import{Ct as e,G as t,J as n,K as r,Q as i,U as a,W as o,X as s,_t as c,bt as l,ht as ee,it as u,mt as d,q as f,tt as p,vt as m,wt as h,xt as g}from"./lz-string-CMojKG3P.js";import{t as _}from"./chunk-pbuEa-1d-DjY3kn7w.js";var v={id:`powerhouse/package`,name:`Vetra Package`,extension:`.phdm`,description:`This document model defines the schema for PH package information.`,author:{name:`Powerhouse`,website:`https://powerhouse.inc`},specifications:[{version:1,changeLog:[],state:{global:{schema:`type VetraPackageState {
  name: String
  description: String
  category: String
  author: Author!
  keywords: [Keyword!]!
  githubUrl: URL
  npmUrl: URL
}

type Author {
  name: String
  website: URL
}

type Keyword {
  id: OID!
  label: String!
}`,initialValue:`{
  "name": null,
  "description": null,
  "category": null,
  "author": {
    "name": null,
    "website": null
  },
  "keywords": [],
  "githubUrl": null,
  "npmUrl": null
}`,examples:[]},local:{schema:``,initialValue:``,examples:[]}},modules:[{id:`a6156f32-8120-43a5-be8b-51c7feaa3460`,name:`base_operations`,description:``,operations:[{id:`33f2eab7-9e07-497f-a4e6-53e50968c3c9`,name:`SET_PACKAGE_NAME`,description:``,schema:`input SetPackageNameInput {
  name: String!
}`,template:``,reducer:``,errors:[],examples:[],scope:`global`},{id:`a07bee80-c2a8-40d7-891b-822ee298d7d9`,name:`SET_PACKAGE_DESCRIPTION`,description:``,schema:`input SetPackageDescriptionInput {
  description: String!
}`,template:``,reducer:``,errors:[],examples:[],scope:`global`},{id:`f3ad82f8-580a-4c6e-b930-e203cda998bb`,name:`SET_PACKAGE_CATEGORY`,description:``,schema:`input SetPackageCategoryInput {
  category: String!
}`,template:``,reducer:``,errors:[],examples:[],scope:`global`},{id:`67f43579-ce98-47e6-bf48-27c0f44818b9`,name:`SET_PACKAGE_AUTHOR`,description:``,schema:`input SetPackageAuthorInput {
  name: OID
  website: URL
}`,template:``,reducer:``,errors:[],examples:[],scope:`global`},{id:`94ba44c4-9627-405e-9ea2-34e9da1c283a`,name:`SET_PACKAGE_AUTHOR_NAME`,description:``,schema:`input SetPackageAuthorNameInput {
  name: String!
}`,template:``,reducer:``,errors:[],examples:[],scope:`global`},{id:`3d5c08df-6c14-480b-915b-875941979fd0`,name:`SET_PACKAGE_AUTHOR_WEBSITE`,description:``,schema:`input SetPackageAuthorWebsiteInput {
  website: URL!
}`,template:``,reducer:``,errors:[],examples:[],scope:`global`},{id:`ed95f841-6fd0-4552-898d-e915599b7495`,name:`ADD_PACKAGE_KEYWORD`,description:``,schema:`input AddPackageKeywordInput {
  id: String!
  label: String!
}`,template:``,reducer:``,errors:[],examples:[],scope:`global`},{id:`83c4db24-bd2f-424d-9e26-751580d6307b`,name:`REMOVE_PACKAGE_KEYWORD`,description:``,schema:`input RemovePackageKeywordInput {
  id: String!
}`,template:``,reducer:``,errors:[],examples:[],scope:`global`},{id:`83a90530-8535-4ea7-ab53-7865532398f7`,name:`SET_PACKAGE_GITHUB_URL`,description:``,schema:`input SetPackageGithubUrlInput {
  url: URL!
}`,template:``,reducer:``,errors:[],examples:[],scope:`global`},{id:`e789859a-01ee-4b60-8e7e-a3ad928a26d1`,name:`SET_PACKAGE_NPM_URL`,description:``,schema:`input SetPackageNpmUrlInput {
  url: URL!
}`,template:``,reducer:``,errors:[],examples:[],scope:`global`}]}]}]},y=e=>e!=null;d().refine(e=>y(e));function b(){return l({id:g(),label:g()})}function te(){return l({__typename:m(`Author`).optional(),name:g().nullish(),website:e().nullish()})}function x(){return l({__typename:m(`Keyword`).optional(),id:g(),label:g()})}function S(){return l({id:g()})}function C(){return l({name:g().nullish(),website:e().nullish()})}function w(){return l({name:g()})}function T(){return l({website:e()})}function E(){return l({category:g()})}function D(){return l({description:g()})}function O(){return l({url:e()})}function k(){return l({name:g()})}function A(){return l({url:e()})}function j(){return l({__typename:m(`VetraPackageState`).optional(),author:c(()=>te()),category:g().nullish(),description:g().nullish(),githubUrl:e().nullish(),keywords:ee(c(()=>x())),name:g().nullish(),npmUrl:e().nullish()})}var M=_({addPackageKeyword:()=>z,removePackageKeyword:()=>B,setPackageAuthor:()=>I,setPackageAuthorName:()=>L,setPackageAuthorWebsite:()=>R,setPackageCategory:()=>F,setPackageDescription:()=>P,setPackageGithubUrl:()=>V,setPackageName:()=>N,setPackageNpmUrl:()=>H}),N=e=>s(`SET_PACKAGE_NAME`,{...e},void 0,k,`global`),P=e=>s(`SET_PACKAGE_DESCRIPTION`,{...e},void 0,D,`global`),F=e=>s(`SET_PACKAGE_CATEGORY`,{...e},void 0,E,`global`),I=e=>s(`SET_PACKAGE_AUTHOR`,{...e},void 0,C,`global`),L=e=>s(`SET_PACKAGE_AUTHOR_NAME`,{...e},void 0,w,`global`),R=e=>s(`SET_PACKAGE_AUTHOR_WEBSITE`,{...e},void 0,T,`global`),z=e=>s(`ADD_PACKAGE_KEYWORD`,{...e},void 0,b,`global`),B=e=>s(`REMOVE_PACKAGE_KEYWORD`,{...e},void 0,S,`global`),V=e=>s(`SET_PACKAGE_GITHUB_URL`,{...e},void 0,O,`global`),H=e=>s(`SET_PACKAGE_NPM_URL`,{...e},void 0,A,`global`),U=`powerhouse/package`,W=a.extend({documentType:m(U)}),G=o.extend({global:j()}),K=l({header:W,state:G,initialState:G});function q(e){return G.safeParse(e).success}function J(e){G.parse(e)}function Y(e){return K.safeParse(e).success}function X(e){K.parse(e)}var Z={setPackageNameOperation(e,t,n){e.name=t.input.name},setPackageDescriptionOperation(e,t,n){e.description=t.input.description},setPackageCategoryOperation(e,t,n){e.category=t.input.category},setPackageAuthorOperation(e,t,n){e.author={name:t.input.name??null,website:t.input.website??null}},setPackageAuthorNameOperation(e,t,n){e.author.name=t.input.name},setPackageAuthorWebsiteOperation(e,t,n){e.author.website=t.input.website},addPackageKeywordOperation(e,t,n){if(e.keywords.find(e=>e.id===t.input.id))throw Error(`Keyword with id "${t.input.id}" already exists`);e.keywords.push(t.input)},removePackageKeywordOperation(e,t,n){e.keywords=e.keywords.filter(e=>e.id!==t.input.id)},setPackageGithubUrlOperation(e,t,n){e.githubUrl=t.input.url},setPackageNpmUrlOperation(e,t,n){e.npmUrl=t.input.url}},Q=i((e,t,n)=>{if(u(t))return e;switch(t.type){case`SET_PACKAGE_NAME`:k().parse(t.input),Z.setPackageNameOperation(e[t.scope],t,n);break;case`SET_PACKAGE_DESCRIPTION`:D().parse(t.input),Z.setPackageDescriptionOperation(e[t.scope],t,n);break;case`SET_PACKAGE_CATEGORY`:E().parse(t.input),Z.setPackageCategoryOperation(e[t.scope],t,n);break;case`SET_PACKAGE_AUTHOR`:C().parse(t.input),Z.setPackageAuthorOperation(e[t.scope],t,n);break;case`SET_PACKAGE_AUTHOR_NAME`:w().parse(t.input),Z.setPackageAuthorNameOperation(e[t.scope],t,n);break;case`SET_PACKAGE_AUTHOR_WEBSITE`:T().parse(t.input),Z.setPackageAuthorWebsiteOperation(e[t.scope],t,n);break;case`ADD_PACKAGE_KEYWORD`:b().parse(t.input),Z.addPackageKeywordOperation(e[t.scope],t,n);break;case`REMOVE_PACKAGE_KEYWORD`:S().parse(t.input),Z.removePackageKeywordOperation(e[t.scope],t,n);break;case`SET_PACKAGE_GITHUB_URL`:O().parse(t.input),Z.setPackageGithubUrlOperation(e[t.scope],t,n);break;case`SET_PACKAGE_NPM_URL`:A().parse(t.input),Z.setPackageNpmUrlOperation(e[t.scope],t,n);break;default:return e}}),ne={name:null,description:null,category:null,author:{name:null,website:null},keywords:[],githubUrl:null,npmUrl:null},re={},$={fileExtension:`.phdm`,createState(e){return{...p(),global:{...ne,...e?.global},local:{...re,...e?.local}}},createDocument(e){let t=r($.createState,e);return t.header.documentType=U,t.header.id=h(),t},saveToFileHandle(e,t){return n(e,t)},loadFromInput(e){return f(e,Q)},isStateOfType(e){return q(e)},assertIsStateOfType(e){return J(e)},isDocumentOfType(e){return Y(e)},assertIsDocumentOfType(e){return X(e)}},ie=_({}),ae={...t,...M},oe={...$,...ie};export{B as a,F as c,N as d,H as f,Q as i,P as l,z as n,L as o,oe as p,v as r,R as s,ae as t,V as u};
//# sourceMappingURL=vetra-package-VqptqKzx-DizZe1eW.js.map