@highstate/designer 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"id":"2a2896ae-2adc-4c6a-ba76-d0ee349bf1e1","timestamp":1787675819423}
1
+ {"id":"896f98e5-6836-4bb1-bc34-632dabf08388","timestamp":1787986474347}
@@ -0,0 +1 @@
1
+ {"id":"896f98e5-6836-4bb1-bc34-632dabf08388","timestamp":1787986474347,"prerendered":[]}
@@ -166,7 +166,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
166
166
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
167
167
  `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){const s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Xr(s,n.start),s.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const r=!this.onKeyLine&&this.indent===e.indent,s=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let i=[];if(s&&n.sep&&!n.value){const o=[];for(let a=0;a<n.sep.length;++a){const c=n.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":s||n.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):s||n.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Et(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(mu(n.key)&&!Et(n.sep,"newline")){const o=Zt(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else i.length>0?n.sep=n.sep.concat(i,this.sourceToken):n.sep.push(this.sourceToken);else if(Et(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=Zt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||s?e.items.push({start:i,key:null,sep:[this.sourceToken]}):Et(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);s||n.value?(e.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Et(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){const r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){const s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Xr(s,n.start),s.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||Et(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){const r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const s=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:s,sep:[]}):n.sep?this.stack.push(s):Object.assign(n,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{const r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){const s=Yn(r),i=Zt(s);po(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
168
168
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
169
- `,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=Yn(e),r=Zt(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Yn(e),r=Zt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Hm(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Km||null,prettyErrors:e}}function Gm(t,e={}){const{lineCounter:n,prettyErrors:r}=Hm(e),s=new Jm(n?.addNewLine),i=new Um(e);let o=null;for(const a of i.compose(s.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new An(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(co(t,n)),o.warnings.forEach(co(t,n))),o}function Wm(t,e,n){let r;const s=Gm(t,n);if(!s)return null;if(s.warnings.forEach(i=>Uc(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:r},n))}var He=R({title:N().optional(),globalTitle:N().optional(),description:N().optional(),color:N().optional(),icon:N().optional(),iconColor:N().optional(),avatarUrl:N().optional(),secondaryIcon:N().optional(),secondaryIconColor:N().optional()}),ke=He.pick({title:!0,description:!0,icon:!0,iconColor:!0}).required({title:!0}),gu=He.pick({title:!0,globalTitle:!0,description:!0,icon:!0,iconColor:!0}).required({title:!0}),yt=He.pick({title:!0,description:!0,avatarUrl:!0,icon:!0,iconColor:!0}).required({title:!0}),Mn=R({createdAt:ce(),updatedAt:ce()}),Ze=N().regex(/^[a-z][a-z0-9-.]+$/,"Name must start with a letter and can only contain lowercase letters, numbers, dashes (-) and dots (.)").min(2).max(64),mn=qt([Ur([Ze,ae("."),ae("v"),Me().int().min(1)]),Ur([Ze,ae("."),Ze,ae("."),ae("v"),Me().int().min(1)]),Ur([Ze,ae("."),Ze,ae("."),Ze,ae("."),ae("v"),Me().int().min(1)])]),Zr=N().regex(/^[a-z][a-zA-Z0-9]+$/,"Field name must start with a letter and be in camelCase format").min(2).max(64),mo=R({type:mn,required:ye(),multiple:ye(),field:N()});R({type:mn,extensions:N().array().optional(),directExtensions:N().array().optional(),inclusions:mo.array().optional(),directInclusions:mo.array().optional(),schema:en(),meta:He.required({title:!0}).pick({title:!0,description:!0,color:!0,icon:!0,iconColor:!0}),definitionHash:Me()});R().loose(),R().loose().toJSONSchema();var Ym=R({type:mn,identity:N(),references:Pe(N(),N().array()).optional(),...He.pick({title:!0,description:!0,icon:!0,iconColor:!0}).shape});R({$meta:Ym});var yu=tt(["composite","unit"]),Xm=Symbol("runtimeSchema");function wn(t){return t.path?`${t.instanceId}:${t.output}:${t.path}`:`${t.instanceId}:${t.output}`}var gs=R({x:Me(),y:Me()}),St=Ur([mn,":",Ze]),rn=R({instanceId:St,output:N(),path:N().optional()}),Xs=R({hubId:N()}),Qm=R({args:Pe(N(),mt()).optional(),inputs:Pe(N(),ve(rn)).optional(),hubInputs:Pe(N(),ve(Xs)).optional(),injectionInputs:ve(Xs).optional(),position:gs.partial().nullable().optional()}),Kr=R({id:St,kind:yu,type:mn,name:Ze,...Qm.shape,position:gs.optional(),resolvedInputs:Pe(N(),ve(rn)).optional(),parentId:St.optional(),outputs:Pe(N(),ve(rn)).optional(),resolvedOutputs:Pe(N(),ve(rn)).optional()}),eg=R({position:gs.partial().nullable().optional(),inputs:ve(rn).optional(),injectionInputs:ve(Xs).optional()}),tg=R({id:ee(),...eg.shape,position:gs.optional()}),ng;(t=>{t.Artifact="d55c63ac-3174-4756-808f-f778e99af0d1",t.Yaml="c857cac5-caa6-4421-b82c-e561fbce6367",t.Secret="240e5789-6ae4-4b22-b9d8-87169e8b4bab"})(ng||={});var rg=R({"c857cac5-caa6-4421-b82c-e561fbce6367":ae(!0),value:N()}),sg=R({name:N(),contentType:N().optional(),size:Me().optional(),mode:Me().optional()}),ig;(t=>{t.Healthy="healthy",t.Degraded="degraded",t.Down="down",t.Warning="warning",t.Progressing="progressing",t.Error="error"})(ig||={});var og=qt([N(),Me(),ye(),N().array()]);R({name:N(),meta:He.pick({title:!0,icon:!0,iconColor:!0}).required({title:!0}),complementaryTo:N().optional(),value:og.optional()});function ag(t){const e=R({"240e5789-6ae4-4b22-b9d8-87169e8b4bab":ae(!0),value:t});return $p(qt([e,t]),e,{decode:n=>typeof n=="object"&&n!==null&&"240e5789-6ae4-4b22-b9d8-87169e8b4bab"in n?n:{"240e5789-6ae4-4b22-b9d8-87169e8b4bab":!0,value:n},encode:n=>n})}var wu=R({schema:en(),[Xm]:Np(Ie).optional(),required:ye(),meta:He.required({title:!0}).pick({title:!0,globalTitle:!0,description:!0,color:!0,icon:!0,iconColor:!0})}),go=R({type:mn,fromInput:Zr.optional(),required:ye(),multiple:ye(),meta:He.required({title:!0}).pick({title:!0,description:!0})}),cg=R({type:Ze,kind:yu,args:Pe(Zr,wu),inputs:Pe(Zr,go),outputs:Pe(Zr,go),meta:He.required({title:!0}).pick({title:!0,description:!0,color:!0,icon:!0,iconColor:!0,secondaryIcon:!0,secondaryIconColor:!0}).extend({category:N().optional(),defaultNamePrefix:N()}),definitionHash:Me()}),ug=wu.extend({readonly:ye(),computed:ye()}),lg=R({package:N(),path:N().optional()});R({...cg.shape,source:lg,secrets:Pe(N(),ug)});function Si(t){return"source"in t}var fg=qt([R({type:ae("before-destroy")})]);R({name:N(),meta:He.pick({title:!0,globalTitle:!0,description:!0,icon:!0,iconColor:!0}).required({title:!0}),spec:fg});var dg=R({name:N()}),hg=R({...rn.shape}),pg=R({value:mt(),source:hg.optional()});R({instanceId:N(),stateId:N(),args:Pe(N(),mt()),inputs:Pe(N(),pg.array()),invokedTriggers:dg.array(),secretValues:Pe(N(),mt()),importBasePath:N()});var yo=new WeakMap;function mg(t){const e=rg.safeParse(t);if(!e.success)return t;const n=yo.get(t);if(n!==void 0)return n;const r=Wm(e.data.value);return yo.set(t,r),r}var gg;(t=>{t.Config="highstate"})(gg||={});var yg=Symbol("unitArtifactId"),wg=R({"d55c63ac-3174-4756-808f-f778e99af0d1":ae(!0),[yg]:N().optional(),hash:N(),meta:ke.optional()}),vg=qt([R({type:ae("embedded"),isBinary:ye().optional(),value:N()}),R({type:ae("embedded-secret"),isBinary:ye().optional(),value:ag(N())}),R({type:ae("artifact"),...wg.shape})]),vu=R({meta:sg,content:vg}),bu=R({image:N(),command:N().array(),cwd:N().optional(),env:Pe(N(),N()).optional(),files:Pe(N(),vu).optional()});R({name:N(),meta:He.pick({title:!0,globalTitle:!0,description:!0,icon:!0,iconColor:!0}).required({title:!0}),spec:bu});var _u=qt([R({type:ae("markdown"),content:N()}),R({type:ae("qr"),content:N(),showContent:Pp(),language:N().optional()}),R({type:ae("file"),file:vu})]);R({name:N(),meta:He.pick({title:!0,globalTitle:!0,description:!0,icon:!0,iconColor:!0}).required({title:!0}),content:_u.array()});R({name:N(),image:N(),params:Pe(N(),mt())});R({projectId:ee(),workerVersionId:ee(),workerInstanceId:ee(),apiUrl:oi(),dataEndpoint:N().min(1),apiKey:N()});Pe(N(),mt());R({});var bg=R({path:N(),content:N(),secret:ye().default(!1),mode:Me().int().optional()}),_g=R({name:N(),containerPort:Me().int().positive().max(65535),protocol:ae("tcp").default("tcp")}),kg=rt("type",[R({type:ae("tcp"),port:N(),timeoutSeconds:Me().int().positive().default(30)}),R({type:ae("http"),port:N(),path:N(),statuses:Me().int().positive().array().default([200]),timeoutSeconds:Me().int().positive().default(30)}),R({type:ae("log"),pattern:N(),timeoutSeconds:Me().int().positive().default(30)})]);R({identity:N().regex(/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/),image:N(),command:N().array().optional(),args:N().array().default([]),env:Pe(N(),N()).default({}),files:bg.array().default([]),ports:_g.array().default([]),readiness:kg.optional()});R({id:N(),host:N(),ports:Pe(N(),R({host:N(),port:Me().int().positive().max(65535)}))});const Sg=R({key:N(),order:tt(["asc","desc"])}),dt=R({search:N().optional(),sortBy:ve(Sg).optional(),pageSize:Me().int().nonnegative().default(0).optional(),pageToken:N().optional()}),$g=rt("type",[R({type:ae("resources"),resourceIds:On(N().min(1))}),R({type:ae("projects"),projectIds:On(ee())}),R({type:ae("project-spaces"),projectSpaceIds:On(ee()),recursive:ye().default(!1)}),R({type:ae("projects-in-spaces"),projectSpaceIds:On(ee()),recursive:ye().default(!1)})]),Eg=ve($g).min(1).refine(t=>new Set(t.map(e=>e.type)).size===t.length,"Restriction types must be unique"),$i=[{title:"Backend",permissions:[{name:"backend.get",title:"View backend",risk:"low"},{name:"backend.update",title:"Update backend",risk:"critical",consequence:"Allows changing backend-wide configuration and security-sensitive settings."},{name:"backend.search",title:"Search backend",risk:"low"}],supportedRestrictions:[]},{title:"Projects",permissions:[{name:"project.get",title:"View projects",risk:"low"},{name:"project.list",title:"List projects",risk:"low"},{name:"project.create",title:"Create projects",risk:"high"},{name:"project.open",title:"Open projects",risk:"high"},{name:"project.unlock",title:"Unlock projects",risk:"critical",consequence:"Allows submitting an identity that decrypts and opens a project."},{name:"project.attach",title:"Attach projects",risk:"high"},{name:"project.detach",title:"Detach projects",risk:"critical",consequence:"Allows disconnecting projects and making their resources unavailable through the backend."},{name:"project.migrate",title:"Migrate projects",risk:"critical",consequence:"Allows moving project data between storage backends and changing where it is controlled."}],supportedRestrictions:["projects","projects-in-spaces"]},{title:"Backend service account project bindings",permissions:[{name:"backend-service-account-project-binding.get",title:"View backend service account project bindings",risk:"low"},{name:"backend-service-account-project-binding.list",title:"List backend service account project bindings",risk:"low"},{name:"backend-service-account-project-binding.create",title:"Create backend service account project bindings",risk:"high"},{name:"backend-service-account-project-binding.update",title:"Update backend service account project bindings",risk:"high"},{name:"backend-service-account-project-binding.delete",title:"Delete backend service account project bindings",risk:"high"},{name:"backend-service-account-project-binding.bind",title:"Bind project service accounts",risk:"critical",consequence:"Allows assigning backend identities to project service accounts and their project permissions."}],supportedRestrictions:["projects","projects-in-spaces"]},{title:"Project spaces",permissions:[{name:"project-space.get",title:"View project spaces",risk:"low"},{name:"project-space.list",title:"List project spaces",risk:"low"},{name:"project-space.create",title:"Create project spaces",risk:"high"},{name:"project-space.update",title:"Update project spaces",risk:"high"},{name:"project-space.delete",title:"Delete project spaces",risk:"critical",consequence:"Allows deleting project-space organization and affecting every project arranged within it."}],supportedRestrictions:["project-spaces"]},{title:"Libraries",permissions:[{name:"library.get",title:"View libraries",risk:"low"},{name:"library.list",title:"List libraries",risk:"low"},{name:"library.manage",title:"Manage libraries",risk:"high"}],supportedRestrictions:["resources"],resourceType:"library"},{title:"Pulumi backends",permissions:[{name:"pulumi-backend.get",title:"View Pulumi backends",risk:"low"},{name:"pulumi-backend.list",title:"List Pulumi backends",risk:"low"},{name:"pulumi-backend.manage",title:"Manage Pulumi backends",risk:"critical",consequence:"Allows changing infrastructure state backends that control deployed resources."}],supportedRestrictions:["resources"],resourceType:"pulumi-backend"},{title:"Project model storages",permissions:[{name:"project-model-storage.get",title:"View project model storages",risk:"low"},{name:"project-model-storage.list",title:"List project model storages",risk:"low"},{name:"project-model-storage.manage",title:"Manage project model storages",risk:"critical",consequence:"Allows changing storage that contains project models and their infrastructure definitions."}],supportedRestrictions:["resources"],resourceType:"project-model-storage"},{title:"Service accounts",permissions:[{name:"service-account.get",title:"View service accounts",risk:"low"},{name:"service-account.list",title:"List service accounts",risk:"low"},{name:"service-account.manage",title:"Manage service accounts",risk:"high"},{name:"service-account.impersonate",title:"Impersonate service accounts",risk:"critical",consequence:"Allows acting with the authority of another backend service account."}],supportedRestrictions:["resources"],resourceType:"backend-service-account"},{title:"API keys",permissions:[{name:"api-key.get",title:"View API keys",risk:"low"},{name:"api-key.list",title:"List API keys",risk:"low"},{name:"api-key.create",title:"Create API keys",risk:"high"},{name:"api-key.update",title:"Update API keys",risk:"high"},{name:"api-key.rotate",title:"Rotate API keys",risk:"high"},{name:"api-key.delete",title:"Delete API keys",risk:"high"},{name:"api-key.escalate",title:"Escalate API key permissions",risk:"critical",consequence:"Allows API keys to receive permissions beyond the caller's current access."}],supportedRestrictions:["resources"],resourceType:"backend-api-key"},{title:"Roles",permissions:[{name:"role.get",title:"View roles",risk:"low"},{name:"role.list",title:"List roles",risk:"low"},{name:"role.create",title:"Create roles",risk:"high"},{name:"role.update",title:"Update roles",risk:"high"},{name:"role.delete",title:"Delete roles",risk:"high"},{name:"role.escalate",title:"Escalate role permissions",risk:"critical",consequence:"Allows roles to receive permissions beyond the caller's current access."}],supportedRestrictions:["resources"],resourceType:"backend-role"},{title:"Role bindings",permissions:[{name:"role-binding.get",title:"View role bindings",risk:"low"},{name:"role-binding.list",title:"List role bindings",risk:"low"},{name:"role-binding.create",title:"Create role bindings",risk:"high"},{name:"role-binding.delete",title:"Delete role bindings",risk:"high"},{name:"role-binding.bind",title:"Bind roles beyond own permissions",risk:"critical",consequence:"Allows granting roles whose permissions exceed the caller's current access."}],supportedRestrictions:[]}],Ig=$i.flatMap(t=>t.permissions.map(e=>e.name)),Ag=tt(Ig),Og=R({permissions:On(Ag),restrictions:Eg.optional()}).strict().superRefine((t,e)=>{const n=$i.filter(r=>r.permissions.some(s=>t.permissions.includes(s.name)));for(const r of t.restrictions??[]){const s=n.find(o=>!o.supportedRestrictions.includes(r.type));if(s&&e.addIssue({code:"custom",message:`Permission group "${s.title}" does not support "${r.type}" restriction`,path:["restrictions"]}),r.type!=="resources")continue;new Set(n.map(o=>"resourceType"in o?o.resourceType:void 0)).size>1&&e.addIssue({code:"custom",message:"Permissions with resource restrictions must use the same resource type",path:["restrictions"]})}}),Ei=ve(Og).min(1);function On(t){return ve(t).min(1).refine(e=>new Set(e).size===e.length,"Values must be unique")}const Tg=Ei.or(Ec([])),Ng=R({meta:ke.extend({title:N().trim().min(1)}),serviceAccountId:ee().optional(),restrictionRules:Tg,expiresAt:ce().nullable()}),Pg=Ng.required({serviceAccountId:!0}).extend({id:ee(),serviceAccountMeta:yt,lastUsedAt:ce().nullable(),...Mn.shape});dt.extend({serviceAccountId:ee().optional()});R({apiKey:Pg,token:N().min(1)});const Cg=R({meta:ke.extend({title:N().trim().min(1)}),rules:Ei});Cg.extend({id:ee(),systemName:Ze.nullable(),...Mn.shape});const xg=R({meta:yt}),jg=xg.extend({id:ee(),systemName:Ze.nullable(),...Mn.shape});jg.extend({rules:ve(Ei.element)});R({roleId:ee(),serviceAccountId:ee(),createdAt:ce()});const Bg=R({backendServiceAccountId:ee(),projectId:ee(),projectServiceAccountId:ee(),createdAt:ce()});R({projectId:ee(),projectMeta:ke,unlocked:ye(),serviceAccounts:ve(R({id:ee(),meta:yt,systemName:Ze.nullable()})),binding:Bg.nullable()});const As=R({id:N().min(1),meta:ke});R({resources:Pe(N(),ve(As)),projects:ve(As),projectSpaces:ve(As)});rt("type",[R({type:ae("host")})]);$i.flatMap(t=>t.permissions.map(e=>e.name));const Dg={id:"q8xbilhwpsn65zjlv5kz44qh"},Rg={id:"n0rfvpl9o77iqf29ff4kk5gf"},zg={id:"pmn9y901jeiz2ydh93045l39"},Fg={id:"qppfcerovu3h22o0x8rlpc3g"};rt("type",[R({type:ae("codebase")}),R({type:ae("database")})]);R({name:Ze,spaceId:ee().default(Dg.id),modelStorageId:ee().default(Fg.id),libraryId:ee().default(Rg.id),pulumiBackendId:ee().default(zg.id),meta:ke});R({id:N(),name:Ze,meta:ke,spaceId:ee(),modelStorageId:ee(),libraryId:ee(),pulumiBackendId:ee(),...Mn.shape});const Mg=R({encryptedIdentities:ve(N()),hasPasskey:ye(),passkeys:ve(R({encryptedIdentity:N(),passkeyIdentity:N()})).default([])});rt("type",[R({type:ae("locked"),unlockSuite:Mg.optional()}),R({type:ae("unlocked")})]);rt("type",[R({type:ae("host")})]);const Ug=He.pick({title:!0,description:!0}).required({title:!0});R({meta:Ug,recipient:N()});tt(["low","medium","high","critical"]);const wo=R({name:N().min(1),title:N().min(1)});rt("risk",[wo.extend({risk:tt(["low","medium","high"])}),wo.extend({risk:ae("critical"),consequence:N().trim().min(1)})]);const Lg=rt("type",[R({type:ae("resources"),resourceIds:Tn(N().min(1))}),R({type:ae("instances"),instanceIds:Tn(St),recursive:ye().default(!1)}),R({type:ae("owners"),serviceAccountIds:Tn(ee())}),R({type:ae("self")}),R({type:ae("workers"),workerIds:Tn(ee())})]),qg=ve(Lg).min(1).refine(t=>new Set(t.map(e=>e.type)).size===t.length,"Restriction types must be unique"),Ii=[{title:"Instance models",permissions:[{name:"instance-model.get",title:"View instance models",risk:"low"},{name:"instance-model.update",title:"Update instance models",risk:"high"}],supportedRestrictions:["instances"]},{title:"Instance states",permissions:[{name:"instance-state.get",title:"View instance states",risk:"low"},{name:"instance-state.list",title:"List instance states",risk:"low"},{name:"instance-status.update",title:"Update instance statuses",risk:"medium"},{name:"instance-state.delete",title:"Forget instance states",risk:"high"}],supportedRestrictions:["instances"]},{title:"Operations",permissions:[{name:"operation.get",title:"View operations",risk:"low"},{name:"operation.list",title:"List operations",risk:"low"},{name:"operation.create",title:"Create operations",risk:"high"},{name:"operation.cancel",title:"Cancel operations",risk:"high"},{name:"operation.logs.get",title:"View operation logs",risk:"medium"}],supportedRestrictions:["resources","instances"],resourceType:"operation"},{title:"Secrets",permissions:[{name:"secret.metadata.get",title:"View secret metadata",risk:"low"},{name:"secret.value.get",title:"View secret values",risk:"high"},{name:"secret.list",title:"List secrets",risk:"low"},{name:"secret.create",title:"Create secrets",risk:"high"},{name:"secret.update",title:"Update secrets",risk:"high"},{name:"secret.delete",title:"Delete secrets",risk:"high"}],supportedRestrictions:["resources","instances","owners","self"],resourceType:"secret"},{title:"Artifacts",permissions:[{name:"artifact.get",title:"View artifacts",risk:"low"},{name:"artifact.list",title:"List artifacts",risk:"low"},{name:"artifact.create",title:"Create artifacts",risk:"medium"},{name:"artifact.delete",title:"Delete artifacts",risk:"high"}],supportedRestrictions:["resources","instances","owners","self"],resourceType:"artifact"},{title:"Terminals",permissions:[{name:"terminal.get",title:"View terminals",risk:"low"},{name:"terminal.list",title:"List terminals",risk:"low"},{name:"terminal.connect",title:"Connect to terminals",risk:"high"},{name:"terminal.create",title:"Create terminals",risk:"high"},{name:"terminal.update",title:"Update terminals",risk:"high"},{name:"terminal.delete",title:"Delete terminals",risk:"high"}],supportedRestrictions:["resources","instances","owners","self"],resourceType:"terminal"},{title:"Pages",permissions:[{name:"page.get",title:"View pages",risk:"low"},{name:"page.list",title:"List pages",risk:"low"},{name:"page.create",title:"Create pages",risk:"medium"},{name:"page.update",title:"Update pages",risk:"medium"},{name:"page.delete",title:"Delete pages",risk:"high"}],supportedRestrictions:["resources","instances","owners","self"],resourceType:"page"},{title:"Panels",permissions:[{name:"panel.get",title:"View panels",risk:"low"},{name:"panel.list",title:"List panels",risk:"low"},{name:"panel.create",title:"Create panels",risk:"medium"},{name:"panel.update",title:"Update panels",risk:"medium"},{name:"panel.delete",title:"Delete panels",risk:"high"}],supportedRestrictions:["resources","instances","owners","self","workers"],resourceType:"panel"},{title:"Workers",permissions:[{name:"worker.get",title:"View workers",risk:"low"},{name:"worker.list",title:"List workers",risk:"low"},{name:"worker.manage",title:"Manage workers",risk:"high"}],supportedRestrictions:["resources","owners","self","workers"],resourceType:"worker"},{title:"Worker versions",permissions:[{name:"worker-version.get",title:"View worker versions",risk:"low"},{name:"worker-version.list",title:"List worker versions",risk:"low"},{name:"worker-version.restart",title:"Restart worker versions",risk:"high"}],supportedRestrictions:["resources","owners","self","workers"],resourceType:"worker-version"},{title:"Entities",permissions:[{name:"entity.get",title:"View entities",risk:"low"},{name:"entity.list",title:"List entities",risk:"low"}],supportedRestrictions:["resources","instances","owners","self"],resourceType:"entity"},{title:"Entity snapshots",permissions:[{name:"entity-snapshot.get",title:"View entity snapshots",risk:"medium"},{name:"entity-snapshot.list",title:"List entity snapshots",risk:"low"}],supportedRestrictions:["resources","instances","owners","self"],resourceType:"entity-snapshot"},{title:"Triggers",permissions:[{name:"trigger.get",title:"View triggers",risk:"low"},{name:"trigger.list",title:"List triggers",risk:"low"}],supportedRestrictions:["resources","instances"],resourceType:"trigger"},{title:"Unlock methods",permissions:[{name:"unlock-method.get",title:"View unlock methods",risk:"low"},{name:"unlock-method.list",title:"List unlock methods",risk:"low"},{name:"unlock-method.create",title:"Create unlock methods",risk:"critical",consequence:"Allows adding identities that can decrypt the project."},{name:"unlock-method.delete",title:"Delete unlock methods",risk:"critical",consequence:"Allows removing identities that can decrypt the project."}],supportedRestrictions:["resources"],resourceType:"unlock-method"},{title:"Service accounts",permissions:[{name:"service-account.get",title:"View service accounts",risk:"low"},{name:"service-account.list",title:"List service accounts",risk:"low"},{name:"service-account.manage",title:"Manage service accounts",risk:"high"},{name:"service-account.impersonate",title:"Impersonate service accounts",risk:"critical",consequence:"Allows acting with the authority of another project service account."}],supportedRestrictions:["resources"],resourceType:"service-account"},{title:"API keys",permissions:[{name:"api-key.get",title:"View API keys",risk:"low"},{name:"api-key.list",title:"List API keys",risk:"low"},{name:"api-key.create",title:"Create API keys",risk:"high"},{name:"api-key.update",title:"Update API keys",risk:"high"},{name:"api-key.rotate",title:"Rotate API keys",risk:"high"},{name:"api-key.delete",title:"Delete API keys",risk:"high"},{name:"api-key.escalate",title:"Escalate API key permissions",risk:"critical",consequence:"Allows API keys to receive permissions beyond the caller's current access."}],supportedRestrictions:["resources","owners","self"],resourceType:"api-key"},{title:"Roles",permissions:[{name:"role.get",title:"View roles",risk:"low"},{name:"role.list",title:"List roles",risk:"low"},{name:"role.create",title:"Create roles",risk:"high"},{name:"role.update",title:"Update roles",risk:"high"},{name:"role.delete",title:"Delete roles",risk:"high"},{name:"role.escalate",title:"Escalate role permissions",risk:"critical",consequence:"Allows roles to receive permissions beyond the caller's current access."}],supportedRestrictions:["resources"],resourceType:"role"},{title:"Role bindings",permissions:[{name:"role-binding.get",title:"View role bindings",risk:"low"},{name:"role-binding.list",title:"List role bindings",risk:"low"},{name:"role-binding.create",title:"Create role bindings",risk:"high"},{name:"role-binding.delete",title:"Delete role bindings",risk:"high"},{name:"role-binding.bind",title:"Bind roles beyond own permissions",risk:"critical",consequence:"Allows granting roles whose permissions exceed the caller's current access."}],supportedRestrictions:[]}],Vg=Ii.flatMap(t=>t.permissions.map(e=>e.name)),Zg=tt(Vg),Kg=R({permissions:Tn(Zg),restrictions:qg.optional()}).strict().superRefine((t,e)=>{const n=Ii.filter(r=>r.permissions.some(s=>t.permissions.includes(s.name)));for(const r of t.restrictions??[]){const s=n.find(o=>!o.supportedRestrictions.includes(r.type));if(s&&e.addIssue({code:"custom",message:`Permission group "${s.title}" does not support "${r.type}" restriction`,path:["restrictions"]}),r.type!=="resources")continue;new Set(n.map(o=>"resourceType"in o?o.resourceType:void 0)).size>1&&e.addIssue({code:"custom",message:"Permissions with resource restrictions must use the same resource type",path:["restrictions"]})}}),Ai=ve(Kg).min(1);function Tn(t){return ve(t).min(1).refine(e=>new Set(e).size===e.length,"Values must be unique")}const ku=He.pick({title:!0,description:!0}).required({title:!0}),Su=Ai.or(Ec([]));R({meta:ku,serviceAccountId:ee().optional(),restrictionRules:Su,expiresAt:ce().nullable()});const Jg=R({id:ee(),meta:ke,serviceAccountId:ee(),serviceAccountMeta:yt.nullable(),restrictionRules:Su,expiresAt:ce().nullable(),lastUsedAt:ce().nullable(),createdAt:ce(),updatedAt:ce(),managed:ye()});dt.extend({serviceAccountId:N().optional()});R({apiKey:Jg,token:N().min(1)});R({id:ee(),hash:N(),size:Me(),meta:ke,createdAt:ce(),updatedAt:ce()});dt.extend({stateId:N().optional(),serviceAccountId:N().optional(),terminalId:N().optional(),pageId:N().optional()});const Hg=R({meta:ke.extend({title:N().trim().min(1)}),rules:Ai});Hg.extend({id:ee(),systemName:Ze.nullable(),...Mn.shape});R({roleId:ee(),serviceAccountId:ee(),createdAt:ce()});const Xn=R({id:N().min(1),title:N()});R({resources:Pe(N(),ve(Xn)),instances:ve(Xn),serviceAccounts:ve(Xn),workers:ve(Xn)});R({id:ee(),meta:ke,systemName:Ze.nullable(),rules:ve(Ai.element)});R({name:N(),meta:ke,value:N(),message:N().optional(),order:Me().min(0).max(100).optional()});R({identity:N().optional(),title:N().optional(),description:N().optional(),icon:N().optional(),iconColor:N().optional()}).passthrough();const Gg=R({id:N(),type:N(),identity:N(),meta:ke,snapshotId:N().optional(),createdAt:ce().optional()});dt.extend({type:N().optional()});const $u=R({id:N(),meta:ke,content:mt(),operationId:N(),stateId:N(),referencedInOutputs:N().array(),exportedInOutputs:N().array(),createdAt:ce()});R({id:N(),entityType:N(),meta:ke,operationId:N(),stateId:N(),createdAt:ce()});R({entity:R({id:N(),type:N(),identity:N()}),snapshot:$u});R({...Gg.shape,lastSnapshot:$u.nullable()});R({id:N(),meta:ke,group:N(),fromSnapshotId:N(),fromEntityId:N(),fromEntityType:N(),fromEntityIdentity:N(),fromEntityMeta:ke,toSnapshotId:N(),toEntityId:N(),toEntityType:N(),toEntityIdentity:N(),toEntityMeta:ke});const Wg=R({stateId:ee(),meta:ke,acquiredAt:ce()});rt("type",[R({type:ae("locked"),locks:Wg.array()}),R({type:ae("unlocked"),stateIds:ve(N())})]);Kr.pick({id:!0,kind:!0,type:!0,name:!0,args:!0,inputs:!0,hubInputs:!0,injectionInputs:!0,position:!0});R({updatedInstances:Kr.array().optional(),updatedHubs:tg.array().optional(),updatedVirtualInstances:Kr.array().optional(),updatedGhostInstances:Kr.array().optional(),deletedInstanceIds:St.array().optional(),deletedHubIds:N().array().optional(),deletedVirtualInstanceIds:St.array().optional(),deletedGhostInstanceIds:St.array().optional()});const Yg=tt(["destroy","preview","update","refresh"]),Xg=R({id:St,parentId:N().optional(),message:N()}),Qg=R({type:Yg,instances:ve(Xg)}),ey=R({forceUpdateDependencies:ye().default(!1),ignoreChangedDependencies:ye().default(!1),ignoreDependencies:ye().default(!1),forceUpdateChildren:ye().default(!1),onlyDestroyGhosts:ye().default(!1),firstDestroyGhosts:ye().default(!1),ignoreGhosts:ye().default(!1),destroyDependentInstances:ye().default(!0),invokeDestroyTriggers:ye().default(!0),deleteUnreachableResources:ye().default(!1),forceDeleteState:ye().default(!1),allowPartialCompositeInstanceUpdate:ye().default(!1),allowPartialCompositeInstanceDestruction:ye().default(!1),refresh:ye().default(!1),debug:ye().default(!1)}).partial(),Eu=tt(["update","preview","destroy","recreate","refresh"]),ty=tt(["pending","running","failing","completed","failed","cancelled","cancelling"]),Iu=He.pick({title:!0,description:!0}).required({title:!0}),ny=R({projectId:N(),type:Eu,instanceIds:ve(St).min(1),options:ey.partial().optional()});ny.extend({meta:Iu,plan:Qg.array().optional()});rt("type",[R({type:ae("updated"),operation:en()}),R({type:ae("deleted"),operationId:N()})]);R({id:ee(),type:Eu,status:ty,meta:Iu,startedAt:ce(),updatedAt:ce(),finishedAt:ce().nullable()});const ry=R({id:ee(),meta:ke,name:N().nullable(),stateId:ee().nullable(),serviceAccountId:ee().nullable(),serviceAccountMeta:yt.nullable(),createdAt:ce(),updatedAt:ce()});dt.extend({serviceAccountId:N().optional(),stateId:N().optional(),artifactId:N().optional()});R({...ry.shape,content:ve(_u)});R({name:N().min(1),meta:ke});R({id:ee(),name:N(),meta:ke,stateId:ee(),serviceAccountId:ee(),serviceAccountMeta:ke,workerVersionId:ee(),workerVersionMeta:ke,workerId:ee(),online:ye(),createdAt:ce(),updatedAt:ce()});R({online:ye()});dt.extend({stateId:ee().optional(),serviceAccountId:ee().optional(),workerVersionId:ee().optional()});R({id:ee(),meta:gu,name:N().nullable(),systemName:N().nullable(),stateId:ee().nullable(),serviceAccountId:ee().nullable(),serviceAccountMeta:yt.nullable(),createdAt:ce(),updatedAt:ce()});dt.extend({serviceAccountId:N().optional(),stateId:N().optional()});const sy=R({meta:yt});sy.extend({id:ee(),meta:yt,systemName:Ze.nullable(),createdAt:ce(),updatedAt:ce()});dt.extend({artifactId:N().optional()});R({stateId:N(),output:N(),path:N().optional()});rt("type",[R({type:ae("updated"),state:en()}),R({type:ae("patched"),stateId:N(),patch:en()}),R({type:ae("patched-batch"),patches:ve(R({stateId:N(),patch:en()}))}),R({type:ae("deleted"),stateId:N()})]);rt("type",[R({type:ae("registered"),stateId:N(),params:Pe(N(),mt())}),R({type:ae("deregistered"),stateId:N()})]);const iy=tt(["active","unavailable"]);R({id:ee(),terminalId:ee(),meta:gu,startedAt:ce(),finishedAt:ce().nullable()});const oy=R({id:ee(),name:N().nullable(),meta:ke,status:iy,stateId:N().nullable(),serviceAccountId:N().nullable(),serviceAccountMeta:yt.nullable(),createdAt:ce(),updatedAt:ce()});dt.extend({serviceAccountId:N().optional(),stateId:N().optional(),artifactId:N().optional()});R({...oy.shape,spec:bu});R({id:ee(),meta:ke,name:N(),stateId:ee(),createdAt:ce(),updatedAt:ce()});dt.extend({stateId:N().optional()});const ay=tt(["password","passkey"]),Qs=He.pick({title:!0,description:!0}).required({title:!0});rt("type",[R({meta:Qs,type:ae("password"),encryptedIdentity:N(),recipient:N()}),R({meta:Qs,type:ae("passkey"),encryptedIdentity:N(),passkeyIdentity:N(),recipient:N()})]);R({id:ee(),type:ay,meta:Qs,recipient:N(),createdAt:ce(),updatedAt:ce()});const cy=R({title:N().min(1),username:N().min(1).optional(),email:Rh().optional(),avatarUrl:oi().optional()}),uy=tt(["local","oidc"]);R({id:ee(),type:uy,meta:cy,createdAt:ce(),updatedAt:ce()});const ly=R({title:N().min(1),description:N().optional(),avatarUrl:oi().optional()});R({id:ee(),meta:ly,createdAt:ce(),updatedAt:ce()});Ii.flatMap(t=>t.permissions.map(e=>e.name));const Au=tt(["unknown","starting","running","stopping","stopped","error"]);R({workerVersionId:ee(),status:Au});R({id:ee(),digest:N(),meta:ke,status:Au,enabled:ye(),apiKeyId:N(),apiKeyMeta:ku,createdAt:ce(),updatedAt:ce()});R({id:ee(),identity:N(),meta:ke,serviceAccountId:N(),serviceAccountMeta:yt,createdAt:ce()});dt.extend({serviceAccountId:N().optional()});function Ou(t){const e=t.visited??new Set,n=t.getInstanceContext(t.input.instanceId);if(!n)return Os({rootType:t.fallbackType,path:t.input.path,entities:void 0,fallbackType:t.fallbackType});const r=n.component.outputs[t.input.output];if(!r)return Os({rootType:t.fallbackType,path:t.input.path,entities:n.entities,fallbackType:t.fallbackType});let s=r.type;if(r.fromInput){const i=`${n.instance.id}:${t.input.output}`;if(!e.has(i)){e.add(i);const o=r.fromInput,a=n.component.inputs[o]?.type??s,c=(n.instance.hubInputs?.[o]?.length??0)>0,u=(n.instance.injectionInputs?.length??0)>0,d=n.instance.inputs?.[o]??[];if(!c&&!u&&d.length===1){const p=d[0];p?s=Ou({input:p,fallbackType:a,getInstanceContext:t.getInstanceContext,visited:e}):s=a}else s=a}}return Os({rootType:s,path:t.input.path,entities:n.entities,fallbackType:t.fallbackType})}function Os(t){const{rootType:e,path:n,entities:r,fallbackType:s}=t;if(!n||!r)return fy(e,s,r);let i=e;const o=n.split(".");for(const a of o){const c=r[i];if(!c)return e;const u=c.inclusions?.find(d=>d.field===a);if(!u)return e;i=u.type}return i}function fy(t,e,n){if(!n||t===e)return t;const r=n[t];return!r||r.extensions?.includes(e)?t:r.inclusions?.find(i=>i.type===e)?e:t}class Oi{constructor(e,n,r,s){this.nodes=e,this.logger=n,this.outputHandler=r,this.dependentSetHandler=s}nodes;logger;outputHandler;dependentSetHandler;workset=new Set;dependencyMap=new Map;dependentMap=new Map;outputMap=new Map;addToWorkset(e){this.workset.add(e)}addAllNodesToWorkset(){for(const e of this.nodes.keys())this.workset.add(e)}get outputs(){return this.outputMap}get dependents(){return this.dependentMap}requireOutput(e){const n=this.outputMap.get(e);if(!n)throw new Error(`Output for node ${e} is not available`);return n}getDependents(e){const n=this.dependentMap.get(e);return n?Array.from(n):[]}invalidate(e){const n=[e];for(;n.length>0;){const r=n.pop();if(!this.nodes.has(r))continue;this.outputMap.delete(r),this.workset.add(r);const s=this.dependentMap.get(r);if(s)for(const i of s)this.outputMap.has(i)&&n.push(i)}}canAddDependency(e,n){if(e===n)return!1;const r=[e],s=new Set;for(;r.length>0;){const i=r.pop();if(i===n)return!1;if(s.has(i))continue;s.add(i);const o=this.dependentMap.get(i);if(o)for(const a of o)this.nodes.has(a)&&r.push(a)}return!0}invalidateSingle(e){this.nodes.has(e)&&(this.outputMap.delete(e),this.workset.add(e))}async process(e){for(;this.workset.size>0;){const n=this.workset.values().next().value,r=[{nodeId:n,resolved:!1,dependencies:[]}];for(;r.length>0;){const s=r[r.length-1],{nodeId:i,resolved:o}=s,a=this.nodes.get(i);if(!a){this.logger.warn({nodeId:i},"node not found in the graph, skipping"),r.pop();continue}if(this.outputMap.has(i)){r.pop();continue}if(!o){s.dependencies=Fp(this.getNodeDependencies(a));let p=!1;for(const h of s.dependencies){if(!this.nodes.has(h)){this.logger.warn({depId:h,nodeId:i},"dependency not found in the graph, skipping");continue}this.outputMap.has(h)||(r.push({nodeId:h,resolved:!1,dependencies:[]}),p=!0)}if(p){s.resolved=!0;continue}}const c=await this.processNode(a,this.logger);if(e?.aborted){this.logger.warn({nodeId:i},"processing aborted, skipping output");return}const u=new Set,d=this.dependencyMap.get(i)??[];for(const p of d){const h=this.dependentMap.get(p);h&&(h.delete(i),u.add(p),h.size===0&&this.dependentMap.delete(p))}for(const p of s.dependencies){let h=this.dependentMap.get(p);h||(h=new Set,this.dependentMap.set(p,h)),h.add(i),u.add(p)}if(this.dependentSetHandler)for(const p of u){const h=this.dependentMap.get(p);this.dependentSetHandler(p,h)}this.outputMap.set(i,c),this.outputHandler?.(i,c),this.dependencyMap.set(i,s.dependencies),r.pop()}this.workset.delete(n)}}}class dy extends Oi{getNodeDependencies(e){const n=[];if(e.kind==="hub"){for(const r of e.hub.inputs??[])n.push(`instance:${r.instanceId}`);for(const r of e.hub.injectionInputs??[])n.push(`hub:${r.hubId}`);return n}for(const r of Object.values(e.instance.inputs??{}))for(const s of r)n.push(`instance:${s.instanceId}`);for(const r of Object.values(e.instance.hubInputs??{}))for(const s of r)n.push(`hub:${s.hubId}`);for(const r of e.instance.injectionInputs??[])n.push(`hub:${r.hubId}`);return n}resolveOutputTypeForInput(e,n){return Ou({input:e,fallbackType:n,getInstanceContext:r=>{const s=this.outputs.get(`instance:${r}`);if(s?.kind==="instance")return{instance:s.instance,component:s.component,entities:s.entities}}})}processNode(e){const n=d=>{const p=this.outputs.get(`hub:${d.hubId}`);if(!p)return{resolvedInputs:[]};if(p.kind!=="hub")throw new Error("Expected hub node");return p},r=d=>{const p=this.outputs.get(`instance:${d.instanceId}`);if(!p)return{component:null,resolvedInputs:[],resolvedOutputs:[]};if(p.kind!=="instance")throw new Error("Expected instance node");return{component:p.component,resolvedInputs:p.resolvedInputs[d.output]??[],resolvedOutputs:p.resolvedOutputs?.[d.output]}};if(e.kind==="hub"){const d=new Map,p=h=>{d.set(wn(h.input),h)};for(const h of e.hub.inputs??[]){const{component:m}=r(h),b=m?.outputs[h.output];if(!b){this.logger.warn({msg:"output not found in the component",input:h,component:m});continue}p({input:h,type:this.resolveOutputTypeForInput(h,b.type)})}for(const h of e.hub.injectionInputs??[]){const{resolvedInputs:m}=n(h);for(const b of m)p(b)}return{kind:"hub",hub:e.hub,resolvedInputs:Array.from(d.values())}}if(e.instance.resolvedInputs)return{kind:"instance",instance:e.instance,component:e.component,entities:e.entities,resolvedInputs:Rp(e.instance.resolvedInputs,(d,p)=>{const h=e.component.inputs[p];return h?d.map(m=>({input:m,type:h.type})):(this.logger.warn({msg:"input not found in the component",inputName:p,component:e.component}),[])}),resolvedOutputs:e.instance.resolvedOutputs??{},resolvedInjectionInputs:[],matchedInjectionInputs:[]};const s=new Map,i=(d,p)=>{let h=s.get(d);h||(h=new Map,s.set(d,h)),h.set(wn(p.input),p)},o=(d,p)=>{const h=e.component.inputs[d],m=e.instance.type===Fu;if(!h&&!m){this.logger.warn({msg:"input not found in the component",input:p,component:e.component});return}const{component:b,resolvedOutputs:w}=r(p);if(!b){this.logger.warn({instanceId:e.instance.id,input:p},"no output found for the input");return}const g=h?.type??b.outputs[p.output]?.type;if(!g){this.logger.warn({instanceId:e.instance.id,input:p,component:b},"cannot resolve input type for dynamic export input");return}if(Si(b)){i(d,{input:p,type:this.resolveOutputTypeForInput(p,g)});return}if(w)for(const k of w)i(d,{input:{...k,path:p.path??k.path},type:this.resolveOutputTypeForInput({instanceId:p.instanceId,output:p.output,path:p.path??k.path},g)});else i(d,{input:p,type:this.resolveOutputTypeForInput(p,g)})};for(const[d,p]of Object.entries(e.instance.inputs??{}))for(const h of p)o(d,h);const a=new Map,c=new Map;for(const d of e.instance.injectionInputs??[]){const{resolvedInputs:p}=n(d);for(const h of p)a.set(wn(h.input),h)}for(const[d,p]of Object.entries(e.component.inputs??{})){const h=new Map(a),m=e.instance.hubInputs?.[d]??[];for(const b of m){const{resolvedInputs:w}=n(b);for(const g of w)h.set(wn(g.input),g)}for(const b of h.values())if(b.type===p.type){o(d,b.input);const w=wn(b.input);a.has(w)&&c.set(w,b)}}const u=Dp(Array.from(s.entries()).map(([d,p])=>[d,Array.from(p.values())]));return{kind:"instance",instance:e.instance,component:e.component,entities:e.entities,resolvedInputs:u,resolvedOutputs:e.instance.resolvedOutputs,resolvedInjectionInputs:Array.from(a.values()),matchedInjectionInputs:Array.from(c.values())}}}function hy(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}const py=t=>new TextEncoder().encode(t);typeof Buffer<"u"&&Buffer.from;function my(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),n=0;n<t.length;)e[n]=t[n],n+=1;return e}return Uint32Array.from(t)}function Ts(t){return new gy().update(t).digest()}var gy=(function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var n,r;try{for(var s=hy(e),i=s.next();!i.done;i=s.next()){var o=i.value;this.checksum=this.checksum>>>8^wy[(this.checksum^o)&255]}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return this},t.prototype.digest=function(){return(this.checksum^4294967295)>>>0},t})(),yy=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],wy=my(yy);function vy(t){const e=t.length;let n=0,r=0;for(;r<e;){let s=t.charCodeAt(r++);if((s&4294967168)===0){n++;continue}else if((s&4294965248)===0)n+=2;else{if(s>=55296&&s<=56319&&r<e){const i=t.charCodeAt(r);(i&64512)===56320&&(++r,s=((s&1023)<<10)+(i&1023)+65536)}(s&4294901760)===0?n+=3:n+=4}}return n}function by(t,e,n){const r=t.length;let s=n,i=0;for(;i<r;){let o=t.charCodeAt(i++);if((o&4294967168)===0){e[s++]=o;continue}else if((o&4294965248)===0)e[s++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&i<r){const a=t.charCodeAt(i);(a&64512)===56320&&(++i,o=((o&1023)<<10)+(a&1023)+65536)}(o&4294901760)===0?(e[s++]=o>>12&15|224,e[s++]=o>>6&63|128):(e[s++]=o>>18&7|240,e[s++]=o>>12&63|128,e[s++]=o>>6&63|128)}e[s++]=o&63|128}}const _y=new TextEncoder,ky=50;function Sy(t,e,n){_y.encodeInto(t,e.subarray(n))}function $y(t,e,n){t.length>ky?Sy(t,e,n):by(t,e,n)}new TextDecoder;class Qn{type;data;constructor(e,n){this.type=e,this.data=n}}class Qr extends Error{constructor(e){super(e);const n=Object.create(Qr.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Qr.name})}}function Ey(t,e,n){const r=n/4294967296,s=n;t.setUint32(e,r),t.setUint32(e+4,s)}function Tu(t,e,n){const r=Math.floor(n/4294967296),s=n;t.setUint32(e,r),t.setUint32(e+4,s)}function Iy(t,e){const n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}const Ay=-1,Oy=4294967296-1,Ty=17179869184-1;function Ny({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=Ty)if(e===0&&t<=Oy){const n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,t),n}else{const n=t/4294967296,r=t&4294967295,s=new Uint8Array(8),i=new DataView(s.buffer);return i.setUint32(0,e<<2|n&3),i.setUint32(4,r),s}else{const n=new Uint8Array(12),r=new DataView(n.buffer);return r.setUint32(0,e),Tu(r,4,t),n}}function Py(t){const e=t.getTime(),n=Math.floor(e/1e3),r=(e-n*1e3)*1e6,s=Math.floor(r/1e9);return{sec:n+s,nsec:r-s*1e9}}function Cy(t){if(t instanceof Date){const e=Py(t);return Ny(e)}else return null}function xy(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const n=e.getUint32(0),r=e.getUint32(4),s=(n&3)*4294967296+r,i=n>>>2;return{sec:s,nsec:i}}case 12:{const n=Iy(e,4),r=e.getUint32(0);return{sec:n,nsec:r}}default:throw new Qr(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function jy(t){const e=xy(t);return new Date(e.sec*1e3+e.nsec/1e6)}const By={type:Ay,encode:Cy,decode:jy};class Ti{static defaultCodec=new Ti;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(By)}register({type:e,encode:n,decode:r}){if(e>=0)this.encoders[e]=n,this.decoders[e]=r;else{const s=-1-e;this.builtInEncoders[s]=n,this.builtInDecoders[s]=r}}tryToEncode(e,n){for(let r=0;r<this.builtInEncoders.length;r++){const s=this.builtInEncoders[r];if(s!=null){const i=s(e,n);if(i!=null){const o=-1-r;return new Qn(o,i)}}}for(let r=0;r<this.encoders.length;r++){const s=this.encoders[r];if(s!=null){const i=s(e,n);if(i!=null){const o=r;return new Qn(o,i)}}}return e instanceof Qn?e:null}decode(e,n,r){const s=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return s?s(e,n,r):new Qn(n,e)}}function Dy(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function Ry(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Dy(t)?new Uint8Array(t):Uint8Array.from(t)}const zy=100,Fy=2048;class Ni{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??Ti.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??zy,this.initialBufferSize=e?.initialBufferSize??Fy,this.sortKeys=e?.sortKeys??!1,this.forceFloat32=e?.forceFloat32??!1,this.ignoreUndefined=e?.ignoreUndefined??!1,this.forceIntegerToFloat=e?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new Ni({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,n){if(n>this.maxDepth)throw new Error(`Too deep objects in depth ${n}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,n)}ensureBufferSizeToWrite(e){const n=this.pos+e;this.view.byteLength<n&&this.resizeBuffer(n*2)}resizeBuffer(e){const n=new ArrayBuffer(e),r=new Uint8Array(n),s=new DataView(n);r.set(this.bytes),this.view=s,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){const r=vy(e);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),$y(e,this.bytes,this.pos),this.pos+=r}encodeObject(e,n){const r=this.extensionCodec.tryToEncode(e,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,n);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,n);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){const n=e.byteLength;if(n<256)this.writeU8(196),this.writeU8(n);else if(n<65536)this.writeU8(197),this.writeU16(n);else if(n<4294967296)this.writeU8(198),this.writeU32(n);else throw new Error(`Too large binary: ${n}`);const r=Ry(e);this.writeU8a(r)}encodeArray(e,n){const r=e.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const s of e)this.doEncode(s,n+1)}countWithoutUndefined(e,n){let r=0;for(const s of n)e[s]!==void 0&&r++;return r}encodeMap(e,n){const r=Object.keys(e);this.sortKeys&&r.sort();const s=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length;if(s<16)this.writeU8(128+s);else if(s<65536)this.writeU8(222),this.writeU16(s);else if(s<4294967296)this.writeU8(223),this.writeU32(s);else throw new Error(`Too large map object: ${s}`);for(const i of r){const o=e[i];this.ignoreUndefined&&o===void 0||(this.encodeString(i),this.doEncode(o,n+1))}}encodeExtension(e){if(typeof e.data=="function"){const r=e.data(this.pos+6),s=r.length;if(s>=4294967296)throw new Error(`Too large extension object: ${s}`);this.writeU8(201),this.writeU32(s),this.writeI8(e.type),this.writeU8a(r);return}const n=e.data.length;if(n===1)this.writeU8(212);else if(n===2)this.writeU8(213);else if(n===4)this.writeU8(214);else if(n===8)this.writeU8(215);else if(n===16)this.writeU8(216);else if(n<256)this.writeU8(199),this.writeU8(n);else if(n<65536)this.writeU8(200),this.writeU16(n);else if(n<4294967296)this.writeU8(201),this.writeU32(n);else throw new Error(`Too large extension object: ${n}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const n=e.length;this.ensureBufferSizeToWrite(n),this.bytes.set(e,this.pos),this.pos+=n}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),Ey(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),Tu(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}}function My(t,e){return new Ni(e).encodeSharedRef(t)}var Ns={},vn={},vo;function Uy(){if(vo)return vn;vo=1,vn.byteLength=a,vn.toByteArray=u,vn.fromByteArray=h;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,i=r.length;s<i;++s)t[s]=r[s],e[r.charCodeAt(s)]=s;e[45]=62,e[95]=63;function o(m){var b=m.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var w=m.indexOf("=");w===-1&&(w=b);var g=w===b?0:4-w%4;return[w,g]}function a(m){var b=o(m),w=b[0],g=b[1];return(w+g)*3/4-g}function c(m,b,w){return(b+w)*3/4-w}function u(m){var b,w=o(m),g=w[0],k=w[1],y=new n(c(m,g,k)),_=0,I=k>0?g-4:g,v;for(v=0;v<I;v+=4)b=e[m.charCodeAt(v)]<<18|e[m.charCodeAt(v+1)]<<12|e[m.charCodeAt(v+2)]<<6|e[m.charCodeAt(v+3)],y[_++]=b>>16&255,y[_++]=b>>8&255,y[_++]=b&255;return k===2&&(b=e[m.charCodeAt(v)]<<2|e[m.charCodeAt(v+1)]>>4,y[_++]=b&255),k===1&&(b=e[m.charCodeAt(v)]<<10|e[m.charCodeAt(v+1)]<<4|e[m.charCodeAt(v+2)]>>2,y[_++]=b>>8&255,y[_++]=b&255),y}function d(m){return t[m>>18&63]+t[m>>12&63]+t[m>>6&63]+t[m&63]}function p(m,b,w){for(var g,k=[],y=b;y<w;y+=3)g=(m[y]<<16&16711680)+(m[y+1]<<8&65280)+(m[y+2]&255),k.push(d(g));return k.join("")}function h(m){for(var b,w=m.length,g=w%3,k=[],y=16383,_=0,I=w-g;_<I;_+=y)k.push(p(m,_,_+y>I?I:_+y));return g===1?(b=m[w-1],k.push(t[b>>2]+t[b<<4&63]+"==")):g===2&&(b=(m[w-2]<<8)+m[w-1],k.push(t[b>>10]+t[b>>4&63]+t[b<<2&63]+"=")),k.join("")}return vn}var er={};var bo;function Ly(){return bo||(bo=1,er.read=function(t,e,n,r,s){var i,o,a=s*8-r-1,c=(1<<a)-1,u=c>>1,d=-7,p=n?s-1:0,h=n?-1:1,m=t[e+p];for(p+=h,i=m&(1<<-d)-1,m>>=-d,d+=a;d>0;i=i*256+t[e+p],p+=h,d-=8);for(o=i&(1<<-d)-1,i>>=-d,d+=r;d>0;o=o*256+t[e+p],p+=h,d-=8);if(i===0)i=1-u;else{if(i===c)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-u}return(m?-1:1)*o*Math.pow(2,i-r)},er.write=function(t,e,n,r,s,i){var o,a,c,u=i*8-s-1,d=(1<<u)-1,p=d>>1,h=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=r?0:i-1,b=r?1:-1,w=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=d):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+p>=1?e+=h/c:e+=h*Math.pow(2,1-p),e*c>=2&&(o++,c/=2),o+p>=d?(a=0,o=d):o+p>=1?(a=(e*c-1)*Math.pow(2,s),o=o+p):(a=e*Math.pow(2,p-1)*Math.pow(2,s),o=0));s>=8;t[n+m]=a&255,m+=b,a/=256,s-=8);for(o=o<<s|a,u+=s;u>0;t[n+m]=o&255,m+=b,o/=256,u-=8);t[n+m-b]|=w*128}),er}var _o;function qy(){return _o||(_o=1,(function(t){const e=Uy(),n=Ly(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=y,t.INSPECT_MAX_BYTES=50;const s=2147483647;t.kMaxLength=s,a.TYPED_ARRAY_SUPPORT=i(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{const S=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(S,l),S.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(S){if(S>s)throw new RangeError('The value "'+S+'" is invalid for option "size"');const l=new Uint8Array(S);return Object.setPrototypeOf(l,a.prototype),l}function a(S,l,f){if(typeof S=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return p(S)}return c(S,l,f)}a.poolSize=8192;function c(S,l,f){if(typeof S=="string")return h(S,l);if(ArrayBuffer.isView(S))return b(S);if(S==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S);if(qe(S,ArrayBuffer)||S&&qe(S.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(qe(S,SharedArrayBuffer)||S&&qe(S.buffer,SharedArrayBuffer)))return w(S,l,f);if(typeof S=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const A=S.valueOf&&S.valueOf();if(A!=null&&A!==S)return a.from(A,l,f);const x=g(S);if(x)return x;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof S[Symbol.toPrimitive]=="function")return a.from(S[Symbol.toPrimitive]("string"),l,f);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S)}a.from=function(S,l,f){return c(S,l,f)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function u(S){if(typeof S!="number")throw new TypeError('"size" argument must be of type number');if(S<0)throw new RangeError('The value "'+S+'" is invalid for option "size"')}function d(S,l,f){return u(S),S<=0?o(S):l!==void 0?typeof f=="string"?o(S).fill(l,f):o(S).fill(l):o(S)}a.alloc=function(S,l,f){return d(S,l,f)};function p(S){return u(S),o(S<0?0:k(S)|0)}a.allocUnsafe=function(S){return p(S)},a.allocUnsafeSlow=function(S){return p(S)};function h(S,l){if((typeof l!="string"||l==="")&&(l="utf8"),!a.isEncoding(l))throw new TypeError("Unknown encoding: "+l);const f=_(S,l)|0;let A=o(f);const x=A.write(S,l);return x!==f&&(A=A.slice(0,x)),A}function m(S){const l=S.length<0?0:k(S.length)|0,f=o(l);for(let A=0;A<l;A+=1)f[A]=S[A]&255;return f}function b(S){if(qe(S,Uint8Array)){const l=new Uint8Array(S);return w(l.buffer,l.byteOffset,l.byteLength)}return m(S)}function w(S,l,f){if(l<0||S.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(S.byteLength<l+(f||0))throw new RangeError('"length" is outside of buffer bounds');let A;return l===void 0&&f===void 0?A=new Uint8Array(S):f===void 0?A=new Uint8Array(S,l):A=new Uint8Array(S,l,f),Object.setPrototypeOf(A,a.prototype),A}function g(S){if(a.isBuffer(S)){const l=k(S.length)|0,f=o(l);return f.length===0||S.copy(f,0,0,l),f}if(S.length!==void 0)return typeof S.length!="number"||Je(S.length)?o(0):m(S);if(S.type==="Buffer"&&Array.isArray(S.data))return m(S.data)}function k(S){if(S>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return S|0}function y(S){return+S!=S&&(S=0),a.alloc(+S)}a.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==a.prototype},a.compare=function(l,f){if(qe(l,Uint8Array)&&(l=a.from(l,l.offset,l.byteLength)),qe(f,Uint8Array)&&(f=a.from(f,f.offset,f.byteLength)),!a.isBuffer(l)||!a.isBuffer(f))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===f)return 0;let A=l.length,x=f.length;for(let z=0,Z=Math.min(A,x);z<Z;++z)if(l[z]!==f[z]){A=l[z],x=f[z];break}return A<x?-1:x<A?1:0},a.isEncoding=function(l){switch(String(l).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(l,f){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return a.alloc(0);let A;if(f===void 0)for(f=0,A=0;A<l.length;++A)f+=l[A].length;const x=a.allocUnsafe(f);let z=0;for(A=0;A<l.length;++A){let Z=l[A];if(qe(Z,Uint8Array))z+Z.length>x.length?(a.isBuffer(Z)||(Z=a.from(Z)),Z.copy(x,z)):Uint8Array.prototype.set.call(x,Z,z);else if(a.isBuffer(Z))Z.copy(x,z);else throw new TypeError('"list" argument must be an Array of Buffers');z+=Z.length}return x};function _(S,l){if(a.isBuffer(S))return S.length;if(ArrayBuffer.isView(S)||qe(S,ArrayBuffer))return S.byteLength;if(typeof S!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof S);const f=S.length,A=arguments.length>2&&arguments[2]===!0;if(!A&&f===0)return 0;let x=!1;for(;;)switch(l){case"ascii":case"latin1":case"binary":return f;case"utf8":case"utf-8":return $e(S).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f*2;case"hex":return f>>>1;case"base64":return Le(S).length;default:if(x)return A?-1:$e(S).length;l=(""+l).toLowerCase(),x=!0}}a.byteLength=_;function I(S,l,f){let A=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((f===void 0||f>this.length)&&(f=this.length),f<=0)||(f>>>=0,l>>>=0,f<=l))return"";for(S||(S="utf8");;)switch(S){case"hex":return ue(this,l,f);case"utf8":case"utf-8":return he(this,l,f);case"ascii":return se(this,l,f);case"latin1":case"binary":return re(this,l,f);case"base64":return ie(this,l,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,l,f);default:if(A)throw new TypeError("Unknown encoding: "+S);S=(S+"").toLowerCase(),A=!0}}a.prototype._isBuffer=!0;function v(S,l,f){const A=S[l];S[l]=S[f],S[f]=A}a.prototype.swap16=function(){const l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let f=0;f<l;f+=2)v(this,f,f+1);return this},a.prototype.swap32=function(){const l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let f=0;f<l;f+=4)v(this,f,f+3),v(this,f+1,f+2);return this},a.prototype.swap64=function(){const l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let f=0;f<l;f+=8)v(this,f,f+7),v(this,f+1,f+6),v(this,f+2,f+5),v(this,f+3,f+4);return this},a.prototype.toString=function(){const l=this.length;return l===0?"":arguments.length===0?he(this,0,l):I.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(l){if(!a.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:a.compare(this,l)===0},a.prototype.inspect=function(){let l="";const f=t.INSPECT_MAX_BYTES;return l=this.toString("hex",0,f).replace(/(.{2})/g,"$1 ").trim(),this.length>f&&(l+=" ... "),"<Buffer "+l+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(l,f,A,x,z){if(qe(l,Uint8Array)&&(l=a.from(l,l.offset,l.byteLength)),!a.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof l);if(f===void 0&&(f=0),A===void 0&&(A=l?l.length:0),x===void 0&&(x=0),z===void 0&&(z=this.length),f<0||A>l.length||x<0||z>this.length)throw new RangeError("out of range index");if(x>=z&&f>=A)return 0;if(x>=z)return-1;if(f>=A)return 1;if(f>>>=0,A>>>=0,x>>>=0,z>>>=0,this===l)return 0;let Z=z-x,me=A-f;const je=Math.min(Z,me),Oe=this.slice(x,z),Be=l.slice(f,A);for(let Ee=0;Ee<je;++Ee)if(Oe[Ee]!==Be[Ee]){Z=Oe[Ee],me=Be[Ee];break}return Z<me?-1:me<Z?1:0};function E(S,l,f,A,x){if(S.length===0)return-1;if(typeof f=="string"?(A=f,f=0):f>2147483647?f=2147483647:f<-2147483648&&(f=-2147483648),f=+f,Je(f)&&(f=x?0:S.length-1),f<0&&(f=S.length+f),f>=S.length){if(x)return-1;f=S.length-1}else if(f<0)if(x)f=0;else return-1;if(typeof l=="string"&&(l=a.from(l,A)),a.isBuffer(l))return l.length===0?-1:O(S,l,f,A,x);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?x?Uint8Array.prototype.indexOf.call(S,l,f):Uint8Array.prototype.lastIndexOf.call(S,l,f):O(S,[l],f,A,x);throw new TypeError("val must be string, number or Buffer")}function O(S,l,f,A,x){let z=1,Z=S.length,me=l.length;if(A!==void 0&&(A=String(A).toLowerCase(),A==="ucs2"||A==="ucs-2"||A==="utf16le"||A==="utf-16le")){if(S.length<2||l.length<2)return-1;z=2,Z/=2,me/=2,f/=2}function je(Be,Ee){return z===1?Be[Ee]:Be.readUInt16BE(Ee*z)}let Oe;if(x){let Be=-1;for(Oe=f;Oe<Z;Oe++)if(je(S,Oe)===je(l,Be===-1?0:Oe-Be)){if(Be===-1&&(Be=Oe),Oe-Be+1===me)return Be*z}else Be!==-1&&(Oe-=Oe-Be),Be=-1}else for(f+me>Z&&(f=Z-me),Oe=f;Oe>=0;Oe--){let Be=!0;for(let Ee=0;Ee<me;Ee++)if(je(S,Oe+Ee)!==je(l,Ee)){Be=!1;break}if(Be)return Oe}return-1}a.prototype.includes=function(l,f,A){return this.indexOf(l,f,A)!==-1},a.prototype.indexOf=function(l,f,A){return E(this,l,f,A,!0)},a.prototype.lastIndexOf=function(l,f,A){return E(this,l,f,A,!1)};function P(S,l,f,A){f=Number(f)||0;const x=S.length-f;A?(A=Number(A),A>x&&(A=x)):A=x;const z=l.length;A>z/2&&(A=z/2);let Z;for(Z=0;Z<A;++Z){const me=parseInt(l.substr(Z*2,2),16);if(Je(me))return Z;S[f+Z]=me}return Z}function q(S,l,f,A){return xe($e(l,S.length-f),S,f,A)}function H(S,l,f,A){return xe(Ue(l),S,f,A)}function G(S,l,f,A){return xe(Le(l),S,f,A)}function Y(S,l,f,A){return xe(Ke(l,S.length-f),S,f,A)}a.prototype.write=function(l,f,A,x){if(f===void 0)x="utf8",A=this.length,f=0;else if(A===void 0&&typeof f=="string")x=f,A=this.length,f=0;else if(isFinite(f))f=f>>>0,isFinite(A)?(A=A>>>0,x===void 0&&(x="utf8")):(x=A,A=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const z=this.length-f;if((A===void 0||A>z)&&(A=z),l.length>0&&(A<0||f<0)||f>this.length)throw new RangeError("Attempt to write outside buffer bounds");x||(x="utf8");let Z=!1;for(;;)switch(x){case"hex":return P(this,l,f,A);case"utf8":case"utf-8":return q(this,l,f,A);case"ascii":case"latin1":case"binary":return H(this,l,f,A);case"base64":return G(this,l,f,A);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y(this,l,f,A);default:if(Z)throw new TypeError("Unknown encoding: "+x);x=(""+x).toLowerCase(),Z=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ie(S,l,f){return l===0&&f===S.length?e.fromByteArray(S):e.fromByteArray(S.slice(l,f))}function he(S,l,f){f=Math.min(S.length,f);const A=[];let x=l;for(;x<f;){const z=S[x];let Z=null,me=z>239?4:z>223?3:z>191?2:1;if(x+me<=f){let je,Oe,Be,Ee;switch(me){case 1:z<128&&(Z=z);break;case 2:je=S[x+1],(je&192)===128&&(Ee=(z&31)<<6|je&63,Ee>127&&(Z=Ee));break;case 3:je=S[x+1],Oe=S[x+2],(je&192)===128&&(Oe&192)===128&&(Ee=(z&15)<<12|(je&63)<<6|Oe&63,Ee>2047&&(Ee<55296||Ee>57343)&&(Z=Ee));break;case 4:je=S[x+1],Oe=S[x+2],Be=S[x+3],(je&192)===128&&(Oe&192)===128&&(Be&192)===128&&(Ee=(z&15)<<18|(je&63)<<12|(Oe&63)<<6|Be&63,Ee>65535&&Ee<1114112&&(Z=Ee))}}Z===null?(Z=65533,me=1):Z>65535&&(Z-=65536,A.push(Z>>>10&1023|55296),Z=56320|Z&1023),A.push(Z),x+=me}return W(A)}const U=4096;function W(S){const l=S.length;if(l<=U)return String.fromCharCode.apply(String,S);let f="",A=0;for(;A<l;)f+=String.fromCharCode.apply(String,S.slice(A,A+=U));return f}function se(S,l,f){let A="";f=Math.min(S.length,f);for(let x=l;x<f;++x)A+=String.fromCharCode(S[x]&127);return A}function re(S,l,f){let A="";f=Math.min(S.length,f);for(let x=l;x<f;++x)A+=String.fromCharCode(S[x]);return A}function ue(S,l,f){const A=S.length;(!l||l<0)&&(l=0),(!f||f<0||f>A)&&(f=A);let x="";for(let z=l;z<f;++z)x+=gn[S[z]];return x}function K(S,l,f){const A=S.slice(l,f);let x="";for(let z=0;z<A.length-1;z+=2)x+=String.fromCharCode(A[z]+A[z+1]*256);return x}a.prototype.slice=function(l,f){const A=this.length;l=~~l,f=f===void 0?A:~~f,l<0?(l+=A,l<0&&(l=0)):l>A&&(l=A),f<0?(f+=A,f<0&&(f=0)):f>A&&(f=A),f<l&&(f=l);const x=this.subarray(l,f);return Object.setPrototypeOf(x,a.prototype),x};function C(S,l,f){if(S%1!==0||S<0)throw new RangeError("offset is not uint");if(S+l>f)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(l,f,A){l=l>>>0,f=f>>>0,A||C(l,f,this.length);let x=this[l],z=1,Z=0;for(;++Z<f&&(z*=256);)x+=this[l+Z]*z;return x},a.prototype.readUintBE=a.prototype.readUIntBE=function(l,f,A){l=l>>>0,f=f>>>0,A||C(l,f,this.length);let x=this[l+--f],z=1;for(;f>0&&(z*=256);)x+=this[l+--f]*z;return x},a.prototype.readUint8=a.prototype.readUInt8=function(l,f){return l=l>>>0,f||C(l,1,this.length),this[l]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(l,f){return l=l>>>0,f||C(l,2,this.length),this[l]|this[l+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(l,f){return l=l>>>0,f||C(l,2,this.length),this[l]<<8|this[l+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(l,f){return l=l>>>0,f||C(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(l,f){return l=l>>>0,f||C(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},a.prototype.readBigUInt64LE=st(function(l){l=l>>>0,V(l,"offset");const f=this[l],A=this[l+7];(f===void 0||A===void 0)&&J(l,this.length-8);const x=f+this[++l]*2**8+this[++l]*2**16+this[++l]*2**24,z=this[++l]+this[++l]*2**8+this[++l]*2**16+A*2**24;return BigInt(x)+(BigInt(z)<<BigInt(32))}),a.prototype.readBigUInt64BE=st(function(l){l=l>>>0,V(l,"offset");const f=this[l],A=this[l+7];(f===void 0||A===void 0)&&J(l,this.length-8);const x=f*2**24+this[++l]*2**16+this[++l]*2**8+this[++l],z=this[++l]*2**24+this[++l]*2**16+this[++l]*2**8+A;return(BigInt(x)<<BigInt(32))+BigInt(z)}),a.prototype.readIntLE=function(l,f,A){l=l>>>0,f=f>>>0,A||C(l,f,this.length);let x=this[l],z=1,Z=0;for(;++Z<f&&(z*=256);)x+=this[l+Z]*z;return z*=128,x>=z&&(x-=Math.pow(2,8*f)),x},a.prototype.readIntBE=function(l,f,A){l=l>>>0,f=f>>>0,A||C(l,f,this.length);let x=f,z=1,Z=this[l+--x];for(;x>0&&(z*=256);)Z+=this[l+--x]*z;return z*=128,Z>=z&&(Z-=Math.pow(2,8*f)),Z},a.prototype.readInt8=function(l,f){return l=l>>>0,f||C(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},a.prototype.readInt16LE=function(l,f){l=l>>>0,f||C(l,2,this.length);const A=this[l]|this[l+1]<<8;return A&32768?A|4294901760:A},a.prototype.readInt16BE=function(l,f){l=l>>>0,f||C(l,2,this.length);const A=this[l+1]|this[l]<<8;return A&32768?A|4294901760:A},a.prototype.readInt32LE=function(l,f){return l=l>>>0,f||C(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},a.prototype.readInt32BE=function(l,f){return l=l>>>0,f||C(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},a.prototype.readBigInt64LE=st(function(l){l=l>>>0,V(l,"offset");const f=this[l],A=this[l+7];(f===void 0||A===void 0)&&J(l,this.length-8);const x=this[l+4]+this[l+5]*2**8+this[l+6]*2**16+(A<<24);return(BigInt(x)<<BigInt(32))+BigInt(f+this[++l]*2**8+this[++l]*2**16+this[++l]*2**24)}),a.prototype.readBigInt64BE=st(function(l){l=l>>>0,V(l,"offset");const f=this[l],A=this[l+7];(f===void 0||A===void 0)&&J(l,this.length-8);const x=(f<<24)+this[++l]*2**16+this[++l]*2**8+this[++l];return(BigInt(x)<<BigInt(32))+BigInt(this[++l]*2**24+this[++l]*2**16+this[++l]*2**8+A)}),a.prototype.readFloatLE=function(l,f){return l=l>>>0,f||C(l,4,this.length),n.read(this,l,!0,23,4)},a.prototype.readFloatBE=function(l,f){return l=l>>>0,f||C(l,4,this.length),n.read(this,l,!1,23,4)},a.prototype.readDoubleLE=function(l,f){return l=l>>>0,f||C(l,8,this.length),n.read(this,l,!0,52,8)},a.prototype.readDoubleBE=function(l,f){return l=l>>>0,f||C(l,8,this.length),n.read(this,l,!1,52,8)};function F(S,l,f,A,x,z){if(!a.isBuffer(S))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>x||l<z)throw new RangeError('"value" argument is out of bounds');if(f+A>S.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(l,f,A,x){if(l=+l,f=f>>>0,A=A>>>0,!x){const me=Math.pow(2,8*A)-1;F(this,l,f,A,me,0)}let z=1,Z=0;for(this[f]=l&255;++Z<A&&(z*=256);)this[f+Z]=l/z&255;return f+A},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(l,f,A,x){if(l=+l,f=f>>>0,A=A>>>0,!x){const me=Math.pow(2,8*A)-1;F(this,l,f,A,me,0)}let z=A-1,Z=1;for(this[f+z]=l&255;--z>=0&&(Z*=256);)this[f+z]=l/Z&255;return f+A},a.prototype.writeUint8=a.prototype.writeUInt8=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,1,255,0),this[f]=l&255,f+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,2,65535,0),this[f]=l&255,this[f+1]=l>>>8,f+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,2,65535,0),this[f]=l>>>8,this[f+1]=l&255,f+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,4,4294967295,0),this[f+3]=l>>>24,this[f+2]=l>>>16,this[f+1]=l>>>8,this[f]=l&255,f+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,4,4294967295,0),this[f]=l>>>24,this[f+1]=l>>>16,this[f+2]=l>>>8,this[f+3]=l&255,f+4};function B(S,l,f,A,x){D(l,A,x,S,f,7);let z=Number(l&BigInt(4294967295));S[f++]=z,z=z>>8,S[f++]=z,z=z>>8,S[f++]=z,z=z>>8,S[f++]=z;let Z=Number(l>>BigInt(32)&BigInt(4294967295));return S[f++]=Z,Z=Z>>8,S[f++]=Z,Z=Z>>8,S[f++]=Z,Z=Z>>8,S[f++]=Z,f}function $(S,l,f,A,x){D(l,A,x,S,f,7);let z=Number(l&BigInt(4294967295));S[f+7]=z,z=z>>8,S[f+6]=z,z=z>>8,S[f+5]=z,z=z>>8,S[f+4]=z;let Z=Number(l>>BigInt(32)&BigInt(4294967295));return S[f+3]=Z,Z=Z>>8,S[f+2]=Z,Z=Z>>8,S[f+1]=Z,Z=Z>>8,S[f]=Z,f+8}a.prototype.writeBigUInt64LE=st(function(l,f=0){return B(this,l,f,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=st(function(l,f=0){return $(this,l,f,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(l,f,A,x){if(l=+l,f=f>>>0,!x){const je=Math.pow(2,8*A-1);F(this,l,f,A,je-1,-je)}let z=0,Z=1,me=0;for(this[f]=l&255;++z<A&&(Z*=256);)l<0&&me===0&&this[f+z-1]!==0&&(me=1),this[f+z]=(l/Z>>0)-me&255;return f+A},a.prototype.writeIntBE=function(l,f,A,x){if(l=+l,f=f>>>0,!x){const je=Math.pow(2,8*A-1);F(this,l,f,A,je-1,-je)}let z=A-1,Z=1,me=0;for(this[f+z]=l&255;--z>=0&&(Z*=256);)l<0&&me===0&&this[f+z+1]!==0&&(me=1),this[f+z]=(l/Z>>0)-me&255;return f+A},a.prototype.writeInt8=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,1,127,-128),l<0&&(l=255+l+1),this[f]=l&255,f+1},a.prototype.writeInt16LE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,2,32767,-32768),this[f]=l&255,this[f+1]=l>>>8,f+2},a.prototype.writeInt16BE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,2,32767,-32768),this[f]=l>>>8,this[f+1]=l&255,f+2},a.prototype.writeInt32LE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,4,2147483647,-2147483648),this[f]=l&255,this[f+1]=l>>>8,this[f+2]=l>>>16,this[f+3]=l>>>24,f+4},a.prototype.writeInt32BE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[f]=l>>>24,this[f+1]=l>>>16,this[f+2]=l>>>8,this[f+3]=l&255,f+4},a.prototype.writeBigInt64LE=st(function(l,f=0){return B(this,l,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=st(function(l,f=0){return $(this,l,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function T(S,l,f,A,x,z){if(f+A>S.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("Index out of range")}function M(S,l,f,A,x){return l=+l,f=f>>>0,x||T(S,l,f,4),n.write(S,l,f,A,23,4),f+4}a.prototype.writeFloatLE=function(l,f,A){return M(this,l,f,!0,A)},a.prototype.writeFloatBE=function(l,f,A){return M(this,l,f,!1,A)};function Q(S,l,f,A,x){return l=+l,f=f>>>0,x||T(S,l,f,8),n.write(S,l,f,A,52,8),f+8}a.prototype.writeDoubleLE=function(l,f,A){return Q(this,l,f,!0,A)},a.prototype.writeDoubleBE=function(l,f,A){return Q(this,l,f,!1,A)},a.prototype.copy=function(l,f,A,x){if(!a.isBuffer(l))throw new TypeError("argument should be a Buffer");if(A||(A=0),!x&&x!==0&&(x=this.length),f>=l.length&&(f=l.length),f||(f=0),x>0&&x<A&&(x=A),x===A||l.length===0||this.length===0)return 0;if(f<0)throw new RangeError("targetStart out of bounds");if(A<0||A>=this.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("sourceEnd out of bounds");x>this.length&&(x=this.length),l.length-f<x-A&&(x=l.length-f+A);const z=x-A;return this===l&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(f,A,x):Uint8Array.prototype.set.call(l,this.subarray(A,x),f),z},a.prototype.fill=function(l,f,A,x){if(typeof l=="string"){if(typeof f=="string"?(x=f,f=0,A=this.length):typeof A=="string"&&(x=A,A=this.length),x!==void 0&&typeof x!="string")throw new TypeError("encoding must be a string");if(typeof x=="string"&&!a.isEncoding(x))throw new TypeError("Unknown encoding: "+x);if(l.length===1){const Z=l.charCodeAt(0);(x==="utf8"&&Z<128||x==="latin1")&&(l=Z)}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(f<0||this.length<f||this.length<A)throw new RangeError("Out of range index");if(A<=f)return this;f=f>>>0,A=A===void 0?this.length:A>>>0,l||(l=0);let z;if(typeof l=="number")for(z=f;z<A;++z)this[z]=l;else{const Z=a.isBuffer(l)?l:a.from(l,x),me=Z.length;if(me===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for(z=0;z<A-f;++z)this[z+f]=Z[z%me]}return this};const X={};function pe(S,l,f){X[S]=class extends f{constructor(){super(),Object.defineProperty(this,"message",{value:l.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${S}]`,this.stack,delete this.name}get code(){return S}set code(x){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:x,writable:!0})}toString(){return`${this.name} [${S}]: ${this.message}`}}}pe("ERR_BUFFER_OUT_OF_BOUNDS",function(S){return S?`${S} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),pe("ERR_INVALID_ARG_TYPE",function(S,l){return`The "${S}" argument must be of type number. Received type ${typeof l}`},TypeError),pe("ERR_OUT_OF_RANGE",function(S,l,f){let A=`The value of "${S}" is out of range.`,x=f;return Number.isInteger(f)&&Math.abs(f)>2**32?x=oe(String(f)):typeof f=="bigint"&&(x=String(f),(f>BigInt(2)**BigInt(32)||f<-(BigInt(2)**BigInt(32)))&&(x=oe(x)),x+="n"),A+=` It must be ${l}. Received ${x}`,A},RangeError);function oe(S){let l="",f=S.length;const A=S[0]==="-"?1:0;for(;f>=A+4;f-=3)l=`_${S.slice(f-3,f)}${l}`;return`${S.slice(0,f)}${l}`}function j(S,l,f){V(l,"offset"),(S[l]===void 0||S[l+f]===void 0)&&J(l,S.length-(f+1))}function D(S,l,f,A,x,z){if(S>f||S<l){const Z=typeof l=="bigint"?"n":"";let me;throw l===0||l===BigInt(0)?me=`>= 0${Z} and < 2${Z} ** ${(z+1)*8}${Z}`:me=`>= -(2${Z} ** ${(z+1)*8-1}${Z}) and < 2 ** ${(z+1)*8-1}${Z}`,new X.ERR_OUT_OF_RANGE("value",me,S)}j(A,x,z)}function V(S,l){if(typeof S!="number")throw new X.ERR_INVALID_ARG_TYPE(l,"number",S)}function J(S,l,f){throw Math.floor(S)!==S?(V(S,f),new X.ERR_OUT_OF_RANGE("offset","an integer",S)):l<0?new X.ERR_BUFFER_OUT_OF_BOUNDS:new X.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${l}`,S)}const ne=/[^+/0-9A-Za-z-_]/g;function le(S){if(S=S.split("=")[0],S=S.trim().replace(ne,""),S.length<2)return"";for(;S.length%4!==0;)S=S+"=";return S}function $e(S,l){l=l||1/0;let f;const A=S.length;let x=null;const z=[];for(let Z=0;Z<A;++Z){if(f=S.charCodeAt(Z),f>55295&&f<57344){if(!x){if(f>56319){(l-=3)>-1&&z.push(239,191,189);continue}else if(Z+1===A){(l-=3)>-1&&z.push(239,191,189);continue}x=f;continue}if(f<56320){(l-=3)>-1&&z.push(239,191,189),x=f;continue}f=(x-55296<<10|f-56320)+65536}else x&&(l-=3)>-1&&z.push(239,191,189);if(x=null,f<128){if((l-=1)<0)break;z.push(f)}else if(f<2048){if((l-=2)<0)break;z.push(f>>6|192,f&63|128)}else if(f<65536){if((l-=3)<0)break;z.push(f>>12|224,f>>6&63|128,f&63|128)}else if(f<1114112){if((l-=4)<0)break;z.push(f>>18|240,f>>12&63|128,f>>6&63|128,f&63|128)}else throw new Error("Invalid code point")}return z}function Ue(S){const l=[];for(let f=0;f<S.length;++f)l.push(S.charCodeAt(f)&255);return l}function Ke(S,l){let f,A,x;const z=[];for(let Z=0;Z<S.length&&!((l-=2)<0);++Z)f=S.charCodeAt(Z),A=f>>8,x=f%256,z.push(x),z.push(A);return z}function Le(S){return e.toByteArray(le(S))}function xe(S,l,f,A){let x;for(x=0;x<A&&!(x+f>=l.length||x>=S.length);++x)l[x+f]=S[x];return x}function qe(S,l){return S instanceof l||S!=null&&S.constructor!=null&&S.constructor.name!=null&&S.constructor.name===l.name}function Je(S){return S!==S}const gn=(function(){const S="0123456789abcdef",l=new Array(256);for(let f=0;f<16;++f){const A=f*16;for(let x=0;x<16;++x)l[A+x]=S[f]+S[x]}return l})();function st(S){return typeof BigInt>"u"?Ct:S}function Ct(){throw new Error("BigInt not supported")}})(Ns)),Ns}var bn=qy();function Kt(t){const e=new ArrayBuffer(4);return new DataView(e).setInt32(0,t,!0),new Uint8Array(e)}class Vy extends Oi{getNodeDependencies({resolvedInputs:e}){const n=[];for(const r of Object.values(e??{}))for(const s of r)n.push(s.input.instanceId);return n}processNode({instance:e,component:n,resolvedInputs:r,sourceHash:s,state:i}){const o=[];o.push(bn.Buffer.from(e.id)),o.push(Kt(n.definitionHash)),i?.inputHashNonce&&o.push(Kt(i.inputHashNonce)),e.args&&o.push(My(e.args)),s?o.push(Kt(s)):Si(n)&&this.logger.warn({instanceId:e.id},"missing source hash for unit model, this may lead to incorrect input hash");const a=[...o],c=Object.entries(r).sort(([h],[m])=>h.localeCompare(m)),u=new Set;for(const[h,m]of c){if(Object.keys(m).length===0)continue;a.push(bn.Buffer.from(h));const b=m.map(w=>w.input.instanceId).sort();for(const w of b){const g=this.outputs.get(w);if(!g){this.logger.warn({instanceId:w,dependentInstanceId:e.id},"missing dependency when calculating input hash, this may lead to incorrect input hash");continue}a.push(Kt(g.inputHash)),a.push(Kt(g.outputHash)),u.add(w)}}const d=[],p=Array.from(u).sort();for(const h of p){const m=this.outputs.get(h);if(!m){this.logger.warn({instanceId:h,dependentInstanceId:e.id},"missing dependency when calculating dependency output hash, this may lead to incorrect input hash");continue}d.push(Kt(m.outputHash))}return{selfHash:Ts(bn.Buffer.concat(o)),inputHash:Ts(bn.Buffer.concat(a)),dependencyOutputHash:Ts(bn.Buffer.concat(d)),outputHash:i?.outputHash??0}}}var tr={exports:{}},Ps={},wt={},xt={},Cs={},xs={},js={},ko;function es(){return ko||(ko=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends e{constructor(y){if(super(),!t.IDENTIFIER.test(y))throw new Error("CodeGen: name must be a valid identifier");this.str=y}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=n;class r extends e{constructor(y){super(),this._items=typeof y=="string"?[y]:y}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const y=this._items[0];return y===""||y==='""'}get str(){var y;return(y=this._str)!==null&&y!==void 0?y:this._str=this._items.reduce((_,I)=>`${_}${I}`,"")}get names(){var y;return(y=this._names)!==null&&y!==void 0?y:this._names=this._items.reduce((_,I)=>(I instanceof n&&(_[I.str]=(_[I.str]||0)+1),_),{})}}t._Code=r,t.nil=new r("");function s(k,...y){const _=[k[0]];let I=0;for(;I<y.length;)a(_,y[I]),_.push(k[++I]);return new r(_)}t._=s;const i=new r("+");function o(k,...y){const _=[m(k[0])];let I=0;for(;I<y.length;)_.push(i),a(_,y[I]),_.push(i,m(k[++I]));return c(_),new r(_)}t.str=o;function a(k,y){y instanceof r?k.push(...y._items):y instanceof n?k.push(y):k.push(p(y))}t.addCodeArg=a;function c(k){let y=1;for(;y<k.length-1;){if(k[y]===i){const _=u(k[y-1],k[y+1]);if(_!==void 0){k.splice(y-1,3,_);continue}k[y++]="+"}y++}}function u(k,y){if(y==='""')return k;if(k==='""')return y;if(typeof k=="string")return y instanceof n||k[k.length-1]!=='"'?void 0:typeof y!="string"?`${k.slice(0,-1)}${y}"`:y[0]==='"'?k.slice(0,-1)+y.slice(1):void 0;if(typeof y=="string"&&y[0]==='"'&&!(k instanceof n))return`"${k}${y.slice(1)}`}function d(k,y){return y.emptyStr()?k:k.emptyStr()?y:o`${k}${y}`}t.strConcat=d;function p(k){return typeof k=="number"||typeof k=="boolean"||k===null?k:m(Array.isArray(k)?k.join(","):k)}function h(k){return new r(m(k))}t.stringify=h;function m(k){return JSON.stringify(k).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=m;function b(k){return typeof k=="string"&&t.IDENTIFIER.test(k)?new r(`.${k}`):s`[${k}]`}t.getProperty=b;function w(k){if(typeof k=="string"&&t.IDENTIFIER.test(k))return new r(`${k}`);throw new Error(`CodeGen: invalid export name: ${k}, use explicit $id name mapping`)}t.getEsmExportName=w;function g(k){return new r(k.toString())}t.regexpCode=g})(js)),js}var Bs={},So;function $o(){return So||(So=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=es();class n extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var r;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(r||(t.UsedValueState=r={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class s{constructor({prefixes:u,parent:d}={}){this._names={},this._prefixes=u,this._parent=d}toName(u){return u instanceof e.Name?u:this.name(u)}name(u){return new e.Name(this._newName(u))}_newName(u){const d=this._names[u]||this._nameGroup(u);return`${u}${d.index++}`}_nameGroup(u){var d,p;if(!((p=(d=this._parent)===null||d===void 0?void 0:d._prefixes)===null||p===void 0)&&p.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}t.Scope=s;class i extends e.Name{constructor(u,d){super(d),this.prefix=u}setValue(u,{property:d,itemIndex:p}){this.value=u,this.scopePath=(0,e._)`.${new e.Name(d)}[${p}]`}}t.ValueScopeName=i;const o=(0,e._)`\n`;class a extends s{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?o:e.nil}}get(){return this._scope}name(u){return new i(u,this._newName(u))}value(u,d){var p;if(d.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const h=this.toName(u),{prefix:m}=h,b=(p=d.key)!==null&&p!==void 0?p:d.ref;let w=this._values[m];if(w){const y=w.get(b);if(y)return y}else w=this._values[m]=new Map;w.set(b,h);const g=this._scope[m]||(this._scope[m]=[]),k=g.length;return g[k]=d.ref,h.setValue(d,{property:m,itemIndex:k}),h}getValue(u,d){const p=this._values[u];if(p)return p.get(d)}scopeRefs(u,d=this._values){return this._reduceValues(d,p=>{if(p.scopePath===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return(0,e._)`${u}${p.scopePath}`})}scopeCode(u=this._values,d,p){return this._reduceValues(u,h=>{if(h.value===void 0)throw new Error(`CodeGen: name "${h}" has no value`);return h.value.code},d,p)}_reduceValues(u,d,p={},h){let m=e.nil;for(const b in u){const w=u[b];if(!w)continue;const g=p[b]=p[b]||new Map;w.forEach(k=>{if(g.has(k))return;g.set(k,r.Started);let y=d(k);if(y){const _=this.opts.es5?t.varKinds.var:t.varKinds.const;m=(0,e._)`${m}${_} ${k} = ${y};${this.opts._n}`}else if(y=h?.(k))m=(0,e._)`${m}${y}${this.opts._n}`;else throw new n(k);g.set(k,r.Completed)})}return m}}t.ValueScope=a})(Bs)),Bs}var Eo;function ge(){return Eo||(Eo=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=es(),n=$o();var r=es();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}});var s=$o();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class i{optimizeNodes(){return this}optimizeNames($,T){return this}}class o extends i{constructor($,T,M){super(),this.varKind=$,this.name=T,this.rhs=M}render({es5:$,_n:T}){const M=$?n.varKinds.var:this.varKind,Q=this.rhs===void 0?"":` = ${this.rhs}`;return`${M} ${this.name}${Q};`+T}optimizeNames($,T){if($[this.name.str])return this.rhs&&(this.rhs=he(this.rhs,$,T)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class a extends i{constructor($,T,M){super(),this.lhs=$,this.rhs=T,this.sideEffects=M}render({_n:$}){return`${this.lhs} = ${this.rhs};`+$}optimizeNames($,T){if(!(this.lhs instanceof e.Name&&!$[this.lhs.str]&&!this.sideEffects))return this.rhs=he(this.rhs,$,T),this}get names(){const $=this.lhs instanceof e.Name?{}:{...this.lhs.names};return ie($,this.rhs)}}class c extends a{constructor($,T,M,Q){super($,M,Q),this.op=T}render({_n:$}){return`${this.lhs} ${this.op}= ${this.rhs};`+$}}class u extends i{constructor($){super(),this.label=$,this.names={}}render({_n:$}){return`${this.label}:`+$}}class d extends i{constructor($){super(),this.label=$,this.names={}}render({_n:$}){return`break${this.label?` ${this.label}`:""};`+$}}class p extends i{constructor($){super(),this.error=$}render({_n:$}){return`throw ${this.error};`+$}get names(){return this.error.names}}class h extends i{constructor($){super(),this.code=$}render({_n:$}){return`${this.code};`+$}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames($,T){return this.code=he(this.code,$,T),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class m extends i{constructor($=[]){super(),this.nodes=$}render($){return this.nodes.reduce((T,M)=>T+M.render($),"")}optimizeNodes(){const{nodes:$}=this;let T=$.length;for(;T--;){const M=$[T].optimizeNodes();Array.isArray(M)?$.splice(T,1,...M):M?$[T]=M:$.splice(T,1)}return $.length>0?this:void 0}optimizeNames($,T){const{nodes:M}=this;let Q=M.length;for(;Q--;){const X=M[Q];X.optimizeNames($,T)||(U($,X.names),M.splice(Q,1))}return M.length>0?this:void 0}get names(){return this.nodes.reduce(($,T)=>Y($,T.names),{})}}class b extends m{render($){return"{"+$._n+super.render($)+"}"+$._n}}class w extends m{}class g extends b{}g.kind="else";class k extends b{constructor($,T){super(T),this.condition=$}render($){let T=`if(${this.condition})`+super.render($);return this.else&&(T+="else "+this.else.render($)),T}optimizeNodes(){super.optimizeNodes();const $=this.condition;if($===!0)return this.nodes;let T=this.else;if(T){const M=T.optimizeNodes();T=this.else=Array.isArray(M)?new g(M):M}if(T)return $===!1?T instanceof k?T:T.nodes:this.nodes.length?this:new k(W($),T instanceof k?[T]:T.nodes);if(!($===!1||!this.nodes.length))return this}optimizeNames($,T){var M;if(this.else=(M=this.else)===null||M===void 0?void 0:M.optimizeNames($,T),!!(super.optimizeNames($,T)||this.else))return this.condition=he(this.condition,$,T),this}get names(){const $=super.names;return ie($,this.condition),this.else&&Y($,this.else.names),$}}k.kind="if";class y extends b{}y.kind="for";class _ extends y{constructor($){super(),this.iteration=$}render($){return`for(${this.iteration})`+super.render($)}optimizeNames($,T){if(super.optimizeNames($,T))return this.iteration=he(this.iteration,$,T),this}get names(){return Y(super.names,this.iteration.names)}}class I extends y{constructor($,T,M,Q){super(),this.varKind=$,this.name=T,this.from=M,this.to=Q}render($){const T=$.es5?n.varKinds.var:this.varKind,{name:M,from:Q,to:X}=this;return`for(${T} ${M}=${Q}; ${M}<${X}; ${M}++)`+super.render($)}get names(){const $=ie(super.names,this.from);return ie($,this.to)}}class v extends y{constructor($,T,M,Q){super(),this.loop=$,this.varKind=T,this.name=M,this.iterable=Q}render($){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render($)}optimizeNames($,T){if(super.optimizeNames($,T))return this.iterable=he(this.iterable,$,T),this}get names(){return Y(super.names,this.iterable.names)}}class E extends b{constructor($,T,M){super(),this.name=$,this.args=T,this.async=M}render($){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render($)}}E.kind="func";class O extends m{render($){return"return "+super.render($)}}O.kind="return";class P extends b{render($){let T="try"+super.render($);return this.catch&&(T+=this.catch.render($)),this.finally&&(T+=this.finally.render($)),T}optimizeNodes(){var $,T;return super.optimizeNodes(),($=this.catch)===null||$===void 0||$.optimizeNodes(),(T=this.finally)===null||T===void 0||T.optimizeNodes(),this}optimizeNames($,T){var M,Q;return super.optimizeNames($,T),(M=this.catch)===null||M===void 0||M.optimizeNames($,T),(Q=this.finally)===null||Q===void 0||Q.optimizeNames($,T),this}get names(){const $=super.names;return this.catch&&Y($,this.catch.names),this.finally&&Y($,this.finally.names),$}}class q extends b{constructor($){super(),this.error=$}render($){return`catch(${this.error})`+super.render($)}}q.kind="catch";class H extends b{render($){return"finally"+super.render($)}}H.kind="finally";class G{constructor($,T={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...T,_n:T.lines?`
169
+ `,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=Yn(e),r=Zt(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Yn(e),r=Zt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Hm(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Km||null,prettyErrors:e}}function Gm(t,e={}){const{lineCounter:n,prettyErrors:r}=Hm(e),s=new Jm(n?.addNewLine),i=new Um(e);let o=null;for(const a of i.compose(s.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new An(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(co(t,n)),o.warnings.forEach(co(t,n))),o}function Wm(t,e,n){let r;const s=Gm(t,n);if(!s)return null;if(s.warnings.forEach(i=>Uc(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:r},n))}var He=R({title:N().optional(),globalTitle:N().optional(),description:N().optional(),color:N().optional(),icon:N().optional(),iconColor:N().optional(),avatarUrl:N().optional(),secondaryIcon:N().optional(),secondaryIconColor:N().optional()}),ke=He.pick({title:!0,description:!0,icon:!0,iconColor:!0}).required({title:!0}),gu=He.pick({title:!0,globalTitle:!0,description:!0,icon:!0,iconColor:!0}).required({title:!0}),yt=He.pick({title:!0,description:!0,avatarUrl:!0,icon:!0,iconColor:!0}).required({title:!0}),Mn=R({createdAt:ce(),updatedAt:ce()}),Ze=N().regex(/^[a-z][a-z0-9-.]+$/,"Name must start with a letter and can only contain lowercase letters, numbers, dashes (-) and dots (.)").min(2).max(64),mn=qt([Ur([Ze,ae("."),ae("v"),Me().int().min(1)]),Ur([Ze,ae("."),Ze,ae("."),ae("v"),Me().int().min(1)]),Ur([Ze,ae("."),Ze,ae("."),Ze,ae("."),ae("v"),Me().int().min(1)])]),Zr=N().regex(/^[a-z][a-zA-Z0-9]+$/,"Field name must start with a letter and be in camelCase format").min(2).max(64),mo=R({type:mn,required:ye(),multiple:ye(),field:N()});R({type:mn,extensions:N().array().optional(),directExtensions:N().array().optional(),inclusions:mo.array().optional(),directInclusions:mo.array().optional(),schema:en(),meta:He.required({title:!0}).pick({title:!0,description:!0,color:!0,icon:!0,iconColor:!0}),definitionHash:Me()});R().loose(),R().loose().toJSONSchema();var Ym=R({type:mn,identity:N(),references:Pe(N(),N().array()).optional(),...He.pick({title:!0,description:!0,icon:!0,iconColor:!0}).shape});R({$meta:Ym});var yu=tt(["composite","unit"]),Xm=Symbol("runtimeSchema");function wn(t){return t.path?`${t.instanceId}:${t.output}:${t.path}`:`${t.instanceId}:${t.output}`}var gs=R({x:Me(),y:Me()}),St=Ur([mn,":",Ze]),rn=R({instanceId:St,output:N(),path:N().optional()}),Xs=R({hubId:N()}),Qm=R({args:Pe(N(),mt()).optional(),inputs:Pe(N(),ve(rn)).optional(),hubInputs:Pe(N(),ve(Xs)).optional(),injectionInputs:ve(Xs).optional(),position:gs.partial().nullable().optional()}),Kr=R({id:St,kind:yu,type:mn,name:Ze,...Qm.shape,position:gs.optional(),resolvedInputs:Pe(N(),ve(rn)).optional(),parentId:St.optional(),outputs:Pe(N(),ve(rn)).optional(),resolvedOutputs:Pe(N(),ve(rn)).optional()}),eg=R({position:gs.partial().nullable().optional(),inputs:ve(rn).optional(),injectionInputs:ve(Xs).optional()}),tg=R({id:ee(),...eg.shape,position:gs.optional()}),ng;(t=>{t.Artifact="d55c63ac-3174-4756-808f-f778e99af0d1",t.Yaml="c857cac5-caa6-4421-b82c-e561fbce6367",t.Secret="240e5789-6ae4-4b22-b9d8-87169e8b4bab"})(ng||={});var rg=R({"c857cac5-caa6-4421-b82c-e561fbce6367":ae(!0),value:N()}),sg=R({name:N(),contentType:N().optional(),size:Me().optional(),mode:Me().optional()}),ig;(t=>{t.Healthy="healthy",t.Degraded="degraded",t.Down="down",t.Warning="warning",t.Progressing="progressing",t.Error="error"})(ig||={});var og=qt([N(),Me(),ye(),N().array()]);R({name:N(),meta:He.pick({title:!0,icon:!0,iconColor:!0}).required({title:!0}),complementaryTo:N().optional(),value:og.optional()});function ag(t){const e=R({"240e5789-6ae4-4b22-b9d8-87169e8b4bab":ae(!0),value:t});return $p(qt([e,t]),e,{decode:n=>typeof n=="object"&&n!==null&&"240e5789-6ae4-4b22-b9d8-87169e8b4bab"in n?n:{"240e5789-6ae4-4b22-b9d8-87169e8b4bab":!0,value:n},encode:n=>n})}var wu=R({schema:en(),[Xm]:Np(Ie).optional(),required:ye(),meta:He.required({title:!0}).pick({title:!0,globalTitle:!0,description:!0,color:!0,icon:!0,iconColor:!0})}),go=R({type:mn,fromInput:Zr.optional(),required:ye(),multiple:ye(),meta:He.required({title:!0}).pick({title:!0,description:!0})}),cg=R({type:Ze,kind:yu,args:Pe(Zr,wu),inputs:Pe(Zr,go),outputs:Pe(Zr,go),meta:He.required({title:!0}).pick({title:!0,description:!0,color:!0,icon:!0,iconColor:!0,secondaryIcon:!0,secondaryIconColor:!0}).extend({category:N().optional(),defaultNamePrefix:N()}),definitionHash:Me()}),ug=wu.extend({readonly:ye(),computed:ye()}),lg=R({package:N(),path:N().optional()});R({...cg.shape,source:lg,secrets:Pe(N(),ug)});function Si(t){return"source"in t}var fg=qt([R({type:ae("before-destroy")})]);R({name:N(),meta:He.pick({title:!0,globalTitle:!0,description:!0,icon:!0,iconColor:!0}).required({title:!0}),spec:fg});var dg=R({name:N()}),hg=R({...rn.shape}),pg=R({value:mt(),source:hg.optional()});R({instanceId:N(),stateId:N(),args:Pe(N(),mt()),inputs:Pe(N(),pg.array()),invokedTriggers:dg.array(),secretValues:Pe(N(),mt()),importBasePath:N()});var yo=new WeakMap;function mg(t){const e=rg.safeParse(t);if(!e.success)return t;const n=yo.get(t);if(n!==void 0)return n;const r=Wm(e.data.value);return yo.set(t,r),r}var gg;(t=>{t.Config="highstate"})(gg||={});var yg=Symbol("unitArtifactId"),wg=R({"d55c63ac-3174-4756-808f-f778e99af0d1":ae(!0),[yg]:N().optional(),hash:N(),meta:ke.optional()}),vg=qt([R({type:ae("embedded"),isBinary:ye().optional(),value:N()}),R({type:ae("embedded-secret"),isBinary:ye().optional(),value:ag(N())}),R({type:ae("artifact"),...wg.shape})]),vu=R({meta:sg,content:vg}),bu=R({image:N(),command:N().array(),cwd:N().optional(),env:Pe(N(),N()).optional(),files:Pe(N(),vu).optional()});R({name:N(),meta:He.pick({title:!0,globalTitle:!0,description:!0,icon:!0,iconColor:!0}).required({title:!0}),spec:bu});var _u=qt([R({type:ae("markdown"),content:N()}),R({type:ae("qr"),content:N(),showContent:Pp(),language:N().optional()}),R({type:ae("file"),file:vu})]);R({name:N(),meta:He.pick({title:!0,globalTitle:!0,description:!0,icon:!0,iconColor:!0}).required({title:!0}),content:_u.array()});R({name:N(),image:N(),params:Pe(N(),mt())});R({projectId:ee(),workerVersionId:ee(),workerInstanceId:ee(),apiUrl:oi(),dataEndpoint:N().min(1),apiKey:N()});Pe(N(),mt());R({});var bg=R({path:N(),content:N(),secret:ye().default(!1),mode:Me().int().optional()}),_g=R({name:N(),containerPort:Me().int().positive().max(65535),protocol:ae("tcp").default("tcp")}),kg=rt("type",[R({type:ae("tcp"),port:N(),timeoutSeconds:Me().int().positive().default(30)}),R({type:ae("http"),port:N(),path:N(),statuses:Me().int().positive().array().default([200]),timeoutSeconds:Me().int().positive().default(30)}),R({type:ae("log"),pattern:N(),timeoutSeconds:Me().int().positive().default(30)})]);R({identity:N().regex(/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/),image:N(),command:N().array().optional(),args:N().array().default([]),env:Pe(N(),N()).default({}),files:bg.array().default([]),ports:_g.array().default([]),readiness:kg.optional()});R({id:N(),host:N(),ports:Pe(N(),R({host:N(),port:Me().int().positive().max(65535)}))});const Sg=R({key:N(),order:tt(["asc","desc"])}),dt=R({search:N().optional(),sortBy:ve(Sg).optional(),pageSize:Me().int().nonnegative().default(0).optional(),pageToken:N().optional()}),$g=rt("type",[R({type:ae("resources"),resourceIds:On(N().min(1))}),R({type:ae("projects"),projectIds:On(ee())}),R({type:ae("project-spaces"),projectSpaceIds:On(ee()),recursive:ye().default(!1)}),R({type:ae("projects-in-spaces"),projectSpaceIds:On(ee()),recursive:ye().default(!1)})]),Eg=ve($g).min(1).refine(t=>new Set(t.map(e=>e.type)).size===t.length,"Restriction types must be unique"),$i=[{title:"Backend",permissions:[{name:"backend.get",title:"View backend",risk:"low"},{name:"backend.update",title:"Update backend",risk:"critical",consequence:"Allows changing backend-wide configuration and security-sensitive settings."},{name:"backend.search",title:"Search backend",risk:"low"}],supportedRestrictions:[]},{title:"Projects",permissions:[{name:"project.get",title:"View projects",risk:"low"},{name:"project.list",title:"List projects",risk:"low"},{name:"project.create",title:"Create projects",risk:"high"},{name:"project.open",title:"Open projects",risk:"high"},{name:"project.unlock",title:"Unlock projects",risk:"critical",consequence:"Allows submitting an identity that decrypts and opens a project."},{name:"project.attach",title:"Attach projects",risk:"high"},{name:"project.detach",title:"Detach projects",risk:"critical",consequence:"Allows disconnecting projects and making their resources unavailable through the backend."},{name:"project.migrate",title:"Migrate projects",risk:"critical",consequence:"Allows moving project data between storage backends and changing where it is controlled."}],supportedRestrictions:["projects","projects-in-spaces"]},{title:"Backend service account project bindings",permissions:[{name:"backend-service-account-project-binding.get",title:"View backend service account project bindings",risk:"low"},{name:"backend-service-account-project-binding.list",title:"List backend service account project bindings",risk:"low"},{name:"backend-service-account-project-binding.create",title:"Create backend service account project bindings",risk:"high"},{name:"backend-service-account-project-binding.update",title:"Update backend service account project bindings",risk:"high"},{name:"backend-service-account-project-binding.delete",title:"Delete backend service account project bindings",risk:"high"},{name:"backend-service-account-project-binding.bind",title:"Bind project service accounts",risk:"critical",consequence:"Allows assigning backend identities to project service accounts and their project permissions."}],supportedRestrictions:["projects","projects-in-spaces"]},{title:"Project spaces",permissions:[{name:"project-space.get",title:"View project spaces",risk:"low"},{name:"project-space.list",title:"List project spaces",risk:"low"},{name:"project-space.create",title:"Create project spaces",risk:"high"},{name:"project-space.update",title:"Update project spaces",risk:"high"},{name:"project-space.delete",title:"Delete project spaces",risk:"critical",consequence:"Allows deleting project-space organization and affecting every project arranged within it."}],supportedRestrictions:["project-spaces"]},{title:"Libraries",permissions:[{name:"library.get",title:"View libraries",risk:"low"},{name:"library.list",title:"List libraries",risk:"low"},{name:"library.manage",title:"Manage libraries",risk:"high"}],supportedRestrictions:["resources"],resourceType:"library"},{title:"Pulumi backends",permissions:[{name:"pulumi-backend.get",title:"View Pulumi backends",risk:"low"},{name:"pulumi-backend.list",title:"List Pulumi backends",risk:"low"},{name:"pulumi-backend.manage",title:"Manage Pulumi backends",risk:"critical",consequence:"Allows changing infrastructure state backends that control deployed resources."}],supportedRestrictions:["resources"],resourceType:"pulumi-backend"},{title:"Project model storages",permissions:[{name:"project-model-storage.get",title:"View project model storages",risk:"low"},{name:"project-model-storage.list",title:"List project model storages",risk:"low"},{name:"project-model-storage.manage",title:"Manage project model storages",risk:"critical",consequence:"Allows changing storage that contains project models and their infrastructure definitions."}],supportedRestrictions:["resources"],resourceType:"project-model-storage"},{title:"Service accounts",permissions:[{name:"service-account.get",title:"View service accounts",risk:"low"},{name:"service-account.list",title:"List service accounts",risk:"low"},{name:"service-account.manage",title:"Manage service accounts",risk:"high"},{name:"service-account.impersonate",title:"Impersonate service accounts",risk:"critical",consequence:"Allows acting with the authority of another backend service account."}],supportedRestrictions:["resources"],resourceType:"backend-service-account"},{title:"API keys",permissions:[{name:"api-key.get",title:"View API keys",risk:"low"},{name:"api-key.list",title:"List API keys",risk:"low"},{name:"api-key.create",title:"Create API keys",risk:"high"},{name:"api-key.update",title:"Update API keys",risk:"high"},{name:"api-key.rotate",title:"Rotate API keys",risk:"high"},{name:"api-key.delete",title:"Delete API keys",risk:"high"},{name:"api-key.escalate",title:"Escalate API key permissions",risk:"critical",consequence:"Allows API keys to receive permissions beyond the caller's current access."}],supportedRestrictions:["resources"],resourceType:"backend-api-key"},{title:"Roles",permissions:[{name:"role.get",title:"View roles",risk:"low"},{name:"role.list",title:"List roles",risk:"low"},{name:"role.create",title:"Create roles",risk:"high"},{name:"role.update",title:"Update roles",risk:"high"},{name:"role.delete",title:"Delete roles",risk:"high"},{name:"role.escalate",title:"Escalate role permissions",risk:"critical",consequence:"Allows roles to receive permissions beyond the caller's current access."}],supportedRestrictions:["resources"],resourceType:"backend-role"},{title:"Role bindings",permissions:[{name:"role-binding.get",title:"View role bindings",risk:"low"},{name:"role-binding.list",title:"List role bindings",risk:"low"},{name:"role-binding.create",title:"Create role bindings",risk:"high"},{name:"role-binding.delete",title:"Delete role bindings",risk:"high"},{name:"role-binding.bind",title:"Bind roles beyond own permissions",risk:"critical",consequence:"Allows granting roles whose permissions exceed the caller's current access."}],supportedRestrictions:[]}],Ig=$i.flatMap(t=>t.permissions.map(e=>e.name)),Ag=tt(Ig),Og=R({permissions:On(Ag),restrictions:Eg.optional()}).strict().superRefine((t,e)=>{const n=$i.filter(r=>r.permissions.some(s=>t.permissions.includes(s.name)));for(const r of t.restrictions??[]){const s=n.find(o=>!o.supportedRestrictions.includes(r.type));if(s&&e.addIssue({code:"custom",message:`Permission group "${s.title}" does not support "${r.type}" restriction`,path:["restrictions"]}),r.type!=="resources")continue;new Set(n.map(o=>"resourceType"in o?o.resourceType:void 0)).size>1&&e.addIssue({code:"custom",message:"Permissions with resource restrictions must use the same resource type",path:["restrictions"]})}}),Ei=ve(Og).min(1);function On(t){return ve(t).min(1).refine(e=>new Set(e).size===e.length,"Values must be unique")}const Tg=Ei.or(Ec([])),Ng=R({meta:ke.extend({title:N().trim().min(1)}),serviceAccountId:ee().optional(),restrictionRules:Tg,expiresAt:ce().nullable()}),Pg=Ng.required({serviceAccountId:!0}).extend({id:ee(),serviceAccountMeta:yt,lastUsedAt:ce().nullable(),...Mn.shape});dt.extend({serviceAccountId:ee().optional()});R({apiKey:Pg,token:N().min(1)});const Cg=R({meta:ke.extend({title:N().trim().min(1)}),rules:Ei});Cg.extend({id:ee(),systemName:Ze.nullable(),...Mn.shape});const xg=R({meta:yt}),jg=xg.extend({id:ee(),systemName:Ze.nullable(),...Mn.shape});jg.extend({rules:ve(Ei.element)});R({roleId:ee(),serviceAccountId:ee(),createdAt:ce()});const Bg=R({backendServiceAccountId:ee(),projectId:ee(),projectServiceAccountId:ee(),createdAt:ce()});R({projectId:ee(),projectMeta:ke,unlocked:ye(),serviceAccounts:ve(R({id:ee(),meta:yt,systemName:Ze.nullable()})),binding:Bg.nullable()});const As=R({id:N().min(1),meta:ke});R({resources:Pe(N(),ve(As)),projects:ve(As),projectSpaces:ve(As)});rt("type",[R({type:ae("host")})]);$i.flatMap(t=>t.permissions.map(e=>e.name));const Dg={id:"q8xbilhwpsn65zjlv5kz44qh"},Rg={id:"n0rfvpl9o77iqf29ff4kk5gf"},zg={id:"pmn9y901jeiz2ydh93045l39"},Fg={id:"qppfcerovu3h22o0x8rlpc3g"};rt("type",[R({type:ae("codebase")}),R({type:ae("database")})]);R({name:Ze,spaceId:ee().default(Dg.id),modelStorageId:ee().default(Fg.id),libraryId:ee().default(Rg.id),pulumiBackendId:ee().default(zg.id),meta:ke});R({id:N(),name:Ze,meta:ke,spaceId:ee(),modelStorageId:ee(),libraryId:ee(),pulumiBackendId:ee(),...Mn.shape});const Mg=R({encryptedIdentities:ve(N()),hasPasskey:ye(),passkeys:ve(R({encryptedIdentity:N(),passkeyIdentity:N()})).default([])});rt("type",[R({type:ae("locked"),unlockSuite:Mg.optional()}),R({type:ae("unlocked")})]);rt("type",[R({type:ae("host")})]);const Ug=He.pick({title:!0,description:!0}).required({title:!0});R({meta:Ug,recipient:N()});tt(["low","medium","high","critical"]);const wo=R({name:N().min(1),title:N().min(1)});rt("risk",[wo.extend({risk:tt(["low","medium","high"])}),wo.extend({risk:ae("critical"),consequence:N().trim().min(1)})]);const Lg=rt("type",[R({type:ae("resources"),resourceIds:Tn(N().min(1))}),R({type:ae("instances"),instanceIds:Tn(St),recursive:ye().default(!1)}),R({type:ae("owners"),serviceAccountIds:Tn(ee())}),R({type:ae("self")}),R({type:ae("workers"),workerIds:Tn(ee())})]),qg=ve(Lg).min(1).refine(t=>new Set(t.map(e=>e.type)).size===t.length,"Restriction types must be unique"),Ii=[{title:"Instance models",permissions:[{name:"instance-model.get",title:"View instance models",risk:"low"},{name:"instance-model.update",title:"Update instance models",risk:"high"}],supportedRestrictions:["instances"]},{title:"Instance states",permissions:[{name:"instance-state.get",title:"View instance states",risk:"low"},{name:"instance-state.list",title:"List instance states",risk:"low"},{name:"instance-status.update",title:"Update instance statuses",risk:"medium"},{name:"instance-state.delete",title:"Forget instance states",risk:"high"}],supportedRestrictions:["instances"]},{title:"Operations",permissions:[{name:"operation.get",title:"View operations",risk:"low"},{name:"operation.list",title:"List operations",risk:"low"},{name:"operation.create",title:"Create operations",risk:"high"},{name:"operation.cancel",title:"Cancel operations",risk:"high"},{name:"operation.logs.get",title:"View operation logs",risk:"medium"}],supportedRestrictions:["resources","instances"],resourceType:"operation"},{title:"Secrets",permissions:[{name:"secret.metadata.get",title:"View secret metadata",risk:"low"},{name:"secret.value.get",title:"View secret values",risk:"high"},{name:"secret.list",title:"List secrets",risk:"low"},{name:"secret.create",title:"Create secrets",risk:"high"},{name:"secret.update",title:"Update secrets",risk:"high"},{name:"secret.delete",title:"Delete secrets",risk:"high"}],supportedRestrictions:["resources","instances","owners","self"],resourceType:"secret"},{title:"Artifacts",permissions:[{name:"artifact.get",title:"View artifacts",risk:"low"},{name:"artifact.list",title:"List artifacts",risk:"low"},{name:"artifact.create",title:"Create artifacts",risk:"medium"},{name:"artifact.delete",title:"Delete artifacts",risk:"high"}],supportedRestrictions:["resources","instances","owners","self"],resourceType:"artifact"},{title:"Terminals",permissions:[{name:"terminal.get",title:"View terminals",risk:"low"},{name:"terminal.list",title:"List terminals",risk:"low"},{name:"terminal.connect",title:"Connect to terminals",risk:"high"},{name:"terminal.create",title:"Create terminals",risk:"high"},{name:"terminal.update",title:"Update terminals",risk:"high"},{name:"terminal.delete",title:"Delete terminals",risk:"high"}],supportedRestrictions:["resources","instances","owners","self"],resourceType:"terminal"},{title:"Pages",permissions:[{name:"page.get",title:"View pages",risk:"low"},{name:"page.list",title:"List pages",risk:"low"},{name:"page.create",title:"Create pages",risk:"medium"},{name:"page.update",title:"Update pages",risk:"medium"},{name:"page.delete",title:"Delete pages",risk:"high"}],supportedRestrictions:["resources","instances","owners","self"],resourceType:"page"},{title:"Panels",permissions:[{name:"panel.get",title:"View panels",risk:"low"},{name:"panel.list",title:"List panels",risk:"low"},{name:"panel.create",title:"Create panels",risk:"medium"},{name:"panel.update",title:"Update panels",risk:"medium"},{name:"panel.delete",title:"Delete panels",risk:"high"}],supportedRestrictions:["resources","instances","owners","self","workers"],resourceType:"panel"},{title:"Workers",permissions:[{name:"worker.get",title:"View workers",risk:"low"},{name:"worker.list",title:"List workers",risk:"low"},{name:"worker.manage",title:"Manage workers",risk:"high"}],supportedRestrictions:["resources","owners","self","workers"],resourceType:"worker"},{title:"Worker versions",permissions:[{name:"worker-version.get",title:"View worker versions",risk:"low"},{name:"worker-version.list",title:"List worker versions",risk:"low"},{name:"worker-version.restart",title:"Restart worker versions",risk:"high"}],supportedRestrictions:["resources","owners","self","workers"],resourceType:"worker-version"},{title:"Entities",permissions:[{name:"entity.get",title:"View entities",risk:"low"},{name:"entity.list",title:"List entities",risk:"low"}],supportedRestrictions:["resources","instances","owners","self"],resourceType:"entity"},{title:"Entity snapshots",permissions:[{name:"entity-snapshot.get",title:"View entity snapshots",risk:"medium"},{name:"entity-snapshot.list",title:"List entity snapshots",risk:"low"}],supportedRestrictions:["resources","instances","owners","self"],resourceType:"entity-snapshot"},{title:"Triggers",permissions:[{name:"trigger.get",title:"View triggers",risk:"low"},{name:"trigger.list",title:"List triggers",risk:"low"}],supportedRestrictions:["resources","instances"],resourceType:"trigger"},{title:"Unlock methods",permissions:[{name:"unlock-method.get",title:"View unlock methods",risk:"low"},{name:"unlock-method.list",title:"List unlock methods",risk:"low"},{name:"unlock-method.create",title:"Create unlock methods",risk:"critical",consequence:"Allows adding identities that can decrypt the project."},{name:"unlock-method.delete",title:"Delete unlock methods",risk:"critical",consequence:"Allows removing identities that can decrypt the project."}],supportedRestrictions:["resources"],resourceType:"unlock-method"},{title:"Service accounts",permissions:[{name:"service-account.get",title:"View service accounts",risk:"low"},{name:"service-account.list",title:"List service accounts",risk:"low"},{name:"service-account.manage",title:"Manage service accounts",risk:"high"},{name:"service-account.impersonate",title:"Impersonate service accounts",risk:"critical",consequence:"Allows acting with the authority of another project service account."}],supportedRestrictions:["resources"],resourceType:"service-account"},{title:"API keys",permissions:[{name:"api-key.get",title:"View API keys",risk:"low"},{name:"api-key.list",title:"List API keys",risk:"low"},{name:"api-key.create",title:"Create API keys",risk:"high"},{name:"api-key.update",title:"Update API keys",risk:"high"},{name:"api-key.rotate",title:"Rotate API keys",risk:"high"},{name:"api-key.delete",title:"Delete API keys",risk:"high"},{name:"api-key.escalate",title:"Escalate API key permissions",risk:"critical",consequence:"Allows API keys to receive permissions beyond the caller's current access."}],supportedRestrictions:["resources","owners","self"],resourceType:"api-key"},{title:"Roles",permissions:[{name:"role.get",title:"View roles",risk:"low"},{name:"role.list",title:"List roles",risk:"low"},{name:"role.create",title:"Create roles",risk:"high"},{name:"role.update",title:"Update roles",risk:"high"},{name:"role.delete",title:"Delete roles",risk:"high"},{name:"role.escalate",title:"Escalate role permissions",risk:"critical",consequence:"Allows roles to receive permissions beyond the caller's current access."}],supportedRestrictions:["resources"],resourceType:"role"},{title:"Role bindings",permissions:[{name:"role-binding.get",title:"View role bindings",risk:"low"},{name:"role-binding.list",title:"List role bindings",risk:"low"},{name:"role-binding.create",title:"Create role bindings",risk:"high"},{name:"role-binding.delete",title:"Delete role bindings",risk:"high"},{name:"role-binding.bind",title:"Bind roles beyond own permissions",risk:"critical",consequence:"Allows granting roles whose permissions exceed the caller's current access."}],supportedRestrictions:[]}],Vg=Ii.flatMap(t=>t.permissions.map(e=>e.name)),Zg=tt(Vg),Kg=R({permissions:Tn(Zg),restrictions:qg.optional()}).strict().superRefine((t,e)=>{const n=Ii.filter(r=>r.permissions.some(s=>t.permissions.includes(s.name)));for(const r of t.restrictions??[]){const s=n.find(o=>!o.supportedRestrictions.includes(r.type));if(s&&e.addIssue({code:"custom",message:`Permission group "${s.title}" does not support "${r.type}" restriction`,path:["restrictions"]}),r.type!=="resources")continue;new Set(n.map(o=>"resourceType"in o?o.resourceType:void 0)).size>1&&e.addIssue({code:"custom",message:"Permissions with resource restrictions must use the same resource type",path:["restrictions"]})}}),Ai=ve(Kg).min(1);function Tn(t){return ve(t).min(1).refine(e=>new Set(e).size===e.length,"Values must be unique")}const ku=He.pick({title:!0,description:!0}).required({title:!0}),Su=Ai.or(Ec([]));R({meta:ku,serviceAccountId:ee().optional(),restrictionRules:Su,expiresAt:ce().nullable()});const Jg=R({id:ee(),meta:ke,serviceAccountId:ee(),serviceAccountMeta:yt.nullable(),restrictionRules:Su,expiresAt:ce().nullable(),lastUsedAt:ce().nullable(),createdAt:ce(),updatedAt:ce(),managed:ye()});dt.extend({serviceAccountId:N().optional()});R({apiKey:Jg,token:N().min(1)});R({id:ee(),hash:N(),size:Me(),meta:ke,createdAt:ce(),updatedAt:ce()});dt.extend({stateId:N().optional(),serviceAccountId:N().optional(),terminalId:N().optional(),pageId:N().optional()});const Hg=R({meta:ke.extend({title:N().trim().min(1)}),rules:Ai});Hg.extend({id:ee(),systemName:Ze.nullable(),...Mn.shape});R({roleId:ee(),serviceAccountId:ee(),createdAt:ce()});const Xn=R({id:N().min(1),title:N()});R({resources:Pe(N(),ve(Xn)),instances:ve(Xn),serviceAccounts:ve(Xn),workers:ve(Xn)});R({id:ee(),meta:ke,systemName:Ze.nullable(),rules:ve(Ai.element)});R({name:N(),meta:ke,value:N(),message:N().optional(),order:Me().min(0).max(100).optional()});R({identity:N().optional(),title:N().optional(),description:N().optional(),icon:N().optional(),iconColor:N().optional()}).passthrough();const Gg=R({id:N(),type:N(),identity:N(),meta:ke,snapshotId:N().optional(),createdAt:ce().optional()});dt.extend({type:N().optional()});const $u=R({id:N(),meta:ke,content:mt(),operationId:N(),stateId:N(),referencedInOutputs:N().array(),exportedInOutputs:N().array(),createdAt:ce()});R({id:N(),entityType:N(),meta:ke,operationId:N(),stateId:N(),createdAt:ce()});R({entity:R({id:N(),type:N(),identity:N()}),snapshot:$u});R({...Gg.shape,lastSnapshot:$u.nullable()});R({id:N(),meta:ke,group:N(),fromSnapshotId:N(),fromEntityId:N(),fromEntityType:N(),fromEntityIdentity:N(),fromEntityMeta:ke,toSnapshotId:N(),toEntityId:N(),toEntityType:N(),toEntityIdentity:N(),toEntityMeta:ke});const Wg=R({stateId:ee(),meta:ke,acquiredAt:ce()});rt("type",[R({type:ae("locked"),locks:Wg.array()}),R({type:ae("unlocked"),stateIds:ve(N())})]);Kr.pick({id:!0,kind:!0,type:!0,name:!0,args:!0,inputs:!0,hubInputs:!0,injectionInputs:!0,position:!0});R({virtualComponentsUpdated:ye().optional(),updatedInstances:Kr.array().optional(),updatedHubs:tg.array().optional(),updatedVirtualInstances:Kr.array().optional(),updatedGhostInstances:Kr.array().optional(),deletedInstanceIds:St.array().optional(),deletedHubIds:N().array().optional(),deletedVirtualInstanceIds:St.array().optional(),deletedGhostInstanceIds:St.array().optional()});const Yg=tt(["destroy","preview","update","refresh"]),Xg=R({id:St,parentId:N().optional(),message:N()}),Qg=R({type:Yg,instances:ve(Xg)}),ey=R({forceUpdateDependencies:ye().default(!1),ignoreChangedDependencies:ye().default(!1),ignoreDependencies:ye().default(!1),forceUpdateChildren:ye().default(!1),onlyDestroyGhosts:ye().default(!1),firstDestroyGhosts:ye().default(!1),ignoreGhosts:ye().default(!1),destroyDependentInstances:ye().default(!0),invokeDestroyTriggers:ye().default(!0),deleteUnreachableResources:ye().default(!1),forceDeleteState:ye().default(!1),allowPartialCompositeInstanceUpdate:ye().default(!1),allowPartialCompositeInstanceDestruction:ye().default(!1),refresh:ye().default(!1),debug:ye().default(!1)}).partial(),Eu=tt(["update","preview","destroy","recreate","refresh"]),ty=tt(["pending","running","failing","completed","failed","cancelled","cancelling"]),Iu=He.pick({title:!0,description:!0}).required({title:!0}),ny=R({projectId:N(),type:Eu,instanceIds:ve(St).min(1),options:ey.partial().optional()});ny.extend({meta:Iu,plan:Qg.array().optional()});rt("type",[R({type:ae("updated"),operation:en()}),R({type:ae("deleted"),operationId:N()})]);R({id:ee(),type:Eu,status:ty,meta:Iu,startedAt:ce(),updatedAt:ce(),finishedAt:ce().nullable()});const ry=R({id:ee(),meta:ke,name:N().nullable(),stateId:ee().nullable(),serviceAccountId:ee().nullable(),serviceAccountMeta:yt.nullable(),createdAt:ce(),updatedAt:ce()});dt.extend({serviceAccountId:N().optional(),stateId:N().optional(),artifactId:N().optional()});R({...ry.shape,content:ve(_u)});R({name:N().min(1),meta:ke});R({id:ee(),name:N(),meta:ke,stateId:ee(),serviceAccountId:ee(),serviceAccountMeta:ke,workerVersionId:ee(),workerVersionMeta:ke,workerId:ee(),online:ye(),createdAt:ce(),updatedAt:ce()});R({online:ye()});dt.extend({stateId:ee().optional(),serviceAccountId:ee().optional(),workerVersionId:ee().optional()});R({id:ee(),meta:gu,name:N().nullable(),systemName:N().nullable(),stateId:ee().nullable(),serviceAccountId:ee().nullable(),serviceAccountMeta:yt.nullable(),createdAt:ce(),updatedAt:ce()});dt.extend({serviceAccountId:N().optional(),stateId:N().optional()});const sy=R({meta:yt});sy.extend({id:ee(),meta:yt,systemName:Ze.nullable(),createdAt:ce(),updatedAt:ce()});dt.extend({artifactId:N().optional()});R({stateId:N(),output:N(),path:N().optional()});rt("type",[R({type:ae("updated"),state:en()}),R({type:ae("patched"),stateId:N(),patch:en()}),R({type:ae("patched-batch"),patches:ve(R({stateId:N(),patch:en()}))}),R({type:ae("deleted"),stateId:N()})]);rt("type",[R({type:ae("registered"),stateId:N(),params:Pe(N(),mt())}),R({type:ae("deregistered"),stateId:N()})]);const iy=tt(["active","unavailable"]);R({id:ee(),terminalId:ee(),meta:gu,startedAt:ce(),finishedAt:ce().nullable()});const oy=R({id:ee(),name:N().nullable(),meta:ke,status:iy,stateId:N().nullable(),serviceAccountId:N().nullable(),serviceAccountMeta:yt.nullable(),createdAt:ce(),updatedAt:ce()});dt.extend({serviceAccountId:N().optional(),stateId:N().optional(),artifactId:N().optional()});R({...oy.shape,spec:bu});R({id:ee(),meta:ke,name:N(),stateId:ee(),createdAt:ce(),updatedAt:ce()});dt.extend({stateId:N().optional()});const ay=tt(["password","passkey"]),Qs=He.pick({title:!0,description:!0}).required({title:!0});rt("type",[R({meta:Qs,type:ae("password"),encryptedIdentity:N(),recipient:N()}),R({meta:Qs,type:ae("passkey"),encryptedIdentity:N(),passkeyIdentity:N(),recipient:N()})]);R({id:ee(),type:ay,meta:Qs,recipient:N(),createdAt:ce(),updatedAt:ce()});const cy=R({title:N().min(1),username:N().min(1).optional(),email:Rh().optional(),avatarUrl:oi().optional()}),uy=tt(["local","oidc"]);R({id:ee(),type:uy,meta:cy,createdAt:ce(),updatedAt:ce()});const ly=R({title:N().min(1),description:N().optional(),avatarUrl:oi().optional()});R({id:ee(),meta:ly,createdAt:ce(),updatedAt:ce()});Ii.flatMap(t=>t.permissions.map(e=>e.name));const Au=tt(["unknown","starting","running","stopping","stopped","error"]);R({workerVersionId:ee(),status:Au});R({id:ee(),digest:N(),meta:ke,status:Au,enabled:ye(),apiKeyId:N(),apiKeyMeta:ku,createdAt:ce(),updatedAt:ce()});R({id:ee(),identity:N(),meta:ke,serviceAccountId:N(),serviceAccountMeta:yt,createdAt:ce()});dt.extend({serviceAccountId:N().optional()});function Ou(t){const e=t.visited??new Set,n=t.getInstanceContext(t.input.instanceId);if(!n)return Os({rootType:t.fallbackType,path:t.input.path,entities:void 0,fallbackType:t.fallbackType});const r=n.component.outputs[t.input.output];if(!r)return Os({rootType:t.fallbackType,path:t.input.path,entities:n.entities,fallbackType:t.fallbackType});let s=r.type;if(r.fromInput){const i=`${n.instance.id}:${t.input.output}`;if(!e.has(i)){e.add(i);const o=r.fromInput,a=n.component.inputs[o]?.type??s,c=(n.instance.hubInputs?.[o]?.length??0)>0,u=(n.instance.injectionInputs?.length??0)>0,d=n.instance.inputs?.[o]??[];if(!c&&!u&&d.length===1){const p=d[0];p?s=Ou({input:p,fallbackType:a,getInstanceContext:t.getInstanceContext,visited:e}):s=a}else s=a}}return Os({rootType:s,path:t.input.path,entities:n.entities,fallbackType:t.fallbackType})}function Os(t){const{rootType:e,path:n,entities:r,fallbackType:s}=t;if(!n||!r)return fy(e,s,r);let i=e;const o=n.split(".");for(const a of o){const c=r[i];if(!c)return e;const u=c.inclusions?.find(d=>d.field===a);if(!u)return e;i=u.type}return i}function fy(t,e,n){if(!n||t===e)return t;const r=n[t];return!r||r.extensions?.includes(e)?t:r.inclusions?.find(i=>i.type===e)?e:t}class Oi{constructor(e,n,r,s){this.nodes=e,this.logger=n,this.outputHandler=r,this.dependentSetHandler=s}nodes;logger;outputHandler;dependentSetHandler;workset=new Set;dependencyMap=new Map;dependentMap=new Map;outputMap=new Map;addToWorkset(e){this.workset.add(e)}addAllNodesToWorkset(){for(const e of this.nodes.keys())this.workset.add(e)}get outputs(){return this.outputMap}get dependents(){return this.dependentMap}requireOutput(e){const n=this.outputMap.get(e);if(!n)throw new Error(`Output for node ${e} is not available`);return n}getDependents(e){const n=this.dependentMap.get(e);return n?Array.from(n):[]}invalidate(e){const n=[e];for(;n.length>0;){const r=n.pop();if(!this.nodes.has(r))continue;this.outputMap.delete(r),this.workset.add(r);const s=this.dependentMap.get(r);if(s)for(const i of s)this.outputMap.has(i)&&n.push(i)}}canAddDependency(e,n){if(e===n)return!1;const r=[e],s=new Set;for(;r.length>0;){const i=r.pop();if(i===n)return!1;if(s.has(i))continue;s.add(i);const o=this.dependentMap.get(i);if(o)for(const a of o)this.nodes.has(a)&&r.push(a)}return!0}invalidateSingle(e){this.nodes.has(e)&&(this.outputMap.delete(e),this.workset.add(e))}async process(e){for(;this.workset.size>0;){const n=this.workset.values().next().value,r=[{nodeId:n,resolved:!1,dependencies:[]}];for(;r.length>0;){const s=r[r.length-1],{nodeId:i,resolved:o}=s,a=this.nodes.get(i);if(!a){this.logger.warn({nodeId:i},"node not found in the graph, skipping"),r.pop();continue}if(this.outputMap.has(i)){r.pop();continue}if(!o){s.dependencies=Fp(this.getNodeDependencies(a));let p=!1;for(const h of s.dependencies){if(!this.nodes.has(h)){this.logger.warn({depId:h,nodeId:i},"dependency not found in the graph, skipping");continue}this.outputMap.has(h)||(r.push({nodeId:h,resolved:!1,dependencies:[]}),p=!0)}if(p){s.resolved=!0;continue}}const c=await this.processNode(a,this.logger);if(e?.aborted){this.logger.warn({nodeId:i},"processing aborted, skipping output");return}const u=new Set,d=this.dependencyMap.get(i)??[];for(const p of d){const h=this.dependentMap.get(p);h&&(h.delete(i),u.add(p),h.size===0&&this.dependentMap.delete(p))}for(const p of s.dependencies){let h=this.dependentMap.get(p);h||(h=new Set,this.dependentMap.set(p,h)),h.add(i),u.add(p)}if(this.dependentSetHandler)for(const p of u){const h=this.dependentMap.get(p);this.dependentSetHandler(p,h)}this.outputMap.set(i,c),this.outputHandler?.(i,c),this.dependencyMap.set(i,s.dependencies),r.pop()}this.workset.delete(n)}}}class dy extends Oi{getNodeDependencies(e){const n=[];if(e.kind==="hub"){for(const r of e.hub.inputs??[])n.push(`instance:${r.instanceId}`);for(const r of e.hub.injectionInputs??[])n.push(`hub:${r.hubId}`);return n}for(const r of Object.values(e.instance.inputs??{}))for(const s of r)n.push(`instance:${s.instanceId}`);for(const r of Object.values(e.instance.hubInputs??{}))for(const s of r)n.push(`hub:${s.hubId}`);for(const r of e.instance.injectionInputs??[])n.push(`hub:${r.hubId}`);return n}resolveOutputTypeForInput(e,n){return Ou({input:e,fallbackType:n,getInstanceContext:r=>{const s=this.outputs.get(`instance:${r}`);if(s?.kind==="instance")return{instance:s.instance,component:s.component,entities:s.entities}}})}processNode(e){const n=d=>{const p=this.outputs.get(`hub:${d.hubId}`);if(!p)return{resolvedInputs:[]};if(p.kind!=="hub")throw new Error("Expected hub node");return p},r=d=>{const p=this.outputs.get(`instance:${d.instanceId}`);if(!p)return{component:null,resolvedInputs:[],resolvedOutputs:[]};if(p.kind!=="instance")throw new Error("Expected instance node");return{component:p.component,resolvedInputs:p.resolvedInputs[d.output]??[],resolvedOutputs:p.resolvedOutputs?.[d.output]}};if(e.kind==="hub"){const d=new Map,p=h=>{d.set(wn(h.input),h)};for(const h of e.hub.inputs??[]){const{component:m}=r(h),b=m?.outputs[h.output];if(!b){this.logger.warn({msg:"output not found in the component",input:h,component:m});continue}p({input:h,type:this.resolveOutputTypeForInput(h,b.type)})}for(const h of e.hub.injectionInputs??[]){const{resolvedInputs:m}=n(h);for(const b of m)p(b)}return{kind:"hub",hub:e.hub,resolvedInputs:Array.from(d.values())}}if(e.instance.resolvedInputs)return{kind:"instance",instance:e.instance,component:e.component,entities:e.entities,resolvedInputs:Rp(e.instance.resolvedInputs,(d,p)=>{const h=e.component.inputs[p];return h?d.map(m=>({input:m,type:h.type})):(this.logger.warn({msg:"input not found in the component",inputName:p,component:e.component}),[])}),resolvedOutputs:e.instance.resolvedOutputs??{},resolvedInjectionInputs:[],matchedInjectionInputs:[]};const s=new Map,i=(d,p)=>{let h=s.get(d);h||(h=new Map,s.set(d,h)),h.set(wn(p.input),p)},o=(d,p)=>{const h=e.component.inputs[d],m=e.instance.type===Fu;if(!h&&!m){this.logger.warn({msg:"input not found in the component",input:p,component:e.component});return}const{component:b,resolvedOutputs:w}=r(p);if(!b){this.logger.warn({instanceId:e.instance.id,input:p},"no output found for the input");return}const g=h?.type??b.outputs[p.output]?.type;if(!g){this.logger.warn({instanceId:e.instance.id,input:p,component:b},"cannot resolve input type for dynamic export input");return}if(Si(b)){i(d,{input:p,type:this.resolveOutputTypeForInput(p,g)});return}if(w)for(const k of w)i(d,{input:{...k,path:p.path??k.path},type:this.resolveOutputTypeForInput({instanceId:p.instanceId,output:p.output,path:p.path??k.path},g)});else i(d,{input:p,type:this.resolveOutputTypeForInput(p,g)})};for(const[d,p]of Object.entries(e.instance.inputs??{}))for(const h of p)o(d,h);const a=new Map,c=new Map;for(const d of e.instance.injectionInputs??[]){const{resolvedInputs:p}=n(d);for(const h of p)a.set(wn(h.input),h)}for(const[d,p]of Object.entries(e.component.inputs??{})){const h=new Map(a),m=e.instance.hubInputs?.[d]??[];for(const b of m){const{resolvedInputs:w}=n(b);for(const g of w)h.set(wn(g.input),g)}for(const b of h.values())if(b.type===p.type){o(d,b.input);const w=wn(b.input);a.has(w)&&c.set(w,b)}}const u=Dp(Array.from(s.entries()).map(([d,p])=>[d,Array.from(p.values())]));return{kind:"instance",instance:e.instance,component:e.component,entities:e.entities,resolvedInputs:u,resolvedOutputs:e.instance.resolvedOutputs,resolvedInjectionInputs:Array.from(a.values()),matchedInjectionInputs:Array.from(c.values())}}}function hy(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}const py=t=>new TextEncoder().encode(t);typeof Buffer<"u"&&Buffer.from;function my(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),n=0;n<t.length;)e[n]=t[n],n+=1;return e}return Uint32Array.from(t)}function Ts(t){return new gy().update(t).digest()}var gy=(function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var n,r;try{for(var s=hy(e),i=s.next();!i.done;i=s.next()){var o=i.value;this.checksum=this.checksum>>>8^wy[(this.checksum^o)&255]}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return this},t.prototype.digest=function(){return(this.checksum^4294967295)>>>0},t})(),yy=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],wy=my(yy);function vy(t){const e=t.length;let n=0,r=0;for(;r<e;){let s=t.charCodeAt(r++);if((s&4294967168)===0){n++;continue}else if((s&4294965248)===0)n+=2;else{if(s>=55296&&s<=56319&&r<e){const i=t.charCodeAt(r);(i&64512)===56320&&(++r,s=((s&1023)<<10)+(i&1023)+65536)}(s&4294901760)===0?n+=3:n+=4}}return n}function by(t,e,n){const r=t.length;let s=n,i=0;for(;i<r;){let o=t.charCodeAt(i++);if((o&4294967168)===0){e[s++]=o;continue}else if((o&4294965248)===0)e[s++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&i<r){const a=t.charCodeAt(i);(a&64512)===56320&&(++i,o=((o&1023)<<10)+(a&1023)+65536)}(o&4294901760)===0?(e[s++]=o>>12&15|224,e[s++]=o>>6&63|128):(e[s++]=o>>18&7|240,e[s++]=o>>12&63|128,e[s++]=o>>6&63|128)}e[s++]=o&63|128}}const _y=new TextEncoder,ky=50;function Sy(t,e,n){_y.encodeInto(t,e.subarray(n))}function $y(t,e,n){t.length>ky?Sy(t,e,n):by(t,e,n)}new TextDecoder;class Qn{type;data;constructor(e,n){this.type=e,this.data=n}}class Qr extends Error{constructor(e){super(e);const n=Object.create(Qr.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Qr.name})}}function Ey(t,e,n){const r=n/4294967296,s=n;t.setUint32(e,r),t.setUint32(e+4,s)}function Tu(t,e,n){const r=Math.floor(n/4294967296),s=n;t.setUint32(e,r),t.setUint32(e+4,s)}function Iy(t,e){const n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}const Ay=-1,Oy=4294967296-1,Ty=17179869184-1;function Ny({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=Ty)if(e===0&&t<=Oy){const n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,t),n}else{const n=t/4294967296,r=t&4294967295,s=new Uint8Array(8),i=new DataView(s.buffer);return i.setUint32(0,e<<2|n&3),i.setUint32(4,r),s}else{const n=new Uint8Array(12),r=new DataView(n.buffer);return r.setUint32(0,e),Tu(r,4,t),n}}function Py(t){const e=t.getTime(),n=Math.floor(e/1e3),r=(e-n*1e3)*1e6,s=Math.floor(r/1e9);return{sec:n+s,nsec:r-s*1e9}}function Cy(t){if(t instanceof Date){const e=Py(t);return Ny(e)}else return null}function xy(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const n=e.getUint32(0),r=e.getUint32(4),s=(n&3)*4294967296+r,i=n>>>2;return{sec:s,nsec:i}}case 12:{const n=Iy(e,4),r=e.getUint32(0);return{sec:n,nsec:r}}default:throw new Qr(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function jy(t){const e=xy(t);return new Date(e.sec*1e3+e.nsec/1e6)}const By={type:Ay,encode:Cy,decode:jy};class Ti{static defaultCodec=new Ti;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(By)}register({type:e,encode:n,decode:r}){if(e>=0)this.encoders[e]=n,this.decoders[e]=r;else{const s=-1-e;this.builtInEncoders[s]=n,this.builtInDecoders[s]=r}}tryToEncode(e,n){for(let r=0;r<this.builtInEncoders.length;r++){const s=this.builtInEncoders[r];if(s!=null){const i=s(e,n);if(i!=null){const o=-1-r;return new Qn(o,i)}}}for(let r=0;r<this.encoders.length;r++){const s=this.encoders[r];if(s!=null){const i=s(e,n);if(i!=null){const o=r;return new Qn(o,i)}}}return e instanceof Qn?e:null}decode(e,n,r){const s=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return s?s(e,n,r):new Qn(n,e)}}function Dy(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function Ry(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Dy(t)?new Uint8Array(t):Uint8Array.from(t)}const zy=100,Fy=2048;class Ni{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??Ti.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??zy,this.initialBufferSize=e?.initialBufferSize??Fy,this.sortKeys=e?.sortKeys??!1,this.forceFloat32=e?.forceFloat32??!1,this.ignoreUndefined=e?.ignoreUndefined??!1,this.forceIntegerToFloat=e?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new Ni({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,n){if(n>this.maxDepth)throw new Error(`Too deep objects in depth ${n}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,n)}ensureBufferSizeToWrite(e){const n=this.pos+e;this.view.byteLength<n&&this.resizeBuffer(n*2)}resizeBuffer(e){const n=new ArrayBuffer(e),r=new Uint8Array(n),s=new DataView(n);r.set(this.bytes),this.view=s,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){const r=vy(e);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),$y(e,this.bytes,this.pos),this.pos+=r}encodeObject(e,n){const r=this.extensionCodec.tryToEncode(e,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,n);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,n);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){const n=e.byteLength;if(n<256)this.writeU8(196),this.writeU8(n);else if(n<65536)this.writeU8(197),this.writeU16(n);else if(n<4294967296)this.writeU8(198),this.writeU32(n);else throw new Error(`Too large binary: ${n}`);const r=Ry(e);this.writeU8a(r)}encodeArray(e,n){const r=e.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const s of e)this.doEncode(s,n+1)}countWithoutUndefined(e,n){let r=0;for(const s of n)e[s]!==void 0&&r++;return r}encodeMap(e,n){const r=Object.keys(e);this.sortKeys&&r.sort();const s=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length;if(s<16)this.writeU8(128+s);else if(s<65536)this.writeU8(222),this.writeU16(s);else if(s<4294967296)this.writeU8(223),this.writeU32(s);else throw new Error(`Too large map object: ${s}`);for(const i of r){const o=e[i];this.ignoreUndefined&&o===void 0||(this.encodeString(i),this.doEncode(o,n+1))}}encodeExtension(e){if(typeof e.data=="function"){const r=e.data(this.pos+6),s=r.length;if(s>=4294967296)throw new Error(`Too large extension object: ${s}`);this.writeU8(201),this.writeU32(s),this.writeI8(e.type),this.writeU8a(r);return}const n=e.data.length;if(n===1)this.writeU8(212);else if(n===2)this.writeU8(213);else if(n===4)this.writeU8(214);else if(n===8)this.writeU8(215);else if(n===16)this.writeU8(216);else if(n<256)this.writeU8(199),this.writeU8(n);else if(n<65536)this.writeU8(200),this.writeU16(n);else if(n<4294967296)this.writeU8(201),this.writeU32(n);else throw new Error(`Too large extension object: ${n}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const n=e.length;this.ensureBufferSizeToWrite(n),this.bytes.set(e,this.pos),this.pos+=n}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),Ey(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),Tu(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}}function My(t,e){return new Ni(e).encodeSharedRef(t)}var Ns={},vn={},vo;function Uy(){if(vo)return vn;vo=1,vn.byteLength=a,vn.toByteArray=u,vn.fromByteArray=h;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,i=r.length;s<i;++s)t[s]=r[s],e[r.charCodeAt(s)]=s;e[45]=62,e[95]=63;function o(m){var b=m.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var w=m.indexOf("=");w===-1&&(w=b);var g=w===b?0:4-w%4;return[w,g]}function a(m){var b=o(m),w=b[0],g=b[1];return(w+g)*3/4-g}function c(m,b,w){return(b+w)*3/4-w}function u(m){var b,w=o(m),g=w[0],k=w[1],y=new n(c(m,g,k)),_=0,I=k>0?g-4:g,v;for(v=0;v<I;v+=4)b=e[m.charCodeAt(v)]<<18|e[m.charCodeAt(v+1)]<<12|e[m.charCodeAt(v+2)]<<6|e[m.charCodeAt(v+3)],y[_++]=b>>16&255,y[_++]=b>>8&255,y[_++]=b&255;return k===2&&(b=e[m.charCodeAt(v)]<<2|e[m.charCodeAt(v+1)]>>4,y[_++]=b&255),k===1&&(b=e[m.charCodeAt(v)]<<10|e[m.charCodeAt(v+1)]<<4|e[m.charCodeAt(v+2)]>>2,y[_++]=b>>8&255,y[_++]=b&255),y}function d(m){return t[m>>18&63]+t[m>>12&63]+t[m>>6&63]+t[m&63]}function p(m,b,w){for(var g,k=[],y=b;y<w;y+=3)g=(m[y]<<16&16711680)+(m[y+1]<<8&65280)+(m[y+2]&255),k.push(d(g));return k.join("")}function h(m){for(var b,w=m.length,g=w%3,k=[],y=16383,_=0,I=w-g;_<I;_+=y)k.push(p(m,_,_+y>I?I:_+y));return g===1?(b=m[w-1],k.push(t[b>>2]+t[b<<4&63]+"==")):g===2&&(b=(m[w-2]<<8)+m[w-1],k.push(t[b>>10]+t[b>>4&63]+t[b<<2&63]+"=")),k.join("")}return vn}var er={};var bo;function Ly(){return bo||(bo=1,er.read=function(t,e,n,r,s){var i,o,a=s*8-r-1,c=(1<<a)-1,u=c>>1,d=-7,p=n?s-1:0,h=n?-1:1,m=t[e+p];for(p+=h,i=m&(1<<-d)-1,m>>=-d,d+=a;d>0;i=i*256+t[e+p],p+=h,d-=8);for(o=i&(1<<-d)-1,i>>=-d,d+=r;d>0;o=o*256+t[e+p],p+=h,d-=8);if(i===0)i=1-u;else{if(i===c)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-u}return(m?-1:1)*o*Math.pow(2,i-r)},er.write=function(t,e,n,r,s,i){var o,a,c,u=i*8-s-1,d=(1<<u)-1,p=d>>1,h=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=r?0:i-1,b=r?1:-1,w=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=d):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+p>=1?e+=h/c:e+=h*Math.pow(2,1-p),e*c>=2&&(o++,c/=2),o+p>=d?(a=0,o=d):o+p>=1?(a=(e*c-1)*Math.pow(2,s),o=o+p):(a=e*Math.pow(2,p-1)*Math.pow(2,s),o=0));s>=8;t[n+m]=a&255,m+=b,a/=256,s-=8);for(o=o<<s|a,u+=s;u>0;t[n+m]=o&255,m+=b,o/=256,u-=8);t[n+m-b]|=w*128}),er}var _o;function qy(){return _o||(_o=1,(function(t){const e=Uy(),n=Ly(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=y,t.INSPECT_MAX_BYTES=50;const s=2147483647;t.kMaxLength=s,a.TYPED_ARRAY_SUPPORT=i(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{const S=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(S,l),S.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(S){if(S>s)throw new RangeError('The value "'+S+'" is invalid for option "size"');const l=new Uint8Array(S);return Object.setPrototypeOf(l,a.prototype),l}function a(S,l,f){if(typeof S=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return p(S)}return c(S,l,f)}a.poolSize=8192;function c(S,l,f){if(typeof S=="string")return h(S,l);if(ArrayBuffer.isView(S))return b(S);if(S==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S);if(qe(S,ArrayBuffer)||S&&qe(S.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(qe(S,SharedArrayBuffer)||S&&qe(S.buffer,SharedArrayBuffer)))return w(S,l,f);if(typeof S=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const A=S.valueOf&&S.valueOf();if(A!=null&&A!==S)return a.from(A,l,f);const x=g(S);if(x)return x;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof S[Symbol.toPrimitive]=="function")return a.from(S[Symbol.toPrimitive]("string"),l,f);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S)}a.from=function(S,l,f){return c(S,l,f)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function u(S){if(typeof S!="number")throw new TypeError('"size" argument must be of type number');if(S<0)throw new RangeError('The value "'+S+'" is invalid for option "size"')}function d(S,l,f){return u(S),S<=0?o(S):l!==void 0?typeof f=="string"?o(S).fill(l,f):o(S).fill(l):o(S)}a.alloc=function(S,l,f){return d(S,l,f)};function p(S){return u(S),o(S<0?0:k(S)|0)}a.allocUnsafe=function(S){return p(S)},a.allocUnsafeSlow=function(S){return p(S)};function h(S,l){if((typeof l!="string"||l==="")&&(l="utf8"),!a.isEncoding(l))throw new TypeError("Unknown encoding: "+l);const f=_(S,l)|0;let A=o(f);const x=A.write(S,l);return x!==f&&(A=A.slice(0,x)),A}function m(S){const l=S.length<0?0:k(S.length)|0,f=o(l);for(let A=0;A<l;A+=1)f[A]=S[A]&255;return f}function b(S){if(qe(S,Uint8Array)){const l=new Uint8Array(S);return w(l.buffer,l.byteOffset,l.byteLength)}return m(S)}function w(S,l,f){if(l<0||S.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(S.byteLength<l+(f||0))throw new RangeError('"length" is outside of buffer bounds');let A;return l===void 0&&f===void 0?A=new Uint8Array(S):f===void 0?A=new Uint8Array(S,l):A=new Uint8Array(S,l,f),Object.setPrototypeOf(A,a.prototype),A}function g(S){if(a.isBuffer(S)){const l=k(S.length)|0,f=o(l);return f.length===0||S.copy(f,0,0,l),f}if(S.length!==void 0)return typeof S.length!="number"||Je(S.length)?o(0):m(S);if(S.type==="Buffer"&&Array.isArray(S.data))return m(S.data)}function k(S){if(S>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return S|0}function y(S){return+S!=S&&(S=0),a.alloc(+S)}a.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==a.prototype},a.compare=function(l,f){if(qe(l,Uint8Array)&&(l=a.from(l,l.offset,l.byteLength)),qe(f,Uint8Array)&&(f=a.from(f,f.offset,f.byteLength)),!a.isBuffer(l)||!a.isBuffer(f))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===f)return 0;let A=l.length,x=f.length;for(let z=0,Z=Math.min(A,x);z<Z;++z)if(l[z]!==f[z]){A=l[z],x=f[z];break}return A<x?-1:x<A?1:0},a.isEncoding=function(l){switch(String(l).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(l,f){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return a.alloc(0);let A;if(f===void 0)for(f=0,A=0;A<l.length;++A)f+=l[A].length;const x=a.allocUnsafe(f);let z=0;for(A=0;A<l.length;++A){let Z=l[A];if(qe(Z,Uint8Array))z+Z.length>x.length?(a.isBuffer(Z)||(Z=a.from(Z)),Z.copy(x,z)):Uint8Array.prototype.set.call(x,Z,z);else if(a.isBuffer(Z))Z.copy(x,z);else throw new TypeError('"list" argument must be an Array of Buffers');z+=Z.length}return x};function _(S,l){if(a.isBuffer(S))return S.length;if(ArrayBuffer.isView(S)||qe(S,ArrayBuffer))return S.byteLength;if(typeof S!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof S);const f=S.length,A=arguments.length>2&&arguments[2]===!0;if(!A&&f===0)return 0;let x=!1;for(;;)switch(l){case"ascii":case"latin1":case"binary":return f;case"utf8":case"utf-8":return $e(S).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f*2;case"hex":return f>>>1;case"base64":return Le(S).length;default:if(x)return A?-1:$e(S).length;l=(""+l).toLowerCase(),x=!0}}a.byteLength=_;function I(S,l,f){let A=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((f===void 0||f>this.length)&&(f=this.length),f<=0)||(f>>>=0,l>>>=0,f<=l))return"";for(S||(S="utf8");;)switch(S){case"hex":return ue(this,l,f);case"utf8":case"utf-8":return he(this,l,f);case"ascii":return se(this,l,f);case"latin1":case"binary":return re(this,l,f);case"base64":return ie(this,l,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,l,f);default:if(A)throw new TypeError("Unknown encoding: "+S);S=(S+"").toLowerCase(),A=!0}}a.prototype._isBuffer=!0;function v(S,l,f){const A=S[l];S[l]=S[f],S[f]=A}a.prototype.swap16=function(){const l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let f=0;f<l;f+=2)v(this,f,f+1);return this},a.prototype.swap32=function(){const l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let f=0;f<l;f+=4)v(this,f,f+3),v(this,f+1,f+2);return this},a.prototype.swap64=function(){const l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let f=0;f<l;f+=8)v(this,f,f+7),v(this,f+1,f+6),v(this,f+2,f+5),v(this,f+3,f+4);return this},a.prototype.toString=function(){const l=this.length;return l===0?"":arguments.length===0?he(this,0,l):I.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(l){if(!a.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:a.compare(this,l)===0},a.prototype.inspect=function(){let l="";const f=t.INSPECT_MAX_BYTES;return l=this.toString("hex",0,f).replace(/(.{2})/g,"$1 ").trim(),this.length>f&&(l+=" ... "),"<Buffer "+l+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(l,f,A,x,z){if(qe(l,Uint8Array)&&(l=a.from(l,l.offset,l.byteLength)),!a.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof l);if(f===void 0&&(f=0),A===void 0&&(A=l?l.length:0),x===void 0&&(x=0),z===void 0&&(z=this.length),f<0||A>l.length||x<0||z>this.length)throw new RangeError("out of range index");if(x>=z&&f>=A)return 0;if(x>=z)return-1;if(f>=A)return 1;if(f>>>=0,A>>>=0,x>>>=0,z>>>=0,this===l)return 0;let Z=z-x,me=A-f;const je=Math.min(Z,me),Oe=this.slice(x,z),Be=l.slice(f,A);for(let Ee=0;Ee<je;++Ee)if(Oe[Ee]!==Be[Ee]){Z=Oe[Ee],me=Be[Ee];break}return Z<me?-1:me<Z?1:0};function E(S,l,f,A,x){if(S.length===0)return-1;if(typeof f=="string"?(A=f,f=0):f>2147483647?f=2147483647:f<-2147483648&&(f=-2147483648),f=+f,Je(f)&&(f=x?0:S.length-1),f<0&&(f=S.length+f),f>=S.length){if(x)return-1;f=S.length-1}else if(f<0)if(x)f=0;else return-1;if(typeof l=="string"&&(l=a.from(l,A)),a.isBuffer(l))return l.length===0?-1:O(S,l,f,A,x);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?x?Uint8Array.prototype.indexOf.call(S,l,f):Uint8Array.prototype.lastIndexOf.call(S,l,f):O(S,[l],f,A,x);throw new TypeError("val must be string, number or Buffer")}function O(S,l,f,A,x){let z=1,Z=S.length,me=l.length;if(A!==void 0&&(A=String(A).toLowerCase(),A==="ucs2"||A==="ucs-2"||A==="utf16le"||A==="utf-16le")){if(S.length<2||l.length<2)return-1;z=2,Z/=2,me/=2,f/=2}function je(Be,Ee){return z===1?Be[Ee]:Be.readUInt16BE(Ee*z)}let Oe;if(x){let Be=-1;for(Oe=f;Oe<Z;Oe++)if(je(S,Oe)===je(l,Be===-1?0:Oe-Be)){if(Be===-1&&(Be=Oe),Oe-Be+1===me)return Be*z}else Be!==-1&&(Oe-=Oe-Be),Be=-1}else for(f+me>Z&&(f=Z-me),Oe=f;Oe>=0;Oe--){let Be=!0;for(let Ee=0;Ee<me;Ee++)if(je(S,Oe+Ee)!==je(l,Ee)){Be=!1;break}if(Be)return Oe}return-1}a.prototype.includes=function(l,f,A){return this.indexOf(l,f,A)!==-1},a.prototype.indexOf=function(l,f,A){return E(this,l,f,A,!0)},a.prototype.lastIndexOf=function(l,f,A){return E(this,l,f,A,!1)};function P(S,l,f,A){f=Number(f)||0;const x=S.length-f;A?(A=Number(A),A>x&&(A=x)):A=x;const z=l.length;A>z/2&&(A=z/2);let Z;for(Z=0;Z<A;++Z){const me=parseInt(l.substr(Z*2,2),16);if(Je(me))return Z;S[f+Z]=me}return Z}function q(S,l,f,A){return xe($e(l,S.length-f),S,f,A)}function H(S,l,f,A){return xe(Ue(l),S,f,A)}function G(S,l,f,A){return xe(Le(l),S,f,A)}function Y(S,l,f,A){return xe(Ke(l,S.length-f),S,f,A)}a.prototype.write=function(l,f,A,x){if(f===void 0)x="utf8",A=this.length,f=0;else if(A===void 0&&typeof f=="string")x=f,A=this.length,f=0;else if(isFinite(f))f=f>>>0,isFinite(A)?(A=A>>>0,x===void 0&&(x="utf8")):(x=A,A=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const z=this.length-f;if((A===void 0||A>z)&&(A=z),l.length>0&&(A<0||f<0)||f>this.length)throw new RangeError("Attempt to write outside buffer bounds");x||(x="utf8");let Z=!1;for(;;)switch(x){case"hex":return P(this,l,f,A);case"utf8":case"utf-8":return q(this,l,f,A);case"ascii":case"latin1":case"binary":return H(this,l,f,A);case"base64":return G(this,l,f,A);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y(this,l,f,A);default:if(Z)throw new TypeError("Unknown encoding: "+x);x=(""+x).toLowerCase(),Z=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ie(S,l,f){return l===0&&f===S.length?e.fromByteArray(S):e.fromByteArray(S.slice(l,f))}function he(S,l,f){f=Math.min(S.length,f);const A=[];let x=l;for(;x<f;){const z=S[x];let Z=null,me=z>239?4:z>223?3:z>191?2:1;if(x+me<=f){let je,Oe,Be,Ee;switch(me){case 1:z<128&&(Z=z);break;case 2:je=S[x+1],(je&192)===128&&(Ee=(z&31)<<6|je&63,Ee>127&&(Z=Ee));break;case 3:je=S[x+1],Oe=S[x+2],(je&192)===128&&(Oe&192)===128&&(Ee=(z&15)<<12|(je&63)<<6|Oe&63,Ee>2047&&(Ee<55296||Ee>57343)&&(Z=Ee));break;case 4:je=S[x+1],Oe=S[x+2],Be=S[x+3],(je&192)===128&&(Oe&192)===128&&(Be&192)===128&&(Ee=(z&15)<<18|(je&63)<<12|(Oe&63)<<6|Be&63,Ee>65535&&Ee<1114112&&(Z=Ee))}}Z===null?(Z=65533,me=1):Z>65535&&(Z-=65536,A.push(Z>>>10&1023|55296),Z=56320|Z&1023),A.push(Z),x+=me}return W(A)}const U=4096;function W(S){const l=S.length;if(l<=U)return String.fromCharCode.apply(String,S);let f="",A=0;for(;A<l;)f+=String.fromCharCode.apply(String,S.slice(A,A+=U));return f}function se(S,l,f){let A="";f=Math.min(S.length,f);for(let x=l;x<f;++x)A+=String.fromCharCode(S[x]&127);return A}function re(S,l,f){let A="";f=Math.min(S.length,f);for(let x=l;x<f;++x)A+=String.fromCharCode(S[x]);return A}function ue(S,l,f){const A=S.length;(!l||l<0)&&(l=0),(!f||f<0||f>A)&&(f=A);let x="";for(let z=l;z<f;++z)x+=gn[S[z]];return x}function K(S,l,f){const A=S.slice(l,f);let x="";for(let z=0;z<A.length-1;z+=2)x+=String.fromCharCode(A[z]+A[z+1]*256);return x}a.prototype.slice=function(l,f){const A=this.length;l=~~l,f=f===void 0?A:~~f,l<0?(l+=A,l<0&&(l=0)):l>A&&(l=A),f<0?(f+=A,f<0&&(f=0)):f>A&&(f=A),f<l&&(f=l);const x=this.subarray(l,f);return Object.setPrototypeOf(x,a.prototype),x};function C(S,l,f){if(S%1!==0||S<0)throw new RangeError("offset is not uint");if(S+l>f)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(l,f,A){l=l>>>0,f=f>>>0,A||C(l,f,this.length);let x=this[l],z=1,Z=0;for(;++Z<f&&(z*=256);)x+=this[l+Z]*z;return x},a.prototype.readUintBE=a.prototype.readUIntBE=function(l,f,A){l=l>>>0,f=f>>>0,A||C(l,f,this.length);let x=this[l+--f],z=1;for(;f>0&&(z*=256);)x+=this[l+--f]*z;return x},a.prototype.readUint8=a.prototype.readUInt8=function(l,f){return l=l>>>0,f||C(l,1,this.length),this[l]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(l,f){return l=l>>>0,f||C(l,2,this.length),this[l]|this[l+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(l,f){return l=l>>>0,f||C(l,2,this.length),this[l]<<8|this[l+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(l,f){return l=l>>>0,f||C(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(l,f){return l=l>>>0,f||C(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},a.prototype.readBigUInt64LE=st(function(l){l=l>>>0,V(l,"offset");const f=this[l],A=this[l+7];(f===void 0||A===void 0)&&J(l,this.length-8);const x=f+this[++l]*2**8+this[++l]*2**16+this[++l]*2**24,z=this[++l]+this[++l]*2**8+this[++l]*2**16+A*2**24;return BigInt(x)+(BigInt(z)<<BigInt(32))}),a.prototype.readBigUInt64BE=st(function(l){l=l>>>0,V(l,"offset");const f=this[l],A=this[l+7];(f===void 0||A===void 0)&&J(l,this.length-8);const x=f*2**24+this[++l]*2**16+this[++l]*2**8+this[++l],z=this[++l]*2**24+this[++l]*2**16+this[++l]*2**8+A;return(BigInt(x)<<BigInt(32))+BigInt(z)}),a.prototype.readIntLE=function(l,f,A){l=l>>>0,f=f>>>0,A||C(l,f,this.length);let x=this[l],z=1,Z=0;for(;++Z<f&&(z*=256);)x+=this[l+Z]*z;return z*=128,x>=z&&(x-=Math.pow(2,8*f)),x},a.prototype.readIntBE=function(l,f,A){l=l>>>0,f=f>>>0,A||C(l,f,this.length);let x=f,z=1,Z=this[l+--x];for(;x>0&&(z*=256);)Z+=this[l+--x]*z;return z*=128,Z>=z&&(Z-=Math.pow(2,8*f)),Z},a.prototype.readInt8=function(l,f){return l=l>>>0,f||C(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},a.prototype.readInt16LE=function(l,f){l=l>>>0,f||C(l,2,this.length);const A=this[l]|this[l+1]<<8;return A&32768?A|4294901760:A},a.prototype.readInt16BE=function(l,f){l=l>>>0,f||C(l,2,this.length);const A=this[l+1]|this[l]<<8;return A&32768?A|4294901760:A},a.prototype.readInt32LE=function(l,f){return l=l>>>0,f||C(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},a.prototype.readInt32BE=function(l,f){return l=l>>>0,f||C(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},a.prototype.readBigInt64LE=st(function(l){l=l>>>0,V(l,"offset");const f=this[l],A=this[l+7];(f===void 0||A===void 0)&&J(l,this.length-8);const x=this[l+4]+this[l+5]*2**8+this[l+6]*2**16+(A<<24);return(BigInt(x)<<BigInt(32))+BigInt(f+this[++l]*2**8+this[++l]*2**16+this[++l]*2**24)}),a.prototype.readBigInt64BE=st(function(l){l=l>>>0,V(l,"offset");const f=this[l],A=this[l+7];(f===void 0||A===void 0)&&J(l,this.length-8);const x=(f<<24)+this[++l]*2**16+this[++l]*2**8+this[++l];return(BigInt(x)<<BigInt(32))+BigInt(this[++l]*2**24+this[++l]*2**16+this[++l]*2**8+A)}),a.prototype.readFloatLE=function(l,f){return l=l>>>0,f||C(l,4,this.length),n.read(this,l,!0,23,4)},a.prototype.readFloatBE=function(l,f){return l=l>>>0,f||C(l,4,this.length),n.read(this,l,!1,23,4)},a.prototype.readDoubleLE=function(l,f){return l=l>>>0,f||C(l,8,this.length),n.read(this,l,!0,52,8)},a.prototype.readDoubleBE=function(l,f){return l=l>>>0,f||C(l,8,this.length),n.read(this,l,!1,52,8)};function F(S,l,f,A,x,z){if(!a.isBuffer(S))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>x||l<z)throw new RangeError('"value" argument is out of bounds');if(f+A>S.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(l,f,A,x){if(l=+l,f=f>>>0,A=A>>>0,!x){const me=Math.pow(2,8*A)-1;F(this,l,f,A,me,0)}let z=1,Z=0;for(this[f]=l&255;++Z<A&&(z*=256);)this[f+Z]=l/z&255;return f+A},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(l,f,A,x){if(l=+l,f=f>>>0,A=A>>>0,!x){const me=Math.pow(2,8*A)-1;F(this,l,f,A,me,0)}let z=A-1,Z=1;for(this[f+z]=l&255;--z>=0&&(Z*=256);)this[f+z]=l/Z&255;return f+A},a.prototype.writeUint8=a.prototype.writeUInt8=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,1,255,0),this[f]=l&255,f+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,2,65535,0),this[f]=l&255,this[f+1]=l>>>8,f+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,2,65535,0),this[f]=l>>>8,this[f+1]=l&255,f+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,4,4294967295,0),this[f+3]=l>>>24,this[f+2]=l>>>16,this[f+1]=l>>>8,this[f]=l&255,f+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,4,4294967295,0),this[f]=l>>>24,this[f+1]=l>>>16,this[f+2]=l>>>8,this[f+3]=l&255,f+4};function B(S,l,f,A,x){D(l,A,x,S,f,7);let z=Number(l&BigInt(4294967295));S[f++]=z,z=z>>8,S[f++]=z,z=z>>8,S[f++]=z,z=z>>8,S[f++]=z;let Z=Number(l>>BigInt(32)&BigInt(4294967295));return S[f++]=Z,Z=Z>>8,S[f++]=Z,Z=Z>>8,S[f++]=Z,Z=Z>>8,S[f++]=Z,f}function $(S,l,f,A,x){D(l,A,x,S,f,7);let z=Number(l&BigInt(4294967295));S[f+7]=z,z=z>>8,S[f+6]=z,z=z>>8,S[f+5]=z,z=z>>8,S[f+4]=z;let Z=Number(l>>BigInt(32)&BigInt(4294967295));return S[f+3]=Z,Z=Z>>8,S[f+2]=Z,Z=Z>>8,S[f+1]=Z,Z=Z>>8,S[f]=Z,f+8}a.prototype.writeBigUInt64LE=st(function(l,f=0){return B(this,l,f,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=st(function(l,f=0){return $(this,l,f,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(l,f,A,x){if(l=+l,f=f>>>0,!x){const je=Math.pow(2,8*A-1);F(this,l,f,A,je-1,-je)}let z=0,Z=1,me=0;for(this[f]=l&255;++z<A&&(Z*=256);)l<0&&me===0&&this[f+z-1]!==0&&(me=1),this[f+z]=(l/Z>>0)-me&255;return f+A},a.prototype.writeIntBE=function(l,f,A,x){if(l=+l,f=f>>>0,!x){const je=Math.pow(2,8*A-1);F(this,l,f,A,je-1,-je)}let z=A-1,Z=1,me=0;for(this[f+z]=l&255;--z>=0&&(Z*=256);)l<0&&me===0&&this[f+z+1]!==0&&(me=1),this[f+z]=(l/Z>>0)-me&255;return f+A},a.prototype.writeInt8=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,1,127,-128),l<0&&(l=255+l+1),this[f]=l&255,f+1},a.prototype.writeInt16LE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,2,32767,-32768),this[f]=l&255,this[f+1]=l>>>8,f+2},a.prototype.writeInt16BE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,2,32767,-32768),this[f]=l>>>8,this[f+1]=l&255,f+2},a.prototype.writeInt32LE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,4,2147483647,-2147483648),this[f]=l&255,this[f+1]=l>>>8,this[f+2]=l>>>16,this[f+3]=l>>>24,f+4},a.prototype.writeInt32BE=function(l,f,A){return l=+l,f=f>>>0,A||F(this,l,f,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[f]=l>>>24,this[f+1]=l>>>16,this[f+2]=l>>>8,this[f+3]=l&255,f+4},a.prototype.writeBigInt64LE=st(function(l,f=0){return B(this,l,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=st(function(l,f=0){return $(this,l,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function T(S,l,f,A,x,z){if(f+A>S.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("Index out of range")}function M(S,l,f,A,x){return l=+l,f=f>>>0,x||T(S,l,f,4),n.write(S,l,f,A,23,4),f+4}a.prototype.writeFloatLE=function(l,f,A){return M(this,l,f,!0,A)},a.prototype.writeFloatBE=function(l,f,A){return M(this,l,f,!1,A)};function Q(S,l,f,A,x){return l=+l,f=f>>>0,x||T(S,l,f,8),n.write(S,l,f,A,52,8),f+8}a.prototype.writeDoubleLE=function(l,f,A){return Q(this,l,f,!0,A)},a.prototype.writeDoubleBE=function(l,f,A){return Q(this,l,f,!1,A)},a.prototype.copy=function(l,f,A,x){if(!a.isBuffer(l))throw new TypeError("argument should be a Buffer");if(A||(A=0),!x&&x!==0&&(x=this.length),f>=l.length&&(f=l.length),f||(f=0),x>0&&x<A&&(x=A),x===A||l.length===0||this.length===0)return 0;if(f<0)throw new RangeError("targetStart out of bounds");if(A<0||A>=this.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("sourceEnd out of bounds");x>this.length&&(x=this.length),l.length-f<x-A&&(x=l.length-f+A);const z=x-A;return this===l&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(f,A,x):Uint8Array.prototype.set.call(l,this.subarray(A,x),f),z},a.prototype.fill=function(l,f,A,x){if(typeof l=="string"){if(typeof f=="string"?(x=f,f=0,A=this.length):typeof A=="string"&&(x=A,A=this.length),x!==void 0&&typeof x!="string")throw new TypeError("encoding must be a string");if(typeof x=="string"&&!a.isEncoding(x))throw new TypeError("Unknown encoding: "+x);if(l.length===1){const Z=l.charCodeAt(0);(x==="utf8"&&Z<128||x==="latin1")&&(l=Z)}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(f<0||this.length<f||this.length<A)throw new RangeError("Out of range index");if(A<=f)return this;f=f>>>0,A=A===void 0?this.length:A>>>0,l||(l=0);let z;if(typeof l=="number")for(z=f;z<A;++z)this[z]=l;else{const Z=a.isBuffer(l)?l:a.from(l,x),me=Z.length;if(me===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for(z=0;z<A-f;++z)this[z+f]=Z[z%me]}return this};const X={};function pe(S,l,f){X[S]=class extends f{constructor(){super(),Object.defineProperty(this,"message",{value:l.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${S}]`,this.stack,delete this.name}get code(){return S}set code(x){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:x,writable:!0})}toString(){return`${this.name} [${S}]: ${this.message}`}}}pe("ERR_BUFFER_OUT_OF_BOUNDS",function(S){return S?`${S} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),pe("ERR_INVALID_ARG_TYPE",function(S,l){return`The "${S}" argument must be of type number. Received type ${typeof l}`},TypeError),pe("ERR_OUT_OF_RANGE",function(S,l,f){let A=`The value of "${S}" is out of range.`,x=f;return Number.isInteger(f)&&Math.abs(f)>2**32?x=oe(String(f)):typeof f=="bigint"&&(x=String(f),(f>BigInt(2)**BigInt(32)||f<-(BigInt(2)**BigInt(32)))&&(x=oe(x)),x+="n"),A+=` It must be ${l}. Received ${x}`,A},RangeError);function oe(S){let l="",f=S.length;const A=S[0]==="-"?1:0;for(;f>=A+4;f-=3)l=`_${S.slice(f-3,f)}${l}`;return`${S.slice(0,f)}${l}`}function j(S,l,f){V(l,"offset"),(S[l]===void 0||S[l+f]===void 0)&&J(l,S.length-(f+1))}function D(S,l,f,A,x,z){if(S>f||S<l){const Z=typeof l=="bigint"?"n":"";let me;throw l===0||l===BigInt(0)?me=`>= 0${Z} and < 2${Z} ** ${(z+1)*8}${Z}`:me=`>= -(2${Z} ** ${(z+1)*8-1}${Z}) and < 2 ** ${(z+1)*8-1}${Z}`,new X.ERR_OUT_OF_RANGE("value",me,S)}j(A,x,z)}function V(S,l){if(typeof S!="number")throw new X.ERR_INVALID_ARG_TYPE(l,"number",S)}function J(S,l,f){throw Math.floor(S)!==S?(V(S,f),new X.ERR_OUT_OF_RANGE("offset","an integer",S)):l<0?new X.ERR_BUFFER_OUT_OF_BOUNDS:new X.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${l}`,S)}const ne=/[^+/0-9A-Za-z-_]/g;function le(S){if(S=S.split("=")[0],S=S.trim().replace(ne,""),S.length<2)return"";for(;S.length%4!==0;)S=S+"=";return S}function $e(S,l){l=l||1/0;let f;const A=S.length;let x=null;const z=[];for(let Z=0;Z<A;++Z){if(f=S.charCodeAt(Z),f>55295&&f<57344){if(!x){if(f>56319){(l-=3)>-1&&z.push(239,191,189);continue}else if(Z+1===A){(l-=3)>-1&&z.push(239,191,189);continue}x=f;continue}if(f<56320){(l-=3)>-1&&z.push(239,191,189),x=f;continue}f=(x-55296<<10|f-56320)+65536}else x&&(l-=3)>-1&&z.push(239,191,189);if(x=null,f<128){if((l-=1)<0)break;z.push(f)}else if(f<2048){if((l-=2)<0)break;z.push(f>>6|192,f&63|128)}else if(f<65536){if((l-=3)<0)break;z.push(f>>12|224,f>>6&63|128,f&63|128)}else if(f<1114112){if((l-=4)<0)break;z.push(f>>18|240,f>>12&63|128,f>>6&63|128,f&63|128)}else throw new Error("Invalid code point")}return z}function Ue(S){const l=[];for(let f=0;f<S.length;++f)l.push(S.charCodeAt(f)&255);return l}function Ke(S,l){let f,A,x;const z=[];for(let Z=0;Z<S.length&&!((l-=2)<0);++Z)f=S.charCodeAt(Z),A=f>>8,x=f%256,z.push(x),z.push(A);return z}function Le(S){return e.toByteArray(le(S))}function xe(S,l,f,A){let x;for(x=0;x<A&&!(x+f>=l.length||x>=S.length);++x)l[x+f]=S[x];return x}function qe(S,l){return S instanceof l||S!=null&&S.constructor!=null&&S.constructor.name!=null&&S.constructor.name===l.name}function Je(S){return S!==S}const gn=(function(){const S="0123456789abcdef",l=new Array(256);for(let f=0;f<16;++f){const A=f*16;for(let x=0;x<16;++x)l[A+x]=S[f]+S[x]}return l})();function st(S){return typeof BigInt>"u"?Ct:S}function Ct(){throw new Error("BigInt not supported")}})(Ns)),Ns}var bn=qy();function Kt(t){const e=new ArrayBuffer(4);return new DataView(e).setInt32(0,t,!0),new Uint8Array(e)}class Vy extends Oi{getNodeDependencies({resolvedInputs:e}){const n=[];for(const r of Object.values(e??{}))for(const s of r)n.push(s.input.instanceId);return n}processNode({instance:e,component:n,resolvedInputs:r,sourceHash:s,state:i}){const o=[];o.push(bn.Buffer.from(e.id)),o.push(Kt(n.definitionHash)),i?.inputHashNonce&&o.push(Kt(i.inputHashNonce)),e.args&&o.push(My(e.args)),s?o.push(Kt(s)):Si(n)&&this.logger.warn({instanceId:e.id},"missing source hash for unit model, this may lead to incorrect input hash");const a=[...o],c=Object.entries(r).sort(([h],[m])=>h.localeCompare(m)),u=new Set;for(const[h,m]of c){if(Object.keys(m).length===0)continue;a.push(bn.Buffer.from(h));const b=m.map(w=>w.input.instanceId).sort();for(const w of b){const g=this.outputs.get(w);if(!g){this.logger.warn({instanceId:w,dependentInstanceId:e.id},"missing dependency when calculating input hash, this may lead to incorrect input hash");continue}a.push(Kt(g.inputHash)),a.push(Kt(g.outputHash)),u.add(w)}}const d=[],p=Array.from(u).sort();for(const h of p){const m=this.outputs.get(h);if(!m){this.logger.warn({instanceId:h,dependentInstanceId:e.id},"missing dependency when calculating dependency output hash, this may lead to incorrect input hash");continue}d.push(Kt(m.outputHash))}return{selfHash:Ts(bn.Buffer.concat(o)),inputHash:Ts(bn.Buffer.concat(a)),dependencyOutputHash:Ts(bn.Buffer.concat(d)),outputHash:i?.outputHash??0}}}var tr={exports:{}},Ps={},wt={},xt={},Cs={},xs={},js={},ko;function es(){return ko||(ko=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends e{constructor(y){if(super(),!t.IDENTIFIER.test(y))throw new Error("CodeGen: name must be a valid identifier");this.str=y}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=n;class r extends e{constructor(y){super(),this._items=typeof y=="string"?[y]:y}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const y=this._items[0];return y===""||y==='""'}get str(){var y;return(y=this._str)!==null&&y!==void 0?y:this._str=this._items.reduce((_,I)=>`${_}${I}`,"")}get names(){var y;return(y=this._names)!==null&&y!==void 0?y:this._names=this._items.reduce((_,I)=>(I instanceof n&&(_[I.str]=(_[I.str]||0)+1),_),{})}}t._Code=r,t.nil=new r("");function s(k,...y){const _=[k[0]];let I=0;for(;I<y.length;)a(_,y[I]),_.push(k[++I]);return new r(_)}t._=s;const i=new r("+");function o(k,...y){const _=[m(k[0])];let I=0;for(;I<y.length;)_.push(i),a(_,y[I]),_.push(i,m(k[++I]));return c(_),new r(_)}t.str=o;function a(k,y){y instanceof r?k.push(...y._items):y instanceof n?k.push(y):k.push(p(y))}t.addCodeArg=a;function c(k){let y=1;for(;y<k.length-1;){if(k[y]===i){const _=u(k[y-1],k[y+1]);if(_!==void 0){k.splice(y-1,3,_);continue}k[y++]="+"}y++}}function u(k,y){if(y==='""')return k;if(k==='""')return y;if(typeof k=="string")return y instanceof n||k[k.length-1]!=='"'?void 0:typeof y!="string"?`${k.slice(0,-1)}${y}"`:y[0]==='"'?k.slice(0,-1)+y.slice(1):void 0;if(typeof y=="string"&&y[0]==='"'&&!(k instanceof n))return`"${k}${y.slice(1)}`}function d(k,y){return y.emptyStr()?k:k.emptyStr()?y:o`${k}${y}`}t.strConcat=d;function p(k){return typeof k=="number"||typeof k=="boolean"||k===null?k:m(Array.isArray(k)?k.join(","):k)}function h(k){return new r(m(k))}t.stringify=h;function m(k){return JSON.stringify(k).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=m;function b(k){return typeof k=="string"&&t.IDENTIFIER.test(k)?new r(`.${k}`):s`[${k}]`}t.getProperty=b;function w(k){if(typeof k=="string"&&t.IDENTIFIER.test(k))return new r(`${k}`);throw new Error(`CodeGen: invalid export name: ${k}, use explicit $id name mapping`)}t.getEsmExportName=w;function g(k){return new r(k.toString())}t.regexpCode=g})(js)),js}var Bs={},So;function $o(){return So||(So=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=es();class n extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var r;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(r||(t.UsedValueState=r={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class s{constructor({prefixes:u,parent:d}={}){this._names={},this._prefixes=u,this._parent=d}toName(u){return u instanceof e.Name?u:this.name(u)}name(u){return new e.Name(this._newName(u))}_newName(u){const d=this._names[u]||this._nameGroup(u);return`${u}${d.index++}`}_nameGroup(u){var d,p;if(!((p=(d=this._parent)===null||d===void 0?void 0:d._prefixes)===null||p===void 0)&&p.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}t.Scope=s;class i extends e.Name{constructor(u,d){super(d),this.prefix=u}setValue(u,{property:d,itemIndex:p}){this.value=u,this.scopePath=(0,e._)`.${new e.Name(d)}[${p}]`}}t.ValueScopeName=i;const o=(0,e._)`\n`;class a extends s{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?o:e.nil}}get(){return this._scope}name(u){return new i(u,this._newName(u))}value(u,d){var p;if(d.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const h=this.toName(u),{prefix:m}=h,b=(p=d.key)!==null&&p!==void 0?p:d.ref;let w=this._values[m];if(w){const y=w.get(b);if(y)return y}else w=this._values[m]=new Map;w.set(b,h);const g=this._scope[m]||(this._scope[m]=[]),k=g.length;return g[k]=d.ref,h.setValue(d,{property:m,itemIndex:k}),h}getValue(u,d){const p=this._values[u];if(p)return p.get(d)}scopeRefs(u,d=this._values){return this._reduceValues(d,p=>{if(p.scopePath===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return(0,e._)`${u}${p.scopePath}`})}scopeCode(u=this._values,d,p){return this._reduceValues(u,h=>{if(h.value===void 0)throw new Error(`CodeGen: name "${h}" has no value`);return h.value.code},d,p)}_reduceValues(u,d,p={},h){let m=e.nil;for(const b in u){const w=u[b];if(!w)continue;const g=p[b]=p[b]||new Map;w.forEach(k=>{if(g.has(k))return;g.set(k,r.Started);let y=d(k);if(y){const _=this.opts.es5?t.varKinds.var:t.varKinds.const;m=(0,e._)`${m}${_} ${k} = ${y};${this.opts._n}`}else if(y=h?.(k))m=(0,e._)`${m}${y}${this.opts._n}`;else throw new n(k);g.set(k,r.Completed)})}return m}}t.ValueScope=a})(Bs)),Bs}var Eo;function ge(){return Eo||(Eo=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=es(),n=$o();var r=es();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}});var s=$o();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class i{optimizeNodes(){return this}optimizeNames($,T){return this}}class o extends i{constructor($,T,M){super(),this.varKind=$,this.name=T,this.rhs=M}render({es5:$,_n:T}){const M=$?n.varKinds.var:this.varKind,Q=this.rhs===void 0?"":` = ${this.rhs}`;return`${M} ${this.name}${Q};`+T}optimizeNames($,T){if($[this.name.str])return this.rhs&&(this.rhs=he(this.rhs,$,T)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class a extends i{constructor($,T,M){super(),this.lhs=$,this.rhs=T,this.sideEffects=M}render({_n:$}){return`${this.lhs} = ${this.rhs};`+$}optimizeNames($,T){if(!(this.lhs instanceof e.Name&&!$[this.lhs.str]&&!this.sideEffects))return this.rhs=he(this.rhs,$,T),this}get names(){const $=this.lhs instanceof e.Name?{}:{...this.lhs.names};return ie($,this.rhs)}}class c extends a{constructor($,T,M,Q){super($,M,Q),this.op=T}render({_n:$}){return`${this.lhs} ${this.op}= ${this.rhs};`+$}}class u extends i{constructor($){super(),this.label=$,this.names={}}render({_n:$}){return`${this.label}:`+$}}class d extends i{constructor($){super(),this.label=$,this.names={}}render({_n:$}){return`break${this.label?` ${this.label}`:""};`+$}}class p extends i{constructor($){super(),this.error=$}render({_n:$}){return`throw ${this.error};`+$}get names(){return this.error.names}}class h extends i{constructor($){super(),this.code=$}render({_n:$}){return`${this.code};`+$}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames($,T){return this.code=he(this.code,$,T),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class m extends i{constructor($=[]){super(),this.nodes=$}render($){return this.nodes.reduce((T,M)=>T+M.render($),"")}optimizeNodes(){const{nodes:$}=this;let T=$.length;for(;T--;){const M=$[T].optimizeNodes();Array.isArray(M)?$.splice(T,1,...M):M?$[T]=M:$.splice(T,1)}return $.length>0?this:void 0}optimizeNames($,T){const{nodes:M}=this;let Q=M.length;for(;Q--;){const X=M[Q];X.optimizeNames($,T)||(U($,X.names),M.splice(Q,1))}return M.length>0?this:void 0}get names(){return this.nodes.reduce(($,T)=>Y($,T.names),{})}}class b extends m{render($){return"{"+$._n+super.render($)+"}"+$._n}}class w extends m{}class g extends b{}g.kind="else";class k extends b{constructor($,T){super(T),this.condition=$}render($){let T=`if(${this.condition})`+super.render($);return this.else&&(T+="else "+this.else.render($)),T}optimizeNodes(){super.optimizeNodes();const $=this.condition;if($===!0)return this.nodes;let T=this.else;if(T){const M=T.optimizeNodes();T=this.else=Array.isArray(M)?new g(M):M}if(T)return $===!1?T instanceof k?T:T.nodes:this.nodes.length?this:new k(W($),T instanceof k?[T]:T.nodes);if(!($===!1||!this.nodes.length))return this}optimizeNames($,T){var M;if(this.else=(M=this.else)===null||M===void 0?void 0:M.optimizeNames($,T),!!(super.optimizeNames($,T)||this.else))return this.condition=he(this.condition,$,T),this}get names(){const $=super.names;return ie($,this.condition),this.else&&Y($,this.else.names),$}}k.kind="if";class y extends b{}y.kind="for";class _ extends y{constructor($){super(),this.iteration=$}render($){return`for(${this.iteration})`+super.render($)}optimizeNames($,T){if(super.optimizeNames($,T))return this.iteration=he(this.iteration,$,T),this}get names(){return Y(super.names,this.iteration.names)}}class I extends y{constructor($,T,M,Q){super(),this.varKind=$,this.name=T,this.from=M,this.to=Q}render($){const T=$.es5?n.varKinds.var:this.varKind,{name:M,from:Q,to:X}=this;return`for(${T} ${M}=${Q}; ${M}<${X}; ${M}++)`+super.render($)}get names(){const $=ie(super.names,this.from);return ie($,this.to)}}class v extends y{constructor($,T,M,Q){super(),this.loop=$,this.varKind=T,this.name=M,this.iterable=Q}render($){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render($)}optimizeNames($,T){if(super.optimizeNames($,T))return this.iterable=he(this.iterable,$,T),this}get names(){return Y(super.names,this.iterable.names)}}class E extends b{constructor($,T,M){super(),this.name=$,this.args=T,this.async=M}render($){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render($)}}E.kind="func";class O extends m{render($){return"return "+super.render($)}}O.kind="return";class P extends b{render($){let T="try"+super.render($);return this.catch&&(T+=this.catch.render($)),this.finally&&(T+=this.finally.render($)),T}optimizeNodes(){var $,T;return super.optimizeNodes(),($=this.catch)===null||$===void 0||$.optimizeNodes(),(T=this.finally)===null||T===void 0||T.optimizeNodes(),this}optimizeNames($,T){var M,Q;return super.optimizeNames($,T),(M=this.catch)===null||M===void 0||M.optimizeNames($,T),(Q=this.finally)===null||Q===void 0||Q.optimizeNames($,T),this}get names(){const $=super.names;return this.catch&&Y($,this.catch.names),this.finally&&Y($,this.finally.names),$}}class q extends b{constructor($){super(),this.error=$}render($){return`catch(${this.error})`+super.render($)}}q.kind="catch";class H extends b{render($){return"finally"+super.render($)}}H.kind="finally";class G{constructor($,T={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...T,_n:T.lines?`
170
170
  `:""},this._extScope=$,this._scope=new n.Scope({parent:$}),this._nodes=[new w]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,T){const M=this._extScope.value($,T);return(this._values[M.prefix]||(this._values[M.prefix]=new Set)).add(M),M}getScopeValue($,T){return this._extScope.getValue($,T)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,T,M,Q){const X=this._scope.toName(T);return M!==void 0&&Q&&(this._constants[X.str]=M),this._leafNode(new o($,X,M)),X}const($,T,M){return this._def(n.varKinds.const,$,T,M)}let($,T,M){return this._def(n.varKinds.let,$,T,M)}var($,T,M){return this._def(n.varKinds.var,$,T,M)}assign($,T,M){return this._leafNode(new a($,T,M))}add($,T){return this._leafNode(new c($,t.operators.ADD,T))}code($){return typeof $=="function"?$():$!==e.nil&&this._leafNode(new h($)),this}object(...$){const T=["{"];for(const[M,Q]of $)T.length>1&&T.push(","),T.push(M),(M!==Q||this.opts.es5)&&(T.push(":"),(0,e.addCodeArg)(T,Q));return T.push("}"),new e._Code(T)}if($,T,M){if(this._blockNode(new k($)),T&&M)this.code(T).else().code(M).endIf();else if(T)this.code(T).endIf();else if(M)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new k($))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(k,g)}_for($,T){return this._blockNode($),T&&this.code(T).endFor(),this}for($,T){return this._for(new _($),T)}forRange($,T,M,Q,X=this.opts.es5?n.varKinds.var:n.varKinds.let){const pe=this._scope.toName($);return this._for(new I(X,pe,T,M),()=>Q(pe))}forOf($,T,M,Q=n.varKinds.const){const X=this._scope.toName($);if(this.opts.es5){const pe=T instanceof e.Name?T:this.var("_arr",T);return this.forRange("_i",0,(0,e._)`${pe}.length`,oe=>{this.var(X,(0,e._)`${pe}[${oe}]`),M(X)})}return this._for(new v("of",Q,X,T),()=>M(X))}forIn($,T,M,Q=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf($,(0,e._)`Object.keys(${T})`,M);const X=this._scope.toName($);return this._for(new v("in",Q,X,T),()=>M(X))}endFor(){return this._endBlockNode(y)}label($){return this._leafNode(new u($))}break($){return this._leafNode(new d($))}return($){const T=new O;if(this._blockNode(T),this.code($),T.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(O)}try($,T,M){if(!T&&!M)throw new Error('CodeGen: "try" without "catch" and "finally"');const Q=new P;if(this._blockNode(Q),this.code($),T){const X=this.name("e");this._currNode=Q.catch=new q(X),T(X)}return M&&(this._currNode=Q.finally=new H,this.code(M)),this._endBlockNode(q,H)}throw($){return this._leafNode(new p($))}block($,T){return this._blockStarts.push(this._nodes.length),$&&this.code($).endBlock(T),this}endBlock($){const T=this._blockStarts.pop();if(T===void 0)throw new Error("CodeGen: not in self-balancing block");const M=this._nodes.length-T;if(M<0||$!==void 0&&M!==$)throw new Error(`CodeGen: wrong number of nodes: ${M} vs ${$} expected`);return this._nodes.length=T,this}func($,T=e.nil,M,Q){return this._blockNode(new E($,T,M)),Q&&this.code(Q).endFunc(),this}endFunc(){return this._endBlockNode(E)}optimize($=1){for(;$-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode($){return this._currNode.nodes.push($),this}_blockNode($){this._currNode.nodes.push($),this._nodes.push($)}_endBlockNode($,T){const M=this._currNode;if(M instanceof $||T&&M instanceof T)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${T?`${$.kind}/${T.kind}`:$.kind}"`)}_elseNode($){const T=this._currNode;if(!(T instanceof k))throw new Error('CodeGen: "else" without "if"');return this._currNode=T.else=$,this}get _root(){return this._nodes[0]}get _currNode(){const $=this._nodes;return $[$.length-1]}set _currNode($){const T=this._nodes;T[T.length-1]=$}}t.CodeGen=G;function Y(B,$){for(const T in $)B[T]=(B[T]||0)+($[T]||0);return B}function ie(B,$){return $ instanceof e._CodeOrName?Y(B,$.names):B}function he(B,$,T){if(B instanceof e.Name)return M(B);if(!Q(B))return B;return new e._Code(B._items.reduce((X,pe)=>(pe instanceof e.Name&&(pe=M(pe)),pe instanceof e._Code?X.push(...pe._items):X.push(pe),X),[]));function M(X){const pe=T[X.str];return pe===void 0||$[X.str]!==1?X:(delete $[X.str],pe)}function Q(X){return X instanceof e._Code&&X._items.some(pe=>pe instanceof e.Name&&$[pe.str]===1&&T[pe.str]!==void 0)}}function U(B,$){for(const T in $)B[T]=(B[T]||0)-($[T]||0)}function W(B){return typeof B=="boolean"||typeof B=="number"||B===null?!B:(0,e._)`!${F(B)}`}t.not=W;const se=C(t.operators.AND);function re(...B){return B.reduce(se)}t.and=re;const ue=C(t.operators.OR);function K(...B){return B.reduce(ue)}t.or=K;function C(B){return($,T)=>$===e.nil?T:T===e.nil?$:(0,e._)`${F($)} ${B} ${F(T)}`}function F(B){return B instanceof e.Name?B:(0,e._)`(${B})`}})(xs)),xs}var de={},Io;function be(){if(Io)return de;Io=1,Object.defineProperty(de,"__esModule",{value:!0}),de.checkStrictMode=de.getErrorPath=de.Type=de.useFunc=de.setEvaluated=de.evaluatedPropsToName=de.mergeEvaluated=de.eachItem=de.unescapeJsonPointer=de.escapeJsonPointer=de.escapeFragment=de.unescapeFragment=de.schemaRefOrVal=de.schemaHasRulesButRef=de.schemaHasRules=de.checkUnknownRules=de.alwaysValidSchema=de.toHash=void 0;const t=ge(),e=es();function n(v){const E={};for(const O of v)E[O]=!0;return E}de.toHash=n;function r(v,E){return typeof E=="boolean"?E:Object.keys(E).length===0?!0:(s(v,E),!i(E,v.self.RULES.all))}de.alwaysValidSchema=r;function s(v,E=v.schema){const{opts:O,self:P}=v;if(!O.strictSchema||typeof E=="boolean")return;const q=P.RULES.keywords;for(const H in E)q[H]||I(v,`unknown keyword: "${H}"`)}de.checkUnknownRules=s;function i(v,E){if(typeof v=="boolean")return!v;for(const O in v)if(E[O])return!0;return!1}de.schemaHasRules=i;function o(v,E){if(typeof v=="boolean")return!v;for(const O in v)if(O!=="$ref"&&E.all[O])return!0;return!1}de.schemaHasRulesButRef=o;function a({topSchemaRef:v,schemaPath:E},O,P,q){if(!q){if(typeof O=="number"||typeof O=="boolean")return O;if(typeof O=="string")return(0,t._)`${O}`}return(0,t._)`${v}${E}${(0,t.getProperty)(P)}`}de.schemaRefOrVal=a;function c(v){return p(decodeURIComponent(v))}de.unescapeFragment=c;function u(v){return encodeURIComponent(d(v))}de.escapeFragment=u;function d(v){return typeof v=="number"?`${v}`:v.replace(/~/g,"~0").replace(/\//g,"~1")}de.escapeJsonPointer=d;function p(v){return v.replace(/~1/g,"/").replace(/~0/g,"~")}de.unescapeJsonPointer=p;function h(v,E){if(Array.isArray(v))for(const O of v)E(O);else E(v)}de.eachItem=h;function m({mergeNames:v,mergeToName:E,mergeValues:O,resultToName:P}){return(q,H,G,Y)=>{const ie=G===void 0?H:G instanceof t.Name?(H instanceof t.Name?v(q,H,G):E(q,H,G),G):H instanceof t.Name?(E(q,G,H),H):O(H,G);return Y===t.Name&&!(ie instanceof t.Name)?P(q,ie):ie}}de.mergeEvaluated={props:m({mergeNames:(v,E,O)=>v.if((0,t._)`${O} !== true && ${E} !== undefined`,()=>{v.if((0,t._)`${E} === true`,()=>v.assign(O,!0),()=>v.assign(O,(0,t._)`${O} || {}`).code((0,t._)`Object.assign(${O}, ${E})`))}),mergeToName:(v,E,O)=>v.if((0,t._)`${O} !== true`,()=>{E===!0?v.assign(O,!0):(v.assign(O,(0,t._)`${O} || {}`),w(v,O,E))}),mergeValues:(v,E)=>v===!0?!0:{...v,...E},resultToName:b}),items:m({mergeNames:(v,E,O)=>v.if((0,t._)`${O} !== true && ${E} !== undefined`,()=>v.assign(O,(0,t._)`${E} === true ? true : ${O} > ${E} ? ${O} : ${E}`)),mergeToName:(v,E,O)=>v.if((0,t._)`${O} !== true`,()=>v.assign(O,E===!0?!0:(0,t._)`${O} > ${E} ? ${O} : ${E}`)),mergeValues:(v,E)=>v===!0?!0:Math.max(v,E),resultToName:(v,E)=>v.var("items",E)})};function b(v,E){if(E===!0)return v.var("props",!0);const O=v.var("props",(0,t._)`{}`);return E!==void 0&&w(v,O,E),O}de.evaluatedPropsToName=b;function w(v,E,O){Object.keys(O).forEach(P=>v.assign((0,t._)`${E}${(0,t.getProperty)(P)}`,!0))}de.setEvaluated=w;const g={};function k(v,E){return v.scopeValue("func",{ref:E,code:g[E.code]||(g[E.code]=new e._Code(E.code))})}de.useFunc=k;var y;(function(v){v[v.Num=0]="Num",v[v.Str=1]="Str"})(y||(de.Type=y={}));function _(v,E,O){if(v instanceof t.Name){const P=E===y.Num;return O?P?(0,t._)`"[" + ${v} + "]"`:(0,t._)`"['" + ${v} + "']"`:P?(0,t._)`"/" + ${v}`:(0,t._)`"/" + ${v}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return O?(0,t.getProperty)(v).toString():"/"+d(v)}de.getErrorPath=_;function I(v,E,O=v.opts.strictSchema){if(O){if(E=`strict mode: ${E}`,O===!0)throw new Error(E);v.self.logger.warn(E)}}return de.checkStrictMode=I,de}var nr={},Ao;function Pt(){if(Ao)return nr;Ao=1,Object.defineProperty(nr,"__esModule",{value:!0});const t=ge(),e={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};return nr.default=e,nr}var Oo;function ys(){return Oo||(Oo=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const e=ge(),n=be(),r=Pt();t.keywordError={message:({keyword:g})=>(0,e.str)`must pass "${g}" keyword validation`},t.keyword$DataError={message:({keyword:g,schemaType:k})=>k?(0,e.str)`"${g}" keyword must be ${k} ($data)`:(0,e.str)`"${g}" keyword is invalid ($data)`};function s(g,k=t.keywordError,y,_){const{it:I}=g,{gen:v,compositeRule:E,allErrors:O}=I,P=p(g,k,y);_??(E||O)?c(v,P):u(I,(0,e._)`[${P}]`)}t.reportError=s;function i(g,k=t.keywordError,y){const{it:_}=g,{gen:I,compositeRule:v,allErrors:E}=_,O=p(g,k,y);c(I,O),v||E||u(_,r.default.vErrors)}t.reportExtraError=i;function o(g,k){g.assign(r.default.errors,k),g.if((0,e._)`${r.default.vErrors} !== null`,()=>g.if(k,()=>g.assign((0,e._)`${r.default.vErrors}.length`,k),()=>g.assign(r.default.vErrors,null)))}t.resetErrorsCount=o;function a({gen:g,keyword:k,schemaValue:y,data:_,errsCount:I,it:v}){if(I===void 0)throw new Error("ajv implementation error");const E=g.name("err");g.forRange("i",I,r.default.errors,O=>{g.const(E,(0,e._)`${r.default.vErrors}[${O}]`),g.if((0,e._)`${E}.instancePath === undefined`,()=>g.assign((0,e._)`${E}.instancePath`,(0,e.strConcat)(r.default.instancePath,v.errorPath))),g.assign((0,e._)`${E}.schemaPath`,(0,e.str)`${v.errSchemaPath}/${k}`),v.opts.verbose&&(g.assign((0,e._)`${E}.schema`,y),g.assign((0,e._)`${E}.data`,_))})}t.extendErrors=a;function c(g,k){const y=g.const("err",k);g.if((0,e._)`${r.default.vErrors} === null`,()=>g.assign(r.default.vErrors,(0,e._)`[${y}]`),(0,e._)`${r.default.vErrors}.push(${y})`),g.code((0,e._)`${r.default.errors}++`)}function u(g,k){const{gen:y,validateName:_,schemaEnv:I}=g;I.$async?y.throw((0,e._)`new ${g.ValidationError}(${k})`):(y.assign((0,e._)`${_}.errors`,k),y.return(!1))}const d={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function p(g,k,y){const{createErrors:_}=g.it;return _===!1?(0,e._)`{}`:h(g,k,y)}function h(g,k,y={}){const{gen:_,it:I}=g,v=[m(I,y),b(g,y)];return w(g,k,v),_.object(...v)}function m({errorPath:g},{instancePath:k}){const y=k?(0,e.str)`${g}${(0,n.getErrorPath)(k,n.Type.Str)}`:g;return[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,y)]}function b({keyword:g,it:{errSchemaPath:k}},{schemaPath:y,parentSchema:_}){let I=_?k:(0,e.str)`${k}/${g}`;return y&&(I=(0,e.str)`${I}${(0,n.getErrorPath)(y,n.Type.Str)}`),[d.schemaPath,I]}function w(g,{params:k,message:y},_){const{keyword:I,data:v,schemaValue:E,it:O}=g,{opts:P,propertyName:q,topSchemaRef:H,schemaPath:G}=O;_.push([d.keyword,I],[d.params,typeof k=="function"?k(g):k||(0,e._)`{}`]),P.messages&&_.push([d.message,typeof y=="function"?y(g):y]),P.verbose&&_.push([d.schema,E],[d.parentSchema,(0,e._)`${H}${G}`],[r.default.data,v]),q&&_.push([d.propertyName,q])}})(Cs)),Cs}var To;function Zy(){if(To)return xt;To=1,Object.defineProperty(xt,"__esModule",{value:!0}),xt.boolOrEmptySchema=xt.topBoolOrEmptySchema=void 0;const t=ys(),e=ge(),n=Pt(),r={message:"boolean schema is false"};function s(a){const{gen:c,schema:u,validateName:d}=a;u===!1?o(a,!1):typeof u=="object"&&u.$async===!0?c.return(n.default.data):(c.assign((0,e._)`${d}.errors`,null),c.return(!0))}xt.topBoolOrEmptySchema=s;function i(a,c){const{gen:u,schema:d}=a;d===!1?(u.var(c,!1),o(a)):u.var(c,!0)}xt.boolOrEmptySchema=i;function o(a,c){const{gen:u,data:d}=a,p={gen:u,keyword:"false schema",data:d,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:a};(0,t.reportError)(p,r,void 0,c)}return xt}var Ve={},jt={},No;function Nu(){if(No)return jt;No=1,Object.defineProperty(jt,"__esModule",{value:!0}),jt.getRules=jt.isJSONType=void 0;const t=["string","number","integer","boolean","null","object","array"],e=new Set(t);function n(s){return typeof s=="string"&&e.has(s)}jt.isJSONType=n;function r(){const s={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...s,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},s.number,s.string,s.array,s.object],post:{rules:[]},all:{},keywords:{}}}return jt.getRules=r,jt}var vt={},Po;function Pu(){if(Po)return vt;Po=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.shouldUseRule=vt.shouldUseGroup=vt.schemaHasRulesForType=void 0;function t({schema:r,self:s},i){const o=s.RULES.types[i];return o&&o!==!0&&e(r,o)}vt.schemaHasRulesForType=t;function e(r,s){return s.rules.some(i=>n(r,i))}vt.shouldUseGroup=e;function n(r,s){var i;return r[s.keyword]!==void 0||((i=s.definition.implements)===null||i===void 0?void 0:i.some(o=>r[o]!==void 0))}return vt.shouldUseRule=n,vt}var Co;function ts(){if(Co)return Ve;Co=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.reportTypeError=Ve.checkDataTypes=Ve.checkDataType=Ve.coerceAndCheckDataType=Ve.getJSONTypes=Ve.getSchemaTypes=Ve.DataType=void 0;const t=Nu(),e=Pu(),n=ys(),r=ge(),s=be();var i;(function(y){y[y.Correct=0]="Correct",y[y.Wrong=1]="Wrong"})(i||(Ve.DataType=i={}));function o(y){const _=a(y.type);if(_.includes("null")){if(y.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!_.length&&y.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');y.nullable===!0&&_.push("null")}return _}Ve.getSchemaTypes=o;function a(y){const _=Array.isArray(y)?y:y?[y]:[];if(_.every(t.isJSONType))return _;throw new Error("type must be JSONType or JSONType[]: "+_.join(","))}Ve.getJSONTypes=a;function c(y,_){const{gen:I,data:v,opts:E}=y,O=d(_,E.coerceTypes),P=_.length>0&&!(O.length===0&&_.length===1&&(0,e.schemaHasRulesForType)(y,_[0]));if(P){const q=b(_,v,E.strictNumbers,i.Wrong);I.if(q,()=>{O.length?p(y,_,O):g(y)})}return P}Ve.coerceAndCheckDataType=c;const u=new Set(["string","number","integer","boolean","null"]);function d(y,_){return _?y.filter(I=>u.has(I)||_==="array"&&I==="array"):[]}function p(y,_,I){const{gen:v,data:E,opts:O}=y,P=v.let("dataType",(0,r._)`typeof ${E}`),q=v.let("coerced",(0,r._)`undefined`);O.coerceTypes==="array"&&v.if((0,r._)`${P} == 'object' && Array.isArray(${E}) && ${E}.length == 1`,()=>v.assign(E,(0,r._)`${E}[0]`).assign(P,(0,r._)`typeof ${E}`).if(b(_,E,O.strictNumbers),()=>v.assign(q,E))),v.if((0,r._)`${q} !== undefined`);for(const G of I)(u.has(G)||G==="array"&&O.coerceTypes==="array")&&H(G);v.else(),g(y),v.endIf(),v.if((0,r._)`${q} !== undefined`,()=>{v.assign(E,q),h(y,q)});function H(G){switch(G){case"string":v.elseIf((0,r._)`${P} == "number" || ${P} == "boolean"`).assign(q,(0,r._)`"" + ${E}`).elseIf((0,r._)`${E} === null`).assign(q,(0,r._)`""`);return;case"number":v.elseIf((0,r._)`${P} == "boolean" || ${E} === null
171
171
  || (${P} == "string" && ${E} && ${E} == +${E})`).assign(q,(0,r._)`+${E}`);return;case"integer":v.elseIf((0,r._)`${P} === "boolean" || ${E} === null
172
172
  || (${P} === "string" && ${E} && ${E} == +${E} && !(${E} % 1))`).assign(q,(0,r._)`+${E}`);return;case"boolean":v.elseIf((0,r._)`${E} === "false" || ${E} === 0 || ${E} === null`).assign(q,!1).elseIf((0,r._)`${E} === "true" || ${E} === 1`).assign(q,!0);return;case"null":v.elseIf((0,r._)`${E} === "" || ${E} === 0 || ${E} === false`),v.assign(q,null);return;case"array":v.elseIf((0,r._)`${P} === "string" || ${P} === "number"