@aipt/cli 0.1.19 → 0.1.24
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.
- package/README.md +90 -6
- package/dist/application-runner.js +177 -176
- package/dist/application.js +94 -93
- package/dist/chunk.js +3 -3
- package/dist/optional-runtime.js +27 -27
- package/dist/package-releases/aipt--cli/0.1.20/release.json +29 -0
- package/dist/package-releases/aipt--cli/0.1.21/release.json +29 -0
- package/dist/package-releases/aipt--cli/0.1.22/release.json +29 -0
- package/dist/package-releases/aipt--cli/0.1.23/release.json +29 -0
- package/dist/package-releases/aipt--idp-setup/0.1.0/release.json +30 -0
- package/dist/package-releases/aipt--idp-setup/0.1.1/release.json +31 -0
- package/dist/package-releases/aipt--platform-kernel/0.1.7/release.json +33 -0
- package/docs/bootstrap.md +1 -1
- package/docs/command-reference.md +1 -0
- package/docs/engineering-workflow.md +1 -1
- package/docs/vibe-coding-guide.md +2 -0
- package/documentation-manifest.json +5 -5
- package/package.json +4 -4
package/dist/optional-runtime.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
var TE=Object.create;var sc=Object.defineProperty;var jE=Object.getOwnPropertyDescriptor;var LE=Object.getOwnPropertyNames;var $E=Object.getPrototypeOf,ME=Object.prototype.hasOwnProperty;var $t=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var $e=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var w=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},cc=(e,t)=>{for(var r in t)sc(e,r,{get:t[r],enumerable:!0})},VE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of LE(t))!ME.call(e,i)&&i!==r&&sc(e,i,{get:()=>t[i],enumerable:!(n=jE(t,i))||n.enumerable});return e};var rr=(e,t,r)=>(r=e!=null?TE($E(e)):{},VE(t||!e||!e.__esModule?sc(r,"default",{value:e,enumerable:!0}):r,e));var yi=w(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.regexpCode=q.getEsmExportName=q.getProperty=q.safeStringify=q.stringify=q.strConcat=q.addCodeArg=q.str=q._=q.nil=q._Code=q.Name=q.IDENTIFIER=q._CodeOrName=void 0;var mi=class{};q._CodeOrName=mi;q.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Sr=class extends mi{constructor(t){if(super(),!q.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};q.Name=Sr;var Ze=class extends mi{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof Sr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};q._Code=Ze;q.nil=new Ze("");function fu(e,...t){let r=[e[0]],n=0;for(;n<t.length;)lc(r,t[n]),r.push(e[++n]);return new Ze(r)}q._=fu;var dc=new Ze("+");function pu(e,...t){let r=[gi(e[0])],n=0;for(;n<t.length;)r.push(dc),lc(r,t[n]),r.push(dc,gi(e[++n]));return UE(r),new Ze(r)}q.str=pu;function lc(e,t){t instanceof Ze?e.push(...t._items):t instanceof Sr?e.push(t):e.push(BE(t))}q.addCodeArg=lc;function UE(e){let t=1;for(;t<e.length-1;){if(e[t]===dc){let r=FE(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function FE(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Sr||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Sr))return`"${e}${t.slice(1)}`}function zE(e,t){return t.emptyStr()?e:e.emptyStr()?t:pu`${e}${t}`}q.strConcat=zE;function BE(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:gi(Array.isArray(e)?e.join(","):e)}function qE(e){return new Ze(gi(e))}q.stringify=qE;function gi(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}q.safeStringify=gi;function GE(e){return typeof e=="string"&&q.IDENTIFIER.test(e)?new Ze(`.${e}`):fu`[${e}]`}q.getProperty=GE;function KE(e){if(typeof e=="string"&&q.IDENTIFIER.test(e))return new Ze(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}q.getEsmExportName=KE;function WE(e){return new Ze(e.toString())}q.regexpCode=WE});var uc=w(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ValueScope=Ve.ValueScopeName=Ve.Scope=Ve.varKinds=Ve.UsedValueState=void 0;var Me=yi(),fc=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Ja;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ja||(Ve.UsedValueState=Ja={}));Ve.varKinds={const:new Me.Name("const"),let:new Me.Name("let"),var:new Me.Name("var")};var Ya=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Me.Name?t:this.name(t)}name(t){return new Me.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Ve.Scope=Ya;var Za=class extends Me.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Me._)`.${new Me.Name(r)}[${n}]`}};Ve.ValueScopeName=Za;var HE=(0,Me._)`\n`,pc=class extends Ya{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?HE:Me.nil}}get(){return this._scope}name(t){return new Za(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:a}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[a];if(s){let l=s.get(o);if(l)return l}else s=this._values[a]=new Map;s.set(o,i);let c=this._scope[a]||(this._scope[a]=[]),d=c.length;return c[d]=r.ref,i.setValue(r,{property:a,itemIndex:d}),i}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Me._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(t,r,n={},i){let a=Me.nil;for(let o in t){let s=t[o];if(!s)continue;let c=n[o]=n[o]||new Map;s.forEach(d=>{if(c.has(d))return;c.set(d,Ja.Started);let l=r(d);if(l){let f=this.opts.es5?Ve.varKinds.var:Ve.varKinds.const;a=(0,Me._)`${a}${f} ${d} = ${l};${this.opts._n}`}else if(l=i?.(d))a=(0,Me._)`${a}${l}${this.opts._n}`;else throw new fc(d);c.set(d,Ja.Completed)})}return a}};Ve.ValueScope=pc});var T=w(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.or=L.and=L.not=L.CodeGen=L.operators=L.varKinds=L.ValueScopeName=L.ValueScope=L.Scope=L.Name=L.regexpCode=L.stringify=L.getProperty=L.nil=L.strConcat=L.str=L._=void 0;var U=yi(),dt=uc(),nr=yi();Object.defineProperty(L,"_",{enumerable:!0,get:function(){return nr._}});Object.defineProperty(L,"str",{enumerable:!0,get:function(){return nr.str}});Object.defineProperty(L,"strConcat",{enumerable:!0,get:function(){return nr.strConcat}});Object.defineProperty(L,"nil",{enumerable:!0,get:function(){return nr.nil}});Object.defineProperty(L,"getProperty",{enumerable:!0,get:function(){return nr.getProperty}});Object.defineProperty(L,"stringify",{enumerable:!0,get:function(){return nr.stringify}});Object.defineProperty(L,"regexpCode",{enumerable:!0,get:function(){return nr.regexpCode}});Object.defineProperty(L,"Name",{enumerable:!0,get:function(){return nr.Name}});var to=uc();Object.defineProperty(L,"Scope",{enumerable:!0,get:function(){return to.Scope}});Object.defineProperty(L,"ValueScope",{enumerable:!0,get:function(){return to.ValueScope}});Object.defineProperty(L,"ValueScopeName",{enumerable:!0,get:function(){return to.ValueScopeName}});Object.defineProperty(L,"varKinds",{enumerable:!0,get:function(){return to.varKinds}});L.operators={GT:new U._Code(">"),GTE:new U._Code(">="),LT:new U._Code("<"),LTE:new U._Code("<="),EQ:new U._Code("==="),NEQ:new U._Code("!=="),NOT:new U._Code("!"),OR:new U._Code("||"),AND:new U._Code("&&"),ADD:new U._Code("+")};var Mt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},hc=class extends Mt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?dt.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=fn(this.rhs,t,r)),this}get names(){return this.rhs instanceof U._CodeOrName?this.rhs.names:{}}},Xa=class extends Mt{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof U.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=fn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof U.Name?{}:{...this.lhs.names};return eo(t,this.rhs)}},mc=class extends Xa{constructor(t,r,n,i){super(t,n,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},gc=class extends Mt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},yc=class extends Mt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},wc=class extends Mt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},_c=class extends Mt{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=fn(this.code,t,r),this}get names(){return this.code instanceof U._CodeOrName?this.code.names:{}}},wi=class extends Mt{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,i=n.length;for(;i--;){let a=n[i];a.optimizeNames(t,r)||(JE(t,a.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Or(t,r.names),{})}},Vt=class extends wi{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Ic=class extends wi{},ln=class extends Vt{};ln.kind="else";var Nr=class e extends Vt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new ln(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(uu(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=fn(this.condition,t,r),this}get names(){let t=super.names;return eo(t,this.condition),this.else&&Or(t,this.else.names),t}};Nr.kind="if";var Pr=class extends Vt{};Pr.kind="for";var vc=class extends Pr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=fn(this.iteration,t,r),this}get names(){return Or(super.names,this.iteration.names)}},Ec=class extends Pr{constructor(t,r,n,i){super(),this.varKind=t,this.name=r,this.from=n,this.to=i}render(t){let r=t.es5?dt.varKinds.var:this.varKind,{name:n,from:i,to:a}=this;return`for(${r} ${n}=${i}; ${n}<${a}; ${n}++)`+super.render(t)}get names(){let t=eo(super.names,this.from);return eo(t,this.to)}},Qa=class extends Pr{constructor(t,r,n,i){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=fn(this.iterable,t,r),this}get names(){return Or(super.names,this.iterable.names)}},_i=class extends Vt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};_i.kind="func";var Ii=class extends wi{render(t){return"return "+super.render(t)}};Ii.kind="return";var bc=class extends Vt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,i;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(i=this.finally)===null||i===void 0||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Or(t,this.catch.names),this.finally&&Or(t,this.finally.names),t}},vi=class extends Vt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};vi.kind="catch";var Ei=class extends Vt{render(t){return"finally"+super.render(t)}};Ei.kind="finally";var Ac=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
-
`:""},this._extScope=t,this._scope=new dt.Scope({parent:t}),this._nodes=[new Ic]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,i){let a=this._scope.toName(r);return n!==void 0&&i&&(this._constants[a.str]=n),this._leafNode(new hc(t,a,n)),a}const(t,r,n){return this._def(dt.varKinds.const,t,r,n)}let(t,r,n){return this._def(dt.varKinds.let,t,r,n)}var(t,r,n){return this._def(dt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Xa(t,r,n))}add(t,r){return this._leafNode(new mc(t,L.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==U.nil&&this._leafNode(new _c(t)),this}object(...t){let r=["{"];for(let[n,i]of t)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,U.addCodeArg)(r,i));return r.push("}"),new U._Code(r)}if(t,r,n){if(this._blockNode(new Nr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Nr(t))}else(){return this._elseNode(new ln)}endIf(){return this._endBlockNode(Nr,ln)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new vc(t),r)}forRange(t,r,n,i,a=this.opts.es5?dt.varKinds.var:dt.varKinds.let){let o=this._scope.toName(t);return this._for(new Ec(a,o,r,n),()=>i(o))}forOf(t,r,n,i=dt.varKinds.const){let a=this._scope.toName(t);if(this.opts.es5){let o=r instanceof U.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,U._)`${o}.length`,s=>{this.var(a,(0,U._)`${o}[${s}]`),n(a)})}return this._for(new Qa("of",i,a,r),()=>n(a))}forIn(t,r,n,i=this.opts.es5?dt.varKinds.var:dt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,U._)`Object.keys(${r})`,n);let a=this._scope.toName(t);return this._for(new Qa("in",i,a,r),()=>n(a))}endFor(){return this._endBlockNode(Pr)}label(t){return this._leafNode(new gc(t))}break(t){return this._leafNode(new yc(t))}return(t){let r=new Ii;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ii)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new bc;if(this._blockNode(i),this.code(t),r){let a=this.name("e");this._currNode=i.catch=new vi(a),r(a)}return n&&(this._currNode=i.finally=new Ei,this.code(n)),this._endBlockNode(vi,Ei)}throw(t){return this._leafNode(new wc(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=U.nil,n,i){return this._blockNode(new _i(t,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(_i)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Nr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};L.CodeGen=Ac;function Or(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function eo(e,t){return t instanceof U._CodeOrName?Or(e,t.names):e}function fn(e,t,r){if(e instanceof U.Name)return n(e);if(!i(e))return e;return new U._Code(e._items.reduce((a,o)=>(o instanceof U.Name&&(o=n(o)),o instanceof U._Code?a.push(...o._items):a.push(o),a),[]));function n(a){let o=r[a.str];return o===void 0||t[a.str]!==1?a:(delete t[a.str],o)}function i(a){return a instanceof U._Code&&a._items.some(o=>o instanceof U.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function JE(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function uu(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,U._)`!${Rc(e)}`}L.not=uu;var YE=hu(L.operators.AND);function ZE(...e){return e.reduce(YE)}L.and=ZE;var XE=hu(L.operators.OR);function QE(...e){return e.reduce(XE)}L.or=QE;function hu(e){return(t,r)=>t===U.nil?r:r===U.nil?t:(0,U._)`${Rc(t)} ${e} ${Rc(r)}`}function Rc(e){return e instanceof U.Name?e:(0,U._)`(${e})`}});var M=w($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.checkStrictMode=$.getErrorPath=$.Type=$.useFunc=$.setEvaluated=$.evaluatedPropsToName=$.mergeEvaluated=$.eachItem=$.unescapeJsonPointer=$.escapeJsonPointer=$.escapeFragment=$.unescapeFragment=$.schemaRefOrVal=$.schemaHasRulesButRef=$.schemaHasRules=$.checkUnknownRules=$.alwaysValidSchema=$.toHash=void 0;var Q=T(),e0=yi();function t0(e){let t={};for(let r of e)t[r]=!0;return t}$.toHash=t0;function r0(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(yu(e,t),!wu(t,e.self.RULES.all))}$.alwaysValidSchema=r0;function yu(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let i=n.RULES.keywords;for(let a in t)i[a]||vu(e,`unknown keyword: "${a}"`)}$.checkUnknownRules=yu;function wu(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}$.schemaHasRules=wu;function n0(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}$.schemaHasRulesButRef=n0;function i0({topSchemaRef:e,schemaPath:t},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Q._)`${r}`}return(0,Q._)`${e}${t}${(0,Q.getProperty)(n)}`}$.schemaRefOrVal=i0;function a0(e){return _u(decodeURIComponent(e))}$.unescapeFragment=a0;function o0(e){return encodeURIComponent(Sc(e))}$.escapeFragment=o0;function Sc(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}$.escapeJsonPointer=Sc;function _u(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}$.unescapeJsonPointer=_u;function s0(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}$.eachItem=s0;function mu({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(i,a,o,s)=>{let c=o===void 0?a:o instanceof Q.Name?(a instanceof Q.Name?e(i,a,o):t(i,a,o),o):a instanceof Q.Name?(t(i,o,a),a):r(a,o);return s===Q.Name&&!(c instanceof Q.Name)?n(i,c):c}}$.mergeEvaluated={props:mu({mergeNames:(e,t,r)=>e.if((0,Q._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,Q._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,Q._)`${r} || {}`).code((0,Q._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,Q._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,Q._)`${r} || {}`),Nc(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Iu}),items:mu({mergeNames:(e,t,r)=>e.if((0,Q._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,Q._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,Q._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,Q._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Iu(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,Q._)`{}`);return t!==void 0&&Nc(e,r,t),r}$.evaluatedPropsToName=Iu;function Nc(e,t,r){Object.keys(r).forEach(n=>e.assign((0,Q._)`${t}${(0,Q.getProperty)(n)}`,!0))}$.setEvaluated=Nc;var gu={};function c0(e,t){return e.scopeValue("func",{ref:t,code:gu[t.code]||(gu[t.code]=new e0._Code(t.code))})}$.useFunc=c0;var kc;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(kc||($.Type=kc={}));function d0(e,t,r){if(e instanceof Q.Name){let n=t===kc.Num;return r?n?(0,Q._)`"[" + ${e} + "]"`:(0,Q._)`"['" + ${e} + "']"`:n?(0,Q._)`"/" + ${e}`:(0,Q._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Q.getProperty)(e).toString():"/"+Sc(e)}$.getErrorPath=d0;function vu(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}$.checkStrictMode=vu});var Xe=w(Pc=>{"use strict";Object.defineProperty(Pc,"__esModule",{value:!0});var Se=T(),l0={data:new Se.Name("data"),valCxt:new Se.Name("valCxt"),instancePath:new Se.Name("instancePath"),parentData:new Se.Name("parentData"),parentDataProperty:new Se.Name("parentDataProperty"),rootData:new Se.Name("rootData"),dynamicAnchors:new Se.Name("dynamicAnchors"),vErrors:new Se.Name("vErrors"),errors:new Se.Name("errors"),this:new Se.Name("this"),self:new Se.Name("self"),scope:new Se.Name("scope"),json:new Se.Name("json"),jsonPos:new Se.Name("jsonPos"),jsonLen:new Se.Name("jsonLen"),jsonPart:new Se.Name("jsonPart")};Pc.default=l0});var bi=w(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.extendErrors=Ne.resetErrorsCount=Ne.reportExtraError=Ne.reportError=Ne.keyword$DataError=Ne.keywordError=void 0;var z=T(),ro=M(),Ce=Xe();Ne.keywordError={message:({keyword:e})=>(0,z.str)`must pass "${e}" keyword validation`};Ne.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,z.str)`"${e}" keyword must be ${t} ($data)`:(0,z.str)`"${e}" keyword is invalid ($data)`};function f0(e,t=Ne.keywordError,r,n){let{it:i}=e,{gen:a,compositeRule:o,allErrors:s}=i,c=Au(e,t,r);n??(o||s)?Eu(a,c):bu(i,(0,z._)`[${c}]`)}Ne.reportError=f0;function p0(e,t=Ne.keywordError,r){let{it:n}=e,{gen:i,compositeRule:a,allErrors:o}=n,s=Au(e,t,r);Eu(i,s),a||o||bu(n,Ce.default.vErrors)}Ne.reportExtraError=p0;function u0(e,t){e.assign(Ce.default.errors,t),e.if((0,z._)`${Ce.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,z._)`${Ce.default.vErrors}.length`,t),()=>e.assign(Ce.default.vErrors,null)))}Ne.resetErrorsCount=u0;function h0({gen:e,keyword:t,schemaValue:r,data:n,errsCount:i,it:a}){if(i===void 0)throw new Error("ajv implementation error");let o=e.name("err");e.forRange("i",i,Ce.default.errors,s=>{e.const(o,(0,z._)`${Ce.default.vErrors}[${s}]`),e.if((0,z._)`${o}.instancePath === undefined`,()=>e.assign((0,z._)`${o}.instancePath`,(0,z.strConcat)(Ce.default.instancePath,a.errorPath))),e.assign((0,z._)`${o}.schemaPath`,(0,z.str)`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign((0,z._)`${o}.schema`,r),e.assign((0,z._)`${o}.data`,n))})}Ne.extendErrors=h0;function Eu(e,t){let r=e.const("err",t);e.if((0,z._)`${Ce.default.vErrors} === null`,()=>e.assign(Ce.default.vErrors,(0,z._)`[${r}]`),(0,z._)`${Ce.default.vErrors}.push(${r})`),e.code((0,z._)`${Ce.default.errors}++`)}function bu(e,t){let{gen:r,validateName:n,schemaEnv:i}=e;i.$async?r.throw((0,z._)`new ${e.ValidationError}(${t})`):(r.assign((0,z._)`${n}.errors`,t),r.return(!1))}var Dr={keyword:new z.Name("keyword"),schemaPath:new z.Name("schemaPath"),params:new z.Name("params"),propertyName:new z.Name("propertyName"),message:new z.Name("message"),schema:new z.Name("schema"),parentSchema:new z.Name("parentSchema")};function Au(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,z._)`{}`:m0(e,t,r)}function m0(e,t,r={}){let{gen:n,it:i}=e,a=[g0(i,r),y0(e,r)];return w0(e,t,a),n.object(...a)}function g0({errorPath:e},{instancePath:t}){let r=t?(0,z.str)`${e}${(0,ro.getErrorPath)(t,ro.Type.Str)}`:e;return[Ce.default.instancePath,(0,z.strConcat)(Ce.default.instancePath,r)]}function y0({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let i=n?t:(0,z.str)`${t}/${e}`;return r&&(i=(0,z.str)`${i}${(0,ro.getErrorPath)(r,ro.Type.Str)}`),[Dr.schemaPath,i]}function w0(e,{params:t,message:r},n){let{keyword:i,data:a,schemaValue:o,it:s}=e,{opts:c,propertyName:d,topSchemaRef:l,schemaPath:f}=s;n.push([Dr.keyword,i],[Dr.params,typeof t=="function"?t(e):t||(0,z._)`{}`]),c.messages&&n.push([Dr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Dr.schema,o],[Dr.parentSchema,(0,z._)`${l}${f}`],[Ce.default.data,a]),d&&n.push([Dr.propertyName,d])}});var ku=w(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.boolOrEmptySchema=pn.topBoolOrEmptySchema=void 0;var _0=bi(),I0=T(),v0=Xe(),E0={message:"boolean schema is false"};function b0(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Ru(e,!1):typeof r=="object"&&r.$async===!0?t.return(v0.default.data):(t.assign((0,I0._)`${n}.errors`,null),t.return(!0))}pn.topBoolOrEmptySchema=b0;function A0(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Ru(e)):r.var(t,!0)}pn.boolOrEmptySchema=A0;function Ru(e,t){let{gen:r,data:n}=e,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,_0.reportError)(i,E0,void 0,t)}});var Oc=w(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.getRules=un.isJSONType=void 0;var R0=["string","number","integer","boolean","null","object","array"],k0=new Set(R0);function S0(e){return typeof e=="string"&&k0.has(e)}un.isJSONType=S0;function N0(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}un.getRules=N0});var Dc=w(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.shouldUseRule=ir.shouldUseGroup=ir.schemaHasRulesForType=void 0;function P0({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Su(e,n)}ir.schemaHasRulesForType=P0;function Su(e,t){return t.rules.some(r=>Nu(e,r))}ir.shouldUseGroup=Su;function Nu(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}ir.shouldUseRule=Nu});var Ai=w(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.reportTypeError=Pe.checkDataTypes=Pe.checkDataType=Pe.coerceAndCheckDataType=Pe.getJSONTypes=Pe.getSchemaTypes=Pe.DataType=void 0;var O0=Oc(),D0=Dc(),C0=bi(),j=T(),Pu=M(),hn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(hn||(Pe.DataType=hn={}));function x0(e){let t=Ou(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Pe.getSchemaTypes=x0;function Ou(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(O0.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Pe.getJSONTypes=Ou;function T0(e,t){let{gen:r,data:n,opts:i}=e,a=j0(t,i.coerceTypes),o=t.length>0&&!(a.length===0&&t.length===1&&(0,D0.schemaHasRulesForType)(e,t[0]));if(o){let s=xc(t,n,i.strictNumbers,hn.Wrong);r.if(s,()=>{a.length?L0(e,t,a):Tc(e)})}return o}Pe.coerceAndCheckDataType=T0;var Du=new Set(["string","number","integer","boolean","null"]);function j0(e,t){return t?e.filter(r=>Du.has(r)||t==="array"&&r==="array"):[]}function L0(e,t,r){let{gen:n,data:i,opts:a}=e,o=n.let("dataType",(0,j._)`typeof ${i}`),s=n.let("coerced",(0,j._)`undefined`);a.coerceTypes==="array"&&n.if((0,j._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,j._)`${i}[0]`).assign(o,(0,j._)`typeof ${i}`).if(xc(t,i,a.strictNumbers),()=>n.assign(s,i))),n.if((0,j._)`${s} !== undefined`);for(let d of r)(Du.has(d)||d==="array"&&a.coerceTypes==="array")&&c(d);n.else(),Tc(e),n.endIf(),n.if((0,j._)`${s} !== undefined`,()=>{n.assign(i,s),$0(e,s)});function c(d){switch(d){case"string":n.elseIf((0,j._)`${o} == "number" || ${o} == "boolean"`).assign(s,(0,j._)`"" + ${i}`).elseIf((0,j._)`${i} === null`).assign(s,(0,j._)`""`);return;case"number":n.elseIf((0,j._)`${o} == "boolean" || ${i} === null
|
|
1
|
+
var TE=Object.create;var sc=Object.defineProperty;var jE=Object.getOwnPropertyDescriptor;var LE=Object.getOwnPropertyNames;var $E=Object.getPrototypeOf,ME=Object.prototype.hasOwnProperty;var $t=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var $e=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var w=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},cc=(e,t)=>{for(var r in t)sc(e,r,{get:t[r],enumerable:!0})},VE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of LE(t))!ME.call(e,i)&&i!==r&&sc(e,i,{get:()=>t[i],enumerable:!(n=jE(t,i))||n.enumerable});return e};var rr=(e,t,r)=>(r=e!=null?TE($E(e)):{},VE(t||!e||!e.__esModule?sc(r,"default",{value:e,enumerable:!0}):r,e));var yi=w(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.regexpCode=q.getEsmExportName=q.getProperty=q.safeStringify=q.stringify=q.strConcat=q.addCodeArg=q.str=q._=q.nil=q._Code=q.Name=q.IDENTIFIER=q._CodeOrName=void 0;var mi=class{};q._CodeOrName=mi;q.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Sr=class extends mi{constructor(t){if(super(),!q.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};q.Name=Sr;var Ze=class extends mi{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof Sr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};q._Code=Ze;q.nil=new Ze("");function fu(e,...t){let r=[e[0]],n=0;for(;n<t.length;)dc(r,t[n]),r.push(e[++n]);return new Ze(r)}q._=fu;var lc=new Ze("+");function pu(e,...t){let r=[gi(e[0])],n=0;for(;n<t.length;)r.push(lc),dc(r,t[n]),r.push(lc,gi(e[++n]));return UE(r),new Ze(r)}q.str=pu;function dc(e,t){t instanceof Ze?e.push(...t._items):t instanceof Sr?e.push(t):e.push(BE(t))}q.addCodeArg=dc;function UE(e){let t=1;for(;t<e.length-1;){if(e[t]===lc){let r=FE(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function FE(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Sr||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Sr))return`"${e}${t.slice(1)}`}function zE(e,t){return t.emptyStr()?e:e.emptyStr()?t:pu`${e}${t}`}q.strConcat=zE;function BE(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:gi(Array.isArray(e)?e.join(","):e)}function qE(e){return new Ze(gi(e))}q.stringify=qE;function gi(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}q.safeStringify=gi;function GE(e){return typeof e=="string"&&q.IDENTIFIER.test(e)?new Ze(`.${e}`):fu`[${e}]`}q.getProperty=GE;function KE(e){if(typeof e=="string"&&q.IDENTIFIER.test(e))return new Ze(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}q.getEsmExportName=KE;function WE(e){return new Ze(e.toString())}q.regexpCode=WE});var uc=w(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ValueScope=Ve.ValueScopeName=Ve.Scope=Ve.varKinds=Ve.UsedValueState=void 0;var Me=yi(),fc=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Ja;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ja||(Ve.UsedValueState=Ja={}));Ve.varKinds={const:new Me.Name("const"),let:new Me.Name("let"),var:new Me.Name("var")};var Ya=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Me.Name?t:this.name(t)}name(t){return new Me.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Ve.Scope=Ya;var Za=class extends Me.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Me._)`.${new Me.Name(r)}[${n}]`}};Ve.ValueScopeName=Za;var HE=(0,Me._)`\n`,pc=class extends Ya{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?HE:Me.nil}}get(){return this._scope}name(t){return new Za(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:a}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[a];if(s){let d=s.get(o);if(d)return d}else s=this._values[a]=new Map;s.set(o,i);let c=this._scope[a]||(this._scope[a]=[]),l=c.length;return c[l]=r.ref,i.setValue(r,{property:a,itemIndex:l}),i}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Me._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(t,r,n={},i){let a=Me.nil;for(let o in t){let s=t[o];if(!s)continue;let c=n[o]=n[o]||new Map;s.forEach(l=>{if(c.has(l))return;c.set(l,Ja.Started);let d=r(l);if(d){let f=this.opts.es5?Ve.varKinds.var:Ve.varKinds.const;a=(0,Me._)`${a}${f} ${l} = ${d};${this.opts._n}`}else if(d=i?.(l))a=(0,Me._)`${a}${d}${this.opts._n}`;else throw new fc(l);c.set(l,Ja.Completed)})}return a}};Ve.ValueScope=pc});var T=w(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.or=L.and=L.not=L.CodeGen=L.operators=L.varKinds=L.ValueScopeName=L.ValueScope=L.Scope=L.Name=L.regexpCode=L.stringify=L.getProperty=L.nil=L.strConcat=L.str=L._=void 0;var U=yi(),lt=uc(),nr=yi();Object.defineProperty(L,"_",{enumerable:!0,get:function(){return nr._}});Object.defineProperty(L,"str",{enumerable:!0,get:function(){return nr.str}});Object.defineProperty(L,"strConcat",{enumerable:!0,get:function(){return nr.strConcat}});Object.defineProperty(L,"nil",{enumerable:!0,get:function(){return nr.nil}});Object.defineProperty(L,"getProperty",{enumerable:!0,get:function(){return nr.getProperty}});Object.defineProperty(L,"stringify",{enumerable:!0,get:function(){return nr.stringify}});Object.defineProperty(L,"regexpCode",{enumerable:!0,get:function(){return nr.regexpCode}});Object.defineProperty(L,"Name",{enumerable:!0,get:function(){return nr.Name}});var to=uc();Object.defineProperty(L,"Scope",{enumerable:!0,get:function(){return to.Scope}});Object.defineProperty(L,"ValueScope",{enumerable:!0,get:function(){return to.ValueScope}});Object.defineProperty(L,"ValueScopeName",{enumerable:!0,get:function(){return to.ValueScopeName}});Object.defineProperty(L,"varKinds",{enumerable:!0,get:function(){return to.varKinds}});L.operators={GT:new U._Code(">"),GTE:new U._Code(">="),LT:new U._Code("<"),LTE:new U._Code("<="),EQ:new U._Code("==="),NEQ:new U._Code("!=="),NOT:new U._Code("!"),OR:new U._Code("||"),AND:new U._Code("&&"),ADD:new U._Code("+")};var Mt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},hc=class extends Mt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?lt.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=fn(this.rhs,t,r)),this}get names(){return this.rhs instanceof U._CodeOrName?this.rhs.names:{}}},Xa=class extends Mt{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof U.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=fn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof U.Name?{}:{...this.lhs.names};return eo(t,this.rhs)}},mc=class extends Xa{constructor(t,r,n,i){super(t,n,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},gc=class extends Mt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},yc=class extends Mt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},wc=class extends Mt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},_c=class extends Mt{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=fn(this.code,t,r),this}get names(){return this.code instanceof U._CodeOrName?this.code.names:{}}},wi=class extends Mt{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,i=n.length;for(;i--;){let a=n[i];a.optimizeNames(t,r)||(JE(t,a.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Or(t,r.names),{})}},Vt=class extends wi{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Ic=class extends wi{},dn=class extends Vt{};dn.kind="else";var Nr=class e extends Vt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new dn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(uu(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=fn(this.condition,t,r),this}get names(){let t=super.names;return eo(t,this.condition),this.else&&Or(t,this.else.names),t}};Nr.kind="if";var Pr=class extends Vt{};Pr.kind="for";var vc=class extends Pr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=fn(this.iteration,t,r),this}get names(){return Or(super.names,this.iteration.names)}},Ec=class extends Pr{constructor(t,r,n,i){super(),this.varKind=t,this.name=r,this.from=n,this.to=i}render(t){let r=t.es5?lt.varKinds.var:this.varKind,{name:n,from:i,to:a}=this;return`for(${r} ${n}=${i}; ${n}<${a}; ${n}++)`+super.render(t)}get names(){let t=eo(super.names,this.from);return eo(t,this.to)}},Qa=class extends Pr{constructor(t,r,n,i){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=fn(this.iterable,t,r),this}get names(){return Or(super.names,this.iterable.names)}},_i=class extends Vt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};_i.kind="func";var Ii=class extends wi{render(t){return"return "+super.render(t)}};Ii.kind="return";var bc=class extends Vt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,i;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(i=this.finally)===null||i===void 0||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Or(t,this.catch.names),this.finally&&Or(t,this.finally.names),t}},vi=class extends Vt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};vi.kind="catch";var Ei=class extends Vt{render(t){return"finally"+super.render(t)}};Ei.kind="finally";var Ac=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
+
`:""},this._extScope=t,this._scope=new lt.Scope({parent:t}),this._nodes=[new Ic]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,i){let a=this._scope.toName(r);return n!==void 0&&i&&(this._constants[a.str]=n),this._leafNode(new hc(t,a,n)),a}const(t,r,n){return this._def(lt.varKinds.const,t,r,n)}let(t,r,n){return this._def(lt.varKinds.let,t,r,n)}var(t,r,n){return this._def(lt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Xa(t,r,n))}add(t,r){return this._leafNode(new mc(t,L.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==U.nil&&this._leafNode(new _c(t)),this}object(...t){let r=["{"];for(let[n,i]of t)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,U.addCodeArg)(r,i));return r.push("}"),new U._Code(r)}if(t,r,n){if(this._blockNode(new Nr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Nr(t))}else(){return this._elseNode(new dn)}endIf(){return this._endBlockNode(Nr,dn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new vc(t),r)}forRange(t,r,n,i,a=this.opts.es5?lt.varKinds.var:lt.varKinds.let){let o=this._scope.toName(t);return this._for(new Ec(a,o,r,n),()=>i(o))}forOf(t,r,n,i=lt.varKinds.const){let a=this._scope.toName(t);if(this.opts.es5){let o=r instanceof U.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,U._)`${o}.length`,s=>{this.var(a,(0,U._)`${o}[${s}]`),n(a)})}return this._for(new Qa("of",i,a,r),()=>n(a))}forIn(t,r,n,i=this.opts.es5?lt.varKinds.var:lt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,U._)`Object.keys(${r})`,n);let a=this._scope.toName(t);return this._for(new Qa("in",i,a,r),()=>n(a))}endFor(){return this._endBlockNode(Pr)}label(t){return this._leafNode(new gc(t))}break(t){return this._leafNode(new yc(t))}return(t){let r=new Ii;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ii)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new bc;if(this._blockNode(i),this.code(t),r){let a=this.name("e");this._currNode=i.catch=new vi(a),r(a)}return n&&(this._currNode=i.finally=new Ei,this.code(n)),this._endBlockNode(vi,Ei)}throw(t){return this._leafNode(new wc(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=U.nil,n,i){return this._blockNode(new _i(t,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(_i)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Nr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};L.CodeGen=Ac;function Or(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function eo(e,t){return t instanceof U._CodeOrName?Or(e,t.names):e}function fn(e,t,r){if(e instanceof U.Name)return n(e);if(!i(e))return e;return new U._Code(e._items.reduce((a,o)=>(o instanceof U.Name&&(o=n(o)),o instanceof U._Code?a.push(...o._items):a.push(o),a),[]));function n(a){let o=r[a.str];return o===void 0||t[a.str]!==1?a:(delete t[a.str],o)}function i(a){return a instanceof U._Code&&a._items.some(o=>o instanceof U.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function JE(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function uu(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,U._)`!${Rc(e)}`}L.not=uu;var YE=hu(L.operators.AND);function ZE(...e){return e.reduce(YE)}L.and=ZE;var XE=hu(L.operators.OR);function QE(...e){return e.reduce(XE)}L.or=QE;function hu(e){return(t,r)=>t===U.nil?r:r===U.nil?t:(0,U._)`${Rc(t)} ${e} ${Rc(r)}`}function Rc(e){return e instanceof U.Name?e:(0,U._)`(${e})`}});var M=w($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.checkStrictMode=$.getErrorPath=$.Type=$.useFunc=$.setEvaluated=$.evaluatedPropsToName=$.mergeEvaluated=$.eachItem=$.unescapeJsonPointer=$.escapeJsonPointer=$.escapeFragment=$.unescapeFragment=$.schemaRefOrVal=$.schemaHasRulesButRef=$.schemaHasRules=$.checkUnknownRules=$.alwaysValidSchema=$.toHash=void 0;var Q=T(),e0=yi();function t0(e){let t={};for(let r of e)t[r]=!0;return t}$.toHash=t0;function r0(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(yu(e,t),!wu(t,e.self.RULES.all))}$.alwaysValidSchema=r0;function yu(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let i=n.RULES.keywords;for(let a in t)i[a]||vu(e,`unknown keyword: "${a}"`)}$.checkUnknownRules=yu;function wu(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}$.schemaHasRules=wu;function n0(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}$.schemaHasRulesButRef=n0;function i0({topSchemaRef:e,schemaPath:t},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Q._)`${r}`}return(0,Q._)`${e}${t}${(0,Q.getProperty)(n)}`}$.schemaRefOrVal=i0;function a0(e){return _u(decodeURIComponent(e))}$.unescapeFragment=a0;function o0(e){return encodeURIComponent(Sc(e))}$.escapeFragment=o0;function Sc(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}$.escapeJsonPointer=Sc;function _u(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}$.unescapeJsonPointer=_u;function s0(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}$.eachItem=s0;function mu({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(i,a,o,s)=>{let c=o===void 0?a:o instanceof Q.Name?(a instanceof Q.Name?e(i,a,o):t(i,a,o),o):a instanceof Q.Name?(t(i,o,a),a):r(a,o);return s===Q.Name&&!(c instanceof Q.Name)?n(i,c):c}}$.mergeEvaluated={props:mu({mergeNames:(e,t,r)=>e.if((0,Q._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,Q._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,Q._)`${r} || {}`).code((0,Q._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,Q._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,Q._)`${r} || {}`),Nc(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Iu}),items:mu({mergeNames:(e,t,r)=>e.if((0,Q._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,Q._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,Q._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,Q._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Iu(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,Q._)`{}`);return t!==void 0&&Nc(e,r,t),r}$.evaluatedPropsToName=Iu;function Nc(e,t,r){Object.keys(r).forEach(n=>e.assign((0,Q._)`${t}${(0,Q.getProperty)(n)}`,!0))}$.setEvaluated=Nc;var gu={};function c0(e,t){return e.scopeValue("func",{ref:t,code:gu[t.code]||(gu[t.code]=new e0._Code(t.code))})}$.useFunc=c0;var kc;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(kc||($.Type=kc={}));function l0(e,t,r){if(e instanceof Q.Name){let n=t===kc.Num;return r?n?(0,Q._)`"[" + ${e} + "]"`:(0,Q._)`"['" + ${e} + "']"`:n?(0,Q._)`"/" + ${e}`:(0,Q._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Q.getProperty)(e).toString():"/"+Sc(e)}$.getErrorPath=l0;function vu(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}$.checkStrictMode=vu});var Xe=w(Pc=>{"use strict";Object.defineProperty(Pc,"__esModule",{value:!0});var Se=T(),d0={data:new Se.Name("data"),valCxt:new Se.Name("valCxt"),instancePath:new Se.Name("instancePath"),parentData:new Se.Name("parentData"),parentDataProperty:new Se.Name("parentDataProperty"),rootData:new Se.Name("rootData"),dynamicAnchors:new Se.Name("dynamicAnchors"),vErrors:new Se.Name("vErrors"),errors:new Se.Name("errors"),this:new Se.Name("this"),self:new Se.Name("self"),scope:new Se.Name("scope"),json:new Se.Name("json"),jsonPos:new Se.Name("jsonPos"),jsonLen:new Se.Name("jsonLen"),jsonPart:new Se.Name("jsonPart")};Pc.default=d0});var bi=w(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.extendErrors=Ne.resetErrorsCount=Ne.reportExtraError=Ne.reportError=Ne.keyword$DataError=Ne.keywordError=void 0;var z=T(),ro=M(),Ce=Xe();Ne.keywordError={message:({keyword:e})=>(0,z.str)`must pass "${e}" keyword validation`};Ne.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,z.str)`"${e}" keyword must be ${t} ($data)`:(0,z.str)`"${e}" keyword is invalid ($data)`};function f0(e,t=Ne.keywordError,r,n){let{it:i}=e,{gen:a,compositeRule:o,allErrors:s}=i,c=Au(e,t,r);n??(o||s)?Eu(a,c):bu(i,(0,z._)`[${c}]`)}Ne.reportError=f0;function p0(e,t=Ne.keywordError,r){let{it:n}=e,{gen:i,compositeRule:a,allErrors:o}=n,s=Au(e,t,r);Eu(i,s),a||o||bu(n,Ce.default.vErrors)}Ne.reportExtraError=p0;function u0(e,t){e.assign(Ce.default.errors,t),e.if((0,z._)`${Ce.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,z._)`${Ce.default.vErrors}.length`,t),()=>e.assign(Ce.default.vErrors,null)))}Ne.resetErrorsCount=u0;function h0({gen:e,keyword:t,schemaValue:r,data:n,errsCount:i,it:a}){if(i===void 0)throw new Error("ajv implementation error");let o=e.name("err");e.forRange("i",i,Ce.default.errors,s=>{e.const(o,(0,z._)`${Ce.default.vErrors}[${s}]`),e.if((0,z._)`${o}.instancePath === undefined`,()=>e.assign((0,z._)`${o}.instancePath`,(0,z.strConcat)(Ce.default.instancePath,a.errorPath))),e.assign((0,z._)`${o}.schemaPath`,(0,z.str)`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign((0,z._)`${o}.schema`,r),e.assign((0,z._)`${o}.data`,n))})}Ne.extendErrors=h0;function Eu(e,t){let r=e.const("err",t);e.if((0,z._)`${Ce.default.vErrors} === null`,()=>e.assign(Ce.default.vErrors,(0,z._)`[${r}]`),(0,z._)`${Ce.default.vErrors}.push(${r})`),e.code((0,z._)`${Ce.default.errors}++`)}function bu(e,t){let{gen:r,validateName:n,schemaEnv:i}=e;i.$async?r.throw((0,z._)`new ${e.ValidationError}(${t})`):(r.assign((0,z._)`${n}.errors`,t),r.return(!1))}var Dr={keyword:new z.Name("keyword"),schemaPath:new z.Name("schemaPath"),params:new z.Name("params"),propertyName:new z.Name("propertyName"),message:new z.Name("message"),schema:new z.Name("schema"),parentSchema:new z.Name("parentSchema")};function Au(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,z._)`{}`:m0(e,t,r)}function m0(e,t,r={}){let{gen:n,it:i}=e,a=[g0(i,r),y0(e,r)];return w0(e,t,a),n.object(...a)}function g0({errorPath:e},{instancePath:t}){let r=t?(0,z.str)`${e}${(0,ro.getErrorPath)(t,ro.Type.Str)}`:e;return[Ce.default.instancePath,(0,z.strConcat)(Ce.default.instancePath,r)]}function y0({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let i=n?t:(0,z.str)`${t}/${e}`;return r&&(i=(0,z.str)`${i}${(0,ro.getErrorPath)(r,ro.Type.Str)}`),[Dr.schemaPath,i]}function w0(e,{params:t,message:r},n){let{keyword:i,data:a,schemaValue:o,it:s}=e,{opts:c,propertyName:l,topSchemaRef:d,schemaPath:f}=s;n.push([Dr.keyword,i],[Dr.params,typeof t=="function"?t(e):t||(0,z._)`{}`]),c.messages&&n.push([Dr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Dr.schema,o],[Dr.parentSchema,(0,z._)`${d}${f}`],[Ce.default.data,a]),l&&n.push([Dr.propertyName,l])}});var ku=w(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.boolOrEmptySchema=pn.topBoolOrEmptySchema=void 0;var _0=bi(),I0=T(),v0=Xe(),E0={message:"boolean schema is false"};function b0(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Ru(e,!1):typeof r=="object"&&r.$async===!0?t.return(v0.default.data):(t.assign((0,I0._)`${n}.errors`,null),t.return(!0))}pn.topBoolOrEmptySchema=b0;function A0(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Ru(e)):r.var(t,!0)}pn.boolOrEmptySchema=A0;function Ru(e,t){let{gen:r,data:n}=e,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,_0.reportError)(i,E0,void 0,t)}});var Oc=w(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.getRules=un.isJSONType=void 0;var R0=["string","number","integer","boolean","null","object","array"],k0=new Set(R0);function S0(e){return typeof e=="string"&&k0.has(e)}un.isJSONType=S0;function N0(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}un.getRules=N0});var Dc=w(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.shouldUseRule=ir.shouldUseGroup=ir.schemaHasRulesForType=void 0;function P0({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Su(e,n)}ir.schemaHasRulesForType=P0;function Su(e,t){return t.rules.some(r=>Nu(e,r))}ir.shouldUseGroup=Su;function Nu(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}ir.shouldUseRule=Nu});var Ai=w(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.reportTypeError=Pe.checkDataTypes=Pe.checkDataType=Pe.coerceAndCheckDataType=Pe.getJSONTypes=Pe.getSchemaTypes=Pe.DataType=void 0;var O0=Oc(),D0=Dc(),C0=bi(),j=T(),Pu=M(),hn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(hn||(Pe.DataType=hn={}));function x0(e){let t=Ou(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Pe.getSchemaTypes=x0;function Ou(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(O0.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Pe.getJSONTypes=Ou;function T0(e,t){let{gen:r,data:n,opts:i}=e,a=j0(t,i.coerceTypes),o=t.length>0&&!(a.length===0&&t.length===1&&(0,D0.schemaHasRulesForType)(e,t[0]));if(o){let s=xc(t,n,i.strictNumbers,hn.Wrong);r.if(s,()=>{a.length?L0(e,t,a):Tc(e)})}return o}Pe.coerceAndCheckDataType=T0;var Du=new Set(["string","number","integer","boolean","null"]);function j0(e,t){return t?e.filter(r=>Du.has(r)||t==="array"&&r==="array"):[]}function L0(e,t,r){let{gen:n,data:i,opts:a}=e,o=n.let("dataType",(0,j._)`typeof ${i}`),s=n.let("coerced",(0,j._)`undefined`);a.coerceTypes==="array"&&n.if((0,j._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,j._)`${i}[0]`).assign(o,(0,j._)`typeof ${i}`).if(xc(t,i,a.strictNumbers),()=>n.assign(s,i))),n.if((0,j._)`${s} !== undefined`);for(let l of r)(Du.has(l)||l==="array"&&a.coerceTypes==="array")&&c(l);n.else(),Tc(e),n.endIf(),n.if((0,j._)`${s} !== undefined`,()=>{n.assign(i,s),$0(e,s)});function c(l){switch(l){case"string":n.elseIf((0,j._)`${o} == "number" || ${o} == "boolean"`).assign(s,(0,j._)`"" + ${i}`).elseIf((0,j._)`${i} === null`).assign(s,(0,j._)`""`);return;case"number":n.elseIf((0,j._)`${o} == "boolean" || ${i} === null
|
|
3
3
|
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(s,(0,j._)`+${i}`);return;case"integer":n.elseIf((0,j._)`${o} === "boolean" || ${i} === null
|
|
4
4
|
|| (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(s,(0,j._)`+${i}`);return;case"boolean":n.elseIf((0,j._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(s,!1).elseIf((0,j._)`${i} === "true" || ${i} === 1`).assign(s,!0);return;case"null":n.elseIf((0,j._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(s,null);return;case"array":n.elseIf((0,j._)`${o} === "string" || ${o} === "number"
|
|
5
|
-
|| ${o} === "boolean" || ${i} === null`).assign(s,(0,j._)`[${i}]`)}}}function $0({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,j._)`${t} !== undefined`,()=>e.assign((0,j._)`${t}[${r}]`,n))}function Cc(e,t,r,n=hn.Correct){let i=n===hn.Correct?j.operators.EQ:j.operators.NEQ,a;switch(e){case"null":return(0,j._)`${t} ${i} null`;case"array":a=(0,j._)`Array.isArray(${t})`;break;case"object":a=(0,j._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":a=o((0,j._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":a=o();break;default:return(0,j._)`typeof ${t} ${i} ${e}`}return n===hn.Correct?a:(0,j.not)(a);function o(s=j.nil){return(0,j.and)((0,j._)`typeof ${t} == "number"`,s,r?(0,j._)`isFinite(${t})`:j.nil)}}Pe.checkDataType=Cc;function xc(e,t,r,n){if(e.length===1)return Cc(e[0],t,r,n);let i,a=(0,Pu.toHash)(e);if(a.array&&a.object){let o=(0,j._)`typeof ${t} != "object"`;i=a.null?o:(0,j._)`!${t} || ${o}`,delete a.null,delete a.array,delete a.object}else i=j.nil;a.number&&delete a.integer;for(let o in a)i=(0,j.and)(i,Cc(o,t,r,n));return i}Pe.checkDataTypes=xc;var M0={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,j._)`{type: ${e}}`:(0,j._)`{type: ${t}}`};function Tc(e){let t=V0(e);(0,C0.reportError)(t,M0)}Pe.reportTypeError=Tc;function V0(e){let{gen:t,data:r,schema:n}=e,i=(0,Pu.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}});var xu=w(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.assignDefaults=void 0;var mn=T(),U0=M();function F0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let i in r)Cu(e,i,r[i].default);else t==="array"&&Array.isArray(n)&&n.forEach((i,a)=>Cu(e,a,i.default))}no.assignDefaults=F0;function Cu(e,t,r){let{gen:n,compositeRule:i,data:a,opts:o}=e;if(r===void 0)return;let s=(0,mn._)`${a}${(0,mn.getProperty)(t)}`;if(i){(0,U0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,mn._)`${s} === undefined`;o.useDefaults==="empty"&&(c=(0,mn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,mn._)`${s} = ${(0,mn.stringify)(r)}`)}});var Qe=w(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.validateUnion=Z.validateArray=Z.usePattern=Z.callValidateCode=Z.schemaProperties=Z.allSchemaProperties=Z.noPropertyInData=Z.propertyInData=Z.isOwnProperty=Z.hasPropFunc=Z.reportMissingProp=Z.checkMissingProp=Z.checkReportMissingProp=void 0;var te=T(),jc=M(),ar=Xe(),z0=M();function B0(e,t){let{gen:r,data:n,it:i}=e;r.if($c(r,n,t,i.opts.ownProperties),()=>{e.setParams({missingProperty:(0,te._)`${t}`},!0),e.error()})}Z.checkReportMissingProp=B0;function q0({gen:e,data:t,it:{opts:r}},n,i){return(0,te.or)(...n.map(a=>(0,te.and)($c(e,t,a,r.ownProperties),(0,te._)`${i} = ${a}`)))}Z.checkMissingProp=q0;function G0(e,t){e.setParams({missingProperty:t},!0),e.error()}Z.reportMissingProp=G0;function Tu(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,te._)`Object.prototype.hasOwnProperty`})}Z.hasPropFunc=Tu;function Lc(e,t,r){return(0,te._)`${Tu(e)}.call(${t}, ${r})`}Z.isOwnProperty=Lc;function K0(e,t,r,n){let i=(0,te._)`${t}${(0,te.getProperty)(r)} !== undefined`;return n?(0,te._)`${i} && ${Lc(e,t,r)}`:i}Z.propertyInData=K0;function $c(e,t,r,n){let i=(0,te._)`${t}${(0,te.getProperty)(r)} === undefined`;return n?(0,te.or)(i,(0,te.not)(Lc(e,t,r))):i}Z.noPropertyInData=$c;function ju(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}Z.allSchemaProperties=ju;function W0(e,t){return ju(t).filter(r=>!(0,jc.alwaysValidSchema)(e,t[r]))}Z.schemaProperties=W0;function H0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:a},it:o},s,c,d){let l=d?(0,te._)`${e}, ${t}, ${n}${i}`:t,f=[[ar.default.instancePath,(0,te.strConcat)(ar.default.instancePath,a)],[ar.default.parentData,o.parentData],[ar.default.parentDataProperty,o.parentDataProperty],[ar.default.rootData,ar.default.rootData]];o.opts.dynamicRef&&f.push([ar.default.dynamicAnchors,ar.default.dynamicAnchors]);let p=(0,te._)`${l}, ${r.object(...f)}`;return c!==te.nil?(0,te._)`${s}.call(${c}, ${p})`:(0,te._)`${s}(${p})`}Z.callValidateCode=H0;var J0=(0,te._)`new RegExp`;function Y0({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:i}=t.code,a=i(r,n);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,te._)`${i.code==="new RegExp"?J0:(0,z0.useFunc)(e,i)}(${r}, ${n})`})}Z.usePattern=Y0;function Z0(e){let{gen:t,data:r,keyword:n,it:i}=e,a=t.name("valid");if(i.allErrors){let s=t.let("valid",!0);return o(()=>t.assign(s,!1)),s}return t.var(a,!0),o(()=>t.break()),a;function o(s){let c=t.const("len",(0,te._)`${r}.length`);t.forRange("i",0,c,d=>{e.subschema({keyword:n,dataProp:d,dataPropType:jc.Type.Num},a),t.if((0,te.not)(a),s)})}}Z.validateArray=Z0;function X0(e){let{gen:t,schema:r,keyword:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,jc.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,d)=>{let l=e.subschema({keyword:n,schemaProp:d,compositeRule:!0},s);t.assign(o,(0,te._)`${o} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,te.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}Z.validateUnion=X0});var Mu=w(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.validateKeywordUsage=vt.validSchemaType=vt.funcKeywordCode=vt.macroKeywordCode=void 0;var xe=T(),Cr=Xe(),Q0=Qe(),eb=bi();function tb(e,t){let{gen:r,keyword:n,schema:i,parentSchema:a,it:o}=e,s=t.macro.call(o.self,i,a,o),c=$u(r,n,s);o.opts.validateSchema!==!1&&o.self.validateSchema(s,!0);let d=r.name("valid");e.subschema({schema:s,schemaPath:xe.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}vt.macroKeywordCode=tb;function rb(e,t){var r;let{gen:n,keyword:i,schema:a,parentSchema:o,$data:s,it:c}=e;ib(c,t);let d=!s&&t.compile?t.compile.call(c.self,a,o,c):t.validate,l=$u(n,i,d),f=n.let("valid");e.block$data(f,p),e.ok((r=t.valid)!==null&&r!==void 0?r:f);function p(){if(t.errors===!1)m(),t.modifying&&Lu(e),g(()=>e.error());else{let y=t.async?u():h();t.modifying&&Lu(e),g(()=>nb(e,y))}}function u(){let y=n.let("ruleErrs",null);return n.try(()=>m((0,xe._)`await `),_=>n.assign(f,!1).if((0,xe._)`${_} instanceof ${c.ValidationError}`,()=>n.assign(y,(0,xe._)`${_}.errors`),()=>n.throw(_))),y}function h(){let y=(0,xe._)`${l}.errors`;return n.assign(y,null),m(xe.nil),y}function m(y=t.async?(0,xe._)`await `:xe.nil){let _=c.opts.passContext?Cr.default.this:Cr.default.self,b=!("compile"in t&&!s||t.schema===!1);n.assign(f,(0,xe._)`${y}${(0,Q0.callValidateCode)(e,l,_,b)}`,t.modifying)}function g(y){var _;n.if((0,xe.not)((_=t.valid)!==null&&_!==void 0?_:f),y)}}vt.funcKeywordCode=rb;function Lu(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,xe._)`${n.parentData}[${n.parentDataProperty}]`))}function nb(e,t){let{gen:r}=e;r.if((0,xe._)`Array.isArray(${t})`,()=>{r.assign(Cr.default.vErrors,(0,xe._)`${Cr.default.vErrors} === null ? ${t} : ${Cr.default.vErrors}.concat(${t})`).assign(Cr.default.errors,(0,xe._)`${Cr.default.vErrors}.length`),(0,eb.extendErrors)(e)},()=>e.error())}function ib({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function $u(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,xe.stringify)(r)})}function ab(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}vt.validSchemaType=ab;function ob({schema:e,opts:t,self:r,errSchemaPath:n},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${a}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[a])){let c=`keyword "${a}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}vt.validateKeywordUsage=ob});var Uu=w(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.extendSubschemaMode=or.extendSubschemaData=or.getSubschema=void 0;var Et=T(),Vu=M();function sb(e,{keyword:t,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:a,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,Et._)`${e.schemaPath}${(0,Et.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,Et._)`${e.schemaPath}${(0,Et.getProperty)(t)}${(0,Et.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Vu.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||a===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}or.getSubschema=sb;function cb(e,t,{dataProp:r,dataPropType:n,data:i,dataTypes:a,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:d,dataPathArr:l,opts:f}=t,p=s.let("data",(0,Et._)`${t.data}${(0,Et.getProperty)(r)}`,!0);c(p),e.errorPath=(0,Et.str)`${d}${(0,Vu.getErrorPath)(r,n,f.jsPropertySyntax)}`,e.parentDataProperty=(0,Et._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(i!==void 0){let d=i instanceof Et.Name?i:s.let("data",i,!0);c(d),o!==void 0&&(e.propertyName=o)}a&&(e.dataTypes=a);function c(d){e.data=d,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,d]}}or.extendSubschemaData=cb;function db(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:a}){n!==void 0&&(e.compositeRule=n),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=r}or.extendSubschemaMode=db});var Mc=w((L$,Fu)=>{"use strict";Fu.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,i,a;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(a=Object.keys(t),n=a.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=n;i--!==0;){var o=a[i];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r}});var Bu=w(($$,zu)=>{"use strict";var sr=zu.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};io(t,n,i,e,"",e)};sr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};sr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};sr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};sr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function io(e,t,r,n,i,a,o,s,c,d){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,i,a,o,s,c,d);for(var l in n){var f=n[l];if(Array.isArray(f)){if(l in sr.arrayKeywords)for(var p=0;p<f.length;p++)io(e,t,r,f[p],i+"/"+l+"/"+p,a,i,l,n,p)}else if(l in sr.propsKeywords){if(f&&typeof f=="object")for(var u in f)io(e,t,r,f[u],i+"/"+l+"/"+lb(u),a,i,l,n,u)}else(l in sr.keywords||e.allKeys&&!(l in sr.skipKeywords))&&io(e,t,r,f,i+"/"+l,a,i,l,n)}r(n,i,a,o,s,c,d)}}function lb(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ri=w(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.getSchemaRefs=Ue.resolveUrl=Ue.normalizeId=Ue._getFullPath=Ue.getFullPath=Ue.inlineRef=void 0;var fb=M(),pb=Mc(),ub=Bu(),hb=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function mb(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Vc(e):t?qu(e)<=t:!1}Ue.inlineRef=mb;var gb=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Vc(e){for(let t in e){if(gb.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Vc)||typeof r=="object"&&Vc(r))return!0}return!1}function qu(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!hb.has(r)&&(typeof e[r]=="object"&&(0,fb.eachItem)(e[r],n=>t+=qu(n)),t===1/0))return 1/0}return t}function Gu(e,t="",r){r!==!1&&(t=gn(t));let n=e.parse(t);return Ku(e,n)}Ue.getFullPath=Gu;function Ku(e,t){return e.serialize(t).split("#")[0]+"#"}Ue._getFullPath=Ku;var yb=/#\/?$/;function gn(e){return e?e.replace(yb,""):""}Ue.normalizeId=gn;function wb(e,t,r){return r=gn(r),e.resolve(t,r)}Ue.resolveUrl=wb;var _b=/^[a-z_][-a-z0-9._]*$/i;function Ib(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=gn(e[r]||t),a={"":i},o=Gu(n,i,!1),s={},c=new Set;return ub(e,{allKeys:!0},(f,p,u,h)=>{if(h===void 0)return;let m=o+p,g=a[h];typeof f[r]=="string"&&(g=y.call(this,f[r])),_.call(this,f.$anchor),_.call(this,f.$dynamicAnchor),a[p]=g;function y(b){let E=this.opts.uriResolver.resolve;if(b=gn(g?E(g,b):b),c.has(b))throw l(b);c.add(b);let I=this.refs[b];return typeof I=="string"&&(I=this.refs[I]),typeof I=="object"?d(f,I.schema,b):b!==gn(m)&&(b[0]==="#"?(d(f,s[b],b),s[b]=f):this.refs[b]=m),b}function _(b){if(typeof b=="string"){if(!_b.test(b))throw new Error(`invalid anchor "${b}"`);y.call(this,`#${b}`)}}}),s;function d(f,p,u){if(p!==void 0&&!pb(f,p))throw l(u)}function l(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Ue.getSchemaRefs=Ib});var Ni=w(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.getData=cr.KeywordCxt=cr.validateFunctionCode=void 0;var Zu=ku(),Wu=Ai(),Fc=Dc(),ao=Ai(),vb=xu(),Si=Mu(),Uc=Uu(),N=T(),D=Xe(),Eb=Ri(),Ut=M(),ki=bi();function bb(e){if(eh(e)&&(th(e),Qu(e))){kb(e);return}Xu(e,()=>(0,Zu.topBoolOrEmptySchema)(e))}cr.validateFunctionCode=bb;function Xu({gen:e,validateName:t,schema:r,schemaEnv:n,opts:i},a){i.code.es5?e.func(t,(0,N._)`${D.default.data}, ${D.default.valCxt}`,n.$async,()=>{e.code((0,N._)`"use strict"; ${Hu(r,i)}`),Rb(e,i),e.code(a)}):e.func(t,(0,N._)`${D.default.data}, ${Ab(i)}`,n.$async,()=>e.code(Hu(r,i)).code(a))}function Ab(e){return(0,N._)`{${D.default.instancePath}="", ${D.default.parentData}, ${D.default.parentDataProperty}, ${D.default.rootData}=${D.default.data}${e.dynamicRef?(0,N._)`, ${D.default.dynamicAnchors}={}`:N.nil}}={}`}function Rb(e,t){e.if(D.default.valCxt,()=>{e.var(D.default.instancePath,(0,N._)`${D.default.valCxt}.${D.default.instancePath}`),e.var(D.default.parentData,(0,N._)`${D.default.valCxt}.${D.default.parentData}`),e.var(D.default.parentDataProperty,(0,N._)`${D.default.valCxt}.${D.default.parentDataProperty}`),e.var(D.default.rootData,(0,N._)`${D.default.valCxt}.${D.default.rootData}`),t.dynamicRef&&e.var(D.default.dynamicAnchors,(0,N._)`${D.default.valCxt}.${D.default.dynamicAnchors}`)},()=>{e.var(D.default.instancePath,(0,N._)`""`),e.var(D.default.parentData,(0,N._)`undefined`),e.var(D.default.parentDataProperty,(0,N._)`undefined`),e.var(D.default.rootData,D.default.data),t.dynamicRef&&e.var(D.default.dynamicAnchors,(0,N._)`{}`)})}function kb(e){let{schema:t,opts:r,gen:n}=e;Xu(e,()=>{r.$comment&&t.$comment&&nh(e),Db(e),n.let(D.default.vErrors,null),n.let(D.default.errors,0),r.unevaluated&&Sb(e),rh(e),Tb(e)})}function Sb(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,N._)`${r}.evaluated`),t.if((0,N._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,N._)`${e.evaluated}.props`,(0,N._)`undefined`)),t.if((0,N._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,N._)`${e.evaluated}.items`,(0,N._)`undefined`))}function Hu(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,N._)`/*# sourceURL=${r} */`:N.nil}function Nb(e,t){if(eh(e)&&(th(e),Qu(e))){Pb(e,t);return}(0,Zu.boolOrEmptySchema)(e,t)}function Qu({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function eh(e){return typeof e.schema!="boolean"}function Pb(e,t){let{schema:r,gen:n,opts:i}=e;i.$comment&&r.$comment&&nh(e),Cb(e),xb(e);let a=n.const("_errs",D.default.errors);rh(e,a),n.var(t,(0,N._)`${a} === ${D.default.errors}`)}function th(e){(0,Ut.checkUnknownRules)(e),Ob(e)}function rh(e,t){if(e.opts.jtd)return Ju(e,[],!1,t);let r=(0,Wu.getSchemaTypes)(e.schema),n=(0,Wu.coerceAndCheckDataType)(e,r);Ju(e,r,!n,t)}function Ob(e){let{schema:t,errSchemaPath:r,opts:n,self:i}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Ut.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Db(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ut.checkStrictMode)(e,"default is ignored in the schema root")}function Cb(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Eb.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function xb(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function nh({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:i}){let a=r.$comment;if(i.$comment===!0)e.code((0,N._)`${D.default.self}.logger.log(${a})`);else if(typeof i.$comment=="function"){let o=(0,N.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,N._)`${D.default.self}.opts.$comment(${a}, ${o}, ${s}.schema)`)}}function Tb(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:i,opts:a}=e;r.$async?t.if((0,N._)`${D.default.errors} === 0`,()=>t.return(D.default.data),()=>t.throw((0,N._)`new ${i}(${D.default.vErrors})`)):(t.assign((0,N._)`${n}.errors`,D.default.vErrors),a.unevaluated&&jb(e),t.return((0,N._)`${D.default.errors} === 0`))}function jb({gen:e,evaluated:t,props:r,items:n}){r instanceof N.Name&&e.assign((0,N._)`${t}.props`,r),n instanceof N.Name&&e.assign((0,N._)`${t}.items`,n)}function Ju(e,t,r,n){let{gen:i,schema:a,data:o,allErrors:s,opts:c,self:d}=e,{RULES:l}=d;if(a.$ref&&(c.ignoreKeywordsWithRef||!(0,Ut.schemaHasRulesButRef)(a,l))){i.block(()=>ah(e,"$ref",l.all.$ref.definition));return}c.jtd||Lb(e,t),i.block(()=>{for(let p of l.rules)f(p);f(l.post)});function f(p){(0,Fc.shouldUseGroup)(a,p)&&(p.type?(i.if((0,ao.checkDataType)(p.type,o,c.strictNumbers)),Yu(e,p),t.length===1&&t[0]===p.type&&r&&(i.else(),(0,ao.reportTypeError)(e)),i.endIf()):Yu(e,p),s||i.if((0,N._)`${D.default.errors} === ${n||0}`))}}function Yu(e,t){let{gen:r,schema:n,opts:{useDefaults:i}}=e;i&&(0,vb.assignDefaults)(e,t.type),r.block(()=>{for(let a of t.rules)(0,Fc.shouldUseRule)(n,a)&&ah(e,a.keyword,a.definition,t.type)})}function Lb(e,t){e.schemaEnv.meta||!e.opts.strictTypes||($b(e,t),e.opts.allowUnionTypes||Mb(e,t),Vb(e,e.dataTypes))}function $b(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{ih(e.dataTypes,r)||zc(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Fb(e,t)}}function Mb(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&zc(e,"use allowUnionTypes to allow union type keyword")}function Vb(e,t){let r=e.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,Fc.shouldUseRule)(e.schema,i)){let{type:a}=i.definition;a.length&&!a.some(o=>Ub(t,o))&&zc(e,`missing type "${a.join(",")}" for keyword "${n}"`)}}}function Ub(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function ih(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Fb(e,t){let r=[];for(let n of e.dataTypes)ih(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function zc(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ut.checkStrictMode)(e,t,e.opts.strictTypes)}var oo=class{constructor(t,r,n){if((0,Si.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ut.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",oh(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Si.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",D.default.errors))}result(t,r,n){this.failResult((0,N.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,N.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,N._)`${r} !== undefined && (${(0,N.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?ki.reportExtraError:ki.reportError)(this,this.def.error,r)}$dataError(){(0,ki.reportError)(this,this.def.$dataError||ki.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ki.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=N.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=N.nil,r=N.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:a,def:o}=this;n.if((0,N.or)((0,N._)`${i} === undefined`,r)),t!==N.nil&&n.assign(t,!0),(a.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==N.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:i,it:a}=this;return(0,N.or)(o(),s());function o(){if(n.length){if(!(r instanceof N.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,N._)`${(0,ao.checkDataTypes)(c,r,a.opts.strictNumbers,ao.DataType.Wrong)}`}return N.nil}function s(){if(i.validateSchema){let c=t.scopeValue("validate$data",{ref:i.validateSchema});return(0,N._)`!${c}(${r})`}return N.nil}}subschema(t,r){let n=(0,Uc.getSubschema)(this.it,t);(0,Uc.extendSubschemaData)(n,this.it,t),(0,Uc.extendSubschemaMode)(n,t);let i={...this.it,...n,items:void 0,props:void 0};return Nb(i,r),i}mergeEvaluated(t,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Ut.mergeEvaluated.props(i,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Ut.mergeEvaluated.items(i,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(t,N.Name)),!0}};cr.KeywordCxt=oo;function ah(e,t,r,n){let i=new oo(e,r,t);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Si.funcKeywordCode)(i,r):"macro"in r?(0,Si.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Si.funcKeywordCode)(i,r)}var zb=/^\/(?:[^~]|~0|~1)*$/,Bb=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function oh(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let i,a;if(e==="")return D.default.rootData;if(e[0]==="/"){if(!zb.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,a=D.default.rootData}else{let d=Bb.exec(e);if(!d)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+d[1];if(i=d[2],i==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(a=r[t-l],!i)return a}let o=a,s=i.split("/");for(let d of s)d&&(a=(0,N._)`${a}${(0,N.getProperty)((0,Ut.unescapeJsonPointer)(d))}`,o=(0,N._)`${o} && ${a}`);return o;function c(d,l){return`Cannot access ${d} ${l} levels up, current level is ${t}`}}cr.getData=oh});var so=w(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});var Bc=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};qc.default=Bc});var Pi=w(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});var Gc=Ri(),Kc=class extends Error{constructor(t,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Gc.resolveUrl)(t,r,n),this.missingSchema=(0,Gc.normalizeId)((0,Gc.getFullPath)(t,this.missingRef))}};Wc.default=Kc});var Oi=w(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.resolveSchema=et.getCompilingSchema=et.resolveRef=et.compileSchema=et.SchemaEnv=void 0;var lt=T(),qb=so(),xr=Xe(),ft=Ri(),sh=M(),Gb=Ni(),yn=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,ft.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};et.SchemaEnv=yn;function Jc(e){let t=ch.call(this,e);if(t)return t;let r=(0,ft.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:a}=this.opts,o=new lt.CodeGen(this.scope,{es5:n,lines:i,ownProperties:a}),s;e.$async&&(s=o.scopeValue("Error",{ref:qb.default,code:(0,lt._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");e.validateName=c;let d={gen:o,allErrors:this.opts.allErrors,data:xr.default.data,parentData:xr.default.parentData,parentDataProperty:xr.default.parentDataProperty,dataNames:[xr.default.data],dataPathArr:[lt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,lt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:lt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,lt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,Gb.validateFunctionCode)(d),o.optimize(this.opts.code.optimize);let f=o.toString();l=`${o.scopeRefs(xr.default.scope)}return ${f}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let u=new Function(`${xr.default.self}`,`${xr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:u}),u.errors=null,u.schema=e.schema,u.schemaEnv=e,e.$async&&(u.$async=!0),this.opts.code.source===!0&&(u.source={validateName:c,validateCode:f,scopeValues:o._values}),this.opts.unevaluated){let{props:h,items:m}=d;u.evaluated={props:h instanceof lt.Name?void 0:h,items:m instanceof lt.Name?void 0:m,dynamicProps:h instanceof lt.Name,dynamicItems:m instanceof lt.Name},u.source&&(u.source.evaluated=(0,lt.stringify)(u.evaluated))}return e.validate=u,e}catch(f){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),f}finally{this._compilations.delete(e)}}et.compileSchema=Jc;function Kb(e,t,r){var n;r=(0,ft.resolveUrl)(this.opts.uriResolver,t,r);let i=e.refs[r];if(i)return i;let a=Jb.call(this,e,r);if(a===void 0){let o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;o&&(a=new yn({schema:o,schemaId:s,root:e,baseId:t}))}if(a!==void 0)return e.refs[r]=Wb.call(this,a)}et.resolveRef=Kb;function Wb(e){return(0,ft.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Jc.call(this,e)}function ch(e){for(let t of this._compilations)if(Hb(t,e))return t}et.getCompilingSchema=ch;function Hb(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Jb(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||co.call(this,e,t)}function co(e,t){let r=this.opts.uriResolver.parse(t),n=(0,ft._getFullPath)(this.opts.uriResolver,r),i=(0,ft.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===i)return Hc.call(this,r,e);let a=(0,ft.normalizeId)(n),o=this.refs[a]||this.schemas[a];if(typeof o=="string"){let s=co.call(this,e,o);return typeof s?.schema!="object"?void 0:Hc.call(this,r,s)}if(typeof o?.schema=="object"){if(o.validate||Jc.call(this,o),a===(0,ft.normalizeId)(t)){let{schema:s}=o,{schemaId:c}=this.opts,d=s[c];return d&&(i=(0,ft.resolveUrl)(this.opts.uriResolver,i,d)),new yn({schema:s,schemaId:c,root:e,baseId:i})}return Hc.call(this,r,o)}}et.resolveSchema=co;var Yb=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Hc(e,{baseId:t,schema:r,root:n}){var i;if(((i=e.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,sh.unescapeFragment)(s)];if(c===void 0)return;r=c;let d=typeof r=="object"&&r[this.opts.schemaId];!Yb.has(s)&&d&&(t=(0,ft.resolveUrl)(this.opts.uriResolver,t,d))}let a;if(typeof r!="boolean"&&r.$ref&&!(0,sh.schemaHasRulesButRef)(r,this.RULES)){let s=(0,ft.resolveUrl)(this.opts.uriResolver,t,r.$ref);a=co.call(this,n,s)}let{schemaId:o}=this.opts;if(a=a||new yn({schema:r,schemaId:o,root:n,baseId:t}),a.schema!==a.root.schema)return a}});var dh=w((B$,Zb)=>{Zb.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Xc=w((q$,mh)=>{"use strict";var Xb=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),fh=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),Yc=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),ph=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Qb=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Zc(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var eA=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function lh(e){return e.length=0,!0}function tA(e,t,r){if(e.length){let n=Zc(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function rA(e){let t=0,r={error:!1,address:"",zone:""},n=[],i=[],a=!1,o=!1,s=tA;for(let c=0;c<e.length;c++){let d=e[c];if(!(d==="["||d==="]"))if(d===":"){if(a===!0&&(o=!0),!s(i,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(a=!0),n.push(":");continue}else if(d==="%"){if(!s(i,n,r))break;s=lh}else{i.push(d);continue}}return i.length&&(s===lh?r.zone=i.join(""):o?n.push(i.join("")):n.push(Zc(i))),r.address=n.join(""),r}function uh(e){if(nA(e,":")<2)return{host:e,isIPV6:!1};let t=rA(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function nA(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function iA(e){let t=e,r=[],n=-1,i=0;for(;i=t.length;){if(i===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(i===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(i===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var aA={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},oA=/[@/?#:]/g,sA=/[@/?#]/g;function hh(e,t){let r=t?sA:oA;return r.lastIndex=0,e.replace(r,n=>aA[n])}function cA(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(Yc(i)){let a=i.toUpperCase(),o=String.fromCharCode(parseInt(a,16));t&&ph(o)?r+=o:r+="%"+a,n+=2;continue}}r+=e[n]}return r}function dA(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Yc(n)){let i=n.toUpperCase(),a=String.fromCharCode(parseInt(i,16));a!=="."&&ph(a)?t+=a:t+="%"+i,r+=2;continue}}Qb(e[r])?t+=e[r]:t+=escape(e[r])}return t}function lA(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Yc(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function fA(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!fh(r)){let n=uh(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=hh(r,!1)}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}mh.exports={nonSimpleDomain:eA,recomposeAuthority:fA,reescapeHostDelimiters:hh,normalizePercentEncoding:cA,normalizePathEncoding:dA,escapePreservingEscapes:lA,removeDotSegments:iA,isIPv4:fh,isUUID:Xb,normalizeIPv6:uh,stringArrayToHexStripped:Zc}});var Ih=w((G$,_h)=>{"use strict";var{isUUID:pA}=Xc(),uA=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,hA=["http","https","ws","wss","urn","urn:uuid"];function mA(e){return hA.indexOf(e)!==-1}function Qc(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function gh(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function yh(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function gA(e){return e.secure=Qc(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function yA(e){if((e.port===(Qc(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function wA(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(uA);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=`${n}:${t.nid||e.nid}`,a=ed(i);e.path=void 0,a&&(e=a.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function _A(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),i=`${r}:${t.nid||n}`,a=ed(i);a&&(e=a.serialize(e,t));let o=e,s=e.nss;return o.path=`${n||t.nid}:${s}`,t.skipEscape=!0,o}function IA(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!pA(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function vA(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var wh={scheme:"http",domainHost:!0,parse:gh,serialize:yh},EA={scheme:"https",domainHost:wh.domainHost,parse:gh,serialize:yh},lo={scheme:"ws",domainHost:!0,parse:gA,serialize:yA},bA={scheme:"wss",domainHost:lo.domainHost,parse:lo.parse,serialize:lo.serialize},AA={scheme:"urn",parse:wA,serialize:_A,skipNormalize:!0},RA={scheme:"urn:uuid",parse:IA,serialize:vA,skipNormalize:!0},fo={http:wh,https:EA,ws:lo,wss:bA,urn:AA,"urn:uuid":RA};Object.setPrototypeOf(fo,null);function ed(e){return e&&(fo[e]||fo[e.toLowerCase()])||void 0}_h.exports={wsIsSecure:Qc,SCHEMES:fo,isValidSchemeName:mA,getSchemeHandler:ed}});var Rh=w((K$,ho)=>{"use strict";var{normalizeIPv6:kA,removeDotSegments:Di,recomposeAuthority:SA,normalizePercentEncoding:NA,normalizePathEncoding:PA,escapePreservingEscapes:OA,reescapeHostDelimiters:DA,isIPv4:CA,nonSimpleDomain:xA}=Xc(),{SCHEMES:TA,getSchemeHandler:Eh}=Ih();function jA(e,t){return typeof e=="string"?e=zA(e,t):typeof e=="object"&&(e=uo(Tr(e,t),t)),e}function LA(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:i,malformedAuthorityOrPort:a}=po(e,n),{parsed:o,malformedAuthorityOrPort:s}=po(t,n);if(a||s)throw new Error(i.error||o.error||"URI is malformed.");let c=bh(i,o,n,!0);return n.skipEscape=!0,Tr(c,n)}function bh(e,t,r,n){let i={};return n||(e=uo(Tr(e,r),r),t=uo(Tr(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=Di(t.path||""),i.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=Di(t.path||""),i.query=t.query):(t.path?(t.path[0]==="/"?i.path=Di(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?i.path="/"+t.path:e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path,i.path=Di(i.path)),i.query=t.query):(i.path=e.path,t.query!==void 0?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function $A(e,t,r){let n=vh(e,r),i=vh(t,r);return n!==void 0&&i!==void 0&&n.toLowerCase()===i.toLowerCase()}function Tr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),i=[],a=Eh(n.scheme||r.scheme);a&&a.serialize&&a.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=NA(r.path):(r.path=OA(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=SA(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!a||!a.absolutePath)&&(s=Di(s)),o===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),i.push(s)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var MA=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,VA=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,UA=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function FA(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function po(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,a=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let o=e.match(VA);o!==null&&o[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",i=!0);let s=e.match(UA);if(s!==null){let d=s[1],l=d.replace(/[\t\n\r]/g,"");l.length>=2&&(l.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",i=!0):d.length!==l.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",i=!0))}let c=e.match(MA);if(c){n.scheme=c[1],n.userinfo=c[3],n.host=c[4],n.port=parseInt(c[5],10),n.path=c[6]||"",n.query=c[7],n.fragment=c[8],isNaN(n.port)&&(n.port=c[5]);let d=FA(n,c);if(d!==void 0&&(n.error=n.error||d,i=!0),n.host)if(CA(n.host)===!1){let p=kA(n.host);n.host=p.host.toLowerCase(),a=p.isIPV6}else a=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let l=Eh(r.scheme||n.scheme);if(!r.unicodeSupport&&(!l||!l.unicodeSupport)&&n.host&&(r.domainHost||l&&l.domainHost)&&a===!1&&xA(n.host))try{n.host=new URL("http://"+n.host).hostname}catch(f){n.error=n.error||"Host's domain name can not be converted to ASCII: "+f}if((!l||l&&!l.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=DA(unescape(n.host),a))),n.path&&(n.path=PA(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}l&&l.parse&&l.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:i}}function uo(e,t){return po(e,t).parsed}function zA(e,t){return Ah(e,t).normalized}function Ah(e,t){let{parsed:r,malformedAuthorityOrPort:n}=po(e,t);return{normalized:n?e:Tr(r,t),malformedAuthorityOrPort:n}}function vh(e,t){if(typeof e=="string"){let{normalized:r,malformedAuthorityOrPort:n}=Ah(e,t);return n?void 0:r}if(typeof e=="object")return Tr(e,t)}var td={SCHEMES:TA,normalize:jA,resolve:LA,resolveComponent:bh,equal:$A,serialize:Tr,parse:uo};ho.exports=td;ho.exports.default=td;ho.exports.fastUri=td});var Sh=w(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});var kh=Rh();kh.code='require("ajv/dist/runtime/uri").default';rd.default=kh});var jh=w(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.CodeGen=ve.Name=ve.nil=ve.stringify=ve.str=ve._=ve.KeywordCxt=void 0;var BA=Ni();Object.defineProperty(ve,"KeywordCxt",{enumerable:!0,get:function(){return BA.KeywordCxt}});var wn=T();Object.defineProperty(ve,"_",{enumerable:!0,get:function(){return wn._}});Object.defineProperty(ve,"str",{enumerable:!0,get:function(){return wn.str}});Object.defineProperty(ve,"stringify",{enumerable:!0,get:function(){return wn.stringify}});Object.defineProperty(ve,"nil",{enumerable:!0,get:function(){return wn.nil}});Object.defineProperty(ve,"Name",{enumerable:!0,get:function(){return wn.Name}});Object.defineProperty(ve,"CodeGen",{enumerable:!0,get:function(){return wn.CodeGen}});var qA=so(),Ch=Pi(),GA=Oc(),Ci=Oi(),KA=T(),xi=Ri(),mo=Ai(),id=M(),Nh=dh(),WA=Sh(),xh=(e,t)=>new RegExp(e,t);xh.code="new RegExp";var HA=["removeAdditional","useDefaults","coerceTypes"],JA=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),YA={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},ZA={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Ph=200;function XA(e){var t,r,n,i,a,o,s,c,d,l,f,p,u,h,m,g,y,_,b,E,I,S,R,P,x;let B=e.strict,k=(t=e.code)===null||t===void 0?void 0:t.optimize,he=k===!0||k===void 0?1:k||0,Lt=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:xh,dn=(i=e.uriResolver)!==null&&i!==void 0?i:WA.default;return{strictSchema:(o=(a=e.strictSchema)!==null&&a!==void 0?a:B)!==null&&o!==void 0?o:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:B)!==null&&c!==void 0?c:!0,strictTypes:(l=(d=e.strictTypes)!==null&&d!==void 0?d:B)!==null&&l!==void 0?l:"log",strictTuples:(p=(f=e.strictTuples)!==null&&f!==void 0?f:B)!==null&&p!==void 0?p:"log",strictRequired:(h=(u=e.strictRequired)!==null&&u!==void 0?u:B)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:he,regExp:Lt}:{optimize:he,regExp:Lt},loopRequired:(m=e.loopRequired)!==null&&m!==void 0?m:Ph,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:Ph,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(_=e.messages)!==null&&_!==void 0?_:!0,inlineRefs:(b=e.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(I=e.addUsedSchema)!==null&&I!==void 0?I:!0,validateSchema:(S=e.validateSchema)!==null&&S!==void 0?S:!0,validateFormats:(R=e.validateFormats)!==null&&R!==void 0?R:!0,unicodeRegExp:(P=e.unicodeRegExp)!==null&&P!==void 0?P:!0,int32range:(x=e.int32range)!==null&&x!==void 0?x:!0,uriResolver:dn}}var Ti=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...XA(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new KA.ValueScope({scope:{},prefixes:JA,es5:r,lines:n}),this.logger=iR(t.logger);let i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,GA.getRules)(),Oh.call(this,YA,t,"NOT SUPPORTED"),Oh.call(this,ZA,t,"DEPRECATED","warn"),this._metaOpts=rR.call(this),t.formats&&eR.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&tR.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),QA.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,i=Nh;n==="id"&&(i={...Nh},i.id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,t,r);async function i(l,f){await a.call(this,l.$schema);let p=this._addSchema(l,f);return p.validate||o.call(this,p)}async function a(l){l&&!this.getSchema(l)&&await i.call(this,{$ref:l},!0)}async function o(l){try{return this._compileSchemaEnv(l)}catch(f){if(!(f instanceof Ch.default))throw f;return s.call(this,f),await c.call(this,f.missingSchema),o.call(this,l)}}function s({missingSchema:l,missingRef:f}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${f} cannot be resolved`)}async function c(l){let f=await d.call(this,l);this.refs[l]||await a.call(this,f.$schema),this.refs[l]||this.addSchema(f,l,r)}async function d(l){let f=this._loading[l];if(f)return f;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,i=this.opts.validateSchema){if(Array.isArray(t)){for(let o of t)this.addSchema(o,void 0,n,i);return this}let a;if(typeof t=="object"){let{schemaId:o}=this.opts;if(a=t[o],a!==void 0&&typeof a!="string")throw new Error(`schema ${o} must be string`)}return r=(0,xi.normalizeId)(r||a),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,i,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,t);if(!i&&r){let a="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(a);else throw new Error(a)}return i}getSchema(t){let r;for(;typeof(r=Dh.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,i=new Ci.SchemaEnv({schema:{},schemaId:n});if(r=Ci.resolveSchema.call(this,i,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Dh.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,xi.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(oR.call(this,n,r),!r)return(0,id.eachItem)(n,a=>nd.call(this,a)),this;cR.call(this,r);let i={...r,type:(0,mo.getJSONTypes)(r.type),schemaType:(0,mo.getJSONTypes)(r.schemaType)};return(0,id.eachItem)(n,i.type.length===0?a=>nd.call(this,a,i):a=>i.type.forEach(o=>nd.call(this,a,i,o))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let i=n.rules.findIndex(a=>a.keyword===t);i>=0&&n.rules.splice(i,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,a)=>i+r+a)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let i of r){let a=i.split("/").slice(1),o=t;for(let s of a)o=o[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:d}=c.definition,l=o[s];d&&l&&(o[s]=Th(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let i=t[n];(!r||r.test(n))&&(typeof i=="string"?delete t[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[n]))}}_addSchema(t,r,n,i=this.opts.validateSchema,a=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof t=="object")o=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,xi.normalizeId)(o||n);let d=xi.getSchemaRefs.call(this,t,n);return c=new Ci.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:d}),this._cache.set(c.schema,c),a&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Ci.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{Ci.compileSchema.call(this,t)}finally{this.opts=r}}};Ti.ValidationError=qA.default;Ti.MissingRefError=Ch.default;ve.default=Ti;function Oh(e,t,r,n="error"){for(let i in e){let a=i;a in t&&this.logger[n](`${r}: option ${i}. ${e[a]}`)}}function Dh(e){return e=(0,xi.normalizeId)(e),this.schemas[e]||this.refs[e]}function QA(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function eR(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function tR(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function rR(){let e={...this.opts};for(let t of HA)delete e[t];return e}var nR={log(){},warn(){},error(){}};function iR(e){if(e===!1)return nR;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var aR=/^[a-z_$][a-z0-9_$:-]*$/i;function oR(e,t){let{RULES:r}=this;if((0,id.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!aR.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function nd(e,t,r){var n;let i=t?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,o=i?a.post:a.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,mo.getJSONTypes)(t.type),schemaType:(0,mo.getJSONTypes)(t.schemaType)}};t.before?sR.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function sR(e,t,r){let n=e.rules.findIndex(i=>i.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function cR(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Th(t)),e.validateSchema=this.compile(t,!0))}var dR={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Th(e){return{anyOf:[e,dR]}}});var Lh=w(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});var lR={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};ad.default=lR});var wo=w(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.callRef=jr.getValidate=void 0;var fR=Pi(),$h=Qe(),Fe=T(),_n=Xe(),Mh=Oi(),go=M(),pR={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:i,schemaEnv:a,validateName:o,opts:s,self:c}=n,{root:d}=a;if((r==="#"||r==="#/")&&i===d.baseId)return f();let l=Mh.resolveRef.call(c,d,i,r);if(l===void 0)throw new fR.default(n.opts.uriResolver,i,r);if(l instanceof Mh.SchemaEnv)return p(l);return u(l);function f(){if(a===d)return yo(e,o,a,a.$async);let h=t.scopeValue("root",{ref:d});return yo(e,(0,Fe._)`${h}.validate`,d,d.$async)}function p(h){let m=Vh(e,h);yo(e,m,h,h.$async)}function u(h){let m=t.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Fe.stringify)(h)}:{ref:h}),g=t.name("valid"),y=e.subschema({schema:h,dataTypes:[],schemaPath:Fe.nil,topSchemaRef:m,errSchemaPath:r},g);e.mergeEvaluated(y),e.ok(g)}}};function Vh(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Fe._)`${r.scopeValue("wrapper",{ref:t})}.validate`}jr.getValidate=Vh;function yo(e,t,r,n){let{gen:i,it:a}=e,{allErrors:o,schemaEnv:s,opts:c}=a,d=c.passContext?_n.default.this:Fe.nil;n?l():f();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=i.let("valid");i.try(()=>{i.code((0,Fe._)`await ${(0,$h.callValidateCode)(e,t,d)}`),u(t),o||i.assign(h,!0)},m=>{i.if((0,Fe._)`!(${m} instanceof ${a.ValidationError})`,()=>i.throw(m)),p(m),o||i.assign(h,!1)}),e.ok(h)}function f(){e.result((0,$h.callValidateCode)(e,t,d),()=>u(t),()=>p(t))}function p(h){let m=(0,Fe._)`${h}.errors`;i.assign(_n.default.vErrors,(0,Fe._)`${_n.default.vErrors} === null ? ${m} : ${_n.default.vErrors}.concat(${m})`),i.assign(_n.default.errors,(0,Fe._)`${_n.default.vErrors}.length`)}function u(h){var m;if(!a.opts.unevaluated)return;let g=(m=r?.validate)===null||m===void 0?void 0:m.evaluated;if(a.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(a.props=go.mergeEvaluated.props(i,g.props,a.props));else{let y=i.var("props",(0,Fe._)`${h}.evaluated.props`);a.props=go.mergeEvaluated.props(i,y,a.props,Fe.Name)}if(a.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(a.items=go.mergeEvaluated.items(i,g.items,a.items));else{let y=i.var("items",(0,Fe._)`${h}.evaluated.items`);a.items=go.mergeEvaluated.items(i,y,a.items,Fe.Name)}}}jr.callRef=yo;jr.default=pR});var Uh=w(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});var uR=Lh(),hR=wo(),mR=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",uR.default,hR.default];od.default=mR});var Fh=w(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});var _o=T(),dr=_o.operators,Io={maximum:{okStr:"<=",ok:dr.LTE,fail:dr.GT},minimum:{okStr:">=",ok:dr.GTE,fail:dr.LT},exclusiveMaximum:{okStr:"<",ok:dr.LT,fail:dr.GTE},exclusiveMinimum:{okStr:">",ok:dr.GT,fail:dr.LTE}},gR={message:({keyword:e,schemaCode:t})=>(0,_o.str)`must be ${Io[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,_o._)`{comparison: ${Io[e].okStr}, limit: ${t}}`},yR={keyword:Object.keys(Io),type:"number",schemaType:"number",$data:!0,error:gR,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,_o._)`${r} ${Io[t].fail} ${n} || isNaN(${r})`)}};sd.default=yR});var zh=w(cd=>{"use strict";Object.defineProperty(cd,"__esModule",{value:!0});var ji=T(),wR={message:({schemaCode:e})=>(0,ji.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ji._)`{multipleOf: ${e}}`},_R={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:wR,code(e){let{gen:t,data:r,schemaCode:n,it:i}=e,a=i.opts.multipleOfPrecision,o=t.let("res"),s=a?(0,ji._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${a}`:(0,ji._)`${o} !== parseInt(${o})`;e.fail$data((0,ji._)`(${n} === 0 || (${o} = ${r}/${n}, ${s}))`)}};cd.default=_R});var qh=w(dd=>{"use strict";Object.defineProperty(dd,"__esModule",{value:!0});function Bh(e){let t=e.length,r=0,n=0,i;for(;n<t;)r++,i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<t&&(i=e.charCodeAt(n),(i&64512)===56320&&n++);return r}dd.default=Bh;Bh.code='require("ajv/dist/runtime/ucs2length").default'});var Gh=w(ld=>{"use strict";Object.defineProperty(ld,"__esModule",{value:!0});var Lr=T(),IR=M(),vR=qh(),ER={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Lr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Lr._)`{limit: ${e}}`},bR={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:ER,code(e){let{keyword:t,data:r,schemaCode:n,it:i}=e,a=t==="maxLength"?Lr.operators.GT:Lr.operators.LT,o=i.opts.unicode===!1?(0,Lr._)`${r}.length`:(0,Lr._)`${(0,IR.useFunc)(e.gen,vR.default)}(${r})`;e.fail$data((0,Lr._)`${o} ${a} ${n}`)}};ld.default=bR});var Kh=w(fd=>{"use strict";Object.defineProperty(fd,"__esModule",{value:!0});var AR=Qe(),RR=M(),In=T(),kR={message:({schemaCode:e})=>(0,In.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,In._)`{pattern: ${e}}`},SR={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:kR,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:a,it:o}=e,s=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=o.opts.code,d=c.code==="new RegExp"?(0,In._)`new RegExp`:(0,RR.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,In._)`${d}(${a}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,In._)`!${l}`)}else{let c=(0,AR.usePattern)(e,i);e.fail$data((0,In._)`!${c}.test(${r})`)}}};fd.default=SR});var Wh=w(pd=>{"use strict";Object.defineProperty(pd,"__esModule",{value:!0});var Li=T(),NR={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,Li.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Li._)`{limit: ${e}}`},PR={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:NR,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxProperties"?Li.operators.GT:Li.operators.LT;e.fail$data((0,Li._)`Object.keys(${r}).length ${i} ${n}`)}};pd.default=PR});var Hh=w(ud=>{"use strict";Object.defineProperty(ud,"__esModule",{value:!0});var $i=Qe(),Mi=T(),OR=M(),DR={message:({params:{missingProperty:e}})=>(0,Mi.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Mi._)`{missingProperty: ${e}}`},CR={keyword:"required",type:"object",schemaType:"array",$data:!0,error:DR,code(e){let{gen:t,schema:r,schemaCode:n,data:i,$data:a,it:o}=e,{opts:s}=o;if(!a&&r.length===0)return;let c=r.length>=s.loopRequired;if(o.allErrors?d():l(),s.strictRequired){let u=e.parentSchema.properties,{definedProperties:h}=e.it;for(let m of r)if(u?.[m]===void 0&&!h.has(m)){let g=o.schemaEnv.baseId+o.errSchemaPath,y=`required property "${m}" is not defined at "${g}" (strictRequired)`;(0,OR.checkStrictMode)(o,y,o.opts.strictRequired)}}function d(){if(c||a)e.block$data(Mi.nil,f);else for(let u of r)(0,$i.checkReportMissingProp)(e,u)}function l(){let u=t.let("missing");if(c||a){let h=t.let("valid",!0);e.block$data(h,()=>p(u,h)),e.ok(h)}else t.if((0,$i.checkMissingProp)(e,r,u)),(0,$i.reportMissingProp)(e,u),t.else()}function f(){t.forOf("prop",n,u=>{e.setParams({missingProperty:u}),t.if((0,$i.noPropertyInData)(t,i,u,s.ownProperties),()=>e.error())})}function p(u,h){e.setParams({missingProperty:u}),t.forOf(u,n,()=>{t.assign(h,(0,$i.propertyInData)(t,i,u,s.ownProperties)),t.if((0,Mi.not)(h),()=>{e.error(),t.break()})},Mi.nil)}}};ud.default=CR});var Jh=w(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});var Vi=T(),xR={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Vi.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Vi._)`{limit: ${e}}`},TR={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:xR,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxItems"?Vi.operators.GT:Vi.operators.LT;e.fail$data((0,Vi._)`${r}.length ${i} ${n}`)}};hd.default=TR});var vo=w(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});var Yh=Mc();Yh.code='require("ajv/dist/runtime/equal").default';md.default=Yh});var Zh=w(yd=>{"use strict";Object.defineProperty(yd,"__esModule",{value:!0});var gd=Ai(),Ee=T(),jR=M(),LR=vo(),$R={message:({params:{i:e,j:t}})=>(0,Ee.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Ee._)`{i: ${e}, j: ${t}}`},MR={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:$R,code(e){let{gen:t,data:r,$data:n,schema:i,parentSchema:a,schemaCode:o,it:s}=e;if(!n&&!i)return;let c=t.let("valid"),d=a.items?(0,gd.getSchemaTypes)(a.items):[];e.block$data(c,l,(0,Ee._)`${o} === false`),e.ok(c);function l(){let h=t.let("i",(0,Ee._)`${r}.length`),m=t.let("j");e.setParams({i:h,j:m}),t.assign(c,!0),t.if((0,Ee._)`${h} > 1`,()=>(f()?p:u)(h,m))}function f(){return d.length>0&&!d.some(h=>h==="object"||h==="array")}function p(h,m){let g=t.name("item"),y=(0,gd.checkDataTypes)(d,g,s.opts.strictNumbers,gd.DataType.Wrong),_=t.const("indices",(0,Ee._)`{}`);t.for((0,Ee._)`;${h}--;`,()=>{t.let(g,(0,Ee._)`${r}[${h}]`),t.if(y,(0,Ee._)`continue`),d.length>1&&t.if((0,Ee._)`typeof ${g} == "string"`,(0,Ee._)`${g} += "_"`),t.if((0,Ee._)`typeof ${_}[${g}] == "number"`,()=>{t.assign(m,(0,Ee._)`${_}[${g}]`),e.error(),t.assign(c,!1).break()}).code((0,Ee._)`${_}[${g}] = ${h}`)})}function u(h,m){let g=(0,jR.useFunc)(t,LR.default),y=t.name("outer");t.label(y).for((0,Ee._)`;${h}--;`,()=>t.for((0,Ee._)`${m} = ${h}; ${m}--;`,()=>t.if((0,Ee._)`${g}(${r}[${h}], ${r}[${m}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};yd.default=MR});var Xh=w(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});var wd=T(),VR=M(),UR=vo(),FR={message:"must be equal to constant",params:({schemaCode:e})=>(0,wd._)`{allowedValue: ${e}}`},zR={keyword:"const",$data:!0,error:FR,code(e){let{gen:t,data:r,$data:n,schemaCode:i,schema:a}=e;n||a&&typeof a=="object"?e.fail$data((0,wd._)`!${(0,VR.useFunc)(t,UR.default)}(${r}, ${i})`):e.fail((0,wd._)`${a} !== ${r}`)}};_d.default=zR});var Qh=w(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});var Ui=T(),BR=M(),qR=vo(),GR={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Ui._)`{allowedValues: ${e}}`},KR={keyword:"enum",schemaType:"array",$data:!0,error:GR,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:a,it:o}=e;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let s=i.length>=o.opts.loopEnum,c,d=()=>c??(c=(0,BR.useFunc)(t,qR.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,f);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let u=t.const("vSchema",a);l=(0,Ui.or)(...i.map((h,m)=>p(u,m)))}e.pass(l);function f(){t.assign(l,!1),t.forOf("v",a,u=>t.if((0,Ui._)`${d()}(${r}, ${u})`,()=>t.assign(l,!0).break()))}function p(u,h){let m=i[h];return typeof m=="object"&&m!==null?(0,Ui._)`${d()}(${r}, ${u}[${h}])`:(0,Ui._)`${r} === ${m}`}}};Id.default=KR});var em=w(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});var WR=Fh(),HR=zh(),JR=Gh(),YR=Kh(),ZR=Wh(),XR=Hh(),QR=Jh(),ek=Zh(),tk=Xh(),rk=Qh(),nk=[WR.default,HR.default,JR.default,YR.default,ZR.default,XR.default,QR.default,ek.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},tk.default,rk.default];vd.default=nk});var bd=w(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.validateAdditionalItems=void 0;var $r=T(),Ed=M(),ik={message:({params:{len:e}})=>(0,$r.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,$r._)`{limit: ${e}}`},ak={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:ik,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Ed.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}tm(e,n)}};function tm(e,t){let{gen:r,schema:n,data:i,keyword:a,it:o}=e;o.items=!0;let s=r.const("len",(0,$r._)`${i}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,$r._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Ed.alwaysValidSchema)(o,n)){let d=r.var("valid",(0,$r._)`${s} <= ${t.length}`);r.if((0,$r.not)(d),()=>c(d)),e.ok(d)}function c(d){r.forRange("i",t.length,s,l=>{e.subschema({keyword:a,dataProp:l,dataPropType:Ed.Type.Num},d),o.allErrors||r.if((0,$r.not)(d),()=>r.break())})}}Fi.validateAdditionalItems=tm;Fi.default=ak});var Ad=w(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.validateTuple=void 0;var rm=T(),Eo=M(),ok=Qe(),sk={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return nm(e,"additionalItems",t);r.items=!0,!(0,Eo.alwaysValidSchema)(r,t)&&e.ok((0,ok.validateArray)(e))}};function nm(e,t,r=e.schema){let{gen:n,parentSchema:i,data:a,keyword:o,it:s}=e;l(i),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=Eo.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),d=n.const("len",(0,rm._)`${a}.length`);r.forEach((f,p)=>{(0,Eo.alwaysValidSchema)(s,f)||(n.if((0,rm._)`${d} > ${p}`,()=>e.subschema({keyword:o,schemaProp:p,dataProp:p},c)),e.ok(c))});function l(f){let{opts:p,errSchemaPath:u}=s,h=r.length,m=h===f.minItems&&(h===f.maxItems||f[t]===!1);if(p.strictTuples&&!m){let g=`"${o}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${u}"`;(0,Eo.checkStrictMode)(s,g,p.strictTuples)}}}zi.validateTuple=nm;zi.default=sk});var im=w(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});var ck=Ad(),dk={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,ck.validateTuple)(e,"items")};Rd.default=dk});var om=w(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});var am=T(),lk=M(),fk=Qe(),pk=bd(),uk={message:({params:{len:e}})=>(0,am.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,am._)`{limit: ${e}}`},hk={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:uk,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:i}=r;n.items=!0,!(0,lk.alwaysValidSchema)(n,t)&&(i?(0,pk.validateAdditionalItems)(e,i):e.ok((0,fk.validateArray)(e)))}};kd.default=hk});var sm=w(Sd=>{"use strict";Object.defineProperty(Sd,"__esModule",{value:!0});var tt=T(),bo=M(),mk={message:({params:{min:e,max:t}})=>t===void 0?(0,tt.str)`must contain at least ${e} valid item(s)`:(0,tt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,tt._)`{minContains: ${e}}`:(0,tt._)`{minContains: ${e}, maxContains: ${t}}`},gk={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:mk,code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:a}=e,o,s,{minContains:c,maxContains:d}=n;a.opts.next?(o=c===void 0?1:c,s=d):o=1;let l=t.const("len",(0,tt._)`${i}.length`);if(e.setParams({min:o,max:s}),s===void 0&&o===0){(0,bo.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&o>s){(0,bo.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,bo.alwaysValidSchema)(a,r)){let m=(0,tt._)`${l} >= ${o}`;s!==void 0&&(m=(0,tt._)`${m} && ${l} <= ${s}`),e.pass(m);return}a.items=!0;let f=t.name("valid");s===void 0&&o===1?u(f,()=>t.if(f,()=>t.break())):o===0?(t.let(f,!0),s!==void 0&&t.if((0,tt._)`${i}.length > 0`,p)):(t.let(f,!1),p()),e.result(f,()=>e.reset());function p(){let m=t.name("_valid"),g=t.let("count",0);u(m,()=>t.if(m,()=>h(g)))}function u(m,g){t.forRange("i",0,l,y=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:bo.Type.Num,compositeRule:!0},m),g()})}function h(m){t.code((0,tt._)`${m}++`),s===void 0?t.if((0,tt._)`${m} >= ${o}`,()=>t.assign(f,!0).break()):(t.if((0,tt._)`${m} > ${s}`,()=>t.assign(f,!1).break()),o===1?t.assign(f,!0):t.if((0,tt._)`${m} >= ${o}`,()=>t.assign(f,!0)))}}};Sd.default=gk});var Ao=w(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.validateSchemaDeps=bt.validatePropertyDeps=bt.error=void 0;var Nd=T(),yk=M(),Bi=Qe();bt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Nd.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Nd._)`{property: ${e},
|
|
5
|
+
|| ${o} === "boolean" || ${i} === null`).assign(s,(0,j._)`[${i}]`)}}}function $0({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,j._)`${t} !== undefined`,()=>e.assign((0,j._)`${t}[${r}]`,n))}function Cc(e,t,r,n=hn.Correct){let i=n===hn.Correct?j.operators.EQ:j.operators.NEQ,a;switch(e){case"null":return(0,j._)`${t} ${i} null`;case"array":a=(0,j._)`Array.isArray(${t})`;break;case"object":a=(0,j._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":a=o((0,j._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":a=o();break;default:return(0,j._)`typeof ${t} ${i} ${e}`}return n===hn.Correct?a:(0,j.not)(a);function o(s=j.nil){return(0,j.and)((0,j._)`typeof ${t} == "number"`,s,r?(0,j._)`isFinite(${t})`:j.nil)}}Pe.checkDataType=Cc;function xc(e,t,r,n){if(e.length===1)return Cc(e[0],t,r,n);let i,a=(0,Pu.toHash)(e);if(a.array&&a.object){let o=(0,j._)`typeof ${t} != "object"`;i=a.null?o:(0,j._)`!${t} || ${o}`,delete a.null,delete a.array,delete a.object}else i=j.nil;a.number&&delete a.integer;for(let o in a)i=(0,j.and)(i,Cc(o,t,r,n));return i}Pe.checkDataTypes=xc;var M0={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,j._)`{type: ${e}}`:(0,j._)`{type: ${t}}`};function Tc(e){let t=V0(e);(0,C0.reportError)(t,M0)}Pe.reportTypeError=Tc;function V0(e){let{gen:t,data:r,schema:n}=e,i=(0,Pu.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}});var xu=w(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.assignDefaults=void 0;var mn=T(),U0=M();function F0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let i in r)Cu(e,i,r[i].default);else t==="array"&&Array.isArray(n)&&n.forEach((i,a)=>Cu(e,a,i.default))}no.assignDefaults=F0;function Cu(e,t,r){let{gen:n,compositeRule:i,data:a,opts:o}=e;if(r===void 0)return;let s=(0,mn._)`${a}${(0,mn.getProperty)(t)}`;if(i){(0,U0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,mn._)`${s} === undefined`;o.useDefaults==="empty"&&(c=(0,mn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,mn._)`${s} = ${(0,mn.stringify)(r)}`)}});var Qe=w(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.validateUnion=Z.validateArray=Z.usePattern=Z.callValidateCode=Z.schemaProperties=Z.allSchemaProperties=Z.noPropertyInData=Z.propertyInData=Z.isOwnProperty=Z.hasPropFunc=Z.reportMissingProp=Z.checkMissingProp=Z.checkReportMissingProp=void 0;var te=T(),jc=M(),ar=Xe(),z0=M();function B0(e,t){let{gen:r,data:n,it:i}=e;r.if($c(r,n,t,i.opts.ownProperties),()=>{e.setParams({missingProperty:(0,te._)`${t}`},!0),e.error()})}Z.checkReportMissingProp=B0;function q0({gen:e,data:t,it:{opts:r}},n,i){return(0,te.or)(...n.map(a=>(0,te.and)($c(e,t,a,r.ownProperties),(0,te._)`${i} = ${a}`)))}Z.checkMissingProp=q0;function G0(e,t){e.setParams({missingProperty:t},!0),e.error()}Z.reportMissingProp=G0;function Tu(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,te._)`Object.prototype.hasOwnProperty`})}Z.hasPropFunc=Tu;function Lc(e,t,r){return(0,te._)`${Tu(e)}.call(${t}, ${r})`}Z.isOwnProperty=Lc;function K0(e,t,r,n){let i=(0,te._)`${t}${(0,te.getProperty)(r)} !== undefined`;return n?(0,te._)`${i} && ${Lc(e,t,r)}`:i}Z.propertyInData=K0;function $c(e,t,r,n){let i=(0,te._)`${t}${(0,te.getProperty)(r)} === undefined`;return n?(0,te.or)(i,(0,te.not)(Lc(e,t,r))):i}Z.noPropertyInData=$c;function ju(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}Z.allSchemaProperties=ju;function W0(e,t){return ju(t).filter(r=>!(0,jc.alwaysValidSchema)(e,t[r]))}Z.schemaProperties=W0;function H0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:a},it:o},s,c,l){let d=l?(0,te._)`${e}, ${t}, ${n}${i}`:t,f=[[ar.default.instancePath,(0,te.strConcat)(ar.default.instancePath,a)],[ar.default.parentData,o.parentData],[ar.default.parentDataProperty,o.parentDataProperty],[ar.default.rootData,ar.default.rootData]];o.opts.dynamicRef&&f.push([ar.default.dynamicAnchors,ar.default.dynamicAnchors]);let p=(0,te._)`${d}, ${r.object(...f)}`;return c!==te.nil?(0,te._)`${s}.call(${c}, ${p})`:(0,te._)`${s}(${p})`}Z.callValidateCode=H0;var J0=(0,te._)`new RegExp`;function Y0({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:i}=t.code,a=i(r,n);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,te._)`${i.code==="new RegExp"?J0:(0,z0.useFunc)(e,i)}(${r}, ${n})`})}Z.usePattern=Y0;function Z0(e){let{gen:t,data:r,keyword:n,it:i}=e,a=t.name("valid");if(i.allErrors){let s=t.let("valid",!0);return o(()=>t.assign(s,!1)),s}return t.var(a,!0),o(()=>t.break()),a;function o(s){let c=t.const("len",(0,te._)`${r}.length`);t.forRange("i",0,c,l=>{e.subschema({keyword:n,dataProp:l,dataPropType:jc.Type.Num},a),t.if((0,te.not)(a),s)})}}Z.validateArray=Z0;function X0(e){let{gen:t,schema:r,keyword:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,jc.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,l)=>{let d=e.subschema({keyword:n,schemaProp:l,compositeRule:!0},s);t.assign(o,(0,te._)`${o} || ${s}`),e.mergeValidEvaluated(d,s)||t.if((0,te.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}Z.validateUnion=X0});var Mu=w(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.validateKeywordUsage=vt.validSchemaType=vt.funcKeywordCode=vt.macroKeywordCode=void 0;var xe=T(),Cr=Xe(),Q0=Qe(),eb=bi();function tb(e,t){let{gen:r,keyword:n,schema:i,parentSchema:a,it:o}=e,s=t.macro.call(o.self,i,a,o),c=$u(r,n,s);o.opts.validateSchema!==!1&&o.self.validateSchema(s,!0);let l=r.name("valid");e.subschema({schema:s,schemaPath:xe.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}vt.macroKeywordCode=tb;function rb(e,t){var r;let{gen:n,keyword:i,schema:a,parentSchema:o,$data:s,it:c}=e;ib(c,t);let l=!s&&t.compile?t.compile.call(c.self,a,o,c):t.validate,d=$u(n,i,l),f=n.let("valid");e.block$data(f,p),e.ok((r=t.valid)!==null&&r!==void 0?r:f);function p(){if(t.errors===!1)m(),t.modifying&&Lu(e),g(()=>e.error());else{let y=t.async?u():h();t.modifying&&Lu(e),g(()=>nb(e,y))}}function u(){let y=n.let("ruleErrs",null);return n.try(()=>m((0,xe._)`await `),_=>n.assign(f,!1).if((0,xe._)`${_} instanceof ${c.ValidationError}`,()=>n.assign(y,(0,xe._)`${_}.errors`),()=>n.throw(_))),y}function h(){let y=(0,xe._)`${d}.errors`;return n.assign(y,null),m(xe.nil),y}function m(y=t.async?(0,xe._)`await `:xe.nil){let _=c.opts.passContext?Cr.default.this:Cr.default.self,b=!("compile"in t&&!s||t.schema===!1);n.assign(f,(0,xe._)`${y}${(0,Q0.callValidateCode)(e,d,_,b)}`,t.modifying)}function g(y){var _;n.if((0,xe.not)((_=t.valid)!==null&&_!==void 0?_:f),y)}}vt.funcKeywordCode=rb;function Lu(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,xe._)`${n.parentData}[${n.parentDataProperty}]`))}function nb(e,t){let{gen:r}=e;r.if((0,xe._)`Array.isArray(${t})`,()=>{r.assign(Cr.default.vErrors,(0,xe._)`${Cr.default.vErrors} === null ? ${t} : ${Cr.default.vErrors}.concat(${t})`).assign(Cr.default.errors,(0,xe._)`${Cr.default.vErrors}.length`),(0,eb.extendErrors)(e)},()=>e.error())}function ib({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function $u(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,xe.stringify)(r)})}function ab(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}vt.validSchemaType=ab;function ob({schema:e,opts:t,self:r,errSchemaPath:n},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${a}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[a])){let c=`keyword "${a}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}vt.validateKeywordUsage=ob});var Uu=w(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.extendSubschemaMode=or.extendSubschemaData=or.getSubschema=void 0;var Et=T(),Vu=M();function sb(e,{keyword:t,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:a,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,Et._)`${e.schemaPath}${(0,Et.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,Et._)`${e.schemaPath}${(0,Et.getProperty)(t)}${(0,Et.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Vu.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||a===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}or.getSubschema=sb;function cb(e,t,{dataProp:r,dataPropType:n,data:i,dataTypes:a,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:l,dataPathArr:d,opts:f}=t,p=s.let("data",(0,Et._)`${t.data}${(0,Et.getProperty)(r)}`,!0);c(p),e.errorPath=(0,Et.str)`${l}${(0,Vu.getErrorPath)(r,n,f.jsPropertySyntax)}`,e.parentDataProperty=(0,Et._)`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(i!==void 0){let l=i instanceof Et.Name?i:s.let("data",i,!0);c(l),o!==void 0&&(e.propertyName=o)}a&&(e.dataTypes=a);function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}or.extendSubschemaData=cb;function lb(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:a}){n!==void 0&&(e.compositeRule=n),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=r}or.extendSubschemaMode=lb});var Mc=w((L$,Fu)=>{"use strict";Fu.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,i,a;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(a=Object.keys(t),n=a.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=n;i--!==0;){var o=a[i];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r}});var Bu=w(($$,zu)=>{"use strict";var sr=zu.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};io(t,n,i,e,"",e)};sr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};sr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};sr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};sr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function io(e,t,r,n,i,a,o,s,c,l){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,i,a,o,s,c,l);for(var d in n){var f=n[d];if(Array.isArray(f)){if(d in sr.arrayKeywords)for(var p=0;p<f.length;p++)io(e,t,r,f[p],i+"/"+d+"/"+p,a,i,d,n,p)}else if(d in sr.propsKeywords){if(f&&typeof f=="object")for(var u in f)io(e,t,r,f[u],i+"/"+d+"/"+db(u),a,i,d,n,u)}else(d in sr.keywords||e.allKeys&&!(d in sr.skipKeywords))&&io(e,t,r,f,i+"/"+d,a,i,d,n)}r(n,i,a,o,s,c,l)}}function db(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ri=w(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.getSchemaRefs=Ue.resolveUrl=Ue.normalizeId=Ue._getFullPath=Ue.getFullPath=Ue.inlineRef=void 0;var fb=M(),pb=Mc(),ub=Bu(),hb=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function mb(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Vc(e):t?qu(e)<=t:!1}Ue.inlineRef=mb;var gb=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Vc(e){for(let t in e){if(gb.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Vc)||typeof r=="object"&&Vc(r))return!0}return!1}function qu(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!hb.has(r)&&(typeof e[r]=="object"&&(0,fb.eachItem)(e[r],n=>t+=qu(n)),t===1/0))return 1/0}return t}function Gu(e,t="",r){r!==!1&&(t=gn(t));let n=e.parse(t);return Ku(e,n)}Ue.getFullPath=Gu;function Ku(e,t){return e.serialize(t).split("#")[0]+"#"}Ue._getFullPath=Ku;var yb=/#\/?$/;function gn(e){return e?e.replace(yb,""):""}Ue.normalizeId=gn;function wb(e,t,r){return r=gn(r),e.resolve(t,r)}Ue.resolveUrl=wb;var _b=/^[a-z_][-a-z0-9._]*$/i;function Ib(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=gn(e[r]||t),a={"":i},o=Gu(n,i,!1),s={},c=new Set;return ub(e,{allKeys:!0},(f,p,u,h)=>{if(h===void 0)return;let m=o+p,g=a[h];typeof f[r]=="string"&&(g=y.call(this,f[r])),_.call(this,f.$anchor),_.call(this,f.$dynamicAnchor),a[p]=g;function y(b){let E=this.opts.uriResolver.resolve;if(b=gn(g?E(g,b):b),c.has(b))throw d(b);c.add(b);let I=this.refs[b];return typeof I=="string"&&(I=this.refs[I]),typeof I=="object"?l(f,I.schema,b):b!==gn(m)&&(b[0]==="#"?(l(f,s[b],b),s[b]=f):this.refs[b]=m),b}function _(b){if(typeof b=="string"){if(!_b.test(b))throw new Error(`invalid anchor "${b}"`);y.call(this,`#${b}`)}}}),s;function l(f,p,u){if(p!==void 0&&!pb(f,p))throw d(u)}function d(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Ue.getSchemaRefs=Ib});var Ni=w(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.getData=cr.KeywordCxt=cr.validateFunctionCode=void 0;var Zu=ku(),Wu=Ai(),Fc=Dc(),ao=Ai(),vb=xu(),Si=Mu(),Uc=Uu(),N=T(),D=Xe(),Eb=Ri(),Ut=M(),ki=bi();function bb(e){if(eh(e)&&(th(e),Qu(e))){kb(e);return}Xu(e,()=>(0,Zu.topBoolOrEmptySchema)(e))}cr.validateFunctionCode=bb;function Xu({gen:e,validateName:t,schema:r,schemaEnv:n,opts:i},a){i.code.es5?e.func(t,(0,N._)`${D.default.data}, ${D.default.valCxt}`,n.$async,()=>{e.code((0,N._)`"use strict"; ${Hu(r,i)}`),Rb(e,i),e.code(a)}):e.func(t,(0,N._)`${D.default.data}, ${Ab(i)}`,n.$async,()=>e.code(Hu(r,i)).code(a))}function Ab(e){return(0,N._)`{${D.default.instancePath}="", ${D.default.parentData}, ${D.default.parentDataProperty}, ${D.default.rootData}=${D.default.data}${e.dynamicRef?(0,N._)`, ${D.default.dynamicAnchors}={}`:N.nil}}={}`}function Rb(e,t){e.if(D.default.valCxt,()=>{e.var(D.default.instancePath,(0,N._)`${D.default.valCxt}.${D.default.instancePath}`),e.var(D.default.parentData,(0,N._)`${D.default.valCxt}.${D.default.parentData}`),e.var(D.default.parentDataProperty,(0,N._)`${D.default.valCxt}.${D.default.parentDataProperty}`),e.var(D.default.rootData,(0,N._)`${D.default.valCxt}.${D.default.rootData}`),t.dynamicRef&&e.var(D.default.dynamicAnchors,(0,N._)`${D.default.valCxt}.${D.default.dynamicAnchors}`)},()=>{e.var(D.default.instancePath,(0,N._)`""`),e.var(D.default.parentData,(0,N._)`undefined`),e.var(D.default.parentDataProperty,(0,N._)`undefined`),e.var(D.default.rootData,D.default.data),t.dynamicRef&&e.var(D.default.dynamicAnchors,(0,N._)`{}`)})}function kb(e){let{schema:t,opts:r,gen:n}=e;Xu(e,()=>{r.$comment&&t.$comment&&nh(e),Db(e),n.let(D.default.vErrors,null),n.let(D.default.errors,0),r.unevaluated&&Sb(e),rh(e),Tb(e)})}function Sb(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,N._)`${r}.evaluated`),t.if((0,N._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,N._)`${e.evaluated}.props`,(0,N._)`undefined`)),t.if((0,N._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,N._)`${e.evaluated}.items`,(0,N._)`undefined`))}function Hu(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,N._)`/*# sourceURL=${r} */`:N.nil}function Nb(e,t){if(eh(e)&&(th(e),Qu(e))){Pb(e,t);return}(0,Zu.boolOrEmptySchema)(e,t)}function Qu({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function eh(e){return typeof e.schema!="boolean"}function Pb(e,t){let{schema:r,gen:n,opts:i}=e;i.$comment&&r.$comment&&nh(e),Cb(e),xb(e);let a=n.const("_errs",D.default.errors);rh(e,a),n.var(t,(0,N._)`${a} === ${D.default.errors}`)}function th(e){(0,Ut.checkUnknownRules)(e),Ob(e)}function rh(e,t){if(e.opts.jtd)return Ju(e,[],!1,t);let r=(0,Wu.getSchemaTypes)(e.schema),n=(0,Wu.coerceAndCheckDataType)(e,r);Ju(e,r,!n,t)}function Ob(e){let{schema:t,errSchemaPath:r,opts:n,self:i}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Ut.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Db(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ut.checkStrictMode)(e,"default is ignored in the schema root")}function Cb(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Eb.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function xb(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function nh({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:i}){let a=r.$comment;if(i.$comment===!0)e.code((0,N._)`${D.default.self}.logger.log(${a})`);else if(typeof i.$comment=="function"){let o=(0,N.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,N._)`${D.default.self}.opts.$comment(${a}, ${o}, ${s}.schema)`)}}function Tb(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:i,opts:a}=e;r.$async?t.if((0,N._)`${D.default.errors} === 0`,()=>t.return(D.default.data),()=>t.throw((0,N._)`new ${i}(${D.default.vErrors})`)):(t.assign((0,N._)`${n}.errors`,D.default.vErrors),a.unevaluated&&jb(e),t.return((0,N._)`${D.default.errors} === 0`))}function jb({gen:e,evaluated:t,props:r,items:n}){r instanceof N.Name&&e.assign((0,N._)`${t}.props`,r),n instanceof N.Name&&e.assign((0,N._)`${t}.items`,n)}function Ju(e,t,r,n){let{gen:i,schema:a,data:o,allErrors:s,opts:c,self:l}=e,{RULES:d}=l;if(a.$ref&&(c.ignoreKeywordsWithRef||!(0,Ut.schemaHasRulesButRef)(a,d))){i.block(()=>ah(e,"$ref",d.all.$ref.definition));return}c.jtd||Lb(e,t),i.block(()=>{for(let p of d.rules)f(p);f(d.post)});function f(p){(0,Fc.shouldUseGroup)(a,p)&&(p.type?(i.if((0,ao.checkDataType)(p.type,o,c.strictNumbers)),Yu(e,p),t.length===1&&t[0]===p.type&&r&&(i.else(),(0,ao.reportTypeError)(e)),i.endIf()):Yu(e,p),s||i.if((0,N._)`${D.default.errors} === ${n||0}`))}}function Yu(e,t){let{gen:r,schema:n,opts:{useDefaults:i}}=e;i&&(0,vb.assignDefaults)(e,t.type),r.block(()=>{for(let a of t.rules)(0,Fc.shouldUseRule)(n,a)&&ah(e,a.keyword,a.definition,t.type)})}function Lb(e,t){e.schemaEnv.meta||!e.opts.strictTypes||($b(e,t),e.opts.allowUnionTypes||Mb(e,t),Vb(e,e.dataTypes))}function $b(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{ih(e.dataTypes,r)||zc(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Fb(e,t)}}function Mb(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&zc(e,"use allowUnionTypes to allow union type keyword")}function Vb(e,t){let r=e.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,Fc.shouldUseRule)(e.schema,i)){let{type:a}=i.definition;a.length&&!a.some(o=>Ub(t,o))&&zc(e,`missing type "${a.join(",")}" for keyword "${n}"`)}}}function Ub(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function ih(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Fb(e,t){let r=[];for(let n of e.dataTypes)ih(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function zc(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ut.checkStrictMode)(e,t,e.opts.strictTypes)}var oo=class{constructor(t,r,n){if((0,Si.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ut.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",oh(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Si.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",D.default.errors))}result(t,r,n){this.failResult((0,N.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,N.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,N._)`${r} !== undefined && (${(0,N.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?ki.reportExtraError:ki.reportError)(this,this.def.error,r)}$dataError(){(0,ki.reportError)(this,this.def.$dataError||ki.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ki.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=N.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=N.nil,r=N.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:a,def:o}=this;n.if((0,N.or)((0,N._)`${i} === undefined`,r)),t!==N.nil&&n.assign(t,!0),(a.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==N.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:i,it:a}=this;return(0,N.or)(o(),s());function o(){if(n.length){if(!(r instanceof N.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,N._)`${(0,ao.checkDataTypes)(c,r,a.opts.strictNumbers,ao.DataType.Wrong)}`}return N.nil}function s(){if(i.validateSchema){let c=t.scopeValue("validate$data",{ref:i.validateSchema});return(0,N._)`!${c}(${r})`}return N.nil}}subschema(t,r){let n=(0,Uc.getSubschema)(this.it,t);(0,Uc.extendSubschemaData)(n,this.it,t),(0,Uc.extendSubschemaMode)(n,t);let i={...this.it,...n,items:void 0,props:void 0};return Nb(i,r),i}mergeEvaluated(t,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Ut.mergeEvaluated.props(i,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Ut.mergeEvaluated.items(i,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(t,N.Name)),!0}};cr.KeywordCxt=oo;function ah(e,t,r,n){let i=new oo(e,r,t);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Si.funcKeywordCode)(i,r):"macro"in r?(0,Si.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Si.funcKeywordCode)(i,r)}var zb=/^\/(?:[^~]|~0|~1)*$/,Bb=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function oh(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let i,a;if(e==="")return D.default.rootData;if(e[0]==="/"){if(!zb.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,a=D.default.rootData}else{let l=Bb.exec(e);if(!l)throw new Error(`Invalid JSON-pointer: ${e}`);let d=+l[1];if(i=l[2],i==="#"){if(d>=t)throw new Error(c("property/index",d));return n[t-d]}if(d>t)throw new Error(c("data",d));if(a=r[t-d],!i)return a}let o=a,s=i.split("/");for(let l of s)l&&(a=(0,N._)`${a}${(0,N.getProperty)((0,Ut.unescapeJsonPointer)(l))}`,o=(0,N._)`${o} && ${a}`);return o;function c(l,d){return`Cannot access ${l} ${d} levels up, current level is ${t}`}}cr.getData=oh});var so=w(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});var Bc=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};qc.default=Bc});var Pi=w(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});var Gc=Ri(),Kc=class extends Error{constructor(t,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Gc.resolveUrl)(t,r,n),this.missingSchema=(0,Gc.normalizeId)((0,Gc.getFullPath)(t,this.missingRef))}};Wc.default=Kc});var Oi=w(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.resolveSchema=et.getCompilingSchema=et.resolveRef=et.compileSchema=et.SchemaEnv=void 0;var dt=T(),qb=so(),xr=Xe(),ft=Ri(),sh=M(),Gb=Ni(),yn=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,ft.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};et.SchemaEnv=yn;function Jc(e){let t=ch.call(this,e);if(t)return t;let r=(0,ft.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:a}=this.opts,o=new dt.CodeGen(this.scope,{es5:n,lines:i,ownProperties:a}),s;e.$async&&(s=o.scopeValue("Error",{ref:qb.default,code:(0,dt._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");e.validateName=c;let l={gen:o,allErrors:this.opts.allErrors,data:xr.default.data,parentData:xr.default.parentData,parentDataProperty:xr.default.parentDataProperty,dataNames:[xr.default.data],dataPathArr:[dt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,dt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:dt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,dt._)`""`,opts:this.opts,self:this},d;try{this._compilations.add(e),(0,Gb.validateFunctionCode)(l),o.optimize(this.opts.code.optimize);let f=o.toString();d=`${o.scopeRefs(xr.default.scope)}return ${f}`,this.opts.code.process&&(d=this.opts.code.process(d,e));let u=new Function(`${xr.default.self}`,`${xr.default.scope}`,d)(this,this.scope.get());if(this.scope.value(c,{ref:u}),u.errors=null,u.schema=e.schema,u.schemaEnv=e,e.$async&&(u.$async=!0),this.opts.code.source===!0&&(u.source={validateName:c,validateCode:f,scopeValues:o._values}),this.opts.unevaluated){let{props:h,items:m}=l;u.evaluated={props:h instanceof dt.Name?void 0:h,items:m instanceof dt.Name?void 0:m,dynamicProps:h instanceof dt.Name,dynamicItems:m instanceof dt.Name},u.source&&(u.source.evaluated=(0,dt.stringify)(u.evaluated))}return e.validate=u,e}catch(f){throw delete e.validate,delete e.validateName,d&&this.logger.error("Error compiling schema, function code:",d),f}finally{this._compilations.delete(e)}}et.compileSchema=Jc;function Kb(e,t,r){var n;r=(0,ft.resolveUrl)(this.opts.uriResolver,t,r);let i=e.refs[r];if(i)return i;let a=Jb.call(this,e,r);if(a===void 0){let o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;o&&(a=new yn({schema:o,schemaId:s,root:e,baseId:t}))}if(a!==void 0)return e.refs[r]=Wb.call(this,a)}et.resolveRef=Kb;function Wb(e){return(0,ft.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Jc.call(this,e)}function ch(e){for(let t of this._compilations)if(Hb(t,e))return t}et.getCompilingSchema=ch;function Hb(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Jb(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||co.call(this,e,t)}function co(e,t){let r=this.opts.uriResolver.parse(t),n=(0,ft._getFullPath)(this.opts.uriResolver,r),i=(0,ft.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===i)return Hc.call(this,r,e);let a=(0,ft.normalizeId)(n),o=this.refs[a]||this.schemas[a];if(typeof o=="string"){let s=co.call(this,e,o);return typeof s?.schema!="object"?void 0:Hc.call(this,r,s)}if(typeof o?.schema=="object"){if(o.validate||Jc.call(this,o),a===(0,ft.normalizeId)(t)){let{schema:s}=o,{schemaId:c}=this.opts,l=s[c];return l&&(i=(0,ft.resolveUrl)(this.opts.uriResolver,i,l)),new yn({schema:s,schemaId:c,root:e,baseId:i})}return Hc.call(this,r,o)}}et.resolveSchema=co;var Yb=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Hc(e,{baseId:t,schema:r,root:n}){var i;if(((i=e.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,sh.unescapeFragment)(s)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!Yb.has(s)&&l&&(t=(0,ft.resolveUrl)(this.opts.uriResolver,t,l))}let a;if(typeof r!="boolean"&&r.$ref&&!(0,sh.schemaHasRulesButRef)(r,this.RULES)){let s=(0,ft.resolveUrl)(this.opts.uriResolver,t,r.$ref);a=co.call(this,n,s)}let{schemaId:o}=this.opts;if(a=a||new yn({schema:r,schemaId:o,root:n,baseId:t}),a.schema!==a.root.schema)return a}});var lh=w((B$,Zb)=>{Zb.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Xc=w((q$,mh)=>{"use strict";var Xb=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),fh=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),Yc=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),ph=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Qb=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Zc(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var eA=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function dh(e){return e.length=0,!0}function tA(e,t,r){if(e.length){let n=Zc(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function rA(e){let t=0,r={error:!1,address:"",zone:""},n=[],i=[],a=!1,o=!1,s=tA;for(let c=0;c<e.length;c++){let l=e[c];if(!(l==="["||l==="]"))if(l===":"){if(a===!0&&(o=!0),!s(i,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(a=!0),n.push(":");continue}else if(l==="%"){if(!s(i,n,r))break;s=dh}else{i.push(l);continue}}return i.length&&(s===dh?r.zone=i.join(""):o?n.push(i.join("")):n.push(Zc(i))),r.address=n.join(""),r}function uh(e){if(nA(e,":")<2)return{host:e,isIPV6:!1};let t=rA(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function nA(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function iA(e){let t=e,r=[],n=-1,i=0;for(;i=t.length;){if(i===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(i===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(i===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var aA={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},oA=/[@/?#:]/g,sA=/[@/?#]/g;function hh(e,t){let r=t?sA:oA;return r.lastIndex=0,e.replace(r,n=>aA[n])}function cA(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(Yc(i)){let a=i.toUpperCase(),o=String.fromCharCode(parseInt(a,16));t&&ph(o)?r+=o:r+="%"+a,n+=2;continue}}r+=e[n]}return r}function lA(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Yc(n)){let i=n.toUpperCase(),a=String.fromCharCode(parseInt(i,16));a!=="."&&ph(a)?t+=a:t+="%"+i,r+=2;continue}}Qb(e[r])?t+=e[r]:t+=escape(e[r])}return t}function dA(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Yc(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function fA(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!fh(r)){let n=uh(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=hh(r,!1)}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}mh.exports={nonSimpleDomain:eA,recomposeAuthority:fA,reescapeHostDelimiters:hh,normalizePercentEncoding:cA,normalizePathEncoding:lA,escapePreservingEscapes:dA,removeDotSegments:iA,isIPv4:fh,isUUID:Xb,normalizeIPv6:uh,stringArrayToHexStripped:Zc}});var Ih=w((G$,_h)=>{"use strict";var{isUUID:pA}=Xc(),uA=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,hA=["http","https","ws","wss","urn","urn:uuid"];function mA(e){return hA.indexOf(e)!==-1}function Qc(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function gh(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function yh(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function gA(e){return e.secure=Qc(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function yA(e){if((e.port===(Qc(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function wA(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(uA);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=`${n}:${t.nid||e.nid}`,a=el(i);e.path=void 0,a&&(e=a.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function _A(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),i=`${r}:${t.nid||n}`,a=el(i);a&&(e=a.serialize(e,t));let o=e,s=e.nss;return o.path=`${n||t.nid}:${s}`,t.skipEscape=!0,o}function IA(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!pA(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function vA(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var wh={scheme:"http",domainHost:!0,parse:gh,serialize:yh},EA={scheme:"https",domainHost:wh.domainHost,parse:gh,serialize:yh},lo={scheme:"ws",domainHost:!0,parse:gA,serialize:yA},bA={scheme:"wss",domainHost:lo.domainHost,parse:lo.parse,serialize:lo.serialize},AA={scheme:"urn",parse:wA,serialize:_A,skipNormalize:!0},RA={scheme:"urn:uuid",parse:IA,serialize:vA,skipNormalize:!0},fo={http:wh,https:EA,ws:lo,wss:bA,urn:AA,"urn:uuid":RA};Object.setPrototypeOf(fo,null);function el(e){return e&&(fo[e]||fo[e.toLowerCase()])||void 0}_h.exports={wsIsSecure:Qc,SCHEMES:fo,isValidSchemeName:mA,getSchemeHandler:el}});var Rh=w((K$,ho)=>{"use strict";var{normalizeIPv6:kA,removeDotSegments:Di,recomposeAuthority:SA,normalizePercentEncoding:NA,normalizePathEncoding:PA,escapePreservingEscapes:OA,reescapeHostDelimiters:DA,isIPv4:CA,nonSimpleDomain:xA}=Xc(),{SCHEMES:TA,getSchemeHandler:Eh}=Ih();function jA(e,t){return typeof e=="string"?e=zA(e,t):typeof e=="object"&&(e=uo(Tr(e,t),t)),e}function LA(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:i,malformedAuthorityOrPort:a}=po(e,n),{parsed:o,malformedAuthorityOrPort:s}=po(t,n);if(a||s)throw new Error(i.error||o.error||"URI is malformed.");let c=bh(i,o,n,!0);return n.skipEscape=!0,Tr(c,n)}function bh(e,t,r,n){let i={};return n||(e=uo(Tr(e,r),r),t=uo(Tr(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=Di(t.path||""),i.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=Di(t.path||""),i.query=t.query):(t.path?(t.path[0]==="/"?i.path=Di(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?i.path="/"+t.path:e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path,i.path=Di(i.path)),i.query=t.query):(i.path=e.path,t.query!==void 0?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function $A(e,t,r){let n=vh(e,r),i=vh(t,r);return n!==void 0&&i!==void 0&&n.toLowerCase()===i.toLowerCase()}function Tr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),i=[],a=Eh(n.scheme||r.scheme);a&&a.serialize&&a.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=NA(r.path):(r.path=OA(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=SA(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!a||!a.absolutePath)&&(s=Di(s)),o===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),i.push(s)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var MA=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,VA=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,UA=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function FA(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function po(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,a=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let o=e.match(VA);o!==null&&o[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",i=!0);let s=e.match(UA);if(s!==null){let l=s[1],d=l.replace(/[\t\n\r]/g,"");d.length>=2&&(d.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",i=!0):l.length!==d.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",i=!0))}let c=e.match(MA);if(c){n.scheme=c[1],n.userinfo=c[3],n.host=c[4],n.port=parseInt(c[5],10),n.path=c[6]||"",n.query=c[7],n.fragment=c[8],isNaN(n.port)&&(n.port=c[5]);let l=FA(n,c);if(l!==void 0&&(n.error=n.error||l,i=!0),n.host)if(CA(n.host)===!1){let p=kA(n.host);n.host=p.host.toLowerCase(),a=p.isIPV6}else a=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let d=Eh(r.scheme||n.scheme);if(!r.unicodeSupport&&(!d||!d.unicodeSupport)&&n.host&&(r.domainHost||d&&d.domainHost)&&a===!1&&xA(n.host))try{n.host=new URL("http://"+n.host).hostname}catch(f){n.error=n.error||"Host's domain name can not be converted to ASCII: "+f}if((!d||d&&!d.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=DA(unescape(n.host),a))),n.path&&(n.path=PA(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}d&&d.parse&&d.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:i}}function uo(e,t){return po(e,t).parsed}function zA(e,t){return Ah(e,t).normalized}function Ah(e,t){let{parsed:r,malformedAuthorityOrPort:n}=po(e,t);return{normalized:n?e:Tr(r,t),malformedAuthorityOrPort:n}}function vh(e,t){if(typeof e=="string"){let{normalized:r,malformedAuthorityOrPort:n}=Ah(e,t);return n?void 0:r}if(typeof e=="object")return Tr(e,t)}var tl={SCHEMES:TA,normalize:jA,resolve:LA,resolveComponent:bh,equal:$A,serialize:Tr,parse:uo};ho.exports=tl;ho.exports.default=tl;ho.exports.fastUri=tl});var Sh=w(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});var kh=Rh();kh.code='require("ajv/dist/runtime/uri").default';rl.default=kh});var jh=w(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.CodeGen=ve.Name=ve.nil=ve.stringify=ve.str=ve._=ve.KeywordCxt=void 0;var BA=Ni();Object.defineProperty(ve,"KeywordCxt",{enumerable:!0,get:function(){return BA.KeywordCxt}});var wn=T();Object.defineProperty(ve,"_",{enumerable:!0,get:function(){return wn._}});Object.defineProperty(ve,"str",{enumerable:!0,get:function(){return wn.str}});Object.defineProperty(ve,"stringify",{enumerable:!0,get:function(){return wn.stringify}});Object.defineProperty(ve,"nil",{enumerable:!0,get:function(){return wn.nil}});Object.defineProperty(ve,"Name",{enumerable:!0,get:function(){return wn.Name}});Object.defineProperty(ve,"CodeGen",{enumerable:!0,get:function(){return wn.CodeGen}});var qA=so(),Ch=Pi(),GA=Oc(),Ci=Oi(),KA=T(),xi=Ri(),mo=Ai(),il=M(),Nh=lh(),WA=Sh(),xh=(e,t)=>new RegExp(e,t);xh.code="new RegExp";var HA=["removeAdditional","useDefaults","coerceTypes"],JA=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),YA={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},ZA={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Ph=200;function XA(e){var t,r,n,i,a,o,s,c,l,d,f,p,u,h,m,g,y,_,b,E,I,S,R,P,x;let B=e.strict,k=(t=e.code)===null||t===void 0?void 0:t.optimize,he=k===!0||k===void 0?1:k||0,Lt=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:xh,ln=(i=e.uriResolver)!==null&&i!==void 0?i:WA.default;return{strictSchema:(o=(a=e.strictSchema)!==null&&a!==void 0?a:B)!==null&&o!==void 0?o:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:B)!==null&&c!==void 0?c:!0,strictTypes:(d=(l=e.strictTypes)!==null&&l!==void 0?l:B)!==null&&d!==void 0?d:"log",strictTuples:(p=(f=e.strictTuples)!==null&&f!==void 0?f:B)!==null&&p!==void 0?p:"log",strictRequired:(h=(u=e.strictRequired)!==null&&u!==void 0?u:B)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:he,regExp:Lt}:{optimize:he,regExp:Lt},loopRequired:(m=e.loopRequired)!==null&&m!==void 0?m:Ph,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:Ph,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(_=e.messages)!==null&&_!==void 0?_:!0,inlineRefs:(b=e.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(I=e.addUsedSchema)!==null&&I!==void 0?I:!0,validateSchema:(S=e.validateSchema)!==null&&S!==void 0?S:!0,validateFormats:(R=e.validateFormats)!==null&&R!==void 0?R:!0,unicodeRegExp:(P=e.unicodeRegExp)!==null&&P!==void 0?P:!0,int32range:(x=e.int32range)!==null&&x!==void 0?x:!0,uriResolver:ln}}var Ti=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...XA(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new KA.ValueScope({scope:{},prefixes:JA,es5:r,lines:n}),this.logger=iR(t.logger);let i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,GA.getRules)(),Oh.call(this,YA,t,"NOT SUPPORTED"),Oh.call(this,ZA,t,"DEPRECATED","warn"),this._metaOpts=rR.call(this),t.formats&&eR.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&tR.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),QA.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,i=Nh;n==="id"&&(i={...Nh},i.id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,t,r);async function i(d,f){await a.call(this,d.$schema);let p=this._addSchema(d,f);return p.validate||o.call(this,p)}async function a(d){d&&!this.getSchema(d)&&await i.call(this,{$ref:d},!0)}async function o(d){try{return this._compileSchemaEnv(d)}catch(f){if(!(f instanceof Ch.default))throw f;return s.call(this,f),await c.call(this,f.missingSchema),o.call(this,d)}}function s({missingSchema:d,missingRef:f}){if(this.refs[d])throw new Error(`AnySchema ${d} is loaded but ${f} cannot be resolved`)}async function c(d){let f=await l.call(this,d);this.refs[d]||await a.call(this,f.$schema),this.refs[d]||this.addSchema(f,d,r)}async function l(d){let f=this._loading[d];if(f)return f;try{return await(this._loading[d]=n(d))}finally{delete this._loading[d]}}}addSchema(t,r,n,i=this.opts.validateSchema){if(Array.isArray(t)){for(let o of t)this.addSchema(o,void 0,n,i);return this}let a;if(typeof t=="object"){let{schemaId:o}=this.opts;if(a=t[o],a!==void 0&&typeof a!="string")throw new Error(`schema ${o} must be string`)}return r=(0,xi.normalizeId)(r||a),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,i,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,t);if(!i&&r){let a="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(a);else throw new Error(a)}return i}getSchema(t){let r;for(;typeof(r=Dh.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,i=new Ci.SchemaEnv({schema:{},schemaId:n});if(r=Ci.resolveSchema.call(this,i,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Dh.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,xi.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(oR.call(this,n,r),!r)return(0,il.eachItem)(n,a=>nl.call(this,a)),this;cR.call(this,r);let i={...r,type:(0,mo.getJSONTypes)(r.type),schemaType:(0,mo.getJSONTypes)(r.schemaType)};return(0,il.eachItem)(n,i.type.length===0?a=>nl.call(this,a,i):a=>i.type.forEach(o=>nl.call(this,a,i,o))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let i=n.rules.findIndex(a=>a.keyword===t);i>=0&&n.rules.splice(i,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,a)=>i+r+a)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let i of r){let a=i.split("/").slice(1),o=t;for(let s of a)o=o[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:l}=c.definition,d=o[s];l&&d&&(o[s]=Th(d))}}return t}_removeAllSchemas(t,r){for(let n in t){let i=t[n];(!r||r.test(n))&&(typeof i=="string"?delete t[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[n]))}}_addSchema(t,r,n,i=this.opts.validateSchema,a=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof t=="object")o=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,xi.normalizeId)(o||n);let l=xi.getSchemaRefs.call(this,t,n);return c=new Ci.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:l}),this._cache.set(c.schema,c),a&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Ci.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{Ci.compileSchema.call(this,t)}finally{this.opts=r}}};Ti.ValidationError=qA.default;Ti.MissingRefError=Ch.default;ve.default=Ti;function Oh(e,t,r,n="error"){for(let i in e){let a=i;a in t&&this.logger[n](`${r}: option ${i}. ${e[a]}`)}}function Dh(e){return e=(0,xi.normalizeId)(e),this.schemas[e]||this.refs[e]}function QA(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function eR(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function tR(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function rR(){let e={...this.opts};for(let t of HA)delete e[t];return e}var nR={log(){},warn(){},error(){}};function iR(e){if(e===!1)return nR;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var aR=/^[a-z_$][a-z0-9_$:-]*$/i;function oR(e,t){let{RULES:r}=this;if((0,il.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!aR.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function nl(e,t,r){var n;let i=t?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,o=i?a.post:a.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,mo.getJSONTypes)(t.type),schemaType:(0,mo.getJSONTypes)(t.schemaType)}};t.before?sR.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function sR(e,t,r){let n=e.rules.findIndex(i=>i.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function cR(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Th(t)),e.validateSchema=this.compile(t,!0))}var lR={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Th(e){return{anyOf:[e,lR]}}});var Lh=w(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});var dR={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};al.default=dR});var wo=w(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.callRef=jr.getValidate=void 0;var fR=Pi(),$h=Qe(),Fe=T(),_n=Xe(),Mh=Oi(),go=M(),pR={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:i,schemaEnv:a,validateName:o,opts:s,self:c}=n,{root:l}=a;if((r==="#"||r==="#/")&&i===l.baseId)return f();let d=Mh.resolveRef.call(c,l,i,r);if(d===void 0)throw new fR.default(n.opts.uriResolver,i,r);if(d instanceof Mh.SchemaEnv)return p(d);return u(d);function f(){if(a===l)return yo(e,o,a,a.$async);let h=t.scopeValue("root",{ref:l});return yo(e,(0,Fe._)`${h}.validate`,l,l.$async)}function p(h){let m=Vh(e,h);yo(e,m,h,h.$async)}function u(h){let m=t.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Fe.stringify)(h)}:{ref:h}),g=t.name("valid"),y=e.subschema({schema:h,dataTypes:[],schemaPath:Fe.nil,topSchemaRef:m,errSchemaPath:r},g);e.mergeEvaluated(y),e.ok(g)}}};function Vh(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Fe._)`${r.scopeValue("wrapper",{ref:t})}.validate`}jr.getValidate=Vh;function yo(e,t,r,n){let{gen:i,it:a}=e,{allErrors:o,schemaEnv:s,opts:c}=a,l=c.passContext?_n.default.this:Fe.nil;n?d():f();function d(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=i.let("valid");i.try(()=>{i.code((0,Fe._)`await ${(0,$h.callValidateCode)(e,t,l)}`),u(t),o||i.assign(h,!0)},m=>{i.if((0,Fe._)`!(${m} instanceof ${a.ValidationError})`,()=>i.throw(m)),p(m),o||i.assign(h,!1)}),e.ok(h)}function f(){e.result((0,$h.callValidateCode)(e,t,l),()=>u(t),()=>p(t))}function p(h){let m=(0,Fe._)`${h}.errors`;i.assign(_n.default.vErrors,(0,Fe._)`${_n.default.vErrors} === null ? ${m} : ${_n.default.vErrors}.concat(${m})`),i.assign(_n.default.errors,(0,Fe._)`${_n.default.vErrors}.length`)}function u(h){var m;if(!a.opts.unevaluated)return;let g=(m=r?.validate)===null||m===void 0?void 0:m.evaluated;if(a.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(a.props=go.mergeEvaluated.props(i,g.props,a.props));else{let y=i.var("props",(0,Fe._)`${h}.evaluated.props`);a.props=go.mergeEvaluated.props(i,y,a.props,Fe.Name)}if(a.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(a.items=go.mergeEvaluated.items(i,g.items,a.items));else{let y=i.var("items",(0,Fe._)`${h}.evaluated.items`);a.items=go.mergeEvaluated.items(i,y,a.items,Fe.Name)}}}jr.callRef=yo;jr.default=pR});var Uh=w(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});var uR=Lh(),hR=wo(),mR=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",uR.default,hR.default];ol.default=mR});var Fh=w(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});var _o=T(),lr=_o.operators,Io={maximum:{okStr:"<=",ok:lr.LTE,fail:lr.GT},minimum:{okStr:">=",ok:lr.GTE,fail:lr.LT},exclusiveMaximum:{okStr:"<",ok:lr.LT,fail:lr.GTE},exclusiveMinimum:{okStr:">",ok:lr.GT,fail:lr.LTE}},gR={message:({keyword:e,schemaCode:t})=>(0,_o.str)`must be ${Io[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,_o._)`{comparison: ${Io[e].okStr}, limit: ${t}}`},yR={keyword:Object.keys(Io),type:"number",schemaType:"number",$data:!0,error:gR,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,_o._)`${r} ${Io[t].fail} ${n} || isNaN(${r})`)}};sl.default=yR});var zh=w(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});var ji=T(),wR={message:({schemaCode:e})=>(0,ji.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ji._)`{multipleOf: ${e}}`},_R={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:wR,code(e){let{gen:t,data:r,schemaCode:n,it:i}=e,a=i.opts.multipleOfPrecision,o=t.let("res"),s=a?(0,ji._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${a}`:(0,ji._)`${o} !== parseInt(${o})`;e.fail$data((0,ji._)`(${n} === 0 || (${o} = ${r}/${n}, ${s}))`)}};cl.default=_R});var qh=w(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});function Bh(e){let t=e.length,r=0,n=0,i;for(;n<t;)r++,i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<t&&(i=e.charCodeAt(n),(i&64512)===56320&&n++);return r}ll.default=Bh;Bh.code='require("ajv/dist/runtime/ucs2length").default'});var Gh=w(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});var Lr=T(),IR=M(),vR=qh(),ER={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Lr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Lr._)`{limit: ${e}}`},bR={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:ER,code(e){let{keyword:t,data:r,schemaCode:n,it:i}=e,a=t==="maxLength"?Lr.operators.GT:Lr.operators.LT,o=i.opts.unicode===!1?(0,Lr._)`${r}.length`:(0,Lr._)`${(0,IR.useFunc)(e.gen,vR.default)}(${r})`;e.fail$data((0,Lr._)`${o} ${a} ${n}`)}};dl.default=bR});var Kh=w(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});var AR=Qe(),RR=M(),In=T(),kR={message:({schemaCode:e})=>(0,In.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,In._)`{pattern: ${e}}`},SR={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:kR,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:a,it:o}=e,s=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=o.opts.code,l=c.code==="new RegExp"?(0,In._)`new RegExp`:(0,RR.useFunc)(t,c),d=t.let("valid");t.try(()=>t.assign(d,(0,In._)`${l}(${a}, ${s}).test(${r})`),()=>t.assign(d,!1)),e.fail$data((0,In._)`!${d}`)}else{let c=(0,AR.usePattern)(e,i);e.fail$data((0,In._)`!${c}.test(${r})`)}}};fl.default=SR});var Wh=w(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});var Li=T(),NR={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,Li.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Li._)`{limit: ${e}}`},PR={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:NR,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxProperties"?Li.operators.GT:Li.operators.LT;e.fail$data((0,Li._)`Object.keys(${r}).length ${i} ${n}`)}};pl.default=PR});var Hh=w(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});var $i=Qe(),Mi=T(),OR=M(),DR={message:({params:{missingProperty:e}})=>(0,Mi.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Mi._)`{missingProperty: ${e}}`},CR={keyword:"required",type:"object",schemaType:"array",$data:!0,error:DR,code(e){let{gen:t,schema:r,schemaCode:n,data:i,$data:a,it:o}=e,{opts:s}=o;if(!a&&r.length===0)return;let c=r.length>=s.loopRequired;if(o.allErrors?l():d(),s.strictRequired){let u=e.parentSchema.properties,{definedProperties:h}=e.it;for(let m of r)if(u?.[m]===void 0&&!h.has(m)){let g=o.schemaEnv.baseId+o.errSchemaPath,y=`required property "${m}" is not defined at "${g}" (strictRequired)`;(0,OR.checkStrictMode)(o,y,o.opts.strictRequired)}}function l(){if(c||a)e.block$data(Mi.nil,f);else for(let u of r)(0,$i.checkReportMissingProp)(e,u)}function d(){let u=t.let("missing");if(c||a){let h=t.let("valid",!0);e.block$data(h,()=>p(u,h)),e.ok(h)}else t.if((0,$i.checkMissingProp)(e,r,u)),(0,$i.reportMissingProp)(e,u),t.else()}function f(){t.forOf("prop",n,u=>{e.setParams({missingProperty:u}),t.if((0,$i.noPropertyInData)(t,i,u,s.ownProperties),()=>e.error())})}function p(u,h){e.setParams({missingProperty:u}),t.forOf(u,n,()=>{t.assign(h,(0,$i.propertyInData)(t,i,u,s.ownProperties)),t.if((0,Mi.not)(h),()=>{e.error(),t.break()})},Mi.nil)}}};ul.default=CR});var Jh=w(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});var Vi=T(),xR={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Vi.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Vi._)`{limit: ${e}}`},TR={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:xR,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxItems"?Vi.operators.GT:Vi.operators.LT;e.fail$data((0,Vi._)`${r}.length ${i} ${n}`)}};hl.default=TR});var vo=w(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});var Yh=Mc();Yh.code='require("ajv/dist/runtime/equal").default';ml.default=Yh});var Zh=w(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});var gl=Ai(),Ee=T(),jR=M(),LR=vo(),$R={message:({params:{i:e,j:t}})=>(0,Ee.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Ee._)`{i: ${e}, j: ${t}}`},MR={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:$R,code(e){let{gen:t,data:r,$data:n,schema:i,parentSchema:a,schemaCode:o,it:s}=e;if(!n&&!i)return;let c=t.let("valid"),l=a.items?(0,gl.getSchemaTypes)(a.items):[];e.block$data(c,d,(0,Ee._)`${o} === false`),e.ok(c);function d(){let h=t.let("i",(0,Ee._)`${r}.length`),m=t.let("j");e.setParams({i:h,j:m}),t.assign(c,!0),t.if((0,Ee._)`${h} > 1`,()=>(f()?p:u)(h,m))}function f(){return l.length>0&&!l.some(h=>h==="object"||h==="array")}function p(h,m){let g=t.name("item"),y=(0,gl.checkDataTypes)(l,g,s.opts.strictNumbers,gl.DataType.Wrong),_=t.const("indices",(0,Ee._)`{}`);t.for((0,Ee._)`;${h}--;`,()=>{t.let(g,(0,Ee._)`${r}[${h}]`),t.if(y,(0,Ee._)`continue`),l.length>1&&t.if((0,Ee._)`typeof ${g} == "string"`,(0,Ee._)`${g} += "_"`),t.if((0,Ee._)`typeof ${_}[${g}] == "number"`,()=>{t.assign(m,(0,Ee._)`${_}[${g}]`),e.error(),t.assign(c,!1).break()}).code((0,Ee._)`${_}[${g}] = ${h}`)})}function u(h,m){let g=(0,jR.useFunc)(t,LR.default),y=t.name("outer");t.label(y).for((0,Ee._)`;${h}--;`,()=>t.for((0,Ee._)`${m} = ${h}; ${m}--;`,()=>t.if((0,Ee._)`${g}(${r}[${h}], ${r}[${m}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};yl.default=MR});var Xh=w(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});var wl=T(),VR=M(),UR=vo(),FR={message:"must be equal to constant",params:({schemaCode:e})=>(0,wl._)`{allowedValue: ${e}}`},zR={keyword:"const",$data:!0,error:FR,code(e){let{gen:t,data:r,$data:n,schemaCode:i,schema:a}=e;n||a&&typeof a=="object"?e.fail$data((0,wl._)`!${(0,VR.useFunc)(t,UR.default)}(${r}, ${i})`):e.fail((0,wl._)`${a} !== ${r}`)}};_l.default=zR});var Qh=w(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});var Ui=T(),BR=M(),qR=vo(),GR={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Ui._)`{allowedValues: ${e}}`},KR={keyword:"enum",schemaType:"array",$data:!0,error:GR,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:a,it:o}=e;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let s=i.length>=o.opts.loopEnum,c,l=()=>c??(c=(0,BR.useFunc)(t,qR.default)),d;if(s||n)d=t.let("valid"),e.block$data(d,f);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let u=t.const("vSchema",a);d=(0,Ui.or)(...i.map((h,m)=>p(u,m)))}e.pass(d);function f(){t.assign(d,!1),t.forOf("v",a,u=>t.if((0,Ui._)`${l()}(${r}, ${u})`,()=>t.assign(d,!0).break()))}function p(u,h){let m=i[h];return typeof m=="object"&&m!==null?(0,Ui._)`${l()}(${r}, ${u}[${h}])`:(0,Ui._)`${r} === ${m}`}}};Il.default=KR});var em=w(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});var WR=Fh(),HR=zh(),JR=Gh(),YR=Kh(),ZR=Wh(),XR=Hh(),QR=Jh(),ek=Zh(),tk=Xh(),rk=Qh(),nk=[WR.default,HR.default,JR.default,YR.default,ZR.default,XR.default,QR.default,ek.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},tk.default,rk.default];vl.default=nk});var bl=w(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.validateAdditionalItems=void 0;var $r=T(),El=M(),ik={message:({params:{len:e}})=>(0,$r.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,$r._)`{limit: ${e}}`},ak={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:ik,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,El.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}tm(e,n)}};function tm(e,t){let{gen:r,schema:n,data:i,keyword:a,it:o}=e;o.items=!0;let s=r.const("len",(0,$r._)`${i}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,$r._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,El.alwaysValidSchema)(o,n)){let l=r.var("valid",(0,$r._)`${s} <= ${t.length}`);r.if((0,$r.not)(l),()=>c(l)),e.ok(l)}function c(l){r.forRange("i",t.length,s,d=>{e.subschema({keyword:a,dataProp:d,dataPropType:El.Type.Num},l),o.allErrors||r.if((0,$r.not)(l),()=>r.break())})}}Fi.validateAdditionalItems=tm;Fi.default=ak});var Al=w(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.validateTuple=void 0;var rm=T(),Eo=M(),ok=Qe(),sk={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return nm(e,"additionalItems",t);r.items=!0,!(0,Eo.alwaysValidSchema)(r,t)&&e.ok((0,ok.validateArray)(e))}};function nm(e,t,r=e.schema){let{gen:n,parentSchema:i,data:a,keyword:o,it:s}=e;d(i),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=Eo.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),l=n.const("len",(0,rm._)`${a}.length`);r.forEach((f,p)=>{(0,Eo.alwaysValidSchema)(s,f)||(n.if((0,rm._)`${l} > ${p}`,()=>e.subschema({keyword:o,schemaProp:p,dataProp:p},c)),e.ok(c))});function d(f){let{opts:p,errSchemaPath:u}=s,h=r.length,m=h===f.minItems&&(h===f.maxItems||f[t]===!1);if(p.strictTuples&&!m){let g=`"${o}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${u}"`;(0,Eo.checkStrictMode)(s,g,p.strictTuples)}}}zi.validateTuple=nm;zi.default=sk});var im=w(Rl=>{"use strict";Object.defineProperty(Rl,"__esModule",{value:!0});var ck=Al(),lk={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,ck.validateTuple)(e,"items")};Rl.default=lk});var om=w(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});var am=T(),dk=M(),fk=Qe(),pk=bl(),uk={message:({params:{len:e}})=>(0,am.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,am._)`{limit: ${e}}`},hk={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:uk,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:i}=r;n.items=!0,!(0,dk.alwaysValidSchema)(n,t)&&(i?(0,pk.validateAdditionalItems)(e,i):e.ok((0,fk.validateArray)(e)))}};kl.default=hk});var sm=w(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});var tt=T(),bo=M(),mk={message:({params:{min:e,max:t}})=>t===void 0?(0,tt.str)`must contain at least ${e} valid item(s)`:(0,tt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,tt._)`{minContains: ${e}}`:(0,tt._)`{minContains: ${e}, maxContains: ${t}}`},gk={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:mk,code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:a}=e,o,s,{minContains:c,maxContains:l}=n;a.opts.next?(o=c===void 0?1:c,s=l):o=1;let d=t.const("len",(0,tt._)`${i}.length`);if(e.setParams({min:o,max:s}),s===void 0&&o===0){(0,bo.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&o>s){(0,bo.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,bo.alwaysValidSchema)(a,r)){let m=(0,tt._)`${d} >= ${o}`;s!==void 0&&(m=(0,tt._)`${m} && ${d} <= ${s}`),e.pass(m);return}a.items=!0;let f=t.name("valid");s===void 0&&o===1?u(f,()=>t.if(f,()=>t.break())):o===0?(t.let(f,!0),s!==void 0&&t.if((0,tt._)`${i}.length > 0`,p)):(t.let(f,!1),p()),e.result(f,()=>e.reset());function p(){let m=t.name("_valid"),g=t.let("count",0);u(m,()=>t.if(m,()=>h(g)))}function u(m,g){t.forRange("i",0,d,y=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:bo.Type.Num,compositeRule:!0},m),g()})}function h(m){t.code((0,tt._)`${m}++`),s===void 0?t.if((0,tt._)`${m} >= ${o}`,()=>t.assign(f,!0).break()):(t.if((0,tt._)`${m} > ${s}`,()=>t.assign(f,!1).break()),o===1?t.assign(f,!0):t.if((0,tt._)`${m} >= ${o}`,()=>t.assign(f,!0)))}}};Sl.default=gk});var Ao=w(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.validateSchemaDeps=bt.validatePropertyDeps=bt.error=void 0;var Nl=T(),yk=M(),Bi=Qe();bt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Nl.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Nl._)`{property: ${e},
|
|
6
6
|
missingProperty: ${n},
|
|
7
7
|
depsCount: ${t},
|
|
8
|
-
deps: ${r}}`};var wk={keyword:"dependencies",type:"object",schemaType:"object",error:bt.error,code(e){let[t,r]=_k(e);cm(e,t),dm(e,r)}};function _k({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let i=Array.isArray(e[n])?t:r;i[n]=e[n]}return[t,r]}function cm(e,t=e.schema){let{gen:r,data:n,it:i}=e;if(Object.keys(t).length===0)return;let a=r.let("missing");for(let o in t){let s=t[o];if(s.length===0)continue;let c=(0,Bi.propertyInData)(r,n,o,i.opts.ownProperties);e.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(c,()=>{for(let d of s)(0,Bi.checkReportMissingProp)(e,d)}):(r.if((0,Nd._)`${c} && (${(0,Bi.checkMissingProp)(e,s,a)})`),(0,Bi.reportMissingProp)(e,a),r.else())}}bt.validatePropertyDeps=cm;function dm(e,t=e.schema){let{gen:r,data:n,keyword:i,it:a}=e,o=r.name("valid");for(let s in t)(0,yk.alwaysValidSchema)(a,t[s])||(r.if((0,Bi.propertyInData)(r,n,s,a.opts.ownProperties),()=>{let c=e.subschema({keyword:i,schemaProp:s},o);e.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),e.ok(o))}bt.validateSchemaDeps=dm;bt.default=wk});var fm=w(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});var lm=T(),Ik=M(),vk={message:"property name must be valid",params:({params:e})=>(0,lm._)`{propertyName: ${e.propertyName}}`},Ek={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:vk,code(e){let{gen:t,schema:r,data:n,it:i}=e;if((0,Ik.alwaysValidSchema)(i,r))return;let a=t.name("valid");t.forIn("key",n,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},a),t.if((0,lm.not)(a),()=>{e.error(!0),i.allErrors||t.break()})}),e.ok(a)}};Pd.default=Ek});var Dd=w(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});var Ro=Qe(),pt=T(),bk=Xe(),ko=M(),Ak={message:"must NOT have additional properties",params:({params:e})=>(0,pt._)`{additionalProperty: ${e.additionalProperty}}`},Rk={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Ak,code(e){let{gen:t,schema:r,parentSchema:n,data:i,errsCount:a,it:o}=e;if(!a)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,ko.alwaysValidSchema)(o,r))return;let d=(0,Ro.allSchemaProperties)(n.properties),l=(0,Ro.allSchemaProperties)(n.patternProperties);f(),e.ok((0,pt._)`${a} === ${bk.default.errors}`);function f(){t.forIn("key",i,g=>{!d.length&&!l.length?h(g):t.if(p(g),()=>h(g))})}function p(g){let y;if(d.length>8){let _=(0,ko.schemaRefOrVal)(o,n.properties,"properties");y=(0,Ro.isOwnProperty)(t,_,g)}else d.length?y=(0,pt.or)(...d.map(_=>(0,pt._)`${g} === ${_}`)):y=pt.nil;return l.length&&(y=(0,pt.or)(y,...l.map(_=>(0,pt._)`${(0,Ro.usePattern)(e,_)}.test(${g})`))),(0,pt.not)(y)}function u(g){t.code((0,pt._)`delete ${i}[${g}]`)}function h(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){u(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,ko.alwaysValidSchema)(o,r)){let y=t.name("valid");c.removeAdditional==="failing"?(m(g,y,!1),t.if((0,pt.not)(y),()=>{e.reset(),u(g)})):(m(g,y),s||t.if((0,pt.not)(y),()=>t.break()))}}function m(g,y,_){let b={keyword:"additionalProperties",dataProp:g,dataPropType:ko.Type.Str};_===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(b,y)}}};Od.default=Rk});var hm=w(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});var kk=Ni(),pm=Qe(),Cd=M(),um=Dd(),Sk={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:a}=e;a.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&um.default.code(new kk.KeywordCxt(a,um.default,"additionalProperties"));let o=(0,pm.allSchemaProperties)(r);for(let f of o)a.definedProperties.add(f);a.opts.unevaluated&&o.length&&a.props!==!0&&(a.props=Cd.mergeEvaluated.props(t,(0,Cd.toHash)(o),a.props));let s=o.filter(f=>!(0,Cd.alwaysValidSchema)(a,r[f]));if(s.length===0)return;let c=t.name("valid");for(let f of s)d(f)?l(f):(t.if((0,pm.propertyInData)(t,i,f,a.opts.ownProperties)),l(f),a.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(c);function d(f){return a.opts.useDefaults&&!a.compositeRule&&r[f].default!==void 0}function l(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};xd.default=Sk});var wm=w(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});var mm=Qe(),So=T(),gm=M(),ym=M(),Nk={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:i,it:a}=e,{opts:o}=a,s=(0,mm.allSchemaProperties)(r),c=s.filter(m=>(0,gm.alwaysValidSchema)(a,r[m]));if(s.length===0||c.length===s.length&&(!a.opts.unevaluated||a.props===!0))return;let d=o.strictSchema&&!o.allowMatchingProperties&&i.properties,l=t.name("valid");a.props!==!0&&!(a.props instanceof So.Name)&&(a.props=(0,ym.evaluatedPropsToName)(t,a.props));let{props:f}=a;p();function p(){for(let m of s)d&&u(m),a.allErrors?h(m):(t.var(l,!0),h(m),t.if(l))}function u(m){for(let g in d)new RegExp(m).test(g)&&(0,gm.checkStrictMode)(a,`property ${g} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){t.forIn("key",n,g=>{t.if((0,So._)`${(0,mm.usePattern)(e,m)}.test(${g})`,()=>{let y=c.includes(m);y||e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:g,dataPropType:ym.Type.Str},l),a.opts.unevaluated&&f!==!0?t.assign((0,So._)`${f}[${g}]`,!0):!y&&!a.allErrors&&t.if((0,So.not)(l),()=>t.break())})})}}};Td.default=Nk});var _m=w(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});var Pk=M(),Ok={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,Pk.alwaysValidSchema)(n,r)){e.fail();return}let i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};jd.default=Ok});var Im=w(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});var Dk=Qe(),Ck={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Dk.validateUnion,error:{message:"must match a schema in anyOf"}};Ld.default=Ck});var vm=w($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});var No=T(),xk=M(),Tk={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,No._)`{passingSchemas: ${e.passing}}`},jk={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Tk,code(e){let{gen:t,schema:r,parentSchema:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let a=r,o=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(d),e.result(o,()=>e.reset(),()=>e.error(!0));function d(){a.forEach((l,f)=>{let p;(0,xk.alwaysValidSchema)(i,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&t.if((0,No._)`${c} && ${o}`).assign(o,!1).assign(s,(0,No._)`[${s}, ${f}]`).else(),t.if(c,()=>{t.assign(o,!0),t.assign(s,f),p&&e.mergeEvaluated(p,No.Name)})})}}};$d.default=jk});var Em=w(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});var Lk=M(),$k={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=t.name("valid");r.forEach((a,o)=>{if((0,Lk.alwaysValidSchema)(n,a))return;let s=e.subschema({keyword:"allOf",schemaProp:o},i);e.ok(i),e.mergeEvaluated(s)})}};Md.default=$k});var Rm=w(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});var Po=T(),Am=M(),Mk={message:({params:e})=>(0,Po.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Po._)`{failingKeyword: ${e.ifClause}}`},Vk={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Mk,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Am.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=bm(n,"then"),a=bm(n,"else");if(!i&&!a)return;let o=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),i&&a){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,d("then",l),d("else",l))}else i?t.if(s,d("then")):t.if((0,Po.not)(s),d("else"));e.pass(o,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function d(l,f){return()=>{let p=e.subschema({keyword:l},s);t.assign(o,s),e.mergeValidEvaluated(p,o),f?t.assign(f,(0,Po._)`${l}`):e.setParams({ifClause:l})}}}};function bm(e,t){let r=e.schema[t];return r!==void 0&&!(0,Am.alwaysValidSchema)(e,r)}Vd.default=Vk});var km=w(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});var Uk=M(),Fk={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Uk.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Ud.default=Fk});var Sm=w(Fd=>{"use strict";Object.defineProperty(Fd,"__esModule",{value:!0});var zk=bd(),Bk=im(),qk=Ad(),Gk=om(),Kk=sm(),Wk=Ao(),Hk=fm(),Jk=Dd(),Yk=hm(),Zk=wm(),Xk=_m(),Qk=Im(),eS=vm(),tS=Em(),rS=Rm(),nS=km();function iS(e=!1){let t=[Xk.default,Qk.default,eS.default,tS.default,rS.default,nS.default,Hk.default,Jk.default,Wk.default,Yk.default,Zk.default];return e?t.push(Bk.default,Gk.default):t.push(zk.default,qk.default),t.push(Kk.default),t}Fd.default=iS});var Bd=w(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.dynamicAnchor=void 0;var zd=T(),aS=Xe(),Nm=Oi(),oS=wo(),sS={keyword:"$dynamicAnchor",schemaType:"string",code:e=>Pm(e,e.schema)};function Pm(e,t){let{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;let i=(0,zd._)`${aS.default.dynamicAnchors}${(0,zd.getProperty)(t)}`,a=n.errSchemaPath==="#"?n.validateName:cS(e);r.if((0,zd._)`!${i}`,()=>r.assign(i,a))}qi.dynamicAnchor=Pm;function cS(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:i,baseId:a,localRefs:o,meta:s}=t.root,{schemaId:c}=n.opts,d=new Nm.SchemaEnv({schema:r,schemaId:c,root:i,baseId:a,localRefs:o,meta:s});return Nm.compileSchema.call(n,d),(0,oS.getValidate)(e,d)}qi.default=sS});var qd=w(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.dynamicRef=void 0;var Om=T(),dS=Xe(),Dm=wo(),lS={keyword:"$dynamicRef",schemaType:"string",code:e=>Cm(e,e.schema)};function Cm(e,t){let{gen:r,keyword:n,it:i}=e;if(t[0]!=="#")throw new Error(`"${n}" only supports hash fragment reference`);let a=t.slice(1);if(i.allErrors)o();else{let c=r.let("valid",!1);o(c),e.ok(c)}function o(c){if(i.schemaEnv.root.dynamicAnchors[a]){let d=r.let("_v",(0,Om._)`${dS.default.dynamicAnchors}${(0,Om.getProperty)(a)}`);r.if(d,s(d,c),s(i.validateName,c))}else s(i.validateName,c)()}function s(c,d){return d?()=>r.block(()=>{(0,Dm.callRef)(e,c),r.let(d,!0)}):()=>(0,Dm.callRef)(e,c)}}Gi.dynamicRef=Cm;Gi.default=lS});var xm=w(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});var fS=Bd(),pS=M(),uS={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,fS.dynamicAnchor)(e,""):(0,pS.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};Gd.default=uS});var Tm=w(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});var hS=qd(),mS={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,hS.dynamicRef)(e,e.schema)};Kd.default=mS});var jm=w(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});var gS=Bd(),yS=qd(),wS=xm(),_S=Tm(),IS=[gS.default,yS.default,wS.default,_S.default];Wd.default=IS});var $m=w(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});var Lm=Ao(),vS={keyword:"dependentRequired",type:"object",schemaType:"object",error:Lm.error,code:e=>(0,Lm.validatePropertyDeps)(e)};Hd.default=vS});var Mm=w(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});var ES=Ao(),bS={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,ES.validateSchemaDeps)(e)};Jd.default=bS});var Vm=w(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});var AS=M(),RS={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){t.contains===void 0&&(0,AS.checkStrictMode)(r,`"${e}" without "contains" is ignored`)}};Yd.default=RS});var Um=w(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});var kS=$m(),SS=Mm(),NS=Vm(),PS=[kS.default,SS.default,NS.default];Zd.default=PS});var zm=w(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});var lr=T(),Fm=M(),OS=Xe(),DS={message:"must NOT have unevaluated properties",params:({params:e})=>(0,lr._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},CS={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:DS,code(e){let{gen:t,schema:r,data:n,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:o,props:s}=a;s instanceof lr.Name?t.if((0,lr._)`${s} !== true`,()=>t.forIn("key",n,f=>t.if(d(s,f),()=>c(f)))):s!==!0&&t.forIn("key",n,f=>s===void 0?c(f):t.if(l(s,f),()=>c(f))),a.props=!0,e.ok((0,lr._)`${i} === ${OS.default.errors}`);function c(f){if(r===!1){e.setParams({unevaluatedProperty:f}),e.error(),o||t.break();return}if(!(0,Fm.alwaysValidSchema)(a,r)){let p=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:f,dataPropType:Fm.Type.Str},p),o||t.if((0,lr.not)(p),()=>t.break())}}function d(f,p){return(0,lr._)`!${f} || !${f}[${p}]`}function l(f,p){let u=[];for(let h in f)f[h]===!0&&u.push((0,lr._)`${p} !== ${h}`);return(0,lr.and)(...u)}}};Xd.default=CS});var qm=w(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});var Mr=T(),Bm=M(),xS={message:({params:{len:e}})=>(0,Mr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Mr._)`{limit: ${e}}`},TS={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:xS,code(e){let{gen:t,schema:r,data:n,it:i}=e,a=i.items||0;if(a===!0)return;let o=t.const("len",(0,Mr._)`${n}.length`);if(r===!1)e.setParams({len:a}),e.fail((0,Mr._)`${o} > ${a}`);else if(typeof r=="object"&&!(0,Bm.alwaysValidSchema)(i,r)){let c=t.var("valid",(0,Mr._)`${o} <= ${a}`);t.if((0,Mr.not)(c),()=>s(c,a)),e.ok(c)}i.items=!0;function s(c,d){t.forRange("i",d,o,l=>{e.subschema({keyword:"unevaluatedItems",dataProp:l,dataPropType:Bm.Type.Num},c),i.allErrors||t.if((0,Mr.not)(c),()=>t.break())})}}};Qd.default=TS});var Gm=w(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});var jS=zm(),LS=qm(),$S=[jS.default,LS.default];el.default=$S});var Km=w(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});var pe=T(),MS={message:({schemaCode:e})=>(0,pe.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,pe._)`{format: ${e}}`},VS={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:MS,code(e,t){let{gen:r,data:n,$data:i,schema:a,schemaCode:o,it:s}=e,{opts:c,errSchemaPath:d,schemaEnv:l,self:f}=s;if(!c.validateFormats)return;i?p():u();function p(){let h=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),m=r.const("fDef",(0,pe._)`${h}[${o}]`),g=r.let("fType"),y=r.let("format");r.if((0,pe._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(g,(0,pe._)`${m}.type || "string"`).assign(y,(0,pe._)`${m}.validate`),()=>r.assign(g,(0,pe._)`"string"`).assign(y,m)),e.fail$data((0,pe.or)(_(),b()));function _(){return c.strictSchema===!1?pe.nil:(0,pe._)`${o} && !${y}`}function b(){let E=l.$async?(0,pe._)`(${m}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,pe._)`${y}(${n})`,I=(0,pe._)`(typeof ${y} == "function" ? ${E} : ${y}.test(${n}))`;return(0,pe._)`${y} && ${y} !== true && ${g} === ${t} && !${I}`}}function u(){let h=f.formats[a];if(!h){_();return}if(h===!0)return;let[m,g,y]=b(h);m===t&&e.pass(E());function _(){if(c.strictSchema===!1){f.logger.warn(I());return}throw new Error(I());function I(){return`unknown format "${a}" ignored in schema at path "${d}"`}}function b(I){let S=I instanceof RegExp?(0,pe.regexpCode)(I):c.code.formats?(0,pe._)`${c.code.formats}${(0,pe.getProperty)(a)}`:void 0,R=r.scopeValue("formats",{key:a,ref:I,code:S});return typeof I=="object"&&!(I instanceof RegExp)?[I.type||"string",I.validate,(0,pe._)`${R}.validate`]:["string",I,R]}function E(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,pe._)`await ${y}(${n})`}return typeof g=="function"?(0,pe._)`${y}(${n})`:(0,pe._)`${y}.test(${n})`}}}};tl.default=VS});var Wm=w(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});var US=Km(),FS=[US.default];rl.default=FS});var Hm=w(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.contentVocabulary=vn.metadataVocabulary=void 0;vn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];vn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Ym=w(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});var zS=Uh(),BS=em(),qS=Sm(),GS=jm(),KS=Um(),WS=Gm(),HS=Wm(),Jm=Hm(),JS=[GS.default,zS.default,BS.default,(0,qS.default)(!0),HS.default,Jm.metadataVocabulary,Jm.contentVocabulary,KS.default,WS.default];nl.default=JS});var Xm=w(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.DiscrError=void 0;var Zm;(function(e){e.Tag="tag",e.Mapping="mapping"})(Zm||(Oo.DiscrError=Zm={}))});var eg=w(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});var En=T(),il=Xm(),Qm=Oi(),YS=Pi(),ZS=M(),XS={message:({params:{discrError:e,tagName:t}})=>e===il.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,En._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},QS={keyword:"discriminator",type:"object",schemaType:"object",error:XS,code(e){let{gen:t,data:r,schema:n,parentSchema:i,it:a}=e,{oneOf:o}=i;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),d=t.const("tag",(0,En._)`${r}${(0,En.getProperty)(s)}`);t.if((0,En._)`typeof ${d} == "string"`,()=>l(),()=>e.error(!1,{discrError:il.DiscrError.Tag,tag:d,tagName:s})),e.ok(c);function l(){let u=p();t.if(!1);for(let h in u)t.elseIf((0,En._)`${d} === ${h}`),t.assign(c,f(u[h]));t.else(),e.error(!1,{discrError:il.DiscrError.Mapping,tag:d,tagName:s}),t.endIf()}function f(u){let h=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:u},h);return e.mergeEvaluated(m,En.Name),h}function p(){var u;let h={},m=y(i),g=!0;for(let E=0;E<o.length;E++){let I=o[E];if(I?.$ref&&!(0,ZS.schemaHasRulesButRef)(I,a.self.RULES)){let R=I.$ref;if(I=Qm.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,R),I instanceof Qm.SchemaEnv&&(I=I.schema),I===void 0)throw new YS.default(a.opts.uriResolver,a.baseId,R)}let S=(u=I?.properties)===null||u===void 0?void 0:u[s];if(typeof S!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);g=g&&(m||y(I)),_(S,E)}if(!g)throw new Error(`discriminator: "${s}" must be required`);return h;function y({required:E}){return Array.isArray(E)&&E.includes(s)}function _(E,I){if(E.const)b(E.const,I);else if(E.enum)for(let S of E.enum)b(S,I);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function b(E,I){if(typeof E!="string"||E in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[E]=I}}}};al.default=QS});var tg=w((K2,eN)=>{eN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var rg=w((W2,tN)=>{tN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var ng=w((H2,rN)=>{rN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var ig=w((J2,nN)=>{nN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var ag=w((Y2,iN)=>{iN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var og=w((Z2,aN)=>{aN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var sg=w((X2,oN)=>{oN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var cg=w((Q2,sN)=>{sN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var dg=w(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});var cN=tg(),dN=rg(),lN=ng(),fN=ig(),pN=ag(),uN=og(),hN=sg(),mN=cg(),gN=["/properties"];function yN(e){return[cN,dN,lN,fN,pN,t(this,uN),hN,t(this,mN)].forEach(r=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,gN):n}}ol.default=yN});var Vr=w((re,cl)=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.MissingRefError=re.ValidationError=re.CodeGen=re.Name=re.nil=re.stringify=re.str=re._=re.KeywordCxt=re.Ajv2020=void 0;var wN=jh(),_N=Ym(),IN=eg(),vN=dg(),sl="https://json-schema.org/draft/2020-12/schema",bn=class extends wN.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),_N.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(IN.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(vN.default.call(this,t),this.refs["http://json-schema.org/schema"]=sl)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(sl)?sl:void 0)}};re.Ajv2020=bn;cl.exports=re=bn;cl.exports.Ajv2020=bn;Object.defineProperty(re,"__esModule",{value:!0});re.default=bn;var EN=Ni();Object.defineProperty(re,"KeywordCxt",{enumerable:!0,get:function(){return EN.KeywordCxt}});var An=T();Object.defineProperty(re,"_",{enumerable:!0,get:function(){return An._}});Object.defineProperty(re,"str",{enumerable:!0,get:function(){return An.str}});Object.defineProperty(re,"stringify",{enumerable:!0,get:function(){return An.stringify}});Object.defineProperty(re,"nil",{enumerable:!0,get:function(){return An.nil}});Object.defineProperty(re,"Name",{enumerable:!0,get:function(){return An.Name}});Object.defineProperty(re,"CodeGen",{enumerable:!0,get:function(){return An.CodeGen}});var bN=so();Object.defineProperty(re,"ValidationError",{enumerable:!0,get:function(){return bN.default}});var AN=Pi();Object.defineProperty(re,"MissingRefError",{enumerable:!0,get:function(){return AN.default}})});function v(e,t){throw new kt(e,t===void 0?void 0:{cause:t})}var my,kt,Cn=$e(()=>{"use strict";my=["PAGE_SCHEMA_INVALID","PAGE_SCHEMA_VERSION_UNSUPPORTED","PAGE_MATERIAL_UNKNOWN","PAGE_MATERIAL_UNVERIFIED","PAGE_BINDING_FORBIDDEN","PAGE_PORT_UNKNOWN","PAGE_ROUTE_CONFLICT","PAGE_ROUTE_UNKNOWN","PAGE_ROUTE_INVALID","PAGE_ROUTE_DYNAMIC_UNSUPPORTED","PAGE_REACT_NOT_CANONICAL","PAGE_OWNED_REGION_CONFLICT","PAGE_PREVIEW_ISOLATION_VIOLATION","PAGE_HYDRATION_MISMATCH","PAGE_BUNDLE_INVALID","PAGE_PUBLISH_MODE_MISMATCH","PAGE_GATEWAY_PORT_DENIED","SCREEN_PROFILE_REQUIRED","SCREEN_SSR_UNSUPPORTED","SCREEN_DATASET_UNKNOWN","SCREEN_DATASET_PORT_UNKNOWN","SCREEN_FIELD_UNKNOWN","SCREEN_ENCODING_INVALID","SCREEN_MARK_MISMATCH","SCREEN_SPEC_FORBIDDEN","SCREEN_REFRESH_INVALID","SCREEN_LAYOUT_INVALID","SCREEN_SCALE_INVALID","SCREEN_ENGINE_UNAVAILABLE"],kt=class extends Error{code;constructor(t,r){super(t,r),this.code=t,this.name="PageDefinitionError"}}});function Nl(e){let t=e===""?[]:e.split(".");t.some(r=>NO.has(r)||r==="")&&v("PAGE_BINDING_FORBIDDEN"),t[0]!==void 0&&!["state","props","item","actionResult","route","datasets","queries","event"].includes(t[0])&&v("PAGE_BINDING_FORBIDDEN")}function Ge(e){if(e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="function"&&v("PAGE_SCHEMA_INVALID"),Array.isArray(e)){for(let i of e)Ge(i);return e}(!e||typeof e!="object")&&v("PAGE_SCHEMA_INVALID");let t=Object.keys(e);t.length!==1&&v("PAGE_BINDING_FORBIDDEN");let r=t[0];gy.has(r)||v("PAGE_BINDING_FORBIDDEN");let n=e[r];if(r==="var")return typeof n!="string"&&v("PAGE_BINDING_FORBIDDEN"),Nl(n),e;if(r==="missing"){let i=Array.isArray(n)?n:[n];for(let a of i)typeof a!="string"&&v("PAGE_BINDING_FORBIDDEN"),Nl(a)}return Ge(n),e}function Sl(e,t){Nl(t);let r=t===""?[]:t.split("."),n=e;for(let i of r){if(n==null||typeof n!="object"||Object.prototype.hasOwnProperty.call(n,i)!==!0)return null;n=n[i]}return n}function Gr(e){return Array.isArray(e)?e:[e]}function it(e,t,r={count:0}){if(r.count+=1,r.count>PO&&v("PAGE_BINDING_FORBIDDEN"),e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(c=>it(c,t,r));let n=Object.keys(e)[0];(n===void 0||!gy.has(n))&&v("PAGE_BINDING_FORBIDDEN");let i=e[n];if(n==="var")return typeof i!="string"&&v("PAGE_BINDING_FORBIDDEN"),Sl(t,i);if(n==="missing")return Gr(i).map(d=>(typeof d!="string"&&v("PAGE_BINDING_FORBIDDEN"),d)).filter(d=>Sl(t,d)===null||Sl(t,d)===void 0);if(n==="if"){let c=Gr(i);return(c.length<2||c.length>3)&&v("PAGE_BINDING_FORBIDDEN"),it(c[0],t,r)?it(c[1],t,r):c.length===3?it(c[2],t,r):null}if(n==="and"){let c=!0;for(let d of Gr(i))if(c=it(d,t,r),!c)return c;return c}if(n==="or"){let c=!1;for(let d of Gr(i))if(c=it(d,t,r),c)return c;return c}if(n==="!")return!it(Gr(i)[0]??null,t,r);if(n==="!!")return!!it(Gr(i)[0]??null,t,r);let a=Gr(i);a.length!==2&&v("PAGE_BINDING_FORBIDDEN");let o=it(a[0],t,r),s=it(a[1],t,r);if(n==="==")return o===s;if(n==="!=")return o!==s;if(n==="in"){if(typeof s=="string"&&typeof o=="string"||Array.isArray(s))return s.includes(o);v("PAGE_BINDING_FORBIDDEN")}return(typeof o!="number"||typeof s!="number")&&v("PAGE_BINDING_FORBIDDEN"),n===">"?o>s:n===">="?o>=s:n==="<"?o<s:o<=s}var gy,NO,PO,Pl=$e(()=>{"use strict";Cn();gy=new Set(["var","if","==","!=",">",">=","<","<=","and","or","!","in","!!","missing"]),NO=new Set(["__proto__","constructor","prototype","services"]),PO=64});import{createHash as OO}from"node:crypto";function Ol(e){return typeof e=="function"&&v("PAGE_SCHEMA_INVALID"),Array.isArray(e)?`[${e.map(Ol).join(",")}]`:e!==null&&typeof e=="object"?`{${Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>`${JSON.stringify(r)}:${Ol(n)}`).join(",")}}`:JSON.stringify(e)}function xn(e){return`sha256:${OO("sha256").update(Ol(e)).digest("hex")}`}var Dl=$e(()=>{"use strict";Cn()});function Ko(e){if(e===void 0)return;(e===null||typeof e!="object"||Array.isArray(e))&&v("PAGE_SCHEMA_INVALID");let t=e;Object.keys(t).some(r=>!DO.has(r))&&v("PAGE_SCHEMA_INVALID");for(let r of Object.keys(yy))t[r]!==void 0&&!yy[r].has(t[r])&&v("PAGE_SCHEMA_INVALID");return t.mobileStack!==void 0&&typeof t.mobileStack!="boolean"&&v("PAGE_SCHEMA_INVALID"),t.mobileHidden!==void 0&&typeof t.mobileHidden!="boolean"&&v("PAGE_SCHEMA_INVALID"),Object.freeze({...t})}function wy(e){let t={spacing:{none:"p-0",xs:"p-1",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-10"},width:{auto:"w-auto",full:"w-full",content:"w-full max-w-5xl mx-auto",narrow:"w-full max-w-2xl mx-auto"},align:{start:"text-left",center:"text-center",end:"text-right"},surface:{transparent:"bg-transparent",surface:"bg-white",muted:"bg-slate-50",accent:"bg-teal-700 text-white"},radius:{none:"rounded-none",sm:"rounded",md:"rounded-xl",lg:"rounded-2xl"},typography:{body:"font-sans",heading:"font-serif"},layout:{block:"block",row:"flex flex-row",column:"flex flex-col",grid2:"grid grid-cols-2",grid3:"grid grid-cols-3"},gap:{none:"gap-0",xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6"},interaction:{none:"",lift:"transition hover:-translate-y-1 hover:shadow-lg",outline:"focus-visible:ring-2 focus-visible:ring-teal-600",dim:"disabled:opacity-50"}};return[e.spacing&&t.spacing[e.spacing],e.width&&t.width[e.width],e.align&&t.align[e.align],e.surface&&t.surface[e.surface],e.radius&&t.radius[e.radius],e.typography&&t.typography[e.typography],e.layout&&t.layout[e.layout],e.gap&&t.gap[e.gap],e.interaction&&t.interaction[e.interaction],e.mobileStack?"max-sm:flex-col":"",e.mobileHidden?"max-sm:hidden":""].filter(Boolean).join(" ")}function _y(e){let t={none:"0",xs:".25rem",sm:".5rem",md:"1rem",lg:"1.5rem",xl:"2.5rem"},r={auto:"auto",full:"100%",content:"64rem",narrow:"42rem"},n={none:"0",sm:".25rem",md:".75rem",lg:"1rem"},i={none:"0",xs:".25rem",sm:".5rem",md:"1rem",lg:"1.5rem"};return Object.freeze({...e.spacing?{padding:t[e.spacing]}:{},...e.width?{width:e.width==="auto"?"auto":"100%",maxWidth:r[e.width],marginInline:e.width==="content"||e.width==="narrow"?"auto":"0"}:{},...e.align?{textAlign:e.align==="start"?"left":e.align==="end"?"right":"center"}:{},...e.surface?{background:e.surface==="transparent"?"transparent":e.surface==="surface"?"var(--aipt-surface)":e.surface==="muted"?"var(--aipt-layer)":"var(--aipt-accent)",color:e.surface==="accent"?"var(--aipt-surface)":"inherit"}:{},...e.radius?{borderRadius:n[e.radius]}:{},...e.typography?{fontFamily:e.typography==="heading"?"var(--aipt-heading)":"var(--aipt-body)"}:{},...e.layout?e.layout==="block"?{display:"block"}:e.layout==="row"?{display:"flex",flexDirection:"row"}:e.layout==="column"?{display:"flex",flexDirection:"column"}:{display:"grid",gridTemplateColumns:`repeat(${e.layout==="grid2"?2:3}, minmax(0, 1fr))`}:{},...e.gap?{gap:i[e.gap]}:{},...e.mobileHidden?{"--aipt-mobile-visibility":"hidden"}:{}})}var DO,yy,Cl=$e(()=>{"use strict";Cn();DO=new Set(["spacing","width","align","surface","radius","typography","mobileStack","layout","gap","mobileHidden","interaction"]),yy={spacing:new Set(["none","xs","sm","md","lg","xl"]),width:new Set(["auto","full","content","narrow"]),align:new Set(["start","center","end"]),surface:new Set(["transparent","surface","muted","accent"]),radius:new Set(["none","sm","md","lg"]),typography:new Set(["body","heading"]),layout:new Set(["block","row","column","grid2","grid3"]),gap:new Set(["none","xs","sm","md","lg"]),interaction:new Set(["none","lift","outline","dim"])}});function se(e,t){throw new Tn(e,t===void 0?void 0:{cause:t})}var Tn,xl=$e(()=>{"use strict";Tn=class extends Error{code;constructor(t,r){super(t,r),this.code=t,this.name="ChartSpecError"}}});function Ho(e){(e===null||typeof e!="object"||Array.isArray(e)||typeof e=="function")&&se("SCREEN_SPEC_FORBIDDEN");for(let t of Object.keys(e))vy.has(t)&&se("SCREEN_SPEC_FORBIDDEN");return e}function Ll(e,t){for(let r of Object.keys(e))t.has(r)||se("SCREEN_SPEC_FORBIDDEN")}function jl(e){if(typeof e=="function"&&se("SCREEN_SPEC_FORBIDDEN"),Array.isArray(e)){for(let t of e)jl(t);return}if(e!==null&&typeof e=="object")for(let[t,r]of Object.entries(e))vy.has(t)&&se("SCREEN_SPEC_FORBIDDEN"),jl(r)}function Wo(e){let t=Ho(e);Ll(t,jO),(typeof t.field!="string"||!xO.test(t.field))&&se("SCREEN_ENCODING_INVALID"),(typeof t.role!="string"||!VO.has(t.role))&&se("SCREEN_ENCODING_INVALID");let r=t.role;return t.aggregate===void 0?Object.freeze({field:t.field,role:r}):((typeof t.aggregate!="string"||!UO.has(t.aggregate))&&se("SCREEN_ENCODING_INVALID"),r!=="measure"&&se("SCREEN_ENCODING_INVALID"),Object.freeze({field:t.field,role:r,aggregate:t.aggregate}))}function qO(e,t){let r=Ho(e),n=new Set(Iy[t]);for(let a of Object.keys(r))n.has(a)||se("SCREEN_ENCODING_INVALID");let i={};for(let a of Iy[t])r[a]!==void 0&&(a==="x"?i.x=Wo(r.x):a==="y"?i.y=Wo(r.y):a==="color"?i.color=Wo(r.color):i.theta=Wo(r.theta));for(let a of MO[t])a in i||se("SCREEN_ENCODING_INVALID");return Object.freeze(i)}function GO(e,t){if(e===void 0)return;let r=Ho(e);Ll(r,BO);let n={};return r.legend!==void 0&&((typeof r.legend!="string"||!FO.has(r.legend))&&se("SCREEN_SPEC_FORBIDDEN"),n.legend=r.legend),r.labelFormat!==void 0&&((typeof r.labelFormat!="string"||!zO.has(r.labelFormat))&&se("SCREEN_SPEC_FORBIDDEN"),n.labelFormat=r.labelFormat),r.area!==void 0&&((t!=="line"||typeof r.area!="boolean")&&se("SCREEN_SPEC_FORBIDDEN"),n.area=r.area),r.smooth!==void 0&&((t!=="line"||typeof r.smooth!="boolean")&&se("SCREEN_SPEC_FORBIDDEN"),n.smooth=r.smooth),r.stacked!==void 0&&((t!=="bar"||typeof r.stacked!="boolean")&&se("SCREEN_SPEC_FORBIDDEN"),n.stacked=r.stacked),Object.keys(n).length===0?void 0:Object.freeze(n)}function KO(e,t){let r=t.find(i=>i.datasetId===e.datasetId);r||se("SCREEN_DATASET_UNKNOWN");let n=new Map(r.fields.map(i=>[i.key,i]));for(let i of Object.values(e.encoding)){if(i===void 0)continue;let a=n.get(i.field);a||se("SCREEN_FIELD_UNKNOWN"),a.role!==i.role&&se("SCREEN_ENCODING_INVALID")}}function $l(e,t={}){jl(e);let r=Ho(e);Ll(r,TO),r.schemaVersion!==Tl&&se("SCREEN_SPEC_FORBIDDEN"),(typeof r.mark!="string"||!LO.has(r.mark))&&se("SCREEN_SPEC_FORBIDDEN");let n=r.mark;if(t.materialId!==void 0){let s=$O[t.materialId];(s===void 0||s!==n)&&se("SCREEN_MARK_MISMATCH")}(typeof r.datasetId!="string"||!CO.test(r.datasetId))&&se("SCREEN_DATASET_UNKNOWN");let i=qO(r.encoding,n),a=GO(r.style,n),o=Object.freeze(a===void 0?{schemaVersion:Tl,mark:n,datasetId:r.datasetId,encoding:i}:{schemaVersion:Tl,mark:n,datasetId:r.datasetId,encoding:i,style:a});return t.datasets!==void 0&&KO(o,t.datasets),o}var Tl,CO,xO,vy,TO,jO,LO,$O,Iy,MO,VO,UO,FO,zO,BO,Ey=$e(()=>{"use strict";xl();Tl="1.0.0",CO=/^[a-z][a-z0-9-]*$/u,xO=/^[a-zA-Z][a-zA-Z0-9_]*$/u,vy=new Set(["option","formatter","series","dataset","on","events","requestConfig","processData","processConfig","axios","dangerouslySetInnerHTML","code"]),TO=new Set(["schemaVersion","mark","datasetId","encoding","style"]),jO=new Set(["field","role","aggregate"]),LO=new Set(["line","bar","pie"]),$O={"chart.line":"line","chart.bar":"bar","chart.pie":"pie"},Iy={line:["x","y","color"],bar:["x","y","color"],pie:["theta","color"]},MO={line:["x","y"],bar:["x","y"],pie:["theta"]},VO=new Set(["dimension","measure"]),UO=new Set(["sum","avg","count","min","max"]),FO=new Set(["hidden","top","bottom","left","right"]),zO=new Set(["number","percent","compact"]),BO=new Set(["legend","area","smooth","stacked","labelFormat"])});var by=$e(()=>{"use strict";xl();Ey()});function fe(e,t="PAGE_SCHEMA_INVALID"){(e===null||typeof e!="object"||Array.isArray(e)||typeof e=="function")&&v(t);for(let r of Object.keys(e))Sy.has(r)&&v("PAGE_SCHEMA_INVALID");return e}function Ie(e,t){for(let r of Object.keys(e))t.has(r)||v("PAGE_SCHEMA_INVALID")}function ne(e,t){return(typeof e!="string"||e.trim()===""||e.length>200)&&v("PAGE_SCHEMA_INVALID"),t&&!t.test(e)&&v("PAGE_SCHEMA_INVALID"),e}function Kr(e){return(typeof e!="string"||e.trim()===""||e.length>200)&&v("PAGE_SCHEMA_INVALID"),e}function Oy(e){let t=fe(e);return Ml(t),Object.freeze({...t})}function Ml(e){if(typeof e=="function"&&v("PAGE_SCHEMA_INVALID"),Array.isArray(e)){for(let t of e)Ml(t);return}if(e!==null&&typeof e=="object")for(let[t,r]of Object.entries(e))Sy.has(t)&&v("PAGE_SCHEMA_INVALID"),Ml(r)}function wD(e){if(e!==void 0)return Ge(e)}function Jo(e){return(typeof e!="string"||!e.startsWith("/")||e.includes("?")||e.includes("#")||e.includes("//"))&&v("PAGE_ROUTE_INVALID"),(e.includes(":")||e.includes("*"))&&v("PAGE_ROUTE_DYNAMIC_UNSUPPORTED"),e!=="/"&&!/^\/[a-z0-9]+(-[a-z0-9]+)*(?:\/[a-z0-9]+(-[a-z0-9]+)*)*$/u.test(e)&&v("PAGE_ROUTE_INVALID"),e}function _D(e){if(e===void 0)return;let t=fe(e);Ie(t,pD);let r=Ge(t.items),n=ne(t.alias,Xo);return t.key===void 0?Object.freeze({items:r,alias:n}):Object.freeze({items:r,alias:n,key:ne(t.key)})}function ID(e){if(e===void 0)return;let t=fe(e),r={};for(let[n,i]of Object.entries(t))Xo.test(n)||v("PAGE_SCHEMA_INVALID"),r[n]=Ge(i);return Object.freeze(r)}function vD(e){if(e===void 0)return;let t=fe(e),r={};for(let[n,i]of Object.entries(t))Xo.test(n)||v("PAGE_SCHEMA_INVALID"),r[n]=ne(i,mr);return Object.freeze(r)}function Vl(e,t,r){let n=fe(e),i=ne(n.id,HO);t.has(i)&&v("PAGE_SCHEMA_INVALID"),t.add(i);let a=n.kind;a!=="box"&&a!=="material"&&a!=="link"&&v("PAGE_SCHEMA_INVALID"),Ie(n,a==="box"?mD:a==="material"?gD:yD);let o=n.props===void 0?Object.freeze({}):Object.freeze(Oy(n.props)),s=wD(n.visible),c=_D(n.loop),d=ID(n.bindings),l=vD(n.events),f=Ko(n.presentation),p={};if(s!==void 0&&(p.visible=s),c!==void 0&&(p.loop=c),d!==void 0&&(p.bindings=d),l!==void 0&&(p.events=l),f!==void 0&&(p.presentation=f),a==="box"){let m=Array.isArray(n.children)?Object.freeze(n.children.map(g=>Vl(g,t,r))):void 0;return Object.freeze({id:i,kind:a,props:o,...m?{children:m}:{},...p})}if(a==="link"){let m=Jo(n.to);return r.routes.some(g=>g.path===m)||v("PAGE_ROUTE_UNKNOWN"),Object.freeze({id:i,kind:a,to:m,props:o,...p})}let u=ne(n.materialId,ky);r.registryLock.some(m=>m.materialId===u)||v("PAGE_MATERIAL_UNKNOWN");let h;if(n.slots!==void 0){let m=fe(n.slots);h={};for(let[g,y]of Object.entries(m))(!Xo.test(g)||g in o)&&v("PAGE_SCHEMA_INVALID"),Array.isArray(y)||v("PAGE_SCHEMA_INVALID"),h[g]=Object.freeze(y.map(_=>Vl(_,t,r)))}return Object.freeze({id:i,kind:a,materialId:u,props:o,...h?{slots:Object.freeze(h)}:{},...p})}function ED(e,t){if(e===void 0)return Object.freeze([]);Array.isArray(e)||v("PAGE_SCHEMA_INVALID");let r=new Set;return Object.freeze(e.map(n=>{let i=fe(n);Ie(i,uD);let a=ne(i.queryId,mr),o=ne(i.datasetId,mr);(r.has(a)||!(t.datasets??[]).some(c=>c.datasetId===o))&&v("SCREEN_DATASET_UNKNOWN"),r.add(a);let s=i.trigger===void 0?"load":i.trigger;if(s!=="load"&&s!=="manual"&&s!=="interval"&&v("PAGE_SCHEMA_INVALID"),s==="interval"){let c=Bt(i.intervalMs,1e3,36e5,"SCREEN_REFRESH_INVALID");return Object.freeze({queryId:a,datasetId:o,args:Ge(i.args??null),trigger:s,intervalMs:c})}return i.intervalMs!==void 0&&v("PAGE_SCHEMA_INVALID"),Object.freeze({queryId:a,datasetId:o,args:Ge(i.args??null),trigger:s})}))}function bD(e,t){if(e===void 0)return Object.freeze([]);Array.isArray(e)||v("PAGE_SCHEMA_INVALID");let r=new Set;return Object.freeze(e.map(n=>{let i=fe(n);Ie(i,fD);let a=ne(i.actionId,mr);if(r.has(a)&&v("PAGE_SCHEMA_INVALID"),r.add(a),i.steps===void 0){let s=ne(i.portId,Yo);return t.dataProxy.some(c=>c.portId===s)||v("PAGE_PORT_UNKNOWN"),Object.freeze({actionId:a,steps:Object.freeze([{type:"invokePort",portId:s,args:Ge(i.args)}])})}(i.portId!==void 0||i.args!==void 0||!Array.isArray(i.steps)||i.steps.length===0)&&v("PAGE_SCHEMA_INVALID");let o=Object.freeze(i.steps.map(s=>{let c=fe(s);if((typeof c.type!="string"||!(c.type in Ay))&&v("PAGE_SCHEMA_INVALID"),Ie(c,Ay[c.type]),c.type==="setState")return Object.freeze({type:"setState",key:ne(c.key,Py),value:Ge(c.value)});if(c.type==="invokePort"){let d=ne(c.portId,Yo);return t.dataProxy.some(l=>l.portId===d)||v("PAGE_PORT_UNKNOWN"),Object.freeze({type:"invokePort",portId:d,args:Ge(c.args)})}if(c.type==="navigate"){let d=ne(c.path);return t.routes.some(l=>l.path===d)||v("PAGE_ROUTE_UNKNOWN"),Object.freeze({type:"navigate",path:d})}if(c.type==="reloadQuery")return Object.freeze({type:"reloadQuery",queryId:ne(c.queryId,mr)});if(c.type==="showFeedback"){let d=c.status??"info";return d!=="info"&&d!=="success"&&d!=="error"&&v("PAGE_SCHEMA_INVALID"),Object.freeze({type:"showFeedback",message:ne(c.message),status:d})}if(c.type==="resetForm")return Object.freeze({type:"resetForm"});v("PAGE_SCHEMA_INVALID")}));return Object.freeze({actionId:a,steps:o})}))}function Bt(e,t,r,n){return(typeof e!="number"||!Number.isInteger(e)||e<t||e>r)&&v(n),e}function AD(e,t){let r=fe(e);Ie(r,iD);let n=ne(r.key);return(!Py.test(n)||t.has(n))&&v("PAGE_SCHEMA_INVALID"),t.add(n),r.role!==void 0&&(typeof r.role!="string"||!dD.has(r.role))&&v("PAGE_SCHEMA_INVALID"),(typeof r.dataType!="string"||!lD.has(r.dataType))&&v("PAGE_SCHEMA_INVALID"),r.nullable!==void 0&&typeof r.nullable!="boolean"&&v("PAGE_SCHEMA_INVALID"),Object.freeze({key:n,label:Kr(r.label),...r.role===void 0?{}:{role:r.role},dataType:r.dataType,...r.nullable===void 0?{}:{nullable:r.nullable}})}function RD(e,t){if(e===void 0)return Object.freeze([]);Array.isArray(e)||v("PAGE_SCHEMA_INVALID");let r=new Set;return Object.freeze(e.map(n=>{let i=fe(n);Ie(i,nD);let a=ne(i.datasetId,mr);r.has(a)&&v("PAGE_SCHEMA_INVALID"),r.add(a);let o=ne(i.portId,Yo);t.has(o)||v("SCREEN_DATASET_PORT_UNKNOWN"),(!Array.isArray(i.fields)||i.fields.length===0)&&v("PAGE_SCHEMA_INVALID");let s=new Set,c=Object.freeze(i.fields.map(f=>AD(f,s))),d=i.cardinality===void 0?"many":i.cardinality;if(d!=="one"&&d!=="many"&&v("PAGE_SCHEMA_INVALID"),i.refreshMs===void 0)return Object.freeze({datasetId:a,portId:o,cardinality:d,fields:c});let l=Bt(i.refreshMs,1e3,36e5,"SCREEN_REFRESH_INVALID");return Object.freeze({datasetId:a,portId:o,cardinality:d,fields:c,refreshMs:l})}))}function kD(e,t,r){let n=fe(e,"SCREEN_LAYOUT_INVALID");Ie(n,oD);let i=Bt(n.x,0,t-1,"SCREEN_LAYOUT_INVALID"),a=Bt(n.y,0,r-1,"SCREEN_LAYOUT_INVALID"),o=Bt(n.w,1,t,"SCREEN_LAYOUT_INVALID"),s=Bt(n.h,1,r,"SCREEN_LAYOUT_INVALID"),c=Bt(n.z,0,1e4,"SCREEN_LAYOUT_INVALID");return Object.freeze({x:i,y:a,w:o,h:s,z:c})}function Zo(e,t){t(e);for(let r of e.children??[])Zo(r,t);for(let r of Object.values(e.slots??{}))for(let n of r)Zo(n,t)}function SD(e){return e.map(t=>({datasetId:t.datasetId,fields:t.fields.map(r=>(r.role===void 0&&v("SCREEN_FIELD_UNKNOWN"),{key:r.key,role:r.role}))}))}function ND(e,t,r){try{$l(t,{materialId:e,datasets:SD(r)})}catch(n){throw n instanceof Tn&&v(n.code),n}}function PD(e,t){Ie(e.props,aD);let r=Bt(e.props.designWidth,1,7680,"SCREEN_LAYOUT_INVALID"),n=Bt(e.props.designHeight,1,4320,"SCREEN_LAYOUT_INVALID");(typeof e.props.scaleMode!="string"||!sD.has(e.props.scaleMode))&&v("SCREEN_SCALE_INVALID"),e.props.snap!==void 0&&(typeof e.props.snap!="number"||!cD.has(e.props.snap))&&v("SCREEN_LAYOUT_INVALID");let i=e.slots?.items??[],a=new Set,o=t.datasets??[];for(let s of i){let c=kD(s.props.frame,r,n);a.has(c.z)&&v("SCREEN_LAYOUT_INVALID"),a.add(c.z),s.materialId?.startsWith("chart.")&&ND(s.materialId,s.props.spec,o)}}function OD(e){Zo(e,t=>{t.materialId===Ny&&v("SCREEN_PROFILE_REQUIRED")})}function DD(e,t){if(t.authoringProfile!=="data-screen"){OD(e);return}let r=e.children??[];(r.length!==1||r[0]?.kind!=="material"||r[0].materialId!==Ny)&&v("SCREEN_LAYOUT_INVALID"),PD(r[0],t)}function ea(e){let t=fe(e),r=t.project&&typeof t.project=="object"&&!Array.isArray(t.project)?t.project.schemaVersion:t.schemaVersion;return r===void 0&&v("PAGE_SCHEMA_INVALID"),r!==jn&&v("PAGE_SCHEMA_VERSION_UNSUPPORTED"),e}function Ul(e){ea(e);let t=fe(e);Ie(t,YO),t.schemaVersion!==jn&&v("PAGE_SCHEMA_VERSION_UNSUPPORTED");let r=t.renderMode;r!=="csr"&&r!=="ssr"&&v("PAGE_SCHEMA_INVALID"),typeof t.prerenderRoutes!="boolean"&&v("PAGE_SCHEMA_INVALID");let n=t.authoringProfile===void 0?"react-data":t.authoringProfile;n!=="react-data"&&n!=="react-jsx"&&n!=="data-screen"&&v("PAGE_SCHEMA_INVALID"),n==="data-screen"&&r==="ssr"&&v("SCREEN_SSR_UNSUPPORTED"),(!Array.isArray(t.routes)||t.routes.length===0)&&v("PAGE_SCHEMA_INVALID");let i=new Set,a=new Set,o=Object.freeze(t.routes.map(m=>{let g=fe(m);Ie(g,XO);let y=Jo(g.path),_=ne(g.pageId,Ry);(i.has(y)||a.has(_))&&v("PAGE_ROUTE_CONFLICT"),i.add(y),a.add(_);let b=g.description===void 0?void 0:Kr(g.description);return Object.freeze({path:y,pageId:_,title:Kr(g.title),...b===void 0?{}:{description:b}})})),s=Object.freeze((Array.isArray(t.navigation)?t.navigation:[]).map(m=>{let g=fe(m);Ie(g,eD);let y=Jo(g.path);return i.has(y)||v("PAGE_ROUTE_UNKNOWN"),Object.freeze({label:Kr(g.label),path:y})})),c=Jo(t.defaultPath);i.has(c)||v("PAGE_ROUTE_UNKNOWN");let d=Object.freeze((Array.isArray(t.registryLock)?t.registryLock:[]).map(m=>{let g=fe(m);return Ie(g,tD),Object.freeze({materialId:ne(g.materialId,ky),version:ne(g.version,WO)})})),l=Object.freeze((Array.isArray(t.dataProxy)?t.dataProxy:[]).map(m=>{let g=fe(m);Ie(g,rD);let y=ne(g.publicPath);return JO.test(y)||v("PAGE_SCHEMA_INVALID"),Object.freeze({portId:ne(g.portId,Yo),publicPath:y})})),f=new Set,p=new Set;for(let m of l)(f.has(m.portId)||p.has(m.publicPath))&&v("PAGE_SCHEMA_INVALID"),f.add(m.portId),p.add(m.publicPath);let u=RD(t.datasets,f),h;if(t.site!==void 0){let m=fe(t.site);Ie(m,QO),h=Object.freeze({footerText:Kr(m.footerText)})}return Object.freeze({schemaVersion:jn,projectId:ne(t.projectId,mr),title:Kr(t.title),renderMode:r,prerenderRoutes:t.prerenderRoutes,authoringProfile:n,routes:o,navigation:s,defaultPath:c,registryLock:d,dataProxy:l,datasets:u,...h===void 0?{}:{site:h}})}function Fl(e,t){ea(e);let r=fe(e);Ie(r,ZO),r.schemaVersion!==jn&&v("PAGE_SCHEMA_VERSION_UNSUPPORTED");let n=ne(r.pageId,Ry);t.routes.some(p=>p.pageId===n)||v("PAGE_ROUTE_UNKNOWN"),ne(r.projectId,mr)!==t.projectId&&v("PAGE_SCHEMA_INVALID");let i=r.authoringMode===void 0?"schema":r.authoringMode;i!=="schema"&&i!=="code-only"&&v("PAGE_SCHEMA_INVALID");let a=r.context===void 0?{}:fe(r.context);Ie(a,hD);let o=a.state===void 0?Object.freeze({}):Object.freeze(Oy(a.state)),s=Vl(r.root,new Set,t);s.kind!=="box"&&v("PAGE_SCHEMA_INVALID"),DD(s,t);let c=ED(a.queries,t),d=bD(a.actions,t),l=new Set(c.map(p=>p.queryId));for(let p of d)for(let u of p.steps)u.type==="setState"&&!Object.hasOwn(o,u.key)&&v("PAGE_SCHEMA_INVALID"),u.type==="reloadQuery"&&!l.has(u.queryId)&&v("PAGE_SCHEMA_INVALID");let f=new Set(d.map(p=>p.actionId));return Zo(s,p=>{for(let u of Object.values(p.events??{}))f.has(u)||v("PAGE_SCHEMA_INVALID")}),Object.freeze({schemaVersion:jn,pageId:n,title:Kr(r.title),projectId:t.projectId,authoringMode:i,root:s,context:Object.freeze({state:o,actions:d,queries:c})})}function zl(e,t){let r=[...e.routes.map(i=>i.pageId)].sort((i,a)=>i.localeCompare(a)),n=Object.keys(t).sort((i,a)=>i.localeCompare(a));return r.join("\0")!==n.join("\0")&&v("PAGE_SCHEMA_INVALID"),xn({project:e,pageDigests:t})}function Bl(e){return xn(e)}function ql(e){let t=fe(ea(e));t.schemaVersion!==void 0&&t.schemaVersion!==jn&&v("PAGE_SCHEMA_VERSION_UNSUPPORTED"),Ie(t,new Set(["project","pages","schemaVersion","digest"]));let r=Ul(t.project);Array.isArray(t.pages)||v("PAGE_SCHEMA_INVALID");let n=Object.freeze(t.pages.map(s=>Fl(s,r))),i=new Set,a={};for(let s of n)i.has(s.pageId)&&v("PAGE_ROUTE_CONFLICT"),i.add(s.pageId),a[s.pageId]=Bl(s);for(let s of r.routes)i.has(s.pageId)||v("PAGE_SCHEMA_INVALID");let o=zl(r,a);return t.digest!==void 0&&t.digest!==o&&v("PAGE_SCHEMA_INVALID"),Object.freeze({project:r,pages:n,digest:o})}var jn,mr,Ry,ky,WO,HO,Yo,JO,Xo,Sy,YO,ZO,XO,QO,eD,tD,rD,nD,iD,aD,oD,Ny,sD,cD,dD,lD,Py,fD,Ay,pD,uD,hD,mD,gD,yD,Dy=$e(()=>{"use strict";by();Pl();Dl();Cn();Cl();jn="1.0.0",mr=/^[a-z][a-z0-9-]*$/u,Ry=/^[a-z][a-z0-9-]*$/u,ky=/^[a-z][a-z0-9]*(\.[a-z][a-z0-9-]*)+$/u,WO=/^[0-9]+\.[0-9]+\.[0-9]+$/u,HO=/^[a-zA-Z][a-zA-Z0-9_]*$/u,Yo=/^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*$/u,JO=/^\/api\/[a-z0-9-]+(\/[a-z0-9-]+)*$/u,Xo=/^[a-zA-Z][a-zA-Z0-9_]*$/u,Sy=new Set(["requestConfig","processData","processConfig","axios","dangerouslySetInnerHTML","code","option","formatter"]),YO=new Set(["schemaVersion","projectId","title","renderMode","prerenderRoutes","authoringProfile","routes","navigation","defaultPath","registryLock","dataProxy","datasets","site"]),ZO=new Set(["schemaVersion","pageId","title","projectId","authoringMode","root","context"]),XO=new Set(["path","pageId","title","description"]),QO=new Set(["footerText"]),eD=new Set(["label","path"]),tD=new Set(["materialId","version"]),rD=new Set(["portId","publicPath"]),nD=new Set(["datasetId","portId","cardinality","fields","refreshMs"]),iD=new Set(["key","label","role","dataType","nullable"]),aD=new Set(["designWidth","designHeight","scaleMode","snap"]),oD=new Set(["x","y","w","h","z"]),Ny="layout.screen-stage",sD=new Set(["contain","cover","width"]),cD=new Set([1,4,8]),dD=new Set(["dimension","measure"]),lD=new Set(["string","number","boolean","date","image","richText","object","array"]),Py=/^[a-zA-Z][a-zA-Z0-9_]*$/u,fD=new Set(["actionId","portId","args","steps"]),Ay={setState:new Set(["type","key","value"]),invokePort:new Set(["type","portId","args"]),navigate:new Set(["type","path"]),reloadQuery:new Set(["type","queryId"]),showFeedback:new Set(["type","message","status"]),resetForm:new Set(["type"])},pD=new Set(["items","alias","key"]),uD=new Set(["queryId","datasetId","args","trigger","intervalMs"]),hD=new Set(["state","actions","queries"]),mD=new Set(["id","kind","props","children","visible","loop","bindings","events","presentation"]),gD=new Set(["id","kind","materialId","props","slots","visible","loop","bindings","events","presentation"]),yD=new Set(["id","kind","to","props","visible","loop","bindings","events","presentation"])});var Gl={};cc(Gl,{PageDefinitionError:()=>kt,assertBinding:()=>Ge,contentDigest:()=>xn,digestPageDefinition:()=>Bl,digestPageProject:()=>zl,evaluateBinding:()=>it,migratePageDocument:()=>ea,pageErrorCodes:()=>my,parsePageAuthoringDocument:()=>ql,parsePageDefinition:()=>Fl,parsePageProject:()=>Ul,parsePresentation:()=>Ko,presentationInlineStyle:()=>_y,presentationTailwindClasses:()=>wy});var Ln=$e(()=>{"use strict";Pl();Dl();Cn();Cl();Dy()});var Vz,Cy=$e(()=>{"use strict";Ln();Vz=['import { createPageElement } from "@aipt/page-renderer";','import { loadPageAuthoringDocument } from "./load-document";',"","export function PageAuthoringCsrEntry(props: { readonly path: string }) {"," return createPageElement(loadPageAuthoringDocument(), { path: props.path });","}",""].join(`
|
|
9
|
-
`)});var ta=w((Fz,Kl)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Kl.exports={nextTick:CD}:Kl.exports=process;function CD(e,t,r,n){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var i=arguments.length,a,o;switch(i){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,r)});case 4:return process.nextTick(function(){e.call(null,t,r,n)});default:for(a=new Array(i-1),o=0;o<a.length;)a[o++]=arguments[o];return process.nextTick(function(){e.apply(null,a)})}}});var Ty=w((zz,xy)=>{var xD={}.toString;xy.exports=Array.isArray||function(e){return xD.call(e)=="[object Array]"}});var Wl=w((Bz,jy)=>{jy.exports=$t("stream")});var ra=w((Hl,$y)=>{var Qo=$t("buffer"),qt=Qo.Buffer;function Ly(e,t){for(var r in e)t[r]=e[r]}qt.from&&qt.alloc&&qt.allocUnsafe&&qt.allocUnsafeSlow?$y.exports=Qo:(Ly(Qo,Hl),Hl.Buffer=$n);function $n(e,t,r){return qt(e,t,r)}Ly(qt,$n);$n.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return qt(e,t,r)};$n.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=qt(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};$n.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return qt(e)};$n.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Qo.SlowBuffer(e)}});var Mn=w(Oe=>{function TD(e){return Array.isArray?Array.isArray(e):es(e)==="[object Array]"}Oe.isArray=TD;function jD(e){return typeof e=="boolean"}Oe.isBoolean=jD;function LD(e){return e===null}Oe.isNull=LD;function $D(e){return e==null}Oe.isNullOrUndefined=$D;function MD(e){return typeof e=="number"}Oe.isNumber=MD;function VD(e){return typeof e=="string"}Oe.isString=VD;function UD(e){return typeof e=="symbol"}Oe.isSymbol=UD;function FD(e){return e===void 0}Oe.isUndefined=FD;function zD(e){return es(e)==="[object RegExp]"}Oe.isRegExp=zD;function BD(e){return typeof e=="object"&&e!==null}Oe.isObject=BD;function qD(e){return es(e)==="[object Date]"}Oe.isDate=qD;function GD(e){return es(e)==="[object Error]"||e instanceof Error}Oe.isError=GD;function KD(e){return typeof e=="function"}Oe.isFunction=KD;function WD(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}Oe.isPrimitive=WD;Oe.isBuffer=$t("buffer").Buffer.isBuffer;function es(e){return Object.prototype.toString.call(e)}});var My=w((Gz,Jl)=>{typeof Object.create=="function"?Jl.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Jl.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}}});var Vn=w((Kz,Zl)=>{try{if(Yl=$t("util"),typeof Yl.inherits!="function")throw"";Zl.exports=Yl.inherits}catch{Zl.exports=My()}var Yl});var Uy=w((Wz,Xl)=>{"use strict";function HD(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Vy=ra().Buffer,na=$t("util");function JD(e,t,r){e.copy(t,r)}Xl.exports=(function(){function e(){HD(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},e.prototype.unshift=function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},e.prototype.shift=function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i},e.prototype.concat=function(r){if(this.length===0)return Vy.alloc(0);for(var n=Vy.allocUnsafe(r>>>0),i=this.head,a=0;i;)JD(i.data,n,a),a+=i.data.length,i=i.next;return n},e})();na&&na.inspect&&na.inspect.custom&&(Xl.exports.prototype[na.inspect.custom]=function(){var e=na.inspect({length:this.length});return this.constructor.name+" "+e})});var Ql=w((Hz,Fy)=>{"use strict";var ts=ta();function YD(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ts.nextTick(rs,this,e)):ts.nextTick(rs,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(a){!t&&a?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,ts.nextTick(rs,r,a)):ts.nextTick(rs,r,a):t&&t(a)}),this)}function ZD(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function rs(e,t){e.emit("error",t)}Fy.exports={destroy:YD,undestroy:ZD}});var By=w((Jz,zy)=>{zy.exports=$t("util").deprecate});var tf=w((Yz,Zy)=>{"use strict";var Wr=ta();Zy.exports=ge;function Gy(e){var t=this;this.next=null,this.entry=null,this.finish=function(){mC(t,e)}}var XD=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Wr.nextTick,Un;ge.WritableState=aa;var Ky=Object.create(Mn());Ky.inherits=Vn();var QD={deprecate:By()},Wy=Wl(),is=ra().Buffer,eC=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function tC(e){return is.from(e)}function rC(e){return is.isBuffer(e)||e instanceof eC}var Hy=Ql();Ky.inherits(ge,Wy);function nC(){}function aa(e,t){Un=Un||Hr(),e=e||{};var r=t instanceof Un;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,i=e.writableHighWaterMark,a=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=e.decodeStrings===!1;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(s){lC(t,s)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Gy(this)}aa.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(aa.prototype,"buffer",{get:QD.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ns;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ns=Function.prototype[Symbol.hasInstance],Object.defineProperty(ge,Symbol.hasInstance,{value:function(e){return ns.call(this,e)?!0:this!==ge?!1:e&&e._writableState instanceof aa}})):ns=function(e){return e instanceof this};function ge(e){if(Un=Un||Hr(),!ns.call(ge,this)&&!(this instanceof Un))return new ge(e);this._writableState=new aa(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),Wy.call(this)}ge.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function iC(e,t){var r=new Error("write after end");e.emit("error",r),Wr.nextTick(t,r)}function aC(e,t,r,n){var i=!0,a=!1;return r===null?a=new TypeError("May not write null values to stream"):typeof r!="string"&&r!==void 0&&!t.objectMode&&(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),Wr.nextTick(n,a),i=!1),i}ge.prototype.write=function(e,t,r){var n=this._writableState,i=!1,a=!n.objectMode&&rC(e);return a&&!is.isBuffer(e)&&(e=tC(e)),typeof t=="function"&&(r=t,t=null),a?t="buffer":t||(t=n.defaultEncoding),typeof r!="function"&&(r=nC),n.ended?iC(this,r):(a||aC(this,n,e,r))&&(n.pendingcb++,i=sC(this,n,a,e,t,r)),i};ge.prototype.cork=function(){var e=this._writableState;e.corked++};ge.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&Jy(this,e))};ge.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function oC(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=is.from(t,r)),t}Object.defineProperty(ge.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function sC(e,t,r,n,i,a){if(!r){var o=oC(t,n,i);n!==o&&(r=!0,i="buffer",n=o)}var s=t.objectMode?1:n.length;t.length+=s;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var d=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:a,next:null},d?d.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else ef(e,t,!1,s,n,i,a);return c}function ef(e,t,r,n,i,a,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function cC(e,t,r,n,i){--t.pendingcb,r?(Wr.nextTick(i,n),Wr.nextTick(ia,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),ia(e,t))}function dC(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function lC(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(dC(r),t)cC(e,r,n,t,i);else{var a=Yy(r);!a&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&Jy(e,r),n?XD(qy,e,r,a,i):qy(e,r,a,i)}}function qy(e,t,r,n){r||fC(e,t),t.pendingcb--,n(),ia(e,t)}function fC(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function Jy(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),a=t.corkedRequestsFree;a.entry=r;for(var o=0,s=!0;r;)i[o]=r,r.isBuf||(s=!1),r=r.next,o+=1;i.allBuffers=s,ef(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new Gy(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,d=r.encoding,l=r.callback,f=t.objectMode?1:c.length;if(ef(e,t,!1,f,c,d,l),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}ge.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))};ge.prototype._writev=null;ge.prototype.end=function(e,t,r){var n=this._writableState;typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||hC(this,n,r)};function Yy(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function pC(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),ia(e,t)})}function uC(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,Wr.nextTick(pC,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function ia(e,t){var r=Yy(t);return r&&(uC(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),r}function hC(e,t,r){t.ending=!0,ia(e,t),r&&(t.finished?Wr.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function mC(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}Object.defineProperty(ge.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});ge.prototype.destroy=Hy.destroy;ge.prototype._undestroy=Hy.undestroy;ge.prototype._destroy=function(e,t){this.end(),t(e)}});var Hr=w((Zz,tw)=>{"use strict";var Xy=ta(),gC=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};tw.exports=Gt;var Qy=Object.create(Mn());Qy.inherits=Vn();var ew=af(),nf=tf();Qy.inherits(Gt,ew);for(rf=gC(nf.prototype),as=0;as<rf.length;as++)os=rf[as],Gt.prototype[os]||(Gt.prototype[os]=nf.prototype[os]);var rf,os,as;function Gt(e){if(!(this instanceof Gt))return new Gt(e);ew.call(this,e),nf.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",yC)}Object.defineProperty(Gt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function yC(){this.allowHalfOpen||this._writableState.ended||Xy.nextTick(wC,this)}function wC(e){e.end()}Object.defineProperty(Gt.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}});Gt.prototype._destroy=function(e,t){this.push(null),this.end(),Xy.nextTick(t,e)}});var cf=w(nw=>{"use strict";var sf=ra().Buffer,rw=sf.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _C(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function IC(e){var t=_C(e);if(typeof t!="string"&&(sf.isEncoding===rw||!rw(e)))throw new Error("Unknown encoding: "+e);return t||e}nw.StringDecoder=oa;function oa(e){this.encoding=IC(e);var t;switch(this.encoding){case"utf16le":this.text=kC,this.end=SC,t=4;break;case"utf8":this.fillLast=bC,t=4;break;case"base64":this.text=NC,this.end=PC,t=3;break;default:this.write=OC,this.end=DC;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=sf.allocUnsafe(t)}oa.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};oa.prototype.end=RC;oa.prototype.text=AC;oa.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function of(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function vC(e,t,r){var n=t.length-1;if(n<r)return 0;var i=of(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||i===-2?0:(i=of(t[n]),i>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||i===-2?0:(i=of(t[n]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function EC(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function bC(e){var t=this.lastTotal-this.lastNeed,r=EC(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function AC(e,t){var r=vC(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function RC(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function kC(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function SC(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function NC(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function PC(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function OC(e){return e.toString(this.encoding)}function DC(e){return e&&e.length?this.write(e):""}});var af=w((eB,mw)=>{"use strict";var zn=ta();mw.exports=ie;var CC=Ty(),sa;ie.ReadableState=lw;var Qz=$t("events").EventEmitter,sw=function(e,t){return e.listeners(t).length},uf=Wl(),ca=ra().Buffer,xC=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function TC(e){return ca.from(e)}function jC(e){return ca.isBuffer(e)||e instanceof xC}var cw=Object.create(Mn());cw.inherits=Vn();var df=$t("util"),H=void 0;df&&df.debuglog?H=df.debuglog("stream"):H=function(){};var LC=Uy(),dw=Ql(),Fn;cw.inherits(ie,uf);var lf=["error","close","destroy","pause","resume"];function $C(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):CC(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}function lw(e,t){sa=sa||Hr(),e=e||{};var r=t instanceof sa;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,i=e.readableHighWaterMark,a=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new LC,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(Fn||(Fn=cf().StringDecoder),this.decoder=new Fn(e.encoding),this.encoding=e.encoding)}function ie(e){if(sa=sa||Hr(),!(this instanceof ie))return new ie(e);this._readableState=new lw(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),uf.call(this)}Object.defineProperty(ie.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});ie.prototype.destroy=dw.destroy;ie.prototype._undestroy=dw.undestroy;ie.prototype._destroy=function(e,t){this.push(null),t(e)};ie.prototype.push=function(e,t){var r=this._readableState,n;return r.objectMode?n=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=ca.from(e,t),t=""),n=!0),fw(this,e,t,!1,n)};ie.prototype.unshift=function(e){return fw(this,e,null,!0,!1)};function fw(e,t,r,n,i){var a=e._readableState;if(t===null)a.reading=!1,FC(e,a);else{var o;i||(o=MC(a,t)),o?e.emit("error",o):a.objectMode||t&&t.length>0?(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==ca.prototype&&(t=TC(t)),n?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):ff(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||t.length!==0?ff(e,a,t,!1):pw(e,a)):ff(e,a,t,!1))):n||(a.reading=!1)}return VC(a)}function ff(e,t,r,n){t.flowing&&t.length===0&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&ss(e)),pw(e,t)}function MC(e,t){var r;return!jC(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new TypeError("Invalid non-string/buffer chunk")),r}function VC(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}ie.prototype.isPaused=function(){return this._readableState.flowing===!1};ie.prototype.setEncoding=function(e){return Fn||(Fn=cf().StringDecoder),this._readableState.decoder=new Fn(e),this._readableState.encoding=e,this};var iw=8388608;function UC(e){return e>=iw?e=iw:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function aw(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=UC(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}ie.prototype.read=function(e){H("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return H("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?pf(this):ss(this),null;if(e=aw(e,t),e===0&&t.ended)return t.length===0&&pf(this),null;var n=t.needReadable;H("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,H("length less than watermark",n)),t.ended||t.reading?(n=!1,H("reading or ended",n)):n&&(H("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=aw(r,t)));var i;return e>0?i=uw(e,t):i=null,i===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&pf(this)),i!==null&&this.emit("data",i),i};function FC(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,ss(e)}}function ss(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(H("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?zn.nextTick(ow,e):ow(e))}function ow(e){H("emit readable"),e.emit("readable"),hf(e)}function pw(e,t){t.readingMore||(t.readingMore=!0,zn.nextTick(zC,e,t))}function zC(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(H("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}ie.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};ie.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,H("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,a=i?s:g;n.endEmitted?zn.nextTick(a):r.once("end",a),e.on("unpipe",o);function o(y,_){H("onunpipe"),y===r&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,l())}function s(){H("onend"),e.end()}var c=BC(r);e.on("drain",c);var d=!1;function l(){H("cleanup"),e.removeListener("close",h),e.removeListener("finish",m),e.removeListener("drain",c),e.removeListener("error",u),e.removeListener("unpipe",o),r.removeListener("end",s),r.removeListener("end",g),r.removeListener("data",p),d=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c()}var f=!1;r.on("data",p);function p(y){H("ondata"),f=!1;var _=e.write(y);_===!1&&!f&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&hw(n.pipes,e)!==-1)&&!d&&(H("false write response, pause",n.awaitDrain),n.awaitDrain++,f=!0),r.pause())}function u(y){H("onerror",y),g(),e.removeListener("error",u),sw(e,"error")===0&&e.emit("error",y)}$C(e,"error",u);function h(){e.removeListener("finish",m),g()}e.once("close",h);function m(){H("onfinish"),e.removeListener("close",h),g()}e.once("finish",m);function g(){H("unpipe"),r.unpipe(e)}return e.emit("pipe",r),n.flowing||(H("pipe resume"),r.resume()),e};function BC(e){return function(){var t=e._readableState;H("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&sw(e,"data")&&(t.flowing=!0,hf(e))}}ie.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)n[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=hw(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};ie.prototype.on=function(e,t){var r=uf.prototype.on.call(this,e,t);if(e==="data")this._readableState.flowing!==!1&&this.resume();else if(e==="readable"){var n=this._readableState;!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&ss(this):zn.nextTick(qC,this))}return r};ie.prototype.addListener=ie.prototype.on;function qC(e){H("readable nexttick read 0"),e.read(0)}ie.prototype.resume=function(){var e=this._readableState;return e.flowing||(H("resume"),e.flowing=!0,GC(this,e)),this};function GC(e,t){t.resumeScheduled||(t.resumeScheduled=!0,zn.nextTick(KC,e,t))}function KC(e,t){t.reading||(H("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),hf(e),t.flowing&&!t.reading&&e.read(0)}ie.prototype.pause=function(){return H("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(H("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function hf(e){var t=e._readableState;for(H("flow",t.flowing);t.flowing&&e.read()!==null;);}ie.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;e.on("end",function(){if(H("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&t.push(o)}t.push(null)}),e.on("data",function(o){if(H("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var s=t.push(o);s||(n=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=(function(o){return function(){return e[o].apply(e,arguments)}})(i));for(var a=0;a<lf.length;a++)e.on(lf[a],this.emit.bind(this,lf[a]));return this._read=function(o){H("wrapped _read",o),n&&(n=!1,e.resume())},this};Object.defineProperty(ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});ie._fromList=uw;function uw(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.head.data:r=t.buffer.concat(t.length),t.buffer.clear()):r=WC(e,t.buffer,t.decoder),r}function WC(e,t,r){var n;return e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?n=t.shift():n=r?HC(e,t):JC(e,t),n}function HC(e,t){var r=t.head,n=1,i=r.data;for(e-=i.length;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),e-=o,e===0){o===a.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++n}return t.length-=n,i}function JC(e,t){var r=ca.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,o),e-=o,e===0){o===a.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++i}return t.length-=i,r}function pf(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,zn.nextTick(YC,t,e))}function YC(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function hw(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}});var mf=w((tB,ww)=>{"use strict";ww.exports=Kt;var cs=Hr(),yw=Object.create(Mn());yw.inherits=Vn();yw.inherits(Kt,cs);function ZC(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Kt(e){if(!(this instanceof Kt))return new Kt(e);cs.call(this,e),this._transformState={afterTransform:ZC.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",XC)}function XC(){var e=this;typeof this._flush=="function"?this._flush(function(t,r){gw(e,t,r)}):gw(this,null,null)}Kt.prototype.push=function(e,t){return this._transformState.needTransform=!1,cs.prototype.push.call(this,e,t)};Kt.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")};Kt.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};Kt.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Kt.prototype._destroy=function(e,t){var r=this;cs.prototype._destroy.call(this,e,function(n){t(n),r.emit("close")})};function gw(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}});var Ew=w((rB,vw)=>{"use strict";vw.exports=da;var _w=mf(),Iw=Object.create(Mn());Iw.inherits=Vn();Iw.inherits(da,_w);function da(e){if(!(this instanceof da))return new da(e);_w.call(this,e)}da.prototype._transform=function(e,t,r){r(null,e)}});var gf=w((Ae,ds)=>{var St=$t("stream");process.env.READABLE_STREAM==="disable"&&St?(ds.exports=St,Ae=ds.exports=St.Readable,Ae.Readable=St.Readable,Ae.Writable=St.Writable,Ae.Duplex=St.Duplex,Ae.Transform=St.Transform,Ae.PassThrough=St.PassThrough,Ae.Stream=St):(Ae=ds.exports=af(),Ae.Stream=St||Ae,Ae.Readable=Ae,Ae.Writable=tf(),Ae.Duplex=Hr(),Ae.Transform=mf(),Ae.PassThrough=Ew())});var Wt=w(Ke=>{"use strict";Ke.base64=!0;Ke.array=!0;Ke.string=!0;Ke.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";Ke.nodebuffer=typeof Buffer<"u";Ke.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")Ke.blob=!1;else{yf=new ArrayBuffer(0);try{Ke.blob=new Blob([yf],{type:"application/zip"}).size===0}catch{try{bw=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,wf=new bw,wf.append(yf),Ke.blob=wf.getBlob("application/zip").size===0}catch{Ke.blob=!1}}}var yf,bw,wf;try{Ke.nodestream=!!gf().Readable}catch{Ke.nodestream=!1}});var If=w(_f=>{"use strict";var QC=le(),ex=Wt(),Nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";_f.encode=function(e){for(var t=[],r,n,i,a,o,s,c,d=0,l=e.length,f=l,p=QC.getTypeOf(e)!=="string";d<e.length;)f=l-d,p?(r=e[d++],n=d<l?e[d++]:0,i=d<l?e[d++]:0):(r=e.charCodeAt(d++),n=d<l?e.charCodeAt(d++):0,i=d<l?e.charCodeAt(d++):0),a=r>>2,o=(r&3)<<4|n>>4,s=f>1?(n&15)<<2|i>>6:64,c=f>2?i&63:64,t.push(Nt.charAt(a)+Nt.charAt(o)+Nt.charAt(s)+Nt.charAt(c));return t.join("")};_f.decode=function(e){var t,r,n,i,a,o,s,c=0,d=0,l="data:";if(e.substr(0,l.length)===l)throw new Error("Invalid base64 input, it looks like a data url.");e=e.replace(/[^A-Za-z0-9+/=]/g,"");var f=e.length*3/4;if(e.charAt(e.length-1)===Nt.charAt(64)&&f--,e.charAt(e.length-2)===Nt.charAt(64)&&f--,f%1!==0)throw new Error("Invalid base64 input, bad content length.");var p;for(ex.uint8array?p=new Uint8Array(f|0):p=new Array(f|0);c<e.length;)i=Nt.indexOf(e.charAt(c++)),a=Nt.indexOf(e.charAt(c++)),o=Nt.indexOf(e.charAt(c++)),s=Nt.indexOf(e.charAt(c++)),t=i<<2|a>>4,r=(a&15)<<4|o>>2,n=(o&3)<<6|s,p[d++]=t,o!==64&&(p[d++]=r),s!==64&&(p[d++]=n);return p}});var la=w((aB,Aw)=>{"use strict";Aw.exports={isNode:typeof Buffer<"u",newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if(typeof e=="number")throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on=="function"&&typeof e.pause=="function"&&typeof e.resume=="function"}}});var Nw=w((oB,Sw)=>{"use strict";var Rw=global.MutationObserver||global.WebKitMutationObserver,Bn;process.browser?Rw?(vf=0,kw=new Rw(fa),Ef=global.document.createTextNode(""),kw.observe(Ef,{characterData:!0}),Bn=function(){Ef.data=vf=++vf%2}):!global.setImmediate&&typeof global.MessageChannel<"u"?(bf=new global.MessageChannel,bf.port1.onmessage=fa,Bn=function(){bf.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?Bn=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){fa(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:Bn=function(){setTimeout(fa,0)}:Bn=function(){process.nextTick(fa)};var vf,kw,Ef,bf,Af,pa=[];function fa(){Af=!0;for(var e,t,r=pa.length;r;){for(t=pa,pa=[],e=-1;++e<r;)t[e]();r=pa.length}Af=!1}Sw.exports=tx;function tx(e){pa.push(e)===1&&!Af&&Bn()}});var jw=w((sB,Tw)=>{"use strict";var Pw=Nw();function qn(){}var De={},Ow=["REJECTED"],Rf=["FULFILLED"],Dw=["PENDING"];process.browser||(ua=["UNHANDLED"]);var ua;Tw.exports=gr;function gr(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=Dw,this.queue=[],this.outcome=void 0,process.browser||(this.handled=ua),e!==qn&&Cw(this,e)}gr.prototype.finally=function(e){if(typeof e!="function")return this;var t=this.constructor;return this.then(r,n);function r(i){function a(){return i}return t.resolve(e()).then(a)}function n(i){function a(){throw i}return t.resolve(e()).then(a)}};gr.prototype.catch=function(e){return this.then(null,e)};gr.prototype.then=function(e,t){if(typeof e!="function"&&this.state===Rf||typeof t!="function"&&this.state===Ow)return this;var r=new this.constructor(qn);if(process.browser||this.handled===ua&&(this.handled=null),this.state!==Dw){var n=this.state===Rf?e:t;kf(r,n,this.outcome)}else this.queue.push(new ha(r,e,t));return r};function ha(e,t,r){this.promise=e,typeof t=="function"&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),typeof r=="function"&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}ha.prototype.callFulfilled=function(e){De.resolve(this.promise,e)};ha.prototype.otherCallFulfilled=function(e){kf(this.promise,this.onFulfilled,e)};ha.prototype.callRejected=function(e){De.reject(this.promise,e)};ha.prototype.otherCallRejected=function(e){kf(this.promise,this.onRejected,e)};function kf(e,t,r){Pw(function(){var n;try{n=t(r)}catch(i){return De.reject(e,i)}n===e?De.reject(e,new TypeError("Cannot resolve promise with itself")):De.resolve(e,n)})}De.resolve=function(e,t){var r=xw(rx,t);if(r.status==="error")return De.reject(e,r.value);var n=r.value;if(n)Cw(e,n);else{e.state=Rf,e.outcome=t;for(var i=-1,a=e.queue.length;++i<a;)e.queue[i].callFulfilled(t)}return e};De.reject=function(e,t){e.state=Ow,e.outcome=t,process.browser||e.handled===ua&&Pw(function(){e.handled===ua&&process.emit("unhandledRejection",t,e)});for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e};function rx(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function Cw(e,t){var r=!1;function n(s){r||(r=!0,De.reject(e,s))}function i(s){r||(r=!0,De.resolve(e,s))}function a(){t(i,n)}var o=xw(a);o.status==="error"&&n(o.value)}function xw(e,t){var r={};try{r.value=e(t),r.status="success"}catch(n){r.status="error",r.value=n}return r}gr.resolve=nx;function nx(e){return e instanceof this?e:De.resolve(new this(qn),e)}gr.reject=ix;function ix(e){var t=new this(qn);return De.reject(t,e)}gr.all=ax;function ax(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var i=new Array(r),a=0,o=-1,s=new this(qn);++o<r;)c(e[o],o);return s;function c(d,l){t.resolve(d).then(f,function(p){n||(n=!0,De.reject(s,p))});function f(p){i[l]=p,++a===r&&!n&&(n=!0,De.resolve(s,i))}}}gr.race=ox;function ox(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var i=-1,a=new this(qn);++i<r;)o(e[i]);return a;function o(s){t.resolve(s).then(function(c){n||(n=!0,De.resolve(a,c))},function(c){n||(n=!0,De.reject(a,c))})}}});var Gn=w((cB,Lw)=>{"use strict";var Sf=null;typeof Promise<"u"?Sf=Promise:Sf=jw();Lw.exports={Promise:Sf}});var Mw=w($w=>{(function(e,t){"use strict";if(e.setImmediate)return;var r=1,n={},i=!1,a=e.document,o;function s(_){typeof _!="function"&&(_=new Function(""+_));for(var b=new Array(arguments.length-1),E=0;E<b.length;E++)b[E]=arguments[E+1];var I={callback:_,args:b};return n[r]=I,o(r),r++}function c(_){delete n[_]}function d(_){var b=_.callback,E=_.args;switch(E.length){case 0:b();break;case 1:b(E[0]);break;case 2:b(E[0],E[1]);break;case 3:b(E[0],E[1],E[2]);break;default:b.apply(t,E);break}}function l(_){if(i)setTimeout(l,0,_);else{var b=n[_];if(b){i=!0;try{d(b)}finally{c(_),i=!1}}}}function f(){o=function(_){process.nextTick(function(){l(_)})}}function p(){if(e.postMessage&&!e.importScripts){var _=!0,b=e.onmessage;return e.onmessage=function(){_=!1},e.postMessage("","*"),e.onmessage=b,_}}function u(){var _="setImmediate$"+Math.random()+"$",b=function(E){E.source===e&&typeof E.data=="string"&&E.data.indexOf(_)===0&&l(+E.data.slice(_.length))};e.addEventListener?e.addEventListener("message",b,!1):e.attachEvent("onmessage",b),o=function(E){e.postMessage(_+E,"*")}}function h(){var _=new MessageChannel;_.port1.onmessage=function(b){var E=b.data;l(E)},o=function(b){_.port2.postMessage(b)}}function m(){var _=a.documentElement;o=function(b){var E=a.createElement("script");E.onreadystatechange=function(){l(b),E.onreadystatechange=null,_.removeChild(E),E=null},_.appendChild(E)}}function g(){o=function(_){setTimeout(l,0,_)}}var y=Object.getPrototypeOf&&Object.getPrototypeOf(e);y=y&&y.setTimeout?y:e,{}.toString.call(e.process)==="[object process]"?f():p()?u():e.MessageChannel?h():a&&"onreadystatechange"in a.createElement("script")?m():g(),y.setImmediate=s,y.clearImmediate=c})(typeof self>"u"?typeof global>"u"?$w:global:self)});var le=w(ye=>{"use strict";var yr=Wt(),sx=If(),Kn=la(),Nf=Gn();Mw();function cx(e){var t=null;return yr.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),fs(e,t)}ye.newBlob=function(e,t){ye.checkSupport("blob");try{return new Blob([e],{type:t})}catch{try{var r=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,n=new r;return n.append(e),n.getBlob(t)}catch{throw new Error("Bug : can't construct the Blob.")}}};function ma(e){return e}function fs(e,t){for(var r=0;r<e.length;++r)t[r]=e.charCodeAt(r)&255;return t}var ls={stringifyByChunk:function(e,t,r){var n=[],i=0,a=e.length;if(a<=r)return String.fromCharCode.apply(null,e);for(;i<a;)t==="array"||t==="nodebuffer"?n.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+r,a)))):n.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+r,a)))),i+=r;return n.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:(function(){try{return yr.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return yr.nodebuffer&&String.fromCharCode.apply(null,Kn.allocBuffer(1)).length===1}catch{return!1}})()}};function ga(e){var t=65536,r=ye.getTypeOf(e),n=!0;if(r==="uint8array"?n=ls.applyCanBeUsed.uint8array:r==="nodebuffer"&&(n=ls.applyCanBeUsed.nodebuffer),n)for(;t>1;)try{return ls.stringifyByChunk(e,r,t)}catch{t=Math.floor(t/2)}return ls.stringifyByChar(e)}ye.applyFromCharCode=ga;function ps(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}var wr={};wr.string={string:ma,array:function(e){return fs(e,new Array(e.length))},arraybuffer:function(e){return wr.string.uint8array(e).buffer},uint8array:function(e){return fs(e,new Uint8Array(e.length))},nodebuffer:function(e){return fs(e,Kn.allocBuffer(e.length))}};wr.array={string:ga,array:ma,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return Kn.newBufferFrom(e)}};wr.arraybuffer={string:function(e){return ga(new Uint8Array(e))},array:function(e){return ps(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:ma,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return Kn.newBufferFrom(new Uint8Array(e))}};wr.uint8array={string:ga,array:function(e){return ps(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:ma,nodebuffer:function(e){return Kn.newBufferFrom(e)}};wr.nodebuffer={string:ga,array:function(e){return ps(e,new Array(e.length))},arraybuffer:function(e){return wr.nodebuffer.uint8array(e).buffer},uint8array:function(e){return ps(e,new Uint8Array(e.length))},nodebuffer:ma};ye.transformTo=function(e,t){if(t||(t=""),!e)return t;ye.checkSupport(e);var r=ye.getTypeOf(t),n=wr[r][e](t);return n};ye.resolve=function(e){for(var t=e.split("/"),r=[],n=0;n<t.length;n++){var i=t[n];i==="."||i===""&&n!==0&&n!==t.length-1||(i===".."?r.pop():r.push(i))}return r.join("/")};ye.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(yr.nodebuffer&&Kn.isBuffer(e))return"nodebuffer";if(yr.uint8array&&e instanceof Uint8Array)return"uint8array";if(yr.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};ye.checkSupport=function(e){var t=yr[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};ye.MAX_VALUE_16BITS=65535;ye.MAX_VALUE_32BITS=-1;ye.pretty=function(e){var t="",r,n;for(n=0;n<(e||"").length;n++)r=e.charCodeAt(n),t+="\\x"+(r<16?"0":"")+r.toString(16).toUpperCase();return t};ye.delay=function(e,t,r){setImmediate(function(){e.apply(r||null,t||[])})};ye.inherits=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r};ye.extend=function(){var e={},t,r;for(t=0;t<arguments.length;t++)for(r in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],r)&&typeof e[r]>"u"&&(e[r]=arguments[t][r]);return e};ye.prepareContent=function(e,t,r,n,i){var a=Nf.Promise.resolve(t).then(function(o){var s=yr.blob&&(o instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(o))!==-1);return s&&typeof FileReader<"u"?new Nf.Promise(function(c,d){var l=new FileReader;l.onload=function(f){c(f.target.result)},l.onerror=function(f){d(f.target.error)},l.readAsArrayBuffer(o)}):o});return a.then(function(o){var s=ye.getTypeOf(o);return s?(s==="arraybuffer"?o=ye.transformTo("uint8array",o):s==="string"&&(i?o=sx.decode(o):r&&n!==!0&&(o=cx(o))),o):Nf.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var We=w((fB,Uw)=>{"use strict";function Vw(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}Vw.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return this.isFinished?!1:(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(r){t.processChunk(r)}),e.on("end",function(){t.end()}),e.on("error",function(r){t.error(r)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}};Uw.exports=Vw});var Hn=w(_r=>{"use strict";var Wn=le(),Jr=Wt(),dx=la(),us=We(),ya=new Array(256);for(Ht=0;Ht<256;Ht++)ya[Ht]=Ht>=252?6:Ht>=248?5:Ht>=240?4:Ht>=224?3:Ht>=192?2:1;var Ht;ya[254]=ya[254]=1;var lx=function(e){var t,r,n,i,a,o=e.length,s=0;for(i=0;i<o;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(Jr.uint8array?t=new Uint8Array(s):t=new Array(s),a=0,i=0;a<s;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[a++]=r:r<2048?(t[a++]=192|r>>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t},fx=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+ya[e[r]]>t?r:t},px=function(e){var t,r,n,i,a=e.length,o=new Array(a*2);for(r=0,t=0;t<a;){if(n=e[t++],n<128){o[r++]=n;continue}if(i=ya[n],i>4){o[r++]=65533,t+=i-1;continue}for(n&=i===2?31:i===3?15:7;i>1&&t<a;)n=n<<6|e[t++]&63,i--;if(i>1){o[r++]=65533;continue}n<65536?o[r++]=n:(n-=65536,o[r++]=55296|n>>10&1023,o[r++]=56320|n&1023)}return o.length!==r&&(o.subarray?o=o.subarray(0,r):o.length=r),Wn.applyFromCharCode(o)};_r.utf8encode=function(t){return Jr.nodebuffer?dx.newBufferFrom(t,"utf-8"):lx(t)};_r.utf8decode=function(t){return Jr.nodebuffer?Wn.transformTo("nodebuffer",t).toString("utf-8"):(t=Wn.transformTo(Jr.uint8array?"uint8array":"array",t),px(t))};function hs(){us.call(this,"utf-8 decode"),this.leftOver=null}Wn.inherits(hs,us);hs.prototype.processChunk=function(e){var t=Wn.transformTo(Jr.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(Jr.uint8array){var r=t;t=new Uint8Array(r.length+this.leftOver.length),t.set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var n=fx(t),i=t;n!==t.length&&(Jr.uint8array?(i=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(i=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:_r.utf8decode(i),meta:e.meta})};hs.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:_r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};_r.Utf8DecodeWorker=hs;function Pf(){us.call(this,"utf-8 encode")}Wn.inherits(Pf,us);Pf.prototype.processChunk=function(e){this.push({data:_r.utf8encode(e.data),meta:e.meta})};_r.Utf8EncodeWorker=Pf});var qw=w((uB,Bw)=>{"use strict";var Fw=We(),zw=le();function Of(e){Fw.call(this,"ConvertWorker to "+e),this.destType=e}zw.inherits(Of,Fw);Of.prototype.processChunk=function(e){this.push({data:zw.transformTo(this.destType,e.data),meta:e.meta})};Bw.exports=Of});var Ww=w((hB,Kw)=>{"use strict";var Gw=gf().Readable,ux=le();ux.inherits(Df,Gw);function Df(e,t,r){Gw.call(this,t),this._helper=e;var n=this;e.on("data",function(i,a){n.push(i)||n._helper.pause(),r&&r(a)}).on("error",function(i){n.emit("error",i)}).on("end",function(){n.push(null)})}Df.prototype._read=function(){this._helper.resume()};Kw.exports=Df});var Cf=w((mB,Yw)=>{"use strict";var Yr=le(),hx=qw(),mx=We(),gx=If(),yx=Wt(),wx=Gn(),Hw=null;if(yx.nodestream)try{Hw=Ww()}catch{}function _x(e,t,r){switch(e){case"blob":return Yr.newBlob(Yr.transformTo("arraybuffer",t),r);case"base64":return gx.encode(t);default:return Yr.transformTo(e,t)}}function Ix(e,t){var r,n=0,i=null,a=0;for(r=0;r<t.length;r++)a+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(i=new Uint8Array(a),r=0;r<t.length;r++)i.set(t[r],n),n+=t[r].length;return i;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}function vx(e,t){return new wx.Promise(function(r,n){var i=[],a=e._internalType,o=e._outputType,s=e._mimeType;e.on("data",function(c,d){i.push(c),t&&t(d)}).on("error",function(c){i=[],n(c)}).on("end",function(){try{var c=_x(o,Ix(a,i),s);r(c)}catch(d){n(d)}i=[]}).resume()})}function Jw(e,t,r){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string";break}try{this._internalType=n,this._outputType=t,this._mimeType=r,Yr.checkSupport(n),this._worker=e.pipe(new hx(n)),e.lock()}catch(i){this._worker=new mx("error"),this._worker.error(i)}}Jw.prototype={accumulate:function(e){return vx(this,e)},on:function(e,t){var r=this;return e==="data"?this._worker.on(e,function(n){t.call(r,n.data,n.meta)}):this._worker.on(e,function(){Yr.delay(t,arguments,r)}),this},resume:function(){return Yr.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(Yr.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new Hw(this,{objectMode:this._outputType!=="nodebuffer"},e)}};Yw.exports=Jw});var xf=w(ht=>{"use strict";ht.base64=!1;ht.binary=!1;ht.dir=!1;ht.createFolders=!0;ht.date=null;ht.compression=null;ht.compressionOptions=null;ht.comment=null;ht.unixPermissions=null;ht.dosPermissions=null});var Tf=w((yB,Zw)=>{"use strict";var ms=le(),gs=We(),Ex=16*1024;function Jn(e){gs.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(r){t.dataIsReady=!0,t.data=r,t.max=r&&r.length||0,t.type=ms.getTypeOf(r),t.isPaused||t._tickAndRepeat()},function(r){t.error(r)})}ms.inherits(Jn,gs);Jn.prototype.cleanUp=function(){gs.prototype.cleanUp.call(this),this.data=null};Jn.prototype.resume=function(){return gs.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,ms.delay(this._tickAndRepeat,[],this)),!0):!1};Jn.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(ms.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};Jn.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=Ex,t=null,r=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,r);break;case"uint8array":t=this.data.subarray(this.index,r);break;case"array":case"nodebuffer":t=this.data.slice(this.index,r);break}return this.index=r,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})};Zw.exports=Jn});var ys=w((wB,Qw)=>{"use strict";var bx=le();function Ax(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var Xw=Ax();function Rx(e,t,r,n){var i=Xw,a=n+r;e=e^-1;for(var o=n;o<a;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}function kx(e,t,r,n){var i=Xw,a=n+r;e=e^-1;for(var o=n;o<a;o++)e=e>>>8^i[(e^t.charCodeAt(o))&255];return e^-1}Qw.exports=function(t,r){if(typeof t>"u"||!t.length)return 0;var n=bx.getTypeOf(t)!=="string";return n?Rx(r|0,t,t.length,0):kx(r|0,t,t.length,0)}});var Lf=w((_B,t_)=>{"use strict";var e_=We(),Sx=ys(),Nx=le();function jf(){e_.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}Nx.inherits(jf,e_);jf.prototype.processChunk=function(e){this.streamInfo.crc32=Sx(e.data,this.streamInfo.crc32||0),this.push(e)};t_.exports=jf});var n_=w((IB,r_)=>{"use strict";var Px=le(),$f=We();function Mf(e){$f.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}Px.inherits(Mf,$f);Mf.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}$f.prototype.processChunk.call(this,e)};r_.exports=Mf});var ws=w((vB,o_)=>{"use strict";var i_=Gn(),a_=Tf(),Ox=Lf(),Vf=n_();function Uf(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}Uf.prototype={getContentWorker:function(){var e=new a_(i_.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Vf("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new a_(i_.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};Uf.createWorkerFrom=function(e,t,r){return e.pipe(new Ox).pipe(new Vf("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new Vf("compressedSize")).withStreamInfo("compression",t)};o_.exports=Uf});var l_=w((EB,d_)=>{"use strict";var Dx=Cf(),Cx=Tf(),Ff=Hn(),zf=ws(),s_=We(),Bf=function(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}};Bf.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");r=e.toLowerCase();var n=r==="string"||r==="text";(r==="binarystring"||r==="text")&&(r="string"),t=this._decompressWorker();var i=!this._dataBinary;i&&!n&&(t=t.pipe(new Ff.Utf8EncodeWorker)),!i&&n&&(t=t.pipe(new Ff.Utf8DecodeWorker))}catch(a){t=new s_("error"),t.error(a)}return new Dx(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof zf&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new Ff.Utf8EncodeWorker)),zf.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof zf?this._data.getContentWorker():this._data instanceof s_?this._data:new Cx(this._data)}};var c_=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],xx=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(_s=0;_s<c_.length;_s++)Bf.prototype[c_[_s]]=xx;var _s;d_.exports=Bf});var Jt=w(Te=>{"use strict";var Tx=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function jx(e,t){return Object.prototype.hasOwnProperty.call(e,t)}Te.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var n in r)jx(r,n)&&(e[n]=r[n])}}return e};Te.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var Lx={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+n),i);return}for(var a=0;a<n;a++)e[i+a]=t[r+a]},flattenChunks:function(e){var t,r,n,i,a,o;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(o=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)a=e[t],o.set(a,i),i+=a.length;return o}},$x={arraySet:function(e,t,r,n,i){for(var a=0;a<n;a++)e[i+a]=t[r+a]},flattenChunks:function(e){return[].concat.apply([],e)}};Te.setTyped=function(e){e?(Te.Buf8=Uint8Array,Te.Buf16=Uint16Array,Te.Buf32=Int32Array,Te.assign(Te,Lx)):(Te.Buf8=Array,Te.Buf16=Array,Te.Buf32=Array,Te.assign(Te,$x))};Te.setTyped(Tx)});var x_=w(Xn=>{"use strict";var Mx=Jt(),Vx=4,f_=0,p_=1,Ux=2;function Zn(e){for(var t=e.length;--t>=0;)e[t]=0}var Fx=0,w_=1,zx=2,Bx=3,qx=258,Yf=29,ba=256,_a=ba+1+Yf,Yn=30,Zf=19,__=2*_a+1,Zr=15,qf=16,Gx=7,Xf=256,I_=16,v_=17,E_=18,Hf=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Is=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Kx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],b_=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Wx=512,Yt=new Array((_a+2)*2);Zn(Yt);var wa=new Array(Yn*2);Zn(wa);var Ia=new Array(Wx);Zn(Ia);var va=new Array(qx-Bx+1);Zn(va);var Qf=new Array(Yf);Zn(Qf);var vs=new Array(Yn);Zn(vs);function Gf(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}var A_,R_,k_;function Kf(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function S_(e){return e<256?Ia[e]:Ia[256+(e>>>7)]}function Ea(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function ze(e,t,r){e.bi_valid>qf-r?(e.bi_buf|=t<<e.bi_valid&65535,Ea(e,e.bi_buf),e.bi_buf=t>>qf-e.bi_valid,e.bi_valid+=r-qf):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function Pt(e,t,r){ze(e,r[t*2],r[t*2+1])}function N_(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function Hx(e){e.bi_valid===16?(Ea(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function Jx(e,t){var r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,d,l,f,p,u,h,m=0;for(p=0;p<=Zr;p++)e.bl_count[p]=0;for(r[e.heap[e.heap_max]*2+1]=0,d=e.heap_max+1;d<__;d++)l=e.heap[d],p=r[r[l*2+1]*2+1]+1,p>c&&(p=c,m++),r[l*2+1]=p,!(l>n)&&(e.bl_count[p]++,u=0,l>=s&&(u=o[l-s]),h=r[l*2],e.opt_len+=h*(p+u),a&&(e.static_len+=h*(i[l*2+1]+u)));if(m!==0){do{for(p=c-1;e.bl_count[p]===0;)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[c]--,m-=2}while(m>0);for(p=c;p!==0;p--)for(l=e.bl_count[p];l!==0;)f=e.heap[--d],!(f>n)&&(r[f*2+1]!==p&&(e.opt_len+=(p-r[f*2+1])*r[f*2],r[f*2+1]=p),l--)}}function P_(e,t,r){var n=new Array(Zr+1),i=0,a,o;for(a=1;a<=Zr;a++)n[a]=i=i+r[a-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=N_(n[s]++,s))}}function Yx(){var e,t,r,n,i,a=new Array(Zr+1);for(r=0,n=0;n<Yf-1;n++)for(Qf[n]=r,e=0;e<1<<Hf[n];e++)va[r++]=n;for(va[r-1]=n,i=0,n=0;n<16;n++)for(vs[n]=i,e=0;e<1<<Is[n];e++)Ia[i++]=n;for(i>>=7;n<Yn;n++)for(vs[n]=i<<7,e=0;e<1<<Is[n]-7;e++)Ia[256+i++]=n;for(t=0;t<=Zr;t++)a[t]=0;for(e=0;e<=143;)Yt[e*2+1]=8,e++,a[8]++;for(;e<=255;)Yt[e*2+1]=9,e++,a[9]++;for(;e<=279;)Yt[e*2+1]=7,e++,a[7]++;for(;e<=287;)Yt[e*2+1]=8,e++,a[8]++;for(P_(Yt,_a+1,a),e=0;e<Yn;e++)wa[e*2+1]=5,wa[e*2]=N_(e,5);A_=new Gf(Yt,Hf,ba+1,_a,Zr),R_=new Gf(wa,Is,0,Yn,Zr),k_=new Gf(new Array(0),Kx,0,Zf,Gx)}function O_(e){var t;for(t=0;t<_a;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Yn;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Zf;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Xf*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function D_(e){e.bi_valid>8?Ea(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Zx(e,t,r,n){D_(e),n&&(Ea(e,r),Ea(e,~r)),Mx.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function u_(e,t,r,n){var i=t*2,a=r*2;return e[i]<e[a]||e[i]===e[a]&&n[t]<=n[r]}function Wf(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&u_(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!u_(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function h_(e,t,r){var n,i,a=0,o,s;if(e.last_lit!==0)do n=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1],i=e.pending_buf[e.l_buf+a],a++,n===0?Pt(e,i,t):(o=va[i],Pt(e,o+ba+1,t),s=Hf[o],s!==0&&(i-=Qf[o],ze(e,i,s)),n--,o=S_(n),Pt(e,o,r),s=Is[o],s!==0&&(n-=vs[o],ze(e,n,s)));while(a<e.last_lit);Pt(e,Xf,t)}function Jf(e,t){var r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,c=-1,d;for(e.heap_len=0,e.heap_max=__,o=0;o<a;o++)r[o*2]!==0?(e.heap[++e.heap_len]=c=o,e.depth[o]=0):r[o*2+1]=0;for(;e.heap_len<2;)d=e.heap[++e.heap_len]=c<2?++c:0,r[d*2]=1,e.depth[d]=0,e.opt_len--,i&&(e.static_len-=n[d*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)Wf(e,r,o);d=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Wf(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,r[d*2]=r[o*2]+r[s*2],e.depth[d]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,r[o*2+1]=r[s*2+1]=d,e.heap[1]=d++,Wf(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Jx(e,t),P_(r,c,e.bl_count)}function m_(e,t,r){var n,i=-1,a,o=t[1],s=0,c=7,d=4;for(o===0&&(c=138,d=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)a=o,o=t[(n+1)*2+1],!(++s<c&&a===o)&&(s<d?e.bl_tree[a*2]+=s:a!==0?(a!==i&&e.bl_tree[a*2]++,e.bl_tree[I_*2]++):s<=10?e.bl_tree[v_*2]++:e.bl_tree[E_*2]++,s=0,i=a,o===0?(c=138,d=3):a===o?(c=6,d=3):(c=7,d=4))}function g_(e,t,r){var n,i=-1,a,o=t[1],s=0,c=7,d=4;for(o===0&&(c=138,d=3),n=0;n<=r;n++)if(a=o,o=t[(n+1)*2+1],!(++s<c&&a===o)){if(s<d)do Pt(e,a,e.bl_tree);while(--s!==0);else a!==0?(a!==i&&(Pt(e,a,e.bl_tree),s--),Pt(e,I_,e.bl_tree),ze(e,s-3,2)):s<=10?(Pt(e,v_,e.bl_tree),ze(e,s-3,3)):(Pt(e,E_,e.bl_tree),ze(e,s-11,7));s=0,i=a,o===0?(c=138,d=3):a===o?(c=6,d=3):(c=7,d=4)}}function Xx(e){var t;for(m_(e,e.dyn_ltree,e.l_desc.max_code),m_(e,e.dyn_dtree,e.d_desc.max_code),Jf(e,e.bl_desc),t=Zf-1;t>=3&&e.bl_tree[b_[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function Qx(e,t,r,n){var i;for(ze(e,t-257,5),ze(e,r-1,5),ze(e,n-4,4),i=0;i<n;i++)ze(e,e.bl_tree[b_[i]*2+1],3);g_(e,e.dyn_ltree,t-1),g_(e,e.dyn_dtree,r-1)}function eT(e){var t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return f_;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return p_;for(r=32;r<ba;r++)if(e.dyn_ltree[r*2]!==0)return p_;return f_}var y_=!1;function tT(e){y_||(Yx(),y_=!0),e.l_desc=new Kf(e.dyn_ltree,A_),e.d_desc=new Kf(e.dyn_dtree,R_),e.bl_desc=new Kf(e.bl_tree,k_),e.bi_buf=0,e.bi_valid=0,O_(e)}function C_(e,t,r,n){ze(e,(Fx<<1)+(n?1:0),3),Zx(e,t,r,!0)}function rT(e){ze(e,w_<<1,3),Pt(e,Xf,Yt),Hx(e)}function nT(e,t,r,n){var i,a,o=0;e.level>0?(e.strm.data_type===Ux&&(e.strm.data_type=eT(e)),Jf(e,e.l_desc),Jf(e,e.d_desc),o=Xx(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&t!==-1?C_(e,t,r,n):e.strategy===Vx||a===i?(ze(e,(w_<<1)+(n?1:0),3),h_(e,Yt,wa)):(ze(e,(zx<<1)+(n?1:0),3),Qx(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),h_(e,e.dyn_ltree,e.dyn_dtree)),O_(e),n&&D_(e)}function iT(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(va[r]+ba+1)*2]++,e.dyn_dtree[S_(t)*2]++),e.last_lit===e.lit_bufsize-1}Xn._tr_init=tT;Xn._tr_stored_block=C_;Xn._tr_flush_block=nT;Xn._tr_tally=iT;Xn._tr_align=rT});var ep=w((RB,T_)=>{"use strict";function aT(e,t,r,n){for(var i=e&65535|0,a=e>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+t[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0}T_.exports=aT});var tp=w((kB,j_)=>{"use strict";function oT(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var sT=oT();function cT(e,t,r,n){var i=sT,a=n+r;e^=-1;for(var o=n;o<a;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}j_.exports=cT});var Es=w((SB,L_)=>{"use strict";L_.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var G_=w(Ct=>{"use strict";var je=Jt(),at=x_(),U_=ep(),Ir=tp(),dT=Es(),tn=0,lT=1,fT=3,Rr=4,$_=5,Dt=0,M_=1,ot=-2,pT=-3,rp=-5,uT=-1,hT=1,bs=2,mT=3,gT=4,yT=0,wT=2,Ss=8,_T=9,IT=15,vT=8,ET=29,bT=256,ip=bT+1+ET,AT=30,RT=19,kT=2*ip+1,ST=15,F=3,br=258,mt=br+F+1,NT=32,Ns=42,ap=69,As=73,Rs=91,ks=103,Xr=113,Ra=666,we=1,ka=2,Qr=3,ti=4,PT=3;function Ar(e,t){return e.msg=dT[t],t}function V_(e){return(e<<1)-(e>4?9:0)}function Er(e){for(var t=e.length;--t>=0;)e[t]=0}function vr(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(je.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function Re(e,t){at._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,vr(e.strm)}function W(e,t){e.pending_buf[e.pending++]=t}function Aa(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function OT(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,je.arraySet(t,e.input,e.next_in,i,r),e.state.wrap===1?e.adler=U_(e.adler,t,i,r):e.state.wrap===2&&(e.adler=Ir(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function F_(e,t){var r=e.max_chain_length,n=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-mt?e.strstart-(e.w_size-mt):0,d=e.window,l=e.w_mask,f=e.prev,p=e.strstart+br,u=d[n+o-1],h=d[n+o];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(d[i+o]!==h||d[i+o-1]!==u||d[i]!==d[n]||d[++i]!==d[n+1])){n+=2,i++;do;while(d[++n]===d[++i]&&d[++n]===d[++i]&&d[++n]===d[++i]&&d[++n]===d[++i]&&d[++n]===d[++i]&&d[++n]===d[++i]&&d[++n]===d[++i]&&d[++n]===d[++i]&&n<p);if(a=br-(p-n),n=p-br,a>o){if(e.match_start=t,o=a,a>=s)break;u=d[n+o-1],h=d[n+o]}}while((t=f[t&l])>c&&--r!==0);return o<=e.lookahead?o:e.lookahead}function en(e){var t=e.w_size,r,n,i,a,o;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-mt)){je.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,r=n;do i=e.head[--r],e.head[r]=i>=t?i-t:0;while(--n);n=t,r=n;do i=e.prev[--r],e.prev[r]=i>=t?i-t:0;while(--n);a+=t}if(e.strm.avail_in===0)break;if(n=OT(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=n,e.lookahead+e.insert>=F)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+F-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<F)););}while(e.lookahead<mt&&e.strm.avail_in!==0)}function DT(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(en(e),e.lookahead===0&&t===tn)return we;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,Re(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-mt&&(Re(e,!1),e.strm.avail_out===0))return we}return e.insert=0,t===Rr?(Re(e,!0),e.strm.avail_out===0?Qr:ti):(e.strstart>e.block_start&&(Re(e,!1),e.strm.avail_out===0),we)}function np(e,t){for(var r,n;;){if(e.lookahead<mt){if(en(e),e.lookahead<mt&&t===tn)return we;if(e.lookahead===0)break}if(r=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-mt&&(e.match_length=F_(e,r)),e.match_length>=F)if(n=at._tr_tally(e,e.strstart-e.match_start,e.match_length-F),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=F){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=at._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Re(e,!1),e.strm.avail_out===0))return we}return e.insert=e.strstart<F-1?e.strstart:F-1,t===Rr?(Re(e,!0),e.strm.avail_out===0?Qr:ti):e.last_lit&&(Re(e,!1),e.strm.avail_out===0)?we:ka}function Qn(e,t){for(var r,n,i;;){if(e.lookahead<mt){if(en(e),e.lookahead<mt&&t===tn)return we;if(e.lookahead===0)break}if(r=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=F-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-mt&&(e.match_length=F_(e,r),e.match_length<=5&&(e.strategy===hT||e.match_length===F&&e.strstart-e.match_start>4096)&&(e.match_length=F-1)),e.prev_length>=F&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-F,n=at._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-F),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=F-1,e.strstart++,n&&(Re(e,!1),e.strm.avail_out===0))return we}else if(e.match_available){if(n=at._tr_tally(e,0,e.window[e.strstart-1]),n&&Re(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return we}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=at._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<F-1?e.strstart:F-1,t===Rr?(Re(e,!0),e.strm.avail_out===0?Qr:ti):e.last_lit&&(Re(e,!1),e.strm.avail_out===0)?we:ka}function CT(e,t){for(var r,n,i,a,o=e.window;;){if(e.lookahead<=br){if(en(e),e.lookahead<=br&&t===tn)return we;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=F&&e.strstart>0&&(i=e.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=e.strstart+br;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&i<a);e.match_length=br-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=F?(r=at._tr_tally(e,1,e.match_length-F),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=at._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Re(e,!1),e.strm.avail_out===0))return we}return e.insert=0,t===Rr?(Re(e,!0),e.strm.avail_out===0?Qr:ti):e.last_lit&&(Re(e,!1),e.strm.avail_out===0)?we:ka}function xT(e,t){for(var r;;){if(e.lookahead===0&&(en(e),e.lookahead===0)){if(t===tn)return we;break}if(e.match_length=0,r=at._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Re(e,!1),e.strm.avail_out===0))return we}return e.insert=0,t===Rr?(Re(e,!0),e.strm.avail_out===0?Qr:ti):e.last_lit&&(Re(e,!1),e.strm.avail_out===0)?we:ka}function Ot(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}var ei;ei=[new Ot(0,0,0,0,DT),new Ot(4,4,8,4,np),new Ot(4,5,16,8,np),new Ot(4,6,32,32,np),new Ot(4,4,16,16,Qn),new Ot(8,16,32,32,Qn),new Ot(8,16,128,128,Qn),new Ot(8,32,128,256,Qn),new Ot(32,128,258,1024,Qn),new Ot(32,258,258,4096,Qn)];function TT(e){e.window_size=2*e.w_size,Er(e.head),e.max_lazy_match=ei[e.level].max_lazy,e.good_match=ei[e.level].good_length,e.nice_match=ei[e.level].nice_length,e.max_chain_length=ei[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=F-1,e.match_available=0,e.ins_h=0}function jT(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ss,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new je.Buf16(kT*2),this.dyn_dtree=new je.Buf16((2*AT+1)*2),this.bl_tree=new je.Buf16((2*RT+1)*2),Er(this.dyn_ltree),Er(this.dyn_dtree),Er(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new je.Buf16(ST+1),this.heap=new je.Buf16(2*ip+1),Er(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new je.Buf16(2*ip+1),Er(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function z_(e){var t;return!e||!e.state?Ar(e,ot):(e.total_in=e.total_out=0,e.data_type=wT,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Ns:Xr,e.adler=t.wrap===2?0:1,t.last_flush=tn,at._tr_init(t),Dt)}function B_(e){var t=z_(e);return t===Dt&&TT(e.state),t}function LT(e,t){return!e||!e.state||e.state.wrap!==2?ot:(e.state.gzhead=t,Dt)}function q_(e,t,r,n,i,a){if(!e)return ot;var o=1;if(t===uT&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>_T||r!==Ss||n<8||n>15||t<0||t>9||a<0||a>gT)return Ar(e,ot);n===8&&(n=9);var s=new jT;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+F-1)/F),s.window=new je.Buf8(s.w_size*2),s.head=new je.Buf16(s.hash_size),s.prev=new je.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new je.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=r,B_(e)}function $T(e,t){return q_(e,t,Ss,IT,vT,yT)}function MT(e,t){var r,n,i,a;if(!e||!e.state||t>$_||t<0)return e?Ar(e,ot):ot;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===Ra&&t!==Rr)return Ar(e,e.avail_out===0?rp:ot);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===Ns)if(n.wrap===2)e.adler=0,W(n,31),W(n,139),W(n,8),n.gzhead?(W(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),W(n,n.gzhead.time&255),W(n,n.gzhead.time>>8&255),W(n,n.gzhead.time>>16&255),W(n,n.gzhead.time>>24&255),W(n,n.level===9?2:n.strategy>=bs||n.level<2?4:0),W(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(W(n,n.gzhead.extra.length&255),W(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Ir(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ap):(W(n,0),W(n,0),W(n,0),W(n,0),W(n,0),W(n,n.level===9?2:n.strategy>=bs||n.level<2?4:0),W(n,PT),n.status=Xr);else{var o=Ss+(n.w_bits-8<<4)<<8,s=-1;n.strategy>=bs||n.level<2?s=0:n.level<6?s=1:n.level===6?s=2:s=3,o|=s<<6,n.strstart!==0&&(o|=NT),o+=31-o%31,n.status=Xr,Aa(n,o),n.strstart!==0&&(Aa(n,e.adler>>>16),Aa(n,e.adler&65535)),e.adler=1}if(n.status===ap)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-i,i)),vr(e),i=n.pending,n.pending===n.pending_buf_size));)W(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=As)}else n.status=As;if(n.status===As)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-i,i)),vr(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.name.length?a=n.gzhead.name.charCodeAt(n.gzindex++)&255:a=0,W(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.gzindex=0,n.status=Rs)}else n.status=Rs;if(n.status===Rs)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-i,i)),vr(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.comment.length?a=n.gzhead.comment.charCodeAt(n.gzindex++)&255:a=0,W(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.status=ks)}else n.status=ks;if(n.status===ks&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&vr(e),n.pending+2<=n.pending_buf_size&&(W(n,e.adler&255),W(n,e.adler>>8&255),e.adler=0,n.status=Xr)):n.status=Xr),n.pending!==0){if(vr(e),e.avail_out===0)return n.last_flush=-1,Dt}else if(e.avail_in===0&&V_(t)<=V_(r)&&t!==Rr)return Ar(e,rp);if(n.status===Ra&&e.avail_in!==0)return Ar(e,rp);if(e.avail_in!==0||n.lookahead!==0||t!==tn&&n.status!==Ra){var c=n.strategy===bs?xT(n,t):n.strategy===mT?CT(n,t):ei[n.level].func(n,t);if((c===Qr||c===ti)&&(n.status=Ra),c===we||c===Qr)return e.avail_out===0&&(n.last_flush=-1),Dt;if(c===ka&&(t===lT?at._tr_align(n):t!==$_&&(at._tr_stored_block(n,0,0,!1),t===fT&&(Er(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),vr(e),e.avail_out===0))return n.last_flush=-1,Dt}return t!==Rr?Dt:n.wrap<=0?M_:(n.wrap===2?(W(n,e.adler&255),W(n,e.adler>>8&255),W(n,e.adler>>16&255),W(n,e.adler>>24&255),W(n,e.total_in&255),W(n,e.total_in>>8&255),W(n,e.total_in>>16&255),W(n,e.total_in>>24&255)):(Aa(n,e.adler>>>16),Aa(n,e.adler&65535)),vr(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Dt:M_)}function VT(e){var t;return!e||!e.state?ot:(t=e.state.status,t!==Ns&&t!==ap&&t!==As&&t!==Rs&&t!==ks&&t!==Xr&&t!==Ra?Ar(e,ot):(e.state=null,t===Xr?Ar(e,pT):Dt))}function UT(e,t){var r=t.length,n,i,a,o,s,c,d,l;if(!e||!e.state||(n=e.state,o=n.wrap,o===2||o===1&&n.status!==Ns||n.lookahead))return ot;for(o===1&&(e.adler=U_(e.adler,t,r,0)),n.wrap=0,r>=n.w_size&&(o===0&&(Er(n.head),n.strstart=0,n.block_start=0,n.insert=0),l=new je.Buf8(n.w_size),je.arraySet(l,t,r-n.w_size,n.w_size,0),t=l,r=n.w_size),s=e.avail_in,c=e.next_in,d=e.input,e.avail_in=r,e.next_in=0,e.input=t,en(n);n.lookahead>=F;){i=n.strstart,a=n.lookahead-(F-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+F-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++;while(--a);n.strstart=i,n.lookahead=F-1,en(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=F-1,n.match_available=0,e.next_in=c,e.input=d,e.avail_in=s,n.wrap=o,Dt}Ct.deflateInit=$T;Ct.deflateInit2=q_;Ct.deflateReset=B_;Ct.deflateResetKeep=z_;Ct.deflateSetHeader=LT;Ct.deflate=MT;Ct.deflateEnd=VT;Ct.deflateSetDictionary=UT;Ct.deflateInfo="pako deflate (from Nodeca project)"});var op=w(ri=>{"use strict";var Ps=Jt(),K_=!0,W_=!0;try{String.fromCharCode.apply(null,[0])}catch{K_=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{W_=!1}var Sa=new Ps.Buf8(256);for(Zt=0;Zt<256;Zt++)Sa[Zt]=Zt>=252?6:Zt>=248?5:Zt>=240?4:Zt>=224?3:Zt>=192?2:1;var Zt;Sa[254]=Sa[254]=1;ri.string2buf=function(e){var t,r,n,i,a,o=e.length,s=0;for(i=0;i<o;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Ps.Buf8(s),a=0,i=0;a<s;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[a++]=r:r<2048?(t[a++]=192|r>>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t};function H_(e,t){if(t<65534&&(e.subarray&&W_||!e.subarray&&K_))return String.fromCharCode.apply(null,Ps.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}ri.buf2binstring=function(e){return H_(e,e.length)};ri.binstring2buf=function(e){for(var t=new Ps.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t};ri.buf2string=function(e,t){var r,n,i,a,o=t||e.length,s=new Array(o*2);for(n=0,r=0;r<o;){if(i=e[r++],i<128){s[n++]=i;continue}if(a=Sa[i],a>4){s[n++]=65533,r+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&r<o;)i=i<<6|e[r++]&63,a--;if(a>1){s[n++]=65533;continue}i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|i&1023)}return H_(s,n)};ri.utf8border=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+Sa[e[r]]>t?r:t}});var sp=w((OB,J_)=>{"use strict";function FT(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}J_.exports=FT});var Q_=w(Oa=>{"use strict";var Na=G_(),Pa=Jt(),dp=op(),lp=Es(),zT=sp(),X_=Object.prototype.toString,BT=0,cp=4,ni=0,Y_=1,Z_=2,qT=-1,GT=0,KT=8;function rn(e){if(!(this instanceof rn))return new rn(e);this.options=Pa.assign({level:qT,method:KT,chunkSize:16384,windowBits:15,memLevel:8,strategy:GT,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zT,this.strm.avail_out=0;var r=Na.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==ni)throw new Error(lp[r]);if(t.header&&Na.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=dp.string2buf(t.dictionary):X_.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,r=Na.deflateSetDictionary(this.strm,n),r!==ni)throw new Error(lp[r]);this._dict_set=!0}}rn.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;a=t===~~t?t:t===!0?cp:BT,typeof e=="string"?r.input=dp.string2buf(e):X_.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Pa.Buf8(n),r.next_out=0,r.avail_out=n),i=Na.deflate(r,a),i!==Y_&&i!==ni)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(a===cp||a===Z_))&&(this.options.to==="string"?this.onData(dp.buf2binstring(Pa.shrinkBuf(r.output,r.next_out))):this.onData(Pa.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==Y_);return a===cp?(i=Na.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ni):(a===Z_&&(this.onEnd(ni),r.avail_out=0),!0)};rn.prototype.onData=function(e){this.chunks.push(e)};rn.prototype.onEnd=function(e){e===ni&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Pa.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function fp(e,t){var r=new rn(t);if(r.push(e,!0),r.err)throw r.msg||lp[r.err];return r.result}function WT(e,t){return t=t||{},t.raw=!0,fp(e,t)}function HT(e,t){return t=t||{},t.gzip=!0,fp(e,t)}Oa.Deflate=rn;Oa.deflate=fp;Oa.deflateRaw=WT;Oa.gzip=HT});var tI=w((CB,eI)=>{"use strict";var Os=30,JT=12;eI.exports=function(t,r){var n,i,a,o,s,c,d,l,f,p,u,h,m,g,y,_,b,E,I,S,R,P,x,B,k;n=t.state,i=t.next_in,B=t.input,a=i+(t.avail_in-5),o=t.next_out,k=t.output,s=o-(r-t.avail_out),c=o+(t.avail_out-257),d=n.dmax,l=n.wsize,f=n.whave,p=n.wnext,u=n.window,h=n.hold,m=n.bits,g=n.lencode,y=n.distcode,_=(1<<n.lenbits)-1,b=(1<<n.distbits)-1;e:do{m<15&&(h+=B[i++]<<m,m+=8,h+=B[i++]<<m,m+=8),E=g[h&_];t:for(;;){if(I=E>>>24,h>>>=I,m-=I,I=E>>>16&255,I===0)k[o++]=E&65535;else if(I&16){S=E&65535,I&=15,I&&(m<I&&(h+=B[i++]<<m,m+=8),S+=h&(1<<I)-1,h>>>=I,m-=I),m<15&&(h+=B[i++]<<m,m+=8,h+=B[i++]<<m,m+=8),E=y[h&b];r:for(;;){if(I=E>>>24,h>>>=I,m-=I,I=E>>>16&255,I&16){if(R=E&65535,I&=15,m<I&&(h+=B[i++]<<m,m+=8,m<I&&(h+=B[i++]<<m,m+=8)),R+=h&(1<<I)-1,R>d){t.msg="invalid distance too far back",n.mode=Os;break e}if(h>>>=I,m-=I,I=o-s,R>I){if(I=R-I,I>f&&n.sane){t.msg="invalid distance too far back",n.mode=Os;break e}if(P=0,x=u,p===0){if(P+=l-I,I<S){S-=I;do k[o++]=u[P++];while(--I);P=o-R,x=k}}else if(p<I){if(P+=l+p-I,I-=p,I<S){S-=I;do k[o++]=u[P++];while(--I);if(P=0,p<S){I=p,S-=I;do k[o++]=u[P++];while(--I);P=o-R,x=k}}}else if(P+=p-I,I<S){S-=I;do k[o++]=u[P++];while(--I);P=o-R,x=k}for(;S>2;)k[o++]=x[P++],k[o++]=x[P++],k[o++]=x[P++],S-=3;S&&(k[o++]=x[P++],S>1&&(k[o++]=x[P++]))}else{P=o-R;do k[o++]=k[P++],k[o++]=k[P++],k[o++]=k[P++],S-=3;while(S>2);S&&(k[o++]=k[P++],S>1&&(k[o++]=k[P++]))}}else if((I&64)===0){E=y[(E&65535)+(h&(1<<I)-1)];continue r}else{t.msg="invalid distance code",n.mode=Os;break e}break}}else if((I&64)===0){E=g[(E&65535)+(h&(1<<I)-1)];continue t}else if(I&32){n.mode=JT;break e}else{t.msg="invalid literal/length code",n.mode=Os;break e}break}}while(i<a&&o<c);S=m>>3,i-=S,m-=S<<3,h&=(1<<m)-1,t.next_in=i,t.next_out=o,t.avail_in=i<a?5+(a-i):5-(i-a),t.avail_out=o<c?257+(c-o):257-(o-c),n.hold=h,n.bits=m}});var cI=w((xB,sI)=>{"use strict";var rI=Jt(),ii=15,nI=852,iI=592,aI=0,pp=1,oI=2,YT=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],ZT=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],XT=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],QT=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];sI.exports=function(t,r,n,i,a,o,s,c){var d=c.bits,l=0,f=0,p=0,u=0,h=0,m=0,g=0,y=0,_=0,b=0,E,I,S,R,P,x=null,B=0,k,he=new rI.Buf16(ii+1),Lt=new rI.Buf16(ii+1),dn=null,du=0,lu,Wa,Ha;for(l=0;l<=ii;l++)he[l]=0;for(f=0;f<i;f++)he[r[n+f]]++;for(h=d,u=ii;u>=1&&he[u]===0;u--);if(h>u&&(h=u),u===0)return a[o++]=1<<24|64<<16|0,a[o++]=1<<24|64<<16|0,c.bits=1,0;for(p=1;p<u&&he[p]===0;p++);for(h<p&&(h=p),y=1,l=1;l<=ii;l++)if(y<<=1,y-=he[l],y<0)return-1;if(y>0&&(t===aI||u!==1))return-1;for(Lt[1]=0,l=1;l<ii;l++)Lt[l+1]=Lt[l]+he[l];for(f=0;f<i;f++)r[n+f]!==0&&(s[Lt[r[n+f]]++]=f);if(t===aI?(x=dn=s,k=19):t===pp?(x=YT,B-=257,dn=ZT,du-=257,k=256):(x=XT,dn=QT,k=-1),b=0,f=0,l=p,P=o,m=h,g=0,S=-1,_=1<<h,R=_-1,t===pp&&_>nI||t===oI&&_>iI)return 1;for(;;){lu=l-g,s[f]<k?(Wa=0,Ha=s[f]):s[f]>k?(Wa=dn[du+s[f]],Ha=x[B+s[f]]):(Wa=96,Ha=0),E=1<<l-g,I=1<<m,p=I;do I-=E,a[P+(b>>g)+I]=lu<<24|Wa<<16|Ha|0;while(I!==0);for(E=1<<l-1;b&E;)E>>=1;if(E!==0?(b&=E-1,b+=E):b=0,f++,--he[l]===0){if(l===u)break;l=r[n+s[f]]}if(l>h&&(b&R)!==S){for(g===0&&(g=h),P+=p,m=l-g,y=1<<m;m+g<u&&(y-=he[m+g],!(y<=0));)m++,y<<=1;if(_+=1<<m,t===pp&&_>nI||t===oI&&_>iI)return 1;S=b&R,a[S]=h<<24|m<<16|P-o|0}}return b!==0&&(a[P+b]=l-g<<24|64<<16|0),c.bits=h,0}});var BI=w(gt=>{"use strict";var He=Jt(),wp=ep(),xt=tp(),e1=tI(),Da=cI(),t1=0,TI=1,jI=2,dI=4,r1=5,Ds=6,nn=0,n1=1,i1=2,st=-2,LI=-3,_p=-4,a1=-5,lI=8,$I=1,fI=2,pI=3,uI=4,hI=5,mI=6,gI=7,yI=8,wI=9,_I=10,Ts=11,Xt=12,up=13,II=14,hp=15,vI=16,EI=17,bI=18,AI=19,Cs=20,xs=21,RI=22,kI=23,SI=24,NI=25,PI=26,mp=27,OI=28,DI=29,ce=30,Ip=31,o1=32,s1=852,c1=592,d1=15,l1=d1;function CI(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function f1(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new He.Buf16(320),this.work=new He.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function MI(e){var t;return!e||!e.state?st:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=$I,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new He.Buf32(s1),t.distcode=t.distdyn=new He.Buf32(c1),t.sane=1,t.back=-1,nn)}function VI(e){var t;return!e||!e.state?st:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,MI(e))}function UI(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?st:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,VI(e))}function FI(e,t){var r,n;return e?(n=new f1,e.state=n,n.window=null,r=UI(e,t),r!==nn&&(e.state=null),r):st}function p1(e){return FI(e,l1)}var xI=!0,gp,yp;function u1(e){if(xI){var t;for(gp=new He.Buf32(512),yp=new He.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Da(TI,e.lens,0,288,gp,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Da(jI,e.lens,0,32,yp,0,e.work,{bits:5}),xI=!1}e.lencode=gp,e.lenbits=9,e.distcode=yp,e.distbits=5}function zI(e,t,r,n){var i,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new He.Buf8(a.wsize)),n>=a.wsize?(He.arraySet(a.window,t,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),He.arraySet(a.window,t,r-n,i,a.wnext),n-=i,n?(He.arraySet(a.window,t,r-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0}function h1(e,t){var r,n,i,a,o,s,c,d,l,f,p,u,h,m,g=0,y,_,b,E,I,S,R,P,x=new He.Buf8(4),B,k,he=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return st;r=e.state,r.mode===Xt&&(r.mode=up),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,d=r.hold,l=r.bits,f=s,p=c,P=nn;e:for(;;)switch(r.mode){case $I:if(r.wrap===0){r.mode=up;break}for(;l<16;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}if(r.wrap&2&&d===35615){r.check=0,x[0]=d&255,x[1]=d>>>8&255,r.check=xt(r.check,x,2,0),d=0,l=0,r.mode=fI;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((d&255)<<8)+(d>>8))%31){e.msg="incorrect header check",r.mode=ce;break}if((d&15)!==lI){e.msg="unknown compression method",r.mode=ce;break}if(d>>>=4,l-=4,R=(d&15)+8,r.wbits===0)r.wbits=R;else if(R>r.wbits){e.msg="invalid window size",r.mode=ce;break}r.dmax=1<<R,e.adler=r.check=1,r.mode=d&512?_I:Xt,d=0,l=0;break;case fI:for(;l<16;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}if(r.flags=d,(r.flags&255)!==lI){e.msg="unknown compression method",r.mode=ce;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=ce;break}r.head&&(r.head.text=d>>8&1),r.flags&512&&(x[0]=d&255,x[1]=d>>>8&255,r.check=xt(r.check,x,2,0)),d=0,l=0,r.mode=pI;case pI:for(;l<32;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}r.head&&(r.head.time=d),r.flags&512&&(x[0]=d&255,x[1]=d>>>8&255,x[2]=d>>>16&255,x[3]=d>>>24&255,r.check=xt(r.check,x,4,0)),d=0,l=0,r.mode=uI;case uI:for(;l<16;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}r.head&&(r.head.xflags=d&255,r.head.os=d>>8),r.flags&512&&(x[0]=d&255,x[1]=d>>>8&255,r.check=xt(r.check,x,2,0)),d=0,l=0,r.mode=hI;case hI:if(r.flags&1024){for(;l<16;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}r.length=d,r.head&&(r.head.extra_len=d),r.flags&512&&(x[0]=d&255,x[1]=d>>>8&255,r.check=xt(r.check,x,2,0)),d=0,l=0}else r.head&&(r.head.extra=null);r.mode=mI;case mI:if(r.flags&1024&&(u=r.length,u>s&&(u=s),u&&(r.head&&(R=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),He.arraySet(r.head.extra,n,a,u,R)),r.flags&512&&(r.check=xt(r.check,n,u,a)),s-=u,a+=u,r.length-=u),r.length))break e;r.length=0,r.mode=gI;case gI:if(r.flags&2048){if(s===0)break e;u=0;do R=n[a+u++],r.head&&R&&r.length<65536&&(r.head.name+=String.fromCharCode(R));while(R&&u<s);if(r.flags&512&&(r.check=xt(r.check,n,u,a)),s-=u,a+=u,R)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=yI;case yI:if(r.flags&4096){if(s===0)break e;u=0;do R=n[a+u++],r.head&&R&&r.length<65536&&(r.head.comment+=String.fromCharCode(R));while(R&&u<s);if(r.flags&512&&(r.check=xt(r.check,n,u,a)),s-=u,a+=u,R)break e}else r.head&&(r.head.comment=null);r.mode=wI;case wI:if(r.flags&512){for(;l<16;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}if(d!==(r.check&65535)){e.msg="header crc mismatch",r.mode=ce;break}d=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Xt;break;case _I:for(;l<32;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}e.adler=r.check=CI(d),d=0,l=0,r.mode=Ts;case Ts:if(r.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,r.hold=d,r.bits=l,i1;e.adler=r.check=1,r.mode=Xt;case Xt:if(t===r1||t===Ds)break e;case up:if(r.last){d>>>=l&7,l-=l&7,r.mode=mp;break}for(;l<3;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}switch(r.last=d&1,d>>>=1,l-=1,d&3){case 0:r.mode=II;break;case 1:if(u1(r),r.mode=Cs,t===Ds){d>>>=2,l-=2;break e}break;case 2:r.mode=EI;break;case 3:e.msg="invalid block type",r.mode=ce}d>>>=2,l-=2;break;case II:for(d>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}if((d&65535)!==(d>>>16^65535)){e.msg="invalid stored block lengths",r.mode=ce;break}if(r.length=d&65535,d=0,l=0,r.mode=hp,t===Ds)break e;case hp:r.mode=vI;case vI:if(u=r.length,u){if(u>s&&(u=s),u>c&&(u=c),u===0)break e;He.arraySet(i,n,a,u,o),s-=u,a+=u,c-=u,o+=u,r.length-=u;break}r.mode=Xt;break;case EI:for(;l<14;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}if(r.nlen=(d&31)+257,d>>>=5,l-=5,r.ndist=(d&31)+1,d>>>=5,l-=5,r.ncode=(d&15)+4,d>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=ce;break}r.have=0,r.mode=bI;case bI:for(;r.have<r.ncode;){for(;l<3;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}r.lens[he[r.have++]]=d&7,d>>>=3,l-=3}for(;r.have<19;)r.lens[he[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,B={bits:r.lenbits},P=Da(t1,r.lens,0,19,r.lencode,0,r.work,B),r.lenbits=B.bits,P){e.msg="invalid code lengths set",r.mode=ce;break}r.have=0,r.mode=AI;case AI:for(;r.have<r.nlen+r.ndist;){for(;g=r.lencode[d&(1<<r.lenbits)-1],y=g>>>24,_=g>>>16&255,b=g&65535,!(y<=l);){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}if(b<16)d>>>=y,l-=y,r.lens[r.have++]=b;else{if(b===16){for(k=y+2;l<k;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}if(d>>>=y,l-=y,r.have===0){e.msg="invalid bit length repeat",r.mode=ce;break}R=r.lens[r.have-1],u=3+(d&3),d>>>=2,l-=2}else if(b===17){for(k=y+3;l<k;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}d>>>=y,l-=y,R=0,u=3+(d&7),d>>>=3,l-=3}else{for(k=y+7;l<k;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}d>>>=y,l-=y,R=0,u=11+(d&127),d>>>=7,l-=7}if(r.have+u>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=ce;break}for(;u--;)r.lens[r.have++]=R}}if(r.mode===ce)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=ce;break}if(r.lenbits=9,B={bits:r.lenbits},P=Da(TI,r.lens,0,r.nlen,r.lencode,0,r.work,B),r.lenbits=B.bits,P){e.msg="invalid literal/lengths set",r.mode=ce;break}if(r.distbits=6,r.distcode=r.distdyn,B={bits:r.distbits},P=Da(jI,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,B),r.distbits=B.bits,P){e.msg="invalid distances set",r.mode=ce;break}if(r.mode=Cs,t===Ds)break e;case Cs:r.mode=xs;case xs:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,r.hold=d,r.bits=l,e1(e,p),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,d=r.hold,l=r.bits,r.mode===Xt&&(r.back=-1);break}for(r.back=0;g=r.lencode[d&(1<<r.lenbits)-1],y=g>>>24,_=g>>>16&255,b=g&65535,!(y<=l);){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}if(_&&(_&240)===0){for(E=y,I=_,S=b;g=r.lencode[S+((d&(1<<E+I)-1)>>E)],y=g>>>24,_=g>>>16&255,b=g&65535,!(E+y<=l);){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}d>>>=E,l-=E,r.back+=E}if(d>>>=y,l-=y,r.back+=y,r.length=b,_===0){r.mode=PI;break}if(_&32){r.back=-1,r.mode=Xt;break}if(_&64){e.msg="invalid literal/length code",r.mode=ce;break}r.extra=_&15,r.mode=RI;case RI:if(r.extra){for(k=r.extra;l<k;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}r.length+=d&(1<<r.extra)-1,d>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=kI;case kI:for(;g=r.distcode[d&(1<<r.distbits)-1],y=g>>>24,_=g>>>16&255,b=g&65535,!(y<=l);){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}if((_&240)===0){for(E=y,I=_,S=b;g=r.distcode[S+((d&(1<<E+I)-1)>>E)],y=g>>>24,_=g>>>16&255,b=g&65535,!(E+y<=l);){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}d>>>=E,l-=E,r.back+=E}if(d>>>=y,l-=y,r.back+=y,_&64){e.msg="invalid distance code",r.mode=ce;break}r.offset=b,r.extra=_&15,r.mode=SI;case SI:if(r.extra){for(k=r.extra;l<k;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}r.offset+=d&(1<<r.extra)-1,d>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=ce;break}r.mode=NI;case NI:if(c===0)break e;if(u=p-c,r.offset>u){if(u=r.offset-u,u>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=ce;break}u>r.wnext?(u-=r.wnext,h=r.wsize-u):h=r.wnext-u,u>r.length&&(u=r.length),m=r.window}else m=i,h=o-r.offset,u=r.length;u>c&&(u=c),c-=u,r.length-=u;do i[o++]=m[h++];while(--u);r.length===0&&(r.mode=xs);break;case PI:if(c===0)break e;i[o++]=r.length,c--,r.mode=xs;break;case mp:if(r.wrap){for(;l<32;){if(s===0)break e;s--,d|=n[a++]<<l,l+=8}if(p-=c,e.total_out+=p,r.total+=p,p&&(e.adler=r.check=r.flags?xt(r.check,i,p,o-p):wp(r.check,i,p,o-p)),p=c,(r.flags?d:CI(d))!==r.check){e.msg="incorrect data check",r.mode=ce;break}d=0,l=0}r.mode=OI;case OI:if(r.wrap&&r.flags){for(;l<32;){if(s===0)break e;s--,d+=n[a++]<<l,l+=8}if(d!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=ce;break}d=0,l=0}r.mode=DI;case DI:P=n1;break e;case ce:P=LI;break e;case Ip:return _p;case o1:default:return st}return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,r.hold=d,r.bits=l,(r.wsize||p!==e.avail_out&&r.mode<ce&&(r.mode<mp||t!==dI))&&zI(e,e.output,e.next_out,p-e.avail_out)?(r.mode=Ip,_p):(f-=e.avail_in,p-=e.avail_out,e.total_in+=f,e.total_out+=p,r.total+=p,r.wrap&&p&&(e.adler=r.check=r.flags?xt(r.check,i,p,e.next_out-p):wp(r.check,i,p,e.next_out-p)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Xt?128:0)+(r.mode===Cs||r.mode===hp?256:0),(f===0&&p===0||t===dI)&&P===nn&&(P=a1),P)}function m1(e){if(!e||!e.state)return st;var t=e.state;return t.window&&(t.window=null),e.state=null,nn}function g1(e,t){var r;return!e||!e.state||(r=e.state,(r.wrap&2)===0)?st:(r.head=t,t.done=!1,nn)}function y1(e,t){var r=t.length,n,i,a;return!e||!e.state||(n=e.state,n.wrap!==0&&n.mode!==Ts)?st:n.mode===Ts&&(i=1,i=wp(i,t,r,0),i!==n.check)?LI:(a=zI(e,t,r,r),a?(n.mode=Ip,_p):(n.havedict=1,nn))}gt.inflateReset=VI;gt.inflateReset2=UI;gt.inflateResetKeep=MI;gt.inflateInit=p1;gt.inflateInit2=FI;gt.inflate=h1;gt.inflateEnd=m1;gt.inflateGetHeader=g1;gt.inflateSetDictionary=y1;gt.inflateInfo="pako inflate (from Nodeca project)"});var vp=w((jB,qI)=>{"use strict";qI.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var KI=w((LB,GI)=>{"use strict";function w1(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}GI.exports=w1});var HI=w(xa=>{"use strict";var ai=BI(),Ca=Jt(),js=op(),ue=vp(),Ep=Es(),_1=sp(),I1=KI(),WI=Object.prototype.toString;function an(e){if(!(this instanceof an))return new an(e);this.options=Ca.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _1,this.strm.avail_out=0;var r=ai.inflateInit2(this.strm,t.windowBits);if(r!==ue.Z_OK)throw new Error(Ep[r]);if(this.header=new I1,ai.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=js.string2buf(t.dictionary):WI.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=ai.inflateSetDictionary(this.strm,t.dictionary),r!==ue.Z_OK)))throw new Error(Ep[r])}an.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,o,s,c,d,l=!1;if(this.ended)return!1;o=t===~~t?t:t===!0?ue.Z_FINISH:ue.Z_NO_FLUSH,typeof e=="string"?r.input=js.binstring2buf(e):WI.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Ca.Buf8(n),r.next_out=0,r.avail_out=n),a=ai.inflate(r,ue.Z_NO_FLUSH),a===ue.Z_NEED_DICT&&i&&(a=ai.inflateSetDictionary(this.strm,i)),a===ue.Z_BUF_ERROR&&l===!0&&(a=ue.Z_OK,l=!1),a!==ue.Z_STREAM_END&&a!==ue.Z_OK)return this.onEnd(a),this.ended=!0,!1;r.next_out&&(r.avail_out===0||a===ue.Z_STREAM_END||r.avail_in===0&&(o===ue.Z_FINISH||o===ue.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=js.utf8border(r.output,r.next_out),c=r.next_out-s,d=js.buf2string(r.output,s),r.next_out=c,r.avail_out=n-c,c&&Ca.arraySet(r.output,r.output,s,c,0),this.onData(d)):this.onData(Ca.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(l=!0)}while((r.avail_in>0||r.avail_out===0)&&a!==ue.Z_STREAM_END);return a===ue.Z_STREAM_END&&(o=ue.Z_FINISH),o===ue.Z_FINISH?(a=ai.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===ue.Z_OK):(o===ue.Z_SYNC_FLUSH&&(this.onEnd(ue.Z_OK),r.avail_out=0),!0)};an.prototype.onData=function(e){this.chunks.push(e)};an.prototype.onEnd=function(e){e===ue.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ca.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function bp(e,t){var r=new an(t);if(r.push(e,!0),r.err)throw r.msg||Ep[r.err];return r.result}function v1(e,t){return t=t||{},t.raw=!0,bp(e,t)}xa.Inflate=an;xa.inflate=bp;xa.inflateRaw=v1;xa.ungzip=bp});var ZI=w((MB,YI)=>{"use strict";var E1=Jt().assign,b1=Q_(),A1=HI(),R1=vp(),JI={};E1(JI,b1,A1,R1);YI.exports=JI});var QI=w($s=>{"use strict";var k1=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",S1=ZI(),XI=le(),Ls=We(),N1=k1?"uint8array":"array";$s.magic="\b\0";function on(e,t){Ls.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}XI.inherits(on,Ls);on.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(XI.transformTo(N1,e.data),!1)};on.prototype.flush=function(){Ls.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};on.prototype.cleanUp=function(){Ls.prototype.cleanUp.call(this),this._pako=null};on.prototype._createPako=function(){this._pako=new S1[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};$s.compressWorker=function(e){return new on("Deflate",e)};$s.uncompressWorker=function(){return new on("Inflate",{})}});var Rp=w(Ap=>{"use strict";var ev=We();Ap.STORE={magic:"\0\0",compressWorker:function(){return new ev("STORE compression")},uncompressWorker:function(){return new ev("STORE decompression")}};Ap.DEFLATE=QI()});var kp=w(sn=>{"use strict";sn.LOCAL_FILE_HEADER="PK";sn.CENTRAL_FILE_HEADER="PK";sn.CENTRAL_DIRECTORY_END="PK";sn.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";sn.ZIP64_CENTRAL_DIRECTORY_END="PK";sn.DATA_DESCRIPTOR="PK\x07\b"});var iv=w((zB,nv)=>{"use strict";var oi=le(),si=We(),Sp=Hn(),tv=ys(),Ms=kp(),ee=function(e,t){var r="",n;for(n=0;n<t;n++)r+=String.fromCharCode(e&255),e=e>>>8;return r},P1=function(e,t){var r=e;return e||(r=t?16893:33204),(r&65535)<<16},O1=function(e){return(e||0)&63},rv=function(e,t,r,n,i,a){var o=e.file,s=e.compression,c=a!==Sp.utf8encode,d=oi.transformTo("string",a(o.name)),l=oi.transformTo("string",Sp.utf8encode(o.name)),f=o.comment,p=oi.transformTo("string",a(f)),u=oi.transformTo("string",Sp.utf8encode(f)),h=l.length!==o.name.length,m=u.length!==f.length,g,y,_="",b="",E="",I=o.dir,S=o.date,R={crc32:0,compressedSize:0,uncompressedSize:0};(!t||r)&&(R.crc32=e.crc32,R.compressedSize=e.compressedSize,R.uncompressedSize=e.uncompressedSize);var P=0;t&&(P|=8),!c&&(h||m)&&(P|=2048);var x=0,B=0;I&&(x|=16),i==="UNIX"?(B=798,x|=P1(o.unixPermissions,I)):(B=20,x|=O1(o.dosPermissions,I)),g=S.getUTCHours(),g=g<<6,g=g|S.getUTCMinutes(),g=g<<5,g=g|S.getUTCSeconds()/2,y=S.getUTCFullYear()-1980,y=y<<4,y=y|S.getUTCMonth()+1,y=y<<5,y=y|S.getUTCDate(),h&&(b=ee(1,1)+ee(tv(d),4)+l,_+="up"+ee(b.length,2)+b),m&&(E=ee(1,1)+ee(tv(p),4)+u,_+="uc"+ee(E.length,2)+E);var k="";k+=`
|
|
10
|
-
\0`,k+=ee(P,2),k+=s.magic,k+=ee(g,2),k+=ee(y,2),k+=ee(R.crc32,4),k+=ee(R.compressedSize,4),k+=ee(R.uncompressedSize,4),k+=ee(d.length,2),k+=ee(_.length,2);var he=Ms.LOCAL_FILE_HEADER+k+d+_,Lt=Ms.CENTRAL_FILE_HEADER+ee(B,2)+k+ee(p.length,2)+"\0\0\0\0"+ee(x,4)+ee(n,4)+d+_+p;return{fileRecord:he,dirRecord:Lt}},D1=function(e,t,r,n,i){var a="",o=oi.transformTo("string",i(n));return a=Ms.CENTRAL_DIRECTORY_END+"\0\0\0\0"+ee(e,2)+ee(e,2)+ee(t,4)+ee(r,4)+ee(o.length,2)+o,a},C1=function(e){var t="";return t=Ms.DATA_DESCRIPTOR+ee(e.crc32,4)+ee(e.compressedSize,4)+ee(e.uncompressedSize,4),t};function yt(e,t,r,n){si.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}oi.inherits(yt,si);yt.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,si.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))};yt.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=rv(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0};yt.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=rv(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:C1(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null};yt.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,n=D1(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})};yt.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};yt.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(r){t.processChunk(r)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(r){t.error(r)}),this};yt.prototype.resume=function(){if(!si.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};yt.prototype.error=function(e){var t=this._sources;if(!si.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch{}return!0};yt.prototype.lock=function(){si.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};nv.exports=yt});var ov=w(av=>{"use strict";var x1=Rp(),T1=iv(),j1=function(e,t){var r=e||t,n=x1[r];if(!n)throw new Error(r+" is not a valid compression method !");return n};av.generateWorker=function(e,t,r){var n=new T1(t.streamFiles,r,t.platform,t.encodeFileName),i=0;try{e.forEach(function(a,o){i++;var s=j1(o.options.compression,t.compression),c=o.options.compressionOptions||t.compressionOptions||{},d=o.dir,l=o.date;o._compressWorker(s,c).withStreamInfo("file",{name:a,dir:d,date:l,comment:o.comment||"",unixPermissions:o.unixPermissions,dosPermissions:o.dosPermissions}).pipe(n)}),n.entriesCount=i}catch(a){n.error(a)}return n}});var cv=w((qB,sv)=>{"use strict";var L1=le(),Vs=We();function Ta(e,t){Vs.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}L1.inherits(Ta,Vs);Ta.prototype._bindStream=function(e){var t=this;this._stream=e,e.pause(),e.on("data",function(r){t.push({data:r,meta:{percent:0}})}).on("error",function(r){t.isPaused?this.generatedError=r:t.error(r)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})};Ta.prototype.pause=function(){return Vs.prototype.pause.call(this)?(this._stream.pause(),!0):!1};Ta.prototype.resume=function(){return Vs.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};sv.exports=Ta});var wv=w((GB,yv)=>{"use strict";var $1=Hn(),ja=le(),pv=We(),M1=Cf(),uv=xf(),dv=ws(),V1=l_(),U1=ov(),lv=la(),F1=cv(),hv=function(e,t,r){var n=ja.getTypeOf(t),i,a=ja.extend(r||{},uv);a.date=a.date||new Date,a.compression!==null&&(a.compression=a.compression.toUpperCase()),typeof a.unixPermissions=="string"&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&a.unixPermissions&16384&&(a.dir=!0),a.dosPermissions&&a.dosPermissions&16&&(a.dir=!0),a.dir&&(e=mv(e)),a.createFolders&&(i=z1(e))&&gv.call(this,i,!0);var o=n==="string"&&a.binary===!1&&a.base64===!1;(!r||typeof r.binary>"u")&&(a.binary=!o);var s=t instanceof dv&&t.uncompressedSize===0;(s||a.dir||!t||t.length===0)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var c=null;t instanceof dv||t instanceof pv?c=t:lv.isNode&&lv.isStream(t)?c=new F1(e,t):c=ja.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var d=new V1(e,c,a);this.files[e]=d},z1=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},mv=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},gv=function(e,t){return t=typeof t<"u"?t:uv.createFolders,e=mv(e),this.files[e]||hv.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function fv(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var B1={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,n;for(t in this.files)n=this.files[t],r=t.slice(this.root.length,t.length),r&&t.slice(0,this.root.length)===this.root&&e(r,n)},filter:function(e){var t=[];return this.forEach(function(r,n){e(r,n)&&t.push(n)}),t},file:function(e,t,r){if(arguments.length===1)if(fv(e)){var n=e;return this.filter(function(a,o){return!o.dir&&n.test(a)})}else{var i=this.files[this.root+e];return i&&!i.dir?i:null}else e=this.root+e,hv.call(this,e,t,r);return this},folder:function(e){if(!e)return this;if(fv(e))return this.filter(function(i,a){return a.dir&&e.test(i)});var t=this.root+e,r=gv.call(this,t),n=this.clone();return n.root=r.name,n},remove:function(e){e=this.root+e;var t=this.files[e];if(t||(e.slice(-1)!=="/"&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter(function(i,a){return a.name.slice(0,e.length)===e}),n=0;n<r.length;n++)delete this.files[r[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if(r=ja.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:$1.utf8encode}),r.type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),r.type==="binarystring"&&(r.type="string"),!r.type)throw new Error("No output type specified.");ja.checkSupport(r.type),(r.platform==="darwin"||r.platform==="freebsd"||r.platform==="linux"||r.platform==="sunos")&&(r.platform="UNIX"),r.platform==="win32"&&(r.platform="DOS");var n=r.comment||this.comment||"";t=U1.generateWorker(this,r,n)}catch(i){t=new pv("error"),t.error(i)}return new M1(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return e=e||{},e.type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};yv.exports=B1});var Np=w((KB,Iv)=>{"use strict";var q1=le();function _v(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}_v.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t=0,r;for(this.checkOffset(e),r=this.index+e-1;r>=this.index;r--)t=(t<<8)+this.byteAt(r);return this.index+=e,t},readString:function(e){return q1.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(e&31)<<1))}};Iv.exports=_v});var Pp=w((WB,Ev)=>{"use strict";var vv=Np(),G1=le();function ci(e){vv.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}G1.inherits(ci,vv);ci.prototype.byteAt=function(e){return this.data[this.zero+e]};ci.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),a=this.length-4;a>=0;--a)if(this.data[a]===t&&this.data[a+1]===r&&this.data[a+2]===n&&this.data[a+3]===i)return a-this.zero;return-1};ci.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&r===a[1]&&n===a[2]&&i===a[3]};ci.prototype.readData=function(e){if(this.checkOffset(e),e===0)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Ev.exports=ci});var Rv=w((HB,Av)=>{"use strict";var bv=Np(),K1=le();function di(e){bv.call(this,e)}K1.inherits(di,bv);di.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)};di.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero};di.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t};di.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Av.exports=di});var Dp=w((JB,Sv)=>{"use strict";var kv=Pp(),W1=le();function Op(e){kv.call(this,e)}W1.inherits(Op,kv);Op.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Sv.exports=Op});var Ov=w((YB,Pv)=>{"use strict";var Nv=Dp(),H1=le();function Cp(e){Nv.call(this,e)}H1.inherits(Cp,Nv);Cp.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Pv.exports=Cp});var xp=w((ZB,Cv)=>{"use strict";var Us=le(),Dv=Wt(),J1=Pp(),Y1=Rv(),Z1=Ov(),X1=Dp();Cv.exports=function(e){var t=Us.getTypeOf(e);return Us.checkSupport(t),t==="string"&&!Dv.uint8array?new Y1(e):t==="nodebuffer"?new Z1(e):Dv.uint8array?new X1(Us.transformTo("uint8array",e)):new J1(Us.transformTo("array",e))}});var Lv=w((XB,jv)=>{"use strict";var Tp=xp(),kr=le(),Q1=ws(),xv=ys(),Fs=Hn(),zs=Rp(),ej=Wt(),tj=0,rj=3,nj=function(e){for(var t in zs)if(Object.prototype.hasOwnProperty.call(zs,t)&&zs[t].magic===e)return zs[t];return null};function Tv(e,t){this.options=e,this.loadOptions=t}Tv.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(t=nj(this.compressionMethod),t===null)throw new Error("Corrupted zip : compression "+kr.pretty(this.compressionMethod)+" unknown (inner file : "+kr.transformTo("string",this.fileName)+")");this.decompressed=new Q1(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),e===tj&&(this.dosPermissions=this.externalFileAttributes&63),e===rj&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=Tp(this.extraFields[1].value);this.uncompressedSize===kr.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===kr.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===kr.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===kr.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t=e.index+this.extraFieldsLength,r,n,i;for(this.extraFields||(this.extraFields={});e.index+4<t;)r=e.readInt(2),n=e.readInt(2),i=e.readData(n),this.extraFields[r]={id:r,length:n,value:i};e.setIndex(t)},handleUTF8:function(){var e=ej.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=Fs.utf8decode(this.fileName),this.fileCommentStr=Fs.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var r=kr.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var n=this.findExtraFieldUnicodeComment();if(n!==null)this.fileCommentStr=n;else{var i=kr.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(i)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=Tp(e.value);return t.readInt(1)!==1||xv(this.fileName)!==t.readInt(4)?null:Fs.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=Tp(e.value);return t.readInt(1)!==1||xv(this.fileComment)!==t.readInt(4)?null:Fs.utf8decode(t.readData(e.length-5))}return null}};jv.exports=Tv});var Vv=w((QB,Mv)=>{"use strict";var ij=xp(),Qt=le(),wt=kp(),aj=Lv(),oj=Wt();function $v(e){this.files=[],this.loadOptions=e}$v.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+Qt.pretty(t)+", expected "+Qt.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var n=this.reader.readString(4),i=n===t;return this.reader.setIndex(r),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=oj.uint8array?"uint8array":"array",r=Qt.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e=this.zip64EndOfCentralSize-44,t=0,r,n,i;t<e;)r=this.reader.readInt(2),n=this.reader.readInt(4),i=this.reader.readData(n),this.zip64ExtensibleData[r]={id:r,length:n,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(wt.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(wt.CENTRAL_FILE_HEADER);)e=new aj({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(wt.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,wt.LOCAL_FILE_HEADER);throw t?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(e);var r=e;if(this.checkSignature(wt.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===Qt.MAX_VALUE_16BITS||this.diskWithCentralDirStart===Qt.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===Qt.MAX_VALUE_16BITS||this.centralDirRecords===Qt.MAX_VALUE_16BITS||this.centralDirSize===Qt.MAX_VALUE_32BITS||this.centralDirOffset===Qt.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(wt.ZIP64_CENTRAL_DIRECTORY_LOCATOR),e<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(wt.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,wt.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(wt.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(wt.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var i=r-n;if(i>0)this.isSignature(r,wt.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(e){this.reader=ij(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};Mv.exports=$v});var zv=w((eq,Fv)=>{"use strict";var jp=le(),Bs=Gn(),sj=Hn(),cj=Vv(),dj=Lf(),Uv=la();function lj(e){return new Bs.Promise(function(t,r){var n=e.decompressed.getContentWorker().pipe(new dj);n.on("error",function(i){r(i)}).on("end",function(){n.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}Fv.exports=function(e,t){var r=this;return t=jp.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:sj.utf8decode}),Uv.isNode&&Uv.isStream(e)?Bs.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):jp.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(n){var i=new cj(t);return i.load(n),i}).then(function(i){var a=[Bs.Promise.resolve(i)],o=i.files;if(t.checkCRC32)for(var s=0;s<o.length;s++)a.push(lj(o[s]));return Bs.Promise.all(a)}).then(function(i){for(var a=i.shift(),o=a.files,s=0;s<o.length;s++){var c=o[s],d=c.fileNameStr,l=jp.resolve(c.fileNameStr);r.file(l,c.decompressed,{binary:!0,optimizedBinaryString:!0,date:c.date,dir:c.dir,comment:c.fileCommentStr.length?c.fileCommentStr:null,unixPermissions:c.unixPermissions,dosPermissions:c.dosPermissions,createFolders:t.createFolders}),c.dir||(r.file(l).unsafeOriginalName=d)}return a.zipComment.length&&(r.comment=a.zipComment),r})}});var Lp=w((tq,Bv)=>{"use strict";function ct(){if(!(this instanceof ct))return new ct;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new ct;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}ct.prototype=wv();ct.prototype.loadAsync=zv();ct.support=Wt();ct.defaults=xf();ct.version="3.10.1";ct.loadAsync=function(e,t){return new ct().loadAsync(e,t)};ct.external=Gn();Bv.exports=ct});import{createHash as fj}from"node:crypto";function $p(e){let t=new Set,r=0,n=[...e.files].sort((f,p)=>f.path.localeCompare(p.path)).map(f=>{if(!hj(f.path)||t.has(f.path))throw new Error("BUNDLE_PATH_INVALID");if(!uj.has(f.mime))throw new Error("BUNDLE_MIME_INVALID");if(t.add(f.path),r+=f.bytes.byteLength,r>(e.maximumBytes??128*1024*1024))throw new Error("BUNDLE_SIZE_EXCEEDED");let p=new Uint8Array(f.bytes);return{...f,bytes:p,sha256:La(p),byteSize:p.byteLength}});if(!n.some(f=>f.path==="index.html"))throw new Error("BUNDLE_ENTRYPOINT_MISSING");let i=La(qs(n.map(({path:f,mime:p,sha256:u,byteSize:h})=>({path:f,mime:p,sha256:u,byteSize:h})))),a=qs({schemaVersion:1,artifactReleaseId:e.artifactReleaseId,buildProfile:e.profile,rendererReleaseId:e.rendererReleaseId,runtimeReleaseIds:e.runtimeReleaseIds,entrypoint:"index.html",files:n.map(({path:f,mime:p,sha256:u,byteSize:h})=>({path:f,mimeType:p,digest:u,byteSize:h,cacheClass:f==="index.html"?"entry":"immutable"}))}),o={path:"manifest.json",mime:"application/json",bytes:a,sha256:La(a),byteSize:a.byteLength},s=qs({schemaVersion:1,files:[...n,{...o}].map(({path:f,sha256:p})=>({path:f,digest:p}))}),c={path:"integrity.json",mime:"application/json",bytes:s,sha256:La(s),byteSize:s.byteLength},d=[...n,o,c].sort((f,p)=>f.path.localeCompare(p.path)),l=La(qs(d.map(({path:f,sha256:p})=>({path:f,sha256:p}))));return Object.freeze({schemaVersion:1,webBundleId:`web-bundle:${l.slice(7)}`,artifactReleaseId:e.artifactReleaseId,profile:e.profile,entrypoint:"index.html",files:d,digest:l})}var pj,uj,La,hj,qs,Mp=$e(()=>{"use strict";pj=rr(Lp(),1),uj=new Set(["text/html; charset=utf-8","application/json","text/css; charset=utf-8","text/javascript; charset=utf-8","image/svg+xml","image/png","image/jpeg","image/webp","audio/mpeg","audio/ogg","audio/wav","video/mp4","video/webm","text/vtt; charset=utf-8","font/woff2"]),La=e=>`sha256:${fj("sha256").update(e).digest("hex")}`,hj=e=>e.length>0&&!e.startsWith("/")&&!e.includes("\\")&&!e.split("/").includes("..")&&!e.includes("\0"),qs=e=>new TextEncoder().encode(JSON.stringify(e))});function gj(e){throw new kt(e)}function yj(e){let t=e.split("/");return t[t.length-1]??e}function li(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function qv(e,t){return e===t?"index.html":`${e.slice(1)}/index.html`}function Vp(e,t){if(e===t)return yj(t);let r=e.lastIndexOf("/"),n=r===-1?0:e.slice(0,r).split("/").length;return`${"../".repeat(n)}${t}`}function Gv(e,t,r){let n=e.project.routes.find(c=>c.path===t);n===void 0&&gj("PAGE_ROUTE_UNKNOWN");let i=qv(t,e.project.defaultPath),a=e.project.navigation.map(c=>` <a href="${li(Vp(i,qv(c.path,e.project.defaultPath)))}">${li(c.label)}</a>`),o=r==="hosted"?"\u6258\u7BA1\u7AD9\u70B9":"\u79BB\u7EBF\u7AD9\u70B9",s=r==="hosted"?"\u8FD9\u662F Hosted CSR \u9759\u6001\u58F3\uFF0C\u4E0D\u662F SSR\u3002\u5BA2\u6237\u7AEF\u6FC0\u6D3B\u540E\u8DEF\u7531\u4ECD\u8D70\u540C\u4E00 Renderer\u3002":"\u8FD9\u662F\u9759\u6001\u79BB\u7EBF\u58F3\uFF0C\u4E0D\u542B\u5BC6\u94A5\u3002\u5B8C\u6574\u4EA4\u4E92\u8BF7\u4F7F\u7528\u6E90\u7801\u5DE5\u7A0B\u5F52\u6863\u3002";return["<!doctype html>",'<html lang="zh-CN">',"<head>",' <meta charset="utf-8">',' <meta name="viewport" content="width=device-width, initial-scale=1">',` <title>${li(n.title)}</title>`,` <link rel="stylesheet" href="${li(Vp(i,"styles.css"))}">`,"</head>","<body>"," <header>",` <p>${o}</p>`," <nav>",...a," </nav>"," </header>"," <main>",` <h1>${li(n.title)}</h1>`,` <p>${s}</p>`," </main>",` <script src="${li(Vp(i,"runtime/app.js"))}"></script>`,"</body>","</html>",""].join(`
|
|
8
|
+
deps: ${r}}`};var wk={keyword:"dependencies",type:"object",schemaType:"object",error:bt.error,code(e){let[t,r]=_k(e);cm(e,t),lm(e,r)}};function _k({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let i=Array.isArray(e[n])?t:r;i[n]=e[n]}return[t,r]}function cm(e,t=e.schema){let{gen:r,data:n,it:i}=e;if(Object.keys(t).length===0)return;let a=r.let("missing");for(let o in t){let s=t[o];if(s.length===0)continue;let c=(0,Bi.propertyInData)(r,n,o,i.opts.ownProperties);e.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(c,()=>{for(let l of s)(0,Bi.checkReportMissingProp)(e,l)}):(r.if((0,Nl._)`${c} && (${(0,Bi.checkMissingProp)(e,s,a)})`),(0,Bi.reportMissingProp)(e,a),r.else())}}bt.validatePropertyDeps=cm;function lm(e,t=e.schema){let{gen:r,data:n,keyword:i,it:a}=e,o=r.name("valid");for(let s in t)(0,yk.alwaysValidSchema)(a,t[s])||(r.if((0,Bi.propertyInData)(r,n,s,a.opts.ownProperties),()=>{let c=e.subschema({keyword:i,schemaProp:s},o);e.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),e.ok(o))}bt.validateSchemaDeps=lm;bt.default=wk});var fm=w(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});var dm=T(),Ik=M(),vk={message:"property name must be valid",params:({params:e})=>(0,dm._)`{propertyName: ${e.propertyName}}`},Ek={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:vk,code(e){let{gen:t,schema:r,data:n,it:i}=e;if((0,Ik.alwaysValidSchema)(i,r))return;let a=t.name("valid");t.forIn("key",n,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},a),t.if((0,dm.not)(a),()=>{e.error(!0),i.allErrors||t.break()})}),e.ok(a)}};Pl.default=Ek});var Dl=w(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});var Ro=Qe(),pt=T(),bk=Xe(),ko=M(),Ak={message:"must NOT have additional properties",params:({params:e})=>(0,pt._)`{additionalProperty: ${e.additionalProperty}}`},Rk={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Ak,code(e){let{gen:t,schema:r,parentSchema:n,data:i,errsCount:a,it:o}=e;if(!a)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,ko.alwaysValidSchema)(o,r))return;let l=(0,Ro.allSchemaProperties)(n.properties),d=(0,Ro.allSchemaProperties)(n.patternProperties);f(),e.ok((0,pt._)`${a} === ${bk.default.errors}`);function f(){t.forIn("key",i,g=>{!l.length&&!d.length?h(g):t.if(p(g),()=>h(g))})}function p(g){let y;if(l.length>8){let _=(0,ko.schemaRefOrVal)(o,n.properties,"properties");y=(0,Ro.isOwnProperty)(t,_,g)}else l.length?y=(0,pt.or)(...l.map(_=>(0,pt._)`${g} === ${_}`)):y=pt.nil;return d.length&&(y=(0,pt.or)(y,...d.map(_=>(0,pt._)`${(0,Ro.usePattern)(e,_)}.test(${g})`))),(0,pt.not)(y)}function u(g){t.code((0,pt._)`delete ${i}[${g}]`)}function h(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){u(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,ko.alwaysValidSchema)(o,r)){let y=t.name("valid");c.removeAdditional==="failing"?(m(g,y,!1),t.if((0,pt.not)(y),()=>{e.reset(),u(g)})):(m(g,y),s||t.if((0,pt.not)(y),()=>t.break()))}}function m(g,y,_){let b={keyword:"additionalProperties",dataProp:g,dataPropType:ko.Type.Str};_===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(b,y)}}};Ol.default=Rk});var hm=w(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});var kk=Ni(),pm=Qe(),Cl=M(),um=Dl(),Sk={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:a}=e;a.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&um.default.code(new kk.KeywordCxt(a,um.default,"additionalProperties"));let o=(0,pm.allSchemaProperties)(r);for(let f of o)a.definedProperties.add(f);a.opts.unevaluated&&o.length&&a.props!==!0&&(a.props=Cl.mergeEvaluated.props(t,(0,Cl.toHash)(o),a.props));let s=o.filter(f=>!(0,Cl.alwaysValidSchema)(a,r[f]));if(s.length===0)return;let c=t.name("valid");for(let f of s)l(f)?d(f):(t.if((0,pm.propertyInData)(t,i,f,a.opts.ownProperties)),d(f),a.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(c);function l(f){return a.opts.useDefaults&&!a.compositeRule&&r[f].default!==void 0}function d(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};xl.default=Sk});var wm=w(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});var mm=Qe(),So=T(),gm=M(),ym=M(),Nk={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:i,it:a}=e,{opts:o}=a,s=(0,mm.allSchemaProperties)(r),c=s.filter(m=>(0,gm.alwaysValidSchema)(a,r[m]));if(s.length===0||c.length===s.length&&(!a.opts.unevaluated||a.props===!0))return;let l=o.strictSchema&&!o.allowMatchingProperties&&i.properties,d=t.name("valid");a.props!==!0&&!(a.props instanceof So.Name)&&(a.props=(0,ym.evaluatedPropsToName)(t,a.props));let{props:f}=a;p();function p(){for(let m of s)l&&u(m),a.allErrors?h(m):(t.var(d,!0),h(m),t.if(d))}function u(m){for(let g in l)new RegExp(m).test(g)&&(0,gm.checkStrictMode)(a,`property ${g} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){t.forIn("key",n,g=>{t.if((0,So._)`${(0,mm.usePattern)(e,m)}.test(${g})`,()=>{let y=c.includes(m);y||e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:g,dataPropType:ym.Type.Str},d),a.opts.unevaluated&&f!==!0?t.assign((0,So._)`${f}[${g}]`,!0):!y&&!a.allErrors&&t.if((0,So.not)(d),()=>t.break())})})}}};Tl.default=Nk});var _m=w(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});var Pk=M(),Ok={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,Pk.alwaysValidSchema)(n,r)){e.fail();return}let i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};jl.default=Ok});var Im=w(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});var Dk=Qe(),Ck={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Dk.validateUnion,error:{message:"must match a schema in anyOf"}};Ll.default=Ck});var vm=w($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});var No=T(),xk=M(),Tk={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,No._)`{passingSchemas: ${e.passing}}`},jk={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Tk,code(e){let{gen:t,schema:r,parentSchema:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let a=r,o=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(l),e.result(o,()=>e.reset(),()=>e.error(!0));function l(){a.forEach((d,f)=>{let p;(0,xk.alwaysValidSchema)(i,d)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&t.if((0,No._)`${c} && ${o}`).assign(o,!1).assign(s,(0,No._)`[${s}, ${f}]`).else(),t.if(c,()=>{t.assign(o,!0),t.assign(s,f),p&&e.mergeEvaluated(p,No.Name)})})}}};$l.default=jk});var Em=w(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});var Lk=M(),$k={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=t.name("valid");r.forEach((a,o)=>{if((0,Lk.alwaysValidSchema)(n,a))return;let s=e.subschema({keyword:"allOf",schemaProp:o},i);e.ok(i),e.mergeEvaluated(s)})}};Ml.default=$k});var Rm=w(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});var Po=T(),Am=M(),Mk={message:({params:e})=>(0,Po.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Po._)`{failingKeyword: ${e.ifClause}}`},Vk={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Mk,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Am.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=bm(n,"then"),a=bm(n,"else");if(!i&&!a)return;let o=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),i&&a){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(s,l("then",d),l("else",d))}else i?t.if(s,l("then")):t.if((0,Po.not)(s),l("else"));e.pass(o,()=>e.error(!0));function c(){let d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(d)}function l(d,f){return()=>{let p=e.subschema({keyword:d},s);t.assign(o,s),e.mergeValidEvaluated(p,o),f?t.assign(f,(0,Po._)`${d}`):e.setParams({ifClause:d})}}}};function bm(e,t){let r=e.schema[t];return r!==void 0&&!(0,Am.alwaysValidSchema)(e,r)}Vl.default=Vk});var km=w(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});var Uk=M(),Fk={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Uk.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Ul.default=Fk});var Sm=w(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});var zk=bl(),Bk=im(),qk=Al(),Gk=om(),Kk=sm(),Wk=Ao(),Hk=fm(),Jk=Dl(),Yk=hm(),Zk=wm(),Xk=_m(),Qk=Im(),eS=vm(),tS=Em(),rS=Rm(),nS=km();function iS(e=!1){let t=[Xk.default,Qk.default,eS.default,tS.default,rS.default,nS.default,Hk.default,Jk.default,Wk.default,Yk.default,Zk.default];return e?t.push(Bk.default,Gk.default):t.push(zk.default,qk.default),t.push(Kk.default),t}Fl.default=iS});var Bl=w(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.dynamicAnchor=void 0;var zl=T(),aS=Xe(),Nm=Oi(),oS=wo(),sS={keyword:"$dynamicAnchor",schemaType:"string",code:e=>Pm(e,e.schema)};function Pm(e,t){let{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;let i=(0,zl._)`${aS.default.dynamicAnchors}${(0,zl.getProperty)(t)}`,a=n.errSchemaPath==="#"?n.validateName:cS(e);r.if((0,zl._)`!${i}`,()=>r.assign(i,a))}qi.dynamicAnchor=Pm;function cS(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:i,baseId:a,localRefs:o,meta:s}=t.root,{schemaId:c}=n.opts,l=new Nm.SchemaEnv({schema:r,schemaId:c,root:i,baseId:a,localRefs:o,meta:s});return Nm.compileSchema.call(n,l),(0,oS.getValidate)(e,l)}qi.default=sS});var ql=w(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.dynamicRef=void 0;var Om=T(),lS=Xe(),Dm=wo(),dS={keyword:"$dynamicRef",schemaType:"string",code:e=>Cm(e,e.schema)};function Cm(e,t){let{gen:r,keyword:n,it:i}=e;if(t[0]!=="#")throw new Error(`"${n}" only supports hash fragment reference`);let a=t.slice(1);if(i.allErrors)o();else{let c=r.let("valid",!1);o(c),e.ok(c)}function o(c){if(i.schemaEnv.root.dynamicAnchors[a]){let l=r.let("_v",(0,Om._)`${lS.default.dynamicAnchors}${(0,Om.getProperty)(a)}`);r.if(l,s(l,c),s(i.validateName,c))}else s(i.validateName,c)()}function s(c,l){return l?()=>r.block(()=>{(0,Dm.callRef)(e,c),r.let(l,!0)}):()=>(0,Dm.callRef)(e,c)}}Gi.dynamicRef=Cm;Gi.default=dS});var xm=w(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});var fS=Bl(),pS=M(),uS={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,fS.dynamicAnchor)(e,""):(0,pS.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};Gl.default=uS});var Tm=w(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});var hS=ql(),mS={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,hS.dynamicRef)(e,e.schema)};Kl.default=mS});var jm=w(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});var gS=Bl(),yS=ql(),wS=xm(),_S=Tm(),IS=[gS.default,yS.default,wS.default,_S.default];Wl.default=IS});var $m=w(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});var Lm=Ao(),vS={keyword:"dependentRequired",type:"object",schemaType:"object",error:Lm.error,code:e=>(0,Lm.validatePropertyDeps)(e)};Hl.default=vS});var Mm=w(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});var ES=Ao(),bS={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,ES.validateSchemaDeps)(e)};Jl.default=bS});var Vm=w(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});var AS=M(),RS={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){t.contains===void 0&&(0,AS.checkStrictMode)(r,`"${e}" without "contains" is ignored`)}};Yl.default=RS});var Um=w(Zl=>{"use strict";Object.defineProperty(Zl,"__esModule",{value:!0});var kS=$m(),SS=Mm(),NS=Vm(),PS=[kS.default,SS.default,NS.default];Zl.default=PS});var zm=w(Xl=>{"use strict";Object.defineProperty(Xl,"__esModule",{value:!0});var dr=T(),Fm=M(),OS=Xe(),DS={message:"must NOT have unevaluated properties",params:({params:e})=>(0,dr._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},CS={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:DS,code(e){let{gen:t,schema:r,data:n,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:o,props:s}=a;s instanceof dr.Name?t.if((0,dr._)`${s} !== true`,()=>t.forIn("key",n,f=>t.if(l(s,f),()=>c(f)))):s!==!0&&t.forIn("key",n,f=>s===void 0?c(f):t.if(d(s,f),()=>c(f))),a.props=!0,e.ok((0,dr._)`${i} === ${OS.default.errors}`);function c(f){if(r===!1){e.setParams({unevaluatedProperty:f}),e.error(),o||t.break();return}if(!(0,Fm.alwaysValidSchema)(a,r)){let p=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:f,dataPropType:Fm.Type.Str},p),o||t.if((0,dr.not)(p),()=>t.break())}}function l(f,p){return(0,dr._)`!${f} || !${f}[${p}]`}function d(f,p){let u=[];for(let h in f)f[h]===!0&&u.push((0,dr._)`${p} !== ${h}`);return(0,dr.and)(...u)}}};Xl.default=CS});var qm=w(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});var Mr=T(),Bm=M(),xS={message:({params:{len:e}})=>(0,Mr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Mr._)`{limit: ${e}}`},TS={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:xS,code(e){let{gen:t,schema:r,data:n,it:i}=e,a=i.items||0;if(a===!0)return;let o=t.const("len",(0,Mr._)`${n}.length`);if(r===!1)e.setParams({len:a}),e.fail((0,Mr._)`${o} > ${a}`);else if(typeof r=="object"&&!(0,Bm.alwaysValidSchema)(i,r)){let c=t.var("valid",(0,Mr._)`${o} <= ${a}`);t.if((0,Mr.not)(c),()=>s(c,a)),e.ok(c)}i.items=!0;function s(c,l){t.forRange("i",l,o,d=>{e.subschema({keyword:"unevaluatedItems",dataProp:d,dataPropType:Bm.Type.Num},c),i.allErrors||t.if((0,Mr.not)(c),()=>t.break())})}}};Ql.default=TS});var Gm=w(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});var jS=zm(),LS=qm(),$S=[jS.default,LS.default];ed.default=$S});var Km=w(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});var pe=T(),MS={message:({schemaCode:e})=>(0,pe.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,pe._)`{format: ${e}}`},VS={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:MS,code(e,t){let{gen:r,data:n,$data:i,schema:a,schemaCode:o,it:s}=e,{opts:c,errSchemaPath:l,schemaEnv:d,self:f}=s;if(!c.validateFormats)return;i?p():u();function p(){let h=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),m=r.const("fDef",(0,pe._)`${h}[${o}]`),g=r.let("fType"),y=r.let("format");r.if((0,pe._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(g,(0,pe._)`${m}.type || "string"`).assign(y,(0,pe._)`${m}.validate`),()=>r.assign(g,(0,pe._)`"string"`).assign(y,m)),e.fail$data((0,pe.or)(_(),b()));function _(){return c.strictSchema===!1?pe.nil:(0,pe._)`${o} && !${y}`}function b(){let E=d.$async?(0,pe._)`(${m}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,pe._)`${y}(${n})`,I=(0,pe._)`(typeof ${y} == "function" ? ${E} : ${y}.test(${n}))`;return(0,pe._)`${y} && ${y} !== true && ${g} === ${t} && !${I}`}}function u(){let h=f.formats[a];if(!h){_();return}if(h===!0)return;let[m,g,y]=b(h);m===t&&e.pass(E());function _(){if(c.strictSchema===!1){f.logger.warn(I());return}throw new Error(I());function I(){return`unknown format "${a}" ignored in schema at path "${l}"`}}function b(I){let S=I instanceof RegExp?(0,pe.regexpCode)(I):c.code.formats?(0,pe._)`${c.code.formats}${(0,pe.getProperty)(a)}`:void 0,R=r.scopeValue("formats",{key:a,ref:I,code:S});return typeof I=="object"&&!(I instanceof RegExp)?[I.type||"string",I.validate,(0,pe._)`${R}.validate`]:["string",I,R]}function E(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!d.$async)throw new Error("async format in sync schema");return(0,pe._)`await ${y}(${n})`}return typeof g=="function"?(0,pe._)`${y}(${n})`:(0,pe._)`${y}.test(${n})`}}}};td.default=VS});var Wm=w(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});var US=Km(),FS=[US.default];rd.default=FS});var Hm=w(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.contentVocabulary=vn.metadataVocabulary=void 0;vn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];vn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Ym=w(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});var zS=Uh(),BS=em(),qS=Sm(),GS=jm(),KS=Um(),WS=Gm(),HS=Wm(),Jm=Hm(),JS=[GS.default,zS.default,BS.default,(0,qS.default)(!0),HS.default,Jm.metadataVocabulary,Jm.contentVocabulary,KS.default,WS.default];nd.default=JS});var Xm=w(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.DiscrError=void 0;var Zm;(function(e){e.Tag="tag",e.Mapping="mapping"})(Zm||(Oo.DiscrError=Zm={}))});var eg=w(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});var En=T(),id=Xm(),Qm=Oi(),YS=Pi(),ZS=M(),XS={message:({params:{discrError:e,tagName:t}})=>e===id.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,En._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},QS={keyword:"discriminator",type:"object",schemaType:"object",error:XS,code(e){let{gen:t,data:r,schema:n,parentSchema:i,it:a}=e,{oneOf:o}=i;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",(0,En._)`${r}${(0,En.getProperty)(s)}`);t.if((0,En._)`typeof ${l} == "string"`,()=>d(),()=>e.error(!1,{discrError:id.DiscrError.Tag,tag:l,tagName:s})),e.ok(c);function d(){let u=p();t.if(!1);for(let h in u)t.elseIf((0,En._)`${l} === ${h}`),t.assign(c,f(u[h]));t.else(),e.error(!1,{discrError:id.DiscrError.Mapping,tag:l,tagName:s}),t.endIf()}function f(u){let h=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:u},h);return e.mergeEvaluated(m,En.Name),h}function p(){var u;let h={},m=y(i),g=!0;for(let E=0;E<o.length;E++){let I=o[E];if(I?.$ref&&!(0,ZS.schemaHasRulesButRef)(I,a.self.RULES)){let R=I.$ref;if(I=Qm.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,R),I instanceof Qm.SchemaEnv&&(I=I.schema),I===void 0)throw new YS.default(a.opts.uriResolver,a.baseId,R)}let S=(u=I?.properties)===null||u===void 0?void 0:u[s];if(typeof S!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);g=g&&(m||y(I)),_(S,E)}if(!g)throw new Error(`discriminator: "${s}" must be required`);return h;function y({required:E}){return Array.isArray(E)&&E.includes(s)}function _(E,I){if(E.const)b(E.const,I);else if(E.enum)for(let S of E.enum)b(S,I);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function b(E,I){if(typeof E!="string"||E in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[E]=I}}}};ad.default=QS});var tg=w((K2,eN)=>{eN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var rg=w((W2,tN)=>{tN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var ng=w((H2,rN)=>{rN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var ig=w((J2,nN)=>{nN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var ag=w((Y2,iN)=>{iN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var og=w((Z2,aN)=>{aN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var sg=w((X2,oN)=>{oN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var cg=w((Q2,sN)=>{sN.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var lg=w(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});var cN=tg(),lN=rg(),dN=ng(),fN=ig(),pN=ag(),uN=og(),hN=sg(),mN=cg(),gN=["/properties"];function yN(e){return[cN,lN,dN,fN,pN,t(this,uN),hN,t(this,mN)].forEach(r=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,gN):n}}od.default=yN});var Vr=w((re,cd)=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.MissingRefError=re.ValidationError=re.CodeGen=re.Name=re.nil=re.stringify=re.str=re._=re.KeywordCxt=re.Ajv2020=void 0;var wN=jh(),_N=Ym(),IN=eg(),vN=lg(),sd="https://json-schema.org/draft/2020-12/schema",bn=class extends wN.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),_N.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(IN.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:r}=this.opts;r&&(vN.default.call(this,t),this.refs["http://json-schema.org/schema"]=sd)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(sd)?sd:void 0)}};re.Ajv2020=bn;cd.exports=re=bn;cd.exports.Ajv2020=bn;Object.defineProperty(re,"__esModule",{value:!0});re.default=bn;var EN=Ni();Object.defineProperty(re,"KeywordCxt",{enumerable:!0,get:function(){return EN.KeywordCxt}});var An=T();Object.defineProperty(re,"_",{enumerable:!0,get:function(){return An._}});Object.defineProperty(re,"str",{enumerable:!0,get:function(){return An.str}});Object.defineProperty(re,"stringify",{enumerable:!0,get:function(){return An.stringify}});Object.defineProperty(re,"nil",{enumerable:!0,get:function(){return An.nil}});Object.defineProperty(re,"Name",{enumerable:!0,get:function(){return An.Name}});Object.defineProperty(re,"CodeGen",{enumerable:!0,get:function(){return An.CodeGen}});var bN=so();Object.defineProperty(re,"ValidationError",{enumerable:!0,get:function(){return bN.default}});var AN=Pi();Object.defineProperty(re,"MissingRefError",{enumerable:!0,get:function(){return AN.default}})});function v(e,t){throw new kt(e,t===void 0?void 0:{cause:t})}var my,kt,Cn=$e(()=>{"use strict";my=["PAGE_SCHEMA_INVALID","PAGE_SCHEMA_VERSION_UNSUPPORTED","PAGE_MATERIAL_UNKNOWN","PAGE_MATERIAL_UNVERIFIED","PAGE_BINDING_FORBIDDEN","PAGE_PORT_UNKNOWN","PAGE_ROUTE_CONFLICT","PAGE_ROUTE_UNKNOWN","PAGE_ROUTE_INVALID","PAGE_ROUTE_DYNAMIC_UNSUPPORTED","PAGE_REACT_NOT_CANONICAL","PAGE_OWNED_REGION_CONFLICT","PAGE_PREVIEW_ISOLATION_VIOLATION","PAGE_HYDRATION_MISMATCH","PAGE_BUNDLE_INVALID","PAGE_PUBLISH_MODE_MISMATCH","PAGE_GATEWAY_PORT_DENIED","SCREEN_PROFILE_REQUIRED","SCREEN_SSR_UNSUPPORTED","SCREEN_DATASET_UNKNOWN","SCREEN_DATASET_PORT_UNKNOWN","SCREEN_FIELD_UNKNOWN","SCREEN_ENCODING_INVALID","SCREEN_MARK_MISMATCH","SCREEN_SPEC_FORBIDDEN","SCREEN_REFRESH_INVALID","SCREEN_LAYOUT_INVALID","SCREEN_SCALE_INVALID","SCREEN_ENGINE_UNAVAILABLE"],kt=class extends Error{code;constructor(t,r){super(t,r),this.code=t,this.name="PageDefinitionError"}}});function Nd(e){let t=e===""?[]:e.split(".");t.some(r=>NO.has(r)||r==="")&&v("PAGE_BINDING_FORBIDDEN"),t[0]!==void 0&&!["state","props","item","actionResult","route","datasets","queries","event"].includes(t[0])&&v("PAGE_BINDING_FORBIDDEN")}function Ge(e){if(e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="function"&&v("PAGE_SCHEMA_INVALID"),Array.isArray(e)){for(let i of e)Ge(i);return e}(!e||typeof e!="object")&&v("PAGE_SCHEMA_INVALID");let t=Object.keys(e);t.length!==1&&v("PAGE_BINDING_FORBIDDEN");let r=t[0];gy.has(r)||v("PAGE_BINDING_FORBIDDEN");let n=e[r];if(r==="var")return typeof n!="string"&&v("PAGE_BINDING_FORBIDDEN"),Nd(n),e;if(r==="missing"){let i=Array.isArray(n)?n:[n];for(let a of i)typeof a!="string"&&v("PAGE_BINDING_FORBIDDEN"),Nd(a)}return Ge(n),e}function Sd(e,t){Nd(t);let r=t===""?[]:t.split("."),n=e;for(let i of r){if(n==null||typeof n!="object"||Object.prototype.hasOwnProperty.call(n,i)!==!0)return null;n=n[i]}return n}function Gr(e){return Array.isArray(e)?e:[e]}function it(e,t,r={count:0}){if(r.count+=1,r.count>PO&&v("PAGE_BINDING_FORBIDDEN"),e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(c=>it(c,t,r));let n=Object.keys(e)[0];(n===void 0||!gy.has(n))&&v("PAGE_BINDING_FORBIDDEN");let i=e[n];if(n==="var")return typeof i!="string"&&v("PAGE_BINDING_FORBIDDEN"),Sd(t,i);if(n==="missing")return Gr(i).map(l=>(typeof l!="string"&&v("PAGE_BINDING_FORBIDDEN"),l)).filter(l=>Sd(t,l)===null||Sd(t,l)===void 0);if(n==="if"){let c=Gr(i);return(c.length<2||c.length>3)&&v("PAGE_BINDING_FORBIDDEN"),it(c[0],t,r)?it(c[1],t,r):c.length===3?it(c[2],t,r):null}if(n==="and"){let c=!0;for(let l of Gr(i))if(c=it(l,t,r),!c)return c;return c}if(n==="or"){let c=!1;for(let l of Gr(i))if(c=it(l,t,r),c)return c;return c}if(n==="!")return!it(Gr(i)[0]??null,t,r);if(n==="!!")return!!it(Gr(i)[0]??null,t,r);let a=Gr(i);a.length!==2&&v("PAGE_BINDING_FORBIDDEN");let o=it(a[0],t,r),s=it(a[1],t,r);if(n==="==")return o===s;if(n==="!=")return o!==s;if(n==="in"){if(typeof s=="string"&&typeof o=="string"||Array.isArray(s))return s.includes(o);v("PAGE_BINDING_FORBIDDEN")}return(typeof o!="number"||typeof s!="number")&&v("PAGE_BINDING_FORBIDDEN"),n===">"?o>s:n===">="?o>=s:n==="<"?o<s:o<=s}var gy,NO,PO,Pd=$e(()=>{"use strict";Cn();gy=new Set(["var","if","==","!=",">",">=","<","<=","and","or","!","in","!!","missing"]),NO=new Set(["__proto__","constructor","prototype","services"]),PO=64});import{createHash as OO}from"node:crypto";function Od(e){return typeof e=="function"&&v("PAGE_SCHEMA_INVALID"),Array.isArray(e)?`[${e.map(Od).join(",")}]`:e!==null&&typeof e=="object"?`{${Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>`${JSON.stringify(r)}:${Od(n)}`).join(",")}}`:JSON.stringify(e)}function xn(e){return`sha256:${OO("sha256").update(Od(e)).digest("hex")}`}var Dd=$e(()=>{"use strict";Cn()});function Ko(e){if(e===void 0)return;(e===null||typeof e!="object"||Array.isArray(e))&&v("PAGE_SCHEMA_INVALID");let t=e;Object.keys(t).some(r=>!DO.has(r))&&v("PAGE_SCHEMA_INVALID");for(let r of Object.keys(yy))t[r]!==void 0&&!yy[r].has(t[r])&&v("PAGE_SCHEMA_INVALID");return t.mobileStack!==void 0&&typeof t.mobileStack!="boolean"&&v("PAGE_SCHEMA_INVALID"),t.mobileHidden!==void 0&&typeof t.mobileHidden!="boolean"&&v("PAGE_SCHEMA_INVALID"),Object.freeze({...t})}function wy(e){let t={spacing:{none:"p-0",xs:"p-1",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-10"},width:{auto:"w-auto",full:"w-full",content:"w-full max-w-5xl mx-auto",narrow:"w-full max-w-2xl mx-auto"},align:{start:"text-left",center:"text-center",end:"text-right"},surface:{transparent:"bg-transparent",surface:"bg-white",muted:"bg-slate-50",accent:"bg-teal-700 text-white"},radius:{none:"rounded-none",sm:"rounded",md:"rounded-xl",lg:"rounded-2xl"},typography:{body:"font-sans",heading:"font-serif"},layout:{block:"block",row:"flex flex-row",column:"flex flex-col",grid2:"grid grid-cols-2",grid3:"grid grid-cols-3"},gap:{none:"gap-0",xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6"},interaction:{none:"",lift:"transition hover:-translate-y-1 hover:shadow-lg",outline:"focus-visible:ring-2 focus-visible:ring-teal-600",dim:"disabled:opacity-50"}};return[e.spacing&&t.spacing[e.spacing],e.width&&t.width[e.width],e.align&&t.align[e.align],e.surface&&t.surface[e.surface],e.radius&&t.radius[e.radius],e.typography&&t.typography[e.typography],e.layout&&t.layout[e.layout],e.gap&&t.gap[e.gap],e.interaction&&t.interaction[e.interaction],e.mobileStack?"max-sm:flex-col":"",e.mobileHidden?"max-sm:hidden":""].filter(Boolean).join(" ")}function _y(e){let t={none:"0",xs:".25rem",sm:".5rem",md:"1rem",lg:"1.5rem",xl:"2.5rem"},r={auto:"auto",full:"100%",content:"64rem",narrow:"42rem"},n={none:"0",sm:".25rem",md:".75rem",lg:"1rem"},i={none:"0",xs:".25rem",sm:".5rem",md:"1rem",lg:"1.5rem"};return Object.freeze({...e.spacing?{padding:t[e.spacing]}:{},...e.width?{width:e.width==="auto"?"auto":"100%",maxWidth:r[e.width],marginInline:e.width==="content"||e.width==="narrow"?"auto":"0"}:{},...e.align?{textAlign:e.align==="start"?"left":e.align==="end"?"right":"center"}:{},...e.surface?{background:e.surface==="transparent"?"transparent":e.surface==="surface"?"var(--aipt-surface)":e.surface==="muted"?"var(--aipt-layer)":"var(--aipt-accent)",color:e.surface==="accent"?"var(--aipt-surface)":"inherit"}:{},...e.radius?{borderRadius:n[e.radius]}:{},...e.typography?{fontFamily:e.typography==="heading"?"var(--aipt-heading)":"var(--aipt-body)"}:{},...e.layout?e.layout==="block"?{display:"block"}:e.layout==="row"?{display:"flex",flexDirection:"row"}:e.layout==="column"?{display:"flex",flexDirection:"column"}:{display:"grid",gridTemplateColumns:`repeat(${e.layout==="grid2"?2:3}, minmax(0, 1fr))`}:{},...e.gap?{gap:i[e.gap]}:{},...e.mobileHidden?{"--aipt-mobile-visibility":"hidden"}:{}})}var DO,yy,Cd=$e(()=>{"use strict";Cn();DO=new Set(["spacing","width","align","surface","radius","typography","mobileStack","layout","gap","mobileHidden","interaction"]),yy={spacing:new Set(["none","xs","sm","md","lg","xl"]),width:new Set(["auto","full","content","narrow"]),align:new Set(["start","center","end"]),surface:new Set(["transparent","surface","muted","accent"]),radius:new Set(["none","sm","md","lg"]),typography:new Set(["body","heading"]),layout:new Set(["block","row","column","grid2","grid3"]),gap:new Set(["none","xs","sm","md","lg"]),interaction:new Set(["none","lift","outline","dim"])}});function se(e,t){throw new Tn(e,t===void 0?void 0:{cause:t})}var Tn,xd=$e(()=>{"use strict";Tn=class extends Error{code;constructor(t,r){super(t,r),this.code=t,this.name="ChartSpecError"}}});function Ho(e){(e===null||typeof e!="object"||Array.isArray(e)||typeof e=="function")&&se("SCREEN_SPEC_FORBIDDEN");for(let t of Object.keys(e))vy.has(t)&&se("SCREEN_SPEC_FORBIDDEN");return e}function Ld(e,t){for(let r of Object.keys(e))t.has(r)||se("SCREEN_SPEC_FORBIDDEN")}function jd(e){if(typeof e=="function"&&se("SCREEN_SPEC_FORBIDDEN"),Array.isArray(e)){for(let t of e)jd(t);return}if(e!==null&&typeof e=="object")for(let[t,r]of Object.entries(e))vy.has(t)&&se("SCREEN_SPEC_FORBIDDEN"),jd(r)}function Wo(e){let t=Ho(e);Ld(t,jO),(typeof t.field!="string"||!xO.test(t.field))&&se("SCREEN_ENCODING_INVALID"),(typeof t.role!="string"||!VO.has(t.role))&&se("SCREEN_ENCODING_INVALID");let r=t.role;return t.aggregate===void 0?Object.freeze({field:t.field,role:r}):((typeof t.aggregate!="string"||!UO.has(t.aggregate))&&se("SCREEN_ENCODING_INVALID"),r!=="measure"&&se("SCREEN_ENCODING_INVALID"),Object.freeze({field:t.field,role:r,aggregate:t.aggregate}))}function qO(e,t){let r=Ho(e),n=new Set(Iy[t]);for(let a of Object.keys(r))n.has(a)||se("SCREEN_ENCODING_INVALID");let i={};for(let a of Iy[t])r[a]!==void 0&&(a==="x"?i.x=Wo(r.x):a==="y"?i.y=Wo(r.y):a==="color"?i.color=Wo(r.color):i.theta=Wo(r.theta));for(let a of MO[t])a in i||se("SCREEN_ENCODING_INVALID");return Object.freeze(i)}function GO(e,t){if(e===void 0)return;let r=Ho(e);Ld(r,BO);let n={};return r.legend!==void 0&&((typeof r.legend!="string"||!FO.has(r.legend))&&se("SCREEN_SPEC_FORBIDDEN"),n.legend=r.legend),r.labelFormat!==void 0&&((typeof r.labelFormat!="string"||!zO.has(r.labelFormat))&&se("SCREEN_SPEC_FORBIDDEN"),n.labelFormat=r.labelFormat),r.area!==void 0&&((t!=="line"||typeof r.area!="boolean")&&se("SCREEN_SPEC_FORBIDDEN"),n.area=r.area),r.smooth!==void 0&&((t!=="line"||typeof r.smooth!="boolean")&&se("SCREEN_SPEC_FORBIDDEN"),n.smooth=r.smooth),r.stacked!==void 0&&((t!=="bar"||typeof r.stacked!="boolean")&&se("SCREEN_SPEC_FORBIDDEN"),n.stacked=r.stacked),Object.keys(n).length===0?void 0:Object.freeze(n)}function KO(e,t){let r=t.find(i=>i.datasetId===e.datasetId);r||se("SCREEN_DATASET_UNKNOWN");let n=new Map(r.fields.map(i=>[i.key,i]));for(let i of Object.values(e.encoding)){if(i===void 0)continue;let a=n.get(i.field);a||se("SCREEN_FIELD_UNKNOWN"),a.role!==i.role&&se("SCREEN_ENCODING_INVALID")}}function $d(e,t={}){jd(e);let r=Ho(e);Ld(r,TO),r.schemaVersion!==Td&&se("SCREEN_SPEC_FORBIDDEN"),(typeof r.mark!="string"||!LO.has(r.mark))&&se("SCREEN_SPEC_FORBIDDEN");let n=r.mark;if(t.materialId!==void 0){let s=$O[t.materialId];(s===void 0||s!==n)&&se("SCREEN_MARK_MISMATCH")}(typeof r.datasetId!="string"||!CO.test(r.datasetId))&&se("SCREEN_DATASET_UNKNOWN");let i=qO(r.encoding,n),a=GO(r.style,n),o=Object.freeze(a===void 0?{schemaVersion:Td,mark:n,datasetId:r.datasetId,encoding:i}:{schemaVersion:Td,mark:n,datasetId:r.datasetId,encoding:i,style:a});return t.datasets!==void 0&&KO(o,t.datasets),o}var Td,CO,xO,vy,TO,jO,LO,$O,Iy,MO,VO,UO,FO,zO,BO,Ey=$e(()=>{"use strict";xd();Td="1.0.0",CO=/^[a-z][a-z0-9-]*$/u,xO=/^[a-zA-Z][a-zA-Z0-9_]*$/u,vy=new Set(["option","formatter","series","dataset","on","events","requestConfig","processData","processConfig","axios","dangerouslySetInnerHTML","code"]),TO=new Set(["schemaVersion","mark","datasetId","encoding","style"]),jO=new Set(["field","role","aggregate"]),LO=new Set(["line","bar","pie"]),$O={"chart.line":"line","chart.bar":"bar","chart.pie":"pie"},Iy={line:["x","y","color"],bar:["x","y","color"],pie:["theta","color"]},MO={line:["x","y"],bar:["x","y"],pie:["theta"]},VO=new Set(["dimension","measure"]),UO=new Set(["sum","avg","count","min","max"]),FO=new Set(["hidden","top","bottom","left","right"]),zO=new Set(["number","percent","compact"]),BO=new Set(["legend","area","smooth","stacked","labelFormat"])});var by=$e(()=>{"use strict";xd();Ey()});function fe(e,t="PAGE_SCHEMA_INVALID"){(e===null||typeof e!="object"||Array.isArray(e)||typeof e=="function")&&v(t);for(let r of Object.keys(e))Sy.has(r)&&v("PAGE_SCHEMA_INVALID");return e}function Ie(e,t){for(let r of Object.keys(e))t.has(r)||v("PAGE_SCHEMA_INVALID")}function ne(e,t){return(typeof e!="string"||e.trim()===""||e.length>200)&&v("PAGE_SCHEMA_INVALID"),t&&!t.test(e)&&v("PAGE_SCHEMA_INVALID"),e}function Kr(e){return(typeof e!="string"||e.trim()===""||e.length>200)&&v("PAGE_SCHEMA_INVALID"),e}function Oy(e){let t=fe(e);return Md(t),Object.freeze({...t})}function Md(e){if(typeof e=="function"&&v("PAGE_SCHEMA_INVALID"),Array.isArray(e)){for(let t of e)Md(t);return}if(e!==null&&typeof e=="object")for(let[t,r]of Object.entries(e))Sy.has(t)&&v("PAGE_SCHEMA_INVALID"),Md(r)}function wD(e){if(e!==void 0)return Ge(e)}function Jo(e){return(typeof e!="string"||!e.startsWith("/")||e.includes("?")||e.includes("#")||e.includes("//"))&&v("PAGE_ROUTE_INVALID"),(e.includes(":")||e.includes("*"))&&v("PAGE_ROUTE_DYNAMIC_UNSUPPORTED"),e!=="/"&&!/^\/[a-z0-9]+(-[a-z0-9]+)*(?:\/[a-z0-9]+(-[a-z0-9]+)*)*$/u.test(e)&&v("PAGE_ROUTE_INVALID"),e}function _D(e){if(e===void 0)return;let t=fe(e);Ie(t,pD);let r=Ge(t.items),n=ne(t.alias,Xo);return t.key===void 0?Object.freeze({items:r,alias:n}):Object.freeze({items:r,alias:n,key:ne(t.key)})}function ID(e){if(e===void 0)return;let t=fe(e),r={};for(let[n,i]of Object.entries(t))Xo.test(n)||v("PAGE_SCHEMA_INVALID"),r[n]=Ge(i);return Object.freeze(r)}function vD(e){if(e===void 0)return;let t=fe(e),r={};for(let[n,i]of Object.entries(t))Xo.test(n)||v("PAGE_SCHEMA_INVALID"),r[n]=ne(i,mr);return Object.freeze(r)}function Vd(e,t,r){let n=fe(e),i=ne(n.id,HO);t.has(i)&&v("PAGE_SCHEMA_INVALID"),t.add(i);let a=n.kind;a!=="box"&&a!=="material"&&a!=="link"&&v("PAGE_SCHEMA_INVALID"),Ie(n,a==="box"?mD:a==="material"?gD:yD);let o=n.props===void 0?Object.freeze({}):Object.freeze(Oy(n.props)),s=wD(n.visible),c=_D(n.loop),l=ID(n.bindings),d=vD(n.events),f=Ko(n.presentation),p={};if(s!==void 0&&(p.visible=s),c!==void 0&&(p.loop=c),l!==void 0&&(p.bindings=l),d!==void 0&&(p.events=d),f!==void 0&&(p.presentation=f),a==="box"){let m=Array.isArray(n.children)?Object.freeze(n.children.map(g=>Vd(g,t,r))):void 0;return Object.freeze({id:i,kind:a,props:o,...m?{children:m}:{},...p})}if(a==="link"){let m=Jo(n.to);return r.routes.some(g=>g.path===m)||v("PAGE_ROUTE_UNKNOWN"),Object.freeze({id:i,kind:a,to:m,props:o,...p})}let u=ne(n.materialId,ky);r.registryLock.some(m=>m.materialId===u)||v("PAGE_MATERIAL_UNKNOWN");let h;if(n.slots!==void 0){let m=fe(n.slots);h={};for(let[g,y]of Object.entries(m))(!Xo.test(g)||g in o)&&v("PAGE_SCHEMA_INVALID"),Array.isArray(y)||v("PAGE_SCHEMA_INVALID"),h[g]=Object.freeze(y.map(_=>Vd(_,t,r)))}return Object.freeze({id:i,kind:a,materialId:u,props:o,...h?{slots:Object.freeze(h)}:{},...p})}function ED(e,t){if(e===void 0)return Object.freeze([]);Array.isArray(e)||v("PAGE_SCHEMA_INVALID");let r=new Set;return Object.freeze(e.map(n=>{let i=fe(n);Ie(i,uD);let a=ne(i.queryId,mr),o=ne(i.datasetId,mr);(r.has(a)||!(t.datasets??[]).some(c=>c.datasetId===o))&&v("SCREEN_DATASET_UNKNOWN"),r.add(a);let s=i.trigger===void 0?"load":i.trigger;if(s!=="load"&&s!=="manual"&&s!=="interval"&&v("PAGE_SCHEMA_INVALID"),s==="interval"){let c=Bt(i.intervalMs,1e3,36e5,"SCREEN_REFRESH_INVALID");return Object.freeze({queryId:a,datasetId:o,args:Ge(i.args??null),trigger:s,intervalMs:c})}return i.intervalMs!==void 0&&v("PAGE_SCHEMA_INVALID"),Object.freeze({queryId:a,datasetId:o,args:Ge(i.args??null),trigger:s})}))}function bD(e,t){if(e===void 0)return Object.freeze([]);Array.isArray(e)||v("PAGE_SCHEMA_INVALID");let r=new Set;return Object.freeze(e.map(n=>{let i=fe(n);Ie(i,fD);let a=ne(i.actionId,mr);if(r.has(a)&&v("PAGE_SCHEMA_INVALID"),r.add(a),i.steps===void 0){let s=ne(i.portId,Yo);return t.dataProxy.some(c=>c.portId===s)||v("PAGE_PORT_UNKNOWN"),Object.freeze({actionId:a,steps:Object.freeze([{type:"invokePort",portId:s,args:Ge(i.args)}])})}(i.portId!==void 0||i.args!==void 0||!Array.isArray(i.steps)||i.steps.length===0)&&v("PAGE_SCHEMA_INVALID");let o=Object.freeze(i.steps.map(s=>{let c=fe(s);if((typeof c.type!="string"||!(c.type in Ay))&&v("PAGE_SCHEMA_INVALID"),Ie(c,Ay[c.type]),c.type==="setState")return Object.freeze({type:"setState",key:ne(c.key,Py),value:Ge(c.value)});if(c.type==="invokePort"){let l=ne(c.portId,Yo);return t.dataProxy.some(d=>d.portId===l)||v("PAGE_PORT_UNKNOWN"),Object.freeze({type:"invokePort",portId:l,args:Ge(c.args)})}if(c.type==="navigate"){let l=ne(c.path);return t.routes.some(d=>d.path===l)||v("PAGE_ROUTE_UNKNOWN"),Object.freeze({type:"navigate",path:l})}if(c.type==="reloadQuery")return Object.freeze({type:"reloadQuery",queryId:ne(c.queryId,mr)});if(c.type==="showFeedback"){let l=c.status??"info";return l!=="info"&&l!=="success"&&l!=="error"&&v("PAGE_SCHEMA_INVALID"),Object.freeze({type:"showFeedback",message:ne(c.message),status:l})}if(c.type==="resetForm")return Object.freeze({type:"resetForm"});v("PAGE_SCHEMA_INVALID")}));return Object.freeze({actionId:a,steps:o})}))}function Bt(e,t,r,n){return(typeof e!="number"||!Number.isInteger(e)||e<t||e>r)&&v(n),e}function AD(e,t){let r=fe(e);Ie(r,iD);let n=ne(r.key);return(!Py.test(n)||t.has(n))&&v("PAGE_SCHEMA_INVALID"),t.add(n),r.role!==void 0&&(typeof r.role!="string"||!lD.has(r.role))&&v("PAGE_SCHEMA_INVALID"),(typeof r.dataType!="string"||!dD.has(r.dataType))&&v("PAGE_SCHEMA_INVALID"),r.nullable!==void 0&&typeof r.nullable!="boolean"&&v("PAGE_SCHEMA_INVALID"),Object.freeze({key:n,label:Kr(r.label),...r.role===void 0?{}:{role:r.role},dataType:r.dataType,...r.nullable===void 0?{}:{nullable:r.nullable}})}function RD(e,t){if(e===void 0)return Object.freeze([]);Array.isArray(e)||v("PAGE_SCHEMA_INVALID");let r=new Set;return Object.freeze(e.map(n=>{let i=fe(n);Ie(i,nD);let a=ne(i.datasetId,mr);r.has(a)&&v("PAGE_SCHEMA_INVALID"),r.add(a);let o=ne(i.portId,Yo);t.has(o)||v("SCREEN_DATASET_PORT_UNKNOWN"),(!Array.isArray(i.fields)||i.fields.length===0)&&v("PAGE_SCHEMA_INVALID");let s=new Set,c=Object.freeze(i.fields.map(f=>AD(f,s))),l=i.cardinality===void 0?"many":i.cardinality;if(l!=="one"&&l!=="many"&&v("PAGE_SCHEMA_INVALID"),i.refreshMs===void 0)return Object.freeze({datasetId:a,portId:o,cardinality:l,fields:c});let d=Bt(i.refreshMs,1e3,36e5,"SCREEN_REFRESH_INVALID");return Object.freeze({datasetId:a,portId:o,cardinality:l,fields:c,refreshMs:d})}))}function kD(e,t,r){let n=fe(e,"SCREEN_LAYOUT_INVALID");Ie(n,oD);let i=Bt(n.x,0,t-1,"SCREEN_LAYOUT_INVALID"),a=Bt(n.y,0,r-1,"SCREEN_LAYOUT_INVALID"),o=Bt(n.w,1,t,"SCREEN_LAYOUT_INVALID"),s=Bt(n.h,1,r,"SCREEN_LAYOUT_INVALID"),c=Bt(n.z,0,1e4,"SCREEN_LAYOUT_INVALID");return Object.freeze({x:i,y:a,w:o,h:s,z:c})}function Zo(e,t){t(e);for(let r of e.children??[])Zo(r,t);for(let r of Object.values(e.slots??{}))for(let n of r)Zo(n,t)}function SD(e){return e.map(t=>({datasetId:t.datasetId,fields:t.fields.map(r=>(r.role===void 0&&v("SCREEN_FIELD_UNKNOWN"),{key:r.key,role:r.role}))}))}function ND(e,t,r){try{$d(t,{materialId:e,datasets:SD(r)})}catch(n){throw n instanceof Tn&&v(n.code),n}}function PD(e,t){Ie(e.props,aD);let r=Bt(e.props.designWidth,1,7680,"SCREEN_LAYOUT_INVALID"),n=Bt(e.props.designHeight,1,4320,"SCREEN_LAYOUT_INVALID");(typeof e.props.scaleMode!="string"||!sD.has(e.props.scaleMode))&&v("SCREEN_SCALE_INVALID"),e.props.snap!==void 0&&(typeof e.props.snap!="number"||!cD.has(e.props.snap))&&v("SCREEN_LAYOUT_INVALID");let i=e.slots?.items??[],a=new Set,o=t.datasets??[];for(let s of i){let c=kD(s.props.frame,r,n);a.has(c.z)&&v("SCREEN_LAYOUT_INVALID"),a.add(c.z),s.materialId?.startsWith("chart.")&&ND(s.materialId,s.props.spec,o)}}function OD(e){Zo(e,t=>{t.materialId===Ny&&v("SCREEN_PROFILE_REQUIRED")})}function DD(e,t){if(t.authoringProfile!=="data-screen"){OD(e);return}let r=e.children??[];(r.length!==1||r[0]?.kind!=="material"||r[0].materialId!==Ny)&&v("SCREEN_LAYOUT_INVALID"),PD(r[0],t)}function ea(e){let t=fe(e),r=t.project&&typeof t.project=="object"&&!Array.isArray(t.project)?t.project.schemaVersion:t.schemaVersion;return r===void 0&&v("PAGE_SCHEMA_INVALID"),r!==jn&&v("PAGE_SCHEMA_VERSION_UNSUPPORTED"),e}function Ud(e){ea(e);let t=fe(e);Ie(t,YO),t.schemaVersion!==jn&&v("PAGE_SCHEMA_VERSION_UNSUPPORTED");let r=t.renderMode;r!=="csr"&&r!=="ssr"&&v("PAGE_SCHEMA_INVALID"),typeof t.prerenderRoutes!="boolean"&&v("PAGE_SCHEMA_INVALID");let n=t.authoringProfile===void 0?"react-data":t.authoringProfile;n!=="react-data"&&n!=="react-jsx"&&n!=="data-screen"&&v("PAGE_SCHEMA_INVALID"),n==="data-screen"&&r==="ssr"&&v("SCREEN_SSR_UNSUPPORTED"),(!Array.isArray(t.routes)||t.routes.length===0)&&v("PAGE_SCHEMA_INVALID");let i=new Set,a=new Set,o=Object.freeze(t.routes.map(m=>{let g=fe(m);Ie(g,XO);let y=Jo(g.path),_=ne(g.pageId,Ry);(i.has(y)||a.has(_))&&v("PAGE_ROUTE_CONFLICT"),i.add(y),a.add(_);let b=g.description===void 0?void 0:Kr(g.description);return Object.freeze({path:y,pageId:_,title:Kr(g.title),...b===void 0?{}:{description:b}})})),s=Object.freeze((Array.isArray(t.navigation)?t.navigation:[]).map(m=>{let g=fe(m);Ie(g,eD);let y=Jo(g.path);return i.has(y)||v("PAGE_ROUTE_UNKNOWN"),Object.freeze({label:Kr(g.label),path:y})})),c=Jo(t.defaultPath);i.has(c)||v("PAGE_ROUTE_UNKNOWN");let l=Object.freeze((Array.isArray(t.registryLock)?t.registryLock:[]).map(m=>{let g=fe(m);return Ie(g,tD),Object.freeze({materialId:ne(g.materialId,ky),version:ne(g.version,WO)})})),d=Object.freeze((Array.isArray(t.dataProxy)?t.dataProxy:[]).map(m=>{let g=fe(m);Ie(g,rD);let y=ne(g.publicPath);return JO.test(y)||v("PAGE_SCHEMA_INVALID"),Object.freeze({portId:ne(g.portId,Yo),publicPath:y})})),f=new Set,p=new Set;for(let m of d)(f.has(m.portId)||p.has(m.publicPath))&&v("PAGE_SCHEMA_INVALID"),f.add(m.portId),p.add(m.publicPath);let u=RD(t.datasets,f),h;if(t.site!==void 0){let m=fe(t.site);Ie(m,QO),h=Object.freeze({footerText:Kr(m.footerText)})}return Object.freeze({schemaVersion:jn,projectId:ne(t.projectId,mr),title:Kr(t.title),renderMode:r,prerenderRoutes:t.prerenderRoutes,authoringProfile:n,routes:o,navigation:s,defaultPath:c,registryLock:l,dataProxy:d,datasets:u,...h===void 0?{}:{site:h}})}function Fd(e,t){ea(e);let r=fe(e);Ie(r,ZO),r.schemaVersion!==jn&&v("PAGE_SCHEMA_VERSION_UNSUPPORTED");let n=ne(r.pageId,Ry);t.routes.some(p=>p.pageId===n)||v("PAGE_ROUTE_UNKNOWN"),ne(r.projectId,mr)!==t.projectId&&v("PAGE_SCHEMA_INVALID");let i=r.authoringMode===void 0?"schema":r.authoringMode;i!=="schema"&&i!=="code-only"&&v("PAGE_SCHEMA_INVALID");let a=r.context===void 0?{}:fe(r.context);Ie(a,hD);let o=a.state===void 0?Object.freeze({}):Object.freeze(Oy(a.state)),s=Vd(r.root,new Set,t);s.kind!=="box"&&v("PAGE_SCHEMA_INVALID"),DD(s,t);let c=ED(a.queries,t),l=bD(a.actions,t),d=new Set(c.map(p=>p.queryId));for(let p of l)for(let u of p.steps)u.type==="setState"&&!Object.hasOwn(o,u.key)&&v("PAGE_SCHEMA_INVALID"),u.type==="reloadQuery"&&!d.has(u.queryId)&&v("PAGE_SCHEMA_INVALID");let f=new Set(l.map(p=>p.actionId));return Zo(s,p=>{for(let u of Object.values(p.events??{}))f.has(u)||v("PAGE_SCHEMA_INVALID")}),Object.freeze({schemaVersion:jn,pageId:n,title:Kr(r.title),projectId:t.projectId,authoringMode:i,root:s,context:Object.freeze({state:o,actions:l,queries:c})})}function zd(e,t){let r=[...e.routes.map(i=>i.pageId)].sort((i,a)=>i.localeCompare(a)),n=Object.keys(t).sort((i,a)=>i.localeCompare(a));return r.join("\0")!==n.join("\0")&&v("PAGE_SCHEMA_INVALID"),xn({project:e,pageDigests:t})}function Bd(e){return xn(e)}function qd(e){let t=fe(ea(e));t.schemaVersion!==void 0&&t.schemaVersion!==jn&&v("PAGE_SCHEMA_VERSION_UNSUPPORTED"),Ie(t,new Set(["project","pages","schemaVersion","digest"]));let r=Ud(t.project);Array.isArray(t.pages)||v("PAGE_SCHEMA_INVALID");let n=Object.freeze(t.pages.map(s=>Fd(s,r))),i=new Set,a={};for(let s of n)i.has(s.pageId)&&v("PAGE_ROUTE_CONFLICT"),i.add(s.pageId),a[s.pageId]=Bd(s);for(let s of r.routes)i.has(s.pageId)||v("PAGE_SCHEMA_INVALID");let o=zd(r,a);return t.digest!==void 0&&t.digest!==o&&v("PAGE_SCHEMA_INVALID"),Object.freeze({project:r,pages:n,digest:o})}var jn,mr,Ry,ky,WO,HO,Yo,JO,Xo,Sy,YO,ZO,XO,QO,eD,tD,rD,nD,iD,aD,oD,Ny,sD,cD,lD,dD,Py,fD,Ay,pD,uD,hD,mD,gD,yD,Dy=$e(()=>{"use strict";by();Pd();Dd();Cn();Cd();jn="1.0.0",mr=/^[a-z][a-z0-9-]*$/u,Ry=/^[a-z][a-z0-9-]*$/u,ky=/^[a-z][a-z0-9]*(\.[a-z][a-z0-9-]*)+$/u,WO=/^[0-9]+\.[0-9]+\.[0-9]+$/u,HO=/^[a-zA-Z][a-zA-Z0-9_]*$/u,Yo=/^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*$/u,JO=/^\/api\/[a-z0-9-]+(\/[a-z0-9-]+)*$/u,Xo=/^[a-zA-Z][a-zA-Z0-9_]*$/u,Sy=new Set(["requestConfig","processData","processConfig","axios","dangerouslySetInnerHTML","code","option","formatter"]),YO=new Set(["schemaVersion","projectId","title","renderMode","prerenderRoutes","authoringProfile","routes","navigation","defaultPath","registryLock","dataProxy","datasets","site"]),ZO=new Set(["schemaVersion","pageId","title","projectId","authoringMode","root","context"]),XO=new Set(["path","pageId","title","description"]),QO=new Set(["footerText"]),eD=new Set(["label","path"]),tD=new Set(["materialId","version"]),rD=new Set(["portId","publicPath"]),nD=new Set(["datasetId","portId","cardinality","fields","refreshMs"]),iD=new Set(["key","label","role","dataType","nullable"]),aD=new Set(["designWidth","designHeight","scaleMode","snap"]),oD=new Set(["x","y","w","h","z"]),Ny="layout.screen-stage",sD=new Set(["contain","cover","width"]),cD=new Set([1,4,8]),lD=new Set(["dimension","measure"]),dD=new Set(["string","number","boolean","date","image","richText","object","array"]),Py=/^[a-zA-Z][a-zA-Z0-9_]*$/u,fD=new Set(["actionId","portId","args","steps"]),Ay={setState:new Set(["type","key","value"]),invokePort:new Set(["type","portId","args"]),navigate:new Set(["type","path"]),reloadQuery:new Set(["type","queryId"]),showFeedback:new Set(["type","message","status"]),resetForm:new Set(["type"])},pD=new Set(["items","alias","key"]),uD=new Set(["queryId","datasetId","args","trigger","intervalMs"]),hD=new Set(["state","actions","queries"]),mD=new Set(["id","kind","props","children","visible","loop","bindings","events","presentation"]),gD=new Set(["id","kind","materialId","props","slots","visible","loop","bindings","events","presentation"]),yD=new Set(["id","kind","to","props","visible","loop","bindings","events","presentation"])});var Gd={};cc(Gd,{PageDefinitionError:()=>kt,assertBinding:()=>Ge,contentDigest:()=>xn,digestPageDefinition:()=>Bd,digestPageProject:()=>zd,evaluateBinding:()=>it,migratePageDocument:()=>ea,pageErrorCodes:()=>my,parsePageAuthoringDocument:()=>qd,parsePageDefinition:()=>Fd,parsePageProject:()=>Ud,parsePresentation:()=>Ko,presentationInlineStyle:()=>_y,presentationTailwindClasses:()=>wy});var Ln=$e(()=>{"use strict";Pd();Dd();Cn();Cd();Dy()});var Vz,Cy=$e(()=>{"use strict";Ln();Vz=['import { createPageElement } from "@aipt/page-renderer";','import { loadPageAuthoringDocument } from "./load-document";',"","export function PageAuthoringCsrEntry(props: { readonly path: string }) {"," return createPageElement(loadPageAuthoringDocument(), { path: props.path });","}",""].join(`
|
|
9
|
+
`)});var ta=w((Fz,Kd)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Kd.exports={nextTick:CD}:Kd.exports=process;function CD(e,t,r,n){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var i=arguments.length,a,o;switch(i){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,r)});case 4:return process.nextTick(function(){e.call(null,t,r,n)});default:for(a=new Array(i-1),o=0;o<a.length;)a[o++]=arguments[o];return process.nextTick(function(){e.apply(null,a)})}}});var Ty=w((zz,xy)=>{var xD={}.toString;xy.exports=Array.isArray||function(e){return xD.call(e)=="[object Array]"}});var Wd=w((Bz,jy)=>{jy.exports=$t("stream")});var ra=w((Hd,$y)=>{var Qo=$t("buffer"),qt=Qo.Buffer;function Ly(e,t){for(var r in e)t[r]=e[r]}qt.from&&qt.alloc&&qt.allocUnsafe&&qt.allocUnsafeSlow?$y.exports=Qo:(Ly(Qo,Hd),Hd.Buffer=$n);function $n(e,t,r){return qt(e,t,r)}Ly(qt,$n);$n.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return qt(e,t,r)};$n.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=qt(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};$n.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return qt(e)};$n.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Qo.SlowBuffer(e)}});var Mn=w(Oe=>{function TD(e){return Array.isArray?Array.isArray(e):es(e)==="[object Array]"}Oe.isArray=TD;function jD(e){return typeof e=="boolean"}Oe.isBoolean=jD;function LD(e){return e===null}Oe.isNull=LD;function $D(e){return e==null}Oe.isNullOrUndefined=$D;function MD(e){return typeof e=="number"}Oe.isNumber=MD;function VD(e){return typeof e=="string"}Oe.isString=VD;function UD(e){return typeof e=="symbol"}Oe.isSymbol=UD;function FD(e){return e===void 0}Oe.isUndefined=FD;function zD(e){return es(e)==="[object RegExp]"}Oe.isRegExp=zD;function BD(e){return typeof e=="object"&&e!==null}Oe.isObject=BD;function qD(e){return es(e)==="[object Date]"}Oe.isDate=qD;function GD(e){return es(e)==="[object Error]"||e instanceof Error}Oe.isError=GD;function KD(e){return typeof e=="function"}Oe.isFunction=KD;function WD(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}Oe.isPrimitive=WD;Oe.isBuffer=$t("buffer").Buffer.isBuffer;function es(e){return Object.prototype.toString.call(e)}});var My=w((Gz,Jd)=>{typeof Object.create=="function"?Jd.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Jd.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}}});var Vn=w((Kz,Zd)=>{try{if(Yd=$t("util"),typeof Yd.inherits!="function")throw"";Zd.exports=Yd.inherits}catch{Zd.exports=My()}var Yd});var Uy=w((Wz,Xd)=>{"use strict";function HD(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Vy=ra().Buffer,na=$t("util");function JD(e,t,r){e.copy(t,r)}Xd.exports=(function(){function e(){HD(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},e.prototype.unshift=function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},e.prototype.shift=function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i},e.prototype.concat=function(r){if(this.length===0)return Vy.alloc(0);for(var n=Vy.allocUnsafe(r>>>0),i=this.head,a=0;i;)JD(i.data,n,a),a+=i.data.length,i=i.next;return n},e})();na&&na.inspect&&na.inspect.custom&&(Xd.exports.prototype[na.inspect.custom]=function(){var e=na.inspect({length:this.length});return this.constructor.name+" "+e})});var Qd=w((Hz,Fy)=>{"use strict";var ts=ta();function YD(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ts.nextTick(rs,this,e)):ts.nextTick(rs,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(a){!t&&a?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,ts.nextTick(rs,r,a)):ts.nextTick(rs,r,a):t&&t(a)}),this)}function ZD(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function rs(e,t){e.emit("error",t)}Fy.exports={destroy:YD,undestroy:ZD}});var By=w((Jz,zy)=>{zy.exports=$t("util").deprecate});var tf=w((Yz,Zy)=>{"use strict";var Wr=ta();Zy.exports=ge;function Gy(e){var t=this;this.next=null,this.entry=null,this.finish=function(){mC(t,e)}}var XD=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Wr.nextTick,Un;ge.WritableState=aa;var Ky=Object.create(Mn());Ky.inherits=Vn();var QD={deprecate:By()},Wy=Wd(),is=ra().Buffer,eC=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function tC(e){return is.from(e)}function rC(e){return is.isBuffer(e)||e instanceof eC}var Hy=Qd();Ky.inherits(ge,Wy);function nC(){}function aa(e,t){Un=Un||Hr(),e=e||{};var r=t instanceof Un;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,i=e.writableHighWaterMark,a=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=e.decodeStrings===!1;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(s){dC(t,s)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Gy(this)}aa.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(aa.prototype,"buffer",{get:QD.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ns;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ns=Function.prototype[Symbol.hasInstance],Object.defineProperty(ge,Symbol.hasInstance,{value:function(e){return ns.call(this,e)?!0:this!==ge?!1:e&&e._writableState instanceof aa}})):ns=function(e){return e instanceof this};function ge(e){if(Un=Un||Hr(),!ns.call(ge,this)&&!(this instanceof Un))return new ge(e);this._writableState=new aa(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),Wy.call(this)}ge.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function iC(e,t){var r=new Error("write after end");e.emit("error",r),Wr.nextTick(t,r)}function aC(e,t,r,n){var i=!0,a=!1;return r===null?a=new TypeError("May not write null values to stream"):typeof r!="string"&&r!==void 0&&!t.objectMode&&(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),Wr.nextTick(n,a),i=!1),i}ge.prototype.write=function(e,t,r){var n=this._writableState,i=!1,a=!n.objectMode&&rC(e);return a&&!is.isBuffer(e)&&(e=tC(e)),typeof t=="function"&&(r=t,t=null),a?t="buffer":t||(t=n.defaultEncoding),typeof r!="function"&&(r=nC),n.ended?iC(this,r):(a||aC(this,n,e,r))&&(n.pendingcb++,i=sC(this,n,a,e,t,r)),i};ge.prototype.cork=function(){var e=this._writableState;e.corked++};ge.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&Jy(this,e))};ge.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function oC(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=is.from(t,r)),t}Object.defineProperty(ge.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function sC(e,t,r,n,i,a){if(!r){var o=oC(t,n,i);n!==o&&(r=!0,i="buffer",n=o)}var s=t.objectMode?1:n.length;t.length+=s;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else ef(e,t,!1,s,n,i,a);return c}function ef(e,t,r,n,i,a,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function cC(e,t,r,n,i){--t.pendingcb,r?(Wr.nextTick(i,n),Wr.nextTick(ia,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),ia(e,t))}function lC(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function dC(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(lC(r),t)cC(e,r,n,t,i);else{var a=Yy(r);!a&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&Jy(e,r),n?XD(qy,e,r,a,i):qy(e,r,a,i)}}function qy(e,t,r,n){r||fC(e,t),t.pendingcb--,n(),ia(e,t)}function fC(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function Jy(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),a=t.corkedRequestsFree;a.entry=r;for(var o=0,s=!0;r;)i[o]=r,r.isBuf||(s=!1),r=r.next,o+=1;i.allBuffers=s,ef(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new Gy(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,d=r.callback,f=t.objectMode?1:c.length;if(ef(e,t,!1,f,c,l,d),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}ge.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))};ge.prototype._writev=null;ge.prototype.end=function(e,t,r){var n=this._writableState;typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||hC(this,n,r)};function Yy(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function pC(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),ia(e,t)})}function uC(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,Wr.nextTick(pC,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function ia(e,t){var r=Yy(t);return r&&(uC(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),r}function hC(e,t,r){t.ending=!0,ia(e,t),r&&(t.finished?Wr.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function mC(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}Object.defineProperty(ge.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});ge.prototype.destroy=Hy.destroy;ge.prototype._undestroy=Hy.undestroy;ge.prototype._destroy=function(e,t){this.end(),t(e)}});var Hr=w((Zz,tw)=>{"use strict";var Xy=ta(),gC=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};tw.exports=Gt;var Qy=Object.create(Mn());Qy.inherits=Vn();var ew=af(),nf=tf();Qy.inherits(Gt,ew);for(rf=gC(nf.prototype),as=0;as<rf.length;as++)os=rf[as],Gt.prototype[os]||(Gt.prototype[os]=nf.prototype[os]);var rf,os,as;function Gt(e){if(!(this instanceof Gt))return new Gt(e);ew.call(this,e),nf.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",yC)}Object.defineProperty(Gt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function yC(){this.allowHalfOpen||this._writableState.ended||Xy.nextTick(wC,this)}function wC(e){e.end()}Object.defineProperty(Gt.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}});Gt.prototype._destroy=function(e,t){this.push(null),this.end(),Xy.nextTick(t,e)}});var cf=w(nw=>{"use strict";var sf=ra().Buffer,rw=sf.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _C(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function IC(e){var t=_C(e);if(typeof t!="string"&&(sf.isEncoding===rw||!rw(e)))throw new Error("Unknown encoding: "+e);return t||e}nw.StringDecoder=oa;function oa(e){this.encoding=IC(e);var t;switch(this.encoding){case"utf16le":this.text=kC,this.end=SC,t=4;break;case"utf8":this.fillLast=bC,t=4;break;case"base64":this.text=NC,this.end=PC,t=3;break;default:this.write=OC,this.end=DC;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=sf.allocUnsafe(t)}oa.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};oa.prototype.end=RC;oa.prototype.text=AC;oa.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function of(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function vC(e,t,r){var n=t.length-1;if(n<r)return 0;var i=of(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||i===-2?0:(i=of(t[n]),i>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||i===-2?0:(i=of(t[n]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function EC(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function bC(e){var t=this.lastTotal-this.lastNeed,r=EC(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function AC(e,t){var r=vC(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function RC(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function kC(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function SC(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function NC(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function PC(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function OC(e){return e.toString(this.encoding)}function DC(e){return e&&e.length?this.write(e):""}});var af=w((eB,mw)=>{"use strict";var zn=ta();mw.exports=ie;var CC=Ty(),sa;ie.ReadableState=dw;var Qz=$t("events").EventEmitter,sw=function(e,t){return e.listeners(t).length},uf=Wd(),ca=ra().Buffer,xC=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function TC(e){return ca.from(e)}function jC(e){return ca.isBuffer(e)||e instanceof xC}var cw=Object.create(Mn());cw.inherits=Vn();var lf=$t("util"),H=void 0;lf&&lf.debuglog?H=lf.debuglog("stream"):H=function(){};var LC=Uy(),lw=Qd(),Fn;cw.inherits(ie,uf);var df=["error","close","destroy","pause","resume"];function $C(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):CC(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}function dw(e,t){sa=sa||Hr(),e=e||{};var r=t instanceof sa;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,i=e.readableHighWaterMark,a=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new LC,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(Fn||(Fn=cf().StringDecoder),this.decoder=new Fn(e.encoding),this.encoding=e.encoding)}function ie(e){if(sa=sa||Hr(),!(this instanceof ie))return new ie(e);this._readableState=new dw(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),uf.call(this)}Object.defineProperty(ie.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});ie.prototype.destroy=lw.destroy;ie.prototype._undestroy=lw.undestroy;ie.prototype._destroy=function(e,t){this.push(null),t(e)};ie.prototype.push=function(e,t){var r=this._readableState,n;return r.objectMode?n=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=ca.from(e,t),t=""),n=!0),fw(this,e,t,!1,n)};ie.prototype.unshift=function(e){return fw(this,e,null,!0,!1)};function fw(e,t,r,n,i){var a=e._readableState;if(t===null)a.reading=!1,FC(e,a);else{var o;i||(o=MC(a,t)),o?e.emit("error",o):a.objectMode||t&&t.length>0?(typeof t!="string"&&!a.objectMode&&Object.getPrototypeOf(t)!==ca.prototype&&(t=TC(t)),n?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):ff(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||t.length!==0?ff(e,a,t,!1):pw(e,a)):ff(e,a,t,!1))):n||(a.reading=!1)}return VC(a)}function ff(e,t,r,n){t.flowing&&t.length===0&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&ss(e)),pw(e,t)}function MC(e,t){var r;return!jC(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new TypeError("Invalid non-string/buffer chunk")),r}function VC(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}ie.prototype.isPaused=function(){return this._readableState.flowing===!1};ie.prototype.setEncoding=function(e){return Fn||(Fn=cf().StringDecoder),this._readableState.decoder=new Fn(e),this._readableState.encoding=e,this};var iw=8388608;function UC(e){return e>=iw?e=iw:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function aw(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=UC(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}ie.prototype.read=function(e){H("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return H("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?pf(this):ss(this),null;if(e=aw(e,t),e===0&&t.ended)return t.length===0&&pf(this),null;var n=t.needReadable;H("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,H("length less than watermark",n)),t.ended||t.reading?(n=!1,H("reading or ended",n)):n&&(H("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=aw(r,t)));var i;return e>0?i=uw(e,t):i=null,i===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&pf(this)),i!==null&&this.emit("data",i),i};function FC(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,ss(e)}}function ss(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(H("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?zn.nextTick(ow,e):ow(e))}function ow(e){H("emit readable"),e.emit("readable"),hf(e)}function pw(e,t){t.readingMore||(t.readingMore=!0,zn.nextTick(zC,e,t))}function zC(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(H("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}ie.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};ie.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,H("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,a=i?s:g;n.endEmitted?zn.nextTick(a):r.once("end",a),e.on("unpipe",o);function o(y,_){H("onunpipe"),y===r&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,d())}function s(){H("onend"),e.end()}var c=BC(r);e.on("drain",c);var l=!1;function d(){H("cleanup"),e.removeListener("close",h),e.removeListener("finish",m),e.removeListener("drain",c),e.removeListener("error",u),e.removeListener("unpipe",o),r.removeListener("end",s),r.removeListener("end",g),r.removeListener("data",p),l=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c()}var f=!1;r.on("data",p);function p(y){H("ondata"),f=!1;var _=e.write(y);_===!1&&!f&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&hw(n.pipes,e)!==-1)&&!l&&(H("false write response, pause",n.awaitDrain),n.awaitDrain++,f=!0),r.pause())}function u(y){H("onerror",y),g(),e.removeListener("error",u),sw(e,"error")===0&&e.emit("error",y)}$C(e,"error",u);function h(){e.removeListener("finish",m),g()}e.once("close",h);function m(){H("onfinish"),e.removeListener("close",h),g()}e.once("finish",m);function g(){H("unpipe"),r.unpipe(e)}return e.emit("pipe",r),n.flowing||(H("pipe resume"),r.resume()),e};function BC(e){return function(){var t=e._readableState;H("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&sw(e,"data")&&(t.flowing=!0,hf(e))}}ie.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)n[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=hw(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};ie.prototype.on=function(e,t){var r=uf.prototype.on.call(this,e,t);if(e==="data")this._readableState.flowing!==!1&&this.resume();else if(e==="readable"){var n=this._readableState;!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&ss(this):zn.nextTick(qC,this))}return r};ie.prototype.addListener=ie.prototype.on;function qC(e){H("readable nexttick read 0"),e.read(0)}ie.prototype.resume=function(){var e=this._readableState;return e.flowing||(H("resume"),e.flowing=!0,GC(this,e)),this};function GC(e,t){t.resumeScheduled||(t.resumeScheduled=!0,zn.nextTick(KC,e,t))}function KC(e,t){t.reading||(H("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),hf(e),t.flowing&&!t.reading&&e.read(0)}ie.prototype.pause=function(){return H("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(H("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function hf(e){var t=e._readableState;for(H("flow",t.flowing);t.flowing&&e.read()!==null;);}ie.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;e.on("end",function(){if(H("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&t.push(o)}t.push(null)}),e.on("data",function(o){if(H("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var s=t.push(o);s||(n=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=(function(o){return function(){return e[o].apply(e,arguments)}})(i));for(var a=0;a<df.length;a++)e.on(df[a],this.emit.bind(this,df[a]));return this._read=function(o){H("wrapped _read",o),n&&(n=!1,e.resume())},this};Object.defineProperty(ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});ie._fromList=uw;function uw(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.head.data:r=t.buffer.concat(t.length),t.buffer.clear()):r=WC(e,t.buffer,t.decoder),r}function WC(e,t,r){var n;return e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?n=t.shift():n=r?HC(e,t):JC(e,t),n}function HC(e,t){var r=t.head,n=1,i=r.data;for(e-=i.length;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),e-=o,e===0){o===a.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++n}return t.length-=n,i}function JC(e,t){var r=ca.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,o),e-=o,e===0){o===a.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++i}return t.length-=i,r}function pf(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,zn.nextTick(YC,t,e))}function YC(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function hw(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}});var mf=w((tB,ww)=>{"use strict";ww.exports=Kt;var cs=Hr(),yw=Object.create(Mn());yw.inherits=Vn();yw.inherits(Kt,cs);function ZC(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Kt(e){if(!(this instanceof Kt))return new Kt(e);cs.call(this,e),this._transformState={afterTransform:ZC.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",XC)}function XC(){var e=this;typeof this._flush=="function"?this._flush(function(t,r){gw(e,t,r)}):gw(this,null,null)}Kt.prototype.push=function(e,t){return this._transformState.needTransform=!1,cs.prototype.push.call(this,e,t)};Kt.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")};Kt.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};Kt.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Kt.prototype._destroy=function(e,t){var r=this;cs.prototype._destroy.call(this,e,function(n){t(n),r.emit("close")})};function gw(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}});var Ew=w((rB,vw)=>{"use strict";vw.exports=la;var _w=mf(),Iw=Object.create(Mn());Iw.inherits=Vn();Iw.inherits(la,_w);function la(e){if(!(this instanceof la))return new la(e);_w.call(this,e)}la.prototype._transform=function(e,t,r){r(null,e)}});var gf=w((Ae,ls)=>{var St=$t("stream");process.env.READABLE_STREAM==="disable"&&St?(ls.exports=St,Ae=ls.exports=St.Readable,Ae.Readable=St.Readable,Ae.Writable=St.Writable,Ae.Duplex=St.Duplex,Ae.Transform=St.Transform,Ae.PassThrough=St.PassThrough,Ae.Stream=St):(Ae=ls.exports=af(),Ae.Stream=St||Ae,Ae.Readable=Ae,Ae.Writable=tf(),Ae.Duplex=Hr(),Ae.Transform=mf(),Ae.PassThrough=Ew())});var Wt=w(Ke=>{"use strict";Ke.base64=!0;Ke.array=!0;Ke.string=!0;Ke.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";Ke.nodebuffer=typeof Buffer<"u";Ke.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")Ke.blob=!1;else{yf=new ArrayBuffer(0);try{Ke.blob=new Blob([yf],{type:"application/zip"}).size===0}catch{try{bw=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,wf=new bw,wf.append(yf),Ke.blob=wf.getBlob("application/zip").size===0}catch{Ke.blob=!1}}}var yf,bw,wf;try{Ke.nodestream=!!gf().Readable}catch{Ke.nodestream=!1}});var If=w(_f=>{"use strict";var QC=de(),ex=Wt(),Nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";_f.encode=function(e){for(var t=[],r,n,i,a,o,s,c,l=0,d=e.length,f=d,p=QC.getTypeOf(e)!=="string";l<e.length;)f=d-l,p?(r=e[l++],n=l<d?e[l++]:0,i=l<d?e[l++]:0):(r=e.charCodeAt(l++),n=l<d?e.charCodeAt(l++):0,i=l<d?e.charCodeAt(l++):0),a=r>>2,o=(r&3)<<4|n>>4,s=f>1?(n&15)<<2|i>>6:64,c=f>2?i&63:64,t.push(Nt.charAt(a)+Nt.charAt(o)+Nt.charAt(s)+Nt.charAt(c));return t.join("")};_f.decode=function(e){var t,r,n,i,a,o,s,c=0,l=0,d="data:";if(e.substr(0,d.length)===d)throw new Error("Invalid base64 input, it looks like a data url.");e=e.replace(/[^A-Za-z0-9+/=]/g,"");var f=e.length*3/4;if(e.charAt(e.length-1)===Nt.charAt(64)&&f--,e.charAt(e.length-2)===Nt.charAt(64)&&f--,f%1!==0)throw new Error("Invalid base64 input, bad content length.");var p;for(ex.uint8array?p=new Uint8Array(f|0):p=new Array(f|0);c<e.length;)i=Nt.indexOf(e.charAt(c++)),a=Nt.indexOf(e.charAt(c++)),o=Nt.indexOf(e.charAt(c++)),s=Nt.indexOf(e.charAt(c++)),t=i<<2|a>>4,r=(a&15)<<4|o>>2,n=(o&3)<<6|s,p[l++]=t,o!==64&&(p[l++]=r),s!==64&&(p[l++]=n);return p}});var da=w((aB,Aw)=>{"use strict";Aw.exports={isNode:typeof Buffer<"u",newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if(typeof e=="number")throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on=="function"&&typeof e.pause=="function"&&typeof e.resume=="function"}}});var Nw=w((oB,Sw)=>{"use strict";var Rw=global.MutationObserver||global.WebKitMutationObserver,Bn;process.browser?Rw?(vf=0,kw=new Rw(fa),Ef=global.document.createTextNode(""),kw.observe(Ef,{characterData:!0}),Bn=function(){Ef.data=vf=++vf%2}):!global.setImmediate&&typeof global.MessageChannel<"u"?(bf=new global.MessageChannel,bf.port1.onmessage=fa,Bn=function(){bf.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?Bn=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){fa(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:Bn=function(){setTimeout(fa,0)}:Bn=function(){process.nextTick(fa)};var vf,kw,Ef,bf,Af,pa=[];function fa(){Af=!0;for(var e,t,r=pa.length;r;){for(t=pa,pa=[],e=-1;++e<r;)t[e]();r=pa.length}Af=!1}Sw.exports=tx;function tx(e){pa.push(e)===1&&!Af&&Bn()}});var jw=w((sB,Tw)=>{"use strict";var Pw=Nw();function qn(){}var De={},Ow=["REJECTED"],Rf=["FULFILLED"],Dw=["PENDING"];process.browser||(ua=["UNHANDLED"]);var ua;Tw.exports=gr;function gr(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=Dw,this.queue=[],this.outcome=void 0,process.browser||(this.handled=ua),e!==qn&&Cw(this,e)}gr.prototype.finally=function(e){if(typeof e!="function")return this;var t=this.constructor;return this.then(r,n);function r(i){function a(){return i}return t.resolve(e()).then(a)}function n(i){function a(){throw i}return t.resolve(e()).then(a)}};gr.prototype.catch=function(e){return this.then(null,e)};gr.prototype.then=function(e,t){if(typeof e!="function"&&this.state===Rf||typeof t!="function"&&this.state===Ow)return this;var r=new this.constructor(qn);if(process.browser||this.handled===ua&&(this.handled=null),this.state!==Dw){var n=this.state===Rf?e:t;kf(r,n,this.outcome)}else this.queue.push(new ha(r,e,t));return r};function ha(e,t,r){this.promise=e,typeof t=="function"&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),typeof r=="function"&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}ha.prototype.callFulfilled=function(e){De.resolve(this.promise,e)};ha.prototype.otherCallFulfilled=function(e){kf(this.promise,this.onFulfilled,e)};ha.prototype.callRejected=function(e){De.reject(this.promise,e)};ha.prototype.otherCallRejected=function(e){kf(this.promise,this.onRejected,e)};function kf(e,t,r){Pw(function(){var n;try{n=t(r)}catch(i){return De.reject(e,i)}n===e?De.reject(e,new TypeError("Cannot resolve promise with itself")):De.resolve(e,n)})}De.resolve=function(e,t){var r=xw(rx,t);if(r.status==="error")return De.reject(e,r.value);var n=r.value;if(n)Cw(e,n);else{e.state=Rf,e.outcome=t;for(var i=-1,a=e.queue.length;++i<a;)e.queue[i].callFulfilled(t)}return e};De.reject=function(e,t){e.state=Ow,e.outcome=t,process.browser||e.handled===ua&&Pw(function(){e.handled===ua&&process.emit("unhandledRejection",t,e)});for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e};function rx(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function Cw(e,t){var r=!1;function n(s){r||(r=!0,De.reject(e,s))}function i(s){r||(r=!0,De.resolve(e,s))}function a(){t(i,n)}var o=xw(a);o.status==="error"&&n(o.value)}function xw(e,t){var r={};try{r.value=e(t),r.status="success"}catch(n){r.status="error",r.value=n}return r}gr.resolve=nx;function nx(e){return e instanceof this?e:De.resolve(new this(qn),e)}gr.reject=ix;function ix(e){var t=new this(qn);return De.reject(t,e)}gr.all=ax;function ax(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var i=new Array(r),a=0,o=-1,s=new this(qn);++o<r;)c(e[o],o);return s;function c(l,d){t.resolve(l).then(f,function(p){n||(n=!0,De.reject(s,p))});function f(p){i[d]=p,++a===r&&!n&&(n=!0,De.resolve(s,i))}}}gr.race=ox;function ox(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var i=-1,a=new this(qn);++i<r;)o(e[i]);return a;function o(s){t.resolve(s).then(function(c){n||(n=!0,De.resolve(a,c))},function(c){n||(n=!0,De.reject(a,c))})}}});var Gn=w((cB,Lw)=>{"use strict";var Sf=null;typeof Promise<"u"?Sf=Promise:Sf=jw();Lw.exports={Promise:Sf}});var Mw=w($w=>{(function(e,t){"use strict";if(e.setImmediate)return;var r=1,n={},i=!1,a=e.document,o;function s(_){typeof _!="function"&&(_=new Function(""+_));for(var b=new Array(arguments.length-1),E=0;E<b.length;E++)b[E]=arguments[E+1];var I={callback:_,args:b};return n[r]=I,o(r),r++}function c(_){delete n[_]}function l(_){var b=_.callback,E=_.args;switch(E.length){case 0:b();break;case 1:b(E[0]);break;case 2:b(E[0],E[1]);break;case 3:b(E[0],E[1],E[2]);break;default:b.apply(t,E);break}}function d(_){if(i)setTimeout(d,0,_);else{var b=n[_];if(b){i=!0;try{l(b)}finally{c(_),i=!1}}}}function f(){o=function(_){process.nextTick(function(){d(_)})}}function p(){if(e.postMessage&&!e.importScripts){var _=!0,b=e.onmessage;return e.onmessage=function(){_=!1},e.postMessage("","*"),e.onmessage=b,_}}function u(){var _="setImmediate$"+Math.random()+"$",b=function(E){E.source===e&&typeof E.data=="string"&&E.data.indexOf(_)===0&&d(+E.data.slice(_.length))};e.addEventListener?e.addEventListener("message",b,!1):e.attachEvent("onmessage",b),o=function(E){e.postMessage(_+E,"*")}}function h(){var _=new MessageChannel;_.port1.onmessage=function(b){var E=b.data;d(E)},o=function(b){_.port2.postMessage(b)}}function m(){var _=a.documentElement;o=function(b){var E=a.createElement("script");E.onreadystatechange=function(){d(b),E.onreadystatechange=null,_.removeChild(E),E=null},_.appendChild(E)}}function g(){o=function(_){setTimeout(d,0,_)}}var y=Object.getPrototypeOf&&Object.getPrototypeOf(e);y=y&&y.setTimeout?y:e,{}.toString.call(e.process)==="[object process]"?f():p()?u():e.MessageChannel?h():a&&"onreadystatechange"in a.createElement("script")?m():g(),y.setImmediate=s,y.clearImmediate=c})(typeof self>"u"?typeof global>"u"?$w:global:self)});var de=w(ye=>{"use strict";var yr=Wt(),sx=If(),Kn=da(),Nf=Gn();Mw();function cx(e){var t=null;return yr.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),fs(e,t)}ye.newBlob=function(e,t){ye.checkSupport("blob");try{return new Blob([e],{type:t})}catch{try{var r=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,n=new r;return n.append(e),n.getBlob(t)}catch{throw new Error("Bug : can't construct the Blob.")}}};function ma(e){return e}function fs(e,t){for(var r=0;r<e.length;++r)t[r]=e.charCodeAt(r)&255;return t}var ds={stringifyByChunk:function(e,t,r){var n=[],i=0,a=e.length;if(a<=r)return String.fromCharCode.apply(null,e);for(;i<a;)t==="array"||t==="nodebuffer"?n.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+r,a)))):n.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+r,a)))),i+=r;return n.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:(function(){try{return yr.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return yr.nodebuffer&&String.fromCharCode.apply(null,Kn.allocBuffer(1)).length===1}catch{return!1}})()}};function ga(e){var t=65536,r=ye.getTypeOf(e),n=!0;if(r==="uint8array"?n=ds.applyCanBeUsed.uint8array:r==="nodebuffer"&&(n=ds.applyCanBeUsed.nodebuffer),n)for(;t>1;)try{return ds.stringifyByChunk(e,r,t)}catch{t=Math.floor(t/2)}return ds.stringifyByChar(e)}ye.applyFromCharCode=ga;function ps(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}var wr={};wr.string={string:ma,array:function(e){return fs(e,new Array(e.length))},arraybuffer:function(e){return wr.string.uint8array(e).buffer},uint8array:function(e){return fs(e,new Uint8Array(e.length))},nodebuffer:function(e){return fs(e,Kn.allocBuffer(e.length))}};wr.array={string:ga,array:ma,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return Kn.newBufferFrom(e)}};wr.arraybuffer={string:function(e){return ga(new Uint8Array(e))},array:function(e){return ps(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:ma,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return Kn.newBufferFrom(new Uint8Array(e))}};wr.uint8array={string:ga,array:function(e){return ps(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:ma,nodebuffer:function(e){return Kn.newBufferFrom(e)}};wr.nodebuffer={string:ga,array:function(e){return ps(e,new Array(e.length))},arraybuffer:function(e){return wr.nodebuffer.uint8array(e).buffer},uint8array:function(e){return ps(e,new Uint8Array(e.length))},nodebuffer:ma};ye.transformTo=function(e,t){if(t||(t=""),!e)return t;ye.checkSupport(e);var r=ye.getTypeOf(t),n=wr[r][e](t);return n};ye.resolve=function(e){for(var t=e.split("/"),r=[],n=0;n<t.length;n++){var i=t[n];i==="."||i===""&&n!==0&&n!==t.length-1||(i===".."?r.pop():r.push(i))}return r.join("/")};ye.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(yr.nodebuffer&&Kn.isBuffer(e))return"nodebuffer";if(yr.uint8array&&e instanceof Uint8Array)return"uint8array";if(yr.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};ye.checkSupport=function(e){var t=yr[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};ye.MAX_VALUE_16BITS=65535;ye.MAX_VALUE_32BITS=-1;ye.pretty=function(e){var t="",r,n;for(n=0;n<(e||"").length;n++)r=e.charCodeAt(n),t+="\\x"+(r<16?"0":"")+r.toString(16).toUpperCase();return t};ye.delay=function(e,t,r){setImmediate(function(){e.apply(r||null,t||[])})};ye.inherits=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r};ye.extend=function(){var e={},t,r;for(t=0;t<arguments.length;t++)for(r in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],r)&&typeof e[r]>"u"&&(e[r]=arguments[t][r]);return e};ye.prepareContent=function(e,t,r,n,i){var a=Nf.Promise.resolve(t).then(function(o){var s=yr.blob&&(o instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(o))!==-1);return s&&typeof FileReader<"u"?new Nf.Promise(function(c,l){var d=new FileReader;d.onload=function(f){c(f.target.result)},d.onerror=function(f){l(f.target.error)},d.readAsArrayBuffer(o)}):o});return a.then(function(o){var s=ye.getTypeOf(o);return s?(s==="arraybuffer"?o=ye.transformTo("uint8array",o):s==="string"&&(i?o=sx.decode(o):r&&n!==!0&&(o=cx(o))),o):Nf.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var We=w((fB,Uw)=>{"use strict";function Vw(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}Vw.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return this.isFinished?!1:(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(r){t.processChunk(r)}),e.on("end",function(){t.end()}),e.on("error",function(r){t.error(r)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}};Uw.exports=Vw});var Hn=w(_r=>{"use strict";var Wn=de(),Jr=Wt(),lx=da(),us=We(),ya=new Array(256);for(Ht=0;Ht<256;Ht++)ya[Ht]=Ht>=252?6:Ht>=248?5:Ht>=240?4:Ht>=224?3:Ht>=192?2:1;var Ht;ya[254]=ya[254]=1;var dx=function(e){var t,r,n,i,a,o=e.length,s=0;for(i=0;i<o;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(Jr.uint8array?t=new Uint8Array(s):t=new Array(s),a=0,i=0;a<s;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[a++]=r:r<2048?(t[a++]=192|r>>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t},fx=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+ya[e[r]]>t?r:t},px=function(e){var t,r,n,i,a=e.length,o=new Array(a*2);for(r=0,t=0;t<a;){if(n=e[t++],n<128){o[r++]=n;continue}if(i=ya[n],i>4){o[r++]=65533,t+=i-1;continue}for(n&=i===2?31:i===3?15:7;i>1&&t<a;)n=n<<6|e[t++]&63,i--;if(i>1){o[r++]=65533;continue}n<65536?o[r++]=n:(n-=65536,o[r++]=55296|n>>10&1023,o[r++]=56320|n&1023)}return o.length!==r&&(o.subarray?o=o.subarray(0,r):o.length=r),Wn.applyFromCharCode(o)};_r.utf8encode=function(t){return Jr.nodebuffer?lx.newBufferFrom(t,"utf-8"):dx(t)};_r.utf8decode=function(t){return Jr.nodebuffer?Wn.transformTo("nodebuffer",t).toString("utf-8"):(t=Wn.transformTo(Jr.uint8array?"uint8array":"array",t),px(t))};function hs(){us.call(this,"utf-8 decode"),this.leftOver=null}Wn.inherits(hs,us);hs.prototype.processChunk=function(e){var t=Wn.transformTo(Jr.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(Jr.uint8array){var r=t;t=new Uint8Array(r.length+this.leftOver.length),t.set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var n=fx(t),i=t;n!==t.length&&(Jr.uint8array?(i=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(i=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:_r.utf8decode(i),meta:e.meta})};hs.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:_r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};_r.Utf8DecodeWorker=hs;function Pf(){us.call(this,"utf-8 encode")}Wn.inherits(Pf,us);Pf.prototype.processChunk=function(e){this.push({data:_r.utf8encode(e.data),meta:e.meta})};_r.Utf8EncodeWorker=Pf});var qw=w((uB,Bw)=>{"use strict";var Fw=We(),zw=de();function Of(e){Fw.call(this,"ConvertWorker to "+e),this.destType=e}zw.inherits(Of,Fw);Of.prototype.processChunk=function(e){this.push({data:zw.transformTo(this.destType,e.data),meta:e.meta})};Bw.exports=Of});var Ww=w((hB,Kw)=>{"use strict";var Gw=gf().Readable,ux=de();ux.inherits(Df,Gw);function Df(e,t,r){Gw.call(this,t),this._helper=e;var n=this;e.on("data",function(i,a){n.push(i)||n._helper.pause(),r&&r(a)}).on("error",function(i){n.emit("error",i)}).on("end",function(){n.push(null)})}Df.prototype._read=function(){this._helper.resume()};Kw.exports=Df});var Cf=w((mB,Yw)=>{"use strict";var Yr=de(),hx=qw(),mx=We(),gx=If(),yx=Wt(),wx=Gn(),Hw=null;if(yx.nodestream)try{Hw=Ww()}catch{}function _x(e,t,r){switch(e){case"blob":return Yr.newBlob(Yr.transformTo("arraybuffer",t),r);case"base64":return gx.encode(t);default:return Yr.transformTo(e,t)}}function Ix(e,t){var r,n=0,i=null,a=0;for(r=0;r<t.length;r++)a+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(i=new Uint8Array(a),r=0;r<t.length;r++)i.set(t[r],n),n+=t[r].length;return i;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}function vx(e,t){return new wx.Promise(function(r,n){var i=[],a=e._internalType,o=e._outputType,s=e._mimeType;e.on("data",function(c,l){i.push(c),t&&t(l)}).on("error",function(c){i=[],n(c)}).on("end",function(){try{var c=_x(o,Ix(a,i),s);r(c)}catch(l){n(l)}i=[]}).resume()})}function Jw(e,t,r){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string";break}try{this._internalType=n,this._outputType=t,this._mimeType=r,Yr.checkSupport(n),this._worker=e.pipe(new hx(n)),e.lock()}catch(i){this._worker=new mx("error"),this._worker.error(i)}}Jw.prototype={accumulate:function(e){return vx(this,e)},on:function(e,t){var r=this;return e==="data"?this._worker.on(e,function(n){t.call(r,n.data,n.meta)}):this._worker.on(e,function(){Yr.delay(t,arguments,r)}),this},resume:function(){return Yr.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(Yr.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new Hw(this,{objectMode:this._outputType!=="nodebuffer"},e)}};Yw.exports=Jw});var xf=w(ht=>{"use strict";ht.base64=!1;ht.binary=!1;ht.dir=!1;ht.createFolders=!0;ht.date=null;ht.compression=null;ht.compressionOptions=null;ht.comment=null;ht.unixPermissions=null;ht.dosPermissions=null});var Tf=w((yB,Zw)=>{"use strict";var ms=de(),gs=We(),Ex=16*1024;function Jn(e){gs.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(r){t.dataIsReady=!0,t.data=r,t.max=r&&r.length||0,t.type=ms.getTypeOf(r),t.isPaused||t._tickAndRepeat()},function(r){t.error(r)})}ms.inherits(Jn,gs);Jn.prototype.cleanUp=function(){gs.prototype.cleanUp.call(this),this.data=null};Jn.prototype.resume=function(){return gs.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,ms.delay(this._tickAndRepeat,[],this)),!0):!1};Jn.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(ms.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};Jn.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=Ex,t=null,r=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,r);break;case"uint8array":t=this.data.subarray(this.index,r);break;case"array":case"nodebuffer":t=this.data.slice(this.index,r);break}return this.index=r,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})};Zw.exports=Jn});var ys=w((wB,Qw)=>{"use strict";var bx=de();function Ax(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var Xw=Ax();function Rx(e,t,r,n){var i=Xw,a=n+r;e=e^-1;for(var o=n;o<a;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}function kx(e,t,r,n){var i=Xw,a=n+r;e=e^-1;for(var o=n;o<a;o++)e=e>>>8^i[(e^t.charCodeAt(o))&255];return e^-1}Qw.exports=function(t,r){if(typeof t>"u"||!t.length)return 0;var n=bx.getTypeOf(t)!=="string";return n?Rx(r|0,t,t.length,0):kx(r|0,t,t.length,0)}});var Lf=w((_B,t_)=>{"use strict";var e_=We(),Sx=ys(),Nx=de();function jf(){e_.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}Nx.inherits(jf,e_);jf.prototype.processChunk=function(e){this.streamInfo.crc32=Sx(e.data,this.streamInfo.crc32||0),this.push(e)};t_.exports=jf});var n_=w((IB,r_)=>{"use strict";var Px=de(),$f=We();function Mf(e){$f.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}Px.inherits(Mf,$f);Mf.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}$f.prototype.processChunk.call(this,e)};r_.exports=Mf});var ws=w((vB,o_)=>{"use strict";var i_=Gn(),a_=Tf(),Ox=Lf(),Vf=n_();function Uf(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}Uf.prototype={getContentWorker:function(){var e=new a_(i_.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Vf("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new a_(i_.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};Uf.createWorkerFrom=function(e,t,r){return e.pipe(new Ox).pipe(new Vf("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new Vf("compressedSize")).withStreamInfo("compression",t)};o_.exports=Uf});var d_=w((EB,l_)=>{"use strict";var Dx=Cf(),Cx=Tf(),Ff=Hn(),zf=ws(),s_=We(),Bf=function(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}};Bf.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");r=e.toLowerCase();var n=r==="string"||r==="text";(r==="binarystring"||r==="text")&&(r="string"),t=this._decompressWorker();var i=!this._dataBinary;i&&!n&&(t=t.pipe(new Ff.Utf8EncodeWorker)),!i&&n&&(t=t.pipe(new Ff.Utf8DecodeWorker))}catch(a){t=new s_("error"),t.error(a)}return new Dx(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof zf&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new Ff.Utf8EncodeWorker)),zf.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof zf?this._data.getContentWorker():this._data instanceof s_?this._data:new Cx(this._data)}};var c_=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],xx=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(_s=0;_s<c_.length;_s++)Bf.prototype[c_[_s]]=xx;var _s;l_.exports=Bf});var Jt=w(Te=>{"use strict";var Tx=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function jx(e,t){return Object.prototype.hasOwnProperty.call(e,t)}Te.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var n in r)jx(r,n)&&(e[n]=r[n])}}return e};Te.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var Lx={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+n),i);return}for(var a=0;a<n;a++)e[i+a]=t[r+a]},flattenChunks:function(e){var t,r,n,i,a,o;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(o=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)a=e[t],o.set(a,i),i+=a.length;return o}},$x={arraySet:function(e,t,r,n,i){for(var a=0;a<n;a++)e[i+a]=t[r+a]},flattenChunks:function(e){return[].concat.apply([],e)}};Te.setTyped=function(e){e?(Te.Buf8=Uint8Array,Te.Buf16=Uint16Array,Te.Buf32=Int32Array,Te.assign(Te,Lx)):(Te.Buf8=Array,Te.Buf16=Array,Te.Buf32=Array,Te.assign(Te,$x))};Te.setTyped(Tx)});var x_=w(Xn=>{"use strict";var Mx=Jt(),Vx=4,f_=0,p_=1,Ux=2;function Zn(e){for(var t=e.length;--t>=0;)e[t]=0}var Fx=0,w_=1,zx=2,Bx=3,qx=258,Yf=29,ba=256,_a=ba+1+Yf,Yn=30,Zf=19,__=2*_a+1,Zr=15,qf=16,Gx=7,Xf=256,I_=16,v_=17,E_=18,Hf=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Is=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Kx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],b_=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Wx=512,Yt=new Array((_a+2)*2);Zn(Yt);var wa=new Array(Yn*2);Zn(wa);var Ia=new Array(Wx);Zn(Ia);var va=new Array(qx-Bx+1);Zn(va);var Qf=new Array(Yf);Zn(Qf);var vs=new Array(Yn);Zn(vs);function Gf(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}var A_,R_,k_;function Kf(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function S_(e){return e<256?Ia[e]:Ia[256+(e>>>7)]}function Ea(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function ze(e,t,r){e.bi_valid>qf-r?(e.bi_buf|=t<<e.bi_valid&65535,Ea(e,e.bi_buf),e.bi_buf=t>>qf-e.bi_valid,e.bi_valid+=r-qf):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function Pt(e,t,r){ze(e,r[t*2],r[t*2+1])}function N_(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function Hx(e){e.bi_valid===16?(Ea(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function Jx(e,t){var r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,d,f,p,u,h,m=0;for(p=0;p<=Zr;p++)e.bl_count[p]=0;for(r[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<__;l++)d=e.heap[l],p=r[r[d*2+1]*2+1]+1,p>c&&(p=c,m++),r[d*2+1]=p,!(d>n)&&(e.bl_count[p]++,u=0,d>=s&&(u=o[d-s]),h=r[d*2],e.opt_len+=h*(p+u),a&&(e.static_len+=h*(i[d*2+1]+u)));if(m!==0){do{for(p=c-1;e.bl_count[p]===0;)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[c]--,m-=2}while(m>0);for(p=c;p!==0;p--)for(d=e.bl_count[p];d!==0;)f=e.heap[--l],!(f>n)&&(r[f*2+1]!==p&&(e.opt_len+=(p-r[f*2+1])*r[f*2],r[f*2+1]=p),d--)}}function P_(e,t,r){var n=new Array(Zr+1),i=0,a,o;for(a=1;a<=Zr;a++)n[a]=i=i+r[a-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=N_(n[s]++,s))}}function Yx(){var e,t,r,n,i,a=new Array(Zr+1);for(r=0,n=0;n<Yf-1;n++)for(Qf[n]=r,e=0;e<1<<Hf[n];e++)va[r++]=n;for(va[r-1]=n,i=0,n=0;n<16;n++)for(vs[n]=i,e=0;e<1<<Is[n];e++)Ia[i++]=n;for(i>>=7;n<Yn;n++)for(vs[n]=i<<7,e=0;e<1<<Is[n]-7;e++)Ia[256+i++]=n;for(t=0;t<=Zr;t++)a[t]=0;for(e=0;e<=143;)Yt[e*2+1]=8,e++,a[8]++;for(;e<=255;)Yt[e*2+1]=9,e++,a[9]++;for(;e<=279;)Yt[e*2+1]=7,e++,a[7]++;for(;e<=287;)Yt[e*2+1]=8,e++,a[8]++;for(P_(Yt,_a+1,a),e=0;e<Yn;e++)wa[e*2+1]=5,wa[e*2]=N_(e,5);A_=new Gf(Yt,Hf,ba+1,_a,Zr),R_=new Gf(wa,Is,0,Yn,Zr),k_=new Gf(new Array(0),Kx,0,Zf,Gx)}function O_(e){var t;for(t=0;t<_a;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Yn;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Zf;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Xf*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function D_(e){e.bi_valid>8?Ea(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Zx(e,t,r,n){D_(e),n&&(Ea(e,r),Ea(e,~r)),Mx.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function u_(e,t,r,n){var i=t*2,a=r*2;return e[i]<e[a]||e[i]===e[a]&&n[t]<=n[r]}function Wf(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&u_(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!u_(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function h_(e,t,r){var n,i,a=0,o,s;if(e.last_lit!==0)do n=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1],i=e.pending_buf[e.l_buf+a],a++,n===0?Pt(e,i,t):(o=va[i],Pt(e,o+ba+1,t),s=Hf[o],s!==0&&(i-=Qf[o],ze(e,i,s)),n--,o=S_(n),Pt(e,o,r),s=Is[o],s!==0&&(n-=vs[o],ze(e,n,s)));while(a<e.last_lit);Pt(e,Xf,t)}function Jf(e,t){var r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,o,s,c=-1,l;for(e.heap_len=0,e.heap_max=__,o=0;o<a;o++)r[o*2]!==0?(e.heap[++e.heap_len]=c=o,e.depth[o]=0):r[o*2+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,r[l*2]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=n[l*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)Wf(e,r,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Wf(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,r[l*2]=r[o*2]+r[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,r[o*2+1]=r[s*2+1]=l,e.heap[1]=l++,Wf(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Jx(e,t),P_(r,c,e.bl_count)}function m_(e,t,r){var n,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)a=o,o=t[(n+1)*2+1],!(++s<c&&a===o)&&(s<l?e.bl_tree[a*2]+=s:a!==0?(a!==i&&e.bl_tree[a*2]++,e.bl_tree[I_*2]++):s<=10?e.bl_tree[v_*2]++:e.bl_tree[E_*2]++,s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))}function g_(e,t,r){var n,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),n=0;n<=r;n++)if(a=o,o=t[(n+1)*2+1],!(++s<c&&a===o)){if(s<l)do Pt(e,a,e.bl_tree);while(--s!==0);else a!==0?(a!==i&&(Pt(e,a,e.bl_tree),s--),Pt(e,I_,e.bl_tree),ze(e,s-3,2)):s<=10?(Pt(e,v_,e.bl_tree),ze(e,s-3,3)):(Pt(e,E_,e.bl_tree),ze(e,s-11,7));s=0,i=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}}function Xx(e){var t;for(m_(e,e.dyn_ltree,e.l_desc.max_code),m_(e,e.dyn_dtree,e.d_desc.max_code),Jf(e,e.bl_desc),t=Zf-1;t>=3&&e.bl_tree[b_[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function Qx(e,t,r,n){var i;for(ze(e,t-257,5),ze(e,r-1,5),ze(e,n-4,4),i=0;i<n;i++)ze(e,e.bl_tree[b_[i]*2+1],3);g_(e,e.dyn_ltree,t-1),g_(e,e.dyn_dtree,r-1)}function eT(e){var t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return f_;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return p_;for(r=32;r<ba;r++)if(e.dyn_ltree[r*2]!==0)return p_;return f_}var y_=!1;function tT(e){y_||(Yx(),y_=!0),e.l_desc=new Kf(e.dyn_ltree,A_),e.d_desc=new Kf(e.dyn_dtree,R_),e.bl_desc=new Kf(e.bl_tree,k_),e.bi_buf=0,e.bi_valid=0,O_(e)}function C_(e,t,r,n){ze(e,(Fx<<1)+(n?1:0),3),Zx(e,t,r,!0)}function rT(e){ze(e,w_<<1,3),Pt(e,Xf,Yt),Hx(e)}function nT(e,t,r,n){var i,a,o=0;e.level>0?(e.strm.data_type===Ux&&(e.strm.data_type=eT(e)),Jf(e,e.l_desc),Jf(e,e.d_desc),o=Xx(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&t!==-1?C_(e,t,r,n):e.strategy===Vx||a===i?(ze(e,(w_<<1)+(n?1:0),3),h_(e,Yt,wa)):(ze(e,(zx<<1)+(n?1:0),3),Qx(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),h_(e,e.dyn_ltree,e.dyn_dtree)),O_(e),n&&D_(e)}function iT(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(va[r]+ba+1)*2]++,e.dyn_dtree[S_(t)*2]++),e.last_lit===e.lit_bufsize-1}Xn._tr_init=tT;Xn._tr_stored_block=C_;Xn._tr_flush_block=nT;Xn._tr_tally=iT;Xn._tr_align=rT});var ep=w((RB,T_)=>{"use strict";function aT(e,t,r,n){for(var i=e&65535|0,a=e>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+t[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0}T_.exports=aT});var tp=w((kB,j_)=>{"use strict";function oT(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var sT=oT();function cT(e,t,r,n){var i=sT,a=n+r;e^=-1;for(var o=n;o<a;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}j_.exports=cT});var Es=w((SB,L_)=>{"use strict";L_.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var G_=w(Ct=>{"use strict";var je=Jt(),at=x_(),U_=ep(),Ir=tp(),lT=Es(),tn=0,dT=1,fT=3,Rr=4,$_=5,Dt=0,M_=1,ot=-2,pT=-3,rp=-5,uT=-1,hT=1,bs=2,mT=3,gT=4,yT=0,wT=2,Ss=8,_T=9,IT=15,vT=8,ET=29,bT=256,ip=bT+1+ET,AT=30,RT=19,kT=2*ip+1,ST=15,F=3,br=258,mt=br+F+1,NT=32,Ns=42,ap=69,As=73,Rs=91,ks=103,Xr=113,Ra=666,we=1,ka=2,Qr=3,ti=4,PT=3;function Ar(e,t){return e.msg=lT[t],t}function V_(e){return(e<<1)-(e>4?9:0)}function Er(e){for(var t=e.length;--t>=0;)e[t]=0}function vr(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(je.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function Re(e,t){at._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,vr(e.strm)}function W(e,t){e.pending_buf[e.pending++]=t}function Aa(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function OT(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,je.arraySet(t,e.input,e.next_in,i,r),e.state.wrap===1?e.adler=U_(e.adler,t,i,r):e.state.wrap===2&&(e.adler=Ir(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function F_(e,t){var r=e.max_chain_length,n=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-mt?e.strstart-(e.w_size-mt):0,l=e.window,d=e.w_mask,f=e.prev,p=e.strstart+br,u=l[n+o-1],h=l[n+o];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(l[i+o]!==h||l[i+o-1]!==u||l[i]!==l[n]||l[++i]!==l[n+1])){n+=2,i++;do;while(l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&n<p);if(a=br-(p-n),n=p-br,a>o){if(e.match_start=t,o=a,a>=s)break;u=l[n+o-1],h=l[n+o]}}while((t=f[t&d])>c&&--r!==0);return o<=e.lookahead?o:e.lookahead}function en(e){var t=e.w_size,r,n,i,a,o;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-mt)){je.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,r=n;do i=e.head[--r],e.head[r]=i>=t?i-t:0;while(--n);n=t,r=n;do i=e.prev[--r],e.prev[r]=i>=t?i-t:0;while(--n);a+=t}if(e.strm.avail_in===0)break;if(n=OT(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=n,e.lookahead+e.insert>=F)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+F-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<F)););}while(e.lookahead<mt&&e.strm.avail_in!==0)}function DT(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(en(e),e.lookahead===0&&t===tn)return we;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,Re(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-mt&&(Re(e,!1),e.strm.avail_out===0))return we}return e.insert=0,t===Rr?(Re(e,!0),e.strm.avail_out===0?Qr:ti):(e.strstart>e.block_start&&(Re(e,!1),e.strm.avail_out===0),we)}function np(e,t){for(var r,n;;){if(e.lookahead<mt){if(en(e),e.lookahead<mt&&t===tn)return we;if(e.lookahead===0)break}if(r=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-mt&&(e.match_length=F_(e,r)),e.match_length>=F)if(n=at._tr_tally(e,e.strstart-e.match_start,e.match_length-F),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=F){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=at._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Re(e,!1),e.strm.avail_out===0))return we}return e.insert=e.strstart<F-1?e.strstart:F-1,t===Rr?(Re(e,!0),e.strm.avail_out===0?Qr:ti):e.last_lit&&(Re(e,!1),e.strm.avail_out===0)?we:ka}function Qn(e,t){for(var r,n,i;;){if(e.lookahead<mt){if(en(e),e.lookahead<mt&&t===tn)return we;if(e.lookahead===0)break}if(r=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=F-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-mt&&(e.match_length=F_(e,r),e.match_length<=5&&(e.strategy===hT||e.match_length===F&&e.strstart-e.match_start>4096)&&(e.match_length=F-1)),e.prev_length>=F&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-F,n=at._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-F),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=F-1,e.strstart++,n&&(Re(e,!1),e.strm.avail_out===0))return we}else if(e.match_available){if(n=at._tr_tally(e,0,e.window[e.strstart-1]),n&&Re(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return we}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=at._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<F-1?e.strstart:F-1,t===Rr?(Re(e,!0),e.strm.avail_out===0?Qr:ti):e.last_lit&&(Re(e,!1),e.strm.avail_out===0)?we:ka}function CT(e,t){for(var r,n,i,a,o=e.window;;){if(e.lookahead<=br){if(en(e),e.lookahead<=br&&t===tn)return we;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=F&&e.strstart>0&&(i=e.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=e.strstart+br;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&i<a);e.match_length=br-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=F?(r=at._tr_tally(e,1,e.match_length-F),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=at._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Re(e,!1),e.strm.avail_out===0))return we}return e.insert=0,t===Rr?(Re(e,!0),e.strm.avail_out===0?Qr:ti):e.last_lit&&(Re(e,!1),e.strm.avail_out===0)?we:ka}function xT(e,t){for(var r;;){if(e.lookahead===0&&(en(e),e.lookahead===0)){if(t===tn)return we;break}if(e.match_length=0,r=at._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Re(e,!1),e.strm.avail_out===0))return we}return e.insert=0,t===Rr?(Re(e,!0),e.strm.avail_out===0?Qr:ti):e.last_lit&&(Re(e,!1),e.strm.avail_out===0)?we:ka}function Ot(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}var ei;ei=[new Ot(0,0,0,0,DT),new Ot(4,4,8,4,np),new Ot(4,5,16,8,np),new Ot(4,6,32,32,np),new Ot(4,4,16,16,Qn),new Ot(8,16,32,32,Qn),new Ot(8,16,128,128,Qn),new Ot(8,32,128,256,Qn),new Ot(32,128,258,1024,Qn),new Ot(32,258,258,4096,Qn)];function TT(e){e.window_size=2*e.w_size,Er(e.head),e.max_lazy_match=ei[e.level].max_lazy,e.good_match=ei[e.level].good_length,e.nice_match=ei[e.level].nice_length,e.max_chain_length=ei[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=F-1,e.match_available=0,e.ins_h=0}function jT(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ss,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new je.Buf16(kT*2),this.dyn_dtree=new je.Buf16((2*AT+1)*2),this.bl_tree=new je.Buf16((2*RT+1)*2),Er(this.dyn_ltree),Er(this.dyn_dtree),Er(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new je.Buf16(ST+1),this.heap=new je.Buf16(2*ip+1),Er(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new je.Buf16(2*ip+1),Er(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function z_(e){var t;return!e||!e.state?Ar(e,ot):(e.total_in=e.total_out=0,e.data_type=wT,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Ns:Xr,e.adler=t.wrap===2?0:1,t.last_flush=tn,at._tr_init(t),Dt)}function B_(e){var t=z_(e);return t===Dt&&TT(e.state),t}function LT(e,t){return!e||!e.state||e.state.wrap!==2?ot:(e.state.gzhead=t,Dt)}function q_(e,t,r,n,i,a){if(!e)return ot;var o=1;if(t===uT&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>_T||r!==Ss||n<8||n>15||t<0||t>9||a<0||a>gT)return Ar(e,ot);n===8&&(n=9);var s=new jT;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+F-1)/F),s.window=new je.Buf8(s.w_size*2),s.head=new je.Buf16(s.hash_size),s.prev=new je.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new je.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=r,B_(e)}function $T(e,t){return q_(e,t,Ss,IT,vT,yT)}function MT(e,t){var r,n,i,a;if(!e||!e.state||t>$_||t<0)return e?Ar(e,ot):ot;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===Ra&&t!==Rr)return Ar(e,e.avail_out===0?rp:ot);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===Ns)if(n.wrap===2)e.adler=0,W(n,31),W(n,139),W(n,8),n.gzhead?(W(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),W(n,n.gzhead.time&255),W(n,n.gzhead.time>>8&255),W(n,n.gzhead.time>>16&255),W(n,n.gzhead.time>>24&255),W(n,n.level===9?2:n.strategy>=bs||n.level<2?4:0),W(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(W(n,n.gzhead.extra.length&255),W(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Ir(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ap):(W(n,0),W(n,0),W(n,0),W(n,0),W(n,0),W(n,n.level===9?2:n.strategy>=bs||n.level<2?4:0),W(n,PT),n.status=Xr);else{var o=Ss+(n.w_bits-8<<4)<<8,s=-1;n.strategy>=bs||n.level<2?s=0:n.level<6?s=1:n.level===6?s=2:s=3,o|=s<<6,n.strstart!==0&&(o|=NT),o+=31-o%31,n.status=Xr,Aa(n,o),n.strstart!==0&&(Aa(n,e.adler>>>16),Aa(n,e.adler&65535)),e.adler=1}if(n.status===ap)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-i,i)),vr(e),i=n.pending,n.pending===n.pending_buf_size));)W(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=As)}else n.status=As;if(n.status===As)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-i,i)),vr(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.name.length?a=n.gzhead.name.charCodeAt(n.gzindex++)&255:a=0,W(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.gzindex=0,n.status=Rs)}else n.status=Rs;if(n.status===Rs)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-i,i)),vr(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindex<n.gzhead.comment.length?a=n.gzhead.comment.charCodeAt(n.gzindex++)&255:a=0,W(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.status=ks)}else n.status=ks;if(n.status===ks&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&vr(e),n.pending+2<=n.pending_buf_size&&(W(n,e.adler&255),W(n,e.adler>>8&255),e.adler=0,n.status=Xr)):n.status=Xr),n.pending!==0){if(vr(e),e.avail_out===0)return n.last_flush=-1,Dt}else if(e.avail_in===0&&V_(t)<=V_(r)&&t!==Rr)return Ar(e,rp);if(n.status===Ra&&e.avail_in!==0)return Ar(e,rp);if(e.avail_in!==0||n.lookahead!==0||t!==tn&&n.status!==Ra){var c=n.strategy===bs?xT(n,t):n.strategy===mT?CT(n,t):ei[n.level].func(n,t);if((c===Qr||c===ti)&&(n.status=Ra),c===we||c===Qr)return e.avail_out===0&&(n.last_flush=-1),Dt;if(c===ka&&(t===dT?at._tr_align(n):t!==$_&&(at._tr_stored_block(n,0,0,!1),t===fT&&(Er(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),vr(e),e.avail_out===0))return n.last_flush=-1,Dt}return t!==Rr?Dt:n.wrap<=0?M_:(n.wrap===2?(W(n,e.adler&255),W(n,e.adler>>8&255),W(n,e.adler>>16&255),W(n,e.adler>>24&255),W(n,e.total_in&255),W(n,e.total_in>>8&255),W(n,e.total_in>>16&255),W(n,e.total_in>>24&255)):(Aa(n,e.adler>>>16),Aa(n,e.adler&65535)),vr(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Dt:M_)}function VT(e){var t;return!e||!e.state?ot:(t=e.state.status,t!==Ns&&t!==ap&&t!==As&&t!==Rs&&t!==ks&&t!==Xr&&t!==Ra?Ar(e,ot):(e.state=null,t===Xr?Ar(e,pT):Dt))}function UT(e,t){var r=t.length,n,i,a,o,s,c,l,d;if(!e||!e.state||(n=e.state,o=n.wrap,o===2||o===1&&n.status!==Ns||n.lookahead))return ot;for(o===1&&(e.adler=U_(e.adler,t,r,0)),n.wrap=0,r>=n.w_size&&(o===0&&(Er(n.head),n.strstart=0,n.block_start=0,n.insert=0),d=new je.Buf8(n.w_size),je.arraySet(d,t,r-n.w_size,n.w_size,0),t=d,r=n.w_size),s=e.avail_in,c=e.next_in,l=e.input,e.avail_in=r,e.next_in=0,e.input=t,en(n);n.lookahead>=F;){i=n.strstart,a=n.lookahead-(F-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+F-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++;while(--a);n.strstart=i,n.lookahead=F-1,en(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=F-1,n.match_available=0,e.next_in=c,e.input=l,e.avail_in=s,n.wrap=o,Dt}Ct.deflateInit=$T;Ct.deflateInit2=q_;Ct.deflateReset=B_;Ct.deflateResetKeep=z_;Ct.deflateSetHeader=LT;Ct.deflate=MT;Ct.deflateEnd=VT;Ct.deflateSetDictionary=UT;Ct.deflateInfo="pako deflate (from Nodeca project)"});var op=w(ri=>{"use strict";var Ps=Jt(),K_=!0,W_=!0;try{String.fromCharCode.apply(null,[0])}catch{K_=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{W_=!1}var Sa=new Ps.Buf8(256);for(Zt=0;Zt<256;Zt++)Sa[Zt]=Zt>=252?6:Zt>=248?5:Zt>=240?4:Zt>=224?3:Zt>=192?2:1;var Zt;Sa[254]=Sa[254]=1;ri.string2buf=function(e){var t,r,n,i,a,o=e.length,s=0;for(i=0;i<o;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Ps.Buf8(s),a=0,i=0;a<s;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[a++]=r:r<2048?(t[a++]=192|r>>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t};function H_(e,t){if(t<65534&&(e.subarray&&W_||!e.subarray&&K_))return String.fromCharCode.apply(null,Ps.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}ri.buf2binstring=function(e){return H_(e,e.length)};ri.binstring2buf=function(e){for(var t=new Ps.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t};ri.buf2string=function(e,t){var r,n,i,a,o=t||e.length,s=new Array(o*2);for(n=0,r=0;r<o;){if(i=e[r++],i<128){s[n++]=i;continue}if(a=Sa[i],a>4){s[n++]=65533,r+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&r<o;)i=i<<6|e[r++]&63,a--;if(a>1){s[n++]=65533;continue}i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|i&1023)}return H_(s,n)};ri.utf8border=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+Sa[e[r]]>t?r:t}});var sp=w((OB,J_)=>{"use strict";function FT(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}J_.exports=FT});var Q_=w(Oa=>{"use strict";var Na=G_(),Pa=Jt(),lp=op(),dp=Es(),zT=sp(),X_=Object.prototype.toString,BT=0,cp=4,ni=0,Y_=1,Z_=2,qT=-1,GT=0,KT=8;function rn(e){if(!(this instanceof rn))return new rn(e);this.options=Pa.assign({level:qT,method:KT,chunkSize:16384,windowBits:15,memLevel:8,strategy:GT,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zT,this.strm.avail_out=0;var r=Na.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==ni)throw new Error(dp[r]);if(t.header&&Na.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=lp.string2buf(t.dictionary):X_.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,r=Na.deflateSetDictionary(this.strm,n),r!==ni)throw new Error(dp[r]);this._dict_set=!0}}rn.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;a=t===~~t?t:t===!0?cp:BT,typeof e=="string"?r.input=lp.string2buf(e):X_.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Pa.Buf8(n),r.next_out=0,r.avail_out=n),i=Na.deflate(r,a),i!==Y_&&i!==ni)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(a===cp||a===Z_))&&(this.options.to==="string"?this.onData(lp.buf2binstring(Pa.shrinkBuf(r.output,r.next_out))):this.onData(Pa.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==Y_);return a===cp?(i=Na.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ni):(a===Z_&&(this.onEnd(ni),r.avail_out=0),!0)};rn.prototype.onData=function(e){this.chunks.push(e)};rn.prototype.onEnd=function(e){e===ni&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Pa.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function fp(e,t){var r=new rn(t);if(r.push(e,!0),r.err)throw r.msg||dp[r.err];return r.result}function WT(e,t){return t=t||{},t.raw=!0,fp(e,t)}function HT(e,t){return t=t||{},t.gzip=!0,fp(e,t)}Oa.Deflate=rn;Oa.deflate=fp;Oa.deflateRaw=WT;Oa.gzip=HT});var tI=w((CB,eI)=>{"use strict";var Os=30,JT=12;eI.exports=function(t,r){var n,i,a,o,s,c,l,d,f,p,u,h,m,g,y,_,b,E,I,S,R,P,x,B,k;n=t.state,i=t.next_in,B=t.input,a=i+(t.avail_in-5),o=t.next_out,k=t.output,s=o-(r-t.avail_out),c=o+(t.avail_out-257),l=n.dmax,d=n.wsize,f=n.whave,p=n.wnext,u=n.window,h=n.hold,m=n.bits,g=n.lencode,y=n.distcode,_=(1<<n.lenbits)-1,b=(1<<n.distbits)-1;e:do{m<15&&(h+=B[i++]<<m,m+=8,h+=B[i++]<<m,m+=8),E=g[h&_];t:for(;;){if(I=E>>>24,h>>>=I,m-=I,I=E>>>16&255,I===0)k[o++]=E&65535;else if(I&16){S=E&65535,I&=15,I&&(m<I&&(h+=B[i++]<<m,m+=8),S+=h&(1<<I)-1,h>>>=I,m-=I),m<15&&(h+=B[i++]<<m,m+=8,h+=B[i++]<<m,m+=8),E=y[h&b];r:for(;;){if(I=E>>>24,h>>>=I,m-=I,I=E>>>16&255,I&16){if(R=E&65535,I&=15,m<I&&(h+=B[i++]<<m,m+=8,m<I&&(h+=B[i++]<<m,m+=8)),R+=h&(1<<I)-1,R>l){t.msg="invalid distance too far back",n.mode=Os;break e}if(h>>>=I,m-=I,I=o-s,R>I){if(I=R-I,I>f&&n.sane){t.msg="invalid distance too far back",n.mode=Os;break e}if(P=0,x=u,p===0){if(P+=d-I,I<S){S-=I;do k[o++]=u[P++];while(--I);P=o-R,x=k}}else if(p<I){if(P+=d+p-I,I-=p,I<S){S-=I;do k[o++]=u[P++];while(--I);if(P=0,p<S){I=p,S-=I;do k[o++]=u[P++];while(--I);P=o-R,x=k}}}else if(P+=p-I,I<S){S-=I;do k[o++]=u[P++];while(--I);P=o-R,x=k}for(;S>2;)k[o++]=x[P++],k[o++]=x[P++],k[o++]=x[P++],S-=3;S&&(k[o++]=x[P++],S>1&&(k[o++]=x[P++]))}else{P=o-R;do k[o++]=k[P++],k[o++]=k[P++],k[o++]=k[P++],S-=3;while(S>2);S&&(k[o++]=k[P++],S>1&&(k[o++]=k[P++]))}}else if((I&64)===0){E=y[(E&65535)+(h&(1<<I)-1)];continue r}else{t.msg="invalid distance code",n.mode=Os;break e}break}}else if((I&64)===0){E=g[(E&65535)+(h&(1<<I)-1)];continue t}else if(I&32){n.mode=JT;break e}else{t.msg="invalid literal/length code",n.mode=Os;break e}break}}while(i<a&&o<c);S=m>>3,i-=S,m-=S<<3,h&=(1<<m)-1,t.next_in=i,t.next_out=o,t.avail_in=i<a?5+(a-i):5-(i-a),t.avail_out=o<c?257+(c-o):257-(o-c),n.hold=h,n.bits=m}});var cI=w((xB,sI)=>{"use strict";var rI=Jt(),ii=15,nI=852,iI=592,aI=0,pp=1,oI=2,YT=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],ZT=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],XT=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],QT=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];sI.exports=function(t,r,n,i,a,o,s,c){var l=c.bits,d=0,f=0,p=0,u=0,h=0,m=0,g=0,y=0,_=0,b=0,E,I,S,R,P,x=null,B=0,k,he=new rI.Buf16(ii+1),Lt=new rI.Buf16(ii+1),ln=null,lu=0,du,Wa,Ha;for(d=0;d<=ii;d++)he[d]=0;for(f=0;f<i;f++)he[r[n+f]]++;for(h=l,u=ii;u>=1&&he[u]===0;u--);if(h>u&&(h=u),u===0)return a[o++]=1<<24|64<<16|0,a[o++]=1<<24|64<<16|0,c.bits=1,0;for(p=1;p<u&&he[p]===0;p++);for(h<p&&(h=p),y=1,d=1;d<=ii;d++)if(y<<=1,y-=he[d],y<0)return-1;if(y>0&&(t===aI||u!==1))return-1;for(Lt[1]=0,d=1;d<ii;d++)Lt[d+1]=Lt[d]+he[d];for(f=0;f<i;f++)r[n+f]!==0&&(s[Lt[r[n+f]]++]=f);if(t===aI?(x=ln=s,k=19):t===pp?(x=YT,B-=257,ln=ZT,lu-=257,k=256):(x=XT,ln=QT,k=-1),b=0,f=0,d=p,P=o,m=h,g=0,S=-1,_=1<<h,R=_-1,t===pp&&_>nI||t===oI&&_>iI)return 1;for(;;){du=d-g,s[f]<k?(Wa=0,Ha=s[f]):s[f]>k?(Wa=ln[lu+s[f]],Ha=x[B+s[f]]):(Wa=96,Ha=0),E=1<<d-g,I=1<<m,p=I;do I-=E,a[P+(b>>g)+I]=du<<24|Wa<<16|Ha|0;while(I!==0);for(E=1<<d-1;b&E;)E>>=1;if(E!==0?(b&=E-1,b+=E):b=0,f++,--he[d]===0){if(d===u)break;d=r[n+s[f]]}if(d>h&&(b&R)!==S){for(g===0&&(g=h),P+=p,m=d-g,y=1<<m;m+g<u&&(y-=he[m+g],!(y<=0));)m++,y<<=1;if(_+=1<<m,t===pp&&_>nI||t===oI&&_>iI)return 1;S=b&R,a[S]=h<<24|m<<16|P-o|0}}return b!==0&&(a[P+b]=d-g<<24|64<<16|0),c.bits=h,0}});var BI=w(gt=>{"use strict";var He=Jt(),wp=ep(),xt=tp(),e1=tI(),Da=cI(),t1=0,TI=1,jI=2,lI=4,r1=5,Ds=6,nn=0,n1=1,i1=2,st=-2,LI=-3,_p=-4,a1=-5,dI=8,$I=1,fI=2,pI=3,uI=4,hI=5,mI=6,gI=7,yI=8,wI=9,_I=10,Ts=11,Xt=12,up=13,II=14,hp=15,vI=16,EI=17,bI=18,AI=19,Cs=20,xs=21,RI=22,kI=23,SI=24,NI=25,PI=26,mp=27,OI=28,DI=29,ce=30,Ip=31,o1=32,s1=852,c1=592,l1=15,d1=l1;function CI(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function f1(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new He.Buf16(320),this.work=new He.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function MI(e){var t;return!e||!e.state?st:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=$I,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new He.Buf32(s1),t.distcode=t.distdyn=new He.Buf32(c1),t.sane=1,t.back=-1,nn)}function VI(e){var t;return!e||!e.state?st:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,MI(e))}function UI(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?st:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,VI(e))}function FI(e,t){var r,n;return e?(n=new f1,e.state=n,n.window=null,r=UI(e,t),r!==nn&&(e.state=null),r):st}function p1(e){return FI(e,d1)}var xI=!0,gp,yp;function u1(e){if(xI){var t;for(gp=new He.Buf32(512),yp=new He.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Da(TI,e.lens,0,288,gp,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Da(jI,e.lens,0,32,yp,0,e.work,{bits:5}),xI=!1}e.lencode=gp,e.lenbits=9,e.distcode=yp,e.distbits=5}function zI(e,t,r,n){var i,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new He.Buf8(a.wsize)),n>=a.wsize?(He.arraySet(a.window,t,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),He.arraySet(a.window,t,r-n,i,a.wnext),n-=i,n?(He.arraySet(a.window,t,r-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0}function h1(e,t){var r,n,i,a,o,s,c,l,d,f,p,u,h,m,g=0,y,_,b,E,I,S,R,P,x=new He.Buf8(4),B,k,he=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return st;r=e.state,r.mode===Xt&&(r.mode=up),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,l=r.hold,d=r.bits,f=s,p=c,P=nn;e:for(;;)switch(r.mode){case $I:if(r.wrap===0){r.mode=up;break}for(;d<16;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}if(r.wrap&2&&l===35615){r.check=0,x[0]=l&255,x[1]=l>>>8&255,r.check=xt(r.check,x,2,0),l=0,d=0,r.mode=fI;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg="incorrect header check",r.mode=ce;break}if((l&15)!==dI){e.msg="unknown compression method",r.mode=ce;break}if(l>>>=4,d-=4,R=(l&15)+8,r.wbits===0)r.wbits=R;else if(R>r.wbits){e.msg="invalid window size",r.mode=ce;break}r.dmax=1<<R,e.adler=r.check=1,r.mode=l&512?_I:Xt,l=0,d=0;break;case fI:for(;d<16;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}if(r.flags=l,(r.flags&255)!==dI){e.msg="unknown compression method",r.mode=ce;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=ce;break}r.head&&(r.head.text=l>>8&1),r.flags&512&&(x[0]=l&255,x[1]=l>>>8&255,r.check=xt(r.check,x,2,0)),l=0,d=0,r.mode=pI;case pI:for(;d<32;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}r.head&&(r.head.time=l),r.flags&512&&(x[0]=l&255,x[1]=l>>>8&255,x[2]=l>>>16&255,x[3]=l>>>24&255,r.check=xt(r.check,x,4,0)),l=0,d=0,r.mode=uI;case uI:for(;d<16;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}r.head&&(r.head.xflags=l&255,r.head.os=l>>8),r.flags&512&&(x[0]=l&255,x[1]=l>>>8&255,r.check=xt(r.check,x,2,0)),l=0,d=0,r.mode=hI;case hI:if(r.flags&1024){for(;d<16;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}r.length=l,r.head&&(r.head.extra_len=l),r.flags&512&&(x[0]=l&255,x[1]=l>>>8&255,r.check=xt(r.check,x,2,0)),l=0,d=0}else r.head&&(r.head.extra=null);r.mode=mI;case mI:if(r.flags&1024&&(u=r.length,u>s&&(u=s),u&&(r.head&&(R=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),He.arraySet(r.head.extra,n,a,u,R)),r.flags&512&&(r.check=xt(r.check,n,u,a)),s-=u,a+=u,r.length-=u),r.length))break e;r.length=0,r.mode=gI;case gI:if(r.flags&2048){if(s===0)break e;u=0;do R=n[a+u++],r.head&&R&&r.length<65536&&(r.head.name+=String.fromCharCode(R));while(R&&u<s);if(r.flags&512&&(r.check=xt(r.check,n,u,a)),s-=u,a+=u,R)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=yI;case yI:if(r.flags&4096){if(s===0)break e;u=0;do R=n[a+u++],r.head&&R&&r.length<65536&&(r.head.comment+=String.fromCharCode(R));while(R&&u<s);if(r.flags&512&&(r.check=xt(r.check,n,u,a)),s-=u,a+=u,R)break e}else r.head&&(r.head.comment=null);r.mode=wI;case wI:if(r.flags&512){for(;d<16;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}if(l!==(r.check&65535)){e.msg="header crc mismatch",r.mode=ce;break}l=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Xt;break;case _I:for(;d<32;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}e.adler=r.check=CI(l),l=0,d=0,r.mode=Ts;case Ts:if(r.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,r.hold=l,r.bits=d,i1;e.adler=r.check=1,r.mode=Xt;case Xt:if(t===r1||t===Ds)break e;case up:if(r.last){l>>>=d&7,d-=d&7,r.mode=mp;break}for(;d<3;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}switch(r.last=l&1,l>>>=1,d-=1,l&3){case 0:r.mode=II;break;case 1:if(u1(r),r.mode=Cs,t===Ds){l>>>=2,d-=2;break e}break;case 2:r.mode=EI;break;case 3:e.msg="invalid block type",r.mode=ce}l>>>=2,d-=2;break;case II:for(l>>>=d&7,d-=d&7;d<32;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}if((l&65535)!==(l>>>16^65535)){e.msg="invalid stored block lengths",r.mode=ce;break}if(r.length=l&65535,l=0,d=0,r.mode=hp,t===Ds)break e;case hp:r.mode=vI;case vI:if(u=r.length,u){if(u>s&&(u=s),u>c&&(u=c),u===0)break e;He.arraySet(i,n,a,u,o),s-=u,a+=u,c-=u,o+=u,r.length-=u;break}r.mode=Xt;break;case EI:for(;d<14;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}if(r.nlen=(l&31)+257,l>>>=5,d-=5,r.ndist=(l&31)+1,l>>>=5,d-=5,r.ncode=(l&15)+4,l>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=ce;break}r.have=0,r.mode=bI;case bI:for(;r.have<r.ncode;){for(;d<3;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}r.lens[he[r.have++]]=l&7,l>>>=3,d-=3}for(;r.have<19;)r.lens[he[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,B={bits:r.lenbits},P=Da(t1,r.lens,0,19,r.lencode,0,r.work,B),r.lenbits=B.bits,P){e.msg="invalid code lengths set",r.mode=ce;break}r.have=0,r.mode=AI;case AI:for(;r.have<r.nlen+r.ndist;){for(;g=r.lencode[l&(1<<r.lenbits)-1],y=g>>>24,_=g>>>16&255,b=g&65535,!(y<=d);){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}if(b<16)l>>>=y,d-=y,r.lens[r.have++]=b;else{if(b===16){for(k=y+2;d<k;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}if(l>>>=y,d-=y,r.have===0){e.msg="invalid bit length repeat",r.mode=ce;break}R=r.lens[r.have-1],u=3+(l&3),l>>>=2,d-=2}else if(b===17){for(k=y+3;d<k;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}l>>>=y,d-=y,R=0,u=3+(l&7),l>>>=3,d-=3}else{for(k=y+7;d<k;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}l>>>=y,d-=y,R=0,u=11+(l&127),l>>>=7,d-=7}if(r.have+u>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=ce;break}for(;u--;)r.lens[r.have++]=R}}if(r.mode===ce)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=ce;break}if(r.lenbits=9,B={bits:r.lenbits},P=Da(TI,r.lens,0,r.nlen,r.lencode,0,r.work,B),r.lenbits=B.bits,P){e.msg="invalid literal/lengths set",r.mode=ce;break}if(r.distbits=6,r.distcode=r.distdyn,B={bits:r.distbits},P=Da(jI,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,B),r.distbits=B.bits,P){e.msg="invalid distances set",r.mode=ce;break}if(r.mode=Cs,t===Ds)break e;case Cs:r.mode=xs;case xs:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,r.hold=l,r.bits=d,e1(e,p),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,l=r.hold,d=r.bits,r.mode===Xt&&(r.back=-1);break}for(r.back=0;g=r.lencode[l&(1<<r.lenbits)-1],y=g>>>24,_=g>>>16&255,b=g&65535,!(y<=d);){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}if(_&&(_&240)===0){for(E=y,I=_,S=b;g=r.lencode[S+((l&(1<<E+I)-1)>>E)],y=g>>>24,_=g>>>16&255,b=g&65535,!(E+y<=d);){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}l>>>=E,d-=E,r.back+=E}if(l>>>=y,d-=y,r.back+=y,r.length=b,_===0){r.mode=PI;break}if(_&32){r.back=-1,r.mode=Xt;break}if(_&64){e.msg="invalid literal/length code",r.mode=ce;break}r.extra=_&15,r.mode=RI;case RI:if(r.extra){for(k=r.extra;d<k;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}r.length+=l&(1<<r.extra)-1,l>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=kI;case kI:for(;g=r.distcode[l&(1<<r.distbits)-1],y=g>>>24,_=g>>>16&255,b=g&65535,!(y<=d);){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}if((_&240)===0){for(E=y,I=_,S=b;g=r.distcode[S+((l&(1<<E+I)-1)>>E)],y=g>>>24,_=g>>>16&255,b=g&65535,!(E+y<=d);){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}l>>>=E,d-=E,r.back+=E}if(l>>>=y,d-=y,r.back+=y,_&64){e.msg="invalid distance code",r.mode=ce;break}r.offset=b,r.extra=_&15,r.mode=SI;case SI:if(r.extra){for(k=r.extra;d<k;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}r.offset+=l&(1<<r.extra)-1,l>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=ce;break}r.mode=NI;case NI:if(c===0)break e;if(u=p-c,r.offset>u){if(u=r.offset-u,u>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=ce;break}u>r.wnext?(u-=r.wnext,h=r.wsize-u):h=r.wnext-u,u>r.length&&(u=r.length),m=r.window}else m=i,h=o-r.offset,u=r.length;u>c&&(u=c),c-=u,r.length-=u;do i[o++]=m[h++];while(--u);r.length===0&&(r.mode=xs);break;case PI:if(c===0)break e;i[o++]=r.length,c--,r.mode=xs;break;case mp:if(r.wrap){for(;d<32;){if(s===0)break e;s--,l|=n[a++]<<d,d+=8}if(p-=c,e.total_out+=p,r.total+=p,p&&(e.adler=r.check=r.flags?xt(r.check,i,p,o-p):wp(r.check,i,p,o-p)),p=c,(r.flags?l:CI(l))!==r.check){e.msg="incorrect data check",r.mode=ce;break}l=0,d=0}r.mode=OI;case OI:if(r.wrap&&r.flags){for(;d<32;){if(s===0)break e;s--,l+=n[a++]<<d,d+=8}if(l!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=ce;break}l=0,d=0}r.mode=DI;case DI:P=n1;break e;case ce:P=LI;break e;case Ip:return _p;case o1:default:return st}return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,r.hold=l,r.bits=d,(r.wsize||p!==e.avail_out&&r.mode<ce&&(r.mode<mp||t!==lI))&&zI(e,e.output,e.next_out,p-e.avail_out)?(r.mode=Ip,_p):(f-=e.avail_in,p-=e.avail_out,e.total_in+=f,e.total_out+=p,r.total+=p,r.wrap&&p&&(e.adler=r.check=r.flags?xt(r.check,i,p,e.next_out-p):wp(r.check,i,p,e.next_out-p)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Xt?128:0)+(r.mode===Cs||r.mode===hp?256:0),(f===0&&p===0||t===lI)&&P===nn&&(P=a1),P)}function m1(e){if(!e||!e.state)return st;var t=e.state;return t.window&&(t.window=null),e.state=null,nn}function g1(e,t){var r;return!e||!e.state||(r=e.state,(r.wrap&2)===0)?st:(r.head=t,t.done=!1,nn)}function y1(e,t){var r=t.length,n,i,a;return!e||!e.state||(n=e.state,n.wrap!==0&&n.mode!==Ts)?st:n.mode===Ts&&(i=1,i=wp(i,t,r,0),i!==n.check)?LI:(a=zI(e,t,r,r),a?(n.mode=Ip,_p):(n.havedict=1,nn))}gt.inflateReset=VI;gt.inflateReset2=UI;gt.inflateResetKeep=MI;gt.inflateInit=p1;gt.inflateInit2=FI;gt.inflate=h1;gt.inflateEnd=m1;gt.inflateGetHeader=g1;gt.inflateSetDictionary=y1;gt.inflateInfo="pako inflate (from Nodeca project)"});var vp=w((jB,qI)=>{"use strict";qI.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var KI=w((LB,GI)=>{"use strict";function w1(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}GI.exports=w1});var HI=w(xa=>{"use strict";var ai=BI(),Ca=Jt(),js=op(),ue=vp(),Ep=Es(),_1=sp(),I1=KI(),WI=Object.prototype.toString;function an(e){if(!(this instanceof an))return new an(e);this.options=Ca.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _1,this.strm.avail_out=0;var r=ai.inflateInit2(this.strm,t.windowBits);if(r!==ue.Z_OK)throw new Error(Ep[r]);if(this.header=new I1,ai.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=js.string2buf(t.dictionary):WI.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=ai.inflateSetDictionary(this.strm,t.dictionary),r!==ue.Z_OK)))throw new Error(Ep[r])}an.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,o,s,c,l,d=!1;if(this.ended)return!1;o=t===~~t?t:t===!0?ue.Z_FINISH:ue.Z_NO_FLUSH,typeof e=="string"?r.input=js.binstring2buf(e):WI.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Ca.Buf8(n),r.next_out=0,r.avail_out=n),a=ai.inflate(r,ue.Z_NO_FLUSH),a===ue.Z_NEED_DICT&&i&&(a=ai.inflateSetDictionary(this.strm,i)),a===ue.Z_BUF_ERROR&&d===!0&&(a=ue.Z_OK,d=!1),a!==ue.Z_STREAM_END&&a!==ue.Z_OK)return this.onEnd(a),this.ended=!0,!1;r.next_out&&(r.avail_out===0||a===ue.Z_STREAM_END||r.avail_in===0&&(o===ue.Z_FINISH||o===ue.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=js.utf8border(r.output,r.next_out),c=r.next_out-s,l=js.buf2string(r.output,s),r.next_out=c,r.avail_out=n-c,c&&Ca.arraySet(r.output,r.output,s,c,0),this.onData(l)):this.onData(Ca.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(d=!0)}while((r.avail_in>0||r.avail_out===0)&&a!==ue.Z_STREAM_END);return a===ue.Z_STREAM_END&&(o=ue.Z_FINISH),o===ue.Z_FINISH?(a=ai.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===ue.Z_OK):(o===ue.Z_SYNC_FLUSH&&(this.onEnd(ue.Z_OK),r.avail_out=0),!0)};an.prototype.onData=function(e){this.chunks.push(e)};an.prototype.onEnd=function(e){e===ue.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ca.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function bp(e,t){var r=new an(t);if(r.push(e,!0),r.err)throw r.msg||Ep[r.err];return r.result}function v1(e,t){return t=t||{},t.raw=!0,bp(e,t)}xa.Inflate=an;xa.inflate=bp;xa.inflateRaw=v1;xa.ungzip=bp});var ZI=w((MB,YI)=>{"use strict";var E1=Jt().assign,b1=Q_(),A1=HI(),R1=vp(),JI={};E1(JI,b1,A1,R1);YI.exports=JI});var QI=w($s=>{"use strict";var k1=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",S1=ZI(),XI=de(),Ls=We(),N1=k1?"uint8array":"array";$s.magic="\b\0";function on(e,t){Ls.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}XI.inherits(on,Ls);on.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(XI.transformTo(N1,e.data),!1)};on.prototype.flush=function(){Ls.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};on.prototype.cleanUp=function(){Ls.prototype.cleanUp.call(this),this._pako=null};on.prototype._createPako=function(){this._pako=new S1[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};$s.compressWorker=function(e){return new on("Deflate",e)};$s.uncompressWorker=function(){return new on("Inflate",{})}});var Rp=w(Ap=>{"use strict";var ev=We();Ap.STORE={magic:"\0\0",compressWorker:function(){return new ev("STORE compression")},uncompressWorker:function(){return new ev("STORE decompression")}};Ap.DEFLATE=QI()});var kp=w(sn=>{"use strict";sn.LOCAL_FILE_HEADER="PK";sn.CENTRAL_FILE_HEADER="PK";sn.CENTRAL_DIRECTORY_END="PK";sn.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";sn.ZIP64_CENTRAL_DIRECTORY_END="PK";sn.DATA_DESCRIPTOR="PK\x07\b"});var iv=w((zB,nv)=>{"use strict";var oi=de(),si=We(),Sp=Hn(),tv=ys(),Ms=kp(),ee=function(e,t){var r="",n;for(n=0;n<t;n++)r+=String.fromCharCode(e&255),e=e>>>8;return r},P1=function(e,t){var r=e;return e||(r=t?16893:33204),(r&65535)<<16},O1=function(e){return(e||0)&63},rv=function(e,t,r,n,i,a){var o=e.file,s=e.compression,c=a!==Sp.utf8encode,l=oi.transformTo("string",a(o.name)),d=oi.transformTo("string",Sp.utf8encode(o.name)),f=o.comment,p=oi.transformTo("string",a(f)),u=oi.transformTo("string",Sp.utf8encode(f)),h=d.length!==o.name.length,m=u.length!==f.length,g,y,_="",b="",E="",I=o.dir,S=o.date,R={crc32:0,compressedSize:0,uncompressedSize:0};(!t||r)&&(R.crc32=e.crc32,R.compressedSize=e.compressedSize,R.uncompressedSize=e.uncompressedSize);var P=0;t&&(P|=8),!c&&(h||m)&&(P|=2048);var x=0,B=0;I&&(x|=16),i==="UNIX"?(B=798,x|=P1(o.unixPermissions,I)):(B=20,x|=O1(o.dosPermissions,I)),g=S.getUTCHours(),g=g<<6,g=g|S.getUTCMinutes(),g=g<<5,g=g|S.getUTCSeconds()/2,y=S.getUTCFullYear()-1980,y=y<<4,y=y|S.getUTCMonth()+1,y=y<<5,y=y|S.getUTCDate(),h&&(b=ee(1,1)+ee(tv(l),4)+d,_+="up"+ee(b.length,2)+b),m&&(E=ee(1,1)+ee(tv(p),4)+u,_+="uc"+ee(E.length,2)+E);var k="";k+=`
|
|
10
|
+
\0`,k+=ee(P,2),k+=s.magic,k+=ee(g,2),k+=ee(y,2),k+=ee(R.crc32,4),k+=ee(R.compressedSize,4),k+=ee(R.uncompressedSize,4),k+=ee(l.length,2),k+=ee(_.length,2);var he=Ms.LOCAL_FILE_HEADER+k+l+_,Lt=Ms.CENTRAL_FILE_HEADER+ee(B,2)+k+ee(p.length,2)+"\0\0\0\0"+ee(x,4)+ee(n,4)+l+_+p;return{fileRecord:he,dirRecord:Lt}},D1=function(e,t,r,n,i){var a="",o=oi.transformTo("string",i(n));return a=Ms.CENTRAL_DIRECTORY_END+"\0\0\0\0"+ee(e,2)+ee(e,2)+ee(t,4)+ee(r,4)+ee(o.length,2)+o,a},C1=function(e){var t="";return t=Ms.DATA_DESCRIPTOR+ee(e.crc32,4)+ee(e.compressedSize,4)+ee(e.uncompressedSize,4),t};function yt(e,t,r,n){si.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}oi.inherits(yt,si);yt.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,si.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))};yt.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=rv(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0};yt.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=rv(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:C1(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null};yt.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,n=D1(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})};yt.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};yt.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(r){t.processChunk(r)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(r){t.error(r)}),this};yt.prototype.resume=function(){if(!si.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};yt.prototype.error=function(e){var t=this._sources;if(!si.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch{}return!0};yt.prototype.lock=function(){si.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};nv.exports=yt});var ov=w(av=>{"use strict";var x1=Rp(),T1=iv(),j1=function(e,t){var r=e||t,n=x1[r];if(!n)throw new Error(r+" is not a valid compression method !");return n};av.generateWorker=function(e,t,r){var n=new T1(t.streamFiles,r,t.platform,t.encodeFileName),i=0;try{e.forEach(function(a,o){i++;var s=j1(o.options.compression,t.compression),c=o.options.compressionOptions||t.compressionOptions||{},l=o.dir,d=o.date;o._compressWorker(s,c).withStreamInfo("file",{name:a,dir:l,date:d,comment:o.comment||"",unixPermissions:o.unixPermissions,dosPermissions:o.dosPermissions}).pipe(n)}),n.entriesCount=i}catch(a){n.error(a)}return n}});var cv=w((qB,sv)=>{"use strict";var L1=de(),Vs=We();function Ta(e,t){Vs.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}L1.inherits(Ta,Vs);Ta.prototype._bindStream=function(e){var t=this;this._stream=e,e.pause(),e.on("data",function(r){t.push({data:r,meta:{percent:0}})}).on("error",function(r){t.isPaused?this.generatedError=r:t.error(r)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})};Ta.prototype.pause=function(){return Vs.prototype.pause.call(this)?(this._stream.pause(),!0):!1};Ta.prototype.resume=function(){return Vs.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};sv.exports=Ta});var wv=w((GB,yv)=>{"use strict";var $1=Hn(),ja=de(),pv=We(),M1=Cf(),uv=xf(),lv=ws(),V1=d_(),U1=ov(),dv=da(),F1=cv(),hv=function(e,t,r){var n=ja.getTypeOf(t),i,a=ja.extend(r||{},uv);a.date=a.date||new Date,a.compression!==null&&(a.compression=a.compression.toUpperCase()),typeof a.unixPermissions=="string"&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&a.unixPermissions&16384&&(a.dir=!0),a.dosPermissions&&a.dosPermissions&16&&(a.dir=!0),a.dir&&(e=mv(e)),a.createFolders&&(i=z1(e))&&gv.call(this,i,!0);var o=n==="string"&&a.binary===!1&&a.base64===!1;(!r||typeof r.binary>"u")&&(a.binary=!o);var s=t instanceof lv&&t.uncompressedSize===0;(s||a.dir||!t||t.length===0)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var c=null;t instanceof lv||t instanceof pv?c=t:dv.isNode&&dv.isStream(t)?c=new F1(e,t):c=ja.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var l=new V1(e,c,a);this.files[e]=l},z1=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},mv=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},gv=function(e,t){return t=typeof t<"u"?t:uv.createFolders,e=mv(e),this.files[e]||hv.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function fv(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var B1={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,n;for(t in this.files)n=this.files[t],r=t.slice(this.root.length,t.length),r&&t.slice(0,this.root.length)===this.root&&e(r,n)},filter:function(e){var t=[];return this.forEach(function(r,n){e(r,n)&&t.push(n)}),t},file:function(e,t,r){if(arguments.length===1)if(fv(e)){var n=e;return this.filter(function(a,o){return!o.dir&&n.test(a)})}else{var i=this.files[this.root+e];return i&&!i.dir?i:null}else e=this.root+e,hv.call(this,e,t,r);return this},folder:function(e){if(!e)return this;if(fv(e))return this.filter(function(i,a){return a.dir&&e.test(i)});var t=this.root+e,r=gv.call(this,t),n=this.clone();return n.root=r.name,n},remove:function(e){e=this.root+e;var t=this.files[e];if(t||(e.slice(-1)!=="/"&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter(function(i,a){return a.name.slice(0,e.length)===e}),n=0;n<r.length;n++)delete this.files[r[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if(r=ja.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:$1.utf8encode}),r.type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),r.type==="binarystring"&&(r.type="string"),!r.type)throw new Error("No output type specified.");ja.checkSupport(r.type),(r.platform==="darwin"||r.platform==="freebsd"||r.platform==="linux"||r.platform==="sunos")&&(r.platform="UNIX"),r.platform==="win32"&&(r.platform="DOS");var n=r.comment||this.comment||"";t=U1.generateWorker(this,r,n)}catch(i){t=new pv("error"),t.error(i)}return new M1(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return e=e||{},e.type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};yv.exports=B1});var Np=w((KB,Iv)=>{"use strict";var q1=de();function _v(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}_v.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t=0,r;for(this.checkOffset(e),r=this.index+e-1;r>=this.index;r--)t=(t<<8)+this.byteAt(r);return this.index+=e,t},readString:function(e){return q1.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(e&31)<<1))}};Iv.exports=_v});var Pp=w((WB,Ev)=>{"use strict";var vv=Np(),G1=de();function ci(e){vv.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}G1.inherits(ci,vv);ci.prototype.byteAt=function(e){return this.data[this.zero+e]};ci.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),a=this.length-4;a>=0;--a)if(this.data[a]===t&&this.data[a+1]===r&&this.data[a+2]===n&&this.data[a+3]===i)return a-this.zero;return-1};ci.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&r===a[1]&&n===a[2]&&i===a[3]};ci.prototype.readData=function(e){if(this.checkOffset(e),e===0)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Ev.exports=ci});var Rv=w((HB,Av)=>{"use strict";var bv=Np(),K1=de();function li(e){bv.call(this,e)}K1.inherits(li,bv);li.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)};li.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero};li.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t};li.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Av.exports=li});var Dp=w((JB,Sv)=>{"use strict";var kv=Pp(),W1=de();function Op(e){kv.call(this,e)}W1.inherits(Op,kv);Op.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Sv.exports=Op});var Ov=w((YB,Pv)=>{"use strict";var Nv=Dp(),H1=de();function Cp(e){Nv.call(this,e)}H1.inherits(Cp,Nv);Cp.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Pv.exports=Cp});var xp=w((ZB,Cv)=>{"use strict";var Us=de(),Dv=Wt(),J1=Pp(),Y1=Rv(),Z1=Ov(),X1=Dp();Cv.exports=function(e){var t=Us.getTypeOf(e);return Us.checkSupport(t),t==="string"&&!Dv.uint8array?new Y1(e):t==="nodebuffer"?new Z1(e):Dv.uint8array?new X1(Us.transformTo("uint8array",e)):new J1(Us.transformTo("array",e))}});var Lv=w((XB,jv)=>{"use strict";var Tp=xp(),kr=de(),Q1=ws(),xv=ys(),Fs=Hn(),zs=Rp(),ej=Wt(),tj=0,rj=3,nj=function(e){for(var t in zs)if(Object.prototype.hasOwnProperty.call(zs,t)&&zs[t].magic===e)return zs[t];return null};function Tv(e,t){this.options=e,this.loadOptions=t}Tv.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(t=nj(this.compressionMethod),t===null)throw new Error("Corrupted zip : compression "+kr.pretty(this.compressionMethod)+" unknown (inner file : "+kr.transformTo("string",this.fileName)+")");this.decompressed=new Q1(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),e===tj&&(this.dosPermissions=this.externalFileAttributes&63),e===rj&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=Tp(this.extraFields[1].value);this.uncompressedSize===kr.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===kr.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===kr.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===kr.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t=e.index+this.extraFieldsLength,r,n,i;for(this.extraFields||(this.extraFields={});e.index+4<t;)r=e.readInt(2),n=e.readInt(2),i=e.readData(n),this.extraFields[r]={id:r,length:n,value:i};e.setIndex(t)},handleUTF8:function(){var e=ej.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=Fs.utf8decode(this.fileName),this.fileCommentStr=Fs.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var r=kr.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var n=this.findExtraFieldUnicodeComment();if(n!==null)this.fileCommentStr=n;else{var i=kr.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(i)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=Tp(e.value);return t.readInt(1)!==1||xv(this.fileName)!==t.readInt(4)?null:Fs.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=Tp(e.value);return t.readInt(1)!==1||xv(this.fileComment)!==t.readInt(4)?null:Fs.utf8decode(t.readData(e.length-5))}return null}};jv.exports=Tv});var Vv=w((QB,Mv)=>{"use strict";var ij=xp(),Qt=de(),wt=kp(),aj=Lv(),oj=Wt();function $v(e){this.files=[],this.loadOptions=e}$v.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+Qt.pretty(t)+", expected "+Qt.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var n=this.reader.readString(4),i=n===t;return this.reader.setIndex(r),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=oj.uint8array?"uint8array":"array",r=Qt.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e=this.zip64EndOfCentralSize-44,t=0,r,n,i;t<e;)r=this.reader.readInt(2),n=this.reader.readInt(4),i=this.reader.readData(n),this.zip64ExtensibleData[r]={id:r,length:n,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(wt.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(wt.CENTRAL_FILE_HEADER);)e=new aj({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(wt.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,wt.LOCAL_FILE_HEADER);throw t?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(e);var r=e;if(this.checkSignature(wt.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===Qt.MAX_VALUE_16BITS||this.diskWithCentralDirStart===Qt.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===Qt.MAX_VALUE_16BITS||this.centralDirRecords===Qt.MAX_VALUE_16BITS||this.centralDirSize===Qt.MAX_VALUE_32BITS||this.centralDirOffset===Qt.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(wt.ZIP64_CENTRAL_DIRECTORY_LOCATOR),e<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(wt.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,wt.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(wt.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(wt.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var i=r-n;if(i>0)this.isSignature(r,wt.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(e){this.reader=ij(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};Mv.exports=$v});var zv=w((eq,Fv)=>{"use strict";var jp=de(),Bs=Gn(),sj=Hn(),cj=Vv(),lj=Lf(),Uv=da();function dj(e){return new Bs.Promise(function(t,r){var n=e.decompressed.getContentWorker().pipe(new lj);n.on("error",function(i){r(i)}).on("end",function(){n.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}Fv.exports=function(e,t){var r=this;return t=jp.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:sj.utf8decode}),Uv.isNode&&Uv.isStream(e)?Bs.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):jp.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(n){var i=new cj(t);return i.load(n),i}).then(function(i){var a=[Bs.Promise.resolve(i)],o=i.files;if(t.checkCRC32)for(var s=0;s<o.length;s++)a.push(dj(o[s]));return Bs.Promise.all(a)}).then(function(i){for(var a=i.shift(),o=a.files,s=0;s<o.length;s++){var c=o[s],l=c.fileNameStr,d=jp.resolve(c.fileNameStr);r.file(d,c.decompressed,{binary:!0,optimizedBinaryString:!0,date:c.date,dir:c.dir,comment:c.fileCommentStr.length?c.fileCommentStr:null,unixPermissions:c.unixPermissions,dosPermissions:c.dosPermissions,createFolders:t.createFolders}),c.dir||(r.file(d).unsafeOriginalName=l)}return a.zipComment.length&&(r.comment=a.zipComment),r})}});var Lp=w((tq,Bv)=>{"use strict";function ct(){if(!(this instanceof ct))return new ct;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new ct;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}ct.prototype=wv();ct.prototype.loadAsync=zv();ct.support=Wt();ct.defaults=xf();ct.version="3.10.1";ct.loadAsync=function(e,t){return new ct().loadAsync(e,t)};ct.external=Gn();Bv.exports=ct});import{createHash as fj}from"node:crypto";function $p(e){let t=new Set,r=0,n=[...e.files].sort((f,p)=>f.path.localeCompare(p.path)).map(f=>{if(!hj(f.path)||t.has(f.path))throw new Error("BUNDLE_PATH_INVALID");if(!uj.has(f.mime))throw new Error("BUNDLE_MIME_INVALID");if(t.add(f.path),r+=f.bytes.byteLength,r>(e.maximumBytes??128*1024*1024))throw new Error("BUNDLE_SIZE_EXCEEDED");let p=new Uint8Array(f.bytes);return{...f,bytes:p,sha256:La(p),byteSize:p.byteLength}});if(!n.some(f=>f.path==="index.html"))throw new Error("BUNDLE_ENTRYPOINT_MISSING");let i=La(qs(n.map(({path:f,mime:p,sha256:u,byteSize:h})=>({path:f,mime:p,sha256:u,byteSize:h})))),a=qs({schemaVersion:1,artifactReleaseId:e.artifactReleaseId,buildProfile:e.profile,rendererReleaseId:e.rendererReleaseId,runtimeReleaseIds:e.runtimeReleaseIds,entrypoint:"index.html",files:n.map(({path:f,mime:p,sha256:u,byteSize:h})=>({path:f,mimeType:p,digest:u,byteSize:h,cacheClass:f==="index.html"?"entry":"immutable"}))}),o={path:"manifest.json",mime:"application/json",bytes:a,sha256:La(a),byteSize:a.byteLength},s=qs({schemaVersion:1,files:[...n,{...o}].map(({path:f,sha256:p})=>({path:f,digest:p}))}),c={path:"integrity.json",mime:"application/json",bytes:s,sha256:La(s),byteSize:s.byteLength},l=[...n,o,c].sort((f,p)=>f.path.localeCompare(p.path)),d=La(qs(l.map(({path:f,sha256:p})=>({path:f,sha256:p}))));return Object.freeze({schemaVersion:1,webBundleId:`web-bundle:${d.slice(7)}`,artifactReleaseId:e.artifactReleaseId,profile:e.profile,entrypoint:"index.html",files:l,digest:d})}var pj,uj,La,hj,qs,Mp=$e(()=>{"use strict";pj=rr(Lp(),1),uj=new Set(["text/html; charset=utf-8","application/json","text/css; charset=utf-8","text/javascript; charset=utf-8","image/svg+xml","image/png","image/jpeg","image/webp","audio/mpeg","audio/ogg","audio/wav","video/mp4","video/webm","text/vtt; charset=utf-8","font/woff2"]),La=e=>`sha256:${fj("sha256").update(e).digest("hex")}`,hj=e=>e.length>0&&!e.startsWith("/")&&!e.includes("\\")&&!e.split("/").includes("..")&&!e.includes("\0"),qs=e=>new TextEncoder().encode(JSON.stringify(e))});function gj(e){throw new kt(e)}function yj(e){let t=e.split("/");return t[t.length-1]??e}function di(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function qv(e,t){return e===t?"index.html":`${e.slice(1)}/index.html`}function Vp(e,t){if(e===t)return yj(t);let r=e.lastIndexOf("/"),n=r===-1?0:e.slice(0,r).split("/").length;return`${"../".repeat(n)}${t}`}function Gv(e,t,r){let n=e.project.routes.find(c=>c.path===t);n===void 0&&gj("PAGE_ROUTE_UNKNOWN");let i=qv(t,e.project.defaultPath),a=e.project.navigation.map(c=>` <a href="${di(Vp(i,qv(c.path,e.project.defaultPath)))}">${di(c.label)}</a>`),o=r==="hosted"?"\u6258\u7BA1\u7AD9\u70B9":"\u79BB\u7EBF\u7AD9\u70B9",s=r==="hosted"?"\u8FD9\u662F Hosted CSR \u9759\u6001\u58F3\uFF0C\u4E0D\u662F SSR\u3002\u5BA2\u6237\u7AEF\u6FC0\u6D3B\u540E\u8DEF\u7531\u4ECD\u8D70\u540C\u4E00 Renderer\u3002":"\u8FD9\u662F\u9759\u6001\u79BB\u7EBF\u58F3\uFF0C\u4E0D\u542B\u5BC6\u94A5\u3002\u5B8C\u6574\u4EA4\u4E92\u8BF7\u4F7F\u7528\u6E90\u7801\u5DE5\u7A0B\u5F52\u6863\u3002";return["<!doctype html>",'<html lang="zh-CN">',"<head>",' <meta charset="utf-8">',' <meta name="viewport" content="width=device-width, initial-scale=1">',` <title>${di(n.title)}</title>`,` <link rel="stylesheet" href="${di(Vp(i,"styles.css"))}">`,"</head>","<body>"," <header>",` <p>${o}</p>`," <nav>",...a," </nav>"," </header>"," <main>",` <h1>${di(n.title)}</h1>`,` <p>${s}</p>`," </main>",` <script src="${di(Vp(i,"runtime/app.js"))}"></script>`,"</body>","</html>",""].join(`
|
|
11
11
|
`)}function Kv(e,t="offline"){let r=e.project.defaultPath,n=[{path:"index.html",content:Gv(e,r,t)},{path:"styles.css",content:`body{font-family:sans-serif;margin:2rem;color:#111}nav a{margin-right:1rem}
|
|
12
12
|
`},{path:"runtime/app.js",content:`document.documentElement.lang="zh-CN";
|
|
13
|
-
`}];for(let i of e.project.routes)i.path!==r&&n.push({path:`${i.path.slice(1)}/index.html`,content:Gv(e,i.path,t)});return n}var mj,
|
|
14
|
-
`,{flag:"wx",mode:384})}catch(i){if(i.code!=="EEXIST")throw i;let a=JSON.parse(await Ws(`${n}.metadata.json`,"utf8"));if(a.mimeType!==r.mimeType||a.sha256!==r.sha256)throw new Error("OBJECT_IMMUTABILITY_CONFLICT")}},async read(r){try{let n=t(r),[i,a]=await Promise.all([Ws(n),Ws(`${n}.metadata.json`,"utf8").then(o=>JSON.parse(o))]);return{bytes:new Uint8Array(i),mimeType:a.mimeType}}catch(n){if(n.code==="ENOENT")return;throw n}}}}function Dj(e,t){return t==="image/png"?e.length>=8&&[137,80,78,71,13,10,26,10].every((r,n)=>e[n]===r):t==="image/jpeg"?e[0]===255&&e[1]===216:t==="audio/mpeg"?e.length>=3&&(e[0]===73&&e[1]===68&&e[2]===51||e[0]===255&&(e[1]&224)===224):t==="video/mp4"?e.length>=12&&new TextDecoder().decode(e.slice(4,8))==="ftyp":!1}function Cj(e){let t=new Set(e.allowedHosts.map(n=>n.toLowerCase())),r=e.maximumRedirects??3;return{async download(n){let i=new URL(n.url);for(let a=0;a<=r;a+=1){if(i.protocol!=="https:"||!t.has(i.hostname.toLowerCase())||i.username||i.password)throw new Le("TEMPORARY_OBJECT_INVALID");let o=await fetch(i,{redirect:"manual",...n.signal?{signal:n.signal}:{}});if(o.status>=300&&o.status<400){let h=o.headers.get("location");if(!h||a===r)throw new Le("TEMPORARY_OBJECT_INVALID");i=new URL(h,i);continue}if(!o.ok||!o.body)throw new Le("TEMPORARY_OBJECT_INVALID");let s=o.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase()??"";if(!n.allowedMimeTypes.includes(s))throw new Le("OBJECT_MIME_INVALID");if(Number(o.headers.get("content-length")??0)>n.maximumBytes)throw new Le("OBJECT_TOO_LARGE");let d=o.body.getReader(),l=[],f=0;for(;;){let h=await d.read();if(h.done)break;if(f+=h.value.byteLength,f>n.maximumBytes)throw await d.cancel(),new Le("OBJECT_TOO_LARGE");l.push(h.value)}let p=new Uint8Array(f),u=0;for(let h of l)p.set(h,u),u+=h.byteLength;if(!Dj(p,s))throw new Le("TEMPORARY_OBJECT_INVALID");return{bytes:p,mimeType:s}}throw new Le("TEMPORARY_OBJECT_INVALID")}}}async function xj(e){if(!/^https:\/\//u.test(e.url)||!e.objectKeyPrefix.trim()||e.maximumBytes<=0)throw new Le("TEMPORARY_OBJECT_INVALID");let t=await e.downloader.download({url:e.url,maximumBytes:e.maximumBytes,allowedMimeTypes:e.allowedMimeTypes,...e.signal?{signal:e.signal}:{}});if(t.bytes.byteLength>e.maximumBytes)throw new Le("OBJECT_TOO_LARGE");if(!e.allowedMimeTypes.includes(t.mimeType))throw new Le("OBJECT_MIME_INVALID");let r=Yv(t.bytes),n=`${e.objectKeyPrefix.replace(/\/$/u,"")}/${r.slice(7)}`;await e.store.putImmutable({objectKey:n,bytes:t.bytes,mimeType:t.mimeType,sha256:r});let i=await e.store.read(n);if(!i||i.mimeType!==t.mimeType||Yv(i.bytes)!==r)throw new Le("OBJECT_READBACK_FAILED");let a=Object.freeze({objectKey:n,mimeType:t.mimeType,byteLength:t.bytes.byteLength,sha256:r});return await e.commitMetadata(a),a}var Le,Yv,Qv=$e(()=>{"use strict";Le=class extends Error{code;constructor(t,r){super(t,r),this.code=t,this.name="ObjectStoreError"}};Yv=e=>`sha256:${Zv("sha256").update(e).digest("hex")}`});import{spawn as uy}from"node:child_process";import{lstat as Qi,readFile as Dn}from"node:fs/promises";import{createServer as EO}from"node:net";import me from"node:path";import At from"node:process";import{pathToFileURL as bO}from"node:url";var Y="^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$",It="^sha256:[a-f0-9]{64}$";var lg=rr(Vr(),1);var be={type:"string",pattern:It},RN={type:"string",pattern:"^[a-z][a-z0-9.-]{2,127}$"},dl={type:"string",format:"date-time"},ll={enum:["typescript.typecheck","vitest.run","typescript.build","npm.pack-dry-run","workspace.structure","capability.assets","node.application-smoke","web.application-build","web.application-smoke","expo.application-config","expo.application-export","react.library-build","next.application-test","next.application-build","next.application-package","next.application-smoke","application.config-contract"]},fg={type:"object",additionalProperties:!1,required:["node","pnpm","typescript"],properties:{node:{type:"string",minLength:1,maxLength:64},pnpm:{type:"string",minLength:1,maxLength:64},typescript:{type:"string",minLength:1,maxLength:64}}},fl={$id:"https://schemas.dyyto.dev/platform/capability-bundle-release-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","capabilityId","version","integrity","consumerProfile","compatibility","assets","verifiers","exit"],properties:{schemaVersion:{const:1},capabilityId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128},integrity:be,consumerProfile:{enum:["blank-typescript-library","standalone-npm-package","react-component-library","nextjs-full-stack-application","workspace-root","workspace-npm-package","workspace-node-application","workspace-web-application","workspace-expo-application","any-project"]},kind:{enum:["profile","engineering-feature","integration-feature","domain-extension"]},dependencies:{type:"object",additionalProperties:!1,required:["profiles"],properties:{profiles:{type:"array",minItems:1,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:128}},capabilities:{type:"array",minItems:1,uniqueItems:!0,items:{type:"string",pattern:Y}}}},compatibility:fg,integration:{type:"object",additionalProperties:!1,required:["title","purpose","packages","codeAssets"],properties:{title:{type:"string",minLength:1,maxLength:128},purpose:{type:"string",minLength:1,maxLength:512},packages:{type:"array",items:{type:"object",additionalProperties:!1,required:["packageName","version","usage","imports"],properties:{packageName:{type:"string",minLength:1,maxLength:214},version:{type:"string",minLength:1,maxLength:128},usage:{enum:["runtime","development","build","test"]},imports:{type:"array",items:{type:"object",additionalProperties:!1,required:["importFrom","symbol"],properties:{importFrom:{type:"string",minLength:1,maxLength:214},symbol:{type:"string",minLength:1,maxLength:128},referencePath:{type:"string",minLength:1,maxLength:512}}}}}}},codeAssets:{type:"array",items:{type:"object",additionalProperties:!1,required:["sourcePath","targetPath","ownership"],properties:{sourcePath:{type:"string",minLength:1,maxLength:512},targetPath:{type:"string",minLength:1,maxLength:512},ownership:{enum:["owned-file","managed-region","seed-file"]}}}}}},assets:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["path","ownership","digest","mode"],properties:{path:{type:"string",minLength:1,maxLength:512},ownership:{enum:["owned-file","managed-region","seed-file"]},digest:be,mode:{type:"integer",minimum:0,maximum:511},regionId:{type:"string",pattern:Y},renderer:{enum:["npm-package-json-v1","npm-package-json-v2","react-component-package-json-v1","nextjs-application-package-json-v1","workspace-root-package-json-v1","node-application-package-json-v1","web-application-package-json-v1","expo-application-package-json-v1","application-config-contract-v1","application-config-binding-v1"]}},allOf:[{if:{properties:{ownership:{const:"managed-region"}},required:["ownership"]},then:{properties:{regionId:{type:"string",pattern:Y}},required:["regionId"]},else:{not:{required:["regionId"]}}}]}},verifiers:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["id"],properties:{id:ll}}},exit:{type:"object",additionalProperties:!1,required:["ownedAssets"],properties:{ownedAssets:{type:"array",items:{type:"string",minLength:1,maxLength:512}}}}}},pg={type:"object",additionalProperties:!1,required:["registryId","packageName","version","integrity","tarballDigest","deliveryReceiptId","usage"],properties:{registryId:{type:"string",pattern:"^registry\\.[a-z0-9][a-z0-9.-]{1,126}$"},packageName:{type:"string",pattern:"^@[a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._-]*$",maxLength:214},version:{type:"string",pattern:"^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$",maxLength:64},integrity:{type:"string",pattern:"^sha512-[A-Za-z0-9+/]{86}==$"},tarballDigest:be,deliveryReceiptId:be,usage:{enum:["runtime","development"]}}},{$id:rM,...ug}=fl,kN={...ug,$id:"https://schemas.dyyto.dev/platform/capability-bundle-release-v2.json",required:[...fl.required,"availability","packageSources"],properties:{...fl.properties,schemaVersion:{const:2},availability:{oneOf:[{type:"object",additionalProperties:!1,required:["maturity","visibility","sourceState"],properties:{maturity:{const:"candidate"},visibility:{const:"maintainers-only"},sourceState:{const:"local-artifact"}}},{type:"object",additionalProperties:!1,required:["maturity","visibility","sourceState"],properties:{maturity:{const:"candidate"},visibility:{const:"maintainers-only"},sourceState:{const:"development-registry"}}},{type:"object",additionalProperties:!1,required:["maturity","visibility","sourceState"],properties:{maturity:{const:"available"},visibility:{const:"catalog-consumers"},sourceState:{const:"registry-verified"}}},{type:"object",additionalProperties:!1,required:["maturity","visibility","reasonCode"],properties:{maturity:{const:"withdrawn"},visibility:{const:"existing-locks-only"},reasonCode:{type:"string",pattern:"^[A-Z][A-Z0-9_]{2,63}$"}}}]},packageSources:{type:"array",maxItems:128,items:pg}}},SN={$id:"https://schemas.dyyto.dev/platform/capability-bundle-release.json",oneOf:[ug,(()=>{let{$id:e,...t}=kN;return t})()]},Do={$id:"https://schemas.dyyto.dev/platform/verification-result-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","verifierId","result","issuer","commandId","exitCode","stdoutDigest","stderrDigest","startedAt","completedAt","projectStateDigest","runtime"],properties:{schemaVersion:{const:1},verifierId:ll,result:{enum:["passed","failed"]},issuer:{enum:["dyyto-cli","test-harness","external-ci"]},commandId:ll,exitCode:{type:"integer",minimum:0,maximum:255},stdoutDigest:be,stderrDigest:be,startedAt:dl,completedAt:dl,projectStateDigest:be,runtime:fg}},NN={...Do,$id:"https://schemas.dyyto.dev/platform/adoption-evidence-v1.json",required:[...Do.required,"evidenceId","capabilityId","capabilityVersion","capabilityIntegrity"],properties:{...Do.properties,evidenceId:be,capabilityId:{type:"string",pattern:Y},capabilityVersion:{type:"string",minLength:1,maxLength:128},capabilityIntegrity:be}},PN={$id:"https://schemas.dyyto.dev/platform/project-adoption-lock.json",type:"object",additionalProperties:!1,required:["schemaVersion","capabilities"],properties:{schemaVersion:{enum:[1,2]},capabilities:{type:"array",items:{type:"object",additionalProperties:!1,required:["capabilityId","version","integrity","consumerProfile","appliedPlanId","projectStateDigest","assets","evidenceIds","committedAt"],properties:{capabilityId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128},integrity:be,consumerProfile:{type:"string",minLength:1,maxLength:128},appliedPlanId:be,projectStateDigest:be,assets:{type:"array",items:{type:"object",additionalProperties:!1,required:["path","digest"],properties:{path:{type:"string",minLength:1,maxLength:512},digest:be,ownership:{enum:["owned-file","managed-region","seed-file"]},regionId:{type:"string",pattern:Y}},allOf:[{if:{properties:{ownership:{const:"managed-region"}},required:["ownership"]},then:{properties:{regionId:{type:"string",pattern:Y}},required:["regionId"]}}]}},evidenceIds:{type:"array",items:be},committedAt:dl,packageAdoption:{type:"object",additionalProperties:!1,required:["registryRevisions","sources","packageJsonDigest","lockfileDigest"],properties:{sourceChannel:{enum:["production","development"]},registryRevisions:{type:"array",items:{type:"object",additionalProperties:!1,required:["registryId","revision"],properties:{registryId:RN,revision:be}}},sources:{type:"array",minItems:1,maxItems:128,items:pg},packageJsonDigest:be,lockfileDigest:be}}}}}},allOf:[{if:{properties:{schemaVersion:{const:1}},required:["schemaVersion"]},then:{properties:{capabilities:{type:"array",items:{type:"object",not:{type:"object",properties:{packageAdoption:{}},required:["packageAdoption"]}}}}}}]},Ki=new lg.Ajv2020({allErrors:!0,strict:!0});Ki.addFormat("date-time",{type:"string",validate:e=>!Number.isNaN(Date.parse(e))});var ON={capabilityBundleRelease:Ki.compile(SN),verificationResult:Ki.compile(Do),adoptionEvidence:Ki.compile(NN),projectAdoptionLock:Ki.compile(PN)},Co=class extends Error{contract;issues;code="ADOPTION_CONTRACT_INVALID";constructor(t,r){super(`Invalid ${t} contract`),this.contract=t,this.issues=r}};function DN(e,t,r){if(!t(r))throw new Co(e,t.errors??[]);return r}var hg=e=>{let t=DN("capabilityBundleRelease",ON.capabilityBundleRelease,e);if(t.schemaVersion===2){let r=()=>{throw new Co("capabilityBundleRelease",[])},n=t.packageSources;(t.availability.maturity==="candidate"&&t.availability.sourceState==="local-artifact"&&n.length!==0||t.availability.maturity==="candidate"&&t.availability.sourceState==="development-registry"&&n.length===0||t.availability.maturity!=="candidate"&&n.length===0)&&r();let i="",a=new Set;for(let s of n){let c=`${s.packageName}@${s.version}`;(c.localeCompare(i)<=0||a.has(c))&&r(),i=c,a.add(c)}let o=t.integration?.packages??[];(t.availability.maturity!=="candidate"||t.availability.sourceState==="development-registry")&&(o.length!==n.length||o.some(s=>!n.some(c=>c.packageName===s.packageName&&c.version===s.version&&c.usage===s.usage)))&&r()}return t};import{lstat as zN,readFile as wg,realpath as BN}from"node:fs/promises";import ml from"node:path";import{createHash as CN}from"node:crypto";function A(e){return`sha256:${CN("sha256").update(e).digest("hex")}`}function C(e){return Array.isArray(e)?`[${e.map(C).join(",")}]`:e!==null&&typeof e=="object"?`{${Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>`${JSON.stringify(r)}:${C(n)}`).join(",")}}`:JSON.stringify(e)}var Rn=class extends Error{code="MANAGED_REGION_INVALID";constructor(t){super(t)}};function xN(e){if(!new RegExp(Y).test(e))throw new Rn("Region identity is invalid");return{begin:`<!-- dyyto:begin ${e} -->`,end:`<!-- dyyto:end ${e} -->`}}function pl(e,t){if(e.includes("\r"))throw new Rn("Managed regions require LF newlines");let{begin:r,end:n}=xN(t),i=e.split(r).length-1,a=e.split(n).length-1;if(i!==1||a!==1)throw new Rn("Managed region markers are unavailable or ambiguous");let o=e.indexOf(r)+r.length,s=e.indexOf(n,o),c=e.slice(o,s);if(/<!-- dyyto:(?:begin|end) /.test(c))throw new Rn("Managed regions cannot overlap");return`${c.replace(/^\n+|\n+$/g,"")}
|
|
15
|
-
`}import mg from"node:path";var ul=class extends Error{assetPath;code="PLAN_PRECONDITION_FAILED";constructor(t,r){super(t),this.assetPath=r}};function gg(e){if(e.length===0||mg.posix.isAbsolute(e)||mg.win32.isAbsolute(e)||e.includes("\\")||e.split("/").some(t=>t===".."||t==="."))throw new ul("Asset path must be a normalized project-relative POSIX path",e)}var yg=rr(Vr(),1);var J={type:"string",pattern:It},kn={type:"string",pattern:Y},zr={type:"string",minLength:1,maxLength:128},Fr={type:"string",minLength:1,maxLength:512,pattern:"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\).+$"},TN={$id:"https://schemas.dyyto.dev/platform/capability-release-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","capabilityId","version","integrity","assets","verifiers"],properties:{schemaVersion:{const:1},capabilityId:kn,version:zr,integrity:J,assets:{type:"array",items:{type:"object",additionalProperties:!1,required:["path","ownership"],properties:{path:Fr,ownership:{enum:["owned-file","managed-region","seed-file","shared-file","user-file"]},desiredDigest:J}}},verifiers:{type:"array",items:{type:"object",additionalProperties:!1,required:["id","kind"],properties:{id:{type:"string",minLength:1,maxLength:128},kind:{enum:["command","file-digest"]}}}}}},jN={$id:"https://schemas.dyyto.dev/platform/project-manifest-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","capabilities"],properties:{schemaVersion:{const:1},template:{type:"object",additionalProperties:!1,required:["id","version"],properties:{id:kn,version:zr}},profile:{type:"object",additionalProperties:!1,required:["id","parameters"],properties:{id:{type:"string",pattern:Y},parameters:{type:"object",minProperties:0,maxProperties:32,propertyNames:{pattern:"^[a-z][A-Za-z0-9]*$"},additionalProperties:{type:"string",maxLength:256}}}},capabilities:{type:"array",items:{type:"object",additionalProperties:!1,required:["capabilityId","version"],properties:{capabilityId:kn,version:zr}}}}},LN={$id:"https://schemas.dyyto.dev/platform/project-lock-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","capabilities"],properties:{schemaVersion:{const:1},capabilities:{type:"array",items:{type:"object",additionalProperties:!1,required:["capabilityId","version","integrity","appliedPlanId","assets","evidenceIds"],properties:{capabilityId:kn,version:zr,integrity:J,appliedPlanId:J,assets:{type:"array",items:{type:"object",additionalProperties:!1,required:["path","digest"],properties:{path:Fr,digest:J}}},evidenceIds:{type:"array",items:{type:"string",minLength:1,maxLength:256}}}}}}},$N={$id:"https://schemas.dyyto.dev/platform/evidence-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","evidenceId","capabilityId","capabilityVersion","verifierId","result","observedAt"],properties:{schemaVersion:{const:1},evidenceId:{type:"string",minLength:1,maxLength:256},capabilityId:kn,capabilityVersion:zr,verifierId:{type:"string",minLength:1,maxLength:128},result:{enum:["passed","failed"]},observedAt:{type:"string",format:"date-time"}}},MN={$id:"https://schemas.dyyto.dev/platform/change-plan-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","planId","action","state","capability","generatedAt","expiresAt","inputDigest","operations"],properties:{schemaVersion:{const:1},planId:J,action:{enum:["adopt","upgrade","remove"]},state:{enum:["reviewable","conflicted"]},capability:{type:"object",additionalProperties:!1,required:["capabilityId","version","integrity"],properties:{capabilityId:kn,version:zr,integrity:J}},generatedAt:{type:"string",format:"date-time"},expiresAt:{type:"string",format:"date-time"},inputDigest:J,packageAdoption:{type:"object",additionalProperties:!1,required:["schemaVersion","packageJsonPreimageDigest","desiredPackageJsonDigest","lockfilePreimage","desiredLockfileDigest","registryRevisions","endpointBindings","sources","installPolicy"],properties:{schemaVersion:{enum:[1,2]},sourceChannel:{enum:["production","development"]},packageJsonPreimageDigest:J,desiredPackageJsonDigest:J,lockfilePreimage:{oneOf:[{type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{const:"absent"}}},{type:"object",additionalProperties:!1,required:["kind","digest"],properties:{kind:{const:"present"},digest:J}}]},desiredLockfileDigest:J,registryRevisions:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["registryId","revision"],properties:{registryId:{type:"string",minLength:1,maxLength:128},revision:J}}},endpointBindings:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["registryId","registryConfigRevision","bindingDigest","expiresAt"],properties:{registryId:{type:"string",minLength:1,maxLength:128},registryConfigRevision:J,bindingDigest:J,expiresAt:{type:"string",format:"date-time"}}}},sources:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["registryId","packageName","version","integrity","tarballDigest","deliveryReceiptId","usage"],properties:{registryId:{type:"string",minLength:1,maxLength:128},packageName:{type:"string",pattern:"^@[a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._-]*$"},version:zr,integrity:{type:"string",pattern:"^sha512-[A-Za-z0-9+/]+={0,2}$"},tarballDigest:J,deliveryReceiptId:J,usage:{enum:["runtime","development"]}}}},installPolicy:{type:"object",additionalProperties:!1,required:["ignoreScripts","allowWorkspaceProtocol","allowPublicRegistryFallback"],properties:{ignoreScripts:{const:!0},allowWorkspaceProtocol:{const:!1},allowPublicRegistryFallback:{const:!1}}},topology:{type:"object",additionalProperties:!1,required:["mode","unitRelativeRoot","unitImporterId","lockfilePath"],properties:{mode:{enum:["standalone","pnpm-shared-lockfile"]},unitRelativeRoot:Fr,unitImporterId:Fr,lockfilePath:{const:"pnpm-lock.yaml"},workspaceManifestPath:{const:"pnpm-workspace.yaml"},workspaceManifestDigest:J}},preservedDependencies:{type:"array",items:{type:"object",additionalProperties:!1,required:["section","packageName","specifier"],properties:{section:{enum:["dependencies","devDependencies","optionalDependencies"]},packageName:{type:"string",minLength:1,maxLength:214},specifier:{type:"string",minLength:1,maxLength:512}}}},preservedImporterDigests:{type:"array",items:{type:"object",additionalProperties:!1,required:["importerId","preimageDigest","desiredDigest"],properties:{importerId:Fr,preimageDigest:J,desiredDigest:J}}}},allOf:[{if:{properties:{schemaVersion:{const:1}},required:["schemaVersion"]},then:{properties:{topology:!1,preservedDependencies:!1,preservedImporterDigests:!1}}},{if:{properties:{schemaVersion:{const:2}},required:["schemaVersion"]},then:{required:["topology","preservedDependencies","preservedImporterDigests"]}}]},operations:{type:"array",items:{type:"object",additionalProperties:!1,required:["path","kind","ownership","disposition"],properties:{path:Fr,kind:{enum:["create","replace","merge","remove"]},ownership:{enum:["owned-file","managed-region","seed-file","shared-file","user-file"]},desiredDigest:J,baseDigest:J,regionId:{type:"string",pattern:Y},disposition:{enum:["ready","noop","conflict"]},conflictCode:{enum:["USER_OWNED","UNEXPECTED_EXISTING","BASE_DIGEST_MISMATCH"]}}}}}},VN={$id:"https://schemas.dyyto.dev/platform/transaction-journal-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","transactionId","planId","approvedPlanId","projectRootDigest","state","createdAt","updatedAt","operations","journalDigest"],properties:{schemaVersion:{const:1},transactionId:{type:"string",minLength:1,maxLength:128},planId:J,approvedPlanId:J,projectRootDigest:J,state:{enum:["preparing","prepared","applying","applied","recovery-required","recovering","recovered"]},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},operations:{type:"array",items:{type:"object",additionalProperties:!1,required:["index","path","kind","before","status"],properties:{index:{type:"integer",minimum:0},path:Fr,kind:{enum:["create","replace","merge","remove"]},before:{oneOf:[{type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{const:"absent"}}},{type:"object",additionalProperties:!1,required:["kind","digest","mode","preimageDigest"],properties:{kind:{const:"present"},digest:J,mode:{type:"integer",minimum:0,maximum:511},preimageDigest:J}}]},desiredDigest:J,status:{enum:["pending","applied","restored"]}}}},failure:{type:"object",additionalProperties:!1,required:["code"],properties:{code:{type:"string",minLength:1,maxLength:128},operationIndex:{type:"integer",minimum:0}}},journalDigest:J}},Ur=new yg.Ajv2020({allErrors:!0,strict:!0});Ur.addFormat("date-time",{type:"string",validate:e=>!Number.isNaN(Date.parse(e))});var UN={capabilityRelease:Ur.compile(TN),projectManifest:Ur.compile(jN),projectLock:Ur.compile(LN),evidence:Ur.compile($N),changePlan:Ur.compile(MN),transactionJournal:Ur.compile(VN)},hl=class extends Error{contract;issues;code="CONTRACT_INVALID";constructor(t,r){super(`Invalid ${t} contract`),this.contract=t,this.issues=r}};function FN(e,t,r){if(!t(r))throw new hl(e,t.errors??[]);return r}var fr=e=>FN("projectManifest",UN.projectManifest,e);var Sn=class extends Error{code;assetPath;constructor(t,r,n){super(r),this.code=t,this.assetPath=n}};async function qN(e,t){let r=ml.join(e,...t.split("/"));try{let n=await zN(r);if(!n.isFile()||n.isSymbolicLink())throw new Sn("PROJECT_STATE_INVALID","Blank profile target must be a regular file",t);return{path:t,exists:!0,digest:A(await wg(r))}}catch(n){if(n.code==="ENOENT")return{path:t,exists:!1};throw n}}async function xo(e){let t=await BN(ml.resolve(e.projectRoot)),r=[];for(let n of e.expectedAssets){let i=await qN(t,n.path),a=i.exists&&i.digest===n.digest;if(n.ownership==="managed-region"&&n.regionId!==void 0&&i.exists)try{a=A(pl(await wg(ml.join(t,...n.path.split("/")),"utf8"),n.regionId))===n.digest}catch{a=!1}if(!a)throw new Sn("PROJECT_STATE_INVALID","A managed project asset does not match the approved plan",n.path);r.push({path:n.path,digest:n.digest,...n.ownership===void 0?{}:{ownership:n.ownership},...n.regionId===void 0?{}:{regionId:n.regionId}})}return{assets:r,projectStateDigest:A(C(r))}}var PM=5*1024*1024,OM=25*1024*1024;import{lstat as vg,readFile as _g,realpath as Ig}from"node:fs/promises";import pr from"node:path";var ut=class extends Error{code;assetPath;constructor(t,r,n){super(r),this.code=t,this.assetPath=n}};function Eg(e){return A(C(e))}async function JN(e,t){let r=pr.join(e,"assets",...t.split("/"));try{return await vg(r),r}catch(n){if(n.code!=="ENOENT"||pr.posix.basename(t)!==".gitignore")throw n}return pr.join(e,"assets",...pr.posix.dirname(t).split("/").filter(n=>n!=="."),"__dyyto_dotfiles__","gitignore")}async function bg(e){let t=await Ig(pr.resolve(e)),r;try{r=hg(JSON.parse(await _g(pr.join(t,"release.json"),"utf8")))}catch(c){throw c instanceof ut?c:new ut("RELEASE_INVALID","Capability release metadata is invalid")}let{integrity:n,...i}=r;if(Eg(i)!==n)throw new ut("RELEASE_INTEGRITY_MISMATCH","Capability release integrity does not match metadata");let a=new Map,o=new Set,s="";for(let c of r.assets){try{gg(c.path)}catch{throw new ut("RELEASE_ASSET_INVALID","Release asset path is unsafe",c.path)}if((c.path===".dyyto"||c.path.startsWith(".dyyto/"))&&c.path!==".dyyto/application-config-binding.json"||o.has(c.path)||c.path.localeCompare(s)<0)throw new ut("RELEASE_ASSET_INVALID","Release assets must be unique, sorted and outside reserved .dyyto paths",c.path);o.add(c.path),s=c.path;let d=await JN(t,c.path),l=await Ig(d),f=pr.join(t,"assets");if(!l.startsWith(`${f}${pr.sep}`))throw new ut("RELEASE_ASSET_INVALID","Release asset escapes its bundle",c.path);let p=await vg(d);if(!p.isFile()||p.isSymbolicLink())throw new ut("RELEASE_ASSET_INVALID","Release asset must be a regular file",c.path);let u=await _g(d);if(A(u)!==c.digest)throw new ut("RELEASE_ASSET_INTEGRITY_MISMATCH","Release asset digest does not match metadata",c.path);a.set(c.path,u)}if(r.exit.ownedAssets.length!==r.assets.length||r.exit.ownedAssets.some((c,d)=>c!==r.assets[d]?.path))throw new ut("RELEASE_INVALID","Exit owned assets must exactly match release assets");return{release:r,contents:a}}import{lstat as Rg,readFile as YN,readdir as ZN,realpath as XN}from"node:fs/promises";import Nn from"node:path";import{homedir as QN}from"node:os";var ur=class extends Error{code;constructor(t){super(t),this.code=t,this.name="WorkspaceTopologyError"}};async function eP(e){let t=Nn.resolve(e),r=await Rg(t).catch(()=>null);if(!r?.isDirectory()||r.isSymbolicLink()||t===Nn.parse(t).root||t===Nn.resolve(QN()))throw new ur("WORKSPACE_PATH_UNSAFE");let n=await XN(t);if(n!==t)throw new ur("WORKSPACE_PATH_UNSAFE");return n}async function Ag(e){let t=await Rg(e).catch(()=>null);if(t!==null){if(!t.isFile()||t.isSymbolicLink())throw new ur("WORKSPACE_PATH_UNSAFE");return YN(e)}}function tP(e){let t=e.split(/\r?\n/u),r=[],n=!1;for(let i of t){if(/^packages:\s*(?:#.*)?$/u.test(i)){n=!0;continue}if(!n)continue;let a=/^\s+-\s+["']?([^"'#]+?)["']?\s*(?:#.*)?$/u.exec(i);if(a){r.push(a[1].trim().replace(/^\.\//u,"").replace(/\/$/u,""));continue}if(i.trim()&&!/^\s/u.test(i))break}if(r.length===0)throw new ur("WORKSPACE_MANIFEST_INVALID");return r}async function kg(e){let t=await eP(e),r=await Ag(Nn.join(t,"pnpm-workspace.yaml"));if(!r)throw new ur("WORKSPACE_OWNER_MISSING");let n=new Map;for(let i of tP(r.toString("utf8"))){let a=[];if(i.endsWith("/*")&&!i.slice(0,-2).includes("*")){let o=i.slice(0,-2),s=await ZN(Nn.join(t,...o.split("/")),{withFileTypes:!0}).catch(()=>[]);for(let c of s)c.isDirectory()&&!c.isSymbolicLink()&&a.push(`${o}/${c.name}`)}else if(!i.includes("*"))a.push(i);else throw new ur("WORKSPACE_MANIFEST_INVALID");for(let o of a){let s=await Ag(Nn.join(t,...o.split("/"),"package.json"));s&&n.set(o,s)}}return Object.freeze([...n].sort(([i],[a])=>i.localeCompare(a)).map(([i,a])=>Object.freeze({relativeRoot:i,bytes:a})))}var Ft=class extends Error{code;constructor(t,r){super(r),this.code=t}},wl=/^sha256:[a-f0-9]{64}$/;var aP=/^registry\.[a-z0-9][a-z0-9.-]{1,126}$/;var Sg=/^[a-z][a-z0-9._:-]{2,127}$/;function Br(e,t){let r=Object.keys(e).sort();return r.length===t.length&&r.every((n,i)=>n===[...t].sort()[i])}function oP(e){if(!Br(e,["registryId","tenantId","origin","scopes","authentication","capabilities","status"])||!aP.test(e.registryId)||!Sg.test(e.tenantId)||e.scopes.length===0||e.scopes.length>32||e.scopes.some((n,i)=>!/^@[a-z0-9][a-z0-9._-]*$/.test(n)||e.scopes.indexOf(n)!==i)||!Br(e.authentication,e.authentication.credentialRef===void 0?["kind"]:["kind","credentialRef"])||!Br(e.capabilities,["read","write","provenance","staging"])||!["workload-identity","short-lived-token","restricted-token","anonymous-test"].includes(e.authentication.kind)||e.authentication.kind==="anonymous-test"!=(e.authentication.credentialRef===void 0)||e.authentication.credentialRef!==void 0&&!Sg.test(e.authentication.credentialRef))return!1;let t;try{t=new URL(e.origin)}catch{return!1}if(t.username||t.password||t.search||t.hash||!t.pathname.endsWith("/")||t.pathname.includes("..")||/%2f|%5c/iu.test(t.pathname))return!1;let r=t.hostname==="127.0.0.1"||t.hostname==="localhost"||t.hostname==="[::1]";return e.authentication.kind==="anonymous-test"&&(!r||t.protocol!=="http:")||e.authentication.kind!=="anonymous-test"&&t.protocol!=="https:"?!1:typeof e.capabilities.read=="boolean"&&typeof e.capabilities.write=="boolean"&&typeof e.capabilities.provenance=="boolean"&&typeof e.capabilities.staging=="boolean"&&(e.status==="enabled"||e.status==="disabled")}function sP(e){if(!oP(e))throw new Ft("REGISTRY_CONFIG_INVALID","Registry configuration is invalid");let t={schemaVersion:1,...e};return Object.freeze({...t,scopes:Object.freeze([...e.scopes]),authentication:Object.freeze({...e.authentication}),capabilities:Object.freeze({...e.capabilities}),revision:A(C(t))})}function _l(e){let t=e;if(typeof t!="object"||t===null||!Br(t,["schemaVersion","revision","registryId","tenantId","origin","scopes","authentication","capabilities","status"])||t.schemaVersion!==1||!wl.test(t.revision))throw new Ft("REGISTRY_CONFIG_INVALID","Registry configuration is invalid");let{schemaVersion:r,revision:n,...i}=t;if(sP(i).revision!==n)throw new Ft("REGISTRY_CONFIG_INVALID","Registry configuration has been modified");return t}function cP(e,t){let r,n;try{r=new URL(e.origin),n=new URL(t)}catch{return!1}return n.username||n.password||n.search||n.hash||n.pathname!==r.pathname||n.protocol!==r.protocol||n.hostname!==r.hostname?!1:e.authentication.kind==="anonymous-test"||n.port===r.port}function dP(e,t){let r=_l(t);if(!Br(e,["registryId","registryConfigRevision","origin","resolvedAt","expiresAt"])||e.registryId!==r.registryId||e.registryConfigRevision!==r.revision||!cP(r,e.origin)||Number.isNaN(Date.parse(e.resolvedAt))||Number.isNaN(Date.parse(e.expiresAt))||Date.parse(e.expiresAt)<=Date.parse(e.resolvedAt))throw new Ft("REGISTRY_ENDPOINT_BINDING_INVALID","Registry endpoint binding is invalid");let n={schemaVersion:1,...e};return Object.freeze({...n,bindingDigest:A(C(n))})}function To(e,t){let r=e;if(typeof r!="object"||r===null||!Br(r,["schemaVersion","bindingDigest","registryId","registryConfigRevision","origin","resolvedAt","expiresAt"])||r.schemaVersion!==1||!wl.test(r.bindingDigest))throw new Ft("REGISTRY_ENDPOINT_BINDING_INVALID","Registry endpoint binding is invalid");let{schemaVersion:n,bindingDigest:i,...a}=r;if(dP(a,t).bindingDigest!==i)throw new Ft("REGISTRY_ENDPOINT_BINDING_INVALID","Registry endpoint binding has been modified");return r}function jo(e,t,r=6e4){if(!Br(e,["schemaVersion","kind","secret","subjectDigest","issuedAt","expiresAt"])||e.schemaVersion!==1||!["bearer-token","anonymous-test"].includes(e.kind)||typeof e.secret!="string"||e.secret.length<1||e.secret.length>16384||/[\r\n\0]/u.test(e.secret)||!wl.test(e.subjectDigest)||[e.issuedAt,e.expiresAt,t].some(n=>Number.isNaN(Date.parse(n)))||Date.parse(e.issuedAt)>Date.parse(t)||Date.parse(e.expiresAt)-Date.parse(t)<r)throw new Ft("REGISTRY_CREDENTIAL_INVALID","Registry credential lease is invalid");return e}var X=class extends Error{code;constructor(t,r){super(t,r),this.code=t,this.name="PackageAdoptionError"}};var Dg=rr(Vr(),1);var Cg=["workspace-node-application","workspace-web-application","nextjs-full-stack-application"],xg="^[a-z0-9][a-z0-9._-]{0,127}$",Il="^[A-Z][A-Z0-9_]{0,127}$",Ng="^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*(?:^|/)\\.(?:/|$))(?!.*\\\\)(?!.*[\\u0000-\\u001f]).+$",uP={$id:"https://schemas.dyyto.dev/platform/application-config-contract-v1.json",type:"object",additionalProperties:!1,required:["$schema","schemaVersion","kind","application","configDirectory","bindings"],properties:{$schema:{const:"https://schemas.dyyto.dev/platform/application-config-contract-v1.json"},schemaVersion:{const:1},kind:{const:"ApplicationConfigContract"},application:{type:"object",additionalProperties:!1,required:["id","profile"],properties:{id:{type:"string",pattern:xg},profile:{enum:Cg}}},configDirectory:{type:"object",additionalProperties:!1,required:["rootEnvironmentVariable","relativeDirectory","environmentFile","materializationOwner"],properties:{rootEnvironmentVariable:{const:"IDP_CONFIG_DIR"},relativeDirectory:{type:"string",pattern:"^applications/[a-z0-9][a-z0-9._-]{0,127}$"},environmentFile:{const:".env"},materializationOwner:{const:"external-deployment-control-plane"}}},bindings:{type:"array",maxItems:128,items:{oneOf:[{type:"object",additionalProperties:!1,required:["name","kind","required"],properties:{name:{type:"string",pattern:Il},kind:{const:"value"},required:{type:"boolean"},default:{type:"string",maxLength:1024}}},{type:"object",additionalProperties:!1,required:["name","kind","required","file"],properties:{name:{type:"string",pattern:Il},kind:{const:"secret-file"},required:{type:"boolean"},file:{type:"string",maxLength:512,pattern:Ng}}},{type:"object",additionalProperties:!1,required:["name","kind","required","file"],properties:{name:{type:"string",pattern:Il},kind:{const:"certificate-file"},required:{type:"boolean"},file:{type:"string",maxLength:512,pattern:Ng}}}]}}}},Pg=new Dg.Ajv2020({allErrors:!0,strict:!0}).compile(uP),Og=/(?:^|_)(?:PASSWORD|PASSWD|TOKEN|SECRET|PRIVATE_KEY|ACCESS_KEY|API_KEY|DATABASE_URL|CONNECTION_STRING|DSN|AUTHORIZATION|CREDENTIALS?)(?:_|$)/u,hP=/(?:^|_)(?:PRIVATE_KEY|PRIVATE|KEYPAIR|KEYSTORE|PKCS12|P12|PFX|KEY)(?:_|$)/u,qe=class extends Error{code;issues;constructor(t,r,n=[]){super(r),this.code=t,this.issues=n}};function mP(e){let t=fr(e),r=t.profile?.id;if(!Cg.includes(r))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID","\u73AF\u5883\u914D\u7F6E\u5951\u7EA6\u53EA\u652F\u6301\u53EF\u90E8\u7F72 Application Profile\u3002");let n=t.profile?.parameters??{},i=n.name;if(Object.keys(n).length!==1||typeof i!="string"||!new RegExp(xg,"u").test(i))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID","Application Manifest \u5FC5\u987B\u5305\u542B\u552F\u4E00\u4E14\u5408\u6CD5\u7684 name \u53C2\u6570\u3002");return{id:i,profile:r}}function vl(e,t){if(!Pg(e))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID","Application ConfigContract \u4E0D\u7B26\u5408 v1 Schema\u3002",Pg.errors??[]);let r=e;if(r.configDirectory.relativeDirectory!==`applications/${r.application.id}`)throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID","Config Dir \u76F8\u5BF9\u76EE\u5F55\u5FC5\u987B\u7531 Application identity \u552F\u4E00\u786E\u5B9A\u3002");let n=new Set,i=new Set;for(let a of r.bindings){if(n.has(a.name))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID",`\u73AF\u5883 Binding \u540D\u79F0\u91CD\u590D\uFF1A${a.name}`);if(n.add(a.name),a.kind==="value"){if(Og.test(a.name))throw new qe("APPLICATION_CONFIG_SECRET_LITERAL_FORBIDDEN",`\u654F\u611F\u914D\u7F6E ${a.name} \u5FC5\u987B\u4F7F\u7528\u6587\u4EF6 Binding\uFF0C\u7981\u6B62\u5728\u4ED3\u5E93\u4E2D\u58F0\u660E\u503C\u3002`);continue}if(!a.name.endsWith("_FILE"))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID",`\u6587\u4EF6 Binding ${a.name} \u5FC5\u987B\u4EE5 _FILE \u7ED3\u5C3E\u3002`);let o=a.kind==="secret-file"?"secrets/":"certs/";if(a.kind==="certificate-file"&&(Og.test(a.name)||hP.test(a.name)))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID",`${a.name} \u5305\u542B\u79C1\u5BC6\u6750\u6599\u8BED\u4E49\uFF0C\u5FC5\u987B\u4F7F\u7528 secret-file \u5E76\u653E\u5165 secrets/\uFF1Bcertificate-file \u53EA\u5141\u8BB8\u516C\u5F00\u8BC1\u4E66\u3002`);let s=a.file.split("/");if(!a.file.startsWith(o)||s.some(c=>c===""||c==="."||c===".."))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID",`${a.name} \u5FC5\u987B\u4F4D\u4E8E ${o} \u4E0B\u7684\u5177\u4F53\u6587\u4EF6\u3002`);if(i.has(a.file))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID",`\u914D\u7F6E\u6587\u4EF6 Binding \u8DEF\u5F84\u91CD\u590D\uFF1A${a.file}`);i.add(a.file)}if(t!==void 0){let a=mP(t);if(r.application.id!==a.id||r.application.profile!==a.profile)throw new qe("APPLICATION_CONFIG_IDENTITY_MISMATCH","ConfigContract \u7684\u5E94\u7528\u8EAB\u4EFD\u6216 Profile \u4E0E Project Manifest \u4E0D\u4E00\u81F4\u3002")}return r}var O=class extends Error{code;constructor(t,r){super(r),this.code=t,this.name="DeliveryError"}};import{mkdir as El,open as Vo,readFile as Ji,readdir as Hg,rename as Uo,rm as Jg}from"node:fs/promises";import _e from"node:path";var bP=44;var Tg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",AP=new Uint8Array(64),Lg=new Uint8Array(128);for(let e=0;e<Tg.length;e++){let t=Tg.charCodeAt(e);AP[e]=t,Lg[t]=e}function Hi(e,t){let r=0,n=0,i=0;do{let o=e.next();i=Lg[o],r|=(i&31)<<n,n+=5}while(i&32);let a=r&1;return r>>>=1,a&&(r=-2147483648|-r),t+r}function jg(e,t){return e.pos>=t?!1:e.peek()!==bP}var ZV=1024*16;var RP=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:r}=this,n=t.indexOf(e,r);return n===-1?t.length:n}};function $g(e){let{length:t}=e,r=new RP(e),n=[],i=0,a=0,o=0,s=0,c=0;do{let d=r.indexOf(";"),l=[],f=!0,p=0;for(i=0;r.pos<d;){let u;i=Hi(r,i),i<p&&(f=!1),p=i,jg(r,d)?(a=Hi(r,a),o=Hi(r,o),s=Hi(r,s),jg(r,d)?(c=Hi(r,c),u=[i,a,o,s,c]):u=[i,a,o,s]):u=[i],l.push(u),r.pos++}f||kP(l),n.push(l),r.pos=d+1}while(r.pos<=t);return n}function kP(e){e.sort(SP)}function SP(e,t){return e[0]-t[0]}var NP=/^[\w+.-]+:\/\//,PP=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,OP=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function DP(e){return NP.test(e)}function CP(e){return e.startsWith("//")}function Ug(e){return e.startsWith("/")}function xP(e){return e.startsWith("file:")}function Mg(e){return/^[.?#]/.test(e)}function Lo(e){let t=PP.exec(e);return Fg(t[1],t[2]||"",t[3],t[4]||"",t[5]||"/",t[6]||"",t[7]||"")}function TP(e){let t=OP.exec(e),r=t[2];return Fg("file:","",t[1]||"","",Ug(r)?r:"/"+r,t[3]||"",t[4]||"")}function Fg(e,t,r,n,i,a,o){return{scheme:e,user:t,host:r,port:n,path:i,query:a,hash:o,type:7}}function Vg(e){if(CP(e)){let r=Lo("http:"+e);return r.scheme="",r.type=6,r}if(Ug(e)){let r=Lo("http://foo.com"+e);return r.scheme="",r.host="",r.type=5,r}if(xP(e))return TP(e);if(DP(e))return Lo(e);let t=Lo("http://foo.com/"+e);return t.scheme="",t.host="",t.type=e?e.startsWith("?")?3:e.startsWith("#")?2:4:1,t}function jP(e){if(e.endsWith("/.."))return e;let t=e.lastIndexOf("/");return e.slice(0,t+1)}function LP(e,t){zg(t,t.type),e.path==="/"?e.path=t.path:e.path=jP(t.path)+e.path}function zg(e,t){let r=t<=4,n=e.path.split("/"),i=1,a=0,o=!1;for(let c=1;c<n.length;c++){let d=n[c];if(!d){o=!0;continue}if(o=!1,d!=="."){if(d===".."){a?(o=!0,a--,i--):r&&(n[i++]=d);continue}n[i++]=d,a++}}let s="";for(let c=1;c<i;c++)s+="/"+n[c];(!s||o&&!s.endsWith("/.."))&&(s+="/"),e.path=s}function Bg(e,t){if(!e&&!t)return"";let r=Vg(e),n=r.type;if(t&&n!==7){let a=Vg(t),o=a.type;switch(n){case 1:r.hash=a.hash;case 2:r.query=a.query;case 3:case 4:LP(r,a);case 5:r.user=a.user,r.host=a.host,r.port=a.port;case 6:r.scheme=a.scheme}o>n&&(n=o)}zg(r,n);let i=r.query+r.hash;switch(n){case 2:case 3:return i;case 4:{let a=r.path.slice(1);return a?Mg(t||e)&&!Mg(a)?"./"+a+i:a+i:i||"."}case 5:return r.path+i;default:return r.scheme+"//"+r.user+r.host+r.port+r.path+i}}function $P(e){if(!e)return"";let t=e.lastIndexOf("/");return e.slice(0,t+1)}function MP(e,t){let r=$P(e),n=t?t+"/":"";return i=>Bg(n+(i||""),r)}var hr=0,VP=1,UP=2,FP=3,zP=4;function BP(e,t){let r=qg(e,0);if(r===e.length)return e;t||(e=e.slice());for(let n=r;n<e.length;n=qg(e,n+1))e[n]=GP(e[n],t);return e}function qg(e,t){for(let r=t;r<e.length;r++)if(!qP(e[r]))return r;return e.length}function qP(e){for(let t=1;t<e.length;t++)if(e[t][hr]<e[t-1][hr])return!1;return!0}function GP(e,t){return t||(e=e.slice()),e.sort(KP)}function KP(e,t){return e[hr]-t[hr]}var Mo=!1;function WP(e,t,r,n){for(;r<=n;){let i=r+(n-r>>1),a=e[i][hr]-t;if(a===0)return Mo=!0,i;a<0?r=i+1:n=i-1}return Mo=!1,r-1}function HP(e,t,r){for(let n=r+1;n<e.length&&e[n][hr]===t;r=n++);return r}function JP(e,t,r){for(let n=r-1;n>=0&&e[n][hr]===t;r=n--);return r}function YP(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function ZP(e,t,r,n){let{lastKey:i,lastNeedle:a,lastIndex:o}=r,s=0,c=e.length-1;if(n===i){if(t===a)return Mo=o!==-1&&e[o][hr]===t,o;t>=a?s=o===-1?0:o:c=o}return r.lastKey=n,r.lastNeedle=t,r.lastIndex=WP(e,t,s,c)}function XP(e){return typeof e=="string"?JSON.parse(e):e}var QP="`line` must be greater than 0 (lines start at line 1)",eO="`column` must be greater than or equal to 0 (columns start at column 0)",Gg=-1,tO=1,Kg=class{constructor(e,t){let r=typeof e=="string";if(!r&&e._decodedMemo)return e;let n=XP(e),{version:i,file:a,names:o,sourceRoot:s,sources:c,sourcesContent:d}=n;this.version=i,this.file=a,this.names=o||[],this.sourceRoot=s,this.sources=c,this.sourcesContent=d,this.ignoreList=n.ignoreList||n.x_google_ignoreList||void 0;let l=MP(t,s);this.resolvedSources=c.map(l);let{mappings:f}=n;if(typeof f=="string")this._encoded=f,this._decoded=void 0;else if(Array.isArray(f))this._encoded=void 0,this._decoded=BP(f,r);else throw n.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(n)}`);this._decodedMemo=YP(),this._bySources=void 0,this._bySourceMemos=void 0}};function rO(e){var t;return(t=e)._decoded||(t._decoded=$g(e._encoded))}function Wg(e,t){let{line:r,column:n,bias:i}=t;if(r--,r<0)throw new Error(QP);if(n<0)throw new Error(eO);let a=rO(e);if(r>=a.length)return $o(null,null,null,null);let o=a[r],s=nO(o,e._decodedMemo,r,n,i||tO);if(s===-1)return $o(null,null,null,null);let c=o[s];if(c.length===1)return $o(null,null,null,null);let{names:d,resolvedSources:l}=e;return $o(l[c[VP]],c[UP]+1,c[FP],c.length===5?d[c[zP]]:null)}function $o(e,t,r,n){return{source:e,line:t,column:r,name:n}}function nO(e,t,r,n,i){let a=ZP(e,n,t,r);return Mo?a=(i===Gg?HP:JP)(e,n,a):i===Gg&&a++,a===-1||a===e.length?-1:a}var oe=class extends Error{code;constructor(t,r){super(r),this.code=t,this.name="RuntimeObservabilityError"}},bl=/^sha256:[a-f0-9]{64}$/,Yg=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,iO=/^00-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$/,Fo=(e,t)=>Object.keys(e).every(r=>t.includes(r)),Yi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Pn=(e,t)=>e.replace(/[\u0000-\u001f\u007f]/g," ").replace(/([a-z]+:\/\/)[^/@\s]+@/gi,"$1").slice(0,t);function aO(e){if(!Yi(e)||!Fo(e,["schemaVersion","eventId","occurredAt","applicationId","releaseId","deploymentId","kind","error","page","traceparent"]))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error Envelope contains unknown fields");if(!Yi(e.error)||!Yi(e.page)||!Fo(e.error,["type","message","frames"])||!Fo(e.page,["origin","path"]))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error Envelope structure is invalid");if(e.schemaVersion!==1||typeof e.eventId!="string"||!Yg.test(e.eventId)||typeof e.occurredAt!="string"||Number.isNaN(Date.parse(e.occurredAt))||typeof e.applicationId!="string"||e.applicationId.length<1||e.applicationId.length>128)throw new oe("RUNTIME_ERROR_INVALID","Runtime Error Envelope identity is invalid");if(!["uncaught-error","unhandled-rejection","reported-error"].includes(e.kind))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error kind is invalid");for(let n of[e.releaseId,e.deploymentId])if(n!==void 0&&(typeof n!="string"||!bl.test(n)))throw new oe("RUNTIME_ERROR_IDENTITY_UNKNOWN","Runtime Error correlation identity is invalid");if(e.traceparent!==void 0&&(typeof e.traceparent!="string"||!iO.test(e.traceparent)))throw new oe("RUNTIME_ERROR_INVALID","traceparent is invalid");if(typeof e.error.type!="string"||typeof e.error.message!="string"||!Array.isArray(e.error.frames)||e.error.frames.length>50||typeof e.page.origin!="string"||typeof e.page.path!="string")throw new oe("RUNTIME_ERROR_INVALID","Runtime Error content is invalid");if(e.error.message.length>4096||e.error.type.length>256||e.page.path.length>2048)throw new oe("RUNTIME_ERROR_TOO_LARGE","Runtime Error content exceeds a hard limit");let t=e.error.frames.map(n=>{if(!Yi(n)||!Fo(n,["file","line","column","function"])||typeof n.file!="string"||n.file.length>2048)throw new oe("RUNTIME_ERROR_INVALID","Runtime Error stack frame is invalid");for(let i of[n.line,n.column])if(i!==void 0&&(!Number.isSafeInteger(i)||Number(i)<1))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error stack location is invalid");if(n.function!==void 0&&(typeof n.function!="string"||n.function.length>256))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error stack function is invalid");return n}),r;try{r=new URL(e.page.origin)}catch{throw new oe("RUNTIME_ERROR_INVALID","Runtime Error page origin is invalid")}if(r.origin!==e.page.origin||!e.page.path.startsWith("/")||e.page.path.includes("?")||e.page.path.includes("#"))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error page must contain only origin and path");return{...e,error:{...e.error,frames:t}}}function oO(e,t,r="unknown"){let n=e.error.frames.map(o=>({file:Pn(o.file,2048),...o.line===void 0?{}:{line:o.line},...o.column===void 0?{}:{column:o.column},...o.function===void 0?{}:{function:Pn(o.function,256)}})),i={type:Pn(e.error.type,256),message:Pn(e.error.message,4096),frames:n},a=A(C({type:i.type,message:i.message,frames:n.slice(0,5).map(({file:o,line:s,column:c})=>({file:o,line:s,column:c}))}));return{schemaVersion:1,eventId:e.eventId,occurredAt:e.occurredAt,receivedAt:t,applicationId:Pn(e.applicationId,128),...e.releaseId===void 0?{}:{releaseId:e.releaseId},...e.deploymentId===void 0?{}:{deploymentId:e.deploymentId},kind:e.kind,error:i,page:{origin:e.page.origin,path:Pn(e.page.path,2048)},...e.traceparent===void 0?{}:{traceparent:e.traceparent},fingerprint:a,state:e.releaseId===void 0?"persisted":"map-missing",correlation:r}}var Zi=class{workspaceRoot;adapterId="observability.local";#e=Promise.resolve();constructor(t){this.workspaceRoot=t}directory(){return _e.join(_e.resolve(this.workspaceRoot),".dyyto","observability","events")}releases(){return _e.join(_e.resolve(this.workspaceRoot),".dyyto","observability","releases")}async accept(t,r){let n=aO(t);if(!r.allowedOrigins.includes(n.page.origin))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error origin is not registered");let i=r.resolveCorrelation===void 0?"unknown":await r.resolveCorrelation(n),a=oO(n,r.receivedAt,i);return this.#t(async()=>{let o=this.directory();await El(o,{recursive:!0,mode:448});let s=_e.join(o,`${a.eventId}.json`);try{let p=JSON.parse(await Ji(s,"utf8")),u={...p,correlation:p.correlation??"unknown"};if(C({...u,receivedAt:a.receivedAt})!==C(a))throw new oe("RUNTIME_ERROR_INVALID","eventId is already used for different content");return{eventId:a.eventId,state:u.state,duplicate:!0}}catch(p){if(p.code!=="ENOENT")throw p}let c=`${s}.tmp-${process.pid}-${crypto.randomUUID()}`,d=await Vo(c,"wx",384);try{await d.writeFile(`${C(a)}
|
|
16
|
-
`,"utf8"),await
|
|
17
|
-
`),await c.sync()}finally{await c.close()}return await Uo(`${o}.tmp`,o),await this.resymbolicate(t.releaseId),s}async resymbolicate(t){let r=await Hg(_e.join(this.releases(),t)).catch(()=>[]),n=[];for(let i of r)try{n.push(JSON.parse(await Ji(_e.join(this.releases(),t,i),"utf8")))}catch{}for(let i of(await this.all()).filter(a=>a.releaseId===t&&a.state==="map-missing")){let a=!1,o=i.error.frames.map(
|
|
18
|
-
`),await d.sync()}finally{await d.close()}await Uo(`${c}.tmp`,c)}}};var Zg=rr(Vr(),1);var sO={$id:"https://schemas.dyyto.dev/platform/solution-catalog-entry-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","solutionId","version","integrity","title","summary","maturity","members","integration","exit"],properties:{schemaVersion:{const:1},solutionId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128},integrity:{type:"string",pattern:It},title:{type:"string",minLength:1,maxLength:80},summary:{type:"string",minLength:1,maxLength:240},maturity:{enum:["guided","automated"]},members:{type:"array",minItems:1,maxItems:32,items:{type:"object",additionalProperties:!1,required:["capabilityId","version","role","required"],properties:{capabilityId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128},role:{type:"string",minLength:1,maxLength:80},required:{type:"boolean"}}}},integration:{type:"object",additionalProperties:!1,required:["prerequisites","steps","verification","result"],properties:{prerequisites:{type:"array",minItems:1,maxItems:16,items:{type:"string",minLength:1,maxLength:200}},steps:{type:"array",minItems:1,maxItems:32,items:{type:"object",additionalProperties:!1,required:["label","command"],properties:{label:{type:"string",minLength:1,maxLength:80},command:{type:"string",minLength:1,maxLength:2e3}}}},verification:{type:"array",minItems:1,maxItems:32,items:{type:"string",minLength:1,maxLength:1e3}},result:{type:"string",minLength:1,maxLength:400}}},exit:{type:"object",additionalProperties:!1,required:["summary"],properties:{summary:{type:"string",minLength:1,maxLength:400}}}}},NU=new Zg.Ajv2020({allErrors:!0,strict:!0}).compile(sO);var ey=rr(Vr(),1);var Xg="^[a-z0-9]+(?:[.-][a-z0-9]+)*$",Qg="^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\)[^\\u0000]+$",cO={$id:"https://schemas.dyyto.dev/platform/example-recipe-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","recipeId","version","integrity","title","locale","rootProfile","capabilities","expectedEntrypoint","verifiers","manualAcceptance","cleanup"],properties:{schemaVersion:{const:1},recipeId:{type:"string",pattern:Xg},version:{type:"string",minLength:1,maxLength:128},integrity:{type:"string",pattern:It},title:{type:"string",minLength:1,maxLength:80},locale:{const:"zh-CN"},rootProfile:{type:"object",additionalProperties:!1,required:["capabilityId","version"],properties:{capabilityId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128}}},capabilities:{type:"array",minItems:1,maxItems:16,items:{type:"object",additionalProperties:!1,required:["capabilityId","version","channel"],properties:{capabilityId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128},channel:{const:"development"}}}},expectedEntrypoint:{type:"string",pattern:Qg,maxLength:240},verifiers:{type:"array",minItems:1,maxItems:16,uniqueItems:!0,items:{type:"string",pattern:Xg}},manualAcceptance:{type:"array",minItems:1,maxItems:32,items:{type:"string",minLength:1,maxLength:240}},cleanup:{type:"object",additionalProperties:!1,required:["ownedStateDirectories"],properties:{ownedStateDirectories:{type:"array",maxItems:8,uniqueItems:!0,items:{type:"string",pattern:Qg,maxLength:240}}}}}},CU=new ey.Ajv2020({allErrors:!0,strict:!0}).compile(cO);var ty=rr(Vr(),1);var dO={$id:"https://schemas.dyyto.dev/platform/engineering-template-release-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","templateId","version","integrity","title","summary","status","profile","parameters","commands","technology","support","integration","metrics"],properties:{schemaVersion:{const:1},templateId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128},integrity:{type:"string",pattern:It},title:{type:"string",minLength:1,maxLength:80},summary:{type:"string",minLength:1,maxLength:240},status:{enum:["candidate","recommended","deprecated"]},profile:{type:"object",additionalProperties:!1,required:["id","capability"],properties:{id:{type:"string",pattern:Y},capability:{type:"string",pattern:`${Y.slice(1,-1)}@[0-9]+\\.[0-9]+\\.[0-9]+$`}}},parameters:{type:"array",minItems:0,maxItems:32,items:{type:"object",additionalProperties:!1,required:["id","required","description"],properties:{id:{type:"string",pattern:"^[a-z][A-Za-z0-9]*$"},required:{type:"boolean"},description:{type:"string",minLength:1,maxLength:160}}}},commands:{type:"object",minProperties:1,additionalProperties:!1,properties:{dev:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"},build:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"},test:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"},package:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"}}},technology:{type:"array",minItems:1,maxItems:32,items:{type:"object",additionalProperties:!1,required:["id","version","policy","verifiedAt","rationale","alternative","exit"],properties:{id:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:64},policy:{enum:["recommended","allowed"]},verifiedAt:{type:"string",format:"date"},rationale:{type:"string",minLength:1,maxLength:240},alternative:{type:"string",minLength:1,maxLength:160},exit:{type:"string",minLength:1,maxLength:240}}}},support:{type:"object",additionalProperties:!1,required:["owner","tier","supportedFrom","supportedUntil","upgradeCadence","eolNoticeDays"],properties:{owner:{type:"string",pattern:Y},tier:{const:"production"},supportedFrom:{type:"string",format:"date"},supportedUntil:{type:"string",format:"date"},upgradeCadence:{type:"string",minLength:1,maxLength:80},eolNoticeDays:{type:"integer",minimum:30,maximum:730}}},integration:{type:"object",additionalProperties:!1,required:["prerequisites","createCommand","result"],properties:{prerequisites:{type:"array",minItems:1,maxItems:16,items:{type:"string",minLength:1,maxLength:200}},createCommand:{type:"string",minLength:1,maxLength:2e3},result:{type:"string",minLength:1,maxLength:400}}},metrics:{type:"array",minItems:1,uniqueItems:!0,items:{enum:["time-to-green-build","time-to-first-business-commit","manual-engineering-edits","upgrade-conflicts"]}}}},LU=new ty.Ajv2020({allErrors:!0,strict:!0,formats:{date:/^\d{4}-\d{2}-\d{2}$/}}).compile(dO);var rt=class extends Error{code;constructor(t){super(t),this.code=t,this.name="PlatformPackageSourceError"}},iy=["dependencies","devDependencies","optionalDependencies","peerDependencies"],lO=/^(?:file:|link:|portal:|git(?:\+|:)|https?:|ssh:|github:)/u,fO=/^@[a-z0-9][a-z0-9._-]*\/$/u;function zo(e){return e.startsWith("workspace:")?"workspace":lO.test(e)?"other":"registry"}function Bo(e){if(!fO.test(e.scope))throw new rt("PLATFORM_PACKAGE_SCOPE_INVALID");let t=[];for(let n of e.manifests){let i;try{i=JSON.parse(Buffer.from(n.bytes).toString("utf8"))}catch{throw new rt("PLATFORM_PACKAGE_MANIFEST_INVALID")}if(i===null||typeof i!="object"||Array.isArray(i))throw new rt("PLATFORM_PACKAGE_MANIFEST_INVALID");for(let a of iy){let o=i[a];if(o!==void 0){if(typeof o!="object"||o===null||Array.isArray(o))throw new rt("PLATFORM_PACKAGE_MANIFEST_INVALID");for(let[s,c]of Object.entries(o))if(s.startsWith(e.scope)){if(typeof c!="string"||c.trim()==="")throw new rt("PLATFORM_PACKAGE_MANIFEST_INVALID");t.push(Object.freeze({importer:n.relativeRoot,field:a,packageName:s,specifier:c,source:zo(c)}))}}}}t.sort((n,i)=>n.importer.localeCompare(i.importer)||n.field.localeCompare(i.field)||n.packageName.localeCompare(i.packageName));let r=e.required??null;return Object.freeze({scope:e.scope,required:r,references:Object.freeze(t),violations:Object.freeze(r===null?[]:t.filter(n=>n.source!==r))})}var pO=/^(?:workspace:[*^~]?|(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?)$/u;function ry(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function ny(e){let t;try{t=JSON.parse(Buffer.from(e).toString("utf8"))}catch{throw new rt("PLATFORM_PACKAGE_MANIFEST_INVALID")}if(t===null||typeof t!="object"||Array.isArray(t))throw new rt("PLATFORM_PACKAGE_MANIFEST_INVALID");return t}function ay(e){let t=Bo({manifests:[{relativeRoot:".",bytes:e.manifest}],scope:e.scope}).references;for(let c of Object.values(e.specifiers))if(!pO.test(c))throw new rt("PLATFORM_PACKAGE_SPECIFIER_INVALID");if(t.filter(c=>e.specifiers[c.packageName]===void 0).length>0)throw new rt("PLATFORM_PACKAGE_SPECIFIER_INVALID");let n=t.filter(c=>e.specifiers[c.packageName]!==c.specifier).map(c=>Object.freeze({field:c.field,packageName:c.packageName,from:c.specifier,to:e.specifiers[c.packageName]}));if(n.length===0)return Object.freeze({scope:e.scope,changes:Object.freeze([]),manifest:e.manifest});let i=ny(e.manifest),a=Buffer.from(e.manifest).toString("utf8");for(let c of new Map(n.map(d=>[`${d.packageName}\0${d.from}`,d])).values())a=a.replace(new RegExp(`("${ry(JSON.stringify(c.packageName).slice(1,-1))}"\\s*:\\s*")${ry(c.from)}(")`,"gu"),`$1${c.to}$2`);let o={...i};for(let c of iy){let d=i[c];d!==void 0&&(o[c]=Object.fromEntries(Object.entries(d).map(([l,f])=>[l,l.startsWith(e.scope)?e.specifiers[l]:f])))}let s=new TextEncoder().encode(a);if(JSON.stringify(ny(s))!==JSON.stringify(o))throw new rt("PLATFORM_PACKAGE_REWRITE_UNSAFE");return Object.freeze({scope:e.scope,changes:Object.freeze(n),manifest:s})}function oy(e){let t=new Map(e.projection.locked.map(a=>[`${a.capabilityId}@${a.version}`,a])),r=new Set(e.projection.verified.map(a=>`${a.capabilityId}@${a.version}`)),n=e.projection.declared.map(a=>{let o=`${a.capabilityId}@${a.version}`,s=e.releases.find(l=>`${l.capabilityId}@${l.version}`===o),c=t.get(o),d=r.has(o)?"verified":c?"locked":"declared";return Object.freeze({capabilityId:a.capabilityId,version:a.version,status:d,title:s?.integration?.title??a.capabilityId,purpose:s?.integration?.purpose??"\u8BE5\u53D1\u884C\u7248\u5C1A\u672A\u58F0\u660E\u6280\u672F\u96C6\u6210\u5143\u6570\u636E\u3002",packages:Object.freeze((s?.integration?.packages??[]).map(l=>{let f=e.dependencies?.[l.packageName]??e.hostDependencies?.[l.packageName]??null,p=e.dependencies?.[l.packageName]===void 0&&e.hostDependencies?.[l.packageName]!==void 0;return Object.freeze({...l,imports:Object.freeze(l.imports.map(u=>Object.freeze({...u}))),installedVersion:f,state:p?"provided-by-platform":f===null?"missing":f===l.version||l.version==="workspace:*"?"matched":zo(f)==="workspace"?"local-workspace":"version-mismatch"})})),codeAssets:Object.freeze((s?.integration?.codeAssets??[]).map(l=>Object.freeze({...l}))),evidenceIds:Object.freeze([...c?.evidenceIds??[]])})}),i=new Set(n.flatMap(a=>a.packages.filter(o=>o.state==="matched"||o.state==="local-workspace").map(o=>o.packageName)));return Object.freeze({...e.projection,platformDependencies:Object.freeze(e.projection.platformDependencies.filter(a=>!i.has(a.packageName))),details:Object.freeze(n),findings:Object.freeze(n.flatMap(a=>a.packages.filter(o=>o.state!=="matched"&&o.state!=="provided-by-platform").map(o=>({code:o.state==="missing"?"INTEGRATION_PACKAGE_MISSING":o.state==="local-workspace"?"INTEGRATION_PACKAGE_SOURCE_LOCAL":"INTEGRATION_PACKAGE_VERSION_MISMATCH",capabilityId:a.capabilityId,packageName:o.packageName,expected:o.version,actual:o.installedVersion}))))})}var zt=class extends Error{code;constructor(t,r){super(r),this.code=t}};function sy(e){if(e===null||typeof e!="object")throw new zt("PROJECT_PROCESS_IDENTITY_MISMATCH","Managed process snapshot is invalid");let t=e;if(t.schemaVersion!==1||typeof t.processId!="string"||t.processId.length<1||typeof t.projectRoot!="string"||t.command!=="dev"||!Number.isSafeInteger(t.pid)||t.pid<1||typeof t.startedAt!="string"||Number.isNaN(Date.parse(t.startedAt))||typeof t.logPath!="string"||t.logOffset!==void 0&&(!Number.isSafeInteger(t.logOffset)||t.logOffset<0))throw new zt("PROJECT_PROCESS_IDENTITY_MISMATCH","Managed process snapshot is invalid");return Object.freeze(t)}function cy(e){let t=e.manifest,r=Array.isArray(t?.capabilities)?t.capabilities.filter(s=>s!==null&&typeof s=="object"&&typeof s.capabilityId=="string"&&typeof s.version=="string").map(s=>Object.freeze({capabilityId:s.capabilityId,version:s.version})):[],n=e.lock,i=Array.isArray(n?.capabilities)?n.capabilities.filter(s=>s!==null&&typeof s=="object"&&typeof s.capabilityId=="string"&&typeof s.version=="string").map(s=>Object.freeze({capabilityId:s.capabilityId,version:s.version,...Array.isArray(s.evidenceIds)?{evidenceIds:Object.freeze([...s.evidenceIds])}:{}})):[],a=Object.entries(e.dependencies??{}).filter(([s])=>s.startsWith("@aipt/")).sort(([s],[c])=>s.localeCompare(c)).map(([s,c])=>Object.freeze({packageName:s,version:c,state:"unmanaged",source:zo(c)})),o=t?.template!==void 0&&typeof t.template.id=="string"&&typeof t.template.version=="string"?Object.freeze({id:t.template.id,version:t.template.version}):null;return Object.freeze({template:o,declared:Object.freeze(r),locked:Object.freeze(i),verified:Object.freeze(i.filter(s=>(s.evidenceIds?.length??0)>0)),platformDependencies:Object.freeze(a)})}var nt=class extends Error{code;constructor(t){super(t),this.code=t}},uO=/^@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$/u,dy=/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/u,hO=/^sha512-[A-Za-z0-9+/]{86}==$/u,qo=/^sha256:[a-f0-9]{64}$/u,mO=/^[a-z0-9][a-z0-9._-]{1,214}\.tgz$/u,gO=/^(?:workspace:|file:|link:|git(?:\+|:)|https?:|ssh:|github:)/u,yO=new Set(["preinstall","install","postinstall","prepublish","prepare"]);function qr(e,t){let r=Object.keys(e).sort(),n=[...t].sort();return r.length===n.length&&r.every((i,a)=>i===n[a])}function wO(e){if(!qr(e,["packageName","version","assetName","integrity","tarballDigest","dependencies","lifecycleScripts"])||!uO.test(e.packageName)||!dy.test(e.version)||!mO.test(e.assetName)||!hO.test(e.integrity)||!qo.test(e.tarballDigest)||typeof e.dependencies!="object"||e.dependencies===null||Array.isArray(e.dependencies)||e.lifecycleScripts.length>0)return!1;let t=Object.entries(e.dependencies);return t.length>256||t.some(([r,n])=>!/^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u.test(r)||!dy.test(n)||gO.test(n))?!1:e.lifecycleScripts.every(r=>yO.has(r))}function Al(e){if(!qr(e,["artifacts"])||e.artifacts.length===0||e.artifacts.length>128)throw new nt("LOCAL_ARTIFACT_BUNDLE_INVALID");let t=e.artifacts.map(a=>Object.freeze({...a,dependencies:Object.freeze({...a.dependencies}),lifecycleScripts:Object.freeze([...a.lifecycleScripts])}));if(t.some(a=>!wO(a)))throw new nt("LOCAL_ARTIFACT_POLICY_VIOLATION");let r=t.map(a=>a.packageName+"@"+a.version);if(new Set(r).size!==r.length||r.some((a,o)=>o>0&&a.localeCompare(r[o-1])<=0))throw new nt("LOCAL_ARTIFACT_BUNDLE_INVALID");let n=new Set(t.map(a=>a.packageName));for(let a of t)for(let[o,s]of Object.entries(a.dependencies))if(o.startsWith("@aipt/")&&(!n.has(o)||!t.some(c=>c.packageName===o&&c.version===s)))throw new nt("LOCAL_ARTIFACT_POLICY_VIOLATION");let i={schemaVersion:1,channel:"development",artifacts:t};return Object.freeze({...i,bundleId:A(C(i))})}function Rl(e){let t=e;if(typeof t!="object"||t===null||!qr(t,["schemaVersion","bundleId","channel","artifacts"])||t.schemaVersion!==1||t.channel!=="development"||!qo.test(t.bundleId)||!Array.isArray(t.artifacts))throw new nt("LOCAL_ARTIFACT_BUNDLE_INVALID");if(Al({artifacts:t.artifacts}).bundleId!==t.bundleId)throw new nt("LOCAL_ARTIFACT_BUNDLE_INVALID");return t}function kl(e){if(!qr(e,["packageInputs","bundle","generatedAt","expiresAt"])||e.packageInputs.length!==e.bundle.artifacts.length||e.packageInputs.length===0||Number.isNaN(Date.parse(e.generatedAt))||Number.isNaN(Date.parse(e.expiresAt))||Date.parse(e.expiresAt)<=Date.parse(e.generatedAt))throw new nt("LOCAL_ARTIFACT_PLAN_INVALID");let t=e.packageInputs.map(i=>Object.freeze({...i}));if(t.some(i=>!qr(i,["relativeRoot","manifestDigest"])||!/^(?:packages|fixtures)\/[a-z0-9][a-z0-9._-]{1,127}$/u.test(i.relativeRoot)||!qo.test(i.manifestDigest))||new Set(t.map(i=>i.relativeRoot)).size!==t.length)throw new nt("LOCAL_ARTIFACT_PLAN_INVALID");let r=Rl(e.bundle),n={schemaVersion:1,state:"awaiting-approval",packageInputs:t,bundle:r,targetPreimage:{kind:"absent"},generatedAt:e.generatedAt,expiresAt:e.expiresAt};return Object.freeze({...n,planId:A(C(n))})}function ly(e){let t=e;if(typeof t!="object"||t===null||!qr(t,["schemaVersion","planId","state","packageInputs","bundle","targetPreimage","generatedAt","expiresAt"])||t.schemaVersion!==1||t.state!=="awaiting-approval"||!qo.test(t.planId)||!qr(t.targetPreimage,["kind"])||t.targetPreimage.kind!=="absent")throw new nt("LOCAL_ARTIFACT_PLAN_INVALID");if(kl({packageInputs:t.packageInputs,bundle:t.bundle,generatedAt:t.generatedAt,expiresAt:t.expiresAt}).planId!==t.planId)throw new nt("LOCAL_ARTIFACT_PLAN_INVALID");return t}var Xi={DEPENDENCIES_NOT_INSTALLED:4,VERIFIER_RUNTIME_INVALID:4},_O=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/u;function fy(e,t){return typeof e=="string"&&e.length>0&&e.length<=t&&!_O.test(e)}function IO(e){let t={schemaVersion:1,kind:"dyyto-cli-domain-error",code:e.code,message:e.message,exitCode:Xi[e.code],...e.nextStep===void 0?{}:{nextStep:e.nextStep}},r=vO(t);if(r===null)throw new TypeError("CLI domain error input is invalid");return r}function vO(e){try{if(typeof e!="object"||e===null||Object.getPrototypeOf(e)!==Object.prototype)return null;let t=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(t).some(s=>typeof s=="symbol"))return null;let r=Object.keys(t).sort(),n="nextStep"in t?["code","exitCode","kind","message","nextStep","schemaVersion"]:["code","exitCode","kind","message","schemaVersion"];if(r.length!==n.length||r.some((s,c)=>s!==n[c])||Object.values(t).some(s=>!("value"in s)))return null;let i=s=>t[s]?.value,a=i("code");if(i("schemaVersion")!==1||i("kind")!=="dyyto-cli-domain-error"||typeof a!="string"||!(a in Xi)||i("exitCode")!==Xi[a]||!fy(i("message"),500))return null;let o=i("nextStep");return o!==void 0&&!fy(o,500)?null:Object.freeze({schemaVersion:1,kind:"dyyto-cli-domain-error",code:a,message:i("message"),exitCode:4,...o===void 0?{}:{nextStep:o}})}catch{return null}}var On=class extends Error{code;exitCode;nextStep;domainError;constructor(t){super(t.message),this.name="CliError",this.code=t.code,this.exitCode=t.exitCode,this.nextStep=t.nextStep,this.domainError=t.code in Xi&&t.exitCode===Xi[t.code]?IO({code:t.code,message:t.message,...t.nextStep===void 0?{}:{nextStep:t.nextStep}}):void 0}};var Rt=64*1024;function py(e,t,r){return new Promise((n,i)=>{let a=new Date().toISOString(),o={...At.env,CI:"1",NO_COLOR:"1",pnpm_config_verify_deps_before_run:"false"};delete o.npm_config_user_agent;let s=uy(e,t,{cwd:r,env:o,stdio:["ignore","pipe","pipe"]}),c=[],d=[];s.stdout.on("data",l=>c.push(Buffer.from(l))),s.stderr.on("data",l=>d.push(Buffer.from(l))),s.on("error",i),s.on("close",l=>n({exitCode:l??1,startedAt:a,completedAt:new Date().toISOString(),stdout:Buffer.concat(c).subarray(0,Rt),stderr:Buffer.concat(d).subarray(0,Rt)}))})}async function hy(){return new Promise((e,t)=>{let r=EO();r.once("error",t),r.listen(0,"127.0.0.1",()=>{let n=r.address();if(n===null||typeof n=="string")return t(new Error("Unable to allocate preview port"));r.close(i=>i===void 0?e(n.port):t(i))})})}async function AO(e,t){let r=new Date().toISOString(),n=await hy(),i=[],a=[],o;try{let s=me.resolve(me.dirname(e),"../dist/node/index.js"),d=await(await import(bO(s).href)).preview({root:t,logLevel:"silent",preview:{host:"127.0.0.1",port:n,strictPort:!0}});o=()=>d.close();let l=await fetch(`http://127.0.0.1:${n}/`);if(!l.ok)throw new Error("Production preview did not become ready");let f=await l.text(),p=f.match(/<script[^>]+src="([^"]+)"/)?.[1];if(!f.includes('<html lang="zh-CN">')||!f.includes("data-application-shell")||p===void 0)throw new Error("Production HTML contract is missing");let u=await fetch(new URL(p,`http://127.0.0.1:${n}/`));if(!u.ok||(await u.text()).length===0)throw new Error("Production entry asset is unavailable");return i.push(Buffer.from(JSON.stringify({smoke:"passed",transport:"http-preview"}))),{exitCode:0,startedAt:r,completedAt:new Date().toISOString(),stdout:Buffer.concat(i).subarray(0,Rt),stderr:Buffer.concat(a).subarray(0,Rt)}}catch(s){return a.push(Buffer.from(s instanceof Error?s.message:"Web application smoke failed")),{exitCode:1,startedAt:r,completedAt:new Date().toISOString(),stdout:Buffer.concat(i).subarray(0,Rt),stderr:Buffer.concat(a).subarray(0,Rt)}}finally{await o?.()}}async function RO(e){let t=new Date().toISOString(),r=await hy(),n=[],i=[],a=[me.join(e,".artifacts","standalone","server.js"),me.join(e,".next","standalone","server.js"),me.join(e,".next","standalone","apps",me.basename(e),"server.js")],o=(await Promise.all(a.map(async c=>await Qi(c).then(d=>d.isFile()?c:null).catch(()=>null)))).find(c=>c!==null);if(o===void 0)return{exitCode:1,startedAt:t,completedAt:new Date().toISOString(),stdout:Buffer.alloc(0),stderr:Buffer.from("Standalone server entry is unavailable")};let s=uy(At.execPath,[o],{cwd:me.dirname(o),env:{...At.env,CI:"1",NO_COLOR:"1",HOSTNAME:"127.0.0.1",PORT:String(r)},stdio:["ignore","pipe","pipe"]});s.stdout.on("data",c=>n.push(Buffer.from(c))),s.stderr.on("data",c=>i.push(Buffer.from(c))),s.on("error",c=>i.push(Buffer.from(c.message)));try{let c=Date.now()+3e4,d;for(;Date.now()<c;){if(s.exitCode!==null)throw new Error("Standalone server exited before readiness");try{if(d=await fetch(`http://127.0.0.1:${r}/api/health`),d.ok)break}catch{}await new Promise(u=>setTimeout(u,150))}let l=d===void 0?null:await d.json().catch(()=>null);if(d===void 0||!d.ok||l?.status!=="ok")throw new Error("Standalone health contract failed");let f=await fetch(`http://127.0.0.1:${r}/`),p=await f.text();if(!f.ok||!p.includes('lang="zh-CN"'))throw new Error("Standalone page contract failed");return n.push(Buffer.from(JSON.stringify({smoke:"passed",transport:"next-standalone"}))),{exitCode:0,startedAt:t,completedAt:new Date().toISOString(),stdout:Buffer.concat(n).subarray(0,Rt),stderr:Buffer.concat(i).subarray(0,Rt)}}catch(c){return i.push(Buffer.from(c instanceof Error?c.message:"Next.js standalone smoke failed")),{exitCode:1,startedAt:t,completedAt:new Date().toISOString(),stdout:Buffer.concat(n).subarray(0,Rt),stderr:Buffer.concat(i).subarray(0,Rt)}}finally{s.exitCode===null&&(s.kill("SIGTERM"),await new Promise(c=>s.once("close",()=>c())))}}async function Go(e){let t=await Qi(e).catch(()=>null);if(t===null||!t.isFile()&&!t.isSymbolicLink())throw new On({code:"DEPENDENCIES_NOT_INSTALLED",message:"\u9879\u76EE\u4F9D\u8D56\u5C1A\u672A\u5B89\u88C5\u3002",exitCode:4,nextStep:"\u8BF7\u5728\u9879\u76EE\u76EE\u5F55\u8FD0\u884C corepack pnpm install\uFF0C\u7136\u540E\u518D\u6B21\u8FD0\u884C dyyto verify\u3002"})}async function kO(e){let t=me.join(e.projectRoot,"node_modules","typescript","bin","tsc"),r=me.join(e.projectRoot,"node_modules","vitest","vitest.mjs"),n=me.join(e.projectRoot,"node_modules","vite","bin","vite.js"),i=me.join(e.projectRoot,"node_modules","next","dist","bin","next"),a=e.release.release.verifiers.some(({id:p})=>p!=="workspace.structure"&&p!=="capability.assets"&&p!=="application.config-contract");a&&(await Go(t),await Go(r),(e.release.release.consumerProfile==="workspace-web-application"||e.release.release.consumerProfile==="react-component-library")&&await Go(n),e.release.release.consumerProfile==="nextjs-full-stack-application"&&await Go(i));let o=JSON.parse(await Dn(me.join(e.projectRoot,"package.json"),"utf8")),s=a?await py(At.execPath,[t,"--version"],e.projectRoot):null;if(s!==null&&s.exitCode!==0)throw new On({code:"VERIFIER_RUNTIME_INVALID",message:"\u5DF2\u5B89\u88C5\u7684 TypeScript \u9A8C\u8BC1\u5668\u65E0\u6CD5\u62A5\u544A\u7248\u672C\u3002",exitCode:4,nextStep:"\u8BF7\u68C0\u67E5\u9879\u76EE\u4F9D\u8D56\u5B8C\u6574\u6027\uFF0C\u91CD\u65B0\u5B89\u88C5\u540E\u518D\u6B21\u8FD0\u884C dyyto verify\u3002"});let c={node:At.version.replace(/^v/,""),pnpm:String(o.packageManager).replace(/^pnpm@/,""),typescript:s===null?e.release.release.compatibility.typescript:s.stdout.toString("utf8").replace(/^Version\s+/,"").trim()},d=await xo({projectRoot:e.projectRoot,expectedAssets:e.expectedAssets}),l={"typescript.typecheck":{executable:At.execPath,args:[t,"--noEmit","-p","tsconfig.json"]},"vitest.run":{executable:At.execPath,args:[r,"run","--testTimeout","15000"]},"typescript.build":{executable:At.execPath,args:[t,"-p","tsconfig.build.json"]},"npm.pack-dry-run":{executable:"npm",args:["pack","--dry-run","--json","--ignore-scripts"]},"workspace.structure":null,"capability.assets":null,"node.application-smoke":{executable:At.execPath,args:[me.join(e.projectRoot,"dist","index.js"),"--smoke"]},"web.application-build":{executable:"corepack",args:["pnpm","run","build"]},"web.application-smoke":null,"expo.application-config":{executable:"corepack",args:["pnpm","exec","expo","config","--type","public"]},"expo.application-export":{executable:"corepack",args:["pnpm","run","package"]},"react.library-build":{executable:"corepack",args:["pnpm","run","verify:bundle"]},"next.application-test":{executable:"corepack",args:["pnpm","run","test"]},"next.application-build":{executable:"corepack",args:["pnpm","run","build"]},"next.application-package":{executable:"corepack",args:["pnpm","run","package"]},"next.application-smoke":null,"application.config-contract":null},f=[];for(let p of e.release.release.verifiers){let u=l[p.id],h=new Date().toISOString(),m=p.id==="application.config-contract"?await Promise.all([Dn(me.join(e.projectRoot,"config","application-config.json"),"utf8"),Dn(me.join(e.projectRoot,"project-capabilities.json"),"utf8")]).then(([g,y])=>{try{return vl(JSON.parse(g),JSON.parse(y)),{exitCode:0,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.from("Application ConfigContract \u4E0E Project Manifest \u4E00\u81F4"),stderr:Buffer.alloc(0)}}catch(_){return{exitCode:1,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.alloc(0),stderr:Buffer.from(_ instanceof Error?_.message:"Application ConfigContract \u6821\u9A8C\u5931\u8D25")}}}).catch(g=>({exitCode:1,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.alloc(0),stderr:Buffer.from(g instanceof Error?g.message:"Application ConfigContract \u4E0D\u53EF\u7528")})):p.id==="web.application-smoke"?await AO(n,e.projectRoot):p.id==="next.application-smoke"?await RO(e.projectRoot):p.id==="workspace.structure"?await Dn(me.join(e.projectRoot,"package.json"),"utf8").then(async g=>{if(e.release.release.assets.find(({path:S})=>S==="package.json")?.ownership==="seed-file"){let S=e.expectedAssets.find(({path:R})=>R==="package.json");if(S!==void 0){let R=S.ownership==="seed-file"&&S.digest===A(g);return{exitCode:R?0:1,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.from(R?"Workspace seed Manifest \u4E0E\u6279\u51C6 Plan \u4E00\u81F4":""),stderr:Buffer.from(R?"":"Workspace seed Manifest \u4E0E\u6279\u51C6 Plan \u4E0D\u4E00\u81F4")}}try{let R=me.join(e.projectRoot,"pnpm-workspace.yaml"),[P,x,B]=await Promise.all([Qi(me.join(e.projectRoot,"package.json")),Qi(R),Dn(R,"utf8")]),k=JSON.parse(g),he=P.isFile()&&!P.isSymbolicLink()&&x.isFile()&&!x.isSymbolicLink()&&typeof k=="object"&&k!==null&&!Array.isArray(k)&&k.private===!0&&/^\s*packages\s*:/mu.test(B);return{exitCode:he?0:1,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.from(he?"Retrofit Workspace \u7ED3\u6784\u6709\u6548":""),stderr:Buffer.from(he?"":"Retrofit Workspace \u7ED3\u6784\u65E0\u6548")}}catch{return{exitCode:1,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.alloc(0),stderr:Buffer.from("Retrofit Workspace \u7ED3\u6784\u65E0\u6548")}}}let _=JSON.parse(g).scripts??{},b=e.release.contents.get("package.json"),E=b===void 0?{}:JSON.parse(Buffer.from(b).toString("utf8")).scripts??{},I=Object.entries(E).filter(([S,R])=>typeof R!="string"||_[S]!==R).map(([S])=>S);return{exitCode:I.length===0?0:1,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.from(I.length===0?"workspace release scripts matched":""),stderr:Buffer.from(I.length===0?"":`workspace release scripts mismatched: ${I.join(",")}`)}}):u===null?{exitCode:0,startedAt:h,completedAt:h,stdout:Buffer.from("capability assets matched"),stderr:Buffer.alloc(0)}:await py(u.executable,[...u.args],e.projectRoot);f.push({schemaVersion:1,verifierId:p.id,result:m.exitCode===0?"passed":"failed",issuer:"dyyto-cli",commandId:p.id,exitCode:m.exitCode,stdoutDigest:A(m.stdout),stderrDigest:A(m.stderr),startedAt:m.startedAt,completedAt:m.completedAt,projectStateDigest:d.projectStateDigest,runtime:c})}return{results:f,summaries:f.map(({verifierId:p,result:u})=>({verifierId:p,result:u}))}}async function SO(e){for(let o of e.removedPaths)if(await Qi(me.join(e.projectRoot,...o.split("/"))).then(()=>!0).catch(s=>s.code==="ENOENT"?!1:Promise.reject(s)))throw new On({code:"VERIFICATION_STATE_INVALID",message:"\u5F85\u79FB\u9664\u8D44\u4EA7\u4ECD\u7136\u5B58\u5728\u3002",exitCode:4,nextStep:"\u8FD0\u884C dyyto inspect \u68C0\u67E5\u9879\u76EE\u6F02\u79FB\u3002"});let t=await xo({projectRoot:e.projectRoot,expectedAssets:e.remainingAssets}),r=JSON.parse(await Dn(me.join(e.projectRoot,"package.json"),"utf8")),n={node:At.version.replace(/^v/,""),pnpm:String(r.packageManager).replace(/^pnpm@/,""),typescript:e.release.release.compatibility.typescript},i=new Date().toISOString(),a=e.release.release.verifiers.map(o=>({schemaVersion:1,verifierId:o.id,result:"passed",issuer:"dyyto-cli",commandId:o.id,exitCode:0,stdoutDigest:A(Buffer.from("removal absence verified")),stderrDigest:A(Buffer.alloc(0)),startedAt:i,completedAt:i,projectStateDigest:t.projectStateDigest,runtime:n}));return{results:a,summaries:a.map(o=>({verifierId:o.verifierId,result:o.result}))}}import{execFile as Tj}from"node:child_process";import{mkdtemp as Hs,mkdir as jj,lstat as Lj,readFile as Va,readdir as aE,realpath as Js,rm as Ys,writeFile as Kp}from"node:fs/promises";import{tmpdir as Zs}from"node:os";import de from"node:path";import{promisify as $j}from"node:util";var Mj=$j(Tj),Je="https://registry.npmjs.org",Ma="node:24.18.0-alpine",_t=class extends Error{constructor(r,n,i){super("Delivery command failed");this.executable=r;this.code=n;this.stderrText=i}executable;code;stderrText};function Vj(e,t=process.env){let r=["PATH","TMPDIR","TEMP","TMP","COREPACK_HOME","CI","GITHUB_ACTIONS","GITHUB_REPOSITORY","GITHUB_WORKFLOW","GITHUB_WORKFLOW_REF","GITHUB_REF","GITHUB_ENVIRONMENT","RUNNER_ENVIRONMENT","ACTIONS_ID_TOKEN_REQUEST_URL","ACTIONS_ID_TOKEN_REQUEST_TOKEN","GITLAB_CI","CI_SERVER_HOST","CI_PROJECT_PATH","CI_CONFIG_PATH","CI_COMMIT_REF_NAME","CI_ENVIRONMENT_NAME","NPM_ID_TOKEN"],n={HOME:e,NO_COLOR:"1",NPM_CONFIG_USERCONFIG:de.join(e,".npmrc"),NPM_CONFIG_REGISTRY:Je,NPM_CONFIG_PROVENANCE:"true",pnpm_config_verify_deps_before_run:"false"};for(let i of r)t[i]!==void 0&&(n[i]=t[i]);return n}var oE={async run(e,t,r){let n=await Hs(de.join(await Js(Zs()),"dyyto-command-home-"));try{let i=de.join(n,".npmrc");await Kp(i,`registry=https://registry.npmjs.org
|
|
13
|
+
`}];for(let i of e.project.routes)i.path!==r&&n.push({path:`${i.path.slice(1)}/index.html`,content:Gv(e,i.path,t)});return n}var mj,lq,Wv=$e(()=>{"use strict";Ln();Cy();Mp();mj=rr(Lp(),1),lq=new TextEncoder});var Fp={};cc(Fp,{handleHostedRequest:()=>kj,planHostedCsr:()=>bj,publishHostedCsr:()=>Aj});import{createHash as wj}from"node:crypto";function Tt(e){throw new kt(e)}function Up(e){return`sha256:${wj("sha256").update(e).digest("hex")}`}function Ij(e){return`objects/${e.slice(7)}`}function vj(e){return e.endsWith(".html")?"text/html; charset=utf-8":e.endsWith(".css")?"text/css; charset=utf-8":e.endsWith(".js")?"text/javascript; charset=utf-8":"application/json"}function Ej(e,t){let r=e;for(let[n,i]of[...t.entries()].sort((a,o)=>o[0].length-a[0].length))r=r.replaceAll(new RegExp(`(?:(?:\\.\\./)*)?${n.replaceAll(".","\\.")}`,"g"),i);return r}function Ks(e){return{"x-dyyto-render-mode":"csr",...e}}function $a(e,t,r="text/plain; charset=utf-8"){return Object.freeze({status:e,headers:Ks({"content-type":r}),body:Gs.encode(t)})}function Hv(e){e.project.renderMode!=="csr"&&Tt("PAGE_PUBLISH_MODE_MISMATCH");let t=Kv(e,"hosted"),r=t.find(l=>l.path==="styles.css"),n=t.find(l=>l.path==="runtime/app.js");(r===void 0||n===void 0)&&Tt("PAGE_BUNDLE_INVALID");let i=Up(Gs.encode(r.content)),a=Up(Gs.encode(n.content)),o=new Map([["styles.css",`/_assets/${i.slice(7)}`],["runtime/app.js",`/_assets/${a.slice(7)}`]]),s=t.map(l=>l.path.endsWith(".html")?{path:l.path,content:Ej(l.content,o)}:l);return{bundle:$p({artifactReleaseId:e.digest,profile:"hosted_web",rendererReleaseId:"@aipt/page-renderer@0.1.0",runtimeReleaseIds:["@aipt/page-host-gateway@0.1.0"],files:s.map(l=>({path:l.path,mime:vj(l.path),bytes:Gs.encode(l.content)}))}),cssDigest:i,scriptDigest:a}}function bj(e){return{bundleDigest:Hv(e).bundle.digest}}async function Aj(e,t){let{bundle:r,cssDigest:n,scriptDigest:i}=Hv(e),a=[];for(let d of r.files){d.path==="current.json"&&Tt("PAGE_BUNDLE_INVALID");let f=d.sha256,p=Ij(f);await t.putImmutable({objectKey:p,bytes:d.bytes,mimeType:d.mime,sha256:f});let u=await t.read(p);(u===void 0||Up(u.bytes)!==f)&&Tt("PAGE_BUNDLE_INVALID"),a.push({path:d.path,objectKey:p,digest:f})}let o=a.map(d=>d.objectKey);(o.includes("current.json")||o.some(d=>d.endsWith("/current.json")))&&Tt("PAGE_BUNDLE_INVALID");let s=d=>{let f=a.find(p=>p.path===d);return f===void 0&&Tt("PAGE_BUNDLE_INVALID"),f},c=e.project.routes.map(d=>{let f=d.path===e.project.defaultPath?"index.html":`${d.path.slice(1)}/index.html`;return{path:d.path,objectKey:s(f).objectKey}}),l={renderMode:"csr",currentDigest:r.digest,defaultPath:e.project.defaultPath,routes:c,assets:[{path:`/_assets/${n.slice(7)}`,objectKey:s("styles.css").objectKey},{path:`/_assets/${i.slice(7)}`,objectKey:s("runtime/app.js").objectKey}]};return Object.freeze({pointer:Object.freeze(l),bundleDigest:r.digest,objectKeys:Object.freeze(o)})}function Rj(e){let t=e.split("?")[0]??e;return(t.length===0||t.includes("\\")||t.split("/").includes(".."))&&Tt("PAGE_BUNDLE_INVALID"),t===""?"/":t}async function kj(e,t){(t.pointer.renderMode!=="csr"||t.document.project.renderMode!=="csr")&&Tt("PAGE_PUBLISH_MODE_MISMATCH");let r=Rj(e.path),n=t.pointer.assets.find(s=>s.path===r);if(n!==void 0){if(e.method!=="GET")return $a(405,"PAGE_BUNDLE_INVALID");let s=await t.store.read(n.objectKey);return s===void 0?$a(404,"PAGE_BUNDLE_INVALID"):Object.freeze({status:200,headers:Ks({"content-type":s.mimeType}),body:s.bytes})}if(r.startsWith("/api/")){let s=t.document.project.dataProxy.find(l=>l.publicPath===r);s===void 0&&Tt("PAGE_GATEWAY_PORT_DENIED");let c=await t.invokePort({portId:s.portId,method:e.method,path:r});return Object.freeze({status:c.status,headers:Ks({...c.headers}),body:c.body})}if(e.method!=="GET")return $a(405,"PAGE_BUNDLE_INVALID");let i=t.pointer.routes.find(s=>s.path===r)??t.pointer.routes.find(s=>s.path===t.pointer.defaultPath);if(i===void 0)return $a(404,"PAGE_ROUTE_UNKNOWN");let a=await t.store.read(i.objectKey);if(a===void 0)return $a(404,"PAGE_BUNDLE_INVALID");let o=_j.decode(a.bytes);return o.includes("SSR")&&!o.includes("\u4E0D\u662F SSR")&&Tt("PAGE_PUBLISH_MODE_MISMATCH"),Object.freeze({status:200,headers:Ks({"content-type":a.mimeType}),body:a.bytes})}var Gs,_j,zp=$e(()=>{"use strict";Wv();Ln();Mp();Gs=new TextEncoder,_j=new TextDecoder});var Xv={};cc(Xv,{ObjectStoreError:()=>Le,createHttpTemporaryObjectDownloader:()=>Cj,filesystemObjectStore:()=>Oj,ingestTemporaryObject:()=>xj});import{createHash as Zv}from"node:crypto";import{mkdir as Sj,readFile as Ws,writeFile as Jv}from"node:fs/promises";import{dirname as Nj,join as Pj}from"node:path";function Oj(e){if(!e.trim())throw new Error("OBJECT_STORE_DIRECTORY_INVALID");let t=r=>{if(!r||r.startsWith("/")||r.split("/").includes(".."))throw new Error("OBJECT_KEY_INVALID");return Pj(e,r)};return{async putImmutable(r){let n=t(r.objectKey);await Sj(Nj(n),{recursive:!0});try{await Jv(n,r.bytes,{flag:"wx",mode:384})}catch(i){if(i.code!=="EEXIST")throw i;let a=new Uint8Array(await Ws(n));if(`sha256:${Zv("sha256").update(a).digest("hex")}`!==r.sha256)throw new Error("OBJECT_IMMUTABILITY_CONFLICT")}try{await Jv(`${n}.metadata.json`,`${JSON.stringify({mimeType:r.mimeType,sha256:r.sha256})}
|
|
14
|
+
`,{flag:"wx",mode:384})}catch(i){if(i.code!=="EEXIST")throw i;let a=JSON.parse(await Ws(`${n}.metadata.json`,"utf8"));if(a.mimeType!==r.mimeType||a.sha256!==r.sha256)throw new Error("OBJECT_IMMUTABILITY_CONFLICT")}},async read(r){try{let n=t(r),[i,a]=await Promise.all([Ws(n),Ws(`${n}.metadata.json`,"utf8").then(o=>JSON.parse(o))]);return{bytes:new Uint8Array(i),mimeType:a.mimeType}}catch(n){if(n.code==="ENOENT")return;throw n}}}}function Dj(e,t){return t==="image/png"?e.length>=8&&[137,80,78,71,13,10,26,10].every((r,n)=>e[n]===r):t==="image/jpeg"?e[0]===255&&e[1]===216:t==="audio/mpeg"?e.length>=3&&(e[0]===73&&e[1]===68&&e[2]===51||e[0]===255&&(e[1]&224)===224):t==="video/mp4"?e.length>=12&&new TextDecoder().decode(e.slice(4,8))==="ftyp":!1}function Cj(e){let t=new Set(e.allowedHosts.map(n=>n.toLowerCase())),r=e.maximumRedirects??3;return{async download(n){let i=new URL(n.url);for(let a=0;a<=r;a+=1){if(i.protocol!=="https:"||!t.has(i.hostname.toLowerCase())||i.username||i.password)throw new Le("TEMPORARY_OBJECT_INVALID");let o=await fetch(i,{redirect:"manual",...n.signal?{signal:n.signal}:{}});if(o.status>=300&&o.status<400){let h=o.headers.get("location");if(!h||a===r)throw new Le("TEMPORARY_OBJECT_INVALID");i=new URL(h,i);continue}if(!o.ok||!o.body)throw new Le("TEMPORARY_OBJECT_INVALID");let s=o.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase()??"";if(!n.allowedMimeTypes.includes(s))throw new Le("OBJECT_MIME_INVALID");if(Number(o.headers.get("content-length")??0)>n.maximumBytes)throw new Le("OBJECT_TOO_LARGE");let l=o.body.getReader(),d=[],f=0;for(;;){let h=await l.read();if(h.done)break;if(f+=h.value.byteLength,f>n.maximumBytes)throw await l.cancel(),new Le("OBJECT_TOO_LARGE");d.push(h.value)}let p=new Uint8Array(f),u=0;for(let h of d)p.set(h,u),u+=h.byteLength;if(!Dj(p,s))throw new Le("TEMPORARY_OBJECT_INVALID");return{bytes:p,mimeType:s}}throw new Le("TEMPORARY_OBJECT_INVALID")}}}async function xj(e){if(!/^https:\/\//u.test(e.url)||!e.objectKeyPrefix.trim()||e.maximumBytes<=0)throw new Le("TEMPORARY_OBJECT_INVALID");let t=await e.downloader.download({url:e.url,maximumBytes:e.maximumBytes,allowedMimeTypes:e.allowedMimeTypes,...e.signal?{signal:e.signal}:{}});if(t.bytes.byteLength>e.maximumBytes)throw new Le("OBJECT_TOO_LARGE");if(!e.allowedMimeTypes.includes(t.mimeType))throw new Le("OBJECT_MIME_INVALID");let r=Yv(t.bytes),n=`${e.objectKeyPrefix.replace(/\/$/u,"")}/${r.slice(7)}`;await e.store.putImmutable({objectKey:n,bytes:t.bytes,mimeType:t.mimeType,sha256:r});let i=await e.store.read(n);if(!i||i.mimeType!==t.mimeType||Yv(i.bytes)!==r)throw new Le("OBJECT_READBACK_FAILED");let a=Object.freeze({objectKey:n,mimeType:t.mimeType,byteLength:t.bytes.byteLength,sha256:r});return await e.commitMetadata(a),a}var Le,Yv,Qv=$e(()=>{"use strict";Le=class extends Error{code;constructor(t,r){super(t,r),this.code=t,this.name="ObjectStoreError"}};Yv=e=>`sha256:${Zv("sha256").update(e).digest("hex")}`});import{spawn as uy}from"node:child_process";import{lstat as Qi,readFile as Dn}from"node:fs/promises";import{createServer as EO}from"node:net";import me from"node:path";import At from"node:process";import{pathToFileURL as bO}from"node:url";var Y="^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$",It="^sha256:[a-f0-9]{64}$";var dg=rr(Vr(),1);var be={type:"string",pattern:It},RN={type:"string",pattern:"^[a-z][a-z0-9.-]{2,127}$"},ld={type:"string",format:"date-time"},dd={enum:["typescript.typecheck","vitest.run","typescript.build","npm.pack-dry-run","workspace.structure","capability.assets","node.application-smoke","web.application-build","web.application-smoke","expo.application-config","expo.application-export","react.library-build","next.application-test","next.application-build","next.application-package","next.application-smoke","application.config-contract"]},fg={type:"object",additionalProperties:!1,required:["node","pnpm","typescript"],properties:{node:{type:"string",minLength:1,maxLength:64},pnpm:{type:"string",minLength:1,maxLength:64},typescript:{type:"string",minLength:1,maxLength:64}}},fd={$id:"https://schemas.dyyto.dev/platform/capability-bundle-release-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","capabilityId","version","integrity","consumerProfile","compatibility","assets","verifiers","exit"],properties:{schemaVersion:{const:1},capabilityId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128},integrity:be,consumerProfile:{enum:["blank-typescript-library","standalone-npm-package","react-component-library","nextjs-full-stack-application","workspace-root","workspace-npm-package","workspace-node-application","workspace-web-application","workspace-expo-application","any-project"]},kind:{enum:["profile","engineering-feature","integration-feature","domain-extension"]},dependencies:{type:"object",additionalProperties:!1,required:["profiles"],properties:{profiles:{type:"array",minItems:1,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:128}},capabilities:{type:"array",minItems:1,uniqueItems:!0,items:{type:"string",pattern:Y}}}},compatibility:fg,integration:{type:"object",additionalProperties:!1,required:["title","purpose","packages","codeAssets"],properties:{title:{type:"string",minLength:1,maxLength:128},purpose:{type:"string",minLength:1,maxLength:512},packages:{type:"array",items:{type:"object",additionalProperties:!1,required:["packageName","version","usage","imports"],properties:{packageName:{type:"string",minLength:1,maxLength:214},version:{type:"string",minLength:1,maxLength:128},usage:{enum:["runtime","development","build","test"]},imports:{type:"array",items:{type:"object",additionalProperties:!1,required:["importFrom","symbol"],properties:{importFrom:{type:"string",minLength:1,maxLength:214},symbol:{type:"string",minLength:1,maxLength:128},referencePath:{type:"string",minLength:1,maxLength:512}}}}}}},codeAssets:{type:"array",items:{type:"object",additionalProperties:!1,required:["sourcePath","targetPath","ownership"],properties:{sourcePath:{type:"string",minLength:1,maxLength:512},targetPath:{type:"string",minLength:1,maxLength:512},ownership:{enum:["owned-file","managed-region","seed-file"]}}}}}},assets:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["path","ownership","digest","mode"],properties:{path:{type:"string",minLength:1,maxLength:512},ownership:{enum:["owned-file","managed-region","seed-file"]},digest:be,mode:{type:"integer",minimum:0,maximum:511},regionId:{type:"string",pattern:Y},renderer:{enum:["npm-package-json-v1","npm-package-json-v2","react-component-package-json-v1","nextjs-application-package-json-v1","workspace-root-package-json-v1","node-application-package-json-v1","web-application-package-json-v1","expo-application-package-json-v1","application-config-contract-v1","application-config-binding-v1"]}},allOf:[{if:{properties:{ownership:{const:"managed-region"}},required:["ownership"]},then:{properties:{regionId:{type:"string",pattern:Y}},required:["regionId"]},else:{not:{required:["regionId"]}}}]}},verifiers:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["id"],properties:{id:dd}}},exit:{type:"object",additionalProperties:!1,required:["ownedAssets"],properties:{ownedAssets:{type:"array",items:{type:"string",minLength:1,maxLength:512}}}}}},pg={type:"object",additionalProperties:!1,required:["registryId","packageName","version","integrity","tarballDigest","deliveryReceiptId","usage"],properties:{registryId:{type:"string",pattern:"^registry\\.[a-z0-9][a-z0-9.-]{1,126}$"},packageName:{type:"string",pattern:"^@[a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._-]*$",maxLength:214},version:{type:"string",pattern:"^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$",maxLength:64},integrity:{type:"string",pattern:"^sha512-[A-Za-z0-9+/]{86}==$"},tarballDigest:be,deliveryReceiptId:be,usage:{enum:["runtime","development"]}}},{$id:rM,...ug}=fd,kN={...ug,$id:"https://schemas.dyyto.dev/platform/capability-bundle-release-v2.json",required:[...fd.required,"availability","packageSources"],properties:{...fd.properties,schemaVersion:{const:2},availability:{oneOf:[{type:"object",additionalProperties:!1,required:["maturity","visibility","sourceState"],properties:{maturity:{const:"candidate"},visibility:{const:"maintainers-only"},sourceState:{const:"local-artifact"}}},{type:"object",additionalProperties:!1,required:["maturity","visibility","sourceState"],properties:{maturity:{const:"candidate"},visibility:{const:"maintainers-only"},sourceState:{const:"development-registry"}}},{type:"object",additionalProperties:!1,required:["maturity","visibility","sourceState"],properties:{maturity:{const:"available"},visibility:{const:"catalog-consumers"},sourceState:{const:"registry-verified"}}},{type:"object",additionalProperties:!1,required:["maturity","visibility","reasonCode"],properties:{maturity:{const:"withdrawn"},visibility:{const:"existing-locks-only"},reasonCode:{type:"string",pattern:"^[A-Z][A-Z0-9_]{2,63}$"}}}]},packageSources:{type:"array",maxItems:128,items:pg}}},SN={$id:"https://schemas.dyyto.dev/platform/capability-bundle-release.json",oneOf:[ug,(()=>{let{$id:e,...t}=kN;return t})()]},Do={$id:"https://schemas.dyyto.dev/platform/verification-result-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","verifierId","result","issuer","commandId","exitCode","stdoutDigest","stderrDigest","startedAt","completedAt","projectStateDigest","runtime"],properties:{schemaVersion:{const:1},verifierId:dd,result:{enum:["passed","failed"]},issuer:{enum:["dyyto-cli","test-harness","external-ci"]},commandId:dd,exitCode:{type:"integer",minimum:0,maximum:255},stdoutDigest:be,stderrDigest:be,startedAt:ld,completedAt:ld,projectStateDigest:be,runtime:fg}},NN={...Do,$id:"https://schemas.dyyto.dev/platform/adoption-evidence-v1.json",required:[...Do.required,"evidenceId","capabilityId","capabilityVersion","capabilityIntegrity"],properties:{...Do.properties,evidenceId:be,capabilityId:{type:"string",pattern:Y},capabilityVersion:{type:"string",minLength:1,maxLength:128},capabilityIntegrity:be}},PN={$id:"https://schemas.dyyto.dev/platform/project-adoption-lock.json",type:"object",additionalProperties:!1,required:["schemaVersion","capabilities"],properties:{schemaVersion:{enum:[1,2]},capabilities:{type:"array",items:{type:"object",additionalProperties:!1,required:["capabilityId","version","integrity","consumerProfile","appliedPlanId","projectStateDigest","assets","evidenceIds","committedAt"],properties:{capabilityId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128},integrity:be,consumerProfile:{type:"string",minLength:1,maxLength:128},appliedPlanId:be,projectStateDigest:be,assets:{type:"array",items:{type:"object",additionalProperties:!1,required:["path","digest"],properties:{path:{type:"string",minLength:1,maxLength:512},digest:be,ownership:{enum:["owned-file","managed-region","seed-file"]},regionId:{type:"string",pattern:Y}},allOf:[{if:{properties:{ownership:{const:"managed-region"}},required:["ownership"]},then:{properties:{regionId:{type:"string",pattern:Y}},required:["regionId"]}}]}},evidenceIds:{type:"array",items:be},committedAt:ld,packageAdoption:{type:"object",additionalProperties:!1,required:["registryRevisions","sources","packageJsonDigest","lockfileDigest"],properties:{sourceChannel:{enum:["production","development"]},registryRevisions:{type:"array",items:{type:"object",additionalProperties:!1,required:["registryId","revision"],properties:{registryId:RN,revision:be}}},sources:{type:"array",minItems:1,maxItems:128,items:pg},packageJsonDigest:be,lockfileDigest:be}}}}}},allOf:[{if:{properties:{schemaVersion:{const:1}},required:["schemaVersion"]},then:{properties:{capabilities:{type:"array",items:{type:"object",not:{type:"object",properties:{packageAdoption:{}},required:["packageAdoption"]}}}}}}]},Ki=new dg.Ajv2020({allErrors:!0,strict:!0});Ki.addFormat("date-time",{type:"string",validate:e=>!Number.isNaN(Date.parse(e))});var ON={capabilityBundleRelease:Ki.compile(SN),verificationResult:Ki.compile(Do),adoptionEvidence:Ki.compile(NN),projectAdoptionLock:Ki.compile(PN)},Co=class extends Error{contract;issues;code="ADOPTION_CONTRACT_INVALID";constructor(t,r){super(`Invalid ${t} contract`),this.contract=t,this.issues=r}};function DN(e,t,r){if(!t(r))throw new Co(e,t.errors??[]);return r}var hg=e=>{let t=DN("capabilityBundleRelease",ON.capabilityBundleRelease,e);if(t.schemaVersion===2){let r=()=>{throw new Co("capabilityBundleRelease",[])},n=t.packageSources;(t.availability.maturity==="candidate"&&t.availability.sourceState==="local-artifact"&&n.length!==0||t.availability.maturity==="candidate"&&t.availability.sourceState==="development-registry"&&n.length===0||t.availability.maturity!=="candidate"&&n.length===0)&&r();let i="",a=new Set;for(let s of n){let c=`${s.packageName}@${s.version}`;(c.localeCompare(i)<=0||a.has(c))&&r(),i=c,a.add(c)}let o=t.integration?.packages??[];(t.availability.maturity!=="candidate"||t.availability.sourceState==="development-registry")&&(o.length!==n.length||o.some(s=>!n.some(c=>c.packageName===s.packageName&&c.version===s.version&&c.usage===s.usage)))&&r()}return t};import{lstat as zN,readFile as wg,realpath as BN}from"node:fs/promises";import md from"node:path";import{createHash as CN}from"node:crypto";function A(e){return`sha256:${CN("sha256").update(e).digest("hex")}`}function C(e){return Array.isArray(e)?`[${e.map(C).join(",")}]`:e!==null&&typeof e=="object"?`{${Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>`${JSON.stringify(r)}:${C(n)}`).join(",")}}`:JSON.stringify(e)}var Rn=class extends Error{code="MANAGED_REGION_INVALID";constructor(t){super(t)}};function xN(e){if(!new RegExp(Y).test(e))throw new Rn("Region identity is invalid");return{begin:`<!-- dyyto:begin ${e} -->`,end:`<!-- dyyto:end ${e} -->`}}function pd(e,t){if(e.includes("\r"))throw new Rn("Managed regions require LF newlines");let{begin:r,end:n}=xN(t),i=e.split(r).length-1,a=e.split(n).length-1;if(i!==1||a!==1)throw new Rn("Managed region markers are unavailable or ambiguous");let o=e.indexOf(r)+r.length,s=e.indexOf(n,o),c=e.slice(o,s);if(/<!-- dyyto:(?:begin|end) /.test(c))throw new Rn("Managed regions cannot overlap");return`${c.replace(/^\n+|\n+$/g,"")}
|
|
15
|
+
`}import mg from"node:path";var ud=class extends Error{assetPath;code="PLAN_PRECONDITION_FAILED";constructor(t,r){super(t),this.assetPath=r}};function gg(e){if(e.length===0||mg.posix.isAbsolute(e)||mg.win32.isAbsolute(e)||e.includes("\\")||e.split("/").some(t=>t===".."||t==="."))throw new ud("Asset path must be a normalized project-relative POSIX path",e)}var yg=rr(Vr(),1);var J={type:"string",pattern:It},kn={type:"string",pattern:Y},zr={type:"string",minLength:1,maxLength:128},Fr={type:"string",minLength:1,maxLength:512,pattern:"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\).+$"},TN={$id:"https://schemas.dyyto.dev/platform/capability-release-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","capabilityId","version","integrity","assets","verifiers"],properties:{schemaVersion:{const:1},capabilityId:kn,version:zr,integrity:J,assets:{type:"array",items:{type:"object",additionalProperties:!1,required:["path","ownership"],properties:{path:Fr,ownership:{enum:["owned-file","managed-region","seed-file","shared-file","user-file"]},desiredDigest:J}}},verifiers:{type:"array",items:{type:"object",additionalProperties:!1,required:["id","kind"],properties:{id:{type:"string",minLength:1,maxLength:128},kind:{enum:["command","file-digest"]}}}}}},jN={$id:"https://schemas.dyyto.dev/platform/project-manifest-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","capabilities"],properties:{schemaVersion:{const:1},template:{type:"object",additionalProperties:!1,required:["id","version"],properties:{id:kn,version:zr}},profile:{type:"object",additionalProperties:!1,required:["id","parameters"],properties:{id:{type:"string",pattern:Y},parameters:{type:"object",minProperties:0,maxProperties:32,propertyNames:{pattern:"^[a-z][A-Za-z0-9]*$"},additionalProperties:{type:"string",maxLength:256}}}},capabilities:{type:"array",items:{type:"object",additionalProperties:!1,required:["capabilityId","version"],properties:{capabilityId:kn,version:zr}}}}},LN={$id:"https://schemas.dyyto.dev/platform/project-lock-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","capabilities"],properties:{schemaVersion:{const:1},capabilities:{type:"array",items:{type:"object",additionalProperties:!1,required:["capabilityId","version","integrity","appliedPlanId","assets","evidenceIds"],properties:{capabilityId:kn,version:zr,integrity:J,appliedPlanId:J,assets:{type:"array",items:{type:"object",additionalProperties:!1,required:["path","digest"],properties:{path:Fr,digest:J}}},evidenceIds:{type:"array",items:{type:"string",minLength:1,maxLength:256}}}}}}},$N={$id:"https://schemas.dyyto.dev/platform/evidence-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","evidenceId","capabilityId","capabilityVersion","verifierId","result","observedAt"],properties:{schemaVersion:{const:1},evidenceId:{type:"string",minLength:1,maxLength:256},capabilityId:kn,capabilityVersion:zr,verifierId:{type:"string",minLength:1,maxLength:128},result:{enum:["passed","failed"]},observedAt:{type:"string",format:"date-time"}}},MN={$id:"https://schemas.dyyto.dev/platform/change-plan-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","planId","action","state","capability","generatedAt","expiresAt","inputDigest","operations"],properties:{schemaVersion:{const:1},planId:J,action:{enum:["adopt","upgrade","remove"]},state:{enum:["reviewable","conflicted"]},capability:{type:"object",additionalProperties:!1,required:["capabilityId","version","integrity"],properties:{capabilityId:kn,version:zr,integrity:J}},generatedAt:{type:"string",format:"date-time"},expiresAt:{type:"string",format:"date-time"},inputDigest:J,packageAdoption:{type:"object",additionalProperties:!1,required:["schemaVersion","packageJsonPreimageDigest","desiredPackageJsonDigest","lockfilePreimage","desiredLockfileDigest","registryRevisions","endpointBindings","sources","installPolicy"],properties:{schemaVersion:{enum:[1,2]},sourceChannel:{enum:["production","development"]},packageJsonPreimageDigest:J,desiredPackageJsonDigest:J,lockfilePreimage:{oneOf:[{type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{const:"absent"}}},{type:"object",additionalProperties:!1,required:["kind","digest"],properties:{kind:{const:"present"},digest:J}}]},desiredLockfileDigest:J,registryRevisions:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["registryId","revision"],properties:{registryId:{type:"string",minLength:1,maxLength:128},revision:J}}},endpointBindings:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["registryId","registryConfigRevision","bindingDigest","expiresAt"],properties:{registryId:{type:"string",minLength:1,maxLength:128},registryConfigRevision:J,bindingDigest:J,expiresAt:{type:"string",format:"date-time"}}}},sources:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["registryId","packageName","version","integrity","tarballDigest","deliveryReceiptId","usage"],properties:{registryId:{type:"string",minLength:1,maxLength:128},packageName:{type:"string",pattern:"^@[a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._-]*$"},version:zr,integrity:{type:"string",pattern:"^sha512-[A-Za-z0-9+/]+={0,2}$"},tarballDigest:J,deliveryReceiptId:J,usage:{enum:["runtime","development"]}}}},installPolicy:{type:"object",additionalProperties:!1,required:["ignoreScripts","allowWorkspaceProtocol","allowPublicRegistryFallback"],properties:{ignoreScripts:{const:!0},allowWorkspaceProtocol:{const:!1},allowPublicRegistryFallback:{const:!1}}},topology:{type:"object",additionalProperties:!1,required:["mode","unitRelativeRoot","unitImporterId","lockfilePath"],properties:{mode:{enum:["standalone","pnpm-shared-lockfile"]},unitRelativeRoot:Fr,unitImporterId:Fr,lockfilePath:{const:"pnpm-lock.yaml"},workspaceManifestPath:{const:"pnpm-workspace.yaml"},workspaceManifestDigest:J}},preservedDependencies:{type:"array",items:{type:"object",additionalProperties:!1,required:["section","packageName","specifier"],properties:{section:{enum:["dependencies","devDependencies","optionalDependencies"]},packageName:{type:"string",minLength:1,maxLength:214},specifier:{type:"string",minLength:1,maxLength:512}}}},preservedImporterDigests:{type:"array",items:{type:"object",additionalProperties:!1,required:["importerId","preimageDigest","desiredDigest"],properties:{importerId:Fr,preimageDigest:J,desiredDigest:J}}}},allOf:[{if:{properties:{schemaVersion:{const:1}},required:["schemaVersion"]},then:{properties:{topology:!1,preservedDependencies:!1,preservedImporterDigests:!1}}},{if:{properties:{schemaVersion:{const:2}},required:["schemaVersion"]},then:{required:["topology","preservedDependencies","preservedImporterDigests"]}}]},operations:{type:"array",items:{type:"object",additionalProperties:!1,required:["path","kind","ownership","disposition"],properties:{path:Fr,kind:{enum:["create","replace","merge","remove"]},ownership:{enum:["owned-file","managed-region","seed-file","shared-file","user-file"]},desiredDigest:J,baseDigest:J,regionId:{type:"string",pattern:Y},disposition:{enum:["ready","noop","conflict"]},conflictCode:{enum:["USER_OWNED","UNEXPECTED_EXISTING","BASE_DIGEST_MISMATCH"]}}}}}},VN={$id:"https://schemas.dyyto.dev/platform/transaction-journal-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","transactionId","planId","approvedPlanId","projectRootDigest","state","createdAt","updatedAt","operations","journalDigest"],properties:{schemaVersion:{const:1},transactionId:{type:"string",minLength:1,maxLength:128},planId:J,approvedPlanId:J,projectRootDigest:J,state:{enum:["preparing","prepared","applying","applied","recovery-required","recovering","recovered"]},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},operations:{type:"array",items:{type:"object",additionalProperties:!1,required:["index","path","kind","before","status"],properties:{index:{type:"integer",minimum:0},path:Fr,kind:{enum:["create","replace","merge","remove"]},before:{oneOf:[{type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{const:"absent"}}},{type:"object",additionalProperties:!1,required:["kind","digest","mode","preimageDigest"],properties:{kind:{const:"present"},digest:J,mode:{type:"integer",minimum:0,maximum:511},preimageDigest:J}}]},desiredDigest:J,status:{enum:["pending","applied","restored"]}}}},failure:{type:"object",additionalProperties:!1,required:["code"],properties:{code:{type:"string",minLength:1,maxLength:128},operationIndex:{type:"integer",minimum:0}}},journalDigest:J}},Ur=new yg.Ajv2020({allErrors:!0,strict:!0});Ur.addFormat("date-time",{type:"string",validate:e=>!Number.isNaN(Date.parse(e))});var UN={capabilityRelease:Ur.compile(TN),projectManifest:Ur.compile(jN),projectLock:Ur.compile(LN),evidence:Ur.compile($N),changePlan:Ur.compile(MN),transactionJournal:Ur.compile(VN)},hd=class extends Error{contract;issues;code="CONTRACT_INVALID";constructor(t,r){super(`Invalid ${t} contract`),this.contract=t,this.issues=r}};function FN(e,t,r){if(!t(r))throw new hd(e,t.errors??[]);return r}var fr=e=>FN("projectManifest",UN.projectManifest,e);var Sn=class extends Error{code;assetPath;constructor(t,r,n){super(r),this.code=t,this.assetPath=n}};async function qN(e,t){let r=md.join(e,...t.split("/"));try{let n=await zN(r);if(!n.isFile()||n.isSymbolicLink())throw new Sn("PROJECT_STATE_INVALID","Blank profile target must be a regular file",t);return{path:t,exists:!0,digest:A(await wg(r))}}catch(n){if(n.code==="ENOENT")return{path:t,exists:!1};throw n}}async function xo(e){let t=await BN(md.resolve(e.projectRoot)),r=[];for(let n of e.expectedAssets){let i=await qN(t,n.path),a=i.exists&&i.digest===n.digest;if(n.ownership==="managed-region"&&n.regionId!==void 0&&i.exists)try{a=A(pd(await wg(md.join(t,...n.path.split("/")),"utf8"),n.regionId))===n.digest}catch{a=!1}if(!a)throw new Sn("PROJECT_STATE_INVALID","A managed project asset does not match the approved plan",n.path);r.push({path:n.path,digest:n.digest,...n.ownership===void 0?{}:{ownership:n.ownership},...n.regionId===void 0?{}:{regionId:n.regionId}})}return{assets:r,projectStateDigest:A(C(r))}}var PM=5*1024*1024,OM=25*1024*1024;import{lstat as vg,readFile as _g,realpath as Ig}from"node:fs/promises";import pr from"node:path";var ut=class extends Error{code;assetPath;constructor(t,r,n){super(r),this.code=t,this.assetPath=n}};function Eg(e){return A(C(e))}async function JN(e,t){let r=pr.join(e,"assets",...t.split("/"));try{return await vg(r),r}catch(n){if(n.code!=="ENOENT"||pr.posix.basename(t)!==".gitignore")throw n}return pr.join(e,"assets",...pr.posix.dirname(t).split("/").filter(n=>n!=="."),"__dyyto_dotfiles__","gitignore")}async function bg(e){let t=await Ig(pr.resolve(e)),r;try{r=hg(JSON.parse(await _g(pr.join(t,"release.json"),"utf8")))}catch(c){throw c instanceof ut?c:new ut("RELEASE_INVALID","Capability release metadata is invalid")}let{integrity:n,...i}=r;if(Eg(i)!==n)throw new ut("RELEASE_INTEGRITY_MISMATCH","Capability release integrity does not match metadata");let a=new Map,o=new Set,s="";for(let c of r.assets){try{gg(c.path)}catch{throw new ut("RELEASE_ASSET_INVALID","Release asset path is unsafe",c.path)}if((c.path===".dyyto"||c.path.startsWith(".dyyto/"))&&c.path!==".dyyto/application-config-binding.json"||o.has(c.path)||c.path.localeCompare(s)<0)throw new ut("RELEASE_ASSET_INVALID","Release assets must be unique, sorted and outside reserved .dyyto paths",c.path);o.add(c.path),s=c.path;let l=await JN(t,c.path),d=await Ig(l),f=pr.join(t,"assets");if(!d.startsWith(`${f}${pr.sep}`))throw new ut("RELEASE_ASSET_INVALID","Release asset escapes its bundle",c.path);let p=await vg(l);if(!p.isFile()||p.isSymbolicLink())throw new ut("RELEASE_ASSET_INVALID","Release asset must be a regular file",c.path);let u=await _g(l);if(A(u)!==c.digest)throw new ut("RELEASE_ASSET_INTEGRITY_MISMATCH","Release asset digest does not match metadata",c.path);a.set(c.path,u)}if(r.exit.ownedAssets.length!==r.assets.length||r.exit.ownedAssets.some((c,l)=>c!==r.assets[l]?.path))throw new ut("RELEASE_INVALID","Exit owned assets must exactly match release assets");return{release:r,contents:a}}import{lstat as Rg,readFile as YN,readdir as ZN,realpath as XN}from"node:fs/promises";import Nn from"node:path";import{homedir as QN}from"node:os";var ur=class extends Error{code;constructor(t){super(t),this.code=t,this.name="WorkspaceTopologyError"}};async function eP(e){let t=Nn.resolve(e),r=await Rg(t).catch(()=>null);if(!r?.isDirectory()||r.isSymbolicLink()||t===Nn.parse(t).root||t===Nn.resolve(QN()))throw new ur("WORKSPACE_PATH_UNSAFE");let n=await XN(t);if(n!==t)throw new ur("WORKSPACE_PATH_UNSAFE");return n}async function Ag(e){let t=await Rg(e).catch(()=>null);if(t!==null){if(!t.isFile()||t.isSymbolicLink())throw new ur("WORKSPACE_PATH_UNSAFE");return YN(e)}}function tP(e){let t=e.split(/\r?\n/u),r=[],n=!1;for(let i of t){if(/^packages:\s*(?:#.*)?$/u.test(i)){n=!0;continue}if(!n)continue;let a=/^\s+-\s+["']?([^"'#]+?)["']?\s*(?:#.*)?$/u.exec(i);if(a){r.push(a[1].trim().replace(/^\.\//u,"").replace(/\/$/u,""));continue}if(i.trim()&&!/^\s/u.test(i))break}if(r.length===0)throw new ur("WORKSPACE_MANIFEST_INVALID");return r}async function kg(e){let t=await eP(e),r=await Ag(Nn.join(t,"pnpm-workspace.yaml"));if(!r)throw new ur("WORKSPACE_OWNER_MISSING");let n=new Map;for(let i of tP(r.toString("utf8"))){let a=[];if(i.endsWith("/*")&&!i.slice(0,-2).includes("*")){let o=i.slice(0,-2),s=await ZN(Nn.join(t,...o.split("/")),{withFileTypes:!0}).catch(()=>[]);for(let c of s)c.isDirectory()&&!c.isSymbolicLink()&&a.push(`${o}/${c.name}`)}else if(!i.includes("*"))a.push(i);else throw new ur("WORKSPACE_MANIFEST_INVALID");for(let o of a){let s=await Ag(Nn.join(t,...o.split("/"),"package.json"));s&&n.set(o,s)}}return Object.freeze([...n].sort(([i],[a])=>i.localeCompare(a)).map(([i,a])=>Object.freeze({relativeRoot:i,bytes:a})))}var Ft=class extends Error{code;constructor(t,r){super(r),this.code=t}},wd=/^sha256:[a-f0-9]{64}$/;var aP=/^registry\.[a-z0-9][a-z0-9.-]{1,126}$/;var Sg=/^[a-z][a-z0-9._:-]{2,127}$/;function Br(e,t){let r=Object.keys(e).sort();return r.length===t.length&&r.every((n,i)=>n===[...t].sort()[i])}function oP(e){if(!Br(e,["registryId","tenantId","origin","scopes","authentication","capabilities","status"])||!aP.test(e.registryId)||!Sg.test(e.tenantId)||e.scopes.length===0||e.scopes.length>32||e.scopes.some((n,i)=>!/^@[a-z0-9][a-z0-9._-]*$/.test(n)||e.scopes.indexOf(n)!==i)||!Br(e.authentication,e.authentication.credentialRef===void 0?["kind"]:["kind","credentialRef"])||!Br(e.capabilities,["read","write","provenance","staging"])||!["workload-identity","short-lived-token","restricted-token","anonymous-test"].includes(e.authentication.kind)||e.authentication.kind==="anonymous-test"!=(e.authentication.credentialRef===void 0)||e.authentication.credentialRef!==void 0&&!Sg.test(e.authentication.credentialRef))return!1;let t;try{t=new URL(e.origin)}catch{return!1}if(t.username||t.password||t.search||t.hash||!t.pathname.endsWith("/")||t.pathname.includes("..")||/%2f|%5c/iu.test(t.pathname))return!1;let r=t.hostname==="127.0.0.1"||t.hostname==="localhost"||t.hostname==="[::1]";return e.authentication.kind==="anonymous-test"&&(!r||t.protocol!=="http:")||e.authentication.kind!=="anonymous-test"&&t.protocol!=="https:"?!1:typeof e.capabilities.read=="boolean"&&typeof e.capabilities.write=="boolean"&&typeof e.capabilities.provenance=="boolean"&&typeof e.capabilities.staging=="boolean"&&(e.status==="enabled"||e.status==="disabled")}function sP(e){if(!oP(e))throw new Ft("REGISTRY_CONFIG_INVALID","Registry configuration is invalid");let t={schemaVersion:1,...e};return Object.freeze({...t,scopes:Object.freeze([...e.scopes]),authentication:Object.freeze({...e.authentication}),capabilities:Object.freeze({...e.capabilities}),revision:A(C(t))})}function _d(e){let t=e;if(typeof t!="object"||t===null||!Br(t,["schemaVersion","revision","registryId","tenantId","origin","scopes","authentication","capabilities","status"])||t.schemaVersion!==1||!wd.test(t.revision))throw new Ft("REGISTRY_CONFIG_INVALID","Registry configuration is invalid");let{schemaVersion:r,revision:n,...i}=t;if(sP(i).revision!==n)throw new Ft("REGISTRY_CONFIG_INVALID","Registry configuration has been modified");return t}function cP(e,t){let r,n;try{r=new URL(e.origin),n=new URL(t)}catch{return!1}return n.username||n.password||n.search||n.hash||n.pathname!==r.pathname||n.protocol!==r.protocol||n.hostname!==r.hostname?!1:e.authentication.kind==="anonymous-test"||n.port===r.port}function lP(e,t){let r=_d(t);if(!Br(e,["registryId","registryConfigRevision","origin","resolvedAt","expiresAt"])||e.registryId!==r.registryId||e.registryConfigRevision!==r.revision||!cP(r,e.origin)||Number.isNaN(Date.parse(e.resolvedAt))||Number.isNaN(Date.parse(e.expiresAt))||Date.parse(e.expiresAt)<=Date.parse(e.resolvedAt))throw new Ft("REGISTRY_ENDPOINT_BINDING_INVALID","Registry endpoint binding is invalid");let n={schemaVersion:1,...e};return Object.freeze({...n,bindingDigest:A(C(n))})}function To(e,t){let r=e;if(typeof r!="object"||r===null||!Br(r,["schemaVersion","bindingDigest","registryId","registryConfigRevision","origin","resolvedAt","expiresAt"])||r.schemaVersion!==1||!wd.test(r.bindingDigest))throw new Ft("REGISTRY_ENDPOINT_BINDING_INVALID","Registry endpoint binding is invalid");let{schemaVersion:n,bindingDigest:i,...a}=r;if(lP(a,t).bindingDigest!==i)throw new Ft("REGISTRY_ENDPOINT_BINDING_INVALID","Registry endpoint binding has been modified");return r}function jo(e,t,r=6e4){if(!Br(e,["schemaVersion","kind","secret","subjectDigest","issuedAt","expiresAt"])||e.schemaVersion!==1||!["bearer-token","anonymous-test"].includes(e.kind)||typeof e.secret!="string"||e.secret.length<1||e.secret.length>16384||/[\r\n\0]/u.test(e.secret)||!wd.test(e.subjectDigest)||[e.issuedAt,e.expiresAt,t].some(n=>Number.isNaN(Date.parse(n)))||Date.parse(e.issuedAt)>Date.parse(t)||Date.parse(e.expiresAt)-Date.parse(t)<r)throw new Ft("REGISTRY_CREDENTIAL_INVALID","Registry credential lease is invalid");return e}var X=class extends Error{code;constructor(t,r){super(t,r),this.code=t,this.name="PackageAdoptionError"}};var Dg=rr(Vr(),1);var Cg=["workspace-node-application","workspace-web-application","nextjs-full-stack-application"],xg="^[a-z0-9][a-z0-9._-]{0,127}$",Id="^[A-Z][A-Z0-9_]{0,127}$",Ng="^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*(?:^|/)\\.(?:/|$))(?!.*\\\\)(?!.*[\\u0000-\\u001f]).+$",uP={$id:"https://schemas.dyyto.dev/platform/application-config-contract-v1.json",type:"object",additionalProperties:!1,required:["$schema","schemaVersion","kind","application","configDirectory","bindings"],properties:{$schema:{const:"https://schemas.dyyto.dev/platform/application-config-contract-v1.json"},schemaVersion:{const:1},kind:{const:"ApplicationConfigContract"},application:{type:"object",additionalProperties:!1,required:["id","profile"],properties:{id:{type:"string",pattern:xg},profile:{enum:Cg}}},configDirectory:{type:"object",additionalProperties:!1,required:["rootEnvironmentVariable","relativeDirectory","environmentFile","materializationOwner"],properties:{rootEnvironmentVariable:{const:"IDP_CONFIG_DIR"},relativeDirectory:{type:"string",pattern:"^applications/[a-z0-9][a-z0-9._-]{0,127}$"},environmentFile:{const:".env"},materializationOwner:{const:"external-deployment-control-plane"}}},bindings:{type:"array",maxItems:128,items:{oneOf:[{type:"object",additionalProperties:!1,required:["name","kind","required"],properties:{name:{type:"string",pattern:Id},kind:{const:"value"},required:{type:"boolean"},default:{type:"string",maxLength:1024}}},{type:"object",additionalProperties:!1,required:["name","kind","required","file"],properties:{name:{type:"string",pattern:Id},kind:{const:"secret-file"},required:{type:"boolean"},file:{type:"string",maxLength:512,pattern:Ng}}},{type:"object",additionalProperties:!1,required:["name","kind","required","file"],properties:{name:{type:"string",pattern:Id},kind:{const:"certificate-file"},required:{type:"boolean"},file:{type:"string",maxLength:512,pattern:Ng}}}]}}}},Pg=new Dg.Ajv2020({allErrors:!0,strict:!0}).compile(uP),Og=/(?:^|_)(?:PASSWORD|PASSWD|TOKEN|SECRET|PRIVATE_KEY|ACCESS_KEY|API_KEY|DATABASE_URL|CONNECTION_STRING|DSN|AUTHORIZATION|CREDENTIALS?)(?:_|$)/u,hP=/(?:^|_)(?:PRIVATE_KEY|PRIVATE|KEYPAIR|KEYSTORE|PKCS12|P12|PFX|KEY)(?:_|$)/u,qe=class extends Error{code;issues;constructor(t,r,n=[]){super(r),this.code=t,this.issues=n}};function mP(e){let t=fr(e),r=t.profile?.id;if(!Cg.includes(r))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID","\u73AF\u5883\u914D\u7F6E\u5951\u7EA6\u53EA\u652F\u6301\u53EF\u90E8\u7F72 Application Profile\u3002");let n=t.profile?.parameters??{},i=n.name;if(Object.keys(n).length!==1||typeof i!="string"||!new RegExp(xg,"u").test(i))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID","Application Manifest \u5FC5\u987B\u5305\u542B\u552F\u4E00\u4E14\u5408\u6CD5\u7684 name \u53C2\u6570\u3002");return{id:i,profile:r}}function vd(e,t){if(!Pg(e))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID","Application ConfigContract \u4E0D\u7B26\u5408 v1 Schema\u3002",Pg.errors??[]);let r=e;if(r.configDirectory.relativeDirectory!==`applications/${r.application.id}`)throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID","Config Dir \u76F8\u5BF9\u76EE\u5F55\u5FC5\u987B\u7531 Application identity \u552F\u4E00\u786E\u5B9A\u3002");let n=new Set,i=new Set;for(let a of r.bindings){if(n.has(a.name))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID",`\u73AF\u5883 Binding \u540D\u79F0\u91CD\u590D\uFF1A${a.name}`);if(n.add(a.name),a.kind==="value"){if(Og.test(a.name))throw new qe("APPLICATION_CONFIG_SECRET_LITERAL_FORBIDDEN",`\u654F\u611F\u914D\u7F6E ${a.name} \u5FC5\u987B\u4F7F\u7528\u6587\u4EF6 Binding\uFF0C\u7981\u6B62\u5728\u4ED3\u5E93\u4E2D\u58F0\u660E\u503C\u3002`);continue}if(!a.name.endsWith("_FILE"))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID",`\u6587\u4EF6 Binding ${a.name} \u5FC5\u987B\u4EE5 _FILE \u7ED3\u5C3E\u3002`);let o=a.kind==="secret-file"?"secrets/":"certs/";if(a.kind==="certificate-file"&&(Og.test(a.name)||hP.test(a.name)))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID",`${a.name} \u5305\u542B\u79C1\u5BC6\u6750\u6599\u8BED\u4E49\uFF0C\u5FC5\u987B\u4F7F\u7528 secret-file \u5E76\u653E\u5165 secrets/\uFF1Bcertificate-file \u53EA\u5141\u8BB8\u516C\u5F00\u8BC1\u4E66\u3002`);let s=a.file.split("/");if(!a.file.startsWith(o)||s.some(c=>c===""||c==="."||c===".."))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID",`${a.name} \u5FC5\u987B\u4F4D\u4E8E ${o} \u4E0B\u7684\u5177\u4F53\u6587\u4EF6\u3002`);if(i.has(a.file))throw new qe("APPLICATION_CONFIG_CONTRACT_INVALID",`\u914D\u7F6E\u6587\u4EF6 Binding \u8DEF\u5F84\u91CD\u590D\uFF1A${a.file}`);i.add(a.file)}if(t!==void 0){let a=mP(t);if(r.application.id!==a.id||r.application.profile!==a.profile)throw new qe("APPLICATION_CONFIG_IDENTITY_MISMATCH","ConfigContract \u7684\u5E94\u7528\u8EAB\u4EFD\u6216 Profile \u4E0E Project Manifest \u4E0D\u4E00\u81F4\u3002")}return r}var O=class extends Error{code;constructor(t,r){super(r),this.code=t,this.name="DeliveryError"}};import{mkdir as Ed,open as Vo,readFile as Ji,readdir as Hg,rename as Uo,rm as Jg}from"node:fs/promises";import _e from"node:path";var bP=44;var Tg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",AP=new Uint8Array(64),Lg=new Uint8Array(128);for(let e=0;e<Tg.length;e++){let t=Tg.charCodeAt(e);AP[e]=t,Lg[t]=e}function Hi(e,t){let r=0,n=0,i=0;do{let o=e.next();i=Lg[o],r|=(i&31)<<n,n+=5}while(i&32);let a=r&1;return r>>>=1,a&&(r=-2147483648|-r),t+r}function jg(e,t){return e.pos>=t?!1:e.peek()!==bP}var ZV=1024*16;var RP=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:r}=this,n=t.indexOf(e,r);return n===-1?t.length:n}};function $g(e){let{length:t}=e,r=new RP(e),n=[],i=0,a=0,o=0,s=0,c=0;do{let l=r.indexOf(";"),d=[],f=!0,p=0;for(i=0;r.pos<l;){let u;i=Hi(r,i),i<p&&(f=!1),p=i,jg(r,l)?(a=Hi(r,a),o=Hi(r,o),s=Hi(r,s),jg(r,l)?(c=Hi(r,c),u=[i,a,o,s,c]):u=[i,a,o,s]):u=[i],d.push(u),r.pos++}f||kP(d),n.push(d),r.pos=l+1}while(r.pos<=t);return n}function kP(e){e.sort(SP)}function SP(e,t){return e[0]-t[0]}var NP=/^[\w+.-]+:\/\//,PP=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,OP=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function DP(e){return NP.test(e)}function CP(e){return e.startsWith("//")}function Ug(e){return e.startsWith("/")}function xP(e){return e.startsWith("file:")}function Mg(e){return/^[.?#]/.test(e)}function Lo(e){let t=PP.exec(e);return Fg(t[1],t[2]||"",t[3],t[4]||"",t[5]||"/",t[6]||"",t[7]||"")}function TP(e){let t=OP.exec(e),r=t[2];return Fg("file:","",t[1]||"","",Ug(r)?r:"/"+r,t[3]||"",t[4]||"")}function Fg(e,t,r,n,i,a,o){return{scheme:e,user:t,host:r,port:n,path:i,query:a,hash:o,type:7}}function Vg(e){if(CP(e)){let r=Lo("http:"+e);return r.scheme="",r.type=6,r}if(Ug(e)){let r=Lo("http://foo.com"+e);return r.scheme="",r.host="",r.type=5,r}if(xP(e))return TP(e);if(DP(e))return Lo(e);let t=Lo("http://foo.com/"+e);return t.scheme="",t.host="",t.type=e?e.startsWith("?")?3:e.startsWith("#")?2:4:1,t}function jP(e){if(e.endsWith("/.."))return e;let t=e.lastIndexOf("/");return e.slice(0,t+1)}function LP(e,t){zg(t,t.type),e.path==="/"?e.path=t.path:e.path=jP(t.path)+e.path}function zg(e,t){let r=t<=4,n=e.path.split("/"),i=1,a=0,o=!1;for(let c=1;c<n.length;c++){let l=n[c];if(!l){o=!0;continue}if(o=!1,l!=="."){if(l===".."){a?(o=!0,a--,i--):r&&(n[i++]=l);continue}n[i++]=l,a++}}let s="";for(let c=1;c<i;c++)s+="/"+n[c];(!s||o&&!s.endsWith("/.."))&&(s+="/"),e.path=s}function Bg(e,t){if(!e&&!t)return"";let r=Vg(e),n=r.type;if(t&&n!==7){let a=Vg(t),o=a.type;switch(n){case 1:r.hash=a.hash;case 2:r.query=a.query;case 3:case 4:LP(r,a);case 5:r.user=a.user,r.host=a.host,r.port=a.port;case 6:r.scheme=a.scheme}o>n&&(n=o)}zg(r,n);let i=r.query+r.hash;switch(n){case 2:case 3:return i;case 4:{let a=r.path.slice(1);return a?Mg(t||e)&&!Mg(a)?"./"+a+i:a+i:i||"."}case 5:return r.path+i;default:return r.scheme+"//"+r.user+r.host+r.port+r.path+i}}function $P(e){if(!e)return"";let t=e.lastIndexOf("/");return e.slice(0,t+1)}function MP(e,t){let r=$P(e),n=t?t+"/":"";return i=>Bg(n+(i||""),r)}var hr=0,VP=1,UP=2,FP=3,zP=4;function BP(e,t){let r=qg(e,0);if(r===e.length)return e;t||(e=e.slice());for(let n=r;n<e.length;n=qg(e,n+1))e[n]=GP(e[n],t);return e}function qg(e,t){for(let r=t;r<e.length;r++)if(!qP(e[r]))return r;return e.length}function qP(e){for(let t=1;t<e.length;t++)if(e[t][hr]<e[t-1][hr])return!1;return!0}function GP(e,t){return t||(e=e.slice()),e.sort(KP)}function KP(e,t){return e[hr]-t[hr]}var Mo=!1;function WP(e,t,r,n){for(;r<=n;){let i=r+(n-r>>1),a=e[i][hr]-t;if(a===0)return Mo=!0,i;a<0?r=i+1:n=i-1}return Mo=!1,r-1}function HP(e,t,r){for(let n=r+1;n<e.length&&e[n][hr]===t;r=n++);return r}function JP(e,t,r){for(let n=r-1;n>=0&&e[n][hr]===t;r=n--);return r}function YP(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function ZP(e,t,r,n){let{lastKey:i,lastNeedle:a,lastIndex:o}=r,s=0,c=e.length-1;if(n===i){if(t===a)return Mo=o!==-1&&e[o][hr]===t,o;t>=a?s=o===-1?0:o:c=o}return r.lastKey=n,r.lastNeedle=t,r.lastIndex=WP(e,t,s,c)}function XP(e){return typeof e=="string"?JSON.parse(e):e}var QP="`line` must be greater than 0 (lines start at line 1)",eO="`column` must be greater than or equal to 0 (columns start at column 0)",Gg=-1,tO=1,Kg=class{constructor(e,t){let r=typeof e=="string";if(!r&&e._decodedMemo)return e;let n=XP(e),{version:i,file:a,names:o,sourceRoot:s,sources:c,sourcesContent:l}=n;this.version=i,this.file=a,this.names=o||[],this.sourceRoot=s,this.sources=c,this.sourcesContent=l,this.ignoreList=n.ignoreList||n.x_google_ignoreList||void 0;let d=MP(t,s);this.resolvedSources=c.map(d);let{mappings:f}=n;if(typeof f=="string")this._encoded=f,this._decoded=void 0;else if(Array.isArray(f))this._encoded=void 0,this._decoded=BP(f,r);else throw n.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(n)}`);this._decodedMemo=YP(),this._bySources=void 0,this._bySourceMemos=void 0}};function rO(e){var t;return(t=e)._decoded||(t._decoded=$g(e._encoded))}function Wg(e,t){let{line:r,column:n,bias:i}=t;if(r--,r<0)throw new Error(QP);if(n<0)throw new Error(eO);let a=rO(e);if(r>=a.length)return $o(null,null,null,null);let o=a[r],s=nO(o,e._decodedMemo,r,n,i||tO);if(s===-1)return $o(null,null,null,null);let c=o[s];if(c.length===1)return $o(null,null,null,null);let{names:l,resolvedSources:d}=e;return $o(d[c[VP]],c[UP]+1,c[FP],c.length===5?l[c[zP]]:null)}function $o(e,t,r,n){return{source:e,line:t,column:r,name:n}}function nO(e,t,r,n,i){let a=ZP(e,n,t,r);return Mo?a=(i===Gg?HP:JP)(e,n,a):i===Gg&&a++,a===-1||a===e.length?-1:a}var oe=class extends Error{code;constructor(t,r){super(r),this.code=t,this.name="RuntimeObservabilityError"}},bd=/^sha256:[a-f0-9]{64}$/,Yg=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,iO=/^00-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$/,Fo=(e,t)=>Object.keys(e).every(r=>t.includes(r)),Yi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Pn=(e,t)=>e.replace(/[\u0000-\u001f\u007f]/g," ").replace(/([a-z]+:\/\/)[^/@\s]+@/gi,"$1").slice(0,t);function aO(e){if(!Yi(e)||!Fo(e,["schemaVersion","eventId","occurredAt","applicationId","releaseId","deploymentId","kind","error","page","traceparent"]))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error Envelope contains unknown fields");if(!Yi(e.error)||!Yi(e.page)||!Fo(e.error,["type","message","frames"])||!Fo(e.page,["origin","path"]))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error Envelope structure is invalid");if(e.schemaVersion!==1||typeof e.eventId!="string"||!Yg.test(e.eventId)||typeof e.occurredAt!="string"||Number.isNaN(Date.parse(e.occurredAt))||typeof e.applicationId!="string"||e.applicationId.length<1||e.applicationId.length>128)throw new oe("RUNTIME_ERROR_INVALID","Runtime Error Envelope identity is invalid");if(!["uncaught-error","unhandled-rejection","reported-error"].includes(e.kind))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error kind is invalid");for(let n of[e.releaseId,e.deploymentId])if(n!==void 0&&(typeof n!="string"||!bd.test(n)))throw new oe("RUNTIME_ERROR_IDENTITY_UNKNOWN","Runtime Error correlation identity is invalid");if(e.traceparent!==void 0&&(typeof e.traceparent!="string"||!iO.test(e.traceparent)))throw new oe("RUNTIME_ERROR_INVALID","traceparent is invalid");if(typeof e.error.type!="string"||typeof e.error.message!="string"||!Array.isArray(e.error.frames)||e.error.frames.length>50||typeof e.page.origin!="string"||typeof e.page.path!="string")throw new oe("RUNTIME_ERROR_INVALID","Runtime Error content is invalid");if(e.error.message.length>4096||e.error.type.length>256||e.page.path.length>2048)throw new oe("RUNTIME_ERROR_TOO_LARGE","Runtime Error content exceeds a hard limit");let t=e.error.frames.map(n=>{if(!Yi(n)||!Fo(n,["file","line","column","function"])||typeof n.file!="string"||n.file.length>2048)throw new oe("RUNTIME_ERROR_INVALID","Runtime Error stack frame is invalid");for(let i of[n.line,n.column])if(i!==void 0&&(!Number.isSafeInteger(i)||Number(i)<1))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error stack location is invalid");if(n.function!==void 0&&(typeof n.function!="string"||n.function.length>256))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error stack function is invalid");return n}),r;try{r=new URL(e.page.origin)}catch{throw new oe("RUNTIME_ERROR_INVALID","Runtime Error page origin is invalid")}if(r.origin!==e.page.origin||!e.page.path.startsWith("/")||e.page.path.includes("?")||e.page.path.includes("#"))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error page must contain only origin and path");return{...e,error:{...e.error,frames:t}}}function oO(e,t,r="unknown"){let n=e.error.frames.map(o=>({file:Pn(o.file,2048),...o.line===void 0?{}:{line:o.line},...o.column===void 0?{}:{column:o.column},...o.function===void 0?{}:{function:Pn(o.function,256)}})),i={type:Pn(e.error.type,256),message:Pn(e.error.message,4096),frames:n},a=A(C({type:i.type,message:i.message,frames:n.slice(0,5).map(({file:o,line:s,column:c})=>({file:o,line:s,column:c}))}));return{schemaVersion:1,eventId:e.eventId,occurredAt:e.occurredAt,receivedAt:t,applicationId:Pn(e.applicationId,128),...e.releaseId===void 0?{}:{releaseId:e.releaseId},...e.deploymentId===void 0?{}:{deploymentId:e.deploymentId},kind:e.kind,error:i,page:{origin:e.page.origin,path:Pn(e.page.path,2048)},...e.traceparent===void 0?{}:{traceparent:e.traceparent},fingerprint:a,state:e.releaseId===void 0?"persisted":"map-missing",correlation:r}}var Zi=class{workspaceRoot;adapterId="observability.local";#e=Promise.resolve();constructor(t){this.workspaceRoot=t}directory(){return _e.join(_e.resolve(this.workspaceRoot),".dyyto","observability","events")}releases(){return _e.join(_e.resolve(this.workspaceRoot),".dyyto","observability","releases")}async accept(t,r){let n=aO(t);if(!r.allowedOrigins.includes(n.page.origin))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error origin is not registered");let i=r.resolveCorrelation===void 0?"unknown":await r.resolveCorrelation(n),a=oO(n,r.receivedAt,i);return this.#t(async()=>{let o=this.directory();await Ed(o,{recursive:!0,mode:448});let s=_e.join(o,`${a.eventId}.json`);try{let p=JSON.parse(await Ji(s,"utf8")),u={...p,correlation:p.correlation??"unknown"};if(C({...u,receivedAt:a.receivedAt})!==C(a))throw new oe("RUNTIME_ERROR_INVALID","eventId is already used for different content");return{eventId:a.eventId,state:u.state,duplicate:!0}}catch(p){if(p.code!=="ENOENT")throw p}let c=`${s}.tmp-${process.pid}-${crypto.randomUUID()}`,l=await Vo(c,"wx",384);try{await l.writeFile(`${C(a)}
|
|
16
|
+
`,"utf8"),await l.sync()}finally{await l.close()}await Uo(c,s);let d=await Vo(o,"r");try{await d.sync()}finally{await d.close()}await this.rotate(),a.releaseId!==void 0&&await this.resymbolicate(a.releaseId);let f=JSON.parse(await Ji(s,"utf8"));return{eventId:a.eventId,state:f.state,duplicate:!1}})}#t(t){let r=this.#e.then(t,t);return this.#e=r.catch(()=>{}),r}async quarantine(t){let r=_e.join(this.directory(),t),n=_e.join(_e.resolve(this.workspaceRoot),".dyyto","observability","quarantine");await Ed(n,{recursive:!0,mode:448}),await Uo(r,_e.join(n,`${Date.now()}-${t}`))}async all(){let t=await Hg(this.directory()).catch(()=>[]),r=[];for(let n of t){if(!n.endsWith(".json")){n.includes(".tmp-")&&await this.quarantine(n).catch(()=>{});continue}try{let i=JSON.parse(await Ji(_e.join(this.directory(),n),"utf8"));if(i.eventId!==n.slice(0,-5))throw new Error("identity mismatch");r.push({...i,correlation:i.correlation??"unknown"})}catch{await this.quarantine(n).catch(()=>{})}}return r.sort((n,i)=>i.occurredAt.localeCompare(n.occurredAt)||n.eventId.localeCompare(i.eventId))}selected(t,r){return t.filter(n=>(!r.applicationId||n.applicationId===r.applicationId)&&(!r.releaseId||n.releaseId===r.releaseId)&&(!r.deploymentId||n.deploymentId===r.deploymentId))}cursor(t,r){let n=C({v:1,offset:t,snapshot:r});return Buffer.from(C({content:n,digest:A(n)})).toString("base64url")}parseCursor(t,r){try{let n=JSON.parse(Buffer.from(t,"base64url").toString("utf8"));if(typeof n.content!="string"||n.digest!==A(n.content))throw new Error("tampered");let i=JSON.parse(n.content);if(i.v!==1||!Number.isSafeInteger(i.offset)||i.offset<0||i.snapshot!==r)throw new Error("expired");return i.offset}catch{throw new oe("OBSERVABILITY_CURSOR_EXPIRED","Runtime Error query cursor is invalid or expired")}}async list(t){let r=Math.max(1,Math.min(t.limit??100,100)),n=this.selected(await this.all(),t),i=A(C(n.map(s=>s.eventId))),a=t.cursor===void 0?0:this.parseCursor(t.cursor,i),o=n.slice(a,a+r);return{events:o,...a+o.length<n.length?{nextCursor:this.cursor(a+o.length,i)}:{}}}async get(t){if(!Yg.test(t))throw new oe("RUNTIME_ERROR_INVALID","Runtime Error eventId is invalid");let r=`${t}.json`;try{let n=JSON.parse(await Ji(_e.join(this.directory(),r),"utf8"));if(n.eventId!==t)throw new Error("identity mismatch");return{...n,correlation:n.correlation??"unknown"}}catch(n){if(n.code==="ENOENT")return null;throw await this.quarantine(r).catch(()=>{}),new oe("OBSERVABILITY_STORE_DAMAGED","Runtime Error record is damaged and has been quarantined")}}async summary(t){let r=this.selected(await this.all(),t),n=new Map;for(let i of r){let a=n.get(i.fingerprint);a?a.count+=1:n.set(i.fingerprint,{count:1,latestAt:i.occurredAt,event:i})}return{total:r.length,groups:[...n.entries()].map(([i,a])=>({fingerprint:i,...a}))}}async rotate(){let t=await this.all(),n=t.reduce((i,a)=>Math.max(i,Date.parse(a.receivedAt)),0)-10080*60*1e3;for(let i of t.slice(1e4))await Jg(_e.join(this.directory(),`${i.eventId}.json`),{force:!0});for(let i of t.slice(0,1e4))Date.parse(i.receivedAt)<n&&await Jg(_e.join(this.directory(),`${i.eventId}.json`),{force:!0})}async registerSourceMap(t){if(!bd.test(t.releaseId)||!bd.test(t.assetDigest)||!/^[A-Za-z0-9._/-]+\.js$/.test(t.asset)||t.asset.includes("..")||!Yi(t.map)||"sourcesContent"in t.map)throw new oe("RUNTIME_ERROR_INVALID","Source Map registration is invalid or contains sourcesContent");let r=Buffer.from(C(t.map)),n=A(r),i=_e.join(this.releases(),t.releaseId);await Ed(i,{recursive:!0,mode:448});let a=A(t.asset),o=_e.join(i,`${a}.json`),s={releaseId:t.releaseId,asset:t.asset,assetDigest:t.assetDigest,mapDigest:n,registeredAt:t.registeredAt},c=await Vo(`${o}.tmp`,"w",384);try{await c.writeFile(`${C({registration:s,map:t.map})}
|
|
17
|
+
`),await c.sync()}finally{await c.close()}return await Uo(`${o}.tmp`,o),await this.resymbolicate(t.releaseId),s}async resymbolicate(t){let r=await Hg(_e.join(this.releases(),t)).catch(()=>[]),n=[];for(let i of r)try{n.push(JSON.parse(await Ji(_e.join(this.releases(),t,i),"utf8")))}catch{}for(let i of(await this.all()).filter(a=>a.releaseId===t&&a.state==="map-missing")){let a=!1,o=i.error.frames.map(d=>{let f=n.find(p=>new URL(d.file,"http://local").pathname.endsWith(`/${p.registration.asset}`));if(!f||d.line===void 0||d.column===void 0)return d;try{let p=Wg(new Kg(f.map),{line:d.line,column:Math.max(0,d.column-1)});return p.source===null||p.line===null||p.column===null?d:(a=!0,{...d,source:p.source.replace(/^file:\/\//,""),sourceLine:p.line,sourceColumn:p.column+1})}catch{return d}});if(!a)continue;let s={...i,error:{...i.error,frames:o},state:"symbolicated"},c=_e.join(this.directory(),`${i.eventId}.json`),l=await Vo(`${c}.tmp`,"w",384);try{await l.writeFile(`${C(s)}
|
|
18
|
+
`),await l.sync()}finally{await l.close()}await Uo(`${c}.tmp`,c)}}};var Zg=rr(Vr(),1);var sO={$id:"https://schemas.dyyto.dev/platform/solution-catalog-entry-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","solutionId","version","integrity","title","summary","maturity","members","integration","exit"],properties:{schemaVersion:{const:1},solutionId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128},integrity:{type:"string",pattern:It},title:{type:"string",minLength:1,maxLength:80},summary:{type:"string",minLength:1,maxLength:240},maturity:{enum:["guided","automated"]},members:{type:"array",minItems:1,maxItems:32,items:{type:"object",additionalProperties:!1,required:["capabilityId","version","role","required"],properties:{capabilityId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128},role:{type:"string",minLength:1,maxLength:80},required:{type:"boolean"}}}},integration:{type:"object",additionalProperties:!1,required:["prerequisites","steps","verification","result"],properties:{prerequisites:{type:"array",minItems:1,maxItems:16,items:{type:"string",minLength:1,maxLength:200}},steps:{type:"array",minItems:1,maxItems:32,items:{type:"object",additionalProperties:!1,required:["label","command"],properties:{label:{type:"string",minLength:1,maxLength:80},command:{type:"string",minLength:1,maxLength:2e3}}}},verification:{type:"array",minItems:1,maxItems:32,items:{type:"string",minLength:1,maxLength:1e3}},result:{type:"string",minLength:1,maxLength:400}}},exit:{type:"object",additionalProperties:!1,required:["summary"],properties:{summary:{type:"string",minLength:1,maxLength:400}}}}},NU=new Zg.Ajv2020({allErrors:!0,strict:!0}).compile(sO);var ey=rr(Vr(),1);var Xg="^[a-z0-9]+(?:[.-][a-z0-9]+)*$",Qg="^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\)[^\\u0000]+$",cO={$id:"https://schemas.dyyto.dev/platform/example-recipe-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","recipeId","version","integrity","title","locale","rootProfile","capabilities","expectedEntrypoint","verifiers","manualAcceptance","cleanup"],properties:{schemaVersion:{const:1},recipeId:{type:"string",pattern:Xg},version:{type:"string",minLength:1,maxLength:128},integrity:{type:"string",pattern:It},title:{type:"string",minLength:1,maxLength:80},locale:{const:"zh-CN"},rootProfile:{type:"object",additionalProperties:!1,required:["capabilityId","version"],properties:{capabilityId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128}}},capabilities:{type:"array",minItems:1,maxItems:16,items:{type:"object",additionalProperties:!1,required:["capabilityId","version","channel"],properties:{capabilityId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128},channel:{const:"development"}}}},expectedEntrypoint:{type:"string",pattern:Qg,maxLength:240},verifiers:{type:"array",minItems:1,maxItems:16,uniqueItems:!0,items:{type:"string",pattern:Xg}},manualAcceptance:{type:"array",minItems:1,maxItems:32,items:{type:"string",minLength:1,maxLength:240}},cleanup:{type:"object",additionalProperties:!1,required:["ownedStateDirectories"],properties:{ownedStateDirectories:{type:"array",maxItems:8,uniqueItems:!0,items:{type:"string",pattern:Qg,maxLength:240}}}}}},CU=new ey.Ajv2020({allErrors:!0,strict:!0}).compile(cO);var ty=rr(Vr(),1);var lO={$id:"https://schemas.dyyto.dev/platform/engineering-template-release-v1.json",type:"object",additionalProperties:!1,required:["schemaVersion","templateId","version","integrity","title","summary","status","profile","parameters","commands","technology","support","integration","metrics"],properties:{schemaVersion:{const:1},templateId:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:128},integrity:{type:"string",pattern:It},title:{type:"string",minLength:1,maxLength:80},summary:{type:"string",minLength:1,maxLength:240},status:{enum:["candidate","recommended","deprecated"]},profile:{type:"object",additionalProperties:!1,required:["id","capability"],properties:{id:{type:"string",pattern:Y},capability:{type:"string",pattern:`${Y.slice(1,-1)}@[0-9]+\\.[0-9]+\\.[0-9]+$`}}},parameters:{type:"array",minItems:0,maxItems:32,items:{type:"object",additionalProperties:!1,required:["id","required","description"],properties:{id:{type:"string",pattern:"^[a-z][A-Za-z0-9]*$"},required:{type:"boolean"},description:{type:"string",minLength:1,maxLength:160}}}},commands:{type:"object",minProperties:1,additionalProperties:!1,properties:{dev:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"},build:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"},test:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"},package:{type:"string",pattern:"^[a-z][a-z0-9.:-]*$"}}},technology:{type:"array",minItems:1,maxItems:32,items:{type:"object",additionalProperties:!1,required:["id","version","policy","verifiedAt","rationale","alternative","exit"],properties:{id:{type:"string",pattern:Y},version:{type:"string",minLength:1,maxLength:64},policy:{enum:["recommended","allowed"]},verifiedAt:{type:"string",format:"date"},rationale:{type:"string",minLength:1,maxLength:240},alternative:{type:"string",minLength:1,maxLength:160},exit:{type:"string",minLength:1,maxLength:240}}}},support:{type:"object",additionalProperties:!1,required:["owner","tier","supportedFrom","supportedUntil","upgradeCadence","eolNoticeDays"],properties:{owner:{type:"string",pattern:Y},tier:{const:"production"},supportedFrom:{type:"string",format:"date"},supportedUntil:{type:"string",format:"date"},upgradeCadence:{type:"string",minLength:1,maxLength:80},eolNoticeDays:{type:"integer",minimum:30,maximum:730}}},integration:{type:"object",additionalProperties:!1,required:["prerequisites","createCommand","result"],properties:{prerequisites:{type:"array",minItems:1,maxItems:16,items:{type:"string",minLength:1,maxLength:200}},createCommand:{type:"string",minLength:1,maxLength:2e3},result:{type:"string",minLength:1,maxLength:400}}},metrics:{type:"array",minItems:1,uniqueItems:!0,items:{enum:["time-to-green-build","time-to-first-business-commit","manual-engineering-edits","upgrade-conflicts"]}}}},LU=new ty.Ajv2020({allErrors:!0,strict:!0,formats:{date:/^\d{4}-\d{2}-\d{2}$/}}).compile(lO);var rt=class extends Error{code;constructor(t){super(t),this.code=t,this.name="PlatformPackageSourceError"}},iy=["dependencies","devDependencies","optionalDependencies","peerDependencies"],dO=/^(?:file:|link:|portal:|git(?:\+|:)|https?:|ssh:|github:)/u,fO=/^@[a-z0-9][a-z0-9._-]*\/$/u;function zo(e){return e.startsWith("workspace:")?"workspace":dO.test(e)?"other":"registry"}function Bo(e){if(!fO.test(e.scope))throw new rt("PLATFORM_PACKAGE_SCOPE_INVALID");let t=[];for(let n of e.manifests){let i;try{i=JSON.parse(Buffer.from(n.bytes).toString("utf8"))}catch{throw new rt("PLATFORM_PACKAGE_MANIFEST_INVALID")}if(i===null||typeof i!="object"||Array.isArray(i))throw new rt("PLATFORM_PACKAGE_MANIFEST_INVALID");for(let a of iy){let o=i[a];if(o!==void 0){if(typeof o!="object"||o===null||Array.isArray(o))throw new rt("PLATFORM_PACKAGE_MANIFEST_INVALID");for(let[s,c]of Object.entries(o))if(s.startsWith(e.scope)){if(typeof c!="string"||c.trim()==="")throw new rt("PLATFORM_PACKAGE_MANIFEST_INVALID");t.push(Object.freeze({importer:n.relativeRoot,field:a,packageName:s,specifier:c,source:zo(c)}))}}}}t.sort((n,i)=>n.importer.localeCompare(i.importer)||n.field.localeCompare(i.field)||n.packageName.localeCompare(i.packageName));let r=e.required??null;return Object.freeze({scope:e.scope,required:r,references:Object.freeze(t),violations:Object.freeze(r===null?[]:t.filter(n=>n.source!==r))})}var pO=/^(?:workspace:[*^~]?|(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?)$/u;function ry(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function ny(e){let t;try{t=JSON.parse(Buffer.from(e).toString("utf8"))}catch{throw new rt("PLATFORM_PACKAGE_MANIFEST_INVALID")}if(t===null||typeof t!="object"||Array.isArray(t))throw new rt("PLATFORM_PACKAGE_MANIFEST_INVALID");return t}function ay(e){let t=Bo({manifests:[{relativeRoot:".",bytes:e.manifest}],scope:e.scope}).references;for(let c of Object.values(e.specifiers))if(!pO.test(c))throw new rt("PLATFORM_PACKAGE_SPECIFIER_INVALID");if(t.filter(c=>e.specifiers[c.packageName]===void 0).length>0)throw new rt("PLATFORM_PACKAGE_SPECIFIER_INVALID");let n=t.filter(c=>e.specifiers[c.packageName]!==c.specifier).map(c=>Object.freeze({field:c.field,packageName:c.packageName,from:c.specifier,to:e.specifiers[c.packageName]}));if(n.length===0)return Object.freeze({scope:e.scope,changes:Object.freeze([]),manifest:e.manifest});let i=ny(e.manifest),a=Buffer.from(e.manifest).toString("utf8");for(let c of new Map(n.map(l=>[`${l.packageName}\0${l.from}`,l])).values())a=a.replace(new RegExp(`("${ry(JSON.stringify(c.packageName).slice(1,-1))}"\\s*:\\s*")${ry(c.from)}(")`,"gu"),`$1${c.to}$2`);let o={...i};for(let c of iy){let l=i[c];l!==void 0&&(o[c]=Object.fromEntries(Object.entries(l).map(([d,f])=>[d,d.startsWith(e.scope)?e.specifiers[d]:f])))}let s=new TextEncoder().encode(a);if(JSON.stringify(ny(s))!==JSON.stringify(o))throw new rt("PLATFORM_PACKAGE_REWRITE_UNSAFE");return Object.freeze({scope:e.scope,changes:Object.freeze(n),manifest:s})}function oy(e){let t=new Map(e.projection.locked.map(a=>[`${a.capabilityId}@${a.version}`,a])),r=new Set(e.projection.verified.map(a=>`${a.capabilityId}@${a.version}`)),n=e.projection.declared.map(a=>{let o=`${a.capabilityId}@${a.version}`,s=e.releases.find(d=>`${d.capabilityId}@${d.version}`===o),c=t.get(o),l=r.has(o)?"verified":c?"locked":"declared";return Object.freeze({capabilityId:a.capabilityId,version:a.version,status:l,title:s?.integration?.title??a.capabilityId,purpose:s?.integration?.purpose??"\u8BE5\u53D1\u884C\u7248\u5C1A\u672A\u58F0\u660E\u6280\u672F\u96C6\u6210\u5143\u6570\u636E\u3002",packages:Object.freeze((s?.integration?.packages??[]).map(d=>{let f=e.dependencies?.[d.packageName]??e.hostDependencies?.[d.packageName]??null,p=e.dependencies?.[d.packageName]===void 0&&e.hostDependencies?.[d.packageName]!==void 0;return Object.freeze({...d,imports:Object.freeze(d.imports.map(u=>Object.freeze({...u}))),installedVersion:f,state:p?"provided-by-platform":f===null?"missing":f===d.version||d.version==="workspace:*"?"matched":zo(f)==="workspace"?"local-workspace":"version-mismatch"})})),codeAssets:Object.freeze((s?.integration?.codeAssets??[]).map(d=>Object.freeze({...d}))),evidenceIds:Object.freeze([...c?.evidenceIds??[]])})}),i=new Set(n.flatMap(a=>a.packages.filter(o=>o.state==="matched"||o.state==="local-workspace").map(o=>o.packageName)));return Object.freeze({...e.projection,platformDependencies:Object.freeze(e.projection.platformDependencies.filter(a=>!i.has(a.packageName))),details:Object.freeze(n),findings:Object.freeze(n.flatMap(a=>a.packages.filter(o=>o.state!=="matched"&&o.state!=="provided-by-platform").map(o=>({code:o.state==="missing"?"INTEGRATION_PACKAGE_MISSING":o.state==="local-workspace"?"INTEGRATION_PACKAGE_SOURCE_LOCAL":"INTEGRATION_PACKAGE_VERSION_MISMATCH",capabilityId:a.capabilityId,packageName:o.packageName,expected:o.version,actual:o.installedVersion}))))})}var zt=class extends Error{code;constructor(t,r){super(r),this.code=t}};function sy(e){if(e===null||typeof e!="object")throw new zt("PROJECT_PROCESS_IDENTITY_MISMATCH","Managed process snapshot is invalid");let t=e;if(t.schemaVersion!==1||typeof t.processId!="string"||t.processId.length<1||typeof t.projectRoot!="string"||t.command!=="dev"||!Number.isSafeInteger(t.pid)||t.pid<1||typeof t.startedAt!="string"||Number.isNaN(Date.parse(t.startedAt))||typeof t.logPath!="string"||t.logOffset!==void 0&&(!Number.isSafeInteger(t.logOffset)||t.logOffset<0))throw new zt("PROJECT_PROCESS_IDENTITY_MISMATCH","Managed process snapshot is invalid");return Object.freeze(t)}function cy(e){let t=e.manifest,r=Array.isArray(t?.capabilities)?t.capabilities.filter(s=>s!==null&&typeof s=="object"&&typeof s.capabilityId=="string"&&typeof s.version=="string").map(s=>Object.freeze({capabilityId:s.capabilityId,version:s.version})):[],n=e.lock,i=Array.isArray(n?.capabilities)?n.capabilities.filter(s=>s!==null&&typeof s=="object"&&typeof s.capabilityId=="string"&&typeof s.version=="string").map(s=>Object.freeze({capabilityId:s.capabilityId,version:s.version,...Array.isArray(s.evidenceIds)?{evidenceIds:Object.freeze([...s.evidenceIds])}:{}})):[],a=Object.entries(e.dependencies??{}).filter(([s])=>s.startsWith("@aipt/")).sort(([s],[c])=>s.localeCompare(c)).map(([s,c])=>Object.freeze({packageName:s,version:c,state:"unmanaged",source:zo(c)})),o=t?.template!==void 0&&typeof t.template.id=="string"&&typeof t.template.version=="string"?Object.freeze({id:t.template.id,version:t.template.version}):null;return Object.freeze({template:o,declared:Object.freeze(r),locked:Object.freeze(i),verified:Object.freeze(i.filter(s=>(s.evidenceIds?.length??0)>0)),platformDependencies:Object.freeze(a)})}var nt=class extends Error{code;constructor(t){super(t),this.code=t}},uO=/^@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$/u,ly=/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/u,hO=/^sha512-[A-Za-z0-9+/]{86}==$/u,qo=/^sha256:[a-f0-9]{64}$/u,mO=/^[a-z0-9][a-z0-9._-]{1,214}\.tgz$/u,gO=/^(?:workspace:|file:|link:|git(?:\+|:)|https?:|ssh:|github:)/u,yO=new Set(["preinstall","install","postinstall","prepublish","prepare"]);function qr(e,t){let r=Object.keys(e).sort(),n=[...t].sort();return r.length===n.length&&r.every((i,a)=>i===n[a])}function wO(e){if(!qr(e,["packageName","version","assetName","integrity","tarballDigest","dependencies","lifecycleScripts"])||!uO.test(e.packageName)||!ly.test(e.version)||!mO.test(e.assetName)||!hO.test(e.integrity)||!qo.test(e.tarballDigest)||typeof e.dependencies!="object"||e.dependencies===null||Array.isArray(e.dependencies)||e.lifecycleScripts.length>0)return!1;let t=Object.entries(e.dependencies);return t.length>256||t.some(([r,n])=>!/^(@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u.test(r)||!ly.test(n)||gO.test(n))?!1:e.lifecycleScripts.every(r=>yO.has(r))}function Ad(e){if(!qr(e,["artifacts"])||e.artifacts.length===0||e.artifacts.length>128)throw new nt("LOCAL_ARTIFACT_BUNDLE_INVALID");let t=e.artifacts.map(a=>Object.freeze({...a,dependencies:Object.freeze({...a.dependencies}),lifecycleScripts:Object.freeze([...a.lifecycleScripts])}));if(t.some(a=>!wO(a)))throw new nt("LOCAL_ARTIFACT_POLICY_VIOLATION");let r=t.map(a=>a.packageName+"@"+a.version);if(new Set(r).size!==r.length||r.some((a,o)=>o>0&&a.localeCompare(r[o-1])<=0))throw new nt("LOCAL_ARTIFACT_BUNDLE_INVALID");let n=new Set(t.map(a=>a.packageName));for(let a of t)for(let[o,s]of Object.entries(a.dependencies))if(o.startsWith("@aipt/")&&(!n.has(o)||!t.some(c=>c.packageName===o&&c.version===s)))throw new nt("LOCAL_ARTIFACT_POLICY_VIOLATION");let i={schemaVersion:1,channel:"development",artifacts:t};return Object.freeze({...i,bundleId:A(C(i))})}function Rd(e){let t=e;if(typeof t!="object"||t===null||!qr(t,["schemaVersion","bundleId","channel","artifacts"])||t.schemaVersion!==1||t.channel!=="development"||!qo.test(t.bundleId)||!Array.isArray(t.artifacts))throw new nt("LOCAL_ARTIFACT_BUNDLE_INVALID");if(Ad({artifacts:t.artifacts}).bundleId!==t.bundleId)throw new nt("LOCAL_ARTIFACT_BUNDLE_INVALID");return t}function kd(e){if(!qr(e,["packageInputs","bundle","generatedAt","expiresAt"])||e.packageInputs.length!==e.bundle.artifacts.length||e.packageInputs.length===0||Number.isNaN(Date.parse(e.generatedAt))||Number.isNaN(Date.parse(e.expiresAt))||Date.parse(e.expiresAt)<=Date.parse(e.generatedAt))throw new nt("LOCAL_ARTIFACT_PLAN_INVALID");let t=e.packageInputs.map(i=>Object.freeze({...i}));if(t.some(i=>!qr(i,["relativeRoot","manifestDigest"])||!/^(?:packages|fixtures)\/[a-z0-9][a-z0-9._-]{1,127}$/u.test(i.relativeRoot)||!qo.test(i.manifestDigest))||new Set(t.map(i=>i.relativeRoot)).size!==t.length)throw new nt("LOCAL_ARTIFACT_PLAN_INVALID");let r=Rd(e.bundle),n={schemaVersion:1,state:"awaiting-approval",packageInputs:t,bundle:r,targetPreimage:{kind:"absent"},generatedAt:e.generatedAt,expiresAt:e.expiresAt};return Object.freeze({...n,planId:A(C(n))})}function dy(e){let t=e;if(typeof t!="object"||t===null||!qr(t,["schemaVersion","planId","state","packageInputs","bundle","targetPreimage","generatedAt","expiresAt"])||t.schemaVersion!==1||t.state!=="awaiting-approval"||!qo.test(t.planId)||!qr(t.targetPreimage,["kind"])||t.targetPreimage.kind!=="absent")throw new nt("LOCAL_ARTIFACT_PLAN_INVALID");if(kd({packageInputs:t.packageInputs,bundle:t.bundle,generatedAt:t.generatedAt,expiresAt:t.expiresAt}).planId!==t.planId)throw new nt("LOCAL_ARTIFACT_PLAN_INVALID");return t}var Xi={DEPENDENCIES_NOT_INSTALLED:4,VERIFIER_RUNTIME_INVALID:4},_O=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/u;function fy(e,t){return typeof e=="string"&&e.length>0&&e.length<=t&&!_O.test(e)}function IO(e){let t={schemaVersion:1,kind:"dyyto-cli-domain-error",code:e.code,message:e.message,exitCode:Xi[e.code],...e.nextStep===void 0?{}:{nextStep:e.nextStep}},r=vO(t);if(r===null)throw new TypeError("CLI domain error input is invalid");return r}function vO(e){try{if(typeof e!="object"||e===null||Object.getPrototypeOf(e)!==Object.prototype)return null;let t=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(t).some(s=>typeof s=="symbol"))return null;let r=Object.keys(t).sort(),n="nextStep"in t?["code","exitCode","kind","message","nextStep","schemaVersion"]:["code","exitCode","kind","message","schemaVersion"];if(r.length!==n.length||r.some((s,c)=>s!==n[c])||Object.values(t).some(s=>!("value"in s)))return null;let i=s=>t[s]?.value,a=i("code");if(i("schemaVersion")!==1||i("kind")!=="dyyto-cli-domain-error"||typeof a!="string"||!(a in Xi)||i("exitCode")!==Xi[a]||!fy(i("message"),500))return null;let o=i("nextStep");return o!==void 0&&!fy(o,500)?null:Object.freeze({schemaVersion:1,kind:"dyyto-cli-domain-error",code:a,message:i("message"),exitCode:4,...o===void 0?{}:{nextStep:o}})}catch{return null}}var On=class extends Error{code;exitCode;nextStep;domainError;constructor(t){super(t.message),this.name="CliError",this.code=t.code,this.exitCode=t.exitCode,this.nextStep=t.nextStep,this.domainError=t.code in Xi&&t.exitCode===Xi[t.code]?IO({code:t.code,message:t.message,...t.nextStep===void 0?{}:{nextStep:t.nextStep}}):void 0}};var Rt=64*1024;function py(e,t,r){return new Promise((n,i)=>{let a=new Date().toISOString(),o={...At.env,CI:"1",NO_COLOR:"1",pnpm_config_verify_deps_before_run:"false"};delete o.npm_config_user_agent;let s=uy(e,t,{cwd:r,env:o,stdio:["ignore","pipe","pipe"]}),c=[],l=[];s.stdout.on("data",d=>c.push(Buffer.from(d))),s.stderr.on("data",d=>l.push(Buffer.from(d))),s.on("error",i),s.on("close",d=>n({exitCode:d??1,startedAt:a,completedAt:new Date().toISOString(),stdout:Buffer.concat(c).subarray(0,Rt),stderr:Buffer.concat(l).subarray(0,Rt)}))})}async function hy(){return new Promise((e,t)=>{let r=EO();r.once("error",t),r.listen(0,"127.0.0.1",()=>{let n=r.address();if(n===null||typeof n=="string")return t(new Error("Unable to allocate preview port"));r.close(i=>i===void 0?e(n.port):t(i))})})}async function AO(e,t){let r=new Date().toISOString(),n=await hy(),i=[],a=[],o;try{let s=me.resolve(me.dirname(e),"../dist/node/index.js"),l=await(await import(bO(s).href)).preview({root:t,logLevel:"silent",preview:{host:"127.0.0.1",port:n,strictPort:!0}});o=()=>l.close();let d=await fetch(`http://127.0.0.1:${n}/`);if(!d.ok)throw new Error("Production preview did not become ready");let f=await d.text(),p=f.match(/<script[^>]+src="([^"]+)"/)?.[1];if(!f.includes('<html lang="zh-CN">')||!f.includes("data-application-shell")||p===void 0)throw new Error("Production HTML contract is missing");let u=await fetch(new URL(p,`http://127.0.0.1:${n}/`));if(!u.ok||(await u.text()).length===0)throw new Error("Production entry asset is unavailable");return i.push(Buffer.from(JSON.stringify({smoke:"passed",transport:"http-preview"}))),{exitCode:0,startedAt:r,completedAt:new Date().toISOString(),stdout:Buffer.concat(i).subarray(0,Rt),stderr:Buffer.concat(a).subarray(0,Rt)}}catch(s){return a.push(Buffer.from(s instanceof Error?s.message:"Web application smoke failed")),{exitCode:1,startedAt:r,completedAt:new Date().toISOString(),stdout:Buffer.concat(i).subarray(0,Rt),stderr:Buffer.concat(a).subarray(0,Rt)}}finally{await o?.()}}async function RO(e){let t=new Date().toISOString(),r=await hy(),n=[],i=[],a=[me.join(e,".artifacts","standalone","server.js"),me.join(e,".next","standalone","server.js"),me.join(e,".next","standalone","apps",me.basename(e),"server.js")],o=(await Promise.all(a.map(async c=>await Qi(c).then(l=>l.isFile()?c:null).catch(()=>null)))).find(c=>c!==null);if(o===void 0)return{exitCode:1,startedAt:t,completedAt:new Date().toISOString(),stdout:Buffer.alloc(0),stderr:Buffer.from("Standalone server entry is unavailable")};let s=uy(At.execPath,[o],{cwd:me.dirname(o),env:{...At.env,CI:"1",NO_COLOR:"1",HOSTNAME:"127.0.0.1",PORT:String(r)},stdio:["ignore","pipe","pipe"]});s.stdout.on("data",c=>n.push(Buffer.from(c))),s.stderr.on("data",c=>i.push(Buffer.from(c))),s.on("error",c=>i.push(Buffer.from(c.message)));try{let c=Date.now()+3e4,l;for(;Date.now()<c;){if(s.exitCode!==null)throw new Error("Standalone server exited before readiness");try{if(l=await fetch(`http://127.0.0.1:${r}/api/health`),l.ok)break}catch{}await new Promise(u=>setTimeout(u,150))}let d=l===void 0?null:await l.json().catch(()=>null);if(l===void 0||!l.ok||d?.status!=="ok")throw new Error("Standalone health contract failed");let f=await fetch(`http://127.0.0.1:${r}/`),p=await f.text();if(!f.ok||!p.includes('lang="zh-CN"'))throw new Error("Standalone page contract failed");return n.push(Buffer.from(JSON.stringify({smoke:"passed",transport:"next-standalone"}))),{exitCode:0,startedAt:t,completedAt:new Date().toISOString(),stdout:Buffer.concat(n).subarray(0,Rt),stderr:Buffer.concat(i).subarray(0,Rt)}}catch(c){return i.push(Buffer.from(c instanceof Error?c.message:"Next.js standalone smoke failed")),{exitCode:1,startedAt:t,completedAt:new Date().toISOString(),stdout:Buffer.concat(n).subarray(0,Rt),stderr:Buffer.concat(i).subarray(0,Rt)}}finally{s.exitCode===null&&(s.kill("SIGTERM"),await new Promise(c=>s.once("close",()=>c())))}}async function Go(e){let t=await Qi(e).catch(()=>null);if(t===null||!t.isFile()&&!t.isSymbolicLink())throw new On({code:"DEPENDENCIES_NOT_INSTALLED",message:"\u9879\u76EE\u4F9D\u8D56\u5C1A\u672A\u5B89\u88C5\u3002",exitCode:4,nextStep:"\u8BF7\u5728\u9879\u76EE\u76EE\u5F55\u8FD0\u884C corepack pnpm install\uFF0C\u7136\u540E\u518D\u6B21\u8FD0\u884C dyyto verify\u3002"})}async function kO(e){let t=me.join(e.projectRoot,"node_modules","typescript","bin","tsc"),r=me.join(e.projectRoot,"node_modules","vitest","vitest.mjs"),n=me.join(e.projectRoot,"node_modules","vite","bin","vite.js"),i=me.join(e.projectRoot,"node_modules","next","dist","bin","next"),a=e.release.release.verifiers.some(({id:p})=>p!=="workspace.structure"&&p!=="capability.assets"&&p!=="application.config-contract");a&&(await Go(t),await Go(r),(e.release.release.consumerProfile==="workspace-web-application"||e.release.release.consumerProfile==="react-component-library")&&await Go(n),e.release.release.consumerProfile==="nextjs-full-stack-application"&&await Go(i));let o=JSON.parse(await Dn(me.join(e.projectRoot,"package.json"),"utf8")),s=a?await py(At.execPath,[t,"--version"],e.projectRoot):null;if(s!==null&&s.exitCode!==0)throw new On({code:"VERIFIER_RUNTIME_INVALID",message:"\u5DF2\u5B89\u88C5\u7684 TypeScript \u9A8C\u8BC1\u5668\u65E0\u6CD5\u62A5\u544A\u7248\u672C\u3002",exitCode:4,nextStep:"\u8BF7\u68C0\u67E5\u9879\u76EE\u4F9D\u8D56\u5B8C\u6574\u6027\uFF0C\u91CD\u65B0\u5B89\u88C5\u540E\u518D\u6B21\u8FD0\u884C dyyto verify\u3002"});let c={node:At.version.replace(/^v/,""),pnpm:String(o.packageManager).replace(/^pnpm@/,""),typescript:s===null?e.release.release.compatibility.typescript:s.stdout.toString("utf8").replace(/^Version\s+/,"").trim()},l=await xo({projectRoot:e.projectRoot,expectedAssets:e.expectedAssets}),d={"typescript.typecheck":{executable:At.execPath,args:[t,"--noEmit","-p","tsconfig.json"]},"vitest.run":{executable:At.execPath,args:[r,"run","--testTimeout","15000"]},"typescript.build":{executable:At.execPath,args:[t,"-p","tsconfig.build.json"]},"npm.pack-dry-run":{executable:"npm",args:["pack","--dry-run","--json","--ignore-scripts"]},"workspace.structure":null,"capability.assets":null,"node.application-smoke":{executable:At.execPath,args:[me.join(e.projectRoot,"dist","index.js"),"--smoke"]},"web.application-build":{executable:"corepack",args:["pnpm","run","build"]},"web.application-smoke":null,"expo.application-config":{executable:"corepack",args:["pnpm","exec","expo","config","--type","public"]},"expo.application-export":{executable:"corepack",args:["pnpm","run","package"]},"react.library-build":{executable:"corepack",args:["pnpm","run","verify:bundle"]},"next.application-test":{executable:"corepack",args:["pnpm","run","test"]},"next.application-build":{executable:"corepack",args:["pnpm","run","build"]},"next.application-package":{executable:"corepack",args:["pnpm","run","package"]},"next.application-smoke":null,"application.config-contract":null},f=[];for(let p of e.release.release.verifiers){let u=d[p.id],h=new Date().toISOString(),m=p.id==="application.config-contract"?await Promise.all([Dn(me.join(e.projectRoot,"config","application-config.json"),"utf8"),Dn(me.join(e.projectRoot,"project-capabilities.json"),"utf8")]).then(([g,y])=>{try{return vd(JSON.parse(g),JSON.parse(y)),{exitCode:0,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.from("Application ConfigContract \u4E0E Project Manifest \u4E00\u81F4"),stderr:Buffer.alloc(0)}}catch(_){return{exitCode:1,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.alloc(0),stderr:Buffer.from(_ instanceof Error?_.message:"Application ConfigContract \u6821\u9A8C\u5931\u8D25")}}}).catch(g=>({exitCode:1,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.alloc(0),stderr:Buffer.from(g instanceof Error?g.message:"Application ConfigContract \u4E0D\u53EF\u7528")})):p.id==="web.application-smoke"?await AO(n,e.projectRoot):p.id==="next.application-smoke"?await RO(e.projectRoot):p.id==="workspace.structure"?await Dn(me.join(e.projectRoot,"package.json"),"utf8").then(async g=>{if(e.release.release.assets.find(({path:S})=>S==="package.json")?.ownership==="seed-file"){let S=e.expectedAssets.find(({path:R})=>R==="package.json");if(S!==void 0){let R=S.ownership==="seed-file"&&S.digest===A(g);return{exitCode:R?0:1,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.from(R?"Workspace seed Manifest \u4E0E\u6279\u51C6 Plan \u4E00\u81F4":""),stderr:Buffer.from(R?"":"Workspace seed Manifest \u4E0E\u6279\u51C6 Plan \u4E0D\u4E00\u81F4")}}try{let R=me.join(e.projectRoot,"pnpm-workspace.yaml"),[P,x,B]=await Promise.all([Qi(me.join(e.projectRoot,"package.json")),Qi(R),Dn(R,"utf8")]),k=JSON.parse(g),he=P.isFile()&&!P.isSymbolicLink()&&x.isFile()&&!x.isSymbolicLink()&&typeof k=="object"&&k!==null&&!Array.isArray(k)&&k.private===!0&&/^\s*packages\s*:/mu.test(B);return{exitCode:he?0:1,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.from(he?"Retrofit Workspace \u7ED3\u6784\u6709\u6548":""),stderr:Buffer.from(he?"":"Retrofit Workspace \u7ED3\u6784\u65E0\u6548")}}catch{return{exitCode:1,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.alloc(0),stderr:Buffer.from("Retrofit Workspace \u7ED3\u6784\u65E0\u6548")}}}let _=JSON.parse(g).scripts??{},b=e.release.contents.get("package.json"),E=b===void 0?{}:JSON.parse(Buffer.from(b).toString("utf8")).scripts??{},I=Object.entries(E).filter(([S,R])=>typeof R!="string"||_[S]!==R).map(([S])=>S);return{exitCode:I.length===0?0:1,startedAt:h,completedAt:new Date().toISOString(),stdout:Buffer.from(I.length===0?"workspace release scripts matched":""),stderr:Buffer.from(I.length===0?"":`workspace release scripts mismatched: ${I.join(",")}`)}}):u===null?{exitCode:0,startedAt:h,completedAt:h,stdout:Buffer.from("capability assets matched"),stderr:Buffer.alloc(0)}:await py(u.executable,[...u.args],e.projectRoot);f.push({schemaVersion:1,verifierId:p.id,result:m.exitCode===0?"passed":"failed",issuer:"dyyto-cli",commandId:p.id,exitCode:m.exitCode,stdoutDigest:A(m.stdout),stderrDigest:A(m.stderr),startedAt:m.startedAt,completedAt:m.completedAt,projectStateDigest:l.projectStateDigest,runtime:c})}return{results:f,summaries:f.map(({verifierId:p,result:u})=>({verifierId:p,result:u}))}}async function SO(e){for(let o of e.removedPaths)if(await Qi(me.join(e.projectRoot,...o.split("/"))).then(()=>!0).catch(s=>s.code==="ENOENT"?!1:Promise.reject(s)))throw new On({code:"VERIFICATION_STATE_INVALID",message:"\u5F85\u79FB\u9664\u8D44\u4EA7\u4ECD\u7136\u5B58\u5728\u3002",exitCode:4,nextStep:"\u8FD0\u884C dyyto inspect \u68C0\u67E5\u9879\u76EE\u6F02\u79FB\u3002"});let t=await xo({projectRoot:e.projectRoot,expectedAssets:e.remainingAssets}),r=JSON.parse(await Dn(me.join(e.projectRoot,"package.json"),"utf8")),n={node:At.version.replace(/^v/,""),pnpm:String(r.packageManager).replace(/^pnpm@/,""),typescript:e.release.release.compatibility.typescript},i=new Date().toISOString(),a=e.release.release.verifiers.map(o=>({schemaVersion:1,verifierId:o.id,result:"passed",issuer:"dyyto-cli",commandId:o.id,exitCode:0,stdoutDigest:A(Buffer.from("removal absence verified")),stderrDigest:A(Buffer.alloc(0)),startedAt:i,completedAt:i,projectStateDigest:t.projectStateDigest,runtime:n}));return{results:a,summaries:a.map(o=>({verifierId:o.verifierId,result:o.result}))}}import{execFile as Tj}from"node:child_process";import{mkdtemp as Hs,mkdir as jj,lstat as Lj,readFile as Va,readdir as aE,realpath as Js,rm as Ys,writeFile as Kp}from"node:fs/promises";import{tmpdir as Zs}from"node:os";import le from"node:path";import{promisify as $j}from"node:util";var Mj=$j(Tj),Je="https://registry.npmjs.org",Ma="node:24.18.0-alpine",_t=class extends Error{constructor(r,n,i){super("Delivery command failed");this.executable=r;this.code=n;this.stderrText=i}executable;code;stderrText};function Vj(e,t=process.env){let r=["PATH","TMPDIR","TEMP","TMP","COREPACK_HOME","CI","GITHUB_ACTIONS","GITHUB_REPOSITORY","GITHUB_WORKFLOW","GITHUB_WORKFLOW_REF","GITHUB_REF","GITHUB_ENVIRONMENT","RUNNER_ENVIRONMENT","ACTIONS_ID_TOKEN_REQUEST_URL","ACTIONS_ID_TOKEN_REQUEST_TOKEN","GITLAB_CI","CI_SERVER_HOST","CI_PROJECT_PATH","CI_CONFIG_PATH","CI_COMMIT_REF_NAME","CI_ENVIRONMENT_NAME","NPM_ID_TOKEN"],n={HOME:e,NO_COLOR:"1",NPM_CONFIG_USERCONFIG:le.join(e,".npmrc"),NPM_CONFIG_REGISTRY:Je,NPM_CONFIG_PROVENANCE:"true",pnpm_config_verify_deps_before_run:"false"};for(let i of r)t[i]!==void 0&&(n[i]=t[i]);return n}var oE={async run(e,t,r){let n=await Hs(le.join(await Js(Zs()),"dyyto-command-home-"));try{let i=le.join(n,".npmrc");await Kp(i,`registry=https://registry.npmjs.org
|
|
19
19
|
provenance=true
|
|
20
|
-
`,{mode:384});let a=Vj(n);return await Mj(e,t,{cwd:r.cwd,timeout:r.timeout,maxBuffer:1024*1024,env:a})}catch(i){let a=i;throw new _t(e,a.code,a.stderr??"")}finally{await Ys(n,{recursive:!0,force:!0})}}};function Uj(e){if(e.length>1024*1024)return{};try{let t=Ua(e),r=t?.error,n=r!==null&&typeof r=="object"?r:t;return{...typeof n.code=="string"?{code:n.code.toUpperCase()}:{},...typeof n.statusCode=="number"?{statusCode:n.statusCode}:typeof t.statusCode=="number"?{statusCode:t.statusCode}:{},...typeof n.summary=="string"?{summary:n.summary.slice(0,512)}:{}}}catch{let t=/(?:^|\s)(E[A-Z0-9_]+)(?:\s|$)/m.exec(e)?.[1];return t===void 0?{}:{code:t}}}function Fj(e){let t=Uj(e.stderrText),r=t.summary??"";return e.code==="ETIMEDOUT"||t.statusCode===429||t.statusCode!==void 0&&t.statusCode>=500?new O("NPM_REGISTRY_OUTCOME_UNKNOWN","npm Registry \u7684\u64CD\u4F5C\u7ED3\u679C\u65E0\u6CD5\u5B89\u5168\u786E\u8BA4\uFF1B\u8BF7\u5148\u68C0\u67E5\u76EE\u6807\u72B6\u6001\uFF0C\u4E0D\u8981\u91CD\u590D\u6682\u5B58"):t.code==="ENEEDAUTH"||t.code==="E401"||t.statusCode===401?new O("NPM_AUTHENTICATION_REQUIRED","\u5F53\u524D\u53D7\u4FE1\u53D1\u5E03\u73AF\u5883\u672A\u83B7\u5F97 npm \u8BA4\u8BC1"):t.code==="EOTP"||/one-time password|two-factor|2fa/i.test(r)?new O("NPM_2FA_REQUIRED","\u8BE5\u64CD\u4F5C\u9700\u8981\u7EF4\u62A4\u8005\u5728 npmjs.com \u6216\u4EA4\u4E92\u5F0F npm CLI \u5B8C\u6210\u53CC\u91CD\u9A8C\u8BC1"):t.code==="E409"||t.code==="EPUBLISHCONFLICT"||t.statusCode===409?new O("NPM_STAGE_CONFLICT","\u8BE5 npm \u5305\u7248\u672C\u5DF2\u516C\u5F00\u6216\u5DF2\u6682\u5B58\uFF0C\u4E0D\u80FD\u8986\u76D6"):/trusted publisher|oidc|id token|workflow|provenance/i.test(r)?new O("NPM_TRUSTED_PUBLISHER_MISMATCH","npm Trusted Publisher \u914D\u7F6E\u4E0E\u5F53\u524D\u6267\u884C\u8EAB\u4EFD\u4E0D\u5339\u914D"):t.code==="E403"||t.statusCode===403?new O("NPM_AUTHORIZATION_DENIED","\u5F53\u524D\u53D1\u5E03\u8EAB\u4EFD\u65E0\u6743\u5BF9\u8BE5\u5305\u6267\u884C\u6682\u5B58\u64CD\u4F5C"):new O("DELIVERY_EXECUTION_FAILED","npm \u4EA4\u4ED8\u547D\u4EE4\u5931\u8D25\uFF0C\u4E14\u6CA1\u6709\u53EF\u5B89\u5168\u5206\u7C7B\u7684\u7ED3\u6784\u5316\u7ED3\u679C")}function fi(e,t){throw e instanceof _t?e.code==="ENOENT"?new O("DELIVERY_ADAPTER_UNAVAILABLE",`Required delivery executable '${t}' is unavailable`):t==="npm"?Fj(e):e.code==="ETIMEDOUT"?new O("DELIVERY_EXECUTION_UNKNOWN","Delivery command timed out; inspect the target before retrying"):new O("DELIVERY_EXECUTION_FAILED","Delivery adapter command failed"):e}async function eE(e,t){let r=await Hs(
|
|
20
|
+
`,{mode:384});let a=Vj(n);return await Mj(e,t,{cwd:r.cwd,timeout:r.timeout,maxBuffer:1024*1024,env:a})}catch(i){let a=i;throw new _t(e,a.code,a.stderr??"")}finally{await Ys(n,{recursive:!0,force:!0})}}};function Uj(e){if(e.length>1024*1024)return{};try{let t=Ua(e),r=t?.error,n=r!==null&&typeof r=="object"?r:t;return{...typeof n.code=="string"?{code:n.code.toUpperCase()}:{},...typeof n.statusCode=="number"?{statusCode:n.statusCode}:typeof t.statusCode=="number"?{statusCode:t.statusCode}:{},...typeof n.summary=="string"?{summary:n.summary.slice(0,512)}:{}}}catch{let t=/(?:^|\s)(E[A-Z0-9_]+)(?:\s|$)/m.exec(e)?.[1];return t===void 0?{}:{code:t}}}function Fj(e){let t=Uj(e.stderrText),r=t.summary??"";return e.code==="ETIMEDOUT"||t.statusCode===429||t.statusCode!==void 0&&t.statusCode>=500?new O("NPM_REGISTRY_OUTCOME_UNKNOWN","npm Registry \u7684\u64CD\u4F5C\u7ED3\u679C\u65E0\u6CD5\u5B89\u5168\u786E\u8BA4\uFF1B\u8BF7\u5148\u68C0\u67E5\u76EE\u6807\u72B6\u6001\uFF0C\u4E0D\u8981\u91CD\u590D\u6682\u5B58"):t.code==="ENEEDAUTH"||t.code==="E401"||t.statusCode===401?new O("NPM_AUTHENTICATION_REQUIRED","\u5F53\u524D\u53D7\u4FE1\u53D1\u5E03\u73AF\u5883\u672A\u83B7\u5F97 npm \u8BA4\u8BC1"):t.code==="EOTP"||/one-time password|two-factor|2fa/i.test(r)?new O("NPM_2FA_REQUIRED","\u8BE5\u64CD\u4F5C\u9700\u8981\u7EF4\u62A4\u8005\u5728 npmjs.com \u6216\u4EA4\u4E92\u5F0F npm CLI \u5B8C\u6210\u53CC\u91CD\u9A8C\u8BC1"):t.code==="E409"||t.code==="EPUBLISHCONFLICT"||t.statusCode===409?new O("NPM_STAGE_CONFLICT","\u8BE5 npm \u5305\u7248\u672C\u5DF2\u516C\u5F00\u6216\u5DF2\u6682\u5B58\uFF0C\u4E0D\u80FD\u8986\u76D6"):/trusted publisher|oidc|id token|workflow|provenance/i.test(r)?new O("NPM_TRUSTED_PUBLISHER_MISMATCH","npm Trusted Publisher \u914D\u7F6E\u4E0E\u5F53\u524D\u6267\u884C\u8EAB\u4EFD\u4E0D\u5339\u914D"):t.code==="E403"||t.statusCode===403?new O("NPM_AUTHORIZATION_DENIED","\u5F53\u524D\u53D1\u5E03\u8EAB\u4EFD\u65E0\u6743\u5BF9\u8BE5\u5305\u6267\u884C\u6682\u5B58\u64CD\u4F5C"):new O("DELIVERY_EXECUTION_FAILED","npm \u4EA4\u4ED8\u547D\u4EE4\u5931\u8D25\uFF0C\u4E14\u6CA1\u6709\u53EF\u5B89\u5168\u5206\u7C7B\u7684\u7ED3\u6784\u5316\u7ED3\u679C")}function fi(e,t){throw e instanceof _t?e.code==="ENOENT"?new O("DELIVERY_ADAPTER_UNAVAILABLE",`Required delivery executable '${t}' is unavailable`):t==="npm"?Fj(e):e.code==="ETIMEDOUT"?new O("DELIVERY_EXECUTION_UNKNOWN","Delivery command timed out; inspect the target before retrying"):new O("DELIVERY_EXECUTION_FAILED","Delivery adapter command failed"):e}async function eE(e,t){let r=await Hs(le.join(await Js(Zs()),"dyyto-npm-artifact-"));try{let n;try{n=await t.run("npm",["pack","--json","--ignore-scripts","--pack-destination",r],{cwd:e,timeout:12e4})}catch(c){return fi(c,"npm")}let i=Ua(n.stdout),a=i[0];if(a===void 0)throw new O("DELIVERY_PRECONDITION_FAILED","npm pack did not return an artifact manifest");let o=a?.filename;if(i.length!==1||typeof o!="string"||typeof a.size!="number"||typeof a.unpackedSize!="number"||!Array.isArray(a.files)||a.files.length===0||a.files.length>1e4||a.size>50*1024*1024||a.unpackedSize>200*1024*1024)throw new O("DELIVERY_PRECONDITION_FAILED","npm artifact manifest is missing or exceeds the secure publication limits");for(let c of a.files){let l=c;if(typeof l.path!="string"||typeof l.size!="number"||l.path.startsWith("/")||l.path.split(/[\\/]/).includes("..")||/(^|\/)(?:\.npmrc|\.env(?:\..*)?|.*\.(?:pem|key|p12|pfx)|id_rsa)$/i.test(l.path))throw new O("DELIVERY_PRECONDITION_FAILED","npm artifact contains an unsafe or secret-bearing file")}let s=await Va(le.join(r,o));if(s.byteLength!==a.size)throw new O("DELIVERY_PRECONDITION_FAILED","npm artifact size does not match its manifest");return{bytes:s,filename:o,digest:A(s)}}finally{await Ys(r,{recursive:!0,force:!0})}}function Ua(e){let t=Math.max(e.lastIndexOf(`
|
|
21
21
|
{`),e.lastIndexOf(`
|
|
22
|
-
[`),e.startsWith("{")||e.startsWith("[")?0:-1);if(t<0)throw new O("DELIVERY_EXECUTION_FAILED","npm did not return JSON output");try{return JSON.parse(e.slice(t===0?0:t+1))}catch{throw new O("DELIVERY_EXECUTION_FAILED","npm returned invalid JSON output")}}async function zj(e,t,r){let n=await Hs(de.join(await Js(Zs()),"dyyto-npm-inspect-"));try{let i;try{i=await r.run("npm",["pack",e,"--json","--ignore-scripts","--pack-destination",n,"--registry",Je],{cwd:t,timeout:12e4})}catch(s){return fi(s,"npm")}let o=Ua(i.stdout)[0]?.filename;if(typeof o!="string")throw new O("NPM_REGISTRY_OUTCOME_UNKNOWN","npm did not return the published tarball identity");return A(await Va(de.join(n,o)))}finally{await Ys(n,{recursive:!0,force:!0})}}async function tE(e,t=!1){let r=[];async function n(i,a){for(let o of(await aE(i,{withFileTypes:!0})).sort((s,c)=>s.name.localeCompare(c.name))){if(o.isSymbolicLink())throw new O("DELIVERY_PRECONDITION_FAILED","Deployment artifact cannot contain symbolic links");let s=a.length===0?o.name:`${a}/${o.name}`;if(o.isDirectory())await n(de.join(i,o.name),s);else if(o.isFile()){if(t&&s.endsWith(".map"))throw new O("DELIVERY_PRECONDITION_FAILED","Web delivery artifact contains a public Source Map; run observe release register after the final build");r.push({path:s,digest:A(await Va(de.join(i,o.name)))})}else throw new O("DELIVERY_PRECONDITION_FAILED","Deployment artifact contains an unsupported filesystem entry")}}if(await n(e,""),r.length===0)throw new O("DELIVERY_PRECONDITION_FAILED","Deployment artifact is empty");return A(JSON.stringify(r))}var Bp=class{constructor(t=oE,r=process.env){this.runner=t;this.executionEnvironment=r}runner;executionEnvironment;adapterId="registry.npmjs";assertTrustedExecution(t){let r=t.plan.publication?.execution;if(r===void 0)throw new O("NPM_TRUSTED_PUBLISHER_MISMATCH","Delivery Plan \u672A\u7ED1\u5B9A\u53D7\u4FE1\u6267\u884C\u8EAB\u4EFD");let n=this.executionEnvironment;if(n.NPM_CONFIG_PROVENANCE?.toLowerCase()==="false"||n.npm_config_provenance?.toLowerCase()==="false")throw new O("NPM_PROVENANCE_REQUIRED","Production npm \u6682\u5B58\u4E0D\u5141\u8BB8\u5173\u95ED provenance");let i=n.NPM_CONFIG_REGISTRY??n.npm_config_registry;if(i!==void 0&&i.replace(/\/$/,"")!==Je)throw new O("DELIVERY_PRECONDITION_FAILED","Secure npm delivery only supports the fixed npmjs.org Registry");if(["NPM_TOKEN","NODE_AUTH_TOKEN","npm_config__authToken"].some(a=>n[a]!==void 0))throw new O("NPM_TOKEN_POLICY_UNVERIFIED","Production npm \u6682\u5B58\u62D2\u7EDD\u4F20\u7EDF token \u73AF\u5883");if(r.provider==="github-actions"){let a=n.GITHUB_WORKFLOW_REF??n.GITHUB_WORKFLOW;if(n.GITHUB_ACTIONS!=="true"||n.RUNNER_ENVIRONMENT!=="github-hosted"||n.ACTIONS_ID_TOKEN_REQUEST_URL===void 0||n.ACTIONS_ID_TOKEN_REQUEST_TOKEN===void 0||n.GITHUB_REPOSITORY!==r.repository||a!==r.workflow||n.GITHUB_REF!==r.ref||r.environment!==void 0&&n.GITHUB_ENVIRONMENT!==r.environment)throw new O("NPM_TRUSTED_PUBLISHER_MISMATCH","GitHub Trusted Publisher \u6267\u884C\u8EAB\u4EFD\u4E0E\u6279\u51C6\u7684 Delivery Plan \u4E0D\u5339\u914D");return}if(n.GITLAB_CI!=="true"||n.CI_SERVER_HOST!=="gitlab.com"||n.NPM_ID_TOKEN===void 0||n.CI_PROJECT_PATH!==r.repository||n.CI_CONFIG_PATH!==r.workflow||n.CI_COMMIT_REF_NAME!==r.ref||r.environment!==void 0&&n.CI_ENVIRONMENT_NAME!==r.environment)throw new O("NPM_TRUSTED_PUBLISHER_MISMATCH","GitLab Trusted Publisher \u6267\u884C\u8EAB\u4EFD\u4E0E\u6279\u51C6\u7684 Delivery Plan \u4E0D\u5339\u914D")}async prepare(t){if(t.profile!=="standalone-npm-package"&&t.profile!=="workspace-npm-package")throw new O("DELIVERY_PROJECT_UNSUPPORTED","npmjs delivery requires an npm package profile");let{name:r,version:n,publishAccess:i}=t.parameters;if(r===void 0||n===void 0||i!=="public")throw new O("DELIVERY_PROJECT_UNSUPPORTED","M11 npmjs Adapter supports explicitly public packages only");let a=await eE(t.projectRoot,this.runner);return{artifact:{type:"npm-package",identity:`${r}@${n}`,digest:a.digest},target:{adapterId:this.adapterId,location:Je},details:{access:i,filename:a.filename}}}async execute(t){if(t.plan.schemaVersion!==2||t.plan.publication?.mode!=="staged"||t.plan.publication.authentication!=="trusted-publishing")throw new O("NPM_TOKEN_POLICY_UNVERIFIED","Secure npm delivery requires an approved staged trusted-publishing Plan");this.assertTrustedExecution(t);let r;try{r=await this.runner.run("npm",["--version"],{cwd:t.projectRoot,timeout:3e4})}catch(s){return fi(s,"npm")}let n=/^(\d+)\.(\d+)\.(\d+)/.exec(r.stdout.trim());if(n===null||Number(n[1])!==11||Number(n[2])<15)throw new O("NPM_STAGE_UNSUPPORTED","Secure staged publishing requires npm >=11.15.0 <12");if((await this.inspect(t)).state!=="absent")throw new O("DELIVERY_TARGET_EXISTS","The npm package version already exists or cannot be safely classified");let a=await eE(t.projectRoot,this.runner);if(a.digest!==t.plan.artifact.digest)throw new O("DELIVERY_PRECONDITION_FAILED","npm artifact changed after Plan approval");let o=await Hs(de.join(await Js(Zs()),"dyyto-npm-publish-"));try{let s=de.join(o,a.filename);await Kp(s,a.bytes,{flag:"wx",mode:384}),await t.onRemoteWriteStarting?.();let c;try{c=await this.runner.run("npm",["stage","publish",s,"--registry",Je,"--access","public","--tag",t.plan.publication.tag,"--json"],{cwd:t.projectRoot,timeout:12e4})}catch(p){fi(p,"npm")}let d;try{d=Ua(c.stdout)}catch{throw new O("NPM_REGISTRY_OUTCOME_UNKNOWN","npm accepted the stage command but did not return a verifiable JSON result")}let l=d,f=typeof l.stageId=="string"?l.stageId:typeof l.id=="string"?l.id:void 0;if(f===void 0||f.length===0)throw new O("NPM_REGISTRY_OUTCOME_UNKNOWN","npm did not return a stage identity; inspect the staged package before retrying");return{externalIdentity:f,details:{registry:Je,publicationState:"staged"}}}finally{await Ys(o,{recursive:!0,force:!0})}}async inspect(t){try{let r=await this.runner.run("npm",["view",t.plan.artifact.identity,"dist","--registry",Je,"--json"],{cwd:t.projectRoot,timeout:3e4}),i=Ua(r.stdout)?.attestations?.url,a;if(typeof i=="string")try{a=new URL(i)}catch{}if(t.plan.publication?.provenance==="required"&&(a===void 0||a.origin!==Je||a.username.length>0||a.password.length>0))return{state:"verification-pending",externalIdentity:t.plan.artifact.identity,details:{registry:Je,reason:"provenance-missing-or-invalid"}};let o=await zj(t.plan.artifact.identity,t.projectRoot,this.runner);return o!==t.plan.artifact.digest?{state:"unknown",externalIdentity:t.plan.artifact.identity,details:{registry:Je,reason:"artifact-digest-mismatch"}}:{state:"verified",externalIdentity:t.plan.artifact.identity,details:{registry:Je,artifactDigest:o,provenance:t.plan.publication?.provenance==="required"?"registry-attestation-present":"not-required",...a===void 0?{}:{provenanceUrlDigest:A(a.href)}}}}catch(r){if(r instanceof _t&&/E404|404 Not Found/i.test(r.stderrText))return{state:"absent",details:{registry:Je}};if(r instanceof _t&&r.code==="ENOENT")throw new O("DELIVERY_ADAPTER_UNAVAILABLE","npm executable is unavailable");if(r instanceof _t)return{state:"unknown",details:{registry:Je}};throw r}}recover(t){return this.inspect(t)}};function rE(e){return`dyyto-${e.slice(7,23)}`}async function nE(e){let t=de.basename(e),r=[de.join(e,".artifacts","standalone","server.js"),de.join(e,".next","standalone","server.js"),de.join(e,".next","standalone","apps",t,"server.js")];for(let n of r)if((await Lj(n).catch(()=>null))?.isFile())return de.dirname(n);throw new O("DELIVERY_PRECONDITION_FAILED","Next.js standalone server entry is unavailable")}var qp=class{constructor(t=oE){this.runner=t}runner;adapterId="deployment.local-docker";async prepare(t){if(t.profile!=="workspace-node-application"&&t.profile!=="workspace-web-application"&&t.profile!=="nextjs-full-stack-application"||t.parameters.name===void 0)throw new O("DELIVERY_PROJECT_UNSUPPORTED","Local Docker delivery supports adopted Node, Web, and Next.js Applications");if(t.profile==="nextjs-full-stack-application"){let r=await nE(t.projectRoot);return{artifact:{type:"node-application",identity:t.parameters.name,digest:await tE(r)},target:{adapterId:this.adapterId,location:"docker://local"},details:{image:Ma,runtime:"next-standalone",renderMode:"ssr"}}}if(t.profile==="workspace-node-application")try{await this.runner.run("corepack",["pnpm","build"],{cwd:t.projectRoot,timeout:12e4})}catch(r){fi(r,"corepack")}return{artifact:{type:t.profile==="workspace-web-application"?"web-application":"node-application",identity:t.parameters.name,digest:await tE(de.join(t.projectRoot,"dist"),t.profile==="workspace-web-application")},target:{adapterId:this.adapterId,location:"docker://local"},details:{image:Ma}}}async execute(t){let r=await this.prepare({projectRoot:t.projectRoot,profile:t.plan.project.profile,parameters:{name:t.plan.artifact.identity}});if(r.artifact.digest!==t.plan.artifact.digest)throw new O("DELIVERY_PRECONDITION_FAILED","Application artifact changed after Plan approval");let n=rE(t.plan.planId),i=t.plan.project.profile==="nextjs-full-stack-application";if(i&&(t.plan.artifact.type==="web-application"||r.details.runtime!=="next-standalone"))throw new O("DELIVERY_PROJECT_UNSUPPORTED","Hosted SSR cannot deploy as a static HTML web-application");let a=i?await nE(t.projectRoot):de.join(t.projectRoot,"dist"),o=i?`type=bind,src=${a},dst=/app,readonly`:`type=bind,src=${a},dst=/app/dist,readonly`,s,c=i?["node","/app/server.js"]:t.plan.artifact.type==="web-application"?["node","--input-type=module","--eval",`import{createServer}from'node:http';import{readFile,stat}from'node:fs/promises';import path from'node:path';const root='/app/dist',mime={'.html':'text/html; charset=utf-8','.js':'text/javascript; charset=utf-8','.css':'text/css; charset=utf-8','.json':'application/json; charset=utf-8','.svg':'image/svg+xml'};createServer(async(q,s)=>{s.setHeader('x-content-type-options','nosniff');if(q.url==='/health'){s.setHeader('content-type','application/json');s.end('{"status":"ok"}');return}if(q.url==='/dyyto-runtime-config.json'){s.setHeader('cache-control','no-store');s.setHeader('content-type','application/json');s.end(JSON.stringify({schemaVersion:1,applicationId:${JSON.stringify(t.plan.artifact.identity)},releaseId:${JSON.stringify(t.plan.artifact.digest)},deploymentId:${JSON.stringify(t.plan.planId)},collectorEndpoint:'http://127.0.0.1:4318'}));return}const raw=(q.url||'/').split(/[?#]/)[0];if(raw.endsWith('.map')){s.statusCode=404;s.end();return}let target=path.resolve(root,'.'+raw);if(target!==root&&!target.startsWith(root+'/')){s.statusCode=404;s.end();return}try{if((await stat(target)).isDirectory())target=path.join(target,'index.html');s.setHeader('content-type',mime[path.extname(target)]||'application/octet-stream');s.end(await readFile(target))}catch{try{s.setHeader('content-type','text/html; charset=utf-8');s.end(await readFile(path.join(root,'index.html')))}catch{s.statusCode=404;s.end()}}}).listen(3000,'0.0.0.0')`]:["node","/app/dist/index.js"];try{s=await this.runner.run("docker",["run","--detach","--name",n,"--label",`dev.dyyto.plan=${t.plan.planId}`,"--publish","127.0.0.1::3000","--env","PORT=3000","--mount",o,"--read-only","--cap-drop","ALL","--user","65532:65532",Ma,...c],{cwd:t.projectRoot,timeout:12e4})}catch(p){return fi(p,"docker")}let d=s.stdout.trim();if(d.length===0)throw new O("DELIVERY_EXECUTION_UNKNOWN","Docker did not return a container identity");let f=`const r=await fetch('http://127.0.0.1:3000${i?"/api/health":"/health"}');if(!r.ok)process.exit(1);const b=await r.json();if(b.status!=='ok')process.exit(1)`;try{await this.runner.run("docker",["exec",n,"node","--input-type=module","--eval",f],{cwd:t.projectRoot,timeout:3e4})}catch(p){try{await this.runner.run("docker",["rm","--force",n],{cwd:t.projectRoot,timeout:3e4})}catch{}throw p instanceof _t&&p.code==="ETIMEDOUT"?new O("DELIVERY_EXECUTION_UNKNOWN","Docker health outcome is unknown after timeout"):new O("DELIVERY_EXECUTION_FAILED","Docker application health check failed; the new container was removed")}return{externalIdentity:d,details:{containerName:n,image:Ma,...i?{runtime:"next-standalone",renderMode:"ssr"}:{}}}}async inspect(t){let r=rE(t.plan.planId);try{let n=await this.runner.run("docker",["inspect","--format",'{{.Id}}|{{.State.Running}}|{{index .Config.Labels "dev.dyyto.plan"}}',r],{cwd:t.projectRoot,timeout:3e4}),[i,a,o]=n.stdout.trim().split("|");return o!==t.plan.planId?{state:"unknown",details:{containerName:r}}:{state:a==="true"?"verified":"unknown",...i===void 0?{}:{externalIdentity:i},details:{containerName:r,image:Ma}}}catch(n){if(n instanceof _t&&n.code==="ENOENT")throw new O("DELIVERY_ADAPTER_UNAVAILABLE","docker executable is unavailable");if(n instanceof _t&&/No such object|No such container/i.test(n.stderrText))return{state:"absent",details:{containerName:r}};if(n instanceof _t)return{state:"unknown",details:{containerName:r}};throw n}}recover(t){return this.inspect(t)}},Gp=class{adapterId="publication.hosted-static";async prepare(t){let{parsePageAuthoringDocument:r}=await Promise.resolve().then(()=>(Ln(),Gl)),{planHostedCsr:n}=await Promise.resolve().then(()=>(zp(),Fp)),i=await iE(t.projectRoot,r);if(i.project.renderMode!=="csr")throw new O("DELIVERY_PROJECT_UNSUPPORTED","Hosted CSR cannot publish an SSR project");let a=n(i);return{artifact:{type:"web-bundle",identity:`page:${i.project.projectId}`,digest:a.bundleDigest},target:{adapterId:this.adapterId,location:"object-store://hosted-csr"},details:{renderMode:"csr",currentDigest:a.bundleDigest}}}async execute(t){if(t.plan.kind!=="hosted-static")throw new O("DELIVERY_PROJECT_UNSUPPORTED","Hosted CSR adapter only executes hosted-static plans");let{filesystemObjectStore:r}=await Promise.resolve().then(()=>(Qv(),Xv)),{parsePageAuthoringDocument:n}=await Promise.resolve().then(()=>(Ln(),Gl)),{publishHostedCsr:i}=await Promise.resolve().then(()=>(zp(),Fp)),a=await iE(t.projectRoot,n),o=await i(a,r(de.join(t.projectRoot,".dyyto","hosted-objects")));if(o.bundleDigest!==t.plan.artifact.digest)throw new O("DELIVERY_PRECONDITION_FAILED","Hosted CSR bundle changed after Plan approval");return await jj(de.join(t.projectRoot,".dyyto"),{recursive:!0,mode:448}),await Kp(de.join(t.projectRoot,".dyyto","hosted-pointer.json"),`${JSON.stringify(o.pointer,null,2)}
|
|
23
|
-
`,{mode:384}),{externalIdentity:`page:${a.project.projectId}`,details:{renderMode:"csr",currentDigest:o.pointer.currentDigest,routeTable:JSON.stringify(o.pointer.routes)}}}async inspect(t){if(t.plan.kind!=="hosted-static")return{state:"unknown",details:{renderMode:"csr"}};try{let r=await this.prepare({projectRoot:t.projectRoot,profile:t.plan.project.profile,parameters:{}});if(r.artifact.digest!==t.plan.artifact.digest)return{state:"unknown",details:{renderMode:"csr"}};let n=r.details.currentDigest;return n===void 0?{state:"unknown",details:{renderMode:"csr"}}:{state:"verified",externalIdentity:t.plan.artifact.identity,details:{renderMode:"csr",currentDigest:n}}}catch(r){return r instanceof O&&r.code==="DELIVERY_PROJECT_UNSUPPORTED"?{state:"absent",details:{renderMode:"csr"}}:{state:"unknown",details:{renderMode:"csr"}}}}recover(t){return this.inspect(t)}};async function iE(e,t){try{let r=JSON.parse(await Va(de.join(e,"src/page-authoring/project.json"),"utf8")),n=de.join(e,"src/page-authoring/pages"),i=(await aE(n)).filter(o=>o.endsWith(".json")).sort((o,s)=>o.localeCompare(s)),a=await Promise.all(i.map(async o=>JSON.parse(await Va(de.join(n,o),"utf8"))));return t({project:r,pages:a})}catch(r){throw r instanceof O?r:new O("DELIVERY_PROJECT_UNSUPPORTED","Hosted CSR requires projected src/page-authoring files")}}import{readFile as Xs,readdir as Bj,rm as qj}from"node:fs/promises";import{execFile as Gj}from"node:child_process";import{promisify as Kj}from"node:util";import pi from"node:path";var Wj=Kj(Gj);async function Hj(e){let t=[];async function r(n,i=""){for(let a of await Bj(n,{withFileTypes:!0})){let o=i?`${i}/${a.name}`:a.name;a.isDirectory()?await r(pi.join(n,a.name),o):a.isFile()&&t.push(o)}}return await r(e),t.sort()}async function Jj(e){e.build!==!1&&await Wj("corepack",["pnpm","build"],{cwd:e.projectRoot,timeout:12e4});let t=pi.join(e.projectRoot,"dist"),r=await Hj(t),n=r.filter(c=>!c.endsWith(".map")),i=[];for(let c of n)i.push({path:c,digest:A(await Xs(pi.join(t,c)))});let a=A(JSON.stringify(i)),o=new Zi(e.workspaceRoot),s=[];for(let c of r.filter(d=>d.endsWith(".js.map"))){let d=c.slice(0,-4),l=pi.join(t,d),f=JSON.parse(await Xs(pi.join(t,c),"utf8"));if(delete f.sourcesContent,!await Xs(l).catch(()=>null))throw new oe("RUNTIME_ERROR_INVALID",`Source Map asset '${d}' is missing`);s.push(await o.registerSourceMap({releaseId:a,asset:d,assetDigest:A(await Xs(l)),map:f,registeredAt:e.registeredAt??new Date().toISOString()})),await qj(pi.join(t,c))}if(s.length===0)throw new oe("RUNTIME_ERROR_INVALID","Production build did not emit private Source Maps");return{releaseId:a,registrations:s,publicFiles:n}}import{createHash as Yj}from"node:crypto";import{execFile as Zj}from"node:child_process";import{mkdtemp as sE,readFile as Xj,realpath as cE,rm as dE,writeFile as Qj}from"node:fs/promises";import{tmpdir as lE}from"node:os";import Fa from"node:path";import{promisify as eL}from"node:util";var tL=eL(Zj);function rL(e=process.env){return async({executable:t,args:r,cwd:n,timeoutMs:i})=>{let a=["PATH","TMPDIR","TEMP","TMP","CI","AWS_ROLE_ARN","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_SESSION_NAME","AWS_REGION","AWS_DEFAULT_REGION","GH_TOKEN","GITHUB_TOKEN","GH_HOST"],o={NO_COLOR:"1",AWS_PAGER:"",GH_PAGER:"cat",GH_PROMPT_DISABLED:"1"};for(let s of a)e[s]!==void 0&&(o[s]=e[s]);try{return{stdout:(await tL(t,[...r],{cwd:n,env:o,timeout:i,maxBuffer:1048576})).stdout}}catch{throw new G(t==="gh"?"REGISTRY_ATTESTATION_FAILED":"REGISTRY_PROVIDER_FAILED")}}}var G=class extends Error{constructor(r){super(r);this.code=r}code},fE=/^[A-Za-z0-9][A-Za-z0-9._-]{1,99}$/u,nL=/^[0-9]{12}$/u,iL=/^[a-z]{2}(?:-gov)?-[a-z]+-[0-9]$/u,aL=/^@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$/u,oL=/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/u;function pE(e){if(!fE.test(e.domain)||!nL.test(e.domainOwner)||!iL.test(e.region))throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");return["--domain",e.domain,"--domain-owner",e.domainOwner,"--region",e.region,"--no-cli-pager","--no-cli-auto-prompt","--output","json"]}function sL(e){if(!fE.test(e.repository))throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");return[...pE(e),"--repository",e.repository]}function uE(e){if(!aL.test(e.packageName)||!oL.test(e.version))throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");let[t,r]=e.packageName.slice(1).split("/");return{namespace:t,name:r,args:["--format","npm","--namespace",t,"--package",r,"--package-version",e.version]}}function za(e){if(!e||e.length>1024*1024)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");try{return JSON.parse(e)}catch{throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID")}}function hE(e){return`sha512-${Yj("sha512").update(e).digest("base64")}`}var Wp=class{constructor(t,r,n){this.provider=t;this.location=r;this.runner=n}provider;location;runner;async read(t,r){if(this.provider.kind!=="aws-codeartifact"||this.provider.verification!=="external")throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");let n=sL(this.location),i=uE(t),a=await sE(Fa.join(await cE(lE()),"dyyto-codeartifact-read-"));try{let o,s;try{o=(await this.runner({executable:"aws",args:["codeartifact","describe-package-version",...n,...i.args],cwd:a,timeoutMs:3e4})).stdout,s=(await this.runner({executable:"aws",args:["codeartifact","list-package-version-assets",...n,...i.args],cwd:a,timeoutMs:3e4})).stdout}catch{throw new G("REGISTRY_PROVIDER_FAILED")}let d=za(o).packageVersion;if(typeof d?.revision!="string"||d.revision.length>50||!/^\S+$/u.test(d.revision)||d.status!=="Published"||d.origin?.originType!=="INTERNAL"||d.origin.domainEntryPoint?.repositoryName!==this.location.repository||d.origin.domainEntryPoint.externalConnectionName!==void 0)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");let f=za(s).assets?.map(h=>h.name).filter(h=>typeof h=="string"&&h.endsWith(".tgz"))??[];if(f.length!==1||f[0].includes("/")||f[0].includes("\\")||f[0].length>255)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");let p=Fa.join(a,"package.tgz");try{await this.runner({executable:"aws",args:["codeartifact","get-package-version-asset",...n,...i.args,"--asset",f[0],p],cwd:a,timeoutMs:6e4})}catch{throw new G("REGISTRY_PROVIDER_FAILED")}let u=await Xj(p).catch(()=>{throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID")});if(u.byteLength===0||u.byteLength>50*1024*1024)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");return{observation:{schemaVersion:1,providerReleaseRevision:this.provider.revision,registryId:t.registryId,packageName:t.packageName,version:t.version,providerVersionRevision:d.revision,status:"published",origin:"internal-publish",assetName:f[0],integrity:hE(u),tarballDigest:A(u),observedAt:r},artifact:u}}finally{await dE(a,{recursive:!0,force:!0})}}async observe(t,r){return(await this.read(t,r)).observation}};function cL(){return async({url:e,bearerToken:t,accept:r,maximumBytes:n})=>{let i;try{i=await fetch(e,{method:"GET",redirect:"error",headers:{accept:r,authorization:"Bearer "+t},signal:AbortSignal.timeout(3e4)})}catch{throw new G("REGISTRY_PROVIDER_FAILED")}if(!i.ok||i.body===null)throw new G("REGISTRY_PROVIDER_FAILED");let a=Number(i.headers.get("content-length"));if(Number.isFinite(a)&&a>n)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");let o=new Uint8Array(await i.arrayBuffer());if(o.byteLength===0||o.byteLength>n)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");let s=i.headers.get("content-type");return{status:i.status,body:o,...s===null?{}:{contentType:s}}}}var Qs=class{constructor(t,r,n,i="npm-registry"){this.provider=t;this.registryOrigin=r;this.client=n;this.acceptedKind=i}provider;registryOrigin;client;acceptedKind;async read(t,r,n){if(this.provider.kind!==this.acceptedKind||this.provider.verification!=="delivery-receipt"||r.kind!=="bearer-token"||!r.secret)throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");try{jo(r,n)}catch{throw new G("REGISTRY_PROVIDER_CONFIG_INVALID")}uE(t);let i;try{i=new URL(this.registryOrigin)}catch{throw new G("REGISTRY_PROVIDER_CONFIG_INVALID")}if(i.protocol!=="https:"||i.username||i.password||i.search||i.hash||!i.pathname.endsWith("/"))throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");let a=new URL(encodeURIComponent(t.packageName),i),o=await this.client({url:a.href,bearerToken:r.secret,accept:"application/vnd.npm.install-v1+json, application/json",maximumBytes:1024*1024}),s=za(Buffer.from(o.body).toString("utf8")),c=s.versions?.[t.version];if(s.name!==t.packageName||c?.name!==t.packageName||c.version!==t.version||typeof c.dist?.integrity!="string"||typeof c.dist.tarball!="string")throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");let d;try{d=new URL(c.dist.tarball)}catch{throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID")}if(d.origin!==i.origin||!d.pathname.startsWith(i.pathname)||d.username||d.password||d.search||d.hash||!d.pathname.endsWith(".tgz"))throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");let l=await this.client({url:d.href,bearerToken:r.secret,accept:"application/octet-stream",maximumBytes:50*1024*1024}),f=hE(l.body);if(f!==c.dist.integrity)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");return{observation:{schemaVersion:1,providerReleaseRevision:this.provider.revision,registryId:t.registryId,packageName:t.packageName,version:t.version,providerVersionRevision:A(t.version+":"+f),status:"published",origin:"internal-publish",assetName:Fa.posix.basename(d.pathname),integrity:f,tarballDigest:A(l.body),observedAt:n},artifact:l.body}}},Hp=class extends Qs{constructor(t,r,n){super(t,r,n,"cnpmcore")}},Jp=class{constructor(t,r,n){this.location=t;this.runner=r;this.roleSubject=n}location;runner;roleSubject;async resolve(t,r,n){if(!/^[a-z][a-z0-9._:-]{2,127}$/u.test(t)||!/^[a-z][a-z0-9.-]{2,127}$/u.test(r)||!this.roleSubject.startsWith("arn:aws:iam::")||this.roleSubject.length>512)throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");let i=["codeartifact","get-authorization-token",...pE(this.location),"--duration-seconds","900"],a;try{a=(await this.runner({executable:"aws",args:i,cwd:process.cwd(),timeoutMs:3e4})).stdout}catch{throw new G("REGISTRY_PROVIDER_FAILED")}let o=za(a);if(typeof o.authorizationToken!="string"||o.authorizationToken.length<16||o.authorizationToken.length>16384||/[\r\n\0]/u.test(o.authorizationToken)||typeof o.expiration!="number"||!Number.isFinite(o.expiration))throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");return{schemaVersion:1,kind:"bearer-token",secret:o.authorizationToken,subjectDigest:A(`${r}:${t}:${this.roleSubject}`),issuedAt:n,expiresAt:new Date(o.expiration*1e3).toISOString()}}},Yp=class{constructor(t,r){this.policy=t;this.runner=r}policy;runner;async verify(t,r){if(!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u.test(this.policy.repository)||!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/.+\.ya?ml$/u.test(this.policy.signerWorkflow)||!this.policy.sourceRef.startsWith("refs/")||this.policy.issuer!=="https://token.actions.githubusercontent.com")throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");let n=await sE(Fa.join(await cE(lE()),"dyyto-attestation-read-")),i=Fa.join(n,"package.tgz");try{await Qj(i,t,{mode:384});let a;try{a=(await this.runner({executable:"gh",args:["attestation","verify",i,"--repo",this.policy.repository,"--signer-repo",this.policy.repository,"--signer-workflow",this.policy.signerWorkflow,"--source-ref",this.policy.sourceRef,"--cert-oidc-issuer",this.policy.issuer,"--predicate-type","https://slsa.dev/provenance/v1","--deny-self-hosted-runners","--format","json"],cwd:n,timeoutMs:6e4})).stdout}catch{throw new G("REGISTRY_ATTESTATION_FAILED")}return za(a),{schemaVersion:1,mode:"external",issuerDigest:A(this.policy.issuer),buildIdentityDigest:A(`${this.policy.repository}:${this.policy.signerWorkflow}:${this.policy.sourceRef}`),subjectDigest:A(t),statementDigest:A(a),verifiedAt:r}}finally{await dE(n,{recursive:!0,force:!0})}}};import{closeSync as dL,existsSync as gE,fstatSync as lL,openSync as fL,readFileSync as pL,writeSync as uL}from"node:fs";import{execFileSync as hL}from"node:child_process";import{mkdir as mL,readFile as ui,realpath as qa,rename as gL,unlink as Zp,writeFile as yL}from"node:fs/promises";import{spawn as wL}from"node:child_process";import Ye from"node:path";import{randomUUID as yE}from"node:crypto";var Qp=e=>Ye.join(e,".dyyto","runtime"),Ba=e=>Ye.join(Qp(e),"project-process.json"),Xp=e=>Ye.join(Qp(e),"project-process.log"),wE=e=>{try{return process.kill(e,0),!0}catch{return!1}},mE=e=>{try{return process.kill(-e,0),!0}catch{return!1}},_E=e=>{if(!wE(e.pid))return!1;try{let t=gE(`/proc/${e.pid}/cmdline`)?pL(`/proc/${e.pid}/cmdline`,"utf8").replaceAll("\0"," "):hL("ps",["-p",String(e.pid),"-o","command="],{encoding:"utf8",timeout:2e3});return t.includes(e.projectRoot)&&t.includes("pnpm")}catch{return!1}};async function eu(e){try{let t=sy(JSON.parse(await ui(Ba(e),"utf8")));return t.projectRoot!==e?null:t}catch{return null}}async function _L(e,t){let r=`${e}.${yE()}.tmp`;await yL(r,`${JSON.stringify(t,null,2)}
|
|
24
|
-
`,{mode:384}),await gL(r,e)}async function IE(e){let t=await qa(Ye.resolve(e)),r=await eu(t);return r===null?{projectRoot:t,state:"stopped"}:_E(r)?{projectRoot:t,state:"running",processId:r.processId,command:r.command,startedAt:r.startedAt}:{projectRoot:t,state:"stale",processId:r.processId,command:r.command,startedAt:r.startedAt}}async function IL(e,t){let r=await qa(Ye.resolve(e));if((await IE(r)).state==="running")throw new zt("PROJECT_PROCESS_ALREADY_RUNNING","A managed project process is already running");if(typeof JSON.parse(await ui(Ye.join(r,"package.json"),"utf8")).scripts?.[t]!="string")throw new zt("PROJECT_COMMAND_UNSUPPORTED",`Project does not declare the '${t}' script`);await mL(Qp(r),{recursive:!0,mode:448}),await Zp(Ba(r)).catch(()=>{});let a=fL(Xp(r),"a",384),o=
|
|
22
|
+
[`),e.startsWith("{")||e.startsWith("[")?0:-1);if(t<0)throw new O("DELIVERY_EXECUTION_FAILED","npm did not return JSON output");try{return JSON.parse(e.slice(t===0?0:t+1))}catch{throw new O("DELIVERY_EXECUTION_FAILED","npm returned invalid JSON output")}}async function zj(e,t,r){let n=await Hs(le.join(await Js(Zs()),"dyyto-npm-inspect-"));try{let i;try{i=await r.run("npm",["pack",e,"--json","--ignore-scripts","--pack-destination",n,"--registry",Je],{cwd:t,timeout:12e4})}catch(s){return fi(s,"npm")}let o=Ua(i.stdout)[0]?.filename;if(typeof o!="string")throw new O("NPM_REGISTRY_OUTCOME_UNKNOWN","npm did not return the published tarball identity");return A(await Va(le.join(n,o)))}finally{await Ys(n,{recursive:!0,force:!0})}}async function tE(e,t=!1){let r=[];async function n(i,a){for(let o of(await aE(i,{withFileTypes:!0})).sort((s,c)=>s.name.localeCompare(c.name))){if(o.isSymbolicLink())throw new O("DELIVERY_PRECONDITION_FAILED","Deployment artifact cannot contain symbolic links");let s=a.length===0?o.name:`${a}/${o.name}`;if(o.isDirectory())await n(le.join(i,o.name),s);else if(o.isFile()){if(t&&s.endsWith(".map"))throw new O("DELIVERY_PRECONDITION_FAILED","Web delivery artifact contains a public Source Map; run observe release register after the final build");r.push({path:s,digest:A(await Va(le.join(i,o.name)))})}else throw new O("DELIVERY_PRECONDITION_FAILED","Deployment artifact contains an unsupported filesystem entry")}}if(await n(e,""),r.length===0)throw new O("DELIVERY_PRECONDITION_FAILED","Deployment artifact is empty");return A(JSON.stringify(r))}var Bp=class{constructor(t=oE,r=process.env){this.runner=t;this.executionEnvironment=r}runner;executionEnvironment;adapterId="registry.npmjs";assertTrustedExecution(t){let r=t.plan.publication?.execution;if(r===void 0)throw new O("NPM_TRUSTED_PUBLISHER_MISMATCH","Delivery Plan \u672A\u7ED1\u5B9A\u53D7\u4FE1\u6267\u884C\u8EAB\u4EFD");let n=this.executionEnvironment;if(n.NPM_CONFIG_PROVENANCE?.toLowerCase()==="false"||n.npm_config_provenance?.toLowerCase()==="false")throw new O("NPM_PROVENANCE_REQUIRED","Production npm \u6682\u5B58\u4E0D\u5141\u8BB8\u5173\u95ED provenance");let i=n.NPM_CONFIG_REGISTRY??n.npm_config_registry;if(i!==void 0&&i.replace(/\/$/,"")!==Je)throw new O("DELIVERY_PRECONDITION_FAILED","Secure npm delivery only supports the fixed npmjs.org Registry");if(["NPM_TOKEN","NODE_AUTH_TOKEN","npm_config__authToken"].some(a=>n[a]!==void 0))throw new O("NPM_TOKEN_POLICY_UNVERIFIED","Production npm \u6682\u5B58\u62D2\u7EDD\u4F20\u7EDF token \u73AF\u5883");if(r.provider==="github-actions"){let a=n.GITHUB_WORKFLOW_REF??n.GITHUB_WORKFLOW;if(n.GITHUB_ACTIONS!=="true"||n.RUNNER_ENVIRONMENT!=="github-hosted"||n.ACTIONS_ID_TOKEN_REQUEST_URL===void 0||n.ACTIONS_ID_TOKEN_REQUEST_TOKEN===void 0||n.GITHUB_REPOSITORY!==r.repository||a!==r.workflow||n.GITHUB_REF!==r.ref||r.environment!==void 0&&n.GITHUB_ENVIRONMENT!==r.environment)throw new O("NPM_TRUSTED_PUBLISHER_MISMATCH","GitHub Trusted Publisher \u6267\u884C\u8EAB\u4EFD\u4E0E\u6279\u51C6\u7684 Delivery Plan \u4E0D\u5339\u914D");return}if(n.GITLAB_CI!=="true"||n.CI_SERVER_HOST!=="gitlab.com"||n.NPM_ID_TOKEN===void 0||n.CI_PROJECT_PATH!==r.repository||n.CI_CONFIG_PATH!==r.workflow||n.CI_COMMIT_REF_NAME!==r.ref||r.environment!==void 0&&n.CI_ENVIRONMENT_NAME!==r.environment)throw new O("NPM_TRUSTED_PUBLISHER_MISMATCH","GitLab Trusted Publisher \u6267\u884C\u8EAB\u4EFD\u4E0E\u6279\u51C6\u7684 Delivery Plan \u4E0D\u5339\u914D")}async prepare(t){if(t.profile!=="standalone-npm-package"&&t.profile!=="workspace-npm-package")throw new O("DELIVERY_PROJECT_UNSUPPORTED","npmjs delivery requires an npm package profile");let{name:r,version:n,publishAccess:i}=t.parameters;if(r===void 0||n===void 0||i!=="public")throw new O("DELIVERY_PROJECT_UNSUPPORTED","M11 npmjs Adapter supports explicitly public packages only");let a=await eE(t.projectRoot,this.runner);return{artifact:{type:"npm-package",identity:`${r}@${n}`,digest:a.digest},target:{adapterId:this.adapterId,location:Je},details:{access:i,filename:a.filename}}}async execute(t){if(t.plan.schemaVersion!==2||t.plan.publication?.mode!=="staged"||t.plan.publication.authentication!=="trusted-publishing")throw new O("NPM_TOKEN_POLICY_UNVERIFIED","Secure npm delivery requires an approved staged trusted-publishing Plan");this.assertTrustedExecution(t);let r;try{r=await this.runner.run("npm",["--version"],{cwd:t.projectRoot,timeout:3e4})}catch(s){return fi(s,"npm")}let n=/^(\d+)\.(\d+)\.(\d+)/.exec(r.stdout.trim());if(n===null||Number(n[1])!==11||Number(n[2])<15)throw new O("NPM_STAGE_UNSUPPORTED","Secure staged publishing requires npm >=11.15.0 <12");if((await this.inspect(t)).state!=="absent")throw new O("DELIVERY_TARGET_EXISTS","The npm package version already exists or cannot be safely classified");let a=await eE(t.projectRoot,this.runner);if(a.digest!==t.plan.artifact.digest)throw new O("DELIVERY_PRECONDITION_FAILED","npm artifact changed after Plan approval");let o=await Hs(le.join(await Js(Zs()),"dyyto-npm-publish-"));try{let s=le.join(o,a.filename);await Kp(s,a.bytes,{flag:"wx",mode:384}),await t.onRemoteWriteStarting?.();let c;try{c=await this.runner.run("npm",["stage","publish",s,"--registry",Je,"--access","public","--tag",t.plan.publication.tag,"--json"],{cwd:t.projectRoot,timeout:12e4})}catch(p){fi(p,"npm")}let l;try{l=Ua(c.stdout)}catch{throw new O("NPM_REGISTRY_OUTCOME_UNKNOWN","npm accepted the stage command but did not return a verifiable JSON result")}let d=l,f=typeof d.stageId=="string"?d.stageId:typeof d.id=="string"?d.id:void 0;if(f===void 0||f.length===0)throw new O("NPM_REGISTRY_OUTCOME_UNKNOWN","npm did not return a stage identity; inspect the staged package before retrying");return{externalIdentity:f,details:{registry:Je,publicationState:"staged"}}}finally{await Ys(o,{recursive:!0,force:!0})}}async inspect(t){try{let r=await this.runner.run("npm",["view",t.plan.artifact.identity,"dist","--registry",Je,"--json"],{cwd:t.projectRoot,timeout:3e4}),i=Ua(r.stdout)?.attestations?.url,a;if(typeof i=="string")try{a=new URL(i)}catch{}if(t.plan.publication?.provenance==="required"&&(a===void 0||a.origin!==Je||a.username.length>0||a.password.length>0))return{state:"verification-pending",externalIdentity:t.plan.artifact.identity,details:{registry:Je,reason:"provenance-missing-or-invalid"}};let o=await zj(t.plan.artifact.identity,t.projectRoot,this.runner);return o!==t.plan.artifact.digest?{state:"unknown",externalIdentity:t.plan.artifact.identity,details:{registry:Je,reason:"artifact-digest-mismatch"}}:{state:"verified",externalIdentity:t.plan.artifact.identity,details:{registry:Je,artifactDigest:o,provenance:t.plan.publication?.provenance==="required"?"registry-attestation-present":"not-required",...a===void 0?{}:{provenanceUrlDigest:A(a.href)}}}}catch(r){if(r instanceof _t&&/E404|404 Not Found/i.test(r.stderrText))return{state:"absent",details:{registry:Je}};if(r instanceof _t&&r.code==="ENOENT")throw new O("DELIVERY_ADAPTER_UNAVAILABLE","npm executable is unavailable");if(r instanceof _t)return{state:"unknown",details:{registry:Je}};throw r}}recover(t){return this.inspect(t)}};function rE(e){return`dyyto-${e.slice(7,23)}`}async function nE(e){let t=le.basename(e),r=[le.join(e,".artifacts","standalone","server.js"),le.join(e,".next","standalone","server.js"),le.join(e,".next","standalone","apps",t,"server.js")];for(let n of r)if((await Lj(n).catch(()=>null))?.isFile())return le.dirname(n);throw new O("DELIVERY_PRECONDITION_FAILED","Next.js standalone server entry is unavailable")}var qp=class{constructor(t=oE){this.runner=t}runner;adapterId="deployment.local-docker";async prepare(t){if(t.profile!=="workspace-node-application"&&t.profile!=="workspace-web-application"&&t.profile!=="nextjs-full-stack-application"||t.parameters.name===void 0)throw new O("DELIVERY_PROJECT_UNSUPPORTED","Local Docker delivery supports adopted Node, Web, and Next.js Applications");if(t.profile==="nextjs-full-stack-application"){let r=await nE(t.projectRoot);return{artifact:{type:"node-application",identity:t.parameters.name,digest:await tE(r)},target:{adapterId:this.adapterId,location:"docker://local"},details:{image:Ma,runtime:"next-standalone",renderMode:"ssr"}}}if(t.profile==="workspace-node-application")try{await this.runner.run("corepack",["pnpm","build"],{cwd:t.projectRoot,timeout:12e4})}catch(r){fi(r,"corepack")}return{artifact:{type:t.profile==="workspace-web-application"?"web-application":"node-application",identity:t.parameters.name,digest:await tE(le.join(t.projectRoot,"dist"),t.profile==="workspace-web-application")},target:{adapterId:this.adapterId,location:"docker://local"},details:{image:Ma}}}async execute(t){let r=await this.prepare({projectRoot:t.projectRoot,profile:t.plan.project.profile,parameters:{name:t.plan.artifact.identity}});if(r.artifact.digest!==t.plan.artifact.digest)throw new O("DELIVERY_PRECONDITION_FAILED","Application artifact changed after Plan approval");let n=rE(t.plan.planId),i=t.plan.project.profile==="nextjs-full-stack-application";if(i&&(t.plan.artifact.type==="web-application"||r.details.runtime!=="next-standalone"))throw new O("DELIVERY_PROJECT_UNSUPPORTED","Hosted SSR cannot deploy as a static HTML web-application");let a=i?await nE(t.projectRoot):le.join(t.projectRoot,"dist"),o=i?`type=bind,src=${a},dst=/app,readonly`:`type=bind,src=${a},dst=/app/dist,readonly`,s,c=i?["node","/app/server.js"]:t.plan.artifact.type==="web-application"?["node","--input-type=module","--eval",`import{createServer}from'node:http';import{readFile,stat}from'node:fs/promises';import path from'node:path';const root='/app/dist',mime={'.html':'text/html; charset=utf-8','.js':'text/javascript; charset=utf-8','.css':'text/css; charset=utf-8','.json':'application/json; charset=utf-8','.svg':'image/svg+xml'};createServer(async(q,s)=>{s.setHeader('x-content-type-options','nosniff');if(q.url==='/health'){s.setHeader('content-type','application/json');s.end('{"status":"ok"}');return}if(q.url==='/dyyto-runtime-config.json'){s.setHeader('cache-control','no-store');s.setHeader('content-type','application/json');s.end(JSON.stringify({schemaVersion:1,applicationId:${JSON.stringify(t.plan.artifact.identity)},releaseId:${JSON.stringify(t.plan.artifact.digest)},deploymentId:${JSON.stringify(t.plan.planId)},collectorEndpoint:'http://127.0.0.1:4318'}));return}const raw=(q.url||'/').split(/[?#]/)[0];if(raw.endsWith('.map')){s.statusCode=404;s.end();return}let target=path.resolve(root,'.'+raw);if(target!==root&&!target.startsWith(root+'/')){s.statusCode=404;s.end();return}try{if((await stat(target)).isDirectory())target=path.join(target,'index.html');s.setHeader('content-type',mime[path.extname(target)]||'application/octet-stream');s.end(await readFile(target))}catch{try{s.setHeader('content-type','text/html; charset=utf-8');s.end(await readFile(path.join(root,'index.html')))}catch{s.statusCode=404;s.end()}}}).listen(3000,'0.0.0.0')`]:["node","/app/dist/index.js"];try{s=await this.runner.run("docker",["run","--detach","--name",n,"--label",`dev.dyyto.plan=${t.plan.planId}`,"--publish","127.0.0.1::3000","--env","PORT=3000","--mount",o,"--read-only","--cap-drop","ALL","--user","65532:65532",Ma,...c],{cwd:t.projectRoot,timeout:12e4})}catch(p){return fi(p,"docker")}let l=s.stdout.trim();if(l.length===0)throw new O("DELIVERY_EXECUTION_UNKNOWN","Docker did not return a container identity");let f=`const r=await fetch('http://127.0.0.1:3000${i?"/api/health":"/health"}');if(!r.ok)process.exit(1);const b=await r.json();if(b.status!=='ok')process.exit(1)`;try{await this.runner.run("docker",["exec",n,"node","--input-type=module","--eval",f],{cwd:t.projectRoot,timeout:3e4})}catch(p){try{await this.runner.run("docker",["rm","--force",n],{cwd:t.projectRoot,timeout:3e4})}catch{}throw p instanceof _t&&p.code==="ETIMEDOUT"?new O("DELIVERY_EXECUTION_UNKNOWN","Docker health outcome is unknown after timeout"):new O("DELIVERY_EXECUTION_FAILED","Docker application health check failed; the new container was removed")}return{externalIdentity:l,details:{containerName:n,image:Ma,...i?{runtime:"next-standalone",renderMode:"ssr"}:{}}}}async inspect(t){let r=rE(t.plan.planId);try{let n=await this.runner.run("docker",["inspect","--format",'{{.Id}}|{{.State.Running}}|{{index .Config.Labels "dev.dyyto.plan"}}',r],{cwd:t.projectRoot,timeout:3e4}),[i,a,o]=n.stdout.trim().split("|");return o!==t.plan.planId?{state:"unknown",details:{containerName:r}}:{state:a==="true"?"verified":"unknown",...i===void 0?{}:{externalIdentity:i},details:{containerName:r,image:Ma}}}catch(n){if(n instanceof _t&&n.code==="ENOENT")throw new O("DELIVERY_ADAPTER_UNAVAILABLE","docker executable is unavailable");if(n instanceof _t&&/No such object|No such container/i.test(n.stderrText))return{state:"absent",details:{containerName:r}};if(n instanceof _t)return{state:"unknown",details:{containerName:r}};throw n}}recover(t){return this.inspect(t)}},Gp=class{adapterId="publication.hosted-static";async prepare(t){let{parsePageAuthoringDocument:r}=await Promise.resolve().then(()=>(Ln(),Gd)),{planHostedCsr:n}=await Promise.resolve().then(()=>(zp(),Fp)),i=await iE(t.projectRoot,r);if(i.project.renderMode!=="csr")throw new O("DELIVERY_PROJECT_UNSUPPORTED","Hosted CSR cannot publish an SSR project");let a=n(i);return{artifact:{type:"web-bundle",identity:`page:${i.project.projectId}`,digest:a.bundleDigest},target:{adapterId:this.adapterId,location:"object-store://hosted-csr"},details:{renderMode:"csr",currentDigest:a.bundleDigest}}}async execute(t){if(t.plan.kind!=="hosted-static")throw new O("DELIVERY_PROJECT_UNSUPPORTED","Hosted CSR adapter only executes hosted-static plans");let{filesystemObjectStore:r}=await Promise.resolve().then(()=>(Qv(),Xv)),{parsePageAuthoringDocument:n}=await Promise.resolve().then(()=>(Ln(),Gd)),{publishHostedCsr:i}=await Promise.resolve().then(()=>(zp(),Fp)),a=await iE(t.projectRoot,n),o=await i(a,r(le.join(t.projectRoot,".dyyto","hosted-objects")));if(o.bundleDigest!==t.plan.artifact.digest)throw new O("DELIVERY_PRECONDITION_FAILED","Hosted CSR bundle changed after Plan approval");return await jj(le.join(t.projectRoot,".dyyto"),{recursive:!0,mode:448}),await Kp(le.join(t.projectRoot,".dyyto","hosted-pointer.json"),`${JSON.stringify(o.pointer,null,2)}
|
|
23
|
+
`,{mode:384}),{externalIdentity:`page:${a.project.projectId}`,details:{renderMode:"csr",currentDigest:o.pointer.currentDigest,routeTable:JSON.stringify(o.pointer.routes)}}}async inspect(t){if(t.plan.kind!=="hosted-static")return{state:"unknown",details:{renderMode:"csr"}};try{let r=await this.prepare({projectRoot:t.projectRoot,profile:t.plan.project.profile,parameters:{}});if(r.artifact.digest!==t.plan.artifact.digest)return{state:"unknown",details:{renderMode:"csr"}};let n=r.details.currentDigest;return n===void 0?{state:"unknown",details:{renderMode:"csr"}}:{state:"verified",externalIdentity:t.plan.artifact.identity,details:{renderMode:"csr",currentDigest:n}}}catch(r){return r instanceof O&&r.code==="DELIVERY_PROJECT_UNSUPPORTED"?{state:"absent",details:{renderMode:"csr"}}:{state:"unknown",details:{renderMode:"csr"}}}}recover(t){return this.inspect(t)}};async function iE(e,t){try{let r=JSON.parse(await Va(le.join(e,"src/page-authoring/project.json"),"utf8")),n=le.join(e,"src/page-authoring/pages"),i=(await aE(n)).filter(o=>o.endsWith(".json")).sort((o,s)=>o.localeCompare(s)),a=await Promise.all(i.map(async o=>JSON.parse(await Va(le.join(n,o),"utf8"))));return t({project:r,pages:a})}catch(r){throw r instanceof O?r:new O("DELIVERY_PROJECT_UNSUPPORTED","Hosted CSR requires projected src/page-authoring files")}}import{readFile as Xs,readdir as Bj,rm as qj}from"node:fs/promises";import{execFile as Gj}from"node:child_process";import{promisify as Kj}from"node:util";import pi from"node:path";var Wj=Kj(Gj);async function Hj(e){let t=[];async function r(n,i=""){for(let a of await Bj(n,{withFileTypes:!0})){let o=i?`${i}/${a.name}`:a.name;a.isDirectory()?await r(pi.join(n,a.name),o):a.isFile()&&t.push(o)}}return await r(e),t.sort()}async function Jj(e){e.build!==!1&&await Wj("corepack",["pnpm","build"],{cwd:e.projectRoot,timeout:12e4});let t=pi.join(e.projectRoot,"dist"),r=await Hj(t),n=r.filter(c=>!c.endsWith(".map")),i=[];for(let c of n)i.push({path:c,digest:A(await Xs(pi.join(t,c)))});let a=A(JSON.stringify(i)),o=new Zi(e.workspaceRoot),s=[];for(let c of r.filter(l=>l.endsWith(".js.map"))){let l=c.slice(0,-4),d=pi.join(t,l),f=JSON.parse(await Xs(pi.join(t,c),"utf8"));if(delete f.sourcesContent,!await Xs(d).catch(()=>null))throw new oe("RUNTIME_ERROR_INVALID",`Source Map asset '${l}' is missing`);s.push(await o.registerSourceMap({releaseId:a,asset:l,assetDigest:A(await Xs(d)),map:f,registeredAt:e.registeredAt??new Date().toISOString()})),await qj(pi.join(t,c))}if(s.length===0)throw new oe("RUNTIME_ERROR_INVALID","Production build did not emit private Source Maps");return{releaseId:a,registrations:s,publicFiles:n}}import{createHash as Yj}from"node:crypto";import{execFile as Zj}from"node:child_process";import{mkdtemp as sE,readFile as Xj,realpath as cE,rm as lE,writeFile as Qj}from"node:fs/promises";import{tmpdir as dE}from"node:os";import Fa from"node:path";import{promisify as eL}from"node:util";var tL=eL(Zj);function rL(e=process.env){return async({executable:t,args:r,cwd:n,timeoutMs:i})=>{let a=["PATH","TMPDIR","TEMP","TMP","CI","AWS_ROLE_ARN","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_SESSION_NAME","AWS_REGION","AWS_DEFAULT_REGION","GH_TOKEN","GITHUB_TOKEN","GH_HOST"],o={NO_COLOR:"1",AWS_PAGER:"",GH_PAGER:"cat",GH_PROMPT_DISABLED:"1"};for(let s of a)e[s]!==void 0&&(o[s]=e[s]);try{return{stdout:(await tL(t,[...r],{cwd:n,env:o,timeout:i,maxBuffer:1048576})).stdout}}catch{throw new G(t==="gh"?"REGISTRY_ATTESTATION_FAILED":"REGISTRY_PROVIDER_FAILED")}}}var G=class extends Error{constructor(r){super(r);this.code=r}code},fE=/^[A-Za-z0-9][A-Za-z0-9._-]{1,99}$/u,nL=/^[0-9]{12}$/u,iL=/^[a-z]{2}(?:-gov)?-[a-z]+-[0-9]$/u,aL=/^@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$/u,oL=/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/u;function pE(e){if(!fE.test(e.domain)||!nL.test(e.domainOwner)||!iL.test(e.region))throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");return["--domain",e.domain,"--domain-owner",e.domainOwner,"--region",e.region,"--no-cli-pager","--no-cli-auto-prompt","--output","json"]}function sL(e){if(!fE.test(e.repository))throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");return[...pE(e),"--repository",e.repository]}function uE(e){if(!aL.test(e.packageName)||!oL.test(e.version))throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");let[t,r]=e.packageName.slice(1).split("/");return{namespace:t,name:r,args:["--format","npm","--namespace",t,"--package",r,"--package-version",e.version]}}function za(e){if(!e||e.length>1024*1024)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");try{return JSON.parse(e)}catch{throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID")}}function hE(e){return`sha512-${Yj("sha512").update(e).digest("base64")}`}var Wp=class{constructor(t,r,n){this.provider=t;this.location=r;this.runner=n}provider;location;runner;async read(t,r){if(this.provider.kind!=="aws-codeartifact"||this.provider.verification!=="external")throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");let n=sL(this.location),i=uE(t),a=await sE(Fa.join(await cE(dE()),"dyyto-codeartifact-read-"));try{let o,s;try{o=(await this.runner({executable:"aws",args:["codeartifact","describe-package-version",...n,...i.args],cwd:a,timeoutMs:3e4})).stdout,s=(await this.runner({executable:"aws",args:["codeartifact","list-package-version-assets",...n,...i.args],cwd:a,timeoutMs:3e4})).stdout}catch{throw new G("REGISTRY_PROVIDER_FAILED")}let l=za(o).packageVersion;if(typeof l?.revision!="string"||l.revision.length>50||!/^\S+$/u.test(l.revision)||l.status!=="Published"||l.origin?.originType!=="INTERNAL"||l.origin.domainEntryPoint?.repositoryName!==this.location.repository||l.origin.domainEntryPoint.externalConnectionName!==void 0)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");let f=za(s).assets?.map(h=>h.name).filter(h=>typeof h=="string"&&h.endsWith(".tgz"))??[];if(f.length!==1||f[0].includes("/")||f[0].includes("\\")||f[0].length>255)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");let p=Fa.join(a,"package.tgz");try{await this.runner({executable:"aws",args:["codeartifact","get-package-version-asset",...n,...i.args,"--asset",f[0],p],cwd:a,timeoutMs:6e4})}catch{throw new G("REGISTRY_PROVIDER_FAILED")}let u=await Xj(p).catch(()=>{throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID")});if(u.byteLength===0||u.byteLength>50*1024*1024)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");return{observation:{schemaVersion:1,providerReleaseRevision:this.provider.revision,registryId:t.registryId,packageName:t.packageName,version:t.version,providerVersionRevision:l.revision,status:"published",origin:"internal-publish",assetName:f[0],integrity:hE(u),tarballDigest:A(u),observedAt:r},artifact:u}}finally{await lE(a,{recursive:!0,force:!0})}}async observe(t,r){return(await this.read(t,r)).observation}};function cL(){return async({url:e,bearerToken:t,accept:r,maximumBytes:n})=>{let i;try{i=await fetch(e,{method:"GET",redirect:"error",headers:{accept:r,authorization:"Bearer "+t},signal:AbortSignal.timeout(3e4)})}catch{throw new G("REGISTRY_PROVIDER_FAILED")}if(!i.ok||i.body===null)throw new G("REGISTRY_PROVIDER_FAILED");let a=Number(i.headers.get("content-length"));if(Number.isFinite(a)&&a>n)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");let o=new Uint8Array(await i.arrayBuffer());if(o.byteLength===0||o.byteLength>n)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");let s=i.headers.get("content-type");return{status:i.status,body:o,...s===null?{}:{contentType:s}}}}var Qs=class{constructor(t,r,n,i="npm-registry"){this.provider=t;this.registryOrigin=r;this.client=n;this.acceptedKind=i}provider;registryOrigin;client;acceptedKind;async read(t,r,n){if(this.provider.kind!==this.acceptedKind||this.provider.verification!=="delivery-receipt"||r.kind!=="bearer-token"||!r.secret)throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");try{jo(r,n)}catch{throw new G("REGISTRY_PROVIDER_CONFIG_INVALID")}uE(t);let i;try{i=new URL(this.registryOrigin)}catch{throw new G("REGISTRY_PROVIDER_CONFIG_INVALID")}if(i.protocol!=="https:"||i.username||i.password||i.search||i.hash||!i.pathname.endsWith("/"))throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");let a=new URL(encodeURIComponent(t.packageName),i),o=await this.client({url:a.href,bearerToken:r.secret,accept:"application/vnd.npm.install-v1+json, application/json",maximumBytes:1024*1024}),s=za(Buffer.from(o.body).toString("utf8")),c=s.versions?.[t.version];if(s.name!==t.packageName||c?.name!==t.packageName||c.version!==t.version||typeof c.dist?.integrity!="string"||typeof c.dist.tarball!="string")throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");let l;try{l=new URL(c.dist.tarball)}catch{throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID")}if(l.origin!==i.origin||!l.pathname.startsWith(i.pathname)||l.username||l.password||l.search||l.hash||!l.pathname.endsWith(".tgz"))throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");let d=await this.client({url:l.href,bearerToken:r.secret,accept:"application/octet-stream",maximumBytes:50*1024*1024}),f=hE(d.body);if(f!==c.dist.integrity)throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");return{observation:{schemaVersion:1,providerReleaseRevision:this.provider.revision,registryId:t.registryId,packageName:t.packageName,version:t.version,providerVersionRevision:A(t.version+":"+f),status:"published",origin:"internal-publish",assetName:Fa.posix.basename(l.pathname),integrity:f,tarballDigest:A(d.body),observedAt:n},artifact:d.body}}},Hp=class extends Qs{constructor(t,r,n){super(t,r,n,"cnpmcore")}},Jp=class{constructor(t,r,n){this.location=t;this.runner=r;this.roleSubject=n}location;runner;roleSubject;async resolve(t,r,n){if(!/^[a-z][a-z0-9._:-]{2,127}$/u.test(t)||!/^[a-z][a-z0-9.-]{2,127}$/u.test(r)||!this.roleSubject.startsWith("arn:aws:iam::")||this.roleSubject.length>512)throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");let i=["codeartifact","get-authorization-token",...pE(this.location),"--duration-seconds","900"],a;try{a=(await this.runner({executable:"aws",args:i,cwd:process.cwd(),timeoutMs:3e4})).stdout}catch{throw new G("REGISTRY_PROVIDER_FAILED")}let o=za(a);if(typeof o.authorizationToken!="string"||o.authorizationToken.length<16||o.authorizationToken.length>16384||/[\r\n\0]/u.test(o.authorizationToken)||typeof o.expiration!="number"||!Number.isFinite(o.expiration))throw new G("REGISTRY_PROVIDER_RESPONSE_INVALID");return{schemaVersion:1,kind:"bearer-token",secret:o.authorizationToken,subjectDigest:A(`${r}:${t}:${this.roleSubject}`),issuedAt:n,expiresAt:new Date(o.expiration*1e3).toISOString()}}},Yp=class{constructor(t,r){this.policy=t;this.runner=r}policy;runner;async verify(t,r){if(!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u.test(this.policy.repository)||!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/.+\.ya?ml$/u.test(this.policy.signerWorkflow)||!this.policy.sourceRef.startsWith("refs/")||this.policy.issuer!=="https://token.actions.githubusercontent.com")throw new G("REGISTRY_PROVIDER_CONFIG_INVALID");let n=await sE(Fa.join(await cE(dE()),"dyyto-attestation-read-")),i=Fa.join(n,"package.tgz");try{await Qj(i,t,{mode:384});let a;try{a=(await this.runner({executable:"gh",args:["attestation","verify",i,"--repo",this.policy.repository,"--signer-repo",this.policy.repository,"--signer-workflow",this.policy.signerWorkflow,"--source-ref",this.policy.sourceRef,"--cert-oidc-issuer",this.policy.issuer,"--predicate-type","https://slsa.dev/provenance/v1","--deny-self-hosted-runners","--format","json"],cwd:n,timeoutMs:6e4})).stdout}catch{throw new G("REGISTRY_ATTESTATION_FAILED")}return za(a),{schemaVersion:1,mode:"external",issuerDigest:A(this.policy.issuer),buildIdentityDigest:A(`${this.policy.repository}:${this.policy.signerWorkflow}:${this.policy.sourceRef}`),subjectDigest:A(t),statementDigest:A(a),verifiedAt:r}}finally{await lE(n,{recursive:!0,force:!0})}}};import{closeSync as lL,existsSync as gE,fstatSync as dL,openSync as fL,readFileSync as pL,writeSync as uL}from"node:fs";import{execFileSync as hL}from"node:child_process";import{mkdir as mL,readFile as ui,realpath as qa,rename as gL,unlink as Zp,writeFile as yL}from"node:fs/promises";import{spawn as wL}from"node:child_process";import Ye from"node:path";import{randomUUID as yE}from"node:crypto";var Qp=e=>Ye.join(e,".dyyto","runtime"),Ba=e=>Ye.join(Qp(e),"project-process.json"),Xp=e=>Ye.join(Qp(e),"project-process.log"),wE=e=>{try{return process.kill(e,0),!0}catch{return!1}},mE=e=>{try{return process.kill(-e,0),!0}catch{return!1}},_E=e=>{if(!wE(e.pid))return!1;try{let t=gE(`/proc/${e.pid}/cmdline`)?pL(`/proc/${e.pid}/cmdline`,"utf8").replaceAll("\0"," "):hL("ps",["-p",String(e.pid),"-o","command="],{encoding:"utf8",timeout:2e3});return t.includes(e.projectRoot)&&t.includes("pnpm")}catch{return!1}};async function eu(e){try{let t=sy(JSON.parse(await ui(Ba(e),"utf8")));return t.projectRoot!==e?null:t}catch{return null}}async function _L(e,t){let r=`${e}.${yE()}.tmp`;await yL(r,`${JSON.stringify(t,null,2)}
|
|
24
|
+
`,{mode:384}),await gL(r,e)}async function IE(e){let t=await qa(Ye.resolve(e)),r=await eu(t);return r===null?{projectRoot:t,state:"stopped"}:_E(r)?{projectRoot:t,state:"running",processId:r.processId,command:r.command,startedAt:r.startedAt}:{projectRoot:t,state:"stale",processId:r.processId,command:r.command,startedAt:r.startedAt}}async function IL(e,t){let r=await qa(Ye.resolve(e));if((await IE(r)).state==="running")throw new zt("PROJECT_PROCESS_ALREADY_RUNNING","A managed project process is already running");if(typeof JSON.parse(await ui(Ye.join(r,"package.json"),"utf8")).scripts?.[t]!="string")throw new zt("PROJECT_COMMAND_UNSUPPORTED",`Project does not declare the '${t}' script`);await mL(Qp(r),{recursive:!0,mode:448}),await Zp(Ba(r)).catch(()=>{});let a=fL(Xp(r),"a",384),o=dL(a).size,s=yE(),c=new Date().toISOString();uL(a,`
|
|
25
25
|
[dyyto lifecycle session ${s} \xB7 ${c}]
|
|
26
|
-
`);let
|
|
27
|
-
`),n}async function HL(e,t,r){let n=BL(e,t.manifest),i=KL(t.manifest,n)?await WL(t,n,r):t.root,a;try{({stdout:a}=await VL("npm",["pack","--json","--ignore-scripts","--pack-destination",r],{cwd:i,timeout:12e4,maxBuffer:1024*1024}))}catch{throw new K("LOCAL_ARTIFACT_PACK_FAILED")}let o;try{o=JSON.parse(a)}catch{throw new K("LOCAL_ARTIFACT_PACK_FAILED")}let s=o[0]?.filename;if(typeof s!="string"||s.includes("/")||s.includes("\\")||!s.endsWith(".tgz"))throw new K("LOCAL_ARTIFACT_PACK_FAILED");let c=await nc(ke.join(r,s)).catch(()=>{throw new K("LOCAL_ARTIFACT_PACK_FAILED")}),
|
|
26
|
+
`);let l=wL("corepack",["pnpm","--dir",r,"run",t],{cwd:r,detached:!0,stdio:["ignore",a,a],env:{...process.env,DYYTO_MANAGED_PROCESS:"1",pnpm_config_verify_deps_before_run:"false"}});await new Promise((f,p)=>{l.once("spawn",f),l.once("error",p)}),lL(a),l.unref();let d={schemaVersion:1,processId:s,projectRoot:r,command:t,pid:l.pid,startedAt:c,logPath:Xp(r),logOffset:o};return await _L(Ba(r),d),{projectRoot:r,state:"running",processId:d.processId,command:t,startedAt:d.startedAt}}async function vL(e){let t=await qa(Ye.resolve(e)),r=await eu(t);if(r===null||!wE(r.pid))return await Zp(Ba(t)).catch(()=>{}),{projectRoot:t,state:"stopped"};if(!_E(r))throw new zt("PROJECT_PROCESS_IDENTITY_MISMATCH","Managed process identity no longer matches the recorded project");process.kill(-r.pid,"SIGTERM");let n=Date.now()+3e4;for(;mE(r.pid)&&Date.now()<n;)await new Promise(i=>setTimeout(i,100));if(mE(r.pid))throw new zt("PROJECT_PROCESS_STOP_TIMEOUT","Managed project process did not stop before the deadline");return await Zp(Ba(t)).catch(()=>{}),{projectRoot:t,state:"stopped",processId:r.processId}}async function EL(e,t=0,r=65536){let n=await qa(Ye.resolve(e)),i=Xp(n);if(!gE(i))return{projectRoot:n,cursor:0,text:""};let a=await ui(i),o=await eu(n),s=a.byteLength,c=Number.isSafeInteger(t)&&t>=0?t:0,l=c===0&&o?.logOffset!==void 0?o.logOffset:c,d=l>s?0:Math.max(l,s-r),f=a.subarray(d).toString("utf8").replace(/\u001B(?:\[[0-?]*[ -/]*[@-~]|\][^\u0007]*(?:\u0007|\u001B\\))/gu,"").replaceAll(n,"<project>").replace(/(authorization|cookie|token|secret|password|api[_-]?key)\s*[:=]\s*\S+/giu,"$1=<redacted>");return{projectRoot:n,cursor:s,text:f,truncated:d>l}}async function bL(e){let t=await qa(Ye.resolve(e)),[r,n]=await Promise.all([ui(Ye.join(t,"project-capabilities.json"),"utf8").then(c=>JSON.parse(c)),ui(Ye.join(t,"package.json"),"utf8").then(c=>JSON.parse(c)).catch(()=>({}))]),i=await ui(Ye.join(t,".dyyto","project-lock.json"),"utf8").then(c=>JSON.parse(c)).catch(()=>null),a={...n.dependencies,...n.devDependencies},o=cy({manifest:r,...i===null?{}:{lock:i},dependencies:a}),s=await Promise.all(o.declared.map(async c=>{try{return(await bg(Ye.resolve(import.meta.dirname,"catalog",c.capabilityId,c.version))).release}catch{return{schemaVersion:1,capabilityId:c.capabilityId,version:c.version,integrity:"",consumerProfile:"any-project",compatibility:{node:"",pnpm:"",typescript:""},assets:[],verifiers:[],exit:{ownedAssets:[]}}}}));return{projectRoot:t,...oy({projection:o,releases:s,dependencies:a,hostDependencies:{"@aipt/platform-kernel":"workspace:*"}})}}import{createHash as AL}from"node:crypto";import{createServer as RL}from"node:http";import{readFile as vE,realpath as EE}from"node:fs/promises";import ec from"node:path";var Be=class extends Error{constructor(r){super(r);this.code=r}code};function kL(e){return"sha512-"+AL("sha512").update(e).digest("base64")}async function bE(e){let t=await EE(e).catch(()=>{throw new Be("LOCAL_ARTIFACT_BUNDLE_INVALID")}),r=await vE(ec.join(t,"index.json"),"utf8").catch(()=>{throw new Be("LOCAL_ARTIFACT_BUNDLE_INVALID")}),n;try{n=Rd(JSON.parse(r))}catch{throw new Be("LOCAL_ARTIFACT_BUNDLE_INVALID")}let i=new Map;for(let a of n.artifacts){let o=ec.join(t,a.assetName),s=ec.relative(t,await EE(o).catch(()=>{throw new Be("LOCAL_ARTIFACT_BUNDLE_INVALID")}));if(!s||s.startsWith("..")||ec.isAbsolute(s))throw new Be("LOCAL_ARTIFACT_BUNDLE_INVALID");let c=await vE(o);if(A(c)!==a.tarballDigest||kL(c)!==a.integrity)throw new Be("LOCAL_ARTIFACT_BUNDLE_INVALID");i.set(a.assetName,c)}return{root:t,bundle:n,assets:i}}function SL(e){return new Promise((t,r)=>e.close(n=>n?r(n):t()))}function AE(e){return JSON.stringify({packageName:e.packageName,version:e.version,assetName:e.assetName,integrity:e.integrity,tarballDigest:e.tarballDigest,dependencies:e.dependencies,lifecycleScripts:e.lifecycleScripts})}function NL(e,t){let r=a=>a.split(/[.-]/u).map(o=>/^\d+$/u.test(o)?Number(o):o),n=r(e),i=r(t);for(let a=0;a<Math.max(n.length,i.length);a+=1){let o=n[a]??0,s=i[a]??0;if(o!==s)return typeof o=="number"&&typeof s=="number"?o-s:String(o).localeCompare(String(s))}return 0}function PL(e,t){let r=new Map,n=new Map;for(let i of[e,...t])for(let a of i.bundle.artifacts){let o=`${a.packageName}@${a.version}`,s=r.get(o);if(s!==void 0&&AE(s)!==AE(a))throw new Be("LOCAL_ARTIFACT_BUNDLE_INVALID");let c=i.assets.get(a.assetName);if(c===void 0)throw new Be("LOCAL_ARTIFACT_BUNDLE_INVALID");let l=n.get(a.assetName);if(l!==void 0&&!Buffer.from(l).equals(c))throw new Be("LOCAL_ARTIFACT_BUNDLE_INVALID");r.set(o,a),n.set(a.assetName,c)}return{artifacts:[...r.values()],assets:n}}async function OL(e){if(!Number.isSafeInteger(e.port)||e.port<1||e.port>65535||e.hostname!==void 0&&e.hostname!=="127.0.0.1")throw new Be("LOCAL_ARTIFACT_SERVER_INVALID");let t=await bE(e.bundleRoot),r=await Promise.all((e.fallbackBundleRoots??[]).map(bE)),n=[t.bundle.bundleId,...r.map(s=>s.bundle.bundleId)];if(new Set(n).size!==n.length)throw new Be("LOCAL_ARTIFACT_BUNDLE_INVALID");let i=PL(t,r),a=e.hostname??"127.0.0.1",o=RL((s,c)=>{let l=s.method??"";if(l!=="GET"&&l!=="HEAD"){c.statusCode=405,c.setHeader("allow","GET, HEAD"),c.end();return}let d=new URL(s.url??"/","http://127.0.0.1").pathname,f=decodeURIComponent(d.slice(1)),p=i.artifacts.filter(u=>u.packageName===f).sort((u,h)=>NL(u.version,h.version));if(p.length>0){let u="http://"+a+":"+e.port,h=Object.fromEntries(p.map(y=>[y.version,{name:y.packageName,version:y.version,dependencies:y.dependencies,dist:{integrity:y.integrity,tarball:u+"/tarballs/"+y.assetName}}])),m=p.at(-1),g=Buffer.from(JSON.stringify({name:m.packageName,versions:h,"dist-tags":{latest:m.version}}));c.statusCode=200,c.setHeader("content-type","application/json"),c.setHeader("content-length",String(g.byteLength)),c.end(l==="HEAD"?void 0:g);return}if(d.startsWith("/tarballs/")){let u=d.slice(10),h=i.assets.get(u);if(h!==void 0){c.statusCode=200,c.setHeader("content-type","application/octet-stream"),c.setHeader("content-length",String(h.byteLength)),c.end(l==="HEAD"?void 0:h);return}}c.statusCode=404,c.setHeader("content-type","application/json"),c.end(l==="HEAD"?void 0:JSON.stringify({error:"not_found"}))});return await new Promise((s,c)=>{o.once("error",c),o.listen(e.port,a,s)}).catch(()=>{throw new Be("LOCAL_ARTIFACT_SERVER_INVALID")}),Object.freeze({origin:"http://"+a+":"+e.port+"/",bundle:t.bundle,fallbackBundles:Object.freeze(r.map(s=>s.bundle)),close:()=>SL(o)})}import{createHash as DL}from"node:crypto";import{execFile as CL}from"node:child_process";import{cp as xL,mkdir as RE,mkdtemp as tu,readFile as nc,realpath as Ga,rename as TL,rm as kE,stat as jL,writeFile as rc}from"node:fs/promises";import{tmpdir as LL}from"node:os";import ke from"node:path";import{promisify as $L}from"node:util";import{gunzipSync as ML}from"node:zlib";var VL=$L(CL),UL=["preinstall","install","postinstall","prepublish","prepare"],K=class extends Error{constructor(r){super(r);this.code=r}code};function FL(e){return"sha512-"+DL("sha512").update(e).digest("base64")}async function zL(e,t){let r=await Ga(e).catch(()=>{throw new K("LOCAL_ARTIFACT_INPUT_INVALID")});if(t.length===0||t.length>128||new Set(t).size!==t.length)throw new K("LOCAL_ARTIFACT_INPUT_INVALID");let n=[];for(let i of t){if(!/^(?:packages|fixtures)\/[a-z0-9][a-z0-9._-]{1,127}$/u.test(i))throw new K("LOCAL_ARTIFACT_INPUT_INVALID");let a=await Ga(ke.join(r,i)).catch(()=>{throw new K("LOCAL_ARTIFACT_INPUT_INVALID")}),o=ke.relative(r,a);if(o!==i||o.startsWith("..")||ke.isAbsolute(o))throw new K("LOCAL_ARTIFACT_INPUT_INVALID");let s=await nc(ke.join(a,"package.json")).catch(()=>{throw new K("LOCAL_ARTIFACT_INPUT_INVALID")}),c;try{c=JSON.parse(Buffer.from(s).toString("utf8"))}catch{throw new K("LOCAL_ARTIFACT_INPUT_INVALID")}if(typeof c.name!="string"||typeof c.version!="string")throw new K("LOCAL_ARTIFACT_INPUT_INVALID");n.push({relativeRoot:i,root:a,manifestBytes:s,manifest:c})}return n}function BL(e,t){let r=new Map(e.map(a=>[String(a.manifest.name),String(a.manifest.version)])),n=t.dependencies;if(n===void 0)return{};if(typeof n!="object"||n===null||Array.isArray(n))throw new K("LOCAL_ARTIFACT_INPUT_INVALID");let i={};for(let[a,o]of Object.entries(n)){if(typeof o!="string")throw new K("LOCAL_ARTIFACT_INPUT_INVALID");let s=o.startsWith("workspace:")?r.get(a):o;if(s===void 0)throw new K("LOCAL_ARTIFACT_INPUT_INVALID");i[a]=s}return Object.fromEntries(Object.entries(i).sort(([a],[o])=>a.localeCompare(o)))}function qL(e,t){for(let r=0;r+512<=e.length;){let n=e.subarray(r,r+512);if(n.every(o=>o===0))return;let i=n.toString("utf8",0,100).replace(/\0.*$/su,""),a=Number.parseInt(n.toString("utf8",124,136).replace(/\0.*$/su,"").trim(),8);if(!Number.isSafeInteger(a)||a<0)return;if(i===t)return e.subarray(r+512,r+512+a);r+=512+Math.ceil(a/512)*512}}function GL(e,t,r){let n;try{n=ML(e)}catch{throw new K("LOCAL_ARTIFACT_PACK_FAILED")}let i=qL(n,"package/package.json");if(i===void 0)throw new K("LOCAL_ARTIFACT_PACK_FAILED");let a;try{a=JSON.parse(i.toString("utf8"))}catch{throw new K("LOCAL_ARTIFACT_PACK_FAILED")}let o=a.dependencies===void 0?{}:a.dependencies;if(typeof o!="object"||o===null||Array.isArray(o))throw new K("LOCAL_ARTIFACT_PACK_FAILED");let s=Object.fromEntries(Object.entries(o).sort(([c],[l])=>c.localeCompare(l)));if(a.name!==t.name||a.version!==t.version||JSON.stringify(s)!==JSON.stringify(r))throw new K("LOCAL_ARTIFACT_PACK_FAILED")}function KL(e,t){return e.dependencies===void 0?!1:Object.entries(e.dependencies).some(([r,n])=>t[r]!==n)}async function WL(e,t,r){let n=ke.join(await tu(ke.join(r,"stage-")),"package");await xL(e.root,n,{recursive:!0,filter:a=>ke.basename(a)!=="node_modules"});let i=JSON.parse(Buffer.from(e.manifestBytes).toString("utf8"));return await rc(ke.join(n,"package.json"),`${JSON.stringify({...i,dependencies:t},null,2)}
|
|
27
|
+
`),n}async function HL(e,t,r){let n=BL(e,t.manifest),i=KL(t.manifest,n)?await WL(t,n,r):t.root,a;try{({stdout:a}=await VL("npm",["pack","--json","--ignore-scripts","--pack-destination",r],{cwd:i,timeout:12e4,maxBuffer:1024*1024}))}catch{throw new K("LOCAL_ARTIFACT_PACK_FAILED")}let o;try{o=JSON.parse(a)}catch{throw new K("LOCAL_ARTIFACT_PACK_FAILED")}let s=o[0]?.filename;if(typeof s!="string"||s.includes("/")||s.includes("\\")||!s.endsWith(".tgz"))throw new K("LOCAL_ARTIFACT_PACK_FAILED");let c=await nc(ke.join(r,s)).catch(()=>{throw new K("LOCAL_ARTIFACT_PACK_FAILED")}),l=t.manifest.scripts;if(l!==void 0&&(typeof l!="object"||l===null||Array.isArray(l)))throw new K("LOCAL_ARTIFACT_INPUT_INVALID");let d=UL.filter(f=>Object.hasOwn(l??{},f));return GL(c,t.manifest,n),{artifact:{packageName:String(t.manifest.name),version:String(t.manifest.version),assetName:s,integrity:FL(c),tarballDigest:A(c),dependencies:n,lifecycleScripts:d},bytes:c}}async function SE(e,t){let r=await zL(e,t),n=await tu(ke.join(await Ga(LL()),"dyyto-local-artifact-pack-"));try{let i=await Promise.all(r.map(o=>HL(r,o,n)));i.sort((o,s)=>(o.artifact.packageName+"@"+o.artifact.version).localeCompare(s.artifact.packageName+"@"+s.artifact.version));let a=Ad({artifacts:i.map(o=>o.artifact)});return{packages:r,bundle:a,bytes:new Map(i.map(o=>[o.artifact.assetName,o.bytes]))}}finally{await kE(n,{recursive:!0,force:!0})}}function tc(e,t){return ke.join(e,".dyyto","artifact-plans",t+".json")}function JL(e,t){return ke.join(e,".dyyto","package-artifacts",t)}async function YL(e){let t=await Ga(e.workspaceRoot).catch(()=>{throw new K("LOCAL_ARTIFACT_INPUT_INVALID")}),r=await SE(t,e.packageRoots),n=e.now??new Date,i=kd({packageInputs:r.packages.map(a=>({relativeRoot:a.relativeRoot,manifestDigest:A(a.manifestBytes)})),bundle:r.bundle,generatedAt:n.toISOString(),expiresAt:new Date(n.getTime()+30*6e4).toISOString()});return await RE(ke.dirname(tc(t,i.planId)),{recursive:!0}),await rc(tc(t,i.planId),JSON.stringify(i,null,2)+`
|
|
28
28
|
`,{flag:"wx",mode:384}).catch(async a=>{if(a.code!=="EEXIST")throw a;if(await nc(tc(t,i.planId),"utf8")!==JSON.stringify(i,null,2)+`
|
|
29
|
-
`)throw new K("LOCAL_ARTIFACT_PREIMAGE_CONFLICT")}),i}async function ZL(e){let t=await Ga(e.workspaceRoot).catch(()=>{throw new K("LOCAL_ARTIFACT_INPUT_INVALID")}),r=await nc(tc(t,e.approvedPlanId),"utf8").catch(()=>{throw new K("LOCAL_ARTIFACT_INPUT_INVALID")}),n;try{n=
|
|
29
|
+
`)throw new K("LOCAL_ARTIFACT_PREIMAGE_CONFLICT")}),i}async function ZL(e){let t=await Ga(e.workspaceRoot).catch(()=>{throw new K("LOCAL_ARTIFACT_INPUT_INVALID")}),r=await nc(tc(t,e.approvedPlanId),"utf8").catch(()=>{throw new K("LOCAL_ARTIFACT_INPUT_INVALID")}),n;try{n=dy(JSON.parse(r))}catch{throw new K("LOCAL_ARTIFACT_INPUT_INVALID")}if(n.planId!==e.approvedPlanId)throw new K("LOCAL_ARTIFACT_INPUT_INVALID");if((e.now??new Date).getTime()>Date.parse(n.expiresAt))throw new K("LOCAL_ARTIFACT_PLAN_EXPIRED");let i=JL(t,n.bundle.bundleId);if(await jL(i).then(()=>!0).catch(c=>c.code==="ENOENT"?!1:Promise.reject(c)))throw new K("LOCAL_ARTIFACT_PREIMAGE_CONFLICT");let a=await SE(t,n.packageInputs.map(c=>c.relativeRoot));if(a.bundle.bundleId!==n.bundle.bundleId||a.packages.some((c,l)=>A(c.manifestBytes)!==n.packageInputs[l].manifestDigest))throw new K("LOCAL_ARTIFACT_PREIMAGE_CONFLICT");let o=ke.dirname(i);await RE(o,{recursive:!0});let s=await tu(ke.join(o,".bundle-next-"));try{await Promise.all(n.bundle.artifacts.map(c=>rc(ke.join(s,c.assetName),a.bytes.get(c.assetName),{mode:292}))),await rc(ke.join(s,"index.json"),JSON.stringify(n.bundle,null,2)+`
|
|
30
30
|
`,{mode:292}),await TL(s,i)}catch(c){throw await kE(s,{recursive:!0,force:!0}),c.code==="EEXIST"?new K("LOCAL_ARTIFACT_PREIMAGE_CONFLICT"):c}return{bundleId:n.bundle.bundleId,target:i}}import{mkdir as XL,readFile as hi,realpath as ic,rename as NE,stat as QL,writeFile as PE}from"node:fs/promises";import er from"node:path";var ae=class extends Error{constructor(r,n){super(n);this.code=r;this.name="PackageSourceSwitchError"}code},e$="https://registry.npmjs.org",t$=/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/u;function r$(e,t){if(e==="workspace"){if(t!==void 0)throw new ae("PACKAGE_SOURCE_REGISTRY_INVALID","\u5207\u6362\u5230 workspace \u534F\u8BAE\u65F6\u4E0D\u80FD\u63D0\u4F9B --registry\u3002");return null}let r=e==="public"?t??e$:t;if(typeof r!="string"||r.trim()==="")throw new ae("PACKAGE_SOURCE_REGISTRY_INVALID","\u5207\u6362\u5230\u79C1\u6709\u955C\u50CF\u9700\u8981\u63D0\u4F9B --registry\u3002");let n;try{n=new URL(r)}catch{throw new ae("PACKAGE_SOURCE_REGISTRY_INVALID","Registry must be an absolute http or https origin.")}if(n.protocol!=="http:"&&n.protocol!=="https:"||n.username||n.password||n.search||n.hash)throw new ae("PACKAGE_SOURCE_REGISTRY_INVALID","Registry \u5FC5\u987B\u662F\u4E0D\u542B\u51ED\u636E\u3001\u67E5\u8BE2\u6216\u7247\u6BB5\u7684\u7EDD\u5BF9 HTTP(S) \u5730\u5740\u3002");return n.toString().replace(/\/+$/u,"")}async function n$(e){let t=`${e.origin}/${e.packageName.replace("/","%2F")}`,r;try{r=await fetch(t,{headers:{accept:"application/vnd.npm.install-v1+json, application/json"},redirect:"error",signal:AbortSignal.timeout(e.timeoutMs??15e3)})}catch{throw new ae("PACKAGE_SOURCE_VERSION_UNRESOLVED",`Registry \u672A\u54CD\u5E94 ${e.packageName}\u3002`)}if(!r.ok)throw new ae("PACKAGE_SOURCE_VERSION_UNRESOLVED",`Registry \u67E5\u8BE2 ${e.packageName} \u65F6\u8FD4\u56DE ${r.status}\u3002`);let n;try{n=await r.json()}catch{throw new ae("PACKAGE_SOURCE_VERSION_UNRESOLVED",`Registry returned an unreadable document for ${e.packageName}.`)}let i=n?.["dist-tags"],a=i===null||typeof i!="object"?void 0:i.latest;if(typeof a!="string"||!t$.test(a))throw new ae("PACKAGE_SOURCE_VERSION_UNRESOLVED",`Registry \u6CA1\u6709\u4E3A ${e.packageName} \u63D0\u4F9B\u53EF\u91C7\u7528\u7684\u7CBE\u786E latest \u7248\u672C\u3002`);return a}function i$(e){let{planId:t,...r}=e,n=["changes","desiredPackageJsonBase64","desiredPackageJsonDigest","expiresAt","generatedAt","packageJsonPreimageDigest","packages","planId","projectRoot","registry","schemaVersion","scope","source","state"];if(Object.keys(e).sort().join("\0")!==n.sort().join("\0")||e.schemaVersion!==1||e.state!=="reviewable"||!["workspace","private","public"].includes(e.source)||A(C(r))!==t||!/^sha256:[a-f0-9]{64}$/u.test(e.packageJsonPreimageDigest)||!/^sha256:[a-f0-9]{64}$/u.test(e.desiredPackageJsonDigest))throw new ae("PACKAGE_SOURCE_PLAN_INVALID","Package source Plan is invalid.");return e}async function a$(e){let t=e;for(;;){if((await hi(er.join(t,"package.json"),"utf8").then(i=>JSON.parse(i)).catch(()=>null))?.name==="@aipt/platform-workspace")return t;let n=er.dirname(t);if(n===t)return null;t=n}}async function o$(e,t){let r=er.join(e,".dyyto","package-source-plans");await XL(r,{recursive:!0,mode:448});let n=er.join(r,`${t.planId}.json`),i=`${C(t)}
|
|
31
|
-
`,a=await hi(n,"utf8").catch(s=>s.code==="ENOENT"?null:Promise.reject(s));if(a!==null){if(a!==i)throw new ae("PACKAGE_SOURCE_PLAN_INVALID","Saved Package source Plan differs.");return}let o=`${n}.${process.pid}.tmp`;await PE(o,i,{mode:384,flag:"wx"}),await NE(o,n)}async function ru(e,t){if(!/^sha256:[a-f0-9]{64}$/u.test(t))throw new ae("PACKAGE_SOURCE_PLAN_INVALID","Package source Plan ID is invalid.");let r=await ic(e),n=i$(JSON.parse(await hi(er.join(r,".dyyto","package-source-plans",`${t}.json`),"utf8")));if(n.projectRoot!==r)throw new ae("PACKAGE_SOURCE_PLAN_INVALID","Package source Plan belongs to another project.");return n}async function s$(e){if(e.source!=="workspace"&&e.source!=="public"&&e.source!=="private")throw new ae("PACKAGE_SOURCE_TARGET_INVALID","Package source must be workspace, public or private.");let t=r$(e.source,e.registry),r=await ic(e.projectRoot).catch(()=>{throw new ae("PACKAGE_SOURCE_PROJECT_INVALID","Project directory does not exist.")});if(e.source!=="workspace"&&await a$(r)!==null)throw new ae("PACKAGE_SOURCE_TARGET_INVALID","Dyyto workspace \u6210\u5458\u5FC5\u987B\u4FDD\u6301 @aipt/* \u4F7F\u7528 workspace \u534F\u8BAE\u3002");let n=er.join(r,"package.json"),i=await hi(n).catch(()=>{throw new ae("PACKAGE_SOURCE_PROJECT_INVALID","Project has no package.json.")}),a=[...new Set(Bo({manifests:[{relativeRoot:".",bytes:i}],scope:e.scope}).references.map(p=>p.packageName))].sort(),o=t===null?a.map(p=>[p,"workspace:*"]):await Promise.all(a.map(async p=>[p,await n$({origin:t,packageName:p,...e.timeoutMs===void 0?{}:{timeoutMs:e.timeoutMs}})])),s=ay({manifest:i,scope:e.scope,specifiers:Object.fromEntries(o)}),c=e.generatedAt??new Date().toISOString(),
|
|
32
|
-
${r}`.replace(/(?:Bearer\s+)?npm_[A-Za-z0-9_-]{20,}/gu,"[credential-redacted]").trim();return new Error(n.length>0?n.slice(-8192):"PACKAGE_MANAGER_COMMAND_FAILED",{cause:e})}function m$(e){let t=new URL(e);if(t.protocol!=="http:"||!["127.0.0.1","localhost","[::1]"].includes(t.hostname)||t.username||t.password||t.search||t.hash)throw new Error("PACKAGE_SOURCE_POLICY_VIOLATION");return t}async function su(e,t,r,n,i=new Date().toISOString()){let a=new Map(e.map(c=>[c.registryId,c])),o=new Map(t.map(c=>[c.registryId,c])),s=["ignore-scripts=true","strict-peer-dependencies=true","manage-package-manager-versions=false"];for(let c of[...new Set(r.map(
|
|
31
|
+
`,a=await hi(n,"utf8").catch(s=>s.code==="ENOENT"?null:Promise.reject(s));if(a!==null){if(a!==i)throw new ae("PACKAGE_SOURCE_PLAN_INVALID","Saved Package source Plan differs.");return}let o=`${n}.${process.pid}.tmp`;await PE(o,i,{mode:384,flag:"wx"}),await NE(o,n)}async function ru(e,t){if(!/^sha256:[a-f0-9]{64}$/u.test(t))throw new ae("PACKAGE_SOURCE_PLAN_INVALID","Package source Plan ID is invalid.");let r=await ic(e),n=i$(JSON.parse(await hi(er.join(r,".dyyto","package-source-plans",`${t}.json`),"utf8")));if(n.projectRoot!==r)throw new ae("PACKAGE_SOURCE_PLAN_INVALID","Package source Plan belongs to another project.");return n}async function s$(e){if(e.source!=="workspace"&&e.source!=="public"&&e.source!=="private")throw new ae("PACKAGE_SOURCE_TARGET_INVALID","Package source must be workspace, public or private.");let t=r$(e.source,e.registry),r=await ic(e.projectRoot).catch(()=>{throw new ae("PACKAGE_SOURCE_PROJECT_INVALID","Project directory does not exist.")});if(e.source!=="workspace"&&await a$(r)!==null)throw new ae("PACKAGE_SOURCE_TARGET_INVALID","Dyyto workspace \u6210\u5458\u5FC5\u987B\u4FDD\u6301 @aipt/* \u4F7F\u7528 workspace \u534F\u8BAE\u3002");let n=er.join(r,"package.json"),i=await hi(n).catch(()=>{throw new ae("PACKAGE_SOURCE_PROJECT_INVALID","Project has no package.json.")}),a=[...new Set(Bo({manifests:[{relativeRoot:".",bytes:i}],scope:e.scope}).references.map(p=>p.packageName))].sort(),o=t===null?a.map(p=>[p,"workspace:*"]):await Promise.all(a.map(async p=>[p,await n$({origin:t,packageName:p,...e.timeoutMs===void 0?{}:{timeoutMs:e.timeoutMs}})])),s=ay({manifest:i,scope:e.scope,specifiers:Object.fromEntries(o)}),c=e.generatedAt??new Date().toISOString(),l=e.expiresAt??new Date(Date.parse(c)+30*6e4).toISOString(),d={schemaVersion:1,state:"reviewable",projectRoot:r,scope:e.scope,source:e.source,registry:t,packages:Object.freeze(a),changes:s.changes,packageJsonPreimageDigest:A(i),desiredPackageJsonDigest:A(s.manifest),desiredPackageJsonBase64:Buffer.from(s.manifest).toString("base64"),generatedAt:c,expiresAt:l},f=Object.freeze({...d,planId:A(C(d))});return await o$(r,f),Object.freeze({projectRoot:r,source:e.source,registry:t,packages:Object.freeze(a),changes:s.changes,written:!1,planId:f.planId,state:"reviewable"})}async function c$(e){let t=await ic(e.projectRoot),r=await ru(t,e.approvedPlanId),n=er.join(t,"package.json"),i=await hi(n);if(Date.parse(r.expiresAt)<=Date.parse(e.now??new Date().toISOString()))throw new ae("PACKAGE_SOURCE_PLAN_INVALID","Package source Plan has expired.");if(A(i)===r.desiredPackageJsonDigest)return Object.freeze({projectRoot:t,source:r.source,registry:r.registry,packages:r.packages,changes:r.changes,written:!1,planId:r.planId,state:"applied"});if(A(i)!==r.packageJsonPreimageDigest)throw new ae("PACKAGE_SOURCE_PREIMAGE_CONFLICT","package.json changed after planning.");let a=Buffer.from(r.desiredPackageJsonBase64,"base64");if(A(a)!==r.desiredPackageJsonDigest)throw new ae("PACKAGE_SOURCE_PLAN_INVALID","Desired package.json digest differs from Plan.");let o=(await QL(n)).mode&511,s=er.join(t,`.package.json.${process.pid}.tmp`);return await PE(s,a,{mode:o,flag:"wx"}),await NE(s,n),Object.freeze({projectRoot:t,source:r.source,registry:r.registry,packages:r.packages,changes:r.changes,written:!0,planId:r.planId,state:"applied"})}async function l$(e){throw new ae("PACKAGE_SOURCE_INSTALL_UNAVAILABLE","--install \u5DF2\u5B89\u5168\u5173\u95ED\uFF1A\u8BF7\u4F7F\u7528\u6B63\u5F0F\u80FD\u529B\u91C7\u7528 Kernel \u751F\u6210\u540C\u65F6\u8986\u76D6 manifest \u4E0E lockfile \u7684\u4E0D\u53EF\u53D8 Plan\uFF1B\u5F53\u524D\u5165\u53E3\u53EA\u5141\u8BB8 --approve \u5199\u5165 package.json \u540E\u518D --verify\u3002")}async function d$(e){let t=await ic(e.projectRoot),r=await ru(t,e.planId),n=await hi(er.join(t,"package.json"));if(A(n)!==r.desiredPackageJsonDigest)throw new ae("PACKAGE_SOURCE_VERIFICATION_FAILED","package.json does not match the approved Package source Plan.");let i=r.source==="workspace"?"workspace":"registry";if(Bo({manifests:[{relativeRoot:".",bytes:n}],scope:r.scope,required:i}).violations.length>0)throw new ae("PACKAGE_SOURCE_VERIFICATION_FAILED","Package source verification found mixed sources.");return Object.freeze({projectRoot:t,source:r.source,registry:r.registry,packages:r.packages,changes:r.changes,written:!1,planId:r.planId,state:"verified"})}import{execFile as f$}from"node:child_process";import{mkdir as OE,mkdtemp as nu,readFile as tr,realpath as iu,rm as Ka,writeFile as jt}from"node:fs/promises";import{homedir as p$,tmpdir as au}from"node:os";import V from"node:path";import{promisify as u$}from"node:util";var h$=u$(f$),ou=async({executable:e,args:t,cwd:r,env:n})=>h$(e,[...t],{cwd:r,env:n,timeout:3e5,maxBuffer:16*1024*1024});function CE(e){let t=typeof e=="object"&&e!==null&&"stderr"in e&&typeof e.stderr=="string"?e.stderr:"",r=typeof e=="object"&&e!==null&&"stdout"in e&&typeof e.stdout=="string"?e.stdout:"",n=`${t}
|
|
32
|
+
${r}`.replace(/(?:Bearer\s+)?npm_[A-Za-z0-9_-]{20,}/gu,"[credential-redacted]").trim();return new Error(n.length>0?n.slice(-8192):"PACKAGE_MANAGER_COMMAND_FAILED",{cause:e})}function m$(e){let t=new URL(e);if(t.protocol!=="http:"||!["127.0.0.1","localhost","[::1]"].includes(t.hostname)||t.username||t.password||t.search||t.hash)throw new Error("PACKAGE_SOURCE_POLICY_VIOLATION");return t}async function su(e,t,r,n,i=new Date().toISOString()){let a=new Map(e.map(c=>[c.registryId,c])),o=new Map(t.map(c=>[c.registryId,c])),s=["ignore-scripts=true","strict-peer-dependencies=true","manage-package-manager-versions=false"];for(let c of[...new Set(r.map(l=>l.registryId))].sort()){let l=a.get(c),d=o.get(c);if(!l||!d)throw new Error("PACKAGE_SOURCE_AUTH_REQUIRED");To(d,l);let f=l.authentication.kind==="anonymous-test"?m$(d.origin).toString():new URL(d.origin).toString();for(let p of l.scopes.slice().sort())s.push(`${p}:registry=${f}`);if(l.authentication.kind!=="anonymous-test"){let p=l.authentication.credentialRef;if(!p||!n)throw new Error("PACKAGE_SOURCE_AUTH_REQUIRED");let u;try{u=jo(await n({credentialRef:p,registryId:c}),i)}catch{throw new Error("PACKAGE_SOURCE_AUTH_REQUIRED")}let h=new URL(f);s.push(`//${h.host}${h.pathname}:_authToken=${u.secret}`),s.push(`//${h.host}${h.pathname}:always-auth=true`)}}return`${s.join(`
|
|
33
33
|
`)}
|
|
34
|
-
`}function ac(e,t,r=V.join(e,"store")){let n=r===V.join(e,"store")?void 0:V.dirname(V.dirname(r));return{PATH:process.env.PATH,CI:"1",NO_COLOR:"1",HOME:e,...n?{XDG_CACHE_HOME:V.join(n,"cache")}:{},COREPACK_HOME:process.env.COREPACK_HOME??V.join(p$(),".cache","node","corepack"),COREPACK_ENABLE_PROJECT_SPEC:"0",NPM_CONFIG_USERCONFIG:t,npm_config_userconfig:t,NPM_CONFIG_IGNORE_SCRIPTS:"true",npm_config_ignore_scripts:"true",pnpm_config_manage_package_manager_versions:"false",pnpm_config_store_dir:r}}function cn(e){let t=JSON.parse(Buffer.from(e).toString("utf8"));if(typeof t.packageManager!="string"||!/^pnpm@\d+\.\d+\.\d+$/u.test(t.packageManager))throw new X("PACKAGE_SOURCE_POLICY_VIOLATION");return t.packageManager}function g$(e){let t=Buffer.from(e).toString("utf8").split(/\r?\n/u),r=t.findIndex(o=>o==="importers:");if(r<0)throw new X("PACKAGE_SOURCE_POLICY_VIOLATION");let n=t.findIndex((o,s)=>s>r&&/^ ['"]?\.['"]?:\s*(?:\{\})?\s*$/u.test(o));if(n<0)throw new X("PACKAGE_SOURCE_POLICY_VIOLATION");if(/\{\}\s*$/u.test(t[n]))return new Set;let i=new Set,a=!1;for(let o=n+1;o<t.length;o+=1){let s=t[o];if(/^ \S/u.test(s)||/^\S/u.test(s)&&s.trim().length>0)break;if(/^ (dependencies|devDependencies|optionalDependencies):\s*$/u.exec(s)){a=!0;continue}if(/^ \S/u.test(s)){a=!1;continue}if(!a)continue;let
|
|
34
|
+
`}function ac(e,t,r=V.join(e,"store")){let n=r===V.join(e,"store")?void 0:V.dirname(V.dirname(r));return{PATH:process.env.PATH,CI:"1",NO_COLOR:"1",HOME:e,...n?{XDG_CACHE_HOME:V.join(n,"cache")}:{},COREPACK_HOME:process.env.COREPACK_HOME??V.join(p$(),".cache","node","corepack"),COREPACK_ENABLE_PROJECT_SPEC:"0",NPM_CONFIG_USERCONFIG:t,npm_config_userconfig:t,NPM_CONFIG_IGNORE_SCRIPTS:"true",npm_config_ignore_scripts:"true",pnpm_config_manage_package_manager_versions:"false",pnpm_config_store_dir:r}}function cn(e){let t=JSON.parse(Buffer.from(e).toString("utf8"));if(typeof t.packageManager!="string"||!/^pnpm@\d+\.\d+\.\d+$/u.test(t.packageManager))throw new X("PACKAGE_SOURCE_POLICY_VIOLATION");return t.packageManager}function g$(e){let t=Buffer.from(e).toString("utf8").split(/\r?\n/u),r=t.findIndex(o=>o==="importers:");if(r<0)throw new X("PACKAGE_SOURCE_POLICY_VIOLATION");let n=t.findIndex((o,s)=>s>r&&/^ ['"]?\.['"]?:\s*(?:\{\})?\s*$/u.test(o));if(n<0)throw new X("PACKAGE_SOURCE_POLICY_VIOLATION");if(/\{\}\s*$/u.test(t[n]))return new Set;let i=new Set,a=!1;for(let o=n+1;o<t.length;o+=1){let s=t[o];if(/^ \S/u.test(s)||/^\S/u.test(s)&&s.trim().length>0)break;if(/^ (dependencies|devDependencies|optionalDependencies):\s*$/u.exec(s)){a=!0;continue}if(/^ \S/u.test(s)){a=!1;continue}if(!a)continue;let l=/^ (?:'([^']+)'|"([^"]+)"|([^\s:][^:]*)):\s*$/u.exec(s),d=l?.[1]??l?.[2]??l?.[3];d!==void 0&&i.add(d)}return i}function y$(e,t){let r=e[t];if(r===void 0)return{};if(r===null||typeof r!="object"||Array.isArray(r)||Object.values(r).some(n=>typeof n!="string"))throw new X("PACKAGE_SOURCE_POLICY_VIOLATION");return{...r}}function w$(e){let t=JSON.parse(Buffer.from(e.desiredPackageJson).toString("utf8"));if(t===null||typeof t!="object"||Array.isArray(t))throw new X("PACKAGE_SOURCE_POLICY_VIOLATION");cn(e.desiredPackageJson);let r=g$(e.currentLockfile),n=xE(e.currentLockfile),i=new Set(e.sources.map(({packageName:c})=>c)),a=e.sources.filter(({packageName:c,version:l,integrity:d})=>{let f=n.get(c);return!r.has(c)||f?.version!==l||f.integrity!==d}),o=e.registrySources.filter(({packageName:c})=>r.has(c)&&!i.has(c)),s={...t};for(let c of["dependencies","devDependencies","optionalDependencies"]){let l=y$(t,c);for(let d of a)delete l[d.packageName];for(let d of o.filter(({usage:f})=>c===(f==="development"?"devDependencies":"dependencies")))l[d.packageName]=d.version;Object.keys(l).length===0?delete s[c]:s[c]=l}return{currentPackageJson:Buffer.from(`${JSON.stringify(s,null,2)}
|
|
35
35
|
`),additions:a,removals:o}}function oc(e){let t=e.trim();return t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function xE(e){let t=new Map,r=Buffer.from(e).toString("utf8").split(/\r?\n/u);for(let n=0;n<r.length;n+=1){let i=/^ ['"]?(@[^\s'"]+\/[^\s:'"]+)@([^:'"]+)['"]?:\s*$/u.exec(r[n]);if(!i)continue;let a;for(let o=n+1;o<r.length&&!/^ \S/u.test(r[o]);o+=1){let s=/integrity:\s*([^,}\s]+)/u.exec(r[o]);if(s){a=oc(s[1]);break}}a!==void 0&&t.set(i[1],{version:oc(i[2]),integrity:a})}return t}function cu(e,t,r=!1){let n=Buffer.from(e).toString("utf8");if(r?/(?:^|[\s'"(])(?:file:|git\+)/mu.test(n):/(?:^|[\s'"(])(?:workspace:|link:|file:|git\+)/mu.test(n))throw new X("PACKAGE_SOURCE_POLICY_VIOLATION");let i=xE(e);for(let a of t){let o=i.get(a.packageName);if(o?.version!==a.version||o.integrity!==a.integrity)throw new X("PACKAGE_SOURCE_INTEGRITY_MISMATCH")}}function DE(e){let t=Buffer.from(e).toString("utf8").split(/\r?\n/u),r=new Map,n=t.findIndex(i=>i==="importers:");if(n<0)return r;for(let i=n+1;i<t.length;){let a=/^ ([^\s][^:]*):(?:\s*\{\})?\s*$/u.exec(t[i]);if(!a){if(/^\S/u.test(t[i])&&t[i].trim())break;i+=1;continue}let o=[t[i]],s=i+1;for(;s<t.length&&(/^ /u.test(t[s])||!t[s].trim());)o.push(t[s]),s+=1;r.set(oc(a[1]),A(Buffer.from(`${o.join(`
|
|
36
36
|
`)}
|
|
37
|
-
`))),i=s}return r}function _$(e,t,r){let n=s=>{let c=Buffer.from(s).toString("utf8").split(/\r?\n/u),
|
|
37
|
+
`))),i=s}return r}function _$(e,t,r){let n=s=>{let c=Buffer.from(s).toString("utf8").split(/\r?\n/u),l=new Map,d=c.findIndex(f=>f==="importers:");for(let f=d+1;d>=0&&f<c.length;){let p=/^ ([^\s][^:]*):(?:\s*\{\})?\s*$/u.exec(c[f]);if(!p){if(/^\S/u.test(c[f])&&c[f].trim())break;f+=1;continue}let u=f+1;for(;u<c.length&&(/^ /u.test(c[u])||!c[u].trim());)u+=1;l.set(oc(p[1]),{lines:c.slice(f,u),start:f,end:u}),f=u}return{lines:c,result:l}},i=n(e),a=n(t),o=[...i.result].filter(([s])=>s!==r).map(([s,c])=>({target:a.result.get(s),block:c,importerId:s}));if(o.some(({target:s})=>s===void 0))throw new X("PACKAGE_SOURCE_POLICY_VIOLATION");for(let{target:s,block:c}of o.sort((l,d)=>d.target.start-l.target.start))a.lines.splice(s.start,s.end-s.start,...c.lines);return Buffer.from(`${a.lines.join(`
|
|
38
38
|
`).replace(/\n+$/u,"")}
|
|
39
|
-
`)}async function _8(e){let t=await nu(V.join(await iu(au()),"dyyto-package-resolve-"));try{let r=V.join(t,"userconfig.npmrc"),n=V.join(t,"store"),i=ac(t,r,n),a=e.runner??ou;await jt(r,await su(e.registries,e.endpointBindings,e.registrySources??e.sources,e.credentialProvider,e.now),{mode:384}),await jt(V.join(t,"package.json"),e.desiredPackageJson),e.currentLockfile!==void 0&&await jt(V.join(t,"pnpm-lock.yaml"),e.currentLockfile);try{if(e.currentLockfile!==void 0){let s=w$({desiredPackageJson:e.desiredPackageJson,currentLockfile:e.currentLockfile,sources:e.sources,registrySources:e.registrySources??e.sources});await jt(V.join(t,"package.json"),s.currentPackageJson),s.removals.length>0&&await a({executable:"corepack",args:[cn(e.desiredPackageJson),"remove",...s.removals.map(({packageName:
|
|
39
|
+
`)}async function _8(e){let t=await nu(V.join(await iu(au()),"dyyto-package-resolve-"));try{let r=V.join(t,"userconfig.npmrc"),n=V.join(t,"store"),i=ac(t,r,n),a=e.runner??ou;await jt(r,await su(e.registries,e.endpointBindings,e.registrySources??e.sources,e.credentialProvider,e.now),{mode:384}),await jt(V.join(t,"package.json"),e.desiredPackageJson),e.currentLockfile!==void 0&&await jt(V.join(t,"pnpm-lock.yaml"),e.currentLockfile);try{if(e.currentLockfile!==void 0){let s=w$({desiredPackageJson:e.desiredPackageJson,currentLockfile:e.currentLockfile,sources:e.sources,registrySources:e.registrySources??e.sources});await jt(V.join(t,"package.json"),s.currentPackageJson),s.removals.length>0&&await a({executable:"corepack",args:[cn(e.desiredPackageJson),"remove",...s.removals.map(({packageName:d})=>d).sort(),"--lockfile-only"],cwd:t,env:i});for(let d of["runtime","development"]){let f=s.additions.filter(p=>p.usage===d).sort((p,u)=>p.packageName.localeCompare(u.packageName));f.length>0&&await a({executable:"corepack",args:[cn(e.desiredPackageJson),"add",...f.map(({packageName:p,version:u})=>`${p}@${u}`),"--save-exact",d==="development"?"--save-dev":"--save-prod","--lockfile-only","--trust-lockfile","--ignore-scripts"],cwd:t,env:i})}let c=JSON.parse(await tr(V.join(t,"package.json"),"utf8")),l=JSON.parse(Buffer.from(e.desiredPackageJson).toString("utf8"));if(C(c)!==C(l))throw new X("PACKAGE_SOURCE_POLICY_VIOLATION")}else await a({executable:"corepack",args:[cn(e.desiredPackageJson),"install","--lockfile-only","--resolution-only","--no-frozen-lockfile","--ignore-scripts"],cwd:t,env:i})}catch(s){throw new X("PACKAGE_SOURCE_OUTCOME_UNKNOWN",{cause:CE(s)})}let o=await tr(V.join(t,"pnpm-lock.yaml"));return cu(o,e.sources),{lockfile:o,packages:e.sources.map(({registryId:s,packageName:c,version:l,integrity:d})=>({registryId:s,packageName:c,version:l,integrity:d}))}}finally{await Ka(t,{recursive:!0,force:!0})}}async function I8(e){if(e.topology.mode!=="pnpm-shared-lockfile")throw new X("PACKAGE_SOURCE_POLICY_VIOLATION");let t=await nu(V.join(await iu(au()),"dyyto-workspace-package-resolve-"));try{let r=await tr(V.join(e.topology.transactionRoot,"pnpm-workspace.yaml"));await jt(V.join(t,"pnpm-workspace.yaml"),r),await jt(V.join(t,"pnpm-lock.yaml"),e.currentLockfile);let n=await tr(V.join(e.topology.transactionRoot,"package.json")).catch(p=>p.code==="ENOENT"?void 0:Promise.reject(p));n&&await jt(V.join(t,"package.json"),n);for(let p of await kg(e.topology.transactionRoot)){let u=V.join(t,...p.relativeRoot.split("/"));await OE(u,{recursive:!0}),await jt(V.join(u,"package.json"),p.relativeRoot===e.topology.unitRelativeRoot?e.desiredPackageJson:p.bytes)}let i=V.join(t,".home");await OE(i);let a=V.join(i,"userconfig.npmrc");await jt(a,`${await su(e.registries,e.endpointBindings,e.registrySources??e.sources,e.credentialProvider,e.now)}enable-modules-dir=false
|
|
40
40
|
link-workspace-packages=false
|
|
41
41
|
prefer-workspace-packages=false
|
|
42
42
|
save-workspace-protocol=false
|
|
43
|
-
`,{mode:384});let o;try{o=await(e.runner??ou)({executable:"corepack",args:[cn(e.desiredPackageJson),"install","--lockfile-only","--resolution-only","--no-frozen-lockfile","--ignore-scripts",...e.persistentStoreDir?["--reporter","ndjson"]:[],"--filter",`./${e.topology.unitRelativeRoot}`],cwd:t,env:ac(i,a,e.persistentStoreDir)})}catch(p){throw new X("PACKAGE_SOURCE_OUTCOME_UNKNOWN",{cause:CE(p)})}let s=await tr(V.join(t,"pnpm-lock.yaml")),c=_$(e.currentLockfile,s,e.topology.unitImporterId);cu(c,e.sources,!0);let
|
|
44
|
-
${o.stderr}`))}}finally{await Ka(t,{recursive:!0,force:!0})}}function v8(e){let t=new Map,r=e.runner??ou;return{async prepare({plan:n}){if(!n.packageAdoption)throw new Error("PACKAGE_SOURCE_POLICY_VIOLATION");let i=e.now?.()??new Date().toISOString(),a=Date.parse(i);for(let
|
|
43
|
+
`,{mode:384});let o;try{o=await(e.runner??ou)({executable:"corepack",args:[cn(e.desiredPackageJson),"install","--lockfile-only","--resolution-only","--no-frozen-lockfile","--ignore-scripts",...e.persistentStoreDir?["--reporter","ndjson"]:[],"--filter",`./${e.topology.unitRelativeRoot}`],cwd:t,env:ac(i,a,e.persistentStoreDir)})}catch(p){throw new X("PACKAGE_SOURCE_OUTCOME_UNKNOWN",{cause:CE(p)})}let s=await tr(V.join(t,"pnpm-lock.yaml")),c=_$(e.currentLockfile,s,e.topology.unitImporterId);cu(c,e.sources,!0);let l=DE(e.currentLockfile),d=DE(c),f=[];for(let[p,u]of l)if(p!==e.topology.unitImporterId){let h=d.get(p);if(!h||h!==u)throw new X("PACKAGE_SOURCE_POLICY_VIOLATION",{cause:new Error(`non-target importer drift:${p}`)});f.push({importerId:p,preimageDigest:u,desiredDigest:h})}return{lockfile:c,packages:e.sources.map(({registryId:p,packageName:u,version:h,integrity:m})=>({registryId:p,packageName:u,version:h,integrity:m})),preservedImporterDigests:Object.freeze(f.sort((p,u)=>p.importerId.localeCompare(u.importerId))),executionObservationDigest:A(Buffer.from(`${o.stdout}
|
|
44
|
+
${o.stderr}`))}}finally{await Ka(t,{recursive:!0,force:!0})}}function v8(e){let t=new Map,r=e.runner??ou;return{async prepare({plan:n}){if(!n.packageAdoption)throw new Error("PACKAGE_SOURCE_POLICY_VIOLATION");let i=e.now?.()??new Date().toISOString(),a=Date.parse(i);for(let l of n.packageAdoption.endpointBindings){let d=e.endpointBindings.find(p=>p.registryId===l.registryId),f=e.registries.find(p=>p.registryId===l.registryId);if(!d||!f||To(d,f).bindingDigest!==l.bindingDigest||Date.parse(d.expiresAt)<=a)throw new X("PACKAGE_SOURCE_POLICY_VIOLATION")}let o=await nu(V.join(await iu(au()),"dyyto-package-apply-")),s=V.join(o,"userconfig.npmrc"),c=n.packageAdoption.schemaVersion===2&&n.packageAdoption.topology.mode==="pnpm-shared-lockfile";try{await jt(s,`${await su(e.registries,e.endpointBindings,n.packageAdoption.sources,e.credentialProvider,i)}${c?`link-workspace-packages=false
|
|
45
45
|
prefer-workspace-packages=false
|
|
46
46
|
save-workspace-protocol=false
|
|
47
|
-
`:""}`,{mode:384}),t.set(n.planId,{home:o,userconfig:s})}catch(
|
|
47
|
+
`:""}`,{mode:384}),t.set(n.planId,{home:o,userconfig:s})}catch(l){throw await Ka(o,{recursive:!0,force:!0}),new X("PACKAGE_SOURCE_POLICY_VIOLATION",{cause:l})}},async install({projectRoot:n,plan:i}){let a=t.get(i.planId);if(!a)throw new X("PACKAGE_INSTALL_FAILED");try{let o=i.packageAdoption;if(!o)throw new Error("missing facts");let s=o.schemaVersion===2&&o.topology.mode==="pnpm-shared-lockfile",c=s?o.topology.unitRelativeRoot:".",l=await tr(V.join(n,...c==="."?[]:c.split("/"),"package.json")),d=e.storeRoot===void 0?V.join(n,".dyyto","resolution-worker","store",s?"shared":"standalone"):V.join(e.storeRoot,"shared");await r({executable:"corepack",args:[cn(l),"install","--frozen-lockfile","--ignore-scripts"],cwd:n,env:ac(a.home,a.userconfig,d)})}catch(o){throw new X("PACKAGE_INSTALL_FAILED",{cause:o})}},async verify({projectRoot:n,plan:i}){let a=i.packageAdoption;if(!a)throw new X("PACKAGE_SOURCE_POLICY_VIOLATION");let o=a.schemaVersion===2&&a.topology.mode==="pnpm-shared-lockfile"?a.topology.unitRelativeRoot:".",[s,c]=await Promise.all([tr(V.join(n,...o==="."?[]:o.split("/"),"package.json")),tr(V.join(n,a.schemaVersion===2?a.topology.lockfilePath:"pnpm-lock.yaml"))]);if(a.desiredPackageJsonDigest!==A(s)||a.desiredLockfileDigest!==A(c))throw new X("PACKAGE_SOURCE_INTEGRITY_MISMATCH");if(i.action==="remove"){let l=Buffer.from(c).toString("utf8"),d=JSON.parse(Buffer.from(s).toString("utf8"));for(let f of a.sources)if(d.dependencies?.[f.packageName]!==void 0||d.devDependencies?.[f.packageName]!==void 0||l.includes(`${f.packageName}@${f.version}`))throw new X("PACKAGE_SOURCE_INTEGRITY_MISMATCH")}else cu(c,a.sources,a.schemaVersion===2)},async restore({projectRoot:n,plan:i}){let a=t.get(i.planId);if(!a)throw new X("PACKAGE_INSTALL_RECOVERY_REQUIRED");if(i.packageAdoption?.lockfilePreimage.kind==="absent"){await Ka(V.join(n,"node_modules"),{recursive:!0,force:!0});return}let o=i.packageAdoption;if(!o)throw new X("PACKAGE_INSTALL_RECOVERY_REQUIRED");let s=o.schemaVersion===2&&o.topology.mode==="pnpm-shared-lockfile",c=s?o.topology.unitRelativeRoot:".",l=await tr(V.join(n,...c==="."?[]:c.split("/"),"package.json")),d=e.storeRoot===void 0?V.join(n,".dyyto","resolution-worker","store",s?"shared":"standalone"):V.join(e.storeRoot,"shared");try{await r({executable:"corepack",args:[cn(l),"install","--frozen-lockfile","--ignore-scripts"],cwd:n,env:ac(a.home,a.userconfig,d)})}catch(f){throw new X("PACKAGE_INSTALL_RECOVERY_REQUIRED",{cause:f})}},async cleanup({plan:n}){let i=t.get(n.planId);i&&(t.delete(n.planId),await Ka(i.home,{recursive:!0,force:!0}))}}}export{Jp as AwsCodeArtifactCredentialProvider,Wp as AwsCodeArtifactPackageReader,Hp as CnpmCorePackageReader,Yp as GitHubArtifactAttestationReader,Gp as HostedStaticPublicationAdapter,qp as LocalDockerDeploymentAdapter,Qs as NpmRegistryPackageReader,Bp as NpmjsPublisherAdapter,ae as PackageSourceSwitchError,G as RegistryProviderAdapterError,l$ as applyAndInstallPackageSourceSwitch,ZL as applyLocalArtifactBundle,c$ as applyPackageSourceSwitch,v8 as createPnpmPackageManagerPort,rL as createSystemProviderCommandRunner,cL as createSystemRegistryHttpClient,SO as executeRemovalVerification,kO as executeVerification,YL as planLocalArtifactBundle,bL as projectIntegrations,EL as projectProcessLogs,IE as projectProcessStatus,ru as readPackageSourceSwitchPlan,Jj as registerWebRelease,_8 as resolvePnpmLock,I8 as resolvePnpmWorkspaceLock,OL as startLocalArtifactServer,IL as startProjectProcess,vL as stopProjectProcess,s$ as switchProjectPackageSources,d$ as verifyPackageSourceSwitch};
|