@anthropic-ai/claude-agent-sdk 0.2.101 → 0.2.104

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/browser-sdk.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
2
 
3
- // Version: 0.2.101
3
+ // Version: 0.2.104
4
4
  var TB=Object.create;var{getPrototypeOf:fB,defineProperty:GY,getOwnPropertyNames:gB}=Object;var yB=Object.prototype.hasOwnProperty;function hB($){return this[$]}var uB,lB,xU=($,X,J)=>{var Y=$!=null&&typeof $==="object";if(Y){var z=X?uB??=new WeakMap:lB??=new WeakMap,W=z.get($);if(W)return W}J=$!=null?TB(fB($)):{};let Q=X||!$||!$.__esModule?GY(J,"default",{value:$,enumerable:!0}):J;for(let G of gB($))if(!yB.call(Q,G))GY(Q,G,{get:hB.bind($,G),enumerable:!0});if(Y)z.set($,Q);return Q};var k=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var mB=($)=>$;function cB($,X){this[$]=mB.bind(null,X)}var x6=($,X)=>{for(var J in X)GY($,J,{get:X[J],enumerable:!0,configurable:!0,set:cB.bind(X,J)})};var iB=Symbol.dispose||Symbol.for("Symbol.dispose"),nB=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),D$=($,X,J)=>{if(X!=null){if(typeof X!=="object"&&typeof X!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var Y;if(J)Y=X[nB];if(Y===void 0)Y=X[iB];if(typeof Y!=="function")throw TypeError("Object not disposable");$.push([J,Y,X])}else if(J)$.push([J]);return X},B$=($,X,J)=>{var Y=typeof SuppressedError==="function"?SuppressedError:function(Q,G,U,w){return w=Error(U),w.name="SuppressedError",w.error=Q,w.suppressed=G,w},z=(Q)=>X=J?new Y(Q,X,"An error was suppressed during disposal"):(J=!0,Q),W=(Q)=>{while(Q=$.pop())try{var G=Q[1]&&Q[1].call(Q[2]);if(Q[0])return Promise.resolve(G).then(W,(U)=>(z(U),W()))}catch(U){z(U)}if(J)throw X};return W()};var TJ=k((cH)=>{Object.defineProperty(cH,"__esModule",{value:!0});cH.regexpCode=cH.getEsmExportName=cH.getProperty=cH.safeStringify=cH.stringify=cH.strConcat=cH.addCodeArg=cH.str=cH._=cH.nil=cH._Code=cH.Name=cH.IDENTIFIER=cH._CodeOrName=void 0;class A7{}cH._CodeOrName=A7;cH.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class z0 extends A7{constructor($){super();if(!cH.IDENTIFIER.test($))throw Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}cH.Name=z0;class M4 extends A7{constructor($){super();this._items=typeof $==="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((X,J)=>`${X}${J}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((X,J)=>{if(J instanceof z0)X[J.str]=(X[J.str]||0)+1;return X},{})}}cH._Code=M4;cH.nil=new M4("");function lH($,...X){let J=[$[0]],Y=0;while(Y<X.length)AG(J,X[Y]),J.push($[++Y]);return new M4(J)}cH._=lH;var bG=new M4("+");function mH($,...X){let J=[xJ($[0])],Y=0;while(Y<X.length)J.push(bG),AG(J,X[Y]),J.push(bG,xJ($[++Y]));return ZM(J),new M4(J)}cH.str=mH;function AG($,X){if(X instanceof M4)$.push(...X._items);else if(X instanceof z0)$.push(X);else $.push(_M(X))}cH.addCodeArg=AG;function ZM($){let X=1;while(X<$.length-1){if($[X]===bG){let J=CM($[X-1],$[X+1]);if(J!==void 0){$.splice(X-1,3,J);continue}$[X++]="+"}X++}}function CM($,X){if(X==='""')return $;if($==='""')return X;if(typeof $=="string"){if(X instanceof z0||$[$.length-1]!=='"')return;if(typeof X!="string")return`${$.slice(0,-1)}${X}"`;if(X[0]==='"')return $.slice(0,-1)+X.slice(1);return}if(typeof X=="string"&&X[0]==='"'&&!($ instanceof z0))return`"${$}${X.slice(1)}`;return}function kM($,X){return X.emptyStr()?$:$.emptyStr()?X:mH`${$}${X}`}cH.strConcat=kM;function _M($){return typeof $=="number"||typeof $=="boolean"||$===null?$:xJ(Array.isArray($)?$.join(","):$)}function xM($){return new M4(xJ($))}cH.stringify=xM;function xJ($){return JSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}cH.safeStringify=xJ;function TM($){return typeof $=="string"&&cH.IDENTIFIER.test($)?new M4(`.${$}`):lH`[${$}]`}cH.getProperty=TM;function fM($){if(typeof $=="string"&&cH.IDENTIFIER.test($))return new M4(`${$}`);throw Error(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}cH.getEsmExportName=fM;function gM($){return new M4($.toString())}cH.regexpCode=gM});var EG=k((dH)=>{Object.defineProperty(dH,"__esModule",{value:!0});dH.ValueScope=dH.ValueScopeName=dH.Scope=dH.varKinds=dH.UsedValueState=void 0;var o$=TJ();class nH extends Error{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}var P7;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(P7||(dH.UsedValueState=P7={}));dH.varKinds={const:new o$.Name("const"),let:new o$.Name("let"),var:new o$.Name("var")};class PG{constructor({prefixes:$,parent:X}={}){this._names={},this._prefixes=$,this._parent=X}toName($){return $ instanceof o$.Name?$:this.name($)}name($){return new o$.Name(this._newName($))}_newName($){let X=this._names[$]||this._nameGroup($);return`${$}${X.index++}`}_nameGroup($){var X,J;if(((J=(X=this._parent)===null||X===void 0?void 0:X._prefixes)===null||J===void 0?void 0:J.has($))||this._prefixes&&!this._prefixes.has($))throw Error(`CodeGen: prefix "${$}" is not allowed in this scope`);return this._names[$]={prefix:$,index:0}}}dH.Scope=PG;class SG extends o$.Name{constructor($,X){super(X);this.prefix=$}setValue($,{property:X,itemIndex:J}){this.value=$,this.scopePath=o$._`.${new o$.Name(X)}[${J}]`}}dH.ValueScopeName=SG;var tM=o$._`\n`;class pH extends PG{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?tM:o$.nil}}get(){return this._scope}name($){return new SG($,this._newName($))}value($,X){var J;if(X.ref===void 0)throw Error("CodeGen: ref must be passed in value");let Y=this.toName($),{prefix:z}=Y,W=(J=X.key)!==null&&J!==void 0?J:X.ref,Q=this._values[z];if(Q){let w=Q.get(W);if(w)return w}else Q=this._values[z]=new Map;Q.set(W,Y);let G=this._scope[z]||(this._scope[z]=[]),U=G.length;return G[U]=X.ref,Y.setValue(X,{property:z,itemIndex:U}),Y}getValue($,X){let J=this._values[$];if(!J)return;return J.get(X)}scopeRefs($,X=this._values){return this._reduceValues(X,(J)=>{if(J.scopePath===void 0)throw Error(`CodeGen: name "${J}" has no value`);return o$._`${$}${J.scopePath}`})}scopeCode($=this._values,X,J){return this._reduceValues($,(Y)=>{if(Y.value===void 0)throw Error(`CodeGen: name "${Y}" has no value`);return Y.value.code},X,J)}_reduceValues($,X,J={},Y){let z=o$.nil;for(let W in $){let Q=$[W];if(!Q)continue;let G=J[W]=J[W]||new Map;Q.forEach((U)=>{if(G.has(U))return;G.set(U,P7.Started);let w=X(U);if(w){let N=this.opts.es5?dH.varKinds.var:dH.varKinds.const;z=o$._`${z}${N} ${U} = ${w};${this.opts._n}`}else if(w=Y===null||Y===void 0?void 0:Y(U))z=o$._`${z}${w}${this.opts._n}`;else throw new nH(U);G.set(U,P7.Completed)})}return z}}dH.ValueScope=pH});var t=k((t$)=>{Object.defineProperty(t$,"__esModule",{value:!0});t$.or=t$.and=t$.not=t$.CodeGen=t$.operators=t$.varKinds=t$.ValueScopeName=t$.ValueScope=t$.Scope=t$.Name=t$.regexpCode=t$.stringify=t$.getProperty=t$.nil=t$.strConcat=t$.str=t$._=void 0;var J$=TJ(),P4=EG(),S6=TJ();Object.defineProperty(t$,"_",{enumerable:!0,get:function(){return S6._}});Object.defineProperty(t$,"str",{enumerable:!0,get:function(){return S6.str}});Object.defineProperty(t$,"strConcat",{enumerable:!0,get:function(){return S6.strConcat}});Object.defineProperty(t$,"nil",{enumerable:!0,get:function(){return S6.nil}});Object.defineProperty(t$,"getProperty",{enumerable:!0,get:function(){return S6.getProperty}});Object.defineProperty(t$,"stringify",{enumerable:!0,get:function(){return S6.stringify}});Object.defineProperty(t$,"regexpCode",{enumerable:!0,get:function(){return S6.regexpCode}});Object.defineProperty(t$,"Name",{enumerable:!0,get:function(){return S6.Name}});var C7=EG();Object.defineProperty(t$,"Scope",{enumerable:!0,get:function(){return C7.Scope}});Object.defineProperty(t$,"ValueScope",{enumerable:!0,get:function(){return C7.ValueScope}});Object.defineProperty(t$,"ValueScopeName",{enumerable:!0,get:function(){return C7.ValueScopeName}});Object.defineProperty(t$,"varKinds",{enumerable:!0,get:function(){return C7.varKinds}});t$.operators={GT:new J$._Code(">"),GTE:new J$._Code(">="),LT:new J$._Code("<"),LTE:new J$._Code("<="),EQ:new J$._Code("==="),NEQ:new J$._Code("!=="),NOT:new J$._Code("!"),OR:new J$._Code("||"),AND:new J$._Code("&&"),ADD:new J$._Code("+")};class E6{optimizeNodes(){return this}optimizeNames($,X){return this}}class oH extends E6{constructor($,X,J){super();this.varKind=$,this.name=X,this.rhs=J}render({es5:$,_n:X}){let J=$?P4.varKinds.var:this.varKind,Y=this.rhs===void 0?"":` = ${this.rhs}`;return`${J} ${this.name}${Y};`+X}optimizeNames($,X){if(!$[this.name.str])return;if(this.rhs)this.rhs=W0(this.rhs,$,X);return this}get names(){return this.rhs instanceof J$._CodeOrName?this.rhs.names:{}}}class ZG extends E6{constructor($,X,J){super();this.lhs=$,this.rhs=X,this.sideEffects=J}render({_n:$}){return`${this.lhs} = ${this.rhs};`+$}optimizeNames($,X){if(this.lhs instanceof J$.Name&&!$[this.lhs.str]&&!this.sideEffects)return;return this.rhs=W0(this.rhs,$,X),this}get names(){let $=this.lhs instanceof J$.Name?{}:{...this.lhs.names};return Z7($,this.rhs)}}class tH extends ZG{constructor($,X,J,Y){super($,J,Y);this.op=X}render({_n:$}){return`${this.lhs} ${this.op}= ${this.rhs};`+$}}class aH extends E6{constructor($){super();this.label=$,this.names={}}render({_n:$}){return`${this.label}:`+$}}class sH extends E6{constructor($){super();this.label=$,this.names={}}render({_n:$}){return`break${this.label?` ${this.label}`:""};`+$}}class eH extends E6{constructor($){super();this.error=$}render({_n:$}){return`throw ${this.error};`+$}get names(){return this.error.names}}class $K extends E6{constructor($){super();this.code=$}render({_n:$}){return`${this.code};`+$}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames($,X){return this.code=W0(this.code,$,X),this}get names(){return this.code instanceof J$._CodeOrName?this.code.names:{}}}class k7 extends E6{constructor($=[]){super();this.nodes=$}render($){return this.nodes.reduce((X,J)=>X+J.render($),"")}optimizeNodes(){let{nodes:$}=this,X=$.length;while(X--){let J=$[X].optimizeNodes();if(Array.isArray(J))$.splice(X,1,...J);else if(J)$[X]=J;else $.splice(X,1)}return $.length>0?this:void 0}optimizeNames($,X){let{nodes:J}=this,Y=J.length;while(Y--){let z=J[Y];if(z.optimizeNames($,X))continue;$2($,z.names),J.splice(Y,1)}return J.length>0?this:void 0}get names(){return this.nodes.reduce(($,X)=>Y1($,X.names),{})}}class v6 extends k7{render($){return"{"+$._n+super.render($)+"}"+$._n}}class XK extends k7{}class fJ extends v6{}fJ.kind="else";class $6 extends v6{constructor($,X){super(X);this.condition=$}render($){let X=`if(${this.condition})`+super.render($);if(this.else)X+="else "+this.else.render($);return X}optimizeNodes(){super.optimizeNodes();let $=this.condition;if($===!0)return this.nodes;let X=this.else;if(X){let J=X.optimizeNodes();X=this.else=Array.isArray(J)?new fJ(J):J}if(X){if($===!1)return X instanceof $6?X:X.nodes;if(this.nodes.length)return this;return new $6(QK($),X instanceof $6?[X]:X.nodes)}if($===!1||!this.nodes.length)return;return this}optimizeNames($,X){var J;if(this.else=(J=this.else)===null||J===void 0?void 0:J.optimizeNames($,X),!(super.optimizeNames($,X)||this.else))return;return this.condition=W0(this.condition,$,X),this}get names(){let $=super.names;if(Z7($,this.condition),this.else)Y1($,this.else.names);return $}}$6.kind="if";class Y0 extends v6{}Y0.kind="for";class JK extends Y0{constructor($){super();this.iteration=$}render($){return`for(${this.iteration})`+super.render($)}optimizeNames($,X){if(!super.optimizeNames($,X))return;return this.iteration=W0(this.iteration,$,X),this}get names(){return Y1(super.names,this.iteration.names)}}class zK extends Y0{constructor($,X,J,Y){super();this.varKind=$,this.name=X,this.from=J,this.to=Y}render($){let X=$.es5?P4.varKinds.var:this.varKind,{name:J,from:Y,to:z}=this;return`for(${X} ${J}=${Y}; ${J}<${z}; ${J}++)`+super.render($)}get names(){let $=Z7(super.names,this.from);return Z7($,this.to)}}class vG extends Y0{constructor($,X,J,Y){super();this.loop=$,this.varKind=X,this.name=J,this.iterable=Y}render($){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render($)}optimizeNames($,X){if(!super.optimizeNames($,X))return;return this.iterable=W0(this.iterable,$,X),this}get names(){return Y1(super.names,this.iterable.names)}}class S7 extends v6{constructor($,X,J){super();this.name=$,this.args=X,this.async=J}render($){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render($)}}S7.kind="func";class E7 extends k7{render($){return"return "+super.render($)}}E7.kind="return";class YK extends v6{render($){let X="try"+super.render($);if(this.catch)X+=this.catch.render($);if(this.finally)X+=this.finally.render($);return X}optimizeNodes(){var $,X;return super.optimizeNodes(),($=this.catch)===null||$===void 0||$.optimizeNodes(),(X=this.finally)===null||X===void 0||X.optimizeNodes(),this}optimizeNames($,X){var J,Y;return super.optimizeNames($,X),(J=this.catch)===null||J===void 0||J.optimizeNames($,X),(Y=this.finally)===null||Y===void 0||Y.optimizeNames($,X),this}get names(){let $=super.names;if(this.catch)Y1($,this.catch.names);if(this.finally)Y1($,this.finally.names);return $}}class v7 extends v6{constructor($){super();this.error=$}render($){return`catch(${this.error})`+super.render($)}}v7.kind="catch";class R7 extends v6{render($){return"finally"+super.render($)}}R7.kind="finally";class WK{constructor($,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
5
5
  `:""},this._extScope=$,this._scope=new P4.Scope({parent:$}),this._nodes=[new XK]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,X){let J=this._extScope.value($,X);return(this._values[J.prefix]||(this._values[J.prefix]=new Set)).add(J),J}getScopeValue($,X){return this._extScope.getValue($,X)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,X,J,Y){let z=this._scope.toName(X);if(J!==void 0&&Y)this._constants[z.str]=J;return this._leafNode(new oH($,z,J)),z}const($,X,J){return this._def(P4.varKinds.const,$,X,J)}let($,X,J){return this._def(P4.varKinds.let,$,X,J)}var($,X,J){return this._def(P4.varKinds.var,$,X,J)}assign($,X,J){return this._leafNode(new ZG($,X,J))}add($,X){return this._leafNode(new tH($,t$.operators.ADD,X))}code($){if(typeof $=="function")$();else if($!==J$.nil)this._leafNode(new $K($));return this}object(...$){let X=["{"];for(let[J,Y]of $){if(X.length>1)X.push(",");if(X.push(J),J!==Y||this.opts.es5)X.push(":"),(0,J$.addCodeArg)(X,Y)}return X.push("}"),new J$._Code(X)}if($,X,J){if(this._blockNode(new $6($)),X&&J)this.code(X).else().code(J).endIf();else if(X)this.code(X).endIf();else if(J)throw Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new $6($))}else(){return this._elseNode(new fJ)}endIf(){return this._endBlockNode($6,fJ)}_for($,X){if(this._blockNode($),X)this.code(X).endFor();return this}for($,X){return this._for(new JK($),X)}forRange($,X,J,Y,z=this.opts.es5?P4.varKinds.var:P4.varKinds.let){let W=this._scope.toName($);return this._for(new zK(z,W,X,J),()=>Y(W))}forOf($,X,J,Y=P4.varKinds.const){let z=this._scope.toName($);if(this.opts.es5){let W=X instanceof J$.Name?X:this.var("_arr",X);return this.forRange("_i",0,J$._`${W}.length`,(Q)=>{this.var(z,J$._`${W}[${Q}]`),J(z)})}return this._for(new vG("of",Y,z,X),()=>J(z))}forIn($,X,J,Y=this.opts.es5?P4.varKinds.var:P4.varKinds.const){if(this.opts.ownProperties)return this.forOf($,J$._`Object.keys(${X})`,J);let z=this._scope.toName($);return this._for(new vG("in",Y,z,X),()=>J(z))}endFor(){return this._endBlockNode(Y0)}label($){return this._leafNode(new aH($))}break($){return this._leafNode(new sH($))}return($){let X=new E7;if(this._blockNode(X),this.code($),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(E7)}try($,X,J){if(!X&&!J)throw Error('CodeGen: "try" without "catch" and "finally"');let Y=new YK;if(this._blockNode(Y),this.code($),X){let z=this.name("e");this._currNode=Y.catch=new v7(z),X(z)}if(J)this._currNode=Y.finally=new R7,this.code(J);return this._endBlockNode(v7,R7)}throw($){return this._leafNode(new eH($))}block($,X){if(this._blockStarts.push(this._nodes.length),$)this.code($).endBlock(X);return this}endBlock($){let X=this._blockStarts.pop();if(X===void 0)throw Error("CodeGen: not in self-balancing block");let J=this._nodes.length-X;if(J<0||$!==void 0&&J!==$)throw Error(`CodeGen: wrong number of nodes: ${J} vs ${$} expected`);return this._nodes.length=X,this}func($,X=J$.nil,J,Y){if(this._blockNode(new S7($,X,J)),Y)this.code(Y).endFunc();return this}endFunc(){return this._endBlockNode(S7)}optimize($=1){while($-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode($){return this._currNode.nodes.push($),this}_blockNode($){this._currNode.nodes.push($),this._nodes.push($)}_endBlockNode($,X){let J=this._currNode;if(J instanceof $||X&&J instanceof X)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${X?`${$.kind}/${X.kind}`:$.kind}"`)}_elseNode($){let X=this._currNode;if(!(X instanceof $6))throw Error('CodeGen: "else" without "if"');return this._currNode=X.else=$,this}get _root(){return this._nodes[0]}get _currNode(){let $=this._nodes;return $[$.length-1]}set _currNode($){let X=this._nodes;X[X.length-1]=$}}t$.CodeGen=WK;function Y1($,X){for(let J in X)$[J]=($[J]||0)+(X[J]||0);return $}function Z7($,X){return X instanceof J$._CodeOrName?Y1($,X.names):$}function W0($,X,J){if($ instanceof J$.Name)return Y($);if(!z($))return $;return new J$._Code($._items.reduce((W,Q)=>{if(Q instanceof J$.Name)Q=Y(Q);if(Q instanceof J$._Code)W.push(...Q._items);else W.push(Q);return W},[]));function Y(W){let Q=J[W.str];if(Q===void 0||X[W.str]!==1)return W;return delete X[W.str],Q}function z(W){return W instanceof J$._Code&&W._items.some((Q)=>Q instanceof J$.Name&&X[Q.str]===1&&J[Q.str]!==void 0)}}function $2($,X){for(let J in X)$[J]=($[J]||0)-(X[J]||0)}function QK($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:J$._`!${RG($)}`}t$.not=QK;var X2=GK(t$.operators.AND);function J2(...$){return $.reduce(X2)}t$.and=J2;var z2=GK(t$.operators.OR);function Y2(...$){return $.reduce(z2)}t$.or=Y2;function GK($){return(X,J)=>X===J$.nil?J:J===J$.nil?X:J$._`${RG(X)} ${$} ${RG(J)}`}function RG($){return $ instanceof J$.Name?$:J$._`(${$})`}});var z$=k((BK)=>{Object.defineProperty(BK,"__esModule",{value:!0});BK.checkStrictMode=BK.getErrorPath=BK.Type=BK.useFunc=BK.setEvaluated=BK.evaluatedPropsToName=BK.mergeEvaluated=BK.eachItem=BK.unescapeJsonPointer=BK.escapeJsonPointer=BK.escapeFragment=BK.unescapeFragment=BK.schemaRefOrVal=BK.schemaHasRulesButRef=BK.schemaHasRules=BK.checkUnknownRules=BK.alwaysValidSchema=BK.toHash=void 0;var N$=t(),U2=TJ();function w2($){let X={};for(let J of $)X[J]=!0;return X}BK.toHash=w2;function N2($,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return HK($,X),!KK(X,$.self.RULES.all)}BK.alwaysValidSchema=N2;function HK($,X=$.schema){let{opts:J,self:Y}=$;if(!J.strictSchema)return;if(typeof X==="boolean")return;let z=Y.RULES.keywords;for(let W in X)if(!z[W])DK($,`unknown keyword: "${W}"`)}BK.checkUnknownRules=HK;function KK($,X){if(typeof $=="boolean")return!$;for(let J in $)if(X[J])return!0;return!1}BK.schemaHasRules=KK;function H2($,X){if(typeof $=="boolean")return!$;for(let J in $)if(J!=="$ref"&&X.all[J])return!0;return!1}BK.schemaHasRulesButRef=H2;function K2({topSchemaRef:$,schemaPath:X},J,Y,z){if(!z){if(typeof J=="number"||typeof J=="boolean")return J;if(typeof J=="string")return N$._`${J}`}return N$._`${$}${X}${(0,N$.getProperty)(Y)}`}BK.schemaRefOrVal=K2;function V2($){return VK(decodeURIComponent($))}BK.unescapeFragment=V2;function O2($){return encodeURIComponent(kG($))}BK.escapeFragment=O2;function kG($){if(typeof $=="number")return`${$}`;return $.replace(/~/g,"~0").replace(/\//g,"~1")}BK.escapeJsonPointer=kG;function VK($){return $.replace(/~1/g,"/").replace(/~0/g,"~")}BK.unescapeJsonPointer=VK;function D2($,X){if(Array.isArray($))for(let J of $)X(J);else X($)}BK.eachItem=D2;function wK({mergeNames:$,mergeToName:X,mergeValues:J,resultToName:Y}){return(z,W,Q,G)=>{let U=Q===void 0?W:Q instanceof N$.Name?(W instanceof N$.Name?$(z,W,Q):X(z,W,Q),Q):W instanceof N$.Name?(X(z,Q,W),W):J(W,Q);return G===N$.Name&&!(U instanceof N$.Name)?Y(z,U):U}}BK.mergeEvaluated={props:wK({mergeNames:($,X,J)=>$.if(N$._`${J} !== true && ${X} !== undefined`,()=>{$.if(N$._`${X} === true`,()=>$.assign(J,!0),()=>$.assign(J,N$._`${J} || {}`).code(N$._`Object.assign(${J}, ${X})`))}),mergeToName:($,X,J)=>$.if(N$._`${J} !== true`,()=>{if(X===!0)$.assign(J,!0);else $.assign(J,N$._`${J} || {}`),_G($,J,X)}),mergeValues:($,X)=>$===!0?!0:{...$,...X},resultToName:OK}),items:wK({mergeNames:($,X,J)=>$.if(N$._`${J} !== true && ${X} !== undefined`,()=>$.assign(J,N$._`${X} === true ? true : ${J} > ${X} ? ${J} : ${X}`)),mergeToName:($,X,J)=>$.if(N$._`${J} !== true`,()=>$.assign(J,X===!0?!0:N$._`${J} > ${X} ? ${J} : ${X}`)),mergeValues:($,X)=>$===!0?!0:Math.max($,X),resultToName:($,X)=>$.var("items",X)})};function OK($,X){if(X===!0)return $.var("props",!0);let J=$.var("props",N$._`{}`);if(X!==void 0)_G($,J,X);return J}BK.evaluatedPropsToName=OK;function _G($,X,J){Object.keys(J).forEach((Y)=>$.assign(N$._`${X}${(0,N$.getProperty)(Y)}`,!0))}BK.setEvaluated=_G;var NK={};function B2($,X){return $.scopeValue("func",{ref:X,code:NK[X.code]||(NK[X.code]=new U2._Code(X.code))})}BK.useFunc=B2;var CG;(function($){$[$.Num=0]="Num",$[$.Str=1]="Str"})(CG||(BK.Type=CG={}));function j2($,X,J){if($ instanceof N$.Name){let Y=X===CG.Num;return J?Y?N$._`"[" + ${$} + "]"`:N$._`"['" + ${$} + "']"`:Y?N$._`"/" + ${$}`:N$._`"/" + ${$}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return J?(0,N$.getProperty)($).toString():"/"+kG($)}BK.getErrorPath=j2;function DK($,X,J=$.opts.strictSchema){if(!J)return;if(X=`strict mode: ${X}`,J===!0)throw Error(X);$.self.logger.warn(X)}BK.checkStrictMode=DK});var X6=k((qK)=>{Object.defineProperty(qK,"__esModule",{value:!0});var u$=t(),T2={data:new u$.Name("data"),valCxt:new u$.Name("valCxt"),instancePath:new u$.Name("instancePath"),parentData:new u$.Name("parentData"),parentDataProperty:new u$.Name("parentDataProperty"),rootData:new u$.Name("rootData"),dynamicAnchors:new u$.Name("dynamicAnchors"),vErrors:new u$.Name("vErrors"),errors:new u$.Name("errors"),this:new u$.Name("this"),self:new u$.Name("self"),scope:new u$.Name("scope"),json:new u$.Name("json"),jsonPos:new u$.Name("jsonPos"),jsonLen:new u$.Name("jsonLen"),jsonPart:new u$.Name("jsonPart")};qK.default=T2});var gJ=k((bK)=>{Object.defineProperty(bK,"__esModule",{value:!0});bK.extendErrors=bK.resetErrorsCount=bK.reportExtraError=bK.reportError=bK.keyword$DataError=bK.keywordError=void 0;var Y$=t(),x7=z$(),i$=X6();bK.keywordError={message:({keyword:$})=>Y$.str`must pass "${$}" keyword validation`};bK.keyword$DataError={message:({keyword:$,schemaType:X})=>X?Y$.str`"${$}" keyword must be ${X} ($data)`:Y$.str`"${$}" keyword is invalid ($data)`};function g2($,X=bK.keywordError,J,Y){let{it:z}=$,{gen:W,compositeRule:Q,allErrors:G}=z,U=IK($,X,J);if(Y!==null&&Y!==void 0?Y:Q||G)LK(W,U);else FK(z,Y$._`[${U}]`)}bK.reportError=g2;function y2($,X=bK.keywordError,J){let{it:Y}=$,{gen:z,compositeRule:W,allErrors:Q}=Y,G=IK($,X,J);if(LK(z,G),!(W||Q))FK(Y,i$.default.vErrors)}bK.reportExtraError=y2;function h2($,X){$.assign(i$.default.errors,X),$.if(Y$._`${i$.default.vErrors} !== null`,()=>$.if(X,()=>$.assign(Y$._`${i$.default.vErrors}.length`,X),()=>$.assign(i$.default.vErrors,null)))}bK.resetErrorsCount=h2;function u2({gen:$,keyword:X,schemaValue:J,data:Y,errsCount:z,it:W}){if(z===void 0)throw Error("ajv implementation error");let Q=$.name("err");$.forRange("i",z,i$.default.errors,(G)=>{if($.const(Q,Y$._`${i$.default.vErrors}[${G}]`),$.if(Y$._`${Q}.instancePath === undefined`,()=>$.assign(Y$._`${Q}.instancePath`,(0,Y$.strConcat)(i$.default.instancePath,W.errorPath))),$.assign(Y$._`${Q}.schemaPath`,Y$.str`${W.errSchemaPath}/${X}`),W.opts.verbose)$.assign(Y$._`${Q}.schema`,J),$.assign(Y$._`${Q}.data`,Y)})}bK.extendErrors=u2;function LK($,X){let J=$.const("err",X);$.if(Y$._`${i$.default.vErrors} === null`,()=>$.assign(i$.default.vErrors,Y$._`[${J}]`),Y$._`${i$.default.vErrors}.push(${J})`),$.code(Y$._`${i$.default.errors}++`)}function FK($,X){let{gen:J,validateName:Y,schemaEnv:z}=$;if(z.$async)J.throw(Y$._`new ${$.ValidationError}(${X})`);else J.assign(Y$._`${Y}.errors`,X),J.return(!1)}var W1={keyword:new Y$.Name("keyword"),schemaPath:new Y$.Name("schemaPath"),params:new Y$.Name("params"),propertyName:new Y$.Name("propertyName"),message:new Y$.Name("message"),schema:new Y$.Name("schema"),parentSchema:new Y$.Name("parentSchema")};function IK($,X,J){let{createErrors:Y}=$.it;if(Y===!1)return Y$._`{}`;return l2($,X,J)}function l2($,X,J={}){let{gen:Y,it:z}=$,W=[m2(z,J),c2($,J)];return i2($,X,W),Y.object(...W)}function m2({errorPath:$},{instancePath:X}){let J=X?Y$.str`${$}${(0,x7.getErrorPath)(X,x7.Type.Str)}`:$;return[i$.default.instancePath,(0,Y$.strConcat)(i$.default.instancePath,J)]}function c2({keyword:$,it:{errSchemaPath:X}},{schemaPath:J,parentSchema:Y}){let z=Y?X:Y$.str`${X}/${$}`;if(J)z=Y$.str`${z}${(0,x7.getErrorPath)(J,x7.Type.Str)}`;return[W1.schemaPath,z]}function i2($,{params:X,message:J},Y){let{keyword:z,data:W,schemaValue:Q,it:G}=$,{opts:U,propertyName:w,topSchemaRef:N,schemaPath:K}=G;if(Y.push([W1.keyword,z],[W1.params,typeof X=="function"?X($):X||Y$._`{}`]),U.messages)Y.push([W1.message,typeof J=="function"?J($):J]);if(U.verbose)Y.push([W1.schema,Q],[W1.parentSchema,Y$._`${N}${K}`],[i$.default.data,W]);if(w)Y.push([W1.propertyName,w])}});var EK=k((PK)=>{Object.defineProperty(PK,"__esModule",{value:!0});PK.boolOrEmptySchema=PK.topBoolOrEmptySchema=void 0;var o2=gJ(),t2=t(),a2=X6(),s2={message:"boolean schema is false"};function e2($){let{gen:X,schema:J,validateName:Y}=$;if(J===!1)MK($,!1);else if(typeof J=="object"&&J.$async===!0)X.return(a2.default.data);else X.assign(t2._`${Y}.errors`,null),X.return(!0)}PK.topBoolOrEmptySchema=e2;function $P($,X){let{gen:J,schema:Y}=$;if(Y===!1)J.var(X,!1),MK($);else J.var(X,!0)}PK.boolOrEmptySchema=$P;function MK($,X){let{gen:J,data:Y}=$,z={gen:J,keyword:"false schema",data:Y,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:$};(0,o2.reportError)(z,s2,void 0,X)}});var TG=k((vK)=>{Object.defineProperty(vK,"__esModule",{value:!0});vK.getRules=vK.isJSONType=void 0;var JP=["string","number","integer","boolean","null","object","array"],zP=new Set(JP);function YP($){return typeof $=="string"&&zP.has($)}vK.isJSONType=YP;function WP(){let $={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...$,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},$.number,$.string,$.array,$.object],post:{rules:[]},all:{},keywords:{}}}vK.getRules=WP});var fG=k((kK)=>{Object.defineProperty(kK,"__esModule",{value:!0});kK.shouldUseRule=kK.shouldUseGroup=kK.schemaHasRulesForType=void 0;function GP({schema:$,self:X},J){let Y=X.RULES.types[J];return Y&&Y!==!0&&ZK($,Y)}kK.schemaHasRulesForType=GP;function ZK($,X){return X.rules.some((J)=>CK($,J))}kK.shouldUseGroup=ZK;function CK($,X){var J;return $[X.keyword]!==void 0||((J=X.definition.implements)===null||J===void 0?void 0:J.some((Y)=>$[Y]!==void 0))}kK.shouldUseRule=CK});var yJ=k((gK)=>{Object.defineProperty(gK,"__esModule",{value:!0});gK.reportTypeError=gK.checkDataTypes=gK.checkDataType=gK.coerceAndCheckDataType=gK.getJSONTypes=gK.getSchemaTypes=gK.DataType=void 0;var NP=TG(),HP=fG(),KP=gJ(),o=t(),xK=z$(),Q0;(function($){$[$.Correct=0]="Correct",$[$.Wrong=1]="Wrong"})(Q0||(gK.DataType=Q0={}));function VP($){let X=TK($.type);if(X.includes("null")){if($.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!X.length&&$.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if($.nullable===!0)X.push("null")}return X}gK.getSchemaTypes=VP;function TK($){let X=Array.isArray($)?$:$?[$]:[];if(X.every(NP.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}gK.getJSONTypes=TK;function OP($,X){let{gen:J,data:Y,opts:z}=$,W=DP(X,z.coerceTypes),Q=X.length>0&&!(W.length===0&&X.length===1&&(0,HP.schemaHasRulesForType)($,X[0]));if(Q){let G=yG(X,Y,z.strictNumbers,Q0.Wrong);J.if(G,()=>{if(W.length)BP($,X,W);else hG($)})}return Q}gK.coerceAndCheckDataType=OP;var fK=new Set(["string","number","integer","boolean","null"]);function DP($,X){return X?$.filter((J)=>fK.has(J)||X==="array"&&J==="array"):[]}function BP($,X,J){let{gen:Y,data:z,opts:W}=$,Q=Y.let("dataType",o._`typeof ${z}`),G=Y.let("coerced",o._`undefined`);if(W.coerceTypes==="array")Y.if(o._`${Q} == 'object' && Array.isArray(${z}) && ${z}.length == 1`,()=>Y.assign(z,o._`${z}[0]`).assign(Q,o._`typeof ${z}`).if(yG(X,z,W.strictNumbers),()=>Y.assign(G,z)));Y.if(o._`${G} !== undefined`);for(let w of J)if(fK.has(w)||w==="array"&&W.coerceTypes==="array")U(w);Y.else(),hG($),Y.endIf(),Y.if(o._`${G} !== undefined`,()=>{Y.assign(z,G),jP($,G)});function U(w){switch(w){case"string":Y.elseIf(o._`${Q} == "number" || ${Q} == "boolean"`).assign(G,o._`"" + ${z}`).elseIf(o._`${z} === null`).assign(G,o._`""`);return;case"number":Y.elseIf(o._`${Q} == "boolean" || ${z} === null
6
6
  || (${Q} == "string" && ${z} && ${z} == +${z})`).assign(G,o._`+${z}`);return;case"integer":Y.elseIf(o._`${Q} === "boolean" || ${z} === null