@intelliweave/embedded 2.1.77 → 2.1.78
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/dist/component/component.js +30 -26
- package/dist/intelliweave-wordpress.zip +0 -0
- package/dist/node/node.js +6 -6
- package/dist/react/react.js +26 -22
- package/dist/script-tag/script-tag.js +30 -26
- package/dist/webpack/index.js +15 -11
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import{b as N,c as gd,d as I_}from"./chunk-AIYMQX7V.js";var Hf=N(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.regexpCode=Xe.getEsmExportName=Xe.getProperty=Xe.safeStringify=Xe.stringify=Xe.strConcat=Xe.addCodeArg=Xe.str=Xe._=Xe.nil=Xe._Code=Xe.Name=Xe.IDENTIFIER=Xe._CodeOrName=void 0;var Wf=class{};Xe._CodeOrName=Wf;Xe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ma=class extends Wf{constructor(e){if(super(),!Xe.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Xe.Name=Ma;var On=class extends Wf{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Ma&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Xe._Code=On;Xe.nil=new On("");function hz(t,...e){let r=[t[0]],n=0;for(;n<e.length;)X0(r,e[n]),r.push(t[++n]);return new On(r)}Xe._=hz;var H0=new On("+");function gz(t,...e){let r=[Gf(t[0])],n=0;for(;n<e.length;)r.push(H0),X0(r,e[n]),r.push(H0,Gf(t[++n]));return tV(r),new On(r)}Xe.str=gz;function X0(t,e){e instanceof On?t.push(...e._items):e instanceof Ma?t.push(e):t.push(iV(e))}Xe.addCodeArg=X0;function tV(t){let e=1;for(;e<t.length-1;){if(t[e]===H0){let r=rV(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function rV(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ma||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ma))return`"${t}${e.slice(1)}`}function nV(t,e){return e.emptyStr()?t:t.emptyStr()?e:gz`${t}${e}`}Xe.strConcat=nV;function iV(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Gf(Array.isArray(t)?t.join(","):t)}function oV(t){return new On(Gf(t))}Xe.stringify=oV;function Gf(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Xe.safeStringify=Gf;function sV(t){return typeof t=="string"&&Xe.IDENTIFIER.test(t)?new On(`.${t}`):hz`[${t}]`}Xe.getProperty=sV;function aV(t){if(typeof t=="string"&&Xe.IDENTIFIER.test(t))return new On(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Xe.getEsmExportName=aV;function lV(t){return new On(t.toString())}Xe.regexpCode=lV});var Y0=N(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});Jr.ValueScope=Jr.ValueScopeName=Jr.Scope=Jr.varKinds=Jr.UsedValueState=void 0;var Kr=Hf(),K0=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qg;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qg||(Jr.UsedValueState=Qg={}));Jr.varKinds={const:new Kr.Name("const"),let:new Kr.Name("let"),var:new Kr.Name("var")};var ey=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Kr.Name?e:this.name(e)}name(e){return new Kr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Jr.Scope=ey;var ty=class extends Kr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Kr._)`.${new Kr.Name(r)}[${n}]`}};Jr.ValueScopeName=ty;var cV=(0,Kr._)`\n`,J0=class extends ey{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?cV:Kr.nil}}get(){return this._scope}name(e){return new ty(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:o}=i,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let u=a.get(s);if(u)return u}else a=this._values[o]=new Map;a.set(s,i);let l=this._scope[o]||(this._scope[o]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:o,itemIndex:c}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Kr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let o=Kr.nil;for(let s in e){let a=e[s];if(!a)continue;let l=n[s]=n[s]||new Map;a.forEach(c=>{if(l.has(c))return;l.set(c,Qg.Started);let u=r(c);if(u){let d=this.opts.es5?Jr.varKinds.var:Jr.varKinds.const;o=(0,Kr._)`${o}${d} ${c} = ${u};${this.opts._n}`}else if(u=i?.(c))o=(0,Kr._)`${o}${u}${this.opts._n}`;else throw new K0(c);l.set(c,Qg.Completed)})}return o}};Jr.ValueScope=J0});var Le=N(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.or=Me.and=Me.not=Me.CodeGen=Me.operators=Me.varKinds=Me.ValueScopeName=Me.ValueScope=Me.Scope=Me.Name=Me.regexpCode=Me.stringify=Me.getProperty=Me.nil=Me.strConcat=Me.str=Me._=void 0;var Ve=Hf(),oi=Y0(),_s=Hf();Object.defineProperty(Me,"_",{enumerable:!0,get:function(){return _s._}});Object.defineProperty(Me,"str",{enumerable:!0,get:function(){return _s.str}});Object.defineProperty(Me,"strConcat",{enumerable:!0,get:function(){return _s.strConcat}});Object.defineProperty(Me,"nil",{enumerable:!0,get:function(){return _s.nil}});Object.defineProperty(Me,"getProperty",{enumerable:!0,get:function(){return _s.getProperty}});Object.defineProperty(Me,"stringify",{enumerable:!0,get:function(){return _s.stringify}});Object.defineProperty(Me,"regexpCode",{enumerable:!0,get:function(){return _s.regexpCode}});Object.defineProperty(Me,"Name",{enumerable:!0,get:function(){return _s.Name}});var oy=Y0();Object.defineProperty(Me,"Scope",{enumerable:!0,get:function(){return oy.Scope}});Object.defineProperty(Me,"ValueScope",{enumerable:!0,get:function(){return oy.ValueScope}});Object.defineProperty(Me,"ValueScopeName",{enumerable:!0,get:function(){return oy.ValueScopeName}});Object.defineProperty(Me,"varKinds",{enumerable:!0,get:function(){return oy.varKinds}});Me.operators={GT:new Ve._Code(">"),GTE:new Ve._Code(">="),LT:new Ve._Code("<"),LTE:new Ve._Code("<="),EQ:new Ve._Code("==="),NEQ:new Ve._Code("!=="),NOT:new Ve._Code("!"),OR:new Ve._Code("||"),AND:new Ve._Code("&&"),ADD:new Ve._Code("+")};var wo=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Q0=class extends wo{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?oi.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=bu(this.rhs,e,r)),this}get names(){return this.rhs instanceof Ve._CodeOrName?this.rhs.names:{}}},ry=class extends wo{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Ve.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=bu(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Ve.Name?{}:{...this.lhs.names};return iy(e,this.rhs)}},ek=class extends ry{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},tk=class extends wo{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},rk=class extends wo{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},nk=class extends wo{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},ik=class extends wo{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=bu(this.code,e,r),this}get names(){return this.code instanceof Ve._CodeOrName?this.code.names:{}}},Xf=class extends wo{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let o=n[i];o.optimizeNames(e,r)||(uV(e,o.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>La(e,r.names),{})}},xo=class extends Xf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},ok=class extends Xf{},yu=class extends xo{};yu.kind="else";var ja=class t extends xo{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new yu(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(yz(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=bu(this.condition,e,r),this}get names(){let e=super.names;return iy(e,this.condition),this.else&&La(e,this.else.names),e}};ja.kind="if";var Da=class extends xo{};Da.kind="for";var sk=class extends Da{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=bu(this.iteration,e,r),this}get names(){return La(super.names,this.iteration.names)}},ak=class extends Da{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?oi.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=iy(super.names,this.from);return iy(e,this.to)}},ny=class extends Da{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=bu(this.iterable,e,r),this}get names(){return La(super.names,this.iterable.names)}},Kf=class extends xo{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Kf.kind="func";var Jf=class extends Xf{render(e){return"return "+super.render(e)}};Jf.kind="return";var lk=class extends xo{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&La(e,this.catch.names),this.finally&&La(e,this.finally.names),e}},Yf=class extends xo{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Yf.kind="catch";var Qf=class extends xo{render(e){return"finally"+super.render(e)}};Qf.kind="finally";var ck=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
1
|
+
import{b as N,c as gd,d as I_}from"./chunk-AIYMQX7V.js";var Hf=N(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.regexpCode=Xe.getEsmExportName=Xe.getProperty=Xe.safeStringify=Xe.stringify=Xe.strConcat=Xe.addCodeArg=Xe.str=Xe._=Xe.nil=Xe._Code=Xe.Name=Xe.IDENTIFIER=Xe._CodeOrName=void 0;var Wf=class{};Xe._CodeOrName=Wf;Xe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ma=class extends Wf{constructor(e){if(super(),!Xe.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Xe.Name=Ma;var Rn=class extends Wf{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Ma&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Xe._Code=Rn;Xe.nil=new Rn("");function hz(t,...e){let r=[t[0]],n=0;for(;n<e.length;)X0(r,e[n]),r.push(t[++n]);return new Rn(r)}Xe._=hz;var H0=new Rn("+");function gz(t,...e){let r=[Gf(t[0])],n=0;for(;n<e.length;)r.push(H0),X0(r,e[n]),r.push(H0,Gf(t[++n]));return tV(r),new Rn(r)}Xe.str=gz;function X0(t,e){e instanceof Rn?t.push(...e._items):e instanceof Ma?t.push(e):t.push(iV(e))}Xe.addCodeArg=X0;function tV(t){let e=1;for(;e<t.length-1;){if(t[e]===H0){let r=rV(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function rV(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ma||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ma))return`"${t}${e.slice(1)}`}function nV(t,e){return e.emptyStr()?t:t.emptyStr()?e:gz`${t}${e}`}Xe.strConcat=nV;function iV(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Gf(Array.isArray(t)?t.join(","):t)}function oV(t){return new Rn(Gf(t))}Xe.stringify=oV;function Gf(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Xe.safeStringify=Gf;function sV(t){return typeof t=="string"&&Xe.IDENTIFIER.test(t)?new Rn(`.${t}`):hz`[${t}]`}Xe.getProperty=sV;function aV(t){if(typeof t=="string"&&Xe.IDENTIFIER.test(t))return new Rn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Xe.getEsmExportName=aV;function lV(t){return new Rn(t.toString())}Xe.regexpCode=lV});var Y0=N(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});Jr.ValueScope=Jr.ValueScopeName=Jr.Scope=Jr.varKinds=Jr.UsedValueState=void 0;var Kr=Hf(),K0=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qg;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qg||(Jr.UsedValueState=Qg={}));Jr.varKinds={const:new Kr.Name("const"),let:new Kr.Name("let"),var:new Kr.Name("var")};var ey=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Kr.Name?e:this.name(e)}name(e){return new Kr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Jr.Scope=ey;var ty=class extends Kr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Kr._)`.${new Kr.Name(r)}[${n}]`}};Jr.ValueScopeName=ty;var cV=(0,Kr._)`\n`,J0=class extends ey{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?cV:Kr.nil}}get(){return this._scope}name(e){return new ty(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:o}=i,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let u=a.get(s);if(u)return u}else a=this._values[o]=new Map;a.set(s,i);let l=this._scope[o]||(this._scope[o]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:o,itemIndex:c}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Kr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let o=Kr.nil;for(let s in e){let a=e[s];if(!a)continue;let l=n[s]=n[s]||new Map;a.forEach(c=>{if(l.has(c))return;l.set(c,Qg.Started);let u=r(c);if(u){let d=this.opts.es5?Jr.varKinds.var:Jr.varKinds.const;o=(0,Kr._)`${o}${d} ${c} = ${u};${this.opts._n}`}else if(u=i?.(c))o=(0,Kr._)`${o}${u}${this.opts._n}`;else throw new K0(c);l.set(c,Qg.Completed)})}return o}};Jr.ValueScope=J0});var Le=N(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.or=Me.and=Me.not=Me.CodeGen=Me.operators=Me.varKinds=Me.ValueScopeName=Me.ValueScope=Me.Scope=Me.Name=Me.regexpCode=Me.stringify=Me.getProperty=Me.nil=Me.strConcat=Me.str=Me._=void 0;var Ve=Hf(),oi=Y0(),_s=Hf();Object.defineProperty(Me,"_",{enumerable:!0,get:function(){return _s._}});Object.defineProperty(Me,"str",{enumerable:!0,get:function(){return _s.str}});Object.defineProperty(Me,"strConcat",{enumerable:!0,get:function(){return _s.strConcat}});Object.defineProperty(Me,"nil",{enumerable:!0,get:function(){return _s.nil}});Object.defineProperty(Me,"getProperty",{enumerable:!0,get:function(){return _s.getProperty}});Object.defineProperty(Me,"stringify",{enumerable:!0,get:function(){return _s.stringify}});Object.defineProperty(Me,"regexpCode",{enumerable:!0,get:function(){return _s.regexpCode}});Object.defineProperty(Me,"Name",{enumerable:!0,get:function(){return _s.Name}});var oy=Y0();Object.defineProperty(Me,"Scope",{enumerable:!0,get:function(){return oy.Scope}});Object.defineProperty(Me,"ValueScope",{enumerable:!0,get:function(){return oy.ValueScope}});Object.defineProperty(Me,"ValueScopeName",{enumerable:!0,get:function(){return oy.ValueScopeName}});Object.defineProperty(Me,"varKinds",{enumerable:!0,get:function(){return oy.varKinds}});Me.operators={GT:new Ve._Code(">"),GTE:new Ve._Code(">="),LT:new Ve._Code("<"),LTE:new Ve._Code("<="),EQ:new Ve._Code("==="),NEQ:new Ve._Code("!=="),NOT:new Ve._Code("!"),OR:new Ve._Code("||"),AND:new Ve._Code("&&"),ADD:new Ve._Code("+")};var wo=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Q0=class extends wo{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?oi.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=bu(this.rhs,e,r)),this}get names(){return this.rhs instanceof Ve._CodeOrName?this.rhs.names:{}}},ry=class extends wo{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Ve.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=bu(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Ve.Name?{}:{...this.lhs.names};return iy(e,this.rhs)}},ek=class extends ry{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},tk=class extends wo{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},rk=class extends wo{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},nk=class extends wo{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},ik=class extends wo{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=bu(this.code,e,r),this}get names(){return this.code instanceof Ve._CodeOrName?this.code.names:{}}},Xf=class extends wo{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let o=n[i];o.optimizeNames(e,r)||(uV(e,o.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>La(e,r.names),{})}},xo=class extends Xf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},ok=class extends Xf{},yu=class extends xo{};yu.kind="else";var ja=class t extends xo{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new yu(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(yz(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=bu(this.condition,e,r),this}get names(){let e=super.names;return iy(e,this.condition),this.else&&La(e,this.else.names),e}};ja.kind="if";var Da=class extends xo{};Da.kind="for";var sk=class extends Da{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=bu(this.iteration,e,r),this}get names(){return La(super.names,this.iteration.names)}},ak=class extends Da{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?oi.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=iy(super.names,this.from);return iy(e,this.to)}},ny=class extends Da{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=bu(this.iterable,e,r),this}get names(){return La(super.names,this.iterable.names)}},Kf=class extends xo{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Kf.kind="func";var Jf=class extends Xf{render(e){return"return "+super.render(e)}};Jf.kind="return";var lk=class extends xo{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&La(e,this.catch.names),this.finally&&La(e,this.finally.names),e}},Yf=class extends xo{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Yf.kind="catch";var Qf=class extends xo{render(e){return"finally"+super.render(e)}};Qf.kind="finally";var ck=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
2
|
`:""},this._extScope=e,this._scope=new oi.Scope({parent:e}),this._nodes=[new ok]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let o=this._scope.toName(r);return n!==void 0&&i&&(this._constants[o.str]=n),this._leafNode(new Q0(e,o,n)),o}const(e,r,n){return this._def(oi.varKinds.const,e,r,n)}let(e,r,n){return this._def(oi.varKinds.let,e,r,n)}var(e,r,n){return this._def(oi.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new ry(e,r,n))}add(e,r){return this._leafNode(new ek(e,Me.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Ve.nil&&this._leafNode(new ik(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,Ve.addCodeArg)(r,i));return r.push("}"),new Ve._Code(r)}if(e,r,n){if(this._blockNode(new ja(e)),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(e){return this._elseNode(new ja(e))}else(){return this._elseNode(new yu)}endIf(){return this._endBlockNode(ja,yu)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new sk(e),r)}forRange(e,r,n,i,o=this.opts.es5?oi.varKinds.var:oi.varKinds.let){let s=this._scope.toName(e);return this._for(new ak(o,s,r,n),()=>i(s))}forOf(e,r,n,i=oi.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=r instanceof Ve.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Ve._)`${s}.length`,a=>{this.var(o,(0,Ve._)`${s}[${a}]`),n(o)})}return this._for(new ny("of",i,o,r),()=>n(o))}forIn(e,r,n,i=this.opts.es5?oi.varKinds.var:oi.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Ve._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new ny("in",i,o,r),()=>n(o))}endFor(){return this._endBlockNode(Da)}label(e){return this._leafNode(new tk(e))}break(e){return this._leafNode(new rk(e))}return(e){let r=new Jf;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Jf)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new lk;if(this._blockNode(i),this.code(e),r){let o=this.name("e");this._currNode=i.catch=new Yf(o),r(o)}return n&&(this._currNode=i.finally=new Qf,this.code(n)),this._endBlockNode(Yf,Qf)}throw(e){return this._leafNode(new nk(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){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||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Ve.nil,n,i){return this._blockNode(new Kf(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Kf)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof ja))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Me.CodeGen=ck;function La(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function iy(t,e){return e instanceof Ve._CodeOrName?La(t,e.names):t}function bu(t,e,r){if(t instanceof Ve.Name)return n(t);if(!i(t))return t;return new Ve._Code(t._items.reduce((o,s)=>(s instanceof Ve.Name&&(s=n(s)),s instanceof Ve._Code?o.push(...s._items):o.push(s),o),[]));function n(o){let s=r[o.str];return s===void 0||e[o.str]!==1?o:(delete e[o.str],s)}function i(o){return o instanceof Ve._Code&&o._items.some(s=>s instanceof Ve.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function uV(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function yz(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Ve._)`!${uk(t)}`}Me.not=yz;var dV=bz(Me.operators.AND);function fV(...t){return t.reduce(dV)}Me.and=fV;var pV=bz(Me.operators.OR);function mV(...t){return t.reduce(pV)}Me.or=mV;function bz(t){return(e,r)=>e===Ve.nil?r:r===Ve.nil?e:(0,Ve._)`${uk(e)} ${t} ${uk(r)}`}function uk(t){return t instanceof Ve.Name?t:(0,Ve._)`(${t})`}});var Ke=N(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.checkStrictMode=Ue.getErrorPath=Ue.Type=Ue.useFunc=Ue.setEvaluated=Ue.evaluatedPropsToName=Ue.mergeEvaluated=Ue.eachItem=Ue.unescapeJsonPointer=Ue.escapeJsonPointer=Ue.escapeFragment=Ue.unescapeFragment=Ue.schemaRefOrVal=Ue.schemaHasRulesButRef=Ue.schemaHasRules=Ue.checkUnknownRules=Ue.alwaysValidSchema=Ue.toHash=void 0;var ft=Le(),hV=Hf();function gV(t){let e={};for(let r of t)e[r]=!0;return e}Ue.toHash=gV;function yV(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(wz(t,e),!xz(e,t.self.RULES.all))}Ue.alwaysValidSchema=yV;function wz(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let o in e)i[o]||$z(t,`unknown keyword: "${o}"`)}Ue.checkUnknownRules=wz;function xz(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Ue.schemaHasRules=xz;function bV(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Ue.schemaHasRulesButRef=bV;function _V({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ft._)`${r}`}return(0,ft._)`${t}${e}${(0,ft.getProperty)(n)}`}Ue.schemaRefOrVal=_V;function vV(t){return kz(decodeURIComponent(t))}Ue.unescapeFragment=vV;function wV(t){return encodeURIComponent(fk(t))}Ue.escapeFragment=wV;function fk(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Ue.escapeJsonPointer=fk;function kz(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Ue.unescapeJsonPointer=kz;function xV(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Ue.eachItem=xV;function _z({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,o,s,a)=>{let l=s===void 0?o:s instanceof ft.Name?(o instanceof ft.Name?t(i,o,s):e(i,o,s),s):o instanceof ft.Name?(e(i,s,o),o):r(o,s);return a===ft.Name&&!(l instanceof ft.Name)?n(i,l):l}}Ue.mergeEvaluated={props:_z({mergeNames:(t,e,r)=>t.if((0,ft._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ft._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ft._)`${r} || {}`).code((0,ft._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ft._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ft._)`${r} || {}`),pk(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Sz}),items:_z({mergeNames:(t,e,r)=>t.if((0,ft._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ft._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ft._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ft._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Sz(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ft._)`{}`);return e!==void 0&&pk(t,r,e),r}Ue.evaluatedPropsToName=Sz;function pk(t,e,r){Object.keys(r).forEach(n=>t.assign((0,ft._)`${e}${(0,ft.getProperty)(n)}`,!0))}Ue.setEvaluated=pk;var vz={};function kV(t,e){return t.scopeValue("func",{ref:e,code:vz[e.code]||(vz[e.code]=new hV._Code(e.code))})}Ue.useFunc=kV;var dk;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(dk||(Ue.Type=dk={}));function SV(t,e,r){if(t instanceof ft.Name){let n=e===dk.Num;return r?n?(0,ft._)`"[" + ${t} + "]"`:(0,ft._)`"['" + ${t} + "']"`:n?(0,ft._)`"/" + ${t}`:(0,ft._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ft.getProperty)(t).toString():"/"+fk(t)}Ue.getErrorPath=SV;function $z(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Ue.checkStrictMode=$z});var ko=N(mk=>{"use strict";Object.defineProperty(mk,"__esModule",{value:!0});var Er=Le(),$V={data:new Er.Name("data"),valCxt:new Er.Name("valCxt"),instancePath:new Er.Name("instancePath"),parentData:new Er.Name("parentData"),parentDataProperty:new Er.Name("parentDataProperty"),rootData:new Er.Name("rootData"),dynamicAnchors:new Er.Name("dynamicAnchors"),vErrors:new Er.Name("vErrors"),errors:new Er.Name("errors"),this:new Er.Name("this"),self:new Er.Name("self"),scope:new Er.Name("scope"),json:new Er.Name("json"),jsonPos:new Er.Name("jsonPos"),jsonLen:new Er.Name("jsonLen"),jsonPart:new Er.Name("jsonPart")};mk.default=$V});var ep=N(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.extendErrors=Pr.resetErrorsCount=Pr.reportExtraError=Pr.reportError=Pr.keyword$DataError=Pr.keywordError=void 0;var We=Le(),sy=Ke(),Dr=ko();Pr.keywordError={message:({keyword:t})=>(0,We.str)`must pass "${t}" keyword validation`};Pr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,We.str)`"${t}" keyword must be ${e} ($data)`:(0,We.str)`"${t}" keyword is invalid ($data)`};function IV(t,e=Pr.keywordError,r,n){let{it:i}=t,{gen:o,compositeRule:s,allErrors:a}=i,l=Pz(t,e,r);n??(s||a)?Iz(o,l):Ez(i,(0,We._)`[${l}]`)}Pr.reportError=IV;function EV(t,e=Pr.keywordError,r){let{it:n}=t,{gen:i,compositeRule:o,allErrors:s}=n,a=Pz(t,e,r);Iz(i,a),o||s||Ez(n,Dr.default.vErrors)}Pr.reportExtraError=EV;function PV(t,e){t.assign(Dr.default.errors,e),t.if((0,We._)`${Dr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,We._)`${Dr.default.vErrors}.length`,e),()=>t.assign(Dr.default.vErrors,null)))}Pr.resetErrorsCount=PV;function TV({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:o}){if(i===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",i,Dr.default.errors,a=>{t.const(s,(0,We._)`${Dr.default.vErrors}[${a}]`),t.if((0,We._)`${s}.instancePath === undefined`,()=>t.assign((0,We._)`${s}.instancePath`,(0,We.strConcat)(Dr.default.instancePath,o.errorPath))),t.assign((0,We._)`${s}.schemaPath`,(0,We.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,We._)`${s}.schema`,r),t.assign((0,We._)`${s}.data`,n))})}Pr.extendErrors=TV;function Iz(t,e){let r=t.const("err",e);t.if((0,We._)`${Dr.default.vErrors} === null`,()=>t.assign(Dr.default.vErrors,(0,We._)`[${r}]`),(0,We._)`${Dr.default.vErrors}.push(${r})`),t.code((0,We._)`${Dr.default.errors}++`)}function Ez(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,We._)`new ${t.ValidationError}(${e})`):(r.assign((0,We._)`${n}.errors`,e),r.return(!1))}var Ua={keyword:new We.Name("keyword"),schemaPath:new We.Name("schemaPath"),params:new We.Name("params"),propertyName:new We.Name("propertyName"),message:new We.Name("message"),schema:new We.Name("schema"),parentSchema:new We.Name("parentSchema")};function Pz(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,We._)`{}`:AV(t,e,r)}function AV(t,e,r={}){let{gen:n,it:i}=t,o=[CV(i,r),zV(t,r)];return OV(t,e,o),n.object(...o)}function CV({errorPath:t},{instancePath:e}){let r=e?(0,We.str)`${t}${(0,sy.getErrorPath)(e,sy.Type.Str)}`:t;return[Dr.default.instancePath,(0,We.strConcat)(Dr.default.instancePath,r)]}function zV({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,We.str)`${e}/${t}`;return r&&(i=(0,We.str)`${i}${(0,sy.getErrorPath)(r,sy.Type.Str)}`),[Ua.schemaPath,i]}function OV(t,{params:e,message:r},n){let{keyword:i,data:o,schemaValue:s,it:a}=t,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=a;n.push([Ua.keyword,i],[Ua.params,typeof e=="function"?e(t):e||(0,We._)`{}`]),l.messages&&n.push([Ua.message,typeof r=="function"?r(t):r]),l.verbose&&n.push([Ua.schema,s],[Ua.parentSchema,(0,We._)`${u}${d}`],[Dr.default.data,o]),c&&n.push([Ua.propertyName,c])}});var Az=N(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.boolOrEmptySchema=_u.topBoolOrEmptySchema=void 0;var RV=ep(),NV=Le(),MV=ko(),jV={message:"boolean schema is false"};function DV(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Tz(t,!1):typeof r=="object"&&r.$async===!0?e.return(MV.default.data):(e.assign((0,NV._)`${n}.errors`,null),e.return(!0))}_u.topBoolOrEmptySchema=DV;function LV(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Tz(t)):r.var(e,!0)}_u.boolOrEmptySchema=LV;function Tz(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,RV.reportError)(i,jV,void 0,e)}});var hk=N(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.getRules=vu.isJSONType=void 0;var UV=["string","number","integer","boolean","null","object","array"],ZV=new Set(UV);function FV(t){return typeof t=="string"&&ZV.has(t)}vu.isJSONType=FV;function VV(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}vu.getRules=VV});var gk=N(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.shouldUseRule=vs.shouldUseGroup=vs.schemaHasRulesForType=void 0;function qV({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Cz(t,n)}vs.schemaHasRulesForType=qV;function Cz(t,e){return e.rules.some(r=>zz(t,r))}vs.shouldUseGroup=Cz;function zz(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}vs.shouldUseRule=zz});var tp=N(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.reportTypeError=Tr.checkDataTypes=Tr.checkDataType=Tr.coerceAndCheckDataType=Tr.getJSONTypes=Tr.getSchemaTypes=Tr.DataType=void 0;var BV=hk(),WV=gk(),GV=ep(),Ce=Le(),Oz=Ke(),wu;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(wu||(Tr.DataType=wu={}));function HV(t){let e=Rz(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Tr.getSchemaTypes=HV;function Rz(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(BV.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Tr.getJSONTypes=Rz;function XV(t,e){let{gen:r,data:n,opts:i}=t,o=KV(e,i.coerceTypes),s=e.length>0&&!(o.length===0&&e.length===1&&(0,WV.schemaHasRulesForType)(t,e[0]));if(s){let a=bk(e,n,i.strictNumbers,wu.Wrong);r.if(a,()=>{o.length?JV(t,e,o):_k(t)})}return s}Tr.coerceAndCheckDataType=XV;var Nz=new Set(["string","number","integer","boolean","null"]);function KV(t,e){return e?t.filter(r=>Nz.has(r)||e==="array"&&r==="array"):[]}function JV(t,e,r){let{gen:n,data:i,opts:o}=t,s=n.let("dataType",(0,Ce._)`typeof ${i}`),a=n.let("coerced",(0,Ce._)`undefined`);o.coerceTypes==="array"&&n.if((0,Ce._)`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,Ce._)`${i}[0]`).assign(s,(0,Ce._)`typeof ${i}`).if(bk(e,i,o.strictNumbers),()=>n.assign(a,i))),n.if((0,Ce._)`${a} !== undefined`);for(let c of r)(Nz.has(c)||c==="array"&&o.coerceTypes==="array")&&l(c);n.else(),_k(t),n.endIf(),n.if((0,Ce._)`${a} !== undefined`,()=>{n.assign(i,a),YV(t,a)});function l(c){switch(c){case"string":n.elseIf((0,Ce._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Ce._)`"" + ${i}`).elseIf((0,Ce._)`${i} === null`).assign(a,(0,Ce._)`""`);return;case"number":n.elseIf((0,Ce._)`${s} == "boolean" || ${i} === null
|
|
3
3
|
|| (${s} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,Ce._)`+${i}`);return;case"integer":n.elseIf((0,Ce._)`${s} === "boolean" || ${i} === null
|
|
4
4
|
|| (${s} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,(0,Ce._)`+${i}`);return;case"boolean":n.elseIf((0,Ce._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf((0,Ce._)`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Ce._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Ce._)`${s} === "string" || ${s} === "number"
|
|
5
|
-
|| ${s} === "boolean" || ${i} === null`).assign(a,(0,Ce._)`[${i}]`)}}}function YV({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Ce._)`${e} !== undefined`,()=>t.assign((0,Ce._)`${e}[${r}]`,n))}function yk(t,e,r,n=wu.Correct){let i=n===wu.Correct?Ce.operators.EQ:Ce.operators.NEQ,o;switch(t){case"null":return(0,Ce._)`${e} ${i} null`;case"array":o=(0,Ce._)`Array.isArray(${e})`;break;case"object":o=(0,Ce._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=s((0,Ce._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=s();break;default:return(0,Ce._)`typeof ${e} ${i} ${t}`}return n===wu.Correct?o:(0,Ce.not)(o);function s(a=Ce.nil){return(0,Ce.and)((0,Ce._)`typeof ${e} == "number"`,a,r?(0,Ce._)`isFinite(${e})`:Ce.nil)}}Tr.checkDataType=yk;function bk(t,e,r,n){if(t.length===1)return yk(t[0],e,r,n);let i,o=(0,Oz.toHash)(t);if(o.array&&o.object){let s=(0,Ce._)`typeof ${e} != "object"`;i=o.null?s:(0,Ce._)`!${e} || ${s}`,delete o.null,delete o.array,delete o.object}else i=Ce.nil;o.number&&delete o.integer;for(let s in o)i=(0,Ce.and)(i,yk(s,e,r,n));return i}Tr.checkDataTypes=bk;var QV={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Ce._)`{type: ${t}}`:(0,Ce._)`{type: ${e}}`};function _k(t){let e=eq(t);(0,GV.reportError)(e,QV)}Tr.reportTypeError=_k;function eq(t){let{gen:e,data:r,schema:n}=t,i=(0,Oz.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var jz=N(ay=>{"use strict";Object.defineProperty(ay,"__esModule",{value:!0});ay.assignDefaults=void 0;var xu=Le(),tq=Ke();function rq(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)Mz(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,o)=>Mz(t,o,i.default))}ay.assignDefaults=rq;function Mz(t,e,r){let{gen:n,compositeRule:i,data:o,opts:s}=t;if(r===void 0)return;let a=(0,xu._)`${o}${(0,xu.getProperty)(e)}`;if(i){(0,tq.checkStrictMode)(t,`default is ignored for: ${a}`);return}let l=(0,xu._)`${a} === undefined`;s.useDefaults==="empty"&&(l=(0,xu._)`${l} || ${a} === null || ${a} === ""`),n.if(l,(0,xu._)`${a} = ${(0,xu.stringify)(r)}`)}});var Rn=N(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.validateUnion=at.validateArray=at.usePattern=at.callValidateCode=at.schemaProperties=at.allSchemaProperties=at.noPropertyInData=at.propertyInData=at.isOwnProperty=at.hasPropFunc=at.reportMissingProp=at.checkMissingProp=at.checkReportMissingProp=void 0;var _t=Le(),vk=Ke(),ws=ko(),nq=Ke();function iq(t,e){let{gen:r,data:n,it:i}=t;r.if(xk(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,_t._)`${e}`},!0),t.error()})}at.checkReportMissingProp=iq;function oq({gen:t,data:e,it:{opts:r}},n,i){return(0,_t.or)(...n.map(o=>(0,_t.and)(xk(t,e,o,r.ownProperties),(0,_t._)`${i} = ${o}`)))}at.checkMissingProp=oq;function sq(t,e){t.setParams({missingProperty:e},!0),t.error()}at.reportMissingProp=sq;function Dz(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,_t._)`Object.prototype.hasOwnProperty`})}at.hasPropFunc=Dz;function wk(t,e,r){return(0,_t._)`${Dz(t)}.call(${e}, ${r})`}at.isOwnProperty=wk;function aq(t,e,r,n){let i=(0,_t._)`${e}${(0,_t.getProperty)(r)} !== undefined`;return n?(0,_t._)`${i} && ${wk(t,e,r)}`:i}at.propertyInData=aq;function xk(t,e,r,n){let i=(0,_t._)`${e}${(0,_t.getProperty)(r)} === undefined`;return n?(0,_t.or)(i,(0,_t.not)(wk(t,e,r))):i}at.noPropertyInData=xk;function Lz(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}at.allSchemaProperties=Lz;function lq(t,e){return Lz(e).filter(r=>!(0,vk.alwaysValidSchema)(t,e[r]))}at.schemaProperties=lq;function cq({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:s},a,l,c){let u=c?(0,_t._)`${t}, ${e}, ${n}${i}`:e,d=[[ws.default.instancePath,(0,_t.strConcat)(ws.default.instancePath,o)],[ws.default.parentData,s.parentData],[ws.default.parentDataProperty,s.parentDataProperty],[ws.default.rootData,ws.default.rootData]];s.opts.dynamicRef&&d.push([ws.default.dynamicAnchors,ws.default.dynamicAnchors]);let p=(0,_t._)`${u}, ${r.object(...d)}`;return l!==_t.nil?(0,_t._)`${a}.call(${l}, ${p})`:(0,_t._)`${a}(${p})`}at.callValidateCode=cq;var uq=(0,_t._)`new RegExp`;function dq({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,o=i(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,_t._)`${i.code==="new RegExp"?uq:(0,nq.useFunc)(t,i)}(${r}, ${n})`})}at.usePattern=dq;function fq(t){let{gen:e,data:r,keyword:n,it:i}=t,o=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(o,!0),s(()=>e.break()),o;function s(a){let l=e.const("len",(0,_t._)`${r}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:n,dataProp:c,dataPropType:vk.Type.Num},o),e.if((0,_t.not)(o),a)})}}at.validateArray=fq;function pq(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,vk.alwaysValidSchema)(i,l))&&!i.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((l,c)=>{let u=t.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);e.assign(s,(0,_t._)`${s} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,_t.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}at.validateUnion=pq});var Fz=N(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.validateKeywordUsage=Ti.validSchemaType=Ti.funcKeywordCode=Ti.macroKeywordCode=void 0;var Lr=Le(),Za=ko(),mq=Rn(),hq=ep();function gq(t,e){let{gen:r,keyword:n,schema:i,parentSchema:o,it:s}=t,a=e.macro.call(s.self,i,o,s),l=Zz(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let c=r.name("valid");t.subschema({schema:a,schemaPath:Lr.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}Ti.macroKeywordCode=gq;function yq(t,e){var r;let{gen:n,keyword:i,schema:o,parentSchema:s,$data:a,it:l}=t;_q(l,e);let c=!a&&e.compile?e.compile.call(l.self,o,s,l):e.validate,u=Zz(n,i,c),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)h(),e.modifying&&Uz(t),y(()=>t.error());else{let g=e.async?f():m();e.modifying&&Uz(t),y(()=>bq(t,g))}}function f(){let g=n.let("ruleErrs",null);return n.try(()=>h((0,Lr._)`await `),b=>n.assign(d,!1).if((0,Lr._)`${b} instanceof ${l.ValidationError}`,()=>n.assign(g,(0,Lr._)`${b}.errors`),()=>n.throw(b))),g}function m(){let g=(0,Lr._)`${u}.errors`;return n.assign(g,null),h(Lr.nil),g}function h(g=e.async?(0,Lr._)`await `:Lr.nil){let b=l.opts.passContext?Za.default.this:Za.default.self,v=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Lr._)`${g}${(0,mq.callValidateCode)(t,u,b,v)}`,e.modifying)}function y(g){var b;n.if((0,Lr.not)((b=e.valid)!==null&&b!==void 0?b:d),g)}}Ti.funcKeywordCode=yq;function Uz(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Lr._)`${n.parentData}[${n.parentDataProperty}]`))}function bq(t,e){let{gen:r}=t;r.if((0,Lr._)`Array.isArray(${e})`,()=>{r.assign(Za.default.vErrors,(0,Lr._)`${Za.default.vErrors} === null ? ${e} : ${Za.default.vErrors}.concat(${e})`).assign(Za.default.errors,(0,Lr._)`${Za.default.vErrors}.length`),(0,hq.extendErrors)(t)},()=>t.error())}function _q({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Zz(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Lr.stringify)(r)})}function vq(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Ti.validSchemaType=vq;function wq({schema:t,opts:e,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");let s=i.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[o])){let l=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}Ti.validateKeywordUsage=wq});var qz=N(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.extendSubschemaMode=xs.extendSubschemaData=xs.getSubschema=void 0;var Ai=Le(),Vz=Ke();function xq(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ai._)`${t.schemaPath}${(0,Ai.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ai._)`${t.schemaPath}${(0,Ai.getProperty)(e)}${(0,Ai.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Vz.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}xs.getSubschema=xq;function kq(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:s}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=e,p=a.let("data",(0,Ai._)`${e.data}${(0,Ai.getProperty)(r)}`,!0);l(p),t.errorPath=(0,Ai.str)`${c}${(0,Vz.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ai._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let c=i instanceof Ai.Name?i:a.let("data",i,!0);l(c),s!==void 0&&(t.propertyName=s)}o&&(t.dataTypes=o);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}xs.extendSubschemaData=kq;function Sq(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}xs.extendSubschemaMode=Sq});var rp=N((G0e,Bz)=>{"use strict";Bz.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var s=o[i];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var kk=N((H0e,Wz)=>{"use strict";var ks=Wz.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};ly(e,n,i,t,"",t)};ks.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ks.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ks.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ks.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 ly(t,e,r,n,i,o,s,a,l,c){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,o,s,a,l,c);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in ks.arrayKeywords)for(var p=0;p<d.length;p++)ly(t,e,r,d[p],i+"/"+u+"/"+p,o,i,u,n,p)}else if(u in ks.propsKeywords){if(d&&typeof d=="object")for(var f in d)ly(t,e,r,d[f],i+"/"+u+"/"+$q(f),o,i,u,n,f)}else(u in ks.keywords||t.allKeys&&!(u in ks.skipKeywords))&&ly(t,e,r,d,i+"/"+u,o,i,u,n)}r(n,i,o,s,a,l,c)}}function $q(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var np=N(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.getSchemaRefs=Yr.resolveUrl=Yr.normalizeId=Yr._getFullPath=Yr.getFullPath=Yr.inlineRef=void 0;var Iq=Ke(),Eq=rp(),Pq=kk(),Tq=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Aq(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Sk(t):e?Gz(t)<=e:!1}Yr.inlineRef=Aq;var Cq=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Sk(t){for(let e in t){if(Cq.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Sk)||typeof r=="object"&&Sk(r))return!0}return!1}function Gz(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Tq.has(r)&&(typeof t[r]=="object"&&(0,Iq.eachItem)(t[r],n=>e+=Gz(n)),e===1/0))return 1/0}return e}function Hz(t,e="",r){r!==!1&&(e=ku(e));let n=t.parse(e);return Xz(t,n)}Yr.getFullPath=Hz;function Xz(t,e){return t.serialize(e).split("#")[0]+"#"}Yr._getFullPath=Xz;var zq=/#\/?$/;function ku(t){return t?t.replace(zq,""):""}Yr.normalizeId=ku;function Oq(t,e,r){return r=ku(r),t.resolve(e,r)}Yr.resolveUrl=Oq;var Rq=/^[a-z_][-a-z0-9._]*$/i;function Nq(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=ku(t[r]||e),o={"":i},s=Hz(n,i,!1),a={},l=new Set;return Pq(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let h=s+p,y=o[m];typeof d[r]=="string"&&(y=g.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),o[p]=y;function g(v){let C=this.opts.uriResolver.resolve;if(v=ku(y?C(y,v):v),l.has(v))throw u(v);l.add(v);let E=this.refs[v];return typeof E=="string"&&(E=this.refs[E]),typeof E=="object"?c(d,E.schema,v):v!==ku(h)&&(v[0]==="#"?(c(d,a[v],v),a[v]=d):this.refs[v]=h),v}function b(v){if(typeof v=="string"){if(!Rq.test(v))throw new Error(`invalid anchor "${v}"`);g.call(this,`#${v}`)}}}),a;function c(d,p,f){if(p!==void 0&&!Eq(d,p))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Yr.getSchemaRefs=Nq});var sp=N(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.getData=Ss.KeywordCxt=Ss.validateFunctionCode=void 0;var eO=Az(),Kz=tp(),Ik=gk(),cy=tp(),Mq=jz(),op=Fz(),$k=qz(),ie=Le(),Se=ko(),jq=np(),So=Ke(),ip=ep();function Dq(t){if(nO(t)&&(iO(t),rO(t))){Zq(t);return}tO(t,()=>(0,eO.topBoolOrEmptySchema)(t))}Ss.validateFunctionCode=Dq;function tO({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},o){i.code.es5?t.func(e,(0,ie._)`${Se.default.data}, ${Se.default.valCxt}`,n.$async,()=>{t.code((0,ie._)`"use strict"; ${Jz(r,i)}`),Uq(t,i),t.code(o)}):t.func(e,(0,ie._)`${Se.default.data}, ${Lq(i)}`,n.$async,()=>t.code(Jz(r,i)).code(o))}function Lq(t){return(0,ie._)`{${Se.default.instancePath}="", ${Se.default.parentData}, ${Se.default.parentDataProperty}, ${Se.default.rootData}=${Se.default.data}${t.dynamicRef?(0,ie._)`, ${Se.default.dynamicAnchors}={}`:ie.nil}}={}`}function Uq(t,e){t.if(Se.default.valCxt,()=>{t.var(Se.default.instancePath,(0,ie._)`${Se.default.valCxt}.${Se.default.instancePath}`),t.var(Se.default.parentData,(0,ie._)`${Se.default.valCxt}.${Se.default.parentData}`),t.var(Se.default.parentDataProperty,(0,ie._)`${Se.default.valCxt}.${Se.default.parentDataProperty}`),t.var(Se.default.rootData,(0,ie._)`${Se.default.valCxt}.${Se.default.rootData}`),e.dynamicRef&&t.var(Se.default.dynamicAnchors,(0,ie._)`${Se.default.valCxt}.${Se.default.dynamicAnchors}`)},()=>{t.var(Se.default.instancePath,(0,ie._)`""`),t.var(Se.default.parentData,(0,ie._)`undefined`),t.var(Se.default.parentDataProperty,(0,ie._)`undefined`),t.var(Se.default.rootData,Se.default.data),e.dynamicRef&&t.var(Se.default.dynamicAnchors,(0,ie._)`{}`)})}function Zq(t){let{schema:e,opts:r,gen:n}=t;tO(t,()=>{r.$comment&&e.$comment&&sO(t),Wq(t),n.let(Se.default.vErrors,null),n.let(Se.default.errors,0),r.unevaluated&&Fq(t),oO(t),Xq(t)})}function Fq(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ie._)`${r}.evaluated`),e.if((0,ie._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ie._)`${t.evaluated}.props`,(0,ie._)`undefined`)),e.if((0,ie._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ie._)`${t.evaluated}.items`,(0,ie._)`undefined`))}function Jz(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ie._)`/*# sourceURL=${r} */`:ie.nil}function Vq(t,e){if(nO(t)&&(iO(t),rO(t))){qq(t,e);return}(0,eO.boolOrEmptySchema)(t,e)}function rO({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function nO(t){return typeof t.schema!="boolean"}function qq(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&sO(t),Gq(t),Hq(t);let o=n.const("_errs",Se.default.errors);oO(t,o),n.var(e,(0,ie._)`${o} === ${Se.default.errors}`)}function iO(t){(0,So.checkUnknownRules)(t),Bq(t)}function oO(t,e){if(t.opts.jtd)return Yz(t,[],!1,e);let r=(0,Kz.getSchemaTypes)(t.schema),n=(0,Kz.coerceAndCheckDataType)(t,r);Yz(t,r,!n,e)}function Bq(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,So.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Wq(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,So.checkStrictMode)(t,"default is ignored in the schema root")}function Gq(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,jq.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Hq(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function sO({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let o=r.$comment;if(i.$comment===!0)t.code((0,ie._)`${Se.default.self}.logger.log(${o})`);else if(typeof i.$comment=="function"){let s=(0,ie.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,ie._)`${Se.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function Xq(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=t;r.$async?e.if((0,ie._)`${Se.default.errors} === 0`,()=>e.return(Se.default.data),()=>e.throw((0,ie._)`new ${i}(${Se.default.vErrors})`)):(e.assign((0,ie._)`${n}.errors`,Se.default.vErrors),o.unevaluated&&Kq(t),e.return((0,ie._)`${Se.default.errors} === 0`))}function Kq({gen:t,evaluated:e,props:r,items:n}){r instanceof ie.Name&&t.assign((0,ie._)`${e}.props`,r),n instanceof ie.Name&&t.assign((0,ie._)`${e}.items`,n)}function Yz(t,e,r,n){let{gen:i,schema:o,data:s,allErrors:a,opts:l,self:c}=t,{RULES:u}=c;if(o.$ref&&(l.ignoreKeywordsWithRef||!(0,So.schemaHasRulesButRef)(o,u))){i.block(()=>lO(t,"$ref",u.all.$ref.definition));return}l.jtd||Jq(t,e),i.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){(0,Ik.shouldUseGroup)(o,p)&&(p.type?(i.if((0,cy.checkDataType)(p.type,s,l.strictNumbers)),Qz(t,p),e.length===1&&e[0]===p.type&&r&&(i.else(),(0,cy.reportTypeError)(t)),i.endIf()):Qz(t,p),a||i.if((0,ie._)`${Se.default.errors} === ${n||0}`))}}function Qz(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,Mq.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,Ik.shouldUseRule)(n,o)&&lO(t,o.keyword,o.definition,e.type)})}function Jq(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Yq(t,e),t.opts.allowUnionTypes||Qq(t,e),e3(t,t.dataTypes))}function Yq(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{aO(t.dataTypes,r)||Ek(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),r3(t,e)}}function Qq(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Ek(t,"use allowUnionTypes to allow union type keyword")}function e3(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,Ik.shouldUseRule)(t.schema,i)){let{type:o}=i.definition;o.length&&!o.some(s=>t3(e,s))&&Ek(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function t3(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function aO(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function r3(t,e){let r=[];for(let n of t.dataTypes)aO(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function Ek(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,So.checkStrictMode)(t,e,t.opts.strictTypes)}var uy=class{constructor(e,r,n){if((0,op.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,So.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",cO(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,op.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=e.gen.const("_errs",Se.default.errors))}result(e,r,n){this.failResult((0,ie.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ie.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ie._)`${r} !== undefined && (${(0,ie.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?ip.reportExtraError:ip.reportError)(this,this.def.error,r)}$dataError(){(0,ip.reportError)(this,this.def.$dataError||ip.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ip.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=ie.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=ie.nil,r=ie.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:o,def:s}=this;n.if((0,ie.or)((0,ie._)`${i} === undefined`,r)),e!==ie.nil&&n.assign(e,!0),(o.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==ie.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:o}=this;return(0,ie.or)(s(),a());function s(){if(n.length){if(!(r instanceof ie.Name))throw new Error("ajv implementation error");let l=Array.isArray(n)?n:[n];return(0,ie._)`${(0,cy.checkDataTypes)(l,r,o.opts.strictNumbers,cy.DataType.Wrong)}`}return ie.nil}function a(){if(i.validateSchema){let l=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,ie._)`!${l}(${r})`}return ie.nil}}subschema(e,r){let n=(0,$k.getSubschema)(this.it,e);(0,$k.extendSubschemaData)(n,this.it,e),(0,$k.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return Vq(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=So.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=So.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,ie.Name)),!0}};Ss.KeywordCxt=uy;function lO(t,e,r,n){let i=new uy(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,op.funcKeywordCode)(i,r):"macro"in r?(0,op.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,op.funcKeywordCode)(i,r)}var n3=/^\/(?:[^~]|~0|~1)*$/,i3=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function cO(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,o;if(t==="")return Se.default.rootData;if(t[0]==="/"){if(!n3.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,o=Se.default.rootData}else{let c=i3.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+c[1];if(i=c[2],i==="#"){if(u>=e)throw new Error(l("property/index",u));return n[e-u]}if(u>e)throw new Error(l("data",u));if(o=r[e-u],!i)return o}let s=o,a=i.split("/");for(let c of a)c&&(o=(0,ie._)`${o}${(0,ie.getProperty)((0,So.unescapeJsonPointer)(c))}`,s=(0,ie._)`${s} && ${o}`);return s;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}Ss.getData=cO});var dy=N(Tk=>{"use strict";Object.defineProperty(Tk,"__esModule",{value:!0});var Pk=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Tk.default=Pk});var ap=N(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});var Ak=np(),Ck=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Ak.resolveUrl)(e,r,n),this.missingSchema=(0,Ak.normalizeId)((0,Ak.getFullPath)(e,this.missingRef))}};zk.default=Ck});var py=N(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.resolveSchema=Nn.getCompilingSchema=Nn.resolveRef=Nn.compileSchema=Nn.SchemaEnv=void 0;var si=Le(),o3=dy(),Fa=ko(),ai=np(),uO=Ke(),s3=sp(),Su=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,ai.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Nn.SchemaEnv=Su;function Rk(t){let e=dO.call(this,t);if(e)return e;let r=(0,ai.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,s=new si.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o}),a;t.$async&&(a=s.scopeValue("Error",{ref:o3.default,code:(0,si._)`require("ajv/dist/runtime/validation_error").default`}));let l=s.scopeName("validate");t.validateName=l;let c={gen:s,allErrors:this.opts.allErrors,data:Fa.default.data,parentData:Fa.default.parentData,parentDataProperty:Fa.default.parentDataProperty,dataNames:[Fa.default.data],dataPathArr:[si.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,si.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:si.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,si._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,s3.validateFunctionCode)(c),s.optimize(this.opts.code.optimize);let d=s.toString();u=`${s.scopeRefs(Fa.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let f=new Function(`${Fa.default.self}`,`${Fa.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:l,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=c;f.evaluated={props:m instanceof si.Name?void 0:m,items:h instanceof si.Name?void 0:h,dynamicProps:m instanceof si.Name,dynamicItems:h instanceof si.Name},f.source&&(f.source.evaluated=(0,si.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Nn.compileSchema=Rk;function a3(t,e,r){var n;r=(0,ai.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let o=u3.call(this,t,r);if(o===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(o=new Su({schema:s,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=l3.call(this,o)}Nn.resolveRef=a3;function l3(t){return(0,ai.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Rk.call(this,t)}function dO(t){for(let e of this._compilations)if(c3(e,t))return e}Nn.getCompilingSchema=dO;function c3(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function u3(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||fy.call(this,t,e)}function fy(t,e){let r=this.opts.uriResolver.parse(e),n=(0,ai._getFullPath)(this.opts.uriResolver,r),i=(0,ai.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return Ok.call(this,r,t);let o=(0,ai.normalizeId)(n),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=fy.call(this,t,s);return typeof a?.schema!="object"?void 0:Ok.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||Rk.call(this,s),o===(0,ai.normalizeId)(e)){let{schema:a}=s,{schemaId:l}=this.opts,c=a[l];return c&&(i=(0,ai.resolveUrl)(this.opts.uriResolver,i,c)),new Su({schema:a,schemaId:l,root:t,baseId:i})}return Ok.call(this,r,s)}}Nn.resolveSchema=fy;var d3=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ok(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let l=r[(0,uO.unescapeFragment)(a)];if(l===void 0)return;r=l;let c=typeof r=="object"&&r[this.opts.schemaId];!d3.has(a)&&c&&(e=(0,ai.resolveUrl)(this.opts.uriResolver,e,c))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,uO.schemaHasRulesButRef)(r,this.RULES)){let a=(0,ai.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=fy.call(this,n,a)}let{schemaId:s}=this.opts;if(o=o||new Su({schema:r,schemaId:s,root:n,baseId:e}),o.schema!==o.root.schema)return o}});var fO=N((eke,f3)=>{f3.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 Mk=N((tke,gO)=>{"use strict";var p3=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),mO=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);function Nk(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var m3=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function pO(t){return t.length=0,!0}function h3(t,e,r){if(t.length){let n=Nk(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function g3(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],o=!1,s=!1,a=h3;for(let l=0;l<t.length;l++){let c=t[l];if(!(c==="["||c==="]"))if(c===":"){if(o===!0&&(s=!0),!a(i,n,r))break;if(++e>7){r.error=!0;break}l>0&&t[l-1]===":"&&(o=!0),n.push(":");continue}else if(c==="%"){if(!a(i,n,r))break;a=pO}else{i.push(c);continue}}return i.length&&(a===pO?r.zone=i.join(""):s?n.push(i.join("")):n.push(Nk(i))),r.address=n.join(""),r}function hO(t){if(y3(t,":")<2)return{host:t,isIPV6:!1};let e=g3(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function y3(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function b3(t){let e=t,r=[],n=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(i===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function _3(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function v3(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!mO(r)){let n=hO(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}gO.exports={nonSimpleDomain:m3,recomposeAuthority:v3,normalizeComponentEncoding:_3,removeDotSegments:b3,isIPv4:mO,isUUID:p3,normalizeIPv6:hO,stringArrayToHexStripped:Nk}});var wO=N((rke,vO)=>{"use strict";var{isUUID:w3}=Mk(),x3=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,k3=["http","https","ws","wss","urn","urn:uuid"];function S3(t){return k3.indexOf(t)!==-1}function jk(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function yO(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function bO(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function $3(t){return t.secure=jk(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function I3(t){if((t.port===(jk(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function E3(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(x3);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,o=Dk(i);t.path=void 0,o&&(t=o.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function P3(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,o=Dk(i);o&&(t=o.serialize(t,e));let s=t,a=t.nss;return s.path=`${n||e.nid}:${a}`,e.skipEscape=!0,s}function T3(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!w3(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function A3(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var _O={scheme:"http",domainHost:!0,parse:yO,serialize:bO},C3={scheme:"https",domainHost:_O.domainHost,parse:yO,serialize:bO},my={scheme:"ws",domainHost:!0,parse:$3,serialize:I3},z3={scheme:"wss",domainHost:my.domainHost,parse:my.parse,serialize:my.serialize},O3={scheme:"urn",parse:E3,serialize:P3,skipNormalize:!0},R3={scheme:"urn:uuid",parse:T3,serialize:A3,skipNormalize:!0},hy={http:_O,https:C3,ws:my,wss:z3,urn:O3,"urn:uuid":R3};Object.setPrototypeOf(hy,null);function Dk(t){return t&&(hy[t]||hy[t.toLowerCase()])||void 0}vO.exports={wsIsSecure:jk,SCHEMES:hy,isValidSchemeName:S3,getSchemeHandler:Dk}});var SO=N((nke,yy)=>{"use strict";var{normalizeIPv6:N3,removeDotSegments:lp,recomposeAuthority:M3,normalizeComponentEncoding:gy,isIPv4:j3,nonSimpleDomain:D3}=Mk(),{SCHEMES:L3,getSchemeHandler:xO}=wO();function U3(t,e){return typeof t=="string"?t=Ci($o(t,e),e):typeof t=="object"&&(t=$o(Ci(t,e),e)),t}function Z3(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=kO($o(t,n),$o(e,n),n,!0);return n.skipEscape=!0,Ci(i,n)}function kO(t,e,r,n){let i={};return n||(t=$o(Ci(t,r),r),e=$o(Ci(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=lp(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=lp(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=lp(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=lp(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function F3(t,e,r){return typeof t=="string"?(t=unescape(t),t=Ci(gy($o(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Ci(gy(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Ci(gy($o(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Ci(gy(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Ci(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],o=xO(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let s=M3(r);if(s!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(s),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(a=lp(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),i.push(a)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var V3=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function $o(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let o=t.match(V3);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host)if(j3(n.host)===!1){let l=N3(n.host);n.host=l.host.toLowerCase(),i=l.isIPV6}else i=!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 s=xO(r.scheme||n.scheme);if(!r.unicodeSupport&&(!s||!s.unicodeSupport)&&n.host&&(r.domainHost||s&&s.domainHost)&&i===!1&&D3(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!s||s&&!s.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),s&&s.parse&&s.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Lk={SCHEMES:L3,normalize:U3,resolve:Z3,resolveComponent:kO,equal:F3,serialize:Ci,parse:$o};yy.exports=Lk;yy.exports.default=Lk;yy.exports.fastUri=Lk});var IO=N(Uk=>{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});var $O=SO();$O.code='require("ajv/dist/runtime/uri").default';Uk.default=$O});var RO=N(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.CodeGen=hr.Name=hr.nil=hr.stringify=hr.str=hr._=hr.KeywordCxt=void 0;var q3=sp();Object.defineProperty(hr,"KeywordCxt",{enumerable:!0,get:function(){return q3.KeywordCxt}});var $u=Le();Object.defineProperty(hr,"_",{enumerable:!0,get:function(){return $u._}});Object.defineProperty(hr,"str",{enumerable:!0,get:function(){return $u.str}});Object.defineProperty(hr,"stringify",{enumerable:!0,get:function(){return $u.stringify}});Object.defineProperty(hr,"nil",{enumerable:!0,get:function(){return $u.nil}});Object.defineProperty(hr,"Name",{enumerable:!0,get:function(){return $u.Name}});Object.defineProperty(hr,"CodeGen",{enumerable:!0,get:function(){return $u.CodeGen}});var B3=dy(),CO=ap(),W3=hk(),cp=py(),G3=Le(),up=np(),by=tp(),Fk=Ke(),EO=fO(),H3=IO(),zO=(t,e)=>new RegExp(t,e);zO.code="new RegExp";var X3=["removeAdditional","useDefaults","coerceTypes"],K3=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),J3={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."},Y3={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},PO=200;function Q3(t){var e,r,n,i,o,s,a,l,c,u,d,p,f,m,h,y,g,b,v,C,E,T,F,le,ee;let I=t.strict,ce=(e=t.code)===null||e===void 0?void 0:e.optimize,be=ce===!0||ce===void 0?1:ce||0,J=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:zO,pe=(i=t.uriResolver)!==null&&i!==void 0?i:H3.default;return{strictSchema:(s=(o=t.strictSchema)!==null&&o!==void 0?o:I)!==null&&s!==void 0?s:!0,strictNumbers:(l=(a=t.strictNumbers)!==null&&a!==void 0?a:I)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=t.strictTypes)!==null&&c!==void 0?c:I)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:I)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:I)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:be,regExp:J}:{optimize:be,regExp:J},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:PO,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:PO,meta:(g=t.meta)!==null&&g!==void 0?g:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(C=t.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(E=t.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(T=t.validateSchema)!==null&&T!==void 0?T:!0,validateFormats:(F=t.validateFormats)!==null&&F!==void 0?F:!0,unicodeRegExp:(le=t.unicodeRegExp)!==null&&le!==void 0?le:!0,int32range:(ee=t.int32range)!==null&&ee!==void 0?ee:!0,uriResolver:pe}}var dp=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Q3(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new G3.ValueScope({scope:{},prefixes:K3,es5:r,lines:n}),this.logger=oB(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,W3.getRules)(),TO.call(this,J3,e,"NOT SUPPORTED"),TO.call(this,Y3,e,"DEPRECATED","warn"),this._metaOpts=nB.call(this),e.formats&&tB.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&rB.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),eB.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=EO;n==="id"&&(i={...EO},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,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,e,r);async function i(u,d){await o.call(this,u.$schema);let p=this._addSchema(u,d);return p.validate||s.call(this,p)}async function o(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof CO.default))throw d;return a.call(this,d),await l.call(this,d.missingSchema),s.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function l(u){let d=await c.call(this,u);this.refs[u]||await o.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,i);return this}let o;if(typeof e=="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,up.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$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,e);if(!i&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return i}getSchema(e){let r;for(;typeof(r=AO.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new cp.SchemaEnv({schema:{},schemaId:n});if(r=cp.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=AO.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,up.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,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(aB.call(this,n,r),!r)return(0,Fk.eachItem)(n,o=>Zk.call(this,o)),this;cB.call(this,r);let i={...r,type:(0,by.getJSONTypes)(r.type),schemaType:(0,by.getJSONTypes)(r.schemaType)};return(0,Fk.eachItem)(n,i.type.length===0?o=>Zk.call(this,o,i):o=>i.type.forEach(s=>Zk.call(this,o,i,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(o=>o.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,o)=>i+r+o)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let o=i.split("/").slice(1),s=e;for(let a of o)s=s[a];for(let a in n){let l=n[a];if(typeof l!="object")continue;let{$data:c}=l.definition,u=s[a];c&&u&&(s[a]=OO(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(l!==void 0)return l;n=(0,up.normalizeId)(s||n);let c=up.getSchemaRefs.call(this,e,n);return l=new cp.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:c}),this._cache.set(l.schema,l),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=l),i&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):cp.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{cp.compileSchema.call(this,e)}finally{this.opts=r}}};dp.ValidationError=B3.default;dp.MissingRefError=CO.default;hr.default=dp;function TO(t,e,r,n="error"){for(let i in t){let o=i;o in e&&this.logger[n](`${r}: option ${i}. ${t[o]}`)}}function AO(t){return t=(0,up.normalizeId)(t),this.schemas[t]||this.refs[t]}function eB(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function tB(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function rB(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function nB(){let t={...this.opts};for(let e of X3)delete t[e];return t}var iB={log(){},warn(){},error(){}};function oB(t){if(t===!1)return iB;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var sB=/^[a-z_$][a-z0-9_$:-]*$/i;function aB(t,e){let{RULES:r}=this;if((0,Fk.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!sB.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Zk(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=i?o.post:o.rules.find(({type:l})=>l===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,by.getJSONTypes)(e.type),schemaType:(0,by.getJSONTypes)(e.schemaType)}};e.before?lB.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(l=>this.addKeyword(l))}function lB(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function cB(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=OO(e)),t.validateSchema=this.compile(e,!0))}var uB={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function OO(t){return{anyOf:[t,uB]}}});var NO=N(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});var dB={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Vk.default=dB});var LO=N(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.callRef=Va.getValidate=void 0;var fB=ap(),MO=Rn(),Qr=Le(),Iu=ko(),jO=py(),_y=Ke(),pB={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:o,validateName:s,opts:a,self:l}=n,{root:c}=o;if((r==="#"||r==="#/")&&i===c.baseId)return d();let u=jO.resolveRef.call(l,c,i,r);if(u===void 0)throw new fB.default(n.opts.uriResolver,i,r);if(u instanceof jO.SchemaEnv)return p(u);return f(u);function d(){if(o===c)return vy(t,s,o,o.$async);let m=e.scopeValue("root",{ref:c});return vy(t,(0,Qr._)`${m}.validate`,c,c.$async)}function p(m){let h=DO(t,m);vy(t,h,m,m.$async)}function f(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Qr.stringify)(m)}:{ref:m}),y=e.name("valid"),g=t.subschema({schema:m,dataTypes:[],schemaPath:Qr.nil,topSchemaRef:h,errSchemaPath:r},y);t.mergeEvaluated(g),t.ok(y)}}};function DO(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Qr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Va.getValidate=DO;function vy(t,e,r,n){let{gen:i,it:o}=t,{allErrors:s,schemaEnv:a,opts:l}=o,c=l.passContext?Iu.default.this:Qr.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,Qr._)`await ${(0,MO.callValidateCode)(t,e,c)}`),f(e),s||i.assign(m,!0)},h=>{i.if((0,Qr._)`!(${h} instanceof ${o.ValidationError})`,()=>i.throw(h)),p(h),s||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,MO.callValidateCode)(t,e,c),()=>f(e),()=>p(e))}function p(m){let h=(0,Qr._)`${m}.errors`;i.assign(Iu.default.vErrors,(0,Qr._)`${Iu.default.vErrors} === null ? ${h} : ${Iu.default.vErrors}.concat(${h})`),i.assign(Iu.default.errors,(0,Qr._)`${Iu.default.vErrors}.length`)}function f(m){var h;if(!o.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(o.props=_y.mergeEvaluated.props(i,y.props,o.props));else{let g=i.var("props",(0,Qr._)`${m}.evaluated.props`);o.props=_y.mergeEvaluated.props(i,g,o.props,Qr.Name)}if(o.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(o.items=_y.mergeEvaluated.items(i,y.items,o.items));else{let g=i.var("items",(0,Qr._)`${m}.evaluated.items`);o.items=_y.mergeEvaluated.items(i,g,o.items,Qr.Name)}}}Va.callRef=vy;Va.default=pB});var UO=N(qk=>{"use strict";Object.defineProperty(qk,"__esModule",{value:!0});var mB=NO(),hB=LO(),gB=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",mB.default,hB.default];qk.default=gB});var ZO=N(Bk=>{"use strict";Object.defineProperty(Bk,"__esModule",{value:!0});var wy=Le(),$s=wy.operators,xy={maximum:{okStr:"<=",ok:$s.LTE,fail:$s.GT},minimum:{okStr:">=",ok:$s.GTE,fail:$s.LT},exclusiveMaximum:{okStr:"<",ok:$s.LT,fail:$s.GTE},exclusiveMinimum:{okStr:">",ok:$s.GT,fail:$s.LTE}},yB={message:({keyword:t,schemaCode:e})=>(0,wy.str)`must be ${xy[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,wy._)`{comparison: ${xy[t].okStr}, limit: ${e}}`},bB={keyword:Object.keys(xy),type:"number",schemaType:"number",$data:!0,error:yB,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,wy._)`${r} ${xy[e].fail} ${n} || isNaN(${r})`)}};Bk.default=bB});var FO=N(Wk=>{"use strict";Object.defineProperty(Wk,"__esModule",{value:!0});var fp=Le(),_B={message:({schemaCode:t})=>(0,fp.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,fp._)`{multipleOf: ${t}}`},vB={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:_B,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,o=i.opts.multipleOfPrecision,s=e.let("res"),a=o?(0,fp._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,fp._)`${s} !== parseInt(${s})`;t.fail$data((0,fp._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};Wk.default=vB});var qO=N(Gk=>{"use strict";Object.defineProperty(Gk,"__esModule",{value:!0});function VO(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}Gk.default=VO;VO.code='require("ajv/dist/runtime/ucs2length").default'});var BO=N(Hk=>{"use strict";Object.defineProperty(Hk,"__esModule",{value:!0});var qa=Le(),wB=Ke(),xB=qO(),kB={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,qa.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,qa._)`{limit: ${t}}`},SB={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:kB,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,o=e==="maxLength"?qa.operators.GT:qa.operators.LT,s=i.opts.unicode===!1?(0,qa._)`${r}.length`:(0,qa._)`${(0,wB.useFunc)(t.gen,xB.default)}(${r})`;t.fail$data((0,qa._)`${s} ${o} ${n}`)}};Hk.default=SB});var WO=N(Xk=>{"use strict";Object.defineProperty(Xk,"__esModule",{value:!0});var $B=Rn(),ky=Le(),IB={message:({schemaCode:t})=>(0,ky.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ky._)`{pattern: ${t}}`},EB={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:IB,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:o}=t,s=o.opts.unicodeRegExp?"u":"",a=r?(0,ky._)`(new RegExp(${i}, ${s}))`:(0,$B.usePattern)(t,n);t.fail$data((0,ky._)`!${a}.test(${e})`)}};Xk.default=EB});var GO=N(Kk=>{"use strict";Object.defineProperty(Kk,"__esModule",{value:!0});var pp=Le(),PB={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,pp.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,pp._)`{limit: ${t}}`},TB={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:PB,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?pp.operators.GT:pp.operators.LT;t.fail$data((0,pp._)`Object.keys(${r}).length ${i} ${n}`)}};Kk.default=TB});var HO=N(Jk=>{"use strict";Object.defineProperty(Jk,"__esModule",{value:!0});var mp=Rn(),hp=Le(),AB=Ke(),CB={message:({params:{missingProperty:t}})=>(0,hp.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,hp._)`{missingProperty: ${t}}`},zB={keyword:"required",type:"object",schemaType:"array",$data:!0,error:CB,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:o,it:s}=t,{opts:a}=s;if(!o&&r.length===0)return;let l=r.length>=a.loopRequired;if(s.allErrors?c():u(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(f?.[h]===void 0&&!m.has(h)){let y=s.schemaEnv.baseId+s.errSchemaPath,g=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,AB.checkStrictMode)(s,g,s.opts.strictRequired)}}function c(){if(l||o)t.block$data(hp.nil,d);else for(let f of r)(0,mp.checkReportMissingProp)(t,f)}function u(){let f=e.let("missing");if(l||o){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,mp.checkMissingProp)(t,r,f)),(0,mp.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0,mp.noPropertyInData)(e,i,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(m,(0,mp.propertyInData)(e,i,f,a.ownProperties)),e.if((0,hp.not)(m),()=>{t.error(),e.break()})},hp.nil)}}};Jk.default=zB});var XO=N(Yk=>{"use strict";Object.defineProperty(Yk,"__esModule",{value:!0});var gp=Le(),OB={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,gp.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,gp._)`{limit: ${t}}`},RB={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:OB,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?gp.operators.GT:gp.operators.LT;t.fail$data((0,gp._)`${r}.length ${i} ${n}`)}};Yk.default=RB});var Sy=N(Qk=>{"use strict";Object.defineProperty(Qk,"__esModule",{value:!0});var KO=rp();KO.code='require("ajv/dist/runtime/equal").default';Qk.default=KO});var JO=N(tS=>{"use strict";Object.defineProperty(tS,"__esModule",{value:!0});var eS=tp(),gr=Le(),NB=Ke(),MB=Sy(),jB={message:({params:{i:t,j:e}})=>(0,gr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,gr._)`{i: ${t}, j: ${e}}`},DB={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:jB,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:o,schemaCode:s,it:a}=t;if(!n&&!i)return;let l=e.let("valid"),c=o.items?(0,eS.getSchemaTypes)(o.items):[];t.block$data(l,u,(0,gr._)`${s} === false`),t.ok(l);function u(){let m=e.let("i",(0,gr._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(l,!0),e.if((0,gr._)`${m} > 1`,()=>(d()?p:f)(m,h))}function d(){return c.length>0&&!c.some(m=>m==="object"||m==="array")}function p(m,h){let y=e.name("item"),g=(0,eS.checkDataTypes)(c,y,a.opts.strictNumbers,eS.DataType.Wrong),b=e.const("indices",(0,gr._)`{}`);e.for((0,gr._)`;${m}--;`,()=>{e.let(y,(0,gr._)`${r}[${m}]`),e.if(g,(0,gr._)`continue`),c.length>1&&e.if((0,gr._)`typeof ${y} == "string"`,(0,gr._)`${y} += "_"`),e.if((0,gr._)`typeof ${b}[${y}] == "number"`,()=>{e.assign(h,(0,gr._)`${b}[${y}]`),t.error(),e.assign(l,!1).break()}).code((0,gr._)`${b}[${y}] = ${m}`)})}function f(m,h){let y=(0,NB.useFunc)(e,MB.default),g=e.name("outer");e.label(g).for((0,gr._)`;${m}--;`,()=>e.for((0,gr._)`${h} = ${m}; ${h}--;`,()=>e.if((0,gr._)`${y}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(l,!1).break(g)})))}}};tS.default=DB});var YO=N(nS=>{"use strict";Object.defineProperty(nS,"__esModule",{value:!0});var rS=Le(),LB=Ke(),UB=Sy(),ZB={message:"must be equal to constant",params:({schemaCode:t})=>(0,rS._)`{allowedValue: ${t}}`},FB={keyword:"const",$data:!0,error:ZB,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,rS._)`!${(0,LB.useFunc)(e,UB.default)}(${r}, ${i})`):t.fail((0,rS._)`${o} !== ${r}`)}};nS.default=FB});var QO=N(iS=>{"use strict";Object.defineProperty(iS,"__esModule",{value:!0});var yp=Le(),VB=Ke(),qB=Sy(),BB={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,yp._)`{allowedValues: ${t}}`},WB={keyword:"enum",schemaType:"array",$data:!0,error:BB,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:o,it:s}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=s.opts.loopEnum,l,c=()=>l??(l=(0,VB.useFunc)(e,qB.default)),u;if(a||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let f=e.const("vSchema",o);u=(0,yp.or)(...i.map((m,h)=>p(f,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",o,f=>e.if((0,yp._)`${c()}(${r}, ${f})`,()=>e.assign(u,!0).break()))}function p(f,m){let h=i[m];return typeof h=="object"&&h!==null?(0,yp._)`${c()}(${r}, ${f}[${m}])`:(0,yp._)`${r} === ${h}`}}};iS.default=WB});var eR=N(oS=>{"use strict";Object.defineProperty(oS,"__esModule",{value:!0});var GB=ZO(),HB=FO(),XB=BO(),KB=WO(),JB=GO(),YB=HO(),QB=XO(),eW=JO(),tW=YO(),rW=QO(),nW=[GB.default,HB.default,XB.default,KB.default,JB.default,YB.default,QB.default,eW.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},tW.default,rW.default];oS.default=nW});var aS=N(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.validateAdditionalItems=void 0;var Ba=Le(),sS=Ke(),iW={message:({params:{len:t}})=>(0,Ba.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ba._)`{limit: ${t}}`},oW={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:iW,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,sS.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}tR(t,n)}};function tR(t,e){let{gen:r,schema:n,data:i,keyword:o,it:s}=t;s.items=!0;let a=r.const("len",(0,Ba._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Ba._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,sS.alwaysValidSchema)(s,n)){let c=r.var("valid",(0,Ba._)`${a} <= ${e.length}`);r.if((0,Ba.not)(c),()=>l(c)),t.ok(c)}function l(c){r.forRange("i",e.length,a,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:sS.Type.Num},c),s.allErrors||r.if((0,Ba.not)(c),()=>r.break())})}}bp.validateAdditionalItems=tR;bp.default=oW});var lS=N(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});_p.validateTuple=void 0;var rR=Le(),$y=Ke(),sW=Rn(),aW={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return nR(t,"additionalItems",e);r.items=!0,!(0,$y.alwaysValidSchema)(r,e)&&t.ok((0,sW.validateArray)(t))}};function nR(t,e,r=t.schema){let{gen:n,parentSchema:i,data:o,keyword:s,it:a}=t;u(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=$y.mergeEvaluated.items(n,r.length,a.items));let l=n.name("valid"),c=n.const("len",(0,rR._)`${o}.length`);r.forEach((d,p)=>{(0,$y.alwaysValidSchema)(a,d)||(n.if((0,rR._)`${c} > ${p}`,()=>t.subschema({keyword:s,schemaProp:p,dataProp:p},l)),t.ok(l))});function u(d){let{opts:p,errSchemaPath:f}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!h){let y=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,$y.checkStrictMode)(a,y,p.strictTuples)}}}_p.validateTuple=nR;_p.default=aW});var iR=N(cS=>{"use strict";Object.defineProperty(cS,"__esModule",{value:!0});var lW=lS(),cW={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,lW.validateTuple)(t,"items")};cS.default=cW});var sR=N(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});var oR=Le(),uW=Ke(),dW=Rn(),fW=aS(),pW={message:({params:{len:t}})=>(0,oR.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,oR._)`{limit: ${t}}`},mW={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:pW,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,uW.alwaysValidSchema)(n,e)&&(i?(0,fW.validateAdditionalItems)(t,i):t.ok((0,dW.validateArray)(t)))}};uS.default=mW});var aR=N(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});var Mn=Le(),Iy=Ke(),hW={message:({params:{min:t,max:e}})=>e===void 0?(0,Mn.str)`must contain at least ${t} valid item(s)`:(0,Mn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Mn._)`{minContains: ${t}}`:(0,Mn._)`{minContains: ${t}, maxContains: ${e}}`},gW={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:hW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t,s,a,{minContains:l,maxContains:c}=n;o.opts.next?(s=l===void 0?1:l,a=c):s=1;let u=e.const("len",(0,Mn._)`${i}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,Iy.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,Iy.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Iy.alwaysValidSchema)(o,r)){let h=(0,Mn._)`${u} >= ${s}`;a!==void 0&&(h=(0,Mn._)`${h} && ${u} <= ${a}`),t.pass(h);return}o.items=!0;let d=e.name("valid");a===void 0&&s===1?f(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,Mn._)`${i}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let h=e.name("_valid"),y=e.let("count",0);f(h,()=>e.if(h,()=>m(y)))}function f(h,y){e.forRange("i",0,u,g=>{t.subschema({keyword:"contains",dataProp:g,dataPropType:Iy.Type.Num,compositeRule:!0},h),y()})}function m(h){e.code((0,Mn._)`${h}++`),a===void 0?e.if((0,Mn._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,Mn._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,Mn._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};dS.default=gW});var uR=N(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.validateSchemaDeps=zi.validatePropertyDeps=zi.error=void 0;var fS=Le(),yW=Ke(),vp=Rn();zi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,fS.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,fS._)`{property: ${t},
|
|
5
|
+
|| ${s} === "boolean" || ${i} === null`).assign(a,(0,Ce._)`[${i}]`)}}}function YV({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Ce._)`${e} !== undefined`,()=>t.assign((0,Ce._)`${e}[${r}]`,n))}function yk(t,e,r,n=wu.Correct){let i=n===wu.Correct?Ce.operators.EQ:Ce.operators.NEQ,o;switch(t){case"null":return(0,Ce._)`${e} ${i} null`;case"array":o=(0,Ce._)`Array.isArray(${e})`;break;case"object":o=(0,Ce._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=s((0,Ce._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=s();break;default:return(0,Ce._)`typeof ${e} ${i} ${t}`}return n===wu.Correct?o:(0,Ce.not)(o);function s(a=Ce.nil){return(0,Ce.and)((0,Ce._)`typeof ${e} == "number"`,a,r?(0,Ce._)`isFinite(${e})`:Ce.nil)}}Tr.checkDataType=yk;function bk(t,e,r,n){if(t.length===1)return yk(t[0],e,r,n);let i,o=(0,Oz.toHash)(t);if(o.array&&o.object){let s=(0,Ce._)`typeof ${e} != "object"`;i=o.null?s:(0,Ce._)`!${e} || ${s}`,delete o.null,delete o.array,delete o.object}else i=Ce.nil;o.number&&delete o.integer;for(let s in o)i=(0,Ce.and)(i,yk(s,e,r,n));return i}Tr.checkDataTypes=bk;var QV={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Ce._)`{type: ${t}}`:(0,Ce._)`{type: ${e}}`};function _k(t){let e=eq(t);(0,GV.reportError)(e,QV)}Tr.reportTypeError=_k;function eq(t){let{gen:e,data:r,schema:n}=t,i=(0,Oz.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var jz=N(ay=>{"use strict";Object.defineProperty(ay,"__esModule",{value:!0});ay.assignDefaults=void 0;var xu=Le(),tq=Ke();function rq(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)Mz(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,o)=>Mz(t,o,i.default))}ay.assignDefaults=rq;function Mz(t,e,r){let{gen:n,compositeRule:i,data:o,opts:s}=t;if(r===void 0)return;let a=(0,xu._)`${o}${(0,xu.getProperty)(e)}`;if(i){(0,tq.checkStrictMode)(t,`default is ignored for: ${a}`);return}let l=(0,xu._)`${a} === undefined`;s.useDefaults==="empty"&&(l=(0,xu._)`${l} || ${a} === null || ${a} === ""`),n.if(l,(0,xu._)`${a} = ${(0,xu.stringify)(r)}`)}});var Nn=N(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.validateUnion=at.validateArray=at.usePattern=at.callValidateCode=at.schemaProperties=at.allSchemaProperties=at.noPropertyInData=at.propertyInData=at.isOwnProperty=at.hasPropFunc=at.reportMissingProp=at.checkMissingProp=at.checkReportMissingProp=void 0;var _t=Le(),vk=Ke(),ws=ko(),nq=Ke();function iq(t,e){let{gen:r,data:n,it:i}=t;r.if(xk(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,_t._)`${e}`},!0),t.error()})}at.checkReportMissingProp=iq;function oq({gen:t,data:e,it:{opts:r}},n,i){return(0,_t.or)(...n.map(o=>(0,_t.and)(xk(t,e,o,r.ownProperties),(0,_t._)`${i} = ${o}`)))}at.checkMissingProp=oq;function sq(t,e){t.setParams({missingProperty:e},!0),t.error()}at.reportMissingProp=sq;function Dz(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,_t._)`Object.prototype.hasOwnProperty`})}at.hasPropFunc=Dz;function wk(t,e,r){return(0,_t._)`${Dz(t)}.call(${e}, ${r})`}at.isOwnProperty=wk;function aq(t,e,r,n){let i=(0,_t._)`${e}${(0,_t.getProperty)(r)} !== undefined`;return n?(0,_t._)`${i} && ${wk(t,e,r)}`:i}at.propertyInData=aq;function xk(t,e,r,n){let i=(0,_t._)`${e}${(0,_t.getProperty)(r)} === undefined`;return n?(0,_t.or)(i,(0,_t.not)(wk(t,e,r))):i}at.noPropertyInData=xk;function Lz(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}at.allSchemaProperties=Lz;function lq(t,e){return Lz(e).filter(r=>!(0,vk.alwaysValidSchema)(t,e[r]))}at.schemaProperties=lq;function cq({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:s},a,l,c){let u=c?(0,_t._)`${t}, ${e}, ${n}${i}`:e,d=[[ws.default.instancePath,(0,_t.strConcat)(ws.default.instancePath,o)],[ws.default.parentData,s.parentData],[ws.default.parentDataProperty,s.parentDataProperty],[ws.default.rootData,ws.default.rootData]];s.opts.dynamicRef&&d.push([ws.default.dynamicAnchors,ws.default.dynamicAnchors]);let p=(0,_t._)`${u}, ${r.object(...d)}`;return l!==_t.nil?(0,_t._)`${a}.call(${l}, ${p})`:(0,_t._)`${a}(${p})`}at.callValidateCode=cq;var uq=(0,_t._)`new RegExp`;function dq({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,o=i(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,_t._)`${i.code==="new RegExp"?uq:(0,nq.useFunc)(t,i)}(${r}, ${n})`})}at.usePattern=dq;function fq(t){let{gen:e,data:r,keyword:n,it:i}=t,o=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(o,!0),s(()=>e.break()),o;function s(a){let l=e.const("len",(0,_t._)`${r}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:n,dataProp:c,dataPropType:vk.Type.Num},o),e.if((0,_t.not)(o),a)})}}at.validateArray=fq;function pq(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,vk.alwaysValidSchema)(i,l))&&!i.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((l,c)=>{let u=t.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);e.assign(s,(0,_t._)`${s} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,_t.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}at.validateUnion=pq});var Fz=N(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.validateKeywordUsage=Ti.validSchemaType=Ti.funcKeywordCode=Ti.macroKeywordCode=void 0;var Lr=Le(),Za=ko(),mq=Nn(),hq=ep();function gq(t,e){let{gen:r,keyword:n,schema:i,parentSchema:o,it:s}=t,a=e.macro.call(s.self,i,o,s),l=Zz(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let c=r.name("valid");t.subschema({schema:a,schemaPath:Lr.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}Ti.macroKeywordCode=gq;function yq(t,e){var r;let{gen:n,keyword:i,schema:o,parentSchema:s,$data:a,it:l}=t;_q(l,e);let c=!a&&e.compile?e.compile.call(l.self,o,s,l):e.validate,u=Zz(n,i,c),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)h(),e.modifying&&Uz(t),y(()=>t.error());else{let g=e.async?f():m();e.modifying&&Uz(t),y(()=>bq(t,g))}}function f(){let g=n.let("ruleErrs",null);return n.try(()=>h((0,Lr._)`await `),b=>n.assign(d,!1).if((0,Lr._)`${b} instanceof ${l.ValidationError}`,()=>n.assign(g,(0,Lr._)`${b}.errors`),()=>n.throw(b))),g}function m(){let g=(0,Lr._)`${u}.errors`;return n.assign(g,null),h(Lr.nil),g}function h(g=e.async?(0,Lr._)`await `:Lr.nil){let b=l.opts.passContext?Za.default.this:Za.default.self,v=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Lr._)`${g}${(0,mq.callValidateCode)(t,u,b,v)}`,e.modifying)}function y(g){var b;n.if((0,Lr.not)((b=e.valid)!==null&&b!==void 0?b:d),g)}}Ti.funcKeywordCode=yq;function Uz(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Lr._)`${n.parentData}[${n.parentDataProperty}]`))}function bq(t,e){let{gen:r}=t;r.if((0,Lr._)`Array.isArray(${e})`,()=>{r.assign(Za.default.vErrors,(0,Lr._)`${Za.default.vErrors} === null ? ${e} : ${Za.default.vErrors}.concat(${e})`).assign(Za.default.errors,(0,Lr._)`${Za.default.vErrors}.length`),(0,hq.extendErrors)(t)},()=>t.error())}function _q({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Zz(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Lr.stringify)(r)})}function vq(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Ti.validSchemaType=vq;function wq({schema:t,opts:e,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");let s=i.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[o])){let l=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}Ti.validateKeywordUsage=wq});var qz=N(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.extendSubschemaMode=xs.extendSubschemaData=xs.getSubschema=void 0;var Ai=Le(),Vz=Ke();function xq(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ai._)`${t.schemaPath}${(0,Ai.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ai._)`${t.schemaPath}${(0,Ai.getProperty)(e)}${(0,Ai.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Vz.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}xs.getSubschema=xq;function kq(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:s}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=e,p=a.let("data",(0,Ai._)`${e.data}${(0,Ai.getProperty)(r)}`,!0);l(p),t.errorPath=(0,Ai.str)`${c}${(0,Vz.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ai._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let c=i instanceof Ai.Name?i:a.let("data",i,!0);l(c),s!==void 0&&(t.propertyName=s)}o&&(t.dataTypes=o);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}xs.extendSubschemaData=kq;function Sq(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}xs.extendSubschemaMode=Sq});var rp=N((G0e,Bz)=>{"use strict";Bz.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var s=o[i];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var kk=N((H0e,Wz)=>{"use strict";var ks=Wz.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};ly(e,n,i,t,"",t)};ks.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ks.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ks.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ks.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 ly(t,e,r,n,i,o,s,a,l,c){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,o,s,a,l,c);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in ks.arrayKeywords)for(var p=0;p<d.length;p++)ly(t,e,r,d[p],i+"/"+u+"/"+p,o,i,u,n,p)}else if(u in ks.propsKeywords){if(d&&typeof d=="object")for(var f in d)ly(t,e,r,d[f],i+"/"+u+"/"+$q(f),o,i,u,n,f)}else(u in ks.keywords||t.allKeys&&!(u in ks.skipKeywords))&&ly(t,e,r,d,i+"/"+u,o,i,u,n)}r(n,i,o,s,a,l,c)}}function $q(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var np=N(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.getSchemaRefs=Yr.resolveUrl=Yr.normalizeId=Yr._getFullPath=Yr.getFullPath=Yr.inlineRef=void 0;var Iq=Ke(),Eq=rp(),Pq=kk(),Tq=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Aq(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Sk(t):e?Gz(t)<=e:!1}Yr.inlineRef=Aq;var Cq=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Sk(t){for(let e in t){if(Cq.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Sk)||typeof r=="object"&&Sk(r))return!0}return!1}function Gz(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Tq.has(r)&&(typeof t[r]=="object"&&(0,Iq.eachItem)(t[r],n=>e+=Gz(n)),e===1/0))return 1/0}return e}function Hz(t,e="",r){r!==!1&&(e=ku(e));let n=t.parse(e);return Xz(t,n)}Yr.getFullPath=Hz;function Xz(t,e){return t.serialize(e).split("#")[0]+"#"}Yr._getFullPath=Xz;var zq=/#\/?$/;function ku(t){return t?t.replace(zq,""):""}Yr.normalizeId=ku;function Oq(t,e,r){return r=ku(r),t.resolve(e,r)}Yr.resolveUrl=Oq;var Rq=/^[a-z_][-a-z0-9._]*$/i;function Nq(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=ku(t[r]||e),o={"":i},s=Hz(n,i,!1),a={},l=new Set;return Pq(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let h=s+p,y=o[m];typeof d[r]=="string"&&(y=g.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),o[p]=y;function g(v){let C=this.opts.uriResolver.resolve;if(v=ku(y?C(y,v):v),l.has(v))throw u(v);l.add(v);let E=this.refs[v];return typeof E=="string"&&(E=this.refs[E]),typeof E=="object"?c(d,E.schema,v):v!==ku(h)&&(v[0]==="#"?(c(d,a[v],v),a[v]=d):this.refs[v]=h),v}function b(v){if(typeof v=="string"){if(!Rq.test(v))throw new Error(`invalid anchor "${v}"`);g.call(this,`#${v}`)}}}),a;function c(d,p,f){if(p!==void 0&&!Eq(d,p))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Yr.getSchemaRefs=Nq});var sp=N(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.getData=Ss.KeywordCxt=Ss.validateFunctionCode=void 0;var eO=Az(),Kz=tp(),Ik=gk(),cy=tp(),Mq=jz(),op=Fz(),$k=qz(),ie=Le(),Se=ko(),jq=np(),So=Ke(),ip=ep();function Dq(t){if(nO(t)&&(iO(t),rO(t))){Zq(t);return}tO(t,()=>(0,eO.topBoolOrEmptySchema)(t))}Ss.validateFunctionCode=Dq;function tO({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},o){i.code.es5?t.func(e,(0,ie._)`${Se.default.data}, ${Se.default.valCxt}`,n.$async,()=>{t.code((0,ie._)`"use strict"; ${Jz(r,i)}`),Uq(t,i),t.code(o)}):t.func(e,(0,ie._)`${Se.default.data}, ${Lq(i)}`,n.$async,()=>t.code(Jz(r,i)).code(o))}function Lq(t){return(0,ie._)`{${Se.default.instancePath}="", ${Se.default.parentData}, ${Se.default.parentDataProperty}, ${Se.default.rootData}=${Se.default.data}${t.dynamicRef?(0,ie._)`, ${Se.default.dynamicAnchors}={}`:ie.nil}}={}`}function Uq(t,e){t.if(Se.default.valCxt,()=>{t.var(Se.default.instancePath,(0,ie._)`${Se.default.valCxt}.${Se.default.instancePath}`),t.var(Se.default.parentData,(0,ie._)`${Se.default.valCxt}.${Se.default.parentData}`),t.var(Se.default.parentDataProperty,(0,ie._)`${Se.default.valCxt}.${Se.default.parentDataProperty}`),t.var(Se.default.rootData,(0,ie._)`${Se.default.valCxt}.${Se.default.rootData}`),e.dynamicRef&&t.var(Se.default.dynamicAnchors,(0,ie._)`${Se.default.valCxt}.${Se.default.dynamicAnchors}`)},()=>{t.var(Se.default.instancePath,(0,ie._)`""`),t.var(Se.default.parentData,(0,ie._)`undefined`),t.var(Se.default.parentDataProperty,(0,ie._)`undefined`),t.var(Se.default.rootData,Se.default.data),e.dynamicRef&&t.var(Se.default.dynamicAnchors,(0,ie._)`{}`)})}function Zq(t){let{schema:e,opts:r,gen:n}=t;tO(t,()=>{r.$comment&&e.$comment&&sO(t),Wq(t),n.let(Se.default.vErrors,null),n.let(Se.default.errors,0),r.unevaluated&&Fq(t),oO(t),Xq(t)})}function Fq(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ie._)`${r}.evaluated`),e.if((0,ie._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ie._)`${t.evaluated}.props`,(0,ie._)`undefined`)),e.if((0,ie._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ie._)`${t.evaluated}.items`,(0,ie._)`undefined`))}function Jz(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ie._)`/*# sourceURL=${r} */`:ie.nil}function Vq(t,e){if(nO(t)&&(iO(t),rO(t))){qq(t,e);return}(0,eO.boolOrEmptySchema)(t,e)}function rO({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function nO(t){return typeof t.schema!="boolean"}function qq(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&sO(t),Gq(t),Hq(t);let o=n.const("_errs",Se.default.errors);oO(t,o),n.var(e,(0,ie._)`${o} === ${Se.default.errors}`)}function iO(t){(0,So.checkUnknownRules)(t),Bq(t)}function oO(t,e){if(t.opts.jtd)return Yz(t,[],!1,e);let r=(0,Kz.getSchemaTypes)(t.schema),n=(0,Kz.coerceAndCheckDataType)(t,r);Yz(t,r,!n,e)}function Bq(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,So.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Wq(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,So.checkStrictMode)(t,"default is ignored in the schema root")}function Gq(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,jq.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Hq(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function sO({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let o=r.$comment;if(i.$comment===!0)t.code((0,ie._)`${Se.default.self}.logger.log(${o})`);else if(typeof i.$comment=="function"){let s=(0,ie.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,ie._)`${Se.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function Xq(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=t;r.$async?e.if((0,ie._)`${Se.default.errors} === 0`,()=>e.return(Se.default.data),()=>e.throw((0,ie._)`new ${i}(${Se.default.vErrors})`)):(e.assign((0,ie._)`${n}.errors`,Se.default.vErrors),o.unevaluated&&Kq(t),e.return((0,ie._)`${Se.default.errors} === 0`))}function Kq({gen:t,evaluated:e,props:r,items:n}){r instanceof ie.Name&&t.assign((0,ie._)`${e}.props`,r),n instanceof ie.Name&&t.assign((0,ie._)`${e}.items`,n)}function Yz(t,e,r,n){let{gen:i,schema:o,data:s,allErrors:a,opts:l,self:c}=t,{RULES:u}=c;if(o.$ref&&(l.ignoreKeywordsWithRef||!(0,So.schemaHasRulesButRef)(o,u))){i.block(()=>lO(t,"$ref",u.all.$ref.definition));return}l.jtd||Jq(t,e),i.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){(0,Ik.shouldUseGroup)(o,p)&&(p.type?(i.if((0,cy.checkDataType)(p.type,s,l.strictNumbers)),Qz(t,p),e.length===1&&e[0]===p.type&&r&&(i.else(),(0,cy.reportTypeError)(t)),i.endIf()):Qz(t,p),a||i.if((0,ie._)`${Se.default.errors} === ${n||0}`))}}function Qz(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,Mq.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,Ik.shouldUseRule)(n,o)&&lO(t,o.keyword,o.definition,e.type)})}function Jq(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Yq(t,e),t.opts.allowUnionTypes||Qq(t,e),e3(t,t.dataTypes))}function Yq(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{aO(t.dataTypes,r)||Ek(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),r3(t,e)}}function Qq(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Ek(t,"use allowUnionTypes to allow union type keyword")}function e3(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,Ik.shouldUseRule)(t.schema,i)){let{type:o}=i.definition;o.length&&!o.some(s=>t3(e,s))&&Ek(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function t3(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function aO(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function r3(t,e){let r=[];for(let n of t.dataTypes)aO(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function Ek(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,So.checkStrictMode)(t,e,t.opts.strictTypes)}var uy=class{constructor(e,r,n){if((0,op.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,So.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",cO(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,op.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=e.gen.const("_errs",Se.default.errors))}result(e,r,n){this.failResult((0,ie.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ie.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ie._)`${r} !== undefined && (${(0,ie.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?ip.reportExtraError:ip.reportError)(this,this.def.error,r)}$dataError(){(0,ip.reportError)(this,this.def.$dataError||ip.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ip.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=ie.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=ie.nil,r=ie.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:o,def:s}=this;n.if((0,ie.or)((0,ie._)`${i} === undefined`,r)),e!==ie.nil&&n.assign(e,!0),(o.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==ie.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:o}=this;return(0,ie.or)(s(),a());function s(){if(n.length){if(!(r instanceof ie.Name))throw new Error("ajv implementation error");let l=Array.isArray(n)?n:[n];return(0,ie._)`${(0,cy.checkDataTypes)(l,r,o.opts.strictNumbers,cy.DataType.Wrong)}`}return ie.nil}function a(){if(i.validateSchema){let l=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,ie._)`!${l}(${r})`}return ie.nil}}subschema(e,r){let n=(0,$k.getSubschema)(this.it,e);(0,$k.extendSubschemaData)(n,this.it,e),(0,$k.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return Vq(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=So.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=So.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,ie.Name)),!0}};Ss.KeywordCxt=uy;function lO(t,e,r,n){let i=new uy(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,op.funcKeywordCode)(i,r):"macro"in r?(0,op.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,op.funcKeywordCode)(i,r)}var n3=/^\/(?:[^~]|~0|~1)*$/,i3=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function cO(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,o;if(t==="")return Se.default.rootData;if(t[0]==="/"){if(!n3.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,o=Se.default.rootData}else{let c=i3.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+c[1];if(i=c[2],i==="#"){if(u>=e)throw new Error(l("property/index",u));return n[e-u]}if(u>e)throw new Error(l("data",u));if(o=r[e-u],!i)return o}let s=o,a=i.split("/");for(let c of a)c&&(o=(0,ie._)`${o}${(0,ie.getProperty)((0,So.unescapeJsonPointer)(c))}`,s=(0,ie._)`${s} && ${o}`);return s;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}Ss.getData=cO});var dy=N(Tk=>{"use strict";Object.defineProperty(Tk,"__esModule",{value:!0});var Pk=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Tk.default=Pk});var ap=N(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});var Ak=np(),Ck=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Ak.resolveUrl)(e,r,n),this.missingSchema=(0,Ak.normalizeId)((0,Ak.getFullPath)(e,this.missingRef))}};zk.default=Ck});var py=N(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.resolveSchema=Mn.getCompilingSchema=Mn.resolveRef=Mn.compileSchema=Mn.SchemaEnv=void 0;var si=Le(),o3=dy(),Fa=ko(),ai=np(),uO=Ke(),s3=sp(),Su=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,ai.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Mn.SchemaEnv=Su;function Rk(t){let e=dO.call(this,t);if(e)return e;let r=(0,ai.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,s=new si.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o}),a;t.$async&&(a=s.scopeValue("Error",{ref:o3.default,code:(0,si._)`require("ajv/dist/runtime/validation_error").default`}));let l=s.scopeName("validate");t.validateName=l;let c={gen:s,allErrors:this.opts.allErrors,data:Fa.default.data,parentData:Fa.default.parentData,parentDataProperty:Fa.default.parentDataProperty,dataNames:[Fa.default.data],dataPathArr:[si.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,si.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:si.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,si._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,s3.validateFunctionCode)(c),s.optimize(this.opts.code.optimize);let d=s.toString();u=`${s.scopeRefs(Fa.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let f=new Function(`${Fa.default.self}`,`${Fa.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:l,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=c;f.evaluated={props:m instanceof si.Name?void 0:m,items:h instanceof si.Name?void 0:h,dynamicProps:m instanceof si.Name,dynamicItems:h instanceof si.Name},f.source&&(f.source.evaluated=(0,si.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Mn.compileSchema=Rk;function a3(t,e,r){var n;r=(0,ai.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let o=u3.call(this,t,r);if(o===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(o=new Su({schema:s,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=l3.call(this,o)}Mn.resolveRef=a3;function l3(t){return(0,ai.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Rk.call(this,t)}function dO(t){for(let e of this._compilations)if(c3(e,t))return e}Mn.getCompilingSchema=dO;function c3(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function u3(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||fy.call(this,t,e)}function fy(t,e){let r=this.opts.uriResolver.parse(e),n=(0,ai._getFullPath)(this.opts.uriResolver,r),i=(0,ai.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return Ok.call(this,r,t);let o=(0,ai.normalizeId)(n),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=fy.call(this,t,s);return typeof a?.schema!="object"?void 0:Ok.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||Rk.call(this,s),o===(0,ai.normalizeId)(e)){let{schema:a}=s,{schemaId:l}=this.opts,c=a[l];return c&&(i=(0,ai.resolveUrl)(this.opts.uriResolver,i,c)),new Su({schema:a,schemaId:l,root:t,baseId:i})}return Ok.call(this,r,s)}}Mn.resolveSchema=fy;var d3=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ok(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let l=r[(0,uO.unescapeFragment)(a)];if(l===void 0)return;r=l;let c=typeof r=="object"&&r[this.opts.schemaId];!d3.has(a)&&c&&(e=(0,ai.resolveUrl)(this.opts.uriResolver,e,c))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,uO.schemaHasRulesButRef)(r,this.RULES)){let a=(0,ai.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=fy.call(this,n,a)}let{schemaId:s}=this.opts;if(o=o||new Su({schema:r,schemaId:s,root:n,baseId:e}),o.schema!==o.root.schema)return o}});var fO=N((eke,f3)=>{f3.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 Mk=N((tke,gO)=>{"use strict";var p3=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),mO=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);function Nk(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var m3=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function pO(t){return t.length=0,!0}function h3(t,e,r){if(t.length){let n=Nk(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function g3(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],o=!1,s=!1,a=h3;for(let l=0;l<t.length;l++){let c=t[l];if(!(c==="["||c==="]"))if(c===":"){if(o===!0&&(s=!0),!a(i,n,r))break;if(++e>7){r.error=!0;break}l>0&&t[l-1]===":"&&(o=!0),n.push(":");continue}else if(c==="%"){if(!a(i,n,r))break;a=pO}else{i.push(c);continue}}return i.length&&(a===pO?r.zone=i.join(""):s?n.push(i.join("")):n.push(Nk(i))),r.address=n.join(""),r}function hO(t){if(y3(t,":")<2)return{host:t,isIPV6:!1};let e=g3(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function y3(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function b3(t){let e=t,r=[],n=-1,i=0;for(;i=e.length;){if(i===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(i===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(i===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function _3(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function v3(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!mO(r)){let n=hO(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}gO.exports={nonSimpleDomain:m3,recomposeAuthority:v3,normalizeComponentEncoding:_3,removeDotSegments:b3,isIPv4:mO,isUUID:p3,normalizeIPv6:hO,stringArrayToHexStripped:Nk}});var wO=N((rke,vO)=>{"use strict";var{isUUID:w3}=Mk(),x3=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,k3=["http","https","ws","wss","urn","urn:uuid"];function S3(t){return k3.indexOf(t)!==-1}function jk(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function yO(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function bO(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function $3(t){return t.secure=jk(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function I3(t){if((t.port===(jk(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function E3(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(x3);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,o=Dk(i);t.path=void 0,o&&(t=o.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function P3(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,o=Dk(i);o&&(t=o.serialize(t,e));let s=t,a=t.nss;return s.path=`${n||e.nid}:${a}`,e.skipEscape=!0,s}function T3(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!w3(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function A3(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var _O={scheme:"http",domainHost:!0,parse:yO,serialize:bO},C3={scheme:"https",domainHost:_O.domainHost,parse:yO,serialize:bO},my={scheme:"ws",domainHost:!0,parse:$3,serialize:I3},z3={scheme:"wss",domainHost:my.domainHost,parse:my.parse,serialize:my.serialize},O3={scheme:"urn",parse:E3,serialize:P3,skipNormalize:!0},R3={scheme:"urn:uuid",parse:T3,serialize:A3,skipNormalize:!0},hy={http:_O,https:C3,ws:my,wss:z3,urn:O3,"urn:uuid":R3};Object.setPrototypeOf(hy,null);function Dk(t){return t&&(hy[t]||hy[t.toLowerCase()])||void 0}vO.exports={wsIsSecure:jk,SCHEMES:hy,isValidSchemeName:S3,getSchemeHandler:Dk}});var SO=N((nke,yy)=>{"use strict";var{normalizeIPv6:N3,removeDotSegments:lp,recomposeAuthority:M3,normalizeComponentEncoding:gy,isIPv4:j3,nonSimpleDomain:D3}=Mk(),{SCHEMES:L3,getSchemeHandler:xO}=wO();function U3(t,e){return typeof t=="string"?t=Ci($o(t,e),e):typeof t=="object"&&(t=$o(Ci(t,e),e)),t}function Z3(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=kO($o(t,n),$o(e,n),n,!0);return n.skipEscape=!0,Ci(i,n)}function kO(t,e,r,n){let i={};return n||(t=$o(Ci(t,r),r),e=$o(Ci(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=lp(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=lp(e.path||""),i.query=e.query):(e.path?(e.path[0]==="/"?i.path=lp(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=lp(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function F3(t,e,r){return typeof t=="string"?(t=unescape(t),t=Ci(gy($o(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Ci(gy(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Ci(gy($o(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Ci(gy(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Ci(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],o=xO(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let s=M3(r);if(s!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(s),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(a=lp(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),i.push(a)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var V3=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function $o(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let o=t.match(V3);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host)if(j3(n.host)===!1){let l=N3(n.host);n.host=l.host.toLowerCase(),i=l.isIPV6}else i=!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 s=xO(r.scheme||n.scheme);if(!r.unicodeSupport&&(!s||!s.unicodeSupport)&&n.host&&(r.domainHost||s&&s.domainHost)&&i===!1&&D3(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!s||s&&!s.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),s&&s.parse&&s.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Lk={SCHEMES:L3,normalize:U3,resolve:Z3,resolveComponent:kO,equal:F3,serialize:Ci,parse:$o};yy.exports=Lk;yy.exports.default=Lk;yy.exports.fastUri=Lk});var IO=N(Uk=>{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});var $O=SO();$O.code='require("ajv/dist/runtime/uri").default';Uk.default=$O});var RO=N(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.CodeGen=hr.Name=hr.nil=hr.stringify=hr.str=hr._=hr.KeywordCxt=void 0;var q3=sp();Object.defineProperty(hr,"KeywordCxt",{enumerable:!0,get:function(){return q3.KeywordCxt}});var $u=Le();Object.defineProperty(hr,"_",{enumerable:!0,get:function(){return $u._}});Object.defineProperty(hr,"str",{enumerable:!0,get:function(){return $u.str}});Object.defineProperty(hr,"stringify",{enumerable:!0,get:function(){return $u.stringify}});Object.defineProperty(hr,"nil",{enumerable:!0,get:function(){return $u.nil}});Object.defineProperty(hr,"Name",{enumerable:!0,get:function(){return $u.Name}});Object.defineProperty(hr,"CodeGen",{enumerable:!0,get:function(){return $u.CodeGen}});var B3=dy(),CO=ap(),W3=hk(),cp=py(),G3=Le(),up=np(),by=tp(),Fk=Ke(),EO=fO(),H3=IO(),zO=(t,e)=>new RegExp(t,e);zO.code="new RegExp";var X3=["removeAdditional","useDefaults","coerceTypes"],K3=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),J3={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."},Y3={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},PO=200;function Q3(t){var e,r,n,i,o,s,a,l,c,u,d,p,f,m,h,y,g,b,v,C,E,T,F,le,ee;let I=t.strict,ce=(e=t.code)===null||e===void 0?void 0:e.optimize,be=ce===!0||ce===void 0?1:ce||0,J=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:zO,pe=(i=t.uriResolver)!==null&&i!==void 0?i:H3.default;return{strictSchema:(s=(o=t.strictSchema)!==null&&o!==void 0?o:I)!==null&&s!==void 0?s:!0,strictNumbers:(l=(a=t.strictNumbers)!==null&&a!==void 0?a:I)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=t.strictTypes)!==null&&c!==void 0?c:I)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:I)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:I)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:be,regExp:J}:{optimize:be,regExp:J},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:PO,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:PO,meta:(g=t.meta)!==null&&g!==void 0?g:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(C=t.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(E=t.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(T=t.validateSchema)!==null&&T!==void 0?T:!0,validateFormats:(F=t.validateFormats)!==null&&F!==void 0?F:!0,unicodeRegExp:(le=t.unicodeRegExp)!==null&&le!==void 0?le:!0,int32range:(ee=t.int32range)!==null&&ee!==void 0?ee:!0,uriResolver:pe}}var dp=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Q3(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new G3.ValueScope({scope:{},prefixes:K3,es5:r,lines:n}),this.logger=oB(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,W3.getRules)(),TO.call(this,J3,e,"NOT SUPPORTED"),TO.call(this,Y3,e,"DEPRECATED","warn"),this._metaOpts=nB.call(this),e.formats&&tB.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&rB.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),eB.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=EO;n==="id"&&(i={...EO},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,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,e,r);async function i(u,d){await o.call(this,u.$schema);let p=this._addSchema(u,d);return p.validate||s.call(this,p)}async function o(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof CO.default))throw d;return a.call(this,d),await l.call(this,d.missingSchema),s.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function l(u){let d=await c.call(this,u);this.refs[u]||await o.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,i);return this}let o;if(typeof e=="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,up.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$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,e);if(!i&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return i}getSchema(e){let r;for(;typeof(r=AO.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new cp.SchemaEnv({schema:{},schemaId:n});if(r=cp.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=AO.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,up.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,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(aB.call(this,n,r),!r)return(0,Fk.eachItem)(n,o=>Zk.call(this,o)),this;cB.call(this,r);let i={...r,type:(0,by.getJSONTypes)(r.type),schemaType:(0,by.getJSONTypes)(r.schemaType)};return(0,Fk.eachItem)(n,i.type.length===0?o=>Zk.call(this,o,i):o=>i.type.forEach(s=>Zk.call(this,o,i,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(o=>o.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,o)=>i+r+o)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let o=i.split("/").slice(1),s=e;for(let a of o)s=s[a];for(let a in n){let l=n[a];if(typeof l!="object")continue;let{$data:c}=l.definition,u=s[a];c&&u&&(s[a]=OO(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(l!==void 0)return l;n=(0,up.normalizeId)(s||n);let c=up.getSchemaRefs.call(this,e,n);return l=new cp.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:c}),this._cache.set(l.schema,l),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=l),i&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):cp.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{cp.compileSchema.call(this,e)}finally{this.opts=r}}};dp.ValidationError=B3.default;dp.MissingRefError=CO.default;hr.default=dp;function TO(t,e,r,n="error"){for(let i in t){let o=i;o in e&&this.logger[n](`${r}: option ${i}. ${t[o]}`)}}function AO(t){return t=(0,up.normalizeId)(t),this.schemas[t]||this.refs[t]}function eB(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function tB(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function rB(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function nB(){let t={...this.opts};for(let e of X3)delete t[e];return t}var iB={log(){},warn(){},error(){}};function oB(t){if(t===!1)return iB;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var sB=/^[a-z_$][a-z0-9_$:-]*$/i;function aB(t,e){let{RULES:r}=this;if((0,Fk.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!sB.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Zk(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=i?o.post:o.rules.find(({type:l})=>l===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,by.getJSONTypes)(e.type),schemaType:(0,by.getJSONTypes)(e.schemaType)}};e.before?lB.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(l=>this.addKeyword(l))}function lB(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function cB(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=OO(e)),t.validateSchema=this.compile(e,!0))}var uB={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function OO(t){return{anyOf:[t,uB]}}});var NO=N(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});var dB={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Vk.default=dB});var LO=N(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.callRef=Va.getValidate=void 0;var fB=ap(),MO=Nn(),Qr=Le(),Iu=ko(),jO=py(),_y=Ke(),pB={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:o,validateName:s,opts:a,self:l}=n,{root:c}=o;if((r==="#"||r==="#/")&&i===c.baseId)return d();let u=jO.resolveRef.call(l,c,i,r);if(u===void 0)throw new fB.default(n.opts.uriResolver,i,r);if(u instanceof jO.SchemaEnv)return p(u);return f(u);function d(){if(o===c)return vy(t,s,o,o.$async);let m=e.scopeValue("root",{ref:c});return vy(t,(0,Qr._)`${m}.validate`,c,c.$async)}function p(m){let h=DO(t,m);vy(t,h,m,m.$async)}function f(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Qr.stringify)(m)}:{ref:m}),y=e.name("valid"),g=t.subschema({schema:m,dataTypes:[],schemaPath:Qr.nil,topSchemaRef:h,errSchemaPath:r},y);t.mergeEvaluated(g),t.ok(y)}}};function DO(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Qr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Va.getValidate=DO;function vy(t,e,r,n){let{gen:i,it:o}=t,{allErrors:s,schemaEnv:a,opts:l}=o,c=l.passContext?Iu.default.this:Qr.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,Qr._)`await ${(0,MO.callValidateCode)(t,e,c)}`),f(e),s||i.assign(m,!0)},h=>{i.if((0,Qr._)`!(${h} instanceof ${o.ValidationError})`,()=>i.throw(h)),p(h),s||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,MO.callValidateCode)(t,e,c),()=>f(e),()=>p(e))}function p(m){let h=(0,Qr._)`${m}.errors`;i.assign(Iu.default.vErrors,(0,Qr._)`${Iu.default.vErrors} === null ? ${h} : ${Iu.default.vErrors}.concat(${h})`),i.assign(Iu.default.errors,(0,Qr._)`${Iu.default.vErrors}.length`)}function f(m){var h;if(!o.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(o.props=_y.mergeEvaluated.props(i,y.props,o.props));else{let g=i.var("props",(0,Qr._)`${m}.evaluated.props`);o.props=_y.mergeEvaluated.props(i,g,o.props,Qr.Name)}if(o.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(o.items=_y.mergeEvaluated.items(i,y.items,o.items));else{let g=i.var("items",(0,Qr._)`${m}.evaluated.items`);o.items=_y.mergeEvaluated.items(i,g,o.items,Qr.Name)}}}Va.callRef=vy;Va.default=pB});var UO=N(qk=>{"use strict";Object.defineProperty(qk,"__esModule",{value:!0});var mB=NO(),hB=LO(),gB=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",mB.default,hB.default];qk.default=gB});var ZO=N(Bk=>{"use strict";Object.defineProperty(Bk,"__esModule",{value:!0});var wy=Le(),$s=wy.operators,xy={maximum:{okStr:"<=",ok:$s.LTE,fail:$s.GT},minimum:{okStr:">=",ok:$s.GTE,fail:$s.LT},exclusiveMaximum:{okStr:"<",ok:$s.LT,fail:$s.GTE},exclusiveMinimum:{okStr:">",ok:$s.GT,fail:$s.LTE}},yB={message:({keyword:t,schemaCode:e})=>(0,wy.str)`must be ${xy[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,wy._)`{comparison: ${xy[t].okStr}, limit: ${e}}`},bB={keyword:Object.keys(xy),type:"number",schemaType:"number",$data:!0,error:yB,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,wy._)`${r} ${xy[e].fail} ${n} || isNaN(${r})`)}};Bk.default=bB});var FO=N(Wk=>{"use strict";Object.defineProperty(Wk,"__esModule",{value:!0});var fp=Le(),_B={message:({schemaCode:t})=>(0,fp.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,fp._)`{multipleOf: ${t}}`},vB={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:_B,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,o=i.opts.multipleOfPrecision,s=e.let("res"),a=o?(0,fp._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,fp._)`${s} !== parseInt(${s})`;t.fail$data((0,fp._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};Wk.default=vB});var qO=N(Gk=>{"use strict";Object.defineProperty(Gk,"__esModule",{value:!0});function VO(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}Gk.default=VO;VO.code='require("ajv/dist/runtime/ucs2length").default'});var BO=N(Hk=>{"use strict";Object.defineProperty(Hk,"__esModule",{value:!0});var qa=Le(),wB=Ke(),xB=qO(),kB={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,qa.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,qa._)`{limit: ${t}}`},SB={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:kB,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,o=e==="maxLength"?qa.operators.GT:qa.operators.LT,s=i.opts.unicode===!1?(0,qa._)`${r}.length`:(0,qa._)`${(0,wB.useFunc)(t.gen,xB.default)}(${r})`;t.fail$data((0,qa._)`${s} ${o} ${n}`)}};Hk.default=SB});var WO=N(Xk=>{"use strict";Object.defineProperty(Xk,"__esModule",{value:!0});var $B=Nn(),ky=Le(),IB={message:({schemaCode:t})=>(0,ky.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ky._)`{pattern: ${t}}`},EB={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:IB,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:o}=t,s=o.opts.unicodeRegExp?"u":"",a=r?(0,ky._)`(new RegExp(${i}, ${s}))`:(0,$B.usePattern)(t,n);t.fail$data((0,ky._)`!${a}.test(${e})`)}};Xk.default=EB});var GO=N(Kk=>{"use strict";Object.defineProperty(Kk,"__esModule",{value:!0});var pp=Le(),PB={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,pp.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,pp._)`{limit: ${t}}`},TB={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:PB,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?pp.operators.GT:pp.operators.LT;t.fail$data((0,pp._)`Object.keys(${r}).length ${i} ${n}`)}};Kk.default=TB});var HO=N(Jk=>{"use strict";Object.defineProperty(Jk,"__esModule",{value:!0});var mp=Nn(),hp=Le(),AB=Ke(),CB={message:({params:{missingProperty:t}})=>(0,hp.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,hp._)`{missingProperty: ${t}}`},zB={keyword:"required",type:"object",schemaType:"array",$data:!0,error:CB,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:o,it:s}=t,{opts:a}=s;if(!o&&r.length===0)return;let l=r.length>=a.loopRequired;if(s.allErrors?c():u(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(f?.[h]===void 0&&!m.has(h)){let y=s.schemaEnv.baseId+s.errSchemaPath,g=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,AB.checkStrictMode)(s,g,s.opts.strictRequired)}}function c(){if(l||o)t.block$data(hp.nil,d);else for(let f of r)(0,mp.checkReportMissingProp)(t,f)}function u(){let f=e.let("missing");if(l||o){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,mp.checkMissingProp)(t,r,f)),(0,mp.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0,mp.noPropertyInData)(e,i,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(m,(0,mp.propertyInData)(e,i,f,a.ownProperties)),e.if((0,hp.not)(m),()=>{t.error(),e.break()})},hp.nil)}}};Jk.default=zB});var XO=N(Yk=>{"use strict";Object.defineProperty(Yk,"__esModule",{value:!0});var gp=Le(),OB={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,gp.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,gp._)`{limit: ${t}}`},RB={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:OB,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?gp.operators.GT:gp.operators.LT;t.fail$data((0,gp._)`${r}.length ${i} ${n}`)}};Yk.default=RB});var Sy=N(Qk=>{"use strict";Object.defineProperty(Qk,"__esModule",{value:!0});var KO=rp();KO.code='require("ajv/dist/runtime/equal").default';Qk.default=KO});var JO=N(tS=>{"use strict";Object.defineProperty(tS,"__esModule",{value:!0});var eS=tp(),gr=Le(),NB=Ke(),MB=Sy(),jB={message:({params:{i:t,j:e}})=>(0,gr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,gr._)`{i: ${t}, j: ${e}}`},DB={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:jB,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:o,schemaCode:s,it:a}=t;if(!n&&!i)return;let l=e.let("valid"),c=o.items?(0,eS.getSchemaTypes)(o.items):[];t.block$data(l,u,(0,gr._)`${s} === false`),t.ok(l);function u(){let m=e.let("i",(0,gr._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(l,!0),e.if((0,gr._)`${m} > 1`,()=>(d()?p:f)(m,h))}function d(){return c.length>0&&!c.some(m=>m==="object"||m==="array")}function p(m,h){let y=e.name("item"),g=(0,eS.checkDataTypes)(c,y,a.opts.strictNumbers,eS.DataType.Wrong),b=e.const("indices",(0,gr._)`{}`);e.for((0,gr._)`;${m}--;`,()=>{e.let(y,(0,gr._)`${r}[${m}]`),e.if(g,(0,gr._)`continue`),c.length>1&&e.if((0,gr._)`typeof ${y} == "string"`,(0,gr._)`${y} += "_"`),e.if((0,gr._)`typeof ${b}[${y}] == "number"`,()=>{e.assign(h,(0,gr._)`${b}[${y}]`),t.error(),e.assign(l,!1).break()}).code((0,gr._)`${b}[${y}] = ${m}`)})}function f(m,h){let y=(0,NB.useFunc)(e,MB.default),g=e.name("outer");e.label(g).for((0,gr._)`;${m}--;`,()=>e.for((0,gr._)`${h} = ${m}; ${h}--;`,()=>e.if((0,gr._)`${y}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(l,!1).break(g)})))}}};tS.default=DB});var YO=N(nS=>{"use strict";Object.defineProperty(nS,"__esModule",{value:!0});var rS=Le(),LB=Ke(),UB=Sy(),ZB={message:"must be equal to constant",params:({schemaCode:t})=>(0,rS._)`{allowedValue: ${t}}`},FB={keyword:"const",$data:!0,error:ZB,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,rS._)`!${(0,LB.useFunc)(e,UB.default)}(${r}, ${i})`):t.fail((0,rS._)`${o} !== ${r}`)}};nS.default=FB});var QO=N(iS=>{"use strict";Object.defineProperty(iS,"__esModule",{value:!0});var yp=Le(),VB=Ke(),qB=Sy(),BB={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,yp._)`{allowedValues: ${t}}`},WB={keyword:"enum",schemaType:"array",$data:!0,error:BB,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:o,it:s}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=s.opts.loopEnum,l,c=()=>l??(l=(0,VB.useFunc)(e,qB.default)),u;if(a||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let f=e.const("vSchema",o);u=(0,yp.or)(...i.map((m,h)=>p(f,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",o,f=>e.if((0,yp._)`${c()}(${r}, ${f})`,()=>e.assign(u,!0).break()))}function p(f,m){let h=i[m];return typeof h=="object"&&h!==null?(0,yp._)`${c()}(${r}, ${f}[${m}])`:(0,yp._)`${r} === ${h}`}}};iS.default=WB});var eR=N(oS=>{"use strict";Object.defineProperty(oS,"__esModule",{value:!0});var GB=ZO(),HB=FO(),XB=BO(),KB=WO(),JB=GO(),YB=HO(),QB=XO(),eW=JO(),tW=YO(),rW=QO(),nW=[GB.default,HB.default,XB.default,KB.default,JB.default,YB.default,QB.default,eW.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},tW.default,rW.default];oS.default=nW});var aS=N(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.validateAdditionalItems=void 0;var Ba=Le(),sS=Ke(),iW={message:({params:{len:t}})=>(0,Ba.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ba._)`{limit: ${t}}`},oW={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:iW,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,sS.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}tR(t,n)}};function tR(t,e){let{gen:r,schema:n,data:i,keyword:o,it:s}=t;s.items=!0;let a=r.const("len",(0,Ba._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Ba._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,sS.alwaysValidSchema)(s,n)){let c=r.var("valid",(0,Ba._)`${a} <= ${e.length}`);r.if((0,Ba.not)(c),()=>l(c)),t.ok(c)}function l(c){r.forRange("i",e.length,a,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:sS.Type.Num},c),s.allErrors||r.if((0,Ba.not)(c),()=>r.break())})}}bp.validateAdditionalItems=tR;bp.default=oW});var lS=N(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});_p.validateTuple=void 0;var rR=Le(),$y=Ke(),sW=Nn(),aW={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return nR(t,"additionalItems",e);r.items=!0,!(0,$y.alwaysValidSchema)(r,e)&&t.ok((0,sW.validateArray)(t))}};function nR(t,e,r=t.schema){let{gen:n,parentSchema:i,data:o,keyword:s,it:a}=t;u(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=$y.mergeEvaluated.items(n,r.length,a.items));let l=n.name("valid"),c=n.const("len",(0,rR._)`${o}.length`);r.forEach((d,p)=>{(0,$y.alwaysValidSchema)(a,d)||(n.if((0,rR._)`${c} > ${p}`,()=>t.subschema({keyword:s,schemaProp:p,dataProp:p},l)),t.ok(l))});function u(d){let{opts:p,errSchemaPath:f}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!h){let y=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,$y.checkStrictMode)(a,y,p.strictTuples)}}}_p.validateTuple=nR;_p.default=aW});var iR=N(cS=>{"use strict";Object.defineProperty(cS,"__esModule",{value:!0});var lW=lS(),cW={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,lW.validateTuple)(t,"items")};cS.default=cW});var sR=N(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});var oR=Le(),uW=Ke(),dW=Nn(),fW=aS(),pW={message:({params:{len:t}})=>(0,oR.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,oR._)`{limit: ${t}}`},mW={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:pW,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,uW.alwaysValidSchema)(n,e)&&(i?(0,fW.validateAdditionalItems)(t,i):t.ok((0,dW.validateArray)(t)))}};uS.default=mW});var aR=N(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});var jn=Le(),Iy=Ke(),hW={message:({params:{min:t,max:e}})=>e===void 0?(0,jn.str)`must contain at least ${t} valid item(s)`:(0,jn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,jn._)`{minContains: ${t}}`:(0,jn._)`{minContains: ${t}, maxContains: ${e}}`},gW={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:hW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t,s,a,{minContains:l,maxContains:c}=n;o.opts.next?(s=l===void 0?1:l,a=c):s=1;let u=e.const("len",(0,jn._)`${i}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,Iy.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,Iy.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Iy.alwaysValidSchema)(o,r)){let h=(0,jn._)`${u} >= ${s}`;a!==void 0&&(h=(0,jn._)`${h} && ${u} <= ${a}`),t.pass(h);return}o.items=!0;let d=e.name("valid");a===void 0&&s===1?f(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,jn._)`${i}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let h=e.name("_valid"),y=e.let("count",0);f(h,()=>e.if(h,()=>m(y)))}function f(h,y){e.forRange("i",0,u,g=>{t.subschema({keyword:"contains",dataProp:g,dataPropType:Iy.Type.Num,compositeRule:!0},h),y()})}function m(h){e.code((0,jn._)`${h}++`),a===void 0?e.if((0,jn._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,jn._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,jn._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};dS.default=gW});var uR=N(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.validateSchemaDeps=zi.validatePropertyDeps=zi.error=void 0;var fS=Le(),yW=Ke(),vp=Nn();zi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,fS.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,fS._)`{property: ${t},
|
|
6
6
|
missingProperty: ${n},
|
|
7
7
|
depsCount: ${e},
|
|
8
|
-
deps: ${r}}`};var bW={keyword:"dependencies",type:"object",schemaType:"object",error:zi.error,code(t){let[e,r]=_W(t);lR(t,e),cR(t,r)}};function _W({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function lR(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let l=(0,vp.propertyInData)(r,n,s,i.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(l,()=>{for(let c of a)(0,vp.checkReportMissingProp)(t,c)}):(r.if((0,fS._)`${l} && (${(0,vp.checkMissingProp)(t,a,o)})`),(0,vp.reportMissingProp)(t,o),r.else())}}zi.validatePropertyDeps=lR;function cR(t,e=t.schema){let{gen:r,data:n,keyword:i,it:o}=t,s=r.name("valid");for(let a in e)(0,yW.alwaysValidSchema)(o,e[a])||(r.if((0,vp.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let l=t.subschema({keyword:i,schemaProp:a},s);t.mergeValidEvaluated(l,s)},()=>r.var(s,!0)),t.ok(s))}zi.validateSchemaDeps=cR;zi.default=bW});var fR=N(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});var dR=Le(),vW=Ke(),wW={message:"property name must be valid",params:({params:t})=>(0,dR._)`{propertyName: ${t.propertyName}}`},xW={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:wW,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,vW.alwaysValidSchema)(i,r))return;let o=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),e.if((0,dR.not)(o),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(o)}};pS.default=xW});var hS=N(mS=>{"use strict";Object.defineProperty(mS,"__esModule",{value:!0});var Ey=Rn(),li=Le(),kW=ko(),Py=Ke(),SW={message:"must NOT have additional properties",params:({params:t})=>(0,li._)`{additionalProperty: ${t.additionalProperty}}`},$W={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:SW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:l}=s;if(s.props=!0,l.removeAdditional!=="all"&&(0,Py.alwaysValidSchema)(s,r))return;let c=(0,Ey.allSchemaProperties)(n.properties),u=(0,Ey.allSchemaProperties)(n.patternProperties);d(),t.ok((0,li._)`${o} === ${kW.default.errors}`);function d(){e.forIn("key",i,y=>{!c.length&&!u.length?m(y):e.if(p(y),()=>m(y))})}function p(y){let g;if(c.length>8){let b=(0,Py.schemaRefOrVal)(s,n.properties,"properties");g=(0,Ey.isOwnProperty)(e,b,y)}else c.length?g=(0,li.or)(...c.map(b=>(0,li._)`${y} === ${b}`)):g=li.nil;return u.length&&(g=(0,li.or)(g,...u.map(b=>(0,li._)`${(0,Ey.usePattern)(t,b)}.test(${y})`))),(0,li.not)(g)}function f(y){e.code((0,li._)`delete ${i}[${y}]`)}function m(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){f(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Py.alwaysValidSchema)(s,r)){let g=e.name("valid");l.removeAdditional==="failing"?(h(y,g,!1),e.if((0,li.not)(g),()=>{t.reset(),f(y)})):(h(y,g),a||e.if((0,li.not)(g),()=>e.break()))}}function h(y,g,b){let v={keyword:"additionalProperties",dataProp:y,dataPropType:Py.Type.Str};b===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,g)}}};mS.default=$W});var hR=N(yS=>{"use strict";Object.defineProperty(yS,"__esModule",{value:!0});var IW=sp(),pR=Rn(),gS=Ke(),mR=hS(),EW={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&mR.default.code(new IW.KeywordCxt(o,mR.default,"additionalProperties"));let s=(0,pR.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=gS.mergeEvaluated.props(e,(0,gS.toHash)(s),o.props));let a=s.filter(d=>!(0,gS.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let l=e.name("valid");for(let d of a)c(d)?u(d):(e.if((0,pR.propertyInData)(e,i,d,o.opts.ownProperties)),u(d),o.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};yS.default=EW});var _R=N(bS=>{"use strict";Object.defineProperty(bS,"__esModule",{value:!0});var gR=Rn(),Ty=Le(),yR=Ke(),bR=Ke(),PW={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:o}=t,{opts:s}=o,a=(0,gR.allSchemaProperties)(r),l=a.filter(h=>(0,yR.alwaysValidSchema)(o,r[h]));if(a.length===0||l.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let c=s.strictSchema&&!s.allowMatchingProperties&&i.properties,u=e.name("valid");o.props!==!0&&!(o.props instanceof Ty.Name)&&(o.props=(0,bR.evaluatedPropsToName)(e,o.props));let{props:d}=o;p();function p(){for(let h of a)c&&f(h),o.allErrors?m(h):(e.var(u,!0),m(h),e.if(u))}function f(h){for(let y in c)new RegExp(h).test(y)&&(0,yR.checkStrictMode)(o,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,y=>{e.if((0,Ty._)`${(0,gR.usePattern)(t,h)}.test(${y})`,()=>{let g=l.includes(h);g||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:bR.Type.Str},u),o.opts.unevaluated&&d!==!0?e.assign((0,Ty._)`${d}[${y}]`,!0):!g&&!o.allErrors&&e.if((0,Ty.not)(u),()=>e.break())})})}}};bS.default=PW});var vR=N(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});var TW=Ke(),AW={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,TW.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};_S.default=AW});var wR=N(vS=>{"use strict";Object.defineProperty(vS,"__esModule",{value:!0});var CW=Rn(),zW={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:CW.validateUnion,error:{message:"must match a schema in anyOf"}};vS.default=zW});var xR=N(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});var Ay=Le(),OW=Ke(),RW={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Ay._)`{passingSchemas: ${t.passing}}`},NW={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:RW,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,s=e.let("valid",!1),a=e.let("passing",null),l=e.name("_valid");t.setParams({passing:a}),e.block(c),t.result(s,()=>t.reset(),()=>t.error(!0));function c(){o.forEach((u,d)=>{let p;(0,OW.alwaysValidSchema)(i,u)?e.var(l,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,Ay._)`${l} && ${s}`).assign(s,!1).assign(a,(0,Ay._)`[${a}, ${d}]`).else(),e.if(l,()=>{e.assign(s,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Ay.Name)})})}}};wS.default=NW});var kR=N(xS=>{"use strict";Object.defineProperty(xS,"__esModule",{value:!0});var MW=Ke(),jW={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((o,s)=>{if((0,MW.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:s},i);t.ok(i),t.mergeEvaluated(a)})}};xS.default=jW});var IR=N(kS=>{"use strict";Object.defineProperty(kS,"__esModule",{value:!0});var Cy=Le(),$R=Ke(),DW={message:({params:t})=>(0,Cy.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Cy._)`{failingKeyword: ${t.ifClause}}`},LW={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:DW,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,$R.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=SR(n,"then"),o=SR(n,"else");if(!i&&!o)return;let s=e.let("valid",!0),a=e.name("_valid");if(l(),t.reset(),i&&o){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,c("then",u),c("else",u))}else i?e.if(a,c("then")):e.if((0,Cy.not)(a),c("else"));t.pass(s,()=>t.error(!0));function l(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function c(u,d){return()=>{let p=t.subschema({keyword:u},a);e.assign(s,a),t.mergeValidEvaluated(p,s),d?e.assign(d,(0,Cy._)`${u}`):t.setParams({ifClause:u})}}}};function SR(t,e){let r=t.schema[e];return r!==void 0&&!(0,$R.alwaysValidSchema)(t,r)}kS.default=LW});var ER=N(SS=>{"use strict";Object.defineProperty(SS,"__esModule",{value:!0});var UW=Ke(),ZW={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,UW.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};SS.default=ZW});var PR=N($S=>{"use strict";Object.defineProperty($S,"__esModule",{value:!0});var FW=aS(),VW=iR(),qW=lS(),BW=sR(),WW=aR(),GW=uR(),HW=fR(),XW=hS(),KW=hR(),JW=_R(),YW=vR(),QW=wR(),eG=xR(),tG=kR(),rG=IR(),nG=ER();function iG(t=!1){let e=[YW.default,QW.default,eG.default,tG.default,rG.default,nG.default,HW.default,XW.default,GW.default,KW.default,JW.default];return t?e.push(VW.default,BW.default):e.push(FW.default,qW.default),e.push(WW.default),e}$S.default=iG});var TR=N(IS=>{"use strict";Object.defineProperty(IS,"__esModule",{value:!0});var Dt=Le(),oG={message:({schemaCode:t})=>(0,Dt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Dt._)`{format: ${t}}`},sG={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:oG,code(t,e){let{gen:r,data:n,$data:i,schema:o,schemaCode:s,it:a}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=a;if(!l.validateFormats)return;i?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),h=r.const("fDef",(0,Dt._)`${m}[${s}]`),y=r.let("fType"),g=r.let("format");r.if((0,Dt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,Dt._)`${h}.type || "string"`).assign(g,(0,Dt._)`${h}.validate`),()=>r.assign(y,(0,Dt._)`"string"`).assign(g,h)),t.fail$data((0,Dt.or)(b(),v()));function b(){return l.strictSchema===!1?Dt.nil:(0,Dt._)`${s} && !${g}`}function v(){let C=u.$async?(0,Dt._)`(${h}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,Dt._)`${g}(${n})`,E=(0,Dt._)`(typeof ${g} == "function" ? ${C} : ${g}.test(${n}))`;return(0,Dt._)`${g} && ${g} !== true && ${y} === ${e} && !${E}`}}function f(){let m=d.formats[o];if(!m){b();return}if(m===!0)return;let[h,y,g]=v(m);h===e&&t.pass(C());function b(){if(l.strictSchema===!1){d.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${o}" ignored in schema at path "${c}"`}}function v(E){let T=E instanceof RegExp?(0,Dt.regexpCode)(E):l.code.formats?(0,Dt._)`${l.code.formats}${(0,Dt.getProperty)(o)}`:void 0,F=r.scopeValue("formats",{key:o,ref:E,code:T});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,Dt._)`${F}.validate`]:["string",E,F]}function C(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Dt._)`await ${g}(${n})`}return typeof y=="function"?(0,Dt._)`${g}(${n})`:(0,Dt._)`${g}.test(${n})`}}}};IS.default=sG});var AR=N(ES=>{"use strict";Object.defineProperty(ES,"__esModule",{value:!0});var aG=TR(),lG=[aG.default];ES.default=lG});var CR=N(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.contentVocabulary=Eu.metadataVocabulary=void 0;Eu.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Eu.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var OR=N(PS=>{"use strict";Object.defineProperty(PS,"__esModule",{value:!0});var cG=UO(),uG=eR(),dG=PR(),fG=AR(),zR=CR(),pG=[cG.default,uG.default,(0,dG.default)(),fG.default,zR.metadataVocabulary,zR.contentVocabulary];PS.default=pG});var NR=N(zy=>{"use strict";Object.defineProperty(zy,"__esModule",{value:!0});zy.DiscrError=void 0;var RR;(function(t){t.Tag="tag",t.Mapping="mapping"})(RR||(zy.DiscrError=RR={}))});var jR=N(AS=>{"use strict";Object.defineProperty(AS,"__esModule",{value:!0});var Pu=Le(),TS=NR(),MR=py(),mG=ap(),hG=Ke(),gG={message:({params:{discrError:t,tagName:e}})=>t===TS.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Pu._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},yG={keyword:"discriminator",type:"object",schemaType:"object",error:gG,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:o}=t,{oneOf:s}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let l=e.let("valid",!1),c=e.const("tag",(0,Pu._)`${r}${(0,Pu.getProperty)(a)}`);e.if((0,Pu._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:TS.DiscrError.Tag,tag:c,tagName:a})),t.ok(l);function u(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,Pu._)`${c} === ${m}`),e.assign(l,d(f[m]));e.else(),t.error(!1,{discrError:TS.DiscrError.Mapping,tag:c,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(h,Pu.Name),m}function p(){var f;let m={},h=g(i),y=!0;for(let C=0;C<s.length;C++){let E=s[C];if(E?.$ref&&!(0,hG.schemaHasRulesButRef)(E,o.self.RULES)){let F=E.$ref;if(E=MR.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,F),E instanceof MR.SchemaEnv&&(E=E.schema),E===void 0)throw new mG.default(o.opts.uriResolver,o.baseId,F)}let T=(f=E?.properties)===null||f===void 0?void 0:f[a];if(typeof T!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||g(E)),b(T,C)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function g({required:C}){return Array.isArray(C)&&C.includes(a)}function b(C,E){if(C.const)v(C.const,E);else if(C.enum)for(let T of C.enum)v(T,E);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(C,E){if(typeof C!="string"||C in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[C]=E}}}};AS.default=yG});var DR=N((Bke,bG)=>{bG.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var UR=N((vt,CS)=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.MissingRefError=vt.ValidationError=vt.CodeGen=vt.Name=vt.nil=vt.stringify=vt.str=vt._=vt.KeywordCxt=vt.Ajv=void 0;var _G=RO(),vG=OR(),wG=jR(),LR=DR(),xG=["/properties"],Oy="http://json-schema.org/draft-07/schema",Tu=class extends _G.default{_addVocabularies(){super._addVocabularies(),vG.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(wG.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(LR,xG):LR;this.addMetaSchema(e,Oy,!1),this.refs["http://json-schema.org/schema"]=Oy}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Oy)?Oy:void 0)}};vt.Ajv=Tu;CS.exports=vt=Tu;CS.exports.Ajv=Tu;Object.defineProperty(vt,"__esModule",{value:!0});vt.default=Tu;var kG=sp();Object.defineProperty(vt,"KeywordCxt",{enumerable:!0,get:function(){return kG.KeywordCxt}});var Au=Le();Object.defineProperty(vt,"_",{enumerable:!0,get:function(){return Au._}});Object.defineProperty(vt,"str",{enumerable:!0,get:function(){return Au.str}});Object.defineProperty(vt,"stringify",{enumerable:!0,get:function(){return Au.stringify}});Object.defineProperty(vt,"nil",{enumerable:!0,get:function(){return Au.nil}});Object.defineProperty(vt,"Name",{enumerable:!0,get:function(){return Au.Name}});Object.defineProperty(vt,"CodeGen",{enumerable:!0,get:function(){return Au.CodeGen}});var SG=dy();Object.defineProperty(vt,"ValidationError",{enumerable:!0,get:function(){return SG.default}});var $G=ap();Object.defineProperty(vt,"MissingRefError",{enumerable:!0,get:function(){return $G.default}})});var HR=N(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.formatNames=Ri.fastFormats=Ri.fullFormats=void 0;function Oi(t,e){return{validate:t,compare:e}}Ri.fullFormats={date:Oi(qR,NS),time:Oi(OS(!0),MS),"date-time":Oi(ZR(!0),WR),"iso-time":Oi(OS(),BR),"iso-date-time":Oi(ZR(),GR),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:CG,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:DG,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:zG,int32:{type:"number",validate:NG},int64:{type:"number",validate:MG},float:{type:"number",validate:VR},double:{type:"number",validate:VR},password:!0,binary:!0};Ri.fastFormats={...Ri.fullFormats,date:Oi(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,NS),time:Oi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,MS),"date-time":Oi(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,WR),"iso-time":Oi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,BR),"iso-date-time":Oi(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,GR),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Ri.formatNames=Object.keys(Ri.fullFormats);function IG(t){return t%4===0&&(t%100!==0||t%400===0)}var EG=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,PG=[0,31,28,31,30,31,30,31,31,30,31,30,31];function qR(t){let e=EG.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&IG(r)?29:PG[n])}function NS(t,e){if(t&&e)return t>e?1:t<e?-1:0}var zS=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function OS(t){return function(r){let n=zS.exec(r);if(!n)return!1;let i=+n[1],o=+n[2],s=+n[3],a=n[4],l=n[5]==="-"?-1:1,c=+(n[6]||0),u=+(n[7]||0);if(c>23||u>59||t&&!a)return!1;if(i<=23&&o<=59&&s<60)return!0;let d=o-u*l,p=i-c*l-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&s<61}}function MS(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function BR(t,e){if(!(t&&e))return;let r=zS.exec(t),n=zS.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var RS=/t|\s/i;function ZR(t){let e=OS(t);return function(n){let i=n.split(RS);return i.length===2&&qR(i[0])&&e(i[1])}}function WR(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function GR(t,e){if(!(t&&e))return;let[r,n]=t.split(RS),[i,o]=e.split(RS),s=NS(r,i);if(s!==void 0)return s||MS(n,o)}var TG=/\/|:/,AG=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function CG(t){return TG.test(t)&&AG.test(t)}var FR=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function zG(t){return FR.lastIndex=0,FR.test(t)}var OG=-(2**31),RG=2**31-1;function NG(t){return Number.isInteger(t)&&t<=RG&&t>=OG}function MG(t){return Number.isInteger(t)}function VR(){return!0}var jG=/[^\\]\\Z/;function DG(t){if(jG.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var kp=N(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.regexpCode=Je.getEsmExportName=Je.getProperty=Je.safeStringify=Je.stringify=Je.strConcat=Je.addCodeArg=Je.str=Je._=Je.nil=Je._Code=Je.Name=Je.IDENTIFIER=Je._CodeOrName=void 0;var wp=class{};Je._CodeOrName=wp;Je.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Wa=class extends wp{constructor(e){if(super(),!Je.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Je.Name=Wa;var jn=class extends wp{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Wa&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Je._Code=jn;Je.nil=new jn("");function XR(t,...e){let r=[t[0]],n=0;for(;n<e.length;)DS(r,e[n]),r.push(t[++n]);return new jn(r)}Je._=XR;var jS=new jn("+");function KR(t,...e){let r=[xp(t[0])],n=0;for(;n<e.length;)r.push(jS),DS(r,e[n]),r.push(jS,xp(t[++n]));return LG(r),new jn(r)}Je.str=KR;function DS(t,e){e instanceof jn?t.push(...e._items):e instanceof Wa?t.push(e):t.push(FG(e))}Je.addCodeArg=DS;function LG(t){let e=1;for(;e<t.length-1;){if(t[e]===jS){let r=UG(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function UG(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Wa||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Wa))return`"${t}${e.slice(1)}`}function ZG(t,e){return e.emptyStr()?t:t.emptyStr()?e:KR`${t}${e}`}Je.strConcat=ZG;function FG(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:xp(Array.isArray(t)?t.join(","):t)}function VG(t){return new jn(xp(t))}Je.stringify=VG;function xp(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Je.safeStringify=xp;function qG(t){return typeof t=="string"&&Je.IDENTIFIER.test(t)?new jn(`.${t}`):XR`[${t}]`}Je.getProperty=qG;function BG(t){if(typeof t=="string"&&Je.IDENTIFIER.test(t))return new jn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Je.getEsmExportName=BG;function WG(t){return new jn(t.toString())}Je.regexpCode=WG});var FS=N(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.ValueScope=Ur.ValueScopeName=Ur.Scope=Ur.varKinds=Ur.UsedValueState=void 0;var en=kp(),LS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},US;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(US=Ur.UsedValueState||(Ur.UsedValueState={}));Ur.varKinds={const:new en.Name("const"),let:new en.Name("let"),var:new en.Name("var")};var Ry=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof en.Name?e:this.name(e)}name(e){return new en.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Ur.Scope=Ry;var Ny=class extends en.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,en._)`.${new en.Name(r)}[${n}]`}};Ur.ValueScopeName=Ny;var GG=(0,en._)`\n`,ZS=class extends Ry{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?GG:en.nil}}get(){return this._scope}name(e){return new Ny(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:o}=i,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let u=a.get(s);if(u)return u}else a=this._values[o]=new Map;a.set(s,i);let l=this._scope[o]||(this._scope[o]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:o,itemIndex:c}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,en._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let o=en.nil;for(let s in e){let a=e[s];if(!a)continue;let l=n[s]=n[s]||new Map;a.forEach(c=>{if(l.has(c))return;l.set(c,US.Started);let u=r(c);if(u){let d=this.opts.es5?Ur.varKinds.var:Ur.varKinds.const;o=(0,en._)`${o}${d} ${c} = ${u};${this.opts._n}`}else if(u=i?.(c))o=(0,en._)`${o}${u}${this.opts._n}`;else throw new LS(c);l.set(c,US.Completed)})}return o}};Ur.ValueScope=ZS});var Re=N(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.or=je.and=je.not=je.CodeGen=je.operators=je.varKinds=je.ValueScopeName=je.ValueScope=je.Scope=je.Name=je.regexpCode=je.stringify=je.getProperty=je.nil=je.strConcat=je.str=je._=void 0;var qe=kp(),ci=FS(),Is=kp();Object.defineProperty(je,"_",{enumerable:!0,get:function(){return Is._}});Object.defineProperty(je,"str",{enumerable:!0,get:function(){return Is.str}});Object.defineProperty(je,"strConcat",{enumerable:!0,get:function(){return Is.strConcat}});Object.defineProperty(je,"nil",{enumerable:!0,get:function(){return Is.nil}});Object.defineProperty(je,"getProperty",{enumerable:!0,get:function(){return Is.getProperty}});Object.defineProperty(je,"stringify",{enumerable:!0,get:function(){return Is.stringify}});Object.defineProperty(je,"regexpCode",{enumerable:!0,get:function(){return Is.regexpCode}});Object.defineProperty(je,"Name",{enumerable:!0,get:function(){return Is.Name}});var Ly=FS();Object.defineProperty(je,"Scope",{enumerable:!0,get:function(){return Ly.Scope}});Object.defineProperty(je,"ValueScope",{enumerable:!0,get:function(){return Ly.ValueScope}});Object.defineProperty(je,"ValueScopeName",{enumerable:!0,get:function(){return Ly.ValueScopeName}});Object.defineProperty(je,"varKinds",{enumerable:!0,get:function(){return Ly.varKinds}});je.operators={GT:new qe._Code(">"),GTE:new qe._Code(">="),LT:new qe._Code("<"),LTE:new qe._Code("<="),EQ:new qe._Code("==="),NEQ:new qe._Code("!=="),NOT:new qe._Code("!"),OR:new qe._Code("||"),AND:new qe._Code("&&"),ADD:new qe._Code("+")};var Io=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},VS=class extends Io{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ci.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=zu(this.rhs,e,r)),this}get names(){return this.rhs instanceof qe._CodeOrName?this.rhs.names:{}}},My=class extends Io{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof qe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=zu(this.rhs,e,r),this}get names(){let e=this.lhs instanceof qe.Name?{}:{...this.lhs.names};return Dy(e,this.rhs)}},qS=class extends My{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},BS=class extends Io{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},WS=class extends Io{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},GS=class extends Io{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},HS=class extends Io{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=zu(this.code,e,r),this}get names(){return this.code instanceof qe._CodeOrName?this.code.names:{}}},Sp=class extends Io{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let o=n[i];o.optimizeNames(e,r)||(HG(e,o.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Xa(e,r.names),{})}},Eo=class extends Sp{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},XS=class extends Sp{},Cu=class extends Eo{};Cu.kind="else";var Ga=class t extends Eo{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Cu(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(JR(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=zu(this.condition,e,r),this}get names(){let e=super.names;return Dy(e,this.condition),this.else&&Xa(e,this.else.names),e}};Ga.kind="if";var Ha=class extends Eo{};Ha.kind="for";var KS=class extends Ha{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=zu(this.iteration,e,r),this}get names(){return Xa(super.names,this.iteration.names)}},JS=class extends Ha{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?ci.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=Dy(super.names,this.from);return Dy(e,this.to)}},jy=class extends Ha{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=zu(this.iterable,e,r),this}get names(){return Xa(super.names,this.iterable.names)}},$p=class extends Eo{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};$p.kind="func";var Ip=class extends Sp{render(e){return"return "+super.render(e)}};Ip.kind="return";var YS=class extends Eo{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Xa(e,this.catch.names),this.finally&&Xa(e,this.finally.names),e}},Ep=class extends Eo{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Ep.kind="catch";var Pp=class extends Eo{render(e){return"finally"+super.render(e)}};Pp.kind="finally";var QS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
8
|
+
deps: ${r}}`};var bW={keyword:"dependencies",type:"object",schemaType:"object",error:zi.error,code(t){let[e,r]=_W(t);lR(t,e),cR(t,r)}};function _W({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function lR(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let l=(0,vp.propertyInData)(r,n,s,i.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(l,()=>{for(let c of a)(0,vp.checkReportMissingProp)(t,c)}):(r.if((0,fS._)`${l} && (${(0,vp.checkMissingProp)(t,a,o)})`),(0,vp.reportMissingProp)(t,o),r.else())}}zi.validatePropertyDeps=lR;function cR(t,e=t.schema){let{gen:r,data:n,keyword:i,it:o}=t,s=r.name("valid");for(let a in e)(0,yW.alwaysValidSchema)(o,e[a])||(r.if((0,vp.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let l=t.subschema({keyword:i,schemaProp:a},s);t.mergeValidEvaluated(l,s)},()=>r.var(s,!0)),t.ok(s))}zi.validateSchemaDeps=cR;zi.default=bW});var fR=N(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});var dR=Le(),vW=Ke(),wW={message:"property name must be valid",params:({params:t})=>(0,dR._)`{propertyName: ${t.propertyName}}`},xW={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:wW,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,vW.alwaysValidSchema)(i,r))return;let o=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),e.if((0,dR.not)(o),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(o)}};pS.default=xW});var hS=N(mS=>{"use strict";Object.defineProperty(mS,"__esModule",{value:!0});var Ey=Nn(),li=Le(),kW=ko(),Py=Ke(),SW={message:"must NOT have additional properties",params:({params:t})=>(0,li._)`{additionalProperty: ${t.additionalProperty}}`},$W={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:SW,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:l}=s;if(s.props=!0,l.removeAdditional!=="all"&&(0,Py.alwaysValidSchema)(s,r))return;let c=(0,Ey.allSchemaProperties)(n.properties),u=(0,Ey.allSchemaProperties)(n.patternProperties);d(),t.ok((0,li._)`${o} === ${kW.default.errors}`);function d(){e.forIn("key",i,y=>{!c.length&&!u.length?m(y):e.if(p(y),()=>m(y))})}function p(y){let g;if(c.length>8){let b=(0,Py.schemaRefOrVal)(s,n.properties,"properties");g=(0,Ey.isOwnProperty)(e,b,y)}else c.length?g=(0,li.or)(...c.map(b=>(0,li._)`${y} === ${b}`)):g=li.nil;return u.length&&(g=(0,li.or)(g,...u.map(b=>(0,li._)`${(0,Ey.usePattern)(t,b)}.test(${y})`))),(0,li.not)(g)}function f(y){e.code((0,li._)`delete ${i}[${y}]`)}function m(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){f(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Py.alwaysValidSchema)(s,r)){let g=e.name("valid");l.removeAdditional==="failing"?(h(y,g,!1),e.if((0,li.not)(g),()=>{t.reset(),f(y)})):(h(y,g),a||e.if((0,li.not)(g),()=>e.break()))}}function h(y,g,b){let v={keyword:"additionalProperties",dataProp:y,dataPropType:Py.Type.Str};b===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,g)}}};mS.default=$W});var hR=N(yS=>{"use strict";Object.defineProperty(yS,"__esModule",{value:!0});var IW=sp(),pR=Nn(),gS=Ke(),mR=hS(),EW={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&mR.default.code(new IW.KeywordCxt(o,mR.default,"additionalProperties"));let s=(0,pR.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=gS.mergeEvaluated.props(e,(0,gS.toHash)(s),o.props));let a=s.filter(d=>!(0,gS.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let l=e.name("valid");for(let d of a)c(d)?u(d):(e.if((0,pR.propertyInData)(e,i,d,o.opts.ownProperties)),u(d),o.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};yS.default=EW});var _R=N(bS=>{"use strict";Object.defineProperty(bS,"__esModule",{value:!0});var gR=Nn(),Ty=Le(),yR=Ke(),bR=Ke(),PW={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:o}=t,{opts:s}=o,a=(0,gR.allSchemaProperties)(r),l=a.filter(h=>(0,yR.alwaysValidSchema)(o,r[h]));if(a.length===0||l.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let c=s.strictSchema&&!s.allowMatchingProperties&&i.properties,u=e.name("valid");o.props!==!0&&!(o.props instanceof Ty.Name)&&(o.props=(0,bR.evaluatedPropsToName)(e,o.props));let{props:d}=o;p();function p(){for(let h of a)c&&f(h),o.allErrors?m(h):(e.var(u,!0),m(h),e.if(u))}function f(h){for(let y in c)new RegExp(h).test(y)&&(0,yR.checkStrictMode)(o,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,y=>{e.if((0,Ty._)`${(0,gR.usePattern)(t,h)}.test(${y})`,()=>{let g=l.includes(h);g||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:bR.Type.Str},u),o.opts.unevaluated&&d!==!0?e.assign((0,Ty._)`${d}[${y}]`,!0):!g&&!o.allErrors&&e.if((0,Ty.not)(u),()=>e.break())})})}}};bS.default=PW});var vR=N(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});var TW=Ke(),AW={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,TW.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};_S.default=AW});var wR=N(vS=>{"use strict";Object.defineProperty(vS,"__esModule",{value:!0});var CW=Nn(),zW={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:CW.validateUnion,error:{message:"must match a schema in anyOf"}};vS.default=zW});var xR=N(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});var Ay=Le(),OW=Ke(),RW={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Ay._)`{passingSchemas: ${t.passing}}`},NW={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:RW,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,s=e.let("valid",!1),a=e.let("passing",null),l=e.name("_valid");t.setParams({passing:a}),e.block(c),t.result(s,()=>t.reset(),()=>t.error(!0));function c(){o.forEach((u,d)=>{let p;(0,OW.alwaysValidSchema)(i,u)?e.var(l,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,Ay._)`${l} && ${s}`).assign(s,!1).assign(a,(0,Ay._)`[${a}, ${d}]`).else(),e.if(l,()=>{e.assign(s,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Ay.Name)})})}}};wS.default=NW});var kR=N(xS=>{"use strict";Object.defineProperty(xS,"__esModule",{value:!0});var MW=Ke(),jW={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((o,s)=>{if((0,MW.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:s},i);t.ok(i),t.mergeEvaluated(a)})}};xS.default=jW});var IR=N(kS=>{"use strict";Object.defineProperty(kS,"__esModule",{value:!0});var Cy=Le(),$R=Ke(),DW={message:({params:t})=>(0,Cy.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Cy._)`{failingKeyword: ${t.ifClause}}`},LW={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:DW,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,$R.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=SR(n,"then"),o=SR(n,"else");if(!i&&!o)return;let s=e.let("valid",!0),a=e.name("_valid");if(l(),t.reset(),i&&o){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,c("then",u),c("else",u))}else i?e.if(a,c("then")):e.if((0,Cy.not)(a),c("else"));t.pass(s,()=>t.error(!0));function l(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function c(u,d){return()=>{let p=t.subschema({keyword:u},a);e.assign(s,a),t.mergeValidEvaluated(p,s),d?e.assign(d,(0,Cy._)`${u}`):t.setParams({ifClause:u})}}}};function SR(t,e){let r=t.schema[e];return r!==void 0&&!(0,$R.alwaysValidSchema)(t,r)}kS.default=LW});var ER=N(SS=>{"use strict";Object.defineProperty(SS,"__esModule",{value:!0});var UW=Ke(),ZW={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,UW.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};SS.default=ZW});var PR=N($S=>{"use strict";Object.defineProperty($S,"__esModule",{value:!0});var FW=aS(),VW=iR(),qW=lS(),BW=sR(),WW=aR(),GW=uR(),HW=fR(),XW=hS(),KW=hR(),JW=_R(),YW=vR(),QW=wR(),eG=xR(),tG=kR(),rG=IR(),nG=ER();function iG(t=!1){let e=[YW.default,QW.default,eG.default,tG.default,rG.default,nG.default,HW.default,XW.default,GW.default,KW.default,JW.default];return t?e.push(VW.default,BW.default):e.push(FW.default,qW.default),e.push(WW.default),e}$S.default=iG});var TR=N(IS=>{"use strict";Object.defineProperty(IS,"__esModule",{value:!0});var Dt=Le(),oG={message:({schemaCode:t})=>(0,Dt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Dt._)`{format: ${t}}`},sG={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:oG,code(t,e){let{gen:r,data:n,$data:i,schema:o,schemaCode:s,it:a}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=a;if(!l.validateFormats)return;i?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),h=r.const("fDef",(0,Dt._)`${m}[${s}]`),y=r.let("fType"),g=r.let("format");r.if((0,Dt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,Dt._)`${h}.type || "string"`).assign(g,(0,Dt._)`${h}.validate`),()=>r.assign(y,(0,Dt._)`"string"`).assign(g,h)),t.fail$data((0,Dt.or)(b(),v()));function b(){return l.strictSchema===!1?Dt.nil:(0,Dt._)`${s} && !${g}`}function v(){let C=u.$async?(0,Dt._)`(${h}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,Dt._)`${g}(${n})`,E=(0,Dt._)`(typeof ${g} == "function" ? ${C} : ${g}.test(${n}))`;return(0,Dt._)`${g} && ${g} !== true && ${y} === ${e} && !${E}`}}function f(){let m=d.formats[o];if(!m){b();return}if(m===!0)return;let[h,y,g]=v(m);h===e&&t.pass(C());function b(){if(l.strictSchema===!1){d.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${o}" ignored in schema at path "${c}"`}}function v(E){let T=E instanceof RegExp?(0,Dt.regexpCode)(E):l.code.formats?(0,Dt._)`${l.code.formats}${(0,Dt.getProperty)(o)}`:void 0,F=r.scopeValue("formats",{key:o,ref:E,code:T});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,Dt._)`${F}.validate`]:["string",E,F]}function C(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Dt._)`await ${g}(${n})`}return typeof y=="function"?(0,Dt._)`${g}(${n})`:(0,Dt._)`${g}.test(${n})`}}}};IS.default=sG});var AR=N(ES=>{"use strict";Object.defineProperty(ES,"__esModule",{value:!0});var aG=TR(),lG=[aG.default];ES.default=lG});var CR=N(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.contentVocabulary=Eu.metadataVocabulary=void 0;Eu.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Eu.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var OR=N(PS=>{"use strict";Object.defineProperty(PS,"__esModule",{value:!0});var cG=UO(),uG=eR(),dG=PR(),fG=AR(),zR=CR(),pG=[cG.default,uG.default,(0,dG.default)(),fG.default,zR.metadataVocabulary,zR.contentVocabulary];PS.default=pG});var NR=N(zy=>{"use strict";Object.defineProperty(zy,"__esModule",{value:!0});zy.DiscrError=void 0;var RR;(function(t){t.Tag="tag",t.Mapping="mapping"})(RR||(zy.DiscrError=RR={}))});var jR=N(AS=>{"use strict";Object.defineProperty(AS,"__esModule",{value:!0});var Pu=Le(),TS=NR(),MR=py(),mG=ap(),hG=Ke(),gG={message:({params:{discrError:t,tagName:e}})=>t===TS.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Pu._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},yG={keyword:"discriminator",type:"object",schemaType:"object",error:gG,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:o}=t,{oneOf:s}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let l=e.let("valid",!1),c=e.const("tag",(0,Pu._)`${r}${(0,Pu.getProperty)(a)}`);e.if((0,Pu._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:TS.DiscrError.Tag,tag:c,tagName:a})),t.ok(l);function u(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,Pu._)`${c} === ${m}`),e.assign(l,d(f[m]));e.else(),t.error(!1,{discrError:TS.DiscrError.Mapping,tag:c,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(h,Pu.Name),m}function p(){var f;let m={},h=g(i),y=!0;for(let C=0;C<s.length;C++){let E=s[C];if(E?.$ref&&!(0,hG.schemaHasRulesButRef)(E,o.self.RULES)){let F=E.$ref;if(E=MR.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,F),E instanceof MR.SchemaEnv&&(E=E.schema),E===void 0)throw new mG.default(o.opts.uriResolver,o.baseId,F)}let T=(f=E?.properties)===null||f===void 0?void 0:f[a];if(typeof T!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||g(E)),b(T,C)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function g({required:C}){return Array.isArray(C)&&C.includes(a)}function b(C,E){if(C.const)v(C.const,E);else if(C.enum)for(let T of C.enum)v(T,E);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(C,E){if(typeof C!="string"||C in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[C]=E}}}};AS.default=yG});var DR=N((Bke,bG)=>{bG.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var UR=N((vt,CS)=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.MissingRefError=vt.ValidationError=vt.CodeGen=vt.Name=vt.nil=vt.stringify=vt.str=vt._=vt.KeywordCxt=vt.Ajv=void 0;var _G=RO(),vG=OR(),wG=jR(),LR=DR(),xG=["/properties"],Oy="http://json-schema.org/draft-07/schema",Tu=class extends _G.default{_addVocabularies(){super._addVocabularies(),vG.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(wG.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(LR,xG):LR;this.addMetaSchema(e,Oy,!1),this.refs["http://json-schema.org/schema"]=Oy}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Oy)?Oy:void 0)}};vt.Ajv=Tu;CS.exports=vt=Tu;CS.exports.Ajv=Tu;Object.defineProperty(vt,"__esModule",{value:!0});vt.default=Tu;var kG=sp();Object.defineProperty(vt,"KeywordCxt",{enumerable:!0,get:function(){return kG.KeywordCxt}});var Au=Le();Object.defineProperty(vt,"_",{enumerable:!0,get:function(){return Au._}});Object.defineProperty(vt,"str",{enumerable:!0,get:function(){return Au.str}});Object.defineProperty(vt,"stringify",{enumerable:!0,get:function(){return Au.stringify}});Object.defineProperty(vt,"nil",{enumerable:!0,get:function(){return Au.nil}});Object.defineProperty(vt,"Name",{enumerable:!0,get:function(){return Au.Name}});Object.defineProperty(vt,"CodeGen",{enumerable:!0,get:function(){return Au.CodeGen}});var SG=dy();Object.defineProperty(vt,"ValidationError",{enumerable:!0,get:function(){return SG.default}});var $G=ap();Object.defineProperty(vt,"MissingRefError",{enumerable:!0,get:function(){return $G.default}})});var HR=N(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.formatNames=Ri.fastFormats=Ri.fullFormats=void 0;function Oi(t,e){return{validate:t,compare:e}}Ri.fullFormats={date:Oi(qR,NS),time:Oi(OS(!0),MS),"date-time":Oi(ZR(!0),WR),"iso-time":Oi(OS(),BR),"iso-date-time":Oi(ZR(),GR),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:CG,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:DG,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:zG,int32:{type:"number",validate:NG},int64:{type:"number",validate:MG},float:{type:"number",validate:VR},double:{type:"number",validate:VR},password:!0,binary:!0};Ri.fastFormats={...Ri.fullFormats,date:Oi(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,NS),time:Oi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,MS),"date-time":Oi(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,WR),"iso-time":Oi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,BR),"iso-date-time":Oi(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,GR),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Ri.formatNames=Object.keys(Ri.fullFormats);function IG(t){return t%4===0&&(t%100!==0||t%400===0)}var EG=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,PG=[0,31,28,31,30,31,30,31,31,30,31,30,31];function qR(t){let e=EG.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&IG(r)?29:PG[n])}function NS(t,e){if(t&&e)return t>e?1:t<e?-1:0}var zS=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function OS(t){return function(r){let n=zS.exec(r);if(!n)return!1;let i=+n[1],o=+n[2],s=+n[3],a=n[4],l=n[5]==="-"?-1:1,c=+(n[6]||0),u=+(n[7]||0);if(c>23||u>59||t&&!a)return!1;if(i<=23&&o<=59&&s<60)return!0;let d=o-u*l,p=i-c*l-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&s<61}}function MS(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function BR(t,e){if(!(t&&e))return;let r=zS.exec(t),n=zS.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var RS=/t|\s/i;function ZR(t){let e=OS(t);return function(n){let i=n.split(RS);return i.length===2&&qR(i[0])&&e(i[1])}}function WR(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function GR(t,e){if(!(t&&e))return;let[r,n]=t.split(RS),[i,o]=e.split(RS),s=NS(r,i);if(s!==void 0)return s||MS(n,o)}var TG=/\/|:/,AG=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function CG(t){return TG.test(t)&&AG.test(t)}var FR=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function zG(t){return FR.lastIndex=0,FR.test(t)}var OG=-(2**31),RG=2**31-1;function NG(t){return Number.isInteger(t)&&t<=RG&&t>=OG}function MG(t){return Number.isInteger(t)}function VR(){return!0}var jG=/[^\\]\\Z/;function DG(t){if(jG.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var kp=N(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.regexpCode=Je.getEsmExportName=Je.getProperty=Je.safeStringify=Je.stringify=Je.strConcat=Je.addCodeArg=Je.str=Je._=Je.nil=Je._Code=Je.Name=Je.IDENTIFIER=Je._CodeOrName=void 0;var wp=class{};Je._CodeOrName=wp;Je.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Wa=class extends wp{constructor(e){if(super(),!Je.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Je.Name=Wa;var Dn=class extends wp{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Wa&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Je._Code=Dn;Je.nil=new Dn("");function XR(t,...e){let r=[t[0]],n=0;for(;n<e.length;)DS(r,e[n]),r.push(t[++n]);return new Dn(r)}Je._=XR;var jS=new Dn("+");function KR(t,...e){let r=[xp(t[0])],n=0;for(;n<e.length;)r.push(jS),DS(r,e[n]),r.push(jS,xp(t[++n]));return LG(r),new Dn(r)}Je.str=KR;function DS(t,e){e instanceof Dn?t.push(...e._items):e instanceof Wa?t.push(e):t.push(FG(e))}Je.addCodeArg=DS;function LG(t){let e=1;for(;e<t.length-1;){if(t[e]===jS){let r=UG(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function UG(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Wa||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Wa))return`"${t}${e.slice(1)}`}function ZG(t,e){return e.emptyStr()?t:t.emptyStr()?e:KR`${t}${e}`}Je.strConcat=ZG;function FG(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:xp(Array.isArray(t)?t.join(","):t)}function VG(t){return new Dn(xp(t))}Je.stringify=VG;function xp(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Je.safeStringify=xp;function qG(t){return typeof t=="string"&&Je.IDENTIFIER.test(t)?new Dn(`.${t}`):XR`[${t}]`}Je.getProperty=qG;function BG(t){if(typeof t=="string"&&Je.IDENTIFIER.test(t))return new Dn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Je.getEsmExportName=BG;function WG(t){return new Dn(t.toString())}Je.regexpCode=WG});var FS=N(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.ValueScope=Ur.ValueScopeName=Ur.Scope=Ur.varKinds=Ur.UsedValueState=void 0;var en=kp(),LS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},US;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(US=Ur.UsedValueState||(Ur.UsedValueState={}));Ur.varKinds={const:new en.Name("const"),let:new en.Name("let"),var:new en.Name("var")};var Ry=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof en.Name?e:this.name(e)}name(e){return new en.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Ur.Scope=Ry;var Ny=class extends en.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,en._)`.${new en.Name(r)}[${n}]`}};Ur.ValueScopeName=Ny;var GG=(0,en._)`\n`,ZS=class extends Ry{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?GG:en.nil}}get(){return this._scope}name(e){return new Ny(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:o}=i,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let u=a.get(s);if(u)return u}else a=this._values[o]=new Map;a.set(s,i);let l=this._scope[o]||(this._scope[o]=[]),c=l.length;return l[c]=r.ref,i.setValue(r,{property:o,itemIndex:c}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,en._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let o=en.nil;for(let s in e){let a=e[s];if(!a)continue;let l=n[s]=n[s]||new Map;a.forEach(c=>{if(l.has(c))return;l.set(c,US.Started);let u=r(c);if(u){let d=this.opts.es5?Ur.varKinds.var:Ur.varKinds.const;o=(0,en._)`${o}${d} ${c} = ${u};${this.opts._n}`}else if(u=i?.(c))o=(0,en._)`${o}${u}${this.opts._n}`;else throw new LS(c);l.set(c,US.Completed)})}return o}};Ur.ValueScope=ZS});var Re=N(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.or=je.and=je.not=je.CodeGen=je.operators=je.varKinds=je.ValueScopeName=je.ValueScope=je.Scope=je.Name=je.regexpCode=je.stringify=je.getProperty=je.nil=je.strConcat=je.str=je._=void 0;var qe=kp(),ci=FS(),Is=kp();Object.defineProperty(je,"_",{enumerable:!0,get:function(){return Is._}});Object.defineProperty(je,"str",{enumerable:!0,get:function(){return Is.str}});Object.defineProperty(je,"strConcat",{enumerable:!0,get:function(){return Is.strConcat}});Object.defineProperty(je,"nil",{enumerable:!0,get:function(){return Is.nil}});Object.defineProperty(je,"getProperty",{enumerable:!0,get:function(){return Is.getProperty}});Object.defineProperty(je,"stringify",{enumerable:!0,get:function(){return Is.stringify}});Object.defineProperty(je,"regexpCode",{enumerable:!0,get:function(){return Is.regexpCode}});Object.defineProperty(je,"Name",{enumerable:!0,get:function(){return Is.Name}});var Ly=FS();Object.defineProperty(je,"Scope",{enumerable:!0,get:function(){return Ly.Scope}});Object.defineProperty(je,"ValueScope",{enumerable:!0,get:function(){return Ly.ValueScope}});Object.defineProperty(je,"ValueScopeName",{enumerable:!0,get:function(){return Ly.ValueScopeName}});Object.defineProperty(je,"varKinds",{enumerable:!0,get:function(){return Ly.varKinds}});je.operators={GT:new qe._Code(">"),GTE:new qe._Code(">="),LT:new qe._Code("<"),LTE:new qe._Code("<="),EQ:new qe._Code("==="),NEQ:new qe._Code("!=="),NOT:new qe._Code("!"),OR:new qe._Code("||"),AND:new qe._Code("&&"),ADD:new qe._Code("+")};var Io=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},VS=class extends Io{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ci.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=zu(this.rhs,e,r)),this}get names(){return this.rhs instanceof qe._CodeOrName?this.rhs.names:{}}},My=class extends Io{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof qe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=zu(this.rhs,e,r),this}get names(){let e=this.lhs instanceof qe.Name?{}:{...this.lhs.names};return Dy(e,this.rhs)}},qS=class extends My{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},BS=class extends Io{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},WS=class extends Io{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},GS=class extends Io{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},HS=class extends Io{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=zu(this.code,e,r),this}get names(){return this.code instanceof qe._CodeOrName?this.code.names:{}}},Sp=class extends Io{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let o=n[i];o.optimizeNames(e,r)||(HG(e,o.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Xa(e,r.names),{})}},Eo=class extends Sp{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},XS=class extends Sp{},Cu=class extends Eo{};Cu.kind="else";var Ga=class t extends Eo{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Cu(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(JR(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=zu(this.condition,e,r),this}get names(){let e=super.names;return Dy(e,this.condition),this.else&&Xa(e,this.else.names),e}};Ga.kind="if";var Ha=class extends Eo{};Ha.kind="for";var KS=class extends Ha{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=zu(this.iteration,e,r),this}get names(){return Xa(super.names,this.iteration.names)}},JS=class extends Ha{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?ci.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=Dy(super.names,this.from);return Dy(e,this.to)}},jy=class extends Ha{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=zu(this.iterable,e,r),this}get names(){return Xa(super.names,this.iterable.names)}},$p=class extends Eo{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};$p.kind="func";var Ip=class extends Sp{render(e){return"return "+super.render(e)}};Ip.kind="return";var YS=class extends Eo{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Xa(e,this.catch.names),this.finally&&Xa(e,this.finally.names),e}},Ep=class extends Eo{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Ep.kind="catch";var Pp=class extends Eo{render(e){return"finally"+super.render(e)}};Pp.kind="finally";var QS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
9
9
|
`:""},this._extScope=e,this._scope=new ci.Scope({parent:e}),this._nodes=[new XS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let o=this._scope.toName(r);return n!==void 0&&i&&(this._constants[o.str]=n),this._leafNode(new VS(e,o,n)),o}const(e,r,n){return this._def(ci.varKinds.const,e,r,n)}let(e,r,n){return this._def(ci.varKinds.let,e,r,n)}var(e,r,n){return this._def(ci.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new My(e,r,n))}add(e,r){return this._leafNode(new qS(e,je.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==qe.nil&&this._leafNode(new HS(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,qe.addCodeArg)(r,i));return r.push("}"),new qe._Code(r)}if(e,r,n){if(this._blockNode(new Ga(e)),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(e){return this._elseNode(new Ga(e))}else(){return this._elseNode(new Cu)}endIf(){return this._endBlockNode(Ga,Cu)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new KS(e),r)}forRange(e,r,n,i,o=this.opts.es5?ci.varKinds.var:ci.varKinds.let){let s=this._scope.toName(e);return this._for(new JS(o,s,r,n),()=>i(s))}forOf(e,r,n,i=ci.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=r instanceof qe.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,qe._)`${s}.length`,a=>{this.var(o,(0,qe._)`${s}[${a}]`),n(o)})}return this._for(new jy("of",i,o,r),()=>n(o))}forIn(e,r,n,i=this.opts.es5?ci.varKinds.var:ci.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,qe._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new jy("in",i,o,r),()=>n(o))}endFor(){return this._endBlockNode(Ha)}label(e){return this._leafNode(new BS(e))}break(e){return this._leafNode(new WS(e))}return(e){let r=new Ip;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ip)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new YS;if(this._blockNode(i),this.code(e),r){let o=this.name("e");this._currNode=i.catch=new Ep(o),r(o)}return n&&(this._currNode=i.finally=new Pp,this.code(n)),this._endBlockNode(Ep,Pp)}throw(e){return this._leafNode(new GS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){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||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=qe.nil,n,i){return this._blockNode(new $p(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode($p)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Ga))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};je.CodeGen=QS;function Xa(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Dy(t,e){return e instanceof qe._CodeOrName?Xa(t,e.names):t}function zu(t,e,r){if(t instanceof qe.Name)return n(t);if(!i(t))return t;return new qe._Code(t._items.reduce((o,s)=>(s instanceof qe.Name&&(s=n(s)),s instanceof qe._Code?o.push(...s._items):o.push(s),o),[]));function n(o){let s=r[o.str];return s===void 0||e[o.str]!==1?o:(delete e[o.str],s)}function i(o){return o instanceof qe._Code&&o._items.some(s=>s instanceof qe.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function HG(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function JR(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,qe._)`!${e$(t)}`}je.not=JR;var XG=YR(je.operators.AND);function KG(...t){return t.reduce(XG)}je.and=KG;var JG=YR(je.operators.OR);function YG(...t){return t.reduce(JG)}je.or=YG;function YR(t){return(e,r)=>e===qe.nil?r:r===qe.nil?e:(0,qe._)`${e$(e)} ${t} ${e$(r)}`}function e$(t){return t instanceof qe.Name?t:(0,qe._)`(${t})`}});var Ye=N(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.checkStrictMode=De.getErrorPath=De.Type=De.useFunc=De.setEvaluated=De.evaluatedPropsToName=De.mergeEvaluated=De.eachItem=De.unescapeJsonPointer=De.escapeJsonPointer=De.escapeFragment=De.unescapeFragment=De.schemaRefOrVal=De.schemaHasRulesButRef=De.schemaHasRules=De.checkUnknownRules=De.alwaysValidSchema=De.toHash=void 0;var pt=Re(),QG=kp();function eH(t){let e={};for(let r of t)e[r]=!0;return e}De.toHash=eH;function tH(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(tN(t,e),!rN(e,t.self.RULES.all))}De.alwaysValidSchema=tH;function tN(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let o in e)i[o]||sN(t,`unknown keyword: "${o}"`)}De.checkUnknownRules=tN;function rN(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}De.schemaHasRules=rN;function rH(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}De.schemaHasRulesButRef=rH;function nH({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,pt._)`${r}`}return(0,pt._)`${t}${e}${(0,pt.getProperty)(n)}`}De.schemaRefOrVal=nH;function iH(t){return nN(decodeURIComponent(t))}De.unescapeFragment=iH;function oH(t){return encodeURIComponent(t$(t))}De.escapeFragment=oH;function t$(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}De.escapeJsonPointer=t$;function nN(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}De.unescapeJsonPointer=nN;function sH(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}De.eachItem=sH;function QR({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,o,s,a)=>{let l=s===void 0?o:s instanceof pt.Name?(o instanceof pt.Name?t(i,o,s):e(i,o,s),s):o instanceof pt.Name?(e(i,s,o),o):r(o,s);return a===pt.Name&&!(l instanceof pt.Name)?n(i,l):l}}De.mergeEvaluated={props:QR({mergeNames:(t,e,r)=>t.if((0,pt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,pt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,pt._)`${r} || {}`).code((0,pt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,pt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,pt._)`${r} || {}`),r$(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:iN}),items:QR({mergeNames:(t,e,r)=>t.if((0,pt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,pt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,pt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,pt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function iN(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,pt._)`{}`);return e!==void 0&&r$(t,r,e),r}De.evaluatedPropsToName=iN;function r$(t,e,r){Object.keys(r).forEach(n=>t.assign((0,pt._)`${e}${(0,pt.getProperty)(n)}`,!0))}De.setEvaluated=r$;var eN={};function aH(t,e){return t.scopeValue("func",{ref:e,code:eN[e.code]||(eN[e.code]=new QG._Code(e.code))})}De.useFunc=aH;var oN;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(oN=De.Type||(De.Type={}));function lH(t,e,r){if(t instanceof pt.Name){let n=e===oN.Num;return r?n?(0,pt._)`"[" + ${t} + "]"`:(0,pt._)`"['" + ${t} + "']"`:n?(0,pt._)`"/" + ${t}`:(0,pt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,pt.getProperty)(t).toString():"/"+t$(t)}De.getErrorPath=lH;function sN(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}De.checkStrictMode=sN});var Po=N(n$=>{"use strict";Object.defineProperty(n$,"__esModule",{value:!0});var Ar=Re(),cH={data:new Ar.Name("data"),valCxt:new Ar.Name("valCxt"),instancePath:new Ar.Name("instancePath"),parentData:new Ar.Name("parentData"),parentDataProperty:new Ar.Name("parentDataProperty"),rootData:new Ar.Name("rootData"),dynamicAnchors:new Ar.Name("dynamicAnchors"),vErrors:new Ar.Name("vErrors"),errors:new Ar.Name("errors"),this:new Ar.Name("this"),self:new Ar.Name("self"),scope:new Ar.Name("scope"),json:new Ar.Name("json"),jsonPos:new Ar.Name("jsonPos"),jsonLen:new Ar.Name("jsonLen"),jsonPart:new Ar.Name("jsonPart")};n$.default=cH});var Tp=N(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.extendErrors=Cr.resetErrorsCount=Cr.reportExtraError=Cr.reportError=Cr.keyword$DataError=Cr.keywordError=void 0;var Ge=Re(),Uy=Ye(),Zr=Po();Cr.keywordError={message:({keyword:t})=>(0,Ge.str)`must pass "${t}" keyword validation`};Cr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ge.str)`"${t}" keyword must be ${e} ($data)`:(0,Ge.str)`"${t}" keyword is invalid ($data)`};function uH(t,e=Cr.keywordError,r,n){let{it:i}=t,{gen:o,compositeRule:s,allErrors:a}=i,l=cN(t,e,r);n??(s||a)?aN(o,l):lN(i,(0,Ge._)`[${l}]`)}Cr.reportError=uH;function dH(t,e=Cr.keywordError,r){let{it:n}=t,{gen:i,compositeRule:o,allErrors:s}=n,a=cN(t,e,r);aN(i,a),o||s||lN(n,Zr.default.vErrors)}Cr.reportExtraError=dH;function fH(t,e){t.assign(Zr.default.errors,e),t.if((0,Ge._)`${Zr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ge._)`${Zr.default.vErrors}.length`,e),()=>t.assign(Zr.default.vErrors,null)))}Cr.resetErrorsCount=fH;function pH({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:o}){if(i===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",i,Zr.default.errors,a=>{t.const(s,(0,Ge._)`${Zr.default.vErrors}[${a}]`),t.if((0,Ge._)`${s}.instancePath === undefined`,()=>t.assign((0,Ge._)`${s}.instancePath`,(0,Ge.strConcat)(Zr.default.instancePath,o.errorPath))),t.assign((0,Ge._)`${s}.schemaPath`,(0,Ge.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,Ge._)`${s}.schema`,r),t.assign((0,Ge._)`${s}.data`,n))})}Cr.extendErrors=pH;function aN(t,e){let r=t.const("err",e);t.if((0,Ge._)`${Zr.default.vErrors} === null`,()=>t.assign(Zr.default.vErrors,(0,Ge._)`[${r}]`),(0,Ge._)`${Zr.default.vErrors}.push(${r})`),t.code((0,Ge._)`${Zr.default.errors}++`)}function lN(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,Ge._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ge._)`${n}.errors`,e),r.return(!1))}var Ka={keyword:new Ge.Name("keyword"),schemaPath:new Ge.Name("schemaPath"),params:new Ge.Name("params"),propertyName:new Ge.Name("propertyName"),message:new Ge.Name("message"),schema:new Ge.Name("schema"),parentSchema:new Ge.Name("parentSchema")};function cN(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ge._)`{}`:mH(t,e,r)}function mH(t,e,r={}){let{gen:n,it:i}=t,o=[hH(i,r),gH(t,r)];return yH(t,e,o),n.object(...o)}function hH({errorPath:t},{instancePath:e}){let r=e?(0,Ge.str)`${t}${(0,Uy.getErrorPath)(e,Uy.Type.Str)}`:t;return[Zr.default.instancePath,(0,Ge.strConcat)(Zr.default.instancePath,r)]}function gH({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,Ge.str)`${e}/${t}`;return r&&(i=(0,Ge.str)`${i}${(0,Uy.getErrorPath)(r,Uy.Type.Str)}`),[Ka.schemaPath,i]}function yH(t,{params:e,message:r},n){let{keyword:i,data:o,schemaValue:s,it:a}=t,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=a;n.push([Ka.keyword,i],[Ka.params,typeof e=="function"?e(t):e||(0,Ge._)`{}`]),l.messages&&n.push([Ka.message,typeof r=="function"?r(t):r]),l.verbose&&n.push([Ka.schema,s],[Ka.parentSchema,(0,Ge._)`${u}${d}`],[Zr.default.data,o]),c&&n.push([Ka.propertyName,c])}});var dN=N(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.boolOrEmptySchema=Ou.topBoolOrEmptySchema=void 0;var bH=Tp(),_H=Re(),vH=Po(),wH={message:"boolean schema is false"};function xH(t){let{gen:e,schema:r,validateName:n}=t;r===!1?uN(t,!1):typeof r=="object"&&r.$async===!0?e.return(vH.default.data):(e.assign((0,_H._)`${n}.errors`,null),e.return(!0))}Ou.topBoolOrEmptySchema=xH;function kH(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),uN(t)):r.var(e,!0)}Ou.boolOrEmptySchema=kH;function uN(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,bH.reportError)(i,wH,void 0,e)}});var i$=N(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.getRules=Ru.isJSONType=void 0;var SH=["string","number","integer","boolean","null","object","array"],$H=new Set(SH);function IH(t){return typeof t=="string"&&$H.has(t)}Ru.isJSONType=IH;function EH(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Ru.getRules=EH});var o$=N(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.shouldUseRule=Es.shouldUseGroup=Es.schemaHasRulesForType=void 0;function PH({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&fN(t,n)}Es.schemaHasRulesForType=PH;function fN(t,e){return e.rules.some(r=>pN(t,r))}Es.shouldUseGroup=fN;function pN(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Es.shouldUseRule=pN});var Cp=N(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.reportTypeError=yr.checkDataTypes=yr.checkDataType=yr.coerceAndCheckDataType=yr.getJSONTypes=yr.getSchemaTypes=yr.DataType=void 0;var TH=i$(),AH=o$(),CH=Tp(),ze=Re(),mN=Ye(),Ap;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Ap=yr.DataType||(yr.DataType={}));function zH(t){let e=hN(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}yr.getSchemaTypes=zH;function hN(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(TH.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}yr.getJSONTypes=hN;function OH(t,e){let{gen:r,data:n,opts:i}=t,o=RH(e,i.coerceTypes),s=e.length>0&&!(o.length===0&&e.length===1&&(0,AH.schemaHasRulesForType)(t,e[0]));if(s){let a=a$(e,n,i.strictNumbers,Ap.Wrong);r.if(a,()=>{o.length?NH(t,e,o):l$(t)})}return s}yr.coerceAndCheckDataType=OH;var gN=new Set(["string","number","integer","boolean","null"]);function RH(t,e){return e?t.filter(r=>gN.has(r)||e==="array"&&r==="array"):[]}function NH(t,e,r){let{gen:n,data:i,opts:o}=t,s=n.let("dataType",(0,ze._)`typeof ${i}`),a=n.let("coerced",(0,ze._)`undefined`);o.coerceTypes==="array"&&n.if((0,ze._)`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,ze._)`${i}[0]`).assign(s,(0,ze._)`typeof ${i}`).if(a$(e,i,o.strictNumbers),()=>n.assign(a,i))),n.if((0,ze._)`${a} !== undefined`);for(let c of r)(gN.has(c)||c==="array"&&o.coerceTypes==="array")&&l(c);n.else(),l$(t),n.endIf(),n.if((0,ze._)`${a} !== undefined`,()=>{n.assign(i,a),MH(t,a)});function l(c){switch(c){case"string":n.elseIf((0,ze._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,ze._)`"" + ${i}`).elseIf((0,ze._)`${i} === null`).assign(a,(0,ze._)`""`);return;case"number":n.elseIf((0,ze._)`${s} == "boolean" || ${i} === null
|
|
10
10
|
|| (${s} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,ze._)`+${i}`);return;case"integer":n.elseIf((0,ze._)`${s} === "boolean" || ${i} === null
|
|
11
11
|
|| (${s} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,(0,ze._)`+${i}`);return;case"boolean":n.elseIf((0,ze._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf((0,ze._)`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":n.elseIf((0,ze._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(a,null);return;case"array":n.elseIf((0,ze._)`${s} === "string" || ${s} === "number"
|
|
12
|
-
|| ${s} === "boolean" || ${i} === null`).assign(a,(0,ze._)`[${i}]`)}}}function MH({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,ze._)`${e} !== undefined`,()=>t.assign((0,ze._)`${e}[${r}]`,n))}function s$(t,e,r,n=Ap.Correct){let i=n===Ap.Correct?ze.operators.EQ:ze.operators.NEQ,o;switch(t){case"null":return(0,ze._)`${e} ${i} null`;case"array":o=(0,ze._)`Array.isArray(${e})`;break;case"object":o=(0,ze._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=s((0,ze._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=s();break;default:return(0,ze._)`typeof ${e} ${i} ${t}`}return n===Ap.Correct?o:(0,ze.not)(o);function s(a=ze.nil){return(0,ze.and)((0,ze._)`typeof ${e} == "number"`,a,r?(0,ze._)`isFinite(${e})`:ze.nil)}}yr.checkDataType=s$;function a$(t,e,r,n){if(t.length===1)return s$(t[0],e,r,n);let i,o=(0,mN.toHash)(t);if(o.array&&o.object){let s=(0,ze._)`typeof ${e} != "object"`;i=o.null?s:(0,ze._)`!${e} || ${s}`,delete o.null,delete o.array,delete o.object}else i=ze.nil;o.number&&delete o.integer;for(let s in o)i=(0,ze.and)(i,s$(s,e,r,n));return i}yr.checkDataTypes=a$;var jH={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ze._)`{type: ${t}}`:(0,ze._)`{type: ${e}}`};function l$(t){let e=DH(t);(0,CH.reportError)(e,jH)}yr.reportTypeError=l$;function DH(t){let{gen:e,data:r,schema:n}=t,i=(0,mN.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var bN=N(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});Zy.assignDefaults=void 0;var Nu=Re(),LH=Ye();function UH(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)yN(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,o)=>yN(t,o,i.default))}Zy.assignDefaults=UH;function yN(t,e,r){let{gen:n,compositeRule:i,data:o,opts:s}=t;if(r===void 0)return;let a=(0,Nu._)`${o}${(0,Nu.getProperty)(e)}`;if(i){(0,LH.checkStrictMode)(t,`default is ignored for: ${a}`);return}let l=(0,Nu._)`${a} === undefined`;s.useDefaults==="empty"&&(l=(0,Nu._)`${l} || ${a} === null || ${a} === ""`),n.if(l,(0,Nu._)`${a} = ${(0,Nu.stringify)(r)}`)}});var Dn=N(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.validateUnion=lt.validateArray=lt.usePattern=lt.callValidateCode=lt.schemaProperties=lt.allSchemaProperties=lt.noPropertyInData=lt.propertyInData=lt.isOwnProperty=lt.hasPropFunc=lt.reportMissingProp=lt.checkMissingProp=lt.checkReportMissingProp=void 0;var wt=Re(),c$=Ye(),Ps=Po(),ZH=Ye();function FH(t,e){let{gen:r,data:n,it:i}=t;r.if(d$(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,wt._)`${e}`},!0),t.error()})}lt.checkReportMissingProp=FH;function VH({gen:t,data:e,it:{opts:r}},n,i){return(0,wt.or)(...n.map(o=>(0,wt.and)(d$(t,e,o,r.ownProperties),(0,wt._)`${i} = ${o}`)))}lt.checkMissingProp=VH;function qH(t,e){t.setParams({missingProperty:e},!0),t.error()}lt.reportMissingProp=qH;function _N(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,wt._)`Object.prototype.hasOwnProperty`})}lt.hasPropFunc=_N;function u$(t,e,r){return(0,wt._)`${_N(t)}.call(${e}, ${r})`}lt.isOwnProperty=u$;function BH(t,e,r,n){let i=(0,wt._)`${e}${(0,wt.getProperty)(r)} !== undefined`;return n?(0,wt._)`${i} && ${u$(t,e,r)}`:i}lt.propertyInData=BH;function d$(t,e,r,n){let i=(0,wt._)`${e}${(0,wt.getProperty)(r)} === undefined`;return n?(0,wt.or)(i,(0,wt.not)(u$(t,e,r))):i}lt.noPropertyInData=d$;function vN(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}lt.allSchemaProperties=vN;function WH(t,e){return vN(e).filter(r=>!(0,c$.alwaysValidSchema)(t,e[r]))}lt.schemaProperties=WH;function GH({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:s},a,l,c){let u=c?(0,wt._)`${t}, ${e}, ${n}${i}`:e,d=[[Ps.default.instancePath,(0,wt.strConcat)(Ps.default.instancePath,o)],[Ps.default.parentData,s.parentData],[Ps.default.parentDataProperty,s.parentDataProperty],[Ps.default.rootData,Ps.default.rootData]];s.opts.dynamicRef&&d.push([Ps.default.dynamicAnchors,Ps.default.dynamicAnchors]);let p=(0,wt._)`${u}, ${r.object(...d)}`;return l!==wt.nil?(0,wt._)`${a}.call(${l}, ${p})`:(0,wt._)`${a}(${p})`}lt.callValidateCode=GH;var HH=(0,wt._)`new RegExp`;function XH({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,o=i(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,wt._)`${i.code==="new RegExp"?HH:(0,ZH.useFunc)(t,i)}(${r}, ${n})`})}lt.usePattern=XH;function KH(t){let{gen:e,data:r,keyword:n,it:i}=t,o=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(o,!0),s(()=>e.break()),o;function s(a){let l=e.const("len",(0,wt._)`${r}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:n,dataProp:c,dataPropType:c$.Type.Num},o),e.if((0,wt.not)(o),a)})}}lt.validateArray=KH;function JH(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,c$.alwaysValidSchema)(i,l))&&!i.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((l,c)=>{let u=t.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);e.assign(s,(0,wt._)`${s} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,wt.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}lt.validateUnion=JH});var kN=N(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.validateKeywordUsage=Ni.validSchemaType=Ni.funcKeywordCode=Ni.macroKeywordCode=void 0;var Fr=Re(),Ja=Po(),YH=Dn(),QH=Tp();function eX(t,e){let{gen:r,keyword:n,schema:i,parentSchema:o,it:s}=t,a=e.macro.call(s.self,i,o,s),l=xN(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let c=r.name("valid");t.subschema({schema:a,schemaPath:Fr.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}Ni.macroKeywordCode=eX;function tX(t,e){var r;let{gen:n,keyword:i,schema:o,parentSchema:s,$data:a,it:l}=t;nX(l,e);let c=!a&&e.compile?e.compile.call(l.self,o,s,l):e.validate,u=xN(n,i,c),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)h(),e.modifying&&wN(t),y(()=>t.error());else{let g=e.async?f():m();e.modifying&&wN(t),y(()=>rX(t,g))}}function f(){let g=n.let("ruleErrs",null);return n.try(()=>h((0,Fr._)`await `),b=>n.assign(d,!1).if((0,Fr._)`${b} instanceof ${l.ValidationError}`,()=>n.assign(g,(0,Fr._)`${b}.errors`),()=>n.throw(b))),g}function m(){let g=(0,Fr._)`${u}.errors`;return n.assign(g,null),h(Fr.nil),g}function h(g=e.async?(0,Fr._)`await `:Fr.nil){let b=l.opts.passContext?Ja.default.this:Ja.default.self,v=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Fr._)`${g}${(0,YH.callValidateCode)(t,u,b,v)}`,e.modifying)}function y(g){var b;n.if((0,Fr.not)((b=e.valid)!==null&&b!==void 0?b:d),g)}}Ni.funcKeywordCode=tX;function wN(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Fr._)`${n.parentData}[${n.parentDataProperty}]`))}function rX(t,e){let{gen:r}=t;r.if((0,Fr._)`Array.isArray(${e})`,()=>{r.assign(Ja.default.vErrors,(0,Fr._)`${Ja.default.vErrors} === null ? ${e} : ${Ja.default.vErrors}.concat(${e})`).assign(Ja.default.errors,(0,Fr._)`${Ja.default.vErrors}.length`),(0,QH.extendErrors)(t)},()=>t.error())}function nX({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function xN(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Fr.stringify)(r)})}function iX(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Ni.validSchemaType=iX;function oX({schema:t,opts:e,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");let s=i.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[o])){let l=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}Ni.validateKeywordUsage=oX});var $N=N(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.extendSubschemaMode=Ts.extendSubschemaData=Ts.getSubschema=void 0;var Mi=Re(),SN=Ye();function sX(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Mi._)`${t.schemaPath}${(0,Mi.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Mi._)`${t.schemaPath}${(0,Mi.getProperty)(e)}${(0,Mi.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,SN.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}Ts.getSubschema=sX;function aX(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:s}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=e,p=a.let("data",(0,Mi._)`${e.data}${(0,Mi.getProperty)(r)}`,!0);l(p),t.errorPath=(0,Mi.str)`${c}${(0,SN.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Mi._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let c=i instanceof Mi.Name?i:a.let("data",i,!0);l(c),s!==void 0&&(t.propertyName=s)}o&&(t.dataTypes=o);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}Ts.extendSubschemaData=aX;function lX(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}Ts.extendSubschemaMode=lX});var zp=N(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.getSchemaRefs=tn.resolveUrl=tn.normalizeId=tn._getFullPath=tn.getFullPath=tn.inlineRef=void 0;var cX=Ye(),uX=rp(),dX=kk(),fX=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function pX(t,e=!0){return typeof t=="boolean"?!0:e===!0?!f$(t):e?IN(t)<=e:!1}tn.inlineRef=pX;var mX=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function f$(t){for(let e in t){if(mX.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(f$)||typeof r=="object"&&f$(r))return!0}return!1}function IN(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!fX.has(r)&&(typeof t[r]=="object"&&(0,cX.eachItem)(t[r],n=>e+=IN(n)),e===1/0))return 1/0}return e}function EN(t,e="",r){r!==!1&&(e=Mu(e));let n=t.parse(e);return PN(t,n)}tn.getFullPath=EN;function PN(t,e){return t.serialize(e).split("#")[0]+"#"}tn._getFullPath=PN;var hX=/#\/?$/;function Mu(t){return t?t.replace(hX,""):""}tn.normalizeId=Mu;function gX(t,e,r){return r=Mu(r),t.resolve(e,r)}tn.resolveUrl=gX;var yX=/^[a-z_][-a-z0-9._]*$/i;function bX(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=Mu(t[r]||e),o={"":i},s=EN(n,i,!1),a={},l=new Set;return dX(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let h=s+p,y=o[m];typeof d[r]=="string"&&(y=g.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),o[p]=y;function g(v){let C=this.opts.uriResolver.resolve;if(v=Mu(y?C(y,v):v),l.has(v))throw u(v);l.add(v);let E=this.refs[v];return typeof E=="string"&&(E=this.refs[E]),typeof E=="object"?c(d,E.schema,v):v!==Mu(h)&&(v[0]==="#"?(c(d,a[v],v),a[v]=d):this.refs[v]=h),v}function b(v){if(typeof v=="string"){if(!yX.test(v))throw new Error(`invalid anchor "${v}"`);g.call(this,`#${v}`)}}}),a;function c(d,p,f){if(p!==void 0&&!uX(d,p))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}tn.getSchemaRefs=bX});var Np=N(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.getData=As.KeywordCxt=As.validateFunctionCode=void 0;var ON=dN(),TN=Cp(),m$=o$(),Fy=Cp(),_X=bN(),Rp=kN(),p$=$N(),oe=Re(),$e=Po(),vX=zp(),To=Ye(),Op=Tp();function wX(t){if(MN(t)&&(jN(t),NN(t))){SX(t);return}RN(t,()=>(0,ON.topBoolOrEmptySchema)(t))}As.validateFunctionCode=wX;function RN({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},o){i.code.es5?t.func(e,(0,oe._)`${$e.default.data}, ${$e.default.valCxt}`,n.$async,()=>{t.code((0,oe._)`"use strict"; ${AN(r,i)}`),kX(t,i),t.code(o)}):t.func(e,(0,oe._)`${$e.default.data}, ${xX(i)}`,n.$async,()=>t.code(AN(r,i)).code(o))}function xX(t){return(0,oe._)`{${$e.default.instancePath}="", ${$e.default.parentData}, ${$e.default.parentDataProperty}, ${$e.default.rootData}=${$e.default.data}${t.dynamicRef?(0,oe._)`, ${$e.default.dynamicAnchors}={}`:oe.nil}}={}`}function kX(t,e){t.if($e.default.valCxt,()=>{t.var($e.default.instancePath,(0,oe._)`${$e.default.valCxt}.${$e.default.instancePath}`),t.var($e.default.parentData,(0,oe._)`${$e.default.valCxt}.${$e.default.parentData}`),t.var($e.default.parentDataProperty,(0,oe._)`${$e.default.valCxt}.${$e.default.parentDataProperty}`),t.var($e.default.rootData,(0,oe._)`${$e.default.valCxt}.${$e.default.rootData}`),e.dynamicRef&&t.var($e.default.dynamicAnchors,(0,oe._)`${$e.default.valCxt}.${$e.default.dynamicAnchors}`)},()=>{t.var($e.default.instancePath,(0,oe._)`""`),t.var($e.default.parentData,(0,oe._)`undefined`),t.var($e.default.parentDataProperty,(0,oe._)`undefined`),t.var($e.default.rootData,$e.default.data),e.dynamicRef&&t.var($e.default.dynamicAnchors,(0,oe._)`{}`)})}function SX(t){let{schema:e,opts:r,gen:n}=t;RN(t,()=>{r.$comment&&e.$comment&&LN(t),TX(t),n.let($e.default.vErrors,null),n.let($e.default.errors,0),r.unevaluated&&$X(t),DN(t),zX(t)})}function $X(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,oe._)`${r}.evaluated`),e.if((0,oe._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,oe._)`${t.evaluated}.props`,(0,oe._)`undefined`)),e.if((0,oe._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,oe._)`${t.evaluated}.items`,(0,oe._)`undefined`))}function AN(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,oe._)`/*# sourceURL=${r} */`:oe.nil}function IX(t,e){if(MN(t)&&(jN(t),NN(t))){EX(t,e);return}(0,ON.boolOrEmptySchema)(t,e)}function NN({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function MN(t){return typeof t.schema!="boolean"}function EX(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&LN(t),AX(t),CX(t);let o=n.const("_errs",$e.default.errors);DN(t,o),n.var(e,(0,oe._)`${o} === ${$e.default.errors}`)}function jN(t){(0,To.checkUnknownRules)(t),PX(t)}function DN(t,e){if(t.opts.jtd)return CN(t,[],!1,e);let r=(0,TN.getSchemaTypes)(t.schema),n=(0,TN.coerceAndCheckDataType)(t,r);CN(t,r,!n,e)}function PX(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,To.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function TX(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,To.checkStrictMode)(t,"default is ignored in the schema root")}function AX(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,vX.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function CX(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function LN({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let o=r.$comment;if(i.$comment===!0)t.code((0,oe._)`${$e.default.self}.logger.log(${o})`);else if(typeof i.$comment=="function"){let s=(0,oe.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,oe._)`${$e.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function zX(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=t;r.$async?e.if((0,oe._)`${$e.default.errors} === 0`,()=>e.return($e.default.data),()=>e.throw((0,oe._)`new ${i}(${$e.default.vErrors})`)):(e.assign((0,oe._)`${n}.errors`,$e.default.vErrors),o.unevaluated&&OX(t),e.return((0,oe._)`${$e.default.errors} === 0`))}function OX({gen:t,evaluated:e,props:r,items:n}){r instanceof oe.Name&&t.assign((0,oe._)`${e}.props`,r),n instanceof oe.Name&&t.assign((0,oe._)`${e}.items`,n)}function CN(t,e,r,n){let{gen:i,schema:o,data:s,allErrors:a,opts:l,self:c}=t,{RULES:u}=c;if(o.$ref&&(l.ignoreKeywordsWithRef||!(0,To.schemaHasRulesButRef)(o,u))){i.block(()=>ZN(t,"$ref",u.all.$ref.definition));return}l.jtd||RX(t,e),i.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){(0,m$.shouldUseGroup)(o,p)&&(p.type?(i.if((0,Fy.checkDataType)(p.type,s,l.strictNumbers)),zN(t,p),e.length===1&&e[0]===p.type&&r&&(i.else(),(0,Fy.reportTypeError)(t)),i.endIf()):zN(t,p),a||i.if((0,oe._)`${$e.default.errors} === ${n||0}`))}}function zN(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,_X.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,m$.shouldUseRule)(n,o)&&ZN(t,o.keyword,o.definition,e.type)})}function RX(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(NX(t,e),t.opts.allowUnionTypes||MX(t,e),jX(t,t.dataTypes))}function NX(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{UN(t.dataTypes,r)||h$(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),LX(t,e)}}function MX(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&h$(t,"use allowUnionTypes to allow union type keyword")}function jX(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,m$.shouldUseRule)(t.schema,i)){let{type:o}=i.definition;o.length&&!o.some(s=>DX(e,s))&&h$(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function DX(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function UN(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function LX(t,e){let r=[];for(let n of t.dataTypes)UN(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function h$(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,To.checkStrictMode)(t,e,t.opts.strictTypes)}var Vy=class{constructor(e,r,n){if((0,Rp.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,To.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",FN(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Rp.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=e.gen.const("_errs",$e.default.errors))}result(e,r,n){this.failResult((0,oe.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,oe.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,oe._)`${r} !== undefined && (${(0,oe.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Op.reportExtraError:Op.reportError)(this,this.def.error,r)}$dataError(){(0,Op.reportError)(this,this.def.$dataError||Op.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Op.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=oe.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=oe.nil,r=oe.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:o,def:s}=this;n.if((0,oe.or)((0,oe._)`${i} === undefined`,r)),e!==oe.nil&&n.assign(e,!0),(o.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==oe.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:o}=this;return(0,oe.or)(s(),a());function s(){if(n.length){if(!(r instanceof oe.Name))throw new Error("ajv implementation error");let l=Array.isArray(n)?n:[n];return(0,oe._)`${(0,Fy.checkDataTypes)(l,r,o.opts.strictNumbers,Fy.DataType.Wrong)}`}return oe.nil}function a(){if(i.validateSchema){let l=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,oe._)`!${l}(${r})`}return oe.nil}}subschema(e,r){let n=(0,p$.getSubschema)(this.it,e);(0,p$.extendSubschemaData)(n,this.it,e),(0,p$.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return IX(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=To.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=To.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,oe.Name)),!0}};As.KeywordCxt=Vy;function ZN(t,e,r,n){let i=new Vy(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Rp.funcKeywordCode)(i,r):"macro"in r?(0,Rp.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Rp.funcKeywordCode)(i,r)}var UX=/^\/(?:[^~]|~0|~1)*$/,ZX=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function FN(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,o;if(t==="")return $e.default.rootData;if(t[0]==="/"){if(!UX.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,o=$e.default.rootData}else{let c=ZX.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+c[1];if(i=c[2],i==="#"){if(u>=e)throw new Error(l("property/index",u));return n[e-u]}if(u>e)throw new Error(l("data",u));if(o=r[e-u],!i)return o}let s=o,a=i.split("/");for(let c of a)c&&(o=(0,oe._)`${o}${(0,oe.getProperty)((0,To.unescapeJsonPointer)(c))}`,s=(0,oe._)`${s} && ${o}`);return s;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}As.getData=FN});var qy=N(y$=>{"use strict";Object.defineProperty(y$,"__esModule",{value:!0});var g$=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};y$.default=g$});var By=N(v$=>{"use strict";Object.defineProperty(v$,"__esModule",{value:!0});var b$=zp(),_$=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,b$.resolveUrl)(e,r,n),this.missingSchema=(0,b$.normalizeId)((0,b$.getFullPath)(e,this.missingRef))}};v$.default=_$});var Gy=N(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.resolveSchema=Ln.getCompilingSchema=Ln.resolveRef=Ln.compileSchema=Ln.SchemaEnv=void 0;var ui=Re(),FX=qy(),Ya=Po(),di=zp(),VN=Ye(),VX=Np(),ju=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,di.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Ln.SchemaEnv=ju;function x$(t){let e=qN.call(this,t);if(e)return e;let r=(0,di.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,s=new ui.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o}),a;t.$async&&(a=s.scopeValue("Error",{ref:FX.default,code:(0,ui._)`require("ajv/dist/runtime/validation_error").default`}));let l=s.scopeName("validate");t.validateName=l;let c={gen:s,allErrors:this.opts.allErrors,data:Ya.default.data,parentData:Ya.default.parentData,parentDataProperty:Ya.default.parentDataProperty,dataNames:[Ya.default.data],dataPathArr:[ui.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,ui.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:ui.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ui._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,VX.validateFunctionCode)(c),s.optimize(this.opts.code.optimize);let d=s.toString();u=`${s.scopeRefs(Ya.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let f=new Function(`${Ya.default.self}`,`${Ya.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:l,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=c;f.evaluated={props:m instanceof ui.Name?void 0:m,items:h instanceof ui.Name?void 0:h,dynamicProps:m instanceof ui.Name,dynamicItems:h instanceof ui.Name},f.source&&(f.source.evaluated=(0,ui.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Ln.compileSchema=x$;function qX(t,e,r){var n;r=(0,di.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let o=GX.call(this,t,r);if(o===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(o=new ju({schema:s,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=BX.call(this,o)}Ln.resolveRef=qX;function BX(t){return(0,di.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:x$.call(this,t)}function qN(t){for(let e of this._compilations)if(WX(e,t))return e}Ln.getCompilingSchema=qN;function WX(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function GX(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Wy.call(this,t,e)}function Wy(t,e){let r=this.opts.uriResolver.parse(e),n=(0,di._getFullPath)(this.opts.uriResolver,r),i=(0,di.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return w$.call(this,r,t);let o=(0,di.normalizeId)(n),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=Wy.call(this,t,s);return typeof a?.schema!="object"?void 0:w$.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||x$.call(this,s),o===(0,di.normalizeId)(e)){let{schema:a}=s,{schemaId:l}=this.opts,c=a[l];return c&&(i=(0,di.resolveUrl)(this.opts.uriResolver,i,c)),new ju({schema:a,schemaId:l,root:t,baseId:i})}return w$.call(this,r,s)}}Ln.resolveSchema=Wy;var HX=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function w$(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let l=r[(0,VN.unescapeFragment)(a)];if(l===void 0)return;r=l;let c=typeof r=="object"&&r[this.opts.schemaId];!HX.has(a)&&c&&(e=(0,di.resolveUrl)(this.opts.uriResolver,e,c))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,VN.schemaHasRulesButRef)(r,this.RULES)){let a=(0,di.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=Wy.call(this,n,a)}let{schemaId:s}=this.opts;if(o=o||new ju({schema:r,schemaId:s,root:n,baseId:e}),o.schema!==o.root.schema)return o}});var BN=N((fSe,XX)=>{XX.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 GN=N((Hy,WN)=>{"use strict";(function(t,e){typeof Hy=="object"&&typeof WN<"u"?e(Hy):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(Hy,(function(t){"use strict";function e(){for(var x=arguments.length,_=Array(x),$=0;$<x;$++)_[$]=arguments[$];if(_.length>1){_[0]=_[0].slice(0,-1);for(var O=_.length-1,R=1;R<O;++R)_[R]=_[R].slice(1,-1);return _[O]=_[O].slice(1),_.join("")}else return _[0]}function r(x){return"(?:"+x+")"}function n(x){return x===void 0?"undefined":x===null?"null":Object.prototype.toString.call(x).split(" ").pop().split("]").shift().toLowerCase()}function i(x){return x.toUpperCase()}function o(x){return x!=null?x instanceof Array?x:typeof x.length!="number"||x.split||x.setInterval||x.call?[x]:Array.prototype.slice.call(x):[]}function s(x,_){var $=x;if(_)for(var O in _)$[O]=_[O];return $}function a(x){var _="[A-Za-z]",$="[\\x0D]",O="[0-9]",R="[\\x22]",Q=e(O,"[A-Fa-f]"),Ae="[\\x0A]",He="[\\x20]",rt=r(r("%[EFef]"+Q+"%"+Q+Q+"%"+Q+Q)+"|"+r("%[89A-Fa-f]"+Q+"%"+Q+Q)+"|"+r("%"+Q+Q)),qt="[\\:\\/\\?\\#\\[\\]\\@]",Be="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Tt=e(qt,Be),Bt=x?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",xt=x?"[\\uE000-\\uF8FF]":"[]",Qe=e(_,O,"[\\-\\.\\_\\~]",Bt),At=r(_+e(_,O,"[\\+\\-\\.]")+"*"),ot=r(r(rt+"|"+e(Qe,Be,"[\\:]"))+"*"),qs=r(r("25[0-5]")+"|"+r("2[0-4]"+O)+"|"+r("1"+O+O)+"|"+r("[1-9]"+O)+"|"+O),an=r(r("25[0-5]")+"|"+r("2[0-4]"+O)+"|"+r("1"+O+O)+"|"+r("0?[1-9]"+O)+"|0?0?"+O),$n=r(an+"\\."+an+"\\."+an+"\\."+an),ut=r(Q+"{1,4}"),ln=r(r(ut+"\\:"+ut)+"|"+$n),In=r(r(ut+"\\:")+"{6}"+ln),gi=r("\\:\\:"+r(ut+"\\:")+"{5}"+ln),Bs=r(r(ut)+"?\\:\\:"+r(ut+"\\:")+"{4}"+ln),Gi=r(r(r(ut+"\\:")+"{0,1}"+ut)+"?\\:\\:"+r(ut+"\\:")+"{3}"+ln),dd=r(r(r(ut+"\\:")+"{0,2}"+ut)+"?\\:\\:"+r(ut+"\\:")+"{2}"+ln),qm=r(r(r(ut+"\\:")+"{0,3}"+ut)+"?\\:\\:"+ut+"\\:"+ln),Bm=r(r(r(ut+"\\:")+"{0,4}"+ut)+"?\\:\\:"+ln),xl=r(r(r(ut+"\\:")+"{0,5}"+ut)+"?\\:\\:"+ut),kl=r(r(r(ut+"\\:")+"{0,6}"+ut)+"?\\:\\:"),Hi=r([In,gi,Bs,Gi,dd,qm,Bm,xl,kl].join("|")),Sl=r(r(Qe+"|"+rt)+"+"),S_=r(Hi+"\\%25"+Sl),Ws=r(Hi+r("\\%25|\\%(?!"+Q+"{2})")+Sl),J2=r("[vV]"+Q+"+\\."+e(Qe,Be,"[\\:]")+"+"),Y2=r("\\["+r(Ws+"|"+Hi+"|"+J2)+"\\]"),yE=r(r(rt+"|"+e(Qe,Be))+"*"),fd=r(Y2+"|"+$n+"(?!"+yE+")|"+yE),pd=r(O+"*"),bE=r(r(ot+"@")+"?"+fd+r("\\:"+pd)+"?"),md=r(rt+"|"+e(Qe,Be,"[\\:\\@]")),Q2=r(md+"*"),_E=r(md+"+"),eL=r(r(rt+"|"+e(Qe,Be,"[\\@]"))+"+"),Xi=r(r("\\/"+Q2)+"*"),$l=r("\\/"+r(_E+Xi)+"?"),$_=r(eL+Xi),Wm=r(_E+Xi),Il="(?!"+md+")",lre=r(Xi+"|"+$l+"|"+$_+"|"+Wm+"|"+Il),El=r(r(md+"|"+e("[\\/\\?]",xt))+"*"),hd=r(r(md+"|[\\/\\?]")+"*"),vE=r(r("\\/\\/"+bE+Xi)+"|"+$l+"|"+Wm+"|"+Il),tL=r(At+"\\:"+vE+r("\\?"+El)+"?"+r("\\#"+hd)+"?"),rL=r(r("\\/\\/"+bE+Xi)+"|"+$l+"|"+$_+"|"+Il),nL=r(rL+r("\\?"+El)+"?"+r("\\#"+hd)+"?"),cre=r(tL+"|"+nL),ure=r(At+"\\:"+vE+r("\\?"+El)+"?"),dre="^("+At+")\\:"+r(r("\\/\\/("+r("("+ot+")@")+"?("+fd+")"+r("\\:("+pd+")")+"?)")+"?("+Xi+"|"+$l+"|"+Wm+"|"+Il+")")+r("\\?("+El+")")+"?"+r("\\#("+hd+")")+"?$",fre="^(){0}"+r(r("\\/\\/("+r("("+ot+")@")+"?("+fd+")"+r("\\:("+pd+")")+"?)")+"?("+Xi+"|"+$l+"|"+$_+"|"+Il+")")+r("\\?("+El+")")+"?"+r("\\#("+hd+")")+"?$",pre="^("+At+")\\:"+r(r("\\/\\/("+r("("+ot+")@")+"?("+fd+")"+r("\\:("+pd+")")+"?)")+"?("+Xi+"|"+$l+"|"+Wm+"|"+Il+")")+r("\\?("+El+")")+"?$",mre="^"+r("\\#("+hd+")")+"?$",hre="^"+r("("+ot+")@")+"?("+fd+")"+r("\\:("+pd+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",_,O,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",Qe,Be),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",Qe,Be),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",Qe,Be),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",Qe,Be),"g"),NOT_QUERY:new RegExp(e("[^\\%]",Qe,Be,"[\\:\\@\\/\\?]",xt),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",Qe,Be,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",Qe,Be),"g"),UNRESERVED:new RegExp(Qe,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",Qe,Tt),"g"),PCT_ENCODED:new RegExp(rt,"g"),IPV4ADDRESS:new RegExp("^("+$n+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Hi+")"+r(r("\\%25|\\%(?!"+Q+"{2})")+"("+Sl+")")+"?\\]?$")}}var l=a(!1),c=a(!0),u=(function(){function x(_,$){var O=[],R=!0,Q=!1,Ae=void 0;try{for(var He=_[Symbol.iterator](),rt;!(R=(rt=He.next()).done)&&(O.push(rt.value),!($&&O.length===$));R=!0);}catch(qt){Q=!0,Ae=qt}finally{try{!R&&He.return&&He.return()}finally{if(Q)throw Ae}}return O}return function(_,$){if(Array.isArray(_))return _;if(Symbol.iterator in Object(_))return x(_,$);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=function(x){if(Array.isArray(x)){for(var _=0,$=Array(x.length);_<x.length;_++)$[_]=x[_];return $}else return Array.from(x)},p=2147483647,f=36,m=1,h=26,y=38,g=700,b=72,v=128,C="-",E=/^xn--/,T=/[^\0-\x7E]/,F=/[\x2E\u3002\uFF0E\uFF61]/g,le={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ee=f-m,I=Math.floor,ce=String.fromCharCode;function be(x){throw new RangeError(le[x])}function J(x,_){for(var $=[],O=x.length;O--;)$[O]=_(x[O]);return $}function pe(x,_){var $=x.split("@"),O="";$.length>1&&(O=$[0]+"@",x=$[1]),x=x.replace(F,".");var R=x.split("."),Q=J(R,_).join(".");return O+Q}function ge(x){for(var _=[],$=0,O=x.length;$<O;){var R=x.charCodeAt($++);if(R>=55296&&R<=56319&&$<O){var Q=x.charCodeAt($++);(Q&64512)==56320?_.push(((R&1023)<<10)+(Q&1023)+65536):(_.push(R),$--)}else _.push(R)}return _}var ct=function(_){return String.fromCodePoint.apply(String,d(_))},yt=function(_){return _-48<10?_-22:_-65<26?_-65:_-97<26?_-97:f},Pt=function(_,$){return _+22+75*(_<26)-(($!=0)<<5)},wr=function(_,$,O){var R=0;for(_=O?I(_/g):_>>1,_+=I(_/$);_>ee*h>>1;R+=f)_=I(_/ee);return I(R+(ee+1)*_/(_+y))},w=function(_){var $=[],O=_.length,R=0,Q=v,Ae=b,He=_.lastIndexOf(C);He<0&&(He=0);for(var rt=0;rt<He;++rt)_.charCodeAt(rt)>=128&&be("not-basic"),$.push(_.charCodeAt(rt));for(var qt=He>0?He+1:0;qt<O;){for(var Be=R,Tt=1,Bt=f;;Bt+=f){qt>=O&&be("invalid-input");var xt=yt(_.charCodeAt(qt++));(xt>=f||xt>I((p-R)/Tt))&&be("overflow"),R+=xt*Tt;var Qe=Bt<=Ae?m:Bt>=Ae+h?h:Bt-Ae;if(xt<Qe)break;var At=f-Qe;Tt>I(p/At)&&be("overflow"),Tt*=At}var ot=$.length+1;Ae=wr(R-Be,ot,Be==0),I(R/ot)>p-Q&&be("overflow"),Q+=I(R/ot),R%=ot,$.splice(R++,0,Q)}return String.fromCodePoint.apply(String,$)},Nr=function(_){var $=[];_=ge(_);var O=_.length,R=v,Q=0,Ae=b,He=!0,rt=!1,qt=void 0;try{for(var Be=_[Symbol.iterator](),Tt;!(He=(Tt=Be.next()).done);He=!0){var Bt=Tt.value;Bt<128&&$.push(ce(Bt))}}catch(Ws){rt=!0,qt=Ws}finally{try{!He&&Be.return&&Be.return()}finally{if(rt)throw qt}}var xt=$.length,Qe=xt;for(xt&&$.push(C);Qe<O;){var At=p,ot=!0,qs=!1,an=void 0;try{for(var $n=_[Symbol.iterator](),ut;!(ot=(ut=$n.next()).done);ot=!0){var ln=ut.value;ln>=R&&ln<At&&(At=ln)}}catch(Ws){qs=!0,an=Ws}finally{try{!ot&&$n.return&&$n.return()}finally{if(qs)throw an}}var In=Qe+1;At-R>I((p-Q)/In)&&be("overflow"),Q+=(At-R)*In,R=At;var gi=!0,Bs=!1,Gi=void 0;try{for(var dd=_[Symbol.iterator](),qm;!(gi=(qm=dd.next()).done);gi=!0){var Bm=qm.value;if(Bm<R&&++Q>p&&be("overflow"),Bm==R){for(var xl=Q,kl=f;;kl+=f){var Hi=kl<=Ae?m:kl>=Ae+h?h:kl-Ae;if(xl<Hi)break;var Sl=xl-Hi,S_=f-Hi;$.push(ce(Pt(Hi+Sl%S_,0))),xl=I(Sl/S_)}$.push(ce(Pt(xl,0))),Ae=wr(Q,In,Qe==xt),Q=0,++Qe}}}catch(Ws){Bs=!0,Gi=Ws}finally{try{!gi&&dd.return&&dd.return()}finally{if(Bs)throw Gi}}++Q,++R}return $.join("")},Bn=function(_){return pe(_,function($){return E.test($)?w($.slice(4).toLowerCase()):$})},S=function(_){return pe(_,function($){return T.test($)?"xn--"+Nr($):$})},Ft={version:"2.1.0",ucs2:{decode:ge,encode:ct},decode:w,encode:Nr,toASCII:S,toUnicode:Bn},Vt={};function Br(x){var _=x.charCodeAt(0),$=void 0;return _<16?$="%0"+_.toString(16).toUpperCase():_<128?$="%"+_.toString(16).toUpperCase():_<2048?$="%"+(_>>6|192).toString(16).toUpperCase()+"%"+(_&63|128).toString(16).toUpperCase():$="%"+(_>>12|224).toString(16).toUpperCase()+"%"+(_>>6&63|128).toString(16).toUpperCase()+"%"+(_&63|128).toString(16).toUpperCase(),$}function Wn(x){for(var _="",$=0,O=x.length;$<O;){var R=parseInt(x.substr($+1,2),16);if(R<128)_+=String.fromCharCode(R),$+=3;else if(R>=194&&R<224){if(O-$>=6){var Q=parseInt(x.substr($+4,2),16);_+=String.fromCharCode((R&31)<<6|Q&63)}else _+=x.substr($,6);$+=6}else if(R>=224){if(O-$>=9){var Ae=parseInt(x.substr($+4,2),16),He=parseInt(x.substr($+7,2),16);_+=String.fromCharCode((R&15)<<12|(Ae&63)<<6|He&63)}else _+=x.substr($,9);$+=9}else _+=x.substr($,3),$+=3}return _}function Mt(x,_){function $(O){var R=Wn(O);return R.match(_.UNRESERVED)?R:O}return x.scheme&&(x.scheme=String(x.scheme).replace(_.PCT_ENCODED,$).toLowerCase().replace(_.NOT_SCHEME,"")),x.userinfo!==void 0&&(x.userinfo=String(x.userinfo).replace(_.PCT_ENCODED,$).replace(_.NOT_USERINFO,Br).replace(_.PCT_ENCODED,i)),x.host!==void 0&&(x.host=String(x.host).replace(_.PCT_ENCODED,$).toLowerCase().replace(_.NOT_HOST,Br).replace(_.PCT_ENCODED,i)),x.path!==void 0&&(x.path=String(x.path).replace(_.PCT_ENCODED,$).replace(x.scheme?_.NOT_PATH:_.NOT_PATH_NOSCHEME,Br).replace(_.PCT_ENCODED,i)),x.query!==void 0&&(x.query=String(x.query).replace(_.PCT_ENCODED,$).replace(_.NOT_QUERY,Br).replace(_.PCT_ENCODED,i)),x.fragment!==void 0&&(x.fragment=String(x.fragment).replace(_.PCT_ENCODED,$).replace(_.NOT_FRAGMENT,Br).replace(_.PCT_ENCODED,i)),x}function Bi(x){return x.replace(/^0*(.*)/,"$1")||"0"}function Wr(x,_){var $=x.match(_.IPV4ADDRESS)||[],O=u($,2),R=O[1];return R?R.split(".").map(Bi).join("."):x}function Wi(x,_){var $=x.match(_.IPV6ADDRESS)||[],O=u($,3),R=O[1],Q=O[2];if(R){for(var Ae=R.toLowerCase().split("::").reverse(),He=u(Ae,2),rt=He[0],qt=He[1],Be=qt?qt.split(":").map(Bi):[],Tt=rt.split(":").map(Bi),Bt=_.IPV4ADDRESS.test(Tt[Tt.length-1]),xt=Bt?7:8,Qe=Tt.length-xt,At=Array(xt),ot=0;ot<xt;++ot)At[ot]=Be[ot]||Tt[Qe+ot]||"";Bt&&(At[xt-1]=Wr(At[xt-1],_));var qs=At.reduce(function(In,gi,Bs){if(!gi||gi==="0"){var Gi=In[In.length-1];Gi&&Gi.index+Gi.length===Bs?Gi.length++:In.push({index:Bs,length:1})}return In},[]),an=qs.sort(function(In,gi){return gi.length-In.length})[0],$n=void 0;if(an&&an.length>1){var ut=At.slice(0,an.index),ln=At.slice(an.index+an.length);$n=ut.join(":")+"::"+ln.join(":")}else $n=At.join(":");return Q&&($n+="%"+Q),$n}else return x}var jo=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ld="".match(/(){0}/)[1]===void 0;function xn(x){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$={},O=_.iri!==!1?c:l;_.reference==="suffix"&&(x=(_.scheme?_.scheme+":":"")+"//"+x);var R=x.match(jo);if(R){ld?($.scheme=R[1],$.userinfo=R[3],$.host=R[4],$.port=parseInt(R[5],10),$.path=R[6]||"",$.query=R[7],$.fragment=R[8],isNaN($.port)&&($.port=R[5])):($.scheme=R[1]||void 0,$.userinfo=x.indexOf("@")!==-1?R[3]:void 0,$.host=x.indexOf("//")!==-1?R[4]:void 0,$.port=parseInt(R[5],10),$.path=R[6]||"",$.query=x.indexOf("?")!==-1?R[7]:void 0,$.fragment=x.indexOf("#")!==-1?R[8]:void 0,isNaN($.port)&&($.port=x.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?R[4]:void 0)),$.host&&($.host=Wi(Wr($.host,O),O)),$.scheme===void 0&&$.userinfo===void 0&&$.host===void 0&&$.port===void 0&&!$.path&&$.query===void 0?$.reference="same-document":$.scheme===void 0?$.reference="relative":$.fragment===void 0?$.reference="absolute":$.reference="uri",_.reference&&_.reference!=="suffix"&&_.reference!==$.reference&&($.error=$.error||"URI is not a "+_.reference+" reference.");var Q=Vt[(_.scheme||$.scheme||"").toLowerCase()];if(!_.unicodeSupport&&(!Q||!Q.unicodeSupport)){if($.host&&(_.domainHost||Q&&Q.domainHost))try{$.host=Ft.toASCII($.host.replace(O.PCT_ENCODED,Wn).toLowerCase())}catch(Ae){$.error=$.error||"Host's domain name can not be converted to ASCII via punycode: "+Ae}Mt($,l)}else Mt($,O);Q&&Q.parse&&Q.parse($,_)}else $.error=$.error||"URI can not be parsed.";return $}function Um(x,_){var $=_.iri!==!1?c:l,O=[];return x.userinfo!==void 0&&(O.push(x.userinfo),O.push("@")),x.host!==void 0&&O.push(Wi(Wr(String(x.host),$),$).replace($.IPV6ADDRESS,function(R,Q,Ae){return"["+Q+(Ae?"%25"+Ae:"")+"]"})),(typeof x.port=="number"||typeof x.port=="string")&&(O.push(":"),O.push(String(x.port))),O.length?O.join(""):void 0}var cd=/^\.\.?\//,Zm=/^\/\.(\/|$)/,ud=/^\/\.\.(\/|$)/,Fm=/^\/?(?:.|\n)*?(?=\/|$)/;function Do(x){for(var _=[];x.length;)if(x.match(cd))x=x.replace(cd,"");else if(x.match(Zm))x=x.replace(Zm,"/");else if(x.match(ud))x=x.replace(ud,"/"),_.pop();else if(x==="."||x==="..")x="";else{var $=x.match(Fm);if($){var O=$[0];x=x.slice(O.length),_.push(O)}else throw new Error("Unexpected dot segment condition")}return _.join("")}function kn(x){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=_.iri?c:l,O=[],R=Vt[(_.scheme||x.scheme||"").toLowerCase()];if(R&&R.serialize&&R.serialize(x,_),x.host&&!$.IPV6ADDRESS.test(x.host)){if(_.domainHost||R&&R.domainHost)try{x.host=_.iri?Ft.toUnicode(x.host):Ft.toASCII(x.host.replace($.PCT_ENCODED,Wn).toLowerCase())}catch(He){x.error=x.error||"Host's domain name can not be converted to "+(_.iri?"Unicode":"ASCII")+" via punycode: "+He}}Mt(x,$),_.reference!=="suffix"&&x.scheme&&(O.push(x.scheme),O.push(":"));var Q=Um(x,_);if(Q!==void 0&&(_.reference!=="suffix"&&O.push("//"),O.push(Q),x.path&&x.path.charAt(0)!=="/"&&O.push("/")),x.path!==void 0){var Ae=x.path;!_.absolutePath&&(!R||!R.absolutePath)&&(Ae=Do(Ae)),Q===void 0&&(Ae=Ae.replace(/^\/\//,"/%2F")),O.push(Ae)}return x.query!==void 0&&(O.push("?"),O.push(x.query)),x.fragment!==void 0&&(O.push("#"),O.push(x.fragment)),O.join("")}function Vm(x,_){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},O=arguments[3],R={};return O||(x=xn(kn(x,$),$),_=xn(kn(_,$),$)),$=$||{},!$.tolerant&&_.scheme?(R.scheme=_.scheme,R.userinfo=_.userinfo,R.host=_.host,R.port=_.port,R.path=Do(_.path||""),R.query=_.query):(_.userinfo!==void 0||_.host!==void 0||_.port!==void 0?(R.userinfo=_.userinfo,R.host=_.host,R.port=_.port,R.path=Do(_.path||""),R.query=_.query):(_.path?(_.path.charAt(0)==="/"?R.path=Do(_.path):((x.userinfo!==void 0||x.host!==void 0||x.port!==void 0)&&!x.path?R.path="/"+_.path:x.path?R.path=x.path.slice(0,x.path.lastIndexOf("/")+1)+_.path:R.path=_.path,R.path=Do(R.path)),R.query=_.query):(R.path=x.path,_.query!==void 0?R.query=_.query:R.query=x.query),R.userinfo=x.userinfo,R.host=x.host,R.port=x.port),R.scheme=x.scheme),R.fragment=_.fragment,R}function w_(x,_,$){var O=s({scheme:"null"},$);return kn(Vm(xn(x,O),xn(_,O),O,!0),O)}function x_(x,_){return typeof x=="string"?x=kn(xn(x,_),_):n(x)==="object"&&(x=xn(kn(x,_),_)),x}function D(x,_,$){return typeof x=="string"?x=kn(xn(x,$),$):n(x)==="object"&&(x=kn(x,$)),typeof _=="string"?_=kn(xn(_,$),$):n(_)==="object"&&(_=kn(_,$)),x===_}function q(x,_){return x&&x.toString().replace(!_||!_.iri?l.ESCAPE:c.ESCAPE,Br)}function de(x,_){return x&&x.toString().replace(!_||!_.iri?l.PCT_ENCODED:c.PCT_ENCODED,Wn)}var Te={scheme:"http",domainHost:!0,parse:function(_,$){return _.host||(_.error=_.error||"HTTP URIs must have a host."),_},serialize:function(_,$){var O=String(_.scheme).toLowerCase()==="https";return(_.port===(O?443:80)||_.port==="")&&(_.port=void 0),_.path||(_.path="/"),_}},tt={scheme:"https",domainHost:Te.domainHost,parse:Te.parse,serialize:Te.serialize};function Gr(x){return typeof x.secure=="boolean"?x.secure:String(x.scheme).toLowerCase()==="wss"}var sn={scheme:"ws",domainHost:!0,parse:function(_,$){var O=_;return O.secure=Gr(O),O.resourceName=(O.path||"/")+(O.query?"?"+O.query:""),O.path=void 0,O.query=void 0,O},serialize:function(_,$){if((_.port===(Gr(_)?443:80)||_.port==="")&&(_.port=void 0),typeof _.secure=="boolean"&&(_.scheme=_.secure?"wss":"ws",_.secure=void 0),_.resourceName){var O=_.resourceName.split("?"),R=u(O,2),Q=R[0],Ae=R[1];_.path=Q&&Q!=="/"?Q:void 0,_.query=Ae,_.resourceName=void 0}return _.fragment=void 0,_}},Sn={scheme:"wss",domainHost:sn.domainHost,parse:sn.parse,serialize:sn.serialize},Fs={},Vs=!0,xr="[A-Za-z0-9\\-\\.\\_\\~"+(Vs?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",sr="[0-9A-Fa-f]",Gn=r(r("%[EFef]"+sr+"%"+sr+sr+"%"+sr+sr)+"|"+r("%[89A-Fa-f]"+sr+"%"+sr+sr)+"|"+r("%"+sr+sr)),F2="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",V2="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",q2=e(V2,'[\\"\\\\]'),B2="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",W2=new RegExp(xr,"g"),wl=new RegExp(Gn,"g"),G2=new RegExp(e("[^]",F2,"[\\.]",'[\\"]',q2),"g"),pE=new RegExp(e("[^]",xr,B2),"g"),H2=pE;function k_(x){var _=Wn(x);return _.match(W2)?_:x}var mE={scheme:"mailto",parse:function(_,$){var O=_,R=O.to=O.path?O.path.split(","):[];if(O.path=void 0,O.query){for(var Q=!1,Ae={},He=O.query.split("&"),rt=0,qt=He.length;rt<qt;++rt){var Be=He[rt].split("=");switch(Be[0]){case"to":for(var Tt=Be[1].split(","),Bt=0,xt=Tt.length;Bt<xt;++Bt)R.push(Tt[Bt]);break;case"subject":O.subject=de(Be[1],$);break;case"body":O.body=de(Be[1],$);break;default:Q=!0,Ae[de(Be[0],$)]=de(Be[1],$);break}}Q&&(O.headers=Ae)}O.query=void 0;for(var Qe=0,At=R.length;Qe<At;++Qe){var ot=R[Qe].split("@");if(ot[0]=de(ot[0]),$.unicodeSupport)ot[1]=de(ot[1],$).toLowerCase();else try{ot[1]=Ft.toASCII(de(ot[1],$).toLowerCase())}catch(qs){O.error=O.error||"Email address's domain name can not be converted to ASCII via punycode: "+qs}R[Qe]=ot.join("@")}return O},serialize:function(_,$){var O=_,R=o(_.to);if(R){for(var Q=0,Ae=R.length;Q<Ae;++Q){var He=String(R[Q]),rt=He.lastIndexOf("@"),qt=He.slice(0,rt).replace(wl,k_).replace(wl,i).replace(G2,Br),Be=He.slice(rt+1);try{Be=$.iri?Ft.toUnicode(Be):Ft.toASCII(de(Be,$).toLowerCase())}catch(Qe){O.error=O.error||"Email address's domain name can not be converted to "+($.iri?"Unicode":"ASCII")+" via punycode: "+Qe}R[Q]=qt+"@"+Be}O.path=R.join(",")}var Tt=_.headers=_.headers||{};_.subject&&(Tt.subject=_.subject),_.body&&(Tt.body=_.body);var Bt=[];for(var xt in Tt)Tt[xt]!==Fs[xt]&&Bt.push(xt.replace(wl,k_).replace(wl,i).replace(pE,Br)+"="+Tt[xt].replace(wl,k_).replace(wl,i).replace(H2,Br));return Bt.length&&(O.query=Bt.join("&")),O}},X2=/^([^\:]+)\:(.*)/,hE={scheme:"urn",parse:function(_,$){var O=_.path&&_.path.match(X2),R=_;if(O){var Q=$.scheme||R.scheme||"urn",Ae=O[1].toLowerCase(),He=O[2],rt=Q+":"+($.nid||Ae),qt=Vt[rt];R.nid=Ae,R.nss=He,R.path=void 0,qt&&(R=qt.parse(R,$))}else R.error=R.error||"URN can not be parsed.";return R},serialize:function(_,$){var O=$.scheme||_.scheme||"urn",R=_.nid,Q=O+":"+($.nid||R),Ae=Vt[Q];Ae&&(_=Ae.serialize(_,$));var He=_,rt=_.nss;return He.path=(R||$.nid)+":"+rt,He}},K2=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,gE={scheme:"urn:uuid",parse:function(_,$){var O=_;return O.uuid=O.nss,O.nss=void 0,!$.tolerant&&(!O.uuid||!O.uuid.match(K2))&&(O.error=O.error||"UUID is not valid."),O},serialize:function(_,$){var O=_;return O.nss=(_.uuid||"").toLowerCase(),O}};Vt[Te.scheme]=Te,Vt[tt.scheme]=tt,Vt[sn.scheme]=sn,Vt[Sn.scheme]=Sn,Vt[mE.scheme]=mE,Vt[hE.scheme]=hE,Vt[gE.scheme]=gE,t.SCHEMES=Vt,t.pctEncChar=Br,t.pctDecChars=Wn,t.parse=xn,t.removeDotSegments=Do,t.serialize=kn,t.resolveComponents=Vm,t.resolve=w_,t.normalize=x_,t.equal=D,t.escapeComponent=q,t.unescapeComponent=de,Object.defineProperty(t,"__esModule",{value:!0})}))});var XN=N(k$=>{"use strict";Object.defineProperty(k$,"__esModule",{value:!0});var HN=GN();HN.code='require("ajv/dist/runtime/uri").default';k$.default=HN});var nM=N(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.CodeGen=br.Name=br.nil=br.stringify=br.str=br._=br.KeywordCxt=void 0;var KX=Np();Object.defineProperty(br,"KeywordCxt",{enumerable:!0,get:function(){return KX.KeywordCxt}});var Du=Re();Object.defineProperty(br,"_",{enumerable:!0,get:function(){return Du._}});Object.defineProperty(br,"str",{enumerable:!0,get:function(){return Du.str}});Object.defineProperty(br,"stringify",{enumerable:!0,get:function(){return Du.stringify}});Object.defineProperty(br,"nil",{enumerable:!0,get:function(){return Du.nil}});Object.defineProperty(br,"Name",{enumerable:!0,get:function(){return Du.Name}});Object.defineProperty(br,"CodeGen",{enumerable:!0,get:function(){return Du.CodeGen}});var JX=qy(),eM=By(),YX=i$(),Mp=Gy(),QX=Re(),jp=zp(),Xy=Cp(),$$=Ye(),KN=BN(),eK=XN(),tM=(t,e)=>new RegExp(t,e);tM.code="new RegExp";var tK=["removeAdditional","useDefaults","coerceTypes"],rK=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),nK={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."},iK={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},JN=200;function oK(t){var e,r,n,i,o,s,a,l,c,u,d,p,f,m,h,y,g,b,v,C,E,T,F,le,ee;let I=t.strict,ce=(e=t.code)===null||e===void 0?void 0:e.optimize,be=ce===!0||ce===void 0?1:ce||0,J=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:tM,pe=(i=t.uriResolver)!==null&&i!==void 0?i:eK.default;return{strictSchema:(s=(o=t.strictSchema)!==null&&o!==void 0?o:I)!==null&&s!==void 0?s:!0,strictNumbers:(l=(a=t.strictNumbers)!==null&&a!==void 0?a:I)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=t.strictTypes)!==null&&c!==void 0?c:I)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:I)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:I)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:be,regExp:J}:{optimize:be,regExp:J},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:JN,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:JN,meta:(g=t.meta)!==null&&g!==void 0?g:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(C=t.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(E=t.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(T=t.validateSchema)!==null&&T!==void 0?T:!0,validateFormats:(F=t.validateFormats)!==null&&F!==void 0?F:!0,unicodeRegExp:(le=t.unicodeRegExp)!==null&&le!==void 0?le:!0,int32range:(ee=t.int32range)!==null&&ee!==void 0?ee:!0,uriResolver:pe}}var Dp=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...oK(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new QX.ValueScope({scope:{},prefixes:rK,es5:r,lines:n}),this.logger=dK(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,YX.getRules)(),YN.call(this,nK,e,"NOT SUPPORTED"),YN.call(this,iK,e,"DEPRECATED","warn"),this._metaOpts=cK.call(this),e.formats&&aK.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&lK.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),sK.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=KN;n==="id"&&(i={...KN},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,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,e,r);async function i(u,d){await o.call(this,u.$schema);let p=this._addSchema(u,d);return p.validate||s.call(this,p)}async function o(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof eM.default))throw d;return a.call(this,d),await l.call(this,d.missingSchema),s.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function l(u){let d=await c.call(this,u);this.refs[u]||await o.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,i);return this}let o;if(typeof e=="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,jp.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$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,e);if(!i&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return i}getSchema(e){let r;for(;typeof(r=QN.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new Mp.SchemaEnv({schema:{},schemaId:n});if(r=Mp.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=QN.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,jp.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,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(pK.call(this,n,r),!r)return(0,$$.eachItem)(n,o=>S$.call(this,o)),this;hK.call(this,r);let i={...r,type:(0,Xy.getJSONTypes)(r.type),schemaType:(0,Xy.getJSONTypes)(r.schemaType)};return(0,$$.eachItem)(n,i.type.length===0?o=>S$.call(this,o,i):o=>i.type.forEach(s=>S$.call(this,o,i,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(o=>o.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,o)=>i+r+o)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let o=i.split("/").slice(1),s=e;for(let a of o)s=s[a];for(let a in n){let l=n[a];if(typeof l!="object")continue;let{$data:c}=l.definition,u=s[a];c&&u&&(s[a]=rM(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(l!==void 0)return l;n=(0,jp.normalizeId)(s||n);let c=jp.getSchemaRefs.call(this,e,n);return l=new Mp.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:c}),this._cache.set(l.schema,l),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=l),i&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Mp.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Mp.compileSchema.call(this,e)}finally{this.opts=r}}};br.default=Dp;Dp.ValidationError=JX.default;Dp.MissingRefError=eM.default;function YN(t,e,r,n="error"){for(let i in t){let o=i;o in e&&this.logger[n](`${r}: option ${i}. ${t[o]}`)}}function QN(t){return t=(0,jp.normalizeId)(t),this.schemas[t]||this.refs[t]}function sK(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function aK(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function lK(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function cK(){let t={...this.opts};for(let e of tK)delete t[e];return t}var uK={log(){},warn(){},error(){}};function dK(t){if(t===!1)return uK;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var fK=/^[a-z_$][a-z0-9_$:-]*$/i;function pK(t,e){let{RULES:r}=this;if((0,$$.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!fK.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function S$(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=i?o.post:o.rules.find(({type:l})=>l===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,Xy.getJSONTypes)(e.type),schemaType:(0,Xy.getJSONTypes)(e.schemaType)}};e.before?mK.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(l=>this.addKeyword(l))}function mK(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function hK(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=rM(e)),t.validateSchema=this.compile(e,!0))}var gK={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function rM(t){return{anyOf:[t,gK]}}});var iM=N(I$=>{"use strict";Object.defineProperty(I$,"__esModule",{value:!0});var yK={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};I$.default=yK});var lM=N(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.callRef=Qa.getValidate=void 0;var bK=By(),oM=Dn(),rn=Re(),Lu=Po(),sM=Gy(),Ky=Ye(),_K={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:o,validateName:s,opts:a,self:l}=n,{root:c}=o;if((r==="#"||r==="#/")&&i===c.baseId)return d();let u=sM.resolveRef.call(l,c,i,r);if(u===void 0)throw new bK.default(n.opts.uriResolver,i,r);if(u instanceof sM.SchemaEnv)return p(u);return f(u);function d(){if(o===c)return Jy(t,s,o,o.$async);let m=e.scopeValue("root",{ref:c});return Jy(t,(0,rn._)`${m}.validate`,c,c.$async)}function p(m){let h=aM(t,m);Jy(t,h,m,m.$async)}function f(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,rn.stringify)(m)}:{ref:m}),y=e.name("valid"),g=t.subschema({schema:m,dataTypes:[],schemaPath:rn.nil,topSchemaRef:h,errSchemaPath:r},y);t.mergeEvaluated(g),t.ok(y)}}};function aM(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,rn._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Qa.getValidate=aM;function Jy(t,e,r,n){let{gen:i,it:o}=t,{allErrors:s,schemaEnv:a,opts:l}=o,c=l.passContext?Lu.default.this:rn.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,rn._)`await ${(0,oM.callValidateCode)(t,e,c)}`),f(e),s||i.assign(m,!0)},h=>{i.if((0,rn._)`!(${h} instanceof ${o.ValidationError})`,()=>i.throw(h)),p(h),s||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,oM.callValidateCode)(t,e,c),()=>f(e),()=>p(e))}function p(m){let h=(0,rn._)`${m}.errors`;i.assign(Lu.default.vErrors,(0,rn._)`${Lu.default.vErrors} === null ? ${h} : ${Lu.default.vErrors}.concat(${h})`),i.assign(Lu.default.errors,(0,rn._)`${Lu.default.vErrors}.length`)}function f(m){var h;if(!o.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(o.props=Ky.mergeEvaluated.props(i,y.props,o.props));else{let g=i.var("props",(0,rn._)`${m}.evaluated.props`);o.props=Ky.mergeEvaluated.props(i,g,o.props,rn.Name)}if(o.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(o.items=Ky.mergeEvaluated.items(i,y.items,o.items));else{let g=i.var("items",(0,rn._)`${m}.evaluated.items`);o.items=Ky.mergeEvaluated.items(i,g,o.items,rn.Name)}}}Qa.callRef=Jy;Qa.default=_K});var cM=N(E$=>{"use strict";Object.defineProperty(E$,"__esModule",{value:!0});var vK=iM(),wK=lM(),xK=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",vK.default,wK.default];E$.default=xK});var uM=N(P$=>{"use strict";Object.defineProperty(P$,"__esModule",{value:!0});var Yy=Re(),Cs=Yy.operators,Qy={maximum:{okStr:"<=",ok:Cs.LTE,fail:Cs.GT},minimum:{okStr:">=",ok:Cs.GTE,fail:Cs.LT},exclusiveMaximum:{okStr:"<",ok:Cs.LT,fail:Cs.GTE},exclusiveMinimum:{okStr:">",ok:Cs.GT,fail:Cs.LTE}},kK={message:({keyword:t,schemaCode:e})=>(0,Yy.str)`must be ${Qy[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Yy._)`{comparison: ${Qy[t].okStr}, limit: ${e}}`},SK={keyword:Object.keys(Qy),type:"number",schemaType:"number",$data:!0,error:kK,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Yy._)`${r} ${Qy[e].fail} ${n} || isNaN(${r})`)}};P$.default=SK});var dM=N(T$=>{"use strict";Object.defineProperty(T$,"__esModule",{value:!0});var Lp=Re(),$K={message:({schemaCode:t})=>(0,Lp.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Lp._)`{multipleOf: ${t}}`},IK={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:$K,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,o=i.opts.multipleOfPrecision,s=e.let("res"),a=o?(0,Lp._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,Lp._)`${s} !== parseInt(${s})`;t.fail$data((0,Lp._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};T$.default=IK});var pM=N(A$=>{"use strict";Object.defineProperty(A$,"__esModule",{value:!0});function fM(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}A$.default=fM;fM.code='require("ajv/dist/runtime/ucs2length").default'});var mM=N(C$=>{"use strict";Object.defineProperty(C$,"__esModule",{value:!0});var el=Re(),EK=Ye(),PK=pM(),TK={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,el.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,el._)`{limit: ${t}}`},AK={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:TK,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,o=e==="maxLength"?el.operators.GT:el.operators.LT,s=i.opts.unicode===!1?(0,el._)`${r}.length`:(0,el._)`${(0,EK.useFunc)(t.gen,PK.default)}(${r})`;t.fail$data((0,el._)`${s} ${o} ${n}`)}};C$.default=AK});var hM=N(z$=>{"use strict";Object.defineProperty(z$,"__esModule",{value:!0});var CK=Dn(),eb=Re(),zK={message:({schemaCode:t})=>(0,eb.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,eb._)`{pattern: ${t}}`},OK={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:zK,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:o}=t,s=o.opts.unicodeRegExp?"u":"",a=r?(0,eb._)`(new RegExp(${i}, ${s}))`:(0,CK.usePattern)(t,n);t.fail$data((0,eb._)`!${a}.test(${e})`)}};z$.default=OK});var gM=N(O$=>{"use strict";Object.defineProperty(O$,"__esModule",{value:!0});var Up=Re(),RK={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Up.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Up._)`{limit: ${t}}`},NK={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:RK,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Up.operators.GT:Up.operators.LT;t.fail$data((0,Up._)`Object.keys(${r}).length ${i} ${n}`)}};O$.default=NK});var yM=N(R$=>{"use strict";Object.defineProperty(R$,"__esModule",{value:!0});var Zp=Dn(),Fp=Re(),MK=Ye(),jK={message:({params:{missingProperty:t}})=>(0,Fp.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Fp._)`{missingProperty: ${t}}`},DK={keyword:"required",type:"object",schemaType:"array",$data:!0,error:jK,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:o,it:s}=t,{opts:a}=s;if(!o&&r.length===0)return;let l=r.length>=a.loopRequired;if(s.allErrors?c():u(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(f?.[h]===void 0&&!m.has(h)){let y=s.schemaEnv.baseId+s.errSchemaPath,g=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,MK.checkStrictMode)(s,g,s.opts.strictRequired)}}function c(){if(l||o)t.block$data(Fp.nil,d);else for(let f of r)(0,Zp.checkReportMissingProp)(t,f)}function u(){let f=e.let("missing");if(l||o){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,Zp.checkMissingProp)(t,r,f)),(0,Zp.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0,Zp.noPropertyInData)(e,i,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(m,(0,Zp.propertyInData)(e,i,f,a.ownProperties)),e.if((0,Fp.not)(m),()=>{t.error(),e.break()})},Fp.nil)}}};R$.default=DK});var bM=N(N$=>{"use strict";Object.defineProperty(N$,"__esModule",{value:!0});var Vp=Re(),LK={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Vp.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Vp._)`{limit: ${t}}`},UK={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:LK,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Vp.operators.GT:Vp.operators.LT;t.fail$data((0,Vp._)`${r}.length ${i} ${n}`)}};N$.default=UK});var tb=N(M$=>{"use strict";Object.defineProperty(M$,"__esModule",{value:!0});var _M=rp();_M.code='require("ajv/dist/runtime/equal").default';M$.default=_M});var vM=N(D$=>{"use strict";Object.defineProperty(D$,"__esModule",{value:!0});var j$=Cp(),_r=Re(),ZK=Ye(),FK=tb(),VK={message:({params:{i:t,j:e}})=>(0,_r.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,_r._)`{i: ${t}, j: ${e}}`},qK={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:VK,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:o,schemaCode:s,it:a}=t;if(!n&&!i)return;let l=e.let("valid"),c=o.items?(0,j$.getSchemaTypes)(o.items):[];t.block$data(l,u,(0,_r._)`${s} === false`),t.ok(l);function u(){let m=e.let("i",(0,_r._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(l,!0),e.if((0,_r._)`${m} > 1`,()=>(d()?p:f)(m,h))}function d(){return c.length>0&&!c.some(m=>m==="object"||m==="array")}function p(m,h){let y=e.name("item"),g=(0,j$.checkDataTypes)(c,y,a.opts.strictNumbers,j$.DataType.Wrong),b=e.const("indices",(0,_r._)`{}`);e.for((0,_r._)`;${m}--;`,()=>{e.let(y,(0,_r._)`${r}[${m}]`),e.if(g,(0,_r._)`continue`),c.length>1&&e.if((0,_r._)`typeof ${y} == "string"`,(0,_r._)`${y} += "_"`),e.if((0,_r._)`typeof ${b}[${y}] == "number"`,()=>{e.assign(h,(0,_r._)`${b}[${y}]`),t.error(),e.assign(l,!1).break()}).code((0,_r._)`${b}[${y}] = ${m}`)})}function f(m,h){let y=(0,ZK.useFunc)(e,FK.default),g=e.name("outer");e.label(g).for((0,_r._)`;${m}--;`,()=>e.for((0,_r._)`${h} = ${m}; ${h}--;`,()=>e.if((0,_r._)`${y}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(l,!1).break(g)})))}}};D$.default=qK});var wM=N(U$=>{"use strict";Object.defineProperty(U$,"__esModule",{value:!0});var L$=Re(),BK=Ye(),WK=tb(),GK={message:"must be equal to constant",params:({schemaCode:t})=>(0,L$._)`{allowedValue: ${t}}`},HK={keyword:"const",$data:!0,error:GK,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,L$._)`!${(0,BK.useFunc)(e,WK.default)}(${r}, ${i})`):t.fail((0,L$._)`${o} !== ${r}`)}};U$.default=HK});var xM=N(Z$=>{"use strict";Object.defineProperty(Z$,"__esModule",{value:!0});var qp=Re(),XK=Ye(),KK=tb(),JK={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,qp._)`{allowedValues: ${t}}`},YK={keyword:"enum",schemaType:"array",$data:!0,error:JK,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:o,it:s}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=s.opts.loopEnum,l,c=()=>l??(l=(0,XK.useFunc)(e,KK.default)),u;if(a||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let f=e.const("vSchema",o);u=(0,qp.or)(...i.map((m,h)=>p(f,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",o,f=>e.if((0,qp._)`${c()}(${r}, ${f})`,()=>e.assign(u,!0).break()))}function p(f,m){let h=i[m];return typeof h=="object"&&h!==null?(0,qp._)`${c()}(${r}, ${f}[${m}])`:(0,qp._)`${r} === ${h}`}}};Z$.default=YK});var kM=N(F$=>{"use strict";Object.defineProperty(F$,"__esModule",{value:!0});var QK=uM(),e8=dM(),t8=mM(),r8=hM(),n8=gM(),i8=yM(),o8=bM(),s8=vM(),a8=wM(),l8=xM(),c8=[QK.default,e8.default,t8.default,r8.default,n8.default,i8.default,o8.default,s8.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},a8.default,l8.default];F$.default=c8});var q$=N(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});Bp.validateAdditionalItems=void 0;var tl=Re(),V$=Ye(),u8={message:({params:{len:t}})=>(0,tl.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,tl._)`{limit: ${t}}`},d8={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:u8,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,V$.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}SM(t,n)}};function SM(t,e){let{gen:r,schema:n,data:i,keyword:o,it:s}=t;s.items=!0;let a=r.const("len",(0,tl._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,tl._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,V$.alwaysValidSchema)(s,n)){let c=r.var("valid",(0,tl._)`${a} <= ${e.length}`);r.if((0,tl.not)(c),()=>l(c)),t.ok(c)}function l(c){r.forRange("i",e.length,a,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:V$.Type.Num},c),s.allErrors||r.if((0,tl.not)(c),()=>r.break())})}}Bp.validateAdditionalItems=SM;Bp.default=d8});var B$=N(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});Wp.validateTuple=void 0;var $M=Re(),rb=Ye(),f8=Dn(),p8={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return IM(t,"additionalItems",e);r.items=!0,!(0,rb.alwaysValidSchema)(r,e)&&t.ok((0,f8.validateArray)(t))}};function IM(t,e,r=t.schema){let{gen:n,parentSchema:i,data:o,keyword:s,it:a}=t;u(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=rb.mergeEvaluated.items(n,r.length,a.items));let l=n.name("valid"),c=n.const("len",(0,$M._)`${o}.length`);r.forEach((d,p)=>{(0,rb.alwaysValidSchema)(a,d)||(n.if((0,$M._)`${c} > ${p}`,()=>t.subschema({keyword:s,schemaProp:p,dataProp:p},l)),t.ok(l))});function u(d){let{opts:p,errSchemaPath:f}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!h){let y=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,rb.checkStrictMode)(a,y,p.strictTuples)}}}Wp.validateTuple=IM;Wp.default=p8});var EM=N(W$=>{"use strict";Object.defineProperty(W$,"__esModule",{value:!0});var m8=B$(),h8={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,m8.validateTuple)(t,"items")};W$.default=h8});var TM=N(G$=>{"use strict";Object.defineProperty(G$,"__esModule",{value:!0});var PM=Re(),g8=Ye(),y8=Dn(),b8=q$(),_8={message:({params:{len:t}})=>(0,PM.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,PM._)`{limit: ${t}}`},v8={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:_8,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,g8.alwaysValidSchema)(n,e)&&(i?(0,b8.validateAdditionalItems)(t,i):t.ok((0,y8.validateArray)(t)))}};G$.default=v8});var AM=N(H$=>{"use strict";Object.defineProperty(H$,"__esModule",{value:!0});var Un=Re(),nb=Ye(),w8={message:({params:{min:t,max:e}})=>e===void 0?(0,Un.str)`must contain at least ${t} valid item(s)`:(0,Un.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Un._)`{minContains: ${t}}`:(0,Un._)`{minContains: ${t}, maxContains: ${e}}`},x8={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:w8,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t,s,a,{minContains:l,maxContains:c}=n;o.opts.next?(s=l===void 0?1:l,a=c):s=1;let u=e.const("len",(0,Un._)`${i}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,nb.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,nb.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,nb.alwaysValidSchema)(o,r)){let h=(0,Un._)`${u} >= ${s}`;a!==void 0&&(h=(0,Un._)`${h} && ${u} <= ${a}`),t.pass(h);return}o.items=!0;let d=e.name("valid");a===void 0&&s===1?f(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,Un._)`${i}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let h=e.name("_valid"),y=e.let("count",0);f(h,()=>e.if(h,()=>m(y)))}function f(h,y){e.forRange("i",0,u,g=>{t.subschema({keyword:"contains",dataProp:g,dataPropType:nb.Type.Num,compositeRule:!0},h),y()})}function m(h){e.code((0,Un._)`${h}++`),a===void 0?e.if((0,Un._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,Un._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,Un._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};H$.default=x8});var OM=N(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.validateSchemaDeps=ji.validatePropertyDeps=ji.error=void 0;var X$=Re(),k8=Ye(),Gp=Dn();ji.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,X$.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,X$._)`{property: ${t},
|
|
12
|
+
|| ${s} === "boolean" || ${i} === null`).assign(a,(0,ze._)`[${i}]`)}}}function MH({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,ze._)`${e} !== undefined`,()=>t.assign((0,ze._)`${e}[${r}]`,n))}function s$(t,e,r,n=Ap.Correct){let i=n===Ap.Correct?ze.operators.EQ:ze.operators.NEQ,o;switch(t){case"null":return(0,ze._)`${e} ${i} null`;case"array":o=(0,ze._)`Array.isArray(${e})`;break;case"object":o=(0,ze._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=s((0,ze._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=s();break;default:return(0,ze._)`typeof ${e} ${i} ${t}`}return n===Ap.Correct?o:(0,ze.not)(o);function s(a=ze.nil){return(0,ze.and)((0,ze._)`typeof ${e} == "number"`,a,r?(0,ze._)`isFinite(${e})`:ze.nil)}}yr.checkDataType=s$;function a$(t,e,r,n){if(t.length===1)return s$(t[0],e,r,n);let i,o=(0,mN.toHash)(t);if(o.array&&o.object){let s=(0,ze._)`typeof ${e} != "object"`;i=o.null?s:(0,ze._)`!${e} || ${s}`,delete o.null,delete o.array,delete o.object}else i=ze.nil;o.number&&delete o.integer;for(let s in o)i=(0,ze.and)(i,s$(s,e,r,n));return i}yr.checkDataTypes=a$;var jH={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ze._)`{type: ${t}}`:(0,ze._)`{type: ${e}}`};function l$(t){let e=DH(t);(0,CH.reportError)(e,jH)}yr.reportTypeError=l$;function DH(t){let{gen:e,data:r,schema:n}=t,i=(0,mN.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var bN=N(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});Zy.assignDefaults=void 0;var Nu=Re(),LH=Ye();function UH(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)yN(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,o)=>yN(t,o,i.default))}Zy.assignDefaults=UH;function yN(t,e,r){let{gen:n,compositeRule:i,data:o,opts:s}=t;if(r===void 0)return;let a=(0,Nu._)`${o}${(0,Nu.getProperty)(e)}`;if(i){(0,LH.checkStrictMode)(t,`default is ignored for: ${a}`);return}let l=(0,Nu._)`${a} === undefined`;s.useDefaults==="empty"&&(l=(0,Nu._)`${l} || ${a} === null || ${a} === ""`),n.if(l,(0,Nu._)`${a} = ${(0,Nu.stringify)(r)}`)}});var Ln=N(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.validateUnion=lt.validateArray=lt.usePattern=lt.callValidateCode=lt.schemaProperties=lt.allSchemaProperties=lt.noPropertyInData=lt.propertyInData=lt.isOwnProperty=lt.hasPropFunc=lt.reportMissingProp=lt.checkMissingProp=lt.checkReportMissingProp=void 0;var wt=Re(),c$=Ye(),Ps=Po(),ZH=Ye();function FH(t,e){let{gen:r,data:n,it:i}=t;r.if(d$(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,wt._)`${e}`},!0),t.error()})}lt.checkReportMissingProp=FH;function VH({gen:t,data:e,it:{opts:r}},n,i){return(0,wt.or)(...n.map(o=>(0,wt.and)(d$(t,e,o,r.ownProperties),(0,wt._)`${i} = ${o}`)))}lt.checkMissingProp=VH;function qH(t,e){t.setParams({missingProperty:e},!0),t.error()}lt.reportMissingProp=qH;function _N(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,wt._)`Object.prototype.hasOwnProperty`})}lt.hasPropFunc=_N;function u$(t,e,r){return(0,wt._)`${_N(t)}.call(${e}, ${r})`}lt.isOwnProperty=u$;function BH(t,e,r,n){let i=(0,wt._)`${e}${(0,wt.getProperty)(r)} !== undefined`;return n?(0,wt._)`${i} && ${u$(t,e,r)}`:i}lt.propertyInData=BH;function d$(t,e,r,n){let i=(0,wt._)`${e}${(0,wt.getProperty)(r)} === undefined`;return n?(0,wt.or)(i,(0,wt.not)(u$(t,e,r))):i}lt.noPropertyInData=d$;function vN(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}lt.allSchemaProperties=vN;function WH(t,e){return vN(e).filter(r=>!(0,c$.alwaysValidSchema)(t,e[r]))}lt.schemaProperties=WH;function GH({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:s},a,l,c){let u=c?(0,wt._)`${t}, ${e}, ${n}${i}`:e,d=[[Ps.default.instancePath,(0,wt.strConcat)(Ps.default.instancePath,o)],[Ps.default.parentData,s.parentData],[Ps.default.parentDataProperty,s.parentDataProperty],[Ps.default.rootData,Ps.default.rootData]];s.opts.dynamicRef&&d.push([Ps.default.dynamicAnchors,Ps.default.dynamicAnchors]);let p=(0,wt._)`${u}, ${r.object(...d)}`;return l!==wt.nil?(0,wt._)`${a}.call(${l}, ${p})`:(0,wt._)`${a}(${p})`}lt.callValidateCode=GH;var HH=(0,wt._)`new RegExp`;function XH({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,o=i(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,wt._)`${i.code==="new RegExp"?HH:(0,ZH.useFunc)(t,i)}(${r}, ${n})`})}lt.usePattern=XH;function KH(t){let{gen:e,data:r,keyword:n,it:i}=t,o=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(o,!0),s(()=>e.break()),o;function s(a){let l=e.const("len",(0,wt._)`${r}.length`);e.forRange("i",0,l,c=>{t.subschema({keyword:n,dataProp:c,dataPropType:c$.Type.Num},o),e.if((0,wt.not)(o),a)})}}lt.validateArray=KH;function JH(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,c$.alwaysValidSchema)(i,l))&&!i.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((l,c)=>{let u=t.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);e.assign(s,(0,wt._)`${s} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,wt.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}lt.validateUnion=JH});var kN=N(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.validateKeywordUsage=Ni.validSchemaType=Ni.funcKeywordCode=Ni.macroKeywordCode=void 0;var Fr=Re(),Ja=Po(),YH=Ln(),QH=Tp();function eX(t,e){let{gen:r,keyword:n,schema:i,parentSchema:o,it:s}=t,a=e.macro.call(s.self,i,o,s),l=xN(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let c=r.name("valid");t.subschema({schema:a,schemaPath:Fr.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),t.pass(c,()=>t.error(!0))}Ni.macroKeywordCode=eX;function tX(t,e){var r;let{gen:n,keyword:i,schema:o,parentSchema:s,$data:a,it:l}=t;nX(l,e);let c=!a&&e.compile?e.compile.call(l.self,o,s,l):e.validate,u=xN(n,i,c),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)h(),e.modifying&&wN(t),y(()=>t.error());else{let g=e.async?f():m();e.modifying&&wN(t),y(()=>rX(t,g))}}function f(){let g=n.let("ruleErrs",null);return n.try(()=>h((0,Fr._)`await `),b=>n.assign(d,!1).if((0,Fr._)`${b} instanceof ${l.ValidationError}`,()=>n.assign(g,(0,Fr._)`${b}.errors`),()=>n.throw(b))),g}function m(){let g=(0,Fr._)`${u}.errors`;return n.assign(g,null),h(Fr.nil),g}function h(g=e.async?(0,Fr._)`await `:Fr.nil){let b=l.opts.passContext?Ja.default.this:Ja.default.self,v=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Fr._)`${g}${(0,YH.callValidateCode)(t,u,b,v)}`,e.modifying)}function y(g){var b;n.if((0,Fr.not)((b=e.valid)!==null&&b!==void 0?b:d),g)}}Ni.funcKeywordCode=tX;function wN(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Fr._)`${n.parentData}[${n.parentDataProperty}]`))}function rX(t,e){let{gen:r}=t;r.if((0,Fr._)`Array.isArray(${e})`,()=>{r.assign(Ja.default.vErrors,(0,Fr._)`${Ja.default.vErrors} === null ? ${e} : ${Ja.default.vErrors}.concat(${e})`).assign(Ja.default.errors,(0,Fr._)`${Ja.default.vErrors}.length`),(0,QH.extendErrors)(t)},()=>t.error())}function nX({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function xN(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Fr.stringify)(r)})}function iX(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Ni.validSchemaType=iX;function oX({schema:t,opts:e,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");let s=i.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[o])){let l=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}Ni.validateKeywordUsage=oX});var $N=N(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.extendSubschemaMode=Ts.extendSubschemaData=Ts.getSubschema=void 0;var Mi=Re(),SN=Ye();function sX(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:s}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Mi._)`${t.schemaPath}${(0,Mi.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Mi._)`${t.schemaPath}${(0,Mi.getProperty)(e)}${(0,Mi.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,SN.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}Ts.getSubschema=sX;function aX(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:s}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=e,p=a.let("data",(0,Mi._)`${e.data}${(0,Mi.getProperty)(r)}`,!0);l(p),t.errorPath=(0,Mi.str)`${c}${(0,SN.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Mi._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let c=i instanceof Mi.Name?i:a.let("data",i,!0);l(c),s!==void 0&&(t.propertyName=s)}o&&(t.dataTypes=o);function l(c){t.data=c,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,c]}}Ts.extendSubschemaData=aX;function lX(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}Ts.extendSubschemaMode=lX});var zp=N(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.getSchemaRefs=tn.resolveUrl=tn.normalizeId=tn._getFullPath=tn.getFullPath=tn.inlineRef=void 0;var cX=Ye(),uX=rp(),dX=kk(),fX=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function pX(t,e=!0){return typeof t=="boolean"?!0:e===!0?!f$(t):e?IN(t)<=e:!1}tn.inlineRef=pX;var mX=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function f$(t){for(let e in t){if(mX.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(f$)||typeof r=="object"&&f$(r))return!0}return!1}function IN(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!fX.has(r)&&(typeof t[r]=="object"&&(0,cX.eachItem)(t[r],n=>e+=IN(n)),e===1/0))return 1/0}return e}function EN(t,e="",r){r!==!1&&(e=Mu(e));let n=t.parse(e);return PN(t,n)}tn.getFullPath=EN;function PN(t,e){return t.serialize(e).split("#")[0]+"#"}tn._getFullPath=PN;var hX=/#\/?$/;function Mu(t){return t?t.replace(hX,""):""}tn.normalizeId=Mu;function gX(t,e,r){return r=Mu(r),t.resolve(e,r)}tn.resolveUrl=gX;var yX=/^[a-z_][-a-z0-9._]*$/i;function bX(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=Mu(t[r]||e),o={"":i},s=EN(n,i,!1),a={},l=new Set;return dX(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let h=s+p,y=o[m];typeof d[r]=="string"&&(y=g.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),o[p]=y;function g(v){let C=this.opts.uriResolver.resolve;if(v=Mu(y?C(y,v):v),l.has(v))throw u(v);l.add(v);let E=this.refs[v];return typeof E=="string"&&(E=this.refs[E]),typeof E=="object"?c(d,E.schema,v):v!==Mu(h)&&(v[0]==="#"?(c(d,a[v],v),a[v]=d):this.refs[v]=h),v}function b(v){if(typeof v=="string"){if(!yX.test(v))throw new Error(`invalid anchor "${v}"`);g.call(this,`#${v}`)}}}),a;function c(d,p,f){if(p!==void 0&&!uX(d,p))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}tn.getSchemaRefs=bX});var Np=N(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.getData=As.KeywordCxt=As.validateFunctionCode=void 0;var ON=dN(),TN=Cp(),m$=o$(),Fy=Cp(),_X=bN(),Rp=kN(),p$=$N(),oe=Re(),$e=Po(),vX=zp(),To=Ye(),Op=Tp();function wX(t){if(MN(t)&&(jN(t),NN(t))){SX(t);return}RN(t,()=>(0,ON.topBoolOrEmptySchema)(t))}As.validateFunctionCode=wX;function RN({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},o){i.code.es5?t.func(e,(0,oe._)`${$e.default.data}, ${$e.default.valCxt}`,n.$async,()=>{t.code((0,oe._)`"use strict"; ${AN(r,i)}`),kX(t,i),t.code(o)}):t.func(e,(0,oe._)`${$e.default.data}, ${xX(i)}`,n.$async,()=>t.code(AN(r,i)).code(o))}function xX(t){return(0,oe._)`{${$e.default.instancePath}="", ${$e.default.parentData}, ${$e.default.parentDataProperty}, ${$e.default.rootData}=${$e.default.data}${t.dynamicRef?(0,oe._)`, ${$e.default.dynamicAnchors}={}`:oe.nil}}={}`}function kX(t,e){t.if($e.default.valCxt,()=>{t.var($e.default.instancePath,(0,oe._)`${$e.default.valCxt}.${$e.default.instancePath}`),t.var($e.default.parentData,(0,oe._)`${$e.default.valCxt}.${$e.default.parentData}`),t.var($e.default.parentDataProperty,(0,oe._)`${$e.default.valCxt}.${$e.default.parentDataProperty}`),t.var($e.default.rootData,(0,oe._)`${$e.default.valCxt}.${$e.default.rootData}`),e.dynamicRef&&t.var($e.default.dynamicAnchors,(0,oe._)`${$e.default.valCxt}.${$e.default.dynamicAnchors}`)},()=>{t.var($e.default.instancePath,(0,oe._)`""`),t.var($e.default.parentData,(0,oe._)`undefined`),t.var($e.default.parentDataProperty,(0,oe._)`undefined`),t.var($e.default.rootData,$e.default.data),e.dynamicRef&&t.var($e.default.dynamicAnchors,(0,oe._)`{}`)})}function SX(t){let{schema:e,opts:r,gen:n}=t;RN(t,()=>{r.$comment&&e.$comment&&LN(t),TX(t),n.let($e.default.vErrors,null),n.let($e.default.errors,0),r.unevaluated&&$X(t),DN(t),zX(t)})}function $X(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,oe._)`${r}.evaluated`),e.if((0,oe._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,oe._)`${t.evaluated}.props`,(0,oe._)`undefined`)),e.if((0,oe._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,oe._)`${t.evaluated}.items`,(0,oe._)`undefined`))}function AN(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,oe._)`/*# sourceURL=${r} */`:oe.nil}function IX(t,e){if(MN(t)&&(jN(t),NN(t))){EX(t,e);return}(0,ON.boolOrEmptySchema)(t,e)}function NN({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function MN(t){return typeof t.schema!="boolean"}function EX(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&LN(t),AX(t),CX(t);let o=n.const("_errs",$e.default.errors);DN(t,o),n.var(e,(0,oe._)`${o} === ${$e.default.errors}`)}function jN(t){(0,To.checkUnknownRules)(t),PX(t)}function DN(t,e){if(t.opts.jtd)return CN(t,[],!1,e);let r=(0,TN.getSchemaTypes)(t.schema),n=(0,TN.coerceAndCheckDataType)(t,r);CN(t,r,!n,e)}function PX(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,To.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function TX(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,To.checkStrictMode)(t,"default is ignored in the schema root")}function AX(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,vX.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function CX(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function LN({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let o=r.$comment;if(i.$comment===!0)t.code((0,oe._)`${$e.default.self}.logger.log(${o})`);else if(typeof i.$comment=="function"){let s=(0,oe.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,oe._)`${$e.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function zX(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=t;r.$async?e.if((0,oe._)`${$e.default.errors} === 0`,()=>e.return($e.default.data),()=>e.throw((0,oe._)`new ${i}(${$e.default.vErrors})`)):(e.assign((0,oe._)`${n}.errors`,$e.default.vErrors),o.unevaluated&&OX(t),e.return((0,oe._)`${$e.default.errors} === 0`))}function OX({gen:t,evaluated:e,props:r,items:n}){r instanceof oe.Name&&t.assign((0,oe._)`${e}.props`,r),n instanceof oe.Name&&t.assign((0,oe._)`${e}.items`,n)}function CN(t,e,r,n){let{gen:i,schema:o,data:s,allErrors:a,opts:l,self:c}=t,{RULES:u}=c;if(o.$ref&&(l.ignoreKeywordsWithRef||!(0,To.schemaHasRulesButRef)(o,u))){i.block(()=>ZN(t,"$ref",u.all.$ref.definition));return}l.jtd||RX(t,e),i.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){(0,m$.shouldUseGroup)(o,p)&&(p.type?(i.if((0,Fy.checkDataType)(p.type,s,l.strictNumbers)),zN(t,p),e.length===1&&e[0]===p.type&&r&&(i.else(),(0,Fy.reportTypeError)(t)),i.endIf()):zN(t,p),a||i.if((0,oe._)`${$e.default.errors} === ${n||0}`))}}function zN(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,_X.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,m$.shouldUseRule)(n,o)&&ZN(t,o.keyword,o.definition,e.type)})}function RX(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(NX(t,e),t.opts.allowUnionTypes||MX(t,e),jX(t,t.dataTypes))}function NX(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{UN(t.dataTypes,r)||h$(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),LX(t,e)}}function MX(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&h$(t,"use allowUnionTypes to allow union type keyword")}function jX(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,m$.shouldUseRule)(t.schema,i)){let{type:o}=i.definition;o.length&&!o.some(s=>DX(e,s))&&h$(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function DX(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function UN(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function LX(t,e){let r=[];for(let n of t.dataTypes)UN(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function h$(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,To.checkStrictMode)(t,e,t.opts.strictTypes)}var Vy=class{constructor(e,r,n){if((0,Rp.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,To.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",FN(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Rp.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=e.gen.const("_errs",$e.default.errors))}result(e,r,n){this.failResult((0,oe.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,oe.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,oe._)`${r} !== undefined && (${(0,oe.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Op.reportExtraError:Op.reportError)(this,this.def.error,r)}$dataError(){(0,Op.reportError)(this,this.def.$dataError||Op.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Op.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=oe.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=oe.nil,r=oe.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:o,def:s}=this;n.if((0,oe.or)((0,oe._)`${i} === undefined`,r)),e!==oe.nil&&n.assign(e,!0),(o.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==oe.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:o}=this;return(0,oe.or)(s(),a());function s(){if(n.length){if(!(r instanceof oe.Name))throw new Error("ajv implementation error");let l=Array.isArray(n)?n:[n];return(0,oe._)`${(0,Fy.checkDataTypes)(l,r,o.opts.strictNumbers,Fy.DataType.Wrong)}`}return oe.nil}function a(){if(i.validateSchema){let l=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,oe._)`!${l}(${r})`}return oe.nil}}subschema(e,r){let n=(0,p$.getSubschema)(this.it,e);(0,p$.extendSubschemaData)(n,this.it,e),(0,p$.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return IX(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=To.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=To.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,oe.Name)),!0}};As.KeywordCxt=Vy;function ZN(t,e,r,n){let i=new Vy(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Rp.funcKeywordCode)(i,r):"macro"in r?(0,Rp.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Rp.funcKeywordCode)(i,r)}var UX=/^\/(?:[^~]|~0|~1)*$/,ZX=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function FN(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,o;if(t==="")return $e.default.rootData;if(t[0]==="/"){if(!UX.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,o=$e.default.rootData}else{let c=ZX.exec(t);if(!c)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+c[1];if(i=c[2],i==="#"){if(u>=e)throw new Error(l("property/index",u));return n[e-u]}if(u>e)throw new Error(l("data",u));if(o=r[e-u],!i)return o}let s=o,a=i.split("/");for(let c of a)c&&(o=(0,oe._)`${o}${(0,oe.getProperty)((0,To.unescapeJsonPointer)(c))}`,s=(0,oe._)`${s} && ${o}`);return s;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${e}`}}As.getData=FN});var qy=N(y$=>{"use strict";Object.defineProperty(y$,"__esModule",{value:!0});var g$=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};y$.default=g$});var By=N(v$=>{"use strict";Object.defineProperty(v$,"__esModule",{value:!0});var b$=zp(),_$=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,b$.resolveUrl)(e,r,n),this.missingSchema=(0,b$.normalizeId)((0,b$.getFullPath)(e,this.missingRef))}};v$.default=_$});var Gy=N(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.resolveSchema=Un.getCompilingSchema=Un.resolveRef=Un.compileSchema=Un.SchemaEnv=void 0;var ui=Re(),FX=qy(),Ya=Po(),di=zp(),VN=Ye(),VX=Np(),ju=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,di.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Un.SchemaEnv=ju;function x$(t){let e=qN.call(this,t);if(e)return e;let r=(0,di.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,s=new ui.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o}),a;t.$async&&(a=s.scopeValue("Error",{ref:FX.default,code:(0,ui._)`require("ajv/dist/runtime/validation_error").default`}));let l=s.scopeName("validate");t.validateName=l;let c={gen:s,allErrors:this.opts.allErrors,data:Ya.default.data,parentData:Ya.default.parentData,parentDataProperty:Ya.default.parentDataProperty,dataNames:[Ya.default.data],dataPathArr:[ui.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,ui.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:ui.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ui._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,VX.validateFunctionCode)(c),s.optimize(this.opts.code.optimize);let d=s.toString();u=`${s.scopeRefs(Ya.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let f=new Function(`${Ya.default.self}`,`${Ya.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:l,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=c;f.evaluated={props:m instanceof ui.Name?void 0:m,items:h instanceof ui.Name?void 0:h,dynamicProps:m instanceof ui.Name,dynamicItems:h instanceof ui.Name},f.source&&(f.source.evaluated=(0,ui.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Un.compileSchema=x$;function qX(t,e,r){var n;r=(0,di.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let o=GX.call(this,t,r);if(o===void 0){let s=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(o=new ju({schema:s,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=BX.call(this,o)}Un.resolveRef=qX;function BX(t){return(0,di.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:x$.call(this,t)}function qN(t){for(let e of this._compilations)if(WX(e,t))return e}Un.getCompilingSchema=qN;function WX(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function GX(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Wy.call(this,t,e)}function Wy(t,e){let r=this.opts.uriResolver.parse(e),n=(0,di._getFullPath)(this.opts.uriResolver,r),i=(0,di.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return w$.call(this,r,t);let o=(0,di.normalizeId)(n),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=Wy.call(this,t,s);return typeof a?.schema!="object"?void 0:w$.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||x$.call(this,s),o===(0,di.normalizeId)(e)){let{schema:a}=s,{schemaId:l}=this.opts,c=a[l];return c&&(i=(0,di.resolveUrl)(this.opts.uriResolver,i,c)),new ju({schema:a,schemaId:l,root:t,baseId:i})}return w$.call(this,r,s)}}Un.resolveSchema=Wy;var HX=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function w$(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let l=r[(0,VN.unescapeFragment)(a)];if(l===void 0)return;r=l;let c=typeof r=="object"&&r[this.opts.schemaId];!HX.has(a)&&c&&(e=(0,di.resolveUrl)(this.opts.uriResolver,e,c))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,VN.schemaHasRulesButRef)(r,this.RULES)){let a=(0,di.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=Wy.call(this,n,a)}let{schemaId:s}=this.opts;if(o=o||new ju({schema:r,schemaId:s,root:n,baseId:e}),o.schema!==o.root.schema)return o}});var BN=N((fSe,XX)=>{XX.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 GN=N((Hy,WN)=>{"use strict";(function(t,e){typeof Hy=="object"&&typeof WN<"u"?e(Hy):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(Hy,(function(t){"use strict";function e(){for(var x=arguments.length,_=Array(x),$=0;$<x;$++)_[$]=arguments[$];if(_.length>1){_[0]=_[0].slice(0,-1);for(var O=_.length-1,R=1;R<O;++R)_[R]=_[R].slice(1,-1);return _[O]=_[O].slice(1),_.join("")}else return _[0]}function r(x){return"(?:"+x+")"}function n(x){return x===void 0?"undefined":x===null?"null":Object.prototype.toString.call(x).split(" ").pop().split("]").shift().toLowerCase()}function i(x){return x.toUpperCase()}function o(x){return x!=null?x instanceof Array?x:typeof x.length!="number"||x.split||x.setInterval||x.call?[x]:Array.prototype.slice.call(x):[]}function s(x,_){var $=x;if(_)for(var O in _)$[O]=_[O];return $}function a(x){var _="[A-Za-z]",$="[\\x0D]",O="[0-9]",R="[\\x22]",Q=e(O,"[A-Fa-f]"),Ae="[\\x0A]",He="[\\x20]",rt=r(r("%[EFef]"+Q+"%"+Q+Q+"%"+Q+Q)+"|"+r("%[89A-Fa-f]"+Q+"%"+Q+Q)+"|"+r("%"+Q+Q)),qt="[\\:\\/\\?\\#\\[\\]\\@]",Be="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Tt=e(qt,Be),Bt=x?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",xt=x?"[\\uE000-\\uF8FF]":"[]",Qe=e(_,O,"[\\-\\.\\_\\~]",Bt),At=r(_+e(_,O,"[\\+\\-\\.]")+"*"),ot=r(r(rt+"|"+e(Qe,Be,"[\\:]"))+"*"),qs=r(r("25[0-5]")+"|"+r("2[0-4]"+O)+"|"+r("1"+O+O)+"|"+r("[1-9]"+O)+"|"+O),an=r(r("25[0-5]")+"|"+r("2[0-4]"+O)+"|"+r("1"+O+O)+"|"+r("0?[1-9]"+O)+"|0?0?"+O),In=r(an+"\\."+an+"\\."+an+"\\."+an),ut=r(Q+"{1,4}"),ln=r(r(ut+"\\:"+ut)+"|"+In),En=r(r(ut+"\\:")+"{6}"+ln),gi=r("\\:\\:"+r(ut+"\\:")+"{5}"+ln),Bs=r(r(ut)+"?\\:\\:"+r(ut+"\\:")+"{4}"+ln),Gi=r(r(r(ut+"\\:")+"{0,1}"+ut)+"?\\:\\:"+r(ut+"\\:")+"{3}"+ln),dd=r(r(r(ut+"\\:")+"{0,2}"+ut)+"?\\:\\:"+r(ut+"\\:")+"{2}"+ln),qm=r(r(r(ut+"\\:")+"{0,3}"+ut)+"?\\:\\:"+ut+"\\:"+ln),Bm=r(r(r(ut+"\\:")+"{0,4}"+ut)+"?\\:\\:"+ln),xl=r(r(r(ut+"\\:")+"{0,5}"+ut)+"?\\:\\:"+ut),kl=r(r(r(ut+"\\:")+"{0,6}"+ut)+"?\\:\\:"),Hi=r([En,gi,Bs,Gi,dd,qm,Bm,xl,kl].join("|")),Sl=r(r(Qe+"|"+rt)+"+"),S_=r(Hi+"\\%25"+Sl),Ws=r(Hi+r("\\%25|\\%(?!"+Q+"{2})")+Sl),J2=r("[vV]"+Q+"+\\."+e(Qe,Be,"[\\:]")+"+"),Y2=r("\\["+r(Ws+"|"+Hi+"|"+J2)+"\\]"),yE=r(r(rt+"|"+e(Qe,Be))+"*"),fd=r(Y2+"|"+In+"(?!"+yE+")|"+yE),pd=r(O+"*"),bE=r(r(ot+"@")+"?"+fd+r("\\:"+pd)+"?"),md=r(rt+"|"+e(Qe,Be,"[\\:\\@]")),Q2=r(md+"*"),_E=r(md+"+"),eL=r(r(rt+"|"+e(Qe,Be,"[\\@]"))+"+"),Xi=r(r("\\/"+Q2)+"*"),$l=r("\\/"+r(_E+Xi)+"?"),$_=r(eL+Xi),Wm=r(_E+Xi),Il="(?!"+md+")",lre=r(Xi+"|"+$l+"|"+$_+"|"+Wm+"|"+Il),El=r(r(md+"|"+e("[\\/\\?]",xt))+"*"),hd=r(r(md+"|[\\/\\?]")+"*"),vE=r(r("\\/\\/"+bE+Xi)+"|"+$l+"|"+Wm+"|"+Il),tL=r(At+"\\:"+vE+r("\\?"+El)+"?"+r("\\#"+hd)+"?"),rL=r(r("\\/\\/"+bE+Xi)+"|"+$l+"|"+$_+"|"+Il),nL=r(rL+r("\\?"+El)+"?"+r("\\#"+hd)+"?"),cre=r(tL+"|"+nL),ure=r(At+"\\:"+vE+r("\\?"+El)+"?"),dre="^("+At+")\\:"+r(r("\\/\\/("+r("("+ot+")@")+"?("+fd+")"+r("\\:("+pd+")")+"?)")+"?("+Xi+"|"+$l+"|"+Wm+"|"+Il+")")+r("\\?("+El+")")+"?"+r("\\#("+hd+")")+"?$",fre="^(){0}"+r(r("\\/\\/("+r("("+ot+")@")+"?("+fd+")"+r("\\:("+pd+")")+"?)")+"?("+Xi+"|"+$l+"|"+$_+"|"+Il+")")+r("\\?("+El+")")+"?"+r("\\#("+hd+")")+"?$",pre="^("+At+")\\:"+r(r("\\/\\/("+r("("+ot+")@")+"?("+fd+")"+r("\\:("+pd+")")+"?)")+"?("+Xi+"|"+$l+"|"+Wm+"|"+Il+")")+r("\\?("+El+")")+"?$",mre="^"+r("\\#("+hd+")")+"?$",hre="^"+r("("+ot+")@")+"?("+fd+")"+r("\\:("+pd+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",_,O,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",Qe,Be),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",Qe,Be),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",Qe,Be),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",Qe,Be),"g"),NOT_QUERY:new RegExp(e("[^\\%]",Qe,Be,"[\\:\\@\\/\\?]",xt),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",Qe,Be,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",Qe,Be),"g"),UNRESERVED:new RegExp(Qe,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",Qe,Tt),"g"),PCT_ENCODED:new RegExp(rt,"g"),IPV4ADDRESS:new RegExp("^("+In+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Hi+")"+r(r("\\%25|\\%(?!"+Q+"{2})")+"("+Sl+")")+"?\\]?$")}}var l=a(!1),c=a(!0),u=(function(){function x(_,$){var O=[],R=!0,Q=!1,Ae=void 0;try{for(var He=_[Symbol.iterator](),rt;!(R=(rt=He.next()).done)&&(O.push(rt.value),!($&&O.length===$));R=!0);}catch(qt){Q=!0,Ae=qt}finally{try{!R&&He.return&&He.return()}finally{if(Q)throw Ae}}return O}return function(_,$){if(Array.isArray(_))return _;if(Symbol.iterator in Object(_))return x(_,$);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=function(x){if(Array.isArray(x)){for(var _=0,$=Array(x.length);_<x.length;_++)$[_]=x[_];return $}else return Array.from(x)},p=2147483647,f=36,m=1,h=26,y=38,g=700,b=72,v=128,C="-",E=/^xn--/,T=/[^\0-\x7E]/,F=/[\x2E\u3002\uFF0E\uFF61]/g,le={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ee=f-m,I=Math.floor,ce=String.fromCharCode;function be(x){throw new RangeError(le[x])}function J(x,_){for(var $=[],O=x.length;O--;)$[O]=_(x[O]);return $}function pe(x,_){var $=x.split("@"),O="";$.length>1&&(O=$[0]+"@",x=$[1]),x=x.replace(F,".");var R=x.split("."),Q=J(R,_).join(".");return O+Q}function ge(x){for(var _=[],$=0,O=x.length;$<O;){var R=x.charCodeAt($++);if(R>=55296&&R<=56319&&$<O){var Q=x.charCodeAt($++);(Q&64512)==56320?_.push(((R&1023)<<10)+(Q&1023)+65536):(_.push(R),$--)}else _.push(R)}return _}var ct=function(_){return String.fromCodePoint.apply(String,d(_))},yt=function(_){return _-48<10?_-22:_-65<26?_-65:_-97<26?_-97:f},Pt=function(_,$){return _+22+75*(_<26)-(($!=0)<<5)},wr=function(_,$,O){var R=0;for(_=O?I(_/g):_>>1,_+=I(_/$);_>ee*h>>1;R+=f)_=I(_/ee);return I(R+(ee+1)*_/(_+y))},w=function(_){var $=[],O=_.length,R=0,Q=v,Ae=b,He=_.lastIndexOf(C);He<0&&(He=0);for(var rt=0;rt<He;++rt)_.charCodeAt(rt)>=128&&be("not-basic"),$.push(_.charCodeAt(rt));for(var qt=He>0?He+1:0;qt<O;){for(var Be=R,Tt=1,Bt=f;;Bt+=f){qt>=O&&be("invalid-input");var xt=yt(_.charCodeAt(qt++));(xt>=f||xt>I((p-R)/Tt))&&be("overflow"),R+=xt*Tt;var Qe=Bt<=Ae?m:Bt>=Ae+h?h:Bt-Ae;if(xt<Qe)break;var At=f-Qe;Tt>I(p/At)&&be("overflow"),Tt*=At}var ot=$.length+1;Ae=wr(R-Be,ot,Be==0),I(R/ot)>p-Q&&be("overflow"),Q+=I(R/ot),R%=ot,$.splice(R++,0,Q)}return String.fromCodePoint.apply(String,$)},Nr=function(_){var $=[];_=ge(_);var O=_.length,R=v,Q=0,Ae=b,He=!0,rt=!1,qt=void 0;try{for(var Be=_[Symbol.iterator](),Tt;!(He=(Tt=Be.next()).done);He=!0){var Bt=Tt.value;Bt<128&&$.push(ce(Bt))}}catch(Ws){rt=!0,qt=Ws}finally{try{!He&&Be.return&&Be.return()}finally{if(rt)throw qt}}var xt=$.length,Qe=xt;for(xt&&$.push(C);Qe<O;){var At=p,ot=!0,qs=!1,an=void 0;try{for(var In=_[Symbol.iterator](),ut;!(ot=(ut=In.next()).done);ot=!0){var ln=ut.value;ln>=R&&ln<At&&(At=ln)}}catch(Ws){qs=!0,an=Ws}finally{try{!ot&&In.return&&In.return()}finally{if(qs)throw an}}var En=Qe+1;At-R>I((p-Q)/En)&&be("overflow"),Q+=(At-R)*En,R=At;var gi=!0,Bs=!1,Gi=void 0;try{for(var dd=_[Symbol.iterator](),qm;!(gi=(qm=dd.next()).done);gi=!0){var Bm=qm.value;if(Bm<R&&++Q>p&&be("overflow"),Bm==R){for(var xl=Q,kl=f;;kl+=f){var Hi=kl<=Ae?m:kl>=Ae+h?h:kl-Ae;if(xl<Hi)break;var Sl=xl-Hi,S_=f-Hi;$.push(ce(Pt(Hi+Sl%S_,0))),xl=I(Sl/S_)}$.push(ce(Pt(xl,0))),Ae=wr(Q,En,Qe==xt),Q=0,++Qe}}}catch(Ws){Bs=!0,Gi=Ws}finally{try{!gi&&dd.return&&dd.return()}finally{if(Bs)throw Gi}}++Q,++R}return $.join("")},Bn=function(_){return pe(_,function($){return E.test($)?w($.slice(4).toLowerCase()):$})},S=function(_){return pe(_,function($){return T.test($)?"xn--"+Nr($):$})},Ft={version:"2.1.0",ucs2:{decode:ge,encode:ct},decode:w,encode:Nr,toASCII:S,toUnicode:Bn},Vt={};function Br(x){var _=x.charCodeAt(0),$=void 0;return _<16?$="%0"+_.toString(16).toUpperCase():_<128?$="%"+_.toString(16).toUpperCase():_<2048?$="%"+(_>>6|192).toString(16).toUpperCase()+"%"+(_&63|128).toString(16).toUpperCase():$="%"+(_>>12|224).toString(16).toUpperCase()+"%"+(_>>6&63|128).toString(16).toUpperCase()+"%"+(_&63|128).toString(16).toUpperCase(),$}function Wn(x){for(var _="",$=0,O=x.length;$<O;){var R=parseInt(x.substr($+1,2),16);if(R<128)_+=String.fromCharCode(R),$+=3;else if(R>=194&&R<224){if(O-$>=6){var Q=parseInt(x.substr($+4,2),16);_+=String.fromCharCode((R&31)<<6|Q&63)}else _+=x.substr($,6);$+=6}else if(R>=224){if(O-$>=9){var Ae=parseInt(x.substr($+4,2),16),He=parseInt(x.substr($+7,2),16);_+=String.fromCharCode((R&15)<<12|(Ae&63)<<6|He&63)}else _+=x.substr($,9);$+=9}else _+=x.substr($,3),$+=3}return _}function Mt(x,_){function $(O){var R=Wn(O);return R.match(_.UNRESERVED)?R:O}return x.scheme&&(x.scheme=String(x.scheme).replace(_.PCT_ENCODED,$).toLowerCase().replace(_.NOT_SCHEME,"")),x.userinfo!==void 0&&(x.userinfo=String(x.userinfo).replace(_.PCT_ENCODED,$).replace(_.NOT_USERINFO,Br).replace(_.PCT_ENCODED,i)),x.host!==void 0&&(x.host=String(x.host).replace(_.PCT_ENCODED,$).toLowerCase().replace(_.NOT_HOST,Br).replace(_.PCT_ENCODED,i)),x.path!==void 0&&(x.path=String(x.path).replace(_.PCT_ENCODED,$).replace(x.scheme?_.NOT_PATH:_.NOT_PATH_NOSCHEME,Br).replace(_.PCT_ENCODED,i)),x.query!==void 0&&(x.query=String(x.query).replace(_.PCT_ENCODED,$).replace(_.NOT_QUERY,Br).replace(_.PCT_ENCODED,i)),x.fragment!==void 0&&(x.fragment=String(x.fragment).replace(_.PCT_ENCODED,$).replace(_.NOT_FRAGMENT,Br).replace(_.PCT_ENCODED,i)),x}function Bi(x){return x.replace(/^0*(.*)/,"$1")||"0"}function Wr(x,_){var $=x.match(_.IPV4ADDRESS)||[],O=u($,2),R=O[1];return R?R.split(".").map(Bi).join("."):x}function Wi(x,_){var $=x.match(_.IPV6ADDRESS)||[],O=u($,3),R=O[1],Q=O[2];if(R){for(var Ae=R.toLowerCase().split("::").reverse(),He=u(Ae,2),rt=He[0],qt=He[1],Be=qt?qt.split(":").map(Bi):[],Tt=rt.split(":").map(Bi),Bt=_.IPV4ADDRESS.test(Tt[Tt.length-1]),xt=Bt?7:8,Qe=Tt.length-xt,At=Array(xt),ot=0;ot<xt;++ot)At[ot]=Be[ot]||Tt[Qe+ot]||"";Bt&&(At[xt-1]=Wr(At[xt-1],_));var qs=At.reduce(function(En,gi,Bs){if(!gi||gi==="0"){var Gi=En[En.length-1];Gi&&Gi.index+Gi.length===Bs?Gi.length++:En.push({index:Bs,length:1})}return En},[]),an=qs.sort(function(En,gi){return gi.length-En.length})[0],In=void 0;if(an&&an.length>1){var ut=At.slice(0,an.index),ln=At.slice(an.index+an.length);In=ut.join(":")+"::"+ln.join(":")}else In=At.join(":");return Q&&(In+="%"+Q),In}else return x}var jo=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ld="".match(/(){0}/)[1]===void 0;function kn(x){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$={},O=_.iri!==!1?c:l;_.reference==="suffix"&&(x=(_.scheme?_.scheme+":":"")+"//"+x);var R=x.match(jo);if(R){ld?($.scheme=R[1],$.userinfo=R[3],$.host=R[4],$.port=parseInt(R[5],10),$.path=R[6]||"",$.query=R[7],$.fragment=R[8],isNaN($.port)&&($.port=R[5])):($.scheme=R[1]||void 0,$.userinfo=x.indexOf("@")!==-1?R[3]:void 0,$.host=x.indexOf("//")!==-1?R[4]:void 0,$.port=parseInt(R[5],10),$.path=R[6]||"",$.query=x.indexOf("?")!==-1?R[7]:void 0,$.fragment=x.indexOf("#")!==-1?R[8]:void 0,isNaN($.port)&&($.port=x.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?R[4]:void 0)),$.host&&($.host=Wi(Wr($.host,O),O)),$.scheme===void 0&&$.userinfo===void 0&&$.host===void 0&&$.port===void 0&&!$.path&&$.query===void 0?$.reference="same-document":$.scheme===void 0?$.reference="relative":$.fragment===void 0?$.reference="absolute":$.reference="uri",_.reference&&_.reference!=="suffix"&&_.reference!==$.reference&&($.error=$.error||"URI is not a "+_.reference+" reference.");var Q=Vt[(_.scheme||$.scheme||"").toLowerCase()];if(!_.unicodeSupport&&(!Q||!Q.unicodeSupport)){if($.host&&(_.domainHost||Q&&Q.domainHost))try{$.host=Ft.toASCII($.host.replace(O.PCT_ENCODED,Wn).toLowerCase())}catch(Ae){$.error=$.error||"Host's domain name can not be converted to ASCII via punycode: "+Ae}Mt($,l)}else Mt($,O);Q&&Q.parse&&Q.parse($,_)}else $.error=$.error||"URI can not be parsed.";return $}function Um(x,_){var $=_.iri!==!1?c:l,O=[];return x.userinfo!==void 0&&(O.push(x.userinfo),O.push("@")),x.host!==void 0&&O.push(Wi(Wr(String(x.host),$),$).replace($.IPV6ADDRESS,function(R,Q,Ae){return"["+Q+(Ae?"%25"+Ae:"")+"]"})),(typeof x.port=="number"||typeof x.port=="string")&&(O.push(":"),O.push(String(x.port))),O.length?O.join(""):void 0}var cd=/^\.\.?\//,Zm=/^\/\.(\/|$)/,ud=/^\/\.\.(\/|$)/,Fm=/^\/?(?:.|\n)*?(?=\/|$)/;function Do(x){for(var _=[];x.length;)if(x.match(cd))x=x.replace(cd,"");else if(x.match(Zm))x=x.replace(Zm,"/");else if(x.match(ud))x=x.replace(ud,"/"),_.pop();else if(x==="."||x==="..")x="";else{var $=x.match(Fm);if($){var O=$[0];x=x.slice(O.length),_.push(O)}else throw new Error("Unexpected dot segment condition")}return _.join("")}function Sn(x){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=_.iri?c:l,O=[],R=Vt[(_.scheme||x.scheme||"").toLowerCase()];if(R&&R.serialize&&R.serialize(x,_),x.host&&!$.IPV6ADDRESS.test(x.host)){if(_.domainHost||R&&R.domainHost)try{x.host=_.iri?Ft.toUnicode(x.host):Ft.toASCII(x.host.replace($.PCT_ENCODED,Wn).toLowerCase())}catch(He){x.error=x.error||"Host's domain name can not be converted to "+(_.iri?"Unicode":"ASCII")+" via punycode: "+He}}Mt(x,$),_.reference!=="suffix"&&x.scheme&&(O.push(x.scheme),O.push(":"));var Q=Um(x,_);if(Q!==void 0&&(_.reference!=="suffix"&&O.push("//"),O.push(Q),x.path&&x.path.charAt(0)!=="/"&&O.push("/")),x.path!==void 0){var Ae=x.path;!_.absolutePath&&(!R||!R.absolutePath)&&(Ae=Do(Ae)),Q===void 0&&(Ae=Ae.replace(/^\/\//,"/%2F")),O.push(Ae)}return x.query!==void 0&&(O.push("?"),O.push(x.query)),x.fragment!==void 0&&(O.push("#"),O.push(x.fragment)),O.join("")}function Vm(x,_){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},O=arguments[3],R={};return O||(x=kn(Sn(x,$),$),_=kn(Sn(_,$),$)),$=$||{},!$.tolerant&&_.scheme?(R.scheme=_.scheme,R.userinfo=_.userinfo,R.host=_.host,R.port=_.port,R.path=Do(_.path||""),R.query=_.query):(_.userinfo!==void 0||_.host!==void 0||_.port!==void 0?(R.userinfo=_.userinfo,R.host=_.host,R.port=_.port,R.path=Do(_.path||""),R.query=_.query):(_.path?(_.path.charAt(0)==="/"?R.path=Do(_.path):((x.userinfo!==void 0||x.host!==void 0||x.port!==void 0)&&!x.path?R.path="/"+_.path:x.path?R.path=x.path.slice(0,x.path.lastIndexOf("/")+1)+_.path:R.path=_.path,R.path=Do(R.path)),R.query=_.query):(R.path=x.path,_.query!==void 0?R.query=_.query:R.query=x.query),R.userinfo=x.userinfo,R.host=x.host,R.port=x.port),R.scheme=x.scheme),R.fragment=_.fragment,R}function w_(x,_,$){var O=s({scheme:"null"},$);return Sn(Vm(kn(x,O),kn(_,O),O,!0),O)}function x_(x,_){return typeof x=="string"?x=Sn(kn(x,_),_):n(x)==="object"&&(x=kn(Sn(x,_),_)),x}function D(x,_,$){return typeof x=="string"?x=Sn(kn(x,$),$):n(x)==="object"&&(x=Sn(x,$)),typeof _=="string"?_=Sn(kn(_,$),$):n(_)==="object"&&(_=Sn(_,$)),x===_}function q(x,_){return x&&x.toString().replace(!_||!_.iri?l.ESCAPE:c.ESCAPE,Br)}function de(x,_){return x&&x.toString().replace(!_||!_.iri?l.PCT_ENCODED:c.PCT_ENCODED,Wn)}var Te={scheme:"http",domainHost:!0,parse:function(_,$){return _.host||(_.error=_.error||"HTTP URIs must have a host."),_},serialize:function(_,$){var O=String(_.scheme).toLowerCase()==="https";return(_.port===(O?443:80)||_.port==="")&&(_.port=void 0),_.path||(_.path="/"),_}},tt={scheme:"https",domainHost:Te.domainHost,parse:Te.parse,serialize:Te.serialize};function Gr(x){return typeof x.secure=="boolean"?x.secure:String(x.scheme).toLowerCase()==="wss"}var sn={scheme:"ws",domainHost:!0,parse:function(_,$){var O=_;return O.secure=Gr(O),O.resourceName=(O.path||"/")+(O.query?"?"+O.query:""),O.path=void 0,O.query=void 0,O},serialize:function(_,$){if((_.port===(Gr(_)?443:80)||_.port==="")&&(_.port=void 0),typeof _.secure=="boolean"&&(_.scheme=_.secure?"wss":"ws",_.secure=void 0),_.resourceName){var O=_.resourceName.split("?"),R=u(O,2),Q=R[0],Ae=R[1];_.path=Q&&Q!=="/"?Q:void 0,_.query=Ae,_.resourceName=void 0}return _.fragment=void 0,_}},$n={scheme:"wss",domainHost:sn.domainHost,parse:sn.parse,serialize:sn.serialize},Fs={},Vs=!0,xr="[A-Za-z0-9\\-\\.\\_\\~"+(Vs?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",sr="[0-9A-Fa-f]",Gn=r(r("%[EFef]"+sr+"%"+sr+sr+"%"+sr+sr)+"|"+r("%[89A-Fa-f]"+sr+"%"+sr+sr)+"|"+r("%"+sr+sr)),F2="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",V2="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",q2=e(V2,'[\\"\\\\]'),B2="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",W2=new RegExp(xr,"g"),wl=new RegExp(Gn,"g"),G2=new RegExp(e("[^]",F2,"[\\.]",'[\\"]',q2),"g"),pE=new RegExp(e("[^]",xr,B2),"g"),H2=pE;function k_(x){var _=Wn(x);return _.match(W2)?_:x}var mE={scheme:"mailto",parse:function(_,$){var O=_,R=O.to=O.path?O.path.split(","):[];if(O.path=void 0,O.query){for(var Q=!1,Ae={},He=O.query.split("&"),rt=0,qt=He.length;rt<qt;++rt){var Be=He[rt].split("=");switch(Be[0]){case"to":for(var Tt=Be[1].split(","),Bt=0,xt=Tt.length;Bt<xt;++Bt)R.push(Tt[Bt]);break;case"subject":O.subject=de(Be[1],$);break;case"body":O.body=de(Be[1],$);break;default:Q=!0,Ae[de(Be[0],$)]=de(Be[1],$);break}}Q&&(O.headers=Ae)}O.query=void 0;for(var Qe=0,At=R.length;Qe<At;++Qe){var ot=R[Qe].split("@");if(ot[0]=de(ot[0]),$.unicodeSupport)ot[1]=de(ot[1],$).toLowerCase();else try{ot[1]=Ft.toASCII(de(ot[1],$).toLowerCase())}catch(qs){O.error=O.error||"Email address's domain name can not be converted to ASCII via punycode: "+qs}R[Qe]=ot.join("@")}return O},serialize:function(_,$){var O=_,R=o(_.to);if(R){for(var Q=0,Ae=R.length;Q<Ae;++Q){var He=String(R[Q]),rt=He.lastIndexOf("@"),qt=He.slice(0,rt).replace(wl,k_).replace(wl,i).replace(G2,Br),Be=He.slice(rt+1);try{Be=$.iri?Ft.toUnicode(Be):Ft.toASCII(de(Be,$).toLowerCase())}catch(Qe){O.error=O.error||"Email address's domain name can not be converted to "+($.iri?"Unicode":"ASCII")+" via punycode: "+Qe}R[Q]=qt+"@"+Be}O.path=R.join(",")}var Tt=_.headers=_.headers||{};_.subject&&(Tt.subject=_.subject),_.body&&(Tt.body=_.body);var Bt=[];for(var xt in Tt)Tt[xt]!==Fs[xt]&&Bt.push(xt.replace(wl,k_).replace(wl,i).replace(pE,Br)+"="+Tt[xt].replace(wl,k_).replace(wl,i).replace(H2,Br));return Bt.length&&(O.query=Bt.join("&")),O}},X2=/^([^\:]+)\:(.*)/,hE={scheme:"urn",parse:function(_,$){var O=_.path&&_.path.match(X2),R=_;if(O){var Q=$.scheme||R.scheme||"urn",Ae=O[1].toLowerCase(),He=O[2],rt=Q+":"+($.nid||Ae),qt=Vt[rt];R.nid=Ae,R.nss=He,R.path=void 0,qt&&(R=qt.parse(R,$))}else R.error=R.error||"URN can not be parsed.";return R},serialize:function(_,$){var O=$.scheme||_.scheme||"urn",R=_.nid,Q=O+":"+($.nid||R),Ae=Vt[Q];Ae&&(_=Ae.serialize(_,$));var He=_,rt=_.nss;return He.path=(R||$.nid)+":"+rt,He}},K2=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,gE={scheme:"urn:uuid",parse:function(_,$){var O=_;return O.uuid=O.nss,O.nss=void 0,!$.tolerant&&(!O.uuid||!O.uuid.match(K2))&&(O.error=O.error||"UUID is not valid."),O},serialize:function(_,$){var O=_;return O.nss=(_.uuid||"").toLowerCase(),O}};Vt[Te.scheme]=Te,Vt[tt.scheme]=tt,Vt[sn.scheme]=sn,Vt[$n.scheme]=$n,Vt[mE.scheme]=mE,Vt[hE.scheme]=hE,Vt[gE.scheme]=gE,t.SCHEMES=Vt,t.pctEncChar=Br,t.pctDecChars=Wn,t.parse=kn,t.removeDotSegments=Do,t.serialize=Sn,t.resolveComponents=Vm,t.resolve=w_,t.normalize=x_,t.equal=D,t.escapeComponent=q,t.unescapeComponent=de,Object.defineProperty(t,"__esModule",{value:!0})}))});var XN=N(k$=>{"use strict";Object.defineProperty(k$,"__esModule",{value:!0});var HN=GN();HN.code='require("ajv/dist/runtime/uri").default';k$.default=HN});var nM=N(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.CodeGen=br.Name=br.nil=br.stringify=br.str=br._=br.KeywordCxt=void 0;var KX=Np();Object.defineProperty(br,"KeywordCxt",{enumerable:!0,get:function(){return KX.KeywordCxt}});var Du=Re();Object.defineProperty(br,"_",{enumerable:!0,get:function(){return Du._}});Object.defineProperty(br,"str",{enumerable:!0,get:function(){return Du.str}});Object.defineProperty(br,"stringify",{enumerable:!0,get:function(){return Du.stringify}});Object.defineProperty(br,"nil",{enumerable:!0,get:function(){return Du.nil}});Object.defineProperty(br,"Name",{enumerable:!0,get:function(){return Du.Name}});Object.defineProperty(br,"CodeGen",{enumerable:!0,get:function(){return Du.CodeGen}});var JX=qy(),eM=By(),YX=i$(),Mp=Gy(),QX=Re(),jp=zp(),Xy=Cp(),$$=Ye(),KN=BN(),eK=XN(),tM=(t,e)=>new RegExp(t,e);tM.code="new RegExp";var tK=["removeAdditional","useDefaults","coerceTypes"],rK=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),nK={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."},iK={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},JN=200;function oK(t){var e,r,n,i,o,s,a,l,c,u,d,p,f,m,h,y,g,b,v,C,E,T,F,le,ee;let I=t.strict,ce=(e=t.code)===null||e===void 0?void 0:e.optimize,be=ce===!0||ce===void 0?1:ce||0,J=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:tM,pe=(i=t.uriResolver)!==null&&i!==void 0?i:eK.default;return{strictSchema:(s=(o=t.strictSchema)!==null&&o!==void 0?o:I)!==null&&s!==void 0?s:!0,strictNumbers:(l=(a=t.strictNumbers)!==null&&a!==void 0?a:I)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=t.strictTypes)!==null&&c!==void 0?c:I)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:I)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:I)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:be,regExp:J}:{optimize:be,regExp:J},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:JN,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:JN,meta:(g=t.meta)!==null&&g!==void 0?g:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(C=t.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(E=t.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(T=t.validateSchema)!==null&&T!==void 0?T:!0,validateFormats:(F=t.validateFormats)!==null&&F!==void 0?F:!0,unicodeRegExp:(le=t.unicodeRegExp)!==null&&le!==void 0?le:!0,int32range:(ee=t.int32range)!==null&&ee!==void 0?ee:!0,uriResolver:pe}}var Dp=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...oK(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new QX.ValueScope({scope:{},prefixes:rK,es5:r,lines:n}),this.logger=dK(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,YX.getRules)(),YN.call(this,nK,e,"NOT SUPPORTED"),YN.call(this,iK,e,"DEPRECATED","warn"),this._metaOpts=cK.call(this),e.formats&&aK.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&lK.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),sK.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=KN;n==="id"&&(i={...KN},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,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,e,r);async function i(u,d){await o.call(this,u.$schema);let p=this._addSchema(u,d);return p.validate||s.call(this,p)}async function o(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof eM.default))throw d;return a.call(this,d),await l.call(this,d.missingSchema),s.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function l(u){let d=await c.call(this,u);this.refs[u]||await o.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,n,i);return this}let o;if(typeof e=="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,jp.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$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,e);if(!i&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return i}getSchema(e){let r;for(;typeof(r=QN.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new Mp.SchemaEnv({schema:{},schemaId:n});if(r=Mp.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=QN.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,jp.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,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(pK.call(this,n,r),!r)return(0,$$.eachItem)(n,o=>S$.call(this,o)),this;hK.call(this,r);let i={...r,type:(0,Xy.getJSONTypes)(r.type),schemaType:(0,Xy.getJSONTypes)(r.schemaType)};return(0,$$.eachItem)(n,i.type.length===0?o=>S$.call(this,o,i):o=>i.type.forEach(s=>S$.call(this,o,i,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(o=>o.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,o)=>i+r+o)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let o=i.split("/").slice(1),s=e;for(let a of o)s=s[a];for(let a in n){let l=n[a];if(typeof l!="object")continue;let{$data:c}=l.definition,u=s[a];c&&u&&(s[a]=rM(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(l!==void 0)return l;n=(0,jp.normalizeId)(s||n);let c=jp.getSchemaRefs.call(this,e,n);return l=new Mp.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:c}),this._cache.set(l.schema,l),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=l),i&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Mp.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Mp.compileSchema.call(this,e)}finally{this.opts=r}}};br.default=Dp;Dp.ValidationError=JX.default;Dp.MissingRefError=eM.default;function YN(t,e,r,n="error"){for(let i in t){let o=i;o in e&&this.logger[n](`${r}: option ${i}. ${t[o]}`)}}function QN(t){return t=(0,jp.normalizeId)(t),this.schemas[t]||this.refs[t]}function sK(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function aK(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function lK(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function cK(){let t={...this.opts};for(let e of tK)delete t[e];return t}var uK={log(){},warn(){},error(){}};function dK(t){if(t===!1)return uK;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var fK=/^[a-z_$][a-z0-9_$:-]*$/i;function pK(t,e){let{RULES:r}=this;if((0,$$.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!fK.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function S$(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=i?o.post:o.rules.find(({type:l})=>l===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,Xy.getJSONTypes)(e.type),schemaType:(0,Xy.getJSONTypes)(e.schemaType)}};e.before?mK.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(l=>this.addKeyword(l))}function mK(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function hK(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=rM(e)),t.validateSchema=this.compile(e,!0))}var gK={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function rM(t){return{anyOf:[t,gK]}}});var iM=N(I$=>{"use strict";Object.defineProperty(I$,"__esModule",{value:!0});var yK={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};I$.default=yK});var lM=N(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.callRef=Qa.getValidate=void 0;var bK=By(),oM=Ln(),rn=Re(),Lu=Po(),sM=Gy(),Ky=Ye(),_K={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:o,validateName:s,opts:a,self:l}=n,{root:c}=o;if((r==="#"||r==="#/")&&i===c.baseId)return d();let u=sM.resolveRef.call(l,c,i,r);if(u===void 0)throw new bK.default(n.opts.uriResolver,i,r);if(u instanceof sM.SchemaEnv)return p(u);return f(u);function d(){if(o===c)return Jy(t,s,o,o.$async);let m=e.scopeValue("root",{ref:c});return Jy(t,(0,rn._)`${m}.validate`,c,c.$async)}function p(m){let h=aM(t,m);Jy(t,h,m,m.$async)}function f(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,rn.stringify)(m)}:{ref:m}),y=e.name("valid"),g=t.subschema({schema:m,dataTypes:[],schemaPath:rn.nil,topSchemaRef:h,errSchemaPath:r},y);t.mergeEvaluated(g),t.ok(y)}}};function aM(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,rn._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Qa.getValidate=aM;function Jy(t,e,r,n){let{gen:i,it:o}=t,{allErrors:s,schemaEnv:a,opts:l}=o,c=l.passContext?Lu.default.this:rn.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,rn._)`await ${(0,oM.callValidateCode)(t,e,c)}`),f(e),s||i.assign(m,!0)},h=>{i.if((0,rn._)`!(${h} instanceof ${o.ValidationError})`,()=>i.throw(h)),p(h),s||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,oM.callValidateCode)(t,e,c),()=>f(e),()=>p(e))}function p(m){let h=(0,rn._)`${m}.errors`;i.assign(Lu.default.vErrors,(0,rn._)`${Lu.default.vErrors} === null ? ${h} : ${Lu.default.vErrors}.concat(${h})`),i.assign(Lu.default.errors,(0,rn._)`${Lu.default.vErrors}.length`)}function f(m){var h;if(!o.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(o.props=Ky.mergeEvaluated.props(i,y.props,o.props));else{let g=i.var("props",(0,rn._)`${m}.evaluated.props`);o.props=Ky.mergeEvaluated.props(i,g,o.props,rn.Name)}if(o.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(o.items=Ky.mergeEvaluated.items(i,y.items,o.items));else{let g=i.var("items",(0,rn._)`${m}.evaluated.items`);o.items=Ky.mergeEvaluated.items(i,g,o.items,rn.Name)}}}Qa.callRef=Jy;Qa.default=_K});var cM=N(E$=>{"use strict";Object.defineProperty(E$,"__esModule",{value:!0});var vK=iM(),wK=lM(),xK=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",vK.default,wK.default];E$.default=xK});var uM=N(P$=>{"use strict";Object.defineProperty(P$,"__esModule",{value:!0});var Yy=Re(),Cs=Yy.operators,Qy={maximum:{okStr:"<=",ok:Cs.LTE,fail:Cs.GT},minimum:{okStr:">=",ok:Cs.GTE,fail:Cs.LT},exclusiveMaximum:{okStr:"<",ok:Cs.LT,fail:Cs.GTE},exclusiveMinimum:{okStr:">",ok:Cs.GT,fail:Cs.LTE}},kK={message:({keyword:t,schemaCode:e})=>(0,Yy.str)`must be ${Qy[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Yy._)`{comparison: ${Qy[t].okStr}, limit: ${e}}`},SK={keyword:Object.keys(Qy),type:"number",schemaType:"number",$data:!0,error:kK,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Yy._)`${r} ${Qy[e].fail} ${n} || isNaN(${r})`)}};P$.default=SK});var dM=N(T$=>{"use strict";Object.defineProperty(T$,"__esModule",{value:!0});var Lp=Re(),$K={message:({schemaCode:t})=>(0,Lp.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Lp._)`{multipleOf: ${t}}`},IK={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:$K,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,o=i.opts.multipleOfPrecision,s=e.let("res"),a=o?(0,Lp._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,Lp._)`${s} !== parseInt(${s})`;t.fail$data((0,Lp._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};T$.default=IK});var pM=N(A$=>{"use strict";Object.defineProperty(A$,"__esModule",{value:!0});function fM(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}A$.default=fM;fM.code='require("ajv/dist/runtime/ucs2length").default'});var mM=N(C$=>{"use strict";Object.defineProperty(C$,"__esModule",{value:!0});var el=Re(),EK=Ye(),PK=pM(),TK={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,el.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,el._)`{limit: ${t}}`},AK={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:TK,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,o=e==="maxLength"?el.operators.GT:el.operators.LT,s=i.opts.unicode===!1?(0,el._)`${r}.length`:(0,el._)`${(0,EK.useFunc)(t.gen,PK.default)}(${r})`;t.fail$data((0,el._)`${s} ${o} ${n}`)}};C$.default=AK});var hM=N(z$=>{"use strict";Object.defineProperty(z$,"__esModule",{value:!0});var CK=Ln(),eb=Re(),zK={message:({schemaCode:t})=>(0,eb.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,eb._)`{pattern: ${t}}`},OK={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:zK,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:o}=t,s=o.opts.unicodeRegExp?"u":"",a=r?(0,eb._)`(new RegExp(${i}, ${s}))`:(0,CK.usePattern)(t,n);t.fail$data((0,eb._)`!${a}.test(${e})`)}};z$.default=OK});var gM=N(O$=>{"use strict";Object.defineProperty(O$,"__esModule",{value:!0});var Up=Re(),RK={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Up.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Up._)`{limit: ${t}}`},NK={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:RK,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Up.operators.GT:Up.operators.LT;t.fail$data((0,Up._)`Object.keys(${r}).length ${i} ${n}`)}};O$.default=NK});var yM=N(R$=>{"use strict";Object.defineProperty(R$,"__esModule",{value:!0});var Zp=Ln(),Fp=Re(),MK=Ye(),jK={message:({params:{missingProperty:t}})=>(0,Fp.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Fp._)`{missingProperty: ${t}}`},DK={keyword:"required",type:"object",schemaType:"array",$data:!0,error:jK,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:o,it:s}=t,{opts:a}=s;if(!o&&r.length===0)return;let l=r.length>=a.loopRequired;if(s.allErrors?c():u(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(f?.[h]===void 0&&!m.has(h)){let y=s.schemaEnv.baseId+s.errSchemaPath,g=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,MK.checkStrictMode)(s,g,s.opts.strictRequired)}}function c(){if(l||o)t.block$data(Fp.nil,d);else for(let f of r)(0,Zp.checkReportMissingProp)(t,f)}function u(){let f=e.let("missing");if(l||o){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,Zp.checkMissingProp)(t,r,f)),(0,Zp.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0,Zp.noPropertyInData)(e,i,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(m,(0,Zp.propertyInData)(e,i,f,a.ownProperties)),e.if((0,Fp.not)(m),()=>{t.error(),e.break()})},Fp.nil)}}};R$.default=DK});var bM=N(N$=>{"use strict";Object.defineProperty(N$,"__esModule",{value:!0});var Vp=Re(),LK={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Vp.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Vp._)`{limit: ${t}}`},UK={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:LK,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Vp.operators.GT:Vp.operators.LT;t.fail$data((0,Vp._)`${r}.length ${i} ${n}`)}};N$.default=UK});var tb=N(M$=>{"use strict";Object.defineProperty(M$,"__esModule",{value:!0});var _M=rp();_M.code='require("ajv/dist/runtime/equal").default';M$.default=_M});var vM=N(D$=>{"use strict";Object.defineProperty(D$,"__esModule",{value:!0});var j$=Cp(),_r=Re(),ZK=Ye(),FK=tb(),VK={message:({params:{i:t,j:e}})=>(0,_r.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,_r._)`{i: ${t}, j: ${e}}`},qK={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:VK,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:o,schemaCode:s,it:a}=t;if(!n&&!i)return;let l=e.let("valid"),c=o.items?(0,j$.getSchemaTypes)(o.items):[];t.block$data(l,u,(0,_r._)`${s} === false`),t.ok(l);function u(){let m=e.let("i",(0,_r._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(l,!0),e.if((0,_r._)`${m} > 1`,()=>(d()?p:f)(m,h))}function d(){return c.length>0&&!c.some(m=>m==="object"||m==="array")}function p(m,h){let y=e.name("item"),g=(0,j$.checkDataTypes)(c,y,a.opts.strictNumbers,j$.DataType.Wrong),b=e.const("indices",(0,_r._)`{}`);e.for((0,_r._)`;${m}--;`,()=>{e.let(y,(0,_r._)`${r}[${m}]`),e.if(g,(0,_r._)`continue`),c.length>1&&e.if((0,_r._)`typeof ${y} == "string"`,(0,_r._)`${y} += "_"`),e.if((0,_r._)`typeof ${b}[${y}] == "number"`,()=>{e.assign(h,(0,_r._)`${b}[${y}]`),t.error(),e.assign(l,!1).break()}).code((0,_r._)`${b}[${y}] = ${m}`)})}function f(m,h){let y=(0,ZK.useFunc)(e,FK.default),g=e.name("outer");e.label(g).for((0,_r._)`;${m}--;`,()=>e.for((0,_r._)`${h} = ${m}; ${h}--;`,()=>e.if((0,_r._)`${y}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(l,!1).break(g)})))}}};D$.default=qK});var wM=N(U$=>{"use strict";Object.defineProperty(U$,"__esModule",{value:!0});var L$=Re(),BK=Ye(),WK=tb(),GK={message:"must be equal to constant",params:({schemaCode:t})=>(0,L$._)`{allowedValue: ${t}}`},HK={keyword:"const",$data:!0,error:GK,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,L$._)`!${(0,BK.useFunc)(e,WK.default)}(${r}, ${i})`):t.fail((0,L$._)`${o} !== ${r}`)}};U$.default=HK});var xM=N(Z$=>{"use strict";Object.defineProperty(Z$,"__esModule",{value:!0});var qp=Re(),XK=Ye(),KK=tb(),JK={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,qp._)`{allowedValues: ${t}}`},YK={keyword:"enum",schemaType:"array",$data:!0,error:JK,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:o,it:s}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=s.opts.loopEnum,l,c=()=>l??(l=(0,XK.useFunc)(e,KK.default)),u;if(a||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let f=e.const("vSchema",o);u=(0,qp.or)(...i.map((m,h)=>p(f,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",o,f=>e.if((0,qp._)`${c()}(${r}, ${f})`,()=>e.assign(u,!0).break()))}function p(f,m){let h=i[m];return typeof h=="object"&&h!==null?(0,qp._)`${c()}(${r}, ${f}[${m}])`:(0,qp._)`${r} === ${h}`}}};Z$.default=YK});var kM=N(F$=>{"use strict";Object.defineProperty(F$,"__esModule",{value:!0});var QK=uM(),e8=dM(),t8=mM(),r8=hM(),n8=gM(),i8=yM(),o8=bM(),s8=vM(),a8=wM(),l8=xM(),c8=[QK.default,e8.default,t8.default,r8.default,n8.default,i8.default,o8.default,s8.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},a8.default,l8.default];F$.default=c8});var q$=N(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});Bp.validateAdditionalItems=void 0;var tl=Re(),V$=Ye(),u8={message:({params:{len:t}})=>(0,tl.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,tl._)`{limit: ${t}}`},d8={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:u8,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,V$.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}SM(t,n)}};function SM(t,e){let{gen:r,schema:n,data:i,keyword:o,it:s}=t;s.items=!0;let a=r.const("len",(0,tl._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,tl._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,V$.alwaysValidSchema)(s,n)){let c=r.var("valid",(0,tl._)`${a} <= ${e.length}`);r.if((0,tl.not)(c),()=>l(c)),t.ok(c)}function l(c){r.forRange("i",e.length,a,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:V$.Type.Num},c),s.allErrors||r.if((0,tl.not)(c),()=>r.break())})}}Bp.validateAdditionalItems=SM;Bp.default=d8});var B$=N(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});Wp.validateTuple=void 0;var $M=Re(),rb=Ye(),f8=Ln(),p8={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return IM(t,"additionalItems",e);r.items=!0,!(0,rb.alwaysValidSchema)(r,e)&&t.ok((0,f8.validateArray)(t))}};function IM(t,e,r=t.schema){let{gen:n,parentSchema:i,data:o,keyword:s,it:a}=t;u(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=rb.mergeEvaluated.items(n,r.length,a.items));let l=n.name("valid"),c=n.const("len",(0,$M._)`${o}.length`);r.forEach((d,p)=>{(0,rb.alwaysValidSchema)(a,d)||(n.if((0,$M._)`${c} > ${p}`,()=>t.subschema({keyword:s,schemaProp:p,dataProp:p},l)),t.ok(l))});function u(d){let{opts:p,errSchemaPath:f}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!h){let y=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,rb.checkStrictMode)(a,y,p.strictTuples)}}}Wp.validateTuple=IM;Wp.default=p8});var EM=N(W$=>{"use strict";Object.defineProperty(W$,"__esModule",{value:!0});var m8=B$(),h8={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,m8.validateTuple)(t,"items")};W$.default=h8});var TM=N(G$=>{"use strict";Object.defineProperty(G$,"__esModule",{value:!0});var PM=Re(),g8=Ye(),y8=Ln(),b8=q$(),_8={message:({params:{len:t}})=>(0,PM.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,PM._)`{limit: ${t}}`},v8={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:_8,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,g8.alwaysValidSchema)(n,e)&&(i?(0,b8.validateAdditionalItems)(t,i):t.ok((0,y8.validateArray)(t)))}};G$.default=v8});var AM=N(H$=>{"use strict";Object.defineProperty(H$,"__esModule",{value:!0});var Zn=Re(),nb=Ye(),w8={message:({params:{min:t,max:e}})=>e===void 0?(0,Zn.str)`must contain at least ${t} valid item(s)`:(0,Zn.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Zn._)`{minContains: ${t}}`:(0,Zn._)`{minContains: ${t}, maxContains: ${e}}`},x8={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:w8,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t,s,a,{minContains:l,maxContains:c}=n;o.opts.next?(s=l===void 0?1:l,a=c):s=1;let u=e.const("len",(0,Zn._)`${i}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,nb.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,nb.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,nb.alwaysValidSchema)(o,r)){let h=(0,Zn._)`${u} >= ${s}`;a!==void 0&&(h=(0,Zn._)`${h} && ${u} <= ${a}`),t.pass(h);return}o.items=!0;let d=e.name("valid");a===void 0&&s===1?f(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,Zn._)`${i}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let h=e.name("_valid"),y=e.let("count",0);f(h,()=>e.if(h,()=>m(y)))}function f(h,y){e.forRange("i",0,u,g=>{t.subschema({keyword:"contains",dataProp:g,dataPropType:nb.Type.Num,compositeRule:!0},h),y()})}function m(h){e.code((0,Zn._)`${h}++`),a===void 0?e.if((0,Zn._)`${h} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,Zn._)`${h} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,Zn._)`${h} >= ${s}`,()=>e.assign(d,!0)))}}};H$.default=x8});var OM=N(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.validateSchemaDeps=ji.validatePropertyDeps=ji.error=void 0;var X$=Re(),k8=Ye(),Gp=Ln();ji.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,X$.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,X$._)`{property: ${t},
|
|
13
13
|
missingProperty: ${n},
|
|
14
14
|
depsCount: ${e},
|
|
15
|
-
deps: ${r}}`};var S8={keyword:"dependencies",type:"object",schemaType:"object",error:ji.error,code(t){let[e,r]=$8(t);CM(t,e),zM(t,r)}};function $8({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function CM(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let l=(0,Gp.propertyInData)(r,n,s,i.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(l,()=>{for(let c of a)(0,Gp.checkReportMissingProp)(t,c)}):(r.if((0,X$._)`${l} && (${(0,Gp.checkMissingProp)(t,a,o)})`),(0,Gp.reportMissingProp)(t,o),r.else())}}ji.validatePropertyDeps=CM;function zM(t,e=t.schema){let{gen:r,data:n,keyword:i,it:o}=t,s=r.name("valid");for(let a in e)(0,k8.alwaysValidSchema)(o,e[a])||(r.if((0,Gp.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let l=t.subschema({keyword:i,schemaProp:a},s);t.mergeValidEvaluated(l,s)},()=>r.var(s,!0)),t.ok(s))}ji.validateSchemaDeps=zM;ji.default=S8});var NM=N(K$=>{"use strict";Object.defineProperty(K$,"__esModule",{value:!0});var RM=Re(),I8=Ye(),E8={message:"property name must be valid",params:({params:t})=>(0,RM._)`{propertyName: ${t.propertyName}}`},P8={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:E8,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,I8.alwaysValidSchema)(i,r))return;let o=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),e.if((0,RM.not)(o),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(o)}};K$.default=P8});var Y$=N(J$=>{"use strict";Object.defineProperty(J$,"__esModule",{value:!0});var ib=Dn(),fi=Re(),T8=Po(),ob=Ye(),A8={message:"must NOT have additional properties",params:({params:t})=>(0,fi._)`{additionalProperty: ${t.additionalProperty}}`},C8={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:A8,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:l}=s;if(s.props=!0,l.removeAdditional!=="all"&&(0,ob.alwaysValidSchema)(s,r))return;let c=(0,ib.allSchemaProperties)(n.properties),u=(0,ib.allSchemaProperties)(n.patternProperties);d(),t.ok((0,fi._)`${o} === ${T8.default.errors}`);function d(){e.forIn("key",i,y=>{!c.length&&!u.length?m(y):e.if(p(y),()=>m(y))})}function p(y){let g;if(c.length>8){let b=(0,ob.schemaRefOrVal)(s,n.properties,"properties");g=(0,ib.isOwnProperty)(e,b,y)}else c.length?g=(0,fi.or)(...c.map(b=>(0,fi._)`${y} === ${b}`)):g=fi.nil;return u.length&&(g=(0,fi.or)(g,...u.map(b=>(0,fi._)`${(0,ib.usePattern)(t,b)}.test(${y})`))),(0,fi.not)(g)}function f(y){e.code((0,fi._)`delete ${i}[${y}]`)}function m(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){f(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,ob.alwaysValidSchema)(s,r)){let g=e.name("valid");l.removeAdditional==="failing"?(h(y,g,!1),e.if((0,fi.not)(g),()=>{t.reset(),f(y)})):(h(y,g),a||e.if((0,fi.not)(g),()=>e.break()))}}function h(y,g,b){let v={keyword:"additionalProperties",dataProp:y,dataPropType:ob.Type.Str};b===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,g)}}};J$.default=C8});var DM=N(eI=>{"use strict";Object.defineProperty(eI,"__esModule",{value:!0});var z8=Np(),MM=Dn(),Q$=Ye(),jM=Y$(),O8={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&jM.default.code(new z8.KeywordCxt(o,jM.default,"additionalProperties"));let s=(0,MM.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=Q$.mergeEvaluated.props(e,(0,Q$.toHash)(s),o.props));let a=s.filter(d=>!(0,Q$.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let l=e.name("valid");for(let d of a)c(d)?u(d):(e.if((0,MM.propertyInData)(e,i,d,o.opts.ownProperties)),u(d),o.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};eI.default=O8});var FM=N(tI=>{"use strict";Object.defineProperty(tI,"__esModule",{value:!0});var LM=Dn(),sb=Re(),UM=Ye(),ZM=Ye(),R8={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:o}=t,{opts:s}=o,a=(0,LM.allSchemaProperties)(r),l=a.filter(h=>(0,UM.alwaysValidSchema)(o,r[h]));if(a.length===0||l.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let c=s.strictSchema&&!s.allowMatchingProperties&&i.properties,u=e.name("valid");o.props!==!0&&!(o.props instanceof sb.Name)&&(o.props=(0,ZM.evaluatedPropsToName)(e,o.props));let{props:d}=o;p();function p(){for(let h of a)c&&f(h),o.allErrors?m(h):(e.var(u,!0),m(h),e.if(u))}function f(h){for(let y in c)new RegExp(h).test(y)&&(0,UM.checkStrictMode)(o,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,y=>{e.if((0,sb._)`${(0,LM.usePattern)(t,h)}.test(${y})`,()=>{let g=l.includes(h);g||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:ZM.Type.Str},u),o.opts.unevaluated&&d!==!0?e.assign((0,sb._)`${d}[${y}]`,!0):!g&&!o.allErrors&&e.if((0,sb.not)(u),()=>e.break())})})}}};tI.default=R8});var VM=N(rI=>{"use strict";Object.defineProperty(rI,"__esModule",{value:!0});var N8=Ye(),M8={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,N8.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};rI.default=M8});var qM=N(nI=>{"use strict";Object.defineProperty(nI,"__esModule",{value:!0});var j8=Dn(),D8={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:j8.validateUnion,error:{message:"must match a schema in anyOf"}};nI.default=D8});var BM=N(iI=>{"use strict";Object.defineProperty(iI,"__esModule",{value:!0});var ab=Re(),L8=Ye(),U8={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,ab._)`{passingSchemas: ${t.passing}}`},Z8={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:U8,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,s=e.let("valid",!1),a=e.let("passing",null),l=e.name("_valid");t.setParams({passing:a}),e.block(c),t.result(s,()=>t.reset(),()=>t.error(!0));function c(){o.forEach((u,d)=>{let p;(0,L8.alwaysValidSchema)(i,u)?e.var(l,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,ab._)`${l} && ${s}`).assign(s,!1).assign(a,(0,ab._)`[${a}, ${d}]`).else(),e.if(l,()=>{e.assign(s,!0),e.assign(a,d),p&&t.mergeEvaluated(p,ab.Name)})})}}};iI.default=Z8});var WM=N(oI=>{"use strict";Object.defineProperty(oI,"__esModule",{value:!0});var F8=Ye(),V8={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((o,s)=>{if((0,F8.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:s},i);t.ok(i),t.mergeEvaluated(a)})}};oI.default=V8});var XM=N(sI=>{"use strict";Object.defineProperty(sI,"__esModule",{value:!0});var lb=Re(),HM=Ye(),q8={message:({params:t})=>(0,lb.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,lb._)`{failingKeyword: ${t.ifClause}}`},B8={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:q8,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,HM.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=GM(n,"then"),o=GM(n,"else");if(!i&&!o)return;let s=e.let("valid",!0),a=e.name("_valid");if(l(),t.reset(),i&&o){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,c("then",u),c("else",u))}else i?e.if(a,c("then")):e.if((0,lb.not)(a),c("else"));t.pass(s,()=>t.error(!0));function l(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function c(u,d){return()=>{let p=t.subschema({keyword:u},a);e.assign(s,a),t.mergeValidEvaluated(p,s),d?e.assign(d,(0,lb._)`${u}`):t.setParams({ifClause:u})}}}};function GM(t,e){let r=t.schema[e];return r!==void 0&&!(0,HM.alwaysValidSchema)(t,r)}sI.default=B8});var KM=N(aI=>{"use strict";Object.defineProperty(aI,"__esModule",{value:!0});var W8=Ye(),G8={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,W8.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};aI.default=G8});var JM=N(lI=>{"use strict";Object.defineProperty(lI,"__esModule",{value:!0});var H8=q$(),X8=EM(),K8=B$(),J8=TM(),Y8=AM(),Q8=OM(),eJ=NM(),tJ=Y$(),rJ=DM(),nJ=FM(),iJ=VM(),oJ=qM(),sJ=BM(),aJ=WM(),lJ=XM(),cJ=KM();function uJ(t=!1){let e=[iJ.default,oJ.default,sJ.default,aJ.default,lJ.default,cJ.default,eJ.default,tJ.default,Q8.default,rJ.default,nJ.default];return t?e.push(X8.default,J8.default):e.push(H8.default,K8.default),e.push(Y8.default),e}lI.default=uJ});var YM=N(cI=>{"use strict";Object.defineProperty(cI,"__esModule",{value:!0});var Lt=Re(),dJ={message:({schemaCode:t})=>(0,Lt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Lt._)`{format: ${t}}`},fJ={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:dJ,code(t,e){let{gen:r,data:n,$data:i,schema:o,schemaCode:s,it:a}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=a;if(!l.validateFormats)return;i?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),h=r.const("fDef",(0,Lt._)`${m}[${s}]`),y=r.let("fType"),g=r.let("format");r.if((0,Lt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,Lt._)`${h}.type || "string"`).assign(g,(0,Lt._)`${h}.validate`),()=>r.assign(y,(0,Lt._)`"string"`).assign(g,h)),t.fail$data((0,Lt.or)(b(),v()));function b(){return l.strictSchema===!1?Lt.nil:(0,Lt._)`${s} && !${g}`}function v(){let C=u.$async?(0,Lt._)`(${h}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,Lt._)`${g}(${n})`,E=(0,Lt._)`(typeof ${g} == "function" ? ${C} : ${g}.test(${n}))`;return(0,Lt._)`${g} && ${g} !== true && ${y} === ${e} && !${E}`}}function f(){let m=d.formats[o];if(!m){b();return}if(m===!0)return;let[h,y,g]=v(m);h===e&&t.pass(C());function b(){if(l.strictSchema===!1){d.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${o}" ignored in schema at path "${c}"`}}function v(E){let T=E instanceof RegExp?(0,Lt.regexpCode)(E):l.code.formats?(0,Lt._)`${l.code.formats}${(0,Lt.getProperty)(o)}`:void 0,F=r.scopeValue("formats",{key:o,ref:E,code:T});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,Lt._)`${F}.validate`]:["string",E,F]}function C(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Lt._)`await ${g}(${n})`}return typeof y=="function"?(0,Lt._)`${g}(${n})`:(0,Lt._)`${g}.test(${n})`}}}};cI.default=fJ});var QM=N(uI=>{"use strict";Object.defineProperty(uI,"__esModule",{value:!0});var pJ=YM(),mJ=[pJ.default];uI.default=mJ});var ej=N(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.contentVocabulary=Uu.metadataVocabulary=void 0;Uu.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Uu.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var rj=N(dI=>{"use strict";Object.defineProperty(dI,"__esModule",{value:!0});var hJ=cM(),gJ=kM(),yJ=JM(),bJ=QM(),tj=ej(),_J=[hJ.default,gJ.default,(0,yJ.default)(),bJ.default,tj.metadataVocabulary,tj.contentVocabulary];dI.default=_J});var nj=N(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});Hp.DiscrError=void 0;var vJ;(function(t){t.Tag="tag",t.Mapping="mapping"})(vJ=Hp.DiscrError||(Hp.DiscrError={}))});var oj=N(pI=>{"use strict";Object.defineProperty(pI,"__esModule",{value:!0});var Zu=Re(),fI=nj(),ij=Gy(),wJ=Ye(),xJ={message:({params:{discrError:t,tagName:e}})=>t===fI.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Zu._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},kJ={keyword:"discriminator",type:"object",schemaType:"object",error:xJ,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:o}=t,{oneOf:s}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let l=e.let("valid",!1),c=e.const("tag",(0,Zu._)`${r}${(0,Zu.getProperty)(a)}`);e.if((0,Zu._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:fI.DiscrError.Tag,tag:c,tagName:a})),t.ok(l);function u(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,Zu._)`${c} === ${m}`),e.assign(l,d(f[m]));e.else(),t.error(!1,{discrError:fI.DiscrError.Mapping,tag:c,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(h,Zu.Name),m}function p(){var f;let m={},h=g(i),y=!0;for(let C=0;C<s.length;C++){let E=s[C];E?.$ref&&!(0,wJ.schemaHasRulesButRef)(E,o.self.RULES)&&(E=ij.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,E?.$ref),E instanceof ij.SchemaEnv&&(E=E.schema));let T=(f=E?.properties)===null||f===void 0?void 0:f[a];if(typeof T!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||g(E)),b(T,C)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function g({required:C}){return Array.isArray(C)&&C.includes(a)}function b(C,E){if(C.const)v(C.const,E);else if(C.enum)for(let T of C.enum)v(T,E);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(C,E){if(typeof C!="string"||C in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[C]=E}}}};pI.default=kJ});var sj=N((e$e,SJ)=>{SJ.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var cj=N((Ot,lj)=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.MissingRefError=Ot.ValidationError=Ot.CodeGen=Ot.Name=Ot.nil=Ot.stringify=Ot.str=Ot._=Ot.KeywordCxt=void 0;var $J=nM(),IJ=rj(),EJ=oj(),aj=sj(),PJ=["/properties"],cb="http://json-schema.org/draft-07/schema",ub=class extends $J.default{_addVocabularies(){super._addVocabularies(),IJ.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(EJ.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(aj,PJ):aj;this.addMetaSchema(e,cb,!1),this.refs["http://json-schema.org/schema"]=cb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(cb)?cb:void 0)}};lj.exports=Ot=ub;Object.defineProperty(Ot,"__esModule",{value:!0});Ot.default=ub;var TJ=Np();Object.defineProperty(Ot,"KeywordCxt",{enumerable:!0,get:function(){return TJ.KeywordCxt}});var Fu=Re();Object.defineProperty(Ot,"_",{enumerable:!0,get:function(){return Fu._}});Object.defineProperty(Ot,"str",{enumerable:!0,get:function(){return Fu.str}});Object.defineProperty(Ot,"stringify",{enumerable:!0,get:function(){return Fu.stringify}});Object.defineProperty(Ot,"nil",{enumerable:!0,get:function(){return Fu.nil}});Object.defineProperty(Ot,"Name",{enumerable:!0,get:function(){return Fu.Name}});Object.defineProperty(Ot,"CodeGen",{enumerable:!0,get:function(){return Fu.CodeGen}});var AJ=qy();Object.defineProperty(Ot,"ValidationError",{enumerable:!0,get:function(){return AJ.default}});var CJ=By();Object.defineProperty(Ot,"MissingRefError",{enumerable:!0,get:function(){return CJ.default}})});var uj=N(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.formatLimitDefinition=void 0;var zJ=cj(),pi=Re(),zs=pi.operators,db={formatMaximum:{okStr:"<=",ok:zs.LTE,fail:zs.GT},formatMinimum:{okStr:">=",ok:zs.GTE,fail:zs.LT},formatExclusiveMaximum:{okStr:"<",ok:zs.LT,fail:zs.GTE},formatExclusiveMinimum:{okStr:">",ok:zs.GT,fail:zs.LTE}},OJ={message:({keyword:t,schemaCode:e})=>(0,pi.str)`should be ${db[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,pi._)`{comparison: ${db[t].okStr}, limit: ${e}}`};Vu.formatLimitDefinition={keyword:Object.keys(db),type:"string",schemaType:"string",$data:!0,error:OJ,code(t){let{gen:e,data:r,schemaCode:n,keyword:i,it:o}=t,{opts:s,self:a}=o;if(!s.validateFormats)return;let l=new zJ.KeywordCxt(o,a.RULES.all.format.definition,"format");l.$data?c():u();function c(){let p=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),f=e.const("fmt",(0,pi._)`${p}[${l.schemaCode}]`);t.fail$data((0,pi.or)((0,pi._)`typeof ${f} != "object"`,(0,pi._)`${f} instanceof RegExp`,(0,pi._)`typeof ${f}.compare != "function"`,d(f)))}function u(){let p=l.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${i}": format "${p}" does not define "compare" function`);let m=e.scopeValue("formats",{key:p,ref:f,code:s.code.formats?(0,pi._)`${s.code.formats}${(0,pi.getProperty)(p)}`:void 0});t.fail$data(d(m))}function d(p){return(0,pi._)`${p}.compare(${r}, ${n}) ${db[i].fail} 0`}},dependencies:["format"]};var RJ=t=>(t.addKeyword(Vu.formatLimitDefinition),t);Vu.default=RJ});var mj=N((Xp,pj)=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var qu=HR(),NJ=uj(),mI=Re(),dj=new mI.Name("fullFormats"),MJ=new mI.Name("fastFormats"),hI=(t,e={keywords:!0})=>{if(Array.isArray(e))return fj(t,e,qu.fullFormats,dj),t;let[r,n]=e.mode==="fast"?[qu.fastFormats,MJ]:[qu.fullFormats,dj],i=e.formats||qu.formatNames;return fj(t,i,r,n),e.keywords&&(0,NJ.default)(t),t};hI.get=(t,e="full")=>{let n=(e==="fast"?qu.fastFormats:qu.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function fj(t,e,r,n){var i,o;(i=(o=t.opts.code).formats)!==null&&i!==void 0||(o.formats=(0,mI._)`require("ajv-formats/dist/formats").${n}`);for(let s of e)t.addFormat(s,r[s])}pj.exports=Xp=hI;Object.defineProperty(Xp,"__esModule",{value:!0});Xp.default=hI});var P2=N(($je,E2)=>{"use strict";var o_=Object.prototype.hasOwnProperty,I2=Object.prototype.toString,v2=Object.defineProperty,w2=Object.getOwnPropertyDescriptor,x2=function(e){return typeof Array.isArray=="function"?Array.isArray(e):I2.call(e)==="[object Array]"},k2=function(e){if(!e||I2.call(e)!=="[object Object]")return!1;var r=o_.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&o_.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;var i;for(i in e);return typeof i>"u"||o_.call(e,i)},S2=function(e,r){v2&&r.name==="__proto__"?v2(e,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):e[r.name]=r.newValue},$2=function(e,r){if(r==="__proto__")if(o_.call(e,r)){if(w2)return w2(e,r).value}else return;return e[r]};E2.exports=function t(){var e,r,n,i,o,s,a=arguments[0],l=1,c=arguments.length,u=!1;for(typeof a=="boolean"&&(u=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(e=arguments[l],e!=null)for(r in e)n=$2(a,r),i=$2(e,r),a!==i&&(u&&i&&(k2(i)||(o=x2(i)))?(o?(o=!1,s=n&&x2(n)?n:[]):s=n&&k2(n)?n:{},S2(a,{name:r,newValue:t(u,s,i)})):typeof i<"u"&&S2(a,{name:r,newValue:i}));return a}});function se(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function P(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var E_=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return E_=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function yd(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var bd=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var K=class extends Error{},Ht=class t extends K{constructor(e,r,n,i){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=i,this.requestID=i?.get("x-request-id"),this.error=r;let o=r;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,r,n){let i=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,r,n,i){if(!e||!i)return new Lo({message:n,cause:bd(r)});let o=r?.error;return e===400?new Pl(e,o,n,i):e===401?new Tl(e,o,n,i):e===403?new Al(e,o,n,i):e===404?new Cl(e,o,n,i):e===409?new zl(e,o,n,i):e===422?new Ol(e,o,n,i):e===429?new Rl(e,o,n,i):e>=500?new Nl(e,o,n,i):new t(e,o,n,i)}},Wt=class extends Ht{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Lo=class extends Ht{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Uo=class extends Lo{constructor({message:e}={}){super({message:e??"Request timed out."})}},Pl=class extends Ht{},Tl=class extends Ht{},Al=class extends Ht{},Cl=class extends Ht{},zl=class extends Ht{},Ol=class extends Ht{},Rl=class extends Ht{},Nl=class extends Ht{},Ml=class extends K{constructor(){super("Could not parse response content as the length limit was reached")}},jl=class extends K{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},yi=class extends Error{constructor(e){super(e)}};var oL=/^[a-z][a-z0-9+.-]*:/i,wE=t=>oL.test(t),kr=t=>(kr=Array.isArray,kr(t)),P_=kr;function T_(t){return typeof t!="object"?{}:t??{}}function A_(t){if(!t)return!0;for(let e in t)return!1;return!0}function xE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _d(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var kE=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new K(`${t} must be an integer`);if(e<0)throw new K(`${t} must be a positive integer`);return e};var SE=t=>{try{return JSON.parse(t)}catch{return}};var bi=t=>new Promise(e=>setTimeout(e,t));var Zo="6.32.0";var PE=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function sL(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var aL=()=>{let t=sL();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":IE(Deno.build.os),"X-Stainless-Arch":$E(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":IE(globalThis.process.platform??"unknown"),"X-Stainless-Arch":$E(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=lL();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function lL(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let i=n[1]||0,o=n[2]||0,s=n[3]||0;return{browser:e,version:`${i}.${o}.${s}`}}}return null}var $E=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",IE=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),EE,TE=()=>EE??(EE=aL());function AE(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function C_(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function Gm(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return C_({start(){},async pull(r){let{done:n,value:i}=await e.next();n?r.close():r.enqueue(i)},async cancel(){await e.return?.()}})}function z_(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function CE(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var zE=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var O_="RFC3986",R_=t=>String(t),N_={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:R_},OE="RFC1738";var Hm=(t,e)=>(Hm=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Hm(t,e)),_i=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var M_=1024,RE=(t,e,r,n,i)=>{if(t.length===0)return t;let o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),r==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a<o.length;a+=M_){let l=o.length>=M_?o.slice(a,a+M_):o,c=[];for(let u=0;u<l.length;++u){let d=l.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===OE&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=_i[d];continue}if(d<2048){c[c.length]=_i[192|d>>6]+_i[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=_i[224|d>>12]+_i[128|d>>6&63]+_i[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=_i[240|d>>18]+_i[128|d>>12&63]+_i[128|d>>6&63]+_i[128|d&63]}s+=c.join("")}return s};function NE(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function j_(t,e){if(kr(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var jE={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},DE=function(t,e){Array.prototype.push.apply(t,kr(e)?e:[e])},ME,Xt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:RE,encodeValuesOnly:!1,format:O_,formatter:R_,indices:!1,serializeDate(t){return(ME??(ME=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function dL(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var D_={};function LE(t,e,r,n,i,o,s,a,l,c,u,d,p,f,m,h,y,g){let b=t,v=g,C=0,E=!1;for(;(v=v.get(D_))!==void 0&&!E;){let I=v.get(t);if(C+=1,typeof I<"u"){if(I===C)throw new RangeError("Cyclic object value");E=!0}typeof v.get(D_)>"u"&&(C=0)}if(typeof c=="function"?b=c(e,b):b instanceof Date?b=p?.(b):r==="comma"&&kr(b)&&(b=j_(b,function(I){return I instanceof Date?p?.(I):I})),b===null){if(o)return l&&!h?l(e,Xt.encoder,y,"key",f):e;b=""}if(dL(b)||NE(b)){if(l){let I=h?e:l(e,Xt.encoder,y,"key",f);return[m?.(I)+"="+m?.(l(b,Xt.encoder,y,"value",f))]}return[m?.(e)+"="+m?.(String(b))]}let T=[];if(typeof b>"u")return T;let F;if(r==="comma"&&kr(b))h&&l&&(b=j_(b,l)),F=[{value:b.length>0?b.join(",")||null:void 0}];else if(kr(c))F=c;else{let I=Object.keys(b);F=u?I.sort(u):I}let le=a?String(e).replace(/\./g,"%2E"):String(e),ee=n&&kr(b)&&b.length===1?le+"[]":le;if(i&&kr(b)&&b.length===0)return ee+"[]";for(let I=0;I<F.length;++I){let ce=F[I],be=typeof ce=="object"&&typeof ce.value<"u"?ce.value:b[ce];if(s&&be===null)continue;let J=d&&a?ce.replace(/\./g,"%2E"):ce,pe=kr(b)?typeof r=="function"?r(ee,J):ee:ee+(d?"."+J:"["+J+"]");g.set(t,C);let ge=new WeakMap;ge.set(D_,g),DE(T,LE(be,pe,r,n,i,o,s,a,r==="comma"&&h&&kr(b)?null:l,c,u,d,p,f,m,h,y,ge))}return T}function fL(t=Xt){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||Xt.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=O_;if(typeof t.format<"u"){if(!Hm(N_,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=N_[r],i=Xt.filter;(typeof t.filter=="function"||kr(t.filter))&&(i=t.filter);let o;if(t.arrayFormat&&t.arrayFormat in jE?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=Xt.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let s=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:Xt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Xt.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Xt.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Xt.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Xt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Xt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Xt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Xt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Xt.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Xt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Xt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Xt.strictNullHandling}}function UE(t,e={}){let r=t,n=fL(e),i,o;typeof n.filter=="function"?(o=n.filter,r=o("",r)):kr(n.filter)&&(o=n.filter,i=o);let s=[];if(typeof r!="object"||r===null)return"";let a=jE[n.arrayFormat],l=a==="comma"&&n.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);let c=new WeakMap;for(let p=0;p<i.length;++p){let f=i[p];n.skipNulls&&r[f]===null||DE(s,LE(r[f],f,a,l,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,c))}let u=s.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),u.length>0?d+u:""}function ZE(t){return UE(t,{arrayFormat:"brackets"})}function qE(t){let e=0;for(let i of t)e+=i.length;let r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var FE;function Dl(t){let e;return(FE??(e=new globalThis.TextEncoder,FE=e.encode.bind(e)))(t)}var VE;function L_(t){let e;return(VE??(e=new globalThis.TextDecoder,VE=e.decode.bind(e)))(t)}var cn,un,Gs=class{constructor(){cn.set(this,void 0),un.set(this,void 0),se(this,cn,new Uint8Array,"f"),se(this,un,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Dl(e):e;se(this,cn,qE([P(this,cn,"f"),r]),"f");let n=[],i;for(;(i=mL(P(this,cn,"f"),P(this,un,"f")))!=null;){if(i.carriage&&P(this,un,"f")==null){se(this,un,i.index,"f");continue}if(P(this,un,"f")!=null&&(i.index!==P(this,un,"f")+1||i.carriage)){n.push(L_(P(this,cn,"f").subarray(0,P(this,un,"f")-1))),se(this,cn,P(this,cn,"f").subarray(P(this,un,"f")),"f"),se(this,un,null,"f");continue}let o=P(this,un,"f")!==null?i.preceding-1:i.preceding,s=L_(P(this,cn,"f").subarray(0,o));n.push(s),se(this,cn,P(this,cn,"f").subarray(i.index),"f"),se(this,un,null,"f")}return n}flush(){return P(this,cn,"f").length?this.decode(`
|
|
15
|
+
deps: ${r}}`};var S8={keyword:"dependencies",type:"object",schemaType:"object",error:ji.error,code(t){let[e,r]=$8(t);CM(t,e),zM(t,r)}};function $8({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function CM(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let l=(0,Gp.propertyInData)(r,n,s,i.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(l,()=>{for(let c of a)(0,Gp.checkReportMissingProp)(t,c)}):(r.if((0,X$._)`${l} && (${(0,Gp.checkMissingProp)(t,a,o)})`),(0,Gp.reportMissingProp)(t,o),r.else())}}ji.validatePropertyDeps=CM;function zM(t,e=t.schema){let{gen:r,data:n,keyword:i,it:o}=t,s=r.name("valid");for(let a in e)(0,k8.alwaysValidSchema)(o,e[a])||(r.if((0,Gp.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let l=t.subschema({keyword:i,schemaProp:a},s);t.mergeValidEvaluated(l,s)},()=>r.var(s,!0)),t.ok(s))}ji.validateSchemaDeps=zM;ji.default=S8});var NM=N(K$=>{"use strict";Object.defineProperty(K$,"__esModule",{value:!0});var RM=Re(),I8=Ye(),E8={message:"property name must be valid",params:({params:t})=>(0,RM._)`{propertyName: ${t.propertyName}}`},P8={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:E8,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,I8.alwaysValidSchema)(i,r))return;let o=e.name("valid");e.forIn("key",n,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),e.if((0,RM.not)(o),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(o)}};K$.default=P8});var Y$=N(J$=>{"use strict";Object.defineProperty(J$,"__esModule",{value:!0});var ib=Ln(),fi=Re(),T8=Po(),ob=Ye(),A8={message:"must NOT have additional properties",params:({params:t})=>(0,fi._)`{additionalProperty: ${t.additionalProperty}}`},C8={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:A8,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:l}=s;if(s.props=!0,l.removeAdditional!=="all"&&(0,ob.alwaysValidSchema)(s,r))return;let c=(0,ib.allSchemaProperties)(n.properties),u=(0,ib.allSchemaProperties)(n.patternProperties);d(),t.ok((0,fi._)`${o} === ${T8.default.errors}`);function d(){e.forIn("key",i,y=>{!c.length&&!u.length?m(y):e.if(p(y),()=>m(y))})}function p(y){let g;if(c.length>8){let b=(0,ob.schemaRefOrVal)(s,n.properties,"properties");g=(0,ib.isOwnProperty)(e,b,y)}else c.length?g=(0,fi.or)(...c.map(b=>(0,fi._)`${y} === ${b}`)):g=fi.nil;return u.length&&(g=(0,fi.or)(g,...u.map(b=>(0,fi._)`${(0,ib.usePattern)(t,b)}.test(${y})`))),(0,fi.not)(g)}function f(y){e.code((0,fi._)`delete ${i}[${y}]`)}function m(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){f(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,ob.alwaysValidSchema)(s,r)){let g=e.name("valid");l.removeAdditional==="failing"?(h(y,g,!1),e.if((0,fi.not)(g),()=>{t.reset(),f(y)})):(h(y,g),a||e.if((0,fi.not)(g),()=>e.break()))}}function h(y,g,b){let v={keyword:"additionalProperties",dataProp:y,dataPropType:ob.Type.Str};b===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,g)}}};J$.default=C8});var DM=N(eI=>{"use strict";Object.defineProperty(eI,"__esModule",{value:!0});var z8=Np(),MM=Ln(),Q$=Ye(),jM=Y$(),O8={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&jM.default.code(new z8.KeywordCxt(o,jM.default,"additionalProperties"));let s=(0,MM.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=Q$.mergeEvaluated.props(e,(0,Q$.toHash)(s),o.props));let a=s.filter(d=>!(0,Q$.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let l=e.name("valid");for(let d of a)c(d)?u(d):(e.if((0,MM.propertyInData)(e,i,d,o.opts.ownProperties)),u(d),o.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(l);function c(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};eI.default=O8});var FM=N(tI=>{"use strict";Object.defineProperty(tI,"__esModule",{value:!0});var LM=Ln(),sb=Re(),UM=Ye(),ZM=Ye(),R8={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:o}=t,{opts:s}=o,a=(0,LM.allSchemaProperties)(r),l=a.filter(h=>(0,UM.alwaysValidSchema)(o,r[h]));if(a.length===0||l.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let c=s.strictSchema&&!s.allowMatchingProperties&&i.properties,u=e.name("valid");o.props!==!0&&!(o.props instanceof sb.Name)&&(o.props=(0,ZM.evaluatedPropsToName)(e,o.props));let{props:d}=o;p();function p(){for(let h of a)c&&f(h),o.allErrors?m(h):(e.var(u,!0),m(h),e.if(u))}function f(h){for(let y in c)new RegExp(h).test(y)&&(0,UM.checkStrictMode)(o,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,y=>{e.if((0,sb._)`${(0,LM.usePattern)(t,h)}.test(${y})`,()=>{let g=l.includes(h);g||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:ZM.Type.Str},u),o.opts.unevaluated&&d!==!0?e.assign((0,sb._)`${d}[${y}]`,!0):!g&&!o.allErrors&&e.if((0,sb.not)(u),()=>e.break())})})}}};tI.default=R8});var VM=N(rI=>{"use strict";Object.defineProperty(rI,"__esModule",{value:!0});var N8=Ye(),M8={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,N8.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};rI.default=M8});var qM=N(nI=>{"use strict";Object.defineProperty(nI,"__esModule",{value:!0});var j8=Ln(),D8={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:j8.validateUnion,error:{message:"must match a schema in anyOf"}};nI.default=D8});var BM=N(iI=>{"use strict";Object.defineProperty(iI,"__esModule",{value:!0});var ab=Re(),L8=Ye(),U8={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,ab._)`{passingSchemas: ${t.passing}}`},Z8={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:U8,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,s=e.let("valid",!1),a=e.let("passing",null),l=e.name("_valid");t.setParams({passing:a}),e.block(c),t.result(s,()=>t.reset(),()=>t.error(!0));function c(){o.forEach((u,d)=>{let p;(0,L8.alwaysValidSchema)(i,u)?e.var(l,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&e.if((0,ab._)`${l} && ${s}`).assign(s,!1).assign(a,(0,ab._)`[${a}, ${d}]`).else(),e.if(l,()=>{e.assign(s,!0),e.assign(a,d),p&&t.mergeEvaluated(p,ab.Name)})})}}};iI.default=Z8});var WM=N(oI=>{"use strict";Object.defineProperty(oI,"__esModule",{value:!0});var F8=Ye(),V8={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((o,s)=>{if((0,F8.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:s},i);t.ok(i),t.mergeEvaluated(a)})}};oI.default=V8});var XM=N(sI=>{"use strict";Object.defineProperty(sI,"__esModule",{value:!0});var lb=Re(),HM=Ye(),q8={message:({params:t})=>(0,lb.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,lb._)`{failingKeyword: ${t.ifClause}}`},B8={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:q8,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,HM.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=GM(n,"then"),o=GM(n,"else");if(!i&&!o)return;let s=e.let("valid",!0),a=e.name("_valid");if(l(),t.reset(),i&&o){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,c("then",u),c("else",u))}else i?e.if(a,c("then")):e.if((0,lb.not)(a),c("else"));t.pass(s,()=>t.error(!0));function l(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function c(u,d){return()=>{let p=t.subschema({keyword:u},a);e.assign(s,a),t.mergeValidEvaluated(p,s),d?e.assign(d,(0,lb._)`${u}`):t.setParams({ifClause:u})}}}};function GM(t,e){let r=t.schema[e];return r!==void 0&&!(0,HM.alwaysValidSchema)(t,r)}sI.default=B8});var KM=N(aI=>{"use strict";Object.defineProperty(aI,"__esModule",{value:!0});var W8=Ye(),G8={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,W8.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};aI.default=G8});var JM=N(lI=>{"use strict";Object.defineProperty(lI,"__esModule",{value:!0});var H8=q$(),X8=EM(),K8=B$(),J8=TM(),Y8=AM(),Q8=OM(),eJ=NM(),tJ=Y$(),rJ=DM(),nJ=FM(),iJ=VM(),oJ=qM(),sJ=BM(),aJ=WM(),lJ=XM(),cJ=KM();function uJ(t=!1){let e=[iJ.default,oJ.default,sJ.default,aJ.default,lJ.default,cJ.default,eJ.default,tJ.default,Q8.default,rJ.default,nJ.default];return t?e.push(X8.default,J8.default):e.push(H8.default,K8.default),e.push(Y8.default),e}lI.default=uJ});var YM=N(cI=>{"use strict";Object.defineProperty(cI,"__esModule",{value:!0});var Lt=Re(),dJ={message:({schemaCode:t})=>(0,Lt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Lt._)`{format: ${t}}`},fJ={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:dJ,code(t,e){let{gen:r,data:n,$data:i,schema:o,schemaCode:s,it:a}=t,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=a;if(!l.validateFormats)return;i?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),h=r.const("fDef",(0,Lt._)`${m}[${s}]`),y=r.let("fType"),g=r.let("format");r.if((0,Lt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,Lt._)`${h}.type || "string"`).assign(g,(0,Lt._)`${h}.validate`),()=>r.assign(y,(0,Lt._)`"string"`).assign(g,h)),t.fail$data((0,Lt.or)(b(),v()));function b(){return l.strictSchema===!1?Lt.nil:(0,Lt._)`${s} && !${g}`}function v(){let C=u.$async?(0,Lt._)`(${h}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,Lt._)`${g}(${n})`,E=(0,Lt._)`(typeof ${g} == "function" ? ${C} : ${g}.test(${n}))`;return(0,Lt._)`${g} && ${g} !== true && ${y} === ${e} && !${E}`}}function f(){let m=d.formats[o];if(!m){b();return}if(m===!0)return;let[h,y,g]=v(m);h===e&&t.pass(C());function b(){if(l.strictSchema===!1){d.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${o}" ignored in schema at path "${c}"`}}function v(E){let T=E instanceof RegExp?(0,Lt.regexpCode)(E):l.code.formats?(0,Lt._)`${l.code.formats}${(0,Lt.getProperty)(o)}`:void 0,F=r.scopeValue("formats",{key:o,ref:E,code:T});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,Lt._)`${F}.validate`]:["string",E,F]}function C(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Lt._)`await ${g}(${n})`}return typeof y=="function"?(0,Lt._)`${g}(${n})`:(0,Lt._)`${g}.test(${n})`}}}};cI.default=fJ});var QM=N(uI=>{"use strict";Object.defineProperty(uI,"__esModule",{value:!0});var pJ=YM(),mJ=[pJ.default];uI.default=mJ});var ej=N(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.contentVocabulary=Uu.metadataVocabulary=void 0;Uu.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Uu.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var rj=N(dI=>{"use strict";Object.defineProperty(dI,"__esModule",{value:!0});var hJ=cM(),gJ=kM(),yJ=JM(),bJ=QM(),tj=ej(),_J=[hJ.default,gJ.default,(0,yJ.default)(),bJ.default,tj.metadataVocabulary,tj.contentVocabulary];dI.default=_J});var nj=N(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});Hp.DiscrError=void 0;var vJ;(function(t){t.Tag="tag",t.Mapping="mapping"})(vJ=Hp.DiscrError||(Hp.DiscrError={}))});var oj=N(pI=>{"use strict";Object.defineProperty(pI,"__esModule",{value:!0});var Zu=Re(),fI=nj(),ij=Gy(),wJ=Ye(),xJ={message:({params:{discrError:t,tagName:e}})=>t===fI.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Zu._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},kJ={keyword:"discriminator",type:"object",schemaType:"object",error:xJ,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:o}=t,{oneOf:s}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let l=e.let("valid",!1),c=e.const("tag",(0,Zu._)`${r}${(0,Zu.getProperty)(a)}`);e.if((0,Zu._)`typeof ${c} == "string"`,()=>u(),()=>t.error(!1,{discrError:fI.DiscrError.Tag,tag:c,tagName:a})),t.ok(l);function u(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,Zu._)`${c} === ${m}`),e.assign(l,d(f[m]));e.else(),t.error(!1,{discrError:fI.DiscrError.Mapping,tag:c,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(h,Zu.Name),m}function p(){var f;let m={},h=g(i),y=!0;for(let C=0;C<s.length;C++){let E=s[C];E?.$ref&&!(0,wJ.schemaHasRulesButRef)(E,o.self.RULES)&&(E=ij.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,E?.$ref),E instanceof ij.SchemaEnv&&(E=E.schema));let T=(f=E?.properties)===null||f===void 0?void 0:f[a];if(typeof T!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||g(E)),b(T,C)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function g({required:C}){return Array.isArray(C)&&C.includes(a)}function b(C,E){if(C.const)v(C.const,E);else if(C.enum)for(let T of C.enum)v(T,E);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(C,E){if(typeof C!="string"||C in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[C]=E}}}};pI.default=kJ});var sj=N((e$e,SJ)=>{SJ.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var cj=N((Ot,lj)=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.MissingRefError=Ot.ValidationError=Ot.CodeGen=Ot.Name=Ot.nil=Ot.stringify=Ot.str=Ot._=Ot.KeywordCxt=void 0;var $J=nM(),IJ=rj(),EJ=oj(),aj=sj(),PJ=["/properties"],cb="http://json-schema.org/draft-07/schema",ub=class extends $J.default{_addVocabularies(){super._addVocabularies(),IJ.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(EJ.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(aj,PJ):aj;this.addMetaSchema(e,cb,!1),this.refs["http://json-schema.org/schema"]=cb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(cb)?cb:void 0)}};lj.exports=Ot=ub;Object.defineProperty(Ot,"__esModule",{value:!0});Ot.default=ub;var TJ=Np();Object.defineProperty(Ot,"KeywordCxt",{enumerable:!0,get:function(){return TJ.KeywordCxt}});var Fu=Re();Object.defineProperty(Ot,"_",{enumerable:!0,get:function(){return Fu._}});Object.defineProperty(Ot,"str",{enumerable:!0,get:function(){return Fu.str}});Object.defineProperty(Ot,"stringify",{enumerable:!0,get:function(){return Fu.stringify}});Object.defineProperty(Ot,"nil",{enumerable:!0,get:function(){return Fu.nil}});Object.defineProperty(Ot,"Name",{enumerable:!0,get:function(){return Fu.Name}});Object.defineProperty(Ot,"CodeGen",{enumerable:!0,get:function(){return Fu.CodeGen}});var AJ=qy();Object.defineProperty(Ot,"ValidationError",{enumerable:!0,get:function(){return AJ.default}});var CJ=By();Object.defineProperty(Ot,"MissingRefError",{enumerable:!0,get:function(){return CJ.default}})});var uj=N(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.formatLimitDefinition=void 0;var zJ=cj(),pi=Re(),zs=pi.operators,db={formatMaximum:{okStr:"<=",ok:zs.LTE,fail:zs.GT},formatMinimum:{okStr:">=",ok:zs.GTE,fail:zs.LT},formatExclusiveMaximum:{okStr:"<",ok:zs.LT,fail:zs.GTE},formatExclusiveMinimum:{okStr:">",ok:zs.GT,fail:zs.LTE}},OJ={message:({keyword:t,schemaCode:e})=>(0,pi.str)`should be ${db[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,pi._)`{comparison: ${db[t].okStr}, limit: ${e}}`};Vu.formatLimitDefinition={keyword:Object.keys(db),type:"string",schemaType:"string",$data:!0,error:OJ,code(t){let{gen:e,data:r,schemaCode:n,keyword:i,it:o}=t,{opts:s,self:a}=o;if(!s.validateFormats)return;let l=new zJ.KeywordCxt(o,a.RULES.all.format.definition,"format");l.$data?c():u();function c(){let p=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),f=e.const("fmt",(0,pi._)`${p}[${l.schemaCode}]`);t.fail$data((0,pi.or)((0,pi._)`typeof ${f} != "object"`,(0,pi._)`${f} instanceof RegExp`,(0,pi._)`typeof ${f}.compare != "function"`,d(f)))}function u(){let p=l.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${i}": format "${p}" does not define "compare" function`);let m=e.scopeValue("formats",{key:p,ref:f,code:s.code.formats?(0,pi._)`${s.code.formats}${(0,pi.getProperty)(p)}`:void 0});t.fail$data(d(m))}function d(p){return(0,pi._)`${p}.compare(${r}, ${n}) ${db[i].fail} 0`}},dependencies:["format"]};var RJ=t=>(t.addKeyword(Vu.formatLimitDefinition),t);Vu.default=RJ});var mj=N((Xp,pj)=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var qu=HR(),NJ=uj(),mI=Re(),dj=new mI.Name("fullFormats"),MJ=new mI.Name("fastFormats"),hI=(t,e={keywords:!0})=>{if(Array.isArray(e))return fj(t,e,qu.fullFormats,dj),t;let[r,n]=e.mode==="fast"?[qu.fastFormats,MJ]:[qu.fullFormats,dj],i=e.formats||qu.formatNames;return fj(t,i,r,n),e.keywords&&(0,NJ.default)(t),t};hI.get=(t,e="full")=>{let n=(e==="fast"?qu.fastFormats:qu.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function fj(t,e,r,n){var i,o;(i=(o=t.opts.code).formats)!==null&&i!==void 0||(o.formats=(0,mI._)`require("ajv-formats/dist/formats").${n}`);for(let s of e)t.addFormat(s,r[s])}pj.exports=Xp=hI;Object.defineProperty(Xp,"__esModule",{value:!0});Xp.default=hI});var P2=N(($je,E2)=>{"use strict";var o_=Object.prototype.hasOwnProperty,I2=Object.prototype.toString,v2=Object.defineProperty,w2=Object.getOwnPropertyDescriptor,x2=function(e){return typeof Array.isArray=="function"?Array.isArray(e):I2.call(e)==="[object Array]"},k2=function(e){if(!e||I2.call(e)!=="[object Object]")return!1;var r=o_.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&o_.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;var i;for(i in e);return typeof i>"u"||o_.call(e,i)},S2=function(e,r){v2&&r.name==="__proto__"?v2(e,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):e[r.name]=r.newValue},$2=function(e,r){if(r==="__proto__")if(o_.call(e,r)){if(w2)return w2(e,r).value}else return;return e[r]};E2.exports=function t(){var e,r,n,i,o,s,a=arguments[0],l=1,c=arguments.length,u=!1;for(typeof a=="boolean"&&(u=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(e=arguments[l],e!=null)for(r in e)n=$2(a,r),i=$2(e,r),a!==i&&(u&&i&&(k2(i)||(o=x2(i)))?(o?(o=!1,s=n&&x2(n)?n:[]):s=n&&k2(n)?n:{},S2(a,{name:r,newValue:t(u,s,i)})):typeof i<"u"&&S2(a,{name:r,newValue:i}));return a}});function se(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function P(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var E_=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return E_=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function yd(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var bd=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var K=class extends Error{},Ht=class t extends K{constructor(e,r,n,i){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=i,this.requestID=i?.get("x-request-id"),this.error=r;let o=r;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,r,n){let i=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,r,n,i){if(!e||!i)return new Lo({message:n,cause:bd(r)});let o=r?.error;return e===400?new Pl(e,o,n,i):e===401?new Tl(e,o,n,i):e===403?new Al(e,o,n,i):e===404?new Cl(e,o,n,i):e===409?new zl(e,o,n,i):e===422?new Ol(e,o,n,i):e===429?new Rl(e,o,n,i):e>=500?new Nl(e,o,n,i):new t(e,o,n,i)}},Wt=class extends Ht{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Lo=class extends Ht{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Uo=class extends Lo{constructor({message:e}={}){super({message:e??"Request timed out."})}},Pl=class extends Ht{},Tl=class extends Ht{},Al=class extends Ht{},Cl=class extends Ht{},zl=class extends Ht{},Ol=class extends Ht{},Rl=class extends Ht{},Nl=class extends Ht{},Ml=class extends K{constructor(){super("Could not parse response content as the length limit was reached")}},jl=class extends K{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},yi=class extends Error{constructor(e){super(e)}};var oL=/^[a-z][a-z0-9+.-]*:/i,wE=t=>oL.test(t),kr=t=>(kr=Array.isArray,kr(t)),P_=kr;function T_(t){return typeof t!="object"?{}:t??{}}function A_(t){if(!t)return!0;for(let e in t)return!1;return!0}function xE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _d(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var kE=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new K(`${t} must be an integer`);if(e<0)throw new K(`${t} must be a positive integer`);return e};var SE=t=>{try{return JSON.parse(t)}catch{return}};var bi=t=>new Promise(e=>setTimeout(e,t));var Zo="6.32.0";var PE=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function sL(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var aL=()=>{let t=sL();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":IE(Deno.build.os),"X-Stainless-Arch":$E(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":IE(globalThis.process.platform??"unknown"),"X-Stainless-Arch":$E(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=lL();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function lL(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let i=n[1]||0,o=n[2]||0,s=n[3]||0;return{browser:e,version:`${i}.${o}.${s}`}}}return null}var $E=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",IE=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),EE,TE=()=>EE??(EE=aL());function AE(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function C_(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function Gm(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return C_({start(){},async pull(r){let{done:n,value:i}=await e.next();n?r.close():r.enqueue(i)},async cancel(){await e.return?.()}})}function z_(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function CE(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var zE=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var O_="RFC3986",R_=t=>String(t),N_={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:R_},OE="RFC1738";var Hm=(t,e)=>(Hm=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Hm(t,e)),_i=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var M_=1024,RE=(t,e,r,n,i)=>{if(t.length===0)return t;let o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),r==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a<o.length;a+=M_){let l=o.length>=M_?o.slice(a,a+M_):o,c=[];for(let u=0;u<l.length;++u){let d=l.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===OE&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=_i[d];continue}if(d<2048){c[c.length]=_i[192|d>>6]+_i[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=_i[224|d>>12]+_i[128|d>>6&63]+_i[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=_i[240|d>>18]+_i[128|d>>12&63]+_i[128|d>>6&63]+_i[128|d&63]}s+=c.join("")}return s};function NE(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function j_(t,e){if(kr(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var jE={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},DE=function(t,e){Array.prototype.push.apply(t,kr(e)?e:[e])},ME,Xt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:RE,encodeValuesOnly:!1,format:O_,formatter:R_,indices:!1,serializeDate(t){return(ME??(ME=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function dL(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var D_={};function LE(t,e,r,n,i,o,s,a,l,c,u,d,p,f,m,h,y,g){let b=t,v=g,C=0,E=!1;for(;(v=v.get(D_))!==void 0&&!E;){let I=v.get(t);if(C+=1,typeof I<"u"){if(I===C)throw new RangeError("Cyclic object value");E=!0}typeof v.get(D_)>"u"&&(C=0)}if(typeof c=="function"?b=c(e,b):b instanceof Date?b=p?.(b):r==="comma"&&kr(b)&&(b=j_(b,function(I){return I instanceof Date?p?.(I):I})),b===null){if(o)return l&&!h?l(e,Xt.encoder,y,"key",f):e;b=""}if(dL(b)||NE(b)){if(l){let I=h?e:l(e,Xt.encoder,y,"key",f);return[m?.(I)+"="+m?.(l(b,Xt.encoder,y,"value",f))]}return[m?.(e)+"="+m?.(String(b))]}let T=[];if(typeof b>"u")return T;let F;if(r==="comma"&&kr(b))h&&l&&(b=j_(b,l)),F=[{value:b.length>0?b.join(",")||null:void 0}];else if(kr(c))F=c;else{let I=Object.keys(b);F=u?I.sort(u):I}let le=a?String(e).replace(/\./g,"%2E"):String(e),ee=n&&kr(b)&&b.length===1?le+"[]":le;if(i&&kr(b)&&b.length===0)return ee+"[]";for(let I=0;I<F.length;++I){let ce=F[I],be=typeof ce=="object"&&typeof ce.value<"u"?ce.value:b[ce];if(s&&be===null)continue;let J=d&&a?ce.replace(/\./g,"%2E"):ce,pe=kr(b)?typeof r=="function"?r(ee,J):ee:ee+(d?"."+J:"["+J+"]");g.set(t,C);let ge=new WeakMap;ge.set(D_,g),DE(T,LE(be,pe,r,n,i,o,s,a,r==="comma"&&h&&kr(b)?null:l,c,u,d,p,f,m,h,y,ge))}return T}function fL(t=Xt){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||Xt.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=O_;if(typeof t.format<"u"){if(!Hm(N_,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=N_[r],i=Xt.filter;(typeof t.filter=="function"||kr(t.filter))&&(i=t.filter);let o;if(t.arrayFormat&&t.arrayFormat in jE?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=Xt.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let s=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:Xt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Xt.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Xt.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Xt.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Xt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Xt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Xt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Xt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Xt.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Xt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Xt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Xt.strictNullHandling}}function UE(t,e={}){let r=t,n=fL(e),i,o;typeof n.filter=="function"?(o=n.filter,r=o("",r)):kr(n.filter)&&(o=n.filter,i=o);let s=[];if(typeof r!="object"||r===null)return"";let a=jE[n.arrayFormat],l=a==="comma"&&n.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);let c=new WeakMap;for(let p=0;p<i.length;++p){let f=i[p];n.skipNulls&&r[f]===null||DE(s,LE(r[f],f,a,l,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,c))}let u=s.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),u.length>0?d+u:""}function ZE(t){return UE(t,{arrayFormat:"brackets"})}function qE(t){let e=0;for(let i of t)e+=i.length;let r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var FE;function Dl(t){let e;return(FE??(e=new globalThis.TextEncoder,FE=e.encode.bind(e)))(t)}var VE;function L_(t){let e;return(VE??(e=new globalThis.TextDecoder,VE=e.decode.bind(e)))(t)}var cn,un,Gs=class{constructor(){cn.set(this,void 0),un.set(this,void 0),se(this,cn,new Uint8Array,"f"),se(this,un,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Dl(e):e;se(this,cn,qE([P(this,cn,"f"),r]),"f");let n=[],i;for(;(i=mL(P(this,cn,"f"),P(this,un,"f")))!=null;){if(i.carriage&&P(this,un,"f")==null){se(this,un,i.index,"f");continue}if(P(this,un,"f")!=null&&(i.index!==P(this,un,"f")+1||i.carriage)){n.push(L_(P(this,cn,"f").subarray(0,P(this,un,"f")-1))),se(this,cn,P(this,cn,"f").subarray(P(this,un,"f")),"f"),se(this,un,null,"f");continue}let o=P(this,un,"f")!==null?i.preceding-1:i.preceding,s=L_(P(this,cn,"f").subarray(0,o));n.push(s),se(this,cn,P(this,cn,"f").subarray(i.index),"f"),se(this,un,null,"f")}return n}flush(){return P(this,cn,"f").length?this.decode(`
|
|
16
16
|
`):[]}};cn=new WeakMap,un=new WeakMap;Gs.NEWLINE_CHARS=new Set([`
|
|
17
17
|
`,"\r"]);Gs.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function mL(t,e){for(let i=e??0;i<t.length;i++){if(t[i]===10)return{preceding:i,index:i+1,carriage:!1};if(t[i]===13)return{preceding:i,index:i+1,carriage:!0}}return null}function BE(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var Km={off:0,error:200,warn:300,info:400,debug:500},U_=(t,e,r)=>{if(t){if(xE(Km,t))return t;jt(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Km))}`)}};function vd(){}function Xm(t,e,r){return!e||Km[t]>Km[r]?vd:e[t].bind(e)}var hL={error:vd,warn:vd,info:vd,debug:vd},WE=new WeakMap;function jt(t){let e=t.logger,r=t.logLevel??"off";if(!e)return hL;let n=WE.get(e);if(n&&n[0]===r)return n[1];let i={error:Xm("error",e,r),warn:Xm("warn",e,r),info:Xm("info",e,r),debug:Xm("debug",e,r)};return WE.set(e,[r,i]),i}var Ki=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var wd,vi=class t{constructor(e,r,n){this.iterator=e,wd.set(this,void 0),this.controller=r,se(this,wd,n,"f")}static fromSSEResponse(e,r,n,i){let o=!1,s=n?jt(n):console;async function*a(){if(o)throw new K("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let l=!1;try{for await(let c of gL(e,r))if(!l){if(c.data.startsWith("[DONE]")){l=!0;continue}if(c.event===null||!c.event.startsWith("thread.")){let u;try{u=JSON.parse(c.data)}catch(d){throw s.error("Could not parse message into JSON:",c.data),s.error("From chunk:",c.raw),d}if(u&&u.error)throw new Ht(void 0,u.error,void 0,e.headers);yield i?{event:c.event,data:u}:u}else{let u;try{u=JSON.parse(c.data)}catch(d){throw console.error("Could not parse message into JSON:",c.data),console.error("From chunk:",c.raw),d}if(c.event=="error")throw new Ht(void 0,u.error,u.message,void 0);yield{event:c.event,data:u}}}l=!0}catch(c){if(yd(c))return;throw c}finally{l||r.abort()}}return new t(a,r,n)}static fromReadableStream(e,r,n){let i=!1;async function*o(){let a=new Gs,l=z_(e);for await(let c of l)for(let u of a.decode(c))yield u;for(let c of a.flush())yield c}async function*s(){if(i)throw new K("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let a=!1;try{for await(let l of o())a||l&&(yield JSON.parse(l));a=!0}catch(l){if(yd(l))return;throw l}finally{a||r.abort()}}return new t(s,r,n)}[(wd=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),i=o=>({next:()=>{if(o.length===0){let s=n.next();e.push(s),r.push(s)}return o.shift()}});return[new t(()=>i(e),this.controller,P(this,wd,"f")),new t(()=>i(r),this.controller,P(this,wd,"f"))]}toReadableStream(){let e=this,r;return C_({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:i,done:o}=await r.next();if(o)return n.close();let s=Dl(JSON.stringify(i)+`
|
|
18
18
|
`);n.enqueue(s)}catch(i){n.error(i)}},async cancel(){await r.return?.()}})}};async function*gL(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new K("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new K("Attempted to iterate over a response with no body");let r=new Z_,n=new Gs,i=z_(t.body);for await(let o of yL(i))for(let s of n.decode(o)){let a=r.decode(s);a&&(yield a)}for(let o of n.flush()){let s=r.decode(o);s&&(yield s)}}async function*yL(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?Dl(r):r,i=new Uint8Array(e.length+n.length);i.set(e),i.set(n,e.length),e=i;let o;for(;(o=BE(e))!==-1;)yield e.slice(0,o),e=e.slice(o)}e.length>0&&(yield e)}var Z_=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
|
|
@@ -45,11 +45,11 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
45
45
|
`):[]}};fn=new WeakMap,pn=new WeakMap;so.NEWLINE_CHARS=new Set([`
|
|
46
46
|
`,"\r"]);so.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function LU(t,e){for(let i=e??0;i<t.length;i++){if(t[i]===10)return{preceding:i,index:i+1,carriage:!1};if(t[i]===13)return{preceding:i,index:i+1,carriage:!0}}return null}function BP(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var Eh={off:0,error:200,warn:300,info:400,debug:500},kv=(t,e,r)=>{if(t){if(AP(Eh,t))return t;rr(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Eh))}`)}};function Zd(){}function Ih(t,e,r){return!e||Eh[t]>Eh[r]?Zd:e[t].bind(e)}var UU={error:Zd,warn:Zd,info:Zd,debug:Zd},WP=new WeakMap;function rr(t){let e=t.logger,r=t.logLevel??"off";if(!e)return UU;let n=WP.get(e);if(n&&n[0]===r)return n[1];let i={error:Ih("error",e,r),warn:Ih("warn",e,r),info:Ih("info",e,r),debug:Ih("debug",e,r)};return WP.set(e,[r,i]),i}var ao=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="x-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var Fd,Si=class t{constructor(e,r,n){this.iterator=e,Fd.set(this,void 0),this.controller=r,W(this,Fd,n,"f")}static fromSSEResponse(e,r,n){let i=!1,o=n?rr(n):console;async function*s(){if(i)throw new te("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let a=!1;try{for await(let l of ZU(e,r)){if(l.event==="completion")try{yield JSON.parse(l.data)}catch(c){throw o.error("Could not parse message into JSON:",l.data),o.error("From chunk:",l.raw),c}if(l.event==="message_start"||l.event==="message_delta"||l.event==="message_stop"||l.event==="content_block_start"||l.event==="content_block_delta"||l.event==="content_block_stop")try{yield JSON.parse(l.data)}catch(c){throw o.error("Could not parse message into JSON:",l.data),o.error("From chunk:",l.raw),c}if(l.event!=="ping"&&l.event==="error")throw new tr(void 0,Sh(l.data)??l.data,void 0,e.headers)}a=!0}catch(l){if(oo(l))return;throw l}finally{a||r.abort()}}return new t(s,r,n)}static fromReadableStream(e,r,n){let i=!1;async function*o(){let a=new so,l=Ld(e);for await(let c of l)for(let u of a.decode(c))yield u;for(let c of a.flush())yield c}async function*s(){if(i)throw new te("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let a=!1;try{for await(let l of o())a||l&&(yield JSON.parse(l));a=!0}catch(l){if(oo(l))return;throw l}finally{a||r.abort()}}return new t(s,r,n)}[(Fd=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),i=o=>({next:()=>{if(o.length===0){let s=n.next();e.push(s),r.push(s)}return o.shift()}});return[new t(()=>i(e),this.controller,A(this,Fd,"f")),new t(()=>i(r),this.controller,A(this,Fd,"f"))]}toReadableStream(){let e=this,r;return wv({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:i,done:o}=await r.next();if(o)return n.close();let s=Ud(JSON.stringify(i)+`
|
|
47
47
|
`);n.enqueue(s)}catch(i){n.error(i)}},async cancel(){await r.return?.()}})}};async function*ZU(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new te("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new te("Attempted to iterate over a response with no body");let r=new Sv,n=new so,i=Ld(t.body);for await(let o of FU(i))for(let s of n.decode(o)){let a=r.decode(s);a&&(yield a)}for(let o of n.flush()){let s=r.decode(o);s&&(yield s)}}async function*FU(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?Ud(r):r,i=new Uint8Array(e.length+n.length);i.set(e),i.set(n,e.length),e=i;let o;for(;(o=BP(e))!==-1;)yield e.slice(0,o),e=e.slice(o)}e.length>0&&(yield e)}var Sv=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
|
|
48
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,i]=VU(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};function VU(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function Ph(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:i,startTime:o}=e,s=await(async()=>{if(e.options.stream)return rr(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller):Si.fromSSEResponse(r,e.controller);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let l=r.headers.get("content-type")?.split(";")[0]?.trim();if(l?.includes("application/json")||l?.endsWith("+json")){if(r.headers.get("content-length")==="0")return;let p=await r.json();return $v(p,r)}return await r.text()})();return rr(t).debug(`[${n}] response parsed`,ao({retryOfRequestLogID:i,url:r.url,status:r.status,body:s,durationMs:Date.now()-o})),s}function $v(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}var Vd,ya=class t extends Promise{constructor(e,r,n=Ph){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=n,Vd.set(this,void 0),W(this,Vd,e,"f")}_thenUnwrap(e){return new t(A(this,Vd,"f"),this.responsePromise,async(r,n)=>$v(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(A(this,Vd,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Vd=new WeakMap;var Th,Ah=class{constructor(e,r,n,i){Th.set(this,void 0),W(this,Th,e,"f"),this.options=i,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new te("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await A(this,Th,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Th=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},qd=class extends ya{constructor(e,r,n){super(e,r,async(i,o)=>new n(i,o.response,await Ph(i,o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},
|
|
48
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,i]=VU(e,":");return i.startsWith(" ")&&(i=i.substring(1)),r==="event"?this.event=i:r==="data"&&this.data.push(i),null}};function VU(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function Ph(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:i,startTime:o}=e,s=await(async()=>{if(e.options.stream)return rr(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller):Si.fromSSEResponse(r,e.controller);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let l=r.headers.get("content-type")?.split(";")[0]?.trim();if(l?.includes("application/json")||l?.endsWith("+json")){if(r.headers.get("content-length")==="0")return;let p=await r.json();return $v(p,r)}return await r.text()})();return rr(t).debug(`[${n}] response parsed`,ao({retryOfRequestLogID:i,url:r.url,status:r.status,body:s,durationMs:Date.now()-o})),s}function $v(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}var Vd,ya=class t extends Promise{constructor(e,r,n=Ph){super(i=>{i(null)}),this.responsePromise=r,this.parseResponse=n,Vd.set(this,void 0),W(this,Vd,e,"f")}_thenUnwrap(e){return new t(A(this,Vd,"f"),this.responsePromise,async(r,n)=>$v(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(A(this,Vd,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Vd=new WeakMap;var Th,Ah=class{constructor(e,r,n,i){Th.set(this,void 0),W(this,Th,e,"f"),this.options=i,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new te("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await A(this,Th,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Th=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},qd=class extends ya{constructor(e,r,n){super(e,r,async(i,o)=>new n(i,o.response,await Ph(i,o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},Pn=class extends Ah{constructor(e,r,n,i){super(e,r,n,i),this.data=n.data||[],this.has_more=n.has_more||!1,this.first_id=n.first_id||null,this.last_id=n.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let r=this.first_id;return r?{...this.options,query:{...kh(this.options.query),before_id:r}}:null}let e=this.last_id;return e?{...this.options,query:{...kh(this.options.query),after_id:e}}:null}};var Cc=class extends Ah{constructor(e,r,n,i){super(e,r,n,i),this.data=n.data||[],this.has_more=n.has_more||!1,this.next_page=n.next_page||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.next_page;return e?{...this.options,query:{...kh(this.options.query),page:e}}:null}};var Ev=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function ba(t,e,r){return Ev(),new File(t,e??"unknown_file",r)}function Bd(t,e){let r=typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"";return e?r.split(/[\\/]/).pop()||void 0:r}var Pv=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function";var zc=async(t,e,r=!0)=>({...t,body:await WU(t.body,e,r)}),GP=new WeakMap;function BU(t){let e=typeof t=="function"?t:t.fetch,r=GP.get(e);if(r)return r;let n=(async()=>{try{let i="Response"in e?e.Response:(await e("data:,")).constructor,o=new FormData;return o.toString()!==await new i(o).text()}catch{return!0}})();return GP.set(e,n),n}var WU=async(t,e,r=!0)=>{if(!await BU(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let n=new FormData;return await Promise.all(Object.entries(t||{}).map(([i,o])=>Iv(n,i,o,r))),n},GU=t=>t instanceof Blob&&"name"in t;var Iv=async(t,e,r,n)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response){let i={},o=r.headers.get("Content-Type");o&&(i={type:o}),t.append(e,ba([await r.blob()],Bd(r,n),i))}else if(Pv(r))t.append(e,ba([await new Response($h(r)).blob()],Bd(r,n)));else if(GU(r))t.append(e,ba([r],Bd(r,n),{type:r.type}));else if(Array.isArray(r))await Promise.all(r.map(i=>Iv(t,e+"[]",i,n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([i,o])=>Iv(t,`${e}[${i}]`,o,n)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var HP=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",HU=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&HP(t),XU=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function Ch(t,e,r){if(Ev(),t=await t,e||(e=Bd(t,!0)),HU(t))return t instanceof File&&e==null&&r==null?t:ba([await t.arrayBuffer()],e??t.name,{type:t.type,lastModified:t.lastModified,...r});if(XU(t)){let i=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),ba(await Tv(i),e,r)}let n=await Tv(t);if(!r?.type){let i=n.find(o=>typeof o=="object"&&"type"in o&&o.type);typeof i=="string"&&(r={...r,type:i})}return ba(n,e,r)}async function Tv(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(HP(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(Pv(t))for await(let r of t)e.push(...await Tv(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${KU(t)}`)}return e}function KU(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var kt=class{constructor(e){this._client=e}};var XP=Symbol.for("brand.privateNullableHeaders");function*YU(t){if(!t)return;if(XP in t){let{values:n,nulls:i}=t;yield*n.entries();for(let o of i)yield[o,null];return}let e=!1,r;t instanceof Headers?r=t.entries():_v(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let i=n[0];if(typeof i!="string")throw new TypeError("expected header name to be a string");let o=_v(n[1])?n[1]:[n[1]],s=!1;for(let a of o)a!==void 0&&(e&&!s&&(s=!0,yield[i,null]),yield[i,a])}}var xe=t=>{let e=new Headers,r=new Set;for(let n of t){let i=new Set;for(let[o,s]of YU(n)){let a=o.toLowerCase();i.has(a)||(e.delete(o),i.add(a)),s===null?(e.delete(o),r.add(a)):(e.append(o,s),r.delete(a))}}return{[XP]:!0,values:e,nulls:r}};var Wd=Symbol("anthropic.sdk.stainlessHelper");function zh(t){return typeof t=="object"&&t!==null&&Wd in t}function Av(t,e){let r=new Set;if(t)for(let n of t)zh(n)&&r.add(n[Wd]);if(e){for(let n of e)if(zh(n)&&r.add(n[Wd]),Array.isArray(n.content))for(let i of n.content)zh(i)&&r.add(i[Wd])}return Array.from(r)}function Oh(t,e){let r=Av(t,e);return r.length===0?{}:{"x-stainless-helper":r.join(", ")}}function KP(t){return zh(t)?{"x-stainless-helper":t[Wd]}:{}}function YP(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var JP=Object.freeze(Object.create(null)),QU=(t=YP)=>function(r,...n){if(r.length===1)return r[0];let i=!1,o=[],s=r.reduce((u,d,p)=>{/[?#]/.test(d)&&(i=!0);let f=n[p],m=(i?encodeURIComponent:t)(""+f);return p!==n.length&&(f==null||typeof f=="object"&&f.toString===Object.getPrototypeOf(Object.getPrototypeOf(f.hasOwnProperty??JP)??JP)?.toString)&&(m=f+"",o.push({start:u.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(f).slice(8,-1)} is not a valid path parameter`})),u+d+(p===n.length?"":m)},""),a=s.split(/[?#]/,1)[0],l=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=l.exec(a))!==null;)o.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can't be safely passed as a path parameter`});if(o.sort((u,d)=>u.start-d.start),o.length>0){let u=0,d=o.reduce((p,f)=>{let m=" ".repeat(f.start-u),h="^".repeat(f.length);return u=f.start+f.length,p+m+h},"");throw new te(`Path parameters result in path with invalid segments:
|
|
49
49
|
${o.map(p=>p.error).join(`
|
|
50
50
|
`)}
|
|
51
51
|
${s}
|
|
52
|
-
${d}`)}return s},St=QU(YP);var Oc=class extends kt{list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/files",En,{query:i,...r,headers:xe([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])})}delete(e,r={},n){let{betas:i}=r??{};return this._client.delete(St`/v1/files/${e}`,{...n,headers:xe([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},n?.headers])})}download(e,r={},n){let{betas:i}=r??{};return this._client.get(St`/v1/files/${e}/content`,{...n,headers:xe([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}retrieveMetadata(e,r={},n){let{betas:i}=r??{};return this._client.get(St`/v1/files/${e}`,{...n,headers:xe([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},n?.headers])})}upload(e,r){let{betas:n,...i}=e;return this._client.post("/v1/files",zc({body:i,...r,headers:xe([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},KP(i.file),r?.headers])},this._client))}};var Rc=class extends kt{retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(St`/v1/models/${e}?beta=true`,{...n,headers:xe([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/models?beta=true",En,{query:i,...r,headers:xe([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}};var Rh={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};function QP(t){return t?.output_format??t?.output_config?.format}function Cv(t,e,r){let n=QP(e);return!e||!("parse"in(n??{}))?{...t,content:t.content.map(i=>{if(i.type==="text"){let o=Object.defineProperty({...i},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(o,"parsed",{get(){return r.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return i}),parsed_output:null}:zv(t,e,r)}function zv(t,e,r){let n=null,i=t.content.map(o=>{if(o.type==="text"){let s=rZ(e,o.text);n===null&&(n=s);let a=Object.defineProperty({...o},"parsed_output",{value:s,enumerable:!1});return Object.defineProperty(a,"parsed",{get(){return r.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),s},enumerable:!1})}return o});return{...t,content:i,parsed_output:n}}function rZ(t,e){let r=QP(t);if(r?.type!=="json_schema")return null;try{return"parse"in r?r.parse(e):JSON.parse(e)}catch(n){throw new te(`Failed to parse structured output: ${n}`)}}var nZ=t=>{let e=0,r=[];for(;e<t.length;){let n=t[e];if(n==="\\"){e++;continue}if(n==="{"){r.push({type:"brace",value:"{"}),e++;continue}if(n==="}"){r.push({type:"brace",value:"}"}),e++;continue}if(n==="["){r.push({type:"paren",value:"["}),e++;continue}if(n==="]"){r.push({type:"paren",value:"]"}),e++;continue}if(n===":"){r.push({type:"separator",value:":"}),e++;continue}if(n===","){r.push({type:"delimiter",value:","}),e++;continue}if(n==='"'){let a="",l=!1;for(n=t[++e];n!=='"';){if(e===t.length){l=!0;break}if(n==="\\"){if(e++,e===t.length){l=!0;break}a+=n+t[e],n=t[++e]}else a+=n,n=t[++e]}n=t[++e],l||r.push({type:"string",value:a});continue}if(n&&/\s/.test(n)){e++;continue}let o=/[0-9]/;if(n&&o.test(n)||n==="-"||n==="."){let a="";for(n==="-"&&(a+=n,n=t[++e]);n&&o.test(n)||n===".";)a+=n,n=t[++e];r.push({type:"number",value:a});continue}let s=/[a-z]/i;if(n&&s.test(n)){let a="";for(;n&&s.test(n)&&e!==t.length;)a+=n,n=t[++e];if(a=="true"||a=="false"||a==="null")r.push({type:"name",value:a});else{e++;continue}continue}e++}return r},Nc=t=>{if(t.length===0)return t;let e=t[t.length-1];switch(e.type){case"separator":return t=t.slice(0,t.length-1),Nc(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),Nc(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),Nc(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),Nc(t);break;case"delimiter":return t=t.slice(0,t.length-1),Nc(t);break}return t},iZ=t=>{let e=[];return t.map(r=>{r.type==="brace"&&(r.value==="{"?e.push("}"):e.splice(e.lastIndexOf("}"),1)),r.type==="paren"&&(r.value==="["?e.push("]"):e.splice(e.lastIndexOf("]"),1))}),e.length>0&&e.reverse().map(r=>{r==="}"?t.push({type:"brace",value:"}"}):r==="]"&&t.push({type:"paren",value:"]"})}),t},oZ=t=>{let e="";return t.map(r=>{r.type==="string"?e+='"'+r.value+'"':e+=r.value}),e},Nh=t=>JSON.parse(oZ(iZ(Nc(nZ(t)))));var Pn,ss,Mc,Gd,Mh,Hd,Xd,jh,Kd,lo,Jd,Dh,Lh,_a,Uh,Zh,Yd,Ov,eT,Fh,Rv,Nv,Mv,tT,rT="__json_buf";function nT(t){return t.type==="tool_use"||t.type==="server_tool_use"||t.type==="mcp_tool_use"}var Vh=class t{constructor(e,r){Pn.add(this),this.messages=[],this.receivedMessages=[],ss.set(this,void 0),Mc.set(this,null),this.controller=new AbortController,Gd.set(this,void 0),Mh.set(this,()=>{}),Hd.set(this,()=>{}),Xd.set(this,void 0),jh.set(this,()=>{}),Kd.set(this,()=>{}),lo.set(this,{}),Jd.set(this,!1),Dh.set(this,!1),Lh.set(this,!1),_a.set(this,!1),Uh.set(this,void 0),Zh.set(this,void 0),Yd.set(this,void 0),Fh.set(this,n=>{if(W(this,Dh,!0,"f"),oo(n)&&(n=new ur),n instanceof ur)return W(this,Lh,!0,"f"),this._emit("abort",n);if(n instanceof te)return this._emit("error",n);if(n instanceof Error){let i=new te(n.message);return i.cause=n,this._emit("error",i)}return this._emit("error",new te(String(n)))}),W(this,Gd,new Promise((n,i)=>{W(this,Mh,n,"f"),W(this,Hd,i,"f")}),"f"),W(this,Xd,new Promise((n,i)=>{W(this,jh,n,"f"),W(this,Kd,i,"f")}),"f"),A(this,Gd,"f").catch(()=>{}),A(this,Xd,"f").catch(()=>{}),W(this,Mc,e,"f"),W(this,Yd,r?.logger??console,"f")}get response(){return A(this,Uh,"f")}get request_id(){return A(this,Zh,"f")}async withResponse(){W(this,_a,!0,"f");let e=await A(this,Gd,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n,{logger:i}={}){let o=new t(r,{logger:i});for(let s of r.messages)o._addMessageParam(s);return W(o,Mc,{...r,stream:!0},"f"),o._run(()=>o._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},A(this,Fh,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let i=n?.signal,o;i&&(i.aborted&&this.controller.abort(),o=this.controller.abort.bind(this.controller),i.addEventListener("abort",o));try{A(this,Pn,"m",Rv).call(this);let{response:s,data:a}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(s);for await(let l of a)A(this,Pn,"m",Nv).call(this,l);if(a.controller.signal?.aborted)throw new ur;A(this,Pn,"m",Mv).call(this)}finally{i&&o&&i.removeEventListener("abort",o)}}_connected(e){this.ended||(W(this,Uh,e,"f"),W(this,Zh,e?.headers.get("request-id"),"f"),A(this,Mh,"f").call(this,e),this._emit("connect"))}get ended(){return A(this,Jd,"f")}get errored(){return A(this,Dh,"f")}get aborted(){return A(this,Lh,"f")}abort(){this.controller.abort()}on(e,r){return(A(this,lo,"f")[e]||(A(this,lo,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=A(this,lo,"f")[e];if(!n)return this;let i=n.findIndex(o=>o.listener===r);return i>=0&&n.splice(i,1),this}once(e,r){return(A(this,lo,"f")[e]||(A(this,lo,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{W(this,_a,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){W(this,_a,!0,"f"),await A(this,Xd,"f")}get currentMessage(){return A(this,ss,"f")}async finalMessage(){return await this.done(),A(this,Pn,"m",Ov).call(this)}async finalText(){return await this.done(),A(this,Pn,"m",eT).call(this)}_emit(e,...r){if(A(this,Jd,"f"))return;e==="end"&&(W(this,Jd,!0,"f"),A(this,jh,"f").call(this));let n=A(this,lo,"f")[e];if(n&&(A(this,lo,"f")[e]=n.filter(i=>!i.once),n.forEach(({listener:i})=>i(...r))),e==="abort"){let i=r[0];!A(this,_a,"f")&&!n?.length&&Promise.reject(i),A(this,Hd,"f").call(this,i),A(this,Kd,"f").call(this,i),this._emit("end");return}if(e==="error"){let i=r[0];!A(this,_a,"f")&&!n?.length&&Promise.reject(i),A(this,Hd,"f").call(this,i),A(this,Kd,"f").call(this,i),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",A(this,Pn,"m",Ov).call(this))}async _fromReadableStream(e,r){let n=r?.signal,i;n&&(n.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),n.addEventListener("abort",i));try{A(this,Pn,"m",Rv).call(this),this._connected(null);let o=Si.fromReadableStream(e,this.controller);for await(let s of o)A(this,Pn,"m",Nv).call(this,s);if(o.controller.signal?.aborted)throw new ur;A(this,Pn,"m",Mv).call(this)}finally{n&&i&&n.removeEventListener("abort",i)}}[(ss=new WeakMap,Mc=new WeakMap,Gd=new WeakMap,Mh=new WeakMap,Hd=new WeakMap,Xd=new WeakMap,jh=new WeakMap,Kd=new WeakMap,lo=new WeakMap,Jd=new WeakMap,Dh=new WeakMap,Lh=new WeakMap,_a=new WeakMap,Uh=new WeakMap,Zh=new WeakMap,Yd=new WeakMap,Fh=new WeakMap,Pn=new WeakSet,Ov=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},eT=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new te("stream ended without producing a content block with type=text");return r.join(" ")},Rv=function(){this.ended||W(this,ss,void 0,"f")},Nv=function(r){if(this.ended)return;let n=A(this,Pn,"m",tT).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let i=n.content.at(-1);switch(r.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",r.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",r.delta.citation,i.citations??[]);break}case"input_json_delta":{nT(i)&&i.input&&this._emit("inputJson",r.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",r.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}case"compaction_delta":{i.type==="compaction"&&i.content&&this._emit("compaction",i.content);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(Cv(n,A(this,Mc,"f"),{logger:A(this,Yd,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{W(this,ss,n,"f");break}case"content_block_start":case"message_delta":break}},Mv=function(){if(this.ended)throw new te("stream has ended, this shouldn't happen");let r=A(this,ss,"f");if(!r)throw new te("request ended without sending any chunks");return W(this,ss,void 0,"f"),Cv(r,A(this,Mc,"f"),{logger:A(this,Yd,"f")})},tT=function(r){let n=A(this,ss,"f");if(r.type==="message_start"){if(n)throw new te(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new te(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.container=r.delta.container,n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,n.context_management=r.context_management,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),r.usage.iterations!=null&&(n.usage.iterations=r.usage.iterations),n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let i=n.content.at(r.index);switch(r.delta.type){case"text_delta":{i?.type==="text"&&(n.content[r.index]={...i,text:(i.text||"")+r.delta.text});break}case"citations_delta":{i?.type==="text"&&(n.content[r.index]={...i,citations:[...i.citations??[],r.delta.citation]});break}case"input_json_delta":{if(i&&nT(i)){let o=i[rT]||"";o+=r.delta.partial_json;let s={...i};if(Object.defineProperty(s,rT,{value:o,enumerable:!1,writable:!0}),o)try{s.input=Nh(o)}catch(a){let l=new te(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${a}. JSON: ${o}`);A(this,Fh,"f").call(this,l)}n.content[r.index]=s}break}case"thinking_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,thinking:i.thinking+r.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,signature:r.delta.signature});break}case"compaction_delta":{i?.type==="compaction"&&(n.content[r.index]={...i,content:(i.content||"")+r.delta.content});break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",i=>{let o=r.shift();o?o.resolve(i):e.push(i)}),this.on("end",()=>{n=!0;for(let i of r)i.resolve(void 0);r.length=0}),this.on("abort",i=>{n=!0;for(let o of r)o.reject(i);r.length=0}),this.on("error",i=>{n=!0;for(let o of r)o.reject(i);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((o,s)=>r.push({resolve:o,reject:s})).then(o=>o?{value:o,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Si(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var va=class extends Error{constructor(e){let r=typeof e=="string"?e:e.map(n=>n.type==="text"?n.text:`[${n.type}]`).join(" ");super(r),this.name="ToolError",this.content=e}};var iT=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
|
|
52
|
+
${d}`)}return s},St=QU(YP);var Oc=class extends kt{list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/files",Pn,{query:i,...r,headers:xe([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])})}delete(e,r={},n){let{betas:i}=r??{};return this._client.delete(St`/v1/files/${e}`,{...n,headers:xe([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},n?.headers])})}download(e,r={},n){let{betas:i}=r??{};return this._client.get(St`/v1/files/${e}/content`,{...n,headers:xe([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}retrieveMetadata(e,r={},n){let{betas:i}=r??{};return this._client.get(St`/v1/files/${e}`,{...n,headers:xe([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},n?.headers])})}upload(e,r){let{betas:n,...i}=e;return this._client.post("/v1/files",zc({body:i,...r,headers:xe([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},KP(i.file),r?.headers])},this._client))}};var Rc=class extends kt{retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(St`/v1/models/${e}?beta=true`,{...n,headers:xe([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/models?beta=true",Pn,{query:i,...r,headers:xe([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}};var Rh={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};function QP(t){return t?.output_format??t?.output_config?.format}function Cv(t,e,r){let n=QP(e);return!e||!("parse"in(n??{}))?{...t,content:t.content.map(i=>{if(i.type==="text"){let o=Object.defineProperty({...i},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(o,"parsed",{get(){return r.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return i}),parsed_output:null}:zv(t,e,r)}function zv(t,e,r){let n=null,i=t.content.map(o=>{if(o.type==="text"){let s=rZ(e,o.text);n===null&&(n=s);let a=Object.defineProperty({...o},"parsed_output",{value:s,enumerable:!1});return Object.defineProperty(a,"parsed",{get(){return r.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),s},enumerable:!1})}return o});return{...t,content:i,parsed_output:n}}function rZ(t,e){let r=QP(t);if(r?.type!=="json_schema")return null;try{return"parse"in r?r.parse(e):JSON.parse(e)}catch(n){throw new te(`Failed to parse structured output: ${n}`)}}var nZ=t=>{let e=0,r=[];for(;e<t.length;){let n=t[e];if(n==="\\"){e++;continue}if(n==="{"){r.push({type:"brace",value:"{"}),e++;continue}if(n==="}"){r.push({type:"brace",value:"}"}),e++;continue}if(n==="["){r.push({type:"paren",value:"["}),e++;continue}if(n==="]"){r.push({type:"paren",value:"]"}),e++;continue}if(n===":"){r.push({type:"separator",value:":"}),e++;continue}if(n===","){r.push({type:"delimiter",value:","}),e++;continue}if(n==='"'){let a="",l=!1;for(n=t[++e];n!=='"';){if(e===t.length){l=!0;break}if(n==="\\"){if(e++,e===t.length){l=!0;break}a+=n+t[e],n=t[++e]}else a+=n,n=t[++e]}n=t[++e],l||r.push({type:"string",value:a});continue}if(n&&/\s/.test(n)){e++;continue}let o=/[0-9]/;if(n&&o.test(n)||n==="-"||n==="."){let a="";for(n==="-"&&(a+=n,n=t[++e]);n&&o.test(n)||n===".";)a+=n,n=t[++e];r.push({type:"number",value:a});continue}let s=/[a-z]/i;if(n&&s.test(n)){let a="";for(;n&&s.test(n)&&e!==t.length;)a+=n,n=t[++e];if(a=="true"||a=="false"||a==="null")r.push({type:"name",value:a});else{e++;continue}continue}e++}return r},Nc=t=>{if(t.length===0)return t;let e=t[t.length-1];switch(e.type){case"separator":return t=t.slice(0,t.length-1),Nc(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),Nc(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),Nc(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),Nc(t);break;case"delimiter":return t=t.slice(0,t.length-1),Nc(t);break}return t},iZ=t=>{let e=[];return t.map(r=>{r.type==="brace"&&(r.value==="{"?e.push("}"):e.splice(e.lastIndexOf("}"),1)),r.type==="paren"&&(r.value==="["?e.push("]"):e.splice(e.lastIndexOf("]"),1))}),e.length>0&&e.reverse().map(r=>{r==="}"?t.push({type:"brace",value:"}"}):r==="]"&&t.push({type:"paren",value:"]"})}),t},oZ=t=>{let e="";return t.map(r=>{r.type==="string"?e+='"'+r.value+'"':e+=r.value}),e},Nh=t=>JSON.parse(oZ(iZ(Nc(nZ(t)))));var Tn,ss,Mc,Gd,Mh,Hd,Xd,jh,Kd,lo,Jd,Dh,Lh,_a,Uh,Zh,Yd,Ov,eT,Fh,Rv,Nv,Mv,tT,rT="__json_buf";function nT(t){return t.type==="tool_use"||t.type==="server_tool_use"||t.type==="mcp_tool_use"}var Vh=class t{constructor(e,r){Tn.add(this),this.messages=[],this.receivedMessages=[],ss.set(this,void 0),Mc.set(this,null),this.controller=new AbortController,Gd.set(this,void 0),Mh.set(this,()=>{}),Hd.set(this,()=>{}),Xd.set(this,void 0),jh.set(this,()=>{}),Kd.set(this,()=>{}),lo.set(this,{}),Jd.set(this,!1),Dh.set(this,!1),Lh.set(this,!1),_a.set(this,!1),Uh.set(this,void 0),Zh.set(this,void 0),Yd.set(this,void 0),Fh.set(this,n=>{if(W(this,Dh,!0,"f"),oo(n)&&(n=new ur),n instanceof ur)return W(this,Lh,!0,"f"),this._emit("abort",n);if(n instanceof te)return this._emit("error",n);if(n instanceof Error){let i=new te(n.message);return i.cause=n,this._emit("error",i)}return this._emit("error",new te(String(n)))}),W(this,Gd,new Promise((n,i)=>{W(this,Mh,n,"f"),W(this,Hd,i,"f")}),"f"),W(this,Xd,new Promise((n,i)=>{W(this,jh,n,"f"),W(this,Kd,i,"f")}),"f"),A(this,Gd,"f").catch(()=>{}),A(this,Xd,"f").catch(()=>{}),W(this,Mc,e,"f"),W(this,Yd,r?.logger??console,"f")}get response(){return A(this,Uh,"f")}get request_id(){return A(this,Zh,"f")}async withResponse(){W(this,_a,!0,"f");let e=await A(this,Gd,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n,{logger:i}={}){let o=new t(r,{logger:i});for(let s of r.messages)o._addMessageParam(s);return W(o,Mc,{...r,stream:!0},"f"),o._run(()=>o._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},A(this,Fh,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let i=n?.signal,o;i&&(i.aborted&&this.controller.abort(),o=this.controller.abort.bind(this.controller),i.addEventListener("abort",o));try{A(this,Tn,"m",Rv).call(this);let{response:s,data:a}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(s);for await(let l of a)A(this,Tn,"m",Nv).call(this,l);if(a.controller.signal?.aborted)throw new ur;A(this,Tn,"m",Mv).call(this)}finally{i&&o&&i.removeEventListener("abort",o)}}_connected(e){this.ended||(W(this,Uh,e,"f"),W(this,Zh,e?.headers.get("request-id"),"f"),A(this,Mh,"f").call(this,e),this._emit("connect"))}get ended(){return A(this,Jd,"f")}get errored(){return A(this,Dh,"f")}get aborted(){return A(this,Lh,"f")}abort(){this.controller.abort()}on(e,r){return(A(this,lo,"f")[e]||(A(this,lo,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=A(this,lo,"f")[e];if(!n)return this;let i=n.findIndex(o=>o.listener===r);return i>=0&&n.splice(i,1),this}once(e,r){return(A(this,lo,"f")[e]||(A(this,lo,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{W(this,_a,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){W(this,_a,!0,"f"),await A(this,Xd,"f")}get currentMessage(){return A(this,ss,"f")}async finalMessage(){return await this.done(),A(this,Tn,"m",Ov).call(this)}async finalText(){return await this.done(),A(this,Tn,"m",eT).call(this)}_emit(e,...r){if(A(this,Jd,"f"))return;e==="end"&&(W(this,Jd,!0,"f"),A(this,jh,"f").call(this));let n=A(this,lo,"f")[e];if(n&&(A(this,lo,"f")[e]=n.filter(i=>!i.once),n.forEach(({listener:i})=>i(...r))),e==="abort"){let i=r[0];!A(this,_a,"f")&&!n?.length&&Promise.reject(i),A(this,Hd,"f").call(this,i),A(this,Kd,"f").call(this,i),this._emit("end");return}if(e==="error"){let i=r[0];!A(this,_a,"f")&&!n?.length&&Promise.reject(i),A(this,Hd,"f").call(this,i),A(this,Kd,"f").call(this,i),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",A(this,Tn,"m",Ov).call(this))}async _fromReadableStream(e,r){let n=r?.signal,i;n&&(n.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),n.addEventListener("abort",i));try{A(this,Tn,"m",Rv).call(this),this._connected(null);let o=Si.fromReadableStream(e,this.controller);for await(let s of o)A(this,Tn,"m",Nv).call(this,s);if(o.controller.signal?.aborted)throw new ur;A(this,Tn,"m",Mv).call(this)}finally{n&&i&&n.removeEventListener("abort",i)}}[(ss=new WeakMap,Mc=new WeakMap,Gd=new WeakMap,Mh=new WeakMap,Hd=new WeakMap,Xd=new WeakMap,jh=new WeakMap,Kd=new WeakMap,lo=new WeakMap,Jd=new WeakMap,Dh=new WeakMap,Lh=new WeakMap,_a=new WeakMap,Uh=new WeakMap,Zh=new WeakMap,Yd=new WeakMap,Fh=new WeakMap,Tn=new WeakSet,Ov=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},eT=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new te("stream ended without producing a content block with type=text");return r.join(" ")},Rv=function(){this.ended||W(this,ss,void 0,"f")},Nv=function(r){if(this.ended)return;let n=A(this,Tn,"m",tT).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let i=n.content.at(-1);switch(r.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",r.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",r.delta.citation,i.citations??[]);break}case"input_json_delta":{nT(i)&&i.input&&this._emit("inputJson",r.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",r.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}case"compaction_delta":{i.type==="compaction"&&i.content&&this._emit("compaction",i.content);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(Cv(n,A(this,Mc,"f"),{logger:A(this,Yd,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{W(this,ss,n,"f");break}case"content_block_start":case"message_delta":break}},Mv=function(){if(this.ended)throw new te("stream has ended, this shouldn't happen");let r=A(this,ss,"f");if(!r)throw new te("request ended without sending any chunks");return W(this,ss,void 0,"f"),Cv(r,A(this,Mc,"f"),{logger:A(this,Yd,"f")})},tT=function(r){let n=A(this,ss,"f");if(r.type==="message_start"){if(n)throw new te(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new te(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.container=r.delta.container,n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,n.context_management=r.context_management,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),r.usage.iterations!=null&&(n.usage.iterations=r.usage.iterations),n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let i=n.content.at(r.index);switch(r.delta.type){case"text_delta":{i?.type==="text"&&(n.content[r.index]={...i,text:(i.text||"")+r.delta.text});break}case"citations_delta":{i?.type==="text"&&(n.content[r.index]={...i,citations:[...i.citations??[],r.delta.citation]});break}case"input_json_delta":{if(i&&nT(i)){let o=i[rT]||"";o+=r.delta.partial_json;let s={...i};if(Object.defineProperty(s,rT,{value:o,enumerable:!1,writable:!0}),o)try{s.input=Nh(o)}catch(a){let l=new te(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${a}. JSON: ${o}`);A(this,Fh,"f").call(this,l)}n.content[r.index]=s}break}case"thinking_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,thinking:i.thinking+r.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,signature:r.delta.signature});break}case"compaction_delta":{i?.type==="compaction"&&(n.content[r.index]={...i,content:(i.content||"")+r.delta.content});break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",i=>{let o=r.shift();o?o.resolve(i):e.push(i)}),this.on("end",()=>{n=!0;for(let i of r)i.resolve(void 0);r.length=0}),this.on("abort",i=>{n=!0;for(let o of r)o.reject(i);r.length=0}),this.on("error",i=>{n=!0;for(let o of r)o.reject(i);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((o,s)=>r.push({resolve:o,reject:s})).then(o=>o?{value:o,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Si(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var va=class extends Error{constructor(e){let r=typeof e=="string"?e:e.map(n=>n.type==="text"?n.text:`[${n.type}]`).join(" ");super(r),this.name="ToolError",this.content=e}};var iT=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
|
|
53
53
|
1. Task Overview
|
|
54
54
|
The user's core request and success criteria
|
|
55
55
|
Any clarifications or constraints they specified
|
|
@@ -71,9 +71,9 @@ User preferences or style requirements
|
|
|
71
71
|
Domain-specific details that aren't obvious
|
|
72
72
|
Any promises made to the user
|
|
73
73
|
Be concise but complete\u2014err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
|
|
74
|
-
Wrap your summary in <summary></summary> tags.`;var Qd,jc,wa,Jt,ef,mn,co,as,tf,oT,jv;function sT(){let t,e;return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}}var Dc=class{constructor(e,r,n){Qd.add(this),this.client=e,jc.set(this,!1),wa.set(this,!1),Jt.set(this,void 0),ef.set(this,void 0),mn.set(this,void 0),co.set(this,void 0),as.set(this,void 0),tf.set(this,0),W(this,Jt,{params:{...r,messages:structuredClone(r.messages)}},"f");let o=["BetaToolRunner",...Av(r.tools,r.messages)].join(", ");W(this,ef,{...n,headers:xe([{"x-stainless-helper":o},n?.headers])},"f"),W(this,as,sT(),"f")}async*[(jc=new WeakMap,wa=new WeakMap,Jt=new WeakMap,ef=new WeakMap,mn=new WeakMap,co=new WeakMap,as=new WeakMap,tf=new WeakMap,Qd=new WeakSet,oT=async function(){let r=A(this,Jt,"f").params.compactionControl;if(!r||!r.enabled)return!1;let n=0;if(A(this,mn,"f")!==void 0)try{let c=await A(this,mn,"f");n=c.usage.input_tokens+(c.usage.cache_creation_input_tokens??0)+(c.usage.cache_read_input_tokens??0)+c.usage.output_tokens}catch{return!1}let i=r.contextTokenThreshold??1e5;if(n<i)return!1;let o=r.model??A(this,Jt,"f").params.model,s=r.summaryPrompt??iT,a=A(this,Jt,"f").params.messages;if(a[a.length-1].role==="assistant"){let c=a[a.length-1];if(Array.isArray(c.content)){let u=c.content.filter(d=>d.type!=="tool_use");u.length===0?a.pop():c.content=u}}let l=await this.client.beta.messages.create({model:o,messages:[...a,{role:"user",content:[{type:"text",text:s}]}],max_tokens:A(this,Jt,"f").params.max_tokens},{headers:{"x-stainless-helper":"compaction"}});if(l.content[0]?.type!=="text")throw new te("Expected text response for compaction");return A(this,Jt,"f").params.messages=[{role:"user",content:l.content}],!0},Symbol.asyncIterator)](){var e;if(A(this,jc,"f"))throw new te("Cannot iterate over a consumed stream");W(this,jc,!0,"f"),W(this,wa,!0,"f"),W(this,co,void 0,"f");try{for(;;){let r;try{if(A(this,Jt,"f").params.max_iterations&&A(this,tf,"f")>=A(this,Jt,"f").params.max_iterations)break;W(this,wa,!1,"f"),W(this,co,void 0,"f"),W(this,tf,(e=A(this,tf,"f"),e++,e),"f"),W(this,mn,void 0,"f");let{max_iterations:n,compactionControl:i,...o}=A(this,Jt,"f").params;if(o.stream?(r=this.client.beta.messages.stream({...o},A(this,ef,"f")),W(this,mn,r.finalMessage(),"f"),A(this,mn,"f").catch(()=>{}),yield r):(W(this,mn,this.client.beta.messages.create({...o,stream:!1},A(this,ef,"f")),"f"),yield A(this,mn,"f")),!await A(this,Qd,"m",oT).call(this)){if(!A(this,wa,"f")){let{role:l,content:c}=await A(this,mn,"f");A(this,Jt,"f").params.messages.push({role:l,content:c})}let a=await A(this,Qd,"m",jv).call(this,A(this,Jt,"f").params.messages.at(-1));if(a)A(this,Jt,"f").params.messages.push(a);else if(!A(this,wa,"f"))break}}finally{r&&r.abort()}}if(!A(this,mn,"f"))throw new te("ToolRunner concluded without a message from the server");A(this,as,"f").resolve(await A(this,mn,"f"))}catch(r){throw W(this,jc,!1,"f"),A(this,as,"f").promise.catch(()=>{}),A(this,as,"f").reject(r),W(this,as,sT(),"f"),r}}setMessagesParams(e){typeof e=="function"?A(this,Jt,"f").params=e(A(this,Jt,"f").params):A(this,Jt,"f").params=e,W(this,wa,!0,"f"),W(this,co,void 0,"f")}async generateToolResponse(){let e=await A(this,mn,"f")??this.params.messages.at(-1);return e?A(this,Qd,"m",jv).call(this,e):null}done(){return A(this,as,"f").promise}async runUntilDone(){if(!A(this,jc,"f"))for await(let e of this);return this.done()}get params(){return A(this,Jt,"f").params}pushMessages(...e){this.setMessagesParams(r=>({...r,messages:[...r.messages,...e]}))}then(e,r){return this.runUntilDone().then(e,r)}};jv=async function(e){return A(this,co,"f")!==void 0?A(this,co,"f"):(W(this,co,aZ(A(this,Jt,"f").params,e),"f"),A(this,co,"f"))};async function aZ(t,e=t.messages.at(-1)){if(!e||e.role!=="assistant"||!e.content||typeof e.content=="string")return null;let r=e.content.filter(i=>i.type==="tool_use");return r.length===0?null:{role:"user",content:await Promise.all(r.map(async i=>{let o=t.tools.find(s=>("name"in s?s.name:s.mcp_server_name)===i.name);if(!o||!("run"in o))return{type:"tool_result",tool_use_id:i.id,content:`Error: Tool '${i.name}' not found`,is_error:!0};try{let s=i.input;"parse"in o&&o.parse&&(s=o.parse(s));let a=await o.run(s);return{type:"tool_result",tool_use_id:i.id,content:a}}catch(s){return{type:"tool_result",tool_use_id:i.id,content:s instanceof va?s.content:`Error: ${s instanceof Error?s.message:String(s)}`,is_error:!0}}}))}}var Lc=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new so;for await(let r of this.iterator)for(let n of e.decode(r))yield JSON.parse(n);for(let r of e.flush())yield JSON.parse(r)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,r){if(!e.body)throw r.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new te("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new te("Attempted to iterate over a response with no body");return new t(Ld(e.body),r)}};var Uc=class extends kt{create(e,r){let{betas:n,...i}=e;return this._client.post("/v1/messages/batches?beta=true",{body:i,...r,headers:xe([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(St`/v1/messages/batches/${e}?beta=true`,{...n,headers:xe([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",
|
|
75
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),o.model in cZ&&o.thinking&&o.thinking.type==="enabled"&&console.warn(`Using Claude with ${o.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let s=this._client._options.timeout;if(!o.stream&&s==null){let l=Rh[o.model]??void 0;s=this._client.calculateNonstreamingTimeout(o.max_tokens,l)}let a=Oh(o.tools,o.messages);return this._client.post("/v1/messages?beta=true",{body:o,timeout:s??6e5,...r,headers:xe([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},a,r?.headers]),stream:n.stream??!1})}parse(e,r){return r={...r,headers:xe([{"anthropic-beta":[...e.betas??[],"structured-outputs-2025-12-15"].toString()},r?.headers])},this.create(e,r).then(n=>zv(n,e,{logger:this._client.logger??console}))}stream(e,r){return Vh.createMessage(this,e,r)}countTokens(e,r){let n=lT(e),{betas:i,...o}=n;return this._client.post("/v1/messages/count_tokens?beta=true",{body:o,...r,headers:xe([{"anthropic-beta":[...i??[],"token-counting-2024-11-01"].toString()},r?.headers])})}toolRunner(e,r){return new Dc(this._client,e,r)}};function lT(t){if(!t.output_format)return t;if(t.output_config?.format)throw new te("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:e,...r}=t;return{...r,output_config:{...t.output_config,format:e}}}uo.Batches=Uc;uo.BetaToolRunner=Dc;uo.ToolError=va;var Zc=class extends kt{create(e,r={},n){let{betas:i,...o}=r??{};return this._client.post(St`/v1/skills/${e}/versions?beta=true`,zc({body:o,...n,headers:xe([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},n?.headers])},this._client))}retrieve(e,r,n){let{skill_id:i,betas:o}=r;return this._client.get(St`/v1/skills/${i}/versions/${e}?beta=true`,{...n,headers:xe([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},n?.headers])})}list(e,r={},n){let{betas:i,...o}=r??{};return this._client.getAPIList(St`/v1/skills/${e}/versions?beta=true`,Cc,{query:o,...n,headers:xe([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},n?.headers])})}delete(e,r,n){let{skill_id:i,betas:o}=r;return this._client.delete(St`/v1/skills/${i}/versions/${e}?beta=true`,{...n,headers:xe([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},n?.headers])})}};var xa=class extends kt{constructor(){super(...arguments),this.versions=new Zc(this._client)}create(e={},r){let{betas:n,...i}=e??{};return this._client.post("/v1/skills?beta=true",zc({body:i,...r,headers:xe([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},r?.headers])},this._client,!1))}retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(St`/v1/skills/${e}?beta=true`,{...n,headers:xe([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/skills?beta=true",Cc,{query:i,...r,headers:xe([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},r?.headers])})}delete(e,r={},n){let{betas:i}=r??{};return this._client.delete(St`/v1/skills/${e}?beta=true`,{...n,headers:xe([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},n?.headers])})}};xa.Versions=Zc;var Yn=class extends kt{constructor(){super(...arguments),this.models=new Rc(this._client),this.messages=new uo(this._client),this.files=new Oc(this._client),this.skills=new xa(this._client)}};Yn.Models=Rc;Yn.Messages=uo;Yn.Files=Oc;Yn.Skills=xa;var ka=class extends kt{create(e,r){let{betas:n,...i}=e;return this._client.post("/v1/complete",{body:i,timeout:this._client._options.timeout??6e5,...r,headers:xe([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}};function cT(t){return t?.output_config?.format}function Dv(t,e,r){let n=cT(e);return!e||!("parse"in(n??{}))?{...t,content:t.content.map(i=>i.type==="text"?Object.defineProperty({...i},"parsed_output",{value:null,enumerable:!1}):i),parsed_output:null}:Lv(t,e,r)}function Lv(t,e,r){let n=null,i=t.content.map(o=>{if(o.type==="text"){let s=pZ(e,o.text);return n===null&&(n=s),Object.defineProperty({...o},"parsed_output",{value:s,enumerable:!1})}return o});return{...t,content:i,parsed_output:n}}function pZ(t,e){let r=cT(t);if(r?.type!=="json_schema")return null;try{return"parse"in r?r.parse(e):JSON.parse(e)}catch(n){throw new te(`Failed to parse structured output: ${n}`)}}var Tn,ls,Fc,rf,qh,nf,of,Bh,sf,fo,af,Wh,Gh,Sa,Hh,Xh,lf,Uv,uT,Zv,Fv,Vv,qv,dT,fT="__json_buf";function pT(t){return t.type==="tool_use"||t.type==="server_tool_use"}var Kh=class t{constructor(e,r){Tn.add(this),this.messages=[],this.receivedMessages=[],ls.set(this,void 0),Fc.set(this,null),this.controller=new AbortController,rf.set(this,void 0),qh.set(this,()=>{}),nf.set(this,()=>{}),of.set(this,void 0),Bh.set(this,()=>{}),sf.set(this,()=>{}),fo.set(this,{}),af.set(this,!1),Wh.set(this,!1),Gh.set(this,!1),Sa.set(this,!1),Hh.set(this,void 0),Xh.set(this,void 0),lf.set(this,void 0),Zv.set(this,n=>{if(W(this,Wh,!0,"f"),oo(n)&&(n=new ur),n instanceof ur)return W(this,Gh,!0,"f"),this._emit("abort",n);if(n instanceof te)return this._emit("error",n);if(n instanceof Error){let i=new te(n.message);return i.cause=n,this._emit("error",i)}return this._emit("error",new te(String(n)))}),W(this,rf,new Promise((n,i)=>{W(this,qh,n,"f"),W(this,nf,i,"f")}),"f"),W(this,of,new Promise((n,i)=>{W(this,Bh,n,"f"),W(this,sf,i,"f")}),"f"),A(this,rf,"f").catch(()=>{}),A(this,of,"f").catch(()=>{}),W(this,Fc,e,"f"),W(this,lf,r?.logger??console,"f")}get response(){return A(this,Hh,"f")}get request_id(){return A(this,Xh,"f")}async withResponse(){W(this,Sa,!0,"f");let e=await A(this,rf,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n,{logger:i}={}){let o=new t(r,{logger:i});for(let s of r.messages)o._addMessageParam(s);return W(o,Fc,{...r,stream:!0},"f"),o._run(()=>o._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},A(this,Zv,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let i=n?.signal,o;i&&(i.aborted&&this.controller.abort(),o=this.controller.abort.bind(this.controller),i.addEventListener("abort",o));try{A(this,Tn,"m",Fv).call(this);let{response:s,data:a}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(s);for await(let l of a)A(this,Tn,"m",Vv).call(this,l);if(a.controller.signal?.aborted)throw new ur;A(this,Tn,"m",qv).call(this)}finally{i&&o&&i.removeEventListener("abort",o)}}_connected(e){this.ended||(W(this,Hh,e,"f"),W(this,Xh,e?.headers.get("request-id"),"f"),A(this,qh,"f").call(this,e),this._emit("connect"))}get ended(){return A(this,af,"f")}get errored(){return A(this,Wh,"f")}get aborted(){return A(this,Gh,"f")}abort(){this.controller.abort()}on(e,r){return(A(this,fo,"f")[e]||(A(this,fo,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=A(this,fo,"f")[e];if(!n)return this;let i=n.findIndex(o=>o.listener===r);return i>=0&&n.splice(i,1),this}once(e,r){return(A(this,fo,"f")[e]||(A(this,fo,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{W(this,Sa,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){W(this,Sa,!0,"f"),await A(this,of,"f")}get currentMessage(){return A(this,ls,"f")}async finalMessage(){return await this.done(),A(this,Tn,"m",Uv).call(this)}async finalText(){return await this.done(),A(this,Tn,"m",uT).call(this)}_emit(e,...r){if(A(this,af,"f"))return;e==="end"&&(W(this,af,!0,"f"),A(this,Bh,"f").call(this));let n=A(this,fo,"f")[e];if(n&&(A(this,fo,"f")[e]=n.filter(i=>!i.once),n.forEach(({listener:i})=>i(...r))),e==="abort"){let i=r[0];!A(this,Sa,"f")&&!n?.length&&Promise.reject(i),A(this,nf,"f").call(this,i),A(this,sf,"f").call(this,i),this._emit("end");return}if(e==="error"){let i=r[0];!A(this,Sa,"f")&&!n?.length&&Promise.reject(i),A(this,nf,"f").call(this,i),A(this,sf,"f").call(this,i),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",A(this,Tn,"m",Uv).call(this))}async _fromReadableStream(e,r){let n=r?.signal,i;n&&(n.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),n.addEventListener("abort",i));try{A(this,Tn,"m",Fv).call(this),this._connected(null);let o=Si.fromReadableStream(e,this.controller);for await(let s of o)A(this,Tn,"m",Vv).call(this,s);if(o.controller.signal?.aborted)throw new ur;A(this,Tn,"m",qv).call(this)}finally{n&&i&&n.removeEventListener("abort",i)}}[(ls=new WeakMap,Fc=new WeakMap,rf=new WeakMap,qh=new WeakMap,nf=new WeakMap,of=new WeakMap,Bh=new WeakMap,sf=new WeakMap,fo=new WeakMap,af=new WeakMap,Wh=new WeakMap,Gh=new WeakMap,Sa=new WeakMap,Hh=new WeakMap,Xh=new WeakMap,lf=new WeakMap,Zv=new WeakMap,Tn=new WeakSet,Uv=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},uT=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new te("stream ended without producing a content block with type=text");return r.join(" ")},Fv=function(){this.ended||W(this,ls,void 0,"f")},Vv=function(r){if(this.ended)return;let n=A(this,Tn,"m",dT).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let i=n.content.at(-1);switch(r.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",r.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",r.delta.citation,i.citations??[]);break}case"input_json_delta":{pT(i)&&i.input&&this._emit("inputJson",r.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",r.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(Dv(n,A(this,Fc,"f"),{logger:A(this,lf,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{W(this,ls,n,"f");break}case"content_block_start":case"message_delta":break}},qv=function(){if(this.ended)throw new te("stream has ended, this shouldn't happen");let r=A(this,ls,"f");if(!r)throw new te("request ended without sending any chunks");return W(this,ls,void 0,"f"),Dv(r,A(this,Fc,"f"),{logger:A(this,lf,"f")})},dT=function(r){let n=A(this,ls,"f");if(r.type==="message_start"){if(n)throw new te(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new te(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),n;case"content_block_start":return n.content.push({...r.content_block}),n;case"content_block_delta":{let i=n.content.at(r.index);switch(r.delta.type){case"text_delta":{i?.type==="text"&&(n.content[r.index]={...i,text:(i.text||"")+r.delta.text});break}case"citations_delta":{i?.type==="text"&&(n.content[r.index]={...i,citations:[...i.citations??[],r.delta.citation]});break}case"input_json_delta":{if(i&&pT(i)){let o=i[fT]||"";o+=r.delta.partial_json;let s={...i};Object.defineProperty(s,fT,{value:o,enumerable:!1,writable:!0}),o&&(s.input=Nh(o)),n.content[r.index]=s}break}case"thinking_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,thinking:i.thinking+r.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,signature:r.delta.signature});break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",i=>{let o=r.shift();o?o.resolve(i):e.push(i)}),this.on("end",()=>{n=!0;for(let i of r)i.resolve(void 0);r.length=0}),this.on("abort",i=>{n=!0;for(let o of r)o.reject(i);r.length=0}),this.on("error",i=>{n=!0;for(let o of r)o.reject(i);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((o,s)=>r.push({resolve:o,reject:s})).then(o=>o?{value:o,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Si(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var Vc=class extends kt{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(St`/v1/messages/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/v1/messages/batches",En,{query:e,...r})}delete(e,r){return this._client.delete(St`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(St`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let n=await this.retrieve(e);if(!n.results_url)throw new te(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...r,headers:xe([{Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((i,o)=>Lc.fromResponse(o.response,o.controller))}};var cs=class extends kt{constructor(){super(...arguments),this.batches=new Vc(this._client)}create(e,r){e.model in mT&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${mT[e.model]}
|
|
76
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),e.model in hZ&&e.thinking&&e.thinking.type==="enabled"&&console.warn(`Using Claude with ${e.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let n=this._client._options.timeout;if(!e.stream&&n==null){let o=Rh[e.model]??void 0;n=this._client.calculateNonstreamingTimeout(e.max_tokens,o)}let i=Oh(e.tools,e.messages);return this._client.post("/v1/messages",{body:e,timeout:n??6e5,...r,headers:xe([i,r?.headers]),stream:e.stream??!1})}parse(e,r){return this.create(e,r).then(n=>Lv(n,e,{logger:this._client.logger??console}))}stream(e,r){return Kh.createMessage(this,e,r,{logger:this._client.logger??console})}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},mT={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026"},hZ=["claude-opus-4-6"];cs.Batches=Vc;var $a=class extends kt{retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(St`/v1/models/${e}`,{...n,headers:xe([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/models",
|
|
74
|
+
Wrap your summary in <summary></summary> tags.`;var Qd,jc,wa,Jt,ef,mn,co,as,tf,oT,jv;function sT(){let t,e;return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}}var Dc=class{constructor(e,r,n){Qd.add(this),this.client=e,jc.set(this,!1),wa.set(this,!1),Jt.set(this,void 0),ef.set(this,void 0),mn.set(this,void 0),co.set(this,void 0),as.set(this,void 0),tf.set(this,0),W(this,Jt,{params:{...r,messages:structuredClone(r.messages)}},"f");let o=["BetaToolRunner",...Av(r.tools,r.messages)].join(", ");W(this,ef,{...n,headers:xe([{"x-stainless-helper":o},n?.headers])},"f"),W(this,as,sT(),"f")}async*[(jc=new WeakMap,wa=new WeakMap,Jt=new WeakMap,ef=new WeakMap,mn=new WeakMap,co=new WeakMap,as=new WeakMap,tf=new WeakMap,Qd=new WeakSet,oT=async function(){let r=A(this,Jt,"f").params.compactionControl;if(!r||!r.enabled)return!1;let n=0;if(A(this,mn,"f")!==void 0)try{let c=await A(this,mn,"f");n=c.usage.input_tokens+(c.usage.cache_creation_input_tokens??0)+(c.usage.cache_read_input_tokens??0)+c.usage.output_tokens}catch{return!1}let i=r.contextTokenThreshold??1e5;if(n<i)return!1;let o=r.model??A(this,Jt,"f").params.model,s=r.summaryPrompt??iT,a=A(this,Jt,"f").params.messages;if(a[a.length-1].role==="assistant"){let c=a[a.length-1];if(Array.isArray(c.content)){let u=c.content.filter(d=>d.type!=="tool_use");u.length===0?a.pop():c.content=u}}let l=await this.client.beta.messages.create({model:o,messages:[...a,{role:"user",content:[{type:"text",text:s}]}],max_tokens:A(this,Jt,"f").params.max_tokens},{headers:{"x-stainless-helper":"compaction"}});if(l.content[0]?.type!=="text")throw new te("Expected text response for compaction");return A(this,Jt,"f").params.messages=[{role:"user",content:l.content}],!0},Symbol.asyncIterator)](){var e;if(A(this,jc,"f"))throw new te("Cannot iterate over a consumed stream");W(this,jc,!0,"f"),W(this,wa,!0,"f"),W(this,co,void 0,"f");try{for(;;){let r;try{if(A(this,Jt,"f").params.max_iterations&&A(this,tf,"f")>=A(this,Jt,"f").params.max_iterations)break;W(this,wa,!1,"f"),W(this,co,void 0,"f"),W(this,tf,(e=A(this,tf,"f"),e++,e),"f"),W(this,mn,void 0,"f");let{max_iterations:n,compactionControl:i,...o}=A(this,Jt,"f").params;if(o.stream?(r=this.client.beta.messages.stream({...o},A(this,ef,"f")),W(this,mn,r.finalMessage(),"f"),A(this,mn,"f").catch(()=>{}),yield r):(W(this,mn,this.client.beta.messages.create({...o,stream:!1},A(this,ef,"f")),"f"),yield A(this,mn,"f")),!await A(this,Qd,"m",oT).call(this)){if(!A(this,wa,"f")){let{role:l,content:c}=await A(this,mn,"f");A(this,Jt,"f").params.messages.push({role:l,content:c})}let a=await A(this,Qd,"m",jv).call(this,A(this,Jt,"f").params.messages.at(-1));if(a)A(this,Jt,"f").params.messages.push(a);else if(!A(this,wa,"f"))break}}finally{r&&r.abort()}}if(!A(this,mn,"f"))throw new te("ToolRunner concluded without a message from the server");A(this,as,"f").resolve(await A(this,mn,"f"))}catch(r){throw W(this,jc,!1,"f"),A(this,as,"f").promise.catch(()=>{}),A(this,as,"f").reject(r),W(this,as,sT(),"f"),r}}setMessagesParams(e){typeof e=="function"?A(this,Jt,"f").params=e(A(this,Jt,"f").params):A(this,Jt,"f").params=e,W(this,wa,!0,"f"),W(this,co,void 0,"f")}async generateToolResponse(){let e=await A(this,mn,"f")??this.params.messages.at(-1);return e?A(this,Qd,"m",jv).call(this,e):null}done(){return A(this,as,"f").promise}async runUntilDone(){if(!A(this,jc,"f"))for await(let e of this);return this.done()}get params(){return A(this,Jt,"f").params}pushMessages(...e){this.setMessagesParams(r=>({...r,messages:[...r.messages,...e]}))}then(e,r){return this.runUntilDone().then(e,r)}};jv=async function(e){return A(this,co,"f")!==void 0?A(this,co,"f"):(W(this,co,aZ(A(this,Jt,"f").params,e),"f"),A(this,co,"f"))};async function aZ(t,e=t.messages.at(-1)){if(!e||e.role!=="assistant"||!e.content||typeof e.content=="string")return null;let r=e.content.filter(i=>i.type==="tool_use");return r.length===0?null:{role:"user",content:await Promise.all(r.map(async i=>{let o=t.tools.find(s=>("name"in s?s.name:s.mcp_server_name)===i.name);if(!o||!("run"in o))return{type:"tool_result",tool_use_id:i.id,content:`Error: Tool '${i.name}' not found`,is_error:!0};try{let s=i.input;"parse"in o&&o.parse&&(s=o.parse(s));let a=await o.run(s);return{type:"tool_result",tool_use_id:i.id,content:a}}catch(s){return{type:"tool_result",tool_use_id:i.id,content:s instanceof va?s.content:`Error: ${s instanceof Error?s.message:String(s)}`,is_error:!0}}}))}}var Lc=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new so;for await(let r of this.iterator)for(let n of e.decode(r))yield JSON.parse(n);for(let r of e.flush())yield JSON.parse(r)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,r){if(!e.body)throw r.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new te("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new te("Attempted to iterate over a response with no body");return new t(Ld(e.body),r)}};var Uc=class extends kt{create(e,r){let{betas:n,...i}=e;return this._client.post("/v1/messages/batches?beta=true",{body:i,...r,headers:xe([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(St`/v1/messages/batches/${e}?beta=true`,{...n,headers:xe([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",Pn,{query:i,...r,headers:xe([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}delete(e,r={},n){let{betas:i}=r??{};return this._client.delete(St`/v1/messages/batches/${e}?beta=true`,{...n,headers:xe([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}cancel(e,r={},n){let{betas:i}=r??{};return this._client.post(St`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:xe([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},n?.headers])})}async results(e,r={},n){let i=await this.retrieve(e);if(!i.results_url)throw new te(`No batch \`results_url\`; Has it finished processing? ${i.processing_status} - ${i.id}`);let{betas:o}=r??{};return this._client.get(i.results_url,{...n,headers:xe([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((s,a)=>Lc.fromResponse(a.response,a.controller))}};var aT={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026"},cZ=["claude-opus-4-6"],uo=class extends kt{constructor(){super(...arguments),this.batches=new Uc(this._client)}create(e,r){let n=lT(e),{betas:i,...o}=n;o.model in aT&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${aT[o.model]}
|
|
75
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),o.model in cZ&&o.thinking&&o.thinking.type==="enabled"&&console.warn(`Using Claude with ${o.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let s=this._client._options.timeout;if(!o.stream&&s==null){let l=Rh[o.model]??void 0;s=this._client.calculateNonstreamingTimeout(o.max_tokens,l)}let a=Oh(o.tools,o.messages);return this._client.post("/v1/messages?beta=true",{body:o,timeout:s??6e5,...r,headers:xe([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},a,r?.headers]),stream:n.stream??!1})}parse(e,r){return r={...r,headers:xe([{"anthropic-beta":[...e.betas??[],"structured-outputs-2025-12-15"].toString()},r?.headers])},this.create(e,r).then(n=>zv(n,e,{logger:this._client.logger??console}))}stream(e,r){return Vh.createMessage(this,e,r)}countTokens(e,r){let n=lT(e),{betas:i,...o}=n;return this._client.post("/v1/messages/count_tokens?beta=true",{body:o,...r,headers:xe([{"anthropic-beta":[...i??[],"token-counting-2024-11-01"].toString()},r?.headers])})}toolRunner(e,r){return new Dc(this._client,e,r)}};function lT(t){if(!t.output_format)return t;if(t.output_config?.format)throw new te("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:e,...r}=t;return{...r,output_config:{...t.output_config,format:e}}}uo.Batches=Uc;uo.BetaToolRunner=Dc;uo.ToolError=va;var Zc=class extends kt{create(e,r={},n){let{betas:i,...o}=r??{};return this._client.post(St`/v1/skills/${e}/versions?beta=true`,zc({body:o,...n,headers:xe([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},n?.headers])},this._client))}retrieve(e,r,n){let{skill_id:i,betas:o}=r;return this._client.get(St`/v1/skills/${i}/versions/${e}?beta=true`,{...n,headers:xe([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},n?.headers])})}list(e,r={},n){let{betas:i,...o}=r??{};return this._client.getAPIList(St`/v1/skills/${e}/versions?beta=true`,Cc,{query:o,...n,headers:xe([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},n?.headers])})}delete(e,r,n){let{skill_id:i,betas:o}=r;return this._client.delete(St`/v1/skills/${i}/versions/${e}?beta=true`,{...n,headers:xe([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},n?.headers])})}};var xa=class extends kt{constructor(){super(...arguments),this.versions=new Zc(this._client)}create(e={},r){let{betas:n,...i}=e??{};return this._client.post("/v1/skills?beta=true",zc({body:i,...r,headers:xe([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},r?.headers])},this._client,!1))}retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(St`/v1/skills/${e}?beta=true`,{...n,headers:xe([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/skills?beta=true",Cc,{query:i,...r,headers:xe([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},r?.headers])})}delete(e,r={},n){let{betas:i}=r??{};return this._client.delete(St`/v1/skills/${e}?beta=true`,{...n,headers:xe([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},n?.headers])})}};xa.Versions=Zc;var Yn=class extends kt{constructor(){super(...arguments),this.models=new Rc(this._client),this.messages=new uo(this._client),this.files=new Oc(this._client),this.skills=new xa(this._client)}};Yn.Models=Rc;Yn.Messages=uo;Yn.Files=Oc;Yn.Skills=xa;var ka=class extends kt{create(e,r){let{betas:n,...i}=e;return this._client.post("/v1/complete",{body:i,timeout:this._client._options.timeout??6e5,...r,headers:xe([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}};function cT(t){return t?.output_config?.format}function Dv(t,e,r){let n=cT(e);return!e||!("parse"in(n??{}))?{...t,content:t.content.map(i=>i.type==="text"?Object.defineProperty({...i},"parsed_output",{value:null,enumerable:!1}):i),parsed_output:null}:Lv(t,e,r)}function Lv(t,e,r){let n=null,i=t.content.map(o=>{if(o.type==="text"){let s=pZ(e,o.text);return n===null&&(n=s),Object.defineProperty({...o},"parsed_output",{value:s,enumerable:!1})}return o});return{...t,content:i,parsed_output:n}}function pZ(t,e){let r=cT(t);if(r?.type!=="json_schema")return null;try{return"parse"in r?r.parse(e):JSON.parse(e)}catch(n){throw new te(`Failed to parse structured output: ${n}`)}}var An,ls,Fc,rf,qh,nf,of,Bh,sf,fo,af,Wh,Gh,Sa,Hh,Xh,lf,Uv,uT,Zv,Fv,Vv,qv,dT,fT="__json_buf";function pT(t){return t.type==="tool_use"||t.type==="server_tool_use"}var Kh=class t{constructor(e,r){An.add(this),this.messages=[],this.receivedMessages=[],ls.set(this,void 0),Fc.set(this,null),this.controller=new AbortController,rf.set(this,void 0),qh.set(this,()=>{}),nf.set(this,()=>{}),of.set(this,void 0),Bh.set(this,()=>{}),sf.set(this,()=>{}),fo.set(this,{}),af.set(this,!1),Wh.set(this,!1),Gh.set(this,!1),Sa.set(this,!1),Hh.set(this,void 0),Xh.set(this,void 0),lf.set(this,void 0),Zv.set(this,n=>{if(W(this,Wh,!0,"f"),oo(n)&&(n=new ur),n instanceof ur)return W(this,Gh,!0,"f"),this._emit("abort",n);if(n instanceof te)return this._emit("error",n);if(n instanceof Error){let i=new te(n.message);return i.cause=n,this._emit("error",i)}return this._emit("error",new te(String(n)))}),W(this,rf,new Promise((n,i)=>{W(this,qh,n,"f"),W(this,nf,i,"f")}),"f"),W(this,of,new Promise((n,i)=>{W(this,Bh,n,"f"),W(this,sf,i,"f")}),"f"),A(this,rf,"f").catch(()=>{}),A(this,of,"f").catch(()=>{}),W(this,Fc,e,"f"),W(this,lf,r?.logger??console,"f")}get response(){return A(this,Hh,"f")}get request_id(){return A(this,Xh,"f")}async withResponse(){W(this,Sa,!0,"f");let e=await A(this,rf,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n,{logger:i}={}){let o=new t(r,{logger:i});for(let s of r.messages)o._addMessageParam(s);return W(o,Fc,{...r,stream:!0},"f"),o._run(()=>o._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},A(this,Zv,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let i=n?.signal,o;i&&(i.aborted&&this.controller.abort(),o=this.controller.abort.bind(this.controller),i.addEventListener("abort",o));try{A(this,An,"m",Fv).call(this);let{response:s,data:a}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(s);for await(let l of a)A(this,An,"m",Vv).call(this,l);if(a.controller.signal?.aborted)throw new ur;A(this,An,"m",qv).call(this)}finally{i&&o&&i.removeEventListener("abort",o)}}_connected(e){this.ended||(W(this,Hh,e,"f"),W(this,Xh,e?.headers.get("request-id"),"f"),A(this,qh,"f").call(this,e),this._emit("connect"))}get ended(){return A(this,af,"f")}get errored(){return A(this,Wh,"f")}get aborted(){return A(this,Gh,"f")}abort(){this.controller.abort()}on(e,r){return(A(this,fo,"f")[e]||(A(this,fo,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=A(this,fo,"f")[e];if(!n)return this;let i=n.findIndex(o=>o.listener===r);return i>=0&&n.splice(i,1),this}once(e,r){return(A(this,fo,"f")[e]||(A(this,fo,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{W(this,Sa,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){W(this,Sa,!0,"f"),await A(this,of,"f")}get currentMessage(){return A(this,ls,"f")}async finalMessage(){return await this.done(),A(this,An,"m",Uv).call(this)}async finalText(){return await this.done(),A(this,An,"m",uT).call(this)}_emit(e,...r){if(A(this,af,"f"))return;e==="end"&&(W(this,af,!0,"f"),A(this,Bh,"f").call(this));let n=A(this,fo,"f")[e];if(n&&(A(this,fo,"f")[e]=n.filter(i=>!i.once),n.forEach(({listener:i})=>i(...r))),e==="abort"){let i=r[0];!A(this,Sa,"f")&&!n?.length&&Promise.reject(i),A(this,nf,"f").call(this,i),A(this,sf,"f").call(this,i),this._emit("end");return}if(e==="error"){let i=r[0];!A(this,Sa,"f")&&!n?.length&&Promise.reject(i),A(this,nf,"f").call(this,i),A(this,sf,"f").call(this,i),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",A(this,An,"m",Uv).call(this))}async _fromReadableStream(e,r){let n=r?.signal,i;n&&(n.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),n.addEventListener("abort",i));try{A(this,An,"m",Fv).call(this),this._connected(null);let o=Si.fromReadableStream(e,this.controller);for await(let s of o)A(this,An,"m",Vv).call(this,s);if(o.controller.signal?.aborted)throw new ur;A(this,An,"m",qv).call(this)}finally{n&&i&&n.removeEventListener("abort",i)}}[(ls=new WeakMap,Fc=new WeakMap,rf=new WeakMap,qh=new WeakMap,nf=new WeakMap,of=new WeakMap,Bh=new WeakMap,sf=new WeakMap,fo=new WeakMap,af=new WeakMap,Wh=new WeakMap,Gh=new WeakMap,Sa=new WeakMap,Hh=new WeakMap,Xh=new WeakMap,lf=new WeakMap,Zv=new WeakMap,An=new WeakSet,Uv=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},uT=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new te("stream ended without producing a content block with type=text");return r.join(" ")},Fv=function(){this.ended||W(this,ls,void 0,"f")},Vv=function(r){if(this.ended)return;let n=A(this,An,"m",dT).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let i=n.content.at(-1);switch(r.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",r.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",r.delta.citation,i.citations??[]);break}case"input_json_delta":{pT(i)&&i.input&&this._emit("inputJson",r.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",r.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}default:r.delta}break}case"message_stop":{this._addMessageParam(n),this._addMessage(Dv(n,A(this,Fc,"f"),{logger:A(this,lf,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{W(this,ls,n,"f");break}case"content_block_start":case"message_delta":break}},qv=function(){if(this.ended)throw new te("stream has ended, this shouldn't happen");let r=A(this,ls,"f");if(!r)throw new te("request ended without sending any chunks");return W(this,ls,void 0,"f"),Dv(r,A(this,Fc,"f"),{logger:A(this,lf,"f")})},dT=function(r){let n=A(this,ls,"f");if(r.type==="message_start"){if(n)throw new te(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new te(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),n;case"content_block_start":return n.content.push({...r.content_block}),n;case"content_block_delta":{let i=n.content.at(r.index);switch(r.delta.type){case"text_delta":{i?.type==="text"&&(n.content[r.index]={...i,text:(i.text||"")+r.delta.text});break}case"citations_delta":{i?.type==="text"&&(n.content[r.index]={...i,citations:[...i.citations??[],r.delta.citation]});break}case"input_json_delta":{if(i&&pT(i)){let o=i[fT]||"";o+=r.delta.partial_json;let s={...i};Object.defineProperty(s,fT,{value:o,enumerable:!1,writable:!0}),o&&(s.input=Nh(o)),n.content[r.index]=s}break}case"thinking_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,thinking:i.thinking+r.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(n.content[r.index]={...i,signature:r.delta.signature});break}default:r.delta}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",i=>{let o=r.shift();o?o.resolve(i):e.push(i)}),this.on("end",()=>{n=!0;for(let i of r)i.resolve(void 0);r.length=0}),this.on("abort",i=>{n=!0;for(let o of r)o.reject(i);r.length=0}),this.on("error",i=>{n=!0;for(let o of r)o.reject(i);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((o,s)=>r.push({resolve:o,reject:s})).then(o=>o?{value:o,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Si(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var Vc=class extends kt{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(St`/v1/messages/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/v1/messages/batches",Pn,{query:e,...r})}delete(e,r){return this._client.delete(St`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(St`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let n=await this.retrieve(e);if(!n.results_url)throw new te(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...r,headers:xe([{Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((i,o)=>Lc.fromResponse(o.response,o.controller))}};var cs=class extends kt{constructor(){super(...arguments),this.batches=new Vc(this._client)}create(e,r){e.model in mT&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${mT[e.model]}
|
|
76
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),e.model in hZ&&e.thinking&&e.thinking.type==="enabled"&&console.warn(`Using Claude with ${e.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let n=this._client._options.timeout;if(!e.stream&&n==null){let o=Rh[e.model]??void 0;n=this._client.calculateNonstreamingTimeout(e.max_tokens,o)}let i=Oh(e.tools,e.messages);return this._client.post("/v1/messages",{body:e,timeout:n??6e5,...r,headers:xe([i,r?.headers]),stream:e.stream??!1})}parse(e,r){return this.create(e,r).then(n=>Lv(n,e,{logger:this._client.logger??console}))}stream(e,r){return Kh.createMessage(this,e,r,{logger:this._client.logger??console})}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},mT={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026"},hZ=["claude-opus-4-6"];cs.Batches=Vc;var $a=class extends kt{retrieve(e,r={},n){let{betas:i}=r??{};return this._client.get(St`/v1/models/${e}`,{...n,headers:xe([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...i}=e??{};return this._client.getAPIList("/v1/models",Pn,{query:i,...r,headers:xe([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}};var cf=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()};var Bv,Wv,Jh,hT,gT="\\n\\nHuman:",yT="\\n\\nAssistant:",Ct=class{constructor({baseURL:e=cf("ANTHROPIC_BASE_URL"),apiKey:r=cf("ANTHROPIC_API_KEY")??null,authToken:n=cf("ANTHROPIC_AUTH_TOKEN")??null,...i}={}){Bv.add(this),Jh.set(this,void 0);let o={apiKey:r,authToken:n,...i,baseURL:e||"https://api.anthropic.com"};if(!o.dangerouslyAllowBrowser&&MP())throw new te(`It looks like you're running in a browser-like environment.
|
|
77
77
|
|
|
78
78
|
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
79
79
|
If you understand the risks and have appropriate mitigations in place,
|
|
@@ -87,7 +87,7 @@ New information found:
|
|
|
87
87
|
${o}
|
|
88
88
|
|
|
89
89
|
New tools available:
|
|
90
|
-
${s}`}},{id:"ui.openURL",type:"action",name:"Open a URL in a new tab.",tags:"open, url, website, navigate, visit, go to, new tab, browser",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowOpenNewTab,content:"Opens the specified URL in a new tab. Use this when the user asks to open a website, visit a URL, go to a page, or navigate to a specific website. Only available when allowOpenNewTab flag is enabled.",parameters:[{name:"url",type:"string",description:"The URL to open in a new tab"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowOpenNewTab)throw new Error("Open New Tab action is not enabled for this persona.");if(!e.url||typeof e.url!="string")throw new Error("URL parameter is required and must be a string.");if(!window.open(e.url,"_blank"))throw new Error("Window blocked by popup blocker. Please allow popups for this site.");return`Opened URL: ${e.url}`}},{id:"ui.changeRoute",type:"action",name:"Change the current page route.",tags:"navigate, route, path, page, go to, change page, routing, navigation",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowChangeRoute,content:"Changes the current page route to the specified path. Use this when the user asks to navigate to a different page, go to a specific section, or change the current page route. Only available when allowChangeRoute flag is enabled.",parameters:[{name:"path",type:"string",description:'The path to navigate to (e.g., "/home", "/dashboard")'}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowChangeRoute)throw new Error("Change Route action is not enabled for this persona.");if(!e.path||typeof e.path!="string")throw new Error("Path parameter is required and must be a string.");let n=new URL(e.path,window.location.origin).pathname;return window.location.href=n,`Changed route to: ${n}`}},{id:"ui.sendEmail",type:"action",name:"Send an email",tags:"email, send, mail, compose, message, contact, mailto",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowSendEmail,content:"Sends an email using the user's default mail client by opening a mailto: link. Use this when the user asks to send an email, compose a message, or contact someone via email. Only available when allowSendEmail flag is enabled.",parameters:[{name:"email_address",type:"string",description:"The recipient email address"},{name:"subject",type:"string",description:"The email subject line"},{name:"body",type:"string",description:"The email body content"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowSendEmail)throw new Error("Send Email action is not enabled for this persona.");if(!e.email_address||typeof e.email_address!="string")throw new Error("Email address parameter is required and must be a string.");if(!e.subject||typeof e.subject!="string")throw new Error("Subject parameter is required and must be a string.");if(!e.body||typeof e.body!="string")throw new Error("Body parameter is required and must be a string.");let n=encodeURIComponent(e.email_address),i=encodeURIComponent(e.subject),o=encodeURIComponent(e.body),s=`mailto:${n}?subject=${i}&body=${o}`;try{window.location.href=s}catch(a){throw new Error(`Failed to open email client: ${a instanceof Error?a.message:String(a)}`)}return`Email opened in default mail client. Recipient: ${e.email_address}, Subject: ${e.subject}`}}];var Fe;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Fe||(Fe={}));var CT;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(CT||(CT={}));var Y=Fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),po=t=>{switch(typeof t){case"undefined":return Y.undefined;case"string":return Y.string;case"number":return Number.isNaN(t)?Y.nan:Y.number;case"boolean":return Y.boolean;case"function":return Y.function;case"bigint":return Y.bigint;case"symbol":return Y.symbol;case"object":return Array.isArray(t)?Y.array:t===null?Y.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Y.promise:typeof Map<"u"&&t instanceof Map?Y.map:typeof Set<"u"&&t instanceof Set?Y.set:typeof Date<"u"&&t instanceof Date?Y.date:Y.object;default:return Y.unknown}};var L=Fe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var hn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Fe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};hn.create=t=>new hn(t);var PZ=(t,e)=>{let r;switch(t.code){case L.invalid_type:t.received===Y.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case L.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Fe.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:r=`Unrecognized key(s) in object: ${Fe.joinValues(t.keys,", ")}`;break;case L.invalid_union:r="Invalid input";break;case L.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Fe.joinValues(t.options)}`;break;case L.invalid_enum_value:r=`Invalid enum value. Expected ${Fe.joinValues(t.options)}, received '${t.received}'`;break;case L.invalid_arguments:r="Invalid function arguments";break;case L.invalid_return_type:r="Invalid function return type";break;case L.invalid_date:r="Invalid date";break;case L.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Fe.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case L.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case L.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case L.custom:r="Invalid input";break;case L.invalid_intersection_types:r="Intersection results could not be merged";break;case L.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case L.not_finite:r="Number must be finite";break;default:r=e.defaultError,Fe.assertNever(t)}return{message:r}},us=PZ;var TZ=us;function pf(){return TZ}var rg=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}};function H(t,e){let r=pf(),n=rg({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===us?void 0:us].filter(i=>!!i)});t.common.issues.push(n)}var $r=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return ye;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ye;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},ye=Object.freeze({status:"aborted"}),Bc=t=>({status:"dirty",value:t}),jr=t=>({status:"valid",value:t}),rw=t=>t.status==="aborted",nw=t=>t.status==="dirty",Ia=t=>t.status==="valid",mf=t=>typeof Promise<"u"&&t instanceof Promise;var re;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(re||(re={}));var An=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},zT=(t,e)=>{if(Ia(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new hn(t.common.issues);return this._error=r,this._error}}};function Pe(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??r??a.defaultError}},description:i}}var Ne=class{get description(){return this._def.description}_getType(e){return po(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:po(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $r,ctx:{common:e.parent.common,data:e.data,parsedType:po(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(mf(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:po(e)},i=this._parseSync({data:e,path:n.path,parent:n});return zT(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:po(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Ia(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Ia(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:po(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(mf(i)?i:Promise.resolve(i));return zT(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:L.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new ei({schema:this,typeName:he.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Qn.create(this,this._def)}nullable(){return go.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fs.create(this)}promise(){return Ea.create(this,this._def)}or(e){return Kc.create([this,e],this._def)}and(e){return Jc.create(this,e,this._def)}transform(e){return new ei({...Pe(this._def),schema:this,typeName:he.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ru({...Pe(this._def),innerType:this,defaultValue:r,typeName:he.ZodDefault})}brand(){return new ng({typeName:he.ZodBranded,type:this,...Pe(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new nu({...Pe(this._def),innerType:this,catchValue:r,typeName:he.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ig.create(this,e)}readonly(){return iu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},AZ=/^c[^\s-]{8,}$/i,CZ=/^[0-9a-z]+$/,zZ=/^[0-9A-HJKMNP-TV-Z]{26}$/i,OZ=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,RZ=/^[a-z0-9_-]{21}$/i,NZ=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,MZ=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,jZ=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,DZ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",iw,LZ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,UZ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ZZ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,FZ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,VZ=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qZ=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OT="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",BZ=new RegExp(`^${OT}$`);function RT(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function WZ(t){return new RegExp(`^${RT(t)}$`)}function GZ(t){let e=`${OT}T${RT(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function HZ(t,e){return!!((e==="v4"||!e)&&LZ.test(t)||(e==="v6"||!e)&&ZZ.test(t))}function XZ(t,e){if(!NZ.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function KZ(t,e){return!!((e==="v4"||!e)&&UZ.test(t)||(e==="v6"||!e)&&FZ.test(t))}var Gc=class t extends Ne{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Y.string){let o=this._getOrReturnCtx(e);return H(o,{code:L.invalid_type,expected:Y.string,received:o.parsedType}),ye}let n=new $r,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),H(i,{code:L.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),H(i,{code:L.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?H(i,{code:L.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&H(i,{code:L.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")jZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"email",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")iw||(iw=new RegExp(DZ,"u")),iw.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"emoji",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")OZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"uuid",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")RZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"nanoid",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")AZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"cuid",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")CZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"cuid2",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")zZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"ulid",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),H(i,{validation:"url",code:L.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"regex",code:L.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),H(i,{code:L.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),H(i,{code:L.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),H(i,{code:L.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?GZ(o).test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{code:L.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?BZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{code:L.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?WZ(o).test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{code:L.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?MZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"duration",code:L.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?HZ(e.data,o.version)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"ip",code:L.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?XZ(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"jwt",code:L.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?KZ(e.data,o.version)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"cidr",code:L.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?VZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"base64",code:L.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?qZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"base64url",code:L.invalid_string,message:o.message}),n.dirty()):Fe.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:L.invalid_string,...re.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...re.errToObj(e)})}url(e){return this._addCheck({kind:"url",...re.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...re.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...re.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...re.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...re.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...re.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...re.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...re.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...re.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...re.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...re.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...re.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...re.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...re.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...re.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...re.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...re.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...re.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...re.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...re.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...re.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...re.errToObj(r)})}nonempty(e){return this.min(1,re.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Gc.create=t=>new Gc({checks:[],typeName:he.ZodString,coerce:t?.coerce??!1,...Pe(t)});function JZ(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}var hf=class t extends Ne{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Y.number){let o=this._getOrReturnCtx(e);return H(o,{code:L.invalid_type,expected:Y.number,received:o.parsedType}),ye}let n,i=new $r;for(let o of this._def.checks)o.kind==="int"?Fe.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),H(n,{code:L.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),H(n,{code:L.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),H(n,{code:L.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?JZ(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),H(n,{code:L.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),H(n,{code:L.not_finite,message:o.message}),i.dirty()):Fe.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,re.toString(r))}gt(e,r){return this.setLimit("min",e,!1,re.toString(r))}lte(e,r){return this.setLimit("max",e,!0,re.toString(r))}lt(e,r){return this.setLimit("max",e,!1,re.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:re.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:re.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Fe.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};hf.create=t=>new hf({checks:[],typeName:he.ZodNumber,coerce:t?.coerce||!1,...Pe(t)});var gf=class t extends Ne{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Y.bigint)return this._getInvalidInput(e);let n,i=new $r;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),H(n,{code:L.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),H(n,{code:L.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),H(n,{code:L.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Fe.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return H(r,{code:L.invalid_type,expected:Y.bigint,received:r.parsedType}),ye}gte(e,r){return this.setLimit("min",e,!0,re.toString(r))}gt(e,r){return this.setLimit("min",e,!1,re.toString(r))}lte(e,r){return this.setLimit("max",e,!0,re.toString(r))}lt(e,r){return this.setLimit("max",e,!1,re.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};gf.create=t=>new gf({checks:[],typeName:he.ZodBigInt,coerce:t?.coerce??!1,...Pe(t)});var yf=class extends Ne{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Y.boolean){let n=this._getOrReturnCtx(e);return H(n,{code:L.invalid_type,expected:Y.boolean,received:n.parsedType}),ye}return jr(e.data)}};yf.create=t=>new yf({typeName:he.ZodBoolean,coerce:t?.coerce||!1,...Pe(t)});var bf=class t extends Ne{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Y.date){let o=this._getOrReturnCtx(e);return H(o,{code:L.invalid_type,expected:Y.date,received:o.parsedType}),ye}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return H(o,{code:L.invalid_date}),ye}let n=new $r,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),H(i,{code:L.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),H(i,{code:L.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Fe.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:re.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:re.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};bf.create=t=>new bf({checks:[],coerce:t?.coerce||!1,typeName:he.ZodDate,...Pe(t)});var _f=class extends Ne{_parse(e){if(this._getType(e)!==Y.symbol){let n=this._getOrReturnCtx(e);return H(n,{code:L.invalid_type,expected:Y.symbol,received:n.parsedType}),ye}return jr(e.data)}};_f.create=t=>new _f({typeName:he.ZodSymbol,...Pe(t)});var Hc=class extends Ne{_parse(e){if(this._getType(e)!==Y.undefined){let n=this._getOrReturnCtx(e);return H(n,{code:L.invalid_type,expected:Y.undefined,received:n.parsedType}),ye}return jr(e.data)}};Hc.create=t=>new Hc({typeName:he.ZodUndefined,...Pe(t)});var Xc=class extends Ne{_parse(e){if(this._getType(e)!==Y.null){let n=this._getOrReturnCtx(e);return H(n,{code:L.invalid_type,expected:Y.null,received:n.parsedType}),ye}return jr(e.data)}};Xc.create=t=>new Xc({typeName:he.ZodNull,...Pe(t)});var vf=class extends Ne{constructor(){super(...arguments),this._any=!0}_parse(e){return jr(e.data)}};vf.create=t=>new vf({typeName:he.ZodAny,...Pe(t)});var ds=class extends Ne{constructor(){super(...arguments),this._unknown=!0}_parse(e){return jr(e.data)}};ds.create=t=>new ds({typeName:he.ZodUnknown,...Pe(t)});var Ii=class extends Ne{_parse(e){let r=this._getOrReturnCtx(e);return H(r,{code:L.invalid_type,expected:Y.never,received:r.parsedType}),ye}};Ii.create=t=>new Ii({typeName:he.ZodNever,...Pe(t)});var wf=class extends Ne{_parse(e){if(this._getType(e)!==Y.undefined){let n=this._getOrReturnCtx(e);return H(n,{code:L.invalid_type,expected:Y.void,received:n.parsedType}),ye}return jr(e.data)}};wf.create=t=>new wf({typeName:he.ZodVoid,...Pe(t)});var fs=class t extends Ne{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==Y.array)return H(r,{code:L.invalid_type,expected:Y.array,received:r.parsedType}),ye;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(H(r,{code:s?L.too_big:L.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(H(r,{code:L.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(H(r,{code:L.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new An(r,s,r.path,a)))).then(s=>$r.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new An(r,s,r.path,a)));return $r.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:re.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:re.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:re.toString(r)}})}nonempty(e){return this.min(1,e)}};fs.create=(t,e)=>new fs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:he.ZodArray,...Pe(e)});function Wc(t){if(t instanceof gn){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Qn.create(Wc(n))}return new gn({...t._def,shape:()=>e})}else return t instanceof fs?new fs({...t._def,type:Wc(t.element)}):t instanceof Qn?Qn.create(Wc(t.unwrap())):t instanceof go?go.create(Wc(t.unwrap())):t instanceof ho?ho.create(t.items.map(e=>Wc(e))):t}var gn=class t extends Ne{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Fe.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==Y.object){let c=this._getOrReturnCtx(e);return H(c,{code:L.invalid_type,expected:Y.object,received:c.parsedType}),ye}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ii&&this._def.unknownKeys==="strip"))for(let c in i.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let u=o[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new An(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ii){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(H(i,{code:L.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new An(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>$r.mergeObjectSync(n,c)):$r.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return re.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:re.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:he.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Fe.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Fe.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Wc(this)}partial(e){let r={};for(let n of Fe.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Fe.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Qn;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return NT(Fe.objectKeys(this.shape))}};gn.create=(t,e)=>new gn({shape:()=>t,unknownKeys:"strip",catchall:Ii.create(),typeName:he.ZodObject,...Pe(e)});gn.strictCreate=(t,e)=>new gn({shape:()=>t,unknownKeys:"strict",catchall:Ii.create(),typeName:he.ZodObject,...Pe(e)});gn.lazycreate=(t,e)=>new gn({shape:t,unknownKeys:"strip",catchall:Ii.create(),typeName:he.ZodObject,...Pe(e)});var Kc=class extends Ne{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new hn(a.ctx.common.issues));return H(r,{code:L.invalid_union,unionErrors:s}),ye}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(l=>new hn(l));return H(r,{code:L.invalid_union,unionErrors:a}),ye}}get options(){return this._def.options}};Kc.create=(t,e)=>new Kc({options:t,typeName:he.ZodUnion,...Pe(e)});var mo=t=>t instanceof Yc?mo(t.schema):t instanceof ei?mo(t.innerType()):t instanceof Qc?[t.value]:t instanceof eu?t.options:t instanceof tu?Fe.objectValues(t.enum):t instanceof ru?mo(t._def.innerType):t instanceof Hc?[void 0]:t instanceof Xc?[null]:t instanceof Qn?[void 0,...mo(t.unwrap())]:t instanceof go?[null,...mo(t.unwrap())]:t instanceof ng||t instanceof iu?mo(t.unwrap()):t instanceof nu?mo(t._def.innerType):[],ow=class t extends Ne{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Y.object)return H(r,{code:L.invalid_type,expected:Y.object,received:r.parsedType}),ye;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(H(r,{code:L.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ye)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=mo(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:he.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Pe(n)})}};function sw(t,e){let r=po(t),n=po(e);if(t===e)return{valid:!0,data:t};if(r===Y.object&&n===Y.object){let i=Fe.objectKeys(e),o=Fe.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let l=sw(t[a],e[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(r===Y.array&&n===Y.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],l=sw(s,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===Y.date&&n===Y.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Jc=class extends Ne{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(rw(o)||rw(s))return ye;let a=sw(o.value,s.value);return a.valid?((nw(o)||nw(s))&&r.dirty(),{status:r.value,value:a.data}):(H(n,{code:L.invalid_intersection_types}),ye)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Jc.create=(t,e,r)=>new Jc({left:t,right:e,typeName:he.ZodIntersection,...Pe(r)});var ho=class t extends Ne{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.array)return H(n,{code:L.invalid_type,expected:Y.array,received:n.parsedType}),ye;if(n.data.length<this._def.items.length)return H(n,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ye;!this._def.rest&&n.data.length>this._def.items.length&&(H(n,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new An(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>$r.mergeArray(r,s)):$r.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ho.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ho({items:t,typeName:he.ZodTuple,rest:null,...Pe(e)})};var aw=class t extends Ne{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.object)return H(n,{code:L.invalid_type,expected:Y.object,received:n.parsedType}),ye;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new An(n,a,n.path,a)),value:s._parse(new An(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?$r.mergeObjectAsync(r,i):$r.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ne?new t({keyType:e,valueType:r,typeName:he.ZodRecord,...Pe(n)}):new t({keyType:Gc.create(),valueType:e,typeName:he.ZodRecord,...Pe(r)})}},xf=class extends Ne{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.map)return H(n,{code:L.invalid_type,expected:Y.map,received:n.parsedType}),ye;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,l],c)=>({key:i._parse(new An(n,a,n.path,[c,"key"])),value:o._parse(new An(n,l,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ye;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ye;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}}}};xf.create=(t,e,r)=>new xf({valueType:e,keyType:t,typeName:he.ZodMap,...Pe(r)});var kf=class t extends Ne{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.set)return H(n,{code:L.invalid_type,expected:Y.set,received:n.parsedType}),ye;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(H(n,{code:L.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(H(n,{code:L.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(l){let c=new Set;for(let u of l){if(u.status==="aborted")return ye;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((l,c)=>o._parse(new An(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:re.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:re.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};kf.create=(t,e)=>new kf({valueType:t,minSize:null,maxSize:null,typeName:he.ZodSet,...Pe(e)});var lw=class t extends Ne{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Y.function)return H(r,{code:L.invalid_type,expected:Y.function,received:r.parsedType}),ye;function n(a,l){return rg({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pf(),us].filter(c=>!!c),issueData:{code:L.invalid_arguments,argumentsError:l}})}function i(a,l){return rg({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pf(),us].filter(c=>!!c),issueData:{code:L.invalid_return_type,returnTypeError:l}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ea){let a=this;return jr(async function(...l){let c=new hn([]),u=await a._def.args.parseAsync(l,o).catch(f=>{throw c.addIssue(n(l,f)),c}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,o).catch(f=>{throw c.addIssue(i(d,f)),c})})}else{let a=this;return jr(function(...l){let c=a._def.args.safeParse(l,o);if(!c.success)throw new hn([n(l,c.error)]);let u=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(u,o);if(!d.success)throw new hn([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ho.create(e).rest(ds.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||ho.create([]).rest(ds.create()),returns:r||ds.create(),typeName:he.ZodFunction,...Pe(n)})}},Yc=class extends Ne{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Yc.create=(t,e)=>new Yc({getter:t,typeName:he.ZodLazy,...Pe(e)});var Qc=class extends Ne{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return H(r,{received:r.data,code:L.invalid_literal,expected:this._def.value}),ye}return{status:"valid",value:e.data}}get value(){return this._def.value}};Qc.create=(t,e)=>new Qc({value:t,typeName:he.ZodLiteral,...Pe(e)});function NT(t,e){return new eu({values:t,typeName:he.ZodEnum,...Pe(e)})}var eu=class t extends Ne{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return H(r,{expected:Fe.joinValues(n),received:r.parsedType,code:L.invalid_type}),ye}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return H(r,{received:r.data,code:L.invalid_enum_value,options:n}),ye}return jr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};eu.create=NT;var tu=class extends Ne{_parse(e){let r=Fe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Y.string&&n.parsedType!==Y.number){let i=Fe.objectValues(r);return H(n,{expected:Fe.joinValues(i),received:n.parsedType,code:L.invalid_type}),ye}if(this._cache||(this._cache=new Set(Fe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Fe.objectValues(r);return H(n,{received:n.data,code:L.invalid_enum_value,options:i}),ye}return jr(e.data)}get enum(){return this._def.values}};tu.create=(t,e)=>new tu({values:t,typeName:he.ZodNativeEnum,...Pe(e)});var Ea=class extends Ne{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Y.promise&&r.common.async===!1)return H(r,{code:L.invalid_type,expected:Y.promise,received:r.parsedType}),ye;let n=r.parsedType===Y.promise?r.data:Promise.resolve(r.data);return jr(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ea.create=(t,e)=>new Ea({type:t,typeName:he.ZodPromise,...Pe(e)});var ei=class extends Ne{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===he.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{H(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ye;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?ye:l.status==="dirty"?Bc(l.value):r.value==="dirty"?Bc(l.value):l});{if(r.value==="aborted")return ye;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ye:a.status==="dirty"?Bc(a.value):r.value==="dirty"?Bc(a.value):a}}if(i.type==="refinement"){let s=a=>{let l=i.refinement(a,o);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ye:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ye:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ia(s))return ye;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Ia(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ye);Fe.assertNever(i)}};ei.create=(t,e,r)=>new ei({schema:t,typeName:he.ZodEffects,effect:e,...Pe(r)});ei.createWithPreprocess=(t,e,r)=>new ei({schema:e,effect:{type:"preprocess",transform:t},typeName:he.ZodEffects,...Pe(r)});var Qn=class extends Ne{_parse(e){return this._getType(e)===Y.undefined?jr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Qn.create=(t,e)=>new Qn({innerType:t,typeName:he.ZodOptional,...Pe(e)});var go=class extends Ne{_parse(e){return this._getType(e)===Y.null?jr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};go.create=(t,e)=>new go({innerType:t,typeName:he.ZodNullable,...Pe(e)});var ru=class extends Ne{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ru.create=(t,e)=>new ru({innerType:t,typeName:he.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Pe(e)});var nu=class extends Ne{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return mf(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new hn(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new hn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};nu.create=(t,e)=>new nu({innerType:t,typeName:he.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Pe(e)});var Sf=class extends Ne{_parse(e){if(this._getType(e)!==Y.nan){let n=this._getOrReturnCtx(e);return H(n,{code:L.invalid_type,expected:Y.nan,received:n.parsedType}),ye}return{status:"valid",value:e.data}}};Sf.create=t=>new Sf({typeName:he.ZodNaN,...Pe(t)});var ng=class extends Ne{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ig=class t extends Ne{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ye:o.status==="dirty"?(r.dirty(),Bc(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ye:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:he.ZodPipeline})}},iu=class extends Ne{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Ia(i)&&(i.value=Object.freeze(i.value)),i);return mf(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};iu.create=(t,e)=>new iu({innerType:t,typeName:he.ZodReadonly,...Pe(e)});var Wme={object:gn.lazycreate},he;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(he||(he={}));var Gme=Gc.create,Hme=hf.create,Xme=Sf.create,Kme=gf.create,Jme=yf.create,Yme=bf.create,Qme=_f.create,ehe=Hc.create,the=Xc.create,rhe=vf.create,nhe=ds.create,ihe=Ii.create,ohe=wf.create,she=fs.create,YZ=gn.create,ahe=gn.strictCreate,lhe=Kc.create,che=ow.create,uhe=Jc.create,dhe=ho.create,fhe=aw.create,phe=xf.create,mhe=kf.create,hhe=lw.create,ghe=Yc.create,yhe=Qc.create,bhe=eu.create,_he=tu.create,vhe=Ea.create,whe=ei.create,xhe=Qn.create,khe=go.create,She=ei.createWithPreprocess,$he=ig.create;var sg=Object.freeze({status:"aborted"});function M(t,e,r){function n(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,l);let c=s.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){let p=u[d];p in a||(a[p]=c[p].bind(a))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:t});function s(a){var l;let c=r?.Parent?new o:this;n(c,a),(l=c._zod).deferred??(l.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var Ei=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ou=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},og={};function Ir(t){return t&&Object.assign(og,t),og}var V={};gd(V,{BIGINT_FORMAT_RANGES:()=>LT,Class:()=>uw,NUMBER_FORMAT_RANGES:()=>gw,aborted:()=>gs,allowsEval:()=>pw,assert:()=>oF,assertEqual:()=>tF,assertIs:()=>nF,assertNever:()=>iF,assertNotEqual:()=>rF,assignProp:()=>ps,base64ToUint8Array:()=>ZT,base64urlToUint8Array:()=>xF,cached:()=>au,captureStackTrace:()=>cg,cleanEnum:()=>wF,cleanRegex:()=>Ef,clone:()=>Hr,cloneDef:()=>aF,createTransparentProxy:()=>pF,defineLazy:()=>st,esc:()=>lg,escapeRegex:()=>Pi,extend:()=>gF,finalizeIssue:()=>ti,floatSafeRemainder:()=>dw,getElementAtPath:()=>lF,getEnumValues:()=>ag,getLengthableOrigin:()=>Pf,getParsedType:()=>fF,getSizableOrigin:()=>UT,hexToUint8Array:()=>SF,isObject:()=>Pa,isPlainObject:()=>hs,issue:()=>lu,joinValues:()=>_e,jsonStringifyReplacer:()=>su,merge:()=>bF,mergeDefs:()=>ms,normalizeParams:()=>ae,nullish:()=>If,numKeys:()=>dF,objectClone:()=>sF,omit:()=>hF,optionalKeys:()=>hw,partial:()=>_F,pick:()=>mF,prefixIssues:()=>yo,primitiveTypes:()=>DT,promiseAllObject:()=>cF,propertyKeyTypes:()=>mw,randomString:()=>uF,required:()=>vF,safeExtend:()=>yF,shallowClone:()=>jT,slugify:()=>fw,stringifyPrimitive:()=>ve,uint8ArrayToBase64:()=>FT,uint8ArrayToBase64url:()=>kF,uint8ArrayToHex:()=>$F,unwrapMessage:()=>$f});function tF(t){return t}function rF(t){return t}function nF(t){}function iF(t){throw new Error}function oF(t){}function ag(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function _e(t,e="|"){return t.map(r=>ve(r)).join(e)}function su(t,e){return typeof e=="bigint"?e.toString():e}function au(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function If(t){return t==null}function Ef(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function dw(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(i=Number.parseInt(l[1]))}let o=r>i?r:i,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}var MT=Symbol("evaluating");function st(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==MT)return n===void 0&&(n=MT,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function sF(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ps(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ms(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function aF(t){return ms(t._zod.def)}function lF(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function cF(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<e.length;o++)i[e[o]]=n[o];return i})}function uF(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function lg(t){return JSON.stringify(t)}function fw(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var cg="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Pa(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var pw=au(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function hs(t){if(Pa(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Pa(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function jT(t){return hs(t)?{...t}:Array.isArray(t)?[...t]:t}function dF(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var fF=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},mw=new Set(["string","number","symbol"]),DT=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Pi(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hr(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function ae(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function pF(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,o){return e??(e=t()),Reflect.set(e,n,i,o)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function ve(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function hw(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var gw={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},LT={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function mF(t,e){let r=t._zod.def,n=ms(t._zod.def,{get shape(){let i={};for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(i[o]=r.shape[o])}return ps(this,"shape",i),i},checks:[]});return Hr(t,n)}function hF(t,e){let r=t._zod.def,n=ms(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete i[o]}return ps(this,"shape",i),i},checks:[]});return Hr(t,n)}function gF(t,e){if(!hs(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let i=ms(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return ps(this,"shape",o),o},checks:[]});return Hr(t,i)}function yF(t,e){if(!hs(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return ps(this,"shape",n),n},checks:t._zod.def.checks};return Hr(t,r)}function bF(t,e){let r=ms(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return ps(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Hr(t,r)}function _F(t,e,r){let n=ms(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:i[s]}):i[s])}else for(let s in i)o[s]=t?new t({type:"optional",innerType:i[s]}):i[s];return ps(this,"shape",o),o},checks:[]});return Hr(e,n)}function vF(t,e,r){let n=ms(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(let s in i)o[s]=new t({type:"nonoptional",innerType:i[s]});return ps(this,"shape",o),o},checks:[]});return Hr(e,n)}function gs(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function yo(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function $f(t){return typeof t=="string"?t:t?.message}function ti(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=$f(t.inst?._zod.def?.error?.(t))??$f(e?.error?.(t))??$f(r.customError?.(t))??$f(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function UT(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Pf(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function lu(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function wF(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function ZT(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function FT(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function xF(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return ZT(e+r)}function kF(t){return FT(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function SF(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function $F(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var uw=class{constructor(...e){}};var VT=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,su,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},ug=M("$ZodError",VT),yw=M("$ZodError",VT,{Parent:Error});function dg(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function fg(t,e=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>n({issues:s}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(e(o));else{let s=r,a=0;for(;a<o.path.length;){let l=o.path[a];a===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(e(o))):s[l]=s[l]||{_errors:[]},s=s[l],a++}}};return n(t),r}var pg=t=>(e,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ei;if(s.issues.length){let a=new(i?.Err??t)(s.issues.map(l=>ti(l,o,Ir())));throw cg(a,i?.callee),a}return s.value};var mg=t=>async(e,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(i?.Err??t)(s.issues.map(l=>ti(l,o,Ir())));throw cg(a,i?.callee),a}return s.value};var Tf=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new Ei;return o.issues.length?{success:!1,error:new(t??ug)(o.issues.map(s=>ti(s,i,Ir())))}:{success:!0,data:o.value}},cu=Tf(yw),Af=t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(s=>ti(s,i,Ir())))}:{success:!0,data:o.value}},Cf=Af(yw),qT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return pg(t)(e,r,i)};var BT=t=>(e,r,n)=>pg(t)(e,r,n);var WT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return mg(t)(e,r,i)};var GT=t=>async(e,r,n)=>mg(t)(e,r,n);var HT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Tf(t)(e,r,i)};var XT=t=>(e,r,n)=>Tf(t)(e,r,n);var KT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Af(t)(e,r,i)};var JT=t=>async(e,r,n)=>Af(t)(e,r,n);var YT=/^[cC][^\s-]{8,}$/,QT=/^[0-9a-z]+$/,eA=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tA=/^[0-9a-vA-V]{20}$/,rA=/^[A-Za-z0-9]{27}$/,nA=/^[a-zA-Z0-9_-]{21}$/,iA=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var oA=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,bw=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var sA=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var EF="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function aA(){return new RegExp(EF,"u")}var lA=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cA=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var uA=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,dA=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_w=/^[A-Za-z0-9_-]*$/;var pA=/^\+(?:[0-9]){6,14}[0-9]$/,mA="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",hA=new RegExp(`^${mA}$`);function gA(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function yA(t){return new RegExp(`^${gA(t)}$`)}function bA(t){let e=gA({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${mA}T(?:${n})$`)}var _A=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},vA=/^-?\d+n?$/,wA=/^-?\d+$/,xA=/^-?\d+(?:\.\d+)?/,kA=/^(?:true|false)$/i,SA=/^null$/i;var $A=/^[^A-Z]*$/,IA=/^[^a-z]*$/;var nr=M("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),EA={number:"number",bigint:"bigint",object:"date"},vw=M("$ZodCheckLessThan",(t,e)=>{nr.init(t,e);let r=EA[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),ww=M("$ZodCheckGreaterThan",(t,e)=>{nr.init(t,e);let r=EA[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),PA=M("$ZodCheckMultipleOf",(t,e)=>{nr.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):dw(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),TA=M("$ZodCheckNumberFormat",(t,e)=>{nr.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,o]=gw[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=i,a.maximum=o,r&&(a.pattern=wA)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inst:t})}});var AA=M("$ZodCheckMaxLength",(t,e)=>{var r;nr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!If(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;if(i.length<=e.maximum)return;let s=Pf(i);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),CA=M("$ZodCheckMinLength",(t,e)=>{var r;nr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!If(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let s=Pf(i);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),zA=M("$ZodCheckLengthEquals",(t,e)=>{var r;nr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!If(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,o=i.length;if(o===e.length)return;let s=Pf(i),a=o>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),zf=M("$ZodCheckStringFormat",(t,e)=>{var r,n;nr.init(t,e),t._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),OA=M("$ZodCheckRegex",(t,e)=>{zf.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),RA=M("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=$A),zf.init(t,e)}),NA=M("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=IA),zf.init(t,e)}),MA=M("$ZodCheckIncludes",(t,e)=>{nr.init(t,e);let r=Pi(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),jA=M("$ZodCheckStartsWith",(t,e)=>{nr.init(t,e);let r=new RegExp(`^${Pi(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),DA=M("$ZodCheckEndsWith",(t,e)=>{nr.init(t,e);let r=new RegExp(`.*${Pi(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var LA=M("$ZodCheckOverwrite",(t,e)=>{nr.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var hg=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
90
|
+
${s}`}},{id:"ui.openURL",type:"action",name:"Open a URL in a new tab.",tags:"open, url, website, navigate, visit, go to, new tab, browser",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowOpenNewTab,content:"Opens the specified URL in a new tab. Use this when the user asks to open a website, visit a URL, go to a page, or navigate to a specific website. Only available when allowOpenNewTab flag is enabled.",parameters:[{name:"url",type:"string",description:"The URL to open in a new tab"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowOpenNewTab)throw new Error("Open New Tab action is not enabled for this persona.");if(!e.url||typeof e.url!="string")throw new Error("URL parameter is required and must be a string.");if(!window.open(e.url,"_blank"))throw new Error("Window blocked by popup blocker. Please allow popups for this site.");return`Opened URL: ${e.url}`}},{id:"ui.changeRoute",type:"action",name:"Change the current page route.",tags:"navigate, route, path, page, go to, change page, routing, navigation",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowChangeRoute,content:"Changes the current page route to the specified path. Use this when the user asks to navigate to a different page, go to a specific section, or change the current page route. Only available when allowChangeRoute flag is enabled.",parameters:[{name:"path",type:"string",description:'The path to navigate to (e.g., "/home", "/dashboard")'}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowChangeRoute)throw new Error("Change Route action is not enabled for this persona.");if(!e.path||typeof e.path!="string")throw new Error("Path parameter is required and must be a string.");let n=new URL(e.path,window.location.origin).pathname;return window.location.href=n,`Changed route to: ${n}`}},{id:"ui.sendEmail",type:"action",name:"Send an email",tags:"email, send, mail, compose, message, contact, mailto",isContext:!0,disabled:typeof window>"u"||!t?.flags?.allowSendEmail,content:"Sends an email using the user's default mail client by opening a mailto: link. Use this when the user asks to send an email, compose a message, or contact someone via email. Only available when allowSendEmail flag is enabled.",parameters:[{name:"email_address",type:"string",description:"The recipient email address"},{name:"subject",type:"string",description:"The email subject line"},{name:"body",type:"string",description:"The email body content"}],action:(e,r)=>{if(typeof window>"u")throw new Error("This action is only available in browser environments.");if(!r.flags.allowSendEmail)throw new Error("Send Email action is not enabled for this persona.");if(!e.email_address||typeof e.email_address!="string")throw new Error("Email address parameter is required and must be a string.");if(!e.subject||typeof e.subject!="string")throw new Error("Subject parameter is required and must be a string.");if(!e.body||typeof e.body!="string")throw new Error("Body parameter is required and must be a string.");let n=encodeURIComponent(e.email_address),i=encodeURIComponent(e.subject),o=encodeURIComponent(e.body),s=`mailto:${n}?subject=${i}&body=${o}`;try{window.location.href=s}catch(a){throw new Error(`Failed to open email client: ${a instanceof Error?a.message:String(a)}`)}return`Email opened in default mail client. Recipient: ${e.email_address}, Subject: ${e.subject}`}}];var Fe;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Fe||(Fe={}));var CT;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(CT||(CT={}));var Y=Fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),po=t=>{switch(typeof t){case"undefined":return Y.undefined;case"string":return Y.string;case"number":return Number.isNaN(t)?Y.nan:Y.number;case"boolean":return Y.boolean;case"function":return Y.function;case"bigint":return Y.bigint;case"symbol":return Y.symbol;case"object":return Array.isArray(t)?Y.array:t===null?Y.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Y.promise:typeof Map<"u"&&t instanceof Map?Y.map:typeof Set<"u"&&t instanceof Set?Y.set:typeof Date<"u"&&t instanceof Date?Y.date:Y.object;default:return Y.unknown}};var L=Fe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var hn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Fe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};hn.create=t=>new hn(t);var PZ=(t,e)=>{let r;switch(t.code){case L.invalid_type:t.received===Y.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case L.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Fe.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:r=`Unrecognized key(s) in object: ${Fe.joinValues(t.keys,", ")}`;break;case L.invalid_union:r="Invalid input";break;case L.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Fe.joinValues(t.options)}`;break;case L.invalid_enum_value:r=`Invalid enum value. Expected ${Fe.joinValues(t.options)}, received '${t.received}'`;break;case L.invalid_arguments:r="Invalid function arguments";break;case L.invalid_return_type:r="Invalid function return type";break;case L.invalid_date:r="Invalid date";break;case L.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Fe.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case L.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case L.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case L.custom:r="Invalid input";break;case L.invalid_intersection_types:r="Intersection results could not be merged";break;case L.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case L.not_finite:r="Number must be finite";break;default:r=e.defaultError,Fe.assertNever(t)}return{message:r}},us=PZ;var TZ=us;function pf(){return TZ}var rg=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}};function H(t,e){let r=pf(),n=rg({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===us?void 0:us].filter(i=>!!i)});t.common.issues.push(n)}var $r=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return ye;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ye;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},ye=Object.freeze({status:"aborted"}),Bc=t=>({status:"dirty",value:t}),jr=t=>({status:"valid",value:t}),rw=t=>t.status==="aborted",nw=t=>t.status==="dirty",Ia=t=>t.status==="valid",mf=t=>typeof Promise<"u"&&t instanceof Promise;var re;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(re||(re={}));var Cn=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},zT=(t,e)=>{if(Ia(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new hn(t.common.issues);return this._error=r,this._error}}};function Pe(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??r??a.defaultError}},description:i}}var Ne=class{get description(){return this._def.description}_getType(e){return po(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:po(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $r,ctx:{common:e.parent.common,data:e.data,parsedType:po(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(mf(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:po(e)},i=this._parseSync({data:e,path:n.path,parent:n});return zT(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:po(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Ia(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Ia(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:po(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(mf(i)?i:Promise.resolve(i));return zT(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:L.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new ei({schema:this,typeName:he.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Qn.create(this,this._def)}nullable(){return go.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fs.create(this)}promise(){return Ea.create(this,this._def)}or(e){return Kc.create([this,e],this._def)}and(e){return Jc.create(this,e,this._def)}transform(e){return new ei({...Pe(this._def),schema:this,typeName:he.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ru({...Pe(this._def),innerType:this,defaultValue:r,typeName:he.ZodDefault})}brand(){return new ng({typeName:he.ZodBranded,type:this,...Pe(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new nu({...Pe(this._def),innerType:this,catchValue:r,typeName:he.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ig.create(this,e)}readonly(){return iu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},AZ=/^c[^\s-]{8,}$/i,CZ=/^[0-9a-z]+$/,zZ=/^[0-9A-HJKMNP-TV-Z]{26}$/i,OZ=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,RZ=/^[a-z0-9_-]{21}$/i,NZ=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,MZ=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,jZ=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,DZ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",iw,LZ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,UZ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ZZ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,FZ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,VZ=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qZ=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OT="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",BZ=new RegExp(`^${OT}$`);function RT(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function WZ(t){return new RegExp(`^${RT(t)}$`)}function GZ(t){let e=`${OT}T${RT(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function HZ(t,e){return!!((e==="v4"||!e)&&LZ.test(t)||(e==="v6"||!e)&&ZZ.test(t))}function XZ(t,e){if(!NZ.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function KZ(t,e){return!!((e==="v4"||!e)&&UZ.test(t)||(e==="v6"||!e)&&FZ.test(t))}var Gc=class t extends Ne{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Y.string){let o=this._getOrReturnCtx(e);return H(o,{code:L.invalid_type,expected:Y.string,received:o.parsedType}),ye}let n=new $r,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),H(i,{code:L.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),H(i,{code:L.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?H(i,{code:L.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&H(i,{code:L.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")jZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"email",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")iw||(iw=new RegExp(DZ,"u")),iw.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"emoji",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")OZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"uuid",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")RZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"nanoid",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")AZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"cuid",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")CZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"cuid2",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")zZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"ulid",code:L.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),H(i,{validation:"url",code:L.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"regex",code:L.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),H(i,{code:L.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),H(i,{code:L.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),H(i,{code:L.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?GZ(o).test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{code:L.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?BZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{code:L.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?WZ(o).test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{code:L.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?MZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"duration",code:L.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?HZ(e.data,o.version)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"ip",code:L.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?XZ(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"jwt",code:L.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?KZ(e.data,o.version)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"cidr",code:L.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?VZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"base64",code:L.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?qZ.test(e.data)||(i=this._getOrReturnCtx(e,i),H(i,{validation:"base64url",code:L.invalid_string,message:o.message}),n.dirty()):Fe.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:L.invalid_string,...re.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...re.errToObj(e)})}url(e){return this._addCheck({kind:"url",...re.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...re.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...re.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...re.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...re.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...re.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...re.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...re.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...re.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...re.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...re.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...re.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...re.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...re.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...re.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...re.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...re.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...re.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...re.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...re.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...re.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...re.errToObj(r)})}nonempty(e){return this.min(1,re.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Gc.create=t=>new Gc({checks:[],typeName:he.ZodString,coerce:t?.coerce??!1,...Pe(t)});function JZ(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}var hf=class t extends Ne{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Y.number){let o=this._getOrReturnCtx(e);return H(o,{code:L.invalid_type,expected:Y.number,received:o.parsedType}),ye}let n,i=new $r;for(let o of this._def.checks)o.kind==="int"?Fe.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),H(n,{code:L.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),H(n,{code:L.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),H(n,{code:L.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?JZ(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),H(n,{code:L.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),H(n,{code:L.not_finite,message:o.message}),i.dirty()):Fe.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,re.toString(r))}gt(e,r){return this.setLimit("min",e,!1,re.toString(r))}lte(e,r){return this.setLimit("max",e,!0,re.toString(r))}lt(e,r){return this.setLimit("max",e,!1,re.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:re.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:re.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Fe.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};hf.create=t=>new hf({checks:[],typeName:he.ZodNumber,coerce:t?.coerce||!1,...Pe(t)});var gf=class t extends Ne{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Y.bigint)return this._getInvalidInput(e);let n,i=new $r;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),H(n,{code:L.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),H(n,{code:L.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),H(n,{code:L.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Fe.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return H(r,{code:L.invalid_type,expected:Y.bigint,received:r.parsedType}),ye}gte(e,r){return this.setLimit("min",e,!0,re.toString(r))}gt(e,r){return this.setLimit("min",e,!1,re.toString(r))}lte(e,r){return this.setLimit("max",e,!0,re.toString(r))}lt(e,r){return this.setLimit("max",e,!1,re.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};gf.create=t=>new gf({checks:[],typeName:he.ZodBigInt,coerce:t?.coerce??!1,...Pe(t)});var yf=class extends Ne{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Y.boolean){let n=this._getOrReturnCtx(e);return H(n,{code:L.invalid_type,expected:Y.boolean,received:n.parsedType}),ye}return jr(e.data)}};yf.create=t=>new yf({typeName:he.ZodBoolean,coerce:t?.coerce||!1,...Pe(t)});var bf=class t extends Ne{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Y.date){let o=this._getOrReturnCtx(e);return H(o,{code:L.invalid_type,expected:Y.date,received:o.parsedType}),ye}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return H(o,{code:L.invalid_date}),ye}let n=new $r,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),H(i,{code:L.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),H(i,{code:L.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Fe.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:re.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:re.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};bf.create=t=>new bf({checks:[],coerce:t?.coerce||!1,typeName:he.ZodDate,...Pe(t)});var _f=class extends Ne{_parse(e){if(this._getType(e)!==Y.symbol){let n=this._getOrReturnCtx(e);return H(n,{code:L.invalid_type,expected:Y.symbol,received:n.parsedType}),ye}return jr(e.data)}};_f.create=t=>new _f({typeName:he.ZodSymbol,...Pe(t)});var Hc=class extends Ne{_parse(e){if(this._getType(e)!==Y.undefined){let n=this._getOrReturnCtx(e);return H(n,{code:L.invalid_type,expected:Y.undefined,received:n.parsedType}),ye}return jr(e.data)}};Hc.create=t=>new Hc({typeName:he.ZodUndefined,...Pe(t)});var Xc=class extends Ne{_parse(e){if(this._getType(e)!==Y.null){let n=this._getOrReturnCtx(e);return H(n,{code:L.invalid_type,expected:Y.null,received:n.parsedType}),ye}return jr(e.data)}};Xc.create=t=>new Xc({typeName:he.ZodNull,...Pe(t)});var vf=class extends Ne{constructor(){super(...arguments),this._any=!0}_parse(e){return jr(e.data)}};vf.create=t=>new vf({typeName:he.ZodAny,...Pe(t)});var ds=class extends Ne{constructor(){super(...arguments),this._unknown=!0}_parse(e){return jr(e.data)}};ds.create=t=>new ds({typeName:he.ZodUnknown,...Pe(t)});var Ii=class extends Ne{_parse(e){let r=this._getOrReturnCtx(e);return H(r,{code:L.invalid_type,expected:Y.never,received:r.parsedType}),ye}};Ii.create=t=>new Ii({typeName:he.ZodNever,...Pe(t)});var wf=class extends Ne{_parse(e){if(this._getType(e)!==Y.undefined){let n=this._getOrReturnCtx(e);return H(n,{code:L.invalid_type,expected:Y.void,received:n.parsedType}),ye}return jr(e.data)}};wf.create=t=>new wf({typeName:he.ZodVoid,...Pe(t)});var fs=class t extends Ne{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==Y.array)return H(r,{code:L.invalid_type,expected:Y.array,received:r.parsedType}),ye;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(H(r,{code:s?L.too_big:L.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(H(r,{code:L.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(H(r,{code:L.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new Cn(r,s,r.path,a)))).then(s=>$r.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new Cn(r,s,r.path,a)));return $r.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:re.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:re.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:re.toString(r)}})}nonempty(e){return this.min(1,e)}};fs.create=(t,e)=>new fs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:he.ZodArray,...Pe(e)});function Wc(t){if(t instanceof gn){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Qn.create(Wc(n))}return new gn({...t._def,shape:()=>e})}else return t instanceof fs?new fs({...t._def,type:Wc(t.element)}):t instanceof Qn?Qn.create(Wc(t.unwrap())):t instanceof go?go.create(Wc(t.unwrap())):t instanceof ho?ho.create(t.items.map(e=>Wc(e))):t}var gn=class t extends Ne{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Fe.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==Y.object){let c=this._getOrReturnCtx(e);return H(c,{code:L.invalid_type,expected:Y.object,received:c.parsedType}),ye}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ii&&this._def.unknownKeys==="strip"))for(let c in i.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let u=o[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Cn(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ii){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(H(i,{code:L.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Cn(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>$r.mergeObjectSync(n,c)):$r.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return re.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:re.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:he.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Fe.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Fe.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Wc(this)}partial(e){let r={};for(let n of Fe.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Fe.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Qn;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return NT(Fe.objectKeys(this.shape))}};gn.create=(t,e)=>new gn({shape:()=>t,unknownKeys:"strip",catchall:Ii.create(),typeName:he.ZodObject,...Pe(e)});gn.strictCreate=(t,e)=>new gn({shape:()=>t,unknownKeys:"strict",catchall:Ii.create(),typeName:he.ZodObject,...Pe(e)});gn.lazycreate=(t,e)=>new gn({shape:t,unknownKeys:"strip",catchall:Ii.create(),typeName:he.ZodObject,...Pe(e)});var Kc=class extends Ne{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new hn(a.ctx.common.issues));return H(r,{code:L.invalid_union,unionErrors:s}),ye}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let l of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(l=>new hn(l));return H(r,{code:L.invalid_union,unionErrors:a}),ye}}get options(){return this._def.options}};Kc.create=(t,e)=>new Kc({options:t,typeName:he.ZodUnion,...Pe(e)});var mo=t=>t instanceof Yc?mo(t.schema):t instanceof ei?mo(t.innerType()):t instanceof Qc?[t.value]:t instanceof eu?t.options:t instanceof tu?Fe.objectValues(t.enum):t instanceof ru?mo(t._def.innerType):t instanceof Hc?[void 0]:t instanceof Xc?[null]:t instanceof Qn?[void 0,...mo(t.unwrap())]:t instanceof go?[null,...mo(t.unwrap())]:t instanceof ng||t instanceof iu?mo(t.unwrap()):t instanceof nu?mo(t._def.innerType):[],ow=class t extends Ne{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Y.object)return H(r,{code:L.invalid_type,expected:Y.object,received:r.parsedType}),ye;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(H(r,{code:L.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ye)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=mo(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:he.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Pe(n)})}};function sw(t,e){let r=po(t),n=po(e);if(t===e)return{valid:!0,data:t};if(r===Y.object&&n===Y.object){let i=Fe.objectKeys(e),o=Fe.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let l=sw(t[a],e[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(r===Y.array&&n===Y.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],l=sw(s,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===Y.date&&n===Y.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Jc=class extends Ne{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(rw(o)||rw(s))return ye;let a=sw(o.value,s.value);return a.valid?((nw(o)||nw(s))&&r.dirty(),{status:r.value,value:a.data}):(H(n,{code:L.invalid_intersection_types}),ye)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Jc.create=(t,e,r)=>new Jc({left:t,right:e,typeName:he.ZodIntersection,...Pe(r)});var ho=class t extends Ne{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.array)return H(n,{code:L.invalid_type,expected:Y.array,received:n.parsedType}),ye;if(n.data.length<this._def.items.length)return H(n,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ye;!this._def.rest&&n.data.length>this._def.items.length&&(H(n,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Cn(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>$r.mergeArray(r,s)):$r.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ho.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ho({items:t,typeName:he.ZodTuple,rest:null,...Pe(e)})};var aw=class t extends Ne{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.object)return H(n,{code:L.invalid_type,expected:Y.object,received:n.parsedType}),ye;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new Cn(n,a,n.path,a)),value:s._parse(new Cn(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?$r.mergeObjectAsync(r,i):$r.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ne?new t({keyType:e,valueType:r,typeName:he.ZodRecord,...Pe(n)}):new t({keyType:Gc.create(),valueType:e,typeName:he.ZodRecord,...Pe(r)})}},xf=class extends Ne{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.map)return H(n,{code:L.invalid_type,expected:Y.map,received:n.parsedType}),ye;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,l],c)=>({key:i._parse(new Cn(n,a,n.path,[c,"key"])),value:o._parse(new Cn(n,l,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ye;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ye;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}}}};xf.create=(t,e,r)=>new xf({valueType:e,keyType:t,typeName:he.ZodMap,...Pe(r)});var kf=class t extends Ne{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.set)return H(n,{code:L.invalid_type,expected:Y.set,received:n.parsedType}),ye;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(H(n,{code:L.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(H(n,{code:L.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(l){let c=new Set;for(let u of l){if(u.status==="aborted")return ye;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((l,c)=>o._parse(new Cn(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:re.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:re.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};kf.create=(t,e)=>new kf({valueType:t,minSize:null,maxSize:null,typeName:he.ZodSet,...Pe(e)});var lw=class t extends Ne{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Y.function)return H(r,{code:L.invalid_type,expected:Y.function,received:r.parsedType}),ye;function n(a,l){return rg({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pf(),us].filter(c=>!!c),issueData:{code:L.invalid_arguments,argumentsError:l}})}function i(a,l){return rg({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,pf(),us].filter(c=>!!c),issueData:{code:L.invalid_return_type,returnTypeError:l}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ea){let a=this;return jr(async function(...l){let c=new hn([]),u=await a._def.args.parseAsync(l,o).catch(f=>{throw c.addIssue(n(l,f)),c}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,o).catch(f=>{throw c.addIssue(i(d,f)),c})})}else{let a=this;return jr(function(...l){let c=a._def.args.safeParse(l,o);if(!c.success)throw new hn([n(l,c.error)]);let u=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(u,o);if(!d.success)throw new hn([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ho.create(e).rest(ds.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||ho.create([]).rest(ds.create()),returns:r||ds.create(),typeName:he.ZodFunction,...Pe(n)})}},Yc=class extends Ne{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Yc.create=(t,e)=>new Yc({getter:t,typeName:he.ZodLazy,...Pe(e)});var Qc=class extends Ne{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return H(r,{received:r.data,code:L.invalid_literal,expected:this._def.value}),ye}return{status:"valid",value:e.data}}get value(){return this._def.value}};Qc.create=(t,e)=>new Qc({value:t,typeName:he.ZodLiteral,...Pe(e)});function NT(t,e){return new eu({values:t,typeName:he.ZodEnum,...Pe(e)})}var eu=class t extends Ne{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return H(r,{expected:Fe.joinValues(n),received:r.parsedType,code:L.invalid_type}),ye}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return H(r,{received:r.data,code:L.invalid_enum_value,options:n}),ye}return jr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};eu.create=NT;var tu=class extends Ne{_parse(e){let r=Fe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Y.string&&n.parsedType!==Y.number){let i=Fe.objectValues(r);return H(n,{expected:Fe.joinValues(i),received:n.parsedType,code:L.invalid_type}),ye}if(this._cache||(this._cache=new Set(Fe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Fe.objectValues(r);return H(n,{received:n.data,code:L.invalid_enum_value,options:i}),ye}return jr(e.data)}get enum(){return this._def.values}};tu.create=(t,e)=>new tu({values:t,typeName:he.ZodNativeEnum,...Pe(e)});var Ea=class extends Ne{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Y.promise&&r.common.async===!1)return H(r,{code:L.invalid_type,expected:Y.promise,received:r.parsedType}),ye;let n=r.parsedType===Y.promise?r.data:Promise.resolve(r.data);return jr(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ea.create=(t,e)=>new Ea({type:t,typeName:he.ZodPromise,...Pe(e)});var ei=class extends Ne{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===he.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{H(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ye;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?ye:l.status==="dirty"?Bc(l.value):r.value==="dirty"?Bc(l.value):l});{if(r.value==="aborted")return ye;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ye:a.status==="dirty"?Bc(a.value):r.value==="dirty"?Bc(a.value):a}}if(i.type==="refinement"){let s=a=>{let l=i.refinement(a,o);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ye:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ye:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ia(s))return ye;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Ia(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ye);Fe.assertNever(i)}};ei.create=(t,e,r)=>new ei({schema:t,typeName:he.ZodEffects,effect:e,...Pe(r)});ei.createWithPreprocess=(t,e,r)=>new ei({schema:e,effect:{type:"preprocess",transform:t},typeName:he.ZodEffects,...Pe(r)});var Qn=class extends Ne{_parse(e){return this._getType(e)===Y.undefined?jr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Qn.create=(t,e)=>new Qn({innerType:t,typeName:he.ZodOptional,...Pe(e)});var go=class extends Ne{_parse(e){return this._getType(e)===Y.null?jr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};go.create=(t,e)=>new go({innerType:t,typeName:he.ZodNullable,...Pe(e)});var ru=class extends Ne{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ru.create=(t,e)=>new ru({innerType:t,typeName:he.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Pe(e)});var nu=class extends Ne{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return mf(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new hn(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new hn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};nu.create=(t,e)=>new nu({innerType:t,typeName:he.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Pe(e)});var Sf=class extends Ne{_parse(e){if(this._getType(e)!==Y.nan){let n=this._getOrReturnCtx(e);return H(n,{code:L.invalid_type,expected:Y.nan,received:n.parsedType}),ye}return{status:"valid",value:e.data}}};Sf.create=t=>new Sf({typeName:he.ZodNaN,...Pe(t)});var ng=class extends Ne{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ig=class t extends Ne{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ye:o.status==="dirty"?(r.dirty(),Bc(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ye:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:he.ZodPipeline})}},iu=class extends Ne{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Ia(i)&&(i.value=Object.freeze(i.value)),i);return mf(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};iu.create=(t,e)=>new iu({innerType:t,typeName:he.ZodReadonly,...Pe(e)});var Wme={object:gn.lazycreate},he;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(he||(he={}));var Gme=Gc.create,Hme=hf.create,Xme=Sf.create,Kme=gf.create,Jme=yf.create,Yme=bf.create,Qme=_f.create,ehe=Hc.create,the=Xc.create,rhe=vf.create,nhe=ds.create,ihe=Ii.create,ohe=wf.create,she=fs.create,YZ=gn.create,ahe=gn.strictCreate,lhe=Kc.create,che=ow.create,uhe=Jc.create,dhe=ho.create,fhe=aw.create,phe=xf.create,mhe=kf.create,hhe=lw.create,ghe=Yc.create,yhe=Qc.create,bhe=eu.create,_he=tu.create,vhe=Ea.create,whe=ei.create,xhe=Qn.create,khe=go.create,She=ei.createWithPreprocess,$he=ig.create;var sg=Object.freeze({status:"aborted"});function M(t,e,r){function n(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,l);let c=s.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){let p=u[d];p in a||(a[p]=c[p].bind(a))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:t});function s(a){var l;let c=r?.Parent?new o:this;n(c,a),(l=c._zod).deferred??(l.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var Ei=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ou=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},og={};function Ir(t){return t&&Object.assign(og,t),og}var V={};gd(V,{BIGINT_FORMAT_RANGES:()=>LT,Class:()=>uw,NUMBER_FORMAT_RANGES:()=>gw,aborted:()=>gs,allowsEval:()=>pw,assert:()=>oF,assertEqual:()=>tF,assertIs:()=>nF,assertNever:()=>iF,assertNotEqual:()=>rF,assignProp:()=>ps,base64ToUint8Array:()=>ZT,base64urlToUint8Array:()=>xF,cached:()=>au,captureStackTrace:()=>cg,cleanEnum:()=>wF,cleanRegex:()=>Ef,clone:()=>Hr,cloneDef:()=>aF,createTransparentProxy:()=>pF,defineLazy:()=>st,esc:()=>lg,escapeRegex:()=>Pi,extend:()=>gF,finalizeIssue:()=>ti,floatSafeRemainder:()=>dw,getElementAtPath:()=>lF,getEnumValues:()=>ag,getLengthableOrigin:()=>Pf,getParsedType:()=>fF,getSizableOrigin:()=>UT,hexToUint8Array:()=>SF,isObject:()=>Pa,isPlainObject:()=>hs,issue:()=>lu,joinValues:()=>_e,jsonStringifyReplacer:()=>su,merge:()=>bF,mergeDefs:()=>ms,normalizeParams:()=>ae,nullish:()=>If,numKeys:()=>dF,objectClone:()=>sF,omit:()=>hF,optionalKeys:()=>hw,partial:()=>_F,pick:()=>mF,prefixIssues:()=>yo,primitiveTypes:()=>DT,promiseAllObject:()=>cF,propertyKeyTypes:()=>mw,randomString:()=>uF,required:()=>vF,safeExtend:()=>yF,shallowClone:()=>jT,slugify:()=>fw,stringifyPrimitive:()=>ve,uint8ArrayToBase64:()=>FT,uint8ArrayToBase64url:()=>kF,uint8ArrayToHex:()=>$F,unwrapMessage:()=>$f});function tF(t){return t}function rF(t){return t}function nF(t){}function iF(t){throw new Error}function oF(t){}function ag(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function _e(t,e="|"){return t.map(r=>ve(r)).join(e)}function su(t,e){return typeof e=="bigint"?e.toString():e}function au(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function If(t){return t==null}function Ef(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function dw(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(i=Number.parseInt(l[1]))}let o=r>i?r:i,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}var MT=Symbol("evaluating");function st(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==MT)return n===void 0&&(n=MT,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function sF(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ps(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ms(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function aF(t){return ms(t._zod.def)}function lF(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function cF(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<e.length;o++)i[e[o]]=n[o];return i})}function uF(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function lg(t){return JSON.stringify(t)}function fw(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var cg="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Pa(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var pw=au(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function hs(t){if(Pa(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Pa(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function jT(t){return hs(t)?{...t}:Array.isArray(t)?[...t]:t}function dF(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var fF=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},mw=new Set(["string","number","symbol"]),DT=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Pi(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hr(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function ae(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function pF(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,o){return e??(e=t()),Reflect.set(e,n,i,o)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function ve(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function hw(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var gw={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},LT={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function mF(t,e){let r=t._zod.def,n=ms(t._zod.def,{get shape(){let i={};for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(i[o]=r.shape[o])}return ps(this,"shape",i),i},checks:[]});return Hr(t,n)}function hF(t,e){let r=t._zod.def,n=ms(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete i[o]}return ps(this,"shape",i),i},checks:[]});return Hr(t,n)}function gF(t,e){if(!hs(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let i=ms(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return ps(this,"shape",o),o},checks:[]});return Hr(t,i)}function yF(t,e){if(!hs(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return ps(this,"shape",n),n},checks:t._zod.def.checks};return Hr(t,r)}function bF(t,e){let r=ms(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return ps(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Hr(t,r)}function _F(t,e,r){let n=ms(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:i[s]}):i[s])}else for(let s in i)o[s]=t?new t({type:"optional",innerType:i[s]}):i[s];return ps(this,"shape",o),o},checks:[]});return Hr(e,n)}function vF(t,e,r){let n=ms(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(let s in i)o[s]=new t({type:"nonoptional",innerType:i[s]});return ps(this,"shape",o),o},checks:[]});return Hr(e,n)}function gs(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function yo(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function $f(t){return typeof t=="string"?t:t?.message}function ti(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=$f(t.inst?._zod.def?.error?.(t))??$f(e?.error?.(t))??$f(r.customError?.(t))??$f(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function UT(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Pf(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function lu(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function wF(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function ZT(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function FT(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function xF(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return ZT(e+r)}function kF(t){return FT(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function SF(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function $F(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var uw=class{constructor(...e){}};var VT=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,su,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},ug=M("$ZodError",VT),yw=M("$ZodError",VT,{Parent:Error});function dg(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function fg(t,e=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>n({issues:s}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(e(o));else{let s=r,a=0;for(;a<o.path.length;){let l=o.path[a];a===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(e(o))):s[l]=s[l]||{_errors:[]},s=s[l],a++}}};return n(t),r}var pg=t=>(e,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ei;if(s.issues.length){let a=new(i?.Err??t)(s.issues.map(l=>ti(l,o,Ir())));throw cg(a,i?.callee),a}return s.value};var mg=t=>async(e,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(i?.Err??t)(s.issues.map(l=>ti(l,o,Ir())));throw cg(a,i?.callee),a}return s.value};var Tf=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new Ei;return o.issues.length?{success:!1,error:new(t??ug)(o.issues.map(s=>ti(s,i,Ir())))}:{success:!0,data:o.value}},cu=Tf(yw),Af=t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(s=>ti(s,i,Ir())))}:{success:!0,data:o.value}},Cf=Af(yw),qT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return pg(t)(e,r,i)};var BT=t=>(e,r,n)=>pg(t)(e,r,n);var WT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return mg(t)(e,r,i)};var GT=t=>async(e,r,n)=>mg(t)(e,r,n);var HT=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Tf(t)(e,r,i)};var XT=t=>(e,r,n)=>Tf(t)(e,r,n);var KT=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Af(t)(e,r,i)};var JT=t=>async(e,r,n)=>Af(t)(e,r,n);var YT=/^[cC][^\s-]{8,}$/,QT=/^[0-9a-z]+$/,eA=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tA=/^[0-9a-vA-V]{20}$/,rA=/^[A-Za-z0-9]{27}$/,nA=/^[a-zA-Z0-9_-]{21}$/,iA=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var oA=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,bw=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var sA=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var EF="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function aA(){return new RegExp(EF,"u")}var lA=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cA=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var uA=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,dA=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_w=/^[A-Za-z0-9_-]*$/;var pA=/^\+(?:[0-9]){6,14}[0-9]$/,mA="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",hA=new RegExp(`^${mA}$`);function gA(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function yA(t){return new RegExp(`^${gA(t)}$`)}function bA(t){let e=gA({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${mA}T(?:${n})$`)}var _A=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},vA=/^-?\d+n?$/,wA=/^-?\d+$/,xA=/^-?\d+(?:\.\d+)?/,kA=/^(?:true|false)$/i,SA=/^null$/i;var $A=/^[^A-Z]*$/,IA=/^[^a-z]*$/;var nr=M("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),EA={number:"number",bigint:"bigint",object:"date"},vw=M("$ZodCheckLessThan",(t,e)=>{nr.init(t,e);let r=EA[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),ww=M("$ZodCheckGreaterThan",(t,e)=>{nr.init(t,e);let r=EA[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),PA=M("$ZodCheckMultipleOf",(t,e)=>{nr.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):dw(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),TA=M("$ZodCheckNumberFormat",(t,e)=>{nr.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,o]=gw[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=i,a.maximum=o,r&&(a.pattern=wA)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inst:t})}});var AA=M("$ZodCheckMaxLength",(t,e)=>{var r;nr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!If(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;if(i.length<=e.maximum)return;let s=Pf(i);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),CA=M("$ZodCheckMinLength",(t,e)=>{var r;nr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!If(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let s=Pf(i);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),zA=M("$ZodCheckLengthEquals",(t,e)=>{var r;nr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!If(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,o=i.length;if(o===e.length)return;let s=Pf(i),a=o>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),zf=M("$ZodCheckStringFormat",(t,e)=>{var r,n;nr.init(t,e),t._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),OA=M("$ZodCheckRegex",(t,e)=>{zf.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),RA=M("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=$A),zf.init(t,e)}),NA=M("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=IA),zf.init(t,e)}),MA=M("$ZodCheckIncludes",(t,e)=>{nr.init(t,e);let r=Pi(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),jA=M("$ZodCheckStartsWith",(t,e)=>{nr.init(t,e);let r=new RegExp(`^${Pi(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),DA=M("$ZodCheckEndsWith",(t,e)=>{nr.init(t,e);let r=new RegExp(`.*${Pi(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var LA=M("$ZodCheckOverwrite",(t,e)=>{nr.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var hg=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
91
91
|
`).filter(s=>s),i=Math.min(...n.map(s=>s.length-s.trimStart().length)),o=n.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,r=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new e(...r,i.join(`
|
|
92
92
|
`))}};var ZA={major:4,minor:1,patch:13};var nt=M("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=ZA;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let i of n)for(let o of i._zod.onattach)o(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let i=(s,a,l)=>{let c=gs(s),u;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(c)continue;let p=s.issues.length,f=d._zod.check(s);if(f instanceof Promise&&l?.async===!1)throw new Ei;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await f,s.issues.length!==p&&(c||(c=gs(s,p)))});else{if(s.issues.length===p)continue;c||(c=gs(s,p))}}return u?u.then(()=>s):s},o=(s,a,l)=>{if(gs(s))return s.aborted=!0,s;let c=i(a,n,l);if(c instanceof Promise){if(l.async===!1)throw new Ei;return c.then(u=>t._zod.parse(u,l))}return t._zod.parse(c,l)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let c=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return c instanceof Promise?c.then(u=>o(u,s,a)):o(c,s,a)}let l=t._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Ei;return l.then(c=>i(c,n,a))}return i(l,n,a)}}t["~standard"]={validate:i=>{try{let o=cu(t,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Cf(t,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),uu=M("$ZodString",(t,e)=>{nt.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??_A(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),mt=M("$ZodStringFormat",(t,e)=>{zf.init(t,e),uu.init(t,e)}),kw=M("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=oA),mt.init(t,e)}),Sw=M("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=bw(n))}else e.pattern??(e.pattern=bw());mt.init(t,e)}),$w=M("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=sA),mt.init(t,e)}),Iw=M("$ZodURL",(t,e)=>{mt.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Ew=M("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=aA()),mt.init(t,e)}),Pw=M("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=nA),mt.init(t,e)}),Tw=M("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=YT),mt.init(t,e)}),Aw=M("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=QT),mt.init(t,e)}),Cw=M("$ZodULID",(t,e)=>{e.pattern??(e.pattern=eA),mt.init(t,e)}),zw=M("$ZodXID",(t,e)=>{e.pattern??(e.pattern=tA),mt.init(t,e)}),Ow=M("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=rA),mt.init(t,e)}),Rw=M("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=bA(e)),mt.init(t,e)}),Nw=M("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=hA),mt.init(t,e)}),Mw=M("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=yA(e)),mt.init(t,e)}),jw=M("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=iA),mt.init(t,e)}),Dw=M("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=lA),mt.init(t,e),t._zod.bag.format="ipv4"}),Lw=M("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=cA),mt.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}});var Uw=M("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=uA),mt.init(t,e)}),Zw=M("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=dA),mt.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function YA(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Fw=M("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=fA),mt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{YA(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function PF(t){if(!_w.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return YA(r)}var Vw=M("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=_w),mt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{PF(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),qw=M("$ZodE164",(t,e)=>{e.pattern??(e.pattern=pA),mt.init(t,e)});function TF(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}var Bw=M("$ZodJWT",(t,e)=>{mt.init(t,e),t._zod.check=r=>{TF(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var bg=M("$ZodNumber",(t,e)=>{nt.init(t,e),t._zod.pattern=t._zod.bag.pattern??xA,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...o?{received:o}:{}}),r}}),Ww=M("$ZodNumberFormat",(t,e)=>{TA.init(t,e),bg.init(t,e)}),_g=M("$ZodBoolean",(t,e)=>{nt.init(t,e),t._zod.pattern=kA,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}}),Gw=M("$ZodBigInt",(t,e)=>{nt.init(t,e),t._zod.pattern=vA,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}});var Hw=M("$ZodNull",(t,e)=>{nt.init(t,e),t._zod.pattern=SA,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),Xw=M("$ZodAny",(t,e)=>{nt.init(t,e),t._zod.parse=r=>r}),Kw=M("$ZodUnknown",(t,e)=>{nt.init(t,e),t._zod.parse=r=>r}),Jw=M("$ZodNever",(t,e)=>{nt.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});var Yw=M("$ZodDate",(t,e)=>{nt.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:t}),r}});function FA(t,e,r){t.issues.length&&e.issues.push(...yo(r,t.issues)),e.value[r]=t.value}var Qw=M("$ZodArray",(t,e)=>{nt.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),r;r.value=Array(i.length);let o=[];for(let s=0;s<i.length;s++){let a=i[s],l=e.element._zod.run({value:a,issues:[]},n);l instanceof Promise?o.push(l.then(c=>FA(c,r,s))):FA(l,r,s)}return o.length?Promise.all(o).then(()=>r):r}});function yg(t,e,r,n){t.issues.length&&e.issues.push(...yo(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function QA(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=hw(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function eC(t,e,r,n,i,o){let s=[],a=i.keySet,l=i.catchall._zod,c=l.def.type;for(let u in e){if(a.has(u))continue;if(c==="never"){s.push(u);continue}let d=l.run({value:e[u],issues:[]},n);d instanceof Promise?t.push(d.then(p=>yg(p,r,u,e))):yg(d,r,u,e)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:o}),t.length?Promise.all(t).then(()=>r):r}var tC=M("$ZodObject",(t,e)=>{if(nt.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let l={...a};return Object.defineProperty(e,"shape",{value:l}),l}})}let n=au(()=>QA(e));st(t._zod,"propValues",()=>{let a=e.shape,l={};for(let c in a){let u=a[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(let d of u.values)l[c].add(d)}}return l});let i=Pa,o=e.catchall,s;t._zod.parse=(a,l)=>{s??(s=n.value);let c=a.value;if(!i(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),a;a.value={};let u=[],d=s.shape;for(let p of s.keys){let m=d[p]._zod.run({value:c[p],issues:[]},l);m instanceof Promise?u.push(m.then(h=>yg(h,a,p,c))):yg(m,a,p,c)}return o?eC(u,c,a,l,n.value,t):u.length?Promise.all(u).then(()=>a):a}}),rC=M("$ZodObjectJIT",(t,e)=>{tC.init(t,e);let r=t._zod.parse,n=au(()=>QA(e)),i=p=>{let f=new hg(["shape","payload","ctx"]),m=n.value,h=v=>{let C=lg(v);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),g=0;for(let v of m.keys)y[v]=`key_${g++}`;f.write("const newResult = {};");for(let v of m.keys){let C=y[v],E=lg(v);f.write(`const ${C} = ${h(v)};`),f.write(`
|
|
93
93
|
if (${C}.issues.length) {
|
|
@@ -106,11 +106,11 @@ ${s}`}},{id:"ui.openURL",type:"action",name:"Open a URL in a new tab.",tags:"ope
|
|
|
106
106
|
newResult[${E}] = ${C}.value;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
`)}f.write("payload.value = newResult;"),f.write("return payload;");let b=f.compile();return(v,C)=>b(p,v,C)},o,s=Pa,a=!og.jitless,c=a&&pw.value,u=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=n.value);let m=p.value;return s(m)?a&&c&&f?.async===!1&&f.jitless!==!0?(o||(o=i(e.shape)),p=o(p,f),u?eC([],m,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),p)}});function VA(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;let i=t.filter(o=>!gs(o));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>ti(s,n,Ir())))}),e)}var vg=M("$ZodUnion",(t,e)=>{nt.init(t,e),st(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),st(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),st(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),st(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>Ef(o.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(i,o)=>{if(r)return n(i,o);let s=!1,a=[];for(let l of e.options){let c=l._zod.run({value:i.value,issues:[]},o);if(c instanceof Promise)a.push(c),s=!0;else{if(c.issues.length===0)return c;a.push(c)}}return s?Promise.all(a).then(l=>VA(l,i,t,o)):VA(a,i,t,o)}}),ex=M("$ZodDiscriminatedUnion",(t,e)=>{vg.init(t,e);let r=t._zod.parse;st(t._zod,"propValues",()=>{let i={};for(let o of e.options){let s=o._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[a,l]of Object.entries(s)){i[a]||(i[a]=new Set);for(let c of l)i[a].add(c)}}return i});let n=au(()=>{let i=e.options,o=new Map;for(let s of i){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let l of a){if(o.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);o.set(l,s)}}return o});t._zod.parse=(i,o)=>{let s=i.value;if(!Pa(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),i;let a=n.value.get(s?.[e.discriminator]);return a?a._zod.run(i,o):e.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:s,path:[e.discriminator],inst:t}),i)}}),tx=M("$ZodIntersection",(t,e)=>{nt.init(t,e),t._zod.parse=(r,n)=>{let i=r.value,o=e.left._zod.run({value:i,issues:[]},n),s=e.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([l,c])=>qA(r,l,c)):qA(r,o,s)}});function xw(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(hs(t)&&hs(e)){let r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(let o of n){let s=xw(t[o],e[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=e[n],s=xw(i,o);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function qA(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),gs(t))return t;let n=xw(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var rx=M("$ZodRecord",(t,e)=>{nt.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!hs(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),r;let o=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let c of s)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);let u=e.valueType._zod.run({value:i[c],issues:[]},n);u instanceof Promise?o.push(u.then(d=>{d.issues.length&&r.issues.push(...yo(c,d.issues)),r.value[c]=d.value})):(u.issues.length&&r.issues.push(...yo(c,u.issues)),r.value[c]=u.value)}let l;for(let c in i)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{r.value={};for(let a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let l=e.keyType._zod.run({value:a,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(u=>ti(u,n,Ir())),input:a,path:[a],inst:t}),r.value[l.value]=l.value;continue}let c=e.valueType._zod.run({value:i[a],issues:[]},n);c instanceof Promise?o.push(c.then(u=>{u.issues.length&&r.issues.push(...yo(a,u.issues)),r.value[l.value]=u.value})):(c.issues.length&&r.issues.push(...yo(a,c.issues)),r.value[l.value]=c.value)}}return o.length?Promise.all(o).then(()=>r):r}});var nx=M("$ZodEnum",(t,e)=>{nt.init(t,e);let r=ag(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>mw.has(typeof i)).map(i=>typeof i=="string"?Pi(i):i.toString()).join("|")})$`),t._zod.parse=(i,o)=>{let s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),ix=M("$ZodLiteral",(t,e)=>{if(nt.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?Pi(n):n?Pi(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),n}});var ox=M("$ZodTransform",(t,e)=>{nt.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ou(t.constructor.name);let i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(r.value=s,r));if(i instanceof Promise)throw new Ei;return r.value=i,r}});function BA(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var sx=M("$ZodOptional",(t,e)=>{nt.init(t,e),t._zod.optin="optional",t._zod.optout="optional",st(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),st(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Ef(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>BA(o,r.value)):BA(i,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),ax=M("$ZodNullable",(t,e)=>{nt.init(t,e),st(t._zod,"optin",()=>e.innerType._zod.optin),st(t._zod,"optout",()=>e.innerType._zod.optout),st(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Ef(r.source)}|null)$`):void 0}),st(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),lx=M("$ZodDefault",(t,e)=>{nt.init(t,e),t._zod.optin="optional",st(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>WA(o,e)):WA(i,e)}});function WA(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var cx=M("$ZodPrefault",(t,e)=>{nt.init(t,e),t._zod.optin="optional",st(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),ux=M("$ZodNonOptional",(t,e)=>{nt.init(t,e),st(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>GA(o,t)):GA(i,t)}});function GA(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var dx=M("$ZodCatch",(t,e)=>{nt.init(t,e),st(t._zod,"optin",()=>e.innerType._zod.optin),st(t._zod,"optout",()=>e.innerType._zod.optout),st(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>ti(s,n,Ir()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(o=>ti(o,n,Ir()))},input:r.value}),r.issues=[]),r)}});var fx=M("$ZodPipe",(t,e)=>{nt.init(t,e),st(t._zod,"values",()=>e.in._zod.values),st(t._zod,"optin",()=>e.in._zod.optin),st(t._zod,"optout",()=>e.out._zod.optout),st(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=e.out._zod.run(r,n);return o instanceof Promise?o.then(s=>gg(s,e.in,n)):gg(o,e.in,n)}let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(o=>gg(o,e.out,n)):gg(i,e.out,n)}});function gg(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var px=M("$ZodReadonly",(t,e)=>{nt.init(t,e),st(t._zod,"propValues",()=>e.innerType._zod.propValues),st(t._zod,"values",()=>e.innerType._zod.values),st(t._zod,"optin",()=>e.innerType?._zod?.optin),st(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(HA):HA(i)}});function HA(t){return t.value=Object.freeze(t.value),t}var mx=M("$ZodCustom",(t,e)=>{nr.init(t,e),nt.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(o=>XA(o,r,n,t));XA(i,r,n,t)}});function XA(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(lu(i))}}var CF=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},zF=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${CF(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${ve(n.values[0])}`:`Invalid option: expected one of ${_e(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",o=e(n.origin);return o?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",o=e(n.origin);return o?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${o.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${_e(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function hx(){return{localeError:zF()}}var nC;var wg=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function yx(){return new wg}(nC=globalThis).__zod_globalRegistry??(nC.__zod_globalRegistry=yx());var bo=globalThis.__zod_globalRegistry;function bx(t,e){return new t({type:"string",...ae(e)})}function _x(t,e){return new t({type:"string",coerce:!0,...ae(e)})}function vx(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ae(e)})}function xg(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ae(e)})}function wx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ae(e)})}function xx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ae(e)})}function kx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ae(e)})}function Sx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ae(e)})}function kg(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ae(e)})}function $x(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ae(e)})}function Ix(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ae(e)})}function Ex(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ae(e)})}function Px(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ae(e)})}function Tx(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ae(e)})}function Ax(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ae(e)})}function Cx(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ae(e)})}function zx(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ae(e)})}function Ox(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ae(e)})}function Rx(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ae(e)})}function Nx(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ae(e)})}function Mx(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ae(e)})}function jx(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ae(e)})}function Dx(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ae(e)})}function Lx(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ae(e)})}function Ux(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ae(e)})}function Zx(t,e){return new t({type:"string",format:"date",check:"string_format",...ae(e)})}function Fx(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ae(e)})}function Vx(t,e){return new t({type:"string",format:"duration",check:"string_format",...ae(e)})}function qx(t,e){return new t({type:"number",checks:[],...ae(e)})}function Bx(t,e){return new t({type:"number",coerce:!0,checks:[],...ae(e)})}function Wx(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ae(e)})}function Gx(t,e){return new t({type:"boolean",...ae(e)})}function Hx(t,e){return new t({type:"boolean",coerce:!0,...ae(e)})}function Xx(t,e){return new t({type:"bigint",coerce:!0,...ae(e)})}function Kx(t,e){return new t({type:"null",...ae(e)})}function Jx(t){return new t({type:"any"})}function Yx(t){return new t({type:"unknown"})}function Qx(t,e){return new t({type:"never",...ae(e)})}function e0(t,e){return new t({type:"date",coerce:!0,...ae(e)})}function Aa(t,e){return new vw({check:"less_than",...ae(e),value:t,inclusive:!1})}function ri(t,e){return new vw({check:"less_than",...ae(e),value:t,inclusive:!0})}function Ca(t,e){return new ww({check:"greater_than",...ae(e),value:t,inclusive:!1})}function yn(t,e){return new ww({check:"greater_than",...ae(e),value:t,inclusive:!0})}function du(t,e){return new PA({check:"multiple_of",...ae(e),value:t})}function Of(t,e){return new AA({check:"max_length",...ae(e),maximum:t})}function za(t,e){return new CA({check:"min_length",...ae(e),minimum:t})}function Rf(t,e){return new zA({check:"length_equals",...ae(e),length:t})}function Sg(t,e){return new OA({check:"string_format",format:"regex",...ae(e),pattern:t})}function $g(t){return new RA({check:"string_format",format:"lowercase",...ae(t)})}function Ig(t){return new NA({check:"string_format",format:"uppercase",...ae(t)})}function Eg(t,e){return new MA({check:"string_format",format:"includes",...ae(e),includes:t})}function Pg(t,e){return new jA({check:"string_format",format:"starts_with",...ae(e),prefix:t})}function Tg(t,e){return new DA({check:"string_format",format:"ends_with",...ae(e),suffix:t})}function _o(t){return new LA({check:"overwrite",tx:t})}function Ag(t){return _o(e=>e.normalize(t))}function Cg(){return _o(t=>t.trim())}function zg(){return _o(t=>t.toLowerCase())}function Og(){return _o(t=>t.toUpperCase())}function t0(){return _o(t=>fw(t))}function oC(t,e,r){return new t({type:"array",element:e,...ae(r)})}function r0(t,e,r){let n=ae(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function n0(t,e,r){return new t({type:"custom",check:"custom",fn:e,...ae(r)})}function i0(t){let e=MF(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(lu(n,r.value,e._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),r.issues.push(lu(i))}},t(r.value,r)));return e}function MF(t,e){let r=new nr({check:"custom",...ae(e)});return r._zod.check=t,r}function fu(t){return!!t._zod}function ii(t,e){return fu(t)?cu(t,e):t.safeParse(e)}function Rg(t){if(!t)return;let e;if(fu(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function mC(t){if(fu(t)){let o=t._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var Nf={};gd(Nf,{ZodISODate:()=>a0,ZodISODateTime:()=>o0,ZodISODuration:()=>d0,ZodISOTime:()=>c0,date:()=>l0,datetime:()=>s0,duration:()=>f0,time:()=>u0});var o0=M("ZodISODateTime",(t,e)=>{Rw.init(t,e),$t.init(t,e)});function s0(t){return Ux(o0,t)}var a0=M("ZodISODate",(t,e)=>{Nw.init(t,e),$t.init(t,e)});function l0(t){return Zx(a0,t)}var c0=M("ZodISOTime",(t,e)=>{Mw.init(t,e),$t.init(t,e)});function u0(t){return Fx(c0,t)}var d0=M("ZodISODuration",(t,e)=>{jw.init(t,e),$t.init(t,e)});function f0(t){return Vx(d0,t)}var gC=(t,e)=>{ug.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>fg(t,r)},flatten:{value:r=>dg(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,su,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,su,2)}},isEmpty:{get(){return t.issues.length===0}}})},k_e=M("ZodError",gC),bn=M("ZodError",gC,{Parent:Error});var yC=pg(bn),bC=mg(bn),_C=Tf(bn),vC=Af(bn),wC=qT(bn),xC=BT(bn),kC=WT(bn),SC=GT(bn),$C=HT(bn),IC=XT(bn),EC=KT(bn),PC=JT(bn);var ht=M("ZodType",(t,e)=>(nt.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(V.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>Hr(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>yC(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>_C(t,r,n),t.parseAsync=async(r,n)=>bC(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>vC(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>wC(t,r,n),t.decode=(r,n)=>xC(t,r,n),t.encodeAsync=async(r,n)=>kC(t,r,n),t.decodeAsync=async(r,n)=>SC(t,r,n),t.safeEncode=(r,n)=>$C(t,r,n),t.safeDecode=(r,n)=>IC(t,r,n),t.safeEncodeAsync=async(r,n)=>EC(t,r,n),t.safeDecodeAsync=async(r,n)=>PC(t,r,n),t.refine=(r,n)=>t.check(b9(r,n)),t.superRefine=r=>t.check(_9(r)),t.overwrite=r=>t.check(_o(r)),t.optional=()=>zt(t),t.nullable=()=>CC(t),t.nullish=()=>zt(CC(t)),t.nonoptional=r=>f9(t,r),t.array=()=>B(t),t.or=r=>gt([t,r]),t.and=r=>jg(t,r),t.transform=r=>m0(t,UC(r)),t.default=r=>c9(t,r),t.prefault=r=>d9(t,r),t.catch=r=>m9(t,r),t.pipe=r=>m0(t,r),t.readonly=()=>y9(t),t.describe=r=>{let n=t.clone();return bo.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return bo.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return bo.get(t);let n=t.clone();return bo.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),zC=M("_ZodString",(t,e)=>{uu.init(t,e),ht.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(Sg(...n)),t.includes=(...n)=>t.check(Eg(...n)),t.startsWith=(...n)=>t.check(Pg(...n)),t.endsWith=(...n)=>t.check(Tg(...n)),t.min=(...n)=>t.check(za(...n)),t.max=(...n)=>t.check(Of(...n)),t.length=(...n)=>t.check(Rf(...n)),t.nonempty=(...n)=>t.check(za(1,...n)),t.lowercase=n=>t.check($g(n)),t.uppercase=n=>t.check(Ig(n)),t.trim=()=>t.check(Cg()),t.normalize=(...n)=>t.check(Ag(...n)),t.toLowerCase=()=>t.check(zg()),t.toUpperCase=()=>t.check(Og()),t.slugify=()=>t.check(t0())}),h0=M("ZodString",(t,e)=>{uu.init(t,e),zC.init(t,e),t.email=r=>t.check(vx(O6,r)),t.url=r=>t.check(kg(OC,r)),t.jwt=r=>t.check(Lx(H6,r)),t.emoji=r=>t.check($x(R6,r)),t.guid=r=>t.check(xg(TC,r)),t.uuid=r=>t.check(wx(Ng,r)),t.uuidv4=r=>t.check(xx(Ng,r)),t.uuidv6=r=>t.check(kx(Ng,r)),t.uuidv7=r=>t.check(Sx(Ng,r)),t.nanoid=r=>t.check(Ix(N6,r)),t.guid=r=>t.check(xg(TC,r)),t.cuid=r=>t.check(Ex(M6,r)),t.cuid2=r=>t.check(Px(j6,r)),t.ulid=r=>t.check(Tx(D6,r)),t.base64=r=>t.check(Mx(B6,r)),t.base64url=r=>t.check(jx(W6,r)),t.xid=r=>t.check(Ax(L6,r)),t.ksuid=r=>t.check(Cx(U6,r)),t.ipv4=r=>t.check(zx(Z6,r)),t.ipv6=r=>t.check(Ox(F6,r)),t.cidrv4=r=>t.check(Rx(V6,r)),t.cidrv6=r=>t.check(Nx(q6,r)),t.e164=r=>t.check(Dx(G6,r)),t.datetime=r=>t.check(s0(r)),t.date=r=>t.check(l0(r)),t.time=r=>t.check(u0(r)),t.duration=r=>t.check(f0(r))});function k(t){return bx(h0,t)}var $t=M("ZodStringFormat",(t,e)=>{mt.init(t,e),zC.init(t,e)}),O6=M("ZodEmail",(t,e)=>{$w.init(t,e),$t.init(t,e)});var TC=M("ZodGUID",(t,e)=>{kw.init(t,e),$t.init(t,e)});var Ng=M("ZodUUID",(t,e)=>{Sw.init(t,e),$t.init(t,e)});var OC=M("ZodURL",(t,e)=>{Iw.init(t,e),$t.init(t,e)});function RC(t){return kg(OC,t)}var R6=M("ZodEmoji",(t,e)=>{Ew.init(t,e),$t.init(t,e)});var N6=M("ZodNanoID",(t,e)=>{Pw.init(t,e),$t.init(t,e)});var M6=M("ZodCUID",(t,e)=>{Tw.init(t,e),$t.init(t,e)});var j6=M("ZodCUID2",(t,e)=>{Aw.init(t,e),$t.init(t,e)});var D6=M("ZodULID",(t,e)=>{Cw.init(t,e),$t.init(t,e)});var L6=M("ZodXID",(t,e)=>{zw.init(t,e),$t.init(t,e)});var U6=M("ZodKSUID",(t,e)=>{Ow.init(t,e),$t.init(t,e)});var Z6=M("ZodIPv4",(t,e)=>{Dw.init(t,e),$t.init(t,e)});var F6=M("ZodIPv6",(t,e)=>{Lw.init(t,e),$t.init(t,e)});var V6=M("ZodCIDRv4",(t,e)=>{Uw.init(t,e),$t.init(t,e)});var q6=M("ZodCIDRv6",(t,e)=>{Zw.init(t,e),$t.init(t,e)});var B6=M("ZodBase64",(t,e)=>{Fw.init(t,e),$t.init(t,e)});var W6=M("ZodBase64URL",(t,e)=>{Vw.init(t,e),$t.init(t,e)});var G6=M("ZodE164",(t,e)=>{qw.init(t,e),$t.init(t,e)});var H6=M("ZodJWT",(t,e)=>{Bw.init(t,e),$t.init(t,e)});var Mg=M("ZodNumber",(t,e)=>{bg.init(t,e),ht.init(t,e),t.gt=(n,i)=>t.check(Ca(n,i)),t.gte=(n,i)=>t.check(yn(n,i)),t.min=(n,i)=>t.check(yn(n,i)),t.lt=(n,i)=>t.check(Aa(n,i)),t.lte=(n,i)=>t.check(ri(n,i)),t.max=(n,i)=>t.check(ri(n,i)),t.int=n=>t.check(AC(n)),t.safe=n=>t.check(AC(n)),t.positive=n=>t.check(Ca(0,n)),t.nonnegative=n=>t.check(yn(0,n)),t.negative=n=>t.check(Aa(0,n)),t.nonpositive=n=>t.check(ri(0,n)),t.multipleOf=(n,i)=>t.check(du(n,i)),t.step=(n,i)=>t.check(du(n,i)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function et(t){return qx(Mg,t)}var X6=M("ZodNumberFormat",(t,e)=>{Ww.init(t,e),Mg.init(t,e)});function AC(t){return Wx(X6,t)}var g0=M("ZodBoolean",(t,e)=>{_g.init(t,e),ht.init(t,e)});function dt(t){return Gx(g0,t)}var NC=M("ZodBigInt",(t,e)=>{Gw.init(t,e),ht.init(t,e),t.gte=(n,i)=>t.check(yn(n,i)),t.min=(n,i)=>t.check(yn(n,i)),t.gt=(n,i)=>t.check(Ca(n,i)),t.gte=(n,i)=>t.check(yn(n,i)),t.min=(n,i)=>t.check(yn(n,i)),t.lt=(n,i)=>t.check(Aa(n,i)),t.lte=(n,i)=>t.check(ri(n,i)),t.max=(n,i)=>t.check(ri(n,i)),t.positive=n=>t.check(Ca(BigInt(0),n)),t.negative=n=>t.check(Aa(BigInt(0),n)),t.nonpositive=n=>t.check(ri(BigInt(0),n)),t.nonnegative=n=>t.check(yn(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(du(n,i));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});var K6=M("ZodNull",(t,e)=>{Hw.init(t,e),ht.init(t,e)});function y0(t){return Kx(K6,t)}var J6=M("ZodAny",(t,e)=>{Xw.init(t,e),ht.init(t,e)});function MC(){return Jx(J6)}var Y6=M("ZodUnknown",(t,e)=>{Kw.init(t,e),ht.init(t,e)});function It(){return Yx(Y6)}var Q6=M("ZodNever",(t,e)=>{Jw.init(t,e),ht.init(t,e)});function e9(t){return Qx(Q6,t)}var jC=M("ZodDate",(t,e)=>{Yw.init(t,e),ht.init(t,e),t.min=(n,i)=>t.check(yn(n,i)),t.max=(n,i)=>t.check(ri(n,i));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});var t9=M("ZodArray",(t,e)=>{Qw.init(t,e),ht.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(za(r,n)),t.nonempty=r=>t.check(za(1,r)),t.max=(r,n)=>t.check(Of(r,n)),t.length=(r,n)=>t.check(Rf(r,n)),t.unwrap=()=>t.element});function B(t,e){return oC(t9,t,e)}var DC=M("ZodObject",(t,e)=>{rC.init(t,e),ht.init(t,e),V.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Xr(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:It()}),t.loose=()=>t.clone({...t._zod.def,catchall:It()}),t.strict=()=>t.clone({...t._zod.def,catchall:e9()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>V.extend(t,r),t.safeExtend=r=>V.safeExtend(t,r),t.merge=r=>V.merge(t,r),t.pick=r=>V.pick(t,r),t.omit=r=>V.omit(t,r),t.partial=(...r)=>V.partial(ZC,t,r[0]),t.required=(...r)=>V.required(FC,t,r[0])});function G(t,e){let r={type:"object",shape:t??{},...V.normalizeParams(e)};return new DC(r)}function Yt(t,e){return new DC({type:"object",shape:t,catchall:It(),...V.normalizeParams(e)})}var LC=M("ZodUnion",(t,e)=>{vg.init(t,e),ht.init(t,e),t.options=e.options});function gt(t,e){return new LC({type:"union",options:t,...V.normalizeParams(e)})}var r9=M("ZodDiscriminatedUnion",(t,e)=>{LC.init(t,e),ex.init(t,e)});function b0(t,e,r){return new r9({type:"union",options:e,discriminator:t,...V.normalizeParams(r)})}var n9=M("ZodIntersection",(t,e)=>{tx.init(t,e),ht.init(t,e)});function jg(t,e){return new n9({type:"intersection",left:t,right:e})}var i9=M("ZodRecord",(t,e)=>{rx.init(t,e),ht.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Et(t,e,r){return new i9({type:"record",keyType:t,valueType:e,...V.normalizeParams(r)})}var p0=M("ZodEnum",(t,e)=>{nx.init(t,e),ht.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{let o={};for(let s of n)if(r.has(s))o[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new p0({...e,checks:[],...V.normalizeParams(i),entries:o})},t.exclude=(n,i)=>{let o={...e.entries};for(let s of n)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new p0({...e,checks:[],...V.normalizeParams(i),entries:o})}});function Xr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new p0({type:"enum",entries:r,...V.normalizeParams(e)})}var o9=M("ZodLiteral",(t,e)=>{ix.init(t,e),ht.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function ne(t,e){return new o9({type:"literal",values:Array.isArray(t)?t:[t],...V.normalizeParams(e)})}var s9=M("ZodTransform",(t,e)=>{ox.init(t,e),ht.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ou(t.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(V.issue(o,r.value,e));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(V.issue(s))}};let i=e.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function UC(t){return new s9({type:"transform",transform:t})}var ZC=M("ZodOptional",(t,e)=>{sx.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType});function zt(t){return new ZC({type:"optional",innerType:t})}var a9=M("ZodNullable",(t,e)=>{ax.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType});function CC(t){return new a9({type:"nullable",innerType:t})}var l9=M("ZodDefault",(t,e)=>{lx.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function c9(t,e){return new l9({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():V.shallowClone(e)}})}var u9=M("ZodPrefault",(t,e)=>{cx.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType});function d9(t,e){return new u9({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():V.shallowClone(e)}})}var FC=M("ZodNonOptional",(t,e)=>{ux.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType});function f9(t,e){return new FC({type:"nonoptional",innerType:t,...V.normalizeParams(e)})}var p9=M("ZodCatch",(t,e)=>{dx.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function m9(t,e){return new p9({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var h9=M("ZodPipe",(t,e)=>{fx.init(t,e),ht.init(t,e),t.in=e.in,t.out=e.out});function m0(t,e){return new h9({type:"pipe",in:t,out:e})}var g9=M("ZodReadonly",(t,e)=>{px.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType});function y9(t){return new g9({type:"readonly",innerType:t})}var VC=M("ZodCustom",(t,e)=>{mx.init(t,e),ht.init(t,e)});function qC(t,e){return r0(VC,t??(()=>!0),e)}function b9(t,e={}){return n0(VC,t,e)}function _9(t){return i0(t)}function _0(t,e){return m0(UC(t),e)}var WC={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var BC;BC||(BC={});var Dg={};gd(Dg,{bigint:()=>k9,boolean:()=>x9,date:()=>S9,number:()=>w9,string:()=>v9});function v9(t){return _x(h0,t)}function w9(t){return Bx(Mg,t)}function x9(t){return Hx(g0,t)}function k9(t){return Xx(NC,t)}function S9(t){return e0(jC,t)}Ir(hx());var mu="2025-11-25";var HC=[mu,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ys="io.modelcontextprotocol/related-task",Ug="2.0",dr=qC(t=>t!==null&&(typeof t=="object"||typeof t=="function")),XC=gt([k(),et().int()]),KC=k(),V_e=Yt({ttl:gt([et(),y0()]).optional(),pollInterval:et().optional()}),I9=G({ttl:et().optional()}),E9=G({taskId:k()}),w0=Yt({progressToken:XC.optional(),[ys]:E9.optional()}),_n=G({_meta:w0.optional()}),Mf=_n.extend({task:I9.optional()}),JC=t=>Mf.safeParse(t).success,fr=G({method:k(),params:_n.loose().optional()}),Cn=G({_meta:w0.optional()}),zn=G({method:k(),params:Cn.loose().optional()}),pr=Yt({_meta:w0.optional()}),Zg=gt([k(),et().int()]),YC=G({jsonrpc:ne(Ug),id:Zg,...fr.shape}).strict(),jf=t=>YC.safeParse(t).success,QC=G({jsonrpc:ne(Ug),...zn.shape}).strict(),ez=t=>QC.safeParse(t).success,x0=G({jsonrpc:ne(Ug),id:Zg,result:pr}).strict(),Oa=t=>x0.safeParse(t).success;var ke;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(ke||(ke={}));var k0=G({jsonrpc:ne(Ug),id:Zg.optional(),error:G({code:et().int(),message:k(),data:It().optional()})}).strict();var tz=t=>k0.safeParse(t).success;var Fg=gt([YC,QC,x0,k0]),q_e=gt([x0,k0]),Ra=pr.strict(),P9=Cn.extend({requestId:Zg.optional(),reason:k().optional()}),Vg=zn.extend({method:ne("notifications/cancelled"),params:P9}),T9=G({src:k(),mimeType:k().optional(),sizes:B(k()).optional(),theme:Xr(["light","dark"]).optional()}),Df=G({icons:B(T9).optional()}),pu=G({name:k(),title:k().optional()}),rz=pu.extend({...pu.shape,...Df.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),A9=jg(G({applyDefaults:dt().optional()}),Et(k(),It())),C9=_0(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,jg(G({form:A9.optional(),url:dr.optional()}),Et(k(),It()).optional())),z9=Yt({list:dr.optional(),cancel:dr.optional(),requests:Yt({sampling:Yt({createMessage:dr.optional()}).optional(),elicitation:Yt({create:dr.optional()}).optional()}).optional()}),O9=Yt({list:dr.optional(),cancel:dr.optional(),requests:Yt({tools:Yt({call:dr.optional()}).optional()}).optional()}),R9=G({experimental:Et(k(),dr).optional(),sampling:G({context:dr.optional(),tools:dr.optional()}).optional(),elicitation:C9.optional(),roots:G({listChanged:dt().optional()}).optional(),tasks:z9.optional()}),N9=_n.extend({protocolVersion:k(),capabilities:R9,clientInfo:rz}),M9=fr.extend({method:ne("initialize"),params:N9});var j9=G({experimental:Et(k(),dr).optional(),logging:dr.optional(),completions:dr.optional(),prompts:G({listChanged:dt().optional()}).optional(),resources:G({subscribe:dt().optional(),listChanged:dt().optional()}).optional(),tools:G({listChanged:dt().optional()}).optional(),tasks:O9.optional()}),S0=pr.extend({protocolVersion:k(),capabilities:j9,serverInfo:rz,instructions:k().optional()}),nz=zn.extend({method:ne("notifications/initialized"),params:Cn.optional()}),iz=t=>nz.safeParse(t).success,qg=fr.extend({method:ne("ping"),params:_n.optional()}),D9=G({progress:et(),total:zt(et()),message:zt(k())}),L9=G({...Cn.shape,...D9.shape,progressToken:XC}),Bg=zn.extend({method:ne("notifications/progress"),params:L9}),U9=_n.extend({cursor:KC.optional()}),Lf=fr.extend({params:U9.optional()}),Uf=pr.extend({nextCursor:KC.optional()}),Z9=Xr(["working","input_required","completed","failed","cancelled"]),Zf=G({taskId:k(),status:Z9,ttl:gt([et(),y0()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:zt(et()),statusMessage:zt(k())}),Na=pr.extend({task:Zf}),F9=Cn.merge(Zf),Ff=zn.extend({method:ne("notifications/tasks/status"),params:F9}),Wg=fr.extend({method:ne("tasks/get"),params:_n.extend({taskId:k()})}),Gg=pr.merge(Zf),Hg=fr.extend({method:ne("tasks/result"),params:_n.extend({taskId:k()})}),B_e=pr.loose(),Xg=Lf.extend({method:ne("tasks/list")}),Kg=Uf.extend({tasks:B(Zf)}),Jg=fr.extend({method:ne("tasks/cancel"),params:_n.extend({taskId:k()})}),oz=pr.merge(Zf),sz=G({uri:k(),mimeType:zt(k()),_meta:Et(k(),It()).optional()}),az=sz.extend({text:k()}),$0=k().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),lz=sz.extend({blob:$0}),Vf=Xr(["user","assistant"]),hu=G({audience:B(Vf).optional(),priority:et().min(0).max(1).optional(),lastModified:Nf.datetime({offset:!0}).optional()}),cz=G({...pu.shape,...Df.shape,uri:k(),description:zt(k()),mimeType:zt(k()),annotations:hu.optional(),_meta:zt(Yt({}))}),V9=G({...pu.shape,...Df.shape,uriTemplate:k(),description:zt(k()),mimeType:zt(k()),annotations:hu.optional(),_meta:zt(Yt({}))}),q9=Lf.extend({method:ne("resources/list")}),I0=Uf.extend({resources:B(cz)}),B9=Lf.extend({method:ne("resources/templates/list")}),E0=Uf.extend({resourceTemplates:B(V9)}),P0=_n.extend({uri:k()}),W9=P0,G9=fr.extend({method:ne("resources/read"),params:W9}),T0=pr.extend({contents:B(gt([az,lz]))}),A0=zn.extend({method:ne("notifications/resources/list_changed"),params:Cn.optional()}),H9=P0,X9=fr.extend({method:ne("resources/subscribe"),params:H9}),K9=P0,J9=fr.extend({method:ne("resources/unsubscribe"),params:K9}),Y9=Cn.extend({uri:k()}),Q9=zn.extend({method:ne("notifications/resources/updated"),params:Y9}),e5=G({name:k(),description:zt(k()),required:zt(dt())}),t5=G({...pu.shape,...Df.shape,description:zt(k()),arguments:zt(B(e5)),_meta:zt(Yt({}))}),r5=Lf.extend({method:ne("prompts/list")}),C0=Uf.extend({prompts:B(t5)}),n5=_n.extend({name:k(),arguments:Et(k(),k()).optional()}),i5=fr.extend({method:ne("prompts/get"),params:n5}),z0=G({type:ne("text"),text:k(),annotations:hu.optional(),_meta:Et(k(),It()).optional()}),O0=G({type:ne("image"),data:$0,mimeType:k(),annotations:hu.optional(),_meta:Et(k(),It()).optional()}),R0=G({type:ne("audio"),data:$0,mimeType:k(),annotations:hu.optional(),_meta:Et(k(),It()).optional()}),o5=G({type:ne("tool_use"),name:k(),id:k(),input:Et(k(),It()),_meta:Et(k(),It()).optional()}),s5=G({type:ne("resource"),resource:gt([az,lz]),annotations:hu.optional(),_meta:Et(k(),It()).optional()}),a5=cz.extend({type:ne("resource_link")}),N0=gt([z0,O0,R0,a5,s5]),l5=G({role:Vf,content:N0}),M0=pr.extend({description:k().optional(),messages:B(l5)}),j0=zn.extend({method:ne("notifications/prompts/list_changed"),params:Cn.optional()}),c5=G({title:k().optional(),readOnlyHint:dt().optional(),destructiveHint:dt().optional(),idempotentHint:dt().optional(),openWorldHint:dt().optional()}),u5=G({taskSupport:Xr(["required","optional","forbidden"]).optional()}),uz=G({...pu.shape,...Df.shape,description:k().optional(),inputSchema:G({type:ne("object"),properties:Et(k(),dr).optional(),required:B(k()).optional()}).catchall(It()),outputSchema:G({type:ne("object"),properties:Et(k(),dr).optional(),required:B(k()).optional()}).catchall(It()).optional(),annotations:c5.optional(),execution:u5.optional(),_meta:Et(k(),It()).optional()}),d5=Lf.extend({method:ne("tools/list")}),D0=Uf.extend({tools:B(uz)}),gu=pr.extend({content:B(N0).default([]),structuredContent:Et(k(),It()).optional(),isError:dt().optional()}),W_e=gu.or(pr.extend({toolResult:It()})),f5=Mf.extend({name:k(),arguments:Et(k(),It()).optional()}),p5=fr.extend({method:ne("tools/call"),params:f5}),qf=zn.extend({method:ne("notifications/tools/list_changed"),params:Cn.optional()}),dz=G({autoRefresh:dt().default(!0),debounceMs:et().int().nonnegative().default(300)}),fz=Xr(["debug","info","notice","warning","error","critical","alert","emergency"]),m5=_n.extend({level:fz}),h5=fr.extend({method:ne("logging/setLevel"),params:m5}),g5=Cn.extend({level:fz,logger:k().optional(),data:It()}),L0=zn.extend({method:ne("notifications/message"),params:g5}),y5=G({name:k().optional()}),b5=G({hints:B(y5).optional(),costPriority:et().min(0).max(1).optional(),speedPriority:et().min(0).max(1).optional(),intelligencePriority:et().min(0).max(1).optional()}),_5=G({mode:Xr(["auto","required","none"]).optional()}),v5=G({type:ne("tool_result"),toolUseId:k().describe("The unique identifier for the corresponding tool call."),content:B(N0).default([]),structuredContent:G({}).loose().optional(),isError:dt().optional(),_meta:Et(k(),It()).optional()}),w5=b0("type",[z0,O0,R0]),Lg=b0("type",[z0,O0,R0,o5,v5]),x5=G({role:Vf,content:gt([Lg,B(Lg)]),_meta:Et(k(),It()).optional()}),k5=Mf.extend({messages:B(x5),modelPreferences:b5.optional(),systemPrompt:k().optional(),includeContext:Xr(["none","thisServer","allServers"]).optional(),temperature:et().optional(),maxTokens:et().int(),stopSequences:B(k()).optional(),metadata:dr.optional(),tools:B(uz).optional(),toolChoice:_5.optional()}),U0=fr.extend({method:ne("sampling/createMessage"),params:k5}),Z0=pr.extend({model:k(),stopReason:zt(Xr(["endTurn","stopSequence","maxTokens"]).or(k())),role:Vf,content:w5}),F0=pr.extend({model:k(),stopReason:zt(Xr(["endTurn","stopSequence","maxTokens","toolUse"]).or(k())),role:Vf,content:gt([Lg,B(Lg)])}),S5=G({type:ne("boolean"),title:k().optional(),description:k().optional(),default:dt().optional()}),$5=G({type:ne("string"),title:k().optional(),description:k().optional(),minLength:et().optional(),maxLength:et().optional(),format:Xr(["email","uri","date","date-time"]).optional(),default:k().optional()}),I5=G({type:Xr(["number","integer"]),title:k().optional(),description:k().optional(),minimum:et().optional(),maximum:et().optional(),default:et().optional()}),E5=G({type:ne("string"),title:k().optional(),description:k().optional(),enum:B(k()),default:k().optional()}),P5=G({type:ne("string"),title:k().optional(),description:k().optional(),oneOf:B(G({const:k(),title:k()})),default:k().optional()}),T5=G({type:ne("string"),title:k().optional(),description:k().optional(),enum:B(k()),enumNames:B(k()).optional(),default:k().optional()}),A5=gt([E5,P5]),C5=G({type:ne("array"),title:k().optional(),description:k().optional(),minItems:et().optional(),maxItems:et().optional(),items:G({type:ne("string"),enum:B(k())}),default:B(k()).optional()}),z5=G({type:ne("array"),title:k().optional(),description:k().optional(),minItems:et().optional(),maxItems:et().optional(),items:G({anyOf:B(G({const:k(),title:k()}))}),default:B(k()).optional()}),O5=gt([C5,z5]),R5=gt([T5,A5,O5]),N5=gt([R5,S5,$5,I5]),M5=Mf.extend({mode:ne("form").optional(),message:k(),requestedSchema:G({type:ne("object"),properties:Et(k(),N5),required:B(k()).optional()})}),j5=Mf.extend({mode:ne("url"),message:k(),elicitationId:k(),url:k().url()}),D5=gt([M5,j5]),V0=fr.extend({method:ne("elicitation/create"),params:D5}),L5=Cn.extend({elicitationId:k()}),U5=zn.extend({method:ne("notifications/elicitation/complete"),params:L5}),q0=pr.extend({action:Xr(["accept","decline","cancel"]),content:_0(t=>t===null?void 0:t,Et(k(),gt([k(),et(),dt(),B(k())])).optional())}),Z5=G({type:ne("ref/resource"),uri:k()});var F5=G({type:ne("ref/prompt"),name:k()}),V5=_n.extend({ref:gt([F5,Z5]),argument:G({name:k(),value:k()}),context:G({arguments:Et(k(),k()).optional()}).optional()}),q5=fr.extend({method:ne("completion/complete"),params:V5});var B0=pr.extend({completion:Yt({values:B(k()).max(100),total:zt(et().int()),hasMore:zt(dt())})}),B5=G({uri:k().startsWith("file://"),name:k().optional(),_meta:Et(k(),It()).optional()}),W5=fr.extend({method:ne("roots/list"),params:_n.optional()}),G5=pr.extend({roots:B(B5)}),H5=zn.extend({method:ne("notifications/roots/list_changed"),params:Cn.optional()}),G_e=gt([qg,M9,q5,h5,i5,r5,q9,B9,G9,X9,J9,p5,d5,Wg,Hg,Xg,Jg]),H_e=gt([Vg,Bg,nz,H5,Ff]),X_e=gt([Ra,Z0,F0,q0,G5,Gg,Kg,Na]),K_e=gt([qg,U0,V0,W5,Wg,Hg,Xg,Jg]),J_e=gt([Vg,Bg,L0,Q9,A0,qf,j0,Ff,U5]),Y_e=gt([Ra,S0,B0,M0,C0,I0,E0,T0,gu,D0,Gg,Kg,Na]),fe=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===ke.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new v0(i.elicitations,r)}return new t(e,r,n)}},v0=class extends fe{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(ke.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function bs(t){return t==="completed"||t==="failed"||t==="cancelled"}var zve=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function W0(t){let r=Rg(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=mC(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function G0(t,e){let r=ii(t,e);if(!r.success)throw r.error;return r.data}var eV=6e4,Yg=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Vg,r=>{this._oncancel(r)}),this.setNotificationHandler(Bg,r=>{this._onprogress(r)}),this.setRequestHandler(qg,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Wg,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new fe(ke.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Hg,async(r,n)=>{let i=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(a.type==="response"||a.type==="error"){let l=a.message,c=l.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),a.type==="response")u(l);else{let d=l,p=new fe(d.error.code,d.error.message,d.error.data);u(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${c}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let s=await this._taskStore.getTask(o,n.sessionId);if(!s)throw new fe(ke.InvalidParams,`Task not found: ${o}`);if(!bs(s.status))return await this._waitForTaskUpdate(o,n.signal),await i();if(bs(s.status)){let a=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...a,_meta:{...a._meta,[ys]:{taskId:o}}}}return await i()};return await i()}),this.setRequestHandler(Xg,async(r,n)=>{try{let{tasks:i,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:o,_meta:{}}}catch(i){throw new fe(ke.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Jg,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new fe(ke.InvalidParams,`Task not found: ${r.params.taskId}`);if(bs(i.status))throw new fe(ke.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new fe(ke.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(i){throw i instanceof fe?i:new fe(ke.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,i,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),fe.fromError(ke.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=o=>{n?.(o),this._onerror(o)};let i=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{i?.(o,s),Oa(o)||tz(o)?this._onresponse(o):jf(o)?this._onrequest(o,s):ez(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=fe.fromError(ke.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,o=e.params?._meta?.[ys]?.taskId;if(n===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:ke.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:u,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let a=JC(e.params)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,c={signal:s.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async u=>{if(s.signal.aborted)return;let d={relatedRequestId:e.id};o&&(d.relatedTask={taskId:o}),await this.notification(u,d)},sendRequest:async(u,d,p)=>{if(s.signal.aborted)throw new fe(ke.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};o&&!f.relatedTask&&(f.relatedTask={taskId:o});let m=f.relatedTask?.taskId??o;return m&&l&&await l.updateTaskStatus(m,"input_required"),await this.request(u,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:o,taskStore:l,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async u=>{if(s.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async u=>{if(s.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:ke.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(l){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),s(l);return}o(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Oa(e))n(e);else{let s=new fe(e.error.code,e.error.message,e.error.data);n(s)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(Oa(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),Oa(e))i(e);else{let s=fe.fromError(e.error.code,e.error.message,e.error.data);i(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(e,r,n)}}catch(s){yield{type:"error",error:s instanceof fe?s:new fe(ke.InternalError,String(s))}}return}let o;try{let s=await this.request(e,Na,n);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new fe(ke.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:a},bs(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:a.status==="failed"?yield{type:"error",error:new fe(ke.InternalError,`Task ${o} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new fe(ke.InternalError,`Task ${o} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)};return}let l=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(c=>setTimeout(c,l)),n?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof fe?s:new fe(ke.InternalError,String(s))}}}request(e,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s,task:a,relatedTask:l}=n??{};return new Promise((c,u)=>{let d=b=>{u(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(b){d(b);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),l&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ys]:l}});let m=b=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(b)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`)));let v=b instanceof fe?b:new fe(ke.RequestTimeout,String(b));u(v)};this._responseHandlers.set(p,b=>{if(!n?.signal?.aborted){if(b instanceof Error)return u(b);try{let v=ii(r,b.result);v.success?c(v.data):u(v.error)}catch(v){u(v)}}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let h=n?.timeout??eV,y=()=>m(fe.fromError(ke.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let g=l?.taskId;if(g){let b=v=>{let C=this._responseHandlers.get(p);C?C(v):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,b),this._enqueueTaskMessage(g,{type:"request",message:f,timestamp:Date.now()}).catch(v=>{this._cleanupTimeout(p),u(v)})}else this._transport.send(f,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(b=>{this._cleanupTimeout(p),u(b)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Gg,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Kg,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},oz,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[ys]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ys]:r.relatedTask}}}),this._transport?.send(a,r).catch(l=>this._onerror(l))});return}let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[ys]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(e,r){let n=W0(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,o)=>{let s=G0(e,i);return Promise.resolve(r(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=W0(e);this._notificationHandlers.set(n,i=>{let o=G0(e,i);return Promise.resolve(r(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let i of n)if(i.type==="request"&&jf(i.message)){let o=i.message.id,s=this._requestResolvers.get(o);s?(s(new fe(ke.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(e);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,o)=>{if(r.aborted){o(new fe(ke.InvalidRequest,"Request cancelled"));return}let s=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(s),o(new fe(ke.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!e)throw new Error("No request provided");return await n.createTask(i,e.id,{method:e.method,params:e.params},r)},getTask:async i=>{let o=await n.getTask(i,r);if(!o)throw new fe(ke.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(i,o,s)=>{await n.storeTaskResult(i,o,s,r);let a=await n.getTask(i,r);if(a){let l=Ff.parse({method:"notifications/tasks/status",params:a});await this.notification(l),bs(a.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,o,s)=>{let a=await n.getTask(i,r);if(!a)throw new fe(ke.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(bs(a.status))throw new fe(ke.InvalidParams,`Cannot update task "${i}" from terminal status "${a.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,o,s,r);let l=await n.getTask(i,r);if(l){let c=Ff.parse({method:"notifications/tasks/status",params:l});await this.notification(c),bs(l.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function pz(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function mz(t,e){let r={...t};for(let n in e){let i=n,o=e[i];if(o===void 0)continue;let s=r[i];pz(s)&&pz(o)?r[i]={...s,...o}:r[i]=o}return r}var hj=I_(UR(),1),gj=I_(mj(),1);function jJ(){let t=new hj.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,gj.default)(t),t}var fb=class{constructor(e){this._ajv=e??jJ()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var pb=class{constructor(e){this._client=e}async*callToolStream(e,r=gu,n){let i=this._client,o={...n,task:n?.task??(i.isToolTask(e.name)?{}:void 0)},s=i.requestStream({method:"tools/call",params:e},r,o),a=i.getToolOutputValidator(e.name);for await(let l of s){if(l.type==="result"&&a){let c=l.result;if(!c.structuredContent&&!c.isError){yield{type:"error",error:new fe(ke.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(c.structuredContent)try{let u=a(c.structuredContent);if(!u.valid){yield{type:"error",error:new fe(ke.InvalidParams,`Structured content does not match the tool's output schema: ${u.errorMessage}`)};return}}catch(u){if(u instanceof fe){yield{type:"error",error:u};return}yield{type:"error",error:new fe(ke.InvalidParams,`Failed to validate structured content: ${u instanceof Error?u.message:String(u)}`)};return}}yield l}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function yj(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function bj(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function mb(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let i of Object.keys(n)){let o=n[i];r[i]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(r[i]=o.default),r[i]!==void 0&&mb(o,r[i])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)typeof r!="boolean"&&mb(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)typeof r!="boolean"&&mb(r,e)}}function DJ(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var hb=class extends Yg{constructor(e,r){super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new fb,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",qf,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",j0,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",A0,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new pb(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=mz(this._capabilities,e)}setRequestHandler(e,r){let i=Rg(e)?.method;if(!i)throw new Error("Schema is missing a method literal");let o;if(fu(i)){let a=i;o=a._zod?.def?.value??a.value}else{let a=i;o=a._def?.value??a.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");let s=o;if(s==="elicitation/create"){let a=async(l,c)=>{let u=ii(V0,l);if(!u.success){let b=u.error instanceof Error?u.error.message:String(u.error);throw new fe(ke.InvalidParams,`Invalid elicitation request: ${b}`)}let{params:d}=u.data;d.mode=d.mode??"form";let{supportsFormMode:p,supportsUrlMode:f}=DJ(this._capabilities.elicitation);if(d.mode==="form"&&!p)throw new fe(ke.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!f)throw new fe(ke.InvalidParams,"Client does not support URL-mode elicitation requests");let m=await Promise.resolve(r(l,c));if(d.task){let b=ii(Na,m);if(!b.success){let v=b.error instanceof Error?b.error.message:String(b.error);throw new fe(ke.InvalidParams,`Invalid task creation result: ${v}`)}return b.data}let h=ii(q0,m);if(!h.success){let b=h.error instanceof Error?h.error.message:String(h.error);throw new fe(ke.InvalidParams,`Invalid elicitation result: ${b}`)}let y=h.data,g=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&y.action==="accept"&&y.content&&g&&this._capabilities.elicitation?.form?.applyDefaults)try{mb(g,y.content)}catch{}return y};return super.setRequestHandler(e,a)}if(s==="sampling/createMessage"){let a=async(l,c)=>{let u=ii(U0,l);if(!u.success){let y=u.error instanceof Error?u.error.message:String(u.error);throw new fe(ke.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=u.data,p=await Promise.resolve(r(l,c));if(d.task){let y=ii(Na,p);if(!y.success){let g=y.error instanceof Error?y.error.message:String(y.error);throw new fe(ke.InvalidParams,`Invalid task creation result: ${g}`)}return y.data}let m=d.tools||d.toolChoice?F0:Z0,h=ii(m,p);if(!h.success){let y=h.error instanceof Error?h.error.message:String(h.error);throw new fe(ke.InvalidParams,`Invalid sampling result: ${y}`)}return h.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapability(e,r){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:mu,capabilities:this._capabilities,clientInfo:this._clientInfo}},S0,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!HC.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){yj(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&bj(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Ra,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},B0,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Ra,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},M0,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},C0,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},I0,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},E0,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},T0,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Ra,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Ra,r)}async callTool(e,r=gu,n){if(this.isToolTaskRequired(e.name))throw new fe(ke.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let i=await this.request({method:"tools/call",params:e},r,n),o=this.getToolOutputValidator(e.name);if(o){if(!i.structuredContent&&!i.isError)throw new fe(ke.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{let s=o(i.structuredContent);if(!s.valid)throw new fe(ke.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof fe?s:new fe(ke.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return i}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of e){if(r.outputSchema){let i=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,i)}let n=r.execution?.taskSupport;(n==="required"||n==="optional")&&this._cachedKnownTaskTools.add(r.name),n==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},D0,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(e,r,n,i){let o=dz.safeParse(n);if(!o.success)throw new Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:a}=o.data,{onChanged:l}=n,c=async()=>{if(!s){l(null,null);return}try{let d=await i();l(null,d)}catch(d){let p=d instanceof Error?d:new Error(String(d));l(p,null)}},u=()=>{if(a){let d=this._listChangedDebounceTimers.get(e);d&&clearTimeout(d);let p=setTimeout(c,a);this._listChangedDebounceTimers.set(e,p)}else c()};this.setNotificationHandler(r,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};function gb(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function _j(t=fetch,e){return e?async(r,n)=>{let i={...e,...n,headers:n?.headers?{...gb(e.headers),...gb(n.headers)}:e.headers};return t(r,i)}:t}var gI;gI=globalThis.crypto;async function LJ(t){return(await gI).getRandomValues(new Uint8Array(t))}async function UJ(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await LJ(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function ZJ(t){return await UJ(t)}async function FJ(t){let e=await(await gI).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function yI(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await ZJ(t),r=await FJ(e);return{code_verifier:e,code_challenge:r}}var vr=RC().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:WC.custom,message:"URL must be parseable",fatal:!0}),sg}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),wj=Yt({resource:k().url(),authorization_servers:B(vr).optional(),jwks_uri:k().url().optional(),scopes_supported:B(k()).optional(),bearer_methods_supported:B(k()).optional(),resource_signing_alg_values_supported:B(k()).optional(),resource_name:k().optional(),resource_documentation:k().optional(),resource_policy_uri:k().url().optional(),resource_tos_uri:k().url().optional(),tls_client_certificate_bound_access_tokens:dt().optional(),authorization_details_types_supported:B(k()).optional(),dpop_signing_alg_values_supported:B(k()).optional(),dpop_bound_access_tokens_required:dt().optional()}),bI=Yt({issuer:k(),authorization_endpoint:vr,token_endpoint:vr,registration_endpoint:vr.optional(),scopes_supported:B(k()).optional(),response_types_supported:B(k()),response_modes_supported:B(k()).optional(),grant_types_supported:B(k()).optional(),token_endpoint_auth_methods_supported:B(k()).optional(),token_endpoint_auth_signing_alg_values_supported:B(k()).optional(),service_documentation:vr.optional(),revocation_endpoint:vr.optional(),revocation_endpoint_auth_methods_supported:B(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:B(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:B(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:B(k()).optional(),code_challenge_methods_supported:B(k()).optional(),client_id_metadata_document_supported:dt().optional()}),VJ=Yt({issuer:k(),authorization_endpoint:vr,token_endpoint:vr,userinfo_endpoint:vr.optional(),jwks_uri:vr,registration_endpoint:vr.optional(),scopes_supported:B(k()).optional(),response_types_supported:B(k()),response_modes_supported:B(k()).optional(),grant_types_supported:B(k()).optional(),acr_values_supported:B(k()).optional(),subject_types_supported:B(k()),id_token_signing_alg_values_supported:B(k()),id_token_encryption_alg_values_supported:B(k()).optional(),id_token_encryption_enc_values_supported:B(k()).optional(),userinfo_signing_alg_values_supported:B(k()).optional(),userinfo_encryption_alg_values_supported:B(k()).optional(),userinfo_encryption_enc_values_supported:B(k()).optional(),request_object_signing_alg_values_supported:B(k()).optional(),request_object_encryption_alg_values_supported:B(k()).optional(),request_object_encryption_enc_values_supported:B(k()).optional(),token_endpoint_auth_methods_supported:B(k()).optional(),token_endpoint_auth_signing_alg_values_supported:B(k()).optional(),display_values_supported:B(k()).optional(),claim_types_supported:B(k()).optional(),claims_supported:B(k()).optional(),service_documentation:k().optional(),claims_locales_supported:B(k()).optional(),ui_locales_supported:B(k()).optional(),claims_parameter_supported:dt().optional(),request_parameter_supported:dt().optional(),request_uri_parameter_supported:dt().optional(),require_request_uri_registration:dt().optional(),op_policy_uri:vr.optional(),op_tos_uri:vr.optional(),client_id_metadata_document_supported:dt().optional()}),xj=G({...VJ.shape,...bI.pick({code_challenge_methods_supported:!0}).shape}),kj=G({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:Dg.number().optional(),scope:k().optional(),refresh_token:k().optional()}).strip(),Sj=G({error:k(),error_description:k().optional(),error_uri:k().optional()}),vj=vr.optional().or(ne("").transform(()=>{})),qJ=G({redirect_uris:B(vr),token_endpoint_auth_method:k().optional(),grant_types:B(k()).optional(),response_types:B(k()).optional(),client_name:k().optional(),client_uri:vr.optional(),logo_uri:vj,scope:k().optional(),contacts:B(k()).optional(),tos_uri:vj,policy_uri:k().optional(),jwks_uri:vr.optional(),jwks:MC().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),BJ=G({client_id:k(),client_secret:k().optional(),client_id_issued_at:et().optional(),client_secret_expires_at:et().optional()}).strip(),$j=qJ.merge(BJ),h$e=G({error:k(),error_description:k().optional()}).strip(),g$e=G({token:k(),token_type_hint:k().optional()}).strip();function Ij(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function Ej({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var Ut=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Kp=class extends Ut{};Kp.errorCode="invalid_request";var rl=class extends Ut{};rl.errorCode="invalid_client";var nl=class extends Ut{};nl.errorCode="invalid_grant";var il=class extends Ut{};il.errorCode="unauthorized_client";var Jp=class extends Ut{};Jp.errorCode="unsupported_grant_type";var Yp=class extends Ut{};Yp.errorCode="invalid_scope";var Qp=class extends Ut{};Qp.errorCode="access_denied";var Ao=class extends Ut{};Ao.errorCode="server_error";var em=class extends Ut{};em.errorCode="temporarily_unavailable";var tm=class extends Ut{};tm.errorCode="unsupported_response_type";var rm=class extends Ut{};rm.errorCode="unsupported_token_type";var nm=class extends Ut{};nm.errorCode="invalid_token";var im=class extends Ut{};im.errorCode="method_not_allowed";var om=class extends Ut{};om.errorCode="too_many_requests";var ol=class extends Ut{};ol.errorCode="invalid_client_metadata";var sm=class extends Ut{};sm.errorCode="insufficient_scope";var am=class extends Ut{};am.errorCode="invalid_target";var Pj={[Kp.errorCode]:Kp,[rl.errorCode]:rl,[nl.errorCode]:nl,[il.errorCode]:il,[Jp.errorCode]:Jp,[Yp.errorCode]:Yp,[Qp.errorCode]:Qp,[Ao.errorCode]:Ao,[em.errorCode]:em,[tm.errorCode]:tm,[rm.errorCode]:rm,[nm.errorCode]:nm,[im.errorCode]:im,[om.errorCode]:om,[ol.errorCode]:ol,[sm.errorCode]:sm,[am.errorCode]:am};var Co=class extends Error{constructor(e){super(e??"Unauthorized")}};function WJ(t){return["client_secret_basic","client_secret_post","none"].includes(t)}var _I="code",vI="S256";function GJ(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&WJ(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function HJ(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":XJ(i,o,r);return;case"client_secret_post":KJ(i,o,n);return;case"none":JJ(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function XJ(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function KJ(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function JJ(t,e){e.set("client_id",t)}async function Aj(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=Sj.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=Pj[i]||Ao;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Ao(i)}}async function lm(t,e){try{return await wI(t,e)}catch(r){if(r instanceof rl||r instanceof il)return await t.invalidateCredentials?.("all"),await wI(t,e);if(r instanceof nl)return await t.invalidateCredentials?.("tokens"),await wI(t,e);throw r}}async function wI(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s=await t.discoveryState?.(),a,l,c,u=i;if(!u&&s?.resourceMetadataUrl&&(u=new URL(s.resourceMetadataUrl)),s?.authorizationServerUrl){if(l=s.authorizationServerUrl,a=s.resourceMetadata,c=s.authorizationServerMetadata??await zj(l,{fetchFn:o}),!a)try{a=await Cj(e,{resourceMetadataUrl:u},o)}catch{}(c!==s.authorizationServerMetadata||a!==s.resourceMetadata)&&await t.saveDiscoveryState?.({authorizationServerUrl:String(l),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}else{let b=await i7(e,{resourceMetadataUrl:u,fetchFn:o});l=b.authorizationServerUrl,c=b.authorizationServerMetadata,a=b.resourceMetadata,await t.saveDiscoveryState?.({authorizationServerUrl:String(l),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}let d=await QJ(e,t,a),p=await Promise.resolve(t.clientInformation());if(!p){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let b=c?.client_id_metadata_document_supported===!0,v=t.clientMetadataUrl;if(v&&!YJ(v))throw new ol(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${v}`);if(b&&v)p={client_id:v},await t.saveClientInformation?.(p);else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let E=await c7(l,{metadata:c,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(E),p=E}}let f=!t.redirectUrl;if(r!==void 0||f){let b=await l7(t,l,{metadata:c,resource:d,authorizationCode:r,fetchFn:o});return await t.saveTokens(b),"AUTHORIZED"}let m=await t.tokens();if(m?.refresh_token)try{let b=await a7(l,{metadata:c,clientInformation:p,refreshToken:m.refresh_token,resource:d,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(b),"AUTHORIZED"}catch(b){if(!(!(b instanceof Ut)||b instanceof Ao))throw b}let h=t.state?await t.state():void 0,{authorizationUrl:y,codeVerifier:g}=await o7(l,{metadata:c,clientInformation:p,state:h,redirectUrl:t.redirectUrl,scope:n||a?.scopes_supported?.join(" ")||t.clientMetadata.scope,resource:d});return await t.saveCodeVerifier(g),await t.redirectToAuthorization(y),"REDIRECT"}function YJ(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function QJ(t,e,r){let n=Ij(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!Ej({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function kI(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let i=xI(t,"resource_metadata")||void 0,o;if(i)try{o=new URL(i)}catch{}let s=xI(t,"scope")||void 0,a=xI(t,"error")||void 0;return{resourceMetadataUrl:o,scope:s,error:a}}function xI(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),i=r.match(n);return i?i[1]||i[2]:null}async function Cj(t,e,r=fetch){let n=await r7(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return wj.parse(await n.json())}async function SI(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?SI(t,void 0,r):void 0;throw n}}function e7(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Tj(t,e,r=fetch){return await SI(t,{"MCP-Protocol-Version":e},r)}function t7(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function r7(t,e,r,n){let i=new URL(t),o=n?.protocolVersion??mu,s;if(n?.metadataUrl)s=new URL(n.metadataUrl);else{let l=e7(e,i.pathname);s=new URL(l,n?.metadataServerUrl??i),s.search=i.search}let a=await Tj(s,o,r);if(!n?.metadataUrl&&t7(a,i.pathname)){let l=new URL(`/.well-known/${e}`,i);a=await Tj(l,o,r)}return a}function n7(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function zj(t,{fetchFn:e=fetch,protocolVersion:r=mu}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},i=n7(t);for(let{url:o,type:s}of i){let a=await SI(o,n,e);if(a){if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return s==="oauth"?bI.parse(await a.json()):xj.parse(await a.json())}}}async function i7(t,e){let r,n;try{r=await Cj(t,{resourceMetadataUrl:e?.resourceMetadataUrl},e?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL("/",t)));let i=await zj(n,{fetchFn:e?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:i,resourceMetadata:r}}async function o7(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(_I))throw new Error(`Incompatible auth server: does not support response type ${_I}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(vI))throw new Error(`Incompatible auth server: does not support code challenge method ${vI}`)}else a=new URL("/authorize",t);let l=await yI(),c=l.code_verifier,u=l.code_challenge;return a.searchParams.set("response_type",_I),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",u),a.searchParams.set("code_challenge_method",vI),a.searchParams.set("redirect_uri",String(n)),o&&a.searchParams.set("state",o),i&&a.searchParams.set("scope",i),i?.includes("offline_access")&&a.searchParams.append("prompt","consent"),s&&a.searchParams.set("resource",s.href),{authorizationUrl:a,codeVerifier:c}}function s7(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function Oj(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:i,resource:o,fetchFn:s}){let a=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),l=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(o&&r.set("resource",o.href),i)await i(l,r,a,e);else if(n){let u=e?.token_endpoint_auth_methods_supported??[],d=GJ(n,u);HJ(d,n,l,r)}let c=await(s??fetch)(a,{method:"POST",headers:l,body:r});if(!c.ok)throw await Aj(c);return kj.parse(await c.json())}async function a7(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),l=await Oj(t,{metadata:e,tokenRequestParams:a,clientInformation:r,addClientAuthentication:o,resource:i,fetchFn:s});return{refresh_token:n,...l}}async function l7(t,e,{metadata:r,resource:n,authorizationCode:i,fetchFn:o}={}){let s=t.clientMetadata.scope,a;if(t.prepareTokenRequest&&(a=await t.prepareTokenRequest(s)),!a){if(!i)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let c=await t.codeVerifier();a=s7(i,c,t.redirectUrl)}let l=await t.clientInformation();return Oj(e,{metadata:r,tokenRequestParams:a,clientInformation:l??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:o})}async function c7(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await Aj(o);return $j.parse(await o.json())}var yb=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function $I(t){}function Rj(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=$I,onError:r=$I,onRetry:n=$I,onComment:i}=t,o="",s=!0,a,l="",c="";function u(h){let y=s?h.replace(/^\xEF\xBB\xBF/,""):h,[g,b]=u7(`${o}${y}`);for(let v of g)d(v);o=b,s=!1}function d(h){if(h===""){f();return}if(h.startsWith(":")){i&&i(h.slice(h.startsWith(": ")?2:1));return}let y=h.indexOf(":");if(y!==-1){let g=h.slice(0,y),b=h[y+1]===" "?2:1,v=h.slice(y+b);p(g,v,h);return}p(h,"",h)}function p(h,y,g){switch(h){case"event":c=y;break;case"data":l=`${l}${y}
|
|
109
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let b=f.compile();return(v,C)=>b(p,v,C)},o,s=Pa,a=!og.jitless,c=a&&pw.value,u=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=n.value);let m=p.value;return s(m)?a&&c&&f?.async===!1&&f.jitless!==!0?(o||(o=i(e.shape)),p=o(p,f),u?eC([],m,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),p)}});function VA(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;let i=t.filter(o=>!gs(o));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>ti(s,n,Ir())))}),e)}var vg=M("$ZodUnion",(t,e)=>{nt.init(t,e),st(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),st(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),st(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),st(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){let i=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>Ef(o.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(i,o)=>{if(r)return n(i,o);let s=!1,a=[];for(let l of e.options){let c=l._zod.run({value:i.value,issues:[]},o);if(c instanceof Promise)a.push(c),s=!0;else{if(c.issues.length===0)return c;a.push(c)}}return s?Promise.all(a).then(l=>VA(l,i,t,o)):VA(a,i,t,o)}}),ex=M("$ZodDiscriminatedUnion",(t,e)=>{vg.init(t,e);let r=t._zod.parse;st(t._zod,"propValues",()=>{let i={};for(let o of e.options){let s=o._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[a,l]of Object.entries(s)){i[a]||(i[a]=new Set);for(let c of l)i[a].add(c)}}return i});let n=au(()=>{let i=e.options,o=new Map;for(let s of i){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let l of a){if(o.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);o.set(l,s)}}return o});t._zod.parse=(i,o)=>{let s=i.value;if(!Pa(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),i;let a=n.value.get(s?.[e.discriminator]);return a?a._zod.run(i,o):e.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:s,path:[e.discriminator],inst:t}),i)}}),tx=M("$ZodIntersection",(t,e)=>{nt.init(t,e),t._zod.parse=(r,n)=>{let i=r.value,o=e.left._zod.run({value:i,issues:[]},n),s=e.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([l,c])=>qA(r,l,c)):qA(r,o,s)}});function xw(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(hs(t)&&hs(e)){let r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(let o of n){let s=xw(t[o],e[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=e[n],s=xw(i,o);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function qA(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),gs(t))return t;let n=xw(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var rx=M("$ZodRecord",(t,e)=>{nt.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!hs(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),r;let o=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let c of s)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);let u=e.valueType._zod.run({value:i[c],issues:[]},n);u instanceof Promise?o.push(u.then(d=>{d.issues.length&&r.issues.push(...yo(c,d.issues)),r.value[c]=d.value})):(u.issues.length&&r.issues.push(...yo(c,u.issues)),r.value[c]=u.value)}let l;for(let c in i)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{r.value={};for(let a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let l=e.keyType._zod.run({value:a,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(u=>ti(u,n,Ir())),input:a,path:[a],inst:t}),r.value[l.value]=l.value;continue}let c=e.valueType._zod.run({value:i[a],issues:[]},n);c instanceof Promise?o.push(c.then(u=>{u.issues.length&&r.issues.push(...yo(a,u.issues)),r.value[l.value]=u.value})):(c.issues.length&&r.issues.push(...yo(a,c.issues)),r.value[l.value]=c.value)}}return o.length?Promise.all(o).then(()=>r):r}});var nx=M("$ZodEnum",(t,e)=>{nt.init(t,e);let r=ag(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>mw.has(typeof i)).map(i=>typeof i=="string"?Pi(i):i.toString()).join("|")})$`),t._zod.parse=(i,o)=>{let s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),ix=M("$ZodLiteral",(t,e)=>{if(nt.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?Pi(n):n?Pi(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),n}});var ox=M("$ZodTransform",(t,e)=>{nt.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ou(t.constructor.name);let i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(r.value=s,r));if(i instanceof Promise)throw new Ei;return r.value=i,r}});function BA(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var sx=M("$ZodOptional",(t,e)=>{nt.init(t,e),t._zod.optin="optional",t._zod.optout="optional",st(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),st(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Ef(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>BA(o,r.value)):BA(i,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),ax=M("$ZodNullable",(t,e)=>{nt.init(t,e),st(t._zod,"optin",()=>e.innerType._zod.optin),st(t._zod,"optout",()=>e.innerType._zod.optout),st(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Ef(r.source)}|null)$`):void 0}),st(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),lx=M("$ZodDefault",(t,e)=>{nt.init(t,e),t._zod.optin="optional",st(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>WA(o,e)):WA(i,e)}});function WA(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var cx=M("$ZodPrefault",(t,e)=>{nt.init(t,e),t._zod.optin="optional",st(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),ux=M("$ZodNonOptional",(t,e)=>{nt.init(t,e),st(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>GA(o,t)):GA(i,t)}});function GA(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var dx=M("$ZodCatch",(t,e)=>{nt.init(t,e),st(t._zod,"optin",()=>e.innerType._zod.optin),st(t._zod,"optout",()=>e.innerType._zod.optout),st(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>ti(s,n,Ir()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(o=>ti(o,n,Ir()))},input:r.value}),r.issues=[]),r)}});var fx=M("$ZodPipe",(t,e)=>{nt.init(t,e),st(t._zod,"values",()=>e.in._zod.values),st(t._zod,"optin",()=>e.in._zod.optin),st(t._zod,"optout",()=>e.out._zod.optout),st(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=e.out._zod.run(r,n);return o instanceof Promise?o.then(s=>gg(s,e.in,n)):gg(o,e.in,n)}let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(o=>gg(o,e.out,n)):gg(i,e.out,n)}});function gg(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var px=M("$ZodReadonly",(t,e)=>{nt.init(t,e),st(t._zod,"propValues",()=>e.innerType._zod.propValues),st(t._zod,"values",()=>e.innerType._zod.values),st(t._zod,"optin",()=>e.innerType?._zod?.optin),st(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(HA):HA(i)}});function HA(t){return t.value=Object.freeze(t.value),t}var mx=M("$ZodCustom",(t,e)=>{nr.init(t,e),nt.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(o=>XA(o,r,n,t));XA(i,r,n,t)}});function XA(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(lu(i))}}var CF=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},zF=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${CF(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${ve(n.values[0])}`:`Invalid option: expected one of ${_e(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",o=e(n.origin);return o?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",o=e(n.origin);return o?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${o.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${_e(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function hx(){return{localeError:zF()}}var nC;var wg=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function yx(){return new wg}(nC=globalThis).__zod_globalRegistry??(nC.__zod_globalRegistry=yx());var bo=globalThis.__zod_globalRegistry;function bx(t,e){return new t({type:"string",...ae(e)})}function _x(t,e){return new t({type:"string",coerce:!0,...ae(e)})}function vx(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ae(e)})}function xg(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ae(e)})}function wx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ae(e)})}function xx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ae(e)})}function kx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ae(e)})}function Sx(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ae(e)})}function kg(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ae(e)})}function $x(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ae(e)})}function Ix(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ae(e)})}function Ex(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ae(e)})}function Px(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ae(e)})}function Tx(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ae(e)})}function Ax(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ae(e)})}function Cx(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ae(e)})}function zx(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ae(e)})}function Ox(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ae(e)})}function Rx(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ae(e)})}function Nx(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ae(e)})}function Mx(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ae(e)})}function jx(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ae(e)})}function Dx(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ae(e)})}function Lx(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ae(e)})}function Ux(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ae(e)})}function Zx(t,e){return new t({type:"string",format:"date",check:"string_format",...ae(e)})}function Fx(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ae(e)})}function Vx(t,e){return new t({type:"string",format:"duration",check:"string_format",...ae(e)})}function qx(t,e){return new t({type:"number",checks:[],...ae(e)})}function Bx(t,e){return new t({type:"number",coerce:!0,checks:[],...ae(e)})}function Wx(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ae(e)})}function Gx(t,e){return new t({type:"boolean",...ae(e)})}function Hx(t,e){return new t({type:"boolean",coerce:!0,...ae(e)})}function Xx(t,e){return new t({type:"bigint",coerce:!0,...ae(e)})}function Kx(t,e){return new t({type:"null",...ae(e)})}function Jx(t){return new t({type:"any"})}function Yx(t){return new t({type:"unknown"})}function Qx(t,e){return new t({type:"never",...ae(e)})}function e0(t,e){return new t({type:"date",coerce:!0,...ae(e)})}function Aa(t,e){return new vw({check:"less_than",...ae(e),value:t,inclusive:!1})}function ri(t,e){return new vw({check:"less_than",...ae(e),value:t,inclusive:!0})}function Ca(t,e){return new ww({check:"greater_than",...ae(e),value:t,inclusive:!1})}function yn(t,e){return new ww({check:"greater_than",...ae(e),value:t,inclusive:!0})}function du(t,e){return new PA({check:"multiple_of",...ae(e),value:t})}function Of(t,e){return new AA({check:"max_length",...ae(e),maximum:t})}function za(t,e){return new CA({check:"min_length",...ae(e),minimum:t})}function Rf(t,e){return new zA({check:"length_equals",...ae(e),length:t})}function Sg(t,e){return new OA({check:"string_format",format:"regex",...ae(e),pattern:t})}function $g(t){return new RA({check:"string_format",format:"lowercase",...ae(t)})}function Ig(t){return new NA({check:"string_format",format:"uppercase",...ae(t)})}function Eg(t,e){return new MA({check:"string_format",format:"includes",...ae(e),includes:t})}function Pg(t,e){return new jA({check:"string_format",format:"starts_with",...ae(e),prefix:t})}function Tg(t,e){return new DA({check:"string_format",format:"ends_with",...ae(e),suffix:t})}function _o(t){return new LA({check:"overwrite",tx:t})}function Ag(t){return _o(e=>e.normalize(t))}function Cg(){return _o(t=>t.trim())}function zg(){return _o(t=>t.toLowerCase())}function Og(){return _o(t=>t.toUpperCase())}function t0(){return _o(t=>fw(t))}function oC(t,e,r){return new t({type:"array",element:e,...ae(r)})}function r0(t,e,r){let n=ae(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function n0(t,e,r){return new t({type:"custom",check:"custom",fn:e,...ae(r)})}function i0(t){let e=MF(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(lu(n,r.value,e._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),r.issues.push(lu(i))}},t(r.value,r)));return e}function MF(t,e){let r=new nr({check:"custom",...ae(e)});return r._zod.check=t,r}function fu(t){return!!t._zod}function ii(t,e){return fu(t)?cu(t,e):t.safeParse(e)}function Rg(t){if(!t)return;let e;if(fu(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function mC(t){if(fu(t)){let o=t._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var Nf={};gd(Nf,{ZodISODate:()=>a0,ZodISODateTime:()=>o0,ZodISODuration:()=>d0,ZodISOTime:()=>c0,date:()=>l0,datetime:()=>s0,duration:()=>f0,time:()=>u0});var o0=M("ZodISODateTime",(t,e)=>{Rw.init(t,e),$t.init(t,e)});function s0(t){return Ux(o0,t)}var a0=M("ZodISODate",(t,e)=>{Nw.init(t,e),$t.init(t,e)});function l0(t){return Zx(a0,t)}var c0=M("ZodISOTime",(t,e)=>{Mw.init(t,e),$t.init(t,e)});function u0(t){return Fx(c0,t)}var d0=M("ZodISODuration",(t,e)=>{jw.init(t,e),$t.init(t,e)});function f0(t){return Vx(d0,t)}var gC=(t,e)=>{ug.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>fg(t,r)},flatten:{value:r=>dg(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,su,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,su,2)}},isEmpty:{get(){return t.issues.length===0}}})},k_e=M("ZodError",gC),bn=M("ZodError",gC,{Parent:Error});var yC=pg(bn),bC=mg(bn),_C=Tf(bn),vC=Af(bn),wC=qT(bn),xC=BT(bn),kC=WT(bn),SC=GT(bn),$C=HT(bn),IC=XT(bn),EC=KT(bn),PC=JT(bn);var ht=M("ZodType",(t,e)=>(nt.init(t,e),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(V.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>Hr(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>yC(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>_C(t,r,n),t.parseAsync=async(r,n)=>bC(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>vC(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>wC(t,r,n),t.decode=(r,n)=>xC(t,r,n),t.encodeAsync=async(r,n)=>kC(t,r,n),t.decodeAsync=async(r,n)=>SC(t,r,n),t.safeEncode=(r,n)=>$C(t,r,n),t.safeDecode=(r,n)=>IC(t,r,n),t.safeEncodeAsync=async(r,n)=>EC(t,r,n),t.safeDecodeAsync=async(r,n)=>PC(t,r,n),t.refine=(r,n)=>t.check(b9(r,n)),t.superRefine=r=>t.check(_9(r)),t.overwrite=r=>t.check(_o(r)),t.optional=()=>zt(t),t.nullable=()=>CC(t),t.nullish=()=>zt(CC(t)),t.nonoptional=r=>f9(t,r),t.array=()=>B(t),t.or=r=>gt([t,r]),t.and=r=>jg(t,r),t.transform=r=>m0(t,UC(r)),t.default=r=>c9(t,r),t.prefault=r=>d9(t,r),t.catch=r=>m9(t,r),t.pipe=r=>m0(t,r),t.readonly=()=>y9(t),t.describe=r=>{let n=t.clone();return bo.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return bo.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return bo.get(t);let n=t.clone();return bo.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),zC=M("_ZodString",(t,e)=>{uu.init(t,e),ht.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(Sg(...n)),t.includes=(...n)=>t.check(Eg(...n)),t.startsWith=(...n)=>t.check(Pg(...n)),t.endsWith=(...n)=>t.check(Tg(...n)),t.min=(...n)=>t.check(za(...n)),t.max=(...n)=>t.check(Of(...n)),t.length=(...n)=>t.check(Rf(...n)),t.nonempty=(...n)=>t.check(za(1,...n)),t.lowercase=n=>t.check($g(n)),t.uppercase=n=>t.check(Ig(n)),t.trim=()=>t.check(Cg()),t.normalize=(...n)=>t.check(Ag(...n)),t.toLowerCase=()=>t.check(zg()),t.toUpperCase=()=>t.check(Og()),t.slugify=()=>t.check(t0())}),h0=M("ZodString",(t,e)=>{uu.init(t,e),zC.init(t,e),t.email=r=>t.check(vx(O6,r)),t.url=r=>t.check(kg(OC,r)),t.jwt=r=>t.check(Lx(H6,r)),t.emoji=r=>t.check($x(R6,r)),t.guid=r=>t.check(xg(TC,r)),t.uuid=r=>t.check(wx(Ng,r)),t.uuidv4=r=>t.check(xx(Ng,r)),t.uuidv6=r=>t.check(kx(Ng,r)),t.uuidv7=r=>t.check(Sx(Ng,r)),t.nanoid=r=>t.check(Ix(N6,r)),t.guid=r=>t.check(xg(TC,r)),t.cuid=r=>t.check(Ex(M6,r)),t.cuid2=r=>t.check(Px(j6,r)),t.ulid=r=>t.check(Tx(D6,r)),t.base64=r=>t.check(Mx(B6,r)),t.base64url=r=>t.check(jx(W6,r)),t.xid=r=>t.check(Ax(L6,r)),t.ksuid=r=>t.check(Cx(U6,r)),t.ipv4=r=>t.check(zx(Z6,r)),t.ipv6=r=>t.check(Ox(F6,r)),t.cidrv4=r=>t.check(Rx(V6,r)),t.cidrv6=r=>t.check(Nx(q6,r)),t.e164=r=>t.check(Dx(G6,r)),t.datetime=r=>t.check(s0(r)),t.date=r=>t.check(l0(r)),t.time=r=>t.check(u0(r)),t.duration=r=>t.check(f0(r))});function k(t){return bx(h0,t)}var $t=M("ZodStringFormat",(t,e)=>{mt.init(t,e),zC.init(t,e)}),O6=M("ZodEmail",(t,e)=>{$w.init(t,e),$t.init(t,e)});var TC=M("ZodGUID",(t,e)=>{kw.init(t,e),$t.init(t,e)});var Ng=M("ZodUUID",(t,e)=>{Sw.init(t,e),$t.init(t,e)});var OC=M("ZodURL",(t,e)=>{Iw.init(t,e),$t.init(t,e)});function RC(t){return kg(OC,t)}var R6=M("ZodEmoji",(t,e)=>{Ew.init(t,e),$t.init(t,e)});var N6=M("ZodNanoID",(t,e)=>{Pw.init(t,e),$t.init(t,e)});var M6=M("ZodCUID",(t,e)=>{Tw.init(t,e),$t.init(t,e)});var j6=M("ZodCUID2",(t,e)=>{Aw.init(t,e),$t.init(t,e)});var D6=M("ZodULID",(t,e)=>{Cw.init(t,e),$t.init(t,e)});var L6=M("ZodXID",(t,e)=>{zw.init(t,e),$t.init(t,e)});var U6=M("ZodKSUID",(t,e)=>{Ow.init(t,e),$t.init(t,e)});var Z6=M("ZodIPv4",(t,e)=>{Dw.init(t,e),$t.init(t,e)});var F6=M("ZodIPv6",(t,e)=>{Lw.init(t,e),$t.init(t,e)});var V6=M("ZodCIDRv4",(t,e)=>{Uw.init(t,e),$t.init(t,e)});var q6=M("ZodCIDRv6",(t,e)=>{Zw.init(t,e),$t.init(t,e)});var B6=M("ZodBase64",(t,e)=>{Fw.init(t,e),$t.init(t,e)});var W6=M("ZodBase64URL",(t,e)=>{Vw.init(t,e),$t.init(t,e)});var G6=M("ZodE164",(t,e)=>{qw.init(t,e),$t.init(t,e)});var H6=M("ZodJWT",(t,e)=>{Bw.init(t,e),$t.init(t,e)});var Mg=M("ZodNumber",(t,e)=>{bg.init(t,e),ht.init(t,e),t.gt=(n,i)=>t.check(Ca(n,i)),t.gte=(n,i)=>t.check(yn(n,i)),t.min=(n,i)=>t.check(yn(n,i)),t.lt=(n,i)=>t.check(Aa(n,i)),t.lte=(n,i)=>t.check(ri(n,i)),t.max=(n,i)=>t.check(ri(n,i)),t.int=n=>t.check(AC(n)),t.safe=n=>t.check(AC(n)),t.positive=n=>t.check(Ca(0,n)),t.nonnegative=n=>t.check(yn(0,n)),t.negative=n=>t.check(Aa(0,n)),t.nonpositive=n=>t.check(ri(0,n)),t.multipleOf=(n,i)=>t.check(du(n,i)),t.step=(n,i)=>t.check(du(n,i)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function et(t){return qx(Mg,t)}var X6=M("ZodNumberFormat",(t,e)=>{Ww.init(t,e),Mg.init(t,e)});function AC(t){return Wx(X6,t)}var g0=M("ZodBoolean",(t,e)=>{_g.init(t,e),ht.init(t,e)});function dt(t){return Gx(g0,t)}var NC=M("ZodBigInt",(t,e)=>{Gw.init(t,e),ht.init(t,e),t.gte=(n,i)=>t.check(yn(n,i)),t.min=(n,i)=>t.check(yn(n,i)),t.gt=(n,i)=>t.check(Ca(n,i)),t.gte=(n,i)=>t.check(yn(n,i)),t.min=(n,i)=>t.check(yn(n,i)),t.lt=(n,i)=>t.check(Aa(n,i)),t.lte=(n,i)=>t.check(ri(n,i)),t.max=(n,i)=>t.check(ri(n,i)),t.positive=n=>t.check(Ca(BigInt(0),n)),t.negative=n=>t.check(Aa(BigInt(0),n)),t.nonpositive=n=>t.check(ri(BigInt(0),n)),t.nonnegative=n=>t.check(yn(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(du(n,i));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});var K6=M("ZodNull",(t,e)=>{Hw.init(t,e),ht.init(t,e)});function y0(t){return Kx(K6,t)}var J6=M("ZodAny",(t,e)=>{Xw.init(t,e),ht.init(t,e)});function MC(){return Jx(J6)}var Y6=M("ZodUnknown",(t,e)=>{Kw.init(t,e),ht.init(t,e)});function It(){return Yx(Y6)}var Q6=M("ZodNever",(t,e)=>{Jw.init(t,e),ht.init(t,e)});function e9(t){return Qx(Q6,t)}var jC=M("ZodDate",(t,e)=>{Yw.init(t,e),ht.init(t,e),t.min=(n,i)=>t.check(yn(n,i)),t.max=(n,i)=>t.check(ri(n,i));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});var t9=M("ZodArray",(t,e)=>{Qw.init(t,e),ht.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(za(r,n)),t.nonempty=r=>t.check(za(1,r)),t.max=(r,n)=>t.check(Of(r,n)),t.length=(r,n)=>t.check(Rf(r,n)),t.unwrap=()=>t.element});function B(t,e){return oC(t9,t,e)}var DC=M("ZodObject",(t,e)=>{rC.init(t,e),ht.init(t,e),V.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Xr(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:It()}),t.loose=()=>t.clone({...t._zod.def,catchall:It()}),t.strict=()=>t.clone({...t._zod.def,catchall:e9()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>V.extend(t,r),t.safeExtend=r=>V.safeExtend(t,r),t.merge=r=>V.merge(t,r),t.pick=r=>V.pick(t,r),t.omit=r=>V.omit(t,r),t.partial=(...r)=>V.partial(ZC,t,r[0]),t.required=(...r)=>V.required(FC,t,r[0])});function G(t,e){let r={type:"object",shape:t??{},...V.normalizeParams(e)};return new DC(r)}function Yt(t,e){return new DC({type:"object",shape:t,catchall:It(),...V.normalizeParams(e)})}var LC=M("ZodUnion",(t,e)=>{vg.init(t,e),ht.init(t,e),t.options=e.options});function gt(t,e){return new LC({type:"union",options:t,...V.normalizeParams(e)})}var r9=M("ZodDiscriminatedUnion",(t,e)=>{LC.init(t,e),ex.init(t,e)});function b0(t,e,r){return new r9({type:"union",options:e,discriminator:t,...V.normalizeParams(r)})}var n9=M("ZodIntersection",(t,e)=>{tx.init(t,e),ht.init(t,e)});function jg(t,e){return new n9({type:"intersection",left:t,right:e})}var i9=M("ZodRecord",(t,e)=>{rx.init(t,e),ht.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Et(t,e,r){return new i9({type:"record",keyType:t,valueType:e,...V.normalizeParams(r)})}var p0=M("ZodEnum",(t,e)=>{nx.init(t,e),ht.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{let o={};for(let s of n)if(r.has(s))o[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new p0({...e,checks:[],...V.normalizeParams(i),entries:o})},t.exclude=(n,i)=>{let o={...e.entries};for(let s of n)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new p0({...e,checks:[],...V.normalizeParams(i),entries:o})}});function Xr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new p0({type:"enum",entries:r,...V.normalizeParams(e)})}var o9=M("ZodLiteral",(t,e)=>{ix.init(t,e),ht.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function ne(t,e){return new o9({type:"literal",values:Array.isArray(t)?t:[t],...V.normalizeParams(e)})}var s9=M("ZodTransform",(t,e)=>{ox.init(t,e),ht.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ou(t.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(V.issue(o,r.value,e));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(V.issue(s))}};let i=e.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function UC(t){return new s9({type:"transform",transform:t})}var ZC=M("ZodOptional",(t,e)=>{sx.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType});function zt(t){return new ZC({type:"optional",innerType:t})}var a9=M("ZodNullable",(t,e)=>{ax.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType});function CC(t){return new a9({type:"nullable",innerType:t})}var l9=M("ZodDefault",(t,e)=>{lx.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function c9(t,e){return new l9({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():V.shallowClone(e)}})}var u9=M("ZodPrefault",(t,e)=>{cx.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType});function d9(t,e){return new u9({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():V.shallowClone(e)}})}var FC=M("ZodNonOptional",(t,e)=>{ux.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType});function f9(t,e){return new FC({type:"nonoptional",innerType:t,...V.normalizeParams(e)})}var p9=M("ZodCatch",(t,e)=>{dx.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function m9(t,e){return new p9({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var h9=M("ZodPipe",(t,e)=>{fx.init(t,e),ht.init(t,e),t.in=e.in,t.out=e.out});function m0(t,e){return new h9({type:"pipe",in:t,out:e})}var g9=M("ZodReadonly",(t,e)=>{px.init(t,e),ht.init(t,e),t.unwrap=()=>t._zod.def.innerType});function y9(t){return new g9({type:"readonly",innerType:t})}var VC=M("ZodCustom",(t,e)=>{mx.init(t,e),ht.init(t,e)});function qC(t,e){return r0(VC,t??(()=>!0),e)}function b9(t,e={}){return n0(VC,t,e)}function _9(t){return i0(t)}function _0(t,e){return m0(UC(t),e)}var WC={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var BC;BC||(BC={});var Dg={};gd(Dg,{bigint:()=>k9,boolean:()=>x9,date:()=>S9,number:()=>w9,string:()=>v9});function v9(t){return _x(h0,t)}function w9(t){return Bx(Mg,t)}function x9(t){return Hx(g0,t)}function k9(t){return Xx(NC,t)}function S9(t){return e0(jC,t)}Ir(hx());var mu="2025-11-25";var HC=[mu,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ys="io.modelcontextprotocol/related-task",Ug="2.0",dr=qC(t=>t!==null&&(typeof t=="object"||typeof t=="function")),XC=gt([k(),et().int()]),KC=k(),V_e=Yt({ttl:gt([et(),y0()]).optional(),pollInterval:et().optional()}),I9=G({ttl:et().optional()}),E9=G({taskId:k()}),w0=Yt({progressToken:XC.optional(),[ys]:E9.optional()}),_n=G({_meta:w0.optional()}),Mf=_n.extend({task:I9.optional()}),JC=t=>Mf.safeParse(t).success,fr=G({method:k(),params:_n.loose().optional()}),zn=G({_meta:w0.optional()}),On=G({method:k(),params:zn.loose().optional()}),pr=Yt({_meta:w0.optional()}),Zg=gt([k(),et().int()]),YC=G({jsonrpc:ne(Ug),id:Zg,...fr.shape}).strict(),jf=t=>YC.safeParse(t).success,QC=G({jsonrpc:ne(Ug),...On.shape}).strict(),ez=t=>QC.safeParse(t).success,x0=G({jsonrpc:ne(Ug),id:Zg,result:pr}).strict(),Oa=t=>x0.safeParse(t).success;var ke;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(ke||(ke={}));var k0=G({jsonrpc:ne(Ug),id:Zg.optional(),error:G({code:et().int(),message:k(),data:It().optional()})}).strict();var tz=t=>k0.safeParse(t).success;var Fg=gt([YC,QC,x0,k0]),q_e=gt([x0,k0]),Ra=pr.strict(),P9=zn.extend({requestId:Zg.optional(),reason:k().optional()}),Vg=On.extend({method:ne("notifications/cancelled"),params:P9}),T9=G({src:k(),mimeType:k().optional(),sizes:B(k()).optional(),theme:Xr(["light","dark"]).optional()}),Df=G({icons:B(T9).optional()}),pu=G({name:k(),title:k().optional()}),rz=pu.extend({...pu.shape,...Df.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),A9=jg(G({applyDefaults:dt().optional()}),Et(k(),It())),C9=_0(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,jg(G({form:A9.optional(),url:dr.optional()}),Et(k(),It()).optional())),z9=Yt({list:dr.optional(),cancel:dr.optional(),requests:Yt({sampling:Yt({createMessage:dr.optional()}).optional(),elicitation:Yt({create:dr.optional()}).optional()}).optional()}),O9=Yt({list:dr.optional(),cancel:dr.optional(),requests:Yt({tools:Yt({call:dr.optional()}).optional()}).optional()}),R9=G({experimental:Et(k(),dr).optional(),sampling:G({context:dr.optional(),tools:dr.optional()}).optional(),elicitation:C9.optional(),roots:G({listChanged:dt().optional()}).optional(),tasks:z9.optional()}),N9=_n.extend({protocolVersion:k(),capabilities:R9,clientInfo:rz}),M9=fr.extend({method:ne("initialize"),params:N9});var j9=G({experimental:Et(k(),dr).optional(),logging:dr.optional(),completions:dr.optional(),prompts:G({listChanged:dt().optional()}).optional(),resources:G({subscribe:dt().optional(),listChanged:dt().optional()}).optional(),tools:G({listChanged:dt().optional()}).optional(),tasks:O9.optional()}),S0=pr.extend({protocolVersion:k(),capabilities:j9,serverInfo:rz,instructions:k().optional()}),nz=On.extend({method:ne("notifications/initialized"),params:zn.optional()}),iz=t=>nz.safeParse(t).success,qg=fr.extend({method:ne("ping"),params:_n.optional()}),D9=G({progress:et(),total:zt(et()),message:zt(k())}),L9=G({...zn.shape,...D9.shape,progressToken:XC}),Bg=On.extend({method:ne("notifications/progress"),params:L9}),U9=_n.extend({cursor:KC.optional()}),Lf=fr.extend({params:U9.optional()}),Uf=pr.extend({nextCursor:KC.optional()}),Z9=Xr(["working","input_required","completed","failed","cancelled"]),Zf=G({taskId:k(),status:Z9,ttl:gt([et(),y0()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:zt(et()),statusMessage:zt(k())}),Na=pr.extend({task:Zf}),F9=zn.merge(Zf),Ff=On.extend({method:ne("notifications/tasks/status"),params:F9}),Wg=fr.extend({method:ne("tasks/get"),params:_n.extend({taskId:k()})}),Gg=pr.merge(Zf),Hg=fr.extend({method:ne("tasks/result"),params:_n.extend({taskId:k()})}),B_e=pr.loose(),Xg=Lf.extend({method:ne("tasks/list")}),Kg=Uf.extend({tasks:B(Zf)}),Jg=fr.extend({method:ne("tasks/cancel"),params:_n.extend({taskId:k()})}),oz=pr.merge(Zf),sz=G({uri:k(),mimeType:zt(k()),_meta:Et(k(),It()).optional()}),az=sz.extend({text:k()}),$0=k().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),lz=sz.extend({blob:$0}),Vf=Xr(["user","assistant"]),hu=G({audience:B(Vf).optional(),priority:et().min(0).max(1).optional(),lastModified:Nf.datetime({offset:!0}).optional()}),cz=G({...pu.shape,...Df.shape,uri:k(),description:zt(k()),mimeType:zt(k()),annotations:hu.optional(),_meta:zt(Yt({}))}),V9=G({...pu.shape,...Df.shape,uriTemplate:k(),description:zt(k()),mimeType:zt(k()),annotations:hu.optional(),_meta:zt(Yt({}))}),q9=Lf.extend({method:ne("resources/list")}),I0=Uf.extend({resources:B(cz)}),B9=Lf.extend({method:ne("resources/templates/list")}),E0=Uf.extend({resourceTemplates:B(V9)}),P0=_n.extend({uri:k()}),W9=P0,G9=fr.extend({method:ne("resources/read"),params:W9}),T0=pr.extend({contents:B(gt([az,lz]))}),A0=On.extend({method:ne("notifications/resources/list_changed"),params:zn.optional()}),H9=P0,X9=fr.extend({method:ne("resources/subscribe"),params:H9}),K9=P0,J9=fr.extend({method:ne("resources/unsubscribe"),params:K9}),Y9=zn.extend({uri:k()}),Q9=On.extend({method:ne("notifications/resources/updated"),params:Y9}),e5=G({name:k(),description:zt(k()),required:zt(dt())}),t5=G({...pu.shape,...Df.shape,description:zt(k()),arguments:zt(B(e5)),_meta:zt(Yt({}))}),r5=Lf.extend({method:ne("prompts/list")}),C0=Uf.extend({prompts:B(t5)}),n5=_n.extend({name:k(),arguments:Et(k(),k()).optional()}),i5=fr.extend({method:ne("prompts/get"),params:n5}),z0=G({type:ne("text"),text:k(),annotations:hu.optional(),_meta:Et(k(),It()).optional()}),O0=G({type:ne("image"),data:$0,mimeType:k(),annotations:hu.optional(),_meta:Et(k(),It()).optional()}),R0=G({type:ne("audio"),data:$0,mimeType:k(),annotations:hu.optional(),_meta:Et(k(),It()).optional()}),o5=G({type:ne("tool_use"),name:k(),id:k(),input:Et(k(),It()),_meta:Et(k(),It()).optional()}),s5=G({type:ne("resource"),resource:gt([az,lz]),annotations:hu.optional(),_meta:Et(k(),It()).optional()}),a5=cz.extend({type:ne("resource_link")}),N0=gt([z0,O0,R0,a5,s5]),l5=G({role:Vf,content:N0}),M0=pr.extend({description:k().optional(),messages:B(l5)}),j0=On.extend({method:ne("notifications/prompts/list_changed"),params:zn.optional()}),c5=G({title:k().optional(),readOnlyHint:dt().optional(),destructiveHint:dt().optional(),idempotentHint:dt().optional(),openWorldHint:dt().optional()}),u5=G({taskSupport:Xr(["required","optional","forbidden"]).optional()}),uz=G({...pu.shape,...Df.shape,description:k().optional(),inputSchema:G({type:ne("object"),properties:Et(k(),dr).optional(),required:B(k()).optional()}).catchall(It()),outputSchema:G({type:ne("object"),properties:Et(k(),dr).optional(),required:B(k()).optional()}).catchall(It()).optional(),annotations:c5.optional(),execution:u5.optional(),_meta:Et(k(),It()).optional()}),d5=Lf.extend({method:ne("tools/list")}),D0=Uf.extend({tools:B(uz)}),gu=pr.extend({content:B(N0).default([]),structuredContent:Et(k(),It()).optional(),isError:dt().optional()}),W_e=gu.or(pr.extend({toolResult:It()})),f5=Mf.extend({name:k(),arguments:Et(k(),It()).optional()}),p5=fr.extend({method:ne("tools/call"),params:f5}),qf=On.extend({method:ne("notifications/tools/list_changed"),params:zn.optional()}),dz=G({autoRefresh:dt().default(!0),debounceMs:et().int().nonnegative().default(300)}),fz=Xr(["debug","info","notice","warning","error","critical","alert","emergency"]),m5=_n.extend({level:fz}),h5=fr.extend({method:ne("logging/setLevel"),params:m5}),g5=zn.extend({level:fz,logger:k().optional(),data:It()}),L0=On.extend({method:ne("notifications/message"),params:g5}),y5=G({name:k().optional()}),b5=G({hints:B(y5).optional(),costPriority:et().min(0).max(1).optional(),speedPriority:et().min(0).max(1).optional(),intelligencePriority:et().min(0).max(1).optional()}),_5=G({mode:Xr(["auto","required","none"]).optional()}),v5=G({type:ne("tool_result"),toolUseId:k().describe("The unique identifier for the corresponding tool call."),content:B(N0).default([]),structuredContent:G({}).loose().optional(),isError:dt().optional(),_meta:Et(k(),It()).optional()}),w5=b0("type",[z0,O0,R0]),Lg=b0("type",[z0,O0,R0,o5,v5]),x5=G({role:Vf,content:gt([Lg,B(Lg)]),_meta:Et(k(),It()).optional()}),k5=Mf.extend({messages:B(x5),modelPreferences:b5.optional(),systemPrompt:k().optional(),includeContext:Xr(["none","thisServer","allServers"]).optional(),temperature:et().optional(),maxTokens:et().int(),stopSequences:B(k()).optional(),metadata:dr.optional(),tools:B(uz).optional(),toolChoice:_5.optional()}),U0=fr.extend({method:ne("sampling/createMessage"),params:k5}),Z0=pr.extend({model:k(),stopReason:zt(Xr(["endTurn","stopSequence","maxTokens"]).or(k())),role:Vf,content:w5}),F0=pr.extend({model:k(),stopReason:zt(Xr(["endTurn","stopSequence","maxTokens","toolUse"]).or(k())),role:Vf,content:gt([Lg,B(Lg)])}),S5=G({type:ne("boolean"),title:k().optional(),description:k().optional(),default:dt().optional()}),$5=G({type:ne("string"),title:k().optional(),description:k().optional(),minLength:et().optional(),maxLength:et().optional(),format:Xr(["email","uri","date","date-time"]).optional(),default:k().optional()}),I5=G({type:Xr(["number","integer"]),title:k().optional(),description:k().optional(),minimum:et().optional(),maximum:et().optional(),default:et().optional()}),E5=G({type:ne("string"),title:k().optional(),description:k().optional(),enum:B(k()),default:k().optional()}),P5=G({type:ne("string"),title:k().optional(),description:k().optional(),oneOf:B(G({const:k(),title:k()})),default:k().optional()}),T5=G({type:ne("string"),title:k().optional(),description:k().optional(),enum:B(k()),enumNames:B(k()).optional(),default:k().optional()}),A5=gt([E5,P5]),C5=G({type:ne("array"),title:k().optional(),description:k().optional(),minItems:et().optional(),maxItems:et().optional(),items:G({type:ne("string"),enum:B(k())}),default:B(k()).optional()}),z5=G({type:ne("array"),title:k().optional(),description:k().optional(),minItems:et().optional(),maxItems:et().optional(),items:G({anyOf:B(G({const:k(),title:k()}))}),default:B(k()).optional()}),O5=gt([C5,z5]),R5=gt([T5,A5,O5]),N5=gt([R5,S5,$5,I5]),M5=Mf.extend({mode:ne("form").optional(),message:k(),requestedSchema:G({type:ne("object"),properties:Et(k(),N5),required:B(k()).optional()})}),j5=Mf.extend({mode:ne("url"),message:k(),elicitationId:k(),url:k().url()}),D5=gt([M5,j5]),V0=fr.extend({method:ne("elicitation/create"),params:D5}),L5=zn.extend({elicitationId:k()}),U5=On.extend({method:ne("notifications/elicitation/complete"),params:L5}),q0=pr.extend({action:Xr(["accept","decline","cancel"]),content:_0(t=>t===null?void 0:t,Et(k(),gt([k(),et(),dt(),B(k())])).optional())}),Z5=G({type:ne("ref/resource"),uri:k()});var F5=G({type:ne("ref/prompt"),name:k()}),V5=_n.extend({ref:gt([F5,Z5]),argument:G({name:k(),value:k()}),context:G({arguments:Et(k(),k()).optional()}).optional()}),q5=fr.extend({method:ne("completion/complete"),params:V5});var B0=pr.extend({completion:Yt({values:B(k()).max(100),total:zt(et().int()),hasMore:zt(dt())})}),B5=G({uri:k().startsWith("file://"),name:k().optional(),_meta:Et(k(),It()).optional()}),W5=fr.extend({method:ne("roots/list"),params:_n.optional()}),G5=pr.extend({roots:B(B5)}),H5=On.extend({method:ne("notifications/roots/list_changed"),params:zn.optional()}),G_e=gt([qg,M9,q5,h5,i5,r5,q9,B9,G9,X9,J9,p5,d5,Wg,Hg,Xg,Jg]),H_e=gt([Vg,Bg,nz,H5,Ff]),X_e=gt([Ra,Z0,F0,q0,G5,Gg,Kg,Na]),K_e=gt([qg,U0,V0,W5,Wg,Hg,Xg,Jg]),J_e=gt([Vg,Bg,L0,Q9,A0,qf,j0,Ff,U5]),Y_e=gt([Ra,S0,B0,M0,C0,I0,E0,T0,gu,D0,Gg,Kg,Na]),fe=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===ke.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new v0(i.elicitations,r)}return new t(e,r,n)}},v0=class extends fe{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(ke.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function bs(t){return t==="completed"||t==="failed"||t==="cancelled"}var zve=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function W0(t){let r=Rg(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=mC(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function G0(t,e){let r=ii(t,e);if(!r.success)throw r.error;return r.data}var eV=6e4,Yg=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Vg,r=>{this._oncancel(r)}),this.setNotificationHandler(Bg,r=>{this._onprogress(r)}),this.setRequestHandler(qg,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Wg,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new fe(ke.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Hg,async(r,n)=>{let i=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(a.type==="response"||a.type==="error"){let l=a.message,c=l.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),a.type==="response")u(l);else{let d=l,p=new fe(d.error.code,d.error.message,d.error.data);u(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${c}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let s=await this._taskStore.getTask(o,n.sessionId);if(!s)throw new fe(ke.InvalidParams,`Task not found: ${o}`);if(!bs(s.status))return await this._waitForTaskUpdate(o,n.signal),await i();if(bs(s.status)){let a=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...a,_meta:{...a._meta,[ys]:{taskId:o}}}}return await i()};return await i()}),this.setRequestHandler(Xg,async(r,n)=>{try{let{tasks:i,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:o,_meta:{}}}catch(i){throw new fe(ke.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Jg,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new fe(ke.InvalidParams,`Task not found: ${r.params.taskId}`);if(bs(i.status))throw new fe(ke.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new fe(ke.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(i){throw i instanceof fe?i:new fe(ke.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,i,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),fe.fromError(ke.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=o=>{n?.(o),this._onerror(o)};let i=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{i?.(o,s),Oa(o)||tz(o)?this._onresponse(o):jf(o)?this._onrequest(o,s):ez(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=fe.fromError(ke.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,o=e.params?._meta?.[ys]?.taskId;if(n===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:ke.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:u,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let a=JC(e.params)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,c={signal:s.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async u=>{if(s.signal.aborted)return;let d={relatedRequestId:e.id};o&&(d.relatedTask={taskId:o}),await this.notification(u,d)},sendRequest:async(u,d,p)=>{if(s.signal.aborted)throw new fe(ke.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};o&&!f.relatedTask&&(f.relatedTask={taskId:o});let m=f.relatedTask?.taskId??o;return m&&l&&await l.updateTaskStatus(m,"input_required"),await this.request(u,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:o,taskStore:l,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async u=>{if(s.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async u=>{if(s.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:ke.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(l){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),s(l);return}o(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Oa(e))n(e);else{let s=new fe(e.error.code,e.error.message,e.error.data);n(s)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(Oa(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),Oa(e))i(e);else{let s=fe.fromError(e.error.code,e.error.message,e.error.data);i(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(e,r,n)}}catch(s){yield{type:"error",error:s instanceof fe?s:new fe(ke.InternalError,String(s))}}return}let o;try{let s=await this.request(e,Na,n);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new fe(ke.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:a},bs(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:a.status==="failed"?yield{type:"error",error:new fe(ke.InternalError,`Task ${o} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new fe(ke.InternalError,`Task ${o} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)};return}let l=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(c=>setTimeout(c,l)),n?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof fe?s:new fe(ke.InternalError,String(s))}}}request(e,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s,task:a,relatedTask:l}=n??{};return new Promise((c,u)=>{let d=b=>{u(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(b){d(b);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),l&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ys]:l}});let m=b=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(b)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`)));let v=b instanceof fe?b:new fe(ke.RequestTimeout,String(b));u(v)};this._responseHandlers.set(p,b=>{if(!n?.signal?.aborted){if(b instanceof Error)return u(b);try{let v=ii(r,b.result);v.success?c(v.data):u(v.error)}catch(v){u(v)}}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let h=n?.timeout??eV,y=()=>m(fe.fromError(ke.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let g=l?.taskId;if(g){let b=v=>{let C=this._responseHandlers.get(p);C?C(v):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,b),this._enqueueTaskMessage(g,{type:"request",message:f,timestamp:Date.now()}).catch(v=>{this._cleanupTimeout(p),u(v)})}else this._transport.send(f,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(b=>{this._cleanupTimeout(p),u(b)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Gg,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Kg,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},oz,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[ys]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ys]:r.relatedTask}}}),this._transport?.send(a,r).catch(l=>this._onerror(l))});return}let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[ys]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(e,r){let n=W0(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,o)=>{let s=G0(e,i);return Promise.resolve(r(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=W0(e);this._notificationHandlers.set(n,i=>{let o=G0(e,i);return Promise.resolve(r(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let i of n)if(i.type==="request"&&jf(i.message)){let o=i.message.id,s=this._requestResolvers.get(o);s?(s(new fe(ke.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(e);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,o)=>{if(r.aborted){o(new fe(ke.InvalidRequest,"Request cancelled"));return}let s=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(s),o(new fe(ke.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!e)throw new Error("No request provided");return await n.createTask(i,e.id,{method:e.method,params:e.params},r)},getTask:async i=>{let o=await n.getTask(i,r);if(!o)throw new fe(ke.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(i,o,s)=>{await n.storeTaskResult(i,o,s,r);let a=await n.getTask(i,r);if(a){let l=Ff.parse({method:"notifications/tasks/status",params:a});await this.notification(l),bs(a.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,o,s)=>{let a=await n.getTask(i,r);if(!a)throw new fe(ke.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(bs(a.status))throw new fe(ke.InvalidParams,`Cannot update task "${i}" from terminal status "${a.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,o,s,r);let l=await n.getTask(i,r);if(l){let c=Ff.parse({method:"notifications/tasks/status",params:l});await this.notification(c),bs(l.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function pz(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function mz(t,e){let r={...t};for(let n in e){let i=n,o=e[i];if(o===void 0)continue;let s=r[i];pz(s)&&pz(o)?r[i]={...s,...o}:r[i]=o}return r}var hj=I_(UR(),1),gj=I_(mj(),1);function jJ(){let t=new hj.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,gj.default)(t),t}var fb=class{constructor(e){this._ajv=e??jJ()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var pb=class{constructor(e){this._client=e}async*callToolStream(e,r=gu,n){let i=this._client,o={...n,task:n?.task??(i.isToolTask(e.name)?{}:void 0)},s=i.requestStream({method:"tools/call",params:e},r,o),a=i.getToolOutputValidator(e.name);for await(let l of s){if(l.type==="result"&&a){let c=l.result;if(!c.structuredContent&&!c.isError){yield{type:"error",error:new fe(ke.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(c.structuredContent)try{let u=a(c.structuredContent);if(!u.valid){yield{type:"error",error:new fe(ke.InvalidParams,`Structured content does not match the tool's output schema: ${u.errorMessage}`)};return}}catch(u){if(u instanceof fe){yield{type:"error",error:u};return}yield{type:"error",error:new fe(ke.InvalidParams,`Failed to validate structured content: ${u instanceof Error?u.message:String(u)}`)};return}}yield l}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,n){return this._client.requestStream(e,r,n)}};function yj(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function bj(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function mb(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let i of Object.keys(n)){let o=n[i];r[i]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(r[i]=o.default),r[i]!==void 0&&mb(o,r[i])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)typeof r!="boolean"&&mb(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)typeof r!="boolean"&&mb(r,e)}}function DJ(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var hb=class extends Yg{constructor(e,r){super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new fb,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",qf,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",j0,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",A0,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new pb(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=mz(this._capabilities,e)}setRequestHandler(e,r){let i=Rg(e)?.method;if(!i)throw new Error("Schema is missing a method literal");let o;if(fu(i)){let a=i;o=a._zod?.def?.value??a.value}else{let a=i;o=a._def?.value??a.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");let s=o;if(s==="elicitation/create"){let a=async(l,c)=>{let u=ii(V0,l);if(!u.success){let b=u.error instanceof Error?u.error.message:String(u.error);throw new fe(ke.InvalidParams,`Invalid elicitation request: ${b}`)}let{params:d}=u.data;d.mode=d.mode??"form";let{supportsFormMode:p,supportsUrlMode:f}=DJ(this._capabilities.elicitation);if(d.mode==="form"&&!p)throw new fe(ke.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!f)throw new fe(ke.InvalidParams,"Client does not support URL-mode elicitation requests");let m=await Promise.resolve(r(l,c));if(d.task){let b=ii(Na,m);if(!b.success){let v=b.error instanceof Error?b.error.message:String(b.error);throw new fe(ke.InvalidParams,`Invalid task creation result: ${v}`)}return b.data}let h=ii(q0,m);if(!h.success){let b=h.error instanceof Error?h.error.message:String(h.error);throw new fe(ke.InvalidParams,`Invalid elicitation result: ${b}`)}let y=h.data,g=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&y.action==="accept"&&y.content&&g&&this._capabilities.elicitation?.form?.applyDefaults)try{mb(g,y.content)}catch{}return y};return super.setRequestHandler(e,a)}if(s==="sampling/createMessage"){let a=async(l,c)=>{let u=ii(U0,l);if(!u.success){let y=u.error instanceof Error?u.error.message:String(u.error);throw new fe(ke.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=u.data,p=await Promise.resolve(r(l,c));if(d.task){let y=ii(Na,p);if(!y.success){let g=y.error instanceof Error?y.error.message:String(y.error);throw new fe(ke.InvalidParams,`Invalid task creation result: ${g}`)}return y.data}let m=d.tools||d.toolChoice?F0:Z0,h=ii(m,p);if(!h.success){let y=h.error instanceof Error?h.error.message:String(h.error);throw new fe(ke.InvalidParams,`Invalid sampling result: ${y}`)}return h.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapability(e,r){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:mu,capabilities:this._capabilities,clientInfo:this._clientInfo}},S0,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!HC.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){yj(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&bj(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Ra,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},B0,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Ra,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},M0,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},C0,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},I0,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},E0,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},T0,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Ra,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Ra,r)}async callTool(e,r=gu,n){if(this.isToolTaskRequired(e.name))throw new fe(ke.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let i=await this.request({method:"tools/call",params:e},r,n),o=this.getToolOutputValidator(e.name);if(o){if(!i.structuredContent&&!i.isError)throw new fe(ke.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{let s=o(i.structuredContent);if(!s.valid)throw new fe(ke.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof fe?s:new fe(ke.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return i}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of e){if(r.outputSchema){let i=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,i)}let n=r.execution?.taskSupport;(n==="required"||n==="optional")&&this._cachedKnownTaskTools.add(r.name),n==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},D0,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(e,r,n,i){let o=dz.safeParse(n);if(!o.success)throw new Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:a}=o.data,{onChanged:l}=n,c=async()=>{if(!s){l(null,null);return}try{let d=await i();l(null,d)}catch(d){let p=d instanceof Error?d:new Error(String(d));l(p,null)}},u=()=>{if(a){let d=this._listChangedDebounceTimers.get(e);d&&clearTimeout(d);let p=setTimeout(c,a);this._listChangedDebounceTimers.set(e,p)}else c()};this.setNotificationHandler(r,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};function gb(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function _j(t=fetch,e){return e?async(r,n)=>{let i={...e,...n,headers:n?.headers?{...gb(e.headers),...gb(n.headers)}:e.headers};return t(r,i)}:t}var gI;gI=globalThis.crypto;async function LJ(t){return(await gI).getRandomValues(new Uint8Array(t))}async function UJ(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await LJ(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function ZJ(t){return await UJ(t)}async function FJ(t){let e=await(await gI).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function yI(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await ZJ(t),r=await FJ(e);return{code_verifier:e,code_challenge:r}}var vr=RC().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:WC.custom,message:"URL must be parseable",fatal:!0}),sg}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),wj=Yt({resource:k().url(),authorization_servers:B(vr).optional(),jwks_uri:k().url().optional(),scopes_supported:B(k()).optional(),bearer_methods_supported:B(k()).optional(),resource_signing_alg_values_supported:B(k()).optional(),resource_name:k().optional(),resource_documentation:k().optional(),resource_policy_uri:k().url().optional(),resource_tos_uri:k().url().optional(),tls_client_certificate_bound_access_tokens:dt().optional(),authorization_details_types_supported:B(k()).optional(),dpop_signing_alg_values_supported:B(k()).optional(),dpop_bound_access_tokens_required:dt().optional()}),bI=Yt({issuer:k(),authorization_endpoint:vr,token_endpoint:vr,registration_endpoint:vr.optional(),scopes_supported:B(k()).optional(),response_types_supported:B(k()),response_modes_supported:B(k()).optional(),grant_types_supported:B(k()).optional(),token_endpoint_auth_methods_supported:B(k()).optional(),token_endpoint_auth_signing_alg_values_supported:B(k()).optional(),service_documentation:vr.optional(),revocation_endpoint:vr.optional(),revocation_endpoint_auth_methods_supported:B(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:B(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:B(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:B(k()).optional(),code_challenge_methods_supported:B(k()).optional(),client_id_metadata_document_supported:dt().optional()}),VJ=Yt({issuer:k(),authorization_endpoint:vr,token_endpoint:vr,userinfo_endpoint:vr.optional(),jwks_uri:vr,registration_endpoint:vr.optional(),scopes_supported:B(k()).optional(),response_types_supported:B(k()),response_modes_supported:B(k()).optional(),grant_types_supported:B(k()).optional(),acr_values_supported:B(k()).optional(),subject_types_supported:B(k()),id_token_signing_alg_values_supported:B(k()),id_token_encryption_alg_values_supported:B(k()).optional(),id_token_encryption_enc_values_supported:B(k()).optional(),userinfo_signing_alg_values_supported:B(k()).optional(),userinfo_encryption_alg_values_supported:B(k()).optional(),userinfo_encryption_enc_values_supported:B(k()).optional(),request_object_signing_alg_values_supported:B(k()).optional(),request_object_encryption_alg_values_supported:B(k()).optional(),request_object_encryption_enc_values_supported:B(k()).optional(),token_endpoint_auth_methods_supported:B(k()).optional(),token_endpoint_auth_signing_alg_values_supported:B(k()).optional(),display_values_supported:B(k()).optional(),claim_types_supported:B(k()).optional(),claims_supported:B(k()).optional(),service_documentation:k().optional(),claims_locales_supported:B(k()).optional(),ui_locales_supported:B(k()).optional(),claims_parameter_supported:dt().optional(),request_parameter_supported:dt().optional(),request_uri_parameter_supported:dt().optional(),require_request_uri_registration:dt().optional(),op_policy_uri:vr.optional(),op_tos_uri:vr.optional(),client_id_metadata_document_supported:dt().optional()}),xj=G({...VJ.shape,...bI.pick({code_challenge_methods_supported:!0}).shape}),kj=G({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:Dg.number().optional(),scope:k().optional(),refresh_token:k().optional()}).strip(),Sj=G({error:k(),error_description:k().optional(),error_uri:k().optional()}),vj=vr.optional().or(ne("").transform(()=>{})),qJ=G({redirect_uris:B(vr),token_endpoint_auth_method:k().optional(),grant_types:B(k()).optional(),response_types:B(k()).optional(),client_name:k().optional(),client_uri:vr.optional(),logo_uri:vj,scope:k().optional(),contacts:B(k()).optional(),tos_uri:vj,policy_uri:k().optional(),jwks_uri:vr.optional(),jwks:MC().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),BJ=G({client_id:k(),client_secret:k().optional(),client_id_issued_at:et().optional(),client_secret_expires_at:et().optional()}).strip(),$j=qJ.merge(BJ),h$e=G({error:k(),error_description:k().optional()}).strip(),g$e=G({token:k(),token_type_hint:k().optional()}).strip();function Ij(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function Ej({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var Ut=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Kp=class extends Ut{};Kp.errorCode="invalid_request";var rl=class extends Ut{};rl.errorCode="invalid_client";var nl=class extends Ut{};nl.errorCode="invalid_grant";var il=class extends Ut{};il.errorCode="unauthorized_client";var Jp=class extends Ut{};Jp.errorCode="unsupported_grant_type";var Yp=class extends Ut{};Yp.errorCode="invalid_scope";var Qp=class extends Ut{};Qp.errorCode="access_denied";var Ao=class extends Ut{};Ao.errorCode="server_error";var em=class extends Ut{};em.errorCode="temporarily_unavailable";var tm=class extends Ut{};tm.errorCode="unsupported_response_type";var rm=class extends Ut{};rm.errorCode="unsupported_token_type";var nm=class extends Ut{};nm.errorCode="invalid_token";var im=class extends Ut{};im.errorCode="method_not_allowed";var om=class extends Ut{};om.errorCode="too_many_requests";var ol=class extends Ut{};ol.errorCode="invalid_client_metadata";var sm=class extends Ut{};sm.errorCode="insufficient_scope";var am=class extends Ut{};am.errorCode="invalid_target";var Pj={[Kp.errorCode]:Kp,[rl.errorCode]:rl,[nl.errorCode]:nl,[il.errorCode]:il,[Jp.errorCode]:Jp,[Yp.errorCode]:Yp,[Qp.errorCode]:Qp,[Ao.errorCode]:Ao,[em.errorCode]:em,[tm.errorCode]:tm,[rm.errorCode]:rm,[nm.errorCode]:nm,[im.errorCode]:im,[om.errorCode]:om,[ol.errorCode]:ol,[sm.errorCode]:sm,[am.errorCode]:am};var Co=class extends Error{constructor(e){super(e??"Unauthorized")}};function WJ(t){return["client_secret_basic","client_secret_post","none"].includes(t)}var _I="code",vI="S256";function GJ(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&WJ(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function HJ(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":XJ(i,o,r);return;case"client_secret_post":KJ(i,o,n);return;case"none":JJ(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function XJ(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function KJ(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function JJ(t,e){e.set("client_id",t)}async function Aj(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=Sj.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=Pj[i]||Ao;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Ao(i)}}async function lm(t,e){try{return await wI(t,e)}catch(r){if(r instanceof rl||r instanceof il)return await t.invalidateCredentials?.("all"),await wI(t,e);if(r instanceof nl)return await t.invalidateCredentials?.("tokens"),await wI(t,e);throw r}}async function wI(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s=await t.discoveryState?.(),a,l,c,u=i;if(!u&&s?.resourceMetadataUrl&&(u=new URL(s.resourceMetadataUrl)),s?.authorizationServerUrl){if(l=s.authorizationServerUrl,a=s.resourceMetadata,c=s.authorizationServerMetadata??await zj(l,{fetchFn:o}),!a)try{a=await Cj(e,{resourceMetadataUrl:u},o)}catch{}(c!==s.authorizationServerMetadata||a!==s.resourceMetadata)&&await t.saveDiscoveryState?.({authorizationServerUrl:String(l),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}else{let b=await i7(e,{resourceMetadataUrl:u,fetchFn:o});l=b.authorizationServerUrl,c=b.authorizationServerMetadata,a=b.resourceMetadata,await t.saveDiscoveryState?.({authorizationServerUrl:String(l),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}let d=await QJ(e,t,a),p=await Promise.resolve(t.clientInformation());if(!p){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let b=c?.client_id_metadata_document_supported===!0,v=t.clientMetadataUrl;if(v&&!YJ(v))throw new ol(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${v}`);if(b&&v)p={client_id:v},await t.saveClientInformation?.(p);else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let E=await c7(l,{metadata:c,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(E),p=E}}let f=!t.redirectUrl;if(r!==void 0||f){let b=await l7(t,l,{metadata:c,resource:d,authorizationCode:r,fetchFn:o});return await t.saveTokens(b),"AUTHORIZED"}let m=await t.tokens();if(m?.refresh_token)try{let b=await a7(l,{metadata:c,clientInformation:p,refreshToken:m.refresh_token,resource:d,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(b),"AUTHORIZED"}catch(b){if(!(!(b instanceof Ut)||b instanceof Ao))throw b}let h=t.state?await t.state():void 0,{authorizationUrl:y,codeVerifier:g}=await o7(l,{metadata:c,clientInformation:p,state:h,redirectUrl:t.redirectUrl,scope:n||a?.scopes_supported?.join(" ")||t.clientMetadata.scope,resource:d});return await t.saveCodeVerifier(g),await t.redirectToAuthorization(y),"REDIRECT"}function YJ(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function QJ(t,e,r){let n=Ij(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!Ej({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function kI(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let i=xI(t,"resource_metadata")||void 0,o;if(i)try{o=new URL(i)}catch{}let s=xI(t,"scope")||void 0,a=xI(t,"error")||void 0;return{resourceMetadataUrl:o,scope:s,error:a}}function xI(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),i=r.match(n);return i?i[1]||i[2]:null}async function Cj(t,e,r=fetch){let n=await r7(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return wj.parse(await n.json())}async function SI(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?SI(t,void 0,r):void 0;throw n}}function e7(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Tj(t,e,r=fetch){return await SI(t,{"MCP-Protocol-Version":e},r)}function t7(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function r7(t,e,r,n){let i=new URL(t),o=n?.protocolVersion??mu,s;if(n?.metadataUrl)s=new URL(n.metadataUrl);else{let l=e7(e,i.pathname);s=new URL(l,n?.metadataServerUrl??i),s.search=i.search}let a=await Tj(s,o,r);if(!n?.metadataUrl&&t7(a,i.pathname)){let l=new URL(`/.well-known/${e}`,i);a=await Tj(l,o,r)}return a}function n7(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function zj(t,{fetchFn:e=fetch,protocolVersion:r=mu}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},i=n7(t);for(let{url:o,type:s}of i){let a=await SI(o,n,e);if(a){if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return s==="oauth"?bI.parse(await a.json()):xj.parse(await a.json())}}}async function i7(t,e){let r,n;try{r=await Cj(t,{resourceMetadataUrl:e?.resourceMetadataUrl},e?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL("/",t)));let i=await zj(n,{fetchFn:e?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:i,resourceMetadata:r}}async function o7(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(_I))throw new Error(`Incompatible auth server: does not support response type ${_I}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(vI))throw new Error(`Incompatible auth server: does not support code challenge method ${vI}`)}else a=new URL("/authorize",t);let l=await yI(),c=l.code_verifier,u=l.code_challenge;return a.searchParams.set("response_type",_I),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",u),a.searchParams.set("code_challenge_method",vI),a.searchParams.set("redirect_uri",String(n)),o&&a.searchParams.set("state",o),i&&a.searchParams.set("scope",i),i?.includes("offline_access")&&a.searchParams.append("prompt","consent"),s&&a.searchParams.set("resource",s.href),{authorizationUrl:a,codeVerifier:c}}function s7(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function Oj(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:i,resource:o,fetchFn:s}){let a=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),l=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(o&&r.set("resource",o.href),i)await i(l,r,a,e);else if(n){let u=e?.token_endpoint_auth_methods_supported??[],d=GJ(n,u);HJ(d,n,l,r)}let c=await(s??fetch)(a,{method:"POST",headers:l,body:r});if(!c.ok)throw await Aj(c);return kj.parse(await c.json())}async function a7(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),l=await Oj(t,{metadata:e,tokenRequestParams:a,clientInformation:r,addClientAuthentication:o,resource:i,fetchFn:s});return{refresh_token:n,...l}}async function l7(t,e,{metadata:r,resource:n,authorizationCode:i,fetchFn:o}={}){let s=t.clientMetadata.scope,a;if(t.prepareTokenRequest&&(a=await t.prepareTokenRequest(s)),!a){if(!i)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let c=await t.codeVerifier();a=s7(i,c,t.redirectUrl)}let l=await t.clientInformation();return Oj(e,{metadata:r,tokenRequestParams:a,clientInformation:l??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:o})}async function c7(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await Aj(o);return $j.parse(await o.json())}var yb=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function $I(t){}function Rj(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=$I,onError:r=$I,onRetry:n=$I,onComment:i}=t,o="",s=!0,a,l="",c="";function u(h){let y=s?h.replace(/^\xEF\xBB\xBF/,""):h,[g,b]=u7(`${o}${y}`);for(let v of g)d(v);o=b,s=!1}function d(h){if(h===""){f();return}if(h.startsWith(":")){i&&i(h.slice(h.startsWith(": ")?2:1));return}let y=h.indexOf(":");if(y!==-1){let g=h.slice(0,y),b=h[y+1]===" "?2:1,v=h.slice(y+b);p(g,v,h);return}p(h,"",h)}function p(h,y,g){switch(h){case"event":c=y;break;case"data":l=`${l}${y}
|
|
110
110
|
`;break;case"id":a=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?n(parseInt(y,10)):r(new yb(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:g}));break;default:r(new yb(`Unknown field "${h.length>20?`${h.slice(0,20)}\u2026`:h}"`,{type:"unknown-field",field:h,value:y,line:g}));break}}function f(){l.length>0&&e({id:a,event:c||void 0,data:l.endsWith(`
|
|
111
111
|
`)?l.slice(0,-1):l}),a=void 0,l="",c=""}function m(h={}){o&&h.consume&&d(o),s=!0,a=void 0,l="",c="",o=""}return{feed:u,reset:m}}function u7(t){let e=[],r="",n=0;for(;n<t.length;){let i=t.indexOf("\r",n),o=t.indexOf(`
|
|
112
112
|
`,n),s=-1;if(i!==-1&&o!==-1?s=Math.min(i,o):i!==-1?s=i:o!==-1&&(s=o),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
|
|
113
|
-
`&&n++}}return[e,r]}var bb=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=Rj({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}};var d7={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Os=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},_b=class{constructor(e,r){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=_j(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??d7}async _authThenStart(){if(!this._authProvider)throw new Co("No auth provider");let e;try{e=await lm(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new Co;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=gb(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){let{resumptionToken:r}=e;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let i=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!i.ok){if(await i.body?.cancel(),i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new Os(i.status,`Failed to open SSE stream: ${i.statusText}`)}this._handleSseStream(i.body,e,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_scheduleReconnection(e,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let i=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,r+1)})},i)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s,a=!1,l=!1;(async()=>{try{let u=e.pipeThrough(new TextDecoderStream).pipeThrough(new bb({onRetry:f=>{this._serverRetryMs=f}})).getReader();for(;;){let{value:f,done:m}=await u.read();if(m)break;if(f.id&&(s=f.id,a=!0,i?.(f.id)),!!f.data&&(!f.event||f.event==="message"))try{let h=Fg.parse(JSON.parse(f.data));Oa(h)&&(l=!0,o!==void 0&&(h.id=o)),this.onmessage?.(h)}catch(h){this.onerror?.(h)}}(n||a)&&!l&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(u){if(this.onerror?.(new Error(`SSE stream disconnected: ${u}`)),(n||a)&&!l&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(f){this.onerror?.(new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Co("No auth provider");if(await lm(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Co("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{let{resumptionToken:n,onresumptiontoken:i}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:jf(e)?e.id:void 0}).catch(p=>this.onerror?.(p));return}let o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},a=await(this._fetch??fetch)(this._url,s),l=a.headers.get("mcp-session-id");if(l&&(this._sessionId=l),!a.ok){let p=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Os(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:f,scope:m}=kI(a);if(this._resourceMetadataUrl=f,this._scope=m,await lm(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Co;return this._hasCompletedAuthFlow=!0,this.send(e)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:f,scope:m,error:h}=kI(a);if(h==="insufficient_scope"){let y=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===y)throw new Os(403,"Server returned 403 after trying upscoping");if(m&&(this._scope=m),f&&(this._resourceMetadataUrl=f),this._lastUpscopingHeader=y??void 0,await lm(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Co;return this.send(e)}}throw new Os(a.status,`Error POSTing to endpoint: ${p}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),iz(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(p=>this.onerror?.(p));return}let u=(Array.isArray(e)?e:[e]).filter(p=>"method"in p&&"id"in p&&p.id!==void 0).length>0,d=a.headers.get("content-type");if(u)if(d?.includes("text/event-stream"))this._handleSseStream(a.body,{onresumptiontoken:i},!1);else if(d?.includes("application/json")){let p=await a.json(),f=Array.isArray(p)?p.map(m=>Fg.parse(m)):[Fg.parse(p)];for(let m of f)this.onmessage?.(m)}else throw await a.body?.cancel(),new Os(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new Os(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}};var Rs={name:"@intelliweave/embedded",version:"2.1.77",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && vitest run","test:local":"IW_API_URL=http://localhost:3000/api npm run test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.97","@types/lodash":"^4.17.24","@types/react":"^19.2.14",bestzip:"^2.2.2","cross-env":"^10.1.0","find-cache-dir":"^6.0.0",lodash:"^4.17.23","onnxruntime-web":"^1.24.3",react:"^19.2.4","replace-in-file":"^8.4.0",tsup:"^8.5.1",tsx:"^4.21.0",typedoc:"^0.28.18",vitest:"^4.1.0"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"@anthropic-ai/sdk":"^0.80.0","@modelcontextprotocol/sdk":"^1.27.1","@types/json-schema":"^7.0.15",minisearch:"^7.2.0",openai:"^6.32.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.1","rehype-stringify":"^10.0.1","remark-gfm":"^4.0.1","remark-parse":"^11.0.0","remark-rehype":"^11.1.2",unified:"^11.0.5","utility-types":"^3.11.0",uuid:"^13.0.0"}};var ir=new Oe("MCPKnowledgeClient"),p7="https://intelliweave-mcp-proxy-828827766277.us-central1.run.app",vb=class{constructor(e){this.tools=[];this.iwActions=[];this.stats={toolsCalled:0};this.lastSearchQuery="";this.lastSearchResults=[];this.config=e}async connect(){return this.client?this.client:this.connectionPromise?await this.connectionPromise:(this.connectionPromise=this.connectInternal(),this.connectionPromise.finally(()=>{this.connectionPromise=void 0}),await this.connectionPromise)}async connectInternal(){ir.debug("Connecting to MCP client");let e=this.config.connect?await this.config.connect():await Promise.resolve().then(async()=>{let r=new URL(this.config.baseURL),n={};this.config.headers&&(n={...n,...this.config.headers}),this.config.proxy?.enabled&&(n["Mcp-Target-Url"]=r.toString(),n["IntelliWeave-Api-Key"]=this.config.proxy.apiKey||"",r=new URL(this.config.proxy.url||p7));let i=new hb({name:Rs.name,version:Rs.version}),o=new _b(r,{requestInit:{headers:n}});return await i.connect(o),ir.debug("Connected with HTTP streaming mode"),i});return await this.disconnect(),this.client=e,e.onerror=r=>{ir.error(`MCP client error: ${r.message}`)},e.onclose=()=>{ir.debug("MCP client connection closed"),this.client=void 0},e.setNotificationHandler(L0,r=>{r.params.level=="critical"?ir.error(`[Server] ${r.params.data}`):r.params.level=="emergency"?ir.error(`[Server] ${r.params.data}`):r.params.level=="error"?ir.error(`[Server] ${r.params.data}`):r.params.level=="warning"?ir.warn(`[Server] ${r.params.data}`):r.params.level=="info"?ir.info(`[Server] ${r.params.data}`):r.params.level=="debug"?ir.debug(`[Server] ${r.params.data}`):ir.log(`[Server] ${r.params.data}`)}),e.setNotificationHandler(qf,r=>{ir.debug("Tool list changed",r),this.fetchTools()}),ir.debug("Fetching tools from MCP server..."),await this.fetchTools(),e}async disconnect(){await this.client?.close(),this.client=void 0,this.tools=[],this.iwActions=[]}async fetchTools(){let e=[],r;for(;;){let i=await this.client.listTools({cursor:r});r=i.nextCursor;for(let o of i.tools||[])e.push(o);if(!i?.tools?.length||!r)break}let n=[];for(let i of e){let o=!!(this.config.searchToolName&&i.name==this.config.searchToolName&&!this.config.searchToolVisible);n.push({id:i.name,name:i.name,content:i.description||"",type:"action",isContext:!0,parameters:i.inputSchema,action:s=>this.performToolCall(i.name,s),disabled:o})}ir.debug(`Fetched ${e.length} tools from MCP server.`),this.tools=e,this.iwActions=n}async search(e){if(e==this.lastSearchQuery)return this.lastSearchResults;await this.connect();let r=this.iwActions.slice(),n=await this.performSearchCall(e);return r=r.concat(n),this.lastSearchQuery=e,this.lastSearchResults=r,ir.debug(`Search completed, found ${r.length} items.`),r}async performSearchCall(e){let r=[];if(!this.config.searchToolName)return r;let n=this.tools.find(o=>o.name==this.config.searchToolName);if(!n)return ir.warn(`Search function ${this.config.searchToolName} not found on the MCP server.`),r;let i;if(n.inputSchema.required?.length==1){let o=n.inputSchema.required[0];i=await this.performToolCall(this.config.searchToolName,{[o]:e})}else if(n.inputSchema.properties&&Object.keys(n.inputSchema.properties).length==1){let o=Object.keys(n.inputSchema.properties)[0];i=await this.performToolCall(this.config.searchToolName,{[o]:e})}else i=await this.performToolCall(this.config.searchToolName,{});if(Array.isArray(i))for(let o=0;o<i.length;o++){let s=i[o];r.push({id:this.config.id+":"+this.config.searchToolName+":"+o,name:`Search result ${o+1} in ${this.config.searchToolName}`,type:"info",content:typeof s=="string"?s:JSON.stringify(s)})}else r.push({id:this.config.id+":"+this.config.searchToolName+":result",name:`Search result in ${this.config.searchToolName}`,type:"info",content:typeof i=="string"?i:JSON.stringify(i)});return r}async performToolCall(e,r){await this.connect(),ir.debug(`Performing tool call for ${e} with params:`,r),this.stats.toolsCalled+=1;let n=await this.client.callTool({name:e,arguments:r});if(n.isError){let i=n.content?.[0]?.text||"Unknown error";throw ir.error(`Error calling tool ${e}: ${i}`),new Error(`Error calling tool ${e}: ${i}`)}if(Array.isArray(n.content)&&n.content.length==1&&n.content[0].type=="text")try{return JSON.parse(n.content[0].text)}catch{}return n.content||[]}};var m7=new Oe("Statistics"),cm=[];async function Vr(t,e){let r={...e,event_id:cr(),event_date:new Date().toISOString(),sdk_version:Rs.version,conversation_id:t?.conversationID||"",api_key:t?.apiKey||"",user_id:t?.userID||""};if(cm.push(r),!t||(await new Promise(i=>setTimeout(i,5e3)),cm.length===0))return;let n=cm.slice();cm.length=0;try{let i=await fetch(t.hubAPI+"/analytics/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:n})});if(!i.ok)throw new Error(`Analytics submission failed: ${i.status} ${i.statusText}`)}catch(i){m7.warn("Failed to submit analytics event:",i),cm.push(...n);return}}var sl=new Oe("KnowledgeBase"),II=1,wb=class t{constructor(e){this._sources=[];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.allowWindowSources=!0;this.allowGlobalConfigSources=!0;this.allowRagSearch=!0;this.ai=e,this.ensureInternalKnowledge()}ensureInternalKnowledge(){this._sources=this._sources.filter(e=>e.id!=="core.internal"),this._sources.push({id:"core.internal",query:async()=>AT(this.ai)})}reset(){this._windowSources=[],this.manualEntries=[],this.lastResults=[],this._sources=[],this.ensureInternalKnowledge()}registerSource(e,r){let n=e;return typeof e=="function"&&(r=e,n=`source.${II++}`),this._sources.push({id:n,query:r}),n}removeSource(e){this._sources=this.sources.filter(r=>r.id!==e&&r.query!==e)}addEntry(e){this.manualEntries.push(e)}removeEntry(e){this.manualEntries=this.manualEntries.filter(r=>r.id!==e)}get sources(){let e=this._sources;return this.allowGlobalConfigSources&&bt().knowledgeBaseSources&&(e=e.concat(bt().knowledgeBaseSources)),this.allowWindowSources&&typeof document<"u"&&(e=e.concat(this._windowSources)),e=e.filter(r=>!r.disabled),e}async search(e){sl.debug(`Searching knowledge base for: ${e}`);let r=Date.now(),n=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});n.query=e,n.entries=[],n.sources=[],this.allowWindowSources&&typeof document<"u"?(document.dispatchEvent(n),this._windowSources=n.sources):this._windowSources=[];let o=(await Promise.all(this.sources.map(async c=>{try{let u=Date.now(),d=await c.query(e);return sl.debug(`Source '${c.id}' took ${Date.now()-u}ms`),d||[]}catch(u){return sl.warn(`Knowledge source '${c.id}' failed:`,u),[]}}))).flat();o=o.concat(n.entries),o=o.concat(this.manualEntries),this.allowGlobalConfigSources&&bt().knowledgeBase&&(o=o.concat(bt().knowledgeBase)),o=o.filter(c=>c&&!c.disabled);for(let c=0;c<o.length;c++){let u=o[c];u.id=u.id||`temp.${c}`,u._functionID=u.id.replaceAll(/[^a-zA-Z0-9_]/g,"_")}let s=new ff({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});s.addAll(o);let l=s.search(e).map(c=>o.find(u=>u.id==c.id));for(let c of o)c.isContext&&(l.find(u=>u.id===c.id)||l.push(c));return this.lastResults=l,Vr(this.ai,{event_type:"kb_search",value:l.length,value_str:"",event_properties:{search_time_ms:Date.now()-r,sources_searched:this.sources.length}}),sl.debug("Found results:",l),l}getCachedEntry(e){return this.lastResults.find(r=>r.id==e||r._functionID==e)}registerSourceFromURL(e,r){r||(r=`external.${II++}`),sl.debug(`Registering remote knowledge base source: ${e}`);let n=[],i=[],o=!0,s=async(l,c)=>{sl.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,actionID:l.id,parameters:c},d=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok)throw new Error(`HTTP Error ${d.status} ${d.statusText}`);let p=await d.json();return a(p.updateItems||[]),p.response},a=l=>{for(let c of l){if(!c.id){sl.warn("KB item skipped since it has no ID.",c);continue}let u=n.find(d=>d.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}n.push({...c,action:d=>s(c,d)})}};this.registerSource(r,async l=>{if(o&&i.includes(l))return n;let c={type:"search",userID:this.ai?.userID||"",query:l},u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let d=await u.json();return o=!d.noCache,i.includes(l)||i.push(l),a(d.items),n})}clone(e){let r=new t(e);return r._sources=this._sources.slice(),r._windowSources=this._windowSources.slice(),r.manualEntries=this.manualEntries.slice(),r.allowGlobalConfigSources=this.allowGlobalConfigSources,r.allowWindowSources=this.allowWindowSources,r.allowRagSearch=this.allowRagSearch,r.ensureInternalKnowledge(),r}registerMCPSource(e){e.id||(e.id=`external.${II++}`);let r=new vb(e);return this.registerSource(e.id,n=>r.search(n)),r}};var xb=class{constructor(e){this.ai=e}async boolean(e){let r=await this.instruct({...e,instruction:`${e.instruction}
|
|
113
|
+
`&&n++}}return[e,r]}var bb=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=Rj({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}};var d7={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Os=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},_b=class{constructor(e,r){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=_j(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??d7}async _authThenStart(){if(!this._authProvider)throw new Co("No auth provider");let e;try{e=await lm(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new Co;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=gb(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){let{resumptionToken:r}=e;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let i=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!i.ok){if(await i.body?.cancel(),i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new Os(i.status,`Failed to open SSE stream: ${i.statusText}`)}this._handleSseStream(i.body,e,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_scheduleReconnection(e,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let i=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,r+1)})},i)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s,a=!1,l=!1;(async()=>{try{let u=e.pipeThrough(new TextDecoderStream).pipeThrough(new bb({onRetry:f=>{this._serverRetryMs=f}})).getReader();for(;;){let{value:f,done:m}=await u.read();if(m)break;if(f.id&&(s=f.id,a=!0,i?.(f.id)),!!f.data&&(!f.event||f.event==="message"))try{let h=Fg.parse(JSON.parse(f.data));Oa(h)&&(l=!0,o!==void 0&&(h.id=o)),this.onmessage?.(h)}catch(h){this.onerror?.(h)}}(n||a)&&!l&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(u){if(this.onerror?.(new Error(`SSE stream disconnected: ${u}`)),(n||a)&&!l&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(f){this.onerror?.(new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Co("No auth provider");if(await lm(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Co("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{let{resumptionToken:n,onresumptiontoken:i}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:jf(e)?e.id:void 0}).catch(p=>this.onerror?.(p));return}let o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},a=await(this._fetch??fetch)(this._url,s),l=a.headers.get("mcp-session-id");if(l&&(this._sessionId=l),!a.ok){let p=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Os(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:f,scope:m}=kI(a);if(this._resourceMetadataUrl=f,this._scope=m,await lm(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Co;return this._hasCompletedAuthFlow=!0,this.send(e)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:f,scope:m,error:h}=kI(a);if(h==="insufficient_scope"){let y=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===y)throw new Os(403,"Server returned 403 after trying upscoping");if(m&&(this._scope=m),f&&(this._resourceMetadataUrl=f),this._lastUpscopingHeader=y??void 0,await lm(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Co;return this.send(e)}}throw new Os(a.status,`Error POSTing to endpoint: ${p}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),iz(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(p=>this.onerror?.(p));return}let u=(Array.isArray(e)?e:[e]).filter(p=>"method"in p&&"id"in p&&p.id!==void 0).length>0,d=a.headers.get("content-type");if(u)if(d?.includes("text/event-stream"))this._handleSseStream(a.body,{onresumptiontoken:i},!1);else if(d?.includes("application/json")){let p=await a.json(),f=Array.isArray(p)?p.map(m=>Fg.parse(m)):[Fg.parse(p)];for(let m of f)this.onmessage?.(m)}else throw await a.body?.cancel(),new Os(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new Os(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}};var Rs={name:"@intelliweave/embedded",version:"2.1.78",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && vitest run","test:local":"IW_API_URL=http://localhost:3000/api npm run test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.97","@types/lodash":"^4.17.24","@types/react":"^19.2.14",bestzip:"^2.2.2","cross-env":"^10.1.0","find-cache-dir":"^6.0.0",lodash:"^4.17.23","onnxruntime-web":"^1.24.3",react:"^19.2.4","replace-in-file":"^8.4.0",tsup:"^8.5.1",tsx:"^4.21.0",typedoc:"^0.28.18",vitest:"^4.1.0"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"@anthropic-ai/sdk":"^0.80.0","@modelcontextprotocol/sdk":"^1.27.1","@types/json-schema":"^7.0.15",minisearch:"^7.2.0",openai:"^6.32.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.1","rehype-stringify":"^10.0.1","remark-gfm":"^4.0.1","remark-parse":"^11.0.0","remark-rehype":"^11.1.2",unified:"^11.0.5","utility-types":"^3.11.0",uuid:"^13.0.0"}};var ir=new Oe("MCPKnowledgeClient"),p7="https://intelliweave-mcp-proxy-828827766277.us-central1.run.app",vb=class{constructor(e){this.tools=[];this.iwActions=[];this.stats={toolsCalled:0};this.lastSearchQuery="";this.lastSearchResults=[];this.config=e}async connect(){return this.client?this.client:this.connectionPromise?await this.connectionPromise:(this.connectionPromise=this.connectInternal(),this.connectionPromise.finally(()=>{this.connectionPromise=void 0}),await this.connectionPromise)}async connectInternal(){ir.debug("Connecting to MCP client");let e=this.config.connect?await this.config.connect():await Promise.resolve().then(async()=>{let r=new URL(this.config.baseURL),n={};this.config.headers&&(n={...n,...this.config.headers}),this.config.proxy?.enabled&&(n["Mcp-Target-Url"]=r.toString(),n["IntelliWeave-Api-Key"]=this.config.proxy.apiKey||"",r=new URL(this.config.proxy.url||p7));let i=new hb({name:Rs.name,version:Rs.version}),o=new _b(r,{requestInit:{headers:n}});return await i.connect(o),ir.debug("Connected with HTTP streaming mode"),i});return await this.disconnect(),this.client=e,e.onerror=r=>{ir.error(`MCP client error: ${r.message}`)},e.onclose=()=>{ir.debug("MCP client connection closed"),this.client=void 0},e.setNotificationHandler(L0,r=>{r.params.level=="critical"?ir.error(`[Server] ${r.params.data}`):r.params.level=="emergency"?ir.error(`[Server] ${r.params.data}`):r.params.level=="error"?ir.error(`[Server] ${r.params.data}`):r.params.level=="warning"?ir.warn(`[Server] ${r.params.data}`):r.params.level=="info"?ir.info(`[Server] ${r.params.data}`):r.params.level=="debug"?ir.debug(`[Server] ${r.params.data}`):ir.log(`[Server] ${r.params.data}`)}),e.setNotificationHandler(qf,r=>{ir.debug("Tool list changed",r),this.fetchTools()}),ir.debug("Fetching tools from MCP server..."),await this.fetchTools(),e}async disconnect(){await this.client?.close(),this.client=void 0,this.tools=[],this.iwActions=[]}async fetchTools(){let e=[],r;for(;;){let i=await this.client.listTools({cursor:r});r=i.nextCursor;for(let o of i.tools||[])e.push(o);if(!i?.tools?.length||!r)break}let n=[];for(let i of e){let o=!!(this.config.searchToolName&&i.name==this.config.searchToolName&&!this.config.searchToolVisible);n.push({id:i.name,name:i.name,content:i.description||"",type:"action",isContext:!0,parameters:i.inputSchema,action:s=>this.performToolCall(i.name,s),disabled:o})}ir.debug(`Fetched ${e.length} tools from MCP server.`),this.tools=e,this.iwActions=n}async search(e){if(e==this.lastSearchQuery)return this.lastSearchResults;await this.connect();let r=this.iwActions.slice(),n=await this.performSearchCall(e);return r=r.concat(n),this.lastSearchQuery=e,this.lastSearchResults=r,ir.debug(`Search completed, found ${r.length} items.`),r}async performSearchCall(e){let r=[];if(!this.config.searchToolName)return r;let n=this.tools.find(o=>o.name==this.config.searchToolName);if(!n)return ir.warn(`Search function ${this.config.searchToolName} not found on the MCP server.`),r;let i;if(n.inputSchema.required?.length==1){let o=n.inputSchema.required[0];i=await this.performToolCall(this.config.searchToolName,{[o]:e})}else if(n.inputSchema.properties&&Object.keys(n.inputSchema.properties).length==1){let o=Object.keys(n.inputSchema.properties)[0];i=await this.performToolCall(this.config.searchToolName,{[o]:e})}else i=await this.performToolCall(this.config.searchToolName,{});if(Array.isArray(i))for(let o=0;o<i.length;o++){let s=i[o];r.push({id:this.config.id+":"+this.config.searchToolName+":"+o,name:`Search result ${o+1} in ${this.config.searchToolName}`,type:"info",content:typeof s=="string"?s:JSON.stringify(s)})}else r.push({id:this.config.id+":"+this.config.searchToolName+":result",name:`Search result in ${this.config.searchToolName}`,type:"info",content:typeof i=="string"?i:JSON.stringify(i)});return r}async performToolCall(e,r){await this.connect(),ir.debug(`Performing tool call for ${e} with params:`,r),this.stats.toolsCalled+=1;let n=await this.client.callTool({name:e,arguments:r});if(n.isError){let i=n.content?.[0]?.text||"Unknown error";throw ir.error(`Error calling tool ${e}: ${i}`),new Error(`Error calling tool ${e}: ${i}`)}if(Array.isArray(n.content)&&n.content.length==1&&n.content[0].type=="text")try{return JSON.parse(n.content[0].text)}catch{}return n.content||[]}};var m7=new Oe("Statistics"),cm=[];async function Vr(t,e){let r={...e,event_id:cr(),event_date:new Date().toISOString(),sdk_version:Rs.version,conversation_id:t?.conversationID||"",api_key:t?.apiKey||"",user_id:t?.userID||""};if(cm.push(r),!t||(await new Promise(i=>setTimeout(i,5e3)),cm.length===0))return;let n=cm.slice();cm.length=0;try{let i=await fetch(t.hubAPI+"/analytics/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:n})});if(!i.ok)throw new Error(`Analytics submission failed: ${i.status} ${i.statusText}`)}catch(i){m7.warn("Failed to submit analytics event:",i),cm.push(...n);return}}var sl=new Oe("KnowledgeBase"),II=1,wb=class t{constructor(e){this._sources=[];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.allowWindowSources=!0;this.allowGlobalConfigSources=!0;this.allowRagSearch=!0;this.ai=e,this.ensureInternalKnowledge()}ensureInternalKnowledge(){this._sources=this._sources.filter(e=>e.id!=="core.internal"),this._sources.push({id:"core.internal",query:async()=>AT(this.ai)})}reset(){this._windowSources=[],this.manualEntries=[],this.lastResults=[],this._sources=[],this.ensureInternalKnowledge()}registerSource(e,r){let n=e;return typeof e=="function"&&(r=e,n=`source.${II++}`),this._sources.push({id:n,query:r}),n}removeSource(e){this._sources=this.sources.filter(r=>r.id!==e&&r.query!==e)}addEntry(e){this.manualEntries.push(e)}removeEntry(e){this.manualEntries=this.manualEntries.filter(r=>r.id!==e)}get sources(){let e=this._sources;return this.allowGlobalConfigSources&&bt().knowledgeBaseSources&&(e=e.concat(bt().knowledgeBaseSources)),this.allowWindowSources&&typeof document<"u"&&(e=e.concat(this._windowSources)),e=e.filter(r=>!r.disabled),e}async search(e){sl.debug(`Searching knowledge base for: ${e}`);let r=Date.now(),n=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});n.query=e,n.entries=[],n.sources=[],this.allowWindowSources&&typeof document<"u"?(document.dispatchEvent(n),this._windowSources=n.sources):this._windowSources=[];let o=(await Promise.all(this.sources.map(async c=>{try{let u=Date.now(),d=await c.query(e);return sl.debug(`Source '${c.id}' took ${Date.now()-u}ms`),d||[]}catch(u){return sl.warn(`Knowledge source '${c.id}' failed:`,u),[]}}))).flat();o=o.concat(n.entries),o=o.concat(this.manualEntries),this.allowGlobalConfigSources&&bt().knowledgeBase&&(o=o.concat(bt().knowledgeBase)),o=o.filter(c=>c&&!c.disabled);for(let c=0;c<o.length;c++){let u=o[c];u.id=u.id||`temp.${c}`,u._functionID=u.id.replaceAll(/[^a-zA-Z0-9_]/g,"_")}let s=new ff({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});s.addAll(o);let l=s.search(e).map(c=>o.find(u=>u.id==c.id));for(let c of o)c.isContext&&(l.find(u=>u.id===c.id)||l.push(c));return this.lastResults=l,Vr(this.ai,{event_type:"kb_search",value:l.length,value_str:"",event_properties:{search_time_ms:Date.now()-r,sources_searched:this.sources.length}}),sl.debug("Found results:",l),l}getCachedEntry(e){return this.lastResults.find(r=>r.id==e||r._functionID==e)}registerSourceFromURL(e,r){r||(r=`external.${II++}`),sl.debug(`Registering remote knowledge base source: ${e}`);let n=[],i=[],o=!0,s=async(l,c)=>{sl.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,actionID:l.id,parameters:c},d=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok)throw new Error(`HTTP Error ${d.status} ${d.statusText}`);let p=await d.json();return a(p.updateItems||[]),p.response},a=l=>{for(let c of l){if(!c.id){sl.warn("KB item skipped since it has no ID.",c);continue}let u=n.find(d=>d.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}n.push({...c,action:d=>s(c,d)})}};this.registerSource(r,async l=>{if(o&&i.includes(l))return n;let c={type:"search",userID:this.ai?.userID||"",query:l},u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let d=await u.json();return o=!d.noCache,i.includes(l)||i.push(l),a(d.items),n})}clone(e){let r=new t(e);return r._sources=this._sources.slice(),r._windowSources=this._windowSources.slice(),r.manualEntries=this.manualEntries.slice(),r.allowGlobalConfigSources=this.allowGlobalConfigSources,r.allowWindowSources=this.allowWindowSources,r.allowRagSearch=this.allowRagSearch,r.ensureInternalKnowledge(),r}registerMCPSource(e){e.id||(e.id=`external.${II++}`);let r=new vb(e);return this.registerSource(e.id,n=>r.search(n)),r}};var xb=class{constructor(e){this.ai=e}async boolean(e){let r=await this.instruct({...e,instruction:`${e.instruction}
|
|
114
114
|
|
|
115
115
|
Return only the text "true" or "false" to indicate the answer to the question. Do not include any additional text or explanations.`});if(r.toLowerCase().includes("true"))return!0;if(r.toLowerCase().includes("false"))return!1;throw new Error("The AI did not give a boolean answer: "+r)}async choose(e){let r=await this.instruct({...e,instruction:`${e.instruction}
|
|
116
116
|
|
|
@@ -129,7 +129,7 @@ ${e.extractions.map(i=>`- ${i.name} (${i.type}): ${i.description||"No descriptio
|
|
|
129
129
|
`,n=await this.instruct({...e,instruction:r});if(n=n.replace(/```jsonl/g,"").replace(/```json/g,"").replace(/```/g,""),e.allowMultiple){let i=n.split(`
|
|
130
130
|
`).map(s=>s.trim()).filter(s=>!!s.trim()),o=[];for(let s of i)try{o.push(JSON.parse(s))}catch(a){console.error("Failed to parse line as JSON:",s,a.message)}return o}else return[JSON.parse(n.trim())]}async generateMarkdown(e){return this.instruct({...e,instruction:"Generate a Markdown document based on the input text. Always include a header on every response. Give long detailed answers with many paragraphs, and explain concepts step by step."})}async instruct(e){let r=this.ai.clone();return r.resetConversation(),r.getContextPrefix=async()=>e.instruction,e.callback&&r.addEventListener("output",n=>{e.callback(n.detail.message)}),e.allowKB||(r.knowledgeBase._sources=[]),await r.sendMessage(typeof e.data=="string"?e.data:JSON.stringify(e.data)).then(n=>n.text())}};var Bu=class{constructor(e){this.messages=e}text(){return this.messages?.flatMap(e=>e.sections)?.filter(e=>e?.type=="text")?.map(e=>e?.text||"")?.filter(e=>!!e)?.join(`
|
|
131
131
|
|
|
132
|
-
`)?.trim()||""}tokenUsage(){return{cachedInputTokens:this.messages?.reduce((e,r)=>e+(r.usage?.cachedInputTokens||0),0)||0,inputTokens:this.messages?.reduce((e,r)=>e+(r.usage?.inputTokens||0),0)||0,outputTokens:this.messages?.reduce((e,r)=>e+(r.usage?.outputTokens||0),0)||0,totalTokens:this.messages?.reduce((e,r)=>e+(r.usage?.totalTokens||0),0)||0}}sections(){return this.messages?.flatMap(e=>e.sections||[])||[]}toolCalls(){return this.messages?.flatMap(e=>e.sections?.filter(r=>r.type=="tool_call")||[])||[]}toolResult(e){return this.messages?.map(r=>r.sections?.find(n=>n.type=="tool_result"&&n.toolCallInstanceID==e)).filter(r=>!!r)[0]||null}};var kb=class{constructor(e){this.subagents=[];this.cachedSubagents={};this.ai=e}register(e){if(this.subagents.find(r=>r.id==e.id))throw new Error(`Sub-agent with ID ${e.id} already exists`);this.subagents.push(e),this.ai.knowledgeBase.registerSource("subagent:"+e.id,r=>[{type:"action",id:"ask:"+e.id,name:`Ask ${e.name||"subagent"}`,content:e.usageInstructions||`Use this tool to ask ${e.name||"subagent"} a question.`,isContext:!0,parameters:[{type:"string",name:"query",description:"The question to ask the subagent"}],action:async(n,i)=>await this.runQuery(e,n.query)}])}remove(e){this.subagents=this.subagents.filter(r=>r.id!=e),this.ai.knowledgeBase.removeSource("subagent:"+e)}async runQuery(e,r){let n=e.apiKey||this.ai.apiKey,i=this.cachedSubagents[n];return i||(i=new Wu,i.userID=this.ai.userID,await i.load(n,e.config),this.cachedSubagents[n]=i),i=i.clone(),i.knowledgeBase.allowGlobalConfigSources=!1,i.knowledgeBase.allowWindowSources=!1,e.clearExistingKnowledge&&i.knowledgeBase.reset(),i.knowledgeBase.allowRagSearch=!e.disableRagSearch,e.knowledge&&i.knowledgeBase.registerSource(e.knowledge),e.onAgentLoaded&&await e.onAgentLoaded(i),(await i.sendMessage(r)).text()}};var
|
|
132
|
+
`)?.trim()||""}tokenUsage(){return{cachedInputTokens:this.messages?.reduce((e,r)=>e+(r.usage?.cachedInputTokens||0),0)||0,inputTokens:this.messages?.reduce((e,r)=>e+(r.usage?.inputTokens||0),0)||0,outputTokens:this.messages?.reduce((e,r)=>e+(r.usage?.outputTokens||0),0)||0,totalTokens:this.messages?.reduce((e,r)=>e+(r.usage?.totalTokens||0),0)||0}}sections(){return this.messages?.flatMap(e=>e.sections||[])||[]}toolCalls(){return this.messages?.flatMap(e=>e.sections?.filter(r=>r.type=="tool_call")||[])||[]}toolResult(e){return this.messages?.map(r=>r.sections?.find(n=>n.type=="tool_result"&&n.toolCallInstanceID==e)).filter(r=>!!r)[0]||null}};var kb=class{constructor(e){this.subagents=[];this.cachedSubagents={};this.ai=e}register(e){if(this.subagents.find(r=>r.id==e.id))throw new Error(`Sub-agent with ID ${e.id} already exists`);this.subagents.push(e),this.ai.knowledgeBase.registerSource("subagent:"+e.id,r=>[{type:"action",id:"ask:"+e.id,name:`Ask ${e.name||"subagent"}`,content:e.usageInstructions||`Use this tool to ask ${e.name||"subagent"} a question.`,isContext:!0,parameters:[{type:"string",name:"query",description:"The question to ask the subagent"}],action:async(n,i)=>await this.runQuery(e,n.query)}])}remove(e){this.subagents=this.subagents.filter(r=>r.id!=e),this.ai.knowledgeBase.removeSource("subagent:"+e)}async runQuery(e,r){let n=e.apiKey||this.ai.apiKey,i=this.cachedSubagents[n];return i||(i=new Wu,i.userID=this.ai.userID,await i.load(n,e.config),this.cachedSubagents[n]=i),i=i.clone(),i.knowledgeBase.allowGlobalConfigSources=!1,i.knowledgeBase.allowWindowSources=!1,e.clearExistingKnowledge&&i.knowledgeBase.reset(),i.knowledgeBase.allowRagSearch=!e.disableRagSearch,e.knowledge&&i.knowledgeBase.registerSource(e.knowledge),e.onAgentLoaded&&await e.onAgentLoaded(i),(await i.sendMessage(r)).text()}};var vn=new Oe("Main"),Nj=new Set,al=class al extends EventTarget{constructor(){super(...arguments);this.conversationID=cr();this.knowledgeBase=new wb(this);this.subAgents=new kb(this);this._lastKBsearch="";this.models=[];this.audio=null;this.apiKey="";this.logic=new xb(this);this.userID=IP();this.hubAPI="https://intelliweave.ai/api";this._lastSystemMsg="";this.lastKBItems=[];this.isProcessing=!1;this.activeAnalyticsPromises=[]}get loaded(){return!!(this.config&&this.currentModel)}get flags(){return this.config?.flags||{}}getBuiltInActionsInfo(){return{version:al.builtInActionsVersion,availableActions:["ui.openURL - Open URLs in new tabs","ui.changeRoute - Change page routes","ui.sendEmail - Send emails via mailto links","search - Search knowledge base"],enabledFlags:this.flags}}async load(r,n){if(this.apiKey=r,!r)throw new Error("API key is required to load the AI.");n?.userID&&(this.userID=n.userID),n?.hubAPI&&(this.hubAPI=n.hubAPI);try{await Promise.all([(async()=>{vn.debug("Loading configuration...");let i=await fetch(this.hubAPI+"/config/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:r,userID:this.userID})});if(!i.ok){let o=`${i.status} ${i.statusText}`;try{let s=await i.json();s.error?o=s.error:s.message&&(o=s.message)}catch(s){vn.debug("Could not parse error response body:",s)}throw new Error(`Failed to load configuration: ${o}`)}try{this.config=await i.json(),vn.debug("Config loaded successfully:",this.config),n&&(this.config={...this.config,...n}),this.config&&vn.debug("UI Properties - logo:",this.config.logo,"background:",this.config.background,"textColor:",this.config.textColor)}catch(o){vn.error("Failed to parse JSON response:",o);try{let s=await i.clone().text();vn.error("Raw response that failed parsing:",s)}catch{vn.error("Could not get raw response text either")}throw new Error(`Failed to parse configuration: ${o}`)}})(),(async()=>{try{let i=await fetch("https://cdn.intelliweave.ai/models/silero_vad_3.onnx");if(!i.ok)throw new Error(`Failed to load VAD model: ${i.status} ${i.statusText}`);this.vadModel=await i.blob()}catch(i){vn.warn(`Failed to load VAD model, some features will be unavailable. ${i.message}`)}})()]),this.models=[{id:this.config.id,config:this.config.model}],this.setModel(this.config.id);for(let i of this.config.knowledge||[])i.url&&i.backendType=="mcp"?this.knowledgeBase.registerMCPSource({id:i.id,searchToolName:i.mcpSearchToolName,baseURL:i.url}):i.url&&this.knowledgeBase.registerSourceFromURL(i.url);for(let i of this.config.knowledge||[])i.entries?.length&&this.knowledgeBase.registerSource(i.id,()=>i.entries||[]);if(this.config.mcpServers)for(let i of this.config.mcpServers)this.knowledgeBase.registerMCPSource(i);for(let i of this.config.subagents||[])this.subAgents.register(i);return this.resetConversation(),this.dispatchEvent(new CustomEvent("load",{detail:{ai:this}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_loaded",{detail:{ai:this}})),this}catch(i){throw vn.warn("Failed to load:",i),this.error=i,this.dispatchEvent(new CustomEvent("error",{detail:{ai:this,error:i}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_error",{detail:{ai:this,error:i}})),i}}setModel(r){let n=this.models.find(o=>o.id==r);if(!n)throw new Error(`Model with ID "${r}" not found.`);let i={...n.config,stream:!0,systemMessage:"",onBeforeMessageProcessing:this.onBeforeMessageProcessing.bind(this),onAIMessage:this.processIncomingMessage.bind(this),onAIToolStart:(o,s)=>{let a=this.knowledgeBase.getCachedEntry(o);this.onAIToolStart?.(a?.id||o,s)}};this.config?.onCreateProvider?this.currentModel=this.config.onCreateProvider(i):n.config.providerID==="anthropic"?this.currentModel=new Yh(i):this.currentModel=new xh(i),this.currentModel.id=n.id,this.currentModel.metadata=n}async getContextPrefix(){let r=bt().pageSummary||`You are ${this.config?.name||"IntelliWeave"}. ${this.config?.instructions||"Speak in short sentences."}`;return typeof r=="function"&&(r=await r()),r}async onBeforeMessageProcessing(){this._lastKBsearch||(this._lastKBsearch="__intelliweaveblanksearchforcontextitems__");let r=this._nextRequestUseKBitems||await this.knowledgeBase.search(this._lastKBsearch);this._nextRequestUseKBitems=void 0;let n=await this.getContextPrefix();this.currentModel.contextGroup.add({id:"_iw_main",sortOrder:1,cannotRemove:!0,data:n}),this.currentModel.contextGroup.add({id:"_iw_kb_only_rule",sortOrder:2,cannotRemove:!0,disabled:!this.flags.onlyUseKnowledgeBase,data:"Important rule: Only use knowledge from your knowledge base to answer questions, do not speak about anything that is not included in your knowledge base."}),this.currentModel.contextGroup.add({id:"_iw_kb_rag",sortOrder:99,cannotRemove:!0,disabled:!this.knowledgeBase.allowRagSearch,data:vh(`
|
|
133
133
|
# RAG search
|
|
134
134
|
Use the \`search\` tool proactively as much as possible to find missing information or tools.
|
|
135
135
|
Use the \`search\` tool when you are unsure about specific details or actions to take.
|
|
@@ -145,12 +145,12 @@ attachments:
|
|
|
145
145
|
mimetype: "${a.mimeType||""}"
|
|
146
146
|
url: "${a.url}"
|
|
147
147
|
`);s||(o+="```\n"),this.currentModel.contextGroup.add({id:i.id,data:`## ${i.type}: ${i.name}
|
|
148
|
-
${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="function"?i.disabled(this):i.disabled})}else if(i.type=="action"){let o={name:i._functionID,description:vh(i.content),params:EP(i.parameters||[{name:"value",type:"string",description:"Input"}]),callback:s=>this.toolRunKBAction(i,s),canRemove:!i.isContext,kbItem:i};this.currentModel.registerTool(o)}else continue;for(let i of this.lastKBItems)!i.isContext||!i.id||r.find(s=>s.id==i.id)||(this.currentModel.contextGroup.remove(i.id),i._functionID&&this.currentModel.toolGroup.remove(i._functionID));this.lastKBItems=r}processIncomingMessage(r,n){if(!n){let i=this.currentModel?.stats?.tokensUsed||0,o=r.reduce((s,a)=>s+(a.usage?.totalTokens||0),0);Vr(this,{event_type:"message_receive",value:o,value_str:"",event_properties:{response_time_ms:Date.now()-(this._messageStartTime||Date.now()),is_streaming:!1,is_chunk:!1,total_tokens:i}})}this.dispatchEvent(new CustomEvent("output",{detail:{ai:this,isPartial:n,messages:r}})),this.onAIMessage?.(r,!!n)}async sendMessage(r,n){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(this.isProcessing)throw new Error("Cannot send message while another message is being processed.");this.isProcessing=!0;try{this._messageStartTime=Date.now(),Nj.has(this.conversationID)||(Nj.add(this.conversationID),Vr(this,{event_type:"session_start"})),Vr(this,{event_type:"message_send",value_str:"",event_properties:{message_length:r.length,is_voice_input:!!this.audio?.speechRecognition?.isRunning}}),this.dispatchEvent(new CustomEvent("input",{detail:{ai:this,message:r}})),this.submitAnalyticsEvent({type:"message",role:"user",message:r});let i=Date.now(),o=await this.currentModel.sendMessage(r),s=new Bu(o);(this._voiceTracker||
|
|
148
|
+
${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="function"?i.disabled(this):i.disabled})}else if(i.type=="action"){let o={name:i._functionID,description:vh(i.content),params:EP(i.parameters||[{name:"value",type:"string",description:"Input"}]),callback:s=>this.toolRunKBAction(i,s),canRemove:!i.isContext,kbItem:i};this.currentModel.registerTool(o)}else continue;for(let i of this.lastKBItems)!i.isContext||!i.id||r.find(s=>s.id==i.id)||(this.currentModel.contextGroup.remove(i.id),i._functionID&&this.currentModel.toolGroup.remove(i._functionID));this.lastKBItems=r}processIncomingMessage(r,n){if(!n){let i=this.currentModel?.stats?.tokensUsed||0,o=r.reduce((s,a)=>s+(a.usage?.totalTokens||0),0);Vr(this,{event_type:"message_receive",value:o,value_str:"",event_properties:{response_time_ms:Date.now()-(this._messageStartTime||Date.now()),is_streaming:!1,is_chunk:!1,total_tokens:i}})}this.dispatchEvent(new CustomEvent("output",{detail:{ai:this,isPartial:n,messages:r}})),this.onAIMessage?.(r,!!n)}async sendMessage(r,n){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(this.isProcessing)throw new Error("Cannot send message while another message is being processed.");this.isProcessing=!0;try{this._messageStartTime=Date.now(),Nj.has(this.conversationID)||(Nj.add(this.conversationID),Vr(this,{event_type:"session_start"})),Vr(this,{event_type:"message_send",value_str:"",event_properties:{message_length:r.length,is_voice_input:!!this.audio?.speechRecognition?.isRunning}}),this.dispatchEvent(new CustomEvent("input",{detail:{ai:this,message:r}})),this.submitAnalyticsEvent({type:"message",role:"user",message:r});let i=Date.now(),o=await this.currentModel.sendMessage(r),s=new Bu(o);(this._voiceTracker||vn.debug.bind(vn))(`LLM response took ${Date.now()-i}ms`);let l=this.currentModel.contextGroup.getAllAsString();l+=`
|
|
149
149
|
|
|
150
150
|
=== TOOLS ===
|
|
151
151
|
|
|
152
152
|
`+this.currentModel.toolGroup.getAll().map(c=>"- "+c.data?.name).join(`
|
|
153
|
-
`),this._lastSystemMsg!=l&&(this._lastSystemMsg=l,this.submitAnalyticsEvent({type:"system-msg",txt:l}));for(let c of o)for(let u of c.sections||[])if(u.type=="text")this.submitAnalyticsEvent({type:"message",role:"assistant",message:u.text||""});else if(u.type=="thinking")this.submitAnalyticsEvent({type:"thinking",role:"assistant",message:u.text||""});else if(u.type=="tool_call"){let d=s.toolResult(u.toolCallInstanceID);this.submitAnalyticsEvent({type:"action",role:"assistant",action:u.toolKbID||"",actionName:u.toolKbName||"",value:u.toolParameters,result:d?.toolErrorResponse||d?.toolSuccessResponse,isError:!!d?.toolErrorResponse})}else u.type=="tool_result"||this.submitAnalyticsEvent({type:"other",role:"assistant"});return s}finally{this.isProcessing=!1}}async toolRunKBAction(r,n){let i=Date.now();try{this.dispatchEvent(new CustomEvent("toolstart",{detail:{knowledgeBaseEntry:r,input:n,ai:this}}));let o=await r.action(n,this),s=Date.now()-i;return Vr(this,{event_type:"tool_call",value_str:r.id||"",event_properties:{tool_args:n,execution_time_ms:s,success:!0}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:r,input:n,ai:this,result:o}})),o}catch(o){let s=Date.now()-i;throw Vr(this,{event_type:"tool_call",value_str:r.id||"",event_properties:{tool_args:n,execution_time_ms:s,success:!1,error_message:o.message}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:r,input:n,ai:this,error:o}})),o}}submitAnalyticsEvent(r){if(bt().analytics===!1||this.config?.analytics===!1)return;let n=fetch(this.hubAPI+"/analytics/post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,apiKey:this.apiKey,time:Date.now(),conversationID:this.conversationID,personaID:this.config?.id})}).catch(i=>{Zn.debug("Failed to submit analytics event:",i)});this.activeAnalyticsPromises.push(n),n.finally(()=>{this.activeAnalyticsPromises=this.activeAnalyticsPromises.filter(i=>i!==n)})}async waitForAnalytics(){this.activeAnalyticsPromises.length!==0&&(await Promise.all(this.activeAnalyticsPromises),this.activeAnalyticsPromises.length>0&&await this.waitForAnalytics())}resetConversation(){this.currentModel&&(this.currentModel.resetConversation(),this._lastKBsearch="",this._nextRequestUseKBitems=void 0,this.conversationID=cr(),this._lastSystemMsg="")}insertAssistantMessage(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");this.currentModel.addAssistantMessage(r)}exportState(){return{type:"intelliweave/state/v2",conversationID:this.conversationID,messages:this.currentModel?.messageGroup.getAll()}}importState(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(r?.type!="intelliweave/state/v2")throw new Error(`Invalid state type: ${r.type}`);this.conversationID=r.conversationID;for(let n of r.messages)this.currentModel.messageGroup.add(n)}clone(){let r=new al;return r.apiKey=this.apiKey,r.config=this.config,r.models=this.models,this.config?.id&&r.setModel(this.config.id),r.audio=this.audio,r.vadModel=this.vadModel,r.userID=this.userID,r.knowledgeBase=this.knowledgeBase.clone(r),r}get messages(){return this.currentModel?.messageGroup.items||[]}};al.version=Rs.version,al.builtInActionsVersion="1.0.0",Zn.debug(`Loaded: version=${Rs.version} builtInActionsVersion=${al.builtInActionsVersion}`);var Wu=al;var vn=class extends HTMLElement{constructor(){super(...arguments);this._state={}}get root(){return this._shadow}static register(){this._isRegistered||(this._isRegistered=!0,this.tagName||(this.tagName="anonymous-component-"+this.name.toLowerCase().replace(/[^a-z0-9-]/g,"-")+"--"+Math.random().toString(36).substring(2)),window.customElements.define(this.tagName,this))}static create(r={},n=""){this.register();let i=document.createElement(this.tagName);for(let o in r)i.setAttribute(o,r[o]);return i.onBeforeCreate(),i.innerHTML=n,i}static add(r={},n=""){this.register();let i=o=>o.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">");return`<${this.tagName} ${Object.keys(r).map(o=>`${o}="${i(r[o]+"")}"`).join(" ")}>${n}</${this.tagName}>`}static createElement(){return this.register(),document.createElement(this.tagName)}connectedCallback(){this._shadow||(this._shadow=this.attachShadow({mode:"closed"}),this._shadow.innerHTML=this.html(),this.onCreate()),this.onUpdate()}disconnectedCallback(){this._shadow=void 0,this.onDestroy()}html(){return""}onBeforeCreate(){}onCreate(){}onUpdate(){}onDestroy(){}attributeChangedCallback(r,n,i){this._shadow&&this.onUpdate()}get attr(){return this._attrProxy?this._attrProxy:(this._attrProxy=new Proxy({},{get:(r,n)=>this.getAttribute(n.toString())||"",set:(r,n,i)=>(this.getAttribute(n.toString())===i||(i?this.setAttribute(n.toString(),i):this.removeAttribute(n.toString()),this._shadow&&this.onUpdate()),!0)}),this._attrProxy)}get state(){return this._stateProxy?this._stateProxy:(this._stateProxy=new Proxy({},{get:(r,n)=>this._state[n],set:(r,n,i)=>(this._state[n]=i,this._shadow&&this.onUpdate(),!0)}),this._stateProxy)}hasChild(r){return!!this.root?.getElementById(r)}child(r){let n=this.root?.getElementById(r);if(!n)throw new Error(`Child with ID ${r} not found`);return n}};vn.observedAttributes=[],vn.tagName="",vn._isRegistered=!1;var Mj='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" width="200" height="200" style="shape-rendering: auto; display: block; " xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="0.5s" calcMode="spline" keyTimes="0;1" values="10;0" keySplines="0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="fill" repeatCount="indefinite" dur="2s" calcMode="discrete" keyTimes="0;0.25;0.5;0.75;1" values="%23797979;%23797979;%23797979;%23797979;%23797979" begin="0s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A</circle><circle cx="50" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A</circle><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A</circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg>';var jj='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 475.085 475.085" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M237.541 328.897c25.128 0 46.632-8.946 64.523-26.83 17.888-17.884 26.833-39.399 26.833-64.525V91.365c0-25.126-8.938-46.632-26.833-64.525C284.173 8.951 262.669 0 237.541 0c-25.125 0-46.632 8.951-64.524 26.84-17.893 17.89-26.838 39.399-26.838 64.525v146.177c0 25.125 8.949 46.641 26.838 64.525 17.889 17.884 39.399 26.83 64.524 26.83z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path><path d="M396.563 188.15c-3.606-3.617-7.898-5.426-12.847-5.426-4.944 0-9.226 1.809-12.847 5.426-3.613 3.616-5.421 7.898-5.421 12.845v36.547c0 35.214-12.518 65.333-37.548 90.362-25.022 25.03-55.145 37.545-90.36 37.545-35.214 0-65.334-12.515-90.365-37.545-25.028-25.022-37.541-55.147-37.541-90.362v-36.547c0-4.947-1.809-9.229-5.424-12.845-3.617-3.617-7.895-5.426-12.847-5.426s-9.235 1.809-12.85 5.426c-3.618 3.616-5.426 7.898-5.426 12.845v36.547c0 42.065 14.04 78.659 42.112 109.776 28.073 31.118 62.762 48.961 104.068 53.526v37.691h-73.089c-4.949 0-9.231 1.811-12.847 5.428-3.617 3.614-5.426 7.898-5.426 12.847 0 4.941 1.809 9.233 5.426 12.847 3.616 3.614 7.898 5.428 12.847 5.428h182.719c4.948 0 9.236-1.813 12.847-5.428 3.621-3.613 5.431-7.905 5.431-12.847 0-4.948-1.81-9.232-5.431-12.847-3.61-3.617-7.898-5.428-12.847-5.428h-73.08v-37.691c41.299-4.565 75.985-22.408 104.061-53.526 28.076-31.117 42.12-67.711 42.12-109.776v-36.547c0-4.946-1.813-9.225-5.435-12.845z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Dj='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 448.075 448.075" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M352.021 16.075c0-6.08-3.52-11.84-8.96-14.4-5.76-2.88-12.16-1.92-16.96 1.92l-141.76 112.96 167.68 167.68zM443.349 420.747l-416-416c-6.24-6.24-16.384-6.24-22.624 0s-6.24 16.384 0 22.624l100.672 100.704h-9.376c-9.92 0-18.56 4.48-24.32 11.52-4.8 5.44-7.68 12.8-7.68 20.48v128c0 17.6 14.4 32 32 32h74.24l155.84 124.48c2.88 2.24 6.4 3.52 9.92 3.52 2.24 0 4.8-.64 7.04-1.6 5.44-2.56 8.96-8.32 8.96-14.4v-57.376l68.672 68.672c3.136 3.136 7.232 4.704 11.328 4.704s8.192-1.568 11.328-4.672c6.24-6.272 6.24-16.384 0-22.656z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var um=class extends vn{constructor(){super(...arguments);this.html=()=>`
|
|
153
|
+
`),this._lastSystemMsg!=l&&(this._lastSystemMsg=l,this.submitAnalyticsEvent({type:"system-msg",txt:l}));for(let c of o)for(let u of c.sections||[])if(u.type=="text")this.submitAnalyticsEvent({type:"message",role:"assistant",message:u.text||""});else if(u.type=="thinking")this.submitAnalyticsEvent({type:"thinking",role:"assistant",message:u.text||""});else if(u.type=="tool_call"){let d=s.toolResult(u.toolCallInstanceID);this.submitAnalyticsEvent({type:"action",role:"assistant",action:u.toolKbID||"",actionName:u.toolKbName||"",value:u.toolParameters,result:d?.toolErrorResponse||d?.toolSuccessResponse,isError:!!d?.toolErrorResponse})}else u.type=="tool_result"||this.submitAnalyticsEvent({type:"other",role:"assistant"});return s}finally{this.isProcessing=!1}}async toolRunKBAction(r,n){let i=Date.now();try{this.dispatchEvent(new CustomEvent("toolstart",{detail:{knowledgeBaseEntry:r,input:n,ai:this}}));let o=await r.action(n,this),s=Date.now()-i;return Vr(this,{event_type:"tool_call",value_str:r.id||"",event_properties:{tool_args:n,execution_time_ms:s,success:!0}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:r,input:n,ai:this,result:o}})),o}catch(o){let s=Date.now()-i;throw Vr(this,{event_type:"tool_call",value_str:r.id||"",event_properties:{tool_args:n,execution_time_ms:s,success:!1,error_message:o.message}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:r,input:n,ai:this,error:o}})),o}}submitAnalyticsEvent(r){if(bt().analytics===!1||this.config?.analytics===!1)return;let n=fetch(this.hubAPI+"/analytics/post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,apiKey:this.apiKey,time:Date.now(),conversationID:this.conversationID,personaID:this.config?.id})}).catch(i=>{vn.debug("Failed to submit analytics event:",i)});this.activeAnalyticsPromises.push(n),n.finally(()=>{this.activeAnalyticsPromises=this.activeAnalyticsPromises.filter(i=>i!==n)})}async waitForAnalytics(){this.activeAnalyticsPromises.length!==0&&(await Promise.all(this.activeAnalyticsPromises),this.activeAnalyticsPromises.length>0&&await this.waitForAnalytics())}resetConversation(){this.currentModel&&(this.currentModel.resetConversation(),this._lastKBsearch="",this._nextRequestUseKBitems=void 0,this.conversationID=cr(),this._lastSystemMsg="")}insertAssistantMessage(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");this.currentModel.addAssistantMessage(r)}exportState(){return{type:"intelliweave/state/v2",conversationID:this.conversationID,messages:this.currentModel?.messageGroup.getAll()}}importState(r){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(r?.type!="intelliweave/state/v2")throw new Error(`Invalid state type: ${r.type}`);this.conversationID=r.conversationID;for(let n of r.messages)this.currentModel.messageGroup.add(n)}clone(){let r=new al;return r.apiKey=this.apiKey,r.config=this.config,r.models=this.models,this.config?.id&&r.setModel(this.config.id),r.audio=this.audio,r.vadModel=this.vadModel,r.userID=this.userID,r.knowledgeBase=this.knowledgeBase.clone(r),r}get messages(){return this.currentModel?.messageGroup.items||[]}};al.version=Rs.version,al.builtInActionsVersion="1.0.0",vn.debug(`Loaded: version=${Rs.version} builtInActionsVersion=${al.builtInActionsVersion}`);var Wu=al;var wn=class extends HTMLElement{constructor(){super(...arguments);this._state={}}get root(){return this._shadow}static register(){this._isRegistered||(this._isRegistered=!0,this.tagName||(this.tagName="anonymous-component-"+this.name.toLowerCase().replace(/[^a-z0-9-]/g,"-")+"--"+Math.random().toString(36).substring(2)),window.customElements.define(this.tagName,this))}static create(r={},n=""){this.register();let i=document.createElement(this.tagName);for(let o in r)i.setAttribute(o,r[o]);return i.onBeforeCreate(),i.innerHTML=n,i}static add(r={},n=""){this.register();let i=o=>o.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<").replaceAll(">",">");return`<${this.tagName} ${Object.keys(r).map(o=>`${o}="${i(r[o]+"")}"`).join(" ")}>${n}</${this.tagName}>`}static createElement(){return this.register(),document.createElement(this.tagName)}connectedCallback(){this._shadow||(this._shadow=this.attachShadow({mode:"closed"}),this._shadow.innerHTML=this.html(),this.onCreate()),this.onUpdate()}disconnectedCallback(){this._shadow=void 0,this.onDestroy()}html(){return""}onBeforeCreate(){}onCreate(){}onUpdate(){}onDestroy(){}attributeChangedCallback(r,n,i){this._shadow&&this.onUpdate()}get attr(){return this._attrProxy?this._attrProxy:(this._attrProxy=new Proxy({},{get:(r,n)=>this.getAttribute(n.toString())||"",set:(r,n,i)=>(this.getAttribute(n.toString())===i||(i?this.setAttribute(n.toString(),i):this.removeAttribute(n.toString()),this._shadow&&this.onUpdate()),!0)}),this._attrProxy)}get state(){return this._stateProxy?this._stateProxy:(this._stateProxy=new Proxy({},{get:(r,n)=>this._state[n],set:(r,n,i)=>(this._state[n]=i,this._shadow&&this.onUpdate(),!0)}),this._stateProxy)}hasChild(r){return!!this.root?.getElementById(r)}child(r){let n=this.root?.getElementById(r);if(!n)throw new Error(`Child with ID ${r} not found`);return n}};wn.observedAttributes=[],wn.tagName="",wn._isRegistered=!1;var Mj='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" width="200" height="200" style="shape-rendering: auto; display: block; " xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="0.5s" calcMode="spline" keyTimes="0;1" values="10;0" keySplines="0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="fill" repeatCount="indefinite" dur="2s" calcMode="discrete" keyTimes="0;0.25;0.5;0.75;1" values="%23797979;%23797979;%23797979;%23797979;%23797979" begin="0s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A</circle><circle cx="50" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A</circle><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A</circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg>';var jj='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 475.085 475.085" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M237.541 328.897c25.128 0 46.632-8.946 64.523-26.83 17.888-17.884 26.833-39.399 26.833-64.525V91.365c0-25.126-8.938-46.632-26.833-64.525C284.173 8.951 262.669 0 237.541 0c-25.125 0-46.632 8.951-64.524 26.84-17.893 17.89-26.838 39.399-26.838 64.525v146.177c0 25.125 8.949 46.641 26.838 64.525 17.889 17.884 39.399 26.83 64.524 26.83z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path><path d="M396.563 188.15c-3.606-3.617-7.898-5.426-12.847-5.426-4.944 0-9.226 1.809-12.847 5.426-3.613 3.616-5.421 7.898-5.421 12.845v36.547c0 35.214-12.518 65.333-37.548 90.362-25.022 25.03-55.145 37.545-90.36 37.545-35.214 0-65.334-12.515-90.365-37.545-25.028-25.022-37.541-55.147-37.541-90.362v-36.547c0-4.947-1.809-9.229-5.424-12.845-3.617-3.617-7.895-5.426-12.847-5.426s-9.235 1.809-12.85 5.426c-3.618 3.616-5.426 7.898-5.426 12.845v36.547c0 42.065 14.04 78.659 42.112 109.776 28.073 31.118 62.762 48.961 104.068 53.526v37.691h-73.089c-4.949 0-9.231 1.811-12.847 5.428-3.617 3.614-5.426 7.898-5.426 12.847 0 4.941 1.809 9.233 5.426 12.847 3.616 3.614 7.898 5.428 12.847 5.428h182.719c4.948 0 9.236-1.813 12.847-5.428 3.621-3.613 5.431-7.905 5.431-12.847 0-4.948-1.81-9.232-5.431-12.847-3.61-3.617-7.898-5.428-12.847-5.428h-73.08v-37.691c41.299-4.565 75.985-22.408 104.061-53.526 28.076-31.117 42.12-67.711 42.12-109.776v-36.547c0-4.946-1.813-9.225-5.435-12.845z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Dj='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 448.075 448.075" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M352.021 16.075c0-6.08-3.52-11.84-8.96-14.4-5.76-2.88-12.16-1.92-16.96 1.92l-141.76 112.96 167.68 167.68zM443.349 420.747l-416-416c-6.24-6.24-16.384-6.24-22.624 0s-6.24 16.384 0 22.624l100.672 100.704h-9.376c-9.92 0-18.56 4.48-24.32 11.52-4.8 5.44-7.68 12.8-7.68 20.48v128c0 17.6 14.4 32 32 32h74.24l155.84 124.48c2.88 2.24 6.4 3.52 9.92 3.52 2.24 0 4.8-.64 7.04-1.6 5.44-2.56 8.96-8.32 8.96-14.4v-57.376l68.672 68.672c3.136 3.136 7.232 4.704 11.328 4.704s8.192-1.568 11.328-4.672c6.24-6.272 6.24-16.384 0-22.656z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var um=class extends wn{constructor(){super(...arguments);this.html=()=>`
|
|
154
154
|
|
|
155
155
|
<!-- Styling -->
|
|
156
156
|
<style>
|
|
@@ -309,7 +309,7 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
309
309
|
<!-- Loader bar -->
|
|
310
310
|
<div id='loader'></div>
|
|
311
311
|
|
|
312
|
-
`;this._wasLoading=!1;this.voiceAnimationPieces=[];this._micAnimFrameCounter=0}onCreate(){this.child("input-field").addEventListener("keypress",r=>this.onInputKeyPress(r),{capture:!0}),this.child("input-field").addEventListener("keydown",r=>r.stopPropagation(),{capture:!0}),this.child("llm-button").addEventListener("click",r=>this.onLLMButtonClick(r)),this.child("send-button").addEventListener("click",r=>this.onSendButtonClick(r)),this.child("microphone-button").addEventListener("click",r=>this.onMicButtonClick(r)),this.child("cancel-speech-button").addEventListener("click",r=>this.onCancelSpeechButtonClick(r))}connectAI(r){this.ai=r,this.ai.audio?.speechRecognition.addEventListener("speech",n=>this.onSpeechEvent(n)),this.ai.audio?.speechRecognition.addEventListener("start",n=>this.onUpdate()),this.ai.audio?.speechRecognition.addEventListener("end",n=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechstart",n=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechend",n=>this.onUpdate()),this.onUpdate()}onUpdate(){this.attr.textColor&&document.documentElement.style.setProperty("--intelliweave-text-color",this.attr.textColor),this.child("input-field").style.display=this.attr.loading||this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("llm-button").style.display=this.attr.loading||!this.attr.llmButtonVisible||this.state.micActiv?"none":"",this.child("llm-button").innerText=this.attr.llmName||"LLM",this.child("send-button").style.display=this.attr.loading||this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("loader").style.display=this.attr.loading?"block":"",this.child("microphone-button").style.display=!this.ai?.audio?.speechRecognition?.isSupported||this.attr.loading&&!this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("cancel-speech-button").style.display="none",this.ai?.audio?.speechRecognition.isRunning&&this.ai?.audio?.speechOutput.isSpeaking&&(this.child("microphone-button").style.display="none",this.child("cancel-speech-button").style.display=""),!this.attr.loading&&this._wasLoading&&this.child("input-field").focus(),this._wasLoading=this.attr.loading,this.child("microphone-button-bg").classList.toggle("active",!!this.ai?.audio?.speechRecognition.isRunning);let r=this.ai?.audio?.speechRecognition.isRunning&&!this.attr.loading;r&&!this.micStateAnimationTimer?this.micStateAnimationTimer=setInterval(()=>this.onMicAnimation(),1e3/60):!r&&this.micStateAnimationTimer&&(this.voiceAnimationPieces.forEach(n=>n.remove()),this.voiceAnimationPieces=[],clearInterval(this.micStateAnimationTimer),this.micStateAnimationTimer=void 0)}onInputKeyPress(r){if(r.stopPropagation(),r.key!="Enter")return;let n=this.child("input-field"),i=n.value?.trim();n.value="",i&&this.dispatchEvent(new CustomEvent("input-message",{detail:i}))}onLLMButtonClick(r){r.preventDefault(),this.dispatchEvent(new CustomEvent("llm-button-click"))}onSendButtonClick(r){r.preventDefault();let n=this.child("input-field"),i=n.value?.trim();n.value="",i&&this.dispatchEvent(new CustomEvent("input-message",{detail:i}))}onMicButtonClick(r){r.preventDefault(),this.ai.audio?.speechRecognition.isRunning?this.ai.audio?.speechRecognition.stop():this.ai.audio?.speechRecognition.start()}onMicAnimation(){if(!this.attr.loading){if(this._micAnimFrameCounter++,this._micAnimFrameCounter%5==0){let r="rgba(140, 170, 200, 0.5)";this.ai?.audio?.speechRecognition.voiceDetection?.isModelLoaded||(r="rgba(255, 0, 0, 0.5)"),this.ai?.audio?.speechRecognition.voiceDetection?.isTranscribing&&(r="rgba(96, 66, 245, 0.9)"),this.ai?.audio?.speechRecognition.wordsCurrentlyBeingSpoken&&(r="rgba(0, 128, 255, 0.9)"),this.ai?.audio?.speechRecognition.voiceDetection?.isVoicePossiblyEnding&&(r="rgba(0, 128, 255, 0.5)"),this.ai?.isProcessing&&(r="rgba(255, 255, 0, 0.5)"),this.ai?.audio?.speechOutput.isSpeaking&&(r="rgba(0, 255, 0, 0.5)");let n=this.ai?.audio?.speechRecognition.volumeLevel||0,i=30,o=6,s=Math.round(n*(i-o)+o),a=document.createElement("div");a.posX=50,a.style.cssText=`position: absolute; top: calc(50% - ${s}px/2); left: 0px; width: 6px; height: ${s}px; background-color: ${r}; border-radius: 3px; pointer-events: none; `,this.root?.appendChild(a),this.voiceAnimationPieces.push(a)}for(let r=0;r<this.voiceAnimationPieces.length;r++){let n=this.voiceAnimationPieces[r];n.posX+=2,n.style.transform=`translate(${n.posX}px, 0px)`,!(n.posX<400)&&(this.voiceAnimationPieces.splice(r--,1),n.remove())}}}onSpeechEvent(r){this.attr.loading||r.detail.isFinal&&this.dispatchEvent(new CustomEvent("input-message",{detail:r.detail.transcript}))}onCancelSpeechButtonClick(r){this.ai.audio?.speechOutput.interrupt(),this.onUpdate()}};um.observedAttributes=["loading","llmName","llmButtonVisible","textColor","layout"];var Lj='data:image/svg+xml,<svg id="eLjt8NmVnoY1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 300 300" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" project-id="defaf4a7213e40159eb368f9622a2af1" export-id="e0405e7e1d4a45c0a08fbbedb06a02a8" cached="false"><defs><radialGradient id="eLjt8NmVnoY6-fill" cx="0" cy="0" r="1" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-58.520001 292.985 -172.197 -34.394001 203.907 57.158)"><stop id="eLjt8NmVnoY6-fill-0" offset="0%" stop-color="%232b3d43"/><stop id="eLjt8NmVnoY6-fill-1" offset="33%" stop-color="%23328897"/><stop id="eLjt8NmVnoY6-fill-2" offset="58%" stop-color="%23328897"/><stop id="eLjt8NmVnoY6-fill-3" offset="100%" stop-color="%237ebf96"/></radialGradient><radialGradient id="eLjt8NmVnoY7-fill" cx="0" cy="0" r="1.112049" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(182.129 -94.016999 94.016999 182.129 43.4553 184.626)"><stop id="eLjt8NmVnoY7-fill-0" offset="0%" stop-color="%233f2d2d"/><stop id="eLjt8NmVnoY7-fill-1" offset="28%" stop-color="%23c83b35"/><stop id="eLjt8NmVnoY7-fill-2" offset="81%" stop-color="%23f69153"/><stop id="eLjt8NmVnoY7-fill-3" offset="100%" stop-color="%23ffe388"/></radialGradient><radialGradient id="eLjt8NmVnoY9-fill" cx="0" cy="0" r="593.59" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.196117 0.98058 -0.578542 -0.115709 406.499077 117.274778)"><stop id="eLjt8NmVnoY9-fill-0" offset="0%" stop-color="%23252d3a"/><stop id="eLjt8NmVnoY9-fill-1" offset="60%" stop-color="%23c50"/><stop id="eLjt8NmVnoY9-fill-2" offset="100%" stop-color="%23fddc85"/></radialGradient><radialGradient id="eLjt8NmVnoY10-fill" cx="0" cy="0" r="454.77" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="translate(87.33 340.7)"><stop id="eLjt8NmVnoY10-fill-0" offset="0%" stop-color="%23002936"/><stop id="eLjt8NmVnoY10-fill-1" offset="44%" stop-color="%23007aa1"/><stop id="eLjt8NmVnoY10-fill-2" offset="67%" stop-color="%2326ab7f"/><stop id="eLjt8NmVnoY10-fill-3" offset="100%" stop-color="%2395e0c8"/></radialGradient></defs><g transform="matrix(.339855 0 0 0.339855 65.056641 64.89012)"><path d="M337.93,111.85c17.31-4.12,30.6-2.15,38.55,5.96c12.9,13.16,10.13,41.58-7.64,77.95-34.66,70.98-116.01,153.37-181.35,183.6-4.15,1.92-8.16,3.6-12.02,5.03l.05.18C83.95,418.36,13.7,365.53,1.49,278.27C15.34,403.24,121.28,500.43,249.94,500.43c138.07,0,250-111.93,250-250c0-9.8-.58-19.46-1.68-28.96-12-82.27-75.81-133.5-160.33-109.62Z" fill="url(%23eLjt8NmVnoY9-fill)"/><path d="M249.94,0.43c-138.07,0-250,111.93-250,250c0,9.41.54,18.69,1.55,27.84C13.7,365.54,83.95,418.36,175.52,384.58l-.05-.18c-11.22,4.17-21.17,6.24-29.61,6.24-9.59,0-17.18-2.67-22.44-8.03-12.9-13.19-10.13-41.61,7.64-77.98c18.26-37.41,49.51-77.98,84.51-112.41c31.45-32.33,62.2-54.66,91.14-68.47.16-.08.34-.16.49-.23c1.74-.85,3.47-1.68,5.18-2.49c9.22-4.27,17.77-7.33,25.54-9.17c84.52-23.88,148.33,27.35,160.33,109.62C483.91,97.04,378.22,0.43,249.94,0.43Z" fill="url(%23eLjt8NmVnoY10-fill)"/><path d="M337.93,111.85c-7.77,1.84-16.32,4.9-25.54,9.17-1.71.8-3.45,1.63-5.18,2.49-.16.08-.34.16-.49.23-28.94,13.81-59.69,36.14-91.14,68.47-35,34.43-66.24,75-84.51,112.41-17.77,36.37-20.54,64.79-7.64,77.98c5.26,5.36,12.85,8.03,22.44,8.03c8.45,0,18.39-2.07,29.61-6.24c3.86-1.42,7.88-3.11,12.02-5.03c65.34-30.23,146.68-112.62,181.35-183.6c17.77-36.37,20.54-64.79,7.64-77.95-7.95-8.11-21.24-10.08-38.55-5.96h-.01Z" fill="%23252d3a"/></g></svg>%0D%0A';var dm=class extends
|
|
312
|
+
`;this._wasLoading=!1;this.voiceAnimationPieces=[];this._micAnimFrameCounter=0}onCreate(){this.child("input-field").addEventListener("keypress",r=>this.onInputKeyPress(r),{capture:!0}),this.child("input-field").addEventListener("keydown",r=>r.stopPropagation(),{capture:!0}),this.child("llm-button").addEventListener("click",r=>this.onLLMButtonClick(r)),this.child("send-button").addEventListener("click",r=>this.onSendButtonClick(r)),this.child("microphone-button").addEventListener("click",r=>this.onMicButtonClick(r)),this.child("cancel-speech-button").addEventListener("click",r=>this.onCancelSpeechButtonClick(r))}connectAI(r){this.ai=r,this.ai.audio?.speechRecognition.addEventListener("speech",n=>this.onSpeechEvent(n)),this.ai.audio?.speechRecognition.addEventListener("start",n=>this.onUpdate()),this.ai.audio?.speechRecognition.addEventListener("end",n=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechstart",n=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechend",n=>this.onUpdate()),this.onUpdate()}onUpdate(){this.attr.textColor&&document.documentElement.style.setProperty("--intelliweave-text-color",this.attr.textColor),this.child("input-field").style.display=this.attr.loading||this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("llm-button").style.display=this.attr.loading||!this.attr.llmButtonVisible||this.state.micActiv?"none":"",this.child("llm-button").innerText=this.attr.llmName||"LLM",this.child("send-button").style.display=this.attr.loading||this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("loader").style.display=this.attr.loading?"block":"",this.child("microphone-button").style.display=!this.ai?.audio?.speechRecognition?.isSupported||this.attr.loading&&!this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("cancel-speech-button").style.display="none",this.ai?.audio?.speechRecognition.isRunning&&this.ai?.audio?.speechOutput.isSpeaking&&(this.child("microphone-button").style.display="none",this.child("cancel-speech-button").style.display=""),!this.attr.loading&&this._wasLoading&&this.child("input-field").focus(),this._wasLoading=this.attr.loading,this.child("microphone-button-bg").classList.toggle("active",!!this.ai?.audio?.speechRecognition.isRunning);let r=this.ai?.audio?.speechRecognition.isRunning&&!this.attr.loading;r&&!this.micStateAnimationTimer?this.micStateAnimationTimer=setInterval(()=>this.onMicAnimation(),1e3/60):!r&&this.micStateAnimationTimer&&(this.voiceAnimationPieces.forEach(n=>n.remove()),this.voiceAnimationPieces=[],clearInterval(this.micStateAnimationTimer),this.micStateAnimationTimer=void 0)}onInputKeyPress(r){if(r.stopPropagation(),r.key!="Enter")return;let n=this.child("input-field"),i=n.value?.trim();n.value="",i&&this.dispatchEvent(new CustomEvent("input-message",{detail:i}))}onLLMButtonClick(r){r.preventDefault(),this.dispatchEvent(new CustomEvent("llm-button-click"))}onSendButtonClick(r){r.preventDefault();let n=this.child("input-field"),i=n.value?.trim();n.value="",i&&this.dispatchEvent(new CustomEvent("input-message",{detail:i}))}onMicButtonClick(r){r.preventDefault(),this.ai.audio?.speechRecognition.isRunning?this.ai.audio?.speechRecognition.stop():this.ai.audio?.speechRecognition.start()}onMicAnimation(){if(!this.attr.loading){if(this._micAnimFrameCounter++,this._micAnimFrameCounter%5==0){let r="rgba(140, 170, 200, 0.5)";this.ai?.audio?.speechRecognition.voiceDetection?.isModelLoaded||(r="rgba(255, 0, 0, 0.5)"),this.ai?.audio?.speechRecognition.voiceDetection?.isTranscribing&&(r="rgba(96, 66, 245, 0.9)"),this.ai?.audio?.speechRecognition.wordsCurrentlyBeingSpoken&&(r="rgba(0, 128, 255, 0.9)"),this.ai?.audio?.speechRecognition.voiceDetection?.isVoicePossiblyEnding&&(r="rgba(0, 128, 255, 0.5)"),this.ai?.isProcessing&&(r="rgba(255, 255, 0, 0.5)"),this.ai?.audio?.speechOutput.isSpeaking&&(r="rgba(0, 255, 0, 0.5)");let n=this.ai?.audio?.speechRecognition.volumeLevel||0,i=30,o=6,s=Math.round(n*(i-o)+o),a=document.createElement("div");a.posX=50,a.style.cssText=`position: absolute; top: calc(50% - ${s}px/2); left: 0px; width: 6px; height: ${s}px; background-color: ${r}; border-radius: 3px; pointer-events: none; `,this.root?.appendChild(a),this.voiceAnimationPieces.push(a)}for(let r=0;r<this.voiceAnimationPieces.length;r++){let n=this.voiceAnimationPieces[r];n.posX+=2,n.style.transform=`translate(${n.posX}px, 0px)`,!(n.posX<400)&&(this.voiceAnimationPieces.splice(r--,1),n.remove())}}}onSpeechEvent(r){this.attr.loading||r.detail.isFinal&&this.dispatchEvent(new CustomEvent("input-message",{detail:r.detail.transcript}))}onCancelSpeechButtonClick(r){this.ai.audio?.speechOutput.interrupt(),this.onUpdate()}};um.observedAttributes=["loading","llmName","llmButtonVisible","textColor","layout"];var Lj='data:image/svg+xml,<svg id="eLjt8NmVnoY1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 300 300" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" project-id="defaf4a7213e40159eb368f9622a2af1" export-id="e0405e7e1d4a45c0a08fbbedb06a02a8" cached="false"><defs><radialGradient id="eLjt8NmVnoY6-fill" cx="0" cy="0" r="1" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-58.520001 292.985 -172.197 -34.394001 203.907 57.158)"><stop id="eLjt8NmVnoY6-fill-0" offset="0%" stop-color="%232b3d43"/><stop id="eLjt8NmVnoY6-fill-1" offset="33%" stop-color="%23328897"/><stop id="eLjt8NmVnoY6-fill-2" offset="58%" stop-color="%23328897"/><stop id="eLjt8NmVnoY6-fill-3" offset="100%" stop-color="%237ebf96"/></radialGradient><radialGradient id="eLjt8NmVnoY7-fill" cx="0" cy="0" r="1.112049" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(182.129 -94.016999 94.016999 182.129 43.4553 184.626)"><stop id="eLjt8NmVnoY7-fill-0" offset="0%" stop-color="%233f2d2d"/><stop id="eLjt8NmVnoY7-fill-1" offset="28%" stop-color="%23c83b35"/><stop id="eLjt8NmVnoY7-fill-2" offset="81%" stop-color="%23f69153"/><stop id="eLjt8NmVnoY7-fill-3" offset="100%" stop-color="%23ffe388"/></radialGradient><radialGradient id="eLjt8NmVnoY9-fill" cx="0" cy="0" r="593.59" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.196117 0.98058 -0.578542 -0.115709 406.499077 117.274778)"><stop id="eLjt8NmVnoY9-fill-0" offset="0%" stop-color="%23252d3a"/><stop id="eLjt8NmVnoY9-fill-1" offset="60%" stop-color="%23c50"/><stop id="eLjt8NmVnoY9-fill-2" offset="100%" stop-color="%23fddc85"/></radialGradient><radialGradient id="eLjt8NmVnoY10-fill" cx="0" cy="0" r="454.77" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="translate(87.33 340.7)"><stop id="eLjt8NmVnoY10-fill-0" offset="0%" stop-color="%23002936"/><stop id="eLjt8NmVnoY10-fill-1" offset="44%" stop-color="%23007aa1"/><stop id="eLjt8NmVnoY10-fill-2" offset="67%" stop-color="%2326ab7f"/><stop id="eLjt8NmVnoY10-fill-3" offset="100%" stop-color="%2395e0c8"/></radialGradient></defs><g transform="matrix(.339855 0 0 0.339855 65.056641 64.89012)"><path d="M337.93,111.85c17.31-4.12,30.6-2.15,38.55,5.96c12.9,13.16,10.13,41.58-7.64,77.95-34.66,70.98-116.01,153.37-181.35,183.6-4.15,1.92-8.16,3.6-12.02,5.03l.05.18C83.95,418.36,13.7,365.53,1.49,278.27C15.34,403.24,121.28,500.43,249.94,500.43c138.07,0,250-111.93,250-250c0-9.8-.58-19.46-1.68-28.96-12-82.27-75.81-133.5-160.33-109.62Z" fill="url(%23eLjt8NmVnoY9-fill)"/><path d="M249.94,0.43c-138.07,0-250,111.93-250,250c0,9.41.54,18.69,1.55,27.84C13.7,365.54,83.95,418.36,175.52,384.58l-.05-.18c-11.22,4.17-21.17,6.24-29.61,6.24-9.59,0-17.18-2.67-22.44-8.03-12.9-13.19-10.13-41.61,7.64-77.98c18.26-37.41,49.51-77.98,84.51-112.41c31.45-32.33,62.2-54.66,91.14-68.47.16-.08.34-.16.49-.23c1.74-.85,3.47-1.68,5.18-2.49c9.22-4.27,17.77-7.33,25.54-9.17c84.52-23.88,148.33,27.35,160.33,109.62C483.91,97.04,378.22,0.43,249.94,0.43Z" fill="url(%23eLjt8NmVnoY10-fill)"/><path d="M337.93,111.85c-7.77,1.84-16.32,4.9-25.54,9.17-1.71.8-3.45,1.63-5.18,2.49-.16.08-.34.16-.49.23-28.94,13.81-59.69,36.14-91.14,68.47-35,34.43-66.24,75-84.51,112.41-17.77,36.37-20.54,64.79-7.64,77.98c5.26,5.36,12.85,8.03,22.44,8.03c8.45,0,18.39-2.07,29.61-6.24c3.86-1.42,7.88-3.11,12.02-5.03c65.34-30.23,146.68-112.62,181.35-183.6c17.77-36.37,20.54-64.79,7.64-77.95-7.95-8.11-21.24-10.08-38.55-5.96h-.01Z" fill="%23252d3a"/></g></svg>%0D%0A';var dm=class extends wn{constructor(){super(...arguments);this.html=()=>`
|
|
313
313
|
|
|
314
314
|
<!-- Styling -->
|
|
315
315
|
<style>
|
|
@@ -362,12 +362,12 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
362
362
|
<!-- Logo -->
|
|
363
363
|
<img id='root' />
|
|
364
364
|
|
|
365
|
-
`;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),100)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let r=this.child("root");if(!r)return;let n=this.attr.logo||Lj;this._lastLogoSrc!=n&&(this._lastLogoSrc=n,r.src=n);let i=this.attr.focusID?document.getElementById(this.attr.focusID):null;if(i){let o=window.visualViewport?.offsetTop||0,s=window.visualViewport?.offsetLeft||0,a=i.getBoundingClientRect();if(!a)return;r.classList.add("focused-mode"),r.style.width="128px",r.style.height="128px",r.style.left=Math.round(a.x+a.width/2-128/2+s)+"px",r.style.top=Math.round(a.y+a.height/2-128/2+o)+"px"}else r.classList.remove("focused-mode"),r.style.width="",r.style.height="",r.style.left="",r.style.top=""}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};dm.observedAttributes=["logo","focusID"];var Uj=typeof self=="object"?self:globalThis,_7=(t,e)=>{let r=(i,o)=>(t.set(o,i),i),n=i=>{if(t.has(i))return t.get(i);let[o,s]=e[i];switch(o){case 0:case-1:return r(s,i);case 1:{let a=r([],i);for(let l of s)a.push(n(l));return a}case 2:{let a=r({},i);for(let[l,c]of s)a[n(l)]=n(c);return a}case 3:return r(new Date(s),i);case 4:{let{source:a,flags:l}=s;return r(new RegExp(a,l),i)}case 5:{let a=r(new Map,i);for(let[l,c]of s)a.set(n(l),n(c));return a}case 6:{let a=r(new Set,i);for(let l of s)a.add(n(l));return a}case 7:{let{name:a,message:l}=s;return r(new Uj[a](l),i)}case 8:return r(BigInt(s),i);case"BigInt":return r(Object(BigInt(s)),i)}return r(new Uj[o](s),i)};return n},AI=t=>_7(new Map,t)(0);var Gu="",{toString:v7}={},{keys:w7}=Object,hm=t=>{let e=typeof t;if(e!=="object"||!t)return[0,e];let r=v7.call(t).slice(8,-1);switch(r){case"Array":return[1,Gu];case"Object":return[2,Gu];case"Date":return[3,Gu];case"RegExp":return[4,Gu];case"Map":return[5,Gu];case"Set":return[6,Gu]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},Pb=([t,e])=>t===0&&(e==="function"||e==="symbol"),x7=(t,e,r,n)=>{let i=(s,a)=>{let l=n.push(s)-1;return r.set(a,l),l},o=s=>{if(r.has(s))return r.get(s);let[a,l]=hm(s);switch(a){case 0:{let u=s;switch(l){case"bigint":a=8,u=s.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([-1],s)}return i([a,u],s)}case 1:{if(l)return i([l,[...s]],s);let u=[],d=i([a,u],s);for(let p of s)u.push(o(p));return d}case 2:{if(l)switch(l){case"BigInt":return i([l,s.toString()],s);case"Boolean":case"Number":case"String":return i([l,s.valueOf()],s)}if(e&&"toJSON"in s)return o(s.toJSON());let u=[],d=i([a,u],s);for(let p of w7(s))(t||!Pb(hm(s[p])))&&u.push([o(p),o(s[p])]);return d}case 3:return i([a,s.toISOString()],s);case 4:{let{source:u,flags:d}=s;return i([a,{source:u,flags:d}],s)}case 5:{let u=[],d=i([a,u],s);for(let[p,f]of s)(t||!(Pb(hm(p))||Pb(hm(f))))&&u.push([o(p),o(f)]);return d}case 6:{let u=[],d=i([a,u],s);for(let p of s)(t||!Pb(hm(p)))&&u.push(o(p));return d}}let{message:c}=s;return i([a,{name:l,message:c}],s)};return o},CI=(t,{json:e,lossy:r}={})=>{let n=[];return x7(!(e||r),!!e,new Map,n)(t),n};var Di=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?AI(CI(t,e)):structuredClone(t):(t,e)=>AI(CI(t,e));var gm=(function(t,e,r,n,i){let o=Li(e);if(r!=null&&(typeof r!="number"||r<0||r===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(n!=null&&(!n.type||!n.children))throw new Error("Expected valid `parent`");if(r==null!=(n==null))throw new Error("Expected both `index` and `parent`");return Zj(t)?o.call(i,t,r,n):!1}),Li=(function(t){if(t==null)return $7;if(typeof t=="string")return S7(t);if(typeof t=="object")return k7(t);if(typeof t=="function")return zI(t);throw new Error("Expected function, string, or array as `test`")});function k7(t){let e=[],r=-1;for(;++r<t.length;)e[r]=Li(t[r]);return zI(n);function n(...i){let o=-1;for(;++o<e.length;)if(e[o].apply(this,i))return!0;return!1}}function S7(t){return zI(e);function e(r){return r.tagName===t}}function zI(t){return e;function e(r,n,i){return!!(Zj(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function $7(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function Zj(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}var I7=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,E7=/^[a-zA-Z]:\\/;function OI(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return E7.test(t)?!1:I7.test(t)}function Fj(t){let e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function Vj(t){return t.join(" ").trim()}var Ui=(function(t){if(t==null)return C7;if(typeof t=="function")return Tb(t);if(typeof t=="object")return Array.isArray(t)?P7(t):T7(t);if(typeof t=="string")return A7(t);throw new Error("Expected function, string, or object as test")});function P7(t){let e=[],r=-1;for(;++r<t.length;)e[r]=Ui(t[r]);return Tb(n);function n(...i){let o=-1;for(;++o<e.length;)if(e[o].apply(this,i))return!0;return!1}}function T7(t){let e=t;return Tb(r);function r(n){let i=n,o;for(o in t)if(i[o]!==e[o])return!1;return!0}}function A7(t){return Tb(e);function e(r){return r&&r.type===t}}function Tb(t){return e;function e(r,n,i){return!!(z7(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function C7(){return!0}function z7(t){return t!==null&&typeof t=="object"&&"type"in t}var qj=[],Ab=!0,ll=!1,Hu="skip";function cl(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;let o=Ui(i),s=n?-1:1;a(t,void 0,[])();function a(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=qj,m,h,y;if((!e||o(l,c,u[u.length-1]||void 0))&&(f=O7(r(l,u)),f[0]===ll))return f;if("children"in l&&l.children){let g=l;if(g.children&&f[0]!==Hu)for(h=(n?g.children.length:-1)+s,y=u.concat(g);h>-1&&h<g.children.length;){let b=g.children[h];if(m=a(b,h,y)(),m[0]===ll)return m;h=typeof m[1]=="number"?m[1]:h+s}}return f}}}function O7(t){return Array.isArray(t)?t:typeof t=="number"?[Ab,t]:t==null?qj:[t]}function zo(t,e,r,n){let i,o,s;typeof e=="function"&&typeof r!="function"?(o=void 0,s=e,i=r):(o=e,s=r,i=n),cl(t,o,a,i);function a(l,c){let u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return s(l,d,u)}}var R7=["http","https"],N7=["nofollow"],M7={};function bm(t){let e=t||M7,r=e.protocols||R7,n=Li(e.test);return function(i){zo(i,"element",function(o,s,a){if(o.tagName==="a"&&typeof o.properties.href=="string"&&n(o,s,a)){let l=o.properties.href;if(OI(l)?r.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=ym(e.content,o),u=c&&!Array.isArray(c)?[c]:c,d=ym(e.rel,o)||N7,p=typeof d=="string"?Fj(d):d,f=ym(e.target,o),m=ym(e.properties,o);if(m&&Object.assign(o.properties,Di(m)),p.length>0&&(o.properties.rel=[...p]),f&&(o.properties.target=f),u){let h=ym(e.contentProperties,o)||{};o.children.push({type:"element",tagName:"span",properties:Di(h),children:Di(u)})}}}})}}function ym(t,e){return typeof t=="function"?t(e):t}var ul=Li(function(t){return t.tagName==="audio"||t.tagName==="canvas"||t.tagName==="embed"||t.tagName==="iframe"||t.tagName==="img"||t.tagName==="math"||t.tagName==="object"||t.tagName==="picture"||t.tagName==="svg"||t.tagName==="video"});var j7=/[ \t\n\f\r]/g;function
|
|
365
|
+
`;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),100)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let r=this.child("root");if(!r)return;let n=this.attr.logo||Lj;this._lastLogoSrc!=n&&(this._lastLogoSrc=n,r.src=n);let i=this.attr.focusID?document.getElementById(this.attr.focusID):null;if(i){let o=window.visualViewport?.offsetTop||0,s=window.visualViewport?.offsetLeft||0,a=i.getBoundingClientRect();if(!a)return;r.classList.add("focused-mode"),r.style.width="128px",r.style.height="128px",r.style.left=Math.round(a.x+a.width/2-128/2+s)+"px",r.style.top=Math.round(a.y+a.height/2-128/2+o)+"px"}else r.classList.remove("focused-mode"),r.style.width="",r.style.height="",r.style.left="",r.style.top=""}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};dm.observedAttributes=["logo","focusID"];var Uj=typeof self=="object"?self:globalThis,_7=(t,e)=>{let r=(i,o)=>(t.set(o,i),i),n=i=>{if(t.has(i))return t.get(i);let[o,s]=e[i];switch(o){case 0:case-1:return r(s,i);case 1:{let a=r([],i);for(let l of s)a.push(n(l));return a}case 2:{let a=r({},i);for(let[l,c]of s)a[n(l)]=n(c);return a}case 3:return r(new Date(s),i);case 4:{let{source:a,flags:l}=s;return r(new RegExp(a,l),i)}case 5:{let a=r(new Map,i);for(let[l,c]of s)a.set(n(l),n(c));return a}case 6:{let a=r(new Set,i);for(let l of s)a.add(n(l));return a}case 7:{let{name:a,message:l}=s;return r(new Uj[a](l),i)}case 8:return r(BigInt(s),i);case"BigInt":return r(Object(BigInt(s)),i)}return r(new Uj[o](s),i)};return n},AI=t=>_7(new Map,t)(0);var Gu="",{toString:v7}={},{keys:w7}=Object,hm=t=>{let e=typeof t;if(e!=="object"||!t)return[0,e];let r=v7.call(t).slice(8,-1);switch(r){case"Array":return[1,Gu];case"Object":return[2,Gu];case"Date":return[3,Gu];case"RegExp":return[4,Gu];case"Map":return[5,Gu];case"Set":return[6,Gu]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},Pb=([t,e])=>t===0&&(e==="function"||e==="symbol"),x7=(t,e,r,n)=>{let i=(s,a)=>{let l=n.push(s)-1;return r.set(a,l),l},o=s=>{if(r.has(s))return r.get(s);let[a,l]=hm(s);switch(a){case 0:{let u=s;switch(l){case"bigint":a=8,u=s.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([-1],s)}return i([a,u],s)}case 1:{if(l)return i([l,[...s]],s);let u=[],d=i([a,u],s);for(let p of s)u.push(o(p));return d}case 2:{if(l)switch(l){case"BigInt":return i([l,s.toString()],s);case"Boolean":case"Number":case"String":return i([l,s.valueOf()],s)}if(e&&"toJSON"in s)return o(s.toJSON());let u=[],d=i([a,u],s);for(let p of w7(s))(t||!Pb(hm(s[p])))&&u.push([o(p),o(s[p])]);return d}case 3:return i([a,s.toISOString()],s);case 4:{let{source:u,flags:d}=s;return i([a,{source:u,flags:d}],s)}case 5:{let u=[],d=i([a,u],s);for(let[p,f]of s)(t||!(Pb(hm(p))||Pb(hm(f))))&&u.push([o(p),o(f)]);return d}case 6:{let u=[],d=i([a,u],s);for(let p of s)(t||!Pb(hm(p)))&&u.push(o(p));return d}}let{message:c}=s;return i([a,{name:l,message:c}],s)};return o},CI=(t,{json:e,lossy:r}={})=>{let n=[];return x7(!(e||r),!!e,new Map,n)(t),n};var Di=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?AI(CI(t,e)):structuredClone(t):(t,e)=>AI(CI(t,e));var gm=(function(t,e,r,n,i){let o=Li(e);if(r!=null&&(typeof r!="number"||r<0||r===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(n!=null&&(!n.type||!n.children))throw new Error("Expected valid `parent`");if(r==null!=(n==null))throw new Error("Expected both `index` and `parent`");return Zj(t)?o.call(i,t,r,n):!1}),Li=(function(t){if(t==null)return $7;if(typeof t=="string")return S7(t);if(typeof t=="object")return k7(t);if(typeof t=="function")return zI(t);throw new Error("Expected function, string, or array as `test`")});function k7(t){let e=[],r=-1;for(;++r<t.length;)e[r]=Li(t[r]);return zI(n);function n(...i){let o=-1;for(;++o<e.length;)if(e[o].apply(this,i))return!0;return!1}}function S7(t){return zI(e);function e(r){return r.tagName===t}}function zI(t){return e;function e(r,n,i){return!!(Zj(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function $7(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function Zj(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}var I7=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,E7=/^[a-zA-Z]:\\/;function OI(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return E7.test(t)?!1:I7.test(t)}function Fj(t){let e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function Vj(t){return t.join(" ").trim()}var Ui=(function(t){if(t==null)return C7;if(typeof t=="function")return Tb(t);if(typeof t=="object")return Array.isArray(t)?P7(t):T7(t);if(typeof t=="string")return A7(t);throw new Error("Expected function, string, or object as test")});function P7(t){let e=[],r=-1;for(;++r<t.length;)e[r]=Ui(t[r]);return Tb(n);function n(...i){let o=-1;for(;++o<e.length;)if(e[o].apply(this,i))return!0;return!1}}function T7(t){let e=t;return Tb(r);function r(n){let i=n,o;for(o in t)if(i[o]!==e[o])return!1;return!0}}function A7(t){return Tb(e);function e(r){return r&&r.type===t}}function Tb(t){return e;function e(r,n,i){return!!(z7(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function C7(){return!0}function z7(t){return t!==null&&typeof t=="object"&&"type"in t}var qj=[],Ab=!0,ll=!1,Hu="skip";function cl(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;let o=Ui(i),s=n?-1:1;a(t,void 0,[])();function a(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=qj,m,h,y;if((!e||o(l,c,u[u.length-1]||void 0))&&(f=O7(r(l,u)),f[0]===ll))return f;if("children"in l&&l.children){let g=l;if(g.children&&f[0]!==Hu)for(h=(n?g.children.length:-1)+s,y=u.concat(g);h>-1&&h<g.children.length;){let b=g.children[h];if(m=a(b,h,y)(),m[0]===ll)return m;h=typeof m[1]=="number"?m[1]:h+s}}return f}}}function O7(t){return Array.isArray(t)?t:typeof t=="number"?[Ab,t]:t==null?qj:[t]}function zo(t,e,r,n){let i,o,s;typeof e=="function"&&typeof r!="function"?(o=void 0,s=e,i=r):(o=e,s=r,i=n),cl(t,o,a,i);function a(l,c){let u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return s(l,d,u)}}var R7=["http","https"],N7=["nofollow"],M7={};function bm(t){let e=t||M7,r=e.protocols||R7,n=Li(e.test);return function(i){zo(i,"element",function(o,s,a){if(o.tagName==="a"&&typeof o.properties.href=="string"&&n(o,s,a)){let l=o.properties.href;if(OI(l)?r.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=ym(e.content,o),u=c&&!Array.isArray(c)?[c]:c,d=ym(e.rel,o)||N7,p=typeof d=="string"?Fj(d):d,f=ym(e.target,o),m=ym(e.properties,o);if(m&&Object.assign(o.properties,Di(m)),p.length>0&&(o.properties.rel=[...p]),f&&(o.properties.target=f),u){let h=ym(e.contentProperties,o)||{};o.children.push({type:"element",tagName:"span",properties:Di(h),children:Di(u)})}}}})}}function ym(t,e){return typeof t=="function"?t(e):t}var ul=Li(function(t){return t.tagName==="audio"||t.tagName==="canvas"||t.tagName==="embed"||t.tagName==="iframe"||t.tagName==="img"||t.tagName==="math"||t.tagName==="object"||t.tagName==="picture"||t.tagName==="svg"||t.tagName==="video"});var j7=/[ \t\n\f\r]/g;function xn(t){return typeof t=="object"?t.type==="text"?Bj(t.value):!1:Bj(t)}function Bj(t){return t.replace(j7,"")===""}var Wj=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"];var Gj=["button","input","select","textarea"];var Hj=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"];var D7={},RI=Ui(["comment","doctype"]);function NI(t,e){Kj(t,{collapse:B7((e||D7).newlines?V7:q7),whitespace:"normal"})}function Kj(t,e){if("children"in t){let r={...e};return(t.type==="root"||Qj(t))&&(r.before=!0,r.after=!0),r.whitespace=W7(t,e),U7(t,r)}if(t.type==="text"){if(e.whitespace==="normal")return L7(t,e);e.whitespace==="nowrap"&&(t.value=e.collapse(t.value))}return{ignore:RI(t),stripAtStart:!1,remove:!1}}function L7(t,e){let r=e.collapse(t.value),n={ignore:!1,stripAtStart:!1,remove:!1},i=0,o=r.length;return e.before&&Xj(r.charAt(0))&&i++,i!==o&&Xj(r.charAt(o-1))&&(e.after?o--:n.stripAtStart=!0),i===o?n.remove=!0:t.value=r.slice(i,o),n}function U7(t,e){let r=e.before,n=e.after,i=t.children,o=i.length,s=-1;for(;++s<o;){let a=Kj(i[s],{...e,after:Jj(i,s,n),before:r});a.remove?(i.splice(s,1),s--,o--):a.ignore||(r=a.stripAtStart),Yj(i[s])&&(r=!1)}return{ignore:!1,stripAtStart:!!(r||n),remove:!1}}function Jj(t,e,r){for(;++e<t.length;){let n=t[e],i=Z7(n);if(i===void 0&&"children"in n&&!F7(n)&&(i=Jj(n.children,-1)),typeof i=="boolean")return i}return r}function Z7(t){if(t.type==="element"){if(Yj(t))return!1;if(Qj(t))return!0}else if(t.type==="text"){if(!xn(t))return!1}else if(!RI(t))return!1}function Yj(t){return ul(t)||gm(t,Gj)}function Qj(t){return gm(t,Wj)}function F7(t){return!!(t.type==="element"&&t.properties.hidden)||RI(t)||gm(t,Hj)}function Xj(t){return t===" "||t===`
|
|
366
366
|
`}function V7(t){let e=/\r?\n|\r/.exec(t);return e?e[0]:" "}function q7(){return" "}function B7(t){return e;function e(r){return String(r).replace(/[\t\n\v\f\r ]+/g,t)}}function W7(t,e){if("tagName"in t&&t.properties)switch(t.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return t.properties.wrap?"pre-wrap":"pre";case"td":case"th":return t.properties.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap";default:}return e.whitespace}var G7={}.hasOwnProperty;function MI(t,e){let r=t.type==="element"&&G7.call(t.properties,e)&&t.properties[e];return r!=null&&r!==!1}var H7=new Set(["pingback","prefetch","stylesheet"]);function jI(t){if(t.type!=="element"||t.tagName!=="link")return!1;if(t.properties.itemProp)return!0;let e=t.properties.rel,r=-1;if(!Array.isArray(e)||e.length===0)return!1;for(;++r<e.length;)if(!H7.has(String(e[r])))return!1;return!0}var X7=Li(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),K7=Li("meta");function DI(t){return!!(t.type==="text"||X7(t)||ul(t)||jI(t)||K7(t)&&MI(t,"itemProp"))}var LI=["pre","script","style","textarea"];var J7={};function ZI(t,e){let r=e||J7,n={blanks:r.blanks||[],head:!1,indentInitial:r.indentInitial!==!1,indent:typeof r.indent=="number"?" ".repeat(r.indent):typeof r.indent=="string"?r.indent:" "};NI(t,{newlines:!0}),cl(t,i);function i(s,a){if(!("children"in s))return;if(s.type==="element"&&s.tagName==="head"&&(n.head=!0),n.head&&s.type==="element"&&s.tagName==="body"&&(n.head=!1),s.type==="element"&&LI.includes(s.tagName))return Hu;if(s.children.length===0||!UI(n,s))return;let l=a.length;n.indentInitial||l--;let c=!1;for(let p of s.children)(p.type==="comment"||p.type==="text")&&(p.value.includes(`
|
|
367
|
-
`)&&(c=!0),p.value=p.value.replace(/ *\n/g,"$&"+n.indent.repeat(l)));let u=[],d;for(let p of s.children)(UI(n,p)||c&&!d)&&(o(u,l,p),c=!0),d=p,u.push(p);d&&(c||UI(n,d))&&(
|
|
367
|
+
`)&&(c=!0),p.value=p.value.replace(/ *\n/g,"$&"+n.indent.repeat(l)));let u=[],d;for(let p of s.children)(UI(n,p)||c&&!d)&&(o(u,l,p),c=!0),d=p,u.push(p);d&&(c||UI(n,d))&&(xn(d)&&(u.pop(),d=u[u.length-1]),o(u,l-1)),s.children=u}function o(s,a,l){let c=s[s.length-1],u=c&&xn(c)?s[s.length-2]:c,d=(eD(n,u)&&eD(n,l)?`
|
|
368
368
|
|
|
369
369
|
`:`
|
|
370
|
-
`)+n.indent.repeat(Math.max(a,0));c&&c.type==="text"?c.value=wn(c)?d:c.value+d:s.push({type:"text",value:d})}}function eD(t,e){return!!(e&&e.type==="element"&&t.blanks.length>0&&t.blanks.includes(e.tagName))}function UI(t,e){return e.type==="root"||(e.type==="element"?t.head||e.tagName==="script"||ul(e)||!DI(e):!1)}function _m(t){return function(e){ZI(e,t)}}var tD=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Oo=class{constructor(e,r,n){this.property=e,this.normal=r,n&&(this.space=n)}};Oo.prototype.property={};Oo.prototype.normal={};Oo.prototype.space=null;function FI(t,e){let r={},n={},i=-1;for(;++i<t.length;)Object.assign(r,t[i].property),Object.assign(n,t[i].normal);return new Oo(r,n,e)}function vm(t){return t.toLowerCase()}var zr=class{constructor(e,r){this.property=e,this.attribute=r}};zr.prototype.space=null;zr.prototype.boolean=!1;zr.prototype.booleanish=!1;zr.prototype.overloadedBoolean=!1;zr.prototype.number=!1;zr.prototype.commaSeparated=!1;zr.prototype.spaceSeparated=!1;zr.prototype.commaOrSpaceSeparated=!1;zr.prototype.mustUseProperty=!1;zr.prototype.defined=!1;var wm={};gd(wm,{boolean:()=>Ee,booleanish:()=>Rt,commaOrSpaceSeparated:()=>nn,commaSeparated:()=>Ns,number:()=>U,overloadedBoolean:()=>VI,spaceSeparated:()=>it});var Y7=0,Ee=dl(),Rt=dl(),VI=dl(),U=dl(),it=dl(),Ns=dl(),nn=dl();function dl(){return 2**++Y7}var qI=Object.keys(wm),fl=class extends zr{constructor(e,r,n,i){let o=-1;if(super(e,r),rD(this,"space",i),typeof n=="number")for(;++o<qI.length;){let s=qI[o];rD(this,qI[o],(n&wm[s])===wm[s])}}};fl.prototype.defined=!0;function rD(t,e,r){r&&(t[e]=r)}var Q7={}.hasOwnProperty;function Fn(t){let e={},r={},n;for(n in t.properties)if(Q7.call(t.properties,n)){let i=t.properties[n],o=new fl(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(o.mustUseProperty=!0),e[n]=o,r[vm(n)]=n,r[vm(o.attribute)]=n}return new Oo(e,r,t.space)}var BI=Fn({space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var WI=Fn({space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Cb(t,e){return e in t?t[e]:e}function zb(t,e){return Cb(t,e.toLowerCase())}var GI=Fn({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:zb,properties:{xmlns:null,xmlnsXLink:null}});var HI=Fn({transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:Rt,ariaAutoComplete:null,ariaBusy:Rt,ariaChecked:Rt,ariaColCount:U,ariaColIndex:U,ariaColSpan:U,ariaControls:it,ariaCurrent:null,ariaDescribedBy:it,ariaDetails:null,ariaDisabled:Rt,ariaDropEffect:it,ariaErrorMessage:null,ariaExpanded:Rt,ariaFlowTo:it,ariaGrabbed:Rt,ariaHasPopup:null,ariaHidden:Rt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:it,ariaLevel:U,ariaLive:null,ariaModal:Rt,ariaMultiLine:Rt,ariaMultiSelectable:Rt,ariaOrientation:null,ariaOwns:it,ariaPlaceholder:null,ariaPosInSet:U,ariaPressed:Rt,ariaReadOnly:Rt,ariaRelevant:null,ariaRequired:Rt,ariaRoleDescription:it,ariaRowCount:U,ariaRowIndex:U,ariaRowSpan:U,ariaSelected:Rt,ariaSetSize:U,ariaSort:null,ariaValueMax:U,ariaValueMin:U,ariaValueNow:U,ariaValueText:null,role:null}});var nD=Fn({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:zb,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ns,acceptCharset:it,accessKey:it,action:null,allow:null,allowFullScreen:Ee,allowPaymentRequest:Ee,allowUserMedia:Ee,alt:null,as:null,async:Ee,autoCapitalize:null,autoComplete:it,autoFocus:Ee,autoPlay:Ee,blocking:it,capture:null,charSet:null,checked:Ee,cite:null,className:it,cols:U,colSpan:null,content:null,contentEditable:Rt,controls:Ee,controlsList:it,coords:U|Ns,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ee,defer:Ee,dir:null,dirName:null,disabled:Ee,download:VI,draggable:Rt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ee,formTarget:null,headers:it,height:U,hidden:Ee,high:U,href:null,hrefLang:null,htmlFor:it,httpEquiv:it,id:null,imageSizes:null,imageSrcSet:null,inert:Ee,inputMode:null,integrity:null,is:null,isMap:Ee,itemId:null,itemProp:it,itemRef:it,itemScope:Ee,itemType:it,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ee,low:U,manifest:null,max:null,maxLength:U,media:null,method:null,min:null,minLength:U,multiple:Ee,muted:Ee,name:null,nonce:null,noModule:Ee,noValidate:Ee,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ee,optimum:U,pattern:null,ping:it,placeholder:null,playsInline:Ee,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ee,referrerPolicy:null,rel:it,required:Ee,reversed:Ee,rows:U,rowSpan:U,sandbox:it,scope:null,scoped:Ee,seamless:Ee,selected:Ee,shadowRootClonable:Ee,shadowRootDelegatesFocus:Ee,shadowRootMode:null,shape:null,size:U,sizes:null,slot:null,span:U,spellCheck:Rt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:U,step:null,style:null,tabIndex:U,target:null,title:null,translate:null,type:null,typeMustMatch:Ee,useMap:null,value:Rt,width:U,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:it,axis:null,background:null,bgColor:null,border:U,borderColor:null,bottomMargin:U,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ee,declare:Ee,event:null,face:null,frame:null,frameBorder:null,hSpace:U,leftMargin:U,link:null,longDesc:null,lowSrc:null,marginHeight:U,marginWidth:U,noResize:Ee,noHref:Ee,noShade:Ee,noWrap:Ee,object:null,profile:null,prompt:null,rev:null,rightMargin:U,rules:null,scheme:null,scrolling:Rt,standby:null,summary:null,text:null,topMargin:U,valueType:null,version:null,vAlign:null,vLink:null,vSpace:U,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ee,disableRemotePlayback:Ee,prefix:null,property:null,results:U,security:null,unselectable:null}});var iD=Fn({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:Cb,properties:{about:nn,accentHeight:U,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:U,amplitude:U,arabicForm:null,ascent:U,attributeName:null,attributeType:null,azimuth:U,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:U,by:null,calcMode:null,capHeight:U,className:it,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:U,diffuseConstant:U,direction:null,display:null,dur:null,divisor:U,dominantBaseline:null,download:Ee,dx:null,dy:null,edgeMode:null,editable:null,elevation:U,enableBackground:null,end:null,event:null,exponent:U,externalResourcesRequired:null,fill:null,fillOpacity:U,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ns,g2:Ns,glyphName:Ns,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:U,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:U,horizOriginX:U,horizOriginY:U,id:null,ideographic:U,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:U,k:U,k1:U,k2:U,k3:U,k4:U,kernelMatrix:nn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:U,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:U,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:U,overlineThickness:U,paintOrder:null,panose1:null,path:null,pathLength:U,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:it,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:U,pointsAtY:U,pointsAtZ:U,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:nn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:nn,rev:nn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:nn,requiredFeatures:nn,requiredFonts:nn,requiredFormats:nn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:U,specularExponent:U,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:U,strikethroughThickness:U,string:null,stroke:null,strokeDashArray:nn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:U,strokeOpacity:U,strokeWidth:null,style:null,surfaceScale:U,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:nn,tabIndex:U,tableValues:null,target:null,targetX:U,targetY:U,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:nn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:U,underlineThickness:U,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:U,values:null,vAlphabetic:U,vMathematical:U,vectorEffect:null,vHanging:U,vIdeographic:U,version:null,vertAdvY:U,vertOriginX:U,vertOriginY:U,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:U,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var eY=/^data[-\w.:]+$/i,oD=/-[a-z]/g,tY=/[A-Z]/g;function XI(t,e){let r=vm(e),n=e,i=zr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&eY.test(e)){if(e.charAt(4)==="-"){let o=e.slice(5).replace(oD,nY);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{let o=e.slice(4);if(!oD.test(o)){let s=o.replace(tY,rY);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=fl}return new i(n,e)}function rY(t){return"-"+t.toLowerCase()}function nY(t){return t.charAt(1).toUpperCase()}var sD=FI([WI,BI,GI,HI,nD],"html"),Ob=FI([WI,BI,GI,HI,iD],"svg");var aD={}.hasOwnProperty;function lD(t,e){let r=e||{};function n(i,...o){let s=n.invalid,a=n.handlers;if(i&&aD.call(i,t)){let l=String(i[t]);s=aD.call(a,l)?a[l]:n.unknown}if(s)return s.call(this,i,...o)}return n.handlers=r.handlers||{},n.invalid=r.invalid,n.unknown=r.unknown,n}var iY=/["&'<>`]/g,oY=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,sY=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,aY=/[|\\{}()[\]^$+*?.]/g,cD=new WeakMap;function uD(t,e){if(t=t.replace(e.subset?lY(e.subset):iY,n),e.subset||e.escapeOnly)return t;return t.replace(oY,r).replace(sY,n);function r(i,o,s){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,s.charCodeAt(o+2),e)}function n(i,o,s){return e.format(i.charCodeAt(0),s.charCodeAt(o+1),e)}}function lY(t){let e=cD.get(t);return e||(e=cY(t),cD.set(t,e)),e}function cY(t){let e=[],r=-1;for(;++r<t.length;)e.push(t[r].replace(aY,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var uY=/[\dA-Fa-f]/;function dD(t,e,r){let n="&#x"+t.toString(16).toUpperCase();return r&&e&&!uY.test(String.fromCharCode(e))?n:n+";"}var dY=/\d/;function fD(t,e,r){let n="&#"+String(t);return r&&e&&!dY.test(String.fromCharCode(e))?n:n+";"}var pD=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var Rb={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var mD=["cent","copy","divide","gt","lt","not","para","times"];var hD={}.hasOwnProperty,KI={},Nb;for(Nb in Rb)hD.call(Rb,Nb)&&(KI[Rb[Nb]]=Nb);var fY=/[^\dA-Za-z]/;function gD(t,e,r,n){let i=String.fromCharCode(t);if(hD.call(KI,i)){let o=KI[i],s="&"+o;return r&&pD.includes(o)&&!mD.includes(o)&&(!n||e&&e!==61&&fY.test(String.fromCharCode(e)))?s:s+";"}return""}function yD(t,e,r){let n=dD(t,e,r.omitOptionalSemicolons),i;if((r.useNamedReferences||r.useShortestReferences)&&(i=gD(t,e,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!i)&&r.useShortestReferences){let o=fD(t,e,r.omitOptionalSemicolons);o.length<n.length&&(n=o)}return i&&(!r.useShortestReferences||i.length<n.length)?i:n}function Ro(t,e){return uD(t,Object.assign({format:yD},e))}var pY=/^>|^->|<!--|-->|--!>|<!-$/g,mY=[">"],hY=["<",">"];function bD(t,e,r,n){return n.settings.bogusComments?"<?"+Ro(t.value,Object.assign({},n.settings.characterReferences,{subset:mY}))+">":"<!--"+t.value.replace(pY,i)+"-->";function i(o){return Ro(o,Object.assign({},n.settings.characterReferences,{subset:hY}))}}function _D(t,e,r,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"}function Xu(t,e){let r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(e);for(;i!==-1;)n++,i=r.indexOf(e,i+e.length);return n}function vD(t,e){let r=e||{};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}var Zt=wD(1),JI=wD(-1),gY=[];function wD(t){return e;function e(r,n,i){let o=r?r.children:gY,s=(n||0)+t,a=o[s];if(!i)for(;a&&wn(a);)s+=t,a=o[s];return a}}var yY={}.hasOwnProperty;function Mb(t){return e;function e(r,n,i){return yY.call(t,r.tagName)&&t[r.tagName](r,n,i)}}var xm=Mb({body:_Y,caption:YI,colgroup:YI,dd:kY,dt:xY,head:YI,html:bY,li:wY,optgroup:SY,option:$Y,p:vY,rp:xD,rt:xD,tbody:EY,td:kD,tfoot:PY,th:kD,thead:IY,tr:TY});function YI(t,e,r){let n=Zt(r,e,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&wn(n.value.charAt(0)))}function bY(t,e,r){let n=Zt(r,e);return!n||n.type!=="comment"}function _Y(t,e,r){let n=Zt(r,e);return!n||n.type!=="comment"}function vY(t,e,r){let n=Zt(r,e);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!r||!(r.type==="element"&&(r.tagName==="a"||r.tagName==="audio"||r.tagName==="del"||r.tagName==="ins"||r.tagName==="map"||r.tagName==="noscript"||r.tagName==="video"))}function wY(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&n.tagName==="li"}function xY(t,e,r){let n=Zt(r,e);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function kY(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function xD(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function SY(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&n.tagName==="optgroup"}function $Y(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function IY(t,e,r){let n=Zt(r,e);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function EY(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function PY(t,e,r){return!Zt(r,e)}function TY(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&n.tagName==="tr"}function kD(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}var SD=Mb({body:zY,colgroup:OY,head:CY,html:AY,tbody:RY});function AY(t){let e=Zt(t,-1);return!e||e.type!=="comment"}function CY(t){let e=t.children,r=[],n=-1;for(;++n<e.length;){let i=e[n];if(i.type==="element"&&(i.tagName==="title"||i.tagName==="base")){if(r.includes(i.tagName))return!1;r.push(i.tagName)}}return e.length>0}function zY(t){let e=Zt(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&wn(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function OY(t,e,r){let n=JI(r,e),i=Zt(t,-1,!0);return r&&n&&n.type==="element"&&n.tagName==="colgroup"&&xm(n,r.children.indexOf(n),r)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function RY(t,e,r){let n=JI(r,e),i=Zt(t,-1);return r&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&xm(n,r.children.indexOf(n),r)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}var jb={name:[[`
|
|
370
|
+
`)+n.indent.repeat(Math.max(a,0));c&&c.type==="text"?c.value=xn(c)?d:c.value+d:s.push({type:"text",value:d})}}function eD(t,e){return!!(e&&e.type==="element"&&t.blanks.length>0&&t.blanks.includes(e.tagName))}function UI(t,e){return e.type==="root"||(e.type==="element"?t.head||e.tagName==="script"||ul(e)||!DI(e):!1)}function _m(t){return function(e){ZI(e,t)}}var tD=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Oo=class{constructor(e,r,n){this.property=e,this.normal=r,n&&(this.space=n)}};Oo.prototype.property={};Oo.prototype.normal={};Oo.prototype.space=null;function FI(t,e){let r={},n={},i=-1;for(;++i<t.length;)Object.assign(r,t[i].property),Object.assign(n,t[i].normal);return new Oo(r,n,e)}function vm(t){return t.toLowerCase()}var zr=class{constructor(e,r){this.property=e,this.attribute=r}};zr.prototype.space=null;zr.prototype.boolean=!1;zr.prototype.booleanish=!1;zr.prototype.overloadedBoolean=!1;zr.prototype.number=!1;zr.prototype.commaSeparated=!1;zr.prototype.spaceSeparated=!1;zr.prototype.commaOrSpaceSeparated=!1;zr.prototype.mustUseProperty=!1;zr.prototype.defined=!1;var wm={};gd(wm,{boolean:()=>Ee,booleanish:()=>Rt,commaOrSpaceSeparated:()=>nn,commaSeparated:()=>Ns,number:()=>U,overloadedBoolean:()=>VI,spaceSeparated:()=>it});var Y7=0,Ee=dl(),Rt=dl(),VI=dl(),U=dl(),it=dl(),Ns=dl(),nn=dl();function dl(){return 2**++Y7}var qI=Object.keys(wm),fl=class extends zr{constructor(e,r,n,i){let o=-1;if(super(e,r),rD(this,"space",i),typeof n=="number")for(;++o<qI.length;){let s=qI[o];rD(this,qI[o],(n&wm[s])===wm[s])}}};fl.prototype.defined=!0;function rD(t,e,r){r&&(t[e]=r)}var Q7={}.hasOwnProperty;function Fn(t){let e={},r={},n;for(n in t.properties)if(Q7.call(t.properties,n)){let i=t.properties[n],o=new fl(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(o.mustUseProperty=!0),e[n]=o,r[vm(n)]=n,r[vm(o.attribute)]=n}return new Oo(e,r,t.space)}var BI=Fn({space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var WI=Fn({space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Cb(t,e){return e in t?t[e]:e}function zb(t,e){return Cb(t,e.toLowerCase())}var GI=Fn({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:zb,properties:{xmlns:null,xmlnsXLink:null}});var HI=Fn({transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:Rt,ariaAutoComplete:null,ariaBusy:Rt,ariaChecked:Rt,ariaColCount:U,ariaColIndex:U,ariaColSpan:U,ariaControls:it,ariaCurrent:null,ariaDescribedBy:it,ariaDetails:null,ariaDisabled:Rt,ariaDropEffect:it,ariaErrorMessage:null,ariaExpanded:Rt,ariaFlowTo:it,ariaGrabbed:Rt,ariaHasPopup:null,ariaHidden:Rt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:it,ariaLevel:U,ariaLive:null,ariaModal:Rt,ariaMultiLine:Rt,ariaMultiSelectable:Rt,ariaOrientation:null,ariaOwns:it,ariaPlaceholder:null,ariaPosInSet:U,ariaPressed:Rt,ariaReadOnly:Rt,ariaRelevant:null,ariaRequired:Rt,ariaRoleDescription:it,ariaRowCount:U,ariaRowIndex:U,ariaRowSpan:U,ariaSelected:Rt,ariaSetSize:U,ariaSort:null,ariaValueMax:U,ariaValueMin:U,ariaValueNow:U,ariaValueText:null,role:null}});var nD=Fn({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:zb,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ns,acceptCharset:it,accessKey:it,action:null,allow:null,allowFullScreen:Ee,allowPaymentRequest:Ee,allowUserMedia:Ee,alt:null,as:null,async:Ee,autoCapitalize:null,autoComplete:it,autoFocus:Ee,autoPlay:Ee,blocking:it,capture:null,charSet:null,checked:Ee,cite:null,className:it,cols:U,colSpan:null,content:null,contentEditable:Rt,controls:Ee,controlsList:it,coords:U|Ns,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ee,defer:Ee,dir:null,dirName:null,disabled:Ee,download:VI,draggable:Rt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ee,formTarget:null,headers:it,height:U,hidden:Ee,high:U,href:null,hrefLang:null,htmlFor:it,httpEquiv:it,id:null,imageSizes:null,imageSrcSet:null,inert:Ee,inputMode:null,integrity:null,is:null,isMap:Ee,itemId:null,itemProp:it,itemRef:it,itemScope:Ee,itemType:it,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ee,low:U,manifest:null,max:null,maxLength:U,media:null,method:null,min:null,minLength:U,multiple:Ee,muted:Ee,name:null,nonce:null,noModule:Ee,noValidate:Ee,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ee,optimum:U,pattern:null,ping:it,placeholder:null,playsInline:Ee,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ee,referrerPolicy:null,rel:it,required:Ee,reversed:Ee,rows:U,rowSpan:U,sandbox:it,scope:null,scoped:Ee,seamless:Ee,selected:Ee,shadowRootClonable:Ee,shadowRootDelegatesFocus:Ee,shadowRootMode:null,shape:null,size:U,sizes:null,slot:null,span:U,spellCheck:Rt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:U,step:null,style:null,tabIndex:U,target:null,title:null,translate:null,type:null,typeMustMatch:Ee,useMap:null,value:Rt,width:U,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:it,axis:null,background:null,bgColor:null,border:U,borderColor:null,bottomMargin:U,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ee,declare:Ee,event:null,face:null,frame:null,frameBorder:null,hSpace:U,leftMargin:U,link:null,longDesc:null,lowSrc:null,marginHeight:U,marginWidth:U,noResize:Ee,noHref:Ee,noShade:Ee,noWrap:Ee,object:null,profile:null,prompt:null,rev:null,rightMargin:U,rules:null,scheme:null,scrolling:Rt,standby:null,summary:null,text:null,topMargin:U,valueType:null,version:null,vAlign:null,vLink:null,vSpace:U,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ee,disableRemotePlayback:Ee,prefix:null,property:null,results:U,security:null,unselectable:null}});var iD=Fn({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:Cb,properties:{about:nn,accentHeight:U,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:U,amplitude:U,arabicForm:null,ascent:U,attributeName:null,attributeType:null,azimuth:U,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:U,by:null,calcMode:null,capHeight:U,className:it,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:U,diffuseConstant:U,direction:null,display:null,dur:null,divisor:U,dominantBaseline:null,download:Ee,dx:null,dy:null,edgeMode:null,editable:null,elevation:U,enableBackground:null,end:null,event:null,exponent:U,externalResourcesRequired:null,fill:null,fillOpacity:U,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ns,g2:Ns,glyphName:Ns,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:U,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:U,horizOriginX:U,horizOriginY:U,id:null,ideographic:U,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:U,k:U,k1:U,k2:U,k3:U,k4:U,kernelMatrix:nn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:U,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:U,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:U,overlineThickness:U,paintOrder:null,panose1:null,path:null,pathLength:U,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:it,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:U,pointsAtY:U,pointsAtZ:U,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:nn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:nn,rev:nn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:nn,requiredFeatures:nn,requiredFonts:nn,requiredFormats:nn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:U,specularExponent:U,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:U,strikethroughThickness:U,string:null,stroke:null,strokeDashArray:nn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:U,strokeOpacity:U,strokeWidth:null,style:null,surfaceScale:U,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:nn,tabIndex:U,tableValues:null,target:null,targetX:U,targetY:U,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:nn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:U,underlineThickness:U,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:U,values:null,vAlphabetic:U,vMathematical:U,vectorEffect:null,vHanging:U,vIdeographic:U,version:null,vertAdvY:U,vertOriginX:U,vertOriginY:U,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:U,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var eY=/^data[-\w.:]+$/i,oD=/-[a-z]/g,tY=/[A-Z]/g;function XI(t,e){let r=vm(e),n=e,i=zr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&eY.test(e)){if(e.charAt(4)==="-"){let o=e.slice(5).replace(oD,nY);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{let o=e.slice(4);if(!oD.test(o)){let s=o.replace(tY,rY);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=fl}return new i(n,e)}function rY(t){return"-"+t.toLowerCase()}function nY(t){return t.charAt(1).toUpperCase()}var sD=FI([WI,BI,GI,HI,nD],"html"),Ob=FI([WI,BI,GI,HI,iD],"svg");var aD={}.hasOwnProperty;function lD(t,e){let r=e||{};function n(i,...o){let s=n.invalid,a=n.handlers;if(i&&aD.call(i,t)){let l=String(i[t]);s=aD.call(a,l)?a[l]:n.unknown}if(s)return s.call(this,i,...o)}return n.handlers=r.handlers||{},n.invalid=r.invalid,n.unknown=r.unknown,n}var iY=/["&'<>`]/g,oY=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,sY=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,aY=/[|\\{}()[\]^$+*?.]/g,cD=new WeakMap;function uD(t,e){if(t=t.replace(e.subset?lY(e.subset):iY,n),e.subset||e.escapeOnly)return t;return t.replace(oY,r).replace(sY,n);function r(i,o,s){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,s.charCodeAt(o+2),e)}function n(i,o,s){return e.format(i.charCodeAt(0),s.charCodeAt(o+1),e)}}function lY(t){let e=cD.get(t);return e||(e=cY(t),cD.set(t,e)),e}function cY(t){let e=[],r=-1;for(;++r<t.length;)e.push(t[r].replace(aY,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var uY=/[\dA-Fa-f]/;function dD(t,e,r){let n="&#x"+t.toString(16).toUpperCase();return r&&e&&!uY.test(String.fromCharCode(e))?n:n+";"}var dY=/\d/;function fD(t,e,r){let n="&#"+String(t);return r&&e&&!dY.test(String.fromCharCode(e))?n:n+";"}var pD=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var Rb={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var mD=["cent","copy","divide","gt","lt","not","para","times"];var hD={}.hasOwnProperty,KI={},Nb;for(Nb in Rb)hD.call(Rb,Nb)&&(KI[Rb[Nb]]=Nb);var fY=/[^\dA-Za-z]/;function gD(t,e,r,n){let i=String.fromCharCode(t);if(hD.call(KI,i)){let o=KI[i],s="&"+o;return r&&pD.includes(o)&&!mD.includes(o)&&(!n||e&&e!==61&&fY.test(String.fromCharCode(e)))?s:s+";"}return""}function yD(t,e,r){let n=dD(t,e,r.omitOptionalSemicolons),i;if((r.useNamedReferences||r.useShortestReferences)&&(i=gD(t,e,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!i)&&r.useShortestReferences){let o=fD(t,e,r.omitOptionalSemicolons);o.length<n.length&&(n=o)}return i&&(!r.useShortestReferences||i.length<n.length)?i:n}function Ro(t,e){return uD(t,Object.assign({format:yD},e))}var pY=/^>|^->|<!--|-->|--!>|<!-$/g,mY=[">"],hY=["<",">"];function bD(t,e,r,n){return n.settings.bogusComments?"<?"+Ro(t.value,Object.assign({},n.settings.characterReferences,{subset:mY}))+">":"<!--"+t.value.replace(pY,i)+"-->";function i(o){return Ro(o,Object.assign({},n.settings.characterReferences,{subset:hY}))}}function _D(t,e,r,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"}function Xu(t,e){let r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(e);for(;i!==-1;)n++,i=r.indexOf(e,i+e.length);return n}function vD(t,e){let r=e||{};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}var Zt=wD(1),JI=wD(-1),gY=[];function wD(t){return e;function e(r,n,i){let o=r?r.children:gY,s=(n||0)+t,a=o[s];if(!i)for(;a&&xn(a);)s+=t,a=o[s];return a}}var yY={}.hasOwnProperty;function Mb(t){return e;function e(r,n,i){return yY.call(t,r.tagName)&&t[r.tagName](r,n,i)}}var xm=Mb({body:_Y,caption:YI,colgroup:YI,dd:kY,dt:xY,head:YI,html:bY,li:wY,optgroup:SY,option:$Y,p:vY,rp:xD,rt:xD,tbody:EY,td:kD,tfoot:PY,th:kD,thead:IY,tr:TY});function YI(t,e,r){let n=Zt(r,e,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&xn(n.value.charAt(0)))}function bY(t,e,r){let n=Zt(r,e);return!n||n.type!=="comment"}function _Y(t,e,r){let n=Zt(r,e);return!n||n.type!=="comment"}function vY(t,e,r){let n=Zt(r,e);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!r||!(r.type==="element"&&(r.tagName==="a"||r.tagName==="audio"||r.tagName==="del"||r.tagName==="ins"||r.tagName==="map"||r.tagName==="noscript"||r.tagName==="video"))}function wY(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&n.tagName==="li"}function xY(t,e,r){let n=Zt(r,e);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function kY(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function xD(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function SY(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&n.tagName==="optgroup"}function $Y(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function IY(t,e,r){let n=Zt(r,e);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function EY(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function PY(t,e,r){return!Zt(r,e)}function TY(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&n.tagName==="tr"}function kD(t,e,r){let n=Zt(r,e);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}var SD=Mb({body:zY,colgroup:OY,head:CY,html:AY,tbody:RY});function AY(t){let e=Zt(t,-1);return!e||e.type!=="comment"}function CY(t){let e=t.children,r=[],n=-1;for(;++n<e.length;){let i=e[n];if(i.type==="element"&&(i.tagName==="title"||i.tagName==="base")){if(r.includes(i.tagName))return!1;r.push(i.tagName)}}return e.length>0}function zY(t){let e=Zt(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&xn(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function OY(t,e,r){let n=JI(r,e),i=Zt(t,-1,!0);return r&&n&&n.type==="element"&&n.tagName==="colgroup"&&xm(n,r.children.indexOf(n),r)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function RY(t,e,r){let n=JI(r,e),i=Zt(t,-1);return r&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&xm(n,r.children.indexOf(n),r)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}var jb={name:[[`
|
|
371
371
|
\f\r &/=>`.split(""),`
|
|
372
372
|
\f\r "&'/=>\``.split("")],[`\0
|
|
373
373
|
\f\r "&'/<=>`.split(""),`\0
|
|
@@ -392,7 +392,7 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
392
392
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:s,tableCell:l,tableRow:a}};function s(f,m,h,y){return c(u(f,h,y),f.align)}function a(f,m,h,y){let g=d(f,h,y),b=c([g]);return b.slice(0,b.indexOf(`
|
|
393
393
|
`))}function l(f,m,h,y){let g=h.enter("tableCell"),b=h.enter("phrasing"),v=h.containerPhrasing(f,{...y,before:o,after:o});return b(),g(),v}function c(f,m){return jD(f,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function u(f,m,h){let y=f.children,g=-1,b=[],v=m.enter("table");for(;++g<y.length;)b[g]=d(y[g],m,h);return v(),b}function d(f,m,h){let y=f.children,g=-1,b=[],v=m.enter("tableRow");for(;++g<y.length;)b[g]=l(y[g],f,m,h);return v(),b}function p(f,m,h){let y=$m.inlineCode(f,m,h);return h.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function $1(){return{exit:{taskListCheckValueChecked:d4,taskListCheckValueUnchecked:d4,paragraph:LQ}}}function I1(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:UQ}}}function d4(t){let e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function LQ(t){let e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){let r=this.stack[this.stack.length-1];r.type;let n=r.children[0];if(n&&n.type==="text"){let i=e.children,o=-1,s;for(;++o<i.length;){let a=i[o];if(a.type==="paragraph"){s=a;break}}s===r&&(n.value=n.value.slice(1),n.value.length===0?r.children.shift():r.position&&n.position&&typeof n.position.start.offset=="number"&&(n.position.start.column++,n.position.start.offset++,r.position.start=Object.assign({},n.position.start)))}}this.exit(t)}function UQ(t,e,r,n){let i=t.children[0],o=typeof t.checked=="boolean"&&i&&i.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",a=r.createTracker(n);o&&a.move(s);let l=$m.listItem(t,e,r,{...n,...a.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+s}}function E1(){return[o1(),a1(),c1(),k1(),$1()]}function P1(t){return{extensions:[s1(),l1(t),u1(),S1(t),I1()]}}function Gt(t,e,r,n){let i=t.length,o=0,s;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,r=r>0?r:0,n.length<1e4)s=Array.from(n),s.unshift(e,r),t.splice(...s);else for(r&&t.splice(e,r);o<n.length;)s=n.slice(o,o+1e4),s.unshift(e,0),t.splice(...s),o+=1e4,e+=1e4}function qr(t,e){return t.length>0?(Gt(t,t.length,0,e),t):e}var f4={}.hasOwnProperty;function Zb(t){let e={},r=-1;for(;++r<t.length;)ZQ(e,t[r]);return e}function ZQ(t,e){let r;for(r in e){let i=(f4.call(t,r)?t[r]:void 0)||(t[r]={}),o=e[r],s;if(o)for(s in o){f4.call(i,s)||(i[s]=[]);let a=o[s];FQ(i[s],Array.isArray(a)?a:a?[a]:[])}}}function FQ(t,e){let r=-1,n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);Gt(t,0,0,n)}var VQ={tokenize:HQ,partial:!0},p4={tokenize:XQ,partial:!0},m4={tokenize:KQ,partial:!0},h4={tokenize:JQ,partial:!0},qQ={tokenize:YQ,partial:!0},g4={name:"wwwAutolink",tokenize:WQ,previous:b4},y4={name:"protocolAutolink",tokenize:GQ,previous:_4},Mo={name:"emailAutolink",tokenize:BQ,previous:v4},Fi={};function A1(){return{text:Fi}}var gl=48;for(;gl<123;)Fi[gl]=Mo,gl++,gl===58?gl=65:gl===91&&(gl=97);Fi[43]=Mo;Fi[45]=Mo;Fi[46]=Mo;Fi[95]=Mo;Fi[72]=[Mo,y4];Fi[104]=[Mo,y4];Fi[87]=[Mo,g4];Fi[119]=[Mo,g4];function BQ(t,e,r){let n=this,i,o;return s;function s(d){return!T1(d)||!v4.call(n,n.previous)||C1(n.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return T1(d)?(t.consume(d),a):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(qQ,u,c)(d):d===45||d===95||Nt(d)?(o=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),i=!0,l}function u(d){return o&&i&&Qt(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function WQ(t,e,r){let n=this;return i;function i(s){return s!==87&&s!==119||!b4.call(n,n.previous)||C1(n.events)?r(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(VQ,t.attempt(p4,t.attempt(m4,o),r),r)(s))}function o(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function GQ(t,e,r){let n=this,i="",o=!1;return s;function s(d){return(d===72||d===104)&&_4.call(n,n.previous)&&!C1(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):r(d)}function a(d){if(Qt(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),a;if(d===58){let p=i.toLowerCase();if(p==="http"||p==="https")return t.consume(d),l}return r(d)}function l(d){return d===47?(t.consume(d),o?c:(o=!0,l)):r(d)}function c(d){return d===null||pl(d)||Ze(d)||Zi(d)||ml(d)?r(d):t.attempt(p4,t.attempt(m4,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function HQ(t,e,r){let n=0;return i;function i(s){return(s===87||s===119)&&n<3?(n++,t.consume(s),i):s===46&&n===3?(t.consume(s),o):r(s)}function o(s){return s===null?r(s):e(s)}}function XQ(t,e,r){let n,i,o;return s;function s(c){return c===46||c===95?t.check(h4,l,a)(c):c===null||Ze(c)||Zi(c)||c!==45&&ml(c)?l(c):(o=!0,t.consume(c),s)}function a(c){return c===95?n=!0:(i=n,n=void 0),t.consume(c),s}function l(c){return i||n||!o?r(c):e(c)}}function KQ(t,e){let r=0,n=0;return i;function i(s){return s===40?(r++,t.consume(s),i):s===41&&n<r?o(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?t.check(h4,e,o)(s):s===null||Ze(s)||Zi(s)?e(s):(t.consume(s),i)}function o(s){return s===41&&n++,t.consume(s),i}}function JQ(t,e,r){return n;function n(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),n):a===38?(t.consume(a),o):a===93?(t.consume(a),i):a===60||a===null||Ze(a)||Zi(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||Ze(a)||Zi(a)?e(a):n(a)}function o(a){return Qt(a)?s(a):r(a)}function s(a){return a===59?(t.consume(a),n):Qt(a)?(t.consume(a),s):r(a)}}function YQ(t,e,r){return n;function n(o){return t.consume(o),i}function i(o){return Nt(o)?r(o):e(o)}}function b4(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Ze(t)}function _4(t){return!Qt(t)}function v4(t){return!(t===47||T1(t))}function T1(t){return t===43||t===45||t===46||t===95||Nt(t)}function C1(t){let e=t.length,r=!1;for(;e--;){let n=t[e][1];if((n.type==="labelLink"||n.type==="labelImage")&&!n._balanced){r=!0;break}if(n._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}function Vn(t){let e=[],r=-1,n=0,i=0;for(;++r<t.length;){let o=t.charCodeAt(r),s="";if(o===37&&Nt(t.charCodeAt(r+1))&&Nt(t.charCodeAt(r+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(s=String.fromCharCode(o));else if(o>55295&&o<57344){let a=t.charCodeAt(r+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="\uFFFD"}else s=String.fromCharCode(o);s&&(e.push(t.slice(n,r),encodeURIComponent(s)),n=r+i+1,s=""),i&&(r+=i,i=0)}return e.join("")+t.slice(n)}function Ds(t,e,r){let n=[],i=-1;for(;++i<t.length;){let o=t[i].resolveAll;o&&!n.includes(o)&&(e=o(e,r),n.push(o))}return e}var Im={name:"attention",tokenize:eee,resolveAll:QQ};function QQ(t,e){let r=-1,n,i,o,s,a,l,c,u;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(n=r;n--;)if(t[n][0]==="exit"&&t[n][1].type==="attentionSequence"&&t[n][1]._open&&e.sliceSerialize(t[n][1]).charCodeAt(0)===e.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[n][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[n][1].end.offset-t[n][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;l=t[n][1].end.offset-t[n][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;let d=Object.assign({},t[n][1].end),p=Object.assign({},t[r][1].start);w4(d,-l),w4(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},t[n][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[r][1].start),end:p},o={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[n][1].end),end:Object.assign({},t[r][1].start)},i={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},a.end)},t[n][1].end=Object.assign({},s.start),t[r][1].start=Object.assign({},a.end),c=[],t[n][1].end.offset-t[n][1].start.offset&&(c=qr(c,[["enter",t[n][1],e],["exit",t[n][1],e]])),c=qr(c,[["enter",i,e],["enter",s,e],["exit",s,e],["enter",o,e]]),c=qr(c,Ds(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),c=qr(c,[["exit",o,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(u=2,c=qr(c,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,Gt(t,n-1,r-n+3,c),r=n+c.length-u-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function eee(t,e){let r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=No(n),o;return s;function s(l){return o=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===o)return t.consume(l),a;let c=t.exit("attentionSequence"),u=No(l),d=!u||u===2&&i||r.includes(l),p=!i||i===2&&u||r.includes(n);return c._open=!!(o===42?d:d&&(i||!p)),c._close=!!(o===42?p:p&&(u||!d)),e(l)}}function w4(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}var z1={name:"autolink",tokenize:tee};function tee(t,e,r){let n=0;return i;function i(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),o}function o(f){return Qt(f)?(t.consume(f),s):f===64?r(f):c(f)}function s(f){return f===43||f===45||f===46||Nt(f)?(n=1,a(f)):c(f)}function a(f){return f===58?(t.consume(f),n=0,l):(f===43||f===45||f===46||Nt(f))&&n++<32?(t.consume(f),a):(n=0,c(f))}function l(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||pl(f)?r(f):(t.consume(f),l)}function c(f){return f===64?(t.consume(f),u):TD(f)?(t.consume(f),c):r(f)}function u(f){return Nt(f)?d(f):r(f)}function d(f){return f===46?(t.consume(f),n=0,u):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):p(f)}function p(f){if((f===45||Nt(f))&&n++<63){let m=f===45?p:d;return t.consume(f),m}return r(f)}}function ue(t,e,r,n){let i=n?n-1:Number.POSITIVE_INFINITY,o=0;return s;function s(l){return me(l)?(t.enter(r),a(l)):e(l)}function a(l){return me(l)&&o++<i?(t.consume(l),a):(t.exit(r),e(l))}}var Vi={tokenize:ree,partial:!0};function ree(t,e,r){return n;function n(o){return me(o)?ue(t,i,"linePrefix")(o):i(o)}function i(o){return o===null||X(o)?e(o):r(o)}}var Fb={name:"blockQuote",tokenize:nee,continuation:{tokenize:iee},exit:oee};function nee(t,e,r){let n=this;return i;function i(s){if(s===62){let a=n.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),o}return r(s)}function o(s){return me(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}function iee(t,e,r){let n=this;return i;function i(s){return me(s)?ue(t,o,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)}function o(s){return t.attempt(Fb,e,r)(s)}}function oee(t){t.exit("blockQuote")}var Vb={name:"characterEscape",tokenize:see};function see(t,e,r){return n;function n(o){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(o),t.exit("escapeMarker"),i}function i(o){return CD(o)?(t.enter("characterEscapeValue"),t.consume(o),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(o)}}var qb={name:"characterReference",tokenize:aee};function aee(t,e,r){let n=this,i=0,o,s;return a;function a(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),o=31,s=Nt,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),o=6,s=AD,u):(t.enter("characterReferenceValue"),o=7,s=Sm,u(d))}function u(d){if(d===59&&i){let p=t.exit("characterReferenceValue");return s===Nt&&!Qu(n.sliceSerialize(p))?r(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return s(d)&&i++<o?(t.consume(d),u):r(d)}}var x4={tokenize:cee,partial:!0},Bb={name:"codeFenced",tokenize:lee,concrete:!0};function lee(t,e,r){let n=this,i={tokenize:E,partial:!0},o=0,s=0,a;return l;function l(T){return c(T)}function c(T){let F=n.events[n.events.length-1];return o=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,a=T,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(T)}function u(T){return T===a?(s++,t.consume(T),u):s<3?r(T):(t.exit("codeFencedFenceSequence"),me(T)?ue(t,d,"whitespace")(T):d(T))}function d(T){return T===null||X(T)?(t.exit("codeFencedFence"),n.interrupt?e(T):t.check(x4,h,C)(T)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),p(T))}function p(T){return T===null||X(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(T)):me(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),ue(t,f,"whitespace")(T)):T===96&&T===a?r(T):(t.consume(T),p)}function f(T){return T===null||X(T)?d(T):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(T))}function m(T){return T===null||X(T)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(T)):T===96&&T===a?r(T):(t.consume(T),m)}function h(T){return t.attempt(i,C,y)(T)}function y(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),g}function g(T){return o>0&&me(T)?ue(t,b,"linePrefix",o+1)(T):b(T)}function b(T){return T===null||X(T)?t.check(x4,h,C)(T):(t.enter("codeFlowValue"),v(T))}function v(T){return T===null||X(T)?(t.exit("codeFlowValue"),b(T)):(t.consume(T),v)}function C(T){return t.exit("codeFenced"),e(T)}function E(T,F,le){let ee=0;return I;function I(ge){return T.enter("lineEnding"),T.consume(ge),T.exit("lineEnding"),ce}function ce(ge){return T.enter("codeFencedFence"),me(ge)?ue(T,be,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ge):be(ge)}function be(ge){return ge===a?(T.enter("codeFencedFenceSequence"),J(ge)):le(ge)}function J(ge){return ge===a?(ee++,T.consume(ge),J):ee>=s?(T.exit("codeFencedFenceSequence"),me(ge)?ue(T,pe,"whitespace")(ge):pe(ge)):le(ge)}function pe(ge){return ge===null||X(ge)?(T.exit("codeFencedFence"),F(ge)):le(ge)}}}function cee(t,e,r){let n=this;return i;function i(s){return s===null?r(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o)}function o(s){return n.parser.lazy[n.now().line]?r(s):e(s)}}var Em={name:"codeIndented",tokenize:dee},uee={tokenize:fee,partial:!0};function dee(t,e,r){let n=this;return i;function i(c){return t.enter("codeIndented"),ue(t,o,"linePrefix",5)(c)}function o(c){let u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):r(c)}function s(c){return c===null?l(c):X(c)?t.attempt(uee,s,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||X(c)?(t.exit("codeFlowValue"),s(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function fee(t,e,r){let n=this;return i;function i(s){return n.parser.lazy[n.now().line]?r(s):X(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i):ue(t,o,"linePrefix",5)(s)}function o(s){let a=n.events[n.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):X(s)?i(s):r(s)}}var O1={name:"codeText",tokenize:hee,resolve:pee,previous:mee};function pee(t){let e=t.length-4,r=3,n,i;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(n=r;++n<e;)if(t[n][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[e][1].type="codeTextPadding",r+=2,e-=2;break}}for(n=r-1,e++;++n<=e;)i===void 0?n!==e&&t[n][1].type!=="lineEnding"&&(i=n):(n===e||t[n][1].type==="lineEnding")&&(t[i][1].type="codeTextData",n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),e-=n-i-2,n=i+2),i=void 0);return t}function mee(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function hee(t,e,r){let n=this,i=0,o,s;return a;function a(p){return t.enter("codeText"),t.enter("codeTextSequence"),l(p)}function l(p){return p===96?(t.consume(p),i++,l):(t.exit("codeTextSequence"),c(p))}function c(p){return p===null?r(p):p===32?(t.enter("space"),t.consume(p),t.exit("space"),c):p===96?(s=t.enter("codeTextSequence"),o=0,d(p)):X(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),c):(t.enter("codeTextData"),u(p))}function u(p){return p===null||p===32||p===96||X(p)?(t.exit("codeTextData"),c(p)):(t.consume(p),u)}function d(p){return p===96?(t.consume(p),o++,d):o===i?(t.exit("codeTextSequence"),t.exit("codeText"),e(p)):(s.type="codeTextData",u(p))}}var Wb=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,r){let n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,r,n){let i=r||0;this.setCursor(Math.trunc(e));let o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&Pm(this.left,n),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Pm(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Pm(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let r=this.left.splice(e,Number.POSITIVE_INFINITY);Pm(this.right,r.reverse())}else{let r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Pm(this.left,r.reverse())}}};function Pm(t,e){let r=0;if(e.length<1e4)t.push(...e);else for(;r<e.length;)t.push(...e.slice(r,r+1e4)),r+=1e4}function Gb(t){let e={},r=-1,n,i,o,s,a,l,c,u=new Wb(t);for(;++r<u.length;){for(;r in e;)r=e[r];if(n=u.get(r),r&&n[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(l=n[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,gee(u,r)),r=e[r],c=!0);else if(n[1]._container){for(o=r,i=void 0;o--&&(s=u.get(o),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=o);i&&(n[1].end=Object.assign({},u.get(i)[1].start),a=u.slice(i,r),a.unshift(n),u.splice(i,r-i+1,a))}}return Gt(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function gee(t,e){let r=t.get(e)[1],n=t.get(e)[2],i=e-1,o=[],s=r._tokenizer||n.parser[r.contentType](r.start),a=s.events,l=[],c={},u,d,p=-1,f=r,m=0,h=0,y=[h];for(;f;){for(;t.get(++i)[1]!==f;);o.push(i),f._tokenizer||(u=n.sliceStream(f),f.next||u.push(null),d&&s.defineSkip(f.start),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=r;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(h=p+1,y.push(h),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(s.events=[],f?(f._tokenizer=void 0,f.previous=void 0):y.pop(),p=y.length;p--;){let g=a.slice(y[p],y[p+1]),b=o.pop();l.push([b,b+g.length-1]),t.splice(b,2,g)}for(l.reverse(),p=-1;++p<l.length;)c[m+l[p][0]]=m+l[p][1],m+=l[p][1]-l[p][0]-1;return c}var R1={tokenize:_ee,resolve:bee},yee={tokenize:vee,partial:!0};function bee(t){return Gb(t),t}function _ee(t,e){let r;return n;function n(a){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?o(a):X(a)?t.check(yee,s,o)(a):(t.consume(a),i)}function o(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function s(a){return t.consume(a),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function vee(t,e,r){let n=this;return i;function i(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),ue(t,o,"linePrefix")}function o(s){if(s===null||X(s))return r(s);let a=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):t.interrupt(n.parser.constructs.flow,r,e)(s)}}function Hb(t,e,r,n,i,o,s,a,l){let c=l||Number.POSITIVE_INFINITY,u=0;return d;function d(g){return g===60?(t.enter(n),t.enter(i),t.enter(o),t.consume(g),t.exit(o),p):g===null||g===32||g===41||pl(g)?r(g):(t.enter(n),t.enter(s),t.enter(a),t.enter("chunkString",{contentType:"string"}),h(g))}function p(g){return g===62?(t.enter(o),t.consume(g),t.exit(o),t.exit(i),t.exit(n),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===62?(t.exit("chunkString"),t.exit(a),p(g)):g===null||g===60||X(g)?r(g):(t.consume(g),g===92?m:f)}function m(g){return g===60||g===62||g===92?(t.consume(g),f):f(g)}function h(g){return!u&&(g===null||g===41||Ze(g))?(t.exit("chunkString"),t.exit(a),t.exit(s),t.exit(n),e(g)):u<c&&g===40?(t.consume(g),u++,h):g===41?(t.consume(g),u--,h):g===null||g===32||g===40||pl(g)?r(g):(t.consume(g),g===92?y:h)}function y(g){return g===40||g===41||g===92?(t.consume(g),h):h(g)}}function Xb(t,e,r,n,i,o){let s=this,a=0,l;return c;function c(f){return t.enter(n),t.enter(i),t.consume(f),t.exit(i),t.enter(o),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?r(f):f===93?(t.exit(o),t.enter(i),t.consume(f),t.exit(i),t.exit(n),e):X(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||X(f)||a++>999?(t.exit("chunkString"),u(f)):(t.consume(f),l||(l=!me(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(t.consume(f),a++,d):d(f)}}function Kb(t,e,r,n,i,o){let s;return a;function a(p){return p===34||p===39||p===40?(t.enter(n),t.enter(i),t.consume(p),t.exit(i),s=p===40?41:p,l):r(p)}function l(p){return p===s?(t.enter(i),t.consume(p),t.exit(i),t.exit(n),e):(t.enter(o),c(p))}function c(p){return p===s?(t.exit(o),l(s)):p===null?r(p):X(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),ue(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===s||p===null||X(p)?(t.exit("chunkString"),c(p)):(t.consume(p),p===92?d:u)}function d(p){return p===s||p===92?(t.consume(p),u):u(p)}}function yl(t,e){let r;return n;function n(i){return X(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):me(i)?ue(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}var N1={name:"definition",tokenize:xee},wee={tokenize:kee,partial:!0};function xee(t,e,r){let n=this,i;return o;function o(f){return t.enter("definition"),s(f)}function s(f){return Xb.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=Or(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):r(f)}function l(f){return Ze(f)?yl(t,c)(f):c(f)}function c(f){return Hb(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return t.attempt(wee,d,d)(f)}function d(f){return me(f)?ue(t,p,"whitespace")(f):p(f)}function p(f){return f===null||X(f)?(t.exit("definition"),n.parser.defined.push(i),e(f)):r(f)}}function kee(t,e,r){return n;function n(a){return Ze(a)?yl(t,i)(a):r(a)}function i(a){return Kb(t,o,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return me(a)?ue(t,s,"whitespace")(a):s(a)}function s(a){return a===null||X(a)?e(a):r(a)}}var M1={name:"hardBreakEscape",tokenize:See};function See(t,e,r){return n;function n(o){return t.enter("hardBreakEscape"),t.consume(o),i}function i(o){return X(o)?(t.exit("hardBreakEscape"),e(o)):r(o)}}var j1={name:"headingAtx",tokenize:Iee,resolve:$ee};function $ee(t,e){let r=t.length-2,n=3,i,o;return t[n][1].type==="whitespace"&&(n+=2),r-2>n&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&t[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:t[n][1].start,end:t[r][1].end},o={type:"chunkText",start:t[n][1].start,end:t[r][1].end,contentType:"text"},Gt(t,n,r-n+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),t}function Iee(t,e,r){let n=0;return i;function i(u){return t.enter("atxHeading"),o(u)}function o(u){return t.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&n++<6?(t.consume(u),s):u===null||Ze(u)?(t.exit("atxHeadingSequence"),a(u)):r(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||X(u)?(t.exit("atxHeading"),e(u)):me(u)?ue(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||Ze(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}var k4=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],D1=["pre","script","style","textarea"];var L1={name:"htmlFlow",tokenize:Aee,resolveTo:Tee,concrete:!0},Eee={tokenize:zee,partial:!0},Pee={tokenize:Cee,partial:!0};function Tee(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Aee(t,e,r){let n=this,i,o,s,a,l;return c;function c(S){return u(S)}function u(S){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(S),d}function d(S){return S===33?(t.consume(S),p):S===47?(t.consume(S),o=!0,h):S===63?(t.consume(S),i=3,n.interrupt?e:w):Qt(S)?(t.consume(S),s=String.fromCharCode(S),y):r(S)}function p(S){return S===45?(t.consume(S),i=2,f):S===91?(t.consume(S),i=5,a=0,m):Qt(S)?(t.consume(S),i=4,n.interrupt?e:w):r(S)}function f(S){return S===45?(t.consume(S),n.interrupt?e:w):r(S)}function m(S){let Ft="CDATA[";return S===Ft.charCodeAt(a++)?(t.consume(S),a===Ft.length?n.interrupt?e:be:m):r(S)}function h(S){return Qt(S)?(t.consume(S),s=String.fromCharCode(S),y):r(S)}function y(S){if(S===null||S===47||S===62||Ze(S)){let Ft=S===47,Vt=s.toLowerCase();return!Ft&&!o&&D1.includes(Vt)?(i=1,n.interrupt?e(S):be(S)):k4.includes(s.toLowerCase())?(i=6,Ft?(t.consume(S),g):n.interrupt?e(S):be(S)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(S):o?b(S):v(S))}return S===45||Nt(S)?(t.consume(S),s+=String.fromCharCode(S),y):r(S)}function g(S){return S===62?(t.consume(S),n.interrupt?e:be):r(S)}function b(S){return me(S)?(t.consume(S),b):I(S)}function v(S){return S===47?(t.consume(S),I):S===58||S===95||Qt(S)?(t.consume(S),C):me(S)?(t.consume(S),v):I(S)}function C(S){return S===45||S===46||S===58||S===95||Nt(S)?(t.consume(S),C):E(S)}function E(S){return S===61?(t.consume(S),T):me(S)?(t.consume(S),E):v(S)}function T(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(t.consume(S),l=S,F):me(S)?(t.consume(S),T):le(S)}function F(S){return S===l?(t.consume(S),l=null,ee):S===null||X(S)?r(S):(t.consume(S),F)}function le(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||Ze(S)?E(S):(t.consume(S),le)}function ee(S){return S===47||S===62||me(S)?v(S):r(S)}function I(S){return S===62?(t.consume(S),ce):r(S)}function ce(S){return S===null||X(S)?be(S):me(S)?(t.consume(S),ce):r(S)}function be(S){return S===45&&i===2?(t.consume(S),ct):S===60&&i===1?(t.consume(S),yt):S===62&&i===4?(t.consume(S),Nr):S===63&&i===3?(t.consume(S),w):S===93&&i===5?(t.consume(S),wr):X(S)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(Eee,Bn,J)(S)):S===null||X(S)?(t.exit("htmlFlowData"),J(S)):(t.consume(S),be)}function J(S){return t.check(Pee,pe,Bn)(S)}function pe(S){return t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),ge}function ge(S){return S===null||X(S)?J(S):(t.enter("htmlFlowData"),be(S))}function ct(S){return S===45?(t.consume(S),w):be(S)}function yt(S){return S===47?(t.consume(S),s="",Pt):be(S)}function Pt(S){if(S===62){let Ft=s.toLowerCase();return D1.includes(Ft)?(t.consume(S),Nr):be(S)}return Qt(S)&&s.length<8?(t.consume(S),s+=String.fromCharCode(S),Pt):be(S)}function wr(S){return S===93?(t.consume(S),w):be(S)}function w(S){return S===62?(t.consume(S),Nr):S===45&&i===2?(t.consume(S),w):be(S)}function Nr(S){return S===null||X(S)?(t.exit("htmlFlowData"),Bn(S)):(t.consume(S),Nr)}function Bn(S){return t.exit("htmlFlow"),e(S)}}function Cee(t,e,r){let n=this;return i;function i(s){return X(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o):r(s)}function o(s){return n.parser.lazy[n.now().line]?r(s):e(s)}}function zee(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Vi,e,r)}}var U1={name:"htmlText",tokenize:Oee};function Oee(t,e,r){let n=this,i,o,s;return a;function a(w){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(w),l}function l(w){return w===33?(t.consume(w),c):w===47?(t.consume(w),E):w===63?(t.consume(w),v):Qt(w)?(t.consume(w),le):r(w)}function c(w){return w===45?(t.consume(w),u):w===91?(t.consume(w),o=0,m):Qt(w)?(t.consume(w),b):r(w)}function u(w){return w===45?(t.consume(w),f):r(w)}function d(w){return w===null?r(w):w===45?(t.consume(w),p):X(w)?(s=d,yt(w)):(t.consume(w),d)}function p(w){return w===45?(t.consume(w),f):d(w)}function f(w){return w===62?ct(w):w===45?p(w):d(w)}function m(w){let Nr="CDATA[";return w===Nr.charCodeAt(o++)?(t.consume(w),o===Nr.length?h:m):r(w)}function h(w){return w===null?r(w):w===93?(t.consume(w),y):X(w)?(s=h,yt(w)):(t.consume(w),h)}function y(w){return w===93?(t.consume(w),g):h(w)}function g(w){return w===62?ct(w):w===93?(t.consume(w),g):h(w)}function b(w){return w===null||w===62?ct(w):X(w)?(s=b,yt(w)):(t.consume(w),b)}function v(w){return w===null?r(w):w===63?(t.consume(w),C):X(w)?(s=v,yt(w)):(t.consume(w),v)}function C(w){return w===62?ct(w):v(w)}function E(w){return Qt(w)?(t.consume(w),T):r(w)}function T(w){return w===45||Nt(w)?(t.consume(w),T):F(w)}function F(w){return X(w)?(s=F,yt(w)):me(w)?(t.consume(w),F):ct(w)}function le(w){return w===45||Nt(w)?(t.consume(w),le):w===47||w===62||Ze(w)?ee(w):r(w)}function ee(w){return w===47?(t.consume(w),ct):w===58||w===95||Qt(w)?(t.consume(w),I):X(w)?(s=ee,yt(w)):me(w)?(t.consume(w),ee):ct(w)}function I(w){return w===45||w===46||w===58||w===95||Nt(w)?(t.consume(w),I):ce(w)}function ce(w){return w===61?(t.consume(w),be):X(w)?(s=ce,yt(w)):me(w)?(t.consume(w),ce):ee(w)}function be(w){return w===null||w===60||w===61||w===62||w===96?r(w):w===34||w===39?(t.consume(w),i=w,J):X(w)?(s=be,yt(w)):me(w)?(t.consume(w),be):(t.consume(w),pe)}function J(w){return w===i?(t.consume(w),i=void 0,ge):w===null?r(w):X(w)?(s=J,yt(w)):(t.consume(w),J)}function pe(w){return w===null||w===34||w===39||w===60||w===61||w===96?r(w):w===47||w===62||Ze(w)?ee(w):(t.consume(w),pe)}function ge(w){return w===47||w===62||Ze(w)?ee(w):r(w)}function ct(w){return w===62?(t.consume(w),t.exit("htmlTextData"),t.exit("htmlText"),e):r(w)}function yt(w){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),Pt}function Pt(w){return me(w)?ue(t,wr,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):wr(w)}function wr(w){return t.enter("htmlTextData"),s(w)}}var bl={name:"labelEnd",tokenize:Lee,resolveTo:Dee,resolveAll:jee},Ree={tokenize:Uee},Nee={tokenize:Zee},Mee={tokenize:Fee};function jee(t){let e=-1;for(;++e<t.length;){let r=t[e][1];(r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd")&&(t.splice(e+1,r.type==="labelImage"?4:2),r.type="data",e++)}return t}function Dee(t,e){let r=t.length,n=0,i,o,s,a;for(;r--;)if(i=t[r][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(t[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=r,i.type!=="labelLink")){n=2;break}}else i.type==="labelEnd"&&(s=r);let l={type:t[o][1].type==="labelLink"?"link":"image",start:Object.assign({},t[o][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"label",start:Object.assign({},t[o][1].start),end:Object.assign({},t[s][1].end)},u={type:"labelText",start:Object.assign({},t[o+n+2][1].end),end:Object.assign({},t[s-2][1].start)};return a=[["enter",l,e],["enter",c,e]],a=qr(a,t.slice(o+1,o+n+3)),a=qr(a,[["enter",u,e]]),a=qr(a,Ds(e.parser.constructs.insideSpan.null,t.slice(o+n+4,s-3),e)),a=qr(a,[["exit",u,e],t[s-2],t[s-1],["exit",c,e]]),a=qr(a,t.slice(s+1)),a=qr(a,[["exit",l,e]]),Gt(t,o,t.length,a),t}function Lee(t,e,r){let n=this,i=n.events.length,o,s;for(;i--;)if((n.events[i][1].type==="labelImage"||n.events[i][1].type==="labelLink")&&!n.events[i][1]._balanced){o=n.events[i][1];break}return a;function a(p){return o?o._inactive?d(p):(s=n.parser.defined.includes(Or(n.sliceSerialize({start:o.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(p),t.exit("labelMarker"),t.exit("labelEnd"),l):r(p)}function l(p){return p===40?t.attempt(Ree,u,s?u:d)(p):p===91?t.attempt(Nee,u,s?c:d)(p):s?u(p):d(p)}function c(p){return t.attempt(Mee,u,d)(p)}function u(p){return e(p)}function d(p){return o._balanced=!0,r(p)}}function Uee(t,e,r){return n;function n(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return Ze(d)?yl(t,o)(d):o(d)}function o(d){return d===41?u(d):Hb(t,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return Ze(d)?yl(t,l)(d):u(d)}function a(d){return r(d)}function l(d){return d===34||d===39||d===40?Kb(t,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return Ze(d)?yl(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):r(d)}}function Zee(t,e,r){let n=this;return i;function i(a){return Xb.call(n,t,o,s,"reference","referenceMarker","referenceString")(a)}function o(a){return n.parser.defined.includes(Or(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(a):r(a)}function s(a){return r(a)}}function Fee(t,e,r){return n;function n(o){return t.enter("reference"),t.enter("referenceMarker"),t.consume(o),t.exit("referenceMarker"),i}function i(o){return o===93?(t.enter("referenceMarker"),t.consume(o),t.exit("referenceMarker"),t.exit("reference"),e):r(o)}}var Z1={name:"labelStartImage",tokenize:Vee,resolveAll:bl.resolveAll};function Vee(t,e,r){let n=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),o}function o(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),s):r(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(a):e(a)}}var F1={name:"labelStartLink",tokenize:qee,resolveAll:bl.resolveAll};function qee(t,e,r){let n=this;return i;function i(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),o}function o(s){return s===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(s):e(s)}}var Tm={name:"lineEnding",tokenize:Bee};function Bee(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),ue(t,e,"linePrefix")}}var _l={name:"thematicBreak",tokenize:Wee};function Wee(t,e,r){let n=0,i;return o;function o(c){return t.enter("thematicBreak"),s(c)}function s(c){return i=c,a(c)}function a(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):n>=3&&(c===null||X(c))?(t.exit("thematicBreak"),e(c)):r(c)}function l(c){return c===i?(t.consume(c),n++,l):(t.exit("thematicBreakSequence"),me(c)?ue(t,a,"whitespace")(c):a(c))}}var Rr={name:"list",tokenize:Xee,continuation:{tokenize:Kee},exit:Yee},Gee={tokenize:Qee,partial:!0},Hee={tokenize:Jee,partial:!0};function Xee(t,e,r){let n=this,i=n.events[n.events.length-1],o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(f){let m=n.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||f===n.containerState.marker:Sm(f)){if(n.containerState.type||(n.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(_l,r,c)(f):c(f);if(!n.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return r(f)}function l(f){return Sm(f)&&++s<10?(t.consume(f),l):(!n.interrupt||s<2)&&(n.containerState.marker?f===n.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),c(f)):r(f)}function c(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||f,t.check(Vi,n.interrupt?r:u,t.attempt(Gee,p,d))}function u(f){return n.containerState.initialBlankLine=!0,o++,p(f)}function d(f){return me(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),p):r(f)}function p(f){return n.containerState.size=o+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function Kee(t,e,r){let n=this;return n.containerState._closeFlow=void 0,t.check(Vi,i,o);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,ue(t,e,"listItemIndent",n.containerState.size+1)(a)}function o(a){return n.containerState.furtherBlankLines||!me(a)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,s(a)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(Hee,e,s)(a))}function s(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,ue(t,t.attempt(Rr,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Jee(t,e,r){let n=this;return ue(t,i,"listItemIndent",n.containerState.size+1);function i(o){let s=n.events[n.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===n.containerState.size?e(o):r(o)}}function Yee(t){t.exit(this.containerState.type)}function Qee(t,e,r){let n=this;return ue(t,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){let s=n.events[n.events.length-1];return!me(o)&&s&&s[1].type==="listItemPrefixWhitespace"?e(o):r(o)}}var Jb={name:"setextUnderline",tokenize:tte,resolveTo:ete};function ete(t,e){let r=t.length,n,i,o;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(i=r)}else t[r][1].type==="content"&&t.splice(r,1),!o&&t[r][1].type==="definition"&&(o=r);let s={type:"setextHeading",start:Object.assign({},t[i][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[i][1].type="setextHeadingText",o?(t.splice(i,0,["enter",s,e]),t.splice(o+1,0,["exit",t[n][1],e]),t[n][1].end=Object.assign({},t[o][1].end)):t[n][1]=s,t.push(["exit",s,e]),t}function tte(t,e,r){let n=this,i;return o;function o(c){let u=n.events.length,d;for(;u--;)if(n.events[u][1].type!=="lineEnding"&&n.events[u][1].type!=="linePrefix"&&n.events[u][1].type!=="content"){d=n.events[u][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(t.enter("setextHeadingLine"),i=c,s(c)):r(c)}function s(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),me(c)?ue(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||X(c)?(t.exit("setextHeadingLine"),e(c)):r(c)}}var rte={tokenize:cte,partial:!0};function V1(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:ste,continuation:{tokenize:ate},exit:lte}},text:{91:{name:"gfmFootnoteCall",tokenize:ote},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nte,resolveTo:ite}}}}function nte(t,e,r){let n=this,i=n.events.length,o=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),s;for(;i--;){let l=n.events[i][1];if(l.type==="labelImage"){s=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!s||!s._balanced)return r(l);let c=Or(n.sliceSerialize({start:s.end,end:n.now()}));return c.codePointAt(0)!==94||!o.includes(c.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function ite(t,e){let r=t.length,n;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){n=t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";let i={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;let s={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[t[r+1],t[r+2],["enter",i,e],t[r+3],t[r+4],["enter",o,e],["exit",o,e],["enter",s,e],["enter",a,e],["exit",a,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",i,e]];return t.splice(r,t.length-r+1,...l),t}function ote(t,e,r){let n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),o=0,s;return a;function a(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?r(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(d){if(o>999||d===93&&!s||d===null||d===91||Ze(d))return r(d);if(d===93){t.exit("chunkString");let p=t.exit("gfmFootnoteCallString");return i.includes(Or(n.sliceSerialize(p)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(d)}return Ze(d)||(s=!0),o++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),o++,c):c(d)}}function ste(t,e,r){let n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]),o,s=0,a;return l;function l(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):r(m)}function u(m){if(s>999||m===93&&!a||m===null||m===91||Ze(m))return r(m);if(m===93){t.exit("chunkString");let h=t.exit("gfmFootnoteDefinitionLabelString");return o=Or(n.sliceSerialize(h)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}return Ze(m)||(a=!0),s++,t.consume(m),m===92?d:u}function d(m){return m===91||m===92||m===93?(t.consume(m),s++,u):u(m)}function p(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),i.includes(o)||i.push(o),ue(t,f,"gfmFootnoteDefinitionWhitespace")):r(m)}function f(m){return e(m)}}function ate(t,e,r){return t.check(Vi,e,t.attempt(rte,e,r))}function lte(t){t.exit("gfmFootnoteDefinition")}function cte(t,e,r){let n=this;return ue(t,i,"gfmFootnoteDefinitionIndent",5);function i(o){let s=n.events[n.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?e(o):r(o)}}function q1(t){let r=(t||{}).singleTilde,n={name:"strikethrough",tokenize:o,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(s,a){let l=-1;for(;++l<s.length;)if(s[l][0]==="enter"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._close){let c=l;for(;c--;)if(s[c][0]==="exit"&&s[c][1].type==="strikethroughSequenceTemporary"&&s[c][1]._open&&s[l][1].end.offset-s[l][1].start.offset===s[c][1].end.offset-s[c][1].start.offset){s[l][1].type="strikethroughSequence",s[c][1].type="strikethroughSequence";let u={type:"strikethrough",start:Object.assign({},s[c][1].start),end:Object.assign({},s[l][1].end)},d={type:"strikethroughText",start:Object.assign({},s[c][1].end),end:Object.assign({},s[l][1].start)},p=[["enter",u,a],["enter",s[c][1],a],["exit",s[c][1],a],["enter",d,a]],f=a.parser.constructs.insideSpan.null;f&&Gt(p,p.length,0,Ds(f,s.slice(c+1,l),a)),Gt(p,p.length,0,[["exit",d,a],["enter",s[l][1],a],["exit",s[l][1],a],["exit",u,a]]),Gt(s,c-1,l-c+3,p),l=c+p.length-2;break}}for(l=-1;++l<s.length;)s[l][1].type==="strikethroughSequenceTemporary"&&(s[l][1].type="data");return s}function o(s,a,l){let c=this.previous,u=this.events,d=0;return p;function p(m){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(m):(s.enter("strikethroughSequenceTemporary"),f(m))}function f(m){let h=No(c);if(m===126)return d>1?l(m):(s.consume(m),d++,f);if(d<2&&!r)return l(m);let y=s.exit("strikethroughSequenceTemporary"),g=No(m);return y._open=!g||g===2&&!!h,y._close=!h||h===2&&!!g,a(m)}}}var Yb=class{constructor(){this.map=[]}add(e,r,n){ute(this,e,r,n)}consume(e){if(this.map.sort(function(o,s){return o[0]-s[0]}),this.map.length===0)return;let r=this.map.length,n=[];for(;r>0;)r-=1,n.push(e.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),e.length=this.map[r][0];n.push(e.slice()),e.length=0;let i=n.pop();for(;i;){for(let o of i)e.push(o);i=n.pop()}this.map.length=0}};function ute(t,e,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=r,t.map[i][2].push(...n);return}i+=1}t.map.push([e,r,n])}}function S4(t,e){let r=!1,n=[];for(;e<t.length;){let i=t[e];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&n.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){let o=n.length-1;n[o]=n[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);e+=1}return n}function B1(){return{flow:{null:{name:"table",tokenize:dte,resolveAll:fte}}}}function dte(t,e,r){let n=this,i=0,o=0,s;return a;function a(I){let ce=n.events.length-1;for(;ce>-1;){let pe=n.events[ce][1].type;if(pe==="lineEnding"||pe==="linePrefix")ce--;else break}let be=ce>-1?n.events[ce][1].type:null,J=be==="tableHead"||be==="tableRow"?T:l;return J===T&&n.parser.lazy[n.now().line]?r(I):J(I)}function l(I){return t.enter("tableHead"),t.enter("tableRow"),c(I)}function c(I){return I===124||(s=!0,o+=1),u(I)}function u(I){return I===null?r(I):X(I)?o>1?(o=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),f):r(I):me(I)?ue(t,u,"whitespace")(I):(o+=1,s&&(s=!1,i+=1),I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),s=!0,u):(t.enter("data"),d(I)))}function d(I){return I===null||I===124||Ze(I)?(t.exit("data"),u(I)):(t.consume(I),I===92?p:d)}function p(I){return I===92||I===124?(t.consume(I),d):d(I)}function f(I){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(I):(t.enter("tableDelimiterRow"),s=!1,me(I)?ue(t,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):m(I))}function m(I){return I===45||I===58?y(I):I===124?(s=!0,t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),h):E(I)}function h(I){return me(I)?ue(t,y,"whitespace")(I):y(I)}function y(I){return I===58?(o+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),g):I===45?(o+=1,g(I)):I===null||X(I)?C(I):E(I)}function g(I){return I===45?(t.enter("tableDelimiterFiller"),b(I)):E(I)}function b(I){return I===45?(t.consume(I),b):I===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),v):(t.exit("tableDelimiterFiller"),v(I))}function v(I){return me(I)?ue(t,C,"whitespace")(I):C(I)}function C(I){return I===124?m(I):I===null||X(I)?!s||i!==o?E(I):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(I)):E(I)}function E(I){return r(I)}function T(I){return t.enter("tableRow"),F(I)}function F(I){return I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),F):I===null||X(I)?(t.exit("tableRow"),e(I)):me(I)?ue(t,F,"whitespace")(I):(t.enter("data"),le(I))}function le(I){return I===null||I===124||Ze(I)?(t.exit("data"),F(I)):(t.consume(I),I===92?ee:le)}function ee(I){return I===92||I===124?(t.consume(I),le):le(I)}}function fte(t,e){let r=-1,n=!0,i=0,o=[0,0,0,0],s=[0,0,0,0],a=!1,l=0,c,u,d,p=new Yb;for(;++r<t.length;){let f=t[r],m=f[1];f[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&($4(p,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(r,0,[["enter",c,e]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(n=!0,d=void 0,o=[0,0,0,0],s=[0,r+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(r,0,[["enter",u,e]])),i=m.type==="tableDelimiterRow"?2:u?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(n=!1,s[2]===0&&(o[1]!==0&&(s[0]=s[1],d=Qb(p,e,o,i,void 0,d),o=[0,0,0,0]),s[2]=r)):m.type==="tableCellDivider"&&(n?n=!1:(o[1]!==0&&(s[0]=s[1],d=Qb(p,e,o,i,void 0,d)),o=s,s=[o[1],r,0,0])):m.type==="tableHead"?(a=!0,l=r):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=r,o[1]!==0?(s[0]=s[1],d=Qb(p,e,o,i,r,d)):s[1]!==0&&(d=Qb(p,e,s,i,r,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(s[3]=r)}for(l!==0&&$4(p,e,l,c,u),p.consume(e.events),r=-1;++r<e.events.length;){let f=e.events[r];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=S4(e.events,r))}return t}function Qb(t,e,r,n,i,o){let s=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",a="tableContent";r[0]!==0&&(o.end=Object.assign({},ed(e.events,r[0])),t.add(r[0],0,[["exit",o,e]]));let l=ed(e.events,r[1]);if(o={type:s,start:Object.assign({},l),end:Object.assign({},l)},t.add(r[1],0,[["enter",o,e]]),r[2]!==0){let c=ed(e.events,r[2]),u=ed(e.events,r[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(r[2],0,[["enter",d,e]]),n!==2){let p=e.events[r[2]],f=e.events[r[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[1].contentType="text",r[3]>r[2]+1){let m=r[2]+1,h=r[3]-r[2]-1;t.add(m,h,[])}}t.add(r[3]+1,0,[["exit",d,e]])}return i!==void 0&&(o.end=Object.assign({},ed(e.events,i)),t.add(i,0,[["exit",o,e]]),o=void 0),o}function $4(t,e,r,n,i){let o=[],s=ed(e.events,r);i&&(i.end=Object.assign({},s),o.push(["exit",i,e])),n.end=Object.assign({},s),o.push(["exit",n,e]),t.add(r+1,0,o)}function ed(t,e){let r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}var pte={name:"tasklistCheck",tokenize:mte};function W1(){return{text:{91:pte}}}function mte(t,e,r){let n=this;return i;function i(l){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),o)}function o(l){return Ze(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),s):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),s):r(l)}function s(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):r(l)}function a(l){return X(l)?e(l):me(l)?t.check({tokenize:hte},e,r)(l):r(l)}}function hte(t,e,r){return ue(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function I4(t){return Zb([A1(),V1(),q1(t),B1(),W1()])}var gte={};function Am(t){let e=this,r=t||gte,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),o=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),s=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(I4(r)),o.push(E1()),s.push(P1(r))}var E4={tokenize:yte};function yte(t){let e=t.attempt(this.parser.constructs.contentInitial,n,i),r;return e;function n(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),ue(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),o(a)}function o(a){let l=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,s(a)}function s(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return X(a)?(t.consume(a),t.exit("chunkText"),o):(t.consume(a),s)}}var T4={tokenize:bte},P4={tokenize:_te};function bte(t){let e=this,r=[],n=0,i,o,s;return a;function a(v){if(n<r.length){let C=r[n];return e.containerState=C[1],t.attempt(C[0].continuation,l,c)(v)}return c(v)}function l(v){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&b();let C=e.events.length,E=C,T;for(;E--;)if(e.events[E][0]==="exit"&&e.events[E][1].type==="chunkFlow"){T=e.events[E][1].end;break}g(n);let F=C;for(;F<e.events.length;)e.events[F][1].end=Object.assign({},T),F++;return Gt(e.events,E+1,0,e.events.slice(C)),e.events.length=F,c(v)}return a(v)}function c(v){if(n===r.length){if(!i)return p(v);if(i.currentConstruct&&i.currentConstruct.concrete)return m(v);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(P4,u,d)(v)}function u(v){return i&&b(),g(n),p(v)}function d(v){return e.parser.lazy[e.now().line]=n!==r.length,s=e.now().offset,m(v)}function p(v){return e.containerState={},t.attempt(P4,f,m)(v)}function f(v){return n++,r.push([e.currentConstruct,e.containerState]),p(v)}function m(v){if(v===null){i&&b(),g(0),t.consume(v);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{contentType:"flow",previous:o,_tokenizer:i}),h(v)}function h(v){if(v===null){y(t.exit("chunkFlow"),!0),g(0),t.consume(v);return}return X(v)?(t.consume(v),y(t.exit("chunkFlow")),n=0,e.interrupt=void 0,a):(t.consume(v),h)}function y(v,C){let E=e.sliceStream(v);if(C&&E.push(null),v.previous=o,o&&(o.next=v),o=v,i.defineSkip(v.start),i.write(E),e.parser.lazy[v.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<s&&(!i.events[T][1].end||i.events[T][1].end.offset>s))return;let F=e.events.length,le=F,ee,I;for(;le--;)if(e.events[le][0]==="exit"&&e.events[le][1].type==="chunkFlow"){if(ee){I=e.events[le][1].end;break}ee=!0}for(g(n),T=F;T<e.events.length;)e.events[T][1].end=Object.assign({},I),T++;Gt(e.events,le+1,0,e.events.slice(F)),e.events.length=T}}function g(v){let C=r.length;for(;C-- >v;){let E=r[C];e.containerState=E[1],E[0].exit.call(e,t)}r.length=v}function b(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function _te(t,e,r){return ue(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}var A4={tokenize:vte};function vte(t){let e=this,r=t.attempt(Vi,n,t.attempt(this.parser.constructs.flowInitial,i,ue(t,t.attempt(this.parser.constructs.flow,i,t.attempt(R1,i)),"linePrefix")));return r;function n(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,r}function i(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,r}}var C4={resolveAll:N4()},z4=R4("string"),O4=R4("text");function R4(t){return{tokenize:e,resolveAll:N4(t==="text"?wte:void 0)};function e(r){let n=this,i=this.parser.constructs[t],o=r.attempt(i,s,a);return s;function s(u){return c(u)?o(u):a(u)}function a(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),l}function l(u){return c(u)?(r.exit("data"),o(u)):(r.consume(u),l)}function c(u){if(u===null)return!0;let d=i[u],p=-1;if(d)for(;++p<d.length;){let f=d[p];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}function N4(t){return e;function e(r,n){let i=-1,o;for(;++i<=r.length;)o===void 0?r[i]&&r[i][1].type==="data"&&(o=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==o+2&&(r[o][1].end=r[i-1][1].end,r.splice(o+2,i-o-2),i=o+2),o=void 0);return t?t(r,n):r}}function wte(t,e){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){let n=t[r-1][1],i=e.sliceStream(n),o=i.length,s=-1,a=0,l;for(;o--;){let c=i[o];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)l=!0,a++;else if(c!==-1){o++;break}}if(a){let c={type:r===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{line:n.end.line,column:n.end.column-a,offset:n.end.offset-a,_index:n.start._index+o,_bufferIndex:o?s:n.start._bufferIndex+s},end:Object.assign({},n.end)};n.end=Object.assign({},c.start),n.start.offset===n.end.offset?Object.assign(n,c):(t.splice(r,0,["enter",c,e],["exit",c,e]),r+=2)}r++}return t}function M4(t,e,r){let n=Object.assign(r?Object.assign({},r):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),i={},o=[],s=[],a=[],l=!0,c={consume:C,enter:E,exit:T,attempt:ee(F),check:ee(le),interrupt:ee(le,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:t,sliceStream:h,sliceSerialize:m,now:y,defineSkip:g,write:f},d=e.tokenize.call(u,c),p;return e.resolveAll&&o.push(e),u;function f(J){return s=qr(s,J),b(),s[s.length-1]!==null?[]:(I(e,0),u.events=Ds(o,u.events,u),u.events)}function m(J,pe){return kte(h(J),pe)}function h(J){return xte(s,J)}function y(){let{line:J,column:pe,offset:ge,_index:ct,_bufferIndex:yt}=n;return{line:J,column:pe,offset:ge,_index:ct,_bufferIndex:yt}}function g(J){i[J.line]=J.column,be()}function b(){let J;for(;n._index<s.length;){let pe=s[n._index];if(typeof pe=="string")for(J=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===J&&n._bufferIndex<pe.length;)v(pe.charCodeAt(n._bufferIndex));else v(pe)}}function v(J){l=void 0,p=J,d=d(J)}function C(J){X(J)?(n.line++,n.column=1,n.offset+=J===-3?2:1,be()):J!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===s[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=J,l=!0}function E(J,pe){let ge=pe||{};return ge.type=J,ge.start=y(),u.events.push(["enter",ge,u]),a.push(ge),ge}function T(J){let pe=a.pop();return pe.end=y(),u.events.push(["exit",pe,u]),pe}function F(J,pe){I(J,pe.from)}function le(J,pe){pe.restore()}function ee(J,pe){return ge;function ge(ct,yt,Pt){let wr,w,Nr,Bn;return Array.isArray(ct)?Ft(ct):"tokenize"in ct?Ft([ct]):S(ct);function S(Mt){return Bi;function Bi(Wr){let Wi=Wr!==null&&Mt[Wr],jo=Wr!==null&&Mt.null,ld=[...Array.isArray(Wi)?Wi:Wi?[Wi]:[],...Array.isArray(jo)?jo:jo?[jo]:[]];return Ft(ld)(Wr)}}function Ft(Mt){return wr=Mt,w=0,Mt.length===0?Pt:Vt(Mt[w])}function Vt(Mt){return Bi;function Bi(Wr){return Bn=ce(),Nr=Mt,Mt.partial||(u.currentConstruct=Mt),Mt.name&&u.parser.constructs.disable.null.includes(Mt.name)?Wn(Wr):Mt.tokenize.call(pe?Object.assign(Object.create(u),pe):u,c,Br,Wn)(Wr)}}function Br(Mt){return l=!0,J(Nr,Bn),yt}function Wn(Mt){return l=!0,Bn.restore(),++w<wr.length?Vt(wr[w]):Pt}}}function I(J,pe){J.resolveAll&&!o.includes(J)&&o.push(J),J.resolve&&Gt(u.events,pe,u.events.length-pe,J.resolve(u.events.slice(pe),u)),J.resolveTo&&(u.events=J.resolveTo(u.events,u))}function ce(){let J=y(),pe=u.previous,ge=u.currentConstruct,ct=u.events.length,yt=Array.from(a);return{restore:Pt,from:ct};function Pt(){n=J,u.previous=pe,u.currentConstruct=ge,u.events.length=ct,a=yt,be()}}function be(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function xte(t,e){let r=e.start._index,n=e.start._bufferIndex,i=e.end._index,o=e.end._bufferIndex,s;if(r===i)s=[t[r].slice(n,o)];else{if(s=t.slice(r,i),n>-1){let a=s[0];typeof a=="string"?s[0]=a.slice(n):s.shift()}o>0&&s.push(t[i].slice(0,o))}return s}function kte(t,e){let r=-1,n=[],i;for(;++r<t.length;){let o=t[r],s;if(typeof o=="string")s=o;else switch(o){case-5:{s="\r";break}case-4:{s=`
|
|
394
394
|
`;break}case-3:{s=`\r
|
|
395
|
-
`;break}case-2:{s=e?" ":" ";break}case-1:{if(!e&&i)continue;s=" ";break}default:s=String.fromCharCode(o)}i=o===-2,n.push(s)}return n.join("")}var G1={};gd(G1,{attentionMarkers:()=>Cte,contentInitial:()=>$te,disable:()=>zte,document:()=>Ste,flow:()=>Ete,flowInitial:()=>Ite,insideSpan:()=>Ate,string:()=>Pte,text:()=>Tte});var Ste={42:Rr,43:Rr,45:Rr,48:Rr,49:Rr,50:Rr,51:Rr,52:Rr,53:Rr,54:Rr,55:Rr,56:Rr,57:Rr,62:Fb},$te={91:N1},Ite={[-2]:Em,[-1]:Em,32:Em},Ete={35:j1,42:_l,45:[Jb,_l],60:L1,61:Jb,95:_l,96:Bb,126:Bb},Pte={38:qb,92:Vb},Tte={[-5]:Tm,[-4]:Tm,[-3]:Tm,33:Z1,38:qb,42:Im,60:[z1,U1],91:F1,92:[M1,Vb],93:bl,95:Im,96:O1},Ate={null:[Im,C4]},Cte={null:[42,95]},zte={null:[]};function H1(t){let r=Zb([G1,...(t||{}).extensions||[]]),n={defined:[],lazy:{},constructs:r,content:i(E4),document:i(T4),flow:i(A4),string:i(z4),text:i(O4)};return n;function i(o){return s;function s(a){return M4(n,o,a)}}}function X1(t){for(;!Gb(t););return t}var j4=/[\0\t\n\r]/g;function K1(){let t=1,e="",r=!0,n;return i;function i(o,s,a){let l=[],c,u,d,p,f;for(o=e+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),d=0,e="",r&&(o.charCodeAt(0)===65279&&d++,r=void 0);d<o.length;){if(j4.lastIndex=d,c=j4.exec(o),p=c&&c.index!==void 0?c.index:o.length,f=o.charCodeAt(p),!c){e=o.slice(d);break}if(f===10&&d===p&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<p&&(l.push(o.slice(d,p)),t+=p-d),f){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:n=!0,t=1}d=p+1}return a&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}function Ls(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?D4(t.position):"start"in t||"end"in t?D4(t):"line"in t||"column"in t?J1(t):""}function J1(t){return L4(t&&t.line)+":"+L4(t&&t.column)}function D4(t){return J1(t&&t.start)+"-"+J1(t&&t.end)}function L4(t){return t&&typeof t=="number"?t:1}var Z4={}.hasOwnProperty;function Y1(t,e,r){return typeof e!="string"&&(r=e,e=void 0),Ote(r)(X1(H1(r).document().write(K1()(t,e,!0))))}function Ote(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(ud),autolinkProtocol:ee,autolinkEmail:ee,atxHeading:o(xn),blockQuote:o(Bi),characterEscape:ee,characterReference:ee,codeFenced:o(Wr),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(Wr,s),codeText:o(Wi,s),codeTextData:ee,data:ee,codeFlowValue:ee,definition:o(jo),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(ld),hardBreakEscape:o(Um),hardBreakTrailing:o(Um),htmlFlow:o(cd,s),htmlFlowData:ee,htmlText:o(cd,s),htmlTextData:ee,image:o(Zm),label:s,link:o(ud),listItem:o(Do),listItemValue:p,listOrdered:o(Fm,d),listUnordered:o(Fm),paragraph:o(kn),reference:S,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(xn),strong:o(Vm),thematicBreak:o(x_)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:Mt,autolinkProtocol:Wn,blockQuote:l(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:Vt,characterReferenceMarkerNumeric:Vt,characterReferenceValue:Br,codeFenced:l(y),codeFencedFence:h,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:I,codeIndented:l(g),codeText:l(ge),codeTextData:I,data:I,definition:l(),definitionDestinationString:C,definitionLabelString:b,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(be),hardBreakTrailing:l(be),htmlFlow:l(J),htmlFlowData:I,htmlText:l(pe),htmlTextData:I,image:l(yt),label:wr,labelText:Pt,lineEnding:ce,link:l(ct),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Ft,resourceDestinationString:w,resourceTitleString:Nr,resource:Bn,setextHeading:l(le),setextHeadingLineSequence:F,setextHeadingText:T,strong:l(),thematicBreak:l()}};F4(e,(t||{}).mdastExtensions||[]);let r={};return n;function n(D){let q={type:"root",children:[]},de={stack:[q],tokenStack:[],config:e,enter:a,exit:c,buffer:s,resume:u,data:r},Te=[],tt=-1;for(;++tt<D.length;)if(D[tt][1].type==="listOrdered"||D[tt][1].type==="listUnordered")if(D[tt][0]==="enter")Te.push(tt);else{let Gr=Te.pop();tt=i(D,Gr,tt)}for(tt=-1;++tt<D.length;){let Gr=e[D[tt][0]];Z4.call(Gr,D[tt][1].type)&&Gr[D[tt][1].type].call(Object.assign({sliceSerialize:D[tt][2].sliceSerialize},de),D[tt][1])}if(de.tokenStack.length>0){let Gr=de.tokenStack[de.tokenStack.length-1];(Gr[1]||U4).call(de,void 0,Gr[0])}for(q.position={start:Us(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:Us(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},tt=-1;++tt<e.transforms.length;)q=e.transforms[tt](q)||q;return q}function i(D,q,de){let Te=q-1,tt=-1,Gr=!1,sn,Sn,Fs,Vs;for(;++Te<=de;){let xr=D[Te];switch(xr[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{xr[0]==="enter"?tt++:tt--,Vs=void 0;break}case"lineEndingBlank":{xr[0]==="enter"&&(sn&&!Vs&&!tt&&!Fs&&(Fs=Te),Vs=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Vs=void 0}if(!tt&&xr[0]==="enter"&&xr[1].type==="listItemPrefix"||tt===-1&&xr[0]==="exit"&&(xr[1].type==="listUnordered"||xr[1].type==="listOrdered")){if(sn){let sr=Te;for(Sn=void 0;sr--;){let Gn=D[sr];if(Gn[1].type==="lineEnding"||Gn[1].type==="lineEndingBlank"){if(Gn[0]==="exit")continue;Sn&&(D[Sn][1].type="lineEndingBlank",Gr=!0),Gn[1].type="lineEnding",Sn=sr}else if(!(Gn[1].type==="linePrefix"||Gn[1].type==="blockQuotePrefix"||Gn[1].type==="blockQuotePrefixWhitespace"||Gn[1].type==="blockQuoteMarker"||Gn[1].type==="listItemIndent"))break}Fs&&(!Sn||Fs<Sn)&&(sn._spread=!0),sn.end=Object.assign({},Sn?D[Sn][1].start:xr[1].end),D.splice(Sn||Te,0,["exit",sn,xr[2]]),Te++,de++}if(xr[1].type==="listItemPrefix"){let sr={type:"listItem",_spread:!1,start:Object.assign({},xr[1].start),end:void 0};sn=sr,D.splice(Te,0,["enter",sr,xr[2]]),Te++,de++,Fs=void 0,Vs=!0}}}return D[q][1]._spread=Gr,de}function o(D,q){return de;function de(Te){a.call(this,D(Te),Te),q&&q.call(this,Te)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(D,q,de){this.stack[this.stack.length-1].children.push(D),this.stack.push(D),this.tokenStack.push([q,de]),D.position={start:Us(q.start),end:void 0}}function l(D){return q;function q(de){D&&D.call(this,de),c.call(this,de)}}function c(D,q){let de=this.stack.pop(),Te=this.tokenStack.pop();if(Te)Te[0].type!==D.type&&(q?q.call(this,D,Te[0]):(Te[1]||U4).call(this,D,Te[0]));else throw new Error("Cannot close `"+D.type+"` ("+Ls({start:D.start,end:D.end})+"): it\u2019s not open");de.position.end=Us(D.end)}function u(){return hl(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(D){if(this.data.expectingFirstListItemValue){let q=this.stack[this.stack.length-2];q.start=Number.parseInt(this.sliceSerialize(D),10),this.data.expectingFirstListItemValue=void 0}}function f(){let D=this.resume(),q=this.stack[this.stack.length-1];q.lang=D}function m(){let D=this.resume(),q=this.stack[this.stack.length-1];q.meta=D}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){let D=this.resume(),q=this.stack[this.stack.length-1];q.value=D.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){let D=this.resume(),q=this.stack[this.stack.length-1];q.value=D.replace(/(\r?\n|\r)$/g,"")}function b(D){let q=this.resume(),de=this.stack[this.stack.length-1];de.label=q,de.identifier=Or(this.sliceSerialize(D)).toLowerCase()}function v(){let D=this.resume(),q=this.stack[this.stack.length-1];q.title=D}function C(){let D=this.resume(),q=this.stack[this.stack.length-1];q.url=D}function E(D){let q=this.stack[this.stack.length-1];if(!q.depth){let de=this.sliceSerialize(D).length;q.depth=de}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function F(D){let q=this.stack[this.stack.length-1];q.depth=this.sliceSerialize(D).codePointAt(0)===61?1:2}function le(){this.data.setextHeadingSlurpLineEnding=void 0}function ee(D){let de=this.stack[this.stack.length-1].children,Te=de[de.length-1];(!Te||Te.type!=="text")&&(Te=w_(),Te.position={start:Us(D.start),end:void 0},de.push(Te)),this.stack.push(Te)}function I(D){let q=this.stack.pop();q.value+=this.sliceSerialize(D),q.position.end=Us(D.end)}function ce(D){let q=this.stack[this.stack.length-1];if(this.data.atHardBreak){let de=q.children[q.children.length-1];de.position.end=Us(D.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(q.type)&&(ee.call(this,D),I.call(this,D))}function be(){this.data.atHardBreak=!0}function J(){let D=this.resume(),q=this.stack[this.stack.length-1];q.value=D}function pe(){let D=this.resume(),q=this.stack[this.stack.length-1];q.value=D}function ge(){let D=this.resume(),q=this.stack[this.stack.length-1];q.value=D}function ct(){let D=this.stack[this.stack.length-1];if(this.data.inReference){let q=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=q,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function yt(){let D=this.stack[this.stack.length-1];if(this.data.inReference){let q=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=q,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function Pt(D){let q=this.sliceSerialize(D),de=this.stack[this.stack.length-2];de.label=c4(q),de.identifier=Or(q).toLowerCase()}function wr(){let D=this.stack[this.stack.length-1],q=this.resume(),de=this.stack[this.stack.length-1];if(this.data.inReference=!0,de.type==="link"){let Te=D.children;de.children=Te}else de.alt=q}function w(){let D=this.resume(),q=this.stack[this.stack.length-1];q.url=D}function Nr(){let D=this.resume(),q=this.stack[this.stack.length-1];q.title=D}function Bn(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function Ft(D){let q=this.resume(),de=this.stack[this.stack.length-1];de.label=q,de.identifier=Or(this.sliceSerialize(D)).toLowerCase(),this.data.referenceType="full"}function Vt(D){this.data.characterReferenceType=D.type}function Br(D){let q=this.sliceSerialize(D),de=this.data.characterReferenceType,Te;de?(Te=Ub(q,de==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Te=Qu(q);let tt=this.stack.pop();tt.value+=Te,tt.position.end=Us(D.end)}function Wn(D){I.call(this,D);let q=this.stack[this.stack.length-1];q.url=this.sliceSerialize(D)}function Mt(D){I.call(this,D);let q=this.stack[this.stack.length-1];q.url="mailto:"+this.sliceSerialize(D)}function Bi(){return{type:"blockquote",children:[]}}function Wr(){return{type:"code",lang:null,meta:null,value:""}}function Wi(){return{type:"inlineCode",value:""}}function jo(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ld(){return{type:"emphasis",children:[]}}function xn(){return{type:"heading",depth:0,children:[]}}function Um(){return{type:"break"}}function cd(){return{type:"html",value:""}}function Zm(){return{type:"image",title:null,url:"",alt:null}}function ud(){return{type:"link",title:null,url:"",children:[]}}function Fm(D){return{type:"list",ordered:D.type==="listOrdered",start:null,spread:D._spread,children:[]}}function Do(D){return{type:"listItem",spread:D._spread,checked:null,children:[]}}function kn(){return{type:"paragraph",children:[]}}function Vm(){return{type:"strong",children:[]}}function w_(){return{type:"text",value:""}}function x_(){return{type:"thematicBreak"}}}function Us(t){return{line:t.line,column:t.column,offset:t.offset}}function F4(t,e){let r=-1;for(;++r<e.length;){let n=e[r];Array.isArray(n)?F4(t,n):Rte(t,n)}}function Rte(t,e){let r;for(r in e)if(Z4.call(e,r))switch(r){case"canContainEols":{let n=e[r];n&&t[r].push(...n);break}case"transforms":{let n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{let n=e[r];n&&Object.assign(t[r],n);break}}}function U4(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Ls({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Ls({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Ls({start:e.start,end:e.end})+") is still open")}function Cm(t){let e=this;e.parser=r;function r(n){return Y1(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function V4(t,e){let r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function q4(t,e){let r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
|
|
395
|
+
`;break}case-2:{s=e?" ":" ";break}case-1:{if(!e&&i)continue;s=" ";break}default:s=String.fromCharCode(o)}i=o===-2,n.push(s)}return n.join("")}var G1={};gd(G1,{attentionMarkers:()=>Cte,contentInitial:()=>$te,disable:()=>zte,document:()=>Ste,flow:()=>Ete,flowInitial:()=>Ite,insideSpan:()=>Ate,string:()=>Pte,text:()=>Tte});var Ste={42:Rr,43:Rr,45:Rr,48:Rr,49:Rr,50:Rr,51:Rr,52:Rr,53:Rr,54:Rr,55:Rr,56:Rr,57:Rr,62:Fb},$te={91:N1},Ite={[-2]:Em,[-1]:Em,32:Em},Ete={35:j1,42:_l,45:[Jb,_l],60:L1,61:Jb,95:_l,96:Bb,126:Bb},Pte={38:qb,92:Vb},Tte={[-5]:Tm,[-4]:Tm,[-3]:Tm,33:Z1,38:qb,42:Im,60:[z1,U1],91:F1,92:[M1,Vb],93:bl,95:Im,96:O1},Ate={null:[Im,C4]},Cte={null:[42,95]},zte={null:[]};function H1(t){let r=Zb([G1,...(t||{}).extensions||[]]),n={defined:[],lazy:{},constructs:r,content:i(E4),document:i(T4),flow:i(A4),string:i(z4),text:i(O4)};return n;function i(o){return s;function s(a){return M4(n,o,a)}}}function X1(t){for(;!Gb(t););return t}var j4=/[\0\t\n\r]/g;function K1(){let t=1,e="",r=!0,n;return i;function i(o,s,a){let l=[],c,u,d,p,f;for(o=e+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),d=0,e="",r&&(o.charCodeAt(0)===65279&&d++,r=void 0);d<o.length;){if(j4.lastIndex=d,c=j4.exec(o),p=c&&c.index!==void 0?c.index:o.length,f=o.charCodeAt(p),!c){e=o.slice(d);break}if(f===10&&d===p&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<p&&(l.push(o.slice(d,p)),t+=p-d),f){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:n=!0,t=1}d=p+1}return a&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}function Ls(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?D4(t.position):"start"in t||"end"in t?D4(t):"line"in t||"column"in t?J1(t):""}function J1(t){return L4(t&&t.line)+":"+L4(t&&t.column)}function D4(t){return J1(t&&t.start)+"-"+J1(t&&t.end)}function L4(t){return t&&typeof t=="number"?t:1}var Z4={}.hasOwnProperty;function Y1(t,e,r){return typeof e!="string"&&(r=e,e=void 0),Ote(r)(X1(H1(r).document().write(K1()(t,e,!0))))}function Ote(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(ud),autolinkProtocol:ee,autolinkEmail:ee,atxHeading:o(kn),blockQuote:o(Bi),characterEscape:ee,characterReference:ee,codeFenced:o(Wr),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(Wr,s),codeText:o(Wi,s),codeTextData:ee,data:ee,codeFlowValue:ee,definition:o(jo),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(ld),hardBreakEscape:o(Um),hardBreakTrailing:o(Um),htmlFlow:o(cd,s),htmlFlowData:ee,htmlText:o(cd,s),htmlTextData:ee,image:o(Zm),label:s,link:o(ud),listItem:o(Do),listItemValue:p,listOrdered:o(Fm,d),listUnordered:o(Fm),paragraph:o(Sn),reference:S,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(kn),strong:o(Vm),thematicBreak:o(x_)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:Mt,autolinkProtocol:Wn,blockQuote:l(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:Vt,characterReferenceMarkerNumeric:Vt,characterReferenceValue:Br,codeFenced:l(y),codeFencedFence:h,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:I,codeIndented:l(g),codeText:l(ge),codeTextData:I,data:I,definition:l(),definitionDestinationString:C,definitionLabelString:b,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(be),hardBreakTrailing:l(be),htmlFlow:l(J),htmlFlowData:I,htmlText:l(pe),htmlTextData:I,image:l(yt),label:wr,labelText:Pt,lineEnding:ce,link:l(ct),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Ft,resourceDestinationString:w,resourceTitleString:Nr,resource:Bn,setextHeading:l(le),setextHeadingLineSequence:F,setextHeadingText:T,strong:l(),thematicBreak:l()}};F4(e,(t||{}).mdastExtensions||[]);let r={};return n;function n(D){let q={type:"root",children:[]},de={stack:[q],tokenStack:[],config:e,enter:a,exit:c,buffer:s,resume:u,data:r},Te=[],tt=-1;for(;++tt<D.length;)if(D[tt][1].type==="listOrdered"||D[tt][1].type==="listUnordered")if(D[tt][0]==="enter")Te.push(tt);else{let Gr=Te.pop();tt=i(D,Gr,tt)}for(tt=-1;++tt<D.length;){let Gr=e[D[tt][0]];Z4.call(Gr,D[tt][1].type)&&Gr[D[tt][1].type].call(Object.assign({sliceSerialize:D[tt][2].sliceSerialize},de),D[tt][1])}if(de.tokenStack.length>0){let Gr=de.tokenStack[de.tokenStack.length-1];(Gr[1]||U4).call(de,void 0,Gr[0])}for(q.position={start:Us(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:Us(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},tt=-1;++tt<e.transforms.length;)q=e.transforms[tt](q)||q;return q}function i(D,q,de){let Te=q-1,tt=-1,Gr=!1,sn,$n,Fs,Vs;for(;++Te<=de;){let xr=D[Te];switch(xr[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{xr[0]==="enter"?tt++:tt--,Vs=void 0;break}case"lineEndingBlank":{xr[0]==="enter"&&(sn&&!Vs&&!tt&&!Fs&&(Fs=Te),Vs=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Vs=void 0}if(!tt&&xr[0]==="enter"&&xr[1].type==="listItemPrefix"||tt===-1&&xr[0]==="exit"&&(xr[1].type==="listUnordered"||xr[1].type==="listOrdered")){if(sn){let sr=Te;for($n=void 0;sr--;){let Gn=D[sr];if(Gn[1].type==="lineEnding"||Gn[1].type==="lineEndingBlank"){if(Gn[0]==="exit")continue;$n&&(D[$n][1].type="lineEndingBlank",Gr=!0),Gn[1].type="lineEnding",$n=sr}else if(!(Gn[1].type==="linePrefix"||Gn[1].type==="blockQuotePrefix"||Gn[1].type==="blockQuotePrefixWhitespace"||Gn[1].type==="blockQuoteMarker"||Gn[1].type==="listItemIndent"))break}Fs&&(!$n||Fs<$n)&&(sn._spread=!0),sn.end=Object.assign({},$n?D[$n][1].start:xr[1].end),D.splice($n||Te,0,["exit",sn,xr[2]]),Te++,de++}if(xr[1].type==="listItemPrefix"){let sr={type:"listItem",_spread:!1,start:Object.assign({},xr[1].start),end:void 0};sn=sr,D.splice(Te,0,["enter",sr,xr[2]]),Te++,de++,Fs=void 0,Vs=!0}}}return D[q][1]._spread=Gr,de}function o(D,q){return de;function de(Te){a.call(this,D(Te),Te),q&&q.call(this,Te)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(D,q,de){this.stack[this.stack.length-1].children.push(D),this.stack.push(D),this.tokenStack.push([q,de]),D.position={start:Us(q.start),end:void 0}}function l(D){return q;function q(de){D&&D.call(this,de),c.call(this,de)}}function c(D,q){let de=this.stack.pop(),Te=this.tokenStack.pop();if(Te)Te[0].type!==D.type&&(q?q.call(this,D,Te[0]):(Te[1]||U4).call(this,D,Te[0]));else throw new Error("Cannot close `"+D.type+"` ("+Ls({start:D.start,end:D.end})+"): it\u2019s not open");de.position.end=Us(D.end)}function u(){return hl(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(D){if(this.data.expectingFirstListItemValue){let q=this.stack[this.stack.length-2];q.start=Number.parseInt(this.sliceSerialize(D),10),this.data.expectingFirstListItemValue=void 0}}function f(){let D=this.resume(),q=this.stack[this.stack.length-1];q.lang=D}function m(){let D=this.resume(),q=this.stack[this.stack.length-1];q.meta=D}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){let D=this.resume(),q=this.stack[this.stack.length-1];q.value=D.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){let D=this.resume(),q=this.stack[this.stack.length-1];q.value=D.replace(/(\r?\n|\r)$/g,"")}function b(D){let q=this.resume(),de=this.stack[this.stack.length-1];de.label=q,de.identifier=Or(this.sliceSerialize(D)).toLowerCase()}function v(){let D=this.resume(),q=this.stack[this.stack.length-1];q.title=D}function C(){let D=this.resume(),q=this.stack[this.stack.length-1];q.url=D}function E(D){let q=this.stack[this.stack.length-1];if(!q.depth){let de=this.sliceSerialize(D).length;q.depth=de}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function F(D){let q=this.stack[this.stack.length-1];q.depth=this.sliceSerialize(D).codePointAt(0)===61?1:2}function le(){this.data.setextHeadingSlurpLineEnding=void 0}function ee(D){let de=this.stack[this.stack.length-1].children,Te=de[de.length-1];(!Te||Te.type!=="text")&&(Te=w_(),Te.position={start:Us(D.start),end:void 0},de.push(Te)),this.stack.push(Te)}function I(D){let q=this.stack.pop();q.value+=this.sliceSerialize(D),q.position.end=Us(D.end)}function ce(D){let q=this.stack[this.stack.length-1];if(this.data.atHardBreak){let de=q.children[q.children.length-1];de.position.end=Us(D.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(q.type)&&(ee.call(this,D),I.call(this,D))}function be(){this.data.atHardBreak=!0}function J(){let D=this.resume(),q=this.stack[this.stack.length-1];q.value=D}function pe(){let D=this.resume(),q=this.stack[this.stack.length-1];q.value=D}function ge(){let D=this.resume(),q=this.stack[this.stack.length-1];q.value=D}function ct(){let D=this.stack[this.stack.length-1];if(this.data.inReference){let q=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=q,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function yt(){let D=this.stack[this.stack.length-1];if(this.data.inReference){let q=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=q,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function Pt(D){let q=this.sliceSerialize(D),de=this.stack[this.stack.length-2];de.label=c4(q),de.identifier=Or(q).toLowerCase()}function wr(){let D=this.stack[this.stack.length-1],q=this.resume(),de=this.stack[this.stack.length-1];if(this.data.inReference=!0,de.type==="link"){let Te=D.children;de.children=Te}else de.alt=q}function w(){let D=this.resume(),q=this.stack[this.stack.length-1];q.url=D}function Nr(){let D=this.resume(),q=this.stack[this.stack.length-1];q.title=D}function Bn(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function Ft(D){let q=this.resume(),de=this.stack[this.stack.length-1];de.label=q,de.identifier=Or(this.sliceSerialize(D)).toLowerCase(),this.data.referenceType="full"}function Vt(D){this.data.characterReferenceType=D.type}function Br(D){let q=this.sliceSerialize(D),de=this.data.characterReferenceType,Te;de?(Te=Ub(q,de==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Te=Qu(q);let tt=this.stack.pop();tt.value+=Te,tt.position.end=Us(D.end)}function Wn(D){I.call(this,D);let q=this.stack[this.stack.length-1];q.url=this.sliceSerialize(D)}function Mt(D){I.call(this,D);let q=this.stack[this.stack.length-1];q.url="mailto:"+this.sliceSerialize(D)}function Bi(){return{type:"blockquote",children:[]}}function Wr(){return{type:"code",lang:null,meta:null,value:""}}function Wi(){return{type:"inlineCode",value:""}}function jo(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ld(){return{type:"emphasis",children:[]}}function kn(){return{type:"heading",depth:0,children:[]}}function Um(){return{type:"break"}}function cd(){return{type:"html",value:""}}function Zm(){return{type:"image",title:null,url:"",alt:null}}function ud(){return{type:"link",title:null,url:"",children:[]}}function Fm(D){return{type:"list",ordered:D.type==="listOrdered",start:null,spread:D._spread,children:[]}}function Do(D){return{type:"listItem",spread:D._spread,checked:null,children:[]}}function Sn(){return{type:"paragraph",children:[]}}function Vm(){return{type:"strong",children:[]}}function w_(){return{type:"text",value:""}}function x_(){return{type:"thematicBreak"}}}function Us(t){return{line:t.line,column:t.column,offset:t.offset}}function F4(t,e){let r=-1;for(;++r<e.length;){let n=e[r];Array.isArray(n)?F4(t,n):Rte(t,n)}}function Rte(t,e){let r;for(r in e)if(Z4.call(e,r))switch(r){case"canContainEols":{let n=e[r];n&&t[r].push(...n);break}case"transforms":{let n=e[r];n&&t[r].push(...n);break}case"enter":case"exit":{let n=e[r];n&&Object.assign(t[r],n);break}}}function U4(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Ls({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Ls({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Ls({start:e.start,end:e.end})+") is still open")}function Cm(t){let e=this;e.parser=r;function r(n){return Y1(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function V4(t,e){let r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,r),t.applyData(e,r)}function q4(t,e){let r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
|
|
396
396
|
`}]}function B4(t,e){let r=e.value?e.value+`
|
|
397
397
|
`:"",n={};e.lang&&(n.className=["language-"+e.lang]);let i={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function W4(t,e){let r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function G4(t,e){let r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function H4(t,e){let r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=Vn(n.toLowerCase()),o=t.footnoteOrder.indexOf(n),s,a=t.footnoteCounts.get(n);a===void 0?(a=0,t.footnoteOrder.push(n),s=t.footnoteOrder.length):s=o+1,a+=1,t.footnoteCounts.set(n,a);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};t.patch(e,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function X4(t,e){let r={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function K4(t,e){if(t.options.allowDangerousHtml){let r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function e_(t,e){let r=e.referenceType,n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];let i=t.all(e),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});let s=i[i.length-1];return s&&s.type==="text"?s.value+=n:i.push({type:"text",value:n}),i}function J4(t,e){let r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return e_(t,e);let i={src:Vn(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);let o={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,o),t.applyData(e,o)}function Y4(t,e){let r={src:Vn(e.url)};e.alt!==null&&e.alt!==void 0&&(r.alt=e.alt),e.title!==null&&e.title!==void 0&&(r.title=e.title);let n={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,n),t.applyData(e,n)}function Q4(t,e){let r={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,r);let n={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(e,n),t.applyData(e,n)}function e2(t,e){let r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return e_(t,e);let i={href:Vn(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);let o={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)}function t2(t,e){let r={href:Vn(e.url)};e.title!==null&&e.title!==void 0&&(r.title=e.title);let n={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function r2(t,e,r){let n=t.all(e),i=r?Nte(r):n2(e),o={},s=[];if(typeof e.checked=="boolean"){let u=n[0],d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},n.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a<n.length;){let u=n[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&s.push({type:"text",value:`
|
|
398
398
|
`}),u.type==="element"&&u.tagName==="p"&&!i?s.push(...u.children):s.push(u)}let l=n[n.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&s.push({type:"text",value:`
|
|
@@ -402,7 +402,7 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
402
402
|
`});++n<t.length;)n&&r.push({type:"text",value:`
|
|
403
403
|
`}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
|
|
404
404
|
`}),r}function b2(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function i_(t,e){let r=_2(t,e),n=r.one(t,void 0),i=y2(r),o=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&("children"in o,o.children.push({type:"text",value:`
|
|
405
|
-
`},i)),o}function zm(t,e){return t&&"run"in t?async function(r,n){let i=i_(r,{file:n,...e});await t.run(i,n)}:function(r,n){return i_(r,{file:n,...t||e})}}function tE(t){if(t)throw t}var a_=I_(P2(),1);function Om(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function rE(){let t=[],e={run:r,use:n};return e;function r(...i){let o=-1,s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...i);function a(l,...c){let u=t[++o],d=-1;if(l){s(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?T2(u,a)(...c):s(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function T2(t,e){let r;return n;function n(...s){let a=t.length>s.length,l;a&&s.push(i);try{l=t.apply(this,s)}catch(c){let u=c;if(a&&r)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(s,...a){r||(r=!0,e(s,...a))}function o(s){i(null,s)}}var or=class extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",o={},s=!1;if(r&&("line"in r&&"column"in r?o={place:r}:"start"in r&&"end"in r?o={place:r}:"type"in r?o={ancestors:[r],place:r.position}:o={...r}),typeof e=="string"?i=e:!o.cause&&e&&(s=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof n=="string"){let l=n.indexOf(":");l===-1?o.ruleId=n:(o.source=n.slice(0,l),o.ruleId=n.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){let l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}let a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=a?a.line:void 0,this.name=Ls(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}};or.prototype.file="";or.prototype.name="";or.prototype.reason="";or.prototype.message="";or.prototype.stack="";or.prototype.column=void 0;or.prototype.line=void 0;or.prototype.ancestors=void 0;or.prototype.cause=void 0;or.prototype.fatal=void 0;or.prototype.place=void 0;or.prototype.ruleId=void 0;or.prototype.source=void 0;var mi={basename:Vte,dirname:qte,extname:Bte,join:Wte,sep:"/"};function Vte(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Rm(t);let r=0,n=-1,i=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(o){r=i+1;break}}else n<0&&(o=!0,n=i+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let s=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(o){r=i+1;break}}else s<0&&(o=!0,s=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(n=i):(a=-1,n=s));return r===n?n=s:n<0&&(n=t.length),t.slice(r,n)}function qte(t){if(Rm(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Bte(t){Rm(t);let e=t.length,r=-1,n=0,i=-1,o=0,s;for(;e--;){let a=t.codePointAt(e);if(a===47){if(s){n=e+1;break}continue}r<0&&(s=!0,r=e+1),a===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||r<0||o===0||o===1&&i===r-1&&i===n+1?"":t.slice(i,r)}function Wte(...t){let e=-1,r;for(;++e<t.length;)Rm(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":Gte(r)}function Gte(t){Rm(t);let e=t.codePointAt(0)===47,r=Hte(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function Hte(t,e){let r="",n=0,i=-1,o=0,s=-1,a,l;for(;++s<=t.length;){if(s<t.length)a=t.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(i===s-1||o===1))if(i!==s-1&&o===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=s,o=0;continue}}else if(r.length>0){r="",n=0,i=s,o=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,s):r=t.slice(i+1,s),n=s-i-1;i=s,o=0}else a===46&&o>-1?o++:o=-1}return r}function Rm(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}var A2={cwd:Xte};function Xte(){return"/"}function td(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function C2(t){if(typeof t=="string")t=new URL(t);else if(!td(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Kte(t)}function Kte(t){if(t.hostname!==""){let n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}let e=t.pathname,r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){let n=e.codePointAt(r+2);if(n===70||n===102){let i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}var nE=["history","path","basename","stem","extname","dirname"],Nm=class{constructor(e){let r;e?td(e)?r={path:e}:typeof e=="string"||Jte(e)?r={value:e}:r=e:r={},this.cwd=A2.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<nE.length;){let o=nE[n];o in r&&r[o]!==void 0&&r[o]!==null&&(this[o]=o==="history"?[...r[o]]:r[o])}let i;for(i in r)nE.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?mi.basename(this.path):void 0}set basename(e){oE(e,"basename"),iE(e,"basename"),this.path=mi.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?mi.dirname(this.path):void 0}set dirname(e){z2(this.basename,"dirname"),this.path=mi.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?mi.extname(this.path):void 0}set extname(e){if(iE(e,"extname"),z2(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=mi.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){td(e)&&(e=C2(e)),oE(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?mi.basename(this.path,this.extname):void 0}set stem(e){oE(e,"stem"),iE(e,"stem"),this.path=mi.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){let i=this.message(e,r,n);throw i.fatal=!0,i}info(e,r,n){let i=this.message(e,r,n);return i.fatal=void 0,i}message(e,r,n){let i=new or(e,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function iE(t,e){if(t&&t.includes(mi.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+mi.sep+"`")}function oE(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function z2(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function Jte(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var O2=(function(t){let n=this.constructor.prototype,i=n[t],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,n),o});var Yte={}.hasOwnProperty,cE=class t extends O2{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=rE()}copy(){let e=new t,r=-1;for(;++r<this.attachers.length;){let n=this.attachers[r];e.use(...n)}return e.data((0,a_.default)(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(lE("data",this.frozen),this.namespace[e]=r,this):Yte.call(this.namespace,e)&&this.namespace[e]||void 0:e?(lE("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let i=r.call(e,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let r=s_(e),n=this.parser||this.Parser;return sE("parse",n),n(String(r),r)}process(e,r){let n=this;return this.freeze(),sE("process",this.parser||this.Parser),aE("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(o,s){let a=s_(e),l=n.parse(a);n.run(l,a,function(u,d,p){if(u||!d||!p)return c(u);let f=d,m=n.stringify(f,p);ere(m)?p.value=m:p.result=m,c(u,p)});function c(u,d){u||!d?s(u):o?o(d):r(void 0,d)}}}processSync(e){let r=!1,n;return this.freeze(),sE("processSync",this.parser||this.Parser),aE("processSync",this.compiler||this.Compiler),this.process(e,i),N2("processSync","process",r),n;function i(o,s){r=!0,tE(o),n=s}}run(e,r,n){R2(e),this.freeze();let i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?o(void 0,n):new Promise(o);function o(s,a){let l=s_(r);i.run(e,l,c);function c(u,d,p){let f=d||e;u?a(u):s?s(f):n(void 0,f,p)}}}runSync(e,r){let n=!1,i;return this.run(e,r,o),N2("runSync","run",n),i;function o(s,a){tE(s),i=a,n=!0}}stringify(e,r){this.freeze();let n=s_(r),i=this.compiler||this.Compiler;return aE("stringify",i),R2(e),i(e,n)}use(e,...r){let n=this.attachers,i=this.namespace;if(lE("use",this.frozen),e!=null)if(typeof e=="function")l(e,r);else if(typeof e=="object")Array.isArray(e)?a(e):s(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function o(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...d]=c;l(u,d)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=(0,a_.default)(!0,i.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let d=c[u];o(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,p=-1;for(;++d<n.length;)if(n[d][0]===c){p=d;break}if(p===-1)n.push([c,...u]);else if(u.length>0){let[f,...m]=u,h=n[p][1];Om(h)&&Om(f)&&(f=(0,a_.default)(!0,h,f)),n[p]=[c,f,...m]}}}},l_=new cE().freeze();function sE(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function aE(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function lE(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function R2(t){if(!Om(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function N2(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function s_(t){return Qte(t)?t:new Nm(t)}function Qte(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function ere(t){return typeof t=="string"||tre(t)}function tre(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var Mm=class extends vn{constructor(){super(...arguments);this.html=()=>`
|
|
405
|
+
`},i)),o}function zm(t,e){return t&&"run"in t?async function(r,n){let i=i_(r,{file:n,...e});await t.run(i,n)}:function(r,n){return i_(r,{file:n,...t||e})}}function tE(t){if(t)throw t}var a_=I_(P2(),1);function Om(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function rE(){let t=[],e={run:r,use:n};return e;function r(...i){let o=-1,s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...i);function a(l,...c){let u=t[++o],d=-1;if(l){s(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?T2(u,a)(...c):s(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function T2(t,e){let r;return n;function n(...s){let a=t.length>s.length,l;a&&s.push(i);try{l=t.apply(this,s)}catch(c){let u=c;if(a&&r)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(s,...a){r||(r=!0,e(s,...a))}function o(s){i(null,s)}}var or=class extends Error{constructor(e,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",o={},s=!1;if(r&&("line"in r&&"column"in r?o={place:r}:"start"in r&&"end"in r?o={place:r}:"type"in r?o={ancestors:[r],place:r.position}:o={...r}),typeof e=="string"?i=e:!o.cause&&e&&(s=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof n=="string"){let l=n.indexOf(":");l===-1?o.ruleId=n:(o.source=n.slice(0,l),o.ruleId=n.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){let l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}let a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=a?a.line:void 0,this.name=Ls(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}};or.prototype.file="";or.prototype.name="";or.prototype.reason="";or.prototype.message="";or.prototype.stack="";or.prototype.column=void 0;or.prototype.line=void 0;or.prototype.ancestors=void 0;or.prototype.cause=void 0;or.prototype.fatal=void 0;or.prototype.place=void 0;or.prototype.ruleId=void 0;or.prototype.source=void 0;var mi={basename:Vte,dirname:qte,extname:Bte,join:Wte,sep:"/"};function Vte(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Rm(t);let r=0,n=-1,i=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(o){r=i+1;break}}else n<0&&(o=!0,n=i+1);return n<0?"":t.slice(r,n)}if(e===t)return"";let s=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(o){r=i+1;break}}else s<0&&(o=!0,s=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(n=i):(a=-1,n=s));return r===n?n=s:n<0&&(n=t.length),t.slice(r,n)}function qte(t){if(Rm(t),t.length===0)return".";let e=-1,r=t.length,n;for(;--r;)if(t.codePointAt(r)===47){if(n){e=r;break}}else n||(n=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Bte(t){Rm(t);let e=t.length,r=-1,n=0,i=-1,o=0,s;for(;e--;){let a=t.codePointAt(e);if(a===47){if(s){n=e+1;break}continue}r<0&&(s=!0,r=e+1),a===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||r<0||o===0||o===1&&i===r-1&&i===n+1?"":t.slice(i,r)}function Wte(...t){let e=-1,r;for(;++e<t.length;)Rm(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":Gte(r)}function Gte(t){Rm(t);let e=t.codePointAt(0)===47,r=Hte(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function Hte(t,e){let r="",n=0,i=-1,o=0,s=-1,a,l;for(;++s<=t.length;){if(s<t.length)a=t.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(i===s-1||o===1))if(i!==s-1&&o===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=s,o=0;continue}}else if(r.length>0){r="",n=0,i=s,o=0;continue}}e&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+t.slice(i+1,s):r=t.slice(i+1,s),n=s-i-1;i=s,o=0}else a===46&&o>-1?o++:o=-1}return r}function Rm(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}var A2={cwd:Xte};function Xte(){return"/"}function td(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function C2(t){if(typeof t=="string")t=new URL(t);else if(!td(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Kte(t)}function Kte(t){if(t.hostname!==""){let n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}let e=t.pathname,r=-1;for(;++r<e.length;)if(e.codePointAt(r)===37&&e.codePointAt(r+1)===50){let n=e.codePointAt(r+2);if(n===70||n===102){let i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}var nE=["history","path","basename","stem","extname","dirname"],Nm=class{constructor(e){let r;e?td(e)?r={path:e}:typeof e=="string"||Jte(e)?r={value:e}:r=e:r={},this.cwd=A2.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<nE.length;){let o=nE[n];o in r&&r[o]!==void 0&&r[o]!==null&&(this[o]=o==="history"?[...r[o]]:r[o])}let i;for(i in r)nE.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?mi.basename(this.path):void 0}set basename(e){oE(e,"basename"),iE(e,"basename"),this.path=mi.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?mi.dirname(this.path):void 0}set dirname(e){z2(this.basename,"dirname"),this.path=mi.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?mi.extname(this.path):void 0}set extname(e){if(iE(e,"extname"),z2(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=mi.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){td(e)&&(e=C2(e)),oE(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?mi.basename(this.path,this.extname):void 0}set stem(e){oE(e,"stem"),iE(e,"stem"),this.path=mi.join(this.dirname||"",e+(this.extname||""))}fail(e,r,n){let i=this.message(e,r,n);throw i.fatal=!0,i}info(e,r,n){let i=this.message(e,r,n);return i.fatal=void 0,i}message(e,r,n){let i=new or(e,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function iE(t,e){if(t&&t.includes(mi.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+mi.sep+"`")}function oE(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function z2(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function Jte(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var O2=(function(t){let n=this.constructor.prototype,i=n[t],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,n),o});var Yte={}.hasOwnProperty,cE=class t extends O2{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=rE()}copy(){let e=new t,r=-1;for(;++r<this.attachers.length;){let n=this.attachers[r];e.use(...n)}return e.data((0,a_.default)(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(lE("data",this.frozen),this.namespace[e]=r,this):Yte.call(this.namespace,e)&&this.namespace[e]||void 0:e?(lE("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let i=r.call(e,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let r=s_(e),n=this.parser||this.Parser;return sE("parse",n),n(String(r),r)}process(e,r){let n=this;return this.freeze(),sE("process",this.parser||this.Parser),aE("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(o,s){let a=s_(e),l=n.parse(a);n.run(l,a,function(u,d,p){if(u||!d||!p)return c(u);let f=d,m=n.stringify(f,p);ere(m)?p.value=m:p.result=m,c(u,p)});function c(u,d){u||!d?s(u):o?o(d):r(void 0,d)}}}processSync(e){let r=!1,n;return this.freeze(),sE("processSync",this.parser||this.Parser),aE("processSync",this.compiler||this.Compiler),this.process(e,i),N2("processSync","process",r),n;function i(o,s){r=!0,tE(o),n=s}}run(e,r,n){R2(e),this.freeze();let i=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?o(void 0,n):new Promise(o);function o(s,a){let l=s_(r);i.run(e,l,c);function c(u,d,p){let f=d||e;u?a(u):s?s(f):n(void 0,f,p)}}}runSync(e,r){let n=!1,i;return this.run(e,r,o),N2("runSync","run",n),i;function o(s,a){tE(s),i=a,n=!0}}stringify(e,r){this.freeze();let n=s_(r),i=this.compiler||this.Compiler;return aE("stringify",i),R2(e),i(e,n)}use(e,...r){let n=this.attachers,i=this.namespace;if(lE("use",this.frozen),e!=null)if(typeof e=="function")l(e,r);else if(typeof e=="object")Array.isArray(e)?a(e):s(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function o(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...d]=c;l(u,d)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=(0,a_.default)(!0,i.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let d=c[u];o(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,p=-1;for(;++d<n.length;)if(n[d][0]===c){p=d;break}if(p===-1)n.push([c,...u]);else if(u.length>0){let[f,...m]=u,h=n[p][1];Om(h)&&Om(f)&&(f=(0,a_.default)(!0,h,f)),n[p]=[c,f,...m]}}}},l_=new cE().freeze();function sE(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function aE(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function lE(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function R2(t){if(!Om(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function N2(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function s_(t){return Qte(t)?t:new Nm(t)}function Qte(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function ere(t){return typeof t=="string"||tre(t)}function tre(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var Mm=class extends wn{constructor(){super(...arguments);this.html=()=>`
|
|
406
406
|
|
|
407
407
|
<!-- Styling -->
|
|
408
408
|
<style>
|
|
@@ -489,7 +489,7 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
489
489
|
<div class='llm-selector-item-icon' style="background-image: url('${n.icon}'); "></div>
|
|
490
490
|
<div class='llm-selector-item-name'>${n.name}</div>
|
|
491
491
|
<div class='llm-selector-item-provider'>${n.provider}</div>
|
|
492
|
-
`,i.addEventListener("click",o=>{this.dispatchEvent(new CustomEvent("select",{detail:n.id}))}),r.appendChild(i)}}};Mm.observedAttributes=["open"];var rd=new Oe("ONNXModel"),hi=class t{constructor(e){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=e,rd.debug(`Model input parameters: ${e.inputNames.join(", ")}`),rd.debug(`Model output parameters: ${e.outputNames.join(", ")}`)}static isSupported(){return!!t.lib}static async load(e){if(!t.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(rd.debug("Loading ONNX runtime"),this.onnx=await t.lib()),rd.debug(`Loading model: ${e}`);let r=await this.onnx.InferenceSession.create(e);return new t(r)}makeTensor(e,r,n=0){let i=1;for(let s of r)i*=s;let o;if(e=="float32")o=new t.onnx.Tensor(new Float32Array(i),r);else if(e=="int8")o=new t.onnx.Tensor(new Int8Array(i),r);else if(e=="int16")o=new t.onnx.Tensor(new Int16Array(i),r);else if(e=="int32")o=new t.onnx.Tensor(new Int32Array(i),r);else if(e=="int64")o=new t.onnx.Tensor(new BigInt64Array(i),r);else if(e=="uint8")o=new t.onnx.Tensor(new Uint8Array(i),r);else if(e=="uint16")o=new t.onnx.Tensor(new Uint16Array(i),r);else if(e=="uint32")o=new t.onnx.Tensor(new Uint32Array(i),r);else if(e=="uint64")o=new t.onnx.Tensor(new BigUint64Array(i),r);else throw new Error(`Invalid type: ${e}`);return n!==0&&(e=="int64"||e=="uint64")?o.data.fill(BigInt(n)):n!==0&&o.data.fill(n),o}registerConstant(e,r){if(!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);return this.constantTensors[e]=r,r}makeConstant(e,r,n,i=0){return this.registerConstant(e,this.makeTensor(r,n,i))}registerState(e,r,n){if(r||(r=e),!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);if(!this.session.outputNames.includes(r))throw new Error(`Model does not have an output named: ${r}`);return this.stateTensors[e]={outputName:r,tensor:n},n}makeState(e,r,n,i,o=0){return this.registerState(e,r,this.makeTensor(n,i,o))}async run(e={}){if(this._runActive&&this.ignoreIfBusy)return rd.debug("Ignoring run request because a previous run is still active");if(this._runActive)throw new Error("A previous run is still active");this._runActive=!0;for(let r in this.stateTensors)e[r]=this.stateTensors[r].tensor;for(let r in this.constantTensors)e[r]=this.constantTensors[r];try{let r=await this.session.run(e);for(let n in this.stateTensors){let i=r[this.stateTensors[n].outputName];this.stateTensors[n].tensor=i}return r}finally{this._runActive=!1}}resetState(){rd.debug("Resetting state tensors");for(let e in this.stateTensors)this.stateTensors[e].tensor.data.fill(0)}};var M2="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var nre=new Oe("PCMPlayerNode"),nd=class extends AudioWorkletNode{constructor(r,n,i){super(r,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!n||n<=0)throw new Error(`Invalid sample rate: ${n}`);if(!i||i!="int16"&&i!="float32")throw new Error(`Invalid format: ${i}`);this.sampleRate=n,this.format=i,this.port.onmessage=o=>this.onWorkletMessage(o),this.port.postMessage({action:"start",inputSampleRate:n,outputSampleRate:r.sampleRate,format:i})}static async registerModule(r){await r.audioWorklet.addModule(M2)}feed(r){this.port.postMessage({action:"data",buffer:r.buffer},[r.buffer])}async play(r){if(this.isCancelled)throw new Error("PCMPlayerNode has already been cancelled.");if(this._playPromise)throw new Error("Already playing a stream");this._playPromise=new Promise(n=>this._playPromiseResolve=n),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:r}}));try{let n=r.getReader();for(;!this.isCancelled;){let{done:i,value:o}=await n.read();if(i||!o)break;this.feed(o)}}catch(n){nre.warn("Stream error:",n),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:r,error:n}}))}this.port.postMessage({action:"end"}),await this._playPromise}onWorkletMessage(r){r.data.action=="end"&&(this._playPromiseResolve?.(),this.dispatchEvent(new CustomEvent("end",{detail:{player:this}})))}stop(){this.isCancelled=!0,this.port.postMessage({action:"cancel"}),this._playPromiseResolve?.()}};var qn=new Oe("ElevenLabs");function uE(t,e,r="pcm_24000"){let n=[],i=Date.now(),o=!1,s,a;return{stream:new ReadableStream({start:d=>{s=d,a=new WebSocket(`wss://api.elevenlabs.io/v1/text-to-speech/${e}/stream-input?inactivity_timeout=120&output_format=${r}`),a.addEventListener("open",()=>{qn.debug(`[at ${Date.now()-i}ms] WebSocket connected`),a.send(JSON.stringify({text:" ","xi-api-key":t}));for(let p of n)a.send(JSON.stringify({text:p}));n.length=0}),a.addEventListener("close",()=>{qn.debug(`[at ${Date.now()-i}ms] WebSocket closed`),s?.close(),o=!0}),a.addEventListener("message",p=>{let f=JSON.parse(p.data);if(f.final){a.close(),s?.close();return}if(qn.debug(`[at ${Date.now()-i}ms] Message received: ${f.audio?.length||0} bytes of audio data`),!f.audio)return;let m=Uint8Array.from(atob(f.audio),h=>h.charCodeAt(0));s?.enqueue(m)})},cancel:()=>{qn.debug(`[at ${Date.now()-i}ms] Stream cancelled`),a?.close(),o=!0}}),sendText:d=>{d&&(qn.debug(`[at ${Date.now()-i}ms] Sending text: "${d}"`),a?.readyState===WebSocket.OPEN?a.send(JSON.stringify({text:d})):n.push(d))},endText:()=>{a?.readyState===WebSocket.OPEN?a.send(JSON.stringify({text:""})):n.push("")},get isClosed(){return o}}}function j2(t,e="pcm_16000",r=16e3,n="vad"){let i=[],o=Date.now(),s=!1,a,l;return{stream:new ReadableStream({start:async f=>{a=f;let m=await fetch("https://api.elevenlabs.io/v1/single-use-token/realtime_scribe",{method:"POST",headers:{"xi-api-key":t}});if(!m.ok)throw new Error(`Failed to generate single-use token: ${m.status} ${m.statusText}`);let h=await m.json(),y=h.token;if(!y)throw new Error(`No token found in response: ${JSON.stringify(h)}`);l=new WebSocket(`wss://api.elevenlabs.io/v1/speech-to-text/realtime?token=${encodeURIComponent(y)}&audio_format=${e}&commit_strategy=${n}`),l.addEventListener("open",()=>{qn.debug(`[at ${Date.now()-o}ms] WebSocket connected`);for(let g of i)l.send(g);i.length=0}),l.addEventListener("close",()=>{qn.debug(`[at ${Date.now()-o}ms] WebSocket closed`),a?.close(),s=!0}),l.addEventListener("message",g=>{let b=JSON.parse(g.data);b.message_type=="committed_transcript"?(qn.debug(`[at ${Date.now()-o}ms] Committed transcript received: "${b.text}"`),a?.enqueue(b.text)):b.error&&(qn.warn(`[at ${Date.now()-o}ms] Error received: ${b.error}`),a?.error(new Error(b.error)),l?.close(),s=!0)})},cancel:()=>{qn.debug(`[at ${Date.now()-o}ms] Stream cancelled`),l?.close(),s=!0}}),sendAudio:f=>{let m=JSON.stringify({message_type:"input_audio_chunk",audio_base_64:btoa(String.fromCharCode(...new Uint8Array(f))),commit:!1,sample_rate:r});qn.debug(`[at ${Date.now()-o}ms] Sending audio: ${f.byteLength} bytes`),l?.readyState===WebSocket.OPEN?l.send(m):i.push(m)},commit:()=>{let f=JSON.stringify({message_type:"input_audio_chunk",audio_base_64:"",commit:!0,sample_rate:r});l?.readyState===WebSocket.OPEN?l.send(f):i.push(f)},close:()=>{qn.debug("Closing connection"),l?.close(),s=!0,setTimeout(()=>{a?.close()},1e3)},get isClosed(){return s}}}var c_=new Oe("SpeechOutput"),D2=.5,ire=.8,u_=class extends EventTarget{constructor(r){super();this.autoSpeak=!0;this.preemptiveConnection=!0;this.processedMessages=new Set;this.maxVolumeHeard=0;this._queuedText=[];this._queueActive=!1;this.ai=r,this.ai.addEventListener("output",n=>this.onOutputFromAI(n)),this.ai.audio?.speechRecognition.addEventListener("speechstart",n=>this.interrupt())}onOutputFromAI(r){let n=r.detail.messages,i=r.detail.isPartial;if(!(!this.ai?.audio?.speechRecognition.isRunning||!this.autoSpeak)){for(let o of n)if(!o.streamingInProgress&&!(!o.id||this.processedMessages.has(o.id))){this.processedMessages.add(o.id);for(let s of o.sections||[])s.type=="text"&&s.text&&this.speak(s.text)}i||this.processedMessages.clear()}}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let r=0;for(let i of this.analyserBuffer)r+=i*i;let n=Math.sqrt(r/this.analyserBuffer.length);return n>this.maxVolumeHeard&&(this.maxVolumeHeard=n),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,n/this.maxVolumeHeard))}async speak(r){if(!this.ai?.config?.voice?.providerID)return c_.warn("No voice provider configured");this.ai._voiceTracker?.(`Added text to queue: ${r}`),this._queuedText.push(r),this._runQueue()}async _runQueue(){if(this._queueActive)return;let r=this._queuedText.shift();if(!r)return;this._queueActive=!0;let n=`speech-${ore++}`;try{await this.ai.audio.beginAccess(n),await this._speakWithLock(r)}finally{this._queueActive=!1,this.ai.audio.endAccess(n)}this._queuedText.length?await this._runQueue():this.onSpeechEnd()}_getElevenLabsConnection(){let r=this._elevenLabsPrecachedConnection;return(!r||r.isClosed)&&(r=uE(this.ai.config.voice.apiKey,this.ai.config.voice.voiceID,"pcm_24000")),this.preemptiveConnection&&(this._elevenLabsPrecachedConnection=uE(this.ai.config.voice.apiKey,this.ai.config.voice.voiceID,"pcm_24000")),r}async _speakWithLock(r){let n=new CustomEvent("speechfilter",{detail:{ai:this.ai,message:r}});if(this.dispatchEvent(n),r=n.detail.message,n.defaultPrevented||!r)return;this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=ire);let i=this.ai?._voiceTracker||c_.timer(`${this.ai.config.voice.providerID} voice`);i(`Speak: ${r}`),this.currentPlayerVolume?.disconnect(),this.currentPlayerVolume=this.ai.audio.context.createGain(),this.currentPlayerVolume.connect(this.ai.audio.context.destination),this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,this.analyserNode.connect(this.currentPlayerVolume),this.maxVolumeHeard=0,this.analyserBuffer=new Float32Array(this.analyserNode.fftSize);let o=new nd(this.ai.audio.context,24e3,"int16");this.currentPlayer=o,o.connect(this.analyserNode),o.addEventListener("end",l=>{let c=l;i(`PCM stream ${c.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==o&&!c.detail.interrupted&&(this.currentPlayer=void 0)});let s=Date.now(),a=null;if(this.ai.config.voice.providerID=="openai"){let l=await fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.ai.config.voice.apiKey}`},body:JSON.stringify({model:"tts-1",input:r,voice:this.ai.config.voice.voiceID,response_format:"pcm"})});if(!l.ok){c_.warn(`Failed to generate voice sample: ${l.status} ${l.statusText}`);return}a=l.body}else if(this.ai.config.voice.providerID=="elevenlabs"){let l=this._getElevenLabsConnection();l.sendText(r),l.endText(),a=l.stream}else{c_.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}i(`Received response in ${Date.now()-s}ms`),this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:r}})),i("Playing PCM stream"),await o.play(a),i("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(this._queuedText=[],!this.currentPlayerVolume)return;this.ai._voiceTracker?.("Interrupted");let r=this.currentPlayerVolume,n=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=D2);let i=400;r.gain.linearRampToValueAtTime(0,i/1e3),await new Promise(o=>setTimeout(o,i+250)),r.disconnect(),n?.stop(),n?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=D2)}},ore=1;function d_(t,e){let r=e.reduce((l,c)=>l+c.byteLength,0),n=new DataView(new ArrayBuffer(44));n.setUint8(0,82),n.setUint8(1,73),n.setUint8(2,70),n.setUint8(3,70),n.setUint32(4,44+r,!0),n.setUint8(8,87),n.setUint8(9,65),n.setUint8(10,86),n.setUint8(11,69);let i=1,o=32,s=i*o/8,a=t*s;return n.setUint8(12,102),n.setUint8(13,109),n.setUint8(14,116),n.setUint8(15,32),n.setUint32(16,16,!0),n.setUint16(20,3,!0),n.setUint16(22,i,!0),n.setUint32(24,t,!0),n.setUint32(28,a,!0),n.setUint16(32,s,!0),n.setUint16(34,o,!0),n.setUint8(36,100),n.setUint8(37,97),n.setUint8(38,116),n.setUint8(39,97),n.setUint32(40,r,!0),new File([n,...e],"audio.wav",{type:"audio/wav"})}var L2="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var id=class extends AudioWorkletNode{constructor(r,n,i,o){super(r,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=i;let s=["int16","int64","float32"];if(!n||n<=0)throw new Error(`Invalid sample rate: ${n}`);if(!s.includes(i))throw new Error(`Invalid format ${i}, must be one of: ${s.join(", ")}`);if(!o||o<=0)throw new Error(`Invalid buffer size: ${o}`);this.port.onmessage=a=>this.onWorkletMessage(a),this.port.postMessage({action:"start",inputSampleRate:r.sampleRate,outputSampleRate:n,format:i,bufferSize:o})}static async registerModule(r){await r.audioWorklet.addModule(L2)}onWorkletMessage(r){if(r.data.action=="data"){let n=null;if(this.format=="int16"&&(n=new Int16Array(r.data.buffer)),this.format=="int64"&&(n=new BigInt64Array(r.data.buffer)),this.format=="float32"&&(n=new Float32Array(r.data.buffer)),!n)throw new Error(`Invalid format: ${this.format}`);this.onData(n),this.dispatchEvent(new CustomEvent("data",{detail:{data:n}}))}}onData(r){}};var dE=16e3,f_=256,od=8,jm=new Oe("VoiceDetectionNode"),Dm=class Dm extends id{constructor(r){super(r,dE,"float32",f_*od);this.isVoiceActive=!1;this.lastVoiceActiveDate=0;this.voiceEndTimeout=50;this.sensitivity=.5;this.sentivityEnd=.2;this.nextVadReset=0;this.currentProbability=0;this._lastVoiceActive=!1;if(!Dm.vadModelURL)throw new Error("VAD model url not set, please load it and set it to VoiceDetectionNode.vadModelURL");this.loadModel()}get isVoicePossiblyEnding(){return this.isVoiceActive&&this.currentProbability<this.sensitivity}get sampleRate(){return dE}get numberOfSamples(){return f_}get numberOfSampleChunks(){return od}get outputBufferSize(){return f_*od}get isModelLoaded(){return!!this.vad}async loadModel(){jm.debug("Loading VAD model"),this.vad=await hi.load(Dm.vadModelURL),this.vad.ignoreIfBusy=!0,jm.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],dE),this.vad.makeState("h","hn","float32",[2,od,64]),this.vad.makeState("c","cn","float32",[2,od,64])}async onData(r){if(this.vad)try{let n=await this.vad.run({input:new hi.onnx.Tensor(r,[od,f_])});if(!n)return;this.currentProbability=0;for(let s=0;s<n.output.data.length;s++)n.output.data[s]>this.currentProbability&&(this.currentProbability=n.output.data[s]);let i=this.isVoiceActive?this.sentivityEnd:this.sensitivity,o=this.currentProbability>i;if(!o&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=o,o&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),jm.debug("Started speaking")):o?this.lastVoiceActiveDate=Date.now():!o&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!o&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),jm.debug("Stopped speaking after timeout")),!o){let s=Date.now();s>this.nextVadReset&&(this.nextVadReset=s+5e3,this.vad.resetState())}}catch(n){jm.error("VAD failed:",n)}}onSpeechStart(){}onSpeechEnd(){}};Dm.vadModelURL="";var sd=Dm;var U2=new Oe("VoiceChunkOutputNode"),Zs=class extends sd{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((r,n)=>r+n.length,0)/8e3}async onData(r){if(await super.onData(r),this.isVoiceActive&&!this._voiceRecording){U2.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let n of this.buffers)this.recordedBuffers.push(n),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:n,isFinal:!1}})),this.onVoiceChunk(n);this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!1}})),this.onVoiceChunk(r),this.buffers=[]}else if(this.isVoiceActive)this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!1}})),this.onVoiceChunk(r);else if(!this.isVoiceActive&&this._voiceRecording){this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!0}})),this.onVoiceChunk(r),this._voiceRecording=!1;let n=this.recordedBuffers.reduce((i,o)=>i+o.length,0);U2.debug(`Voice complete, recorded ${(n/8e3).toFixed(2)} seconds of audio, ${n*4/1024} KB of data`),this.dispatchEvent(new CustomEvent("voicedataend",{detail:{data:this.recordedBuffers}})),this.onVoiceEnd(this.recordedBuffers),this.recordedBuffers=[]}else for(this.buffers.push(r);this.bufferDuration>this.backBufferDurationSeconds;)this.buffers.shift()}onVoiceChunk(r){}onVoiceEnd(r){}};var p_=new Oe("OpenAITranscriptionNode"),m_=class extends Zs{constructor(r,n){super(r);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=n}async onVoiceEnd(r){let n=p_.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...r);let i=d_(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let o="";try{let s=new FormData;s.append("file",i),s.append("model","whisper-1"),s.append("response_format","text");let a=await fetch("https://api.openai.com/v1/audio/transcriptions",{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:s,signal:this.lastRequestAbortController.signal});if(!a.ok)throw new Error(`Failed to generate voice sample: ${a.status} ${a.statusText}`);n("Response received"),o=await a.text(),n("Content received: "+o),this.lastRequestAbortController=void 0}catch(s){p_.error(`Failed to transcribe speech: ${s.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!o)return p_.debug("Transcription complete, but no text was found");p_.debug(`Transcription: ${o}`),this.onVoiceTranscription(o),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:o}}))}onVoiceTranscription(r){}};var h_=class extends WebSocket{constructor(r){super(r);this.pendingData=[];this.addEventListener("open",()=>this._onOpen())}send(r){this.readyState==WebSocket.OPEN?super.send(r):this.pendingData.push(r)}_onOpen(){for(let r of this.pendingData)super.send(r);this.pendingData=[]}};var qi=new Oe("IntelliWeaveTranscriptionNode"),are="wss://speech.intelliweave.ai/api/v1/transcribe",y_=class y_ extends Zs{constructor(r,n){super(r);this.apiAddress=are;this.apiKey="";this.isTranscribing=!1;this.apiKey=n}async onVoiceChunk(r){this.isTranscribing=!0,this.ws?this.ws.send(r):(qi.debug("Opening WebSocket connection"),this.ws=new h_(this.apiAddress),this.ws.send(JSON.stringify({type:"hello",sampleRate:16e3,channels:1,format:"float32",apiKey:this.apiKey})),this.ws.send(r.buffer),this.ws.onopen=()=>{qi.debug("WebSocket connection opened")},this.ws.addEventListener("message",i=>{let o=JSON.parse(i.data);if(o.error)return qi.warn("Error: "+o.error);if(o.type!="transcription")return qi.warn("Invalid response type",o);if(o.streaming&&!o.final)return qi.debug("Partial transcription: "+o.partialText);if(this.isTranscribing=!1,!o.text.trim())return qi.warn(`Empty transcription (${o.processingTime}ms)`);qi.debug(`Transcription: ${o.text} (${o.processingTime}ms)`),this.onVoiceTranscription(o.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:o.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",i=>qi.warn("WebSocket error")));let n=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{qi.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},n)}async onVoiceEnd(r){if(this.ws?.send(JSON.stringify({type:"end"})),y_.debugExportWav){let n=d_(this.sampleRate,r),i=document.createElement("a");i.href=URL.createObjectURL(n),i.download="recording.wav",i.click()}}onVoiceTranscription(r){}onSocketClose(){qi.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};y_.debugExportWav=!1;var g_=y_;var ad=new Oe("ElevenLabsTranscriptionNode"),b_=class extends Zs{constructor(r,n){super(r);this.apiKey="";this.isTranscribing=!1;this.apiKey=n}async onVoiceChunk(r){this.isTranscribing=!0;let n=new Int16Array(r.length);for(let o=0;o<r.length;o++)n[o]=r[o]*32767;!this.connection||this.connection.isClosed?(this.connection?.close(),this.connection=void 0,ad.debug(`Opening connection. sampleRate: ${this.sampleRate} format=${this.format}`),this.connection=j2(this.apiKey,"pcm_"+this.sampleRate,this.sampleRate,"manual"),this.startReading(this.connection),this.connection.sendAudio(n.buffer)):this.connection.sendAudio(n.buffer);let i=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{ad.debug("Shutting down WebSocket connection"),this.connection?.close(),this.connection=void 0},i)}async startReading(r){let n=r.stream.getReader();try{for(;;){let{value:i,done:o}=await n.read();if(o){ad.debug("Stream closed");break}if(!i?.trim()){ad.warn("Empty transcription received");continue}this.isTranscribing=!1,ad.debug(`Transcription: ${i}`),this.onVoiceTranscription(i),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:i}}))}}catch(i){ad.error(`Failed to read transcription stream: ${i.message}`),this.connection==r&&(this.connection=void 0);return}}async onVoiceEnd(r){this.connection?.commit()}onVoiceTranscription(r){}};var fE=new Oe("SpeechRecognition"),__=class extends EventTarget{constructor(r){super();this.isRunning=!1;this._skipEvents=!1;this.maxVolumeHeard=0;this.ai=r}get isSupported(){if(!hi.lib||!this.ai?.vadModel||!ns().AudioWorkletNode)return!1;if(this.ai?.config?.transcription?.providerID!="intelliweave"){if(!(this.ai?.config?.transcription?.providerID=="openai"&&this.ai.config?.transcription?.apiKey)){if(!(this.ai?.config?.transcription?.providerID=="elevenlabs"&&this.ai.config?.transcription?.apiKey))return!1}}return!0}async start(){if(!this.isSupported)throw new Error("Speech recognition not supported in this persona and browser.");if(!this.isRunning){this.isRunning=!0;try{await this.ai.audio.beginAccess("speech-recognition"),this.micStream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}});let r=this.ai.audio.context.createMediaStreamSource(this.micStream);this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,r.connect(this.analyserNode),this.analyserBuffer=new Float32Array(this.analyserNode.fftSize),sd.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new m_(this.ai.audio.context,this.ai.config.transcription.apiKey),r.connect(this.voiceDetection)):this.ai?.config?.transcription?.providerID=="elevenlabs"?(this.voiceDetection=new b_(this.ai.audio.context,this.ai.config.transcription.apiKey),r.connect(this.voiceDetection)):(this.voiceDetection=new g_(this.ai.audio.context,this.ai.apiKey),this.voiceDetection.apiAddress=this.ai?.config?.transcription?.url||this.voiceDetection.apiAddress,r.connect(this.voiceDetection)),this.voiceDetection.addEventListener("speechstart",n=>{this.ai._voiceTracker=fE.timer("voice interaction","Speech started"),this.recordingStartTime=Date.now(),Vr(this.ai,{event_type:"voice_start",event_properties:{audio_provider:this.ai.config?.transcription?.providerID||"intelliweave",sample_rate:16e3}}),this.dispatchEvent(new CustomEvent(n.type,{detail:n.detail}))}),this.voiceDetection.addEventListener("speechend",n=>{this.ai._voiceTracker?.("Speech ended");let i=this.recordingStartTime?Date.now()-this.recordingStartTime:0;Vr(this.ai,{event_type:"voice_end",event_properties:{recording_duration_ms:i}}),this.dispatchEvent(new CustomEvent(n.type,{detail:n.detail}))}),this.voiceDetection.addEventListener("transcription",n=>{this.ai._voiceTracker?.(`Transcription: ${n.detail.text}`),Vr(this.ai,{event_type:"voice_submit",value_str:"",event_properties:{transcription_provider:this.ai.config?.transcription?.providerID||"intelliweave",confidence_score:n.detail.confidence||void 0}}),this.onTranscription(n)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(r){fE.error("Failed to start speech recognition:",r),this.stop()}}}stop(){this.isRunning&&(this.isRunning=!1,this.ai.audio.endAccess("speech-recognition"),this.voiceDetection?.disconnect(),this.voiceDetection=void 0,this.micStream?.getTracks().forEach(r=>r.stop()),this.micStream=void 0,this.analyserNode=void 0,this.analyserBuffer=void 0,this._skipEvents||this.dispatchEvent(new CustomEvent("end",{detail:{speechRecognition:this}})))}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let r=0;for(let i of this.analyserBuffer)r+=i*i;let n=Math.sqrt(r/this.analyserBuffer.length);return n>this.maxVolumeHeard&&(this.maxVolumeHeard=n),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,n/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(r){let n=r.detail.text;fE.debug("Heard:",n),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:n,isFinal:!0}}))}async reset(){if(this.isRunning){this._skipEvents=!0;try{this.stop(),await this.start(),this._skipEvents=!1}catch(r){throw this._skipEvents=!1,r}}}};var v_=new Oe("AudioSystem"),Lm=class t{constructor(e){this.locks=[];if(!e)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=e,this.ai.audio=this,this.speechRecognition=new __(this.ai),this.speechOutput=new u_(this.ai)}static get isSupported(){return!(!hi.lib||!ns().AudioWorkletNode)}static async registerModules(e){await Promise.all([nd.registerModule(e),id.registerModule(e)])}async beginAccess(e){v_.debug(`Began access for: ${e}`),this.locks.includes(e)||this.locks.push(e),!this.context&&(v_.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await t.registerModules(this.context))}endAccess(e){v_.debug(`Ended access for: ${e}`),this.locks=this.locks.filter(r=>r!=e),!this.locks.length&&(v_.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var on=new Oe("Embed"),vl=class extends vn{constructor(){super();this.config={};this.suggestions=[];this._previousOpenState=!1;this.html=()=>`
|
|
492
|
+
`,i.addEventListener("click",o=>{this.dispatchEvent(new CustomEvent("select",{detail:n.id}))}),r.appendChild(i)}}};Mm.observedAttributes=["open"];var rd=new Oe("ONNXModel"),hi=class t{constructor(e){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=e,rd.debug(`Model input parameters: ${e.inputNames.join(", ")}`),rd.debug(`Model output parameters: ${e.outputNames.join(", ")}`)}static isSupported(){return!!t.lib}static async load(e){if(!t.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(rd.debug("Loading ONNX runtime"),this.onnx=await t.lib()),rd.debug(`Loading model: ${e}`);let r=await this.onnx.InferenceSession.create(e);return new t(r)}makeTensor(e,r,n=0){let i=1;for(let s of r)i*=s;let o;if(e=="float32")o=new t.onnx.Tensor(new Float32Array(i),r);else if(e=="int8")o=new t.onnx.Tensor(new Int8Array(i),r);else if(e=="int16")o=new t.onnx.Tensor(new Int16Array(i),r);else if(e=="int32")o=new t.onnx.Tensor(new Int32Array(i),r);else if(e=="int64")o=new t.onnx.Tensor(new BigInt64Array(i),r);else if(e=="uint8")o=new t.onnx.Tensor(new Uint8Array(i),r);else if(e=="uint16")o=new t.onnx.Tensor(new Uint16Array(i),r);else if(e=="uint32")o=new t.onnx.Tensor(new Uint32Array(i),r);else if(e=="uint64")o=new t.onnx.Tensor(new BigUint64Array(i),r);else throw new Error(`Invalid type: ${e}`);return n!==0&&(e=="int64"||e=="uint64")?o.data.fill(BigInt(n)):n!==0&&o.data.fill(n),o}registerConstant(e,r){if(!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);return this.constantTensors[e]=r,r}makeConstant(e,r,n,i=0){return this.registerConstant(e,this.makeTensor(r,n,i))}registerState(e,r,n){if(r||(r=e),!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);if(!this.session.outputNames.includes(r))throw new Error(`Model does not have an output named: ${r}`);return this.stateTensors[e]={outputName:r,tensor:n},n}makeState(e,r,n,i,o=0){return this.registerState(e,r,this.makeTensor(n,i,o))}async run(e={}){if(this._runActive&&this.ignoreIfBusy)return rd.debug("Ignoring run request because a previous run is still active");if(this._runActive)throw new Error("A previous run is still active");this._runActive=!0;for(let r in this.stateTensors)e[r]=this.stateTensors[r].tensor;for(let r in this.constantTensors)e[r]=this.constantTensors[r];try{let r=await this.session.run(e);for(let n in this.stateTensors){let i=r[this.stateTensors[n].outputName];this.stateTensors[n].tensor=i}return r}finally{this._runActive=!1}}resetState(){rd.debug("Resetting state tensors");for(let e in this.stateTensors)this.stateTensors[e].tensor.data.fill(0)}};var M2="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var nre=new Oe("PCMPlayerNode"),nd=class extends AudioWorkletNode{constructor(r,n,i){super(r,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!n||n<=0)throw new Error(`Invalid sample rate: ${n}`);if(!i||i!="int16"&&i!="float32")throw new Error(`Invalid format: ${i}`);this.sampleRate=n,this.format=i,this.port.onmessage=o=>this.onWorkletMessage(o),this.port.postMessage({action:"start",inputSampleRate:n,outputSampleRate:r.sampleRate,format:i})}static async registerModule(r){await r.audioWorklet.addModule(M2)}feed(r){this.port.postMessage({action:"data",buffer:r.buffer},[r.buffer])}async play(r){if(this.isCancelled)throw new Error("PCMPlayerNode has already been cancelled.");if(this._playPromise)throw new Error("Already playing a stream");this._playPromise=new Promise(n=>this._playPromiseResolve=n),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:r}}));try{let n=r.getReader();for(;!this.isCancelled;){let{done:i,value:o}=await n.read();if(i||!o)break;this.feed(o)}}catch(n){nre.warn("Stream error:",n),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:r,error:n}}))}this.port.postMessage({action:"end"}),await this._playPromise}onWorkletMessage(r){r.data.action=="end"&&(this._playPromiseResolve?.(),this.dispatchEvent(new CustomEvent("end",{detail:{player:this}})))}stop(){this.isCancelled=!0,this.port.postMessage({action:"cancel"}),this._playPromiseResolve?.()}};var qn=new Oe("ElevenLabs");function uE(t,e,r="pcm_24000"){let n=[],i=Date.now(),o=!1,s,a;return{stream:new ReadableStream({start:d=>{s=d,a=new WebSocket(`wss://api.elevenlabs.io/v1/text-to-speech/${e}/stream-input?inactivity_timeout=120&output_format=${r}`),a.addEventListener("open",()=>{qn.debug(`[at ${Date.now()-i}ms] WebSocket connected`),a.send(JSON.stringify({text:" ","xi-api-key":t}));for(let p of n)a.send(JSON.stringify({text:p}));n.length=0}),a.addEventListener("close",()=>{qn.debug(`[at ${Date.now()-i}ms] WebSocket closed`),s?.close(),o=!0}),a.addEventListener("message",p=>{let f=JSON.parse(p.data);if(f.final){a.close(),s?.close();return}if(qn.debug(`[at ${Date.now()-i}ms] Message received: ${f.audio?.length||0} bytes of audio data`),!f.audio)return;let m=Uint8Array.from(atob(f.audio),h=>h.charCodeAt(0));s?.enqueue(m)})},cancel:()=>{qn.debug(`[at ${Date.now()-i}ms] Stream cancelled`),a?.close(),o=!0}}),sendText:d=>{d&&(qn.debug(`[at ${Date.now()-i}ms] Sending text: "${d}"`),a?.readyState===WebSocket.OPEN?a.send(JSON.stringify({text:d})):n.push(d))},endText:()=>{a?.readyState===WebSocket.OPEN?a.send(JSON.stringify({text:""})):n.push("")},get isClosed(){return o}}}function j2(t,e="pcm_16000",r=16e3,n="vad"){let i=[],o=Date.now(),s=!1,a,l;return{stream:new ReadableStream({start:async f=>{a=f;let m=await fetch("https://api.elevenlabs.io/v1/single-use-token/realtime_scribe",{method:"POST",headers:{"xi-api-key":t}});if(!m.ok)throw new Error(`Failed to generate single-use token: ${m.status} ${m.statusText}`);let h=await m.json(),y=h.token;if(!y)throw new Error(`No token found in response: ${JSON.stringify(h)}`);l=new WebSocket(`wss://api.elevenlabs.io/v1/speech-to-text/realtime?token=${encodeURIComponent(y)}&audio_format=${e}&commit_strategy=${n}`),l.addEventListener("open",()=>{qn.debug(`[at ${Date.now()-o}ms] WebSocket connected`);for(let g of i)l.send(g);i.length=0}),l.addEventListener("close",()=>{qn.debug(`[at ${Date.now()-o}ms] WebSocket closed`),a?.close(),s=!0}),l.addEventListener("message",g=>{let b=JSON.parse(g.data);b.message_type=="committed_transcript"?(qn.debug(`[at ${Date.now()-o}ms] Committed transcript received: "${b.text}"`),a?.enqueue(b.text)):b.error&&(qn.warn(`[at ${Date.now()-o}ms] Error received: ${b.error}`),a?.error(new Error(b.error)),l?.close(),s=!0)})},cancel:()=>{qn.debug(`[at ${Date.now()-o}ms] Stream cancelled`),l?.close(),s=!0}}),sendAudio:f=>{let m=JSON.stringify({message_type:"input_audio_chunk",audio_base_64:btoa(String.fromCharCode(...new Uint8Array(f))),commit:!1,sample_rate:r});qn.debug(`[at ${Date.now()-o}ms] Sending audio: ${f.byteLength} bytes`),l?.readyState===WebSocket.OPEN?l.send(m):i.push(m)},commit:()=>{let f=JSON.stringify({message_type:"input_audio_chunk",audio_base_64:"",commit:!0,sample_rate:r});l?.readyState===WebSocket.OPEN?l.send(f):i.push(f)},close:()=>{qn.debug("Closing connection"),l?.close(),s=!0,setTimeout(()=>{a?.close()},1e3)},get isClosed(){return s}}}var c_=new Oe("SpeechOutput"),D2=.5,ire=.8,u_=class extends EventTarget{constructor(r){super();this.autoSpeak=!0;this.preemptiveConnection=!0;this.processedMessages=new Set;this.maxVolumeHeard=0;this._queuedText=[];this._queueActive=!1;this.ai=r,this.ai.addEventListener("output",n=>this.onOutputFromAI(n)),this.ai.audio?.speechRecognition.addEventListener("speechstart",n=>this.interrupt())}onOutputFromAI(r){let n=r.detail.messages,i=r.detail.isPartial;if(!(!this.ai?.audio?.speechRecognition.isRunning||!this.autoSpeak)){for(let o of n)if(!o.streamingInProgress&&!(!o.id||this.processedMessages.has(o.id))){this.processedMessages.add(o.id);for(let s of o.sections||[])s.type=="text"&&s.text&&this.speak(s.text)}i||this.processedMessages.clear()}}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let r=0;for(let i of this.analyserBuffer)r+=i*i;let n=Math.sqrt(r/this.analyserBuffer.length);return n>this.maxVolumeHeard&&(this.maxVolumeHeard=n),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,n/this.maxVolumeHeard))}async speak(r){if(!this.ai?.config?.voice?.providerID)return c_.warn("No voice provider configured");this.ai._voiceTracker?.(`Added text to queue: ${r}`),this._queuedText.push(r),this._runQueue()}async _runQueue(){if(this._queueActive)return;let r=this._queuedText.shift();if(!r)return;this._queueActive=!0;let n=`speech-${ore++}`;try{await this.ai.audio.beginAccess(n),await this._speakWithLock(r)}finally{this._queueActive=!1,this.ai.audio.endAccess(n)}this._queuedText.length?await this._runQueue():this.onSpeechEnd()}_getElevenLabsConnection(){let r=this._elevenLabsPrecachedConnection;return(!r||r.isClosed)&&(r=uE(this.ai.config.voice.apiKey,this.ai.config.voice.voiceID,"pcm_24000")),this.preemptiveConnection&&(this._elevenLabsPrecachedConnection=uE(this.ai.config.voice.apiKey,this.ai.config.voice.voiceID,"pcm_24000")),r}async _speakWithLock(r){let n=new CustomEvent("speechfilter",{detail:{ai:this.ai,message:r}});if(this.dispatchEvent(n),r=n.detail.message,n.defaultPrevented||!r)return;this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=ire);let i=this.ai?._voiceTracker||c_.timer(`${this.ai.config.voice.providerID} voice`);i(`Speak: ${r}`),this.currentPlayerVolume?.disconnect(),this.currentPlayerVolume=this.ai.audio.context.createGain(),this.currentPlayerVolume.connect(this.ai.audio.context.destination),this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,this.analyserNode.connect(this.currentPlayerVolume),this.maxVolumeHeard=0,this.analyserBuffer=new Float32Array(this.analyserNode.fftSize);let o=new nd(this.ai.audio.context,24e3,"int16");this.currentPlayer=o,o.connect(this.analyserNode),o.addEventListener("end",l=>{let c=l;i(`PCM stream ${c.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==o&&!c.detail.interrupted&&(this.currentPlayer=void 0)});let s=Date.now(),a=null;if(this.ai.config.voice.providerID=="openai"){let l=await fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.ai.config.voice.apiKey}`},body:JSON.stringify({model:"tts-1",input:r,voice:this.ai.config.voice.voiceID,response_format:"pcm"})});if(!l.ok){c_.warn(`Failed to generate voice sample: ${l.status} ${l.statusText}`);return}a=l.body}else if(this.ai.config.voice.providerID=="elevenlabs"){let l=this._getElevenLabsConnection();l.sendText(r),l.endText(),a=l.stream}else{c_.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}i(`Received response in ${Date.now()-s}ms`),this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:r}})),i("Playing PCM stream"),await o.play(a),i("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(this._queuedText=[],!this.currentPlayerVolume)return;this.ai._voiceTracker?.("Interrupted");let r=this.currentPlayerVolume,n=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=D2);let i=400;r.gain.linearRampToValueAtTime(0,i/1e3),await new Promise(o=>setTimeout(o,i+250)),r.disconnect(),n?.stop(),n?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=D2)}},ore=1;function d_(t,e){let r=e.reduce((l,c)=>l+c.byteLength,0),n=new DataView(new ArrayBuffer(44));n.setUint8(0,82),n.setUint8(1,73),n.setUint8(2,70),n.setUint8(3,70),n.setUint32(4,44+r,!0),n.setUint8(8,87),n.setUint8(9,65),n.setUint8(10,86),n.setUint8(11,69);let i=1,o=32,s=i*o/8,a=t*s;return n.setUint8(12,102),n.setUint8(13,109),n.setUint8(14,116),n.setUint8(15,32),n.setUint32(16,16,!0),n.setUint16(20,3,!0),n.setUint16(22,i,!0),n.setUint32(24,t,!0),n.setUint32(28,a,!0),n.setUint16(32,s,!0),n.setUint16(34,o,!0),n.setUint8(36,100),n.setUint8(37,97),n.setUint8(38,116),n.setUint8(39,97),n.setUint32(40,r,!0),new File([n,...e],"audio.wav",{type:"audio/wav"})}var L2="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var id=class extends AudioWorkletNode{constructor(r,n,i,o){super(r,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=i;let s=["int16","int64","float32"];if(!n||n<=0)throw new Error(`Invalid sample rate: ${n}`);if(!s.includes(i))throw new Error(`Invalid format ${i}, must be one of: ${s.join(", ")}`);if(!o||o<=0)throw new Error(`Invalid buffer size: ${o}`);this.port.onmessage=a=>this.onWorkletMessage(a),this.port.postMessage({action:"start",inputSampleRate:r.sampleRate,outputSampleRate:n,format:i,bufferSize:o})}static async registerModule(r){await r.audioWorklet.addModule(L2)}onWorkletMessage(r){if(r.data.action=="data"){let n=null;if(this.format=="int16"&&(n=new Int16Array(r.data.buffer)),this.format=="int64"&&(n=new BigInt64Array(r.data.buffer)),this.format=="float32"&&(n=new Float32Array(r.data.buffer)),!n)throw new Error(`Invalid format: ${this.format}`);this.onData(n),this.dispatchEvent(new CustomEvent("data",{detail:{data:n}}))}}onData(r){}};var dE=16e3,f_=256,od=8,jm=new Oe("VoiceDetectionNode"),Dm=class Dm extends id{constructor(r){super(r,dE,"float32",f_*od);this.isVoiceActive=!1;this.lastVoiceActiveDate=0;this.voiceEndTimeout=50;this.sensitivity=.5;this.sentivityEnd=.2;this.nextVadReset=0;this.currentProbability=0;this._lastVoiceActive=!1;if(!Dm.vadModelURL)throw new Error("VAD model url not set, please load it and set it to VoiceDetectionNode.vadModelURL");this.loadModel()}get isVoicePossiblyEnding(){return this.isVoiceActive&&this.currentProbability<this.sensitivity}get sampleRate(){return dE}get numberOfSamples(){return f_}get numberOfSampleChunks(){return od}get outputBufferSize(){return f_*od}get isModelLoaded(){return!!this.vad}async loadModel(){jm.debug("Loading VAD model"),this.vad=await hi.load(Dm.vadModelURL),this.vad.ignoreIfBusy=!0,jm.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],dE),this.vad.makeState("h","hn","float32",[2,od,64]),this.vad.makeState("c","cn","float32",[2,od,64])}async onData(r){if(this.vad)try{let n=await this.vad.run({input:new hi.onnx.Tensor(r,[od,f_])});if(!n)return;this.currentProbability=0;for(let s=0;s<n.output.data.length;s++)n.output.data[s]>this.currentProbability&&(this.currentProbability=n.output.data[s]);let i=this.isVoiceActive?this.sentivityEnd:this.sensitivity,o=this.currentProbability>i;if(!o&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=o,o&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),jm.debug("Started speaking")):o?this.lastVoiceActiveDate=Date.now():!o&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!o&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),jm.debug("Stopped speaking after timeout")),!o){let s=Date.now();s>this.nextVadReset&&(this.nextVadReset=s+5e3,this.vad.resetState())}}catch(n){jm.error("VAD failed:",n)}}onSpeechStart(){}onSpeechEnd(){}};Dm.vadModelURL="";var sd=Dm;var U2=new Oe("VoiceChunkOutputNode"),Zs=class extends sd{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((r,n)=>r+n.length,0)/8e3}async onData(r){if(await super.onData(r),this.isVoiceActive&&!this._voiceRecording){U2.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let n of this.buffers)this.recordedBuffers.push(n),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:n,isFinal:!1}})),this.onVoiceChunk(n);this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!1}})),this.onVoiceChunk(r),this.buffers=[]}else if(this.isVoiceActive)this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!1}})),this.onVoiceChunk(r);else if(!this.isVoiceActive&&this._voiceRecording){this.recordedBuffers.push(r),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:r,isFinal:!0}})),this.onVoiceChunk(r),this._voiceRecording=!1;let n=this.recordedBuffers.reduce((i,o)=>i+o.length,0);U2.debug(`Voice complete, recorded ${(n/8e3).toFixed(2)} seconds of audio, ${n*4/1024} KB of data`),this.dispatchEvent(new CustomEvent("voicedataend",{detail:{data:this.recordedBuffers}})),this.onVoiceEnd(this.recordedBuffers),this.recordedBuffers=[]}else for(this.buffers.push(r);this.bufferDuration>this.backBufferDurationSeconds;)this.buffers.shift()}onVoiceChunk(r){}onVoiceEnd(r){}};var p_=new Oe("OpenAITranscriptionNode"),m_=class extends Zs{constructor(r,n){super(r);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=n}async onVoiceEnd(r){let n=p_.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...r);let i=d_(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let o="";try{let s=new FormData;s.append("file",i),s.append("model","whisper-1"),s.append("response_format","text");let a=await fetch("https://api.openai.com/v1/audio/transcriptions",{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:s,signal:this.lastRequestAbortController.signal});if(!a.ok)throw new Error(`Failed to generate voice sample: ${a.status} ${a.statusText}`);n("Response received"),o=await a.text(),n("Content received: "+o),this.lastRequestAbortController=void 0}catch(s){p_.error(`Failed to transcribe speech: ${s.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!o)return p_.debug("Transcription complete, but no text was found");p_.debug(`Transcription: ${o}`),this.onVoiceTranscription(o),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:o}}))}onVoiceTranscription(r){}};var h_=class extends WebSocket{constructor(r){super(r);this.pendingData=[];this.addEventListener("open",()=>this._onOpen())}send(r){this.readyState==WebSocket.OPEN?super.send(r):this.pendingData.push(r)}_onOpen(){for(let r of this.pendingData)super.send(r);this.pendingData=[]}};var qi=new Oe("IntelliWeaveTranscriptionNode"),are="wss://speech.intelliweave.ai/api/v1/transcribe",y_=class y_ extends Zs{constructor(r,n){super(r);this.apiAddress=are;this.apiKey="";this.isTranscribing=!1;this.apiKey=n}async onVoiceChunk(r){this.isTranscribing=!0,this.ws?this.ws.send(r):(qi.debug("Opening WebSocket connection"),this.ws=new h_(this.apiAddress),this.ws.send(JSON.stringify({type:"hello",sampleRate:16e3,channels:1,format:"float32",apiKey:this.apiKey})),this.ws.send(r.buffer),this.ws.onopen=()=>{qi.debug("WebSocket connection opened")},this.ws.addEventListener("message",i=>{let o=JSON.parse(i.data);if(o.error)return qi.warn("Error: "+o.error);if(o.type!="transcription")return qi.warn("Invalid response type",o);if(o.streaming&&!o.final)return qi.debug("Partial transcription: "+o.partialText);if(this.isTranscribing=!1,!o.text.trim())return qi.warn(`Empty transcription (${o.processingTime}ms)`);qi.debug(`Transcription: ${o.text} (${o.processingTime}ms)`),this.onVoiceTranscription(o.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:o.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",i=>qi.warn("WebSocket error")));let n=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{qi.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},n)}async onVoiceEnd(r){if(this.ws?.send(JSON.stringify({type:"end"})),y_.debugExportWav){let n=d_(this.sampleRate,r),i=document.createElement("a");i.href=URL.createObjectURL(n),i.download="recording.wav",i.click()}}onVoiceTranscription(r){}onSocketClose(){qi.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};y_.debugExportWav=!1;var g_=y_;var ad=new Oe("ElevenLabsTranscriptionNode"),b_=class extends Zs{constructor(r,n){super(r);this.apiKey="";this.isTranscribing=!1;this.apiKey=n}async onVoiceChunk(r){this.isTranscribing=!0;let n=new Int16Array(r.length);for(let o=0;o<r.length;o++)n[o]=r[o]*32767;!this.connection||this.connection.isClosed?(this.connection?.close(),this.connection=void 0,ad.debug(`Opening connection. sampleRate: ${this.sampleRate} format=${this.format}`),this.connection=j2(this.apiKey,"pcm_"+this.sampleRate,this.sampleRate,"manual"),this.startReading(this.connection),this.connection.sendAudio(n.buffer)):this.connection.sendAudio(n.buffer);let i=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{ad.debug("Shutting down WebSocket connection"),this.connection?.close(),this.connection=void 0},i)}async startReading(r){let n=r.stream.getReader();try{for(;;){let{value:i,done:o}=await n.read();if(o){ad.debug("Stream closed");break}if(!i?.trim()){ad.warn("Empty transcription received");continue}this.isTranscribing=!1,ad.debug(`Transcription: ${i}`),this.onVoiceTranscription(i),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:i}}))}}catch(i){ad.error(`Failed to read transcription stream: ${i.message}`),this.connection==r&&(this.connection=void 0);return}}async onVoiceEnd(r){this.connection?.commit()}onVoiceTranscription(r){}};var fE=new Oe("SpeechRecognition"),__=class extends EventTarget{constructor(r){super();this.isRunning=!1;this._skipEvents=!1;this.maxVolumeHeard=0;this.ai=r}get isSupported(){if(!hi.lib||!this.ai?.vadModel||!ns().AudioWorkletNode)return!1;if(this.ai?.config?.transcription?.providerID!="intelliweave"){if(!(this.ai?.config?.transcription?.providerID=="openai"&&this.ai.config?.transcription?.apiKey)){if(!(this.ai?.config?.transcription?.providerID=="elevenlabs"&&this.ai.config?.transcription?.apiKey))return!1}}return!0}async start(){if(!this.isSupported)throw new Error("Speech recognition not supported in this persona and browser.");if(!this.isRunning){this.isRunning=!0;try{await this.ai.audio.beginAccess("speech-recognition"),this.micStream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}});let r=this.ai.audio.context.createMediaStreamSource(this.micStream);this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,r.connect(this.analyserNode),this.analyserBuffer=new Float32Array(this.analyserNode.fftSize),sd.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new m_(this.ai.audio.context,this.ai.config.transcription.apiKey),r.connect(this.voiceDetection)):this.ai?.config?.transcription?.providerID=="elevenlabs"?(this.voiceDetection=new b_(this.ai.audio.context,this.ai.config.transcription.apiKey),r.connect(this.voiceDetection)):(this.voiceDetection=new g_(this.ai.audio.context,this.ai.apiKey),this.voiceDetection.apiAddress=this.ai?.config?.transcription?.url||this.voiceDetection.apiAddress,r.connect(this.voiceDetection)),this.voiceDetection.addEventListener("speechstart",n=>{this.ai._voiceTracker=fE.timer("voice interaction","Speech started"),this.recordingStartTime=Date.now(),Vr(this.ai,{event_type:"voice_start",event_properties:{audio_provider:this.ai.config?.transcription?.providerID||"intelliweave",sample_rate:16e3}}),this.dispatchEvent(new CustomEvent(n.type,{detail:n.detail}))}),this.voiceDetection.addEventListener("speechend",n=>{this.ai._voiceTracker?.("Speech ended");let i=this.recordingStartTime?Date.now()-this.recordingStartTime:0;Vr(this.ai,{event_type:"voice_end",event_properties:{recording_duration_ms:i}}),this.dispatchEvent(new CustomEvent(n.type,{detail:n.detail}))}),this.voiceDetection.addEventListener("transcription",n=>{this.ai._voiceTracker?.(`Transcription: ${n.detail.text}`),Vr(this.ai,{event_type:"voice_submit",value_str:"",event_properties:{transcription_provider:this.ai.config?.transcription?.providerID||"intelliweave",confidence_score:n.detail.confidence||void 0}}),this.onTranscription(n)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(r){fE.error("Failed to start speech recognition:",r),this.stop()}}}stop(){this.isRunning&&(this.isRunning=!1,this.ai.audio.endAccess("speech-recognition"),this.voiceDetection?.disconnect(),this.voiceDetection=void 0,this.micStream?.getTracks().forEach(r=>r.stop()),this.micStream=void 0,this.analyserNode=void 0,this.analyserBuffer=void 0,this._skipEvents||this.dispatchEvent(new CustomEvent("end",{detail:{speechRecognition:this}})))}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let r=0;for(let i of this.analyserBuffer)r+=i*i;let n=Math.sqrt(r/this.analyserBuffer.length);return n>this.maxVolumeHeard&&(this.maxVolumeHeard=n),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,n/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(r){let n=r.detail.text;fE.debug("Heard:",n),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:n,isFinal:!0}}))}async reset(){if(this.isRunning){this._skipEvents=!0;try{this.stop(),await this.start(),this._skipEvents=!1}catch(r){throw this._skipEvents=!1,r}}}};var v_=new Oe("AudioSystem"),Lm=class t{constructor(e){this.locks=[];if(!e)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=e,this.ai.audio=this,this.speechRecognition=new __(this.ai),this.speechOutput=new u_(this.ai)}static get isSupported(){return!(!hi.lib||!ns().AudioWorkletNode)}static async registerModules(e){await Promise.all([nd.registerModule(e),id.registerModule(e)])}async beginAccess(e){v_.debug(`Began access for: ${e}`),this.locks.includes(e)||this.locks.push(e),!this.context&&(v_.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await t.registerModules(this.context))}endAccess(e){v_.debug(`Ended access for: ${e}`),this.locks=this.locks.filter(r=>r!=e),!this.locks.length&&(v_.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var on=new Oe("Embed"),vl=class extends wn{constructor(){super();this.config={};this.suggestions=[];this._previousOpenState=!1;this.html=()=>`
|
|
493
493
|
|
|
494
494
|
<!-- Styling -->
|
|
495
495
|
<style>
|
|
@@ -654,7 +654,11 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
654
654
|
}
|
|
655
655
|
|
|
656
656
|
#root .green-accent {
|
|
657
|
-
color:
|
|
657
|
+
color: color-mix(
|
|
658
|
+
in srgb,
|
|
659
|
+
var(--intelliweave-persona-bg, rgba(32, 38, 44, 0.92)) 30%, #98eaff 70%
|
|
660
|
+
);
|
|
661
|
+
mix-blend-mode: exclusion;
|
|
658
662
|
font-style: normal;
|
|
659
663
|
}
|
|
660
664
|
|
|
@@ -711,7 +715,7 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
711
715
|
margin: 10px 20px;
|
|
712
716
|
text-align: center;
|
|
713
717
|
font-size: 13px;
|
|
714
|
-
background-color: #3A414A;
|
|
718
|
+
background-color: color-mix(in oklch, var(--intelliweave-persona-bg, #3A414A) 60%, #808080);
|
|
715
719
|
padding: 8px 16px;
|
|
716
720
|
border-radius: 16px;
|
|
717
721
|
cursor: pointer;
|
|
@@ -957,7 +961,7 @@ ${o}`,cannotRemove:i.isContext,sortOrder:101,disabled:typeof i.disabled=="functi
|
|
|
957
961
|
|
|
958
962
|
`;this._lastLogo="";this._lastBackground="";this._lastTextColor="";this._lastFontFamily="";this._lastDisplayMode="";this._lastLayout="";this._lastPersonaName="";this._lastHeaderLogo="";this._lastPositioningMode="";this._lastPositionX="";this._lastPositionY="";this._isProcessing=!1;this.ai=new Wu,Lm.isSupported&&(this.ai.audio=new Lm(this.ai))}onCreate(){bt().embed&&on.warn("Only one <web-weaver-embed> element should be on the page."),bt().embed=this;let r=bt();on.debug("[WebWeaverEmbed] Client config:",r),r.displayMode&&!this.attr.displayMode&&(on.debug("[WebWeaverEmbed] Setting displayMode from client config:",r.displayMode),this.attr.displayMode=r.displayMode),r.layout&&!this.attr.layout&&(on.debug("[WebWeaverEmbed] Setting layout from client config:",r.layout),this.attr.layout=r.layout),r.positioningMode&&!this.attr.positioningMode&&(on.debug("[WebWeaverEmbed] Setting positioningMode from client config:",r.positioningMode),this.attr.positioningMode=r.positioningMode),r.positionX&&!this.attr.positionX&&(on.debug("[WebWeaverEmbed] Setting positionX from client config:",r.positionX),this.attr.positionX=r.positionX),r.positionY&&!this.attr.positionY&&(on.debug("[WebWeaverEmbed] Setting positionY from client config:",r.positionY),this.attr.positionY=r.positionY),r.offsetX!==void 0&&!this.attr.offsetX&&(on.debug("[WebWeaverEmbed] Setting offsetX from client config:",r.offsetX),this.attr.offsetX=String(r.offsetX)),r.offsetY!==void 0&&!this.attr.offsetY&&(on.debug("[WebWeaverEmbed] Setting offsetY from client config:",r.offsetY),this.attr.offsetY=String(r.offsetY)),on.debug("[WebWeaverEmbed] Attributes after setting:",{displayMode:this.attr.displayMode,positionX:this.attr.positionX,positionY:this.attr.positionY,offsetX:this.attr.offsetX,offsetY:this.attr.offsetY}),this.applyConfigStylesAndAttributes(),this.child("root").addEventListener("click",o=>this.onContainerClick(o)),this.child("web-weaver-logo").addEventListener("click",o=>this.onLogoClick(o)),this.child("interaction-bar").addEventListener("input-message",o=>this.processInput(o.detail)),this.child("interaction-bar").addEventListener("llm-button-click",o=>this.state.llmPanelOpen=!this.state.llmPanelOpen),this.child("llm-selector-panel").addEventListener("select",o=>this.onLLMModelSelect(o)),this.child("web-weaver-embed-inner").addEventListener("scroll",o=>this.onContentScroll(o)),this.child("interaction-bar").connectAI(this.ai),this.ai.onAIMessage=this.onAIMessage.bind(this),this.ai.knowledgeBase.addEntry({id:"_iw_image_instructions",type:"info",name:"Using Images",content:`
|
|
959
963
|
You can display images in Markdown format, example: 
|
|
960
|
-
Image URLs must be absolute. When using an image URL from the knowledge base, include all parameters.`,isContext:!0});let i=this.attr.apiKey||bt().apiKey;if(!i)return on.warn("No API key specified, some features may be unavailable.");this.state.loading=!0,this.attr.hubAPI&&(this.ai.hubAPI=this.attr.hubAPI),this.ai.load(i).then(o=>{this.config=o.config,bt().introductionMessage||(bt().introductionMessage=this.config.introductionMessage),bt().analytics=this.config.analytics!==void 0?!!this.config.analytics:bt().analytics,this.applyConfigStylesAndAttributes(),this.child("root").classList.remove("hidden"),this.state.loading=!1,this.config.managedBy&&this.updateBrandingFor(this.config.managedBy),this.ai.knowledgeBase.addEntry({id:"ui.suggestResponse",type:"action",name:"Suggest a response",content:"Add a button with a suggested response for the user's next message. Supports multiple calls at once.",isContext:!0,hideActionInUI:"always",disabled:!this.ai.flags.allowSuggestionButtons,parameters:[{name:"text",type:"string",description:"The suggested response for the user's next message."}],action:s=>(this.suggestions.push(s.text),"Suggestion button added")}),this.resetConversation()}).catch(o=>{on.error("Failed to load AI configuration:",o),this.state.loading=!1;let s=this.child("web-weaver-embed-inner");s&&(s.innerHTML='<div class="output" style="color: red; padding: 20px;">Error loading configuration. Please try again later.</div>')})}applyPersonaColorVariants(r,n){if(!n){r.style.removeProperty("--intelliweave-persona-bg-muted"),r.style.removeProperty("--intelliweave-assistant-bubble-bg"),r.style.removeProperty("--intelliweave-interaction-bg");return}let i=this.parseColorToRGB(n);if(!i){r.style.removeProperty("--intelliweave-persona-bg-muted"),r.style.removeProperty("--intelliweave-assistant-bubble-bg"),r.style.setProperty("--intelliweave-interaction-bg",n);return}let{r:o,g:s,b:a}=i;r.style.setProperty("--intelliweave-persona-bg-muted",`rgba(${o}, ${s}, ${a}, 0.65)`),r.style.setProperty("--intelliweave-assistant-bubble-bg",`rgba(${Math.round(o*.85)}, ${Math.round(s*.85)}, ${Math.round(a*.85)}, 0.85)`),r.style.setProperty("--intelliweave-interaction-bg",`rgba(${o}, ${s}, ${a}, 0.9)`)}parseColorToRGB(r){if(!r)return null;let n=r.trim();if(n.startsWith("#")){let i=n.slice(1);if(i.length===3){let o=parseInt(i[0]+i[0],16),s=parseInt(i[1]+i[1],16),a=parseInt(i[2]+i[2],16);return{r:o,g:s,b:a}}if(i.length===6){let o=parseInt(i.slice(0,2),16),s=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return{r:o,g:s,b:a}}return null}if(n.startsWith("rgb")){let i=n.match(/rgba?\s*\(\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)/i);return i?{r:Math.max(0,Math.min(255,Math.round(Number(i[1])))),g:Math.max(0,Math.min(255,Math.round(Number(i[2])))),b:Math.max(0,Math.min(255,Math.round(Number(i[3]))))}:null}return null}adjustLogoPadding(r){let n=new Image;n.onload=()=>{let l=n.naturalWidth/n.naturalHeight,c=l>1?96/l:96,u=l<=1?10:0,p=(96+c)/2-48,f=Math.max(p+15+u,40+u);this.style.setProperty("--logo-top-margin",`${Math.round(u)}px`);let m=this.child("web-weaver-embed-inner");m&&m.style.setProperty("--logo-bottom-padding",`${Math.round(f)}px`)},n.src=r}applyConfigStylesAndAttributes(){let r=this.config,n=this.child("root");if(!n)return;let i=!1,s=this.attr.logo||r.logo;if(s&&s!==this._lastLogo){this._lastLogo=s,i=!0;let Pt=this.child("web-weaver-logo");Pt&&(Pt.setAttribute("logo",s),this.adjustLogoPadding(s))}let a=this.root?.getElementById("fullscreen-logo"),l=this.root?.getElementById("fullscreen-name"),c=r.name||"";c!==this._lastPersonaName&&(this._lastPersonaName=c,l&&(l.textContent=c),i=!0),s!==this._lastHeaderLogo&&(this._lastHeaderLogo=s||"",a&&(s?(a.src=s,a.style.display=""):a.style.display="none"),i=!0);let u=this.root?.getElementById("fullscreen-header"),d=(this.attr.header||"").toLowerCase();if(u){let Pt=d==="hidden"||d==="none"||d==="false";u.style.display=!Pt&&(s||c)?"":"none"}let f=this.attr.background||r.background;f!==this._lastBackground&&(this._lastBackground=f,i=!0,f?(n.style.background=f,n.style.setProperty("--intelliweave-persona-bg",f),this.applyPersonaColorVariants(n,f)):(n.style.background="",n.style.removeProperty("--intelliweave-persona-bg"),this.applyPersonaColorVariants(n,void 0)));let h=this.attr.textColor||r.textColor,y=this.child("interaction-bar");h!==this._lastTextColor&&(this._lastTextColor=h,i=!0,h?(n.style.color=h,n.style.setProperty("--intelliweave-user-bubble-text",h),n.style.setProperty("--intelliweave-assistant-bubble-text",h),y&&y.setAttribute("textColor",h)):(n.style.color="",n.style.removeProperty("--intelliweave-user-bubble-text"),n.style.removeProperty("--intelliweave-assistant-bubble-text"),y&&y.removeAttribute("textColor")));let g={Inter:"Inter:wght@300;400;500;600;700",Roboto:"Roboto:wght@300;400;500;700","Open Sans":"Open+Sans:wght@300;400;500;600;700",Poppins:"Poppins:wght@300;400;500;600;700",Lato:"Lato:wght@300;400;700","DM Sans":"DM+Sans:wght@300;400;500;600;700",Nunito:"Nunito:wght@300;400;500;600;700","Plus Jakarta Sans":"Plus+Jakarta+Sans:wght@300;400;500;600;700",Montserrat:"Montserrat:wght@300;400;500;600;700"},v=this.attr.fontFamily||r.fontFamily;if(v!==this._lastFontFamily){this._lastFontFamily=v,i=!0,v?n.style.setProperty("--intelliweave-font-family",v):n.style.removeProperty("--intelliweave-font-family");let Pt=this.root?.getElementById("google-font-link");if(Pt){let wr=(v||"Karla").replace(/['"]/g,"").split(",")[0].trim(),w=g[wr];w?Pt.href=`https://fonts.googleapis.com/css2?family=${w}&display=swap`:(!v||wr==="Karla")&&(Pt.href="https://fonts.googleapis.com/css2?family=Karla:ital,wght@0,200..800;1,200..800&display=swap")}}let E=this.attr.displayMode||r.displayMode||"closed";E!==this._lastDisplayMode&&(this._lastDisplayMode=E,i=!0,E==="open"&&!this.attr.open&&(this.attr.open=!0));let F=this.attr.layout||r.layout||"widget";F!==this._lastLayout&&(this._lastLayout=F,i=!0);let ee=this.attr.positioningMode||r.positioningMode||"fixed";ee!==this._lastPositioningMode&&(this._lastPositioningMode=ee,i=!0);let ce=this.attr.positionX||r.positionX||"right";ce!==this._lastPositionX&&(this._lastPositionX=ce,i=!0);let J=this.attr.positionY||r.positionY||"bottom";J!==this._lastPositionY&&(this._lastPositionY=J,i=!0);let pe=this.attr.offsetX?parseInt(this.attr.offsetX):void 0,ge=pe!==void 0?pe:r.offsetX!==void 0?r.offsetX:20;ge!==this._lastOffsetX&&(this._lastOffsetX=ge,i=!0);let ct=this.attr.offsetY?parseInt(this.attr.offsetY):void 0,yt=ct!==void 0?ct:r.offsetY!==void 0?r.offsetY:20;yt!==this._lastOffsetY&&(this._lastOffsetY=yt,i=!0),i&&on.debug("[WebWeaverEmbed] Applied UI Styling:",{finalLogo:s,finalBackground:n.style.background,finalTextColor:n.style.color,finalDisplayMode:E,finalLayout:F,finalPositioningMode:ee,finalPositionX:ce,finalPositionY:J,finalOffsetX:ge,finalOffsetY:yt})}onUpdate(){if(this.applyConfigStylesAndAttributes(),this.child("web-weaver-embed-inner").style.display=this.attr.open?"":"none",this.child("interaction-bar").style.display=this.attr.open?"":"none",this.child("llm-selector-panel").attr.open=this.state.llmPanelOpen,this.child("pulseanim").style.display=this.attr.open?"none":"",this.child("poweredby").style.display=this.attr.open?"flex":"none",this.child("interaction-bar").attr.layout=this._lastLayout||"widget",this.attr.open&&!this._previousOpenState)this._uiSessionStartTime=Date.now(),Vr(this.ai,{event_type:"ui_open",event_properties:{trigger:"button_click"}});else if(!this.attr.open&&this._previousOpenState){let c=this._uiSessionStartTime?Date.now()-this._uiSessionStartTime:0;Vr(this.ai,{event_type:"ui_close",event_properties:{trigger:"button_click",session_duration_ms:c}})}this._previousOpenState=this.attr.open;let r=this.child("root");this.attr.open?r.classList.add("open"):r.classList.remove("open"),(this._lastLayout||"widget")==="fullscreen"?(r.classList.add("layout-fullscreen"),this.attr.open||(this.attr.open=!0)):r.classList.remove("layout-fullscreen");let i=this._lastPositioningMode||"fixed",o=this._lastPositionX||"right",s=this._lastPositionY||"bottom",a=this._lastOffsetX!==void 0?this._lastOffsetX:20,l=this._lastOffsetY!==void 0?this._lastOffsetY:20;i==="container"?(r.classList.add("container-mode"),this.attr.open||(this.attr.open=!0)):r.classList.remove("container-mode"),i!=="container"&&(r.style.left="",r.style.right="",r.style.top="",r.style.bottom="",o==="left"?r.style.left=a+"px":r.style.right=a+"px",s==="top"?r.style.top=l+"px":r.style.bottom=l+"px"),this.child("interaction-bar").attr.loading=this.state.loading,this.child("interaction-bar").attr.llmName=this.ai.currentModel?.metadata?.name||this.ai.currentModel?.id||"None",this.child("interaction-bar").attr.llmButtonVisible=this.ai.models.length>1,this.child("llm-selector-panel").state.items=this.ai.models.sort((c,u)=>(u.priority||0)-(c.priority||0)),this.child("llm-selector-panel").state.selectedID=this.ai.currentModel?.id}onDestroy(){bt().embed==this&&(bt().embed=void 0)}onContainerClick(r){let n=this._lastDisplayMode||"closed";(this._lastLayout||"widget")!=="fullscreen"&&n!=="open"&&(this.attr.open||(r.preventDefault(),this.attr.open=!0))}onLogoClick(r){if(r.preventDefault(),r.stopPropagation(),this.attr.focusID)this.attr.focusID="";else{let n=this._lastDisplayMode||"closed";if((this._lastLayout||"widget")==="fullscreen"||n==="open")return;this.attr.open=!this.attr.open}}open(){this.attr.open=!0}close(){this.attr.open=!1}resetConversation(){let r=this.child("web-weaver-embed-inner");for(this.state.llmPanelOpen=!1;r.children.length>0;)r.children[0].remove();this.ai.resetConversation(),this.suggestions=[];let n=document.createElement("div");n.className="introduction-message",n.innerHTML=bt().introductionMessage||`Welcome to <b>${document.title||"Web Weaver"}</b>. How can I help you?`,r.appendChild(n),this.ai.insertAssistantMessage(n.innerText);for(let i of bt().introductionSuggestions||[]){let o=document.createElement("div");o.className="suggestion-button",o.innerText=i,o.addEventListener("click",s=>this.onSuggestionClick(s,i)),r.appendChild(o)}}async processInput(r){if(this._isProcessing)return;this._isProcessing=!0,this.state.loading=!0,this.state.llmPanelOpen=!1;let n=this.child("web-weaver-embed-inner");this.suggestions=[];try{for(let a of Array.from(n.querySelectorAll(".suggestion-button")))a.remove();this.attr.focusID="";let i=document.createElement("div");i.className="input",i.innerText=r,n.appendChild(i);let o=this.currentOutputElement;this.currentOutputElement=document.createElement("div"),this.currentOutputElement.className="output-container",n.appendChild(this.currentOutputElement);let s=Math.ceil(n.clientHeight-300);s<0&&(s=0),s>600&&(s=600),o&&(o.style.minHeight=""),this.currentOutputElement.style.minHeight=s+"px",this.currentOutputElement.offsetHeight,this.currentOutputElement.scrollIntoView({behavior:"smooth",block:"start"}),await this.ai.sendMessage(r);for(let a of this.suggestions){let l=document.createElement("div");l.className="suggestion-button",l.innerText=a,l.addEventListener("click",c=>this.onSuggestionClick(c,a)),this.currentOutputElement.appendChild(l)}}catch(i){on.error("Failed to process input:",i);let o=document.createElement("div");o.className="output",o.innerText="Sorry, there was a problem getting a response. "+i.message,n.appendChild(o);let s=document.createElement("div");s.className="suggestion-button",s.innerText="Reset conversation",s.addEventListener("click",a=>this.resetConversation()),n.appendChild(s)}this.state.loading=!1,this._isProcessing=!1}async onAIMessage(r,n){let i=[];for(let o of r)for(let s=0;s<(o.sections?.length||0);s++){let a=o.sections[s],l=`msgelem-${o.id||""}_${s}_${a.type||"unknown"}`;if(l=l.replace(/[^a-zA-Z0-9-_]/g,"_"),a.type=="thinking"){if(!a.text)continue;let c=a.text||"";c.includes(`
|
|
964
|
+
Image URLs must be absolute. When using an image URL from the knowledge base, include all parameters.`,isContext:!0});let i=this.attr.apiKey||bt().apiKey;if(!i)return on.warn("No API key specified, some features may be unavailable.");this.state.loading=!0,this.attr.hubAPI&&(this.ai.hubAPI=this.attr.hubAPI),this.ai.load(i).then(o=>{this.config=o.config,bt().introductionMessage||(bt().introductionMessage=this.config.introductionMessage),bt().analytics=this.config.analytics!==void 0?!!this.config.analytics:bt().analytics,this.applyConfigStylesAndAttributes(),this.child("root").classList.remove("hidden"),this.state.loading=!1,this.config.managedBy&&this.updateBrandingFor(this.config.managedBy),this.ai.knowledgeBase.addEntry({id:"ui.suggestResponse",type:"action",name:"Suggest a response",content:"Add a button with a suggested response for the user's next message. Supports multiple calls at once.",isContext:!0,hideActionInUI:"always",disabled:!this.ai.flags.allowSuggestionButtons,parameters:[{name:"text",type:"string",description:"The suggested response for the user's next message."}],action:s=>(this.suggestions.push(s.text),"Suggestion button added")}),this.resetConversation()}).catch(o=>{on.error("Failed to load AI configuration:",o),this.state.loading=!1;let s=this.child("web-weaver-embed-inner");if(s){let a=o?.message||o?.toString()||"Unknown error";s.innerHTML=`<div class="output" style="color: red; padding: 20px;">${a}</div>`}})}applyPersonaColorVariants(r,n){if(!n){r.style.removeProperty("--intelliweave-persona-bg-muted"),r.style.removeProperty("--intelliweave-assistant-bubble-bg"),r.style.removeProperty("--intelliweave-interaction-bg");return}let i=this.parseColorToRGB(n);if(!i){r.style.removeProperty("--intelliweave-persona-bg-muted"),r.style.removeProperty("--intelliweave-assistant-bubble-bg"),r.style.setProperty("--intelliweave-interaction-bg",n);return}let{r:o,g:s,b:a}=i;r.style.setProperty("--intelliweave-persona-bg-muted",`rgba(${o}, ${s}, ${a}, 0.65)`),r.style.setProperty("--intelliweave-assistant-bubble-bg",`rgba(${Math.round(o*.85)}, ${Math.round(s*.85)}, ${Math.round(a*.85)}, 0.85)`),r.style.setProperty("--intelliweave-interaction-bg",`rgba(${o}, ${s}, ${a}, 0.9)`)}parseColorToRGB(r){if(!r)return null;let n=r.trim();if(n.startsWith("#")){let i=n.slice(1);if(i.length===3){let o=parseInt(i[0]+i[0],16),s=parseInt(i[1]+i[1],16),a=parseInt(i[2]+i[2],16);return{r:o,g:s,b:a}}if(i.length===6){let o=parseInt(i.slice(0,2),16),s=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return{r:o,g:s,b:a}}return null}if(n.startsWith("rgb")){let i=n.match(/rgba?\s*\(\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)/i);return i?{r:Math.max(0,Math.min(255,Math.round(Number(i[1])))),g:Math.max(0,Math.min(255,Math.round(Number(i[2])))),b:Math.max(0,Math.min(255,Math.round(Number(i[3]))))}:null}return null}adjustLogoPadding(r){let n=new Image;n.onload=()=>{let l=n.naturalWidth/n.naturalHeight,c=l>1?96/l:96,u=l<=1?10:0,p=(96+c)/2-48,f=Math.max(p+15+u,40+u);this.style.setProperty("--logo-top-margin",`${Math.round(u)}px`);let m=this.child("web-weaver-embed-inner");m&&m.style.setProperty("--logo-bottom-padding",`${Math.round(f)}px`)},n.src=r}applyConfigStylesAndAttributes(){let r=this.config,n=this.child("root");if(!n)return;let i=!1,s=this.attr.logo||r.logo;if(s&&s!==this._lastLogo){this._lastLogo=s,i=!0;let Pt=this.child("web-weaver-logo");Pt&&(Pt.setAttribute("logo",s),this.adjustLogoPadding(s))}let a=this.root?.getElementById("fullscreen-logo"),l=this.root?.getElementById("fullscreen-name"),c=r.name||"";c!==this._lastPersonaName&&(this._lastPersonaName=c,l&&(l.textContent=c),i=!0),s!==this._lastHeaderLogo&&(this._lastHeaderLogo=s||"",a&&(s?(a.src=s,a.style.display=""):a.style.display="none"),i=!0);let u=this.root?.getElementById("fullscreen-header"),d=(this.attr.header||"").toLowerCase();if(u){let Pt=d==="hidden"||d==="none"||d==="false";u.style.display=!Pt&&(s||c)?"":"none"}let f=this.attr.background||r.background;f!==this._lastBackground&&(this._lastBackground=f,i=!0,f?(n.style.background=f,n.style.setProperty("--intelliweave-persona-bg",f),this.applyPersonaColorVariants(n,f)):(n.style.background="",n.style.removeProperty("--intelliweave-persona-bg"),this.applyPersonaColorVariants(n,void 0)));let h=this.attr.textColor||r.textColor,y=this.child("interaction-bar");h!==this._lastTextColor&&(this._lastTextColor=h,i=!0,h?(n.style.color=h,n.style.setProperty("--intelliweave-user-bubble-text",h),n.style.setProperty("--intelliweave-assistant-bubble-text",h),y&&y.setAttribute("textColor",h)):(n.style.color="",n.style.removeProperty("--intelliweave-user-bubble-text"),n.style.removeProperty("--intelliweave-assistant-bubble-text"),y&&y.removeAttribute("textColor")));let g={Inter:"Inter:wght@300;400;500;600;700",Roboto:"Roboto:wght@300;400;500;700","Open Sans":"Open+Sans:wght@300;400;500;600;700",Poppins:"Poppins:wght@300;400;500;600;700",Lato:"Lato:wght@300;400;700","DM Sans":"DM+Sans:wght@300;400;500;600;700",Nunito:"Nunito:wght@300;400;500;600;700","Plus Jakarta Sans":"Plus+Jakarta+Sans:wght@300;400;500;600;700",Montserrat:"Montserrat:wght@300;400;500;600;700"},v=this.attr.fontFamily||r.fontFamily;if(v!==this._lastFontFamily){this._lastFontFamily=v,i=!0,v?n.style.setProperty("--intelliweave-font-family",v):n.style.removeProperty("--intelliweave-font-family");let Pt=this.root?.getElementById("google-font-link");if(Pt){let wr=(v||"Karla").replace(/['"]/g,"").split(",")[0].trim(),w=g[wr];w?Pt.href=`https://fonts.googleapis.com/css2?family=${w}&display=swap`:(!v||wr==="Karla")&&(Pt.href="https://fonts.googleapis.com/css2?family=Karla:ital,wght@0,200..800;1,200..800&display=swap")}}let E=this.attr.displayMode||r.displayMode||"closed";E!==this._lastDisplayMode&&(this._lastDisplayMode=E,i=!0,E==="open"&&!this.attr.open&&(this.attr.open=!0));let F=this.attr.layout||r.layout||"widget";F!==this._lastLayout&&(this._lastLayout=F,i=!0);let ee=this.attr.positioningMode||r.positioningMode||"fixed";ee!==this._lastPositioningMode&&(this._lastPositioningMode=ee,i=!0);let ce=this.attr.positionX||r.positionX||"right";ce!==this._lastPositionX&&(this._lastPositionX=ce,i=!0);let J=this.attr.positionY||r.positionY||"bottom";J!==this._lastPositionY&&(this._lastPositionY=J,i=!0);let pe=this.attr.offsetX?parseInt(this.attr.offsetX):void 0,ge=pe!==void 0?pe:r.offsetX!==void 0?r.offsetX:20;ge!==this._lastOffsetX&&(this._lastOffsetX=ge,i=!0);let ct=this.attr.offsetY?parseInt(this.attr.offsetY):void 0,yt=ct!==void 0?ct:r.offsetY!==void 0?r.offsetY:20;yt!==this._lastOffsetY&&(this._lastOffsetY=yt,i=!0),i&&on.debug("[WebWeaverEmbed] Applied UI Styling:",{finalLogo:s,finalBackground:n.style.background,finalTextColor:n.style.color,finalDisplayMode:E,finalLayout:F,finalPositioningMode:ee,finalPositionX:ce,finalPositionY:J,finalOffsetX:ge,finalOffsetY:yt})}onUpdate(){if(this.applyConfigStylesAndAttributes(),this.child("web-weaver-embed-inner").style.display=this.attr.open?"":"none",this.child("interaction-bar").style.display=this.attr.open?"":"none",this.child("llm-selector-panel").attr.open=this.state.llmPanelOpen,this.child("pulseanim").style.display=this.attr.open?"none":"",this.child("poweredby").style.display=this.attr.open?"flex":"none",this.child("interaction-bar").attr.layout=this._lastLayout||"widget",this.attr.open&&!this._previousOpenState)this._uiSessionStartTime=Date.now(),Vr(this.ai,{event_type:"ui_open",event_properties:{trigger:"button_click"}});else if(!this.attr.open&&this._previousOpenState){let c=this._uiSessionStartTime?Date.now()-this._uiSessionStartTime:0;Vr(this.ai,{event_type:"ui_close",event_properties:{trigger:"button_click",session_duration_ms:c}})}this._previousOpenState=this.attr.open;let r=this.child("root");this.attr.open?r.classList.add("open"):r.classList.remove("open"),(this._lastLayout||"widget")==="fullscreen"?(r.classList.add("layout-fullscreen"),this.attr.open||(this.attr.open=!0)):r.classList.remove("layout-fullscreen");let i=this._lastPositioningMode||"fixed",o=this._lastPositionX||"right",s=this._lastPositionY||"bottom",a=this._lastOffsetX!==void 0?this._lastOffsetX:20,l=this._lastOffsetY!==void 0?this._lastOffsetY:20;i==="container"?(r.classList.add("container-mode"),this.attr.open||(this.attr.open=!0)):r.classList.remove("container-mode"),i!=="container"&&(r.style.left="",r.style.right="",r.style.top="",r.style.bottom="",o==="left"?r.style.left=a+"px":r.style.right=a+"px",s==="top"?r.style.top=l+"px":r.style.bottom=l+"px"),this.child("interaction-bar").attr.loading=this.state.loading,this.child("interaction-bar").attr.llmName=this.ai.currentModel?.metadata?.name||this.ai.currentModel?.id||"None",this.child("interaction-bar").attr.llmButtonVisible=this.ai.models.length>1,this.child("llm-selector-panel").state.items=this.ai.models.sort((c,u)=>(u.priority||0)-(c.priority||0)),this.child("llm-selector-panel").state.selectedID=this.ai.currentModel?.id}onDestroy(){bt().embed==this&&(bt().embed=void 0)}onContainerClick(r){let n=this._lastDisplayMode||"closed";(this._lastLayout||"widget")!=="fullscreen"&&n!=="open"&&(this.attr.open||(r.preventDefault(),this.attr.open=!0))}onLogoClick(r){if(r.preventDefault(),r.stopPropagation(),this.attr.focusID)this.attr.focusID="";else{let n=this._lastDisplayMode||"closed";if((this._lastLayout||"widget")==="fullscreen"||n==="open")return;this.attr.open=!this.attr.open}}open(){this.attr.open=!0}close(){this.attr.open=!1}resetConversation(){let r=this.child("web-weaver-embed-inner");for(this.state.llmPanelOpen=!1;r.children.length>0;)r.children[0].remove();this.ai.resetConversation(),this.suggestions=[];let n=document.createElement("div");n.className="introduction-message",n.innerHTML=bt().introductionMessage||`Welcome to <b>${document.title||"Web Weaver"}</b>. How can I help you?`,r.appendChild(n),this.ai.insertAssistantMessage(n.innerText);for(let i of bt().introductionSuggestions||[]){let o=document.createElement("div");o.className="suggestion-button",o.innerText=i,o.addEventListener("click",s=>this.onSuggestionClick(s,i)),r.appendChild(o)}}async processInput(r){if(this._isProcessing)return;this._isProcessing=!0,this.state.loading=!0,this.state.llmPanelOpen=!1;let n=this.child("web-weaver-embed-inner");this.suggestions=[];try{for(let a of Array.from(n.querySelectorAll(".suggestion-button")))a.remove();this.attr.focusID="";let i=document.createElement("div");i.className="input",i.innerText=r,n.appendChild(i);let o=this.currentOutputElement;this.currentOutputElement=document.createElement("div"),this.currentOutputElement.className="output-container",n.appendChild(this.currentOutputElement);let s=Math.ceil(n.clientHeight-300);s<0&&(s=0),s>600&&(s=600),o&&(o.style.minHeight=""),this.currentOutputElement.style.minHeight=s+"px",this.currentOutputElement.offsetHeight,this.currentOutputElement.scrollIntoView({behavior:"smooth",block:"start"}),await this.ai.sendMessage(r);for(let a of this.suggestions){let l=document.createElement("div");l.className="suggestion-button",l.innerText=a,l.addEventListener("click",c=>this.onSuggestionClick(c,a)),this.currentOutputElement.appendChild(l)}}catch(i){on.error("Failed to process input:",i);let o=document.createElement("div");o.className="output",o.innerText="Sorry, there was a problem getting a response. "+i.message,n.appendChild(o);let s=document.createElement("div");s.className="suggestion-button",s.innerText="Reset conversation",s.addEventListener("click",a=>this.resetConversation()),n.appendChild(s)}this.state.loading=!1,this._isProcessing=!1}async onAIMessage(r,n){let i=[];for(let o of r)for(let s=0;s<(o.sections?.length||0);s++){let a=o.sections[s],l=`msgelem-${o.id||""}_${s}_${a.type||"unknown"}`;if(l=l.replace(/[^a-zA-Z0-9-_]/g,"_"),a.type=="thinking"){if(!a.text)continue;let c=a.text||"";c.includes(`
|
|
961
965
|
`)&&(c=c.split(`
|
|
962
966
|
`)[0]),this.updateInfoElement(l,c,"thinking-icon"),i.push(l)}else if(a.type=="tool_call"){let u=new Bu(r).toolResult(a.toolCallInstanceID||"");if(a.toolCallHiddenInUI!="always"){if(u?.toolErrorResponse)this.updateInfoElement(l,"**Error:** "+u.toolErrorResponse||"","tool-icon"),i.push(l);else if(!(a.toolCallHiddenInUI=="after-complete"&&u))if(a.toolKbID=="search"){let d=a.toolParameters?.query?`**Search:** ${a.toolParameters.query}`:"**Search**";this.updateInfoElement(l,d,"tool-icon"),i.push(l)}else if(a.toolKbID?.startsWith("ask:")&&a.toolParameters?.query){let d=a.toolKbID.substring(4),f=`**Ask ${this.ai.subAgents.subagents.find(m=>m.id===d)?.name||"agent"}:** ${a.toolParameters.query}`;this.updateInfoElement(l,f,"tool-icon"),i.push(l)}else this.updateInfoElement(l,a.toolKbName||"","tool-icon"),i.push(l)}}else if(a.type!="tool_result"){if(!a.text)continue;this.updateTextElement(l,a.text||""),i.push(l)}}for(let o of Array.from(this.currentOutputElement.children))i.includes(o.id)||o.remove()}updateTextElement(r,n){let i=this.currentOutputElement.querySelector(`#${r}`);i||(i=document.createElement("div"),i.id=r,i.className="output",this.currentOutputElement.appendChild(i));let o=l_().use(Cm).use(Am).use(zm).use(Z2).use(bm,{target:"_blank",rel:["noopener","noreferrer"]}).use(_m).use(km).processSync(n||"");i.innerHTML=o.toString("utf-8")}updateInfoElement(r,n,i){let o=this.currentOutputElement.querySelector(`#${r}`);o||(o=document.createElement("div"),o.id=r,o.className="info-block",o.innerHTML=`
|
|
963
967
|
<div class='info-block-icon'></div>
|