tempest.games 0.2.47 → 0.2.49
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/CHANGELOG.md +14 -0
- package/app/assets/{index-C0taM2pq.js → index-rL2PwV4P.js} +45 -45
- package/app/index.html +1 -1
- package/bin/backend.bun.js +99 -99
- package/bin/backend.worker.game.bun.js +5 -5
- package/bin/backend.worker.tribunal.bun.js +44 -44
- package/bin/frontend.bun.js +25 -25
- package/package.json +4 -4
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var Oj=Object.create;var{getPrototypeOf:wj,defineProperty:_W,getOwnPropertyNames:Dj}=Object;var Ej=Object.prototype.hasOwnProperty;var PN=($,X,Y)=>{Y=$!=null?Oj(wj($)):{};let U=X||!$||!$.__esModule?_W(Y,"default",{value:$,enumerable:!0}):Y;for(let G of Dj($))if(!Ej.call(U,G))_W(U,G,{get:()=>$[G],enumerable:!0});return U};var IN=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var D2=($,X)=>{for(var Y in X)_W($,Y,{get:X[Y],enumerable:!0,configurable:!0,set:(U)=>X[Y]=()=>U})};var rm=($,X)=>()=>($&&(X=$($=0)),X);var xN=import.meta.require;var fM=IN((Nd,bM)=>{var fY=xN("os"),hY=xN("path");function kM($){let X=process.env.XDG_CACHE_HOME||hY.join(fY.homedir(),".cache");return hY.join(X,$)}function XS($){return hY.join(fY.homedir(),"Library","Caches",$)}function YS($){let X=process.env.LOCALAPPDATA||hY.join(fY.homedir(),"AppData","Local");return hY.join(X,$,"Cache")}var GS=function(){switch(fY.platform()){case"darwin":return XS;case"win32":return YS;case"aix":case"android":case"freebsd":case"linux":case"netbsd":case"openbsd":case"sunos":return kM;default:return console.error(`(node:${process.pid}) [cachedir] Warning: the platform "${fY.platform()}" is not currently supported by node-cachedir, falling back to "posix". Please file an issue with your platform here: https://github.com/LinusU/node-cachedir/issues/new`),kM}}();bM.exports=function $(X){if(typeof X!=="string")throw new TypeError("id is not a string");if(X.length===0)throw new Error("id cannot be empty");if(/[^0-9a-zA-Z-]/.test(X))throw new Error("id cannot contain special characters");return GS(X)}});var VJ=IN((cl,jO)=>{var pU=process||{},ZJ=pU.argv||[],cU=pU.env||{},_S=!(!!cU.NO_COLOR||ZJ.includes("--no-color"))&&(!!cU.FORCE_COLOR||ZJ.includes("--color")||pU.platform==="win32"||(pU.stdout||{}).isTTY&&cU.TERM!=="dumb"||!!cU.CI),qS=($,X,Y=$)=>(U)=>{let G=""+U,z=G.indexOf(X,$.length);return~z?$+RS(G,X,Y,z)+X:$+G+X},RS=($,X,Y,U)=>{let G="",z=0;do G+=$.substring(z,U)+Y,z=U+X.length,U=$.indexOf(X,z);while(~U);return G+$.substring(z)},HJ=($=_S)=>{let X=$?qS:()=>String;return{isColorSupported:$,reset:X("\x1B[0m","\x1B[0m"),bold:X("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:X("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:X("\x1B[3m","\x1B[23m"),underline:X("\x1B[4m","\x1B[24m"),inverse:X("\x1B[7m","\x1B[27m"),hidden:X("\x1B[8m","\x1B[28m"),strikethrough:X("\x1B[9m","\x1B[29m"),black:X("\x1B[30m","\x1B[39m"),red:X("\x1B[31m","\x1B[39m"),green:X("\x1B[32m","\x1B[39m"),yellow:X("\x1B[33m","\x1B[39m"),blue:X("\x1B[34m","\x1B[39m"),magenta:X("\x1B[35m","\x1B[39m"),cyan:X("\x1B[36m","\x1B[39m"),white:X("\x1B[37m","\x1B[39m"),gray:X("\x1B[90m","\x1B[39m"),bgBlack:X("\x1B[40m","\x1B[49m"),bgRed:X("\x1B[41m","\x1B[49m"),bgGreen:X("\x1B[42m","\x1B[49m"),bgYellow:X("\x1B[43m","\x1B[49m"),bgBlue:X("\x1B[44m","\x1B[49m"),bgMagenta:X("\x1B[45m","\x1B[49m"),bgCyan:X("\x1B[46m","\x1B[49m"),bgWhite:X("\x1B[47m","\x1B[49m"),blackBright:X("\x1B[90m","\x1B[39m"),redBright:X("\x1B[91m","\x1B[39m"),greenBright:X("\x1B[92m","\x1B[39m"),yellowBright:X("\x1B[93m","\x1B[39m"),blueBright:X("\x1B[94m","\x1B[39m"),magentaBright:X("\x1B[95m","\x1B[39m"),cyanBright:X("\x1B[96m","\x1B[39m"),whiteBright:X("\x1B[97m","\x1B[39m"),bgBlackBright:X("\x1B[100m","\x1B[49m"),bgRedBright:X("\x1B[101m","\x1B[49m"),bgGreenBright:X("\x1B[102m","\x1B[49m"),bgYellowBright:X("\x1B[103m","\x1B[49m"),bgBlueBright:X("\x1B[104m","\x1B[49m"),bgMagentaBright:X("\x1B[105m","\x1B[49m"),bgCyanBright:X("\x1B[106m","\x1B[49m"),bgWhiteBright:X("\x1B[107m","\x1B[49m")}};jO.exports=HJ();jO.exports.createColors=HJ});function E6($){return JSON.parse($)}var p$=($)=>JSON.stringify($),om=[Array.prototype,Boolean.prototype,Number.prototype,Object.prototype,String.prototype];function $X($){return j5(N6.STORE,$,void 0)}function u9($){return XX(N6.STORE,$)}function RW(...$){return A1(N6.STORE,...$)}function R5($,X){return uN(N6.STORE,$,X)}function SN($){return pN($,N6.STORE)}var J0={atom_family:"atom family",atom:"atom",continuity:"continuity",key:"key",mutable_atom_family:"atom family [m]",mutable_atom:"atom [m]",readonly_held_selector_family:"selector family [h]",readonly_held_selector:"selector [h]",readonly_pure_selector_family:"selector family",readonly_pure_selector:"selector",state:"state",timeline:"timeline",transaction:"transaction",unknown:"unknown",writable_held_selector_family:"selector family [wh]",writable_held_selector:"selector [wh]",writable_pure_selector_family:"selector family [w]",writable_pure_selector:"selector [w]"};var qW=($)=>(X,Y,U,G,...z)=>{console[$](`${X} ${J0[Y]} \`${U}\` ${G}`,...z)},Nj={error:qW("error"),info:qW("info"),warn:qW("warn")},kN=class{logLevel;filter;logger;constructor($,X,Y=Nj){this.logLevel=$,this.filter=X,this.logger=Y}error=(...$)=>{if(this.logLevel!==null){let X=this.filter?.(...$)??!0;if(X===!0)this.logger.error(...$);else if(X)this.logger.error(...X)}};info=(...$)=>{if(this.logLevel==="info"){let X=this.filter?.(...$)??!0;if(X===!0)this.logger.info(...$);else if(X)this.logger.info(...X)}};warn=(...$)=>{if(this.logLevel!=="error"&&this.logLevel!==null){let X=this.filter?.(...$)??!0;if(X===!0)this.logger.warn(...$);else if(X)this.logger.warn(...X)}}};var bN=class{store;deallocateTX;claimTX;constructor($=N6.STORE){this.store=$,this.deallocateTX=hN($),this.claimTX=gN($),fN("root",$)}allocate($,X,Y){B5(this.store,$,X,Y)}deallocate($){v5(this.store,this.deallocateTX,TW())($)}claim($,X,Y){p9(this.store,$,X,Y)}};function T5($){return vW(N6.STORE,$)}function c9($){return d9(N6.STORE,$)}var A0=class $ extends Set{mode="record";subject=new g$;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor(X,Y=0){super(X);if(X instanceof $)this.parent=X,this.cacheUpdateNumber=X.cacheUpdateNumber;if(Y)this.cacheLimit=Y,this.cache=new Array(Y),this.subscribe("auto cache",(U)=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=U})}READONLY_VIEW=this;toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON(X){let Y=new $(X.members,X.cacheLimit);return Y.cache=X.cache,Y.cacheIdx=X.cacheIdx,Y.cacheUpdateNumber=X.cacheUpdateNumber,Y}add(X){let Y=super.add(X);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`add:${p$(X)}`);return Y}clear(){let X=this.mode==="record"?[...this]:null;if(super.clear(),X)this.cacheUpdateNumber++,this.emit(`clear:${JSON.stringify(X)}`)}delete(X){let Y=super.delete(X);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`del:${p$(X)}`);return Y}parent=null;child=null;transactionUpdates=null;transaction(X){this.mode="transaction",this.transactionUpdates=[],this.child=new $(this);let Y=this.child._subscribe("transaction",(U)=>{this.transactionUpdates?.push(U)});try{if(X(this.child)){for(let G of this.transactionUpdates)this.doStep(G);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(U){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",U),U}finally{Y(),this.child=null,this.transactionUpdates=null,this.mode="record"}}_subscribe(X,Y){return this.subject.subscribe(X,Y)}subscribe(X,Y){return this.subject.subscribe(X,(U)=>{Y(`${this.cacheUpdateNumber}=${U}`)})}emit(X){this.subject.next(X)}doStep(X){let Y=X.indexOf(":"),U=X.substring(0,Y),G=X.substring(Y+1);switch(U){case"add":this.add(JSON.parse(G));break;case"clear":this.clear();break;case"del":this.delete(JSON.parse(G));break;case"tx":for(let z of G.split(";"))this.doStep(z)}}getUpdateNumber(X){let Y=X.indexOf("=");return Number(X.substring(0,Y))}do(X){let Y=X.indexOf("="),U=Number(X.substring(0,Y)),G=U-this.cacheUpdateNumber;if(G>0){if(G===1){this.mode="playback";let W=X.substring(Y+1);return this.doStep(W),this.mode="record",this.cacheUpdateNumber=U,null}return this.cacheUpdateNumber+1}if(Math.abs(G)<this.cacheLimit){let W=this.cacheIdx+G;if(this.cache[W]===X)return null;this.mode="playback";let Z=!1;while(!Z){this.cacheIdx%=this.cacheLimit;let V=this.cache[this.cacheIdx];if(this.cacheIdx--,!V)return"OUT_OF_RANGE";this.undo(V),Z=this.cacheIdx===W-1}let H=X.substring(Y+1);return this.doStep(H),this.mode="record",this.cacheUpdateNumber=U,null}return"OUT_OF_RANGE"}undoStep(X){let Y=X.indexOf(":"),U=X.substring(0,Y),G=X.substring(Y+1);switch(U){case"add":this.delete(JSON.parse(G));break;case"del":this.add(JSON.parse(G));break;case"clear":{let z=JSON.parse(G);for(let W of z)this.add(W);break}case"tx":{let z=G.split(";");for(let W=z.length-1;W>=0;W--)this.undoStep(z[W])}}}undo(X){let Y=X.indexOf("=");if(Number(X.substring(0,Y))===this.cacheUpdateNumber){this.mode="playback";let G=X.substring(Y+1);return this.undoStep(G),this.mode="record",this.cacheUpdateNumber--,null}return this.cacheUpdateNumber}};function TW($=Math.random){return $().toString(36).slice(2)}function j$($){while($.child!==null)$=$.child;return $}function Mj($){while($.parent!==null)$=$.parent;return $}var Jj=class ${_buffer;_index=0;constructor(X){let Y;if(typeof X==="number")Y=X;else Y=X.length;this._buffer=Array.from({length:Y})}get buffer(){return this._buffer}get index(){return this._index}add(X){this._buffer[this._index]=X,this._index=(this._index+1)%this._buffer.length}copy(){let X=new $([...this._buffer]);return X._index=this._index,X}};function f1($){let X={key:$.key,type:$.type};if("family"in $)X.family=$.family;return X}var Aj=Symbol("counterfeit"),Lj={atom_family:"atom",molecule_family:"molecule",mutable_atom_family:"mutable_atom",readonly_held_selector_family:"readonly_held_selector",readonly_pure_selector_family:"readonly_pure_selector",writable_held_selector_family:"writable_held_selector",writable_pure_selector_family:"writable_pure_selector"};function dN($,X,Y){let U=p$(X),G=`${$.key}(${U})`,z=Lj[$.type],W={key:G,type:z,family:{key:$.key,subKey:U}};if(Y)W.counterfeit=!0;return W}var b1=class extends Map{deleted=new Set;changed=new Set;source;constructor($){super();this.source=$}get($){if(super.has($))return super.get($);if(!this.deleted.has($)&&this.source.has($))return this.source.get($);return}set($,X){if(this.deleted.delete($),this.source.has($))this.changed.add($);return super.set($,X)}hasOwn($){return super.has($)}has($){return!this.deleted.has($)&&(super.has($)||this.source.has($))}delete($){if(this.source.has($))this.deleted.add($),this.changed.delete($);return super.delete($)}clear(){this.deleted=new Set(this.source.keys()),this.changed.clear(),super.clear()}*[Symbol.iterator](){yield*super[Symbol.iterator]();for(let[$,X]of this.source)if(!this.deleted.has($)&&!this.changed.has($))yield[$,X]}*entries(){yield*this[Symbol.iterator]()}*keys(){yield*super.keys();for(let $ of this.source.keys())if(!this.deleted.has($)&&!this.changed.has($))yield $}*values(){for(let[,$]of this[Symbol.iterator]())yield $}forEach($){for(let[X,Y]of this[Symbol.iterator]())$(Y,X,this)}get size(){return super.size+this.source.size-this.changed.size-this.deleted.size}},nN=class extends Set{deleted=new Set;source;constructor($){super();this.source=$}add($){if(this.source.has($))return this.deleted.delete($),this;return super.add($)}hasOwn($){return super.has($)}has($){return!this.deleted.has($)&&(super.has($)||this.source.has($))}delete($){if(this.source.has($))return this.deleted.add($),!0;return super.delete($)}clear(){this.deleted=new Set(this.source),super.clear()}*[Symbol.iterator](){yield*super[Symbol.iterator]();for(let $ of this.source)if(!this.deleted.has($))yield $}*iterateOwn(){yield*super[Symbol.iterator]()}get size(){return super.size+this.source.size-this.deleted.size}},Kj=class extends Map{deleted=new Set;source;constructor($){super();this.source=$}get($){if(super.has($))return super.get($);if(!this.deleted.has($)&&this.source.has($)){let Y=this.source.get($),U=new nN(Y);return super.set($,U),U}return}set($,X){return this.deleted.delete($),super.set($,X)}has($){return!this.deleted.has($)&&(super.has($)||this.source.has($))}delete($){return this.deleted.add($),super.delete($)}},L0=class ${a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(X,Y)=>`${X}:${Y}`;warn;getRelatedKeys(X){return this.relations.get(X)}addRelation(X,Y){let U=this.relations.get(X),G=this.relations.get(Y);if(U)U.add(Y);else U=new Set([Y]),this.relations.set(X,U);if(G)G.add(X);else G=new Set([X]),this.relations.set(Y,G)}deleteRelation(X,Y){let U=this.relations.get(X);if(U){if(U.delete(Y),U.size===0)this.relations.delete(X);let G=this.relations.get(Y);if(G){if(G.delete(X),G.size===0)this.relations.delete(Y)}}}replaceRelationsUnsafely(X,Y){this.relations.set(X,new Set(Y));for(let U of Y){let G=new Set().add(X);this.relations.set(U,G)}}replaceRelationsSafely(X,Y){let U=this.relations.get(X),G=this.isAType?.(X)?X:void 0,z=G===void 0?X:void 0;if(U)for(let W of U){G??=W,z??=W;let Q=this.relations.get(W);if(Q){if(Q.size===1)this.relations.delete(W);else Q.delete(X);this.contents.delete(this.makeContentKey(G,z))}}this.relations.set(X,new Set(Y));for(let W of Y){let Q=this.relations.get(W);if(Q)Q.add(X);else Q=new Set().add(X),this.relations.set(W,Q)}}getContentInternal(X){return this.contents.get(X)}setContent(X,Y){this.contents.set(X,Y)}deleteContent(X){this.contents.delete(X)}constructor(X,Y){if(this.a=X.between[0],this.b=X.between[1],this.cardinality=X.cardinality,this.isAType=Y?.isAType??null,this.isBType=Y?.isBType??null,this.isContent=Y?.isContent??null,Y?.makeContentKey)this.makeContentKey=Y.makeContentKey;if(!Y?.externalStore){let U=Y?.source;if(U===void 0)this.relations=new Map(X.relations?.map(([G,z])=>[G,new Set(z)])),this.contents=new Map(X.contents);if(U)this.relations=new Kj(U.relations),this.contents=new b1(U.contents)}if(Y?.externalStore){let U=Y.externalStore;if(this.has=(G,z)=>U.has(G,z),this.addRelation=(G,z)=>{U.addRelation(G,z)},this.deleteRelation=(G,z)=>{U.deleteRelation(G,z)},this.replaceRelationsSafely=(G,z)=>{U.replaceRelationsSafely(G,z)},this.replaceRelationsUnsafely=(G,z)=>{U.replaceRelationsUnsafely(G,z)},this.getRelatedKeys=(G)=>U.getRelatedKeys(G),U.getContent)this.getContentInternal=(G)=>{return U.getContent(G)},this.setContent=(G,z)=>{U.setContent(G,z)},this.deleteContent=(G)=>{U.deleteContent(G)};for(let[G,z]of X.relations??[]){let W=this.isAType?.(G)?G:void 0,Q=W===void 0?G:void 0;for(let Z of z)W??=Z,Q??=Z,this.addRelation(W,Q)}for(let[G,z]of X.contents??[])this.setContent(G,z)}if(Y?.warn)this.warn=Y.warn}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([X,Y])=>[X,[...Y]]),contents:[...this.contents.entries()]}}set(...X){let Y,U,G;switch(X.length){case 1:{let z=X[0];Y=z[this.a],U=z[this.b],G=void 0;break}case 2:{let z=X[0];if(typeof z==="string")[Y,U]=X;else Y=z[this.a],U=z[this.b],G=X[1];break}default:Y=X[0],U=X[1],G=X[2];break}switch(this.cardinality){case"1:1":{let z=this.getRelatedKey(Y);if(z&&z!==U)this.delete(Y,z)}case"1:n":{let z=this.getRelatedKey(U);if(z&&z!==Y)this.delete(z,U)}break;case"n:n":}if(G){let z=this.makeContentKey(Y,U);this.setContent(z,G)}return this.addRelation(Y,U),this}delete(X,Y){Y=typeof Y==="string"?Y:X[this.b];let U=typeof X==="string"?X:X[this.a];if(U===void 0&&typeof Y==="string"){let G=this.getRelatedKeys(Y);if(G)for(let z of G)this.delete(z,Y)}else if(typeof U==="string"&&Y===void 0){let G=this.getRelatedKeys(U);if(G)for(let z of G)this.delete(U,z)}else if(typeof U==="string"&&typeof Y==="string"){this.deleteRelation(U,Y);let G=this.makeContentKey(U,Y);this.deleteContent(G)}return this}getRelatedKey(X){let Y=this.getRelatedKeys(X);if(Y){if(Y.size>1)this.warn?.(`${Y.size} related keys were found for key "${X}": (${[...Y].map((G)=>`"${G}"`).join(", ")}). Only one related key was expected.`);let U;for(let G of Y){U=G;break}return U}}replaceRelations(X,Y,U){let G=!Array.isArray(Y),z=G?Object.keys(Y):Y;if(U?.reckless)this.replaceRelationsUnsafely(X,z);else this.replaceRelationsSafely(X,z);if(G)for(let W of z){let Q=this.makeContentKey(X,W),Z=Y[W];this.setContent(Q,Z)}return this}getContent(X,Y){let U=this.makeContentKey(X,Y);return this.getContentInternal(U)}getRelationEntries(X){let Y=X[this.a],U=X[this.b];if(Y!==void 0&&U===void 0){let G=this.getRelatedKeys(Y);if(G)return[...G].map((z)=>{return[z,this.getContent(Y,z)]})}if(Y===void 0&&U!==void 0){let G=this.getRelatedKeys(U);if(G)return[...G].map((z)=>{return[z,this.getContent(z,U)]})}return[]}has(X,Y){if(Y)return this.getRelatedKeys(X)?.has(Y)??!1;return this.relations.has(X)}overlay(){let X={source:this,makeContentKey:this.makeContentKey};if(this.isAType)X.isAType=this.isAType;if(this.isBType)X.isBType=this.isBType;if(this.isContent)X.isContent=this.isContent;if(this.warn)X.warn=this.warn;return new $({between:[this.a,this.b],cardinality:this.cardinality},X)}incorporate(X){let{relations:Y,contents:U}=X;for(let[G,z]of Y)if(z instanceof nN){let{source:W}=z;for(let Q of z.iterateOwn())W.add(Q)}else this.relations.set(G,z);for(let G of Y.deleted)this.relations.delete(G);for(let[G,z]of U)this.contents.set(G,z);for(let G of U.deleted)this.contents.delete(G)}},g$=class{Subscriber;subscribers=new Map;subscribe($,X){return this.subscribers.set($,X),()=>{this.unsubscribe($)}}unsubscribe($){this.subscribers.delete($)}next($){let X=this.subscribers.values();for(let Y of X)Y($)}},_j=class extends g${state;constructor($){super();this.state=$}next($){this.state=$,super.next($)}},qj=($,X)=>{let Y=j$($);if(Y.operation.open)return Y.operation.prev.get(X.key);return Y.valueMap.get(X.key)};function tN($,X,Y,U){let G=$.disposalTraces.buffer.find((z)=>z?.key===p$(U));switch($.logger.error("\u274C",X.type,X.key,"gets a fallback value because key",U,"is not allocated",G?`This key was previously disposed:
|
|
4
|
-
${G.trace}`:"(no previous disposal trace found)"),Y.type){case"mutable_atom_family":{if($.defaults.has(Y.key))return $.defaults.get(Y.key);let z=new Y.class;return $.defaults.set(Y.key,z),z}case"atom_family":{if($.defaults.has(Y.key))return $.defaults.get(Y.key);let z=Y.default,W=z(U);return $.defaults.set(Y.key,W),W}case"readonly_pure_selector_family":case"writable_pure_selector_family":case"readonly_held_selector_family":case"writable_held_selector_family":{if($.defaults.has(Y.key))return $.defaults.get(Y.key);let z=Y.default(U);return $.defaults.set(Y.key,z),z}}}var jW=class extends Promise{fate;resolve;reject;done=!1;constructor($){let X,Y;super((U,G)=>{X=U,Y=G});this.resolve=X,this.reject=Y,this.use($ instanceof Promise?$:new Promise($))}pass($,X){if($===this.fate)this.resolve(X),this.done=!0}fail($,X){if($===this.fate)this.reject(X),this.done=!0}use($){if(this===$)return;if($ instanceof Promise){let X=$;this.fate=X,X.then((Y)=>{this.pass(X,Y)},(Y)=>{this.fail(X,Y)})}else this.resolve($),this.fate=void 0}};function YX($){return"epoch"in $.transactionMeta}function
|
|
3
|
+
var Oj=Object.create;var{getPrototypeOf:wj,defineProperty:_W,getOwnPropertyNames:Dj}=Object;var Ej=Object.prototype.hasOwnProperty;var PN=($,X,Y)=>{Y=$!=null?Oj(wj($)):{};let U=X||!$||!$.__esModule?_W(Y,"default",{value:$,enumerable:!0}):Y;for(let G of Dj($))if(!Ej.call(U,G))_W(U,G,{get:()=>$[G],enumerable:!0});return U};var IN=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var D2=($,X)=>{for(var Y in X)_W($,Y,{get:X[Y],enumerable:!0,configurable:!0,set:(U)=>X[Y]=()=>U})};var rm=($,X)=>()=>($&&(X=$($=0)),X);var xN=import.meta.require;var fM=IN((Nd,bM)=>{var fY=xN("os"),hY=xN("path");function kM($){let X=process.env.XDG_CACHE_HOME||hY.join(fY.homedir(),".cache");return hY.join(X,$)}function XS($){return hY.join(fY.homedir(),"Library","Caches",$)}function YS($){let X=process.env.LOCALAPPDATA||hY.join(fY.homedir(),"AppData","Local");return hY.join(X,$,"Cache")}var GS=function(){switch(fY.platform()){case"darwin":return XS;case"win32":return YS;case"aix":case"android":case"freebsd":case"linux":case"netbsd":case"openbsd":case"sunos":return kM;default:return console.error(`(node:${process.pid}) [cachedir] Warning: the platform "${fY.platform()}" is not currently supported by node-cachedir, falling back to "posix". Please file an issue with your platform here: https://github.com/LinusU/node-cachedir/issues/new`),kM}}();bM.exports=function $(X){if(typeof X!=="string")throw new TypeError("id is not a string");if(X.length===0)throw new Error("id cannot be empty");if(/[^0-9a-zA-Z-]/.test(X))throw new Error("id cannot contain special characters");return GS(X)}});var VJ=IN((cl,jO)=>{var pU=process||{},ZJ=pU.argv||[],cU=pU.env||{},_S=!(!!cU.NO_COLOR||ZJ.includes("--no-color"))&&(!!cU.FORCE_COLOR||ZJ.includes("--color")||pU.platform==="win32"||(pU.stdout||{}).isTTY&&cU.TERM!=="dumb"||!!cU.CI),qS=($,X,Y=$)=>(U)=>{let G=""+U,z=G.indexOf(X,$.length);return~z?$+RS(G,X,Y,z)+X:$+G+X},RS=($,X,Y,U)=>{let G="",z=0;do G+=$.substring(z,U)+Y,z=U+X.length,U=$.indexOf(X,z);while(~U);return G+$.substring(z)},HJ=($=_S)=>{let X=$?qS:()=>String;return{isColorSupported:$,reset:X("\x1B[0m","\x1B[0m"),bold:X("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:X("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:X("\x1B[3m","\x1B[23m"),underline:X("\x1B[4m","\x1B[24m"),inverse:X("\x1B[7m","\x1B[27m"),hidden:X("\x1B[8m","\x1B[28m"),strikethrough:X("\x1B[9m","\x1B[29m"),black:X("\x1B[30m","\x1B[39m"),red:X("\x1B[31m","\x1B[39m"),green:X("\x1B[32m","\x1B[39m"),yellow:X("\x1B[33m","\x1B[39m"),blue:X("\x1B[34m","\x1B[39m"),magenta:X("\x1B[35m","\x1B[39m"),cyan:X("\x1B[36m","\x1B[39m"),white:X("\x1B[37m","\x1B[39m"),gray:X("\x1B[90m","\x1B[39m"),bgBlack:X("\x1B[40m","\x1B[49m"),bgRed:X("\x1B[41m","\x1B[49m"),bgGreen:X("\x1B[42m","\x1B[49m"),bgYellow:X("\x1B[43m","\x1B[49m"),bgBlue:X("\x1B[44m","\x1B[49m"),bgMagenta:X("\x1B[45m","\x1B[49m"),bgCyan:X("\x1B[46m","\x1B[49m"),bgWhite:X("\x1B[47m","\x1B[49m"),blackBright:X("\x1B[90m","\x1B[39m"),redBright:X("\x1B[91m","\x1B[39m"),greenBright:X("\x1B[92m","\x1B[39m"),yellowBright:X("\x1B[93m","\x1B[39m"),blueBright:X("\x1B[94m","\x1B[39m"),magentaBright:X("\x1B[95m","\x1B[39m"),cyanBright:X("\x1B[96m","\x1B[39m"),whiteBright:X("\x1B[97m","\x1B[39m"),bgBlackBright:X("\x1B[100m","\x1B[49m"),bgRedBright:X("\x1B[101m","\x1B[49m"),bgGreenBright:X("\x1B[102m","\x1B[49m"),bgYellowBright:X("\x1B[103m","\x1B[49m"),bgBlueBright:X("\x1B[104m","\x1B[49m"),bgMagentaBright:X("\x1B[105m","\x1B[49m"),bgCyanBright:X("\x1B[106m","\x1B[49m"),bgWhiteBright:X("\x1B[107m","\x1B[49m")}};jO.exports=HJ();jO.exports.createColors=HJ});function E6($){return JSON.parse($)}var p$=($)=>JSON.stringify($),om=[Array.prototype,Boolean.prototype,Number.prototype,Object.prototype,String.prototype];function $X($){return j5(N6.STORE,$,void 0)}function u9($){return XX(N6.STORE,$)}function RW(...$){return L1(N6.STORE,...$)}function R5($,X){return uN(N6.STORE,$,X)}function SN($){return pN($,N6.STORE)}var A0={atom_family:"atom family",atom:"atom",continuity:"continuity",key:"key",mutable_atom_family:"atom family [m]",mutable_atom:"atom [m]",readonly_held_selector_family:"selector family [h]",readonly_held_selector:"selector [h]",readonly_pure_selector_family:"selector family",readonly_pure_selector:"selector",state:"state",timeline:"timeline",transaction:"transaction",unknown:"unknown",writable_held_selector_family:"selector family [wh]",writable_held_selector:"selector [wh]",writable_pure_selector_family:"selector family [w]",writable_pure_selector:"selector [w]"};var qW=($)=>(X,Y,U,G,...z)=>{console[$](`${X} ${A0[Y]} \`${U}\` ${G}`,...z)},Nj={error:qW("error"),info:qW("info"),warn:qW("warn")},kN=class{logLevel;filter;logger;constructor($,X,Y=Nj){this.logLevel=$,this.filter=X,this.logger=Y}error=(...$)=>{if(this.logLevel!==null){let X=this.filter?.(...$)??!0;if(X===!0)this.logger.error(...$);else if(X)this.logger.error(...X)}};info=(...$)=>{if(this.logLevel==="info"){let X=this.filter?.(...$)??!0;if(X===!0)this.logger.info(...$);else if(X)this.logger.info(...X)}};warn=(...$)=>{if(this.logLevel!=="error"&&this.logLevel!==null){let X=this.filter?.(...$)??!0;if(X===!0)this.logger.warn(...$);else if(X)this.logger.warn(...X)}}};var bN=class{store;deallocateTX;claimTX;constructor($=N6.STORE){this.store=$,this.deallocateTX=hN($),this.claimTX=gN($),fN("root",$)}allocate($,X,Y){B5(this.store,$,X,Y)}deallocate($){v5(this.store,this.deallocateTX,TW())($)}claim($,X,Y){p9(this.store,$,X,Y)}};function T5($){return vW(N6.STORE,$)}function c9($){return d9(N6.STORE,$)}var L0=class $ extends Set{mode="record";subject=new g$;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor(X,Y=0){super(X);if(X instanceof $)this.parent=X,this.cacheUpdateNumber=X.cacheUpdateNumber;if(Y)this.cacheLimit=Y,this.cache=new Array(Y),this.subscribe("auto cache",(U)=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=U})}READONLY_VIEW=this;toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON(X){let Y=new $(X.members,X.cacheLimit);return Y.cache=X.cache,Y.cacheIdx=X.cacheIdx,Y.cacheUpdateNumber=X.cacheUpdateNumber,Y}add(X){let Y=super.add(X);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`add:${p$(X)}`);return Y}clear(){let X=this.mode==="record"?[...this]:null;if(super.clear(),X)this.cacheUpdateNumber++,this.emit(`clear:${JSON.stringify(X)}`)}delete(X){let Y=super.delete(X);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`del:${p$(X)}`);return Y}parent=null;child=null;transactionUpdates=null;transaction(X){this.mode="transaction",this.transactionUpdates=[],this.child=new $(this);let Y=this.child._subscribe("transaction",(U)=>{this.transactionUpdates?.push(U)});try{if(X(this.child)){for(let G of this.transactionUpdates)this.doStep(G);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(U){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",U),U}finally{Y(),this.child=null,this.transactionUpdates=null,this.mode="record"}}_subscribe(X,Y){return this.subject.subscribe(X,Y)}subscribe(X,Y){return this.subject.subscribe(X,(U)=>{Y(`${this.cacheUpdateNumber}=${U}`)})}emit(X){this.subject.next(X)}doStep(X){let Y=X.indexOf(":"),U=X.substring(0,Y),G=X.substring(Y+1);switch(U){case"add":this.add(JSON.parse(G));break;case"clear":this.clear();break;case"del":this.delete(JSON.parse(G));break;case"tx":for(let z of G.split(";"))this.doStep(z)}}getUpdateNumber(X){let Y=X.indexOf("=");return Number(X.substring(0,Y))}do(X){let Y=X.indexOf("="),U=Number(X.substring(0,Y)),G=U-this.cacheUpdateNumber;if(G>0){if(G===1){this.mode="playback";let W=X.substring(Y+1);return this.doStep(W),this.mode="record",this.cacheUpdateNumber=U,null}return this.cacheUpdateNumber+1}if(Math.abs(G)<this.cacheLimit){let W=this.cacheIdx+G;if(this.cache[W]===X)return null;this.mode="playback";let Z=!1;while(!Z){this.cacheIdx%=this.cacheLimit;let V=this.cache[this.cacheIdx];if(this.cacheIdx--,!V)return"OUT_OF_RANGE";this.undo(V),Z=this.cacheIdx===W-1}let H=X.substring(Y+1);return this.doStep(H),this.mode="record",this.cacheUpdateNumber=U,null}return"OUT_OF_RANGE"}undoStep(X){let Y=X.indexOf(":"),U=X.substring(0,Y),G=X.substring(Y+1);switch(U){case"add":this.delete(JSON.parse(G));break;case"del":this.add(JSON.parse(G));break;case"clear":{let z=JSON.parse(G);for(let W of z)this.add(W);break}case"tx":{let z=G.split(";");for(let W=z.length-1;W>=0;W--)this.undoStep(z[W])}}}undo(X){let Y=X.indexOf("=");if(Number(X.substring(0,Y))===this.cacheUpdateNumber){this.mode="playback";let G=X.substring(Y+1);return this.undoStep(G),this.mode="record",this.cacheUpdateNumber--,null}return this.cacheUpdateNumber}};function TW($=Math.random){return $().toString(36).slice(2)}function j$($){while($.child!==null)$=$.child;return $}function Mj($){while($.parent!==null)$=$.parent;return $}var Jj=class ${_buffer;_index=0;constructor(X){let Y;if(typeof X==="number")Y=X;else Y=X.length;this._buffer=Array.from({length:Y})}get buffer(){return this._buffer}get index(){return this._index}add(X){this._buffer[this._index]=X,this._index=(this._index+1)%this._buffer.length}copy(){let X=new $([...this._buffer]);return X._index=this._index,X}};function h1($){let X={key:$.key,type:$.type};if("family"in $)X.family=$.family;return X}var Aj=Symbol("counterfeit"),Lj={atom_family:"atom",molecule_family:"molecule",mutable_atom_family:"mutable_atom",readonly_held_selector_family:"readonly_held_selector",readonly_pure_selector_family:"readonly_pure_selector",writable_held_selector_family:"writable_held_selector",writable_pure_selector_family:"writable_pure_selector"};function dN($,X,Y){let U=p$(X),G=`${$.key}(${U})`,z=Lj[$.type],W={key:G,type:z,family:{key:$.key,subKey:U}};if(Y)W.counterfeit=!0;return W}var f1=class extends Map{deleted=new Set;changed=new Set;source;constructor($){super();this.source=$}get($){if(super.has($))return super.get($);if(!this.deleted.has($)&&this.source.has($))return this.source.get($);return}set($,X){if(this.deleted.delete($),this.source.has($))this.changed.add($);return super.set($,X)}hasOwn($){return super.has($)}has($){return!this.deleted.has($)&&(super.has($)||this.source.has($))}delete($){if(this.source.has($))this.deleted.add($),this.changed.delete($);return super.delete($)}clear(){this.deleted=new Set(this.source.keys()),this.changed.clear(),super.clear()}*[Symbol.iterator](){yield*super[Symbol.iterator]();for(let[$,X]of this.source)if(!this.deleted.has($)&&!this.changed.has($))yield[$,X]}*entries(){yield*this[Symbol.iterator]()}*keys(){yield*super.keys();for(let $ of this.source.keys())if(!this.deleted.has($)&&!this.changed.has($))yield $}*values(){for(let[,$]of this[Symbol.iterator]())yield $}forEach($){for(let[X,Y]of this[Symbol.iterator]())$(Y,X,this)}get size(){return super.size+this.source.size-this.changed.size-this.deleted.size}},nN=class extends Set{deleted=new Set;source;constructor($){super();this.source=$}add($){if(this.source.has($))return this.deleted.delete($),this;return super.add($)}hasOwn($){return super.has($)}has($){return!this.deleted.has($)&&(super.has($)||this.source.has($))}delete($){if(this.source.has($))return this.deleted.add($),!0;return super.delete($)}clear(){this.deleted=new Set(this.source),super.clear()}*[Symbol.iterator](){yield*super[Symbol.iterator]();for(let $ of this.source)if(!this.deleted.has($))yield $}*iterateOwn(){yield*super[Symbol.iterator]()}get size(){return super.size+this.source.size-this.deleted.size}},Kj=class extends Map{deleted=new Set;source;constructor($){super();this.source=$}get($){if(super.has($))return super.get($);if(!this.deleted.has($)&&this.source.has($)){let Y=this.source.get($),U=new nN(Y);return super.set($,U),U}return}set($,X){return this.deleted.delete($),super.set($,X)}has($){return!this.deleted.has($)&&(super.has($)||this.source.has($))}delete($){return this.deleted.add($),super.delete($)}},K0=class ${a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(X,Y)=>`${X}:${Y}`;warn;getRelatedKeys(X){return this.relations.get(X)}addRelation(X,Y){let U=this.relations.get(X),G=this.relations.get(Y);if(U)U.add(Y);else U=new Set([Y]),this.relations.set(X,U);if(G)G.add(X);else G=new Set([X]),this.relations.set(Y,G)}deleteRelation(X,Y){let U=this.relations.get(X);if(U){if(U.delete(Y),U.size===0)this.relations.delete(X);let G=this.relations.get(Y);if(G){if(G.delete(X),G.size===0)this.relations.delete(Y)}}}replaceRelationsUnsafely(X,Y){this.relations.set(X,new Set(Y));for(let U of Y){let G=new Set().add(X);this.relations.set(U,G)}}replaceRelationsSafely(X,Y){let U=this.relations.get(X),G=this.isAType?.(X)?X:void 0,z=G===void 0?X:void 0;if(U)for(let W of U){G??=W,z??=W;let Q=this.relations.get(W);if(Q){if(Q.size===1)this.relations.delete(W);else Q.delete(X);this.contents.delete(this.makeContentKey(G,z))}}this.relations.set(X,new Set(Y));for(let W of Y){let Q=this.relations.get(W);if(Q)Q.add(X);else Q=new Set().add(X),this.relations.set(W,Q)}}getContentInternal(X){return this.contents.get(X)}setContent(X,Y){this.contents.set(X,Y)}deleteContent(X){this.contents.delete(X)}constructor(X,Y){if(this.a=X.between[0],this.b=X.between[1],this.cardinality=X.cardinality,this.isAType=Y?.isAType??null,this.isBType=Y?.isBType??null,this.isContent=Y?.isContent??null,Y?.makeContentKey)this.makeContentKey=Y.makeContentKey;if(!Y?.externalStore){let U=Y?.source;if(U===void 0)this.relations=new Map(X.relations?.map(([G,z])=>[G,new Set(z)])),this.contents=new Map(X.contents);if(U)this.relations=new Kj(U.relations),this.contents=new f1(U.contents)}if(Y?.externalStore){let U=Y.externalStore;if(this.has=(G,z)=>U.has(G,z),this.addRelation=(G,z)=>{U.addRelation(G,z)},this.deleteRelation=(G,z)=>{U.deleteRelation(G,z)},this.replaceRelationsSafely=(G,z)=>{U.replaceRelationsSafely(G,z)},this.replaceRelationsUnsafely=(G,z)=>{U.replaceRelationsUnsafely(G,z)},this.getRelatedKeys=(G)=>U.getRelatedKeys(G),U.getContent)this.getContentInternal=(G)=>{return U.getContent(G)},this.setContent=(G,z)=>{U.setContent(G,z)},this.deleteContent=(G)=>{U.deleteContent(G)};for(let[G,z]of X.relations??[]){let W=this.isAType?.(G)?G:void 0,Q=W===void 0?G:void 0;for(let Z of z)W??=Z,Q??=Z,this.addRelation(W,Q)}for(let[G,z]of X.contents??[])this.setContent(G,z)}if(Y?.warn)this.warn=Y.warn}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([X,Y])=>[X,[...Y]]),contents:[...this.contents.entries()]}}set(...X){let Y,U,G;switch(X.length){case 1:{let z=X[0];Y=z[this.a],U=z[this.b],G=void 0;break}case 2:{let z=X[0];if(typeof z==="string")[Y,U]=X;else Y=z[this.a],U=z[this.b],G=X[1];break}default:Y=X[0],U=X[1],G=X[2];break}switch(this.cardinality){case"1:1":{let z=this.getRelatedKey(Y);if(z&&z!==U)this.delete(Y,z)}case"1:n":{let z=this.getRelatedKey(U);if(z&&z!==Y)this.delete(z,U)}break;case"n:n":}if(G){let z=this.makeContentKey(Y,U);this.setContent(z,G)}return this.addRelation(Y,U),this}delete(X,Y){Y=typeof Y==="string"?Y:X[this.b];let U=typeof X==="string"?X:X[this.a];if(U===void 0&&typeof Y==="string"){let G=this.getRelatedKeys(Y);if(G)for(let z of G)this.delete(z,Y)}else if(typeof U==="string"&&Y===void 0){let G=this.getRelatedKeys(U);if(G)for(let z of G)this.delete(U,z)}else if(typeof U==="string"&&typeof Y==="string"){this.deleteRelation(U,Y);let G=this.makeContentKey(U,Y);this.deleteContent(G)}return this}getRelatedKey(X){let Y=this.getRelatedKeys(X);if(Y){if(Y.size>1)this.warn?.(`${Y.size} related keys were found for key "${X}": (${[...Y].map((G)=>`"${G}"`).join(", ")}). Only one related key was expected.`);let U;for(let G of Y){U=G;break}return U}}replaceRelations(X,Y,U){let G=!Array.isArray(Y),z=G?Object.keys(Y):Y;if(U?.reckless)this.replaceRelationsUnsafely(X,z);else this.replaceRelationsSafely(X,z);if(G)for(let W of z){let Q=this.makeContentKey(X,W),Z=Y[W];this.setContent(Q,Z)}return this}getContent(X,Y){let U=this.makeContentKey(X,Y);return this.getContentInternal(U)}getRelationEntries(X){let Y=X[this.a],U=X[this.b];if(Y!==void 0&&U===void 0){let G=this.getRelatedKeys(Y);if(G)return[...G].map((z)=>{return[z,this.getContent(Y,z)]})}if(Y===void 0&&U!==void 0){let G=this.getRelatedKeys(U);if(G)return[...G].map((z)=>{return[z,this.getContent(z,U)]})}return[]}has(X,Y){if(Y)return this.getRelatedKeys(X)?.has(Y)??!1;return this.relations.has(X)}overlay(){let X={source:this,makeContentKey:this.makeContentKey};if(this.isAType)X.isAType=this.isAType;if(this.isBType)X.isBType=this.isBType;if(this.isContent)X.isContent=this.isContent;if(this.warn)X.warn=this.warn;return new $({between:[this.a,this.b],cardinality:this.cardinality},X)}incorporate(X){let{relations:Y,contents:U}=X;for(let[G,z]of Y)if(z instanceof nN){let{source:W}=z;for(let Q of z.iterateOwn())W.add(Q)}else this.relations.set(G,z);for(let G of Y.deleted)this.relations.delete(G);for(let[G,z]of U)this.contents.set(G,z);for(let G of U.deleted)this.contents.delete(G)}},g$=class{Subscriber;subscribers=new Map;subscribe($,X){return this.subscribers.set($,X),()=>{this.unsubscribe($)}}unsubscribe($){this.subscribers.delete($)}next($){let X=this.subscribers.values();for(let Y of X)Y($)}},_j=class extends g${state;constructor($){super();this.state=$}next($){this.state=$,super.next($)}},qj=($,X)=>{let Y=j$($);if(Y.operation.open)return Y.operation.prev.get(X.key);return Y.valueMap.get(X.key)};function tN($,X,Y,U){let G=$.disposalTraces.buffer.find((z)=>z?.key===p$(U));switch($.logger.error("\u274C",X.type,X.key,"gets a fallback value because key",U,"is not allocated",G?`This key was previously disposed:
|
|
4
|
+
${G.trace}`:"(no previous disposal trace found)"),Y.type){case"mutable_atom_family":{if($.defaults.has(Y.key))return $.defaults.get(Y.key);let z=new Y.class;return $.defaults.set(Y.key,z),z.READONLY_VIEW}case"atom_family":{if($.defaults.has(Y.key))return $.defaults.get(Y.key);let z=Y.default,W=z(U);return $.defaults.set(Y.key,W),W}case"readonly_pure_selector_family":case"writable_pure_selector_family":case"readonly_held_selector_family":case"writable_held_selector_family":{if($.defaults.has(Y.key))return $.defaults.get(Y.key);let z=Y.default(U);return $.defaults.set(Y.key,z),z}}}var jW=class extends Promise{fate;resolve;reject;done=!1;constructor($){let X,Y;super((U,G)=>{X=U,Y=G});this.resolve=X,this.reject=Y,this.use($ instanceof Promise?$:new Promise($))}pass($,X){if($===this.fate)this.resolve(X),this.done=!0}fail($,X){if($===this.fate)this.reject(X),this.done=!0}use($){if(this===$)return;if($ instanceof Promise){let X=$;this.fate=X,X.then((Y)=>{this.pass(X,Y)},(Y)=>{this.fail(X,Y)})}else this.resolve($),this.fate=void 0}};function YX($){return"epoch"in $.transactionMeta}function y6($){return"phase"in $.transactionMeta}function aN($,X){if($.operation.open){let Y=performance.now();return $.logger.info("\uD83D\uDEAB",X.type,X.key,`deferring setState at T-${Y} until setState for "${$.operation.token.key}" is done`),Y}return $.operation={open:!0,done:new Set,prev:new Map,timestamp:Date.now(),token:X,subEvents:[]},$.logger.info("\u2B55",X.type,X.key,`operation start in store "${$.config.name}"${y6($)?` ${$.transactionMeta.phase} "${$.transactionMeta.update.token.key}"`:""}`),$}function sN($){if($.operation.open)$.logger.info("\uD83D\uDD34",$.operation.token.type,$.operation.token.key,`operation done in store "${$.config.name}"`);$.operation={open:!1},$.on.operationClose.next($.operation)}var eN=($,X)=>{if(!$.operation.open)return $.logger.error("\uD83D\uDC1E","unknown",X,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0;return $.operation.done.has(X)},I5=($,X)=>{if(!$.operation.open){$.logger.error("\uD83D\uDC1E","unknown",X,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}$.operation.done.add(X)};function kW($,X){let Y=j$($),{key:U,type:G}=X,z=Y.selectorAtoms.getRelatedKeys(U);if(Y.logger.info("\uD83E\uDDF9",G,U,z?`evicting ${z.size} states downstream:`:"no downstream states",z??"to evict"),z){if(Y.operation.open)Y.logger.info("\uD83E\uDDF9",G,U,`[ ${[...Y.operation.done].join(", ")} ] already done`);for(let W of z){if(eN(Y,W))continue;XF(Y,W),I5(Y,W)}}}function $F($,X){let Y=j$($),U=Y.selectorGraph.getRelationEntries({upstreamSelectorKey:X}).filter(([G,{source:z}])=>z===X);for(let[G]of U){if(eN(Y,G))continue;XF(Y,G),I5(Y,G),$F($,G)}}function g6($,X,Y){let{key:U,subject:G,type:z}=X,W=$.valueMap.get(U);if(W instanceof jW&&!W.done){let Q=W;if(Y instanceof Promise)return Q.use(Y),Q;return $.valueMap.set(U,Y),Y}if(Y instanceof Promise){let Q=new jW(Y);return $.valueMap.set(U,Q),Q.then(function Z(H){if($.valueMap.get(U)===Q){switch(aN($,X),g6($,X,H),z){case"atom":case"mutable_atom":kW($,X);break;case"readonly_pure_selector":case"writable_pure_selector":$F($,U);break}sN($),G.next({newValue:H,oldValue:Q})}}).catch((Z)=>{$.logger.error("\uD83D\uDCA5","state",U,"rejected:",Z)}),Q}return $.logger.info("\uD83D\uDCDD",X.type,X.key,"writing to cache",Y),$.valueMap.set(U,Y),Y}function Rj($,X,Y){$.logger.info("\uD83D\uDCD6",X.type,X.key,"reading cached value");let U=$.valueMap.get(X.key);if(Y==="mut"&&X.type==="mutable_atom"&&y6($)){let z=X,{parent:W}=$;if($.valueMap.hasOwn(z.key))return U;let Q=W.valueMap.get(z.key);$.logger.info("\uD83D\uDCC3","atom",z.key,"copying");let Z=Q.toJSON(),H=z.class.fromJSON(Z);$.valueMap.set(z.key,H),new pW(z,W),U=H}return U}function XF($,X){let Y=$.valueMap.get(X);if(Y instanceof jW){let U=$.writableSelectors.get(X)??$.readonlySelectors.get(X);if(U)U.getFrom($);return}if($.operation.open)$.operation.prev.set(X,Y);$.valueMap.delete(X),$.logger.info("\uD83D\uDDD1","state",X,"evicted")}var Tj=/^\[object (?:Async|Generator|AsyncGenerator)?Function\]$/;function i9($){let X=Object.prototype.toString.call($);return Tj.test(X)}function s2($,X,Y){if($.valueMap.has(X.key))return Rj($,X,Y);$.logger.info("\u2754",X.type,X.key,"value not found in cache");let{key:U}=X;switch(X.type){case"readonly_held_selector":case"writable_held_selector":return $.logger.info("\uD83E\uDDEE",X.type,U,"computing value"),X.getFrom($);case"readonly_pure_selector":case"writable_pure_selector":{let G;$.logger.info("\uD83E\uDDEE",X.type,U,"computing value");try{if(G=X.getFrom($),G instanceof Promise)return G.catch((W)=>{if($.logger.error("\uD83D\uDCA5",X.type,U,"rejected:",W),X.catch){for(let Q of X.catch)if(W instanceof Q)return g6($,X,W)}throw W})}catch(W){if($.logger.error("\uD83D\uDCA5",X.type,U,"rejected:",W),X.catch){for(let Q of X.catch)if(W instanceof Q)return g6($,X,W)}throw W}return g6($,X,G)}case"atom":{let G;if(i9(X.default))try{if(G=X.default(),G instanceof Promise)G=G.catch((W)=>{if($.logger.error("\uD83D\uDCA5",X.type,U,"rejected:",W),X.catch){for(let Q of X.catch)if(W instanceof Q)return G=g6($,X,W),G}throw W})}catch(W){if($.logger.error("\uD83D\uDCA5",X.type,U,"rejected:",W),X.catch){for(let Q of X.catch)if(W instanceof Q)return G=g6($,X,W),$.logger.info("\u2728",X.type,U,"computed default",G),G}throw W}else G=X.default,$.logger.info("\u2728",X.type,U,"using static default",G);return g6($,X,G)}case"mutable_atom":{let G=new X.class;return $.logger.info("\u2728",X.type,U,"created new instance",G),g6($,X,G)}}}function bW($,X){return _4($,{key:X.family.key,type:`${X.type}_family`})}var o9=Symbol("MUST_CREATE");function n9($,X,Y,U){let G=p$(Y),z=$.molecules.get(G);if(!z&&$.config.lifespan==="immortal")return $.logger.warn("\uD83D\uDCA3","key",G,"was used to mint a counterfeit token for",X.type,`"${X.key}"`),dN(X,Y,Aj);let Q;if(U===o9){if($.logger.info("\uD83D\uDC6A",X.type,X.key,"adds member",typeof Y==="string"?`\`${Y}\``:Y),Q=X.create(Y),z)$.moleculeData.set(G,X.key)}else Q=dN(X,Y);return Q}var vj=($)=>{$.logger.info("\uD83E\uDE82","transaction",$.transactionMeta.update.token.key,"Aborting transaction"),$.parent.child=null};function v5($,X,Y){return(...U)=>{return _4($,X).run(U,Y)}}function PW($,X){if(i9($))return $(X);return $}var IW=($,X,Y)=>{let U=s2($,X,"mut"),G=PW(Y,U);return $.logger.info("\u2B50","atom",X.key,"setting value",G),G=g6($,X,G),I5($,X.key),kW($,X),{oldValue:U,newValue:G}};function lN($,X){switch(X.type){case"mutable_atom":return IW($,X,new X.class);case"atom":{let Y=X.default;if(i9(Y))Y=Y();return IW($,X,Y)}}}function Cj($,X){let Y;switch(X.type){case"atom":case"mutable_atom":Y=lN($,X);break;case"writable_pure_selector":case"writable_held_selector":{let U=X.getFrom($),G=P5($,X.key);for(let W of G.values()){let Q=lN($,W);zF($,X,Q,!1)}let z=X.getFrom($);Y={oldValue:U,newValue:z}}break}return Y}function A1($,...X){fW($,SW,...X)}var xW=Symbol("RESET");function C5($,...X){let Y=[...X,xW];A1($,...Y)}function Bj($,X,Y){let U,G,z,{type:W,key:Q}=X;switch(X.type){case"writable_pure_selector":U=s2($,X,"mut"),G=PW(Y,U),G=g6($,X,G);break;case"writable_held_selector":z=X.const,PW(Y,z),U=z,G=z}return $.logger.info("\u2B50",W,Q,"setting to",G),I5($,Q),X.setSelf(G),{oldValue:U,newValue:G}}var jj=($,X,Y)=>{let U;switch(X.type){case"atom":case"mutable_atom":U=IW($,X,Y);break;case"writable_pure_selector":case"writable_held_selector":U=Bj($,X,Y);break}return U};function Pj($,X,Y){let{token:U,update:{newValue:G,oldValue:z}}=X;A1($,U,Y==="newValue"?G:z)}function Ij($){let{stack:X}=$;if(X)return`
|
|
5
5
|
`+X.split(`
|
|
6
6
|
`)?.slice(1)?.join(`
|
|
7
|
-
`);return""}function fN($,X=N6.STORE){let Y={key:$,stringKey:p$($),dependsOn:"any"};return X.molecules.set(p$($),Y),$}function B5($,X,Y,U="any"){let G=X,z=p$(Y),W=[],Q=j$($);if(Array.isArray(G))for(let V of G){let O=p$(V);if(Q.molecules.get(O))$.moleculeGraph.set(O,z,{source:O});else W.push(O)}else{let V=p$(G);if(Q.molecules.get(V))$.moleculeGraph.set(V,z,{source:V});else W.push(V)}if(W.length===0)Q.molecules.set(z,{key:Y,stringKey:z,dependsOn:U});let Z={type:"molecule_creation",key:Y,provenance:G,timestamp:Date.now()};if(
|
|
7
|
+
`);return""}function fN($,X=N6.STORE){let Y={key:$,stringKey:p$($),dependsOn:"any"};return X.molecules.set(p$($),Y),$}function B5($,X,Y,U="any"){let G=X,z=p$(Y),W=[],Q=j$($);if(Array.isArray(G))for(let V of G){let O=p$(V);if(Q.molecules.get(O))$.moleculeGraph.set(O,z,{source:O});else W.push(O)}else{let V=p$(G);if(Q.molecules.get(V))$.moleculeGraph.set(V,z,{source:V});else W.push(V)}if(W.length===0)Q.molecules.set(z,{key:Y,stringKey:z,dependsOn:U});let Z={type:"molecule_creation",key:Y,provenance:G,timestamp:Date.now()};if(y6(Q)&&Q.transactionMeta.phase==="building")Q.transactionMeta.update.subEvents.push(Z);else Q.on.moleculeCreation.next(Z);for(let V of W){let O=$.disposalTraces.buffer.find((w)=>w?.key===V);$.logger.error("\u274C","key",Y,"allocation failed:",`Could not allocate to ${V} in store "${$.config.name}".`,O?`
|
|
8
8
|
${V} was most recently disposed
|
|
9
9
|
${O.trace}`:`No previous disposal trace for ${V} was found.`)}return Y}function hN($){return d9($,{key:"[Internal] deallocate",do:(X,Y)=>{x5(j$($),Y)}})}function x5($,X){let Y=p$(X),U=$.molecules.get(Y);if(!U){let w=$.disposalTraces.buffer.find((D)=>D?.key===Y);$.logger.error("\u274C","key",X,"deallocation failed:",`Could not find allocation for ${Y} in store "${$.config.name}".`,w?`
|
|
10
10
|
This state was most recently deallocated
|
|
11
|
-
${w.trace}`:`No previous disposal trace for ${Y} was found.`);return}let G=$.moleculeJoins.getRelatedKeys(Y);if(G)for(let w of G){let D=$.joins.get(w);if(D)D.relations.delete(X)}$.moleculeJoins.delete(Y);let z=[],W=[],Q=$.moleculeGraph.getRelationEntries({downstreamMoleculeKey:Y});if(Q)for(let[w,{source:D}]of Q)if(D===Y){let E=E6(w);x5($,E)}else z.push(D);let Z=$.moleculeData.getRelatedKeys(U.stringKey);if(Z)for(let w of Z){let D=$.families.get(w),E=
|
|
11
|
+
${w.trace}`:`No previous disposal trace for ${Y} was found.`);return}let G=$.moleculeJoins.getRelatedKeys(Y);if(G)for(let w of G){let D=$.joins.get(w);if(D)D.relations.delete(X)}$.moleculeJoins.delete(Y);let z=[],W=[],Q=$.moleculeGraph.getRelationEntries({downstreamMoleculeKey:Y});if(Q)for(let[w,{source:D}]of Q)if(D===Y){let E=E6(w);x5($,E)}else z.push(D);let Z=$.moleculeData.getRelatedKeys(U.stringKey);if(Z)for(let w of Z){let D=$.families.get(w),E=L1($,D,X);W.push([D.key,E]),l9($,D,X)}let H={type:"molecule_disposal",key:U.key,values:W,provenance:z,timestamp:Date.now()};$.molecules.delete(Y);let V=y6($)&&$.transactionMeta.phase==="building";if(V)$.transactionMeta.update.subEvents.push(H);if($.moleculeGraph.delete(U.stringKey),$.moleculeJoins.delete(U.stringKey),$.moleculeData.delete(U.stringKey),!V)$.on.moleculeDisposal.next(H);$.molecules.delete(U.stringKey);let O=Ij(new Error);$.disposalTraces.add({key:Y,trace:O})}function gN($){return d9($,{key:"[Internal] claim",do:(X,Y,U,G)=>{p9($,Y,U,G)}})}function p9($,X,Y,U){let G=p$(Y),z=j$($),W=z.molecules.get(G);if(!W){let w=$.disposalTraces.buffer.find((D)=>D?.key===G);return $.logger.error("\u274C","key",G,"claim failed:",`Could not allocate to ${G} in store "${$.config.name}".`,w?`
|
|
12
12
|
${G} was most recently disposed
|
|
13
13
|
${w.trace}`:`No previous disposal trace for ${G} was found.`),Y}let Q=p$(X),Z=z.molecules.get(Q);if(!Z){let w=$.disposalTraces.buffer.find((D)=>D?.key===Q);return $.logger.error("\u274C","key",Y,"claim failed:",`Could not allocate to ${Q} in store "${$.config.name}".`,w?`
|
|
14
14
|
${Q} was most recently disposed
|
|
15
|
-
${w.trace}`:`No previous disposal trace for ${Q} was found.`),Y}let H=$.moleculeGraph.getRelationEntries({downstreamMoleculeKey:W.stringKey}).filter(([,{source:w}])=>w!==G).map(([w])=>E6(w));if(U)z.moleculeGraph.delete(G);z.moleculeGraph.set({upstreamMoleculeKey:Z.stringKey,downstreamMoleculeKey:W.stringKey},{source:Z.stringKey});let V={type:"molecule_transfer",key:W.key,exclusive:Boolean(U),from:H,to:[Z.key],timestamp:Date.now()};if(g6(z)&&z.transactionMeta.phase==="building")z.transactionMeta.update.subEvents.push(V);return Y}function xj($,X,Y){switch(Y){case"newValue":YF($,X);break;case"oldValue":l9($,X.token);break}}function Sj($,X,Y){switch(Y){case"newValue":l9($,X.token);break;case"oldValue":if(YF($,X),X.subType==="atom")$.valueMap.set(X.token.key,X.value);break}}function YF($,X){let{token:Y}=X;if(X.subType==="writable"&&X.value)J1($,Y,X.value);else A1($,Y)}function kj($,X,Y){switch(Y){case"newValue":B5($,X.provenance,X.key);break;case"oldValue":x5($,X.key);break}}function bj($,X,Y){switch(Y){case"newValue":x5($,X.key);break;case"oldValue":{let U=X.provenance.map(E6);B5($,U,X.key);for(let[G,z]of X.values){let W=$.families.get(G);if(W){A1($,W,X.key);let Q=`${G}(${p$(X.key)})`;$.valueMap.set(Q,z)}}}break}}function fj($,X,Y){switch(Y){case"newValue":for(let U of X.to)p9($,U,X.key,X.exclusive?"exclusive":void 0);break;case"oldValue":{let U="exclusive";for(let G of X.from)p9($,G,X.key,U),U=void 0}break}}function GF($,X,Y){let U=Y==="newValue"?X.subEvents:[...X.subEvents].reverse();for(let G of U)switch(G.type){case"atom_update":Pj($,G,Y);break;case"state_creation":xj($,G,Y);break;case"state_disposal":Sj($,G,Y);break;case"molecule_creation":kj($,G,Y);break;case"molecule_disposal":bj($,G,Y);break;case"molecule_transfer":fj($,G,Y);break;case"transaction_outcome":GF($,G,Y);break}}function UF($,X){return $.transactionMeta.actionContinuities.getRelatedKey(X)}function hj($,X){return $.transactionMeta.epoch.get(X)}function gj($,X){let Y=UF($,X);if(Y===void 0)return;return hj($,Y)}function yj($,X,Y){let U=UF($,X);if(U!==void 0)$.transactionMeta.epoch.set(U,Y)}function mj($,X){let Y=j$($),{parent:U}=Y;Y.transactionMeta.phase="applying",Y.transactionMeta.update.output=X,U.child=null,U.on.transactionApplying.next(Y.transactionMeta);let{subEvents:G}=Y.transactionMeta.update;if($.logger.info("\uD83D\uDEC4","transaction",Y.transactionMeta.update.token.key,`applying ${G.length} subEvents:`,G),GF(U,Y.transactionMeta.update,"newValue"),YX(U))yj(U,Y.transactionMeta.update.token.key,Y.transactionMeta.update.epoch),_4($,{key:Y.transactionMeta.update.token.key,type:"transaction"})?.subject.next(Y.transactionMeta.update),$.logger.info("\uD83D\uDEEC","transaction",Y.transactionMeta.update.token.key,"applied");else if(g6(U))U.transactionMeta.update.subEvents.push(Y.transactionMeta.update);U.on.transactionApplying.next(null)}function uj($){return{store:$}}var cj=($,X,Y,U)=>{let G=j$($),z={parent:G,child:null,on:G.on,loggers:G.loggers,logger:G.logger,config:G.config,atoms:new b1(G.atoms),atomsThatAreDefault:new Set(G.atomsThatAreDefault),families:new b1(G.families),joins:new b1(G.joins),operation:{open:!1},readonlySelectors:new b1(G.readonlySelectors),timelines:new b1(G.timelines),timelineTopics:G.timelineTopics.overlay(),trackers:new Map,transactions:new b1(G.transactions),selectorAtoms:G.selectorAtoms.overlay(),selectorGraph:G.selectorGraph.overlay(),writableSelectors:new b1(G.writableSelectors),valueMap:new b1(G.valueMap),defaults:G.defaults,disposalTraces:$.disposalTraces.copy(),molecules:new b1(G.molecules),moleculeGraph:G.moleculeGraph.overlay(),moleculeData:G.moleculeData.overlay(),moleculeJoins:G.moleculeJoins.overlay(),miscResources:new b1(G.miscResources)},W=gj($,X.key),Q={phase:"building",update:{type:"transaction_outcome",token:X,id:U,epoch:W===void 0?NaN:W+1,timestamp:Date.now(),subEvents:[],params:Y,output:void 0},toolkit:{get:(...H)=>A1(Z,...H),set:(...H)=>{J1(Z,...H)},reset:(...H)=>{C5(Z,...H)},run:(H,V=TW())=>v5(Z,H,V),find:(...H)=>K4($,...H),json:(H)=>e2(Z,H),dispose:(...H)=>{l9(Z,...H)},env:()=>uj(Z)}},Z=Object.assign(z,{transactionMeta:Q});return G.child=Z,$.logger.info("\uD83D\uDEEB","transaction",X.key,"building with params:",Y),Z};function d9($,X){let{key:Y}=X,U=$.transactions.has(Y),G={key:Y,type:"transaction",run:(Q,Z)=>{let H=f1(G),V=cj($,H,Q,Z);try{let{toolkit:O}=V.transactionMeta,w=X.do(O,...Q);return mj(V,w),w}catch(O){throw vj(V),$.logger.warn("\uD83D\uDCA5","transaction",Y,"caught:",O),O}},install:(Q)=>d9(Q,X),subject:new g$};j$($).transactions.set(Y,G);let W=f1(G);if(!U)$.on.transactionCreation.next(W);return W}function zF($,X,{oldValue:Y,newValue:U},G,z){let W=f1(X);if(G&&z){X.subject.next({newValue:U});let O={checkpoint:!0,type:"state_creation",subType:"writable",token:W,timestamp:Date.now(),value:U};$.operation.subEvents.push(O),z.subject.next(O);let D=j$($);if(W.family){if(YX(D))switch(W.type){case"atom":case"mutable_atom":$.on.atomCreation.next(W);break;case"writable_pure_selector":case"writable_held_selector":$.on.selectorCreation.next(W);break}else if(g6(D)&&D.on.transactionApplying.state===null)D.transactionMeta.update.subEvents.push(O)}return}let{key:Q,subject:Z,type:H}=X,V={oldValue:BW(Y)?Y.READONLY_VIEW:Y,newValue:BW(U)?U.READONLY_VIEW:U};if(YX($)){switch(H){case"mutable_atom":$.logger.info("\uD83D\uDCE2",H,Q,"is now (",U,") subscribers:",Z.subscribers.keys());break;case"atom":case"writable_pure_selector":case"writable_held_selector":$.logger.info("\uD83D\uDCE2",H,Q,"went (",Y,"->",U,") subscribers:",Z.subscribers.keys())}Z.next(V)}if(g6($)&&(H==="mutable_atom"||H==="atom")){if($.on.transactionApplying.state===null){if(BW(U))return;let{timestamp:O}=$.operation,w={type:"atom_update",token:W,timestamp:O,update:V};$.transactionMeta.update.subEvents.push(w),$.logger.info("\uD83D\uDCC1","atom",Q,"stowed (",Y,"->",U,")");return}if(VF(X,"tracker:signal")){let O=Q.slice(1),w=$.atoms.get(O);if(s2($,w,"mut").do(V.newValue)===null===!0)kW($,w)}}}var SW=Symbol("OWN_OP"),pj=Symbol("JOIN_OP");function fW($,X,...Y){let U,G,z,W,Q,Z;if(Y.length===2){if(z=Y[0],Z=Y[1],"family"in z)if(W=bW($,z),Q=E6(z.family.subKey),U=t9($,W,Q),!U)z=G=n9($,W,Q,o9);else z=U}else if(W=_4($,Y[0]),Q=Y[1],Z=Y[2],U=t9($,W,Q),!U)z=G=n9($,W,Q,o9);else z=U;let H=Z===xW?"reset":"set",V;if(X===SW){let E=aN($,z);if(typeof E==="number"){let J=E,A=$.on.operationClose.subscribe(`waiting to ${H} "${z.key}" at T-${J}`,function L(){A(),$.logger.info("\uD83D\uDFE2",z.type,z.key,"resuming deferred",H,`from T-${J}`),fW($,X,z,Z)});return}V=E}else V=$;if("counterfeit"in z&&"family"in z){let E=z.family.subKey,F=$.disposalTraces.buffer.find((J)=>J?.key===E);$.logger.error("\u274C",z.type,z.key,"could not be",H,"because key",E,"is not allocated.",F?`this key was previously disposed:${F.trace}`:"(no previous disposal trace found)");return}let O=_4(V,z),w;if(Z===xW)w=Cj(V,O);else w=jj(V,O,Z);let D=Boolean(G);if(zF(V,O,w,D,W),X===SW)sN(V)}var WF=($,X)=>j$($).atoms.has(X),dj=($,X)=>j$($).writableSelectors.has(X),lj=($,X)=>j$($).readonlySelectors.has(X),rj=($,X)=>WF($,X)||dj($,X)||lj($,X);function rN($,X){return j$($).selectorGraph.getRelationEntries({downstreamSelectorKey:X}).filter(([U,{source:G}])=>G!==X).map(([U,{source:G}])=>G).filter((U)=>rj($,U))}function P5($,X,Y=new Set){let U=rN($,X),G=new Map;while(U.length>0){let z=U.pop();if(Y.has(z))continue;if(Y.add(z),WF($,z)){let W=$.atoms.get(z);G.set(W.key,W)}else U.push(...rN($,z))}return G}function ij($,X,Y,U,G){let z=j$($),{type:W,key:Q}=U;if(W==="atom"||W==="mutable_atom")z.selectorAtoms.set({selectorKey:Y,atomKey:Q}),$.logger.info("\uD83D\uDD0D",X,Y,`discovers root atom "${Q}"`);else{let Z=P5($,Q,G);$.logger.info("\uD83D\uDD0D",X,Y,`discovers root atoms: [ ${[...Z.values()].map((H)=>`"${H.key}"`).join(", ")} ]`);for(let{key:H}of Z.values())z.selectorAtoms=z.selectorAtoms.set({selectorKey:Y,atomKey:H})}G.add(Q)}function S5($,X,Y,U){return{get:(...G)=>{let z=j$($),{token:W,family:Q,subKey:Z}=cW($,...G),H;if("counterfeit"in W&&Q&&Z)H=tN($,W,Q,Z);else{let V=_4($,W);H=s2($,V)}return $.logger.info("\uD83D\uDD0C",X,Y,`registers dependency ( "${W.key}" =`,H,")"),z.selectorGraph.set({upstreamSelectorKey:W.key,downstreamSelectorKey:Y},{source:W.key}),ij($,X,Y,W,U),H},set:(...G)=>{let z=j$($);fW(z,pj,...G)},find:(...G)=>K4($,...G),json:(G)=>e2($,G)}}function hW($,X,Y){let U=j$($),G=new g$,z=new Set,{key:W,const:Q}=X,Z="readonly_held_selector";$.logger.info("\uD83D\uDD28","readonly_held_selector",W,"is being created");let{get:H,find:V,json:O}=S5(U,"readonly_held_selector",W,z),D={...X,type:"readonly_held_selector",subject:G,getFrom:(F)=>{let J=F.selectorGraph.getRelationEntries({downstreamSelectorKey:W});for(let[A,{source:L}]of J)if(L!==W)F.selectorGraph.delete(A,W);return F.selectorAtoms.delete(W),X.get({get:H,find:V,json:O},Q),K0(F,D,Q),$.logger.info("\u2728","readonly_held_selector",W,"=",Q),z.clear(),Q},install:(F)=>hW(F,X,Y)};if(Y)D.family=Y;U.readonlySelectors.set(W,D);let E={key:W,type:"readonly_held_selector"};if(Y)E.family=Y;return E}function gW($,X,Y){let U=j$($),G=new g$,z=new Set,W=X.key,Q="readonly_pure_selector";$.logger.info("\uD83D\uDD28","readonly_pure_selector",W,"is being created");let{get:Z,find:H,json:V}=S5(U,"readonly_pure_selector",W,z),w={...X,type:"readonly_pure_selector",subject:G,getFrom:()=>{let E=j$($),F=E.selectorGraph.getRelationEntries({downstreamSelectorKey:W});for(let[L,{source:T}]of F)if(T!==W)E.selectorGraph.delete(L,W);E.selectorAtoms.delete(W);let J=X.get({get:Z,find:H,json:V}),A=K0(E,w,J);return $.logger.info("\u2728","readonly_pure_selector",W,"=",A),z.clear(),A},install:(E)=>gW(E,X,Y)};if(Y)w.family=Y;U.readonlySelectors.set(W,w);let D={key:W,type:"readonly_pure_selector"};if(Y)D.family=Y;return D}function yW($,X,Y){let U=j$($),G=new g$,z=new Set,{key:W,const:Q}=X,Z="writable_held_selector";$.logger.info("\uD83D\uDD28","writable_held_selector",W,"is being created");let H=S5(U,"writable_held_selector",W,z),{find:V,get:O,json:w}=H,D={find:V,get:O,json:w},J={...X,type:"writable_held_selector",subject:G,getFrom:(L)=>{let T=L.selectorGraph.getRelationEntries({downstreamSelectorKey:W});for(let[q,{source:v}]of T)if(v!==W)L.selectorGraph.delete(q,W);return L.selectorAtoms.delete(W),X.get(D,Q),K0(L,J,Q),$.logger.info("\u2728","writable_held_selector",W,"=",Q),z.clear(),Q},setSelf:()=>{X.set(H,Q)},install:(L)=>yW(L,X,Y)};if(Y)J.family=Y;U.writableSelectors.set(W,J);let A={key:W,type:"writable_held_selector"};if(Y)A.family=Y;return A}function mW($,X,Y){let U=j$($),G=new g$,z=new Set,W=X.key,Q="writable_pure_selector";$.logger.info("\uD83D\uDD28","writable_pure_selector",W,"is being created");let Z=S5(U,"writable_pure_selector",W,z),{find:H,get:V,json:O}=Z,w={find:H,get:V,json:O},F={...X,type:"writable_pure_selector",subject:G,getFrom:(A)=>{let L=A.selectorGraph.getRelationEntries({downstreamSelectorKey:W});for(let[v,{source:I}]of L)if(I!==W)A.selectorGraph.delete(v,W);A.selectorAtoms.delete(W);let T=X.get(w),q=K0(A,F,T);return $.logger.info("\u2728","writable_pure_selector",W,"=",q),z.clear(),q},setSelf:(A)=>{X.set(Z,A)},install:(A)=>mW(A,X,Y)};if(Y)F.family=Y;U.writableSelectors.set(W,F);let J={key:W,type:"writable_pure_selector"};if(Y)J.family=Y;return J}function yN($,X){let Y="set"in X,U="const"in X;if(U&&Y){let z=yW($,X,void 0);return $.on.selectorCreation.next(z),z}if(U){let z=hW($,X,void 0);return $.on.selectorCreation.next(z),z}if(Y){let z=mW($,X,void 0);return $.on.selectorCreation.next(z),z}let G=gW($,X,void 0);return $.on.selectorCreation.next(G),G}function oj($,X){let Y=j$($),{key:U,type:G,family:z}=X;if(!z)$.logger.error("\u274C",G,U,"Standalone selectors cannot be disposed.");else{if(Y.molecules.get(z.subKey))Y.moleculeData.delete(z.subKey,z.key);let Q;switch(X.type){case"writable_held_selector":Y.writableSelectors.delete(U),Q={key:z.key,type:"writable_held_selector_family"},_4($,Q).subject.next({type:"state_disposal",subType:"selector",token:X,timestamp:Date.now()});break;case"writable_pure_selector":Y.writableSelectors.delete(U),Q={key:z.key,type:"writable_pure_selector_family"},_4($,Q).subject.next({type:"state_disposal",subType:"selector",token:X,timestamp:Date.now()});break;case"readonly_held_selector":Y.readonlySelectors.delete(U),Q={key:z.key,type:"readonly_held_selector_family"},_4($,Q).subject.next({type:"state_disposal",subType:"selector",token:X,timestamp:Date.now()});break;case"readonly_pure_selector":Y.readonlySelectors.delete(U),Q={key:z.key,type:"readonly_pure_selector_family"},_4($,Q).subject.next({type:"state_disposal",subType:"selector",token:X,timestamp:Date.now()});break}if(Y.valueMap.delete(U),Y.selectorAtoms.delete(U),Y.selectorGraph.delete(U),Y.moleculeData.delete(z.key,z.subKey),$.logger.info("\uD83D\uDD25",X.type,U,"deleted"),g6(Y)&&Y.transactionMeta.phase==="building")Y.transactionMeta.update.subEvents.push({type:"state_disposal",subType:"selector",token:X,timestamp:Date.now()});else $.on.selectorDisposal.next(X)}}function a2($,X,Y){let U=X.key,G="readonly_pure_selector_family",z={key:U,type:"readonly_pure_selector_family"},W=$.families.get(U);if(W)$.logger.error("\u2757","readonly_pure_selector_family",U,`Overwriting an existing ${J0[W.type]} "${W.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let Q=new g$,H=Object.assign((V)=>{let O=p$(V),w={key:U,subKey:O},D=`${U}(${O})`,E=j$($);return gW(E,{key:D,get:X.get(V)},w)},z,{internalRoles:Y,subject:Q,install:(V)=>a2(V,X),default:(V)=>{return X.get(V)({get:(...w)=>A1($,...w),find:(...w)=>K4($,...w),json:(w)=>e2($,w)})}});return $.families.set(U,H),z}function XX($,X,Y){let U={key:X.key,type:"atom_family"},G=$.families.get(X.key);if(G)$.logger.error("\u2757","atom_family",X.key,`Overwriting an existing ${J0[G.type]} "${G.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let z=new g$,Q=Object.assign((Z)=>{let H=p$(Z),V={key:X.key,subKey:H},O=`${X.key}(${H})`,w=j$($),D=X.default,E={key:O,default:i9(D)?()=>D(Z):D};if(X.effects)E.effects=X.effects(Z);return t2(w,E,V)},U,{default:X.default,subject:z,install:(Z)=>XX(Z,X),internalRoles:Y});if($.families.set(X.key,Q),i9(X.default)===!1)$.defaults.set(X.key,X.default);return U}function QF($,X,Y){let U=X.key,G="readonly_held_selector_family",z={key:U,type:"readonly_held_selector_family"},W=$.families.get(U);if(W)$.logger.error("\u2757","readonly_held_selector_family",U,`Overwriting an existing ${J0[W.type]} "${W.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let Q=new g$,H=Object.assign((V)=>{let O=p$(V),w={key:U,subKey:O},D=`${U}(${O})`,E=j$($);return hW(E,{key:D,const:X.const(V),get:X.get(V)},w)},z,{internalRoles:Y,subject:Q,install:(V)=>QF(V,X),default:X.const});return $.families.set(U,H),z}function ZF($,X,Y){let U=X.key,G="writable_held_selector_family",z={key:U,type:"writable_held_selector_family"},W=$.families.get(U);if(W)$.logger.error("\u2757","writable_held_selector_family",U,`Overwriting an existing ${J0[W.type]} "${W.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let Q=new g$,H=Object.assign((V)=>{let O=p$(V),w={key:U,subKey:O},D=`${U}(${O})`,E=j$($);return yW(E,{key:D,const:X.const(V),get:X.get(V),set:X.set(V)},w)},z,{internalRoles:Y,subject:Q,install:(V)=>ZF(V,X),default:X.const});return $.families.set(U,H),z}function uW($,X,Y){let U=X.key,G="writable_pure_selector_family",z={key:U,type:"writable_pure_selector_family"},W=$.families.get(U);if(W)$.logger.error("\u2757","writable_pure_selector_family",U,`Overwriting an existing ${J0[W.type]} "${W.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let Q=new g$,H=Object.assign((V)=>{let O=p$(V),w={key:U,subKey:O},D=`${U}(${O})`,E=j$($);return mW(E,{key:D,get:X.get(V),set:X.set(V)},w)},z,{internalRoles:Y,subject:Q,install:(V)=>uW(V,X),default:(V)=>{return X.get(V)({get:(...w)=>A1($,...w),find:(...w)=>K4($,...w),json:(w)=>e2($,w)})}});return $.families.set(U,H),z}function vW($,X){let Y="set"in X,U="const"in X;if(U&&Y)return ZF($,X,void 0);if(U)return QF($,X,void 0);if(Y)return uW($,X);return a2($,X)}function t9($,X,Y){let U=p$(Y),G=`${X.key}(${U})`,z=j$($),W;switch(X.type){case"atom_family":case"mutable_atom_family":W=z.atoms.get(G);break;case"writable_held_selector_family":case"writable_pure_selector_family":W=z.writableSelectors.get(G);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":W=z.readonlySelectors.get(G);break}if(W)return f1(W);return W}function K4($,X,Y){let U=_4($,X),G=t9($,X,Y);if(G)return G;return n9($,U,Y)}function l9($,...X){let Y;if(X.length===1)Y=X[0];else{let U=X[0],G=X[1];Y=K4($,U,G)}try{_4($,Y)}catch(U){$.logger.error("\u274C",Y.type,Y.key,`could not be disposed because it was not found in the store "${$.config.name}".`);return}switch(Y.type){case"atom":case"mutable_atom":HF($,Y);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":oj($,Y);break}}function cW($,...X){let Y,U,G,z,W;if(X.length===1){if(W=X[0],"family"in W){let H=bW($,W);if(G=_4($,H),z=E6(W.family.subKey),Y=t9($,H,z),"counterfeit"in W)return{token:W,family:G,subKey:z,isNew:!1};if(!Y)U=n9($,H,z,o9),W=U;else W=Y}}else if(G=_4($,X[0]),z=X[1],Y=t9($,G,z),!Y)U=n9($,G,z,o9),W=U;else W=Y;let Q="counterfeit"in W;if(Boolean(U)&&Q===!1&&G){let H;switch(W.type){case"readonly_pure_selector":case"readonly_held_selector":H="readable";break;case"atom":case"mutable_atom":case"writable_pure_selector":case"writable_held_selector":H="writable";break}let V={type:"state_creation",subType:H,token:W,timestamp:Date.now()};G.subject.next(V);let w=j$($);if(W.family){if(YX(w))switch(W.type){case"atom":case"mutable_atom":$.on.atomCreation.next(W);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":$.on.selectorCreation.next(W);break}else if(g6(w)&&w.on.transactionApplying.state===null)w.transactionMeta.update.subEvents.push(V)}}return{token:W,family:G,subKey:z,isNew:Boolean(U)}}function A1($,...X){let{token:Y,family:U,subKey:G}=cW($,...X);if("counterfeit"in Y&&U&&G)return tN($,Y,U,G);let z=_4($,Y);return s2($,z)}var iN=($,X,Y)=>{return Y.subject.subscribe(`${X.type}:${X.key}`,(U)=>{$.logger.info("\uD83D\uDCE2",X.type,X.key,"root",Y.key,"went",U.oldValue,"->",U.newValue);let G=qj($,X),z=s2($,X);$.logger.info("\u2728",X.type,X.key,"went",G,"->",z),X.subject.next({newValue:z,oldValue:G})})};function a9($,X,Y,U){function G(O){if($.operation.open){let w=$.on.operationClose.subscribe(`state subscription ${Y}`,()=>{w(),U(O)})}else U(O)}cW($,X);let z=_4($,X);$.logger.info("\uD83D\uDC40",z.type,z.key,`Adding subscription "${Y}"`);let W=z.type==="writable_pure_selector"||z.type==="readonly_pure_selector",Q=new Map,Z=G;if(W){s2($,z);for(let[O,w]of P5($,z.key))Q.set(O,iN($,z,w));Z=function O(w){let D=P5($,z.key);for(let[E,F]of Q)if(D.get(E))D.delete(E);else F(),Q.delete(E);for(let[E,F]of D)Q.set(E,iN($,z,F));G(w)}}let H=z.subject.subscribe(Y,Z);return()=>{$.logger.info("\uD83D\uDE48",z.type,z.key,`Removing subscription "${Y}"`),H();for(let O of Q.values())O()}}function _4($,X){let Y,U=$;while(U!==null){switch(X.type){case"atom":case"mutable_atom":Y=U.atoms.get(X.key);break;case"writable_pure_selector":case"writable_held_selector":Y=U.writableSelectors.get(X.key);break;case"readonly_pure_selector":case"readonly_held_selector":Y=U.readonlySelectors.get(X.key);break;case"atom_family":case"mutable_atom_family":case"writable_pure_selector_family":case"readonly_pure_selector_family":case"writable_held_selector_family":case"readonly_held_selector_family":Y=U.families.get(X.key);break;case"timeline":Y=U.timelines.get(X.key);break;case"transaction":Y=U.transactions.get(X.key);break}if(Y)return Y;U=U.child}throw new aj(X,$)}var nj=($,X,Y,U)=>{let G=_4($,X);$.logger.info("\uD83D\uDC40","timeline",X.key,`Adding subscription "${Y}"`);let z=G.subject.subscribe(Y,U);return()=>{$.logger.info("\uD83D\uDE48","timeline",X.key,`Removing subscription "${Y}" from timeline`),z()}};var pW=class{initializeSignalAtom($,X){let Y=`*${$.key}`;X.atoms.delete(Y),X.valueMap.delete(Y);let U=$.family?{key:`*${$.family.key}`,subKey:$.family.subKey}:void 0,G=t2(X,{key:Y,default:null},U,["tracker:signal"]);if(X.parent?.valueMap.has(Y)){let z=X.parent.valueMap.get(Y);X.valueMap.set(Y,z)}return G}unsubscribeFromInnerValue;unsubscribeFromState;captureSignalsFromCore($,X,Y){let U=$.key,G=Y.config.name,z=g6(Y)?Y.transactionMeta.update.token.key:"main",W=`tracker:${G}:${z}:${U}`,Q=(H)=>{J1(Y,X,H)},Z=A1(Y,$);this.unsubscribeFromInnerValue=Z.subscribe(W,Q),this.unsubscribeFromState=a9(Y,$,W,function H(V){if(V.newValue!==V.oldValue)this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=V.newValue.subscribe(W,Q)}.bind(this))}supplySignalsToCore($,X,Y){let U=`tracker:${Y.config.name}:${g6(Y)?Y.transactionMeta.update.token.key:"main"}:${$.key}`;a9(Y,X,U,function G({newValue:z,oldValue:W}){let Q=Y.timelineTopics.getRelatedKey(X.key);if(Q&&Y.timelines.get(Q)?.timeTraveling){let O=nj(Y,{key:Q,type:"timeline"},U,function w(D){O(),J1(Y,$,(E)=>{if(D==="redo"&&z)E.do(z);else if(D==="undo"&&W)E.undo(W);return E})});return}let Z=A1(Y,$),H=Z.getUpdateNumber(z),V=H-Z.cacheUpdateNumber;if(z&&V===1)J1(Y,$,(O)=>(O.do(z),O));else{let O=Z.cacheUpdateNumber+1;Y.logger.info("\u274C","mutable_atom",$.key,"could not be updated. Expected update number",O,"but got",H)}})}mutableAtomToken;latestSignalToken;[Symbol.dispose];constructor($,X){let Y=j$(X),U=this.initializeSignalAtom($,Y);this.mutableAtomToken=$,this.latestSignalToken=U,this.captureSignalsFromCore($,U,Y),this.supplySignalsToCore($,U,Y),Y.trackers.set($.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),Y.trackers.delete($.key)}}};function j5($,X,Y){$.logger.info("\uD83D\uDD28","atom",X.key,`creating in store "${$.config.name}"`);let U=j$($),{key:G}=X,z=U.atoms.get(G),W="mutable_atom";if(z&&z.type===W)return $.logger.error("\u274C",W,G,"Tried to create atom, but it already exists in the store."),f1(z);let Q=new g$,Z={...X,type:W,install:(V)=>{return V.logger.info("\uD83D\uDEE0\uFE0F","atom",G,`installing in store "${V.config.name}"`),j5(V,X,Y)},subject:Q};if(Y)Z.family=Y;U.atoms.set(Z.key,Z);let H=f1(Z);if(X.effects){let V=0,O=[];for(let w of X.effects){let D=w({resetSelf:()=>{C5($,H)},setSelf:(E)=>{J1($,H,E)},onSet:(E)=>a9($,H,`effect[${V}]`,E)});if(D)O.push(D);++V}Z.cleanup=()=>{for(let w of O)w()}}if(new pW(H,$),!Y)yN($,{key:`${G}:JSON`,get:({get:V})=>V(H).toJSON(),set:({set:V},O)=>{V(H,X.class.fromJSON(O))}});return $.on.atomCreation.next(H),H}var tj=class{trackers=new Map;latestSignalAtoms;mutableAtoms;constructor($,X){let Y=XX(X,{key:`*${$.key}`,default:null},["mutable","updates"]);this.latestSignalAtoms=_4(X,Y),this.mutableAtoms=$;let U=(G)=>{let{type:z,token:W}=G;if(W.family){let Q=E6(W.family.subKey);switch(z){case"state_creation":this.trackers.set(Q,new pW(W,X));break;case"state_disposal":{let Z=this.trackers.get(Q);if(Z)Z[Symbol.dispose](),this.trackers.delete(Q)}}}};this.mutableAtoms.subject.subscribe(`store=${X.config.name}::tracker-atom-family`,U)}};function CW($,X,Y){let U={key:X.key,type:"mutable_atom_family"},G=$.families.get(X.key);if(G)$.logger.error("\u2757","mutable_atom_family",X.key,`Overwriting an existing ${J0[G.type]} "${G.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let z=new g$,Q=Object.assign((Z)=>{let H=p$(Z),V={key:X.key,subKey:H},O=`${X.key}(${H})`,w=j$($),D={key:O,class:X.class};if(X.effects)D.effects=X.effects(Z);return j5(w,D,V)},U,{class:X.class,subject:z,install:(Z)=>CW(Z,X),internalRoles:Y});return $.families.set(X.key,Q),uW($,{key:`${X.key}:JSON`,get:(Z)=>({get:H})=>H(U,Z).toJSON(),set:(Z)=>({set:H},V)=>{H(U,Z,X.class.fromJSON(V))}},["mutable","json"]),new tj(Q,$),U}var oN=($,X)=>{let Y=j$(X),U=`${$.key}:JSON`;return Y.families.get(U)},e2=($,X)=>{if(X.family){let U=j$($),z={key:`${X.family.key}:JSON`,type:"writable_pure_selector_family"},W=_4(U,z),Q=E6(X.family.subKey);return K4($,W,Q)}return{type:"writable_pure_selector",key:`${X.key}:JSON`}};var dW=($)=>{let Y={type:"atom",key:`*${$.key}`};if($.family)Y.family={key:`*${$.family.key}`,subKey:$.family.subKey};return Y};function BW($){return typeof $==="object"&&$!==null&&"do"in $&&"undo"in $&&"subscribe"in $&&"cacheUpdateNumber"in $&&"getUpdateNumber"in $&&"READONLY_VIEW"in $&&"toJSON"in $}var mN=class{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;writableSelectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new L0({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new L0({between:["upstreamSelectorKey","downstreamSelectorKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});trackers=new Map;families=new Map;joins=new Map;transactions=new Map;transactionMeta={epoch:new Map,actionContinuities:new L0({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new L0({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new Jj(100);molecules=new Map;moleculeJoins=new L0({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});moleculeGraph=new L0({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});moleculeData=new L0({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});miscResources=new Map;on={atomCreation:new g$,atomDisposal:new g$,selectorCreation:new g$,selectorDisposal:new g$,timelineCreation:new g$,transactionCreation:new g$,transactionApplying:new _j(null),operationClose:new g$,moleculeCreation:new g$,moleculeDisposal:new g$};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new kN("warn",($,X,Y)=>!GX(Y))];logger={error:(...$)=>{for(let X of this.loggers)X.error(...$)},info:(...$)=>{for(let X of this.loggers)X.info(...$)},warn:(...$)=>{for(let X of this.loggers)X.warn(...$)}};constructor($,X=null){if(this.config={...X?.config,...$},X!==null){if(this.operation={...X?.operation},YX(X))this.transactionMeta={epoch:new Map(X?.transactionMeta.epoch),actionContinuities:new L0(X?.transactionMeta.actionContinuities.toJSON())};for(let[,U]of X.families){if(U.internalRoles?.includes("mutable")||U.internalRoles?.includes("join"))continue;U.install(this)}let Y=new Set;for(let[,U]of X.atoms){if(Y.has(U.key))continue;if(U.install(this),U.type==="mutable_atom"){let G=e2(X,U),z=dW(U);Y.add(G.key),Y.add(z.key)}}for(let[,U]of X.readonlySelectors)U.install(this);for(let[,U]of X.writableSelectors){if(Y.has(U.key))continue;U.install(this)}for(let[,U]of X.transactions)U.install(this);for(let[,U]of X.timelines)U.install(this)}}},N6={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new mN({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function t2($,X,Y,U){let{key:z}=X;$.logger.info("\uD83D\uDD28","atom",z,"is being created");let W=j$($),Q=W.atoms.get(z);if(Q&&Q.type==="atom")return $.logger.error("\u274C","atom",z,"Tried to create atom, but it already exists in the store."),f1(Q);let Z=new g$,H={...X,type:"atom",install:(O)=>{return O.logger.info("\uD83D\uDEE0\uFE0F","atom",z,`installing in store "${O.config.name}"`),t2(O,X,Y)},subject:Z};if(Y)H.family=Y;if(U)H.internalRoles=U;W.atoms.set(z,H);let V=f1(H);if(X.effects){let O=0,w=[];for(let D of X.effects){let E=D({resetSelf:()=>{C5($,V)},setSelf:(F)=>{J1($,V,F)},onSet:(F)=>a9($,V,`effect[${O}]`,F)});if(E)w.push(E);++O}H.cleanup=()=>{for(let D of w)D()}}return $.on.atomCreation.next(V),V}function HF($,X){let Y=j$($),{key:U,family:G}=X,z=_4(Y,X);if(!G)$.logger.error("\u274C","atom",U,"Standalone atoms cannot be disposed.");else{z.cleanup?.();let W=$.valueMap.get(z.key),Q=bW($,X),H=_4($,Q).subject,V={type:"state_disposal",subType:"atom",token:X,value:W,timestamp:Date.now()};H.next(V);let O=g6(Y);if(Y.atoms.delete(U),Y.valueMap.delete(U),Y.selectorAtoms.delete(U),Y.atomsThatAreDefault.delete(U),Y.moleculeData.delete(G.key,G.subKey),$.timelineTopics.delete(U),X.type==="mutable_atom"){let w=dW(X);HF($,w),$.trackers.delete(U)}if($.logger.info("\uD83D\uDD25","atom",U,"deleted"),O&&Y.transactionMeta.phase==="building"){let w=Y.transactionMeta.update.subEvents.at(-1),E=w?.type==="molecule_disposal"&&w.values.some(([J])=>J===z.family?.key),F=VF(z,"tracker:signal");if(!E&&!F)Y.transactionMeta.update.subEvents.push(V)}else $.on.atomDisposal.next(X)}}function VF($,X){if("internalRoles"in $===!1)return!1;return $.internalRoles.includes(X)}function H4($){return $[0].toUpperCase()+$.slice(1)}var OF=class{toolkit;options;defaultContent;relations;states;core;transact($,X){let Y=this.toolkit;this.toolkit=$,X(this),this.toolkit=Y}store;realm;[Symbol.dispose](){}constructor($,X,Y=N6.STORE){this.store=Y,this.realm=new bN(Y),this.options=$,this.defaultContent=X,this.store.miscResources.set(`join:${$.key}`,this),this.realm.allocate("root",$.key),this.toolkit={get:(...q)=>A1(Y,...q),set:(...q)=>{J1(Y,...q)},find:(...q)=>K4(Y,...q),json:(q)=>e2(Y,q)};let U=$.between[0],G=$.between[1],z=CW(Y,{key:`${$.key}/relatedKeys`,class:A0},["join","relations"]);this.core={relatedKeysAtoms:z};let W=({get:q},v)=>q(z,v),Q=({set:q},v,I)=>{if(!this.store.molecules.has(p$(v)))this.realm.allocate($.key,v);q(z,v,(S)=>S.add(I)),q(z,I,(S)=>S.add(v))},Z=({set:q},v,I)=>{q(z,v,(j)=>{return j.delete(I),j}),q(z,I,(j)=>{return j.delete(v),j});let[S,y]=[v,I].sort(),r=`${S}:${y}`;this.store.moleculeJoins.delete(r)},H=(q,v,I)=>{let{find:S,get:y,set:r}=q,j=S(z,v),X$=y(j);for(let l of X$){if(I.includes(l))continue;r(z,l,(L$)=>{return L$.delete(v),L$})}r(j,(l)=>{return l.transaction((W$)=>{W$.clear();for(let L$ of I){let b$=W(q,L$),L4=b$.has(v);if(this.relations.cardinality==="1:n"){let X6=[];for(let c of b$){if(c===v)continue;let H$=W(q,c);if(H$.delete(L$),H$.size===0)X6.push(c)}if(!L4&&b$.size>0)b$.clear();for(let c of X6){let[H$,f$]=[L$,c].sort(),n$=`${H$}:${f$}`;Y.moleculeJoins.delete(n$)}}if(!L4)b$.add(v);W$.add(L$)}return!0}),l})},V=(q,v,I)=>{let{set:S}=q;S(z,v,(y)=>{return y.transaction((r)=>{for(let j of I)r.add(j);return!0}),y});for(let y of I)S(z,y,(r)=>{return r.add(v),r});return!0},O=(q,v,I)=>{let S=W(q,v);return I?S.has(I):S.size>0},w={getRelatedKeys:(q)=>W(this.toolkit,q),addRelation:(q,v)=>{this.store.moleculeJoins.set(`"${q}"`,$.key),this.store.moleculeJoins.set(`"${v}"`,$.key),Q(this.toolkit,q,v)},deleteRelation:(q,v)=>{Z(this.toolkit,q,v)},replaceRelationsSafely:(q,v)=>{H(this.toolkit,q,v)},replaceRelationsUnsafely:(q,v)=>{V(this.toolkit,q,v)},has:(q,v)=>O(this.toolkit,q,v)},D,E;if(X){E=XX(Y,{key:`${$.key}/content`,default:X},["join","content"]);let q=({get:S},y)=>S(E,y),v=({set:S},y,r)=>{S(E,y,r)};D=Object.assign(w,{getContent:(S)=>{return q(this.toolkit,S)},setContent:(S,y)=>{v(this.toolkit,S,y)},deleteContent:(S)=>{}})}else D=w;let F=new L0($,{externalStore:D,isAType:$.isAType,isBType:$.isBType,makeContentKey:(...q)=>{let[v,I]=q,[S,y]=q.sort(),r=`${S}:${y}`,j=Y.molecules.get(p$(v)),X$=Y.molecules.get(p$(I));if(!j)this.realm.allocate($.key,v);if(!X$)this.realm.allocate($.key,I);return this.realm.allocate(v,r,"all"),this.realm.claim(I,r),this.store.moleculeJoins.set(r,$.key),r}}),J=()=>a2(Y,{key:`${$.key}/singleRelatedKey`,get:(q)=>({get:v})=>{let I=v(z,q);for(let S of I)return S;return null}},["join","keys"]),A=()=>{return a2(Y,{key:`${$.key}/multipleRelatedKeys`,get:(q)=>({get:v})=>{let I=oN(z,Y);return v(I,q).members}},["join","keys"])},L=()=>a2(Y,{key:`${$.key}/singleRelatedEntry`,get:(q)=>({get:v})=>{let I=v(z,q);for(let S of I){let y=F.isAType?.(q)?q:void 0,r=y===void 0?q:void 0;y??=S,r??=S;let j=F.makeContentKey(y,r),X$=v(E,j);return[S,X$]}return null}},["join","entries"]),T=()=>a2(Y,{key:`${$.key}/multipleRelatedEntries`,get:(q)=>({get:v})=>{let I=oN(z,Y);return v(I,q).members.map((y)=>{let r=F.isAType?.(q)?q:void 0,j=r===void 0?q:void 0;r??=y,j??=y;let X$=F.makeContentKey(r,j),l=v(E,X$);return[y,l]})}},["join","entries"]);switch($.cardinality){case"1:1":{let q=J(),v=`${U}KeyOf${H4(G)}`,I=`${G}KeyOf${H4(U)}`,S={[v]:q,[I]:q},y;if(X){let r=L(),j=`${U}EntryOf${H4(G)}`,X$=`${G}EntryOf${H4(U)}`,l={[j]:r,[X$]:r};y=Object.assign(S,l)}else y=S;this.relations=F,this.states=y;break}case"1:n":{let q=J(),v=A(),I=`${U}KeyOf${H4(G)}`,S=`${G}KeysOf${H4(U)}`,y={[I]:q,[S]:v},r;if(X){let j=L(),X$=T(),l=`${U}EntryOf${H4(G)}`,W$=`${G}EntriesOf${H4(U)}`,L$={[l]:j,[W$]:X$};r=Object.assign(y,L$)}else r=y;this.relations=F,this.states=r;break}case"n:n":{let q=A(),v=`${U}KeysOf${H4(G)}`,I=`${G}KeysOf${H4(U)}`,S={[v]:q,[I]:q},y;if(X){let r=T(),j=`${U}EntriesOf${H4(G)}`,X$=`${G}EntriesOf${H4(U)}`,l={[j]:r,[X$]:r};y=Object.assign(S,l)}else y=S;this.relations=F,this.states=y}}}};function uN($,X,Y){return $.joins.set(X.key,new OF(X,Y,$)),{key:X.key,type:"join",a:X.between[0],b:X.between[1],cardinality:X.cardinality}}function lW($,X){let Y=X.joins.get($.key);if(Y===void 0){let G=N6.STORE.joins.get($.key);if(G===void 0)throw new Error(`Join "${$.key}" not found in store "${X.config.name}"`);let z=Mj(X);Y=new OF(G.options,G.defaultContent,z),X.joins.set($.key,Y)}return Y}function r9($,X,Y){let U=lW($,Y),G=j$(Y);if(g6(G)){let{toolkit:z}=G.transactionMeta;U.transact(z,({relations:W})=>{X(W)})}else X(U.relations)}function cN($,X,Y){let U=lW($,Y),G;switch($.cardinality){case"1:1":{let z=`${$.a}KeyOf${H4($.b)}`,W=`${$.b}KeyOf${H4($.a)}`;G={get[z](){let Z=U.states[z];return K4(Y,Z,X)},get[W](){let Z=U.states[W];return K4(Y,Z,X)}};let Q=`${$.a}EntryOf${H4($.b)}`;if(Q in U.states){let Z=`${$.b}EntryOf${H4($.a)}`;Object.assign(G,{get[Q](){let H=U.states[Q];return K4(Y,H,X)},get[Z](){let H=U.states[Z];return K4(Y,H,X)}})}break}case"1:n":{let z=`${$.a}KeyOf${H4($.b)}`,W=`${$.b}KeysOf${H4($.a)}`;G={get[z](){let Z=U.states[z];return K4(Y,Z,X)},get[W](){let Z=U.states[W];return K4(Y,Z,X)}};let Q=`${$.a}EntryOf${H4($.b)}`;if(Q in U.states){let Z=`${$.b}EntriesOf${H4($.a)}`;Object.assign(G,{get[Q](){let H=U.states[Q];return K4(Y,H,X)},get[Z](){let H=U.states[Z];return K4(Y,H,X)}})}break}case"n:n":{let z=`${$.a}KeysOf${H4($.b)}`,W=`${$.b}KeysOf${H4($.a)}`;G={get[z](){let Z=U.states[z];return K4(Y,Z,X)},get[W](){let Z=U.states[W];return K4(Y,Z,X)}};let Q=`${$.a}EntriesOf${H4($.b)}`;if(Q in U.states){let Z=`${$.b}EntriesOf${H4($.a)}`;Object.assign(G,{get[Q](){let H=U.states[Q];return K4(Y,H,X)},get[Z](){let H=U.states[Z];return K4(Y,H,X)}})}}}return G}function pN($,X){return lW($,X).core.relatedKeysAtoms}var aj=class extends Error{constructor($,X){super(`${J0[$.type]} ${p$($.key)} not found in store "${X.config.name}".`)}};function GX($){return $.startsWith("\uD83D\uDD0D ")}var sj=class extends Map{set($,X){if(this.has($))return console.warn("Tried to set a key that already exists in an InvariantMap",{key:$,value:X}),this;return super.set($,X)}clear(){throw new Error("Cannot clear an InvariantMap")}},Ru=class ${type="continuity";globals=[];actions=[];perspectives=[];key;constructor(X){this.key=X}static existing=new sj;static create(X,Y){let U=new $(X),{type:G,globals:z,actions:W,perspectives:Q}=Y(U),Z={type:G,key:X,globals:z,actions:W,perspectives:Q};return $.existing.set(X,Z),Z}add(...X){switch(X[0].type){case"atom":case"mutable_atom":this.globals.push(...X);break;case"transaction":this.actions.push(...X);break;case"atom_family":case"mutable_atom_family":{let[U,G]=X;this.perspectives.push({type:"realtime_perspective",resourceAtoms:U,viewAtoms:G})}break}return this}};var Tu=$X({key:"usersInRoomIndex",class:A0}),rW=$X({key:"roomIndex",class:A0}),ej={enteredAtEpoch:0},s9=R5({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:($)=>typeof $==="string",isBType:($)=>typeof $==="string"},ej),vu=T5({key:"usersInMyRoomView",get:($)=>({find:X})=>{let Y=SN(s9);return[X(Y,$)]}});import{spawn as $P}from"child_process";var iW=class{listeners;globalListeners;handleEvent($,...X){for(let U of this.globalListeners)U($,...X);let Y=this.listeners.get($);if(Y)for(let U of Y)U(...X)}id="no_id_retrieved";emit;constructor($){this.emit=$,this.listeners=new Map,this.globalListeners=new Set}on($,X){let Y=this.listeners.get($);if(Y)Y.add(X);else this.listeners.set($,new Set([X]));return this}onAny($){return this.globalListeners.add($),this}off($,X){let Y=this.listeners.get($);if(Y)if(X)Y.delete(X);else this.listeners.delete($);return this}offAny($){return this.globalListeners.delete($),this}},XP=class extends iW{incompleteData="";unprocessedEvents=[];incompleteLog="";unprocessedLogs=[];id="#####";process;key;logger;handleLog($){if(Array.isArray($)){let[X,...Y]=$;switch(X){case"i":this.logger.info(...Y);break;case"w":this.logger.warn(...Y);break;case"e":this.logger.error(...Y);break;default:return}}}constructor($,X,Y){super((U,...G)=>{let z=JSON.stringify([U,...G])+"\x03",W=(Q)=>{if(Q.code==="EPIPE")console.error("EPIPE error during write",this.process.stdin);this.process.stdin.removeListener("error",W)};return this.process.stdin.once("error",W),this.process.stdin.write(z),this});if(this.process=$,this.key=X,this.logger=Y??{info:(...U)=>{console.info(this.id,this.key,...U)},warn:(...U)=>{console.warn(this.id,this.key,...U)},error:(...U)=>{console.error(this.id,this.key,...U)}},this.process.stdout.on("data",(U)=>{let G=U.toString();if(G==="ALIVE")return;this.unprocessedEvents.push(...G.split("\x03"));let z=this.unprocessedEvents.shift();this.incompleteData+=z??"";try{if(this.incompleteData.startsWith("error"))console.log("\u2757",this.incompleteData);let W=E6(this.incompleteData);this.handleEvent(...W);while(this.unprocessedEvents.length>0){let Q=this.unprocessedEvents.shift();if(Q){if(this.unprocessedEvents.length===0)this.incompleteData=Q;W=E6(Q),this.handleEvent(...W)}}this.incompleteData=""}catch(W){console.warn("\u26A0\uFE0F----------------\u26A0\uFE0F"),console.warn(this.incompleteData),console.warn("\u26A0\uFE0F----------------\u26A0\uFE0F"),console.error(W)}}),this.process.stderr.on("data",(U)=>{let G=U.toString();this.unprocessedLogs.push(...G.split("\x03"));let z=this.unprocessedLogs.shift();this.incompleteLog+=z??"";try{let W=E6(this.incompleteLog);this.handleLog(W);while(this.unprocessedLogs.length>0)if(this.incompleteLog=this.unprocessedLogs.shift()??"",this.incompleteLog)W=E6(this.incompleteLog),this.handleLog(W)}catch(W){console.error("\u274C\u274C\u274C"),console.error(this.incompleteLog),console.error(W),console.error("\u274C\u274C\u274C\uFE0F")}}),$.pid)this.id=$.pid.toString()}},YP=class extends iW{in;out;id="no_id_retrieved";disposalFunctions=[];constructor($){super((...X)=>{return this.out.next(X),this});this.id=$,this.in=new g$,this.out=new g$,this.in.subscribe("socket",(X)=>{this.handleEvent(...X)})}dispose(){for(let $ of this.disposalFunctions)$()}},wF=class extends iW{incompleteData="";unprocessedEvents=[];relays;relayServices;process;id="#####";log(...$){this.process.stderr.write(p$($.map((X)=>X instanceof A0?`{ ${X.toJSON().members.join(" | ")} }`:X))+"\x03")}logger={info:(...$)=>{this.log("i",...$)},warn:(...$)=>{this.log("w",...$)},error:(...$)=>{this.log("e",...$)}};constructor(){super(($,...X)=>{let Y=JSON.stringify([$,...X]);return this.process.stdout.write(Y+"\x03"),this});if(this.process=process,this.process.stdin.resume(),this.relays=new Map,this.relayServices=[],this.process.stdin.on("data",($)=>{let X=$.toString();this.unprocessedEvents.push(...X.split("\x03"));let Y=this.unprocessedEvents.shift();this.incompleteData+=Y??"";try{let U=E6(this.incompleteData);this.logger.info("\uD83C\uDFB0","received",U),this.handleEvent(...U);while(this.unprocessedEvents.length>0){let G=this.unprocessedEvents.shift();if(G){if(this.unprocessedEvents.length===0)this.incompleteData=G;let z=E6(G);this.handleEvent(...z)}}this.incompleteData=""}catch(U){if(U instanceof Error)this.logger.error("\u2757",U.message,U.cause,U.stack)}}),this.on("exit",()=>{this.logger.info("\uD83D\uDD25",this.id,'received "exit"'),process.exit(0)}),process.on("exit",($)=>{this.logger.info("\uD83D\uDD25",this.id,`exited with code ${$}`)}),process.on("end",()=>{this.logger.info("\uD83D\uDD25",this.id,"ended"),process.exit(0)}),process.on("SIGTERM",()=>{this.logger.error("\uD83D\uDD25",this.id,"terminated"),process.exit(0)}),process.on("SIGINT",()=>{this.logger.error("\uD83D\uDD25",this.id,"interrupted"),process.exit(0)}),process.pid)this.id=process.pid?.toString();this.on("user-joins",($)=>{this.logger.info("\uD83D\uDC64","user",$,"joined");let X=new YP(`user:${$}`);this.relays.set($,X),this.logger.info("\uD83D\uDD17","attaching services:",`[${[...this.relayServices.keys()].join(", ")}]`);for(let Y of this.relayServices){let U=Y(X);if(U)X.disposalFunctions.push(U)}this.on(`user:${$}`,(...Y)=>{X.in.next(Y)}),X.out.subscribe("socket",(Y)=>{this.emit(...Y)})}),this.on("user-leaves",($)=>{let X=this.relays.get($);if(this.off(`relay:${$}`),X)X.dispose(),this.relays.delete($)}),process.stdout.write("ALIVE")}relay($){this.logger.info("\uD83D\uDD17","running relay method"),this.relayServices.push($)}},DF=u9({key:"roomArguments",default:["echo",["Hello World!"]]}),GP=T5({key:"room",get:($)=>async({get:X,find:Y})=>{let U=Y(DF,$),G=X(U),[z,W]=G,Q=await new Promise((Z)=>{let H=$P(z,W,{env:process.env}),V=(O)=>{if(O.toString()==="ALIVE")H.stdout.off("data",V),Z(H)};H.stdout.on("data",V)});return new XP(Q,$)}}),fu=c9({key:"createRoom",do:({get:$,set:X,find:Y},U,G,z)=>{let W=z?[G,z]:[G],Q=Y(DF,U);X(Q,W),X(rW,(V)=>V.add(U));let Z=Y(GP,U);return $(Z)}}),hu=c9({key:"joinRoom",do:($,X,Y,U)=>{let G={enteredAtEpoch:U};return r9(s9,(z)=>{z.set({room:X,user:Y},G)},$.env().store),G}}),gu=c9({key:"leaveRoom",do:($,X,Y)=>{r9(s9,(U)=>{U.delete({room:X,user:Y})},$.env().store)}}),yu=c9({key:"destroyRoom",do:($,X)=>{r9(s9,(Y)=>{Y.delete({room:X})},$.env().store),$.set(rW,(Y)=>(Y.delete(X),Y))}});var mu=u9({key:"redactor",default:{occlude:($)=>$}}),uu=u9({key:"unacknowledgedUpdates",default:()=>[]}),cu=u9({key:"sockets",default:null}),pu=$X({key:"socketsIndex",class:A0}),du=$X({key:"usersIndex",class:A0}),lu=R5({key:"usersOfSockets",between:["user","socket"],cardinality:"1:1",isAType:($)=>$.startsWith("user::"),isBType:($)=>$.startsWith("socket::")});var kU={};D2(kU,{xid:()=>Gx,void:()=>Rx,uuidv7:()=>tI,uuidv6:()=>nI,uuidv4:()=>oI,uuid:()=>iI,url:()=>aI,uppercase:()=>KY,unknown:()=>TU,union:()=>xU,undefined:()=>_x,ulid:()=>Yx,uint64:()=>Lx,uint32:()=>Mx,tuple:()=>Ix,trim:()=>CY,treeifyError:()=>WQ,transform:()=>NO,toUpperCase:()=>jY,toLowerCase:()=>BY,toJSONSchema:()=>bV,templateLiteral:()=>mx,symbol:()=>Kx,superRefine:()=>BM,success:()=>gx,stringbool:()=>dx,stringFormat:()=>Dx,string:()=>dV,strictObject:()=>Bx,startsWith:()=>qY,size:()=>JY,setErrorMap:()=>ox,set:()=>kx,safeParseAsync:()=>pV,safeParse:()=>cV,registry:()=>t5,regexes:()=>G8,regex:()=>AY,refine:()=>CM,record:()=>GM,readonly:()=>KM,property:()=>vV,promise:()=>ux,prettifyError:()=>QQ,preprocess:()=>rx,prefault:()=>EM,positive:()=>_V,pipe:()=>BU,partialRecord:()=>xx,parseAsync:()=>uV,parse:()=>mV,overwrite:()=>v0,optional:()=>vU,object:()=>Cx,number:()=>cF,nullish:()=>hx,nullable:()=>CU,null:()=>iF,normalize:()=>vY,nonpositive:()=>RV,nonoptional:()=>NM,nonnegative:()=>TV,never:()=>jU,negative:()=>qV,nativeEnum:()=>bx,nanoid:()=>eI,nan:()=>yx,multipleOf:()=>W8,minSize:()=>Q8,minLength:()=>N2,mime:()=>TY,maxSize:()=>VX,maxLength:()=>OX,map:()=>Sx,lte:()=>L1,lt:()=>R0,lowercase:()=>LY,looseObject:()=>jx,locales:()=>NY,literal:()=>ZM,length:()=>wX,lazy:()=>RM,ksuid:()=>Ux,keyof:()=>vx,jwt:()=>wx,json:()=>lx,iso:()=>qU,ipv6:()=>Wx,ipv4:()=>zx,intersection:()=>XM,int64:()=>Ax,int32:()=>Fx,int:()=>lV,instanceof:()=>px,includes:()=>_Y,guid:()=>rI,gte:()=>m6,gt:()=>T0,globalRegistry:()=>s1,getErrorMap:()=>nx,function:()=>kV,formatError:()=>HY,float64:()=>Nx,float32:()=>Ex,flattenError:()=>ZY,file:()=>fx,enum:()=>WM,endsWith:()=>RY,emoji:()=>sI,email:()=>lI,e164:()=>Ox,discriminatedUnion:()=>Px,date:()=>Tx,custom:()=>cx,cuid2:()=>Xx,cuid:()=>$x,core:()=>C0,config:()=>v4,coerce:()=>AO,clone:()=>X1,cidrv6:()=>Zx,cidrv4:()=>Qx,check:()=>vM,catch:()=>JM,boolean:()=>pF,bigint:()=>Jx,base64url:()=>Vx,base64:()=>Hx,array:()=>OO,any:()=>qx,_default:()=>wM,_ZodString:()=>rV,ZodXID:()=>$O,ZodVoid:()=>aF,ZodUnknown:()=>nF,ZodUnion:()=>wO,ZodUndefined:()=>lF,ZodUUID:()=>B0,ZodURL:()=>oV,ZodULID:()=>eV,ZodType:()=>T$,ZodTuple:()=>YM,ZodTransform:()=>EO,ZodTemplateLiteral:()=>_M,ZodSymbol:()=>dF,ZodSuccess:()=>FM,ZodStringFormat:()=>a$,ZodString:()=>xY,ZodSet:()=>zM,ZodRecord:()=>DO,ZodRealError:()=>DX,ZodReadonly:()=>LM,ZodPromise:()=>TM,ZodPrefault:()=>DM,ZodPipe:()=>JO,ZodOptional:()=>FO,ZodObject:()=>IU,ZodNumberFormat:()=>EX,ZodNumber:()=>SY,ZodNullable:()=>VM,ZodNull:()=>rF,ZodNonOptional:()=>MO,ZodNever:()=>tF,ZodNanoID:()=>tV,ZodNaN:()=>AM,ZodMap:()=>UM,ZodLiteral:()=>QM,ZodLazy:()=>qM,ZodKSUID:()=>XO,ZodJWT:()=>HO,ZodIssueCode:()=>ix,ZodIntersection:()=>$M,ZodISOTime:()=>KU,ZodISODuration:()=>_U,ZodISODateTime:()=>AU,ZodISODate:()=>LU,ZodIPv6:()=>GO,ZodIPv4:()=>YO,ZodGUID:()=>RU,ZodFile:()=>HM,ZodError:()=>pI,ZodEnum:()=>IY,ZodEmoji:()=>nV,ZodEmail:()=>iV,ZodE164:()=>ZO,ZodDiscriminatedUnion:()=>eF,ZodDefault:()=>OM,ZodDate:()=>PU,ZodCustomStringFormat:()=>uF,ZodCustom:()=>SU,ZodCatch:()=>MM,ZodCUID2:()=>sV,ZodCUID:()=>aV,ZodCIDRv6:()=>zO,ZodCIDRv4:()=>UO,ZodBoolean:()=>kY,ZodBigIntFormat:()=>VO,ZodBigInt:()=>bY,ZodBase64URL:()=>QO,ZodBase64:()=>WO,ZodArray:()=>sF,ZodAny:()=>oF,TimePrecision:()=>nH,NEVER:()=>oW,$output:()=>lH,$input:()=>rH,$brand:()=>nW});var C0={};D2(C0,{version:()=>GZ,util:()=>n,treeifyError:()=>WQ,toJSONSchema:()=>bV,toDotPath:()=>FF,safeParseAsync:()=>HQ,safeParse:()=>ZQ,registry:()=>t5,regexes:()=>G8,prettifyError:()=>QQ,parseAsync:()=>g5,parse:()=>f5,locales:()=>NY,isValidJWT:()=>kF,isValidBase64URL:()=>SF,isValidBase64:()=>RZ,globalRegistry:()=>s1,globalConfig:()=>e9,function:()=>kV,formatError:()=>HY,flattenError:()=>ZY,config:()=>v4,clone:()=>X1,_xid:()=>ZU,_void:()=>JV,_uuidv7:()=>XU,_uuidv6:()=>$U,_uuidv4:()=>e5,_uuid:()=>s5,_url:()=>YU,_uppercase:()=>KY,_unknown:()=>HX,_union:()=>KI,_undefined:()=>EV,_ulid:()=>QU,_uint64:()=>wV,_uint32:()=>WV,_tuple:()=>CV,_trim:()=>CY,_transform:()=>PI,_toUpperCase:()=>jY,_toLowerCase:()=>BY,_templateLiteral:()=>yI,_symbol:()=>DV,_success:()=>bI,_stringbool:()=>IV,_stringFormat:()=>xV,_string:()=>iH,_startsWith:()=>qY,_size:()=>JY,_set:()=>vI,_safeParseAsync:()=>m5,_safeParse:()=>y5,_regex:()=>AY,_refine:()=>PV,_record:()=>RI,_readonly:()=>gI,_property:()=>vV,_promise:()=>uI,_positive:()=>_V,_pipe:()=>hI,_parseAsync:()=>h5,_parse:()=>b5,_overwrite:()=>v0,_optional:()=>II,_number:()=>$V,_nullable:()=>xI,_null:()=>NV,_normalize:()=>vY,_nonpositive:()=>RV,_nonoptional:()=>kI,_nonnegative:()=>TV,_never:()=>MV,_negative:()=>qV,_nativeEnum:()=>BI,_nanoid:()=>UU,_nan:()=>KV,_multipleOf:()=>W8,_minSize:()=>Q8,_minLength:()=>N2,_min:()=>m6,_mime:()=>TY,_maxSize:()=>VX,_maxLength:()=>OX,_max:()=>L1,_map:()=>TI,_lte:()=>L1,_lt:()=>R0,_lowercase:()=>LY,_literal:()=>jI,_length:()=>wX,_lazy:()=>mI,_ksuid:()=>HU,_jwt:()=>MU,_isoTime:()=>sH,_isoDuration:()=>eH,_isoDateTime:()=>tH,_isoDate:()=>aH,_ipv6:()=>OU,_ipv4:()=>VU,_intersection:()=>qI,_int64:()=>OV,_int32:()=>zV,_int:()=>YV,_includes:()=>_Y,_guid:()=>MY,_gte:()=>m6,_gt:()=>T0,_float64:()=>UV,_float32:()=>GV,_file:()=>BV,_enum:()=>CI,_endsWith:()=>RY,_emoji:()=>GU,_email:()=>a5,_e164:()=>FU,_discriminatedUnion:()=>_I,_default:()=>SI,_date:()=>AV,_custom:()=>jV,_cuid2:()=>WU,_cuid:()=>zU,_coercedString:()=>oH,_coercedNumber:()=>XV,_coercedDate:()=>LV,_coercedBoolean:()=>ZV,_coercedBigint:()=>VV,_cidrv6:()=>DU,_cidrv4:()=>wU,_catch:()=>fI,_boolean:()=>QV,_bigint:()=>HV,_base64url:()=>NU,_base64:()=>EU,_array:()=>PY,_any:()=>FV,TimePrecision:()=>nH,NEVER:()=>oW,JSONSchemaGenerator:()=>JU,JSONSchema:()=>gF,Doc:()=>d5,$output:()=>lH,$input:()=>rH,$constructor:()=>C,$brand:()=>nW,$ZodXID:()=>EZ,$ZodVoid:()=>hZ,$ZodUnknown:()=>ZX,$ZodUnion:()=>n5,$ZodUndefined:()=>SZ,$ZodUUID:()=>WZ,$ZodURL:()=>ZZ,$ZodULID:()=>DZ,$ZodType:()=>N$,$ZodTuple:()=>z8,$ZodTransform:()=>wY,$ZodTemplateLiteral:()=>GH,$ZodSymbol:()=>xZ,$ZodSuccess:()=>eZ,$ZodStringFormat:()=>l$,$ZodString:()=>U8,$ZodSet:()=>dZ,$ZodRegistry:()=>FY,$ZodRecord:()=>cZ,$ZodRealError:()=>WX,$ZodReadonly:()=>YH,$ZodPromise:()=>UH,$ZodPrefault:()=>aZ,$ZodPipe:()=>DY,$ZodOptional:()=>oZ,$ZodObject:()=>yZ,$ZodNumberFormat:()=>PZ,$ZodNumber:()=>i5,$ZodNullable:()=>nZ,$ZodNull:()=>kZ,$ZodNonOptional:()=>sZ,$ZodNever:()=>fZ,$ZodNanoID:()=>VZ,$ZodNaN:()=>XH,$ZodMap:()=>pZ,$ZodLiteral:()=>rZ,$ZodLazy:()=>zH,$ZodKSUID:()=>NZ,$ZodJWT:()=>BZ,$ZodIntersection:()=>uZ,$ZodISOTime:()=>JZ,$ZodISODuration:()=>AZ,$ZodISODateTime:()=>FZ,$ZodISODate:()=>MZ,$ZodIPv6:()=>KZ,$ZodIPv4:()=>LZ,$ZodGUID:()=>zZ,$ZodFunction:()=>SV,$ZodFile:()=>iZ,$ZodError:()=>QY,$ZodEnum:()=>lZ,$ZodEmoji:()=>HZ,$ZodEmail:()=>QZ,$ZodE164:()=>CZ,$ZodDiscriminatedUnion:()=>mZ,$ZodDefault:()=>tZ,$ZodDate:()=>gZ,$ZodCustomStringFormat:()=>jZ,$ZodCustom:()=>WH,$ZodCheckUpperCase:()=>tQ,$ZodCheckStringFormat:()=>QX,$ZodCheckStartsWith:()=>sQ,$ZodCheckSizeEquals:()=>dQ,$ZodCheckRegex:()=>oQ,$ZodCheckProperty:()=>$Z,$ZodCheckOverwrite:()=>YZ,$ZodCheckNumberFormat:()=>mQ,$ZodCheckMultipleOf:()=>yQ,$ZodCheckMinSize:()=>pQ,$ZodCheckMinLength:()=>rQ,$ZodCheckMimeType:()=>XZ,$ZodCheckMaxSize:()=>cQ,$ZodCheckMaxLength:()=>lQ,$ZodCheckLowerCase:()=>nQ,$ZodCheckLessThan:()=>c5,$ZodCheckLengthEquals:()=>iQ,$ZodCheckIncludes:()=>aQ,$ZodCheckGreaterThan:()=>p5,$ZodCheckEndsWith:()=>eQ,$ZodCheckBigIntFormat:()=>uQ,$ZodCheck:()=>O4,$ZodCatch:()=>$H,$ZodCUID2:()=>wZ,$ZodCUID:()=>OZ,$ZodCIDRv6:()=>qZ,$ZodCIDRv4:()=>_Z,$ZodBoolean:()=>VY,$ZodBigIntFormat:()=>IZ,$ZodBigInt:()=>o5,$ZodBase64URL:()=>vZ,$ZodBase64:()=>TZ,$ZodAsyncError:()=>_0,$ZodArray:()=>OY,$ZodAny:()=>bZ});var oW=Object.freeze({status:"aborted"});function C($,X,Y){function U(Q,Z){var H;Object.defineProperty(Q,"_zod",{value:Q._zod??{},enumerable:!1}),(H=Q._zod).traits??(H.traits=new Set),Q._zod.traits.add($),X(Q,Z);for(let V in W.prototype)if(!(V in Q))Object.defineProperty(Q,V,{value:W.prototype[V].bind(Q)});Q._zod.constr=W,Q._zod.def=Z}let G=Y?.Parent??Object;class z extends G{}Object.defineProperty(z,"name",{value:$});function W(Q){var Z;let H=Y?.Parent?new z:this;U(H,Q),(Z=H._zod).deferred??(Z.deferred=[]);for(let V of H._zod.deferred)V();return H}return Object.defineProperty(W,"init",{value:U}),Object.defineProperty(W,Symbol.hasInstance,{value:(Q)=>{if(Y?.Parent&&Q instanceof Y.Parent)return!0;return Q?._zod?.traits?.has($)}}),Object.defineProperty(W,"name",{value:$}),W}var nW=Symbol("zod_brand");class _0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var e9={};function v4($){if($)Object.assign(e9,$);return e9}var n={};D2(n,{unwrapMessage:()=>$Y,stringifyPrimitive:()=>o,required:()=>LP,randomString:()=>OP,propertyKeyTypes:()=>UY,promiseAllObject:()=>VP,primitiveTypes:()=>XQ,prefixIssues:()=>y6,pick:()=>NP,partial:()=>AP,optionalKeys:()=>YQ,omit:()=>FP,numKeys:()=>wP,nullish:()=>E2,normalizeParams:()=>d,merge:()=>JP,jsonStringifyReplacer:()=>aW,joinValues:()=>h,issue:()=>zQ,isPlainObject:()=>zX,isObject:()=>UX,getSizableOrigin:()=>zY,getParsedType:()=>DP,getLengthableOrigin:()=>WY,getEnumValues:()=>XY,getElementAtPath:()=>HP,floatSafeRemainder:()=>sW,finalizeIssue:()=>Y1,extend:()=>MP,escapeRegex:()=>q0,esc:()=>$8,defineLazy:()=>y$,createTransparentProxy:()=>EP,clone:()=>X1,cleanRegex:()=>GY,cleanEnum:()=>KP,captureStackTrace:()=>k5,cached:()=>YY,assignProp:()=>eW,assertNotEqual:()=>zP,assertNever:()=>QP,assertIs:()=>WP,assertEqual:()=>UP,assert:()=>ZP,allowsEval:()=>$Q,aborted:()=>X8,NUMBER_FORMAT_RANGES:()=>GQ,Class:()=>EF,BIGINT_FORMAT_RANGES:()=>UQ});function UP($){return $}function zP($){return $}function WP($){}function QP($){throw new Error}function ZP($){}function XY($){let X=Object.values($).filter((U)=>typeof U==="number");return Object.entries($).filter(([U,G])=>X.indexOf(+U)===-1).map(([U,G])=>G)}function h($,X="|"){return $.map((Y)=>o(Y)).join(X)}function aW($,X){if(typeof X==="bigint")return X.toString();return X}function YY($){return{get value(){{let Y=$();return Object.defineProperty(this,"value",{value:Y}),Y}throw new Error("cached value already set")}}}function E2($){return $===null||$===void 0}function GY($){let X=$.startsWith("^")?1:0,Y=$.endsWith("$")?$.length-1:$.length;return $.slice(X,Y)}function sW($,X){let Y=($.toString().split(".")[1]||"").length,U=(X.toString().split(".")[1]||"").length,G=Y>U?Y:U,z=Number.parseInt($.toFixed(G).replace(".","")),W=Number.parseInt(X.toFixed(G).replace(".",""));return z%W/10**G}function y$($,X,Y){Object.defineProperty($,X,{get(){{let G=Y();return $[X]=G,G}throw new Error("cached value already set")},set(G){Object.defineProperty($,X,{value:G})},configurable:!0})}function eW($,X,Y){Object.defineProperty($,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function HP($,X){if(!X)return $;return X.reduce((Y,U)=>Y?.[U],$)}function VP($){let X=Object.keys($),Y=X.map((U)=>$[U]);return Promise.all(Y).then((U)=>{let G={};for(let z=0;z<X.length;z++)G[X[z]]=U[z];return G})}function OP($=10){let Y="";for(let U=0;U<$;U++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function $8($){return JSON.stringify($)}var k5=Error.captureStackTrace?Error.captureStackTrace:(...$)=>{};function UX($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var $Q=YY(()=>{if(typeof navigator!=="undefined"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function zX($){if(UX($)===!1)return!1;let X=$.constructor;if(X===void 0)return!0;let Y=X.prototype;if(UX(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function wP($){let X=0;for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))X++;return X}var DP=($)=>{let X=typeof $;switch(X){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN($)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray($))return"array";if($===null)return"null";if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return"promise";if(typeof Map!=="undefined"&&$ instanceof Map)return"map";if(typeof Set!=="undefined"&&$ instanceof Set)return"set";if(typeof Date!=="undefined"&&$ instanceof Date)return"date";if(typeof File!=="undefined"&&$ instanceof File)return"file";return"object";default:throw new Error(`Unknown data type: ${X}`)}},UY=new Set(["string","number","symbol"]),XQ=new Set(["string","number","bigint","boolean","symbol","undefined"]);function q0($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X1($,X,Y){let U=new $._zod.constr(X??$._zod.def);if(!X||Y?.parent)U._zod.parent=$;return U}function d($){let X=$;if(!X)return{};if(typeof X==="string")return{error:()=>X};if(X?.message!==void 0){if(X?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");X.error=X.message}if(delete X.message,typeof X.error==="string")return{...X,error:()=>X.error};return X}function EP($){let X;return new Proxy({},{get(Y,U,G){return X??(X=$()),Reflect.get(X,U,G)},set(Y,U,G,z){return X??(X=$()),Reflect.set(X,U,G,z)},has(Y,U){return X??(X=$()),Reflect.has(X,U)},deleteProperty(Y,U){return X??(X=$()),Reflect.deleteProperty(X,U)},ownKeys(Y){return X??(X=$()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(Y,U){return X??(X=$()),Reflect.getOwnPropertyDescriptor(X,U)},defineProperty(Y,U,G){return X??(X=$()),Reflect.defineProperty(X,U,G)}})}function o($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function YQ($){return Object.keys($).filter((X)=>{return $[X]._zod.optin==="optional"&&$[X]._zod.optout==="optional"})}var GQ={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},UQ={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function NP($,X){let Y={},U=$._zod.def;for(let G in X){if(!(G in U.shape))throw new Error(`Unrecognized key: "${G}"`);if(!X[G])continue;Y[G]=U.shape[G]}return X1($,{...$._zod.def,shape:Y,checks:[]})}function FP($,X){let Y={...$._zod.def.shape},U=$._zod.def;for(let G in X){if(!(G in U.shape))throw new Error(`Unrecognized key: "${G}"`);if(!X[G])continue;delete Y[G]}return X1($,{...$._zod.def,shape:Y,checks:[]})}function MP($,X){if(!zX(X))throw new Error("Invalid input to extend: expected a plain object");let Y={...$._zod.def,get shape(){let U={...$._zod.def.shape,...X};return eW(this,"shape",U),U},checks:[]};return X1($,Y)}function JP($,X){return X1($,{...$._zod.def,get shape(){let Y={...$._zod.def.shape,...X._zod.def.shape};return eW(this,"shape",Y),Y},catchall:X._zod.def.catchall,checks:[]})}function AP($,X,Y){let U=X._zod.def.shape,G={...U};if(Y)for(let z in Y){if(!(z in U))throw new Error(`Unrecognized key: "${z}"`);if(!Y[z])continue;G[z]=$?new $({type:"optional",innerType:U[z]}):U[z]}else for(let z in U)G[z]=$?new $({type:"optional",innerType:U[z]}):U[z];return X1(X,{...X._zod.def,shape:G,checks:[]})}function LP($,X,Y){let U=X._zod.def.shape,G={...U};if(Y)for(let z in Y){if(!(z in G))throw new Error(`Unrecognized key: "${z}"`);if(!Y[z])continue;G[z]=new $({type:"nonoptional",innerType:U[z]})}else for(let z in U)G[z]=new $({type:"nonoptional",innerType:U[z]});return X1(X,{...X._zod.def,shape:G,checks:[]})}function X8($,X=0){for(let Y=X;Y<$.issues.length;Y++)if($.issues[Y]?.continue!==!0)return!0;return!1}function y6($,X){return X.map((Y)=>{var U;return(U=Y).path??(U.path=[]),Y.path.unshift($),Y})}function $Y($){return typeof $==="string"?$:$?.message}function Y1($,X,Y){let U={...$,path:$.path??[]};if(!$.message){let G=$Y($.inst?._zod.def?.error?.($))??$Y(X?.error?.($))??$Y(Y.customError?.($))??$Y(Y.localeError?.($))??"Invalid input";U.message=G}if(delete U.inst,delete U.continue,!X?.reportInput)delete U.input;return U}function zY($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function WY($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function zQ(...$){let[X,Y,U]=$;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:U};return{...X}}function KP($){return Object.entries($).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}class EF{constructor(...$){}}var NF=($,X)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:X,enumerable:!1}),Object.defineProperty($,"message",{get(){return JSON.stringify(X,aW,2)},enumerable:!0}),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},QY=C("$ZodError",NF),WX=C("$ZodError",NF,{Parent:Error});function ZY($,X=(Y)=>Y.message){let Y={},U=[];for(let G of $.issues)if(G.path.length>0)Y[G.path[0]]=Y[G.path[0]]||[],Y[G.path[0]].push(X(G));else U.push(X(G));return{formErrors:U,fieldErrors:Y}}function HY($,X){let Y=X||function(z){return z.message},U={_errors:[]},G=(z)=>{for(let W of z.issues)if(W.code==="invalid_union"&&W.errors.length)W.errors.map((Q)=>G({issues:Q}));else if(W.code==="invalid_key")G({issues:W.issues});else if(W.code==="invalid_element")G({issues:W.issues});else if(W.path.length===0)U._errors.push(Y(W));else{let Q=U,Z=0;while(Z<W.path.length){let H=W.path[Z];if(Z!==W.path.length-1)Q[H]=Q[H]||{_errors:[]};else Q[H]=Q[H]||{_errors:[]},Q[H]._errors.push(Y(W));Q=Q[H],Z++}}};return G($),U}function WQ($,X){let Y=X||function(z){return z.message},U={errors:[]},G=(z,W=[])=>{var Q,Z;for(let H of z.issues)if(H.code==="invalid_union"&&H.errors.length)H.errors.map((V)=>G({issues:V},H.path));else if(H.code==="invalid_key")G({issues:H.issues},H.path);else if(H.code==="invalid_element")G({issues:H.issues},H.path);else{let V=[...W,...H.path];if(V.length===0){U.errors.push(Y(H));continue}let O=U,w=0;while(w<V.length){let D=V[w],E=w===V.length-1;if(typeof D==="string")O.properties??(O.properties={}),(Q=O.properties)[D]??(Q[D]={errors:[]}),O=O.properties[D];else O.items??(O.items=[]),(Z=O.items)[D]??(Z[D]={errors:[]}),O=O.items[D];if(E)O.errors.push(Y(H));w++}}};return G($),U}function FF($){let X=[];for(let Y of $)if(typeof Y==="number")X.push(`[${Y}]`);else if(typeof Y==="symbol")X.push(`[${JSON.stringify(String(Y))}]`);else if(/[^\w$]/.test(Y))X.push(`[${JSON.stringify(Y)}]`);else{if(X.length)X.push(".");X.push(Y)}return X.join("")}function QQ($){let X=[],Y=[...$.issues].sort((U,G)=>U.path.length-G.path.length);for(let U of Y)if(X.push(`\u2716 ${U.message}`),U.path?.length)X.push(` \u2192 at ${FF(U.path)}`);return X.join(`
|
|
16
|
-
`)}var b5=($)=>(X,Y,U,G)=>{let z=U?Object.assign(U,{async:!1}):{async:!1},W=X._zod.run({value:Y,issues:[]},z);if(W instanceof Promise)throw new _0;if(W.issues.length){let Q=new(G?.Err??$)(W.issues.map((Z)=>Y1(Z,z,v4())));throw k5(Q,G?.callee),Q}return W.value},f5=b5(WX),h5=($)=>async(X,Y,U,G)=>{let z=U?Object.assign(U,{async:!0}):{async:!0},W=X._zod.run({value:Y,issues:[]},z);if(W instanceof Promise)W=await W;if(W.issues.length){let Q=new(G?.Err??$)(W.issues.map((Z)=>Y1(Z,z,v4())));throw k5(Q,G?.callee),Q}return W.value},g5=h5(WX),y5=($)=>(X,Y,U)=>{let G=U?{...U,async:!1}:{async:!1},z=X._zod.run({value:Y,issues:[]},G);if(z instanceof Promise)throw new _0;return z.issues.length?{success:!1,error:new($??QY)(z.issues.map((W)=>Y1(W,G,v4())))}:{success:!0,data:z.value}},ZQ=y5(WX),m5=($)=>async(X,Y,U)=>{let G=U?Object.assign(U,{async:!0}):{async:!0},z=X._zod.run({value:Y,issues:[]},G);if(z instanceof Promise)z=await z;return z.issues.length?{success:!1,error:new $(z.issues.map((W)=>Y1(W,G,v4())))}:{success:!0,data:z.value}},HQ=m5(WX);var G8={};D2(G8,{xid:()=>DQ,uuid7:()=>vP,uuid6:()=>TP,uuid4:()=>RP,uuid:()=>Y8,uppercase:()=>gQ,unicodeEmail:()=>jP,undefined:()=>fQ,ulid:()=>wQ,time:()=>BQ,string:()=>PQ,rfc5322Email:()=>BP,number:()=>SQ,null:()=>bQ,nanoid:()=>NQ,lowercase:()=>hQ,ksuid:()=>EQ,ipv6:()=>KQ,ipv4:()=>LQ,integer:()=>xQ,html5Email:()=>CP,hostname:()=>TQ,guid:()=>MQ,extendedDuration:()=>qP,emoji:()=>AQ,email:()=>JQ,e164:()=>vQ,duration:()=>FQ,domain:()=>xP,datetime:()=>jQ,date:()=>CQ,cuid2:()=>OQ,cuid:()=>VQ,cidrv6:()=>qQ,cidrv4:()=>_Q,browserEmail:()=>PP,boolean:()=>kQ,bigint:()=>IQ,base64url:()=>u5,base64:()=>RQ,_emoji:()=>IP});var VQ=/^[cC][^\s-]{8,}$/,OQ=/^[0-9a-z]+$/,wQ=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,DQ=/^[0-9a-vA-V]{20}$/,EQ=/^[A-Za-z0-9]{27}$/,NQ=/^[a-zA-Z0-9_-]{21}$/,FQ=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qP=/^[-+]?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)?)??$/,MQ=/^([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})$/,Y8=($)=>{if(!$)return/^([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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},RP=Y8(4),TP=Y8(6),vP=Y8(7),JQ=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,CP=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,BP=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,jP=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,PP=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,IP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function AQ(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var LQ=/^(?:(?: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])$/,KQ=/^(([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})$/,_Q=/^((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])$/,qQ=/^(([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])$/,RQ=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,u5=/^[A-Za-z0-9_-]*$/,TQ=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,xP=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,vQ=/^\+(?:[0-9]){6,14}[0-9]$/,MF="(?:(?:\\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])))",CQ=new RegExp(`^${MF}$`);function JF($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function BQ($){return new RegExp(`^${JF($)}$`)}function jQ($){let X=JF({precision:$.precision}),Y=["Z"];if($.local)Y.push("");if($.offset)Y.push("([+-]\\d{2}:\\d{2})");let U=`${X}(?:${Y.join("|")})`;return new RegExp(`^${MF}T(?:${U})$`)}var PQ=($)=>{let X=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)},IQ=/^\d+n?$/,xQ=/^\d+$/,SQ=/^-?\d+(?:\.\d+)?/i,kQ=/true|false/i,bQ=/null/i;var fQ=/undefined/i;var hQ=/^[^A-Z]*$/,gQ=/^[^a-z]*$/;var O4=C("$ZodCheck",($,X)=>{var Y;$._zod??($._zod={}),$._zod.def=X,(Y=$._zod).onattach??(Y.onattach=[])}),LF={number:"number",bigint:"bigint",object:"date"},c5=C("$ZodCheckLessThan",($,X)=>{O4.init($,X);let Y=LF[typeof X.value];$._zod.onattach.push((U)=>{let G=U._zod.bag,z=(X.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<z)if(X.inclusive)G.maximum=X.value;else G.exclusiveMaximum=X.value}),$._zod.check=(U)=>{if(X.inclusive?U.value<=X.value:U.value<X.value)return;U.issues.push({origin:Y,code:"too_big",maximum:X.value,input:U.value,inclusive:X.inclusive,inst:$,continue:!X.abort})}}),p5=C("$ZodCheckGreaterThan",($,X)=>{O4.init($,X);let Y=LF[typeof X.value];$._zod.onattach.push((U)=>{let G=U._zod.bag,z=(X.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>z)if(X.inclusive)G.minimum=X.value;else G.exclusiveMinimum=X.value}),$._zod.check=(U)=>{if(X.inclusive?U.value>=X.value:U.value>X.value)return;U.issues.push({origin:Y,code:"too_small",minimum:X.value,input:U.value,inclusive:X.inclusive,inst:$,continue:!X.abort})}}),yQ=C("$ZodCheckMultipleOf",($,X)=>{O4.init($,X),$._zod.onattach.push((Y)=>{var U;(U=Y._zod.bag).multipleOf??(U.multipleOf=X.value)}),$._zod.check=(Y)=>{if(typeof Y.value!==typeof X.value)throw new Error("Cannot mix number and bigint in multiple_of check.");if(typeof Y.value==="bigint"?Y.value%X.value===BigInt(0):sW(Y.value,X.value)===0)return;Y.issues.push({origin:typeof Y.value,code:"not_multiple_of",divisor:X.value,input:Y.value,inst:$,continue:!X.abort})}}),mQ=C("$ZodCheckNumberFormat",($,X)=>{O4.init($,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),U=Y?"int":"number",[G,z]=GQ[X.format];$._zod.onattach.push((W)=>{let Q=W._zod.bag;if(Q.format=X.format,Q.minimum=G,Q.maximum=z,Y)Q.pattern=xQ}),$._zod.check=(W)=>{let Q=W.value;if(Y){if(!Number.isInteger(Q)){W.issues.push({expected:U,format:X.format,code:"invalid_type",input:Q,inst:$});return}if(!Number.isSafeInteger(Q)){if(Q>0)W.issues.push({input:Q,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:U,continue:!X.abort});else W.issues.push({input:Q,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:U,continue:!X.abort});return}}if(Q<G)W.issues.push({origin:"number",input:Q,code:"too_small",minimum:G,inclusive:!0,inst:$,continue:!X.abort});if(Q>z)W.issues.push({origin:"number",input:Q,code:"too_big",maximum:z,inst:$})}}),uQ=C("$ZodCheckBigIntFormat",($,X)=>{O4.init($,X);let[Y,U]=UQ[X.format];$._zod.onattach.push((G)=>{let z=G._zod.bag;z.format=X.format,z.minimum=Y,z.maximum=U}),$._zod.check=(G)=>{let z=G.value;if(z<Y)G.issues.push({origin:"bigint",input:z,code:"too_small",minimum:Y,inclusive:!0,inst:$,continue:!X.abort});if(z>U)G.issues.push({origin:"bigint",input:z,code:"too_big",maximum:U,inst:$})}}),cQ=C("$ZodCheckMaxSize",($,X)=>{var Y;O4.init($,X),(Y=$._zod.def).when??(Y.when=(U)=>{let G=U.value;return!E2(G)&&G.size!==void 0}),$._zod.onattach.push((U)=>{let G=U._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<G)U._zod.bag.maximum=X.maximum}),$._zod.check=(U)=>{let G=U.value;if(G.size<=X.maximum)return;U.issues.push({origin:zY(G),code:"too_big",maximum:X.maximum,input:G,inst:$,continue:!X.abort})}}),pQ=C("$ZodCheckMinSize",($,X)=>{var Y;O4.init($,X),(Y=$._zod.def).when??(Y.when=(U)=>{let G=U.value;return!E2(G)&&G.size!==void 0}),$._zod.onattach.push((U)=>{let G=U._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>G)U._zod.bag.minimum=X.minimum}),$._zod.check=(U)=>{let G=U.value;if(G.size>=X.minimum)return;U.issues.push({origin:zY(G),code:"too_small",minimum:X.minimum,input:G,inst:$,continue:!X.abort})}}),dQ=C("$ZodCheckSizeEquals",($,X)=>{var Y;O4.init($,X),(Y=$._zod.def).when??(Y.when=(U)=>{let G=U.value;return!E2(G)&&G.size!==void 0}),$._zod.onattach.push((U)=>{let G=U._zod.bag;G.minimum=X.size,G.maximum=X.size,G.size=X.size}),$._zod.check=(U)=>{let G=U.value,z=G.size;if(z===X.size)return;let W=z>X.size;U.issues.push({origin:zY(G),...W?{code:"too_big",maximum:X.size}:{code:"too_small",minimum:X.size},inclusive:!0,exact:!0,input:U.value,inst:$,continue:!X.abort})}}),lQ=C("$ZodCheckMaxLength",($,X)=>{var Y;O4.init($,X),(Y=$._zod.def).when??(Y.when=(U)=>{let G=U.value;return!E2(G)&&G.length!==void 0}),$._zod.onattach.push((U)=>{let G=U._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<G)U._zod.bag.maximum=X.maximum}),$._zod.check=(U)=>{let G=U.value;if(G.length<=X.maximum)return;let W=WY(G);U.issues.push({origin:W,code:"too_big",maximum:X.maximum,inclusive:!0,input:G,inst:$,continue:!X.abort})}}),rQ=C("$ZodCheckMinLength",($,X)=>{var Y;O4.init($,X),(Y=$._zod.def).when??(Y.when=(U)=>{let G=U.value;return!E2(G)&&G.length!==void 0}),$._zod.onattach.push((U)=>{let G=U._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>G)U._zod.bag.minimum=X.minimum}),$._zod.check=(U)=>{let G=U.value;if(G.length>=X.minimum)return;let W=WY(G);U.issues.push({origin:W,code:"too_small",minimum:X.minimum,inclusive:!0,input:G,inst:$,continue:!X.abort})}}),iQ=C("$ZodCheckLengthEquals",($,X)=>{var Y;O4.init($,X),(Y=$._zod.def).when??(Y.when=(U)=>{let G=U.value;return!E2(G)&&G.length!==void 0}),$._zod.onattach.push((U)=>{let G=U._zod.bag;G.minimum=X.length,G.maximum=X.length,G.length=X.length}),$._zod.check=(U)=>{let G=U.value,z=G.length;if(z===X.length)return;let W=WY(G),Q=z>X.length;U.issues.push({origin:W,...Q?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:U.value,inst:$,continue:!X.abort})}}),QX=C("$ZodCheckStringFormat",($,X)=>{var Y,U;if(O4.init($,X),$._zod.onattach.push((G)=>{let z=G._zod.bag;if(z.format=X.format,X.pattern)z.patterns??(z.patterns=new Set),z.patterns.add(X.pattern)}),X.pattern)(Y=$._zod).check??(Y.check=(G)=>{if(X.pattern.lastIndex=0,X.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:X.format,input:G.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:$,continue:!X.abort})});else(U=$._zod).check??(U.check=()=>{})}),oQ=C("$ZodCheckRegex",($,X)=>{QX.init($,X),$._zod.check=(Y)=>{if(X.pattern.lastIndex=0,X.pattern.test(Y.value))return;Y.issues.push({origin:"string",code:"invalid_format",format:"regex",input:Y.value,pattern:X.pattern.toString(),inst:$,continue:!X.abort})}}),nQ=C("$ZodCheckLowerCase",($,X)=>{X.pattern??(X.pattern=hQ),QX.init($,X)}),tQ=C("$ZodCheckUpperCase",($,X)=>{X.pattern??(X.pattern=gQ),QX.init($,X)}),aQ=C("$ZodCheckIncludes",($,X)=>{O4.init($,X);let Y=q0(X.includes),U=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Y}`:Y);X.pattern=U,$._zod.onattach.push((G)=>{let z=G._zod.bag;z.patterns??(z.patterns=new Set),z.patterns.add(U)}),$._zod.check=(G)=>{if(G.value.includes(X.includes,X.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:G.value,inst:$,continue:!X.abort})}}),sQ=C("$ZodCheckStartsWith",($,X)=>{O4.init($,X);let Y=new RegExp(`^${q0(X.prefix)}.*`);X.pattern??(X.pattern=Y),$._zod.onattach.push((U)=>{let G=U._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(Y)}),$._zod.check=(U)=>{if(U.value.startsWith(X.prefix))return;U.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:U.value,inst:$,continue:!X.abort})}}),eQ=C("$ZodCheckEndsWith",($,X)=>{O4.init($,X);let Y=new RegExp(`.*${q0(X.suffix)}$`);X.pattern??(X.pattern=Y),$._zod.onattach.push((U)=>{let G=U._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(Y)}),$._zod.check=(U)=>{if(U.value.endsWith(X.suffix))return;U.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:U.value,inst:$,continue:!X.abort})}});function AF($,X,Y){if($.issues.length)X.issues.push(...y6(Y,$.issues))}var $Z=C("$ZodCheckProperty",($,X)=>{O4.init($,X),$._zod.check=(Y)=>{let U=X.schema._zod.run({value:Y.value[X.property],issues:[]},{});if(U instanceof Promise)return U.then((G)=>AF(G,Y,X.property));AF(U,Y,X.property);return}}),XZ=C("$ZodCheckMimeType",($,X)=>{O4.init($,X);let Y=new Set(X.mime);$._zod.onattach.push((U)=>{U._zod.bag.mime=X.mime}),$._zod.check=(U)=>{if(Y.has(U.value.type))return;U.issues.push({code:"invalid_value",values:X.mime,input:U.value.type,inst:$})}}),YZ=C("$ZodCheckOverwrite",($,X)=>{O4.init($,X),$._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class d5{constructor($=[]){if(this.content=[],this.indent=0,this)this.args=$}indented($){this.indent+=1,$(this),this.indent-=1}write($){if(typeof $==="function"){$(this,{execution:"sync"}),$(this,{execution:"async"});return}let Y=$.split(`
|
|
15
|
+
${w.trace}`:`No previous disposal trace for ${Q} was found.`),Y}let H=$.moleculeGraph.getRelationEntries({downstreamMoleculeKey:W.stringKey}).filter(([,{source:w}])=>w!==G).map(([w])=>E6(w));if(U)z.moleculeGraph.delete(G);z.moleculeGraph.set({upstreamMoleculeKey:Z.stringKey,downstreamMoleculeKey:W.stringKey},{source:Z.stringKey});let V={type:"molecule_transfer",key:W.key,exclusive:Boolean(U),from:H,to:[Z.key],timestamp:Date.now()};if(y6(z)&&z.transactionMeta.phase==="building")z.transactionMeta.update.subEvents.push(V);return Y}function xj($,X,Y){switch(Y){case"newValue":YF($,X);break;case"oldValue":l9($,X.token);break}}function Sj($,X,Y){switch(Y){case"newValue":l9($,X.token);break;case"oldValue":if(YF($,X),X.subType==="atom")$.valueMap.set(X.token.key,X.value);break}}function YF($,X){let{token:Y}=X;if(X.subType==="writable"&&X.value)A1($,Y,X.value);else L1($,Y)}function kj($,X,Y){switch(Y){case"newValue":B5($,X.provenance,X.key);break;case"oldValue":x5($,X.key);break}}function bj($,X,Y){switch(Y){case"newValue":x5($,X.key);break;case"oldValue":{let U=X.provenance.map(E6);B5($,U,X.key);for(let[G,z]of X.values){let W=$.families.get(G);if(W){L1($,W,X.key);let Q=`${G}(${p$(X.key)})`;$.valueMap.set(Q,z)}}}break}}function fj($,X,Y){switch(Y){case"newValue":for(let U of X.to)p9($,U,X.key,X.exclusive?"exclusive":void 0);break;case"oldValue":{let U="exclusive";for(let G of X.from)p9($,G,X.key,U),U=void 0}break}}function GF($,X,Y){let U=Y==="newValue"?X.subEvents:[...X.subEvents].reverse();for(let G of U)switch(G.type){case"atom_update":Pj($,G,Y);break;case"state_creation":xj($,G,Y);break;case"state_disposal":Sj($,G,Y);break;case"molecule_creation":kj($,G,Y);break;case"molecule_disposal":bj($,G,Y);break;case"molecule_transfer":fj($,G,Y);break;case"transaction_outcome":GF($,G,Y);break}}function UF($,X){return $.transactionMeta.actionContinuities.getRelatedKey(X)}function hj($,X){return $.transactionMeta.epoch.get(X)}function gj($,X){let Y=UF($,X);if(Y===void 0)return;return hj($,Y)}function yj($,X,Y){let U=UF($,X);if(U!==void 0)$.transactionMeta.epoch.set(U,Y)}function mj($,X){let Y=j$($),{parent:U}=Y;Y.transactionMeta.phase="applying",Y.transactionMeta.update.output=X,U.child=null,U.on.transactionApplying.next(Y.transactionMeta);let{subEvents:G}=Y.transactionMeta.update;if($.logger.info("\uD83D\uDEC4","transaction",Y.transactionMeta.update.token.key,`applying ${G.length} subEvents:`,G),GF(U,Y.transactionMeta.update,"newValue"),YX(U))yj(U,Y.transactionMeta.update.token.key,Y.transactionMeta.update.epoch),_4($,{key:Y.transactionMeta.update.token.key,type:"transaction"})?.subject.next(Y.transactionMeta.update),$.logger.info("\uD83D\uDEEC","transaction",Y.transactionMeta.update.token.key,"applied");else if(y6(U))U.transactionMeta.update.subEvents.push(Y.transactionMeta.update);U.on.transactionApplying.next(null)}function uj($){return{store:$}}var cj=($,X,Y,U)=>{let G=j$($),z={parent:G,child:null,on:G.on,loggers:G.loggers,logger:G.logger,config:G.config,atoms:new f1(G.atoms),atomsThatAreDefault:new Set(G.atomsThatAreDefault),families:new f1(G.families),joins:new f1(G.joins),operation:{open:!1},readonlySelectors:new f1(G.readonlySelectors),timelines:new f1(G.timelines),timelineTopics:G.timelineTopics.overlay(),trackers:new Map,transactions:new f1(G.transactions),selectorAtoms:G.selectorAtoms.overlay(),selectorGraph:G.selectorGraph.overlay(),writableSelectors:new f1(G.writableSelectors),valueMap:new f1(G.valueMap),defaults:G.defaults,disposalTraces:$.disposalTraces.copy(),molecules:new f1(G.molecules),moleculeGraph:G.moleculeGraph.overlay(),moleculeData:G.moleculeData.overlay(),moleculeJoins:G.moleculeJoins.overlay(),miscResources:new f1(G.miscResources)},W=gj($,X.key),Q={phase:"building",update:{type:"transaction_outcome",token:X,id:U,epoch:W===void 0?NaN:W+1,timestamp:Date.now(),subEvents:[],params:Y,output:void 0},toolkit:{get:(...H)=>L1(Z,...H),set:(...H)=>{A1(Z,...H)},reset:(...H)=>{C5(Z,...H)},run:(H,V=TW())=>v5(Z,H,V),find:(...H)=>K4($,...H),json:(H)=>e2(Z,H),dispose:(...H)=>{l9(Z,...H)},env:()=>uj(Z)}},Z=Object.assign(z,{transactionMeta:Q});return G.child=Z,$.logger.info("\uD83D\uDEEB","transaction",X.key,"building with params:",Y),Z};function d9($,X){let{key:Y}=X,U=$.transactions.has(Y),G={key:Y,type:"transaction",run:(Q,Z)=>{let H=h1(G),V=cj($,H,Q,Z);try{let{toolkit:O}=V.transactionMeta,w=X.do(O,...Q);return mj(V,w),w}catch(O){throw vj(V),$.logger.warn("\uD83D\uDCA5","transaction",Y,"caught:",O),O}},install:(Q)=>d9(Q,X),subject:new g$};j$($).transactions.set(Y,G);let W=h1(G);if(!U)$.on.transactionCreation.next(W);return W}function zF($,X,{oldValue:Y,newValue:U},G,z){let W=h1(X);if(G&&z){X.subject.next({newValue:U});let O={checkpoint:!0,type:"state_creation",subType:"writable",token:W,timestamp:Date.now(),value:U};$.operation.subEvents.push(O),z.subject.next(O);let D=j$($);if(W.family){if(YX(D))switch(W.type){case"atom":case"mutable_atom":$.on.atomCreation.next(W);break;case"writable_pure_selector":case"writable_held_selector":$.on.selectorCreation.next(W);break}else if(y6(D)&&D.on.transactionApplying.state===null)D.transactionMeta.update.subEvents.push(O)}return}let{key:Q,subject:Z,type:H}=X,V={oldValue:BW(Y)?Y.READONLY_VIEW:Y,newValue:BW(U)?U.READONLY_VIEW:U};if(YX($)){switch(H){case"mutable_atom":$.logger.info("\uD83D\uDCE2",H,Q,"is now (",U,") subscribers:",Z.subscribers.keys());break;case"atom":case"writable_pure_selector":case"writable_held_selector":$.logger.info("\uD83D\uDCE2",H,Q,"went (",Y,"->",U,") subscribers:",Z.subscribers.keys())}Z.next(V)}if(y6($)&&(H==="mutable_atom"||H==="atom")){if($.on.transactionApplying.state===null){if(BW(U))return;let{timestamp:O}=$.operation,w={type:"atom_update",token:W,timestamp:O,update:V};$.transactionMeta.update.subEvents.push(w),$.logger.info("\uD83D\uDCC1","atom",Q,"stowed (",Y,"->",U,")");return}if(VF(X,"tracker:signal")){let O=Q.slice(1),w=$.atoms.get(O);if(s2($,w,"mut").do(V.newValue)===null===!0)kW($,w)}}}var SW=Symbol("OWN_OP"),pj=Symbol("JOIN_OP");function fW($,X,...Y){let U,G,z,W,Q,Z;if(Y.length===2){if(z=Y[0],Z=Y[1],"family"in z)if(W=bW($,z),Q=E6(z.family.subKey),U=t9($,W,Q),!U)z=G=n9($,W,Q,o9);else z=U}else if(W=_4($,Y[0]),Q=Y[1],Z=Y[2],U=t9($,W,Q),!U)z=G=n9($,W,Q,o9);else z=U;let H=Z===xW?"reset":"set",V;if(X===SW){let E=aN($,z);if(typeof E==="number"){let J=E,A=$.on.operationClose.subscribe(`waiting to ${H} "${z.key}" at T-${J}`,function L(){A(),$.logger.info("\uD83D\uDFE2",z.type,z.key,"resuming deferred",H,`from T-${J}`),fW($,X,z,Z)});return}V=E}else V=$;if("counterfeit"in z&&"family"in z){let E=z.family.subKey,F=$.disposalTraces.buffer.find((J)=>J?.key===E);$.logger.error("\u274C",z.type,z.key,"could not be",H,"because key",E,"is not allocated.",F?`this key was previously disposed:${F.trace}`:"(no previous disposal trace found)");return}let O=_4(V,z),w;if(Z===xW)w=Cj(V,O);else w=jj(V,O,Z);let D=Boolean(G);if(zF(V,O,w,D,W),X===SW)sN(V)}var WF=($,X)=>j$($).atoms.has(X),dj=($,X)=>j$($).writableSelectors.has(X),lj=($,X)=>j$($).readonlySelectors.has(X),rj=($,X)=>WF($,X)||dj($,X)||lj($,X);function rN($,X){return j$($).selectorGraph.getRelationEntries({downstreamSelectorKey:X}).filter(([U,{source:G}])=>G!==X).map(([U,{source:G}])=>G).filter((U)=>rj($,U))}function P5($,X,Y=new Set){let U=rN($,X),G=new Map;while(U.length>0){let z=U.pop();if(Y.has(z))continue;if(Y.add(z),WF($,z)){let W=$.atoms.get(z);G.set(W.key,W)}else U.push(...rN($,z))}return G}function ij($,X,Y,U,G){let z=j$($),{type:W,key:Q}=U;if(W==="atom"||W==="mutable_atom")z.selectorAtoms.set({selectorKey:Y,atomKey:Q}),$.logger.info("\uD83D\uDD0D",X,Y,`discovers root atom "${Q}"`);else{let Z=P5($,Q,G);$.logger.info("\uD83D\uDD0D",X,Y,`discovers root atoms: [ ${[...Z.values()].map((H)=>`"${H.key}"`).join(", ")} ]`);for(let{key:H}of Z.values())z.selectorAtoms=z.selectorAtoms.set({selectorKey:Y,atomKey:H})}G.add(Q)}function S5($,X,Y,U){return{get:(...G)=>{let z=j$($),{token:W,family:Q,subKey:Z}=cW($,...G),H;if("counterfeit"in W&&Q&&Z)H=tN($,W,Q,Z);else{let V=_4($,W);H=s2($,V)}return $.logger.info("\uD83D\uDD0C",X,Y,`registers dependency ( "${W.key}" =`,H,")"),z.selectorGraph.set({upstreamSelectorKey:W.key,downstreamSelectorKey:Y},{source:W.key}),ij($,X,Y,W,U),H},set:(...G)=>{let z=j$($);fW(z,pj,...G)},find:(...G)=>K4($,...G),json:(G)=>e2($,G)}}function hW($,X,Y){let U=j$($),G=new g$,z=new Set,{key:W,const:Q}=X,Z="readonly_held_selector";$.logger.info("\uD83D\uDD28","readonly_held_selector",W,"is being created");let{get:H,find:V,json:O}=S5(U,"readonly_held_selector",W,z),D={...X,type:"readonly_held_selector",subject:G,getFrom:(F)=>{let J=F.selectorGraph.getRelationEntries({downstreamSelectorKey:W});for(let[A,{source:L}]of J)if(L!==W)F.selectorGraph.delete(A,W);return F.selectorAtoms.delete(W),X.get({get:H,find:V,json:O},Q),g6(F,D,Q),$.logger.info("\u2728","readonly_held_selector",W,"=",Q),z.clear(),Q},install:(F)=>hW(F,X,Y)};if(Y)D.family=Y;U.readonlySelectors.set(W,D);let E={key:W,type:"readonly_held_selector"};if(Y)E.family=Y;return E}function gW($,X,Y){let U=j$($),G=new g$,z=new Set,W=X.key,Q="readonly_pure_selector";$.logger.info("\uD83D\uDD28","readonly_pure_selector",W,"is being created");let{get:Z,find:H,json:V}=S5(U,"readonly_pure_selector",W,z),w={...X,type:"readonly_pure_selector",subject:G,getFrom:()=>{let E=j$($),F=E.selectorGraph.getRelationEntries({downstreamSelectorKey:W});for(let[L,{source:T}]of F)if(T!==W)E.selectorGraph.delete(L,W);E.selectorAtoms.delete(W);let J=X.get({get:Z,find:H,json:V}),A=g6(E,w,J);return $.logger.info("\u2728","readonly_pure_selector",W,"=",A),z.clear(),A},install:(E)=>gW(E,X,Y)};if(Y)w.family=Y;U.readonlySelectors.set(W,w);let D={key:W,type:"readonly_pure_selector"};if(Y)D.family=Y;return D}function yW($,X,Y){let U=j$($),G=new g$,z=new Set,{key:W,const:Q}=X,Z="writable_held_selector";$.logger.info("\uD83D\uDD28","writable_held_selector",W,"is being created");let H=S5(U,"writable_held_selector",W,z),{find:V,get:O,json:w}=H,D={find:V,get:O,json:w},J={...X,type:"writable_held_selector",subject:G,getFrom:(L)=>{let T=L.selectorGraph.getRelationEntries({downstreamSelectorKey:W});for(let[q,{source:v}]of T)if(v!==W)L.selectorGraph.delete(q,W);return L.selectorAtoms.delete(W),X.get(D,Q),g6(L,J,Q),$.logger.info("\u2728","writable_held_selector",W,"=",Q),z.clear(),Q},setSelf:()=>{X.set(H,Q)},install:(L)=>yW(L,X,Y)};if(Y)J.family=Y;U.writableSelectors.set(W,J);let A={key:W,type:"writable_held_selector"};if(Y)A.family=Y;return A}function mW($,X,Y){let U=j$($),G=new g$,z=new Set,W=X.key,Q="writable_pure_selector";$.logger.info("\uD83D\uDD28","writable_pure_selector",W,"is being created");let Z=S5(U,"writable_pure_selector",W,z),{find:H,get:V,json:O}=Z,w={find:H,get:V,json:O},F={...X,type:"writable_pure_selector",subject:G,getFrom:(A)=>{let L=A.selectorGraph.getRelationEntries({downstreamSelectorKey:W});for(let[v,{source:I}]of L)if(I!==W)A.selectorGraph.delete(v,W);A.selectorAtoms.delete(W);let T=X.get(w),q=g6(A,F,T);return $.logger.info("\u2728","writable_pure_selector",W,"=",q),z.clear(),q},setSelf:(A)=>{X.set(Z,A)},install:(A)=>mW(A,X,Y)};if(Y)F.family=Y;U.writableSelectors.set(W,F);let J={key:W,type:"writable_pure_selector"};if(Y)J.family=Y;return J}function yN($,X){let Y="set"in X,U="const"in X;if(U&&Y){let z=yW($,X,void 0);return $.on.selectorCreation.next(z),z}if(U){let z=hW($,X,void 0);return $.on.selectorCreation.next(z),z}if(Y){let z=mW($,X,void 0);return $.on.selectorCreation.next(z),z}let G=gW($,X,void 0);return $.on.selectorCreation.next(G),G}function oj($,X){let Y=j$($),{key:U,type:G,family:z}=X;if(!z)$.logger.error("\u274C",G,U,"Standalone selectors cannot be disposed.");else{if(Y.molecules.get(z.subKey))Y.moleculeData.delete(z.subKey,z.key);let Q;switch(X.type){case"writable_held_selector":Y.writableSelectors.delete(U),Q={key:z.key,type:"writable_held_selector_family"},_4($,Q).subject.next({type:"state_disposal",subType:"selector",token:X,timestamp:Date.now()});break;case"writable_pure_selector":Y.writableSelectors.delete(U),Q={key:z.key,type:"writable_pure_selector_family"},_4($,Q).subject.next({type:"state_disposal",subType:"selector",token:X,timestamp:Date.now()});break;case"readonly_held_selector":Y.readonlySelectors.delete(U),Q={key:z.key,type:"readonly_held_selector_family"},_4($,Q).subject.next({type:"state_disposal",subType:"selector",token:X,timestamp:Date.now()});break;case"readonly_pure_selector":Y.readonlySelectors.delete(U),Q={key:z.key,type:"readonly_pure_selector_family"},_4($,Q).subject.next({type:"state_disposal",subType:"selector",token:X,timestamp:Date.now()});break}if(Y.valueMap.delete(U),Y.selectorAtoms.delete(U),Y.selectorGraph.delete(U),Y.moleculeData.delete(z.key,z.subKey),$.logger.info("\uD83D\uDD25",X.type,U,"deleted"),y6(Y)&&Y.transactionMeta.phase==="building")Y.transactionMeta.update.subEvents.push({type:"state_disposal",subType:"selector",token:X,timestamp:Date.now()});else $.on.selectorDisposal.next(X)}}function a2($,X,Y){let U=X.key,G="readonly_pure_selector_family",z={key:U,type:"readonly_pure_selector_family"},W=$.families.get(U);if(W)$.logger.error("\u2757","readonly_pure_selector_family",U,`Overwriting an existing ${A0[W.type]} "${W.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let Q=new g$,H={...z,create:(V)=>{let O=p$(V),w={key:U,subKey:O},D=`${U}(${O})`,E=j$($),F={key:D,get:X.get(V)};if(X.catch)F.catch=X.catch;return gW(E,F,w)},internalRoles:Y,subject:Q,install:(V)=>a2(V,X),default:(V)=>{return X.get(V)({get:(...w)=>L1($,...w),find:(...w)=>K4($,...w),json:(w)=>e2($,w)})}};return $.families.set(U,H),z}function XX($,X,Y){let U={key:X.key,type:"atom_family"},G=$.families.get(X.key);if(G)$.logger.error("\u2757","atom_family",X.key,`Overwriting an existing ${A0[G.type]} "${G.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let z=new g$,Q={...U,create:(Z)=>{let H=p$(Z),V={key:X.key,subKey:H},O=`${X.key}(${H})`,w=j$($),D=X.default,E={key:O,default:i9(D)?()=>D(Z):D};if(X.effects)E.effects=X.effects(Z);if(X.catch)E.catch=X.catch;return t2(w,E,V)},default:X.default,subject:z,install:(Z)=>XX(Z,X),internalRoles:Y};if($.families.set(X.key,Q),i9(X.default)===!1)$.defaults.set(X.key,X.default);return U}function QF($,X,Y){let U=X.key,G="readonly_held_selector_family",z={key:U,type:"readonly_held_selector_family"},W=$.families.get(U);if(W)$.logger.error("\u2757","readonly_held_selector_family",U,`Overwriting an existing ${A0[W.type]} "${W.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let Q=new g$,H={...z,create:(V)=>{let O=p$(V),w={key:U,subKey:O},D=`${U}(${O})`,E=j$($);return hW(E,{key:D,const:X.const(V),get:X.get(V)},w)},internalRoles:Y,subject:Q,install:(V)=>QF(V,X),default:X.const};return $.families.set(U,H),z}function ZF($,X,Y){let U=X.key,G="writable_held_selector_family",z={key:U,type:"writable_held_selector_family"},W=$.families.get(U);if(W)$.logger.error("\u2757","writable_held_selector_family",U,`Overwriting an existing ${A0[W.type]} "${W.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let Q=new g$,H={...z,create:(V)=>{let O=p$(V),w={key:U,subKey:O},D=`${U}(${O})`,E=j$($);return yW(E,{key:D,const:X.const(V),get:X.get(V),set:X.set(V)},w)},internalRoles:Y,subject:Q,install:(V)=>ZF(V,X),default:X.const};return $.families.set(U,H),z}function uW($,X,Y){let U=X.key,G="writable_pure_selector_family",z={key:U,type:"writable_pure_selector_family"},W=$.families.get(U);if(W)$.logger.error("\u2757","writable_pure_selector_family",U,`Overwriting an existing ${A0[W.type]} "${W.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let Q=new g$,H={...z,create:(V)=>{let O=p$(V),w={key:U,subKey:O},D=`${U}(${O})`,E=j$($),F={key:D,get:X.get(V),set:X.set(V)};if(X.catch)F.catch=X.catch;return mW(E,F,w)},internalRoles:Y,subject:Q,install:(V)=>uW(V,X),default:(V)=>{return X.get(V)({get:(...w)=>L1($,...w),find:(...w)=>K4($,...w),json:(w)=>e2($,w)})}};return $.families.set(U,H),z}function vW($,X){let Y="set"in X,U="const"in X;if(U&&Y)return ZF($,X,void 0);if(U)return QF($,X,void 0);if(Y)return uW($,X);return a2($,X)}function t9($,X,Y){let U=p$(Y),G=`${X.key}(${U})`,z=j$($),W;switch(X.type){case"atom_family":case"mutable_atom_family":W=z.atoms.get(G);break;case"writable_held_selector_family":case"writable_pure_selector_family":W=z.writableSelectors.get(G);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":W=z.readonlySelectors.get(G);break}if(W)return h1(W);return W}function K4($,X,Y){let U=_4($,X),G=t9($,X,Y);if(G)return G;return n9($,U,Y)}function l9($,...X){let Y;if(X.length===1)Y=X[0];else{let U=X[0],G=X[1];Y=K4($,U,G)}try{_4($,Y)}catch(U){$.logger.error("\u274C",Y.type,Y.key,`could not be disposed because it was not found in the store "${$.config.name}".`);return}switch(Y.type){case"atom":case"mutable_atom":HF($,Y);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":oj($,Y);break}}function cW($,...X){let Y,U,G,z,W;if(X.length===1){if(W=X[0],"family"in W){let H=bW($,W);if(G=_4($,H),z=E6(W.family.subKey),Y=t9($,H,z),"counterfeit"in W)return{token:W,family:G,subKey:z,isNew:!1};if(!Y)U=n9($,H,z,o9),W=U;else W=Y}}else if(G=_4($,X[0]),z=X[1],Y=t9($,G,z),!Y)U=n9($,G,z,o9),W=U;else W=Y;let Q="counterfeit"in W;if(Boolean(U)&&Q===!1&&G){let H;switch(W.type){case"readonly_pure_selector":case"readonly_held_selector":H="readable";break;case"atom":case"mutable_atom":case"writable_pure_selector":case"writable_held_selector":H="writable";break}let V={type:"state_creation",subType:H,token:W,timestamp:Date.now()};G.subject.next(V);let w=j$($);if(W.family){if(YX(w))switch(W.type){case"atom":case"mutable_atom":$.on.atomCreation.next(W);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":$.on.selectorCreation.next(W);break}else if(y6(w)&&w.on.transactionApplying.state===null)w.transactionMeta.update.subEvents.push(V)}}return{token:W,family:G,subKey:z,isNew:Boolean(U)}}function L1($,...X){let{token:Y,family:U,subKey:G}=cW($,...X);if("counterfeit"in Y&&U&&G)return tN($,Y,U,G);let z=_4($,Y);return s2($,z)}var iN=($,X,Y)=>{return Y.subject.subscribe(`${X.type}:${X.key}`,(U)=>{$.logger.info("\uD83D\uDCE2",X.type,X.key,"root",Y.key,"went",U.oldValue,"->",U.newValue);let G=qj($,X),z=s2($,X);$.logger.info("\u2728",X.type,X.key,"went",G,"->",z),X.subject.next({newValue:z,oldValue:G})})};function a9($,X,Y,U){function G(O){if($.operation.open){let w=$.on.operationClose.subscribe(`state subscription ${Y}`,()=>{w(),U(O)})}else U(O)}cW($,X);let z=_4($,X);$.logger.info("\uD83D\uDC40",z.type,z.key,`Adding subscription "${Y}"`);let W=z.type==="writable_pure_selector"||z.type==="readonly_pure_selector",Q=new Map,Z=G;if(W){s2($,z);for(let[O,w]of P5($,z.key))Q.set(O,iN($,z,w));Z=function O(w){let D=P5($,z.key);for(let[E,F]of Q)if(D.get(E))D.delete(E);else F(),Q.delete(E);for(let[E,F]of D)Q.set(E,iN($,z,F));G(w)}}let H=z.subject.subscribe(Y,Z);return()=>{$.logger.info("\uD83D\uDE48",z.type,z.key,`Removing subscription "${Y}"`),H();for(let O of Q.values())O()}}function _4($,X){let Y,U=$;while(U!==null){switch(X.type){case"atom":case"mutable_atom":Y=U.atoms.get(X.key);break;case"writable_pure_selector":case"writable_held_selector":Y=U.writableSelectors.get(X.key);break;case"readonly_pure_selector":case"readonly_held_selector":Y=U.readonlySelectors.get(X.key);break;case"atom_family":case"mutable_atom_family":case"writable_pure_selector_family":case"readonly_pure_selector_family":case"writable_held_selector_family":case"readonly_held_selector_family":Y=U.families.get(X.key);break;case"timeline":Y=U.timelines.get(X.key);break;case"transaction":Y=U.transactions.get(X.key);break}if(Y)return Y;U=U.child}throw new aj(X,$)}var nj=($,X,Y,U)=>{let G=_4($,X);$.logger.info("\uD83D\uDC40","timeline",X.key,`Adding subscription "${Y}"`);let z=G.subject.subscribe(Y,U);return()=>{$.logger.info("\uD83D\uDE48","timeline",X.key,`Removing subscription "${Y}" from timeline`),z()}};var pW=class{initializeSignalAtom($,X){let Y=`*${$.key}`;X.atoms.delete(Y),X.valueMap.delete(Y);let U=$.family?{key:`*${$.family.key}`,subKey:$.family.subKey}:void 0,G=t2(X,{key:Y,default:null},U,["tracker:signal"]);if(X.parent?.valueMap.has(Y)){let z=X.parent.valueMap.get(Y);X.valueMap.set(Y,z)}return G}unsubscribeFromInnerValue;unsubscribeFromState;captureSignalsFromCore($,X,Y){let U=$.key,G=Y.config.name,z=y6(Y)?Y.transactionMeta.update.token.key:"main",W=`tracker:${G}:${z}:${U}`,Q=(H)=>{A1(Y,X,H)},Z=L1(Y,$);this.unsubscribeFromInnerValue=Z.subscribe(W,Q),this.unsubscribeFromState=a9(Y,$,W,function H(V){if(V.newValue!==V.oldValue)this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=V.newValue.subscribe(W,Q)}.bind(this))}supplySignalsToCore($,X,Y){let U=`tracker:${Y.config.name}:${y6(Y)?Y.transactionMeta.update.token.key:"main"}:${$.key}`;a9(Y,X,U,function G({newValue:z,oldValue:W}){let Q=Y.timelineTopics.getRelatedKey(X.key);if(Q&&Y.timelines.get(Q)?.timeTraveling){let O=nj(Y,{key:Q,type:"timeline"},U,function w(D){O(),A1(Y,$,(E)=>{if(D==="redo"&&z)E.do(z);else if(D==="undo"&&W)E.undo(W);return E})});return}let Z=L1(Y,$),H=Z.getUpdateNumber(z),V=H-Z.cacheUpdateNumber;if(z&&V===1)A1(Y,$,(O)=>(O.do(z),O));else{let O=Z.cacheUpdateNumber+1;Y.logger.info("\u274C","mutable_atom",$.key,"could not be updated. Expected update number",O,"but got",H)}})}mutableAtomToken;latestSignalToken;[Symbol.dispose];constructor($,X){let Y=j$(X),U=this.initializeSignalAtom($,Y);this.mutableAtomToken=$,this.latestSignalToken=U,this.captureSignalsFromCore($,U,Y),this.supplySignalsToCore($,U,Y),Y.trackers.set($.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),Y.trackers.delete($.key)}}};function j5($,X,Y){$.logger.info("\uD83D\uDD28","atom",X.key,`creating in store "${$.config.name}"`);let U=j$($),{key:G}=X,z=U.atoms.get(G),W="mutable_atom";if(z&&z.type===W)return $.logger.error("\u274C",W,G,"Tried to create atom, but it already exists in the store."),h1(z);let Q=new g$,Z={...X,type:W,install:(V)=>{return V.logger.info("\uD83D\uDEE0\uFE0F","atom",G,`installing in store "${V.config.name}"`),j5(V,X,Y)},subject:Q};if(Y)Z.family=Y;U.atoms.set(Z.key,Z);let H=h1(Z);if(X.effects){let V=0,O=[];for(let w of X.effects){let D=w({resetSelf:()=>{C5($,H)},setSelf:(E)=>{A1($,H,E)},onSet:(E)=>a9($,H,`effect[${V}]`,E)});if(D)O.push(D);++V}Z.cleanup=()=>{for(let w of O)w()}}if(new pW(H,$),!Y)yN($,{key:`${G}:JSON`,get:({get:V})=>V(H).toJSON(),set:({set:V},O)=>{V(H,X.class.fromJSON(O))}});return $.on.atomCreation.next(H),H}var tj=class{trackers=new Map;latestSignalAtoms;mutableAtoms;constructor($,X){let Y=XX(X,{key:`*${$.key}`,default:null},["mutable","updates"]);this.latestSignalAtoms=_4(X,Y),this.mutableAtoms=$;let U=(G)=>{let{type:z,token:W}=G;if(W.family){let Q=E6(W.family.subKey);switch(z){case"state_creation":this.trackers.set(Q,new pW(W,X));break;case"state_disposal":{let Z=this.trackers.get(Q);if(Z)Z[Symbol.dispose](),this.trackers.delete(Q)}}}};this.mutableAtoms.subject.subscribe(`store=${X.config.name}::tracker-atom-family`,U)}};function CW($,X,Y){let U={key:X.key,type:"mutable_atom_family"},G=$.families.get(X.key);if(G)$.logger.error("\u2757","mutable_atom_family",X.key,`Overwriting an existing ${A0[G.type]} "${G.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let z=new g$,Q={...U,create:(Z)=>{let H=p$(Z),V={key:X.key,subKey:H},O=`${X.key}(${H})`,w=j$($),D={key:O,class:X.class};if(X.effects)D.effects=X.effects(Z);return j5(w,D,V)},class:X.class,subject:z,install:(Z)=>CW(Z,X),internalRoles:Y};return $.families.set(X.key,Q),uW($,{key:`${X.key}:JSON`,get:(Z)=>({get:H})=>H(U,Z).toJSON(),set:(Z)=>({set:H},V)=>{H(U,Z,X.class.fromJSON(V))}},["mutable","json"]),new tj(Q,$),U}var oN=($,X)=>{let Y=j$(X),U=`${$.key}:JSON`;return Y.families.get(U)},e2=($,X)=>{if(X.family){let U=j$($),z={key:`${X.family.key}:JSON`,type:"writable_pure_selector_family"},W=_4(U,z),Q=E6(X.family.subKey);return K4($,W,Q)}return{type:"writable_pure_selector",key:`${X.key}:JSON`}};var dW=($)=>{let Y={type:"atom",key:`*${$.key}`};if($.family)Y.family={key:`*${$.family.key}`,subKey:$.family.subKey};return Y};function BW($){return typeof $==="object"&&$!==null&&"do"in $&&"undo"in $&&"subscribe"in $&&"cacheUpdateNumber"in $&&"getUpdateNumber"in $&&"READONLY_VIEW"in $&&"toJSON"in $}var mN=class{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;writableSelectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new K0({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new K0({between:["upstreamSelectorKey","downstreamSelectorKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});trackers=new Map;families=new Map;joins=new Map;transactions=new Map;transactionMeta={epoch:new Map,actionContinuities:new K0({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new K0({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new Jj(100);molecules=new Map;moleculeJoins=new K0({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});moleculeGraph=new K0({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});moleculeData=new K0({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});miscResources=new Map;on={atomCreation:new g$,atomDisposal:new g$,selectorCreation:new g$,selectorDisposal:new g$,timelineCreation:new g$,transactionCreation:new g$,transactionApplying:new _j(null),operationClose:new g$,moleculeCreation:new g$,moleculeDisposal:new g$};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new kN("warn",($,X,Y)=>!GX(Y))];logger={error:(...$)=>{for(let X of this.loggers)X.error(...$)},info:(...$)=>{for(let X of this.loggers)X.info(...$)},warn:(...$)=>{for(let X of this.loggers)X.warn(...$)}};constructor($,X=null){if(this.config={...X?.config,...$},X!==null){if(this.operation={...X?.operation},YX(X))this.transactionMeta={epoch:new Map(X?.transactionMeta.epoch),actionContinuities:new K0(X?.transactionMeta.actionContinuities.toJSON())};for(let[,U]of X.families){if(U.internalRoles?.includes("mutable")||U.internalRoles?.includes("join"))continue;U.install(this)}let Y=new Set;for(let[,U]of X.atoms){if(Y.has(U.key))continue;if(U.install(this),U.type==="mutable_atom"){let G=e2(X,U),z=dW(U);Y.add(G.key),Y.add(z.key)}}for(let[,U]of X.readonlySelectors)U.install(this);for(let[,U]of X.writableSelectors){if(Y.has(U.key))continue;U.install(this)}for(let[,U]of X.transactions)U.install(this);for(let[,U]of X.timelines)U.install(this)}}},N6={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new mN({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function t2($,X,Y,U){let{key:z}=X;$.logger.info("\uD83D\uDD28","atom",z,"is being created");let W=j$($),Q=W.atoms.get(z);if(Q&&Q.type==="atom")return $.logger.error("\u274C","atom",z,"Tried to create atom, but it already exists in the store."),h1(Q);let Z=new g$,H={...X,type:"atom",install:(O)=>{return O.logger.info("\uD83D\uDEE0\uFE0F","atom",z,`installing in store "${O.config.name}"`),t2(O,X,Y)},subject:Z};if(Y)H.family=Y;if(U)H.internalRoles=U;W.atoms.set(z,H);let V=h1(H);if(X.effects){let O=0,w=[];for(let D of X.effects){let E=D({resetSelf:()=>{C5($,V)},setSelf:(F)=>{A1($,V,F)},onSet:(F)=>a9($,V,`effect[${O}]`,F)});if(E)w.push(E);++O}H.cleanup=()=>{for(let D of w)D()}}return $.on.atomCreation.next(V),V}function HF($,X){let Y=j$($),{key:U,family:G}=X,z=_4(Y,X);if(!G)$.logger.error("\u274C","atom",U,"Standalone atoms cannot be disposed.");else{z.cleanup?.();let W=$.valueMap.get(z.key),Q=bW($,X),H=_4($,Q).subject,V={type:"state_disposal",subType:"atom",token:X,value:W,timestamp:Date.now()};H.next(V);let O=y6(Y);if(Y.atoms.delete(U),Y.valueMap.delete(U),Y.selectorAtoms.delete(U),Y.atomsThatAreDefault.delete(U),Y.moleculeData.delete(G.key,G.subKey),$.timelineTopics.delete(U),X.type==="mutable_atom"){let w=dW(X);HF($,w),$.trackers.delete(U)}if($.logger.info("\uD83D\uDD25","atom",U,"deleted"),O&&Y.transactionMeta.phase==="building"){let w=Y.transactionMeta.update.subEvents.at(-1),E=w?.type==="molecule_disposal"&&w.values.some(([J])=>J===z.family?.key),F=VF(z,"tracker:signal");if(!E&&!F)Y.transactionMeta.update.subEvents.push(V)}else $.on.atomDisposal.next(X)}}function VF($,X){if("internalRoles"in $===!1)return!1;return $.internalRoles.includes(X)}function H4($){return $[0].toUpperCase()+$.slice(1)}var OF=class{toolkit;options;defaultContent;relations;states;core;transact($,X){let Y=this.toolkit;this.toolkit=$,X(this),this.toolkit=Y}store;realm;[Symbol.dispose](){}constructor($,X,Y=N6.STORE){this.store=Y,this.realm=new bN(Y),this.options=$,this.defaultContent=X,this.store.miscResources.set(`join:${$.key}`,this),this.realm.allocate("root",$.key),this.toolkit={get:(...q)=>L1(Y,...q),set:(...q)=>{A1(Y,...q)},find:(...q)=>K4(Y,...q),json:(q)=>e2(Y,q)};let U=$.between[0],G=$.between[1],z=CW(Y,{key:`${$.key}/relatedKeys`,class:L0},["join","relations"]);this.core={relatedKeysAtoms:z};let W=({get:q},v)=>q(z,v),Q=({set:q},v,I)=>{if(!this.store.molecules.has(p$(v)))this.realm.allocate($.key,v);q(z,v,(S)=>S.add(I)),q(z,I,(S)=>S.add(v))},Z=({set:q},v,I)=>{q(z,v,(j)=>{return j.delete(I),j}),q(z,I,(j)=>{return j.delete(v),j});let[S,y]=[v,I].sort(),r=`${S}:${y}`;this.store.moleculeJoins.delete(r)},H=(q,v,I)=>{let{find:S,get:y,set:r}=q,j=S(z,v),X$=y(j);for(let l of X$){if(I.includes(l))continue;r(z,l,(L$)=>{return L$.delete(v),L$})}r(j,(l)=>{return l.transaction((W$)=>{W$.clear();for(let L$ of I){let b$=W(q,L$),L4=b$.has(v);if(this.relations.cardinality==="1:n"){let X6=[];for(let c of b$){if(c===v)continue;let H$=W(q,c);if(H$.delete(L$),H$.size===0)X6.push(c)}if(!L4&&b$.size>0)b$.clear();for(let c of X6){let[H$,f$]=[L$,c].sort(),n$=`${H$}:${f$}`;Y.moleculeJoins.delete(n$)}}if(!L4)b$.add(v);W$.add(L$)}return!0}),l})},V=(q,v,I)=>{let{set:S}=q;S(z,v,(y)=>{return y.transaction((r)=>{for(let j of I)r.add(j);return!0}),y});for(let y of I)S(z,y,(r)=>{return r.add(v),r});return!0},O=(q,v,I)=>{let S=W(q,v);return I?S.has(I):S.size>0},w={getRelatedKeys:(q)=>W(this.toolkit,q),addRelation:(q,v)=>{this.store.moleculeJoins.set(`"${q}"`,$.key),this.store.moleculeJoins.set(`"${v}"`,$.key),Q(this.toolkit,q,v)},deleteRelation:(q,v)=>{Z(this.toolkit,q,v)},replaceRelationsSafely:(q,v)=>{H(this.toolkit,q,v)},replaceRelationsUnsafely:(q,v)=>{V(this.toolkit,q,v)},has:(q,v)=>O(this.toolkit,q,v)},D,E;if(X){E=XX(Y,{key:`${$.key}/content`,default:X},["join","content"]);let q=({get:S},y)=>S(E,y),v=({set:S},y,r)=>{S(E,y,r)};D=Object.assign(w,{getContent:(S)=>{return q(this.toolkit,S)},setContent:(S,y)=>{v(this.toolkit,S,y)},deleteContent:(S)=>{}})}else D=w;let F=new K0($,{externalStore:D,isAType:$.isAType,isBType:$.isBType,makeContentKey:(...q)=>{let[v,I]=q,[S,y]=q.sort(),r=`${S}:${y}`,j=Y.molecules.get(p$(v)),X$=Y.molecules.get(p$(I));if(!j)this.realm.allocate($.key,v);if(!X$)this.realm.allocate($.key,I);return this.realm.allocate(v,r,"all"),this.realm.claim(I,r),this.store.moleculeJoins.set(r,$.key),r}}),J=()=>a2(Y,{key:`${$.key}/singleRelatedKey`,get:(q)=>({get:v})=>{let I=v(z,q);for(let S of I)return S;return null}},["join","keys"]),A=()=>{return a2(Y,{key:`${$.key}/multipleRelatedKeys`,get:(q)=>({get:v})=>{let I=oN(z,Y);return v(I,q).members}},["join","keys"])},L=()=>a2(Y,{key:`${$.key}/singleRelatedEntry`,get:(q)=>({get:v})=>{let I=v(z,q);for(let S of I){let y=F.isAType?.(q)?q:void 0,r=y===void 0?q:void 0;y??=S,r??=S;let j=F.makeContentKey(y,r),X$=v(E,j);return[S,X$]}return null}},["join","entries"]),T=()=>a2(Y,{key:`${$.key}/multipleRelatedEntries`,get:(q)=>({get:v})=>{let I=oN(z,Y);return v(I,q).members.map((y)=>{let r=F.isAType?.(q)?q:void 0,j=r===void 0?q:void 0;r??=y,j??=y;let X$=F.makeContentKey(r,j),l=v(E,X$);return[y,l]})}},["join","entries"]);switch($.cardinality){case"1:1":{let q=J(),v=`${U}KeyOf${H4(G)}`,I=`${G}KeyOf${H4(U)}`,S={[v]:q,[I]:q},y;if(X){let r=L(),j=`${U}EntryOf${H4(G)}`,X$=`${G}EntryOf${H4(U)}`,l={[j]:r,[X$]:r};y=Object.assign(S,l)}else y=S;this.relations=F,this.states=y;break}case"1:n":{let q=J(),v=A(),I=`${U}KeyOf${H4(G)}`,S=`${G}KeysOf${H4(U)}`,y={[I]:q,[S]:v},r;if(X){let j=L(),X$=T(),l=`${U}EntryOf${H4(G)}`,W$=`${G}EntriesOf${H4(U)}`,L$={[l]:j,[W$]:X$};r=Object.assign(y,L$)}else r=y;this.relations=F,this.states=r;break}case"n:n":{let q=A(),v=`${U}KeysOf${H4(G)}`,I=`${G}KeysOf${H4(U)}`,S={[v]:q,[I]:q},y;if(X){let r=T(),j=`${U}EntriesOf${H4(G)}`,X$=`${G}EntriesOf${H4(U)}`,l={[j]:r,[X$]:r};y=Object.assign(S,l)}else y=S;this.relations=F,this.states=y}}}};function uN($,X,Y){return $.joins.set(X.key,new OF(X,Y,$)),{key:X.key,type:"join",a:X.between[0],b:X.between[1],cardinality:X.cardinality}}function lW($,X){let Y=X.joins.get($.key);if(Y===void 0){let G=N6.STORE.joins.get($.key);if(G===void 0)throw new Error(`Join "${$.key}" not found in store "${X.config.name}"`);let z=Mj(X);Y=new OF(G.options,G.defaultContent,z),X.joins.set($.key,Y)}return Y}function r9($,X,Y){let U=lW($,Y),G=j$(Y);if(y6(G)){let{toolkit:z}=G.transactionMeta;U.transact(z,({relations:W})=>{X(W)})}else X(U.relations)}function cN($,X,Y){let U=lW($,Y),G;switch($.cardinality){case"1:1":{let z=`${$.a}KeyOf${H4($.b)}`,W=`${$.b}KeyOf${H4($.a)}`;G={get[z](){let Z=U.states[z];return K4(Y,Z,X)},get[W](){let Z=U.states[W];return K4(Y,Z,X)}};let Q=`${$.a}EntryOf${H4($.b)}`;if(Q in U.states){let Z=`${$.b}EntryOf${H4($.a)}`;Object.assign(G,{get[Q](){let H=U.states[Q];return K4(Y,H,X)},get[Z](){let H=U.states[Z];return K4(Y,H,X)}})}break}case"1:n":{let z=`${$.a}KeyOf${H4($.b)}`,W=`${$.b}KeysOf${H4($.a)}`;G={get[z](){let Z=U.states[z];return K4(Y,Z,X)},get[W](){let Z=U.states[W];return K4(Y,Z,X)}};let Q=`${$.a}EntryOf${H4($.b)}`;if(Q in U.states){let Z=`${$.b}EntriesOf${H4($.a)}`;Object.assign(G,{get[Q](){let H=U.states[Q];return K4(Y,H,X)},get[Z](){let H=U.states[Z];return K4(Y,H,X)}})}break}case"n:n":{let z=`${$.a}KeysOf${H4($.b)}`,W=`${$.b}KeysOf${H4($.a)}`;G={get[z](){let Z=U.states[z];return K4(Y,Z,X)},get[W](){let Z=U.states[W];return K4(Y,Z,X)}};let Q=`${$.a}EntriesOf${H4($.b)}`;if(Q in U.states){let Z=`${$.b}EntriesOf${H4($.a)}`;Object.assign(G,{get[Q](){let H=U.states[Q];return K4(Y,H,X)},get[Z](){let H=U.states[Z];return K4(Y,H,X)}})}}}return G}function pN($,X){return lW($,X).core.relatedKeysAtoms}var aj=class extends Error{constructor($,X){super(`${A0[$.type]} ${p$($.key)} not found in store "${X.config.name}".`)}};function GX($){return $.startsWith("\uD83D\uDD0D ")}var sj=class extends Map{set($,X){if(this.has($))return console.warn("Tried to set a key that already exists in an InvariantMap",{key:$,value:X}),this;return super.set($,X)}clear(){throw new Error("Cannot clear an InvariantMap")}},Ru=class ${type="continuity";globals=[];actions=[];perspectives=[];key;constructor(X){this.key=X}static existing=new sj;static create(X,Y){let U=new $(X),{type:G,globals:z,actions:W,perspectives:Q}=Y(U),Z={type:G,key:X,globals:z,actions:W,perspectives:Q};return $.existing.set(X,Z),Z}add(...X){switch(X[0].type){case"atom":case"mutable_atom":this.globals.push(...X);break;case"transaction":this.actions.push(...X);break;case"atom_family":case"mutable_atom_family":{let[U,G]=X;this.perspectives.push({type:"realtime_perspective",resourceAtoms:U,viewAtoms:G})}break}return this}};var Tu=$X({key:"usersInRoomIndex",class:L0}),rW=$X({key:"roomIndex",class:L0}),ej={enteredAtEpoch:0},s9=R5({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:($)=>typeof $==="string",isBType:($)=>typeof $==="string"},ej),vu=T5({key:"usersInMyRoomView",get:($)=>({find:X})=>{let Y=SN(s9);return[X(Y,$)]}});import{spawn as $P}from"child_process";var iW=class{listeners;globalListeners;handleEvent($,...X){for(let U of this.globalListeners)U($,...X);let Y=this.listeners.get($);if(Y)for(let U of Y)U(...X)}id="no_id_retrieved";emit;constructor($){this.emit=$,this.listeners=new Map,this.globalListeners=new Set}on($,X){let Y=this.listeners.get($);if(Y)Y.add(X);else this.listeners.set($,new Set([X]));return this}onAny($){return this.globalListeners.add($),this}off($,X){let Y=this.listeners.get($);if(Y)if(X)Y.delete(X);else this.listeners.delete($);return this}offAny($){return this.globalListeners.delete($),this}},XP=class extends iW{incompleteData="";unprocessedEvents=[];incompleteLog="";unprocessedLogs=[];id="#####";process;key;logger;handleLog($){if(Array.isArray($)){let[X,...Y]=$;switch(X){case"i":this.logger.info(...Y);break;case"w":this.logger.warn(...Y);break;case"e":this.logger.error(...Y);break;default:return}}}constructor($,X,Y){super((U,...G)=>{let z=JSON.stringify([U,...G])+"\x03",W=(Q)=>{if(Q.code==="EPIPE")console.error("EPIPE error during write",this.process.stdin);this.process.stdin.removeListener("error",W)};return this.process.stdin.once("error",W),this.process.stdin.write(z),this});if(this.process=$,this.key=X,this.logger=Y??{info:(...U)=>{console.info(this.id,this.key,...U)},warn:(...U)=>{console.warn(this.id,this.key,...U)},error:(...U)=>{console.error(this.id,this.key,...U)}},this.process.stdout.on("data",(U)=>{let G=U.toString();if(G==="ALIVE")return;this.unprocessedEvents.push(...G.split("\x03"));let z=this.unprocessedEvents.shift();this.incompleteData+=z??"";try{if(this.incompleteData.startsWith("error"))console.log("\u2757",this.incompleteData);let W=E6(this.incompleteData);this.handleEvent(...W);while(this.unprocessedEvents.length>0){let Q=this.unprocessedEvents.shift();if(Q){if(this.unprocessedEvents.length===0)this.incompleteData=Q;W=E6(Q),this.handleEvent(...W)}}this.incompleteData=""}catch(W){console.warn("\u26A0\uFE0F----------------\u26A0\uFE0F"),console.warn(this.incompleteData),console.warn("\u26A0\uFE0F----------------\u26A0\uFE0F"),console.error(W)}}),this.process.stderr.on("data",(U)=>{let G=U.toString();this.unprocessedLogs.push(...G.split("\x03"));let z=this.unprocessedLogs.shift();this.incompleteLog+=z??"";try{let W=E6(this.incompleteLog);this.handleLog(W);while(this.unprocessedLogs.length>0)if(this.incompleteLog=this.unprocessedLogs.shift()??"",this.incompleteLog)W=E6(this.incompleteLog),this.handleLog(W)}catch(W){console.error("\u274C\u274C\u274C"),console.error(this.incompleteLog),console.error(W),console.error("\u274C\u274C\u274C\uFE0F")}}),$.pid)this.id=$.pid.toString()}},YP=class extends iW{in;out;id="no_id_retrieved";disposalFunctions=[];constructor($){super((...X)=>{return this.out.next(X),this});this.id=$,this.in=new g$,this.out=new g$,this.in.subscribe("socket",(X)=>{this.handleEvent(...X)})}dispose(){for(let $ of this.disposalFunctions)$()}},wF=class extends iW{incompleteData="";unprocessedEvents=[];relays;relayServices;process;id="#####";log(...$){this.process.stderr.write(p$($.map((X)=>X instanceof L0?`{ ${X.toJSON().members.join(" | ")} }`:X))+"\x03")}logger={info:(...$)=>{this.log("i",...$)},warn:(...$)=>{this.log("w",...$)},error:(...$)=>{this.log("e",...$)}};constructor(){super(($,...X)=>{let Y=JSON.stringify([$,...X]);return this.process.stdout.write(Y+"\x03"),this});if(this.process=process,this.process.stdin.resume(),this.relays=new Map,this.relayServices=[],this.process.stdin.on("data",($)=>{let X=$.toString();this.unprocessedEvents.push(...X.split("\x03"));let Y=this.unprocessedEvents.shift();this.incompleteData+=Y??"";try{let U=E6(this.incompleteData);this.logger.info("\uD83C\uDFB0","received",U),this.handleEvent(...U);while(this.unprocessedEvents.length>0){let G=this.unprocessedEvents.shift();if(G){if(this.unprocessedEvents.length===0)this.incompleteData=G;let z=E6(G);this.handleEvent(...z)}}this.incompleteData=""}catch(U){if(U instanceof Error)this.logger.error("\u2757",U.message,U.cause,U.stack)}}),this.on("exit",()=>{this.logger.info("\uD83D\uDD25",this.id,'received "exit"'),process.exit(0)}),process.on("exit",($)=>{this.logger.info("\uD83D\uDD25",this.id,`exited with code ${$}`)}),process.on("end",()=>{this.logger.info("\uD83D\uDD25",this.id,"ended"),process.exit(0)}),process.on("SIGTERM",()=>{this.logger.error("\uD83D\uDD25",this.id,"terminated"),process.exit(0)}),process.on("SIGINT",()=>{this.logger.error("\uD83D\uDD25",this.id,"interrupted"),process.exit(0)}),process.pid)this.id=process.pid?.toString();this.on("user-joins",($)=>{this.logger.info("\uD83D\uDC64","user",$,"joined");let X=new YP(`user:${$}`);this.relays.set($,X),this.logger.info("\uD83D\uDD17","attaching services:",`[${[...this.relayServices.keys()].join(", ")}]`);for(let Y of this.relayServices){let U=Y(X);if(U)X.disposalFunctions.push(U)}this.on(`user:${$}`,(...Y)=>{X.in.next(Y)}),X.out.subscribe("socket",(Y)=>{this.emit(...Y)})}),this.on("user-leaves",($)=>{let X=this.relays.get($);if(this.off(`relay:${$}`),X)X.dispose(),this.relays.delete($)}),process.stdout.write("ALIVE")}relay($){this.logger.info("\uD83D\uDD17","running relay method"),this.relayServices.push($)}},DF=u9({key:"roomArguments",default:["echo",["Hello World!"]]}),GP=T5({key:"room",get:($)=>async({get:X,find:Y})=>{let U=Y(DF,$),G=X(U),[z,W]=G,Q=await new Promise((Z)=>{let H=$P(z,W,{env:process.env}),V=(O)=>{if(O.toString()==="ALIVE")H.stdout.off("data",V),Z(H)};H.stdout.on("data",V)});return new XP(Q,$)}}),fu=c9({key:"createRoom",do:({get:$,set:X,find:Y},U,G,z)=>{let W=z?[G,z]:[G],Q=Y(DF,U);X(Q,W),X(rW,(V)=>V.add(U));let Z=Y(GP,U);return $(Z)}}),hu=c9({key:"joinRoom",do:($,X,Y,U)=>{let G={enteredAtEpoch:U};return r9(s9,(z)=>{z.set({room:X,user:Y},G)},$.env().store),G}}),gu=c9({key:"leaveRoom",do:($,X,Y)=>{r9(s9,(U)=>{U.delete({room:X,user:Y})},$.env().store)}}),yu=c9({key:"destroyRoom",do:($,X)=>{r9(s9,(Y)=>{Y.delete({room:X})},$.env().store),$.set(rW,(Y)=>(Y.delete(X),Y))}});var mu=u9({key:"redactor",default:{occlude:($)=>$}}),uu=u9({key:"unacknowledgedUpdates",default:()=>[]}),cu=u9({key:"sockets",default:null}),pu=$X({key:"socketsIndex",class:L0}),du=$X({key:"usersIndex",class:L0}),lu=R5({key:"usersOfSockets",between:["user","socket"],cardinality:"1:1",isAType:($)=>$.startsWith("user::"),isBType:($)=>$.startsWith("socket::")});var kU={};D2(kU,{xid:()=>Gx,void:()=>Rx,uuidv7:()=>tI,uuidv6:()=>nI,uuidv4:()=>oI,uuid:()=>iI,url:()=>aI,uppercase:()=>KY,unknown:()=>TU,union:()=>xU,undefined:()=>_x,ulid:()=>Yx,uint64:()=>Lx,uint32:()=>Mx,tuple:()=>Ix,trim:()=>CY,treeifyError:()=>WQ,transform:()=>NO,toUpperCase:()=>jY,toLowerCase:()=>BY,toJSONSchema:()=>bV,templateLiteral:()=>mx,symbol:()=>Kx,superRefine:()=>BM,success:()=>gx,stringbool:()=>dx,stringFormat:()=>Dx,string:()=>dV,strictObject:()=>Bx,startsWith:()=>qY,size:()=>JY,setErrorMap:()=>ox,set:()=>kx,safeParseAsync:()=>pV,safeParse:()=>cV,registry:()=>t5,regexes:()=>G8,regex:()=>AY,refine:()=>CM,record:()=>GM,readonly:()=>KM,property:()=>vV,promise:()=>ux,prettifyError:()=>QQ,preprocess:()=>rx,prefault:()=>EM,positive:()=>_V,pipe:()=>BU,partialRecord:()=>xx,parseAsync:()=>uV,parse:()=>mV,overwrite:()=>v0,optional:()=>vU,object:()=>Cx,number:()=>cF,nullish:()=>hx,nullable:()=>CU,null:()=>iF,normalize:()=>vY,nonpositive:()=>RV,nonoptional:()=>NM,nonnegative:()=>TV,never:()=>jU,negative:()=>qV,nativeEnum:()=>bx,nanoid:()=>eI,nan:()=>yx,multipleOf:()=>W8,minSize:()=>Q8,minLength:()=>N2,mime:()=>TY,maxSize:()=>VX,maxLength:()=>OX,map:()=>Sx,lte:()=>K1,lt:()=>R0,lowercase:()=>LY,looseObject:()=>jx,locales:()=>NY,literal:()=>ZM,length:()=>wX,lazy:()=>RM,ksuid:()=>Ux,keyof:()=>vx,jwt:()=>wx,json:()=>lx,iso:()=>qU,ipv6:()=>Wx,ipv4:()=>zx,intersection:()=>XM,int64:()=>Ax,int32:()=>Fx,int:()=>lV,instanceof:()=>px,includes:()=>_Y,guid:()=>rI,gte:()=>u6,gt:()=>T0,globalRegistry:()=>e1,getErrorMap:()=>nx,function:()=>kV,formatError:()=>HY,float64:()=>Nx,float32:()=>Ex,flattenError:()=>ZY,file:()=>fx,enum:()=>WM,endsWith:()=>RY,emoji:()=>sI,email:()=>lI,e164:()=>Ox,discriminatedUnion:()=>Px,date:()=>Tx,custom:()=>cx,cuid2:()=>Xx,cuid:()=>$x,core:()=>C0,config:()=>v4,coerce:()=>AO,clone:()=>Y1,cidrv6:()=>Zx,cidrv4:()=>Qx,check:()=>vM,catch:()=>JM,boolean:()=>pF,bigint:()=>Jx,base64url:()=>Vx,base64:()=>Hx,array:()=>OO,any:()=>qx,_default:()=>wM,_ZodString:()=>rV,ZodXID:()=>$O,ZodVoid:()=>aF,ZodUnknown:()=>nF,ZodUnion:()=>wO,ZodUndefined:()=>lF,ZodUUID:()=>B0,ZodURL:()=>oV,ZodULID:()=>eV,ZodType:()=>T$,ZodTuple:()=>YM,ZodTransform:()=>EO,ZodTemplateLiteral:()=>_M,ZodSymbol:()=>dF,ZodSuccess:()=>FM,ZodStringFormat:()=>a$,ZodString:()=>xY,ZodSet:()=>zM,ZodRecord:()=>DO,ZodRealError:()=>DX,ZodReadonly:()=>LM,ZodPromise:()=>TM,ZodPrefault:()=>DM,ZodPipe:()=>JO,ZodOptional:()=>FO,ZodObject:()=>IU,ZodNumberFormat:()=>EX,ZodNumber:()=>SY,ZodNullable:()=>VM,ZodNull:()=>rF,ZodNonOptional:()=>MO,ZodNever:()=>tF,ZodNanoID:()=>tV,ZodNaN:()=>AM,ZodMap:()=>UM,ZodLiteral:()=>QM,ZodLazy:()=>qM,ZodKSUID:()=>XO,ZodJWT:()=>HO,ZodIssueCode:()=>ix,ZodIntersection:()=>$M,ZodISOTime:()=>KU,ZodISODuration:()=>_U,ZodISODateTime:()=>AU,ZodISODate:()=>LU,ZodIPv6:()=>GO,ZodIPv4:()=>YO,ZodGUID:()=>RU,ZodFile:()=>HM,ZodError:()=>pI,ZodEnum:()=>IY,ZodEmoji:()=>nV,ZodEmail:()=>iV,ZodE164:()=>ZO,ZodDiscriminatedUnion:()=>eF,ZodDefault:()=>OM,ZodDate:()=>PU,ZodCustomStringFormat:()=>uF,ZodCustom:()=>SU,ZodCatch:()=>MM,ZodCUID2:()=>sV,ZodCUID:()=>aV,ZodCIDRv6:()=>zO,ZodCIDRv4:()=>UO,ZodBoolean:()=>kY,ZodBigIntFormat:()=>VO,ZodBigInt:()=>bY,ZodBase64URL:()=>QO,ZodBase64:()=>WO,ZodArray:()=>sF,ZodAny:()=>oF,TimePrecision:()=>nH,NEVER:()=>oW,$output:()=>lH,$input:()=>rH,$brand:()=>nW});var C0={};D2(C0,{version:()=>GZ,util:()=>n,treeifyError:()=>WQ,toJSONSchema:()=>bV,toDotPath:()=>FF,safeParseAsync:()=>HQ,safeParse:()=>ZQ,registry:()=>t5,regexes:()=>G8,prettifyError:()=>QQ,parseAsync:()=>g5,parse:()=>f5,locales:()=>NY,isValidJWT:()=>kF,isValidBase64URL:()=>SF,isValidBase64:()=>RZ,globalRegistry:()=>e1,globalConfig:()=>e9,function:()=>kV,formatError:()=>HY,flattenError:()=>ZY,config:()=>v4,clone:()=>Y1,_xid:()=>ZU,_void:()=>JV,_uuidv7:()=>XU,_uuidv6:()=>$U,_uuidv4:()=>e5,_uuid:()=>s5,_url:()=>YU,_uppercase:()=>KY,_unknown:()=>HX,_union:()=>KI,_undefined:()=>EV,_ulid:()=>QU,_uint64:()=>wV,_uint32:()=>WV,_tuple:()=>CV,_trim:()=>CY,_transform:()=>PI,_toUpperCase:()=>jY,_toLowerCase:()=>BY,_templateLiteral:()=>yI,_symbol:()=>DV,_success:()=>bI,_stringbool:()=>IV,_stringFormat:()=>xV,_string:()=>iH,_startsWith:()=>qY,_size:()=>JY,_set:()=>vI,_safeParseAsync:()=>m5,_safeParse:()=>y5,_regex:()=>AY,_refine:()=>PV,_record:()=>RI,_readonly:()=>gI,_property:()=>vV,_promise:()=>uI,_positive:()=>_V,_pipe:()=>hI,_parseAsync:()=>h5,_parse:()=>b5,_overwrite:()=>v0,_optional:()=>II,_number:()=>$V,_nullable:()=>xI,_null:()=>NV,_normalize:()=>vY,_nonpositive:()=>RV,_nonoptional:()=>kI,_nonnegative:()=>TV,_never:()=>MV,_negative:()=>qV,_nativeEnum:()=>BI,_nanoid:()=>UU,_nan:()=>KV,_multipleOf:()=>W8,_minSize:()=>Q8,_minLength:()=>N2,_min:()=>u6,_mime:()=>TY,_maxSize:()=>VX,_maxLength:()=>OX,_max:()=>K1,_map:()=>TI,_lte:()=>K1,_lt:()=>R0,_lowercase:()=>LY,_literal:()=>jI,_length:()=>wX,_lazy:()=>mI,_ksuid:()=>HU,_jwt:()=>MU,_isoTime:()=>sH,_isoDuration:()=>eH,_isoDateTime:()=>tH,_isoDate:()=>aH,_ipv6:()=>OU,_ipv4:()=>VU,_intersection:()=>qI,_int64:()=>OV,_int32:()=>zV,_int:()=>YV,_includes:()=>_Y,_guid:()=>MY,_gte:()=>u6,_gt:()=>T0,_float64:()=>UV,_float32:()=>GV,_file:()=>BV,_enum:()=>CI,_endsWith:()=>RY,_emoji:()=>GU,_email:()=>a5,_e164:()=>FU,_discriminatedUnion:()=>_I,_default:()=>SI,_date:()=>AV,_custom:()=>jV,_cuid2:()=>WU,_cuid:()=>zU,_coercedString:()=>oH,_coercedNumber:()=>XV,_coercedDate:()=>LV,_coercedBoolean:()=>ZV,_coercedBigint:()=>VV,_cidrv6:()=>DU,_cidrv4:()=>wU,_catch:()=>fI,_boolean:()=>QV,_bigint:()=>HV,_base64url:()=>NU,_base64:()=>EU,_array:()=>PY,_any:()=>FV,TimePrecision:()=>nH,NEVER:()=>oW,JSONSchemaGenerator:()=>JU,JSONSchema:()=>gF,Doc:()=>d5,$output:()=>lH,$input:()=>rH,$constructor:()=>C,$brand:()=>nW,$ZodXID:()=>EZ,$ZodVoid:()=>hZ,$ZodUnknown:()=>ZX,$ZodUnion:()=>n5,$ZodUndefined:()=>SZ,$ZodUUID:()=>WZ,$ZodURL:()=>ZZ,$ZodULID:()=>DZ,$ZodType:()=>N$,$ZodTuple:()=>z8,$ZodTransform:()=>wY,$ZodTemplateLiteral:()=>GH,$ZodSymbol:()=>xZ,$ZodSuccess:()=>eZ,$ZodStringFormat:()=>l$,$ZodString:()=>U8,$ZodSet:()=>dZ,$ZodRegistry:()=>FY,$ZodRecord:()=>cZ,$ZodRealError:()=>WX,$ZodReadonly:()=>YH,$ZodPromise:()=>UH,$ZodPrefault:()=>aZ,$ZodPipe:()=>DY,$ZodOptional:()=>oZ,$ZodObject:()=>yZ,$ZodNumberFormat:()=>PZ,$ZodNumber:()=>i5,$ZodNullable:()=>nZ,$ZodNull:()=>kZ,$ZodNonOptional:()=>sZ,$ZodNever:()=>fZ,$ZodNanoID:()=>VZ,$ZodNaN:()=>XH,$ZodMap:()=>pZ,$ZodLiteral:()=>rZ,$ZodLazy:()=>zH,$ZodKSUID:()=>NZ,$ZodJWT:()=>BZ,$ZodIntersection:()=>uZ,$ZodISOTime:()=>JZ,$ZodISODuration:()=>AZ,$ZodISODateTime:()=>FZ,$ZodISODate:()=>MZ,$ZodIPv6:()=>KZ,$ZodIPv4:()=>LZ,$ZodGUID:()=>zZ,$ZodFunction:()=>SV,$ZodFile:()=>iZ,$ZodError:()=>QY,$ZodEnum:()=>lZ,$ZodEmoji:()=>HZ,$ZodEmail:()=>QZ,$ZodE164:()=>CZ,$ZodDiscriminatedUnion:()=>mZ,$ZodDefault:()=>tZ,$ZodDate:()=>gZ,$ZodCustomStringFormat:()=>jZ,$ZodCustom:()=>WH,$ZodCheckUpperCase:()=>tQ,$ZodCheckStringFormat:()=>QX,$ZodCheckStartsWith:()=>sQ,$ZodCheckSizeEquals:()=>dQ,$ZodCheckRegex:()=>oQ,$ZodCheckProperty:()=>$Z,$ZodCheckOverwrite:()=>YZ,$ZodCheckNumberFormat:()=>mQ,$ZodCheckMultipleOf:()=>yQ,$ZodCheckMinSize:()=>pQ,$ZodCheckMinLength:()=>rQ,$ZodCheckMimeType:()=>XZ,$ZodCheckMaxSize:()=>cQ,$ZodCheckMaxLength:()=>lQ,$ZodCheckLowerCase:()=>nQ,$ZodCheckLessThan:()=>c5,$ZodCheckLengthEquals:()=>iQ,$ZodCheckIncludes:()=>aQ,$ZodCheckGreaterThan:()=>p5,$ZodCheckEndsWith:()=>eQ,$ZodCheckBigIntFormat:()=>uQ,$ZodCheck:()=>O4,$ZodCatch:()=>$H,$ZodCUID2:()=>wZ,$ZodCUID:()=>OZ,$ZodCIDRv6:()=>qZ,$ZodCIDRv4:()=>_Z,$ZodBoolean:()=>VY,$ZodBigIntFormat:()=>IZ,$ZodBigInt:()=>o5,$ZodBase64URL:()=>vZ,$ZodBase64:()=>TZ,$ZodAsyncError:()=>_0,$ZodArray:()=>OY,$ZodAny:()=>bZ});var oW=Object.freeze({status:"aborted"});function C($,X,Y){function U(Q,Z){var H;Object.defineProperty(Q,"_zod",{value:Q._zod??{},enumerable:!1}),(H=Q._zod).traits??(H.traits=new Set),Q._zod.traits.add($),X(Q,Z);for(let V in W.prototype)if(!(V in Q))Object.defineProperty(Q,V,{value:W.prototype[V].bind(Q)});Q._zod.constr=W,Q._zod.def=Z}let G=Y?.Parent??Object;class z extends G{}Object.defineProperty(z,"name",{value:$});function W(Q){var Z;let H=Y?.Parent?new z:this;U(H,Q),(Z=H._zod).deferred??(Z.deferred=[]);for(let V of H._zod.deferred)V();return H}return Object.defineProperty(W,"init",{value:U}),Object.defineProperty(W,Symbol.hasInstance,{value:(Q)=>{if(Y?.Parent&&Q instanceof Y.Parent)return!0;return Q?._zod?.traits?.has($)}}),Object.defineProperty(W,"name",{value:$}),W}var nW=Symbol("zod_brand");class _0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var e9={};function v4($){if($)Object.assign(e9,$);return e9}var n={};D2(n,{unwrapMessage:()=>$Y,stringifyPrimitive:()=>o,required:()=>LP,randomString:()=>OP,propertyKeyTypes:()=>UY,promiseAllObject:()=>VP,primitiveTypes:()=>XQ,prefixIssues:()=>m6,pick:()=>NP,partial:()=>AP,optionalKeys:()=>YQ,omit:()=>FP,numKeys:()=>wP,nullish:()=>E2,normalizeParams:()=>d,merge:()=>JP,jsonStringifyReplacer:()=>aW,joinValues:()=>h,issue:()=>zQ,isPlainObject:()=>zX,isObject:()=>UX,getSizableOrigin:()=>zY,getParsedType:()=>DP,getLengthableOrigin:()=>WY,getEnumValues:()=>XY,getElementAtPath:()=>HP,floatSafeRemainder:()=>sW,finalizeIssue:()=>G1,extend:()=>MP,escapeRegex:()=>q0,esc:()=>$8,defineLazy:()=>y$,createTransparentProxy:()=>EP,clone:()=>Y1,cleanRegex:()=>GY,cleanEnum:()=>KP,captureStackTrace:()=>k5,cached:()=>YY,assignProp:()=>eW,assertNotEqual:()=>zP,assertNever:()=>QP,assertIs:()=>WP,assertEqual:()=>UP,assert:()=>ZP,allowsEval:()=>$Q,aborted:()=>X8,NUMBER_FORMAT_RANGES:()=>GQ,Class:()=>EF,BIGINT_FORMAT_RANGES:()=>UQ});function UP($){return $}function zP($){return $}function WP($){}function QP($){throw new Error}function ZP($){}function XY($){let X=Object.values($).filter((U)=>typeof U==="number");return Object.entries($).filter(([U,G])=>X.indexOf(+U)===-1).map(([U,G])=>G)}function h($,X="|"){return $.map((Y)=>o(Y)).join(X)}function aW($,X){if(typeof X==="bigint")return X.toString();return X}function YY($){return{get value(){{let Y=$();return Object.defineProperty(this,"value",{value:Y}),Y}throw new Error("cached value already set")}}}function E2($){return $===null||$===void 0}function GY($){let X=$.startsWith("^")?1:0,Y=$.endsWith("$")?$.length-1:$.length;return $.slice(X,Y)}function sW($,X){let Y=($.toString().split(".")[1]||"").length,U=(X.toString().split(".")[1]||"").length,G=Y>U?Y:U,z=Number.parseInt($.toFixed(G).replace(".","")),W=Number.parseInt(X.toFixed(G).replace(".",""));return z%W/10**G}function y$($,X,Y){Object.defineProperty($,X,{get(){{let G=Y();return $[X]=G,G}throw new Error("cached value already set")},set(G){Object.defineProperty($,X,{value:G})},configurable:!0})}function eW($,X,Y){Object.defineProperty($,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function HP($,X){if(!X)return $;return X.reduce((Y,U)=>Y?.[U],$)}function VP($){let X=Object.keys($),Y=X.map((U)=>$[U]);return Promise.all(Y).then((U)=>{let G={};for(let z=0;z<X.length;z++)G[X[z]]=U[z];return G})}function OP($=10){let Y="";for(let U=0;U<$;U++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function $8($){return JSON.stringify($)}var k5=Error.captureStackTrace?Error.captureStackTrace:(...$)=>{};function UX($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var $Q=YY(()=>{if(typeof navigator!=="undefined"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function zX($){if(UX($)===!1)return!1;let X=$.constructor;if(X===void 0)return!0;let Y=X.prototype;if(UX(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function wP($){let X=0;for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))X++;return X}var DP=($)=>{let X=typeof $;switch(X){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN($)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray($))return"array";if($===null)return"null";if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return"promise";if(typeof Map!=="undefined"&&$ instanceof Map)return"map";if(typeof Set!=="undefined"&&$ instanceof Set)return"set";if(typeof Date!=="undefined"&&$ instanceof Date)return"date";if(typeof File!=="undefined"&&$ instanceof File)return"file";return"object";default:throw new Error(`Unknown data type: ${X}`)}},UY=new Set(["string","number","symbol"]),XQ=new Set(["string","number","bigint","boolean","symbol","undefined"]);function q0($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y1($,X,Y){let U=new $._zod.constr(X??$._zod.def);if(!X||Y?.parent)U._zod.parent=$;return U}function d($){let X=$;if(!X)return{};if(typeof X==="string")return{error:()=>X};if(X?.message!==void 0){if(X?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");X.error=X.message}if(delete X.message,typeof X.error==="string")return{...X,error:()=>X.error};return X}function EP($){let X;return new Proxy({},{get(Y,U,G){return X??(X=$()),Reflect.get(X,U,G)},set(Y,U,G,z){return X??(X=$()),Reflect.set(X,U,G,z)},has(Y,U){return X??(X=$()),Reflect.has(X,U)},deleteProperty(Y,U){return X??(X=$()),Reflect.deleteProperty(X,U)},ownKeys(Y){return X??(X=$()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(Y,U){return X??(X=$()),Reflect.getOwnPropertyDescriptor(X,U)},defineProperty(Y,U,G){return X??(X=$()),Reflect.defineProperty(X,U,G)}})}function o($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function YQ($){return Object.keys($).filter((X)=>{return $[X]._zod.optin==="optional"&&$[X]._zod.optout==="optional"})}var GQ={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},UQ={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function NP($,X){let Y={},U=$._zod.def;for(let G in X){if(!(G in U.shape))throw new Error(`Unrecognized key: "${G}"`);if(!X[G])continue;Y[G]=U.shape[G]}return Y1($,{...$._zod.def,shape:Y,checks:[]})}function FP($,X){let Y={...$._zod.def.shape},U=$._zod.def;for(let G in X){if(!(G in U.shape))throw new Error(`Unrecognized key: "${G}"`);if(!X[G])continue;delete Y[G]}return Y1($,{...$._zod.def,shape:Y,checks:[]})}function MP($,X){if(!zX(X))throw new Error("Invalid input to extend: expected a plain object");let Y={...$._zod.def,get shape(){let U={...$._zod.def.shape,...X};return eW(this,"shape",U),U},checks:[]};return Y1($,Y)}function JP($,X){return Y1($,{...$._zod.def,get shape(){let Y={...$._zod.def.shape,...X._zod.def.shape};return eW(this,"shape",Y),Y},catchall:X._zod.def.catchall,checks:[]})}function AP($,X,Y){let U=X._zod.def.shape,G={...U};if(Y)for(let z in Y){if(!(z in U))throw new Error(`Unrecognized key: "${z}"`);if(!Y[z])continue;G[z]=$?new $({type:"optional",innerType:U[z]}):U[z]}else for(let z in U)G[z]=$?new $({type:"optional",innerType:U[z]}):U[z];return Y1(X,{...X._zod.def,shape:G,checks:[]})}function LP($,X,Y){let U=X._zod.def.shape,G={...U};if(Y)for(let z in Y){if(!(z in G))throw new Error(`Unrecognized key: "${z}"`);if(!Y[z])continue;G[z]=new $({type:"nonoptional",innerType:U[z]})}else for(let z in U)G[z]=new $({type:"nonoptional",innerType:U[z]});return Y1(X,{...X._zod.def,shape:G,checks:[]})}function X8($,X=0){for(let Y=X;Y<$.issues.length;Y++)if($.issues[Y]?.continue!==!0)return!0;return!1}function m6($,X){return X.map((Y)=>{var U;return(U=Y).path??(U.path=[]),Y.path.unshift($),Y})}function $Y($){return typeof $==="string"?$:$?.message}function G1($,X,Y){let U={...$,path:$.path??[]};if(!$.message){let G=$Y($.inst?._zod.def?.error?.($))??$Y(X?.error?.($))??$Y(Y.customError?.($))??$Y(Y.localeError?.($))??"Invalid input";U.message=G}if(delete U.inst,delete U.continue,!X?.reportInput)delete U.input;return U}function zY($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function WY($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function zQ(...$){let[X,Y,U]=$;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:U};return{...X}}function KP($){return Object.entries($).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}class EF{constructor(...$){}}var NF=($,X)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:X,enumerable:!1}),Object.defineProperty($,"message",{get(){return JSON.stringify(X,aW,2)},enumerable:!0}),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},QY=C("$ZodError",NF),WX=C("$ZodError",NF,{Parent:Error});function ZY($,X=(Y)=>Y.message){let Y={},U=[];for(let G of $.issues)if(G.path.length>0)Y[G.path[0]]=Y[G.path[0]]||[],Y[G.path[0]].push(X(G));else U.push(X(G));return{formErrors:U,fieldErrors:Y}}function HY($,X){let Y=X||function(z){return z.message},U={_errors:[]},G=(z)=>{for(let W of z.issues)if(W.code==="invalid_union"&&W.errors.length)W.errors.map((Q)=>G({issues:Q}));else if(W.code==="invalid_key")G({issues:W.issues});else if(W.code==="invalid_element")G({issues:W.issues});else if(W.path.length===0)U._errors.push(Y(W));else{let Q=U,Z=0;while(Z<W.path.length){let H=W.path[Z];if(Z!==W.path.length-1)Q[H]=Q[H]||{_errors:[]};else Q[H]=Q[H]||{_errors:[]},Q[H]._errors.push(Y(W));Q=Q[H],Z++}}};return G($),U}function WQ($,X){let Y=X||function(z){return z.message},U={errors:[]},G=(z,W=[])=>{var Q,Z;for(let H of z.issues)if(H.code==="invalid_union"&&H.errors.length)H.errors.map((V)=>G({issues:V},H.path));else if(H.code==="invalid_key")G({issues:H.issues},H.path);else if(H.code==="invalid_element")G({issues:H.issues},H.path);else{let V=[...W,...H.path];if(V.length===0){U.errors.push(Y(H));continue}let O=U,w=0;while(w<V.length){let D=V[w],E=w===V.length-1;if(typeof D==="string")O.properties??(O.properties={}),(Q=O.properties)[D]??(Q[D]={errors:[]}),O=O.properties[D];else O.items??(O.items=[]),(Z=O.items)[D]??(Z[D]={errors:[]}),O=O.items[D];if(E)O.errors.push(Y(H));w++}}};return G($),U}function FF($){let X=[];for(let Y of $)if(typeof Y==="number")X.push(`[${Y}]`);else if(typeof Y==="symbol")X.push(`[${JSON.stringify(String(Y))}]`);else if(/[^\w$]/.test(Y))X.push(`[${JSON.stringify(Y)}]`);else{if(X.length)X.push(".");X.push(Y)}return X.join("")}function QQ($){let X=[],Y=[...$.issues].sort((U,G)=>U.path.length-G.path.length);for(let U of Y)if(X.push(`\u2716 ${U.message}`),U.path?.length)X.push(` \u2192 at ${FF(U.path)}`);return X.join(`
|
|
16
|
+
`)}var b5=($)=>(X,Y,U,G)=>{let z=U?Object.assign(U,{async:!1}):{async:!1},W=X._zod.run({value:Y,issues:[]},z);if(W instanceof Promise)throw new _0;if(W.issues.length){let Q=new(G?.Err??$)(W.issues.map((Z)=>G1(Z,z,v4())));throw k5(Q,G?.callee),Q}return W.value},f5=b5(WX),h5=($)=>async(X,Y,U,G)=>{let z=U?Object.assign(U,{async:!0}):{async:!0},W=X._zod.run({value:Y,issues:[]},z);if(W instanceof Promise)W=await W;if(W.issues.length){let Q=new(G?.Err??$)(W.issues.map((Z)=>G1(Z,z,v4())));throw k5(Q,G?.callee),Q}return W.value},g5=h5(WX),y5=($)=>(X,Y,U)=>{let G=U?{...U,async:!1}:{async:!1},z=X._zod.run({value:Y,issues:[]},G);if(z instanceof Promise)throw new _0;return z.issues.length?{success:!1,error:new($??QY)(z.issues.map((W)=>G1(W,G,v4())))}:{success:!0,data:z.value}},ZQ=y5(WX),m5=($)=>async(X,Y,U)=>{let G=U?Object.assign(U,{async:!0}):{async:!0},z=X._zod.run({value:Y,issues:[]},G);if(z instanceof Promise)z=await z;return z.issues.length?{success:!1,error:new $(z.issues.map((W)=>G1(W,G,v4())))}:{success:!0,data:z.value}},HQ=m5(WX);var G8={};D2(G8,{xid:()=>DQ,uuid7:()=>vP,uuid6:()=>TP,uuid4:()=>RP,uuid:()=>Y8,uppercase:()=>gQ,unicodeEmail:()=>jP,undefined:()=>fQ,ulid:()=>wQ,time:()=>BQ,string:()=>PQ,rfc5322Email:()=>BP,number:()=>SQ,null:()=>bQ,nanoid:()=>NQ,lowercase:()=>hQ,ksuid:()=>EQ,ipv6:()=>KQ,ipv4:()=>LQ,integer:()=>xQ,html5Email:()=>CP,hostname:()=>TQ,guid:()=>MQ,extendedDuration:()=>qP,emoji:()=>AQ,email:()=>JQ,e164:()=>vQ,duration:()=>FQ,domain:()=>xP,datetime:()=>jQ,date:()=>CQ,cuid2:()=>OQ,cuid:()=>VQ,cidrv6:()=>qQ,cidrv4:()=>_Q,browserEmail:()=>PP,boolean:()=>kQ,bigint:()=>IQ,base64url:()=>u5,base64:()=>RQ,_emoji:()=>IP});var VQ=/^[cC][^\s-]{8,}$/,OQ=/^[0-9a-z]+$/,wQ=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,DQ=/^[0-9a-vA-V]{20}$/,EQ=/^[A-Za-z0-9]{27}$/,NQ=/^[a-zA-Z0-9_-]{21}$/,FQ=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qP=/^[-+]?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)?)??$/,MQ=/^([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})$/,Y8=($)=>{if(!$)return/^([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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},RP=Y8(4),TP=Y8(6),vP=Y8(7),JQ=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,CP=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,BP=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,jP=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,PP=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,IP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function AQ(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var LQ=/^(?:(?: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])$/,KQ=/^(([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})$/,_Q=/^((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])$/,qQ=/^(([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])$/,RQ=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,u5=/^[A-Za-z0-9_-]*$/,TQ=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,xP=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,vQ=/^\+(?:[0-9]){6,14}[0-9]$/,MF="(?:(?:\\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])))",CQ=new RegExp(`^${MF}$`);function JF($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function BQ($){return new RegExp(`^${JF($)}$`)}function jQ($){let X=JF({precision:$.precision}),Y=["Z"];if($.local)Y.push("");if($.offset)Y.push("([+-]\\d{2}:\\d{2})");let U=`${X}(?:${Y.join("|")})`;return new RegExp(`^${MF}T(?:${U})$`)}var PQ=($)=>{let X=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)},IQ=/^\d+n?$/,xQ=/^\d+$/,SQ=/^-?\d+(?:\.\d+)?/i,kQ=/true|false/i,bQ=/null/i;var fQ=/undefined/i;var hQ=/^[^A-Z]*$/,gQ=/^[^a-z]*$/;var O4=C("$ZodCheck",($,X)=>{var Y;$._zod??($._zod={}),$._zod.def=X,(Y=$._zod).onattach??(Y.onattach=[])}),LF={number:"number",bigint:"bigint",object:"date"},c5=C("$ZodCheckLessThan",($,X)=>{O4.init($,X);let Y=LF[typeof X.value];$._zod.onattach.push((U)=>{let G=U._zod.bag,z=(X.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<z)if(X.inclusive)G.maximum=X.value;else G.exclusiveMaximum=X.value}),$._zod.check=(U)=>{if(X.inclusive?U.value<=X.value:U.value<X.value)return;U.issues.push({origin:Y,code:"too_big",maximum:X.value,input:U.value,inclusive:X.inclusive,inst:$,continue:!X.abort})}}),p5=C("$ZodCheckGreaterThan",($,X)=>{O4.init($,X);let Y=LF[typeof X.value];$._zod.onattach.push((U)=>{let G=U._zod.bag,z=(X.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>z)if(X.inclusive)G.minimum=X.value;else G.exclusiveMinimum=X.value}),$._zod.check=(U)=>{if(X.inclusive?U.value>=X.value:U.value>X.value)return;U.issues.push({origin:Y,code:"too_small",minimum:X.value,input:U.value,inclusive:X.inclusive,inst:$,continue:!X.abort})}}),yQ=C("$ZodCheckMultipleOf",($,X)=>{O4.init($,X),$._zod.onattach.push((Y)=>{var U;(U=Y._zod.bag).multipleOf??(U.multipleOf=X.value)}),$._zod.check=(Y)=>{if(typeof Y.value!==typeof X.value)throw new Error("Cannot mix number and bigint in multiple_of check.");if(typeof Y.value==="bigint"?Y.value%X.value===BigInt(0):sW(Y.value,X.value)===0)return;Y.issues.push({origin:typeof Y.value,code:"not_multiple_of",divisor:X.value,input:Y.value,inst:$,continue:!X.abort})}}),mQ=C("$ZodCheckNumberFormat",($,X)=>{O4.init($,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),U=Y?"int":"number",[G,z]=GQ[X.format];$._zod.onattach.push((W)=>{let Q=W._zod.bag;if(Q.format=X.format,Q.minimum=G,Q.maximum=z,Y)Q.pattern=xQ}),$._zod.check=(W)=>{let Q=W.value;if(Y){if(!Number.isInteger(Q)){W.issues.push({expected:U,format:X.format,code:"invalid_type",input:Q,inst:$});return}if(!Number.isSafeInteger(Q)){if(Q>0)W.issues.push({input:Q,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:U,continue:!X.abort});else W.issues.push({input:Q,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:U,continue:!X.abort});return}}if(Q<G)W.issues.push({origin:"number",input:Q,code:"too_small",minimum:G,inclusive:!0,inst:$,continue:!X.abort});if(Q>z)W.issues.push({origin:"number",input:Q,code:"too_big",maximum:z,inst:$})}}),uQ=C("$ZodCheckBigIntFormat",($,X)=>{O4.init($,X);let[Y,U]=UQ[X.format];$._zod.onattach.push((G)=>{let z=G._zod.bag;z.format=X.format,z.minimum=Y,z.maximum=U}),$._zod.check=(G)=>{let z=G.value;if(z<Y)G.issues.push({origin:"bigint",input:z,code:"too_small",minimum:Y,inclusive:!0,inst:$,continue:!X.abort});if(z>U)G.issues.push({origin:"bigint",input:z,code:"too_big",maximum:U,inst:$})}}),cQ=C("$ZodCheckMaxSize",($,X)=>{var Y;O4.init($,X),(Y=$._zod.def).when??(Y.when=(U)=>{let G=U.value;return!E2(G)&&G.size!==void 0}),$._zod.onattach.push((U)=>{let G=U._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<G)U._zod.bag.maximum=X.maximum}),$._zod.check=(U)=>{let G=U.value;if(G.size<=X.maximum)return;U.issues.push({origin:zY(G),code:"too_big",maximum:X.maximum,input:G,inst:$,continue:!X.abort})}}),pQ=C("$ZodCheckMinSize",($,X)=>{var Y;O4.init($,X),(Y=$._zod.def).when??(Y.when=(U)=>{let G=U.value;return!E2(G)&&G.size!==void 0}),$._zod.onattach.push((U)=>{let G=U._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>G)U._zod.bag.minimum=X.minimum}),$._zod.check=(U)=>{let G=U.value;if(G.size>=X.minimum)return;U.issues.push({origin:zY(G),code:"too_small",minimum:X.minimum,input:G,inst:$,continue:!X.abort})}}),dQ=C("$ZodCheckSizeEquals",($,X)=>{var Y;O4.init($,X),(Y=$._zod.def).when??(Y.when=(U)=>{let G=U.value;return!E2(G)&&G.size!==void 0}),$._zod.onattach.push((U)=>{let G=U._zod.bag;G.minimum=X.size,G.maximum=X.size,G.size=X.size}),$._zod.check=(U)=>{let G=U.value,z=G.size;if(z===X.size)return;let W=z>X.size;U.issues.push({origin:zY(G),...W?{code:"too_big",maximum:X.size}:{code:"too_small",minimum:X.size},inclusive:!0,exact:!0,input:U.value,inst:$,continue:!X.abort})}}),lQ=C("$ZodCheckMaxLength",($,X)=>{var Y;O4.init($,X),(Y=$._zod.def).when??(Y.when=(U)=>{let G=U.value;return!E2(G)&&G.length!==void 0}),$._zod.onattach.push((U)=>{let G=U._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<G)U._zod.bag.maximum=X.maximum}),$._zod.check=(U)=>{let G=U.value;if(G.length<=X.maximum)return;let W=WY(G);U.issues.push({origin:W,code:"too_big",maximum:X.maximum,inclusive:!0,input:G,inst:$,continue:!X.abort})}}),rQ=C("$ZodCheckMinLength",($,X)=>{var Y;O4.init($,X),(Y=$._zod.def).when??(Y.when=(U)=>{let G=U.value;return!E2(G)&&G.length!==void 0}),$._zod.onattach.push((U)=>{let G=U._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>G)U._zod.bag.minimum=X.minimum}),$._zod.check=(U)=>{let G=U.value;if(G.length>=X.minimum)return;let W=WY(G);U.issues.push({origin:W,code:"too_small",minimum:X.minimum,inclusive:!0,input:G,inst:$,continue:!X.abort})}}),iQ=C("$ZodCheckLengthEquals",($,X)=>{var Y;O4.init($,X),(Y=$._zod.def).when??(Y.when=(U)=>{let G=U.value;return!E2(G)&&G.length!==void 0}),$._zod.onattach.push((U)=>{let G=U._zod.bag;G.minimum=X.length,G.maximum=X.length,G.length=X.length}),$._zod.check=(U)=>{let G=U.value,z=G.length;if(z===X.length)return;let W=WY(G),Q=z>X.length;U.issues.push({origin:W,...Q?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:U.value,inst:$,continue:!X.abort})}}),QX=C("$ZodCheckStringFormat",($,X)=>{var Y,U;if(O4.init($,X),$._zod.onattach.push((G)=>{let z=G._zod.bag;if(z.format=X.format,X.pattern)z.patterns??(z.patterns=new Set),z.patterns.add(X.pattern)}),X.pattern)(Y=$._zod).check??(Y.check=(G)=>{if(X.pattern.lastIndex=0,X.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:X.format,input:G.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:$,continue:!X.abort})});else(U=$._zod).check??(U.check=()=>{})}),oQ=C("$ZodCheckRegex",($,X)=>{QX.init($,X),$._zod.check=(Y)=>{if(X.pattern.lastIndex=0,X.pattern.test(Y.value))return;Y.issues.push({origin:"string",code:"invalid_format",format:"regex",input:Y.value,pattern:X.pattern.toString(),inst:$,continue:!X.abort})}}),nQ=C("$ZodCheckLowerCase",($,X)=>{X.pattern??(X.pattern=hQ),QX.init($,X)}),tQ=C("$ZodCheckUpperCase",($,X)=>{X.pattern??(X.pattern=gQ),QX.init($,X)}),aQ=C("$ZodCheckIncludes",($,X)=>{O4.init($,X);let Y=q0(X.includes),U=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Y}`:Y);X.pattern=U,$._zod.onattach.push((G)=>{let z=G._zod.bag;z.patterns??(z.patterns=new Set),z.patterns.add(U)}),$._zod.check=(G)=>{if(G.value.includes(X.includes,X.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:G.value,inst:$,continue:!X.abort})}}),sQ=C("$ZodCheckStartsWith",($,X)=>{O4.init($,X);let Y=new RegExp(`^${q0(X.prefix)}.*`);X.pattern??(X.pattern=Y),$._zod.onattach.push((U)=>{let G=U._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(Y)}),$._zod.check=(U)=>{if(U.value.startsWith(X.prefix))return;U.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:U.value,inst:$,continue:!X.abort})}}),eQ=C("$ZodCheckEndsWith",($,X)=>{O4.init($,X);let Y=new RegExp(`.*${q0(X.suffix)}$`);X.pattern??(X.pattern=Y),$._zod.onattach.push((U)=>{let G=U._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(Y)}),$._zod.check=(U)=>{if(U.value.endsWith(X.suffix))return;U.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:U.value,inst:$,continue:!X.abort})}});function AF($,X,Y){if($.issues.length)X.issues.push(...m6(Y,$.issues))}var $Z=C("$ZodCheckProperty",($,X)=>{O4.init($,X),$._zod.check=(Y)=>{let U=X.schema._zod.run({value:Y.value[X.property],issues:[]},{});if(U instanceof Promise)return U.then((G)=>AF(G,Y,X.property));AF(U,Y,X.property);return}}),XZ=C("$ZodCheckMimeType",($,X)=>{O4.init($,X);let Y=new Set(X.mime);$._zod.onattach.push((U)=>{U._zod.bag.mime=X.mime}),$._zod.check=(U)=>{if(Y.has(U.value.type))return;U.issues.push({code:"invalid_value",values:X.mime,input:U.value.type,inst:$})}}),YZ=C("$ZodCheckOverwrite",($,X)=>{O4.init($,X),$._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class d5{constructor($=[]){if(this.content=[],this.indent=0,this)this.args=$}indented($){this.indent+=1,$(this),this.indent-=1}write($){if(typeof $==="function"){$(this,{execution:"sync"}),$(this,{execution:"async"});return}let Y=$.split(`
|
|
17
17
|
`).filter((z)=>z),U=Math.min(...Y.map((z)=>z.length-z.trimStart().length)),G=Y.map((z)=>z.slice(U)).map((z)=>" ".repeat(this.indent*2)+z);for(let z of G)this.content.push(z)}compile(){let $=Function,X=this?.args,U=[...(this?.content??[""]).map((G)=>` ${G}`)];return new $(...X,U.join(`
|
|
18
|
-
`))}}var GZ={major:4,minor:0,patch:0};var N$=C("$ZodType",($,X)=>{var Y;$??($={}),$._zod.def=X,$._zod.bag=$._zod.bag||{},$._zod.version=GZ;let U=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))U.unshift($);for(let G of U)for(let z of G._zod.onattach)z($);if(U.length===0)(Y=$._zod).deferred??(Y.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let G=(z,W,Q)=>{let Z=X8(z),H;for(let V of W){if(V._zod.def.when){if(!V._zod.def.when(z))continue}else if(Z)continue;let O=z.issues.length,w=V._zod.check(z);if(w instanceof Promise&&Q?.async===!1)throw new _0;if(H||w instanceof Promise)H=(H??Promise.resolve()).then(async()=>{if(await w,z.issues.length===O)return;if(!Z)Z=X8(z,O)});else{if(z.issues.length===O)continue;if(!Z)Z=X8(z,O)}}if(H)return H.then(()=>{return z});return z};$._zod.run=(z,W)=>{let Q=$._zod.parse(z,W);if(Q instanceof Promise){if(W.async===!1)throw new _0;return Q.then((Z)=>G(Z,U,W))}return G(Q,U,W)}}$["~standard"]={validate:(G)=>{try{let z=ZQ($,G);return z.success?{value:z.data}:{issues:z.error?.issues}}catch(z){return HQ($,G).then((W)=>W.success?{value:W.data}:{issues:W.error?.issues})}},vendor:"zod",version:1}}),U8=C("$ZodString",($,X)=>{N$.init($,X),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??PQ($._zod.bag),$._zod.parse=(Y,U)=>{if(X.coerce)try{Y.value=String(Y.value)}catch(G){}if(typeof Y.value==="string")return Y;return Y.issues.push({expected:"string",code:"invalid_type",input:Y.value,inst:$}),Y}}),l$=C("$ZodStringFormat",($,X)=>{QX.init($,X),U8.init($,X)}),zZ=C("$ZodGUID",($,X)=>{X.pattern??(X.pattern=MQ),l$.init($,X)}),WZ=C("$ZodUUID",($,X)=>{if(X.version){let U={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(U===void 0)throw new Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=Y8(U))}else X.pattern??(X.pattern=Y8());l$.init($,X)}),QZ=C("$ZodEmail",($,X)=>{X.pattern??(X.pattern=JQ),l$.init($,X)}),ZZ=C("$ZodURL",($,X)=>{l$.init($,X),$._zod.check=(Y)=>{try{let U=Y.value,G=new URL(U),z=G.href;if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(G.hostname))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:TQ.source,input:Y.value,inst:$,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:Y.value,inst:$,continue:!X.abort})}if(!U.endsWith("/")&&z.endsWith("/"))Y.value=z.slice(0,-1);else Y.value=z;return}catch(U){Y.issues.push({code:"invalid_format",format:"url",input:Y.value,inst:$,continue:!X.abort})}}}),HZ=C("$ZodEmoji",($,X)=>{X.pattern??(X.pattern=AQ()),l$.init($,X)}),VZ=C("$ZodNanoID",($,X)=>{X.pattern??(X.pattern=NQ),l$.init($,X)}),OZ=C("$ZodCUID",($,X)=>{X.pattern??(X.pattern=VQ),l$.init($,X)}),wZ=C("$ZodCUID2",($,X)=>{X.pattern??(X.pattern=OQ),l$.init($,X)}),DZ=C("$ZodULID",($,X)=>{X.pattern??(X.pattern=wQ),l$.init($,X)}),EZ=C("$ZodXID",($,X)=>{X.pattern??(X.pattern=DQ),l$.init($,X)}),NZ=C("$ZodKSUID",($,X)=>{X.pattern??(X.pattern=EQ),l$.init($,X)}),FZ=C("$ZodISODateTime",($,X)=>{X.pattern??(X.pattern=jQ(X)),l$.init($,X)}),MZ=C("$ZodISODate",($,X)=>{X.pattern??(X.pattern=CQ),l$.init($,X)}),JZ=C("$ZodISOTime",($,X)=>{X.pattern??(X.pattern=BQ(X)),l$.init($,X)}),AZ=C("$ZodISODuration",($,X)=>{X.pattern??(X.pattern=FQ),l$.init($,X)}),LZ=C("$ZodIPv4",($,X)=>{X.pattern??(X.pattern=LQ),l$.init($,X),$._zod.onattach.push((Y)=>{let U=Y._zod.bag;U.format="ipv4"})}),KZ=C("$ZodIPv6",($,X)=>{X.pattern??(X.pattern=KQ),l$.init($,X),$._zod.onattach.push((Y)=>{let U=Y._zod.bag;U.format="ipv6"}),$._zod.check=(Y)=>{try{new URL(`http://[${Y.value}]`)}catch{Y.issues.push({code:"invalid_format",format:"ipv6",input:Y.value,inst:$,continue:!X.abort})}}}),_Z=C("$ZodCIDRv4",($,X)=>{X.pattern??(X.pattern=_Q),l$.init($,X)}),qZ=C("$ZodCIDRv6",($,X)=>{X.pattern??(X.pattern=qQ),l$.init($,X),$._zod.check=(Y)=>{let[U,G]=Y.value.split("/");try{if(!G)throw new Error;let z=Number(G);if(`${z}`!==G)throw new Error;if(z<0||z>128)throw new Error;new URL(`http://[${U}]`)}catch{Y.issues.push({code:"invalid_format",format:"cidrv6",input:Y.value,inst:$,continue:!X.abort})}}});function RZ($){if($==="")return!0;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var TZ=C("$ZodBase64",($,X)=>{X.pattern??(X.pattern=RQ),l$.init($,X),$._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64"}),$._zod.check=(Y)=>{if(RZ(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64",input:Y.value,inst:$,continue:!X.abort})}});function SF($){if(!u5.test($))return!1;let X=$.replace(/[-_]/g,(U)=>U==="-"?"+":"/"),Y=X.padEnd(Math.ceil(X.length/4)*4,"=");return RZ(Y)}var vZ=C("$ZodBase64URL",($,X)=>{X.pattern??(X.pattern=u5),l$.init($,X),$._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64url"}),$._zod.check=(Y)=>{if(SF(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64url",input:Y.value,inst:$,continue:!X.abort})}}),CZ=C("$ZodE164",($,X)=>{X.pattern??(X.pattern=vQ),l$.init($,X)});function kF($,X=null){try{let Y=$.split(".");if(Y.length!==3)return!1;let[U]=Y;if(!U)return!1;let G=JSON.parse(atob(U));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(X&&(!("alg"in G)||G.alg!==X))return!1;return!0}catch{return!1}}var BZ=C("$ZodJWT",($,X)=>{l$.init($,X),$._zod.check=(Y)=>{if(kF(Y.value,X.alg))return;Y.issues.push({code:"invalid_format",format:"jwt",input:Y.value,inst:$,continue:!X.abort})}}),jZ=C("$ZodCustomStringFormat",($,X)=>{l$.init($,X),$._zod.check=(Y)=>{if(X.fn(Y.value))return;Y.issues.push({code:"invalid_format",format:X.format,input:Y.value,inst:$,continue:!X.abort})}}),i5=C("$ZodNumber",($,X)=>{N$.init($,X),$._zod.pattern=$._zod.bag.pattern??SQ,$._zod.parse=(Y,U)=>{if(X.coerce)try{Y.value=Number(Y.value)}catch(W){}let G=Y.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return Y;let z=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return Y.issues.push({expected:"number",code:"invalid_type",input:G,inst:$,...z?{received:z}:{}}),Y}}),PZ=C("$ZodNumber",($,X)=>{mQ.init($,X),i5.init($,X)}),VY=C("$ZodBoolean",($,X)=>{N$.init($,X),$._zod.pattern=kQ,$._zod.parse=(Y,U)=>{if(X.coerce)try{Y.value=Boolean(Y.value)}catch(z){}let G=Y.value;if(typeof G==="boolean")return Y;return Y.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:$}),Y}}),o5=C("$ZodBigInt",($,X)=>{N$.init($,X),$._zod.pattern=IQ,$._zod.parse=(Y,U)=>{if(X.coerce)try{Y.value=BigInt(Y.value)}catch(G){}if(typeof Y.value==="bigint")return Y;return Y.issues.push({expected:"bigint",code:"invalid_type",input:Y.value,inst:$}),Y}}),IZ=C("$ZodBigInt",($,X)=>{uQ.init($,X),o5.init($,X)}),xZ=C("$ZodSymbol",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(typeof G==="symbol")return Y;return Y.issues.push({expected:"symbol",code:"invalid_type",input:G,inst:$}),Y}}),SZ=C("$ZodUndefined",($,X)=>{N$.init($,X),$._zod.pattern=fQ,$._zod.values=new Set([void 0]),$._zod.optin="optional",$._zod.optout="optional",$._zod.parse=(Y,U)=>{let G=Y.value;if(typeof G==="undefined")return Y;return Y.issues.push({expected:"undefined",code:"invalid_type",input:G,inst:$}),Y}}),kZ=C("$ZodNull",($,X)=>{N$.init($,X),$._zod.pattern=bQ,$._zod.values=new Set([null]),$._zod.parse=(Y,U)=>{let G=Y.value;if(G===null)return Y;return Y.issues.push({expected:"null",code:"invalid_type",input:G,inst:$}),Y}}),bZ=C("$ZodAny",($,X)=>{N$.init($,X),$._zod.parse=(Y)=>Y}),ZX=C("$ZodUnknown",($,X)=>{N$.init($,X),$._zod.parse=(Y)=>Y}),fZ=C("$ZodNever",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{return Y.issues.push({expected:"never",code:"invalid_type",input:Y.value,inst:$}),Y}}),hZ=C("$ZodVoid",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(typeof G==="undefined")return Y;return Y.issues.push({expected:"void",code:"invalid_type",input:G,inst:$}),Y}}),gZ=C("$ZodDate",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{if(X.coerce)try{Y.value=new Date(Y.value)}catch(Q){}let G=Y.value,z=G instanceof Date;if(z&&!Number.isNaN(G.getTime()))return Y;return Y.issues.push({expected:"date",code:"invalid_type",input:G,...z?{received:"Invalid Date"}:{},inst:$}),Y}});function _F($,X,Y){if($.issues.length)X.issues.push(...
|
|
18
|
+
`))}}var GZ={major:4,minor:0,patch:0};var N$=C("$ZodType",($,X)=>{var Y;$??($={}),$._zod.def=X,$._zod.bag=$._zod.bag||{},$._zod.version=GZ;let U=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))U.unshift($);for(let G of U)for(let z of G._zod.onattach)z($);if(U.length===0)(Y=$._zod).deferred??(Y.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let G=(z,W,Q)=>{let Z=X8(z),H;for(let V of W){if(V._zod.def.when){if(!V._zod.def.when(z))continue}else if(Z)continue;let O=z.issues.length,w=V._zod.check(z);if(w instanceof Promise&&Q?.async===!1)throw new _0;if(H||w instanceof Promise)H=(H??Promise.resolve()).then(async()=>{if(await w,z.issues.length===O)return;if(!Z)Z=X8(z,O)});else{if(z.issues.length===O)continue;if(!Z)Z=X8(z,O)}}if(H)return H.then(()=>{return z});return z};$._zod.run=(z,W)=>{let Q=$._zod.parse(z,W);if(Q instanceof Promise){if(W.async===!1)throw new _0;return Q.then((Z)=>G(Z,U,W))}return G(Q,U,W)}}$["~standard"]={validate:(G)=>{try{let z=ZQ($,G);return z.success?{value:z.data}:{issues:z.error?.issues}}catch(z){return HQ($,G).then((W)=>W.success?{value:W.data}:{issues:W.error?.issues})}},vendor:"zod",version:1}}),U8=C("$ZodString",($,X)=>{N$.init($,X),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??PQ($._zod.bag),$._zod.parse=(Y,U)=>{if(X.coerce)try{Y.value=String(Y.value)}catch(G){}if(typeof Y.value==="string")return Y;return Y.issues.push({expected:"string",code:"invalid_type",input:Y.value,inst:$}),Y}}),l$=C("$ZodStringFormat",($,X)=>{QX.init($,X),U8.init($,X)}),zZ=C("$ZodGUID",($,X)=>{X.pattern??(X.pattern=MQ),l$.init($,X)}),WZ=C("$ZodUUID",($,X)=>{if(X.version){let U={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(U===void 0)throw new Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=Y8(U))}else X.pattern??(X.pattern=Y8());l$.init($,X)}),QZ=C("$ZodEmail",($,X)=>{X.pattern??(X.pattern=JQ),l$.init($,X)}),ZZ=C("$ZodURL",($,X)=>{l$.init($,X),$._zod.check=(Y)=>{try{let U=Y.value,G=new URL(U),z=G.href;if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(G.hostname))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:TQ.source,input:Y.value,inst:$,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:Y.value,inst:$,continue:!X.abort})}if(!U.endsWith("/")&&z.endsWith("/"))Y.value=z.slice(0,-1);else Y.value=z;return}catch(U){Y.issues.push({code:"invalid_format",format:"url",input:Y.value,inst:$,continue:!X.abort})}}}),HZ=C("$ZodEmoji",($,X)=>{X.pattern??(X.pattern=AQ()),l$.init($,X)}),VZ=C("$ZodNanoID",($,X)=>{X.pattern??(X.pattern=NQ),l$.init($,X)}),OZ=C("$ZodCUID",($,X)=>{X.pattern??(X.pattern=VQ),l$.init($,X)}),wZ=C("$ZodCUID2",($,X)=>{X.pattern??(X.pattern=OQ),l$.init($,X)}),DZ=C("$ZodULID",($,X)=>{X.pattern??(X.pattern=wQ),l$.init($,X)}),EZ=C("$ZodXID",($,X)=>{X.pattern??(X.pattern=DQ),l$.init($,X)}),NZ=C("$ZodKSUID",($,X)=>{X.pattern??(X.pattern=EQ),l$.init($,X)}),FZ=C("$ZodISODateTime",($,X)=>{X.pattern??(X.pattern=jQ(X)),l$.init($,X)}),MZ=C("$ZodISODate",($,X)=>{X.pattern??(X.pattern=CQ),l$.init($,X)}),JZ=C("$ZodISOTime",($,X)=>{X.pattern??(X.pattern=BQ(X)),l$.init($,X)}),AZ=C("$ZodISODuration",($,X)=>{X.pattern??(X.pattern=FQ),l$.init($,X)}),LZ=C("$ZodIPv4",($,X)=>{X.pattern??(X.pattern=LQ),l$.init($,X),$._zod.onattach.push((Y)=>{let U=Y._zod.bag;U.format="ipv4"})}),KZ=C("$ZodIPv6",($,X)=>{X.pattern??(X.pattern=KQ),l$.init($,X),$._zod.onattach.push((Y)=>{let U=Y._zod.bag;U.format="ipv6"}),$._zod.check=(Y)=>{try{new URL(`http://[${Y.value}]`)}catch{Y.issues.push({code:"invalid_format",format:"ipv6",input:Y.value,inst:$,continue:!X.abort})}}}),_Z=C("$ZodCIDRv4",($,X)=>{X.pattern??(X.pattern=_Q),l$.init($,X)}),qZ=C("$ZodCIDRv6",($,X)=>{X.pattern??(X.pattern=qQ),l$.init($,X),$._zod.check=(Y)=>{let[U,G]=Y.value.split("/");try{if(!G)throw new Error;let z=Number(G);if(`${z}`!==G)throw new Error;if(z<0||z>128)throw new Error;new URL(`http://[${U}]`)}catch{Y.issues.push({code:"invalid_format",format:"cidrv6",input:Y.value,inst:$,continue:!X.abort})}}});function RZ($){if($==="")return!0;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var TZ=C("$ZodBase64",($,X)=>{X.pattern??(X.pattern=RQ),l$.init($,X),$._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64"}),$._zod.check=(Y)=>{if(RZ(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64",input:Y.value,inst:$,continue:!X.abort})}});function SF($){if(!u5.test($))return!1;let X=$.replace(/[-_]/g,(U)=>U==="-"?"+":"/"),Y=X.padEnd(Math.ceil(X.length/4)*4,"=");return RZ(Y)}var vZ=C("$ZodBase64URL",($,X)=>{X.pattern??(X.pattern=u5),l$.init($,X),$._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64url"}),$._zod.check=(Y)=>{if(SF(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64url",input:Y.value,inst:$,continue:!X.abort})}}),CZ=C("$ZodE164",($,X)=>{X.pattern??(X.pattern=vQ),l$.init($,X)});function kF($,X=null){try{let Y=$.split(".");if(Y.length!==3)return!1;let[U]=Y;if(!U)return!1;let G=JSON.parse(atob(U));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(X&&(!("alg"in G)||G.alg!==X))return!1;return!0}catch{return!1}}var BZ=C("$ZodJWT",($,X)=>{l$.init($,X),$._zod.check=(Y)=>{if(kF(Y.value,X.alg))return;Y.issues.push({code:"invalid_format",format:"jwt",input:Y.value,inst:$,continue:!X.abort})}}),jZ=C("$ZodCustomStringFormat",($,X)=>{l$.init($,X),$._zod.check=(Y)=>{if(X.fn(Y.value))return;Y.issues.push({code:"invalid_format",format:X.format,input:Y.value,inst:$,continue:!X.abort})}}),i5=C("$ZodNumber",($,X)=>{N$.init($,X),$._zod.pattern=$._zod.bag.pattern??SQ,$._zod.parse=(Y,U)=>{if(X.coerce)try{Y.value=Number(Y.value)}catch(W){}let G=Y.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return Y;let z=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return Y.issues.push({expected:"number",code:"invalid_type",input:G,inst:$,...z?{received:z}:{}}),Y}}),PZ=C("$ZodNumber",($,X)=>{mQ.init($,X),i5.init($,X)}),VY=C("$ZodBoolean",($,X)=>{N$.init($,X),$._zod.pattern=kQ,$._zod.parse=(Y,U)=>{if(X.coerce)try{Y.value=Boolean(Y.value)}catch(z){}let G=Y.value;if(typeof G==="boolean")return Y;return Y.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:$}),Y}}),o5=C("$ZodBigInt",($,X)=>{N$.init($,X),$._zod.pattern=IQ,$._zod.parse=(Y,U)=>{if(X.coerce)try{Y.value=BigInt(Y.value)}catch(G){}if(typeof Y.value==="bigint")return Y;return Y.issues.push({expected:"bigint",code:"invalid_type",input:Y.value,inst:$}),Y}}),IZ=C("$ZodBigInt",($,X)=>{uQ.init($,X),o5.init($,X)}),xZ=C("$ZodSymbol",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(typeof G==="symbol")return Y;return Y.issues.push({expected:"symbol",code:"invalid_type",input:G,inst:$}),Y}}),SZ=C("$ZodUndefined",($,X)=>{N$.init($,X),$._zod.pattern=fQ,$._zod.values=new Set([void 0]),$._zod.optin="optional",$._zod.optout="optional",$._zod.parse=(Y,U)=>{let G=Y.value;if(typeof G==="undefined")return Y;return Y.issues.push({expected:"undefined",code:"invalid_type",input:G,inst:$}),Y}}),kZ=C("$ZodNull",($,X)=>{N$.init($,X),$._zod.pattern=bQ,$._zod.values=new Set([null]),$._zod.parse=(Y,U)=>{let G=Y.value;if(G===null)return Y;return Y.issues.push({expected:"null",code:"invalid_type",input:G,inst:$}),Y}}),bZ=C("$ZodAny",($,X)=>{N$.init($,X),$._zod.parse=(Y)=>Y}),ZX=C("$ZodUnknown",($,X)=>{N$.init($,X),$._zod.parse=(Y)=>Y}),fZ=C("$ZodNever",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{return Y.issues.push({expected:"never",code:"invalid_type",input:Y.value,inst:$}),Y}}),hZ=C("$ZodVoid",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(typeof G==="undefined")return Y;return Y.issues.push({expected:"void",code:"invalid_type",input:G,inst:$}),Y}}),gZ=C("$ZodDate",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{if(X.coerce)try{Y.value=new Date(Y.value)}catch(Q){}let G=Y.value,z=G instanceof Date;if(z&&!Number.isNaN(G.getTime()))return Y;return Y.issues.push({expected:"date",code:"invalid_type",input:G,...z?{received:"Invalid Date"}:{},inst:$}),Y}});function _F($,X,Y){if($.issues.length)X.issues.push(...m6(Y,$.issues));X.value[Y]=$.value}var OY=C("$ZodArray",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(!Array.isArray(G))return Y.issues.push({expected:"array",code:"invalid_type",input:G,inst:$}),Y;Y.value=Array(G.length);let z=[];for(let W=0;W<G.length;W++){let Q=G[W],Z=X.element._zod.run({value:Q,issues:[]},U);if(Z instanceof Promise)z.push(Z.then((H)=>_F(H,Y,W)));else _F(Z,Y,W)}if(z.length)return Promise.all(z).then(()=>Y);return Y}});function l5($,X,Y){if($.issues.length)X.issues.push(...m6(Y,$.issues));X.value[Y]=$.value}function qF($,X,Y,U){if($.issues.length)if(U[Y]===void 0)if(Y in U)X.value[Y]=void 0;else X.value[Y]=$.value;else X.issues.push(...m6(Y,$.issues));else if($.value===void 0){if(Y in U)X.value[Y]=void 0}else X.value[Y]=$.value}var yZ=C("$ZodObject",($,X)=>{N$.init($,X);let Y=YY(()=>{let O=Object.keys(X.shape);for(let D of O)if(!(X.shape[D]instanceof N$))throw new Error(`Invalid element at key "${D}": expected a Zod schema`);let w=YQ(X.shape);return{shape:X.shape,keys:O,keySet:new Set(O),numKeys:O.length,optionalKeys:new Set(w)}});y$($._zod,"propValues",()=>{let O=X.shape,w={};for(let D in O){let E=O[D]._zod;if(E.values){w[D]??(w[D]=new Set);for(let F of E.values)w[D].add(F)}}return w});let U=(O)=>{let w=new d5(["shape","payload","ctx"]),D=Y.value,E=(L)=>{let T=$8(L);return`shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`};w.write("const input = payload.value;");let F=Object.create(null),J=0;for(let L of D.keys)F[L]=`key_${J++}`;w.write("const newResult = {}");for(let L of D.keys)if(D.optionalKeys.has(L)){let T=F[L];w.write(`const ${T} = ${E(L)};`);let q=$8(L);w.write(`
|
|
19
19
|
if (${T}.issues.length) {
|
|
20
20
|
if (input[${q}] === undefined) {
|
|
21
21
|
if (${q} in input) {
|
|
@@ -38,9 +38,9 @@ ${w.trace}`:`No previous disposal trace for ${Q} was found.`),Y}let H=$.molecule
|
|
|
38
38
|
if (${T}.issues.length) payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
|
|
39
39
|
...iss,
|
|
40
40
|
path: iss.path ? [${$8(L)}, ...iss.path] : [${$8(L)}]
|
|
41
|
-
})));`),w.write(`newResult[${$8(L)}] = ${T}.value`)}w.write("payload.value = newResult;"),w.write("return payload;");let A=w.compile();return(L,T)=>A(O,L,T)},G,z=UX,W=!e9.jitless,Z=W&&$Q.value,H=X.catchall,V;$._zod.parse=(O,w)=>{V??(V=Y.value);let D=O.value;if(!z(D))return O.issues.push({expected:"object",code:"invalid_type",input:D,inst:$}),O;let E=[];if(W&&Z&&w?.async===!1&&w.jitless!==!0){if(!G)G=U(X.shape);O=G(O,w)}else{O.value={};let T=V.shape;for(let q of V.keys){let v=T[q],I=v._zod.run({value:D[q],issues:[]},w),S=v._zod.optin==="optional"&&v._zod.optout==="optional";if(I instanceof Promise)E.push(I.then((y)=>S?qF(y,O,q,D):l5(y,O,q)));else if(S)qF(I,O,q,D);else l5(I,O,q)}}if(!H)return E.length?Promise.all(E).then(()=>O):O;let F=[],J=V.keySet,A=H._zod,L=A.def.type;for(let T of Object.keys(D)){if(J.has(T))continue;if(L==="never"){F.push(T);continue}let q=A.run({value:D[T],issues:[]},w);if(q instanceof Promise)E.push(q.then((v)=>l5(v,O,T)));else l5(q,O,T)}if(F.length)O.issues.push({code:"unrecognized_keys",keys:F,input:D,inst:$});if(!E.length)return O;return Promise.all(E).then(()=>{return O})}});function RF($,X,Y,U){for(let G of $)if(G.issues.length===0)return X.value=G.value,X;return X.issues.push({code:"invalid_union",input:X.value,inst:Y,errors:$.map((G)=>G.issues.map((z)=>Y1(z,U,v4())))}),X}var n5=C("$ZodUnion",($,X)=>{N$.init($,X),y$($._zod,"optin",()=>X.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),y$($._zod,"optout",()=>X.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),y$($._zod,"values",()=>{if(X.options.every((Y)=>Y._zod.values))return new Set(X.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),y$($._zod,"pattern",()=>{if(X.options.every((Y)=>Y._zod.pattern)){let Y=X.options.map((U)=>U._zod.pattern);return new RegExp(`^(${Y.map((U)=>GY(U.source)).join("|")})$`)}return}),$._zod.parse=(Y,U)=>{let G=!1,z=[];for(let W of X.options){let Q=W._zod.run({value:Y.value,issues:[]},U);if(Q instanceof Promise)z.push(Q),G=!0;else{if(Q.issues.length===0)return Q;z.push(Q)}}if(!G)return RF(z,Y,$,U);return Promise.all(z).then((W)=>{return RF(W,Y,$,U)})}}),mZ=C("$ZodDiscriminatedUnion",($,X)=>{n5.init($,X);let Y=$._zod.parse;y$($._zod,"propValues",()=>{let G={};for(let z of X.options){let W=z._zod.propValues;if(!W||Object.keys(W).length===0)throw new Error(`Invalid discriminated union option at index "${X.options.indexOf(z)}"`);for(let[Q,Z]of Object.entries(W)){if(!G[Q])G[Q]=new Set;for(let H of Z)G[Q].add(H)}}return G});let U=YY(()=>{let G=X.options,z=new Map;for(let W of G){let Q=W._zod.propValues[X.discriminator];if(!Q||Q.size===0)throw new Error(`Invalid discriminated union option at index "${X.options.indexOf(W)}"`);for(let Z of Q){if(z.has(Z))throw new Error(`Duplicate discriminator value "${String(Z)}"`);z.set(Z,W)}}return z});$._zod.parse=(G,z)=>{let W=G.value;if(!UX(W))return G.issues.push({code:"invalid_type",expected:"object",input:W,inst:$}),G;let Q=U.value.get(W?.[X.discriminator]);if(Q)return Q._zod.run(G,z);if(X.unionFallback)return Y(G,z);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:W,path:[X.discriminator],inst:$}),G}}),uZ=C("$ZodIntersection",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value,z=X.left._zod.run({value:G,issues:[]},U),W=X.right._zod.run({value:G,issues:[]},U);if(z instanceof Promise||W instanceof Promise)return Promise.all([z,W]).then(([Z,H])=>{return TF(Y,Z,H)});return TF(Y,z,W)}});function UZ($,X){if($===X)return{valid:!0,data:$};if($ instanceof Date&&X instanceof Date&&+$===+X)return{valid:!0,data:$};if(zX($)&&zX(X)){let Y=Object.keys(X),U=Object.keys($).filter((z)=>Y.indexOf(z)!==-1),G={...$,...X};for(let z of U){let W=UZ($[z],X[z]);if(!W.valid)return{valid:!1,mergeErrorPath:[z,...W.mergeErrorPath]};G[z]=W.data}return{valid:!0,data:G}}if(Array.isArray($)&&Array.isArray(X)){if($.length!==X.length)return{valid:!1,mergeErrorPath:[]};let Y=[];for(let U=0;U<$.length;U++){let G=$[U],z=X[U],W=UZ(G,z);if(!W.valid)return{valid:!1,mergeErrorPath:[U,...W.mergeErrorPath]};Y.push(W.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function TF($,X,Y){if(X.issues.length)$.issues.push(...X.issues);if(Y.issues.length)$.issues.push(...Y.issues);if(X8($))return $;let U=UZ(X.value,Y.value);if(!U.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(U.mergeErrorPath)}`);return $.value=U.data,$}var z8=C("$ZodTuple",($,X)=>{N$.init($,X);let Y=X.items,U=Y.length-[...Y].reverse().findIndex((G)=>G._zod.optin!=="optional");$._zod.parse=(G,z)=>{let W=G.value;if(!Array.isArray(W))return G.issues.push({input:W,inst:$,expected:"tuple",code:"invalid_type"}),G;G.value=[];let Q=[];if(!X.rest){let H=W.length>Y.length,V=W.length<U-1;if(H||V)return G.issues.push({input:W,inst:$,origin:"array",...H?{code:"too_big",maximum:Y.length}:{code:"too_small",minimum:Y.length}}),G}let Z=-1;for(let H of Y){if(Z++,Z>=W.length){if(Z>=U)continue}let V=H._zod.run({value:W[Z],issues:[]},z);if(V instanceof Promise)Q.push(V.then((O)=>r5(O,G,Z)));else r5(V,G,Z)}if(X.rest){let H=W.slice(Y.length);for(let V of H){Z++;let O=X.rest._zod.run({value:V,issues:[]},z);if(O instanceof Promise)Q.push(O.then((w)=>r5(w,G,Z)));else r5(O,G,Z)}}if(Q.length)return Promise.all(Q).then(()=>G);return G}});function r5($,X,Y){if($.issues.length)X.issues.push(...y6(Y,$.issues));X.value[Y]=$.value}var cZ=C("$ZodRecord",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(!zX(G))return Y.issues.push({expected:"record",code:"invalid_type",input:G,inst:$}),Y;let z=[];if(X.keyType._zod.values){let W=X.keyType._zod.values;Y.value={};for(let Z of W)if(typeof Z==="string"||typeof Z==="number"||typeof Z==="symbol"){let H=X.valueType._zod.run({value:G[Z],issues:[]},U);if(H instanceof Promise)z.push(H.then((V)=>{if(V.issues.length)Y.issues.push(...y6(Z,V.issues));Y.value[Z]=V.value}));else{if(H.issues.length)Y.issues.push(...y6(Z,H.issues));Y.value[Z]=H.value}}let Q;for(let Z in G)if(!W.has(Z))Q=Q??[],Q.push(Z);if(Q&&Q.length>0)Y.issues.push({code:"unrecognized_keys",input:G,inst:$,keys:Q})}else{Y.value={};for(let W of Reflect.ownKeys(G)){if(W==="__proto__")continue;let Q=X.keyType._zod.run({value:W,issues:[]},U);if(Q instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(Q.issues.length){Y.issues.push({origin:"record",code:"invalid_key",issues:Q.issues.map((H)=>Y1(H,U,v4())),input:W,path:[W],inst:$}),Y.value[Q.value]=Q.value;continue}let Z=X.valueType._zod.run({value:G[W],issues:[]},U);if(Z instanceof Promise)z.push(Z.then((H)=>{if(H.issues.length)Y.issues.push(...y6(W,H.issues));Y.value[Q.value]=H.value}));else{if(Z.issues.length)Y.issues.push(...y6(W,Z.issues));Y.value[Q.value]=Z.value}}}if(z.length)return Promise.all(z).then(()=>Y);return Y}}),pZ=C("$ZodMap",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(!(G instanceof Map))return Y.issues.push({expected:"map",code:"invalid_type",input:G,inst:$}),Y;let z=[];Y.value=new Map;for(let[W,Q]of G){let Z=X.keyType._zod.run({value:W,issues:[]},U),H=X.valueType._zod.run({value:Q,issues:[]},U);if(Z instanceof Promise||H instanceof Promise)z.push(Promise.all([Z,H]).then(([V,O])=>{vF(V,O,Y,W,G,$,U)}));else vF(Z,H,Y,W,G,$,U)}if(z.length)return Promise.all(z).then(()=>Y);return Y}});function vF($,X,Y,U,G,z,W){if($.issues.length)if(UY.has(typeof U))Y.issues.push(...y6(U,$.issues));else Y.issues.push({origin:"map",code:"invalid_key",input:G,inst:z,issues:$.issues.map((Q)=>Y1(Q,W,v4()))});if(X.issues.length)if(UY.has(typeof U))Y.issues.push(...y6(U,X.issues));else Y.issues.push({origin:"map",code:"invalid_element",input:G,inst:z,key:U,issues:X.issues.map((Q)=>Y1(Q,W,v4()))});Y.value.set($.value,X.value)}var dZ=C("$ZodSet",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(!(G instanceof Set))return Y.issues.push({input:G,inst:$,expected:"set",code:"invalid_type"}),Y;let z=[];Y.value=new Set;for(let W of G){let Q=X.valueType._zod.run({value:W,issues:[]},U);if(Q instanceof Promise)z.push(Q.then((Z)=>CF(Z,Y)));else CF(Q,Y)}if(z.length)return Promise.all(z).then(()=>Y);return Y}});function CF($,X){if($.issues.length)X.issues.push(...$.issues);X.value.add($.value)}var lZ=C("$ZodEnum",($,X)=>{N$.init($,X);let Y=XY(X.entries);$._zod.values=new Set(Y),$._zod.pattern=new RegExp(`^(${Y.filter((U)=>UY.has(typeof U)).map((U)=>typeof U==="string"?q0(U):U.toString()).join("|")})$`),$._zod.parse=(U,G)=>{let z=U.value;if($._zod.values.has(z))return U;return U.issues.push({code:"invalid_value",values:Y,input:z,inst:$}),U}}),rZ=C("$ZodLiteral",($,X)=>{N$.init($,X),$._zod.values=new Set(X.values),$._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?q0(Y):Y?Y.toString():String(Y)).join("|")})$`),$._zod.parse=(Y,U)=>{let G=Y.value;if($._zod.values.has(G))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:G,inst:$}),Y}}),iZ=C("$ZodFile",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(G instanceof File)return Y;return Y.issues.push({expected:"file",code:"invalid_type",input:G,inst:$}),Y}}),wY=C("$ZodTransform",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=X.transform(Y.value,Y);if(U.async)return(G instanceof Promise?G:Promise.resolve(G)).then((W)=>{return Y.value=W,Y});if(G instanceof Promise)throw new _0;return Y.value=G,Y}}),oZ=C("$ZodOptional",($,X)=>{N$.init($,X),$._zod.optin="optional",$._zod.optout="optional",y$($._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),y$($._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${GY(Y.source)})?$`):void 0}),$._zod.parse=(Y,U)=>{if(X.innerType._zod.optin==="optional")return X.innerType._zod.run(Y,U);if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,U)}}),nZ=C("$ZodNullable",($,X)=>{N$.init($,X),y$($._zod,"optin",()=>X.innerType._zod.optin),y$($._zod,"optout",()=>X.innerType._zod.optout),y$($._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${GY(Y.source)}|null)$`):void 0}),y$($._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),$._zod.parse=(Y,U)=>{if(Y.value===null)return Y;return X.innerType._zod.run(Y,U)}}),tZ=C("$ZodDefault",($,X)=>{N$.init($,X),$._zod.optin="optional",y$($._zod,"values",()=>X.innerType._zod.values),$._zod.parse=(Y,U)=>{if(Y.value===void 0)return Y.value=X.defaultValue,Y;let G=X.innerType._zod.run(Y,U);if(G instanceof Promise)return G.then((z)=>BF(z,X));return BF(G,X)}});function BF($,X){if($.value===void 0)$.value=X.defaultValue;return $}var aZ=C("$ZodPrefault",($,X)=>{N$.init($,X),$._zod.optin="optional",y$($._zod,"values",()=>X.innerType._zod.values),$._zod.parse=(Y,U)=>{if(Y.value===void 0)Y.value=X.defaultValue;return X.innerType._zod.run(Y,U)}}),sZ=C("$ZodNonOptional",($,X)=>{N$.init($,X),y$($._zod,"values",()=>{let Y=X.innerType._zod.values;return Y?new Set([...Y].filter((U)=>U!==void 0)):void 0}),$._zod.parse=(Y,U)=>{let G=X.innerType._zod.run(Y,U);if(G instanceof Promise)return G.then((z)=>jF(z,$));return jF(G,$)}});function jF($,X){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:X});return $}var eZ=C("$ZodSuccess",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=X.innerType._zod.run(Y,U);if(G instanceof Promise)return G.then((z)=>{return Y.value=z.issues.length===0,Y});return Y.value=G.issues.length===0,Y}}),$H=C("$ZodCatch",($,X)=>{N$.init($,X),$._zod.optin="optional",y$($._zod,"optout",()=>X.innerType._zod.optout),y$($._zod,"values",()=>X.innerType._zod.values),$._zod.parse=(Y,U)=>{let G=X.innerType._zod.run(Y,U);if(G instanceof Promise)return G.then((z)=>{if(Y.value=z.value,z.issues.length)Y.value=X.catchValue({...Y,error:{issues:z.issues.map((W)=>Y1(W,U,v4()))},input:Y.value}),Y.issues=[];return Y});if(Y.value=G.value,G.issues.length)Y.value=X.catchValue({...Y,error:{issues:G.issues.map((z)=>Y1(z,U,v4()))},input:Y.value}),Y.issues=[];return Y}}),XH=C("$ZodNaN",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{if(typeof Y.value!=="number"||!Number.isNaN(Y.value))return Y.issues.push({input:Y.value,inst:$,expected:"nan",code:"invalid_type"}),Y;return Y}}),DY=C("$ZodPipe",($,X)=>{N$.init($,X),y$($._zod,"values",()=>X.in._zod.values),y$($._zod,"optin",()=>X.in._zod.optin),y$($._zod,"optout",()=>X.out._zod.optout),$._zod.parse=(Y,U)=>{let G=X.in._zod.run(Y,U);if(G instanceof Promise)return G.then((z)=>PF(z,X,U));return PF(G,X,U)}});function PF($,X,Y){if(X8($))return $;return X.out._zod.run({value:$.value,issues:$.issues},Y)}var YH=C("$ZodReadonly",($,X)=>{N$.init($,X),y$($._zod,"propValues",()=>X.innerType._zod.propValues),y$($._zod,"values",()=>X.innerType._zod.values),y$($._zod,"optin",()=>X.innerType._zod.optin),y$($._zod,"optout",()=>X.innerType._zod.optout),$._zod.parse=(Y,U)=>{let G=X.innerType._zod.run(Y,U);if(G instanceof Promise)return G.then(IF);return IF(G)}});function IF($){return $.value=Object.freeze($.value),$}var GH=C("$ZodTemplateLiteral",($,X)=>{N$.init($,X);let Y=[];for(let U of X.parts)if(U instanceof N$){if(!U._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...U._zod.traits].shift()}`);let G=U._zod.pattern instanceof RegExp?U._zod.pattern.source:U._zod.pattern;if(!G)throw new Error(`Invalid template literal part: ${U._zod.traits}`);let z=G.startsWith("^")?1:0,W=G.endsWith("$")?G.length-1:G.length;Y.push(G.slice(z,W))}else if(U===null||XQ.has(typeof U))Y.push(q0(`${U}`));else throw new Error(`Invalid template literal part: ${U}`);$._zod.pattern=new RegExp(`^${Y.join("")}$`),$._zod.parse=(U,G)=>{if(typeof U.value!=="string")return U.issues.push({input:U.value,inst:$,expected:"template_literal",code:"invalid_type"}),U;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(U.value))return U.issues.push({input:U.value,inst:$,code:"invalid_format",format:"template_literal",pattern:$._zod.pattern.source}),U;return U}}),UH=C("$ZodPromise",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{return Promise.resolve(Y.value).then((G)=>X.innerType._zod.run({value:G,issues:[]},U))}}),zH=C("$ZodLazy",($,X)=>{N$.init($,X),y$($._zod,"innerType",()=>X.getter()),y$($._zod,"pattern",()=>$._zod.innerType._zod.pattern),y$($._zod,"propValues",()=>$._zod.innerType._zod.propValues),y$($._zod,"optin",()=>$._zod.innerType._zod.optin),y$($._zod,"optout",()=>$._zod.innerType._zod.optout),$._zod.parse=(Y,U)=>{return $._zod.innerType._zod.run(Y,U)}}),WH=C("$ZodCustom",($,X)=>{O4.init($,X),N$.init($,X),$._zod.parse=(Y,U)=>{return Y},$._zod.check=(Y)=>{let U=Y.value,G=X.fn(U);if(G instanceof Promise)return G.then((z)=>xF(z,Y,U,$));xF(G,Y,U,$);return}});function xF($,X,Y,U){if(!$){let G={code:"custom",input:Y,inst:U,path:[...U._zod.def.path??[]],continue:!U._zod.def.abort};if(U._zod.def.params)G.params=U._zod.def.params;X.issues.push(zQ(G))}}var NY={};D2(NY,{zhTW:()=>dH,zhCN:()=>pH,vi:()=>cH,ur:()=>uH,ua:()=>mH,tr:()=>yH,th:()=>gH,ta:()=>hH,sv:()=>fH,sl:()=>bH,ru:()=>kH,pt:()=>SH,ps:()=>IH,pl:()=>xH,ota:()=>PH,no:()=>jH,nl:()=>BH,ms:()=>CH,mk:()=>vH,ko:()=>TH,kh:()=>RH,ja:()=>qH,it:()=>_H,id:()=>KH,hu:()=>LH,he:()=>AH,frCA:()=>JH,fr:()=>MH,fi:()=>FH,fa:()=>NH,es:()=>EH,eo:()=>DH,en:()=>EY,de:()=>wH,cs:()=>OH,ca:()=>VH,be:()=>HH,az:()=>ZH,ar:()=>QH});var SP=()=>{let $={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return(G)=>{switch(G.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${G.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o(G.values[0])}`;return`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${G.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${z} ${G.maximum.toString()} ${W.unit??"\u0639\u0646\u0635\u0631"}`;return`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${G.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${z} ${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${G.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${z} ${G.minimum.toString()} ${W.unit}`;return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${G.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${z} ${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${G.prefix}"`;if(z.format==="ends_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${z.suffix}"`;if(z.format==="includes")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${z.includes}"`;if(z.format==="regex")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${z.pattern}`;return`${U[z.format]??G.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${G.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${G.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${G.keys.length>1?"\u0629":""}: ${h(G.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${G.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${G.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function QH(){return{localeError:SP()}}var kP=()=>{let $={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={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",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(G)=>{switch(G.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${G.expected}, daxil olan ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o(G.values[0])}`;return`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${G.origin??"d\u0259y\u0259r"} ${z}${G.maximum.toString()} ${W.unit??"element"}`;return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${G.origin??"d\u0259y\u0259r"} ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${G.origin} ${z}${G.minimum.toString()} ${W.unit}`;return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${G.origin} ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Yanl\u0131\u015F m\u0259tn: "${z.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`;if(z.format==="ends_with")return`Yanl\u0131\u015F m\u0259tn: "${z.suffix}" il\u0259 bitm\u0259lidir`;if(z.format==="includes")return`Yanl\u0131\u015F m\u0259tn: "${z.includes}" daxil olmal\u0131d\u0131r`;if(z.format==="regex")return`Yanl\u0131\u015F m\u0259tn: ${z.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`;return`Yanl\u0131\u015F ${U[z.format]??G.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${G.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${G.keys.length>1?"lar":""}: ${h(G.keys,", ")}`;case"invalid_key":return`${G.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${G.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function ZH(){return{localeError:kP()}}function fF($,X,Y,U){let G=Math.abs($),z=G%10,W=G%100;if(W>=11&&W<=19)return U;if(z===1)return X;if(z>=2&&z<=4)return Y;return U}var bP=()=>{let $={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(G))return"\u043C\u0430\u0441\u0456\u045E";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return(G)=>{switch(G.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${G.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${o(G.values[0])}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W){let Q=Number(G.maximum),Z=fF(Q,W.unit.one,W.unit.few,W.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${G.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${W.verb} ${z}${G.maximum.toString()} ${Z}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${G.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W){let Q=Number(G.minimum),Z=fF(Q,W.unit.one,W.unit.few,W.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${G.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${W.verb} ${z}${G.minimum.toString()} ${Z}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${G.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${z.prefix}"`;if(z.format==="ends_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${z.suffix}"`;if(z.format==="includes")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${z.includes}"`;if(z.format==="regex")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${z.pattern}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${U[z.format]??G.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${G.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${G.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${h(G.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${G.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${G.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function HH(){return{localeError:bP()}}var fP=()=>{let $={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"entrada",email:"adre\xE7a electr\xF2nica",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:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return(G)=>{switch(G.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${G.expected}, s'ha rebut ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Valor inv\xE0lid: s'esperava ${o(G.values[0])}`;return`Opci\xF3 inv\xE0lida: s'esperava una de ${h(G.values," o ")}`;case"too_big":{let z=G.inclusive?"com a m\xE0xim":"menys de",W=X(G.origin);if(W)return`Massa gran: s'esperava que ${G.origin??"el valor"} contingu\xE9s ${z} ${G.maximum.toString()} ${W.unit??"elements"}`;return`Massa gran: s'esperava que ${G.origin??"el valor"} fos ${z} ${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?"com a m\xEDnim":"m\xE9s de",W=X(G.origin);if(W)return`Massa petit: s'esperava que ${G.origin} contingu\xE9s ${z} ${G.minimum.toString()} ${W.unit}`;return`Massa petit: s'esperava que ${G.origin} fos ${z} ${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Format inv\xE0lid: ha de comen\xE7ar amb "${z.prefix}"`;if(z.format==="ends_with")return`Format inv\xE0lid: ha d'acabar amb "${z.suffix}"`;if(z.format==="includes")return`Format inv\xE0lid: ha d'incloure "${z.includes}"`;if(z.format==="regex")return`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${z.pattern}`;return`Format inv\xE0lid per a ${U[z.format]??G.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${G.divisor}`;case"unrecognized_keys":return`Clau${G.keys.length>1?"s":""} no reconeguda${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${G.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${G.origin}`;default:return"Entrada inv\xE0lida"}}};function VH(){return{localeError:fP()}}var hP=()=>{let $={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(G))return"pole";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",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:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return(G)=>{switch(G.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${G.expected}, obdr\u017Eeno ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o(G.values[0])}`;return`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${G.origin??"hodnota"} mus\xED m\xEDt ${z}${G.maximum.toString()} ${W.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${G.origin??"hodnota"} mus\xED b\xFDt ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${G.origin??"hodnota"} mus\xED m\xEDt ${z}${G.minimum.toString()} ${W.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${G.origin??"hodnota"} mus\xED b\xFDt ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${z.prefix}"`;if(z.format==="ends_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${z.suffix}"`;if(z.format==="includes")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${z.includes}"`;if(z.format==="regex")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${z.pattern}`;return`Neplatn\xFD form\xE1t ${U[z.format]??G.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${G.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${h(G.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${G.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${G.origin}`;default:return"Neplatn\xFD vstup"}}};function OH(){return{localeError:hP()}}var gP=()=>{let $={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"Zahl";case"object":{if(Array.isArray(G))return"Array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"Eingabe",email:"E-Mail-Adresse",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-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(G)=>{switch(G.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${G.expected}, erhalten ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Ung\xFCltige Eingabe: erwartet ${o(G.values[0])}`;return`Ung\xFCltige Option: erwartet eine von ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Zu gro\xDF: erwartet, dass ${G.origin??"Wert"} ${z}${G.maximum.toString()} ${W.unit??"Elemente"} hat`;return`Zu gro\xDF: erwartet, dass ${G.origin??"Wert"} ${z}${G.maximum.toString()} ist`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Zu klein: erwartet, dass ${G.origin} ${z}${G.minimum.toString()} ${W.unit} hat`;return`Zu klein: erwartet, dass ${G.origin} ${z}${G.minimum.toString()} ist`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Ung\xFCltiger String: muss mit "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ung\xFCltiger String: muss mit "${z.suffix}" enden`;if(z.format==="includes")return`Ung\xFCltiger String: muss "${z.includes}" enthalten`;if(z.format==="regex")return`Ung\xFCltiger String: muss dem Muster ${z.pattern} entsprechen`;return`Ung\xFCltig: ${U[z.format]??G.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${G.divisor} sein`;case"unrecognized_keys":return`${G.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${h(G.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${G.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${G.origin}`;default:return"Ung\xFCltige Eingabe"}}};function wH(){return{localeError:gP()}}var yP=($)=>{let X=typeof $;switch(X){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return X},mP=()=>{let $={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 X(U){return $[U]??null}let Y={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",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(U)=>{switch(U.code){case"invalid_type":return`Invalid input: expected ${U.expected}, received ${yP(U.input)}`;case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${o(U.values[0])}`;return`Invalid option: expected one of ${h(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=X(U.origin);if(z)return`Too big: expected ${U.origin??"value"} to have ${G}${U.maximum.toString()} ${z.unit??"elements"}`;return`Too big: expected ${U.origin??"value"} to be ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=X(U.origin);if(z)return`Too small: expected ${U.origin} to have ${G}${U.minimum.toString()} ${z.unit}`;return`Too small: expected ${U.origin} to be ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Invalid string: must start with "${G.prefix}"`;if(G.format==="ends_with")return`Invalid string: must end with "${G.suffix}"`;if(G.format==="includes")return`Invalid string: must include "${G.includes}"`;if(G.format==="regex")return`Invalid string: must match pattern ${G.pattern}`;return`Invalid ${Y[G.format]??U.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${U.divisor}`;case"unrecognized_keys":return`Unrecognized key${U.keys.length>1?"s":""}: ${h(U.keys,", ")}`;case"invalid_key":return`Invalid key in ${U.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${U.origin}`;default:return"Invalid input"}}};function EY(){return{localeError:mP()}}var uP=($)=>{let X=typeof $;switch(X){case"number":return Number.isNaN($)?"NaN":"nombro";case"object":{if(Array.isArray($))return"tabelo";if($===null)return"senvalora";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return X},cP=()=>{let $={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function X(U){return $[U]??null}let Y={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(U)=>{switch(U.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${U.expected}, ricevi\u011Dis ${uP(U.input)}`;case"invalid_value":if(U.values.length===1)return`Nevalida enigo: atendi\u011Dis ${o(U.values[0])}`;return`Nevalida opcio: atendi\u011Dis unu el ${h(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=X(U.origin);if(z)return`Tro granda: atendi\u011Dis ke ${U.origin??"valoro"} havu ${G}${U.maximum.toString()} ${z.unit??"elementojn"}`;return`Tro granda: atendi\u011Dis ke ${U.origin??"valoro"} havu ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=X(U.origin);if(z)return`Tro malgranda: atendi\u011Dis ke ${U.origin} havu ${G}${U.minimum.toString()} ${z.unit}`;return`Tro malgranda: atendi\u011Dis ke ${U.origin} estu ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Nevalida karaktraro: devas komenci\u011Di per "${G.prefix}"`;if(G.format==="ends_with")return`Nevalida karaktraro: devas fini\u011Di per "${G.suffix}"`;if(G.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${G.includes}"`;if(G.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${G.pattern}`;return`Nevalida ${Y[G.format]??U.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${U.divisor}`;case"unrecognized_keys":return`Nekonata${U.keys.length>1?"j":""} \u015Dlosilo${U.keys.length>1?"j":""}: ${h(U.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${U.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${U.origin}`;default:return"Nevalida enigo"}}};function DH(){return{localeError:cP()}}var pP=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(G))return"arreglo";if(G===null)return"nulo";if(Object.getPrototypeOf(G)!==Object.prototype)return G.constructor.name}}return z},U={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",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:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return(G)=>{switch(G.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${G.expected}, recibido ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Entrada inv\xE1lida: se esperaba ${o(G.values[0])}`;return`Opci\xF3n inv\xE1lida: se esperaba una de ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Demasiado grande: se esperaba que ${G.origin??"valor"} tuviera ${z}${G.maximum.toString()} ${W.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${G.origin??"valor"} fuera ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Demasiado peque\xF1o: se esperaba que ${G.origin} tuviera ${z}${G.minimum.toString()} ${W.unit}`;return`Demasiado peque\xF1o: se esperaba que ${G.origin} fuera ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Cadena inv\xE1lida: debe comenzar con "${z.prefix}"`;if(z.format==="ends_with")return`Cadena inv\xE1lida: debe terminar en "${z.suffix}"`;if(z.format==="includes")return`Cadena inv\xE1lida: debe incluir "${z.includes}"`;if(z.format==="regex")return`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${z.pattern}`;return`Inv\xE1lido ${U[z.format]??G.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${G.divisor}`;case"unrecognized_keys":return`Llave${G.keys.length>1?"s":""} desconocida${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${G.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${G.origin}`;default:return"Entrada inv\xE1lida"}}};function EH(){return{localeError:pP()}}var dP=()=>{let $={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(G))return"\u0622\u0631\u0627\u06CC\u0647";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return(G)=>{switch(G.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${G.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${Y(G.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":if(G.values.length===1)return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o(G.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`;return`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${h(G.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${G.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${z}${G.maximum.toString()} ${W.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${G.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${z}${G.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${G.origin} \u0628\u0627\u06CC\u062F ${z}${G.minimum.toString()} ${W.unit} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${G.origin} \u0628\u0627\u06CC\u062F ${z}${G.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${z.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`;if(z.format==="ends_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${z.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`;if(z.format==="includes")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${z.includes}" \u0628\u0627\u0634\u062F`;if(z.format==="regex")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${z.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`;return`${U[z.format]??G.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${G.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${G.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${h(G.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${G.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${G.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function NH(){return{localeError:dP()}}var lP=()=>{let $={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(G)=>{switch(G.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${G.expected}, oli ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Virheellinen sy\xF6te: t\xE4ytyy olla ${o(G.values[0])}`;return`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Liian suuri: ${W.subject} t\xE4ytyy olla ${z}${G.maximum.toString()} ${W.unit}`.trim();return`Liian suuri: arvon t\xE4ytyy olla ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Liian pieni: ${W.subject} t\xE4ytyy olla ${z}${G.minimum.toString()} ${W.unit}`.trim();return`Liian pieni: arvon t\xE4ytyy olla ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${z.prefix}"`;if(z.format==="ends_with")return`Virheellinen sy\xF6te: t\xE4ytyy loppua "${z.suffix}"`;if(z.format==="includes")return`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${z.includes}"`;if(z.format==="regex")return`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${z.pattern}`;return`Virheellinen ${U[z.format]??G.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${G.divisor} monikerta`;case"unrecognized_keys":return`${G.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${h(G.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function FH(){return{localeError:lP()}}var rP=()=>{let $={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"nombre";case"object":{if(Array.isArray(G))return"tableau";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"entr\xE9e",email:"adresse e-mail",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:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return(G)=>{switch(G.code){case"invalid_type":return`Entr\xE9e invalide : ${G.expected} attendu, ${Y(G.input)} re\xE7u`;case"invalid_value":if(G.values.length===1)return`Entr\xE9e invalide : ${o(G.values[0])} attendu`;return`Option invalide : une valeur parmi ${h(G.values,"|")} attendue`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Trop grand : ${G.origin??"valeur"} doit ${W.verb} ${z}${G.maximum.toString()} ${W.unit??"\xE9l\xE9ment(s)"}`;return`Trop grand : ${G.origin??"valeur"} doit \xEAtre ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Trop petit : ${G.origin} doit ${W.verb} ${z}${G.minimum.toString()} ${W.unit}`;return`Trop petit : ${G.origin} doit \xEAtre ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Cha\xEEne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Cha\xEEne invalide : doit correspondre au mod\xE8le ${z.pattern}`;return`${U[z.format]??G.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${G.divisor}`;case"unrecognized_keys":return`Cl\xE9${G.keys.length>1?"s":""} non reconnue${G.keys.length>1?"s":""} : ${h(G.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${G.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${G.origin}`;default:return"Entr\xE9e invalide"}}};function MH(){return{localeError:rP()}}var iP=()=>{let $={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"entr\xE9e",email:"adresse courriel",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:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return(G)=>{switch(G.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${G.expected}, re\xE7u ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Entr\xE9e invalide : attendu ${o(G.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"\u2264":"<",W=X(G.origin);if(W)return`Trop grand : attendu que ${G.origin??"la valeur"} ait ${z}${G.maximum.toString()} ${W.unit}`;return`Trop grand : attendu que ${G.origin??"la valeur"} soit ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?"\u2265":">",W=X(G.origin);if(W)return`Trop petit : attendu que ${G.origin} ait ${z}${G.minimum.toString()} ${W.unit}`;return`Trop petit : attendu que ${G.origin} soit ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Cha\xEEne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Cha\xEEne invalide : doit correspondre au motif ${z.pattern}`;return`${U[z.format]??G.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${G.divisor}`;case"unrecognized_keys":return`Cl\xE9${G.keys.length>1?"s":""} non reconnue${G.keys.length>1?"s":""} : ${h(G.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${G.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${G.origin}`;default:return"Entr\xE9e invalide"}}};function JH(){return{localeError:iP()}}var oP=()=>{let $={string:{unit:"\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u05E7\u05DC\u05D8",email:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",url:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",emoji:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",date:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",time:"\u05D6\u05DE\u05DF ISO",duration:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",ipv4:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",ipv6:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",cidrv4:"\u05D8\u05D5\u05D5\u05D7 IPv4",cidrv6:"\u05D8\u05D5\u05D5\u05D7 IPv6",base64:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",base64url:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",json_string:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",e164:"\u05DE\u05E1\u05E4\u05E8 E.164",jwt:"JWT",template_literal:"\u05E7\u05DC\u05D8"};return(G)=>{switch(G.code){case"invalid_type":return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${G.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${o(G.values[0])}`;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05D0\u05D7\u05EA \u05DE\u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${G.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${z}${G.maximum.toString()} ${W.unit??"elements"}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${G.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${G.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${z}${G.minimum.toString()} ${W.unit}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${G.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1"${z.prefix}"`;if(z.format==="ends_with")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${z.suffix}"`;if(z.format==="includes")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${z.includes}"`;if(z.format==="regex")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${z.pattern}`;return`${U[z.format]??G.format} \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${G.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${G.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${G.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${h(G.keys,", ")}`;case"invalid_key":return`\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${G.origin}`;case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${G.origin}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function AH(){return{localeError:oP()}}var nP=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(G))return"t\xF6mb";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"bemenet",email:"email c\xEDm",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 id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return(G)=>{switch(G.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${G.expected}, a kapott \xE9rt\xE9k ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o(G.values[0])}`;return`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`T\xFAl nagy: ${G.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${z}${G.maximum.toString()} ${W.unit??"elem"}`;return`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${G.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${G.origin} m\xE9rete t\xFAl kicsi ${z}${G.minimum.toString()} ${W.unit}`;return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${G.origin} t\xFAl kicsi ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\xC9rv\xE9nytelen string: "${z.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`;if(z.format==="ends_with")return`\xC9rv\xE9nytelen string: "${z.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`;if(z.format==="includes")return`\xC9rv\xE9nytelen string: "${z.includes}" \xE9rt\xE9ket kell tartalmaznia`;if(z.format==="regex")return`\xC9rv\xE9nytelen string: ${z.pattern} mint\xE1nak kell megfelelnie`;return`\xC9rv\xE9nytelen ${U[z.format]??G.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${G.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${G.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${G.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function LH(){return{localeError:nP()}}var tP=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"input",email:"alamat email",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:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(G)=>{switch(G.code){case"invalid_type":return`Input tidak valid: diharapkan ${G.expected}, diterima ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Input tidak valid: diharapkan ${o(G.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Terlalu besar: diharapkan ${G.origin??"value"} memiliki ${z}${G.maximum.toString()} ${W.unit??"elemen"}`;return`Terlalu besar: diharapkan ${G.origin??"value"} menjadi ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Terlalu kecil: diharapkan ${G.origin} memiliki ${z}${G.minimum.toString()} ${W.unit}`;return`Terlalu kecil: diharapkan ${G.origin} menjadi ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`String tidak valid: harus dimulai dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak valid: harus berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak valid: harus menyertakan "${z.includes}"`;if(z.format==="regex")return`String tidak valid: harus sesuai pola ${z.pattern}`;return`${U[z.format]??G.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${G.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${G.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${G.origin}`;default:return"Input tidak valid"}}};function KH(){return{localeError:tP()}}var aP=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"numero";case"object":{if(Array.isArray(G))return"vettore";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"input",email:"indirizzo email",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:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(G)=>{switch(G.code){case"invalid_type":return`Input non valido: atteso ${G.expected}, ricevuto ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Input non valido: atteso ${o(G.values[0])}`;return`Opzione non valida: atteso uno tra ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Troppo grande: ${G.origin??"valore"} deve avere ${z}${G.maximum.toString()} ${W.unit??"elementi"}`;return`Troppo grande: ${G.origin??"valore"} deve essere ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Troppo piccolo: ${G.origin} deve avere ${z}${G.minimum.toString()} ${W.unit}`;return`Troppo piccolo: ${G.origin} deve essere ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Stringa non valida: deve iniziare con "${z.prefix}"`;if(z.format==="ends_with")return`Stringa non valida: deve terminare con "${z.suffix}"`;if(z.format==="includes")return`Stringa non valida: deve includere "${z.includes}"`;if(z.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${z.pattern}`;return`Invalid ${U[z.format]??G.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${G.divisor}`;case"unrecognized_keys":return`Chiav${G.keys.length>1?"i":"e"} non riconosciut${G.keys.length>1?"e":"a"}: ${h(G.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${G.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${G.origin}`;default:return"Input non valido"}}};function _H(){return{localeError:aP()}}var sP=()=>{let $={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(G))return"\u914D\u5217";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return(G)=>{switch(G.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${G.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${Y(G.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":if(G.values.length===1)return`\u7121\u52B9\u306A\u5165\u529B: ${o(G.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u9078\u629E: ${h(G.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let z=G.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",W=X(G.origin);if(W)return`\u5927\u304D\u3059\u304E\u308B\u5024: ${G.origin??"\u5024"}\u306F${G.maximum.toString()}${W.unit??"\u8981\u7D20"}${z}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5927\u304D\u3059\u304E\u308B\u5024: ${G.origin??"\u5024"}\u306F${G.maximum.toString()}${z}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let z=G.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",W=X(G.origin);if(W)return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${G.origin}\u306F${G.minimum.toString()}${W.unit}${z}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${G.origin}\u306F${G.minimum.toString()}${z}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${z.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(z.format==="ends_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${z.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(z.format==="includes")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${z.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(z.format==="regex")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${z.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u7121\u52B9\u306A${U[z.format]??G.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${G.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${G.keys.length>1?"\u7FA4":""}: ${h(G.keys,"\u3001")}`;case"invalid_key":return`${G.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${G.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function qH(){return{localeError:sP()}}var eP=()=>{let $={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(G))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(G===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return(G)=>{switch(G.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${G.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o(G.values[0])}`;return`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${G.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${z} ${G.maximum.toString()} ${W.unit??"\u1792\u17B6\u178F\u17BB"}`;return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${G.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${z} ${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${G.origin} ${z} ${G.minimum.toString()} ${W.unit}`;return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${G.origin} ${z} ${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${z.prefix}"`;if(z.format==="ends_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${z.suffix}"`;if(z.format==="includes")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${z.includes}"`;if(z.format==="regex")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${z.pattern}`;return`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${U[z.format]??G.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${G.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${h(G.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${G.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${G.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function RH(){return{localeError:eP()}}var $I=()=>{let $={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return(G)=>{switch(G.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${G.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${Y(G.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":if(G.values.length===1)return`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${o(G.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC635\uC158: ${h(G.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let z=G.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",W=z==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",Q=X(G.origin),Z=Q?.unit??"\uC694\uC18C";if(Q)return`${G.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${G.maximum.toString()}${Z} ${z}${W}`;return`${G.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${G.maximum.toString()} ${z}${W}`}case"too_small":{let z=G.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",W=z==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",Q=X(G.origin),Z=Q?.unit??"\uC694\uC18C";if(Q)return`${G.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${G.minimum.toString()}${Z} ${z}${W}`;return`${G.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${G.minimum.toString()} ${z}${W}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${z.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`;if(z.format==="ends_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${z.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`;if(z.format==="includes")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${z.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`;if(z.format==="regex")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${z.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C ${U[z.format]??G.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${G.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${h(G.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${G.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${G.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function TH(){return{localeError:$I()}}var XI=()=>{let $={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(G))return"\u043D\u0438\u0437\u0430";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return(G)=>{switch(G.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${G.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Invalid input: expected ${o(G.values[0])}`;return`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${G.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${z}${G.maximum.toString()} ${W.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${G.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${G.origin} \u0434\u0430 \u0438\u043C\u0430 ${z}${G.minimum.toString()} ${W.unit}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${G.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${z.prefix}"`;if(z.format==="ends_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${z.suffix}"`;if(z.format==="includes")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${z.includes}"`;if(z.format==="regex")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${z.pattern}`;return`Invalid ${U[z.format]??G.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${G.divisor}`;case"unrecognized_keys":return`${G.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${h(G.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${G.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${G.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function vH(){return{localeError:XI()}}var YI=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"nombor";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"input",email:"alamat e-mel",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:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(G)=>{switch(G.code){case"invalid_type":return`Input tidak sah: dijangka ${G.expected}, diterima ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Input tidak sah: dijangka ${o(G.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Terlalu besar: dijangka ${G.origin??"nilai"} ${W.verb} ${z}${G.maximum.toString()} ${W.unit??"elemen"}`;return`Terlalu besar: dijangka ${G.origin??"nilai"} adalah ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Terlalu kecil: dijangka ${G.origin} ${W.verb} ${z}${G.minimum.toString()} ${W.unit}`;return`Terlalu kecil: dijangka ${G.origin} adalah ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`String tidak sah: mesti bermula dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak sah: mesti mengandungi "${z.includes}"`;if(z.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${z.pattern}`;return`${U[z.format]??G.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${G.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${h(G.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${G.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${G.origin}`;default:return"Input tidak sah"}}};function CH(){return{localeError:YI()}}var GI=()=>{let $={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"getal";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"invoer",email:"emailadres",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 datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(G)=>{switch(G.code){case"invalid_type":return`Ongeldige invoer: verwacht ${G.expected}, ontving ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Ongeldige invoer: verwacht ${o(G.values[0])}`;return`Ongeldige optie: verwacht \xE9\xE9n van ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Te lang: verwacht dat ${G.origin??"waarde"} ${z}${G.maximum.toString()} ${W.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${G.origin??"waarde"} ${z}${G.maximum.toString()} is`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Te kort: verwacht dat ${G.origin} ${z}${G.minimum.toString()} ${W.unit} bevat`;return`Te kort: verwacht dat ${G.origin} ${z}${G.minimum.toString()} is`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Ongeldige tekst: moet met "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ongeldige tekst: moet op "${z.suffix}" eindigen`;if(z.format==="includes")return`Ongeldige tekst: moet "${z.includes}" bevatten`;if(z.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${z.pattern}`;return`Ongeldig: ${U[z.format]??G.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${G.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${G.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${G.origin}`;default:return"Ongeldige invoer"}}};function BH(){return{localeError:GI()}}var UI=()=>{let $={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"tall";case"object":{if(Array.isArray(G))return"liste";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(G)=>{switch(G.code){case"invalid_type":return`Ugyldig input: forventet ${G.expected}, fikk ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Ugyldig verdi: forventet ${o(G.values[0])}`;return`Ugyldig valg: forventet en av ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`For stor(t): forventet ${G.origin??"value"} til \xE5 ha ${z}${G.maximum.toString()} ${W.unit??"elementer"}`;return`For stor(t): forventet ${G.origin??"value"} til \xE5 ha ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`For lite(n): forventet ${G.origin} til \xE5 ha ${z}${G.minimum.toString()} ${W.unit}`;return`For lite(n): forventet ${G.origin} til \xE5 ha ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Ugyldig streng: m\xE5 starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: m\xE5 ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: m\xE5 inneholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: m\xE5 matche m\xF8nsteret ${z.pattern}`;return`Ugyldig ${U[z.format]??G.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${G.divisor}`;case"unrecognized_keys":return`${G.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${h(G.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${G.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${G.origin}`;default:return"Ugyldig input"}}};function jH(){return{localeError:UI()}}var zI=()=>{let $={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"numara";case"object":{if(Array.isArray(G))return"saf";if(G===null)return"gayb";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"giren",email:"epostag\xE2h",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 heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return(G)=>{switch(G.code){case"invalid_type":return`F\xE2sit giren: umulan ${G.expected}, al\u0131nan ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`F\xE2sit giren: umulan ${o(G.values[0])}`;return`F\xE2sit tercih: m\xFBteberler ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Fazla b\xFCy\xFCk: ${G.origin??"value"}, ${z}${G.maximum.toString()} ${W.unit??"elements"} sahip olmal\u0131yd\u0131.`;return`Fazla b\xFCy\xFCk: ${G.origin??"value"}, ${z}${G.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Fazla k\xFC\xE7\xFCk: ${G.origin}, ${z}${G.minimum.toString()} ${W.unit} sahip olmal\u0131yd\u0131.`;return`Fazla k\xFC\xE7\xFCk: ${G.origin}, ${z}${G.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`F\xE2sit metin: "${z.prefix}" ile ba\u015Flamal\u0131.`;if(z.format==="ends_with")return`F\xE2sit metin: "${z.suffix}" ile bitmeli.`;if(z.format==="includes")return`F\xE2sit metin: "${z.includes}" ihtiv\xE2 etmeli.`;if(z.format==="regex")return`F\xE2sit metin: ${z.pattern} nak\u015F\u0131na uymal\u0131.`;return`F\xE2sit ${U[z.format]??G.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${G.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`${G.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${G.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function PH(){return{localeError:zI()}}var WI=()=>{let $={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(G))return"\u0627\u0631\u06D0";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return(G)=>{switch(G.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${G.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${Y(G.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":if(G.values.length===1)return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o(G.values[0])} \u0648\u0627\u06CC`;return`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${h(G.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${G.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${z}${G.maximum.toString()} ${W.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${G.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${z}${G.maximum.toString()} \u0648\u064A`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${G.origin} \u0628\u0627\u06CC\u062F ${z}${G.minimum.toString()} ${W.unit} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${G.origin} \u0628\u0627\u06CC\u062F ${z}${G.minimum.toString()} \u0648\u064A`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${z.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`;if(z.format==="ends_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${z.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`;if(z.format==="includes")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${z.includes}" \u0648\u0644\u0631\u064A`;if(z.format==="regex")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${z.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`;return`${U[z.format]??G.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${G.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${G.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${h(G.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${G.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${G.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function IH(){return{localeError:WI()}}var QI=()=>{let $={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"liczba";case"object":{if(Array.isArray(G))return"tablica";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"wyra\u017Cenie",email:"adres email",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:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return(G)=>{switch(G.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${G.expected}, otrzymano ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o(G.values[0])}`;return`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${G.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${z}${G.maximum.toString()} ${W.unit??"element\xF3w"}`;return`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${G.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${G.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${z}${G.minimum.toString()} ${W.unit??"element\xF3w"}`;return`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${G.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${z.prefix}"`;if(z.format==="ends_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${z.suffix}"`;if(z.format==="includes")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${z.includes}"`;if(z.format==="regex")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${z.pattern}`;return`Nieprawid\u0142ow(y/a/e) ${U[z.format]??G.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${G.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${G.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${G.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function xH(){return{localeError:QI()}}var ZI=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(G))return"array";if(G===null)return"nulo";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"padr\xE3o",email:"endere\xE7o de e-mail",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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return(G)=>{switch(G.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${G.expected}, recebido ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Entrada inv\xE1lida: esperado ${o(G.values[0])}`;return`Op\xE7\xE3o inv\xE1lida: esperada uma das ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Muito grande: esperado que ${G.origin??"valor"} tivesse ${z}${G.maximum.toString()} ${W.unit??"elementos"}`;return`Muito grande: esperado que ${G.origin??"valor"} fosse ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Muito pequeno: esperado que ${G.origin} tivesse ${z}${G.minimum.toString()} ${W.unit}`;return`Muito pequeno: esperado que ${G.origin} fosse ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Texto inv\xE1lido: deve come\xE7ar com "${z.prefix}"`;if(z.format==="ends_with")return`Texto inv\xE1lido: deve terminar com "${z.suffix}"`;if(z.format==="includes")return`Texto inv\xE1lido: deve incluir "${z.includes}"`;if(z.format==="regex")return`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${z.pattern}`;return`${U[z.format]??G.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${G.divisor}`;case"unrecognized_keys":return`Chave${G.keys.length>1?"s":""} desconhecida${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${G.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${G.origin}`;default:return"Campo inv\xE1lido"}}};function SH(){return{localeError:ZI()}}function hF($,X,Y,U){let G=Math.abs($),z=G%10,W=G%100;if(W>=11&&W<=19)return U;if(z===1)return X;if(z>=2&&z<=4)return Y;return U}var HI=()=>{let $={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(G))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return(G)=>{switch(G.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${G.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o(G.values[0])}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W){let Q=Number(G.maximum),Z=hF(Q,W.unit.one,W.unit.few,W.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${G.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${z}${G.maximum.toString()} ${Z}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${G.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W){let Q=Number(G.minimum),Z=hF(Q,W.unit.one,W.unit.few,W.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${G.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${z}${G.minimum.toString()} ${Z}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${G.origin} \u0431\u0443\u0434\u0435\u0442 ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${z.prefix}"`;if(z.format==="ends_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${z.suffix}"`;if(z.format==="includes")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${z.includes}"`;if(z.format==="regex")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${z.pattern}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${U[z.format]??G.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${G.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${G.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${G.keys.length>1?"\u0438":""}: ${h(G.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${G.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${G.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function kH(){return{localeError:HI()}}var VI=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(G))return"tabela";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"vnos",email:"e-po\u0161tni naslov",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 datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return(G)=>{switch(G.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${G.expected}, prejeto ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Neveljaven vnos: pri\u010Dakovano ${o(G.values[0])}`;return`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Preveliko: pri\u010Dakovano, da bo ${G.origin??"vrednost"} imelo ${z}${G.maximum.toString()} ${W.unit??"elementov"}`;return`Preveliko: pri\u010Dakovano, da bo ${G.origin??"vrednost"} ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Premajhno: pri\u010Dakovano, da bo ${G.origin} imelo ${z}${G.minimum.toString()} ${W.unit}`;return`Premajhno: pri\u010Dakovano, da bo ${G.origin} ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Neveljaven niz: mora se za\u010Deti z "${z.prefix}"`;if(z.format==="ends_with")return`Neveljaven niz: mora se kon\u010Dati z "${z.suffix}"`;if(z.format==="includes")return`Neveljaven niz: mora vsebovati "${z.includes}"`;if(z.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${z.pattern}`;return`Neveljaven ${U[z.format]??G.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${G.divisor}`;case"unrecognized_keys":return`Neprepoznan${G.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${h(G.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${G.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${G.origin}`;default:return"Neveljaven vnos"}}};function bH(){return{localeError:VI()}}var OI=()=>{let $={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"antal";case"object":{if(Array.isArray(G))return"lista";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"regulj\xE4rt uttryck",email:"e-postadress",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-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(G)=>{switch(G.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${G.expected}, fick ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Ogiltig inmatning: f\xF6rv\xE4ntat ${o(G.values[0])}`;return`Ogiltigt val: f\xF6rv\xE4ntade en av ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`F\xF6r stor(t): f\xF6rv\xE4ntade ${G.origin??"v\xE4rdet"} att ha ${z}${G.maximum.toString()} ${W.unit??"element"}`;return`F\xF6r stor(t): f\xF6rv\xE4ntat ${G.origin??"v\xE4rdet"} att ha ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`F\xF6r lite(t): f\xF6rv\xE4ntade ${G.origin??"v\xE4rdet"} att ha ${z}${G.minimum.toString()} ${W.unit}`;return`F\xF6r lite(t): f\xF6rv\xE4ntade ${G.origin??"v\xE4rdet"} att ha ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${z.prefix}"`;if(z.format==="ends_with")return`Ogiltig str\xE4ng: m\xE5ste sluta med "${z.suffix}"`;if(z.format==="includes")return`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${z.includes}"`;if(z.format==="regex")return`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${z.pattern}"`;return`Ogiltig(t) ${U[z.format]??G.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${G.divisor}`;case"unrecognized_keys":return`${G.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${h(G.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${G.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${G.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function fH(){return{localeError:OI()}}var wI=()=>{let $={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(G))return"\u0B85\u0BA3\u0BBF";if(G===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",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 \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return(G)=>{switch(G.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${G.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o(G.values[0])}`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${h(G.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${G.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${z}${G.maximum.toString()} ${W.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${G.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${z}${G.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${G.origin} ${z}${G.minimum.toString()} ${W.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${G.origin} ${z}${G.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${z.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(z.format==="ends_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${z.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(z.format==="includes")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${z.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(z.format==="regex")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${z.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${U[z.format]??G.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${G.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${G.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${h(G.keys,", ")}`;case"invalid_key":return`${G.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${G.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function hH(){return{localeError:wI()}}var DI=()=>{let $={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(G))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(G===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return(G)=>{switch(G.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${G.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o(G.values[0])}`;return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",W=X(G.origin);if(W)return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${G.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${z} ${G.maximum.toString()} ${W.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`;return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${G.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${z} ${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",W=X(G.origin);if(W)return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${G.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${z} ${G.minimum.toString()} ${W.unit}`;return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${G.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${z} ${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${z.prefix}"`;if(z.format==="ends_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${z.suffix}"`;if(z.format==="includes")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${z.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`;if(z.format==="regex")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${z.pattern}`;return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${U[z.format]??G.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${G.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${h(G.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${G.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${G.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function gH(){return{localeError:DI()}}var EI=($)=>{let X=typeof $;switch(X){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return X},NI=()=>{let $={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function X(U){return $[U]??null}let Y={regex:"girdi",email:"e-posta adresi",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 tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return(U)=>{switch(U.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${U.expected}, al\u0131nan ${EI(U.input)}`;case"invalid_value":if(U.values.length===1)return`Ge\xE7ersiz de\u011Fer: beklenen ${o(U.values[0])}`;return`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${h(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=X(U.origin);if(z)return`\xC7ok b\xFCy\xFCk: beklenen ${U.origin??"de\u011Fer"} ${G}${U.maximum.toString()} ${z.unit??"\xF6\u011Fe"}`;return`\xC7ok b\xFCy\xFCk: beklenen ${U.origin??"de\u011Fer"} ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=X(U.origin);if(z)return`\xC7ok k\xFC\xE7\xFCk: beklenen ${U.origin} ${G}${U.minimum.toString()} ${z.unit}`;return`\xC7ok k\xFC\xE7\xFCk: beklenen ${U.origin} ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Ge\xE7ersiz metin: "${G.prefix}" ile ba\u015Flamal\u0131`;if(G.format==="ends_with")return`Ge\xE7ersiz metin: "${G.suffix}" ile bitmeli`;if(G.format==="includes")return`Ge\xE7ersiz metin: "${G.includes}" i\xE7ermeli`;if(G.format==="regex")return`Ge\xE7ersiz metin: ${G.pattern} desenine uymal\u0131`;return`Ge\xE7ersiz ${Y[G.format]??U.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${U.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${U.keys.length>1?"lar":""}: ${h(U.keys,", ")}`;case"invalid_key":return`${U.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${U.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function yH(){return{localeError:NI()}}var FI=()=>{let $={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(G))return"\u043C\u0430\u0441\u0438\u0432";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return(G)=>{switch(G.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${G.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o(G.values[0])}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${G.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${W.verb} ${z}${G.maximum.toString()} ${W.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${G.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${G.origin} ${W.verb} ${z}${G.minimum.toString()} ${W.unit}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${G.origin} \u0431\u0443\u0434\u0435 ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${z.prefix}"`;if(z.format==="ends_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${z.suffix}"`;if(z.format==="includes")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${z.includes}"`;if(z.format==="regex")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${z.pattern}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${U[z.format]??G.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${G.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${G.keys.length>1?"\u0456":""}: ${h(G.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${G.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${G.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function mH(){return{localeError:FI()}}var MI=()=>{let $={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(G))return"\u0622\u0631\u06D2";if(G===null)return"\u0646\u0644";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return(G)=>{switch(G.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${G.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${Y(G.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":if(G.values.length===1)return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o(G.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;return`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${h(G.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${G.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${z}${G.maximum.toString()} ${W.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${G.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${z}${G.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${G.origin} \u06A9\u06D2 ${z}${G.minimum.toString()} ${W.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${G.origin} \u06A9\u0627 ${z}${G.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${z.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(z.format==="ends_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${z.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(z.format==="includes")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${z.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(z.format==="regex")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${z.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;return`\u063A\u0644\u0637 ${U[z.format]??G.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${G.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${G.keys.length>1?"\u0632":""}: ${h(G.keys,"\u060C ")}`;case"invalid_key":return`${G.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${G.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function uH(){return{localeError:MI()}}var JI=()=>{let $={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(G))return"m\u1EA3ng";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",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:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return(G)=>{switch(G.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${G.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o(G.values[0])}`;return`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${G.origin??"gi\xE1 tr\u1ECB"} ${W.verb} ${z}${G.maximum.toString()} ${W.unit??"ph\u1EA7n t\u1EED"}`;return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${G.origin??"gi\xE1 tr\u1ECB"} ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${G.origin} ${W.verb} ${z}${G.minimum.toString()} ${W.unit}`;return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${G.origin} ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${z.prefix}"`;if(z.format==="ends_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${z.suffix}"`;if(z.format==="includes")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${z.includes}"`;if(z.format==="regex")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${z.pattern}`;return`${U[z.format]??G.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${G.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${h(G.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${G.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${G.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function cH(){return{localeError:JI()}}var AI=()=>{let $={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(G))return"\u6570\u7EC4";if(G===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return(G)=>{switch(G.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${G.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o(G.values[0])}`;return`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${G.origin??"\u503C"} ${z}${G.maximum.toString()} ${W.unit??"\u4E2A\u5143\u7D20"}`;return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${G.origin??"\u503C"} ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${G.origin} ${z}${G.minimum.toString()} ${W.unit}`;return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${G.origin} ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${z.prefix}" \u5F00\u5934`;if(z.format==="ends_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${z.suffix}" \u7ED3\u5C3E`;if(z.format==="includes")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${z.includes}"`;if(z.format==="regex")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${z.pattern}`;return`\u65E0\u6548${U[z.format]??G.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${G.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${h(G.keys,", ")}`;case"invalid_key":return`${G.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${G.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function pH(){return{localeError:AI()}}var LI=()=>{let $={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",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 \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return(G)=>{switch(G.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${G.expected}\uFF0C\u4F46\u6536\u5230 ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o(G.values[0])}`;return`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${G.origin??"\u503C"} \u61C9\u70BA ${z}${G.maximum.toString()} ${W.unit??"\u500B\u5143\u7D20"}`;return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${G.origin??"\u503C"} \u61C9\u70BA ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${G.origin} \u61C9\u70BA ${z}${G.minimum.toString()} ${W.unit}`;return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${G.origin} \u61C9\u70BA ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${z.prefix}" \u958B\u982D`;if(z.format==="ends_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${z.suffix}" \u7D50\u5C3E`;if(z.format==="includes")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${z.includes}"`;if(z.format==="regex")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${z.pattern}`;return`\u7121\u6548\u7684 ${U[z.format]??G.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${G.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${G.keys.length>1?"\u5011":""}\uFF1A${h(G.keys,"\u3001")}`;case"invalid_key":return`${G.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${G.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function dH(){return{localeError:LI()}}var lH=Symbol("ZodOutput"),rH=Symbol("ZodInput");class FY{constructor(){this._map=new Map,this._idmap=new Map}add($,...X){let Y=X[0];if(this._map.set($,Y),Y&&typeof Y==="object"&&"id"in Y){if(this._idmap.has(Y.id))throw new Error(`ID ${Y.id} already exists in the registry`);this._idmap.set(Y.id,$)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove($){let X=this._map.get($);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete($),this}get($){let X=$._zod.parent;if(X){let Y={...this.get(X)??{}};return delete Y.id,{...Y,...this._map.get($)}}return this._map.get($)}has($){return this._map.has($)}}function t5(){return new FY}var s1=t5();function iH($,X){return new $({type:"string",...d(X)})}function oH($,X){return new $({type:"string",coerce:!0,...d(X)})}function a5($,X){return new $({type:"string",format:"email",check:"string_format",abort:!1,...d(X)})}function MY($,X){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...d(X)})}function s5($,X){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...d(X)})}function e5($,X){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...d(X)})}function $U($,X){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...d(X)})}function XU($,X){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...d(X)})}function YU($,X){return new $({type:"string",format:"url",check:"string_format",abort:!1,...d(X)})}function GU($,X){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...d(X)})}function UU($,X){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...d(X)})}function zU($,X){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...d(X)})}function WU($,X){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...d(X)})}function QU($,X){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...d(X)})}function ZU($,X){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...d(X)})}function HU($,X){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...d(X)})}function VU($,X){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...d(X)})}function OU($,X){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...d(X)})}function wU($,X){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...d(X)})}function DU($,X){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...d(X)})}function EU($,X){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...d(X)})}function NU($,X){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...d(X)})}function FU($,X){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...d(X)})}function MU($,X){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...d(X)})}var nH={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function tH($,X){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...d(X)})}function aH($,X){return new $({type:"string",format:"date",check:"string_format",...d(X)})}function sH($,X){return new $({type:"string",format:"time",check:"string_format",precision:null,...d(X)})}function eH($,X){return new $({type:"string",format:"duration",check:"string_format",...d(X)})}function $V($,X){return new $({type:"number",checks:[],...d(X)})}function XV($,X){return new $({type:"number",coerce:!0,checks:[],...d(X)})}function YV($,X){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...d(X)})}function GV($,X){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...d(X)})}function UV($,X){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...d(X)})}function zV($,X){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...d(X)})}function WV($,X){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...d(X)})}function QV($,X){return new $({type:"boolean",...d(X)})}function ZV($,X){return new $({type:"boolean",coerce:!0,...d(X)})}function HV($,X){return new $({type:"bigint",...d(X)})}function VV($,X){return new $({type:"bigint",coerce:!0,...d(X)})}function OV($,X){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...d(X)})}function wV($,X){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...d(X)})}function DV($,X){return new $({type:"symbol",...d(X)})}function EV($,X){return new $({type:"undefined",...d(X)})}function NV($,X){return new $({type:"null",...d(X)})}function FV($){return new $({type:"any"})}function HX($){return new $({type:"unknown"})}function MV($,X){return new $({type:"never",...d(X)})}function JV($,X){return new $({type:"void",...d(X)})}function AV($,X){return new $({type:"date",...d(X)})}function LV($,X){return new $({type:"date",coerce:!0,...d(X)})}function KV($,X){return new $({type:"nan",...d(X)})}function R0($,X){return new c5({check:"less_than",...d(X),value:$,inclusive:!1})}function L1($,X){return new c5({check:"less_than",...d(X),value:$,inclusive:!0})}function T0($,X){return new p5({check:"greater_than",...d(X),value:$,inclusive:!1})}function m6($,X){return new p5({check:"greater_than",...d(X),value:$,inclusive:!0})}function _V($){return T0(0,$)}function qV($){return R0(0,$)}function RV($){return L1(0,$)}function TV($){return m6(0,$)}function W8($,X){return new yQ({check:"multiple_of",...d(X),value:$})}function VX($,X){return new cQ({check:"max_size",...d(X),maximum:$})}function Q8($,X){return new pQ({check:"min_size",...d(X),minimum:$})}function JY($,X){return new dQ({check:"size_equals",...d(X),size:$})}function OX($,X){return new lQ({check:"max_length",...d(X),maximum:$})}function N2($,X){return new rQ({check:"min_length",...d(X),minimum:$})}function wX($,X){return new iQ({check:"length_equals",...d(X),length:$})}function AY($,X){return new oQ({check:"string_format",format:"regex",...d(X),pattern:$})}function LY($){return new nQ({check:"string_format",format:"lowercase",...d($)})}function KY($){return new tQ({check:"string_format",format:"uppercase",...d($)})}function _Y($,X){return new aQ({check:"string_format",format:"includes",...d(X),includes:$})}function qY($,X){return new sQ({check:"string_format",format:"starts_with",...d(X),prefix:$})}function RY($,X){return new eQ({check:"string_format",format:"ends_with",...d(X),suffix:$})}function vV($,X,Y){return new $Z({check:"property",property:$,schema:X,...d(Y)})}function TY($,X){return new XZ({check:"mime_type",mime:$,...d(X)})}function v0($){return new YZ({check:"overwrite",tx:$})}function vY($){return v0((X)=>X.normalize($))}function CY(){return v0(($)=>$.trim())}function BY(){return v0(($)=>$.toLowerCase())}function jY(){return v0(($)=>$.toUpperCase())}function PY($,X,Y){return new $({type:"array",element:X,...d(Y)})}function KI($,X,Y){return new $({type:"union",options:X,...d(Y)})}function _I($,X,Y,U){return new $({type:"union",options:Y,discriminator:X,...d(U)})}function qI($,X,Y){return new $({type:"intersection",left:X,right:Y})}function CV($,X,Y,U){let G=Y instanceof N$;return new $({type:"tuple",items:X,rest:G?Y:null,...d(G?U:Y)})}function RI($,X,Y,U){return new $({type:"record",keyType:X,valueType:Y,...d(U)})}function TI($,X,Y,U){return new $({type:"map",keyType:X,valueType:Y,...d(U)})}function vI($,X,Y){return new $({type:"set",valueType:X,...d(Y)})}function CI($,X,Y){let U=Array.isArray(X)?Object.fromEntries(X.map((G)=>[G,G])):X;return new $({type:"enum",entries:U,...d(Y)})}function BI($,X,Y){return new $({type:"enum",entries:X,...d(Y)})}function jI($,X,Y){return new $({type:"literal",values:Array.isArray(X)?X:[X],...d(Y)})}function BV($,X){return new $({type:"file",...d(X)})}function PI($,X){return new $({type:"transform",transform:X})}function II($,X){return new $({type:"optional",innerType:X})}function xI($,X){return new $({type:"nullable",innerType:X})}function SI($,X,Y){return new $({type:"default",innerType:X,get defaultValue(){return typeof Y==="function"?Y():Y}})}function kI($,X,Y){return new $({type:"nonoptional",innerType:X,...d(Y)})}function bI($,X){return new $({type:"success",innerType:X})}function fI($,X,Y){return new $({type:"catch",innerType:X,catchValue:typeof Y==="function"?Y:()=>Y})}function hI($,X,Y){return new $({type:"pipe",in:X,out:Y})}function gI($,X){return new $({type:"readonly",innerType:X})}function yI($,X,Y){return new $({type:"template_literal",parts:X,...d(Y)})}function mI($,X){return new $({type:"lazy",getter:X})}function uI($,X){return new $({type:"promise",innerType:X})}function jV($,X,Y){let U=d(Y);return U.abort??(U.abort=!0),new $({type:"custom",check:"custom",fn:X,...U})}function PV($,X,Y){return new $({type:"custom",check:"custom",fn:X,...d(Y)})}function IV($,X){let Y=d(X),U=Y.truthy??["true","1","yes","on","y","enabled"],G=Y.falsy??["false","0","no","off","n","disabled"];if(Y.case!=="sensitive")U=U.map((E)=>typeof E==="string"?E.toLowerCase():E),G=G.map((E)=>typeof E==="string"?E.toLowerCase():E);let z=new Set(U),W=new Set(G),Q=$.Pipe??DY,Z=$.Boolean??VY,H=$.String??U8,O=new($.Transform??wY)({type:"transform",transform:(E,F)=>{let J=E;if(Y.case!=="sensitive")J=J.toLowerCase();if(z.has(J))return!0;else if(W.has(J))return!1;else return F.issues.push({code:"invalid_value",expected:"stringbool",values:[...z,...W],input:F.value,inst:O}),{}},error:Y.error}),w=new Q({type:"pipe",in:new H({type:"string",error:Y.error}),out:O,error:Y.error});return new Q({type:"pipe",in:w,out:new Z({type:"boolean",error:Y.error}),error:Y.error})}function xV($,X,Y,U={}){let G=d(U),z={...d(U),check:"string_format",type:"string",format:X,fn:typeof Y==="function"?Y:(Q)=>Y.test(Q),...G};if(Y instanceof RegExp)z.pattern=Y;return new $(z)}class SV{constructor($){this._def=$,this.def=$}implement($){if(typeof $!=="function")throw new Error("implement() must be called with a function");let X=(...Y)=>{let U=this._def.input?f5(this._def.input,Y,void 0,{callee:X}):Y;if(!Array.isArray(U))throw new Error("Invalid arguments schema: not an array or tuple schema.");let G=$(...U);return this._def.output?f5(this._def.output,G,void 0,{callee:X}):G};return X}implementAsync($){if(typeof $!=="function")throw new Error("implement() must be called with a function");let X=async(...Y)=>{let U=this._def.input?await g5(this._def.input,Y,void 0,{callee:X}):Y;if(!Array.isArray(U))throw new Error("Invalid arguments schema: not an array or tuple schema.");let G=await $(...U);return this._def.output?g5(this._def.output,G,void 0,{callee:X}):G};return X}input(...$){let X=this.constructor;if(Array.isArray($[0]))return new X({type:"function",input:new z8({type:"tuple",items:$[0],rest:$[1]}),output:this._def.output});return new X({type:"function",input:$[0],output:this._def.output})}output($){return new this.constructor({type:"function",input:this._def.input,output:$})}}function kV($){return new SV({type:"function",input:Array.isArray($?.input)?CV(z8,$?.input):$?.input??PY(OY,HX(ZX)),output:$?.output??HX(ZX)})}class JU{constructor($){this.counter=0,this.metadataRegistry=$?.metadata??s1,this.target=$?.target??"draft-2020-12",this.unrepresentable=$?.unrepresentable??"throw",this.override=$?.override??(()=>{}),this.io=$?.io??"output",this.seen=new Map}process($,X={path:[],schemaPath:[]}){var Y;let U=$._zod.def,G={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},z=this.seen.get($);if(z){if(z.count++,X.schemaPath.includes($))z.cycle=X.path;return z.schema}let W={schema:{},count:1,cycle:void 0,path:X.path};this.seen.set($,W);let Q=$._zod.toJSONSchema?.();if(Q)W.schema=Q;else{let V={...X,schemaPath:[...X.schemaPath,$],path:X.path},O=$._zod.parent;if(O)W.ref=O,this.process(O,V),this.seen.get(O).isParent=!0;else{let w=W.schema;switch(U.type){case"string":{let D=w;D.type="string";let{minimum:E,maximum:F,format:J,patterns:A,contentEncoding:L}=$._zod.bag;if(typeof E==="number")D.minLength=E;if(typeof F==="number")D.maxLength=F;if(J){if(D.format=G[J]??J,D.format==="")delete D.format}if(L)D.contentEncoding=L;if(A&&A.size>0){let T=[...A];if(T.length===1)D.pattern=T[0].source;else if(T.length>1)W.schema.allOf=[...T.map((q)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:q.source}))]}break}case"number":{let D=w,{minimum:E,maximum:F,format:J,multipleOf:A,exclusiveMaximum:L,exclusiveMinimum:T}=$._zod.bag;if(typeof J==="string"&&J.includes("int"))D.type="integer";else D.type="number";if(typeof T==="number")D.exclusiveMinimum=T;if(typeof E==="number"){if(D.minimum=E,typeof T==="number")if(T>=E)delete D.minimum;else delete D.exclusiveMinimum}if(typeof L==="number")D.exclusiveMaximum=L;if(typeof F==="number"){if(D.maximum=F,typeof L==="number")if(L<=F)delete D.maximum;else delete D.exclusiveMaximum}if(typeof A==="number")D.multipleOf=A;break}case"boolean":{let D=w;D.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{w.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{w.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let D=w,{minimum:E,maximum:F}=$._zod.bag;if(typeof E==="number")D.minItems=E;if(typeof F==="number")D.maxItems=F;D.type="array",D.items=this.process(U.element,{...V,path:[...V.path,"items"]});break}case"object":{let D=w;D.type="object",D.properties={};let E=U.shape;for(let A in E)D.properties[A]=this.process(E[A],{...V,path:[...V.path,"properties",A]});let F=new Set(Object.keys(E)),J=new Set([...F].filter((A)=>{let L=U.shape[A]._zod;if(this.io==="input")return L.optin===void 0;else return L.optout===void 0}));if(J.size>0)D.required=Array.from(J);if(U.catchall?._zod.def.type==="never")D.additionalProperties=!1;else if(!U.catchall){if(this.io==="output")D.additionalProperties=!1}else if(U.catchall)D.additionalProperties=this.process(U.catchall,{...V,path:[...V.path,"additionalProperties"]});break}case"union":{let D=w;D.anyOf=U.options.map((E,F)=>this.process(E,{...V,path:[...V.path,"anyOf",F]}));break}case"intersection":{let D=w,E=this.process(U.left,{...V,path:[...V.path,"allOf",0]}),F=this.process(U.right,{...V,path:[...V.path,"allOf",1]}),J=(L)=>("allOf"in L)&&Object.keys(L).length===1,A=[...J(E)?E.allOf:[E],...J(F)?F.allOf:[F]];D.allOf=A;break}case"tuple":{let D=w;D.type="array";let E=U.items.map((A,L)=>this.process(A,{...V,path:[...V.path,"prefixItems",L]}));if(this.target==="draft-2020-12")D.prefixItems=E;else D.items=E;if(U.rest){let A=this.process(U.rest,{...V,path:[...V.path,"items"]});if(this.target==="draft-2020-12")D.items=A;else D.additionalItems=A}if(U.rest)D.items=this.process(U.rest,{...V,path:[...V.path,"items"]});let{minimum:F,maximum:J}=$._zod.bag;if(typeof F==="number")D.minItems=F;if(typeof J==="number")D.maxItems=J;break}case"record":{let D=w;D.type="object",D.propertyNames=this.process(U.keyType,{...V,path:[...V.path,"propertyNames"]}),D.additionalProperties=this.process(U.valueType,{...V,path:[...V.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let D=w,E=XY(U.entries);if(E.every((F)=>typeof F==="number"))D.type="number";if(E.every((F)=>typeof F==="string"))D.type="string";D.enum=E;break}case"literal":{let D=w,E=[];for(let F of U.values)if(F===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof F==="bigint")if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");else E.push(Number(F));else E.push(F);if(E.length===0);else if(E.length===1){let F=E[0];D.type=F===null?"null":typeof F,D.const=F}else{if(E.every((F)=>typeof F==="number"))D.type="number";if(E.every((F)=>typeof F==="string"))D.type="string";if(E.every((F)=>typeof F==="boolean"))D.type="string";if(E.every((F)=>F===null))D.type="null";D.enum=E}break}case"file":{let D=w,E={type:"string",format:"binary",contentEncoding:"binary"},{minimum:F,maximum:J,mime:A}=$._zod.bag;if(F!==void 0)E.minLength=F;if(J!==void 0)E.maxLength=J;if(A)if(A.length===1)E.contentMediaType=A[0],Object.assign(D,E);else D.anyOf=A.map((L)=>{return{...E,contentMediaType:L}});else Object.assign(D,E);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let D=this.process(U.innerType,V);w.anyOf=[D,{type:"null"}];break}case"nonoptional":{this.process(U.innerType,V),W.ref=U.innerType;break}case"success":{let D=w;D.type="boolean";break}case"default":{this.process(U.innerType,V),W.ref=U.innerType,w.default=JSON.parse(JSON.stringify(U.defaultValue));break}case"prefault":{if(this.process(U.innerType,V),W.ref=U.innerType,this.io==="input")w._prefault=JSON.parse(JSON.stringify(U.defaultValue));break}case"catch":{this.process(U.innerType,V),W.ref=U.innerType;let D;try{D=U.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}w.default=D;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let D=w,E=$._zod.pattern;if(!E)throw new Error("Pattern not found in template literal");D.type="string",D.pattern=E.source;break}case"pipe":{let D=this.io==="input"?U.in._zod.def.type==="transform"?U.out:U.in:U.out;this.process(D,V),W.ref=D;break}case"readonly":{this.process(U.innerType,V),W.ref=U.innerType,w.readOnly=!0;break}case"promise":{this.process(U.innerType,V),W.ref=U.innerType;break}case"optional":{this.process(U.innerType,V),W.ref=U.innerType;break}case"lazy":{let D=$._zod.innerType;this.process(D,V),W.ref=D;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let Z=this.metadataRegistry.get($);if(Z)Object.assign(W.schema,Z);if(this.io==="input"&&x4($))delete W.schema.examples,delete W.schema.default;if(this.io==="input"&&W.schema._prefault)(Y=W.schema).default??(Y.default=W.schema._prefault);return delete W.schema._prefault,this.seen.get($).schema}emit($,X){let Y={cycles:X?.cycles??"ref",reused:X?.reused??"inline",external:X?.external??void 0},U=this.seen.get($);if(!U)throw new Error("Unprocessed schema. This is a bug in Zod.");let G=(H)=>{let V=this.target==="draft-2020-12"?"$defs":"definitions";if(Y.external){let E=Y.external.registry.get(H[0])?.id,F=Y.external.uri??((A)=>A);if(E)return{ref:F(E)};let J=H[1].defId??H[1].schema.id??`schema${this.counter++}`;return H[1].defId=J,{defId:J,ref:`${F("__shared")}#/${V}/${J}`}}if(H[1]===U)return{ref:"#"};let w=`${"#"}/${V}/`,D=H[1].schema.id??`__schema${this.counter++}`;return{defId:D,ref:w+D}},z=(H)=>{if(H[1].schema.$ref)return;let V=H[1],{ref:O,defId:w}=G(H);if(V.def={...V.schema},w)V.defId=w;let D=V.schema;for(let E in D)delete D[E];D.$ref=O};if(Y.cycles==="throw")for(let H of this.seen.entries()){let V=H[1];if(V.cycle)throw new Error(`Cycle detected: #/${V.cycle?.join("/")}/<root>
|
|
41
|
+
})));`),w.write(`newResult[${$8(L)}] = ${T}.value`)}w.write("payload.value = newResult;"),w.write("return payload;");let A=w.compile();return(L,T)=>A(O,L,T)},G,z=UX,W=!e9.jitless,Z=W&&$Q.value,H=X.catchall,V;$._zod.parse=(O,w)=>{V??(V=Y.value);let D=O.value;if(!z(D))return O.issues.push({expected:"object",code:"invalid_type",input:D,inst:$}),O;let E=[];if(W&&Z&&w?.async===!1&&w.jitless!==!0){if(!G)G=U(X.shape);O=G(O,w)}else{O.value={};let T=V.shape;for(let q of V.keys){let v=T[q],I=v._zod.run({value:D[q],issues:[]},w),S=v._zod.optin==="optional"&&v._zod.optout==="optional";if(I instanceof Promise)E.push(I.then((y)=>S?qF(y,O,q,D):l5(y,O,q)));else if(S)qF(I,O,q,D);else l5(I,O,q)}}if(!H)return E.length?Promise.all(E).then(()=>O):O;let F=[],J=V.keySet,A=H._zod,L=A.def.type;for(let T of Object.keys(D)){if(J.has(T))continue;if(L==="never"){F.push(T);continue}let q=A.run({value:D[T],issues:[]},w);if(q instanceof Promise)E.push(q.then((v)=>l5(v,O,T)));else l5(q,O,T)}if(F.length)O.issues.push({code:"unrecognized_keys",keys:F,input:D,inst:$});if(!E.length)return O;return Promise.all(E).then(()=>{return O})}});function RF($,X,Y,U){for(let G of $)if(G.issues.length===0)return X.value=G.value,X;return X.issues.push({code:"invalid_union",input:X.value,inst:Y,errors:$.map((G)=>G.issues.map((z)=>G1(z,U,v4())))}),X}var n5=C("$ZodUnion",($,X)=>{N$.init($,X),y$($._zod,"optin",()=>X.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),y$($._zod,"optout",()=>X.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),y$($._zod,"values",()=>{if(X.options.every((Y)=>Y._zod.values))return new Set(X.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),y$($._zod,"pattern",()=>{if(X.options.every((Y)=>Y._zod.pattern)){let Y=X.options.map((U)=>U._zod.pattern);return new RegExp(`^(${Y.map((U)=>GY(U.source)).join("|")})$`)}return}),$._zod.parse=(Y,U)=>{let G=!1,z=[];for(let W of X.options){let Q=W._zod.run({value:Y.value,issues:[]},U);if(Q instanceof Promise)z.push(Q),G=!0;else{if(Q.issues.length===0)return Q;z.push(Q)}}if(!G)return RF(z,Y,$,U);return Promise.all(z).then((W)=>{return RF(W,Y,$,U)})}}),mZ=C("$ZodDiscriminatedUnion",($,X)=>{n5.init($,X);let Y=$._zod.parse;y$($._zod,"propValues",()=>{let G={};for(let z of X.options){let W=z._zod.propValues;if(!W||Object.keys(W).length===0)throw new Error(`Invalid discriminated union option at index "${X.options.indexOf(z)}"`);for(let[Q,Z]of Object.entries(W)){if(!G[Q])G[Q]=new Set;for(let H of Z)G[Q].add(H)}}return G});let U=YY(()=>{let G=X.options,z=new Map;for(let W of G){let Q=W._zod.propValues[X.discriminator];if(!Q||Q.size===0)throw new Error(`Invalid discriminated union option at index "${X.options.indexOf(W)}"`);for(let Z of Q){if(z.has(Z))throw new Error(`Duplicate discriminator value "${String(Z)}"`);z.set(Z,W)}}return z});$._zod.parse=(G,z)=>{let W=G.value;if(!UX(W))return G.issues.push({code:"invalid_type",expected:"object",input:W,inst:$}),G;let Q=U.value.get(W?.[X.discriminator]);if(Q)return Q._zod.run(G,z);if(X.unionFallback)return Y(G,z);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:W,path:[X.discriminator],inst:$}),G}}),uZ=C("$ZodIntersection",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value,z=X.left._zod.run({value:G,issues:[]},U),W=X.right._zod.run({value:G,issues:[]},U);if(z instanceof Promise||W instanceof Promise)return Promise.all([z,W]).then(([Z,H])=>{return TF(Y,Z,H)});return TF(Y,z,W)}});function UZ($,X){if($===X)return{valid:!0,data:$};if($ instanceof Date&&X instanceof Date&&+$===+X)return{valid:!0,data:$};if(zX($)&&zX(X)){let Y=Object.keys(X),U=Object.keys($).filter((z)=>Y.indexOf(z)!==-1),G={...$,...X};for(let z of U){let W=UZ($[z],X[z]);if(!W.valid)return{valid:!1,mergeErrorPath:[z,...W.mergeErrorPath]};G[z]=W.data}return{valid:!0,data:G}}if(Array.isArray($)&&Array.isArray(X)){if($.length!==X.length)return{valid:!1,mergeErrorPath:[]};let Y=[];for(let U=0;U<$.length;U++){let G=$[U],z=X[U],W=UZ(G,z);if(!W.valid)return{valid:!1,mergeErrorPath:[U,...W.mergeErrorPath]};Y.push(W.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function TF($,X,Y){if(X.issues.length)$.issues.push(...X.issues);if(Y.issues.length)$.issues.push(...Y.issues);if(X8($))return $;let U=UZ(X.value,Y.value);if(!U.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(U.mergeErrorPath)}`);return $.value=U.data,$}var z8=C("$ZodTuple",($,X)=>{N$.init($,X);let Y=X.items,U=Y.length-[...Y].reverse().findIndex((G)=>G._zod.optin!=="optional");$._zod.parse=(G,z)=>{let W=G.value;if(!Array.isArray(W))return G.issues.push({input:W,inst:$,expected:"tuple",code:"invalid_type"}),G;G.value=[];let Q=[];if(!X.rest){let H=W.length>Y.length,V=W.length<U-1;if(H||V)return G.issues.push({input:W,inst:$,origin:"array",...H?{code:"too_big",maximum:Y.length}:{code:"too_small",minimum:Y.length}}),G}let Z=-1;for(let H of Y){if(Z++,Z>=W.length){if(Z>=U)continue}let V=H._zod.run({value:W[Z],issues:[]},z);if(V instanceof Promise)Q.push(V.then((O)=>r5(O,G,Z)));else r5(V,G,Z)}if(X.rest){let H=W.slice(Y.length);for(let V of H){Z++;let O=X.rest._zod.run({value:V,issues:[]},z);if(O instanceof Promise)Q.push(O.then((w)=>r5(w,G,Z)));else r5(O,G,Z)}}if(Q.length)return Promise.all(Q).then(()=>G);return G}});function r5($,X,Y){if($.issues.length)X.issues.push(...m6(Y,$.issues));X.value[Y]=$.value}var cZ=C("$ZodRecord",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(!zX(G))return Y.issues.push({expected:"record",code:"invalid_type",input:G,inst:$}),Y;let z=[];if(X.keyType._zod.values){let W=X.keyType._zod.values;Y.value={};for(let Z of W)if(typeof Z==="string"||typeof Z==="number"||typeof Z==="symbol"){let H=X.valueType._zod.run({value:G[Z],issues:[]},U);if(H instanceof Promise)z.push(H.then((V)=>{if(V.issues.length)Y.issues.push(...m6(Z,V.issues));Y.value[Z]=V.value}));else{if(H.issues.length)Y.issues.push(...m6(Z,H.issues));Y.value[Z]=H.value}}let Q;for(let Z in G)if(!W.has(Z))Q=Q??[],Q.push(Z);if(Q&&Q.length>0)Y.issues.push({code:"unrecognized_keys",input:G,inst:$,keys:Q})}else{Y.value={};for(let W of Reflect.ownKeys(G)){if(W==="__proto__")continue;let Q=X.keyType._zod.run({value:W,issues:[]},U);if(Q instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(Q.issues.length){Y.issues.push({origin:"record",code:"invalid_key",issues:Q.issues.map((H)=>G1(H,U,v4())),input:W,path:[W],inst:$}),Y.value[Q.value]=Q.value;continue}let Z=X.valueType._zod.run({value:G[W],issues:[]},U);if(Z instanceof Promise)z.push(Z.then((H)=>{if(H.issues.length)Y.issues.push(...m6(W,H.issues));Y.value[Q.value]=H.value}));else{if(Z.issues.length)Y.issues.push(...m6(W,Z.issues));Y.value[Q.value]=Z.value}}}if(z.length)return Promise.all(z).then(()=>Y);return Y}}),pZ=C("$ZodMap",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(!(G instanceof Map))return Y.issues.push({expected:"map",code:"invalid_type",input:G,inst:$}),Y;let z=[];Y.value=new Map;for(let[W,Q]of G){let Z=X.keyType._zod.run({value:W,issues:[]},U),H=X.valueType._zod.run({value:Q,issues:[]},U);if(Z instanceof Promise||H instanceof Promise)z.push(Promise.all([Z,H]).then(([V,O])=>{vF(V,O,Y,W,G,$,U)}));else vF(Z,H,Y,W,G,$,U)}if(z.length)return Promise.all(z).then(()=>Y);return Y}});function vF($,X,Y,U,G,z,W){if($.issues.length)if(UY.has(typeof U))Y.issues.push(...m6(U,$.issues));else Y.issues.push({origin:"map",code:"invalid_key",input:G,inst:z,issues:$.issues.map((Q)=>G1(Q,W,v4()))});if(X.issues.length)if(UY.has(typeof U))Y.issues.push(...m6(U,X.issues));else Y.issues.push({origin:"map",code:"invalid_element",input:G,inst:z,key:U,issues:X.issues.map((Q)=>G1(Q,W,v4()))});Y.value.set($.value,X.value)}var dZ=C("$ZodSet",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(!(G instanceof Set))return Y.issues.push({input:G,inst:$,expected:"set",code:"invalid_type"}),Y;let z=[];Y.value=new Set;for(let W of G){let Q=X.valueType._zod.run({value:W,issues:[]},U);if(Q instanceof Promise)z.push(Q.then((Z)=>CF(Z,Y)));else CF(Q,Y)}if(z.length)return Promise.all(z).then(()=>Y);return Y}});function CF($,X){if($.issues.length)X.issues.push(...$.issues);X.value.add($.value)}var lZ=C("$ZodEnum",($,X)=>{N$.init($,X);let Y=XY(X.entries);$._zod.values=new Set(Y),$._zod.pattern=new RegExp(`^(${Y.filter((U)=>UY.has(typeof U)).map((U)=>typeof U==="string"?q0(U):U.toString()).join("|")})$`),$._zod.parse=(U,G)=>{let z=U.value;if($._zod.values.has(z))return U;return U.issues.push({code:"invalid_value",values:Y,input:z,inst:$}),U}}),rZ=C("$ZodLiteral",($,X)=>{N$.init($,X),$._zod.values=new Set(X.values),$._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?q0(Y):Y?Y.toString():String(Y)).join("|")})$`),$._zod.parse=(Y,U)=>{let G=Y.value;if($._zod.values.has(G))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:G,inst:$}),Y}}),iZ=C("$ZodFile",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=Y.value;if(G instanceof File)return Y;return Y.issues.push({expected:"file",code:"invalid_type",input:G,inst:$}),Y}}),wY=C("$ZodTransform",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=X.transform(Y.value,Y);if(U.async)return(G instanceof Promise?G:Promise.resolve(G)).then((W)=>{return Y.value=W,Y});if(G instanceof Promise)throw new _0;return Y.value=G,Y}}),oZ=C("$ZodOptional",($,X)=>{N$.init($,X),$._zod.optin="optional",$._zod.optout="optional",y$($._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),y$($._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${GY(Y.source)})?$`):void 0}),$._zod.parse=(Y,U)=>{if(X.innerType._zod.optin==="optional")return X.innerType._zod.run(Y,U);if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,U)}}),nZ=C("$ZodNullable",($,X)=>{N$.init($,X),y$($._zod,"optin",()=>X.innerType._zod.optin),y$($._zod,"optout",()=>X.innerType._zod.optout),y$($._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${GY(Y.source)}|null)$`):void 0}),y$($._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),$._zod.parse=(Y,U)=>{if(Y.value===null)return Y;return X.innerType._zod.run(Y,U)}}),tZ=C("$ZodDefault",($,X)=>{N$.init($,X),$._zod.optin="optional",y$($._zod,"values",()=>X.innerType._zod.values),$._zod.parse=(Y,U)=>{if(Y.value===void 0)return Y.value=X.defaultValue,Y;let G=X.innerType._zod.run(Y,U);if(G instanceof Promise)return G.then((z)=>BF(z,X));return BF(G,X)}});function BF($,X){if($.value===void 0)$.value=X.defaultValue;return $}var aZ=C("$ZodPrefault",($,X)=>{N$.init($,X),$._zod.optin="optional",y$($._zod,"values",()=>X.innerType._zod.values),$._zod.parse=(Y,U)=>{if(Y.value===void 0)Y.value=X.defaultValue;return X.innerType._zod.run(Y,U)}}),sZ=C("$ZodNonOptional",($,X)=>{N$.init($,X),y$($._zod,"values",()=>{let Y=X.innerType._zod.values;return Y?new Set([...Y].filter((U)=>U!==void 0)):void 0}),$._zod.parse=(Y,U)=>{let G=X.innerType._zod.run(Y,U);if(G instanceof Promise)return G.then((z)=>jF(z,$));return jF(G,$)}});function jF($,X){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:X});return $}var eZ=C("$ZodSuccess",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{let G=X.innerType._zod.run(Y,U);if(G instanceof Promise)return G.then((z)=>{return Y.value=z.issues.length===0,Y});return Y.value=G.issues.length===0,Y}}),$H=C("$ZodCatch",($,X)=>{N$.init($,X),$._zod.optin="optional",y$($._zod,"optout",()=>X.innerType._zod.optout),y$($._zod,"values",()=>X.innerType._zod.values),$._zod.parse=(Y,U)=>{let G=X.innerType._zod.run(Y,U);if(G instanceof Promise)return G.then((z)=>{if(Y.value=z.value,z.issues.length)Y.value=X.catchValue({...Y,error:{issues:z.issues.map((W)=>G1(W,U,v4()))},input:Y.value}),Y.issues=[];return Y});if(Y.value=G.value,G.issues.length)Y.value=X.catchValue({...Y,error:{issues:G.issues.map((z)=>G1(z,U,v4()))},input:Y.value}),Y.issues=[];return Y}}),XH=C("$ZodNaN",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{if(typeof Y.value!=="number"||!Number.isNaN(Y.value))return Y.issues.push({input:Y.value,inst:$,expected:"nan",code:"invalid_type"}),Y;return Y}}),DY=C("$ZodPipe",($,X)=>{N$.init($,X),y$($._zod,"values",()=>X.in._zod.values),y$($._zod,"optin",()=>X.in._zod.optin),y$($._zod,"optout",()=>X.out._zod.optout),$._zod.parse=(Y,U)=>{let G=X.in._zod.run(Y,U);if(G instanceof Promise)return G.then((z)=>PF(z,X,U));return PF(G,X,U)}});function PF($,X,Y){if(X8($))return $;return X.out._zod.run({value:$.value,issues:$.issues},Y)}var YH=C("$ZodReadonly",($,X)=>{N$.init($,X),y$($._zod,"propValues",()=>X.innerType._zod.propValues),y$($._zod,"values",()=>X.innerType._zod.values),y$($._zod,"optin",()=>X.innerType._zod.optin),y$($._zod,"optout",()=>X.innerType._zod.optout),$._zod.parse=(Y,U)=>{let G=X.innerType._zod.run(Y,U);if(G instanceof Promise)return G.then(IF);return IF(G)}});function IF($){return $.value=Object.freeze($.value),$}var GH=C("$ZodTemplateLiteral",($,X)=>{N$.init($,X);let Y=[];for(let U of X.parts)if(U instanceof N$){if(!U._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...U._zod.traits].shift()}`);let G=U._zod.pattern instanceof RegExp?U._zod.pattern.source:U._zod.pattern;if(!G)throw new Error(`Invalid template literal part: ${U._zod.traits}`);let z=G.startsWith("^")?1:0,W=G.endsWith("$")?G.length-1:G.length;Y.push(G.slice(z,W))}else if(U===null||XQ.has(typeof U))Y.push(q0(`${U}`));else throw new Error(`Invalid template literal part: ${U}`);$._zod.pattern=new RegExp(`^${Y.join("")}$`),$._zod.parse=(U,G)=>{if(typeof U.value!=="string")return U.issues.push({input:U.value,inst:$,expected:"template_literal",code:"invalid_type"}),U;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(U.value))return U.issues.push({input:U.value,inst:$,code:"invalid_format",format:"template_literal",pattern:$._zod.pattern.source}),U;return U}}),UH=C("$ZodPromise",($,X)=>{N$.init($,X),$._zod.parse=(Y,U)=>{return Promise.resolve(Y.value).then((G)=>X.innerType._zod.run({value:G,issues:[]},U))}}),zH=C("$ZodLazy",($,X)=>{N$.init($,X),y$($._zod,"innerType",()=>X.getter()),y$($._zod,"pattern",()=>$._zod.innerType._zod.pattern),y$($._zod,"propValues",()=>$._zod.innerType._zod.propValues),y$($._zod,"optin",()=>$._zod.innerType._zod.optin),y$($._zod,"optout",()=>$._zod.innerType._zod.optout),$._zod.parse=(Y,U)=>{return $._zod.innerType._zod.run(Y,U)}}),WH=C("$ZodCustom",($,X)=>{O4.init($,X),N$.init($,X),$._zod.parse=(Y,U)=>{return Y},$._zod.check=(Y)=>{let U=Y.value,G=X.fn(U);if(G instanceof Promise)return G.then((z)=>xF(z,Y,U,$));xF(G,Y,U,$);return}});function xF($,X,Y,U){if(!$){let G={code:"custom",input:Y,inst:U,path:[...U._zod.def.path??[]],continue:!U._zod.def.abort};if(U._zod.def.params)G.params=U._zod.def.params;X.issues.push(zQ(G))}}var NY={};D2(NY,{zhTW:()=>dH,zhCN:()=>pH,vi:()=>cH,ur:()=>uH,ua:()=>mH,tr:()=>yH,th:()=>gH,ta:()=>hH,sv:()=>fH,sl:()=>bH,ru:()=>kH,pt:()=>SH,ps:()=>IH,pl:()=>xH,ota:()=>PH,no:()=>jH,nl:()=>BH,ms:()=>CH,mk:()=>vH,ko:()=>TH,kh:()=>RH,ja:()=>qH,it:()=>_H,id:()=>KH,hu:()=>LH,he:()=>AH,frCA:()=>JH,fr:()=>MH,fi:()=>FH,fa:()=>NH,es:()=>EH,eo:()=>DH,en:()=>EY,de:()=>wH,cs:()=>OH,ca:()=>VH,be:()=>HH,az:()=>ZH,ar:()=>QH});var SP=()=>{let $={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return(G)=>{switch(G.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${G.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o(G.values[0])}`;return`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${G.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${z} ${G.maximum.toString()} ${W.unit??"\u0639\u0646\u0635\u0631"}`;return`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${G.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${z} ${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${G.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${z} ${G.minimum.toString()} ${W.unit}`;return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${G.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${z} ${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${G.prefix}"`;if(z.format==="ends_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${z.suffix}"`;if(z.format==="includes")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${z.includes}"`;if(z.format==="regex")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${z.pattern}`;return`${U[z.format]??G.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${G.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${G.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${G.keys.length>1?"\u0629":""}: ${h(G.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${G.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${G.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function QH(){return{localeError:SP()}}var kP=()=>{let $={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={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",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(G)=>{switch(G.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${G.expected}, daxil olan ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o(G.values[0])}`;return`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${G.origin??"d\u0259y\u0259r"} ${z}${G.maximum.toString()} ${W.unit??"element"}`;return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${G.origin??"d\u0259y\u0259r"} ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${G.origin} ${z}${G.minimum.toString()} ${W.unit}`;return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${G.origin} ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Yanl\u0131\u015F m\u0259tn: "${z.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`;if(z.format==="ends_with")return`Yanl\u0131\u015F m\u0259tn: "${z.suffix}" il\u0259 bitm\u0259lidir`;if(z.format==="includes")return`Yanl\u0131\u015F m\u0259tn: "${z.includes}" daxil olmal\u0131d\u0131r`;if(z.format==="regex")return`Yanl\u0131\u015F m\u0259tn: ${z.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`;return`Yanl\u0131\u015F ${U[z.format]??G.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${G.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${G.keys.length>1?"lar":""}: ${h(G.keys,", ")}`;case"invalid_key":return`${G.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${G.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function ZH(){return{localeError:kP()}}function fF($,X,Y,U){let G=Math.abs($),z=G%10,W=G%100;if(W>=11&&W<=19)return U;if(z===1)return X;if(z>=2&&z<=4)return Y;return U}var bP=()=>{let $={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(G))return"\u043C\u0430\u0441\u0456\u045E";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return(G)=>{switch(G.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${G.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${o(G.values[0])}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W){let Q=Number(G.maximum),Z=fF(Q,W.unit.one,W.unit.few,W.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${G.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${W.verb} ${z}${G.maximum.toString()} ${Z}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${G.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W){let Q=Number(G.minimum),Z=fF(Q,W.unit.one,W.unit.few,W.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${G.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${W.verb} ${z}${G.minimum.toString()} ${Z}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${G.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${z.prefix}"`;if(z.format==="ends_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${z.suffix}"`;if(z.format==="includes")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${z.includes}"`;if(z.format==="regex")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${z.pattern}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${U[z.format]??G.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${G.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${G.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${h(G.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${G.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${G.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function HH(){return{localeError:bP()}}var fP=()=>{let $={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"entrada",email:"adre\xE7a electr\xF2nica",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:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return(G)=>{switch(G.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${G.expected}, s'ha rebut ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Valor inv\xE0lid: s'esperava ${o(G.values[0])}`;return`Opci\xF3 inv\xE0lida: s'esperava una de ${h(G.values," o ")}`;case"too_big":{let z=G.inclusive?"com a m\xE0xim":"menys de",W=X(G.origin);if(W)return`Massa gran: s'esperava que ${G.origin??"el valor"} contingu\xE9s ${z} ${G.maximum.toString()} ${W.unit??"elements"}`;return`Massa gran: s'esperava que ${G.origin??"el valor"} fos ${z} ${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?"com a m\xEDnim":"m\xE9s de",W=X(G.origin);if(W)return`Massa petit: s'esperava que ${G.origin} contingu\xE9s ${z} ${G.minimum.toString()} ${W.unit}`;return`Massa petit: s'esperava que ${G.origin} fos ${z} ${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Format inv\xE0lid: ha de comen\xE7ar amb "${z.prefix}"`;if(z.format==="ends_with")return`Format inv\xE0lid: ha d'acabar amb "${z.suffix}"`;if(z.format==="includes")return`Format inv\xE0lid: ha d'incloure "${z.includes}"`;if(z.format==="regex")return`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${z.pattern}`;return`Format inv\xE0lid per a ${U[z.format]??G.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${G.divisor}`;case"unrecognized_keys":return`Clau${G.keys.length>1?"s":""} no reconeguda${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${G.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${G.origin}`;default:return"Entrada inv\xE0lida"}}};function VH(){return{localeError:fP()}}var hP=()=>{let $={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(G))return"pole";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",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:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return(G)=>{switch(G.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${G.expected}, obdr\u017Eeno ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o(G.values[0])}`;return`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${G.origin??"hodnota"} mus\xED m\xEDt ${z}${G.maximum.toString()} ${W.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${G.origin??"hodnota"} mus\xED b\xFDt ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${G.origin??"hodnota"} mus\xED m\xEDt ${z}${G.minimum.toString()} ${W.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${G.origin??"hodnota"} mus\xED b\xFDt ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${z.prefix}"`;if(z.format==="ends_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${z.suffix}"`;if(z.format==="includes")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${z.includes}"`;if(z.format==="regex")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${z.pattern}`;return`Neplatn\xFD form\xE1t ${U[z.format]??G.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${G.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${h(G.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${G.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${G.origin}`;default:return"Neplatn\xFD vstup"}}};function OH(){return{localeError:hP()}}var gP=()=>{let $={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"Zahl";case"object":{if(Array.isArray(G))return"Array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"Eingabe",email:"E-Mail-Adresse",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-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(G)=>{switch(G.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${G.expected}, erhalten ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Ung\xFCltige Eingabe: erwartet ${o(G.values[0])}`;return`Ung\xFCltige Option: erwartet eine von ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Zu gro\xDF: erwartet, dass ${G.origin??"Wert"} ${z}${G.maximum.toString()} ${W.unit??"Elemente"} hat`;return`Zu gro\xDF: erwartet, dass ${G.origin??"Wert"} ${z}${G.maximum.toString()} ist`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Zu klein: erwartet, dass ${G.origin} ${z}${G.minimum.toString()} ${W.unit} hat`;return`Zu klein: erwartet, dass ${G.origin} ${z}${G.minimum.toString()} ist`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Ung\xFCltiger String: muss mit "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ung\xFCltiger String: muss mit "${z.suffix}" enden`;if(z.format==="includes")return`Ung\xFCltiger String: muss "${z.includes}" enthalten`;if(z.format==="regex")return`Ung\xFCltiger String: muss dem Muster ${z.pattern} entsprechen`;return`Ung\xFCltig: ${U[z.format]??G.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${G.divisor} sein`;case"unrecognized_keys":return`${G.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${h(G.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${G.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${G.origin}`;default:return"Ung\xFCltige Eingabe"}}};function wH(){return{localeError:gP()}}var yP=($)=>{let X=typeof $;switch(X){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return X},mP=()=>{let $={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 X(U){return $[U]??null}let Y={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",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(U)=>{switch(U.code){case"invalid_type":return`Invalid input: expected ${U.expected}, received ${yP(U.input)}`;case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${o(U.values[0])}`;return`Invalid option: expected one of ${h(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=X(U.origin);if(z)return`Too big: expected ${U.origin??"value"} to have ${G}${U.maximum.toString()} ${z.unit??"elements"}`;return`Too big: expected ${U.origin??"value"} to be ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=X(U.origin);if(z)return`Too small: expected ${U.origin} to have ${G}${U.minimum.toString()} ${z.unit}`;return`Too small: expected ${U.origin} to be ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Invalid string: must start with "${G.prefix}"`;if(G.format==="ends_with")return`Invalid string: must end with "${G.suffix}"`;if(G.format==="includes")return`Invalid string: must include "${G.includes}"`;if(G.format==="regex")return`Invalid string: must match pattern ${G.pattern}`;return`Invalid ${Y[G.format]??U.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${U.divisor}`;case"unrecognized_keys":return`Unrecognized key${U.keys.length>1?"s":""}: ${h(U.keys,", ")}`;case"invalid_key":return`Invalid key in ${U.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${U.origin}`;default:return"Invalid input"}}};function EY(){return{localeError:mP()}}var uP=($)=>{let X=typeof $;switch(X){case"number":return Number.isNaN($)?"NaN":"nombro";case"object":{if(Array.isArray($))return"tabelo";if($===null)return"senvalora";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return X},cP=()=>{let $={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function X(U){return $[U]??null}let Y={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(U)=>{switch(U.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${U.expected}, ricevi\u011Dis ${uP(U.input)}`;case"invalid_value":if(U.values.length===1)return`Nevalida enigo: atendi\u011Dis ${o(U.values[0])}`;return`Nevalida opcio: atendi\u011Dis unu el ${h(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=X(U.origin);if(z)return`Tro granda: atendi\u011Dis ke ${U.origin??"valoro"} havu ${G}${U.maximum.toString()} ${z.unit??"elementojn"}`;return`Tro granda: atendi\u011Dis ke ${U.origin??"valoro"} havu ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=X(U.origin);if(z)return`Tro malgranda: atendi\u011Dis ke ${U.origin} havu ${G}${U.minimum.toString()} ${z.unit}`;return`Tro malgranda: atendi\u011Dis ke ${U.origin} estu ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Nevalida karaktraro: devas komenci\u011Di per "${G.prefix}"`;if(G.format==="ends_with")return`Nevalida karaktraro: devas fini\u011Di per "${G.suffix}"`;if(G.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${G.includes}"`;if(G.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${G.pattern}`;return`Nevalida ${Y[G.format]??U.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${U.divisor}`;case"unrecognized_keys":return`Nekonata${U.keys.length>1?"j":""} \u015Dlosilo${U.keys.length>1?"j":""}: ${h(U.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${U.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${U.origin}`;default:return"Nevalida enigo"}}};function DH(){return{localeError:cP()}}var pP=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(G))return"arreglo";if(G===null)return"nulo";if(Object.getPrototypeOf(G)!==Object.prototype)return G.constructor.name}}return z},U={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",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:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return(G)=>{switch(G.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${G.expected}, recibido ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Entrada inv\xE1lida: se esperaba ${o(G.values[0])}`;return`Opci\xF3n inv\xE1lida: se esperaba una de ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Demasiado grande: se esperaba que ${G.origin??"valor"} tuviera ${z}${G.maximum.toString()} ${W.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${G.origin??"valor"} fuera ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Demasiado peque\xF1o: se esperaba que ${G.origin} tuviera ${z}${G.minimum.toString()} ${W.unit}`;return`Demasiado peque\xF1o: se esperaba que ${G.origin} fuera ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Cadena inv\xE1lida: debe comenzar con "${z.prefix}"`;if(z.format==="ends_with")return`Cadena inv\xE1lida: debe terminar en "${z.suffix}"`;if(z.format==="includes")return`Cadena inv\xE1lida: debe incluir "${z.includes}"`;if(z.format==="regex")return`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${z.pattern}`;return`Inv\xE1lido ${U[z.format]??G.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${G.divisor}`;case"unrecognized_keys":return`Llave${G.keys.length>1?"s":""} desconocida${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${G.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${G.origin}`;default:return"Entrada inv\xE1lida"}}};function EH(){return{localeError:pP()}}var dP=()=>{let $={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(G))return"\u0622\u0631\u0627\u06CC\u0647";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return(G)=>{switch(G.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${G.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${Y(G.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":if(G.values.length===1)return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o(G.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`;return`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${h(G.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${G.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${z}${G.maximum.toString()} ${W.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${G.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${z}${G.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${G.origin} \u0628\u0627\u06CC\u062F ${z}${G.minimum.toString()} ${W.unit} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${G.origin} \u0628\u0627\u06CC\u062F ${z}${G.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${z.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`;if(z.format==="ends_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${z.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`;if(z.format==="includes")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${z.includes}" \u0628\u0627\u0634\u062F`;if(z.format==="regex")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${z.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`;return`${U[z.format]??G.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${G.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${G.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${h(G.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${G.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${G.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function NH(){return{localeError:dP()}}var lP=()=>{let $={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(G)=>{switch(G.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${G.expected}, oli ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Virheellinen sy\xF6te: t\xE4ytyy olla ${o(G.values[0])}`;return`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Liian suuri: ${W.subject} t\xE4ytyy olla ${z}${G.maximum.toString()} ${W.unit}`.trim();return`Liian suuri: arvon t\xE4ytyy olla ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Liian pieni: ${W.subject} t\xE4ytyy olla ${z}${G.minimum.toString()} ${W.unit}`.trim();return`Liian pieni: arvon t\xE4ytyy olla ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${z.prefix}"`;if(z.format==="ends_with")return`Virheellinen sy\xF6te: t\xE4ytyy loppua "${z.suffix}"`;if(z.format==="includes")return`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${z.includes}"`;if(z.format==="regex")return`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${z.pattern}`;return`Virheellinen ${U[z.format]??G.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${G.divisor} monikerta`;case"unrecognized_keys":return`${G.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${h(G.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function FH(){return{localeError:lP()}}var rP=()=>{let $={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"nombre";case"object":{if(Array.isArray(G))return"tableau";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"entr\xE9e",email:"adresse e-mail",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:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return(G)=>{switch(G.code){case"invalid_type":return`Entr\xE9e invalide : ${G.expected} attendu, ${Y(G.input)} re\xE7u`;case"invalid_value":if(G.values.length===1)return`Entr\xE9e invalide : ${o(G.values[0])} attendu`;return`Option invalide : une valeur parmi ${h(G.values,"|")} attendue`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Trop grand : ${G.origin??"valeur"} doit ${W.verb} ${z}${G.maximum.toString()} ${W.unit??"\xE9l\xE9ment(s)"}`;return`Trop grand : ${G.origin??"valeur"} doit \xEAtre ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Trop petit : ${G.origin} doit ${W.verb} ${z}${G.minimum.toString()} ${W.unit}`;return`Trop petit : ${G.origin} doit \xEAtre ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Cha\xEEne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Cha\xEEne invalide : doit correspondre au mod\xE8le ${z.pattern}`;return`${U[z.format]??G.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${G.divisor}`;case"unrecognized_keys":return`Cl\xE9${G.keys.length>1?"s":""} non reconnue${G.keys.length>1?"s":""} : ${h(G.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${G.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${G.origin}`;default:return"Entr\xE9e invalide"}}};function MH(){return{localeError:rP()}}var iP=()=>{let $={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"entr\xE9e",email:"adresse courriel",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:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return(G)=>{switch(G.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${G.expected}, re\xE7u ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Entr\xE9e invalide : attendu ${o(G.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"\u2264":"<",W=X(G.origin);if(W)return`Trop grand : attendu que ${G.origin??"la valeur"} ait ${z}${G.maximum.toString()} ${W.unit}`;return`Trop grand : attendu que ${G.origin??"la valeur"} soit ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?"\u2265":">",W=X(G.origin);if(W)return`Trop petit : attendu que ${G.origin} ait ${z}${G.minimum.toString()} ${W.unit}`;return`Trop petit : attendu que ${G.origin} soit ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Cha\xEEne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Cha\xEEne invalide : doit correspondre au motif ${z.pattern}`;return`${U[z.format]??G.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${G.divisor}`;case"unrecognized_keys":return`Cl\xE9${G.keys.length>1?"s":""} non reconnue${G.keys.length>1?"s":""} : ${h(G.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${G.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${G.origin}`;default:return"Entr\xE9e invalide"}}};function JH(){return{localeError:iP()}}var oP=()=>{let $={string:{unit:"\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u05E7\u05DC\u05D8",email:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",url:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",emoji:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",date:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",time:"\u05D6\u05DE\u05DF ISO",duration:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",ipv4:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",ipv6:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",cidrv4:"\u05D8\u05D5\u05D5\u05D7 IPv4",cidrv6:"\u05D8\u05D5\u05D5\u05D7 IPv6",base64:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",base64url:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",json_string:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",e164:"\u05DE\u05E1\u05E4\u05E8 E.164",jwt:"JWT",template_literal:"\u05E7\u05DC\u05D8"};return(G)=>{switch(G.code){case"invalid_type":return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${G.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${o(G.values[0])}`;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05D0\u05D7\u05EA \u05DE\u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${G.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${z}${G.maximum.toString()} ${W.unit??"elements"}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${G.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${G.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${z}${G.minimum.toString()} ${W.unit}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${G.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1"${z.prefix}"`;if(z.format==="ends_with")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${z.suffix}"`;if(z.format==="includes")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${z.includes}"`;if(z.format==="regex")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${z.pattern}`;return`${U[z.format]??G.format} \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${G.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${G.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${G.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${h(G.keys,", ")}`;case"invalid_key":return`\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${G.origin}`;case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${G.origin}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function AH(){return{localeError:oP()}}var nP=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(G))return"t\xF6mb";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"bemenet",email:"email c\xEDm",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 id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return(G)=>{switch(G.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${G.expected}, a kapott \xE9rt\xE9k ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o(G.values[0])}`;return`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`T\xFAl nagy: ${G.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${z}${G.maximum.toString()} ${W.unit??"elem"}`;return`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${G.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${G.origin} m\xE9rete t\xFAl kicsi ${z}${G.minimum.toString()} ${W.unit}`;return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${G.origin} t\xFAl kicsi ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\xC9rv\xE9nytelen string: "${z.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`;if(z.format==="ends_with")return`\xC9rv\xE9nytelen string: "${z.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`;if(z.format==="includes")return`\xC9rv\xE9nytelen string: "${z.includes}" \xE9rt\xE9ket kell tartalmaznia`;if(z.format==="regex")return`\xC9rv\xE9nytelen string: ${z.pattern} mint\xE1nak kell megfelelnie`;return`\xC9rv\xE9nytelen ${U[z.format]??G.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${G.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${G.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${G.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function LH(){return{localeError:nP()}}var tP=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"input",email:"alamat email",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:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(G)=>{switch(G.code){case"invalid_type":return`Input tidak valid: diharapkan ${G.expected}, diterima ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Input tidak valid: diharapkan ${o(G.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Terlalu besar: diharapkan ${G.origin??"value"} memiliki ${z}${G.maximum.toString()} ${W.unit??"elemen"}`;return`Terlalu besar: diharapkan ${G.origin??"value"} menjadi ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Terlalu kecil: diharapkan ${G.origin} memiliki ${z}${G.minimum.toString()} ${W.unit}`;return`Terlalu kecil: diharapkan ${G.origin} menjadi ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`String tidak valid: harus dimulai dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak valid: harus berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak valid: harus menyertakan "${z.includes}"`;if(z.format==="regex")return`String tidak valid: harus sesuai pola ${z.pattern}`;return`${U[z.format]??G.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${G.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${G.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${G.origin}`;default:return"Input tidak valid"}}};function KH(){return{localeError:tP()}}var aP=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"numero";case"object":{if(Array.isArray(G))return"vettore";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"input",email:"indirizzo email",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:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(G)=>{switch(G.code){case"invalid_type":return`Input non valido: atteso ${G.expected}, ricevuto ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Input non valido: atteso ${o(G.values[0])}`;return`Opzione non valida: atteso uno tra ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Troppo grande: ${G.origin??"valore"} deve avere ${z}${G.maximum.toString()} ${W.unit??"elementi"}`;return`Troppo grande: ${G.origin??"valore"} deve essere ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Troppo piccolo: ${G.origin} deve avere ${z}${G.minimum.toString()} ${W.unit}`;return`Troppo piccolo: ${G.origin} deve essere ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Stringa non valida: deve iniziare con "${z.prefix}"`;if(z.format==="ends_with")return`Stringa non valida: deve terminare con "${z.suffix}"`;if(z.format==="includes")return`Stringa non valida: deve includere "${z.includes}"`;if(z.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${z.pattern}`;return`Invalid ${U[z.format]??G.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${G.divisor}`;case"unrecognized_keys":return`Chiav${G.keys.length>1?"i":"e"} non riconosciut${G.keys.length>1?"e":"a"}: ${h(G.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${G.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${G.origin}`;default:return"Input non valido"}}};function _H(){return{localeError:aP()}}var sP=()=>{let $={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(G))return"\u914D\u5217";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return(G)=>{switch(G.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${G.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${Y(G.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":if(G.values.length===1)return`\u7121\u52B9\u306A\u5165\u529B: ${o(G.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u9078\u629E: ${h(G.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let z=G.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",W=X(G.origin);if(W)return`\u5927\u304D\u3059\u304E\u308B\u5024: ${G.origin??"\u5024"}\u306F${G.maximum.toString()}${W.unit??"\u8981\u7D20"}${z}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5927\u304D\u3059\u304E\u308B\u5024: ${G.origin??"\u5024"}\u306F${G.maximum.toString()}${z}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let z=G.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",W=X(G.origin);if(W)return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${G.origin}\u306F${G.minimum.toString()}${W.unit}${z}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${G.origin}\u306F${G.minimum.toString()}${z}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${z.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(z.format==="ends_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${z.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(z.format==="includes")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${z.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(z.format==="regex")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${z.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u7121\u52B9\u306A${U[z.format]??G.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${G.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${G.keys.length>1?"\u7FA4":""}: ${h(G.keys,"\u3001")}`;case"invalid_key":return`${G.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${G.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function qH(){return{localeError:sP()}}var eP=()=>{let $={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(G))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(G===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return(G)=>{switch(G.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${G.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o(G.values[0])}`;return`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${G.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${z} ${G.maximum.toString()} ${W.unit??"\u1792\u17B6\u178F\u17BB"}`;return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${G.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${z} ${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${G.origin} ${z} ${G.minimum.toString()} ${W.unit}`;return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${G.origin} ${z} ${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${z.prefix}"`;if(z.format==="ends_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${z.suffix}"`;if(z.format==="includes")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${z.includes}"`;if(z.format==="regex")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${z.pattern}`;return`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${U[z.format]??G.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${G.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${h(G.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${G.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${G.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function RH(){return{localeError:eP()}}var $I=()=>{let $={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return(G)=>{switch(G.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${G.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${Y(G.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":if(G.values.length===1)return`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${o(G.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC635\uC158: ${h(G.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let z=G.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",W=z==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",Q=X(G.origin),Z=Q?.unit??"\uC694\uC18C";if(Q)return`${G.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${G.maximum.toString()}${Z} ${z}${W}`;return`${G.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${G.maximum.toString()} ${z}${W}`}case"too_small":{let z=G.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",W=z==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",Q=X(G.origin),Z=Q?.unit??"\uC694\uC18C";if(Q)return`${G.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${G.minimum.toString()}${Z} ${z}${W}`;return`${G.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${G.minimum.toString()} ${z}${W}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${z.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`;if(z.format==="ends_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${z.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`;if(z.format==="includes")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${z.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`;if(z.format==="regex")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${z.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C ${U[z.format]??G.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${G.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${h(G.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${G.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${G.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function TH(){return{localeError:$I()}}var XI=()=>{let $={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(G))return"\u043D\u0438\u0437\u0430";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return(G)=>{switch(G.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${G.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Invalid input: expected ${o(G.values[0])}`;return`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${G.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${z}${G.maximum.toString()} ${W.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${G.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${G.origin} \u0434\u0430 \u0438\u043C\u0430 ${z}${G.minimum.toString()} ${W.unit}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${G.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${z.prefix}"`;if(z.format==="ends_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${z.suffix}"`;if(z.format==="includes")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${z.includes}"`;if(z.format==="regex")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${z.pattern}`;return`Invalid ${U[z.format]??G.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${G.divisor}`;case"unrecognized_keys":return`${G.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${h(G.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${G.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${G.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function vH(){return{localeError:XI()}}var YI=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"nombor";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"input",email:"alamat e-mel",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:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(G)=>{switch(G.code){case"invalid_type":return`Input tidak sah: dijangka ${G.expected}, diterima ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Input tidak sah: dijangka ${o(G.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Terlalu besar: dijangka ${G.origin??"nilai"} ${W.verb} ${z}${G.maximum.toString()} ${W.unit??"elemen"}`;return`Terlalu besar: dijangka ${G.origin??"nilai"} adalah ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Terlalu kecil: dijangka ${G.origin} ${W.verb} ${z}${G.minimum.toString()} ${W.unit}`;return`Terlalu kecil: dijangka ${G.origin} adalah ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`String tidak sah: mesti bermula dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak sah: mesti mengandungi "${z.includes}"`;if(z.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${z.pattern}`;return`${U[z.format]??G.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${G.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${h(G.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${G.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${G.origin}`;default:return"Input tidak sah"}}};function CH(){return{localeError:YI()}}var GI=()=>{let $={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"getal";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"invoer",email:"emailadres",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 datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(G)=>{switch(G.code){case"invalid_type":return`Ongeldige invoer: verwacht ${G.expected}, ontving ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Ongeldige invoer: verwacht ${o(G.values[0])}`;return`Ongeldige optie: verwacht \xE9\xE9n van ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Te lang: verwacht dat ${G.origin??"waarde"} ${z}${G.maximum.toString()} ${W.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${G.origin??"waarde"} ${z}${G.maximum.toString()} is`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Te kort: verwacht dat ${G.origin} ${z}${G.minimum.toString()} ${W.unit} bevat`;return`Te kort: verwacht dat ${G.origin} ${z}${G.minimum.toString()} is`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Ongeldige tekst: moet met "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ongeldige tekst: moet op "${z.suffix}" eindigen`;if(z.format==="includes")return`Ongeldige tekst: moet "${z.includes}" bevatten`;if(z.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${z.pattern}`;return`Ongeldig: ${U[z.format]??G.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${G.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${G.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${G.origin}`;default:return"Ongeldige invoer"}}};function BH(){return{localeError:GI()}}var UI=()=>{let $={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"tall";case"object":{if(Array.isArray(G))return"liste";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(G)=>{switch(G.code){case"invalid_type":return`Ugyldig input: forventet ${G.expected}, fikk ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Ugyldig verdi: forventet ${o(G.values[0])}`;return`Ugyldig valg: forventet en av ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`For stor(t): forventet ${G.origin??"value"} til \xE5 ha ${z}${G.maximum.toString()} ${W.unit??"elementer"}`;return`For stor(t): forventet ${G.origin??"value"} til \xE5 ha ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`For lite(n): forventet ${G.origin} til \xE5 ha ${z}${G.minimum.toString()} ${W.unit}`;return`For lite(n): forventet ${G.origin} til \xE5 ha ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Ugyldig streng: m\xE5 starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: m\xE5 ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: m\xE5 inneholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: m\xE5 matche m\xF8nsteret ${z.pattern}`;return`Ugyldig ${U[z.format]??G.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${G.divisor}`;case"unrecognized_keys":return`${G.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${h(G.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${G.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${G.origin}`;default:return"Ugyldig input"}}};function jH(){return{localeError:UI()}}var zI=()=>{let $={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"numara";case"object":{if(Array.isArray(G))return"saf";if(G===null)return"gayb";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"giren",email:"epostag\xE2h",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 heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return(G)=>{switch(G.code){case"invalid_type":return`F\xE2sit giren: umulan ${G.expected}, al\u0131nan ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`F\xE2sit giren: umulan ${o(G.values[0])}`;return`F\xE2sit tercih: m\xFBteberler ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Fazla b\xFCy\xFCk: ${G.origin??"value"}, ${z}${G.maximum.toString()} ${W.unit??"elements"} sahip olmal\u0131yd\u0131.`;return`Fazla b\xFCy\xFCk: ${G.origin??"value"}, ${z}${G.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Fazla k\xFC\xE7\xFCk: ${G.origin}, ${z}${G.minimum.toString()} ${W.unit} sahip olmal\u0131yd\u0131.`;return`Fazla k\xFC\xE7\xFCk: ${G.origin}, ${z}${G.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`F\xE2sit metin: "${z.prefix}" ile ba\u015Flamal\u0131.`;if(z.format==="ends_with")return`F\xE2sit metin: "${z.suffix}" ile bitmeli.`;if(z.format==="includes")return`F\xE2sit metin: "${z.includes}" ihtiv\xE2 etmeli.`;if(z.format==="regex")return`F\xE2sit metin: ${z.pattern} nak\u015F\u0131na uymal\u0131.`;return`F\xE2sit ${U[z.format]??G.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${G.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`${G.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${G.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function PH(){return{localeError:zI()}}var WI=()=>{let $={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(G))return"\u0627\u0631\u06D0";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return(G)=>{switch(G.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${G.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${Y(G.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":if(G.values.length===1)return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o(G.values[0])} \u0648\u0627\u06CC`;return`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${h(G.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${G.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${z}${G.maximum.toString()} ${W.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${G.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${z}${G.maximum.toString()} \u0648\u064A`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${G.origin} \u0628\u0627\u06CC\u062F ${z}${G.minimum.toString()} ${W.unit} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${G.origin} \u0628\u0627\u06CC\u062F ${z}${G.minimum.toString()} \u0648\u064A`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${z.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`;if(z.format==="ends_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${z.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`;if(z.format==="includes")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${z.includes}" \u0648\u0644\u0631\u064A`;if(z.format==="regex")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${z.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`;return`${U[z.format]??G.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${G.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${G.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${h(G.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${G.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${G.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function IH(){return{localeError:WI()}}var QI=()=>{let $={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"liczba";case"object":{if(Array.isArray(G))return"tablica";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"wyra\u017Cenie",email:"adres email",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:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return(G)=>{switch(G.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${G.expected}, otrzymano ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o(G.values[0])}`;return`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${G.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${z}${G.maximum.toString()} ${W.unit??"element\xF3w"}`;return`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${G.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${G.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${z}${G.minimum.toString()} ${W.unit??"element\xF3w"}`;return`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${G.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${z.prefix}"`;if(z.format==="ends_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${z.suffix}"`;if(z.format==="includes")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${z.includes}"`;if(z.format==="regex")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${z.pattern}`;return`Nieprawid\u0142ow(y/a/e) ${U[z.format]??G.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${G.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${G.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${G.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function xH(){return{localeError:QI()}}var ZI=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(G))return"array";if(G===null)return"nulo";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"padr\xE3o",email:"endere\xE7o de e-mail",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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return(G)=>{switch(G.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${G.expected}, recebido ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Entrada inv\xE1lida: esperado ${o(G.values[0])}`;return`Op\xE7\xE3o inv\xE1lida: esperada uma das ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Muito grande: esperado que ${G.origin??"valor"} tivesse ${z}${G.maximum.toString()} ${W.unit??"elementos"}`;return`Muito grande: esperado que ${G.origin??"valor"} fosse ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Muito pequeno: esperado que ${G.origin} tivesse ${z}${G.minimum.toString()} ${W.unit}`;return`Muito pequeno: esperado que ${G.origin} fosse ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Texto inv\xE1lido: deve come\xE7ar com "${z.prefix}"`;if(z.format==="ends_with")return`Texto inv\xE1lido: deve terminar com "${z.suffix}"`;if(z.format==="includes")return`Texto inv\xE1lido: deve incluir "${z.includes}"`;if(z.format==="regex")return`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${z.pattern}`;return`${U[z.format]??G.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${G.divisor}`;case"unrecognized_keys":return`Chave${G.keys.length>1?"s":""} desconhecida${G.keys.length>1?"s":""}: ${h(G.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${G.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${G.origin}`;default:return"Campo inv\xE1lido"}}};function SH(){return{localeError:ZI()}}function hF($,X,Y,U){let G=Math.abs($),z=G%10,W=G%100;if(W>=11&&W<=19)return U;if(z===1)return X;if(z>=2&&z<=4)return Y;return U}var HI=()=>{let $={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(G))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return(G)=>{switch(G.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${G.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o(G.values[0])}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W){let Q=Number(G.maximum),Z=hF(Q,W.unit.one,W.unit.few,W.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${G.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${z}${G.maximum.toString()} ${Z}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${G.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W){let Q=Number(G.minimum),Z=hF(Q,W.unit.one,W.unit.few,W.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${G.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${z}${G.minimum.toString()} ${Z}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${G.origin} \u0431\u0443\u0434\u0435\u0442 ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${z.prefix}"`;if(z.format==="ends_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${z.suffix}"`;if(z.format==="includes")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${z.includes}"`;if(z.format==="regex")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${z.pattern}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${U[z.format]??G.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${G.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${G.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${G.keys.length>1?"\u0438":""}: ${h(G.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${G.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${G.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function kH(){return{localeError:HI()}}var VI=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(G))return"tabela";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"vnos",email:"e-po\u0161tni naslov",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 datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return(G)=>{switch(G.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${G.expected}, prejeto ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Neveljaven vnos: pri\u010Dakovano ${o(G.values[0])}`;return`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Preveliko: pri\u010Dakovano, da bo ${G.origin??"vrednost"} imelo ${z}${G.maximum.toString()} ${W.unit??"elementov"}`;return`Preveliko: pri\u010Dakovano, da bo ${G.origin??"vrednost"} ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Premajhno: pri\u010Dakovano, da bo ${G.origin} imelo ${z}${G.minimum.toString()} ${W.unit}`;return`Premajhno: pri\u010Dakovano, da bo ${G.origin} ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Neveljaven niz: mora se za\u010Deti z "${z.prefix}"`;if(z.format==="ends_with")return`Neveljaven niz: mora se kon\u010Dati z "${z.suffix}"`;if(z.format==="includes")return`Neveljaven niz: mora vsebovati "${z.includes}"`;if(z.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${z.pattern}`;return`Neveljaven ${U[z.format]??G.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${G.divisor}`;case"unrecognized_keys":return`Neprepoznan${G.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${h(G.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${G.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${G.origin}`;default:return"Neveljaven vnos"}}};function bH(){return{localeError:VI()}}var OI=()=>{let $={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"antal";case"object":{if(Array.isArray(G))return"lista";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"regulj\xE4rt uttryck",email:"e-postadress",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-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(G)=>{switch(G.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${G.expected}, fick ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`Ogiltig inmatning: f\xF6rv\xE4ntat ${o(G.values[0])}`;return`Ogiltigt val: f\xF6rv\xE4ntade en av ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`F\xF6r stor(t): f\xF6rv\xE4ntade ${G.origin??"v\xE4rdet"} att ha ${z}${G.maximum.toString()} ${W.unit??"element"}`;return`F\xF6r stor(t): f\xF6rv\xE4ntat ${G.origin??"v\xE4rdet"} att ha ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`F\xF6r lite(t): f\xF6rv\xE4ntade ${G.origin??"v\xE4rdet"} att ha ${z}${G.minimum.toString()} ${W.unit}`;return`F\xF6r lite(t): f\xF6rv\xE4ntade ${G.origin??"v\xE4rdet"} att ha ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${z.prefix}"`;if(z.format==="ends_with")return`Ogiltig str\xE4ng: m\xE5ste sluta med "${z.suffix}"`;if(z.format==="includes")return`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${z.includes}"`;if(z.format==="regex")return`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${z.pattern}"`;return`Ogiltig(t) ${U[z.format]??G.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${G.divisor}`;case"unrecognized_keys":return`${G.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${h(G.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${G.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${G.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function fH(){return{localeError:OI()}}var wI=()=>{let $={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(G))return"\u0B85\u0BA3\u0BBF";if(G===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",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 \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return(G)=>{switch(G.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${G.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o(G.values[0])}`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${h(G.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${G.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${z}${G.maximum.toString()} ${W.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${G.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${z}${G.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${G.origin} ${z}${G.minimum.toString()} ${W.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${G.origin} ${z}${G.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${z.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(z.format==="ends_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${z.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(z.format==="includes")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${z.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(z.format==="regex")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${z.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${U[z.format]??G.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${G.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${G.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${h(G.keys,", ")}`;case"invalid_key":return`${G.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${G.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function hH(){return{localeError:wI()}}var DI=()=>{let $={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(G))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(G===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return(G)=>{switch(G.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${G.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o(G.values[0])}`;return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",W=X(G.origin);if(W)return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${G.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${z} ${G.maximum.toString()} ${W.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`;return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${G.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${z} ${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",W=X(G.origin);if(W)return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${G.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${z} ${G.minimum.toString()} ${W.unit}`;return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${G.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${z} ${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${z.prefix}"`;if(z.format==="ends_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${z.suffix}"`;if(z.format==="includes")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${z.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`;if(z.format==="regex")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${z.pattern}`;return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${U[z.format]??G.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${G.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${h(G.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${G.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${G.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function gH(){return{localeError:DI()}}var EI=($)=>{let X=typeof $;switch(X){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return X},NI=()=>{let $={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function X(U){return $[U]??null}let Y={regex:"girdi",email:"e-posta adresi",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 tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return(U)=>{switch(U.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${U.expected}, al\u0131nan ${EI(U.input)}`;case"invalid_value":if(U.values.length===1)return`Ge\xE7ersiz de\u011Fer: beklenen ${o(U.values[0])}`;return`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${h(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=X(U.origin);if(z)return`\xC7ok b\xFCy\xFCk: beklenen ${U.origin??"de\u011Fer"} ${G}${U.maximum.toString()} ${z.unit??"\xF6\u011Fe"}`;return`\xC7ok b\xFCy\xFCk: beklenen ${U.origin??"de\u011Fer"} ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=X(U.origin);if(z)return`\xC7ok k\xFC\xE7\xFCk: beklenen ${U.origin} ${G}${U.minimum.toString()} ${z.unit}`;return`\xC7ok k\xFC\xE7\xFCk: beklenen ${U.origin} ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Ge\xE7ersiz metin: "${G.prefix}" ile ba\u015Flamal\u0131`;if(G.format==="ends_with")return`Ge\xE7ersiz metin: "${G.suffix}" ile bitmeli`;if(G.format==="includes")return`Ge\xE7ersiz metin: "${G.includes}" i\xE7ermeli`;if(G.format==="regex")return`Ge\xE7ersiz metin: ${G.pattern} desenine uymal\u0131`;return`Ge\xE7ersiz ${Y[G.format]??U.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${U.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${U.keys.length>1?"lar":""}: ${h(U.keys,", ")}`;case"invalid_key":return`${U.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${U.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function yH(){return{localeError:NI()}}var FI=()=>{let $={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(G))return"\u043C\u0430\u0441\u0438\u0432";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return(G)=>{switch(G.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${G.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o(G.values[0])}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${G.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${W.verb} ${z}${G.maximum.toString()} ${W.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${G.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${G.origin} ${W.verb} ${z}${G.minimum.toString()} ${W.unit}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${G.origin} \u0431\u0443\u0434\u0435 ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${z.prefix}"`;if(z.format==="ends_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${z.suffix}"`;if(z.format==="includes")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${z.includes}"`;if(z.format==="regex")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${z.pattern}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${U[z.format]??G.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${G.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${G.keys.length>1?"\u0456":""}: ${h(G.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${G.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${G.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function mH(){return{localeError:FI()}}var MI=()=>{let $={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(G))return"\u0622\u0631\u06D2";if(G===null)return"\u0646\u0644";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return(G)=>{switch(G.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${G.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${Y(G.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":if(G.values.length===1)return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o(G.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;return`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${h(G.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${G.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${z}${G.maximum.toString()} ${W.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${G.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${z}${G.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${G.origin} \u06A9\u06D2 ${z}${G.minimum.toString()} ${W.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${G.origin} \u06A9\u0627 ${z}${G.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${z.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(z.format==="ends_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${z.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(z.format==="includes")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${z.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(z.format==="regex")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${z.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;return`\u063A\u0644\u0637 ${U[z.format]??G.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${G.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${G.keys.length>1?"\u0632":""}: ${h(G.keys,"\u060C ")}`;case"invalid_key":return`${G.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${G.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function uH(){return{localeError:MI()}}var JI=()=>{let $={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(G))return"m\u1EA3ng";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",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:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return(G)=>{switch(G.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${G.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o(G.values[0])}`;return`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${G.origin??"gi\xE1 tr\u1ECB"} ${W.verb} ${z}${G.maximum.toString()} ${W.unit??"ph\u1EA7n t\u1EED"}`;return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${G.origin??"gi\xE1 tr\u1ECB"} ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${G.origin} ${W.verb} ${z}${G.minimum.toString()} ${W.unit}`;return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${G.origin} ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${z.prefix}"`;if(z.format==="ends_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${z.suffix}"`;if(z.format==="includes")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${z.includes}"`;if(z.format==="regex")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${z.pattern}`;return`${U[z.format]??G.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${G.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${h(G.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${G.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${G.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function cH(){return{localeError:JI()}}var AI=()=>{let $={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(G))return"\u6570\u7EC4";if(G===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return(G)=>{switch(G.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${G.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o(G.values[0])}`;return`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${G.origin??"\u503C"} ${z}${G.maximum.toString()} ${W.unit??"\u4E2A\u5143\u7D20"}`;return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${G.origin??"\u503C"} ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${G.origin} ${z}${G.minimum.toString()} ${W.unit}`;return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${G.origin} ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${z.prefix}" \u5F00\u5934`;if(z.format==="ends_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${z.suffix}" \u7ED3\u5C3E`;if(z.format==="includes")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${z.includes}"`;if(z.format==="regex")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${z.pattern}`;return`\u65E0\u6548${U[z.format]??G.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${G.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${h(G.keys,", ")}`;case"invalid_key":return`${G.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${G.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function pH(){return{localeError:AI()}}var LI=()=>{let $={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function X(G){return $[G]??null}let Y=(G)=>{let z=typeof G;switch(z){case"number":return Number.isNaN(G)?"NaN":"number";case"object":{if(Array.isArray(G))return"array";if(G===null)return"null";if(Object.getPrototypeOf(G)!==Object.prototype&&G.constructor)return G.constructor.name}}return z},U={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",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 \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return(G)=>{switch(G.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${G.expected}\uFF0C\u4F46\u6536\u5230 ${Y(G.input)}`;case"invalid_value":if(G.values.length===1)return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o(G.values[0])}`;return`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${h(G.values,"|")}`;case"too_big":{let z=G.inclusive?"<=":"<",W=X(G.origin);if(W)return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${G.origin??"\u503C"} \u61C9\u70BA ${z}${G.maximum.toString()} ${W.unit??"\u500B\u5143\u7D20"}`;return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${G.origin??"\u503C"} \u61C9\u70BA ${z}${G.maximum.toString()}`}case"too_small":{let z=G.inclusive?">=":">",W=X(G.origin);if(W)return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${G.origin} \u61C9\u70BA ${z}${G.minimum.toString()} ${W.unit}`;return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${G.origin} \u61C9\u70BA ${z}${G.minimum.toString()}`}case"invalid_format":{let z=G;if(z.format==="starts_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${z.prefix}" \u958B\u982D`;if(z.format==="ends_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${z.suffix}" \u7D50\u5C3E`;if(z.format==="includes")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${z.includes}"`;if(z.format==="regex")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${z.pattern}`;return`\u7121\u6548\u7684 ${U[z.format]??G.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${G.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${G.keys.length>1?"\u5011":""}\uFF1A${h(G.keys,"\u3001")}`;case"invalid_key":return`${G.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${G.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function dH(){return{localeError:LI()}}var lH=Symbol("ZodOutput"),rH=Symbol("ZodInput");class FY{constructor(){this._map=new Map,this._idmap=new Map}add($,...X){let Y=X[0];if(this._map.set($,Y),Y&&typeof Y==="object"&&"id"in Y){if(this._idmap.has(Y.id))throw new Error(`ID ${Y.id} already exists in the registry`);this._idmap.set(Y.id,$)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove($){let X=this._map.get($);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete($),this}get($){let X=$._zod.parent;if(X){let Y={...this.get(X)??{}};return delete Y.id,{...Y,...this._map.get($)}}return this._map.get($)}has($){return this._map.has($)}}function t5(){return new FY}var e1=t5();function iH($,X){return new $({type:"string",...d(X)})}function oH($,X){return new $({type:"string",coerce:!0,...d(X)})}function a5($,X){return new $({type:"string",format:"email",check:"string_format",abort:!1,...d(X)})}function MY($,X){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...d(X)})}function s5($,X){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...d(X)})}function e5($,X){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...d(X)})}function $U($,X){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...d(X)})}function XU($,X){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...d(X)})}function YU($,X){return new $({type:"string",format:"url",check:"string_format",abort:!1,...d(X)})}function GU($,X){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...d(X)})}function UU($,X){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...d(X)})}function zU($,X){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...d(X)})}function WU($,X){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...d(X)})}function QU($,X){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...d(X)})}function ZU($,X){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...d(X)})}function HU($,X){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...d(X)})}function VU($,X){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...d(X)})}function OU($,X){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...d(X)})}function wU($,X){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...d(X)})}function DU($,X){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...d(X)})}function EU($,X){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...d(X)})}function NU($,X){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...d(X)})}function FU($,X){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...d(X)})}function MU($,X){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...d(X)})}var nH={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function tH($,X){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...d(X)})}function aH($,X){return new $({type:"string",format:"date",check:"string_format",...d(X)})}function sH($,X){return new $({type:"string",format:"time",check:"string_format",precision:null,...d(X)})}function eH($,X){return new $({type:"string",format:"duration",check:"string_format",...d(X)})}function $V($,X){return new $({type:"number",checks:[],...d(X)})}function XV($,X){return new $({type:"number",coerce:!0,checks:[],...d(X)})}function YV($,X){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...d(X)})}function GV($,X){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...d(X)})}function UV($,X){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...d(X)})}function zV($,X){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...d(X)})}function WV($,X){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...d(X)})}function QV($,X){return new $({type:"boolean",...d(X)})}function ZV($,X){return new $({type:"boolean",coerce:!0,...d(X)})}function HV($,X){return new $({type:"bigint",...d(X)})}function VV($,X){return new $({type:"bigint",coerce:!0,...d(X)})}function OV($,X){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...d(X)})}function wV($,X){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...d(X)})}function DV($,X){return new $({type:"symbol",...d(X)})}function EV($,X){return new $({type:"undefined",...d(X)})}function NV($,X){return new $({type:"null",...d(X)})}function FV($){return new $({type:"any"})}function HX($){return new $({type:"unknown"})}function MV($,X){return new $({type:"never",...d(X)})}function JV($,X){return new $({type:"void",...d(X)})}function AV($,X){return new $({type:"date",...d(X)})}function LV($,X){return new $({type:"date",coerce:!0,...d(X)})}function KV($,X){return new $({type:"nan",...d(X)})}function R0($,X){return new c5({check:"less_than",...d(X),value:$,inclusive:!1})}function K1($,X){return new c5({check:"less_than",...d(X),value:$,inclusive:!0})}function T0($,X){return new p5({check:"greater_than",...d(X),value:$,inclusive:!1})}function u6($,X){return new p5({check:"greater_than",...d(X),value:$,inclusive:!0})}function _V($){return T0(0,$)}function qV($){return R0(0,$)}function RV($){return K1(0,$)}function TV($){return u6(0,$)}function W8($,X){return new yQ({check:"multiple_of",...d(X),value:$})}function VX($,X){return new cQ({check:"max_size",...d(X),maximum:$})}function Q8($,X){return new pQ({check:"min_size",...d(X),minimum:$})}function JY($,X){return new dQ({check:"size_equals",...d(X),size:$})}function OX($,X){return new lQ({check:"max_length",...d(X),maximum:$})}function N2($,X){return new rQ({check:"min_length",...d(X),minimum:$})}function wX($,X){return new iQ({check:"length_equals",...d(X),length:$})}function AY($,X){return new oQ({check:"string_format",format:"regex",...d(X),pattern:$})}function LY($){return new nQ({check:"string_format",format:"lowercase",...d($)})}function KY($){return new tQ({check:"string_format",format:"uppercase",...d($)})}function _Y($,X){return new aQ({check:"string_format",format:"includes",...d(X),includes:$})}function qY($,X){return new sQ({check:"string_format",format:"starts_with",...d(X),prefix:$})}function RY($,X){return new eQ({check:"string_format",format:"ends_with",...d(X),suffix:$})}function vV($,X,Y){return new $Z({check:"property",property:$,schema:X,...d(Y)})}function TY($,X){return new XZ({check:"mime_type",mime:$,...d(X)})}function v0($){return new YZ({check:"overwrite",tx:$})}function vY($){return v0((X)=>X.normalize($))}function CY(){return v0(($)=>$.trim())}function BY(){return v0(($)=>$.toLowerCase())}function jY(){return v0(($)=>$.toUpperCase())}function PY($,X,Y){return new $({type:"array",element:X,...d(Y)})}function KI($,X,Y){return new $({type:"union",options:X,...d(Y)})}function _I($,X,Y,U){return new $({type:"union",options:Y,discriminator:X,...d(U)})}function qI($,X,Y){return new $({type:"intersection",left:X,right:Y})}function CV($,X,Y,U){let G=Y instanceof N$;return new $({type:"tuple",items:X,rest:G?Y:null,...d(G?U:Y)})}function RI($,X,Y,U){return new $({type:"record",keyType:X,valueType:Y,...d(U)})}function TI($,X,Y,U){return new $({type:"map",keyType:X,valueType:Y,...d(U)})}function vI($,X,Y){return new $({type:"set",valueType:X,...d(Y)})}function CI($,X,Y){let U=Array.isArray(X)?Object.fromEntries(X.map((G)=>[G,G])):X;return new $({type:"enum",entries:U,...d(Y)})}function BI($,X,Y){return new $({type:"enum",entries:X,...d(Y)})}function jI($,X,Y){return new $({type:"literal",values:Array.isArray(X)?X:[X],...d(Y)})}function BV($,X){return new $({type:"file",...d(X)})}function PI($,X){return new $({type:"transform",transform:X})}function II($,X){return new $({type:"optional",innerType:X})}function xI($,X){return new $({type:"nullable",innerType:X})}function SI($,X,Y){return new $({type:"default",innerType:X,get defaultValue(){return typeof Y==="function"?Y():Y}})}function kI($,X,Y){return new $({type:"nonoptional",innerType:X,...d(Y)})}function bI($,X){return new $({type:"success",innerType:X})}function fI($,X,Y){return new $({type:"catch",innerType:X,catchValue:typeof Y==="function"?Y:()=>Y})}function hI($,X,Y){return new $({type:"pipe",in:X,out:Y})}function gI($,X){return new $({type:"readonly",innerType:X})}function yI($,X,Y){return new $({type:"template_literal",parts:X,...d(Y)})}function mI($,X){return new $({type:"lazy",getter:X})}function uI($,X){return new $({type:"promise",innerType:X})}function jV($,X,Y){let U=d(Y);return U.abort??(U.abort=!0),new $({type:"custom",check:"custom",fn:X,...U})}function PV($,X,Y){return new $({type:"custom",check:"custom",fn:X,...d(Y)})}function IV($,X){let Y=d(X),U=Y.truthy??["true","1","yes","on","y","enabled"],G=Y.falsy??["false","0","no","off","n","disabled"];if(Y.case!=="sensitive")U=U.map((E)=>typeof E==="string"?E.toLowerCase():E),G=G.map((E)=>typeof E==="string"?E.toLowerCase():E);let z=new Set(U),W=new Set(G),Q=$.Pipe??DY,Z=$.Boolean??VY,H=$.String??U8,O=new($.Transform??wY)({type:"transform",transform:(E,F)=>{let J=E;if(Y.case!=="sensitive")J=J.toLowerCase();if(z.has(J))return!0;else if(W.has(J))return!1;else return F.issues.push({code:"invalid_value",expected:"stringbool",values:[...z,...W],input:F.value,inst:O}),{}},error:Y.error}),w=new Q({type:"pipe",in:new H({type:"string",error:Y.error}),out:O,error:Y.error});return new Q({type:"pipe",in:w,out:new Z({type:"boolean",error:Y.error}),error:Y.error})}function xV($,X,Y,U={}){let G=d(U),z={...d(U),check:"string_format",type:"string",format:X,fn:typeof Y==="function"?Y:(Q)=>Y.test(Q),...G};if(Y instanceof RegExp)z.pattern=Y;return new $(z)}class SV{constructor($){this._def=$,this.def=$}implement($){if(typeof $!=="function")throw new Error("implement() must be called with a function");let X=(...Y)=>{let U=this._def.input?f5(this._def.input,Y,void 0,{callee:X}):Y;if(!Array.isArray(U))throw new Error("Invalid arguments schema: not an array or tuple schema.");let G=$(...U);return this._def.output?f5(this._def.output,G,void 0,{callee:X}):G};return X}implementAsync($){if(typeof $!=="function")throw new Error("implement() must be called with a function");let X=async(...Y)=>{let U=this._def.input?await g5(this._def.input,Y,void 0,{callee:X}):Y;if(!Array.isArray(U))throw new Error("Invalid arguments schema: not an array or tuple schema.");let G=await $(...U);return this._def.output?g5(this._def.output,G,void 0,{callee:X}):G};return X}input(...$){let X=this.constructor;if(Array.isArray($[0]))return new X({type:"function",input:new z8({type:"tuple",items:$[0],rest:$[1]}),output:this._def.output});return new X({type:"function",input:$[0],output:this._def.output})}output($){return new this.constructor({type:"function",input:this._def.input,output:$})}}function kV($){return new SV({type:"function",input:Array.isArray($?.input)?CV(z8,$?.input):$?.input??PY(OY,HX(ZX)),output:$?.output??HX(ZX)})}class JU{constructor($){this.counter=0,this.metadataRegistry=$?.metadata??e1,this.target=$?.target??"draft-2020-12",this.unrepresentable=$?.unrepresentable??"throw",this.override=$?.override??(()=>{}),this.io=$?.io??"output",this.seen=new Map}process($,X={path:[],schemaPath:[]}){var Y;let U=$._zod.def,G={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},z=this.seen.get($);if(z){if(z.count++,X.schemaPath.includes($))z.cycle=X.path;return z.schema}let W={schema:{},count:1,cycle:void 0,path:X.path};this.seen.set($,W);let Q=$._zod.toJSONSchema?.();if(Q)W.schema=Q;else{let V={...X,schemaPath:[...X.schemaPath,$],path:X.path},O=$._zod.parent;if(O)W.ref=O,this.process(O,V),this.seen.get(O).isParent=!0;else{let w=W.schema;switch(U.type){case"string":{let D=w;D.type="string";let{minimum:E,maximum:F,format:J,patterns:A,contentEncoding:L}=$._zod.bag;if(typeof E==="number")D.minLength=E;if(typeof F==="number")D.maxLength=F;if(J){if(D.format=G[J]??J,D.format==="")delete D.format}if(L)D.contentEncoding=L;if(A&&A.size>0){let T=[...A];if(T.length===1)D.pattern=T[0].source;else if(T.length>1)W.schema.allOf=[...T.map((q)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:q.source}))]}break}case"number":{let D=w,{minimum:E,maximum:F,format:J,multipleOf:A,exclusiveMaximum:L,exclusiveMinimum:T}=$._zod.bag;if(typeof J==="string"&&J.includes("int"))D.type="integer";else D.type="number";if(typeof T==="number")D.exclusiveMinimum=T;if(typeof E==="number"){if(D.minimum=E,typeof T==="number")if(T>=E)delete D.minimum;else delete D.exclusiveMinimum}if(typeof L==="number")D.exclusiveMaximum=L;if(typeof F==="number"){if(D.maximum=F,typeof L==="number")if(L<=F)delete D.maximum;else delete D.exclusiveMaximum}if(typeof A==="number")D.multipleOf=A;break}case"boolean":{let D=w;D.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{w.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{w.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let D=w,{minimum:E,maximum:F}=$._zod.bag;if(typeof E==="number")D.minItems=E;if(typeof F==="number")D.maxItems=F;D.type="array",D.items=this.process(U.element,{...V,path:[...V.path,"items"]});break}case"object":{let D=w;D.type="object",D.properties={};let E=U.shape;for(let A in E)D.properties[A]=this.process(E[A],{...V,path:[...V.path,"properties",A]});let F=new Set(Object.keys(E)),J=new Set([...F].filter((A)=>{let L=U.shape[A]._zod;if(this.io==="input")return L.optin===void 0;else return L.optout===void 0}));if(J.size>0)D.required=Array.from(J);if(U.catchall?._zod.def.type==="never")D.additionalProperties=!1;else if(!U.catchall){if(this.io==="output")D.additionalProperties=!1}else if(U.catchall)D.additionalProperties=this.process(U.catchall,{...V,path:[...V.path,"additionalProperties"]});break}case"union":{let D=w;D.anyOf=U.options.map((E,F)=>this.process(E,{...V,path:[...V.path,"anyOf",F]}));break}case"intersection":{let D=w,E=this.process(U.left,{...V,path:[...V.path,"allOf",0]}),F=this.process(U.right,{...V,path:[...V.path,"allOf",1]}),J=(L)=>("allOf"in L)&&Object.keys(L).length===1,A=[...J(E)?E.allOf:[E],...J(F)?F.allOf:[F]];D.allOf=A;break}case"tuple":{let D=w;D.type="array";let E=U.items.map((A,L)=>this.process(A,{...V,path:[...V.path,"prefixItems",L]}));if(this.target==="draft-2020-12")D.prefixItems=E;else D.items=E;if(U.rest){let A=this.process(U.rest,{...V,path:[...V.path,"items"]});if(this.target==="draft-2020-12")D.items=A;else D.additionalItems=A}if(U.rest)D.items=this.process(U.rest,{...V,path:[...V.path,"items"]});let{minimum:F,maximum:J}=$._zod.bag;if(typeof F==="number")D.minItems=F;if(typeof J==="number")D.maxItems=J;break}case"record":{let D=w;D.type="object",D.propertyNames=this.process(U.keyType,{...V,path:[...V.path,"propertyNames"]}),D.additionalProperties=this.process(U.valueType,{...V,path:[...V.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let D=w,E=XY(U.entries);if(E.every((F)=>typeof F==="number"))D.type="number";if(E.every((F)=>typeof F==="string"))D.type="string";D.enum=E;break}case"literal":{let D=w,E=[];for(let F of U.values)if(F===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof F==="bigint")if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");else E.push(Number(F));else E.push(F);if(E.length===0);else if(E.length===1){let F=E[0];D.type=F===null?"null":typeof F,D.const=F}else{if(E.every((F)=>typeof F==="number"))D.type="number";if(E.every((F)=>typeof F==="string"))D.type="string";if(E.every((F)=>typeof F==="boolean"))D.type="string";if(E.every((F)=>F===null))D.type="null";D.enum=E}break}case"file":{let D=w,E={type:"string",format:"binary",contentEncoding:"binary"},{minimum:F,maximum:J,mime:A}=$._zod.bag;if(F!==void 0)E.minLength=F;if(J!==void 0)E.maxLength=J;if(A)if(A.length===1)E.contentMediaType=A[0],Object.assign(D,E);else D.anyOf=A.map((L)=>{return{...E,contentMediaType:L}});else Object.assign(D,E);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let D=this.process(U.innerType,V);w.anyOf=[D,{type:"null"}];break}case"nonoptional":{this.process(U.innerType,V),W.ref=U.innerType;break}case"success":{let D=w;D.type="boolean";break}case"default":{this.process(U.innerType,V),W.ref=U.innerType,w.default=JSON.parse(JSON.stringify(U.defaultValue));break}case"prefault":{if(this.process(U.innerType,V),W.ref=U.innerType,this.io==="input")w._prefault=JSON.parse(JSON.stringify(U.defaultValue));break}case"catch":{this.process(U.innerType,V),W.ref=U.innerType;let D;try{D=U.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}w.default=D;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let D=w,E=$._zod.pattern;if(!E)throw new Error("Pattern not found in template literal");D.type="string",D.pattern=E.source;break}case"pipe":{let D=this.io==="input"?U.in._zod.def.type==="transform"?U.out:U.in:U.out;this.process(D,V),W.ref=D;break}case"readonly":{this.process(U.innerType,V),W.ref=U.innerType,w.readOnly=!0;break}case"promise":{this.process(U.innerType,V),W.ref=U.innerType;break}case"optional":{this.process(U.innerType,V),W.ref=U.innerType;break}case"lazy":{let D=$._zod.innerType;this.process(D,V),W.ref=D;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let Z=this.metadataRegistry.get($);if(Z)Object.assign(W.schema,Z);if(this.io==="input"&&x4($))delete W.schema.examples,delete W.schema.default;if(this.io==="input"&&W.schema._prefault)(Y=W.schema).default??(Y.default=W.schema._prefault);return delete W.schema._prefault,this.seen.get($).schema}emit($,X){let Y={cycles:X?.cycles??"ref",reused:X?.reused??"inline",external:X?.external??void 0},U=this.seen.get($);if(!U)throw new Error("Unprocessed schema. This is a bug in Zod.");let G=(H)=>{let V=this.target==="draft-2020-12"?"$defs":"definitions";if(Y.external){let E=Y.external.registry.get(H[0])?.id,F=Y.external.uri??((A)=>A);if(E)return{ref:F(E)};let J=H[1].defId??H[1].schema.id??`schema${this.counter++}`;return H[1].defId=J,{defId:J,ref:`${F("__shared")}#/${V}/${J}`}}if(H[1]===U)return{ref:"#"};let w=`${"#"}/${V}/`,D=H[1].schema.id??`__schema${this.counter++}`;return{defId:D,ref:w+D}},z=(H)=>{if(H[1].schema.$ref)return;let V=H[1],{ref:O,defId:w}=G(H);if(V.def={...V.schema},w)V.defId=w;let D=V.schema;for(let E in D)delete D[E];D.$ref=O};if(Y.cycles==="throw")for(let H of this.seen.entries()){let V=H[1];if(V.cycle)throw new Error(`Cycle detected: #/${V.cycle?.join("/")}/<root>
|
|
42
42
|
|
|
43
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let H of this.seen.entries()){let V=H[1];if($===H[0]){z(H);continue}if(Y.external){let w=Y.external.registry.get(H[0])?.id;if($!==H[0]&&w){z(H);continue}}if(this.metadataRegistry.get(H[0])?.id){z(H);continue}if(V.cycle){z(H);continue}if(V.count>1){if(Y.reused==="ref"){z(H);continue}}}let W=(H,V)=>{let O=this.seen.get(H),w=O.def??O.schema,D={...w};if(O.ref===null)return;let E=O.ref;if(O.ref=null,E){W(E,V);let F=this.seen.get(E).schema;if(F.$ref&&V.target==="draft-7")w.allOf=w.allOf??[],w.allOf.push(F);else Object.assign(w,F),Object.assign(w,D)}if(!O.isParent)this.override({zodSchema:H,jsonSchema:w,path:O.path??[]})};for(let H of[...this.seen.entries()].reverse())W(H[0],{target:this.target});let Q={};if(this.target==="draft-2020-12")Q.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")Q.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);if(Y.external?.uri){let H=Y.external.registry.get($)?.id;if(!H)throw new Error("Schema is missing an `id` property");Q.$id=Y.external.uri(H)}Object.assign(Q,U.def);let Z=Y.external?.defs??{};for(let H of this.seen.entries()){let V=H[1];if(V.def&&V.defId)Z[V.defId]=V.def}if(Y.external);else if(Object.keys(Z).length>0)if(this.target==="draft-2020-12")Q.$defs=Z;else Q.definitions=Z;try{return JSON.parse(JSON.stringify(Q))}catch(H){throw new Error("Error converting schema to JSON.")}}}function bV($,X){if($ instanceof FY){let U=new JU(X),G={};for(let Q of $._idmap.entries()){let[Z,H]=Q;U.process(H)}let z={},W={registry:$,uri:X?.uri,defs:G};for(let Q of $._idmap.entries()){let[Z,H]=Q;z[Z]=U.emit(H,{...X,external:W})}if(Object.keys(G).length>0){let Q=U.target==="draft-2020-12"?"$defs":"definitions";z.__shared={[Q]:G}}return{schemas:z}}let Y=new JU(X);return Y.process($),Y.emit($,X)}function x4($,X){let Y=X??{seen:new Set};if(Y.seen.has($))return!1;Y.seen.add($);let G=$._zod.def;switch(G.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return x4(G.element,Y);case"object":{for(let z in G.shape)if(x4(G.shape[z],Y))return!0;return!1}case"union":{for(let z of G.options)if(x4(z,Y))return!0;return!1}case"intersection":return x4(G.left,Y)||x4(G.right,Y);case"tuple":{for(let z of G.items)if(x4(z,Y))return!0;if(G.rest&&x4(G.rest,Y))return!0;return!1}case"record":return x4(G.keyType,Y)||x4(G.valueType,Y);case"map":return x4(G.keyType,Y)||x4(G.valueType,Y);case"set":return x4(G.valueType,Y);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return x4(G.innerType,Y);case"lazy":return x4(G.getter(),Y);case"default":return x4(G.innerType,Y);case"prefault":return x4(G.innerType,Y);case"custom":return!1;case"transform":return!0;case"pipe":return x4(G.in,Y)||x4(G.out,Y);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${G.type}`)}var gF={};var qU={};D2(qU,{time:()=>gV,duration:()=>yV,datetime:()=>fV,date:()=>hV,ZodISOTime:()=>KU,ZodISODuration:()=>_U,ZodISODateTime:()=>AU,ZodISODate:()=>LU});var AU=C("ZodISODateTime",($,X)=>{FZ.init($,X),a$.init($,X)});function fV($){return tH(AU,$)}var LU=C("ZodISODate",($,X)=>{MZ.init($,X),a$.init($,X)});function hV($){return aH(LU,$)}var KU=C("ZodISOTime",($,X)=>{JZ.init($,X),a$.init($,X)});function gV($){return sH(KU,$)}var _U=C("ZodISODuration",($,X)=>{AZ.init($,X),a$.init($,X)});function yV($){return eH(_U,$)}var mF=($,X)=>{QY.init($,X),$.name="ZodError",Object.defineProperties($,{format:{value:(Y)=>HY($,Y)},flatten:{value:(Y)=>ZY($,Y)},addIssue:{value:(Y)=>$.issues.push(Y)},addIssues:{value:(Y)=>$.issues.push(...Y)},isEmpty:{get(){return $.issues.length===0}}})},pI=C("ZodError",mF),DX=C("ZodError",mF,{Parent:Error});var mV=b5(DX),uV=h5(DX),cV=y5(DX),pV=m5(DX);var T$=C("ZodType",($,X)=>{return N$.init($,X),$.def=X,Object.defineProperty($,"_def",{value:X}),$.check=(...Y)=>{return $.clone({...X,checks:[...X.checks??[],...Y.map((U)=>typeof U==="function"?{_zod:{check:U,def:{check:"custom"},onattach:[]}}:U)]})},$.clone=(Y,U)=>X1($,Y,U),$.brand=()=>$,$.register=(Y,U)=>{return Y.add($,U),$},$.parse=(Y,U)=>mV($,Y,U,{callee:$.parse}),$.safeParse=(Y,U)=>cV($,Y,U),$.parseAsync=async(Y,U)=>uV($,Y,U,{callee:$.parseAsync}),$.safeParseAsync=async(Y,U)=>pV($,Y,U),$.spa=$.safeParseAsync,$.refine=(Y,U)=>$.check(CM(Y,U)),$.superRefine=(Y)=>$.check(BM(Y)),$.overwrite=(Y)=>$.check(v0(Y)),$.optional=()=>vU($),$.nullable=()=>CU($),$.nullish=()=>vU(CU($)),$.nonoptional=(Y)=>NM($,Y),$.array=()=>OO($),$.or=(Y)=>xU([$,Y]),$.and=(Y)=>XM($,Y),$.transform=(Y)=>BU($,NO(Y)),$.default=(Y)=>wM($,Y),$.prefault=(Y)=>EM($,Y),$.catch=(Y)=>JM($,Y),$.pipe=(Y)=>BU($,Y),$.readonly=()=>KM($),$.describe=(Y)=>{let U=$.clone();return s1.add(U,{description:Y}),U},Object.defineProperty($,"description",{get(){return s1.get($)?.description},configurable:!0}),$.meta=(...Y)=>{if(Y.length===0)return s1.get($);let U=$.clone();return s1.add(U,Y[0]),U},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$}),rV=C("_ZodString",($,X)=>{U8.init($,X),T$.init($,X);let Y=$._zod.bag;$.format=Y.format??null,$.minLength=Y.minimum??null,$.maxLength=Y.maximum??null,$.regex=(...U)=>$.check(AY(...U)),$.includes=(...U)=>$.check(_Y(...U)),$.startsWith=(...U)=>$.check(qY(...U)),$.endsWith=(...U)=>$.check(RY(...U)),$.min=(...U)=>$.check(N2(...U)),$.max=(...U)=>$.check(OX(...U)),$.length=(...U)=>$.check(wX(...U)),$.nonempty=(...U)=>$.check(N2(1,...U)),$.lowercase=(U)=>$.check(LY(U)),$.uppercase=(U)=>$.check(KY(U)),$.trim=()=>$.check(CY()),$.normalize=(...U)=>$.check(vY(...U)),$.toLowerCase=()=>$.check(BY()),$.toUpperCase=()=>$.check(jY())}),xY=C("ZodString",($,X)=>{U8.init($,X),rV.init($,X),$.email=(Y)=>$.check(a5(iV,Y)),$.url=(Y)=>$.check(YU(oV,Y)),$.jwt=(Y)=>$.check(MU(HO,Y)),$.emoji=(Y)=>$.check(GU(nV,Y)),$.guid=(Y)=>$.check(MY(RU,Y)),$.uuid=(Y)=>$.check(s5(B0,Y)),$.uuidv4=(Y)=>$.check(e5(B0,Y)),$.uuidv6=(Y)=>$.check($U(B0,Y)),$.uuidv7=(Y)=>$.check(XU(B0,Y)),$.nanoid=(Y)=>$.check(UU(tV,Y)),$.guid=(Y)=>$.check(MY(RU,Y)),$.cuid=(Y)=>$.check(zU(aV,Y)),$.cuid2=(Y)=>$.check(WU(sV,Y)),$.ulid=(Y)=>$.check(QU(eV,Y)),$.base64=(Y)=>$.check(EU(WO,Y)),$.base64url=(Y)=>$.check(NU(QO,Y)),$.xid=(Y)=>$.check(ZU($O,Y)),$.ksuid=(Y)=>$.check(HU(XO,Y)),$.ipv4=(Y)=>$.check(VU(YO,Y)),$.ipv6=(Y)=>$.check(OU(GO,Y)),$.cidrv4=(Y)=>$.check(wU(UO,Y)),$.cidrv6=(Y)=>$.check(DU(zO,Y)),$.e164=(Y)=>$.check(FU(ZO,Y)),$.datetime=(Y)=>$.check(fV(Y)),$.date=(Y)=>$.check(hV(Y)),$.time=(Y)=>$.check(gV(Y)),$.duration=(Y)=>$.check(yV(Y))});function dV($){return iH(xY,$)}var a$=C("ZodStringFormat",($,X)=>{l$.init($,X),rV.init($,X)}),iV=C("ZodEmail",($,X)=>{QZ.init($,X),a$.init($,X)});function lI($){return a5(iV,$)}var RU=C("ZodGUID",($,X)=>{zZ.init($,X),a$.init($,X)});function rI($){return MY(RU,$)}var B0=C("ZodUUID",($,X)=>{WZ.init($,X),a$.init($,X)});function iI($){return s5(B0,$)}function oI($){return e5(B0,$)}function nI($){return $U(B0,$)}function tI($){return XU(B0,$)}var oV=C("ZodURL",($,X)=>{ZZ.init($,X),a$.init($,X)});function aI($){return YU(oV,$)}var nV=C("ZodEmoji",($,X)=>{HZ.init($,X),a$.init($,X)});function sI($){return GU(nV,$)}var tV=C("ZodNanoID",($,X)=>{VZ.init($,X),a$.init($,X)});function eI($){return UU(tV,$)}var aV=C("ZodCUID",($,X)=>{OZ.init($,X),a$.init($,X)});function $x($){return zU(aV,$)}var sV=C("ZodCUID2",($,X)=>{wZ.init($,X),a$.init($,X)});function Xx($){return WU(sV,$)}var eV=C("ZodULID",($,X)=>{DZ.init($,X),a$.init($,X)});function Yx($){return QU(eV,$)}var $O=C("ZodXID",($,X)=>{EZ.init($,X),a$.init($,X)});function Gx($){return ZU($O,$)}var XO=C("ZodKSUID",($,X)=>{NZ.init($,X),a$.init($,X)});function Ux($){return HU(XO,$)}var YO=C("ZodIPv4",($,X)=>{LZ.init($,X),a$.init($,X)});function zx($){return VU(YO,$)}var GO=C("ZodIPv6",($,X)=>{KZ.init($,X),a$.init($,X)});function Wx($){return OU(GO,$)}var UO=C("ZodCIDRv4",($,X)=>{_Z.init($,X),a$.init($,X)});function Qx($){return wU(UO,$)}var zO=C("ZodCIDRv6",($,X)=>{qZ.init($,X),a$.init($,X)});function Zx($){return DU(zO,$)}var WO=C("ZodBase64",($,X)=>{TZ.init($,X),a$.init($,X)});function Hx($){return EU(WO,$)}var QO=C("ZodBase64URL",($,X)=>{vZ.init($,X),a$.init($,X)});function Vx($){return NU(QO,$)}var ZO=C("ZodE164",($,X)=>{CZ.init($,X),a$.init($,X)});function Ox($){return FU(ZO,$)}var HO=C("ZodJWT",($,X)=>{BZ.init($,X),a$.init($,X)});function wx($){return MU(HO,$)}var uF=C("ZodCustomStringFormat",($,X)=>{jZ.init($,X),a$.init($,X)});function Dx($,X,Y={}){return xV(uF,$,X,Y)}var SY=C("ZodNumber",($,X)=>{i5.init($,X),T$.init($,X),$.gt=(U,G)=>$.check(T0(U,G)),$.gte=(U,G)=>$.check(m6(U,G)),$.min=(U,G)=>$.check(m6(U,G)),$.lt=(U,G)=>$.check(R0(U,G)),$.lte=(U,G)=>$.check(L1(U,G)),$.max=(U,G)=>$.check(L1(U,G)),$.int=(U)=>$.check(lV(U)),$.safe=(U)=>$.check(lV(U)),$.positive=(U)=>$.check(T0(0,U)),$.nonnegative=(U)=>$.check(m6(0,U)),$.negative=(U)=>$.check(R0(0,U)),$.nonpositive=(U)=>$.check(L1(0,U)),$.multipleOf=(U,G)=>$.check(W8(U,G)),$.step=(U,G)=>$.check(W8(U,G)),$.finite=()=>$;let Y=$._zod.bag;$.minValue=Math.max(Y.minimum??Number.NEGATIVE_INFINITY,Y.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(Y.maximum??Number.POSITIVE_INFINITY,Y.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(Y.format??"").includes("int")||Number.isSafeInteger(Y.multipleOf??0.5),$.isFinite=!0,$.format=Y.format??null});function cF($){return $V(SY,$)}var EX=C("ZodNumberFormat",($,X)=>{PZ.init($,X),SY.init($,X)});function lV($){return YV(EX,$)}function Ex($){return GV(EX,$)}function Nx($){return UV(EX,$)}function Fx($){return zV(EX,$)}function Mx($){return WV(EX,$)}var kY=C("ZodBoolean",($,X)=>{VY.init($,X),T$.init($,X)});function pF($){return QV(kY,$)}var bY=C("ZodBigInt",($,X)=>{o5.init($,X),T$.init($,X),$.gte=(U,G)=>$.check(m6(U,G)),$.min=(U,G)=>$.check(m6(U,G)),$.gt=(U,G)=>$.check(T0(U,G)),$.gte=(U,G)=>$.check(m6(U,G)),$.min=(U,G)=>$.check(m6(U,G)),$.lt=(U,G)=>$.check(R0(U,G)),$.lte=(U,G)=>$.check(L1(U,G)),$.max=(U,G)=>$.check(L1(U,G)),$.positive=(U)=>$.check(T0(BigInt(0),U)),$.negative=(U)=>$.check(R0(BigInt(0),U)),$.nonpositive=(U)=>$.check(L1(BigInt(0),U)),$.nonnegative=(U)=>$.check(m6(BigInt(0),U)),$.multipleOf=(U,G)=>$.check(W8(U,G));let Y=$._zod.bag;$.minValue=Y.minimum??null,$.maxValue=Y.maximum??null,$.format=Y.format??null});function Jx($){return HV(bY,$)}var VO=C("ZodBigIntFormat",($,X)=>{IZ.init($,X),bY.init($,X)});function Ax($){return OV(VO,$)}function Lx($){return wV(VO,$)}var dF=C("ZodSymbol",($,X)=>{xZ.init($,X),T$.init($,X)});function Kx($){return DV(dF,$)}var lF=C("ZodUndefined",($,X)=>{SZ.init($,X),T$.init($,X)});function _x($){return EV(lF,$)}var rF=C("ZodNull",($,X)=>{kZ.init($,X),T$.init($,X)});function iF($){return NV(rF,$)}var oF=C("ZodAny",($,X)=>{bZ.init($,X),T$.init($,X)});function qx(){return FV(oF)}var nF=C("ZodUnknown",($,X)=>{ZX.init($,X),T$.init($,X)});function TU(){return HX(nF)}var tF=C("ZodNever",($,X)=>{fZ.init($,X),T$.init($,X)});function jU($){return MV(tF,$)}var aF=C("ZodVoid",($,X)=>{hZ.init($,X),T$.init($,X)});function Rx($){return JV(aF,$)}var PU=C("ZodDate",($,X)=>{gZ.init($,X),T$.init($,X),$.min=(U,G)=>$.check(m6(U,G)),$.max=(U,G)=>$.check(L1(U,G));let Y=$._zod.bag;$.minDate=Y.minimum?new Date(Y.minimum):null,$.maxDate=Y.maximum?new Date(Y.maximum):null});function Tx($){return AV(PU,$)}var sF=C("ZodArray",($,X)=>{OY.init($,X),T$.init($,X),$.element=X.element,$.min=(Y,U)=>$.check(N2(Y,U)),$.nonempty=(Y)=>$.check(N2(1,Y)),$.max=(Y,U)=>$.check(OX(Y,U)),$.length=(Y,U)=>$.check(wX(Y,U)),$.unwrap=()=>$.element});function OO($,X){return PY(sF,$,X)}function vx($){let X=$._zod.def.shape;return ZM(Object.keys(X))}var IU=C("ZodObject",($,X)=>{yZ.init($,X),T$.init($,X),n.defineLazy($,"shape",()=>X.shape),$.keyof=()=>WM(Object.keys($._zod.def.shape)),$.catchall=(Y)=>$.clone({...$._zod.def,catchall:Y}),$.passthrough=()=>$.clone({...$._zod.def,catchall:TU()}),$.loose=()=>$.clone({...$._zod.def,catchall:TU()}),$.strict=()=>$.clone({...$._zod.def,catchall:jU()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(Y)=>{return n.extend($,Y)},$.merge=(Y)=>n.merge($,Y),$.pick=(Y)=>n.pick($,Y),$.omit=(Y)=>n.omit($,Y),$.partial=(...Y)=>n.partial(FO,$,Y[0]),$.required=(...Y)=>n.required(MO,$,Y[0])});function Cx($,X){let Y={type:"object",get shape(){return n.assignProp(this,"shape",{...$}),this.shape},...n.normalizeParams(X)};return new IU(Y)}function Bx($,X){return new IU({type:"object",get shape(){return n.assignProp(this,"shape",{...$}),this.shape},catchall:jU(),...n.normalizeParams(X)})}function jx($,X){return new IU({type:"object",get shape(){return n.assignProp(this,"shape",{...$}),this.shape},catchall:TU(),...n.normalizeParams(X)})}var wO=C("ZodUnion",($,X)=>{n5.init($,X),T$.init($,X),$.options=X.options});function xU($,X){return new wO({type:"union",options:$,...n.normalizeParams(X)})}var eF=C("ZodDiscriminatedUnion",($,X)=>{wO.init($,X),mZ.init($,X)});function Px($,X,Y){return new eF({type:"union",options:X,discriminator:$,...n.normalizeParams(Y)})}var $M=C("ZodIntersection",($,X)=>{uZ.init($,X),T$.init($,X)});function XM($,X){return new $M({type:"intersection",left:$,right:X})}var YM=C("ZodTuple",($,X)=>{z8.init($,X),T$.init($,X),$.rest=(Y)=>$.clone({...$._zod.def,rest:Y})});function Ix($,X,Y){let U=X instanceof N$,G=U?Y:X;return new YM({type:"tuple",items:$,rest:U?X:null,...n.normalizeParams(G)})}var DO=C("ZodRecord",($,X)=>{cZ.init($,X),T$.init($,X),$.keyType=X.keyType,$.valueType=X.valueType});function GM($,X,Y){return new DO({type:"record",keyType:$,valueType:X,...n.normalizeParams(Y)})}function xx($,X,Y){return new DO({type:"record",keyType:xU([$,jU()]),valueType:X,...n.normalizeParams(Y)})}var UM=C("ZodMap",($,X)=>{pZ.init($,X),T$.init($,X),$.keyType=X.keyType,$.valueType=X.valueType});function Sx($,X,Y){return new UM({type:"map",keyType:$,valueType:X,...n.normalizeParams(Y)})}var zM=C("ZodSet",($,X)=>{dZ.init($,X),T$.init($,X),$.min=(...Y)=>$.check(Q8(...Y)),$.nonempty=(Y)=>$.check(Q8(1,Y)),$.max=(...Y)=>$.check(VX(...Y)),$.size=(...Y)=>$.check(JY(...Y))});function kx($,X){return new zM({type:"set",valueType:$,...n.normalizeParams(X)})}var IY=C("ZodEnum",($,X)=>{lZ.init($,X),T$.init($,X),$.enum=X.entries,$.options=Object.values(X.entries);let Y=new Set(Object.keys(X.entries));$.extract=(U,G)=>{let z={};for(let W of U)if(Y.has(W))z[W]=X.entries[W];else throw new Error(`Key ${W} not found in enum`);return new IY({...X,checks:[],...n.normalizeParams(G),entries:z})},$.exclude=(U,G)=>{let z={...X.entries};for(let W of U)if(Y.has(W))delete z[W];else throw new Error(`Key ${W} not found in enum`);return new IY({...X,checks:[],...n.normalizeParams(G),entries:z})}});function WM($,X){let Y=Array.isArray($)?Object.fromEntries($.map((U)=>[U,U])):$;return new IY({type:"enum",entries:Y,...n.normalizeParams(X)})}function bx($,X){return new IY({type:"enum",entries:$,...n.normalizeParams(X)})}var QM=C("ZodLiteral",($,X)=>{rZ.init($,X),T$.init($,X),$.values=new Set(X.values),Object.defineProperty($,"value",{get(){if(X.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function ZM($,X){return new QM({type:"literal",values:Array.isArray($)?$:[$],...n.normalizeParams(X)})}var HM=C("ZodFile",($,X)=>{iZ.init($,X),T$.init($,X),$.min=(Y,U)=>$.check(Q8(Y,U)),$.max=(Y,U)=>$.check(VX(Y,U)),$.mime=(Y,U)=>$.check(TY(Array.isArray(Y)?Y:[Y],U))});function fx($){return BV(HM,$)}var EO=C("ZodTransform",($,X)=>{wY.init($,X),T$.init($,X),$._zod.parse=(Y,U)=>{Y.addIssue=(z)=>{if(typeof z==="string")Y.issues.push(n.issue(z,Y.value,X));else{let W=z;if(W.fatal)W.continue=!1;W.code??(W.code="custom"),W.input??(W.input=Y.value),W.inst??(W.inst=$),W.continue??(W.continue=!0),Y.issues.push(n.issue(W))}};let G=X.transform(Y.value,Y);if(G instanceof Promise)return G.then((z)=>{return Y.value=z,Y});return Y.value=G,Y}});function NO($){return new EO({type:"transform",transform:$})}var FO=C("ZodOptional",($,X)=>{oZ.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType});function vU($){return new FO({type:"optional",innerType:$})}var VM=C("ZodNullable",($,X)=>{nZ.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType});function CU($){return new VM({type:"nullable",innerType:$})}function hx($){return vU(CU($))}var OM=C("ZodDefault",($,X)=>{tZ.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function wM($,X){return new OM({type:"default",innerType:$,get defaultValue(){return typeof X==="function"?X():X}})}var DM=C("ZodPrefault",($,X)=>{aZ.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType});function EM($,X){return new DM({type:"prefault",innerType:$,get defaultValue(){return typeof X==="function"?X():X}})}var MO=C("ZodNonOptional",($,X)=>{sZ.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType});function NM($,X){return new MO({type:"nonoptional",innerType:$,...n.normalizeParams(X)})}var FM=C("ZodSuccess",($,X)=>{eZ.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType});function gx($){return new FM({type:"success",innerType:$})}var MM=C("ZodCatch",($,X)=>{$H.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function JM($,X){return new MM({type:"catch",innerType:$,catchValue:typeof X==="function"?X:()=>X})}var AM=C("ZodNaN",($,X)=>{XH.init($,X),T$.init($,X)});function yx($){return KV(AM,$)}var JO=C("ZodPipe",($,X)=>{DY.init($,X),T$.init($,X),$.in=X.in,$.out=X.out});function BU($,X){return new JO({type:"pipe",in:$,out:X})}var LM=C("ZodReadonly",($,X)=>{YH.init($,X),T$.init($,X)});function KM($){return new LM({type:"readonly",innerType:$})}var _M=C("ZodTemplateLiteral",($,X)=>{GH.init($,X),T$.init($,X)});function mx($,X){return new _M({type:"template_literal",parts:$,...n.normalizeParams(X)})}var qM=C("ZodLazy",($,X)=>{zH.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.getter()});function RM($){return new qM({type:"lazy",getter:$})}var TM=C("ZodPromise",($,X)=>{UH.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType});function ux($){return new TM({type:"promise",innerType:$})}var SU=C("ZodCustom",($,X)=>{WH.init($,X),T$.init($,X)});function vM($){let X=new O4({check:"custom"});return X._zod.check=$,X}function cx($,X){return jV(SU,$??(()=>!0),X)}function CM($,X={}){return PV(SU,$,X)}function BM($){let X=vM((Y)=>{return Y.addIssue=(U)=>{if(typeof U==="string")Y.issues.push(n.issue(U,Y.value,X._zod.def));else{let G=U;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=Y.value),G.inst??(G.inst=X),G.continue??(G.continue=!X._zod.def.abort),Y.issues.push(n.issue(G))}},$(Y.value,Y)});return X}function px($,X={error:`Input not instance of ${$.name}`}){let Y=new SU({type:"custom",check:"custom",fn:(U)=>U instanceof $,abort:!0,...n.normalizeParams(X)});return Y._zod.bag.Class=$,Y}var dx=(...$)=>IV({Pipe:JO,Boolean:kY,String:xY,Transform:EO},...$);function lx($){let X=RM(()=>{return xU([dV($),cF(),pF(),iF(),OO(X),GM(dV(),X)])});return X}function rx($,X){return BU(NO($),X)}var ix={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"};function ox($){v4({customError:$})}function nx(){return v4().customError}var AO={};D2(AO,{string:()=>tx,number:()=>ax,date:()=>$S,boolean:()=>sx,bigint:()=>ex});function tx($){return oH(xY,$)}function ax($){return XV(SY,$)}function sx($){return ZV(kY,$)}function ex($){return VV(bY,$)}function $S($){return LV(PU,$)}v4(EY());function jM($,X){return function Y({schema:U,fallback:G,toJsonSchema:z=kU.toJSONSchema}){let W=z(U);return async function Q(Z,H=3){let V,O=[];while(O.length<H){V=await $(Z,W,G,O);let w=await U["~standard"].validate(V);if("value"in w)return w.value;X?.warn(`safegen failed to generate well-formed data.
|
|
43
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let H of this.seen.entries()){let V=H[1];if($===H[0]){z(H);continue}if(Y.external){let w=Y.external.registry.get(H[0])?.id;if($!==H[0]&&w){z(H);continue}}if(this.metadataRegistry.get(H[0])?.id){z(H);continue}if(V.cycle){z(H);continue}if(V.count>1){if(Y.reused==="ref"){z(H);continue}}}let W=(H,V)=>{let O=this.seen.get(H),w=O.def??O.schema,D={...w};if(O.ref===null)return;let E=O.ref;if(O.ref=null,E){W(E,V);let F=this.seen.get(E).schema;if(F.$ref&&V.target==="draft-7")w.allOf=w.allOf??[],w.allOf.push(F);else Object.assign(w,F),Object.assign(w,D)}if(!O.isParent)this.override({zodSchema:H,jsonSchema:w,path:O.path??[]})};for(let H of[...this.seen.entries()].reverse())W(H[0],{target:this.target});let Q={};if(this.target==="draft-2020-12")Q.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")Q.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);if(Y.external?.uri){let H=Y.external.registry.get($)?.id;if(!H)throw new Error("Schema is missing an `id` property");Q.$id=Y.external.uri(H)}Object.assign(Q,U.def);let Z=Y.external?.defs??{};for(let H of this.seen.entries()){let V=H[1];if(V.def&&V.defId)Z[V.defId]=V.def}if(Y.external);else if(Object.keys(Z).length>0)if(this.target==="draft-2020-12")Q.$defs=Z;else Q.definitions=Z;try{return JSON.parse(JSON.stringify(Q))}catch(H){throw new Error("Error converting schema to JSON.")}}}function bV($,X){if($ instanceof FY){let U=new JU(X),G={};for(let Q of $._idmap.entries()){let[Z,H]=Q;U.process(H)}let z={},W={registry:$,uri:X?.uri,defs:G};for(let Q of $._idmap.entries()){let[Z,H]=Q;z[Z]=U.emit(H,{...X,external:W})}if(Object.keys(G).length>0){let Q=U.target==="draft-2020-12"?"$defs":"definitions";z.__shared={[Q]:G}}return{schemas:z}}let Y=new JU(X);return Y.process($),Y.emit($,X)}function x4($,X){let Y=X??{seen:new Set};if(Y.seen.has($))return!1;Y.seen.add($);let G=$._zod.def;switch(G.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return x4(G.element,Y);case"object":{for(let z in G.shape)if(x4(G.shape[z],Y))return!0;return!1}case"union":{for(let z of G.options)if(x4(z,Y))return!0;return!1}case"intersection":return x4(G.left,Y)||x4(G.right,Y);case"tuple":{for(let z of G.items)if(x4(z,Y))return!0;if(G.rest&&x4(G.rest,Y))return!0;return!1}case"record":return x4(G.keyType,Y)||x4(G.valueType,Y);case"map":return x4(G.keyType,Y)||x4(G.valueType,Y);case"set":return x4(G.valueType,Y);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return x4(G.innerType,Y);case"lazy":return x4(G.getter(),Y);case"default":return x4(G.innerType,Y);case"prefault":return x4(G.innerType,Y);case"custom":return!1;case"transform":return!0;case"pipe":return x4(G.in,Y)||x4(G.out,Y);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${G.type}`)}var gF={};var qU={};D2(qU,{time:()=>gV,duration:()=>yV,datetime:()=>fV,date:()=>hV,ZodISOTime:()=>KU,ZodISODuration:()=>_U,ZodISODateTime:()=>AU,ZodISODate:()=>LU});var AU=C("ZodISODateTime",($,X)=>{FZ.init($,X),a$.init($,X)});function fV($){return tH(AU,$)}var LU=C("ZodISODate",($,X)=>{MZ.init($,X),a$.init($,X)});function hV($){return aH(LU,$)}var KU=C("ZodISOTime",($,X)=>{JZ.init($,X),a$.init($,X)});function gV($){return sH(KU,$)}var _U=C("ZodISODuration",($,X)=>{AZ.init($,X),a$.init($,X)});function yV($){return eH(_U,$)}var mF=($,X)=>{QY.init($,X),$.name="ZodError",Object.defineProperties($,{format:{value:(Y)=>HY($,Y)},flatten:{value:(Y)=>ZY($,Y)},addIssue:{value:(Y)=>$.issues.push(Y)},addIssues:{value:(Y)=>$.issues.push(...Y)},isEmpty:{get(){return $.issues.length===0}}})},pI=C("ZodError",mF),DX=C("ZodError",mF,{Parent:Error});var mV=b5(DX),uV=h5(DX),cV=y5(DX),pV=m5(DX);var T$=C("ZodType",($,X)=>{return N$.init($,X),$.def=X,Object.defineProperty($,"_def",{value:X}),$.check=(...Y)=>{return $.clone({...X,checks:[...X.checks??[],...Y.map((U)=>typeof U==="function"?{_zod:{check:U,def:{check:"custom"},onattach:[]}}:U)]})},$.clone=(Y,U)=>Y1($,Y,U),$.brand=()=>$,$.register=(Y,U)=>{return Y.add($,U),$},$.parse=(Y,U)=>mV($,Y,U,{callee:$.parse}),$.safeParse=(Y,U)=>cV($,Y,U),$.parseAsync=async(Y,U)=>uV($,Y,U,{callee:$.parseAsync}),$.safeParseAsync=async(Y,U)=>pV($,Y,U),$.spa=$.safeParseAsync,$.refine=(Y,U)=>$.check(CM(Y,U)),$.superRefine=(Y)=>$.check(BM(Y)),$.overwrite=(Y)=>$.check(v0(Y)),$.optional=()=>vU($),$.nullable=()=>CU($),$.nullish=()=>vU(CU($)),$.nonoptional=(Y)=>NM($,Y),$.array=()=>OO($),$.or=(Y)=>xU([$,Y]),$.and=(Y)=>XM($,Y),$.transform=(Y)=>BU($,NO(Y)),$.default=(Y)=>wM($,Y),$.prefault=(Y)=>EM($,Y),$.catch=(Y)=>JM($,Y),$.pipe=(Y)=>BU($,Y),$.readonly=()=>KM($),$.describe=(Y)=>{let U=$.clone();return e1.add(U,{description:Y}),U},Object.defineProperty($,"description",{get(){return e1.get($)?.description},configurable:!0}),$.meta=(...Y)=>{if(Y.length===0)return e1.get($);let U=$.clone();return e1.add(U,Y[0]),U},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$}),rV=C("_ZodString",($,X)=>{U8.init($,X),T$.init($,X);let Y=$._zod.bag;$.format=Y.format??null,$.minLength=Y.minimum??null,$.maxLength=Y.maximum??null,$.regex=(...U)=>$.check(AY(...U)),$.includes=(...U)=>$.check(_Y(...U)),$.startsWith=(...U)=>$.check(qY(...U)),$.endsWith=(...U)=>$.check(RY(...U)),$.min=(...U)=>$.check(N2(...U)),$.max=(...U)=>$.check(OX(...U)),$.length=(...U)=>$.check(wX(...U)),$.nonempty=(...U)=>$.check(N2(1,...U)),$.lowercase=(U)=>$.check(LY(U)),$.uppercase=(U)=>$.check(KY(U)),$.trim=()=>$.check(CY()),$.normalize=(...U)=>$.check(vY(...U)),$.toLowerCase=()=>$.check(BY()),$.toUpperCase=()=>$.check(jY())}),xY=C("ZodString",($,X)=>{U8.init($,X),rV.init($,X),$.email=(Y)=>$.check(a5(iV,Y)),$.url=(Y)=>$.check(YU(oV,Y)),$.jwt=(Y)=>$.check(MU(HO,Y)),$.emoji=(Y)=>$.check(GU(nV,Y)),$.guid=(Y)=>$.check(MY(RU,Y)),$.uuid=(Y)=>$.check(s5(B0,Y)),$.uuidv4=(Y)=>$.check(e5(B0,Y)),$.uuidv6=(Y)=>$.check($U(B0,Y)),$.uuidv7=(Y)=>$.check(XU(B0,Y)),$.nanoid=(Y)=>$.check(UU(tV,Y)),$.guid=(Y)=>$.check(MY(RU,Y)),$.cuid=(Y)=>$.check(zU(aV,Y)),$.cuid2=(Y)=>$.check(WU(sV,Y)),$.ulid=(Y)=>$.check(QU(eV,Y)),$.base64=(Y)=>$.check(EU(WO,Y)),$.base64url=(Y)=>$.check(NU(QO,Y)),$.xid=(Y)=>$.check(ZU($O,Y)),$.ksuid=(Y)=>$.check(HU(XO,Y)),$.ipv4=(Y)=>$.check(VU(YO,Y)),$.ipv6=(Y)=>$.check(OU(GO,Y)),$.cidrv4=(Y)=>$.check(wU(UO,Y)),$.cidrv6=(Y)=>$.check(DU(zO,Y)),$.e164=(Y)=>$.check(FU(ZO,Y)),$.datetime=(Y)=>$.check(fV(Y)),$.date=(Y)=>$.check(hV(Y)),$.time=(Y)=>$.check(gV(Y)),$.duration=(Y)=>$.check(yV(Y))});function dV($){return iH(xY,$)}var a$=C("ZodStringFormat",($,X)=>{l$.init($,X),rV.init($,X)}),iV=C("ZodEmail",($,X)=>{QZ.init($,X),a$.init($,X)});function lI($){return a5(iV,$)}var RU=C("ZodGUID",($,X)=>{zZ.init($,X),a$.init($,X)});function rI($){return MY(RU,$)}var B0=C("ZodUUID",($,X)=>{WZ.init($,X),a$.init($,X)});function iI($){return s5(B0,$)}function oI($){return e5(B0,$)}function nI($){return $U(B0,$)}function tI($){return XU(B0,$)}var oV=C("ZodURL",($,X)=>{ZZ.init($,X),a$.init($,X)});function aI($){return YU(oV,$)}var nV=C("ZodEmoji",($,X)=>{HZ.init($,X),a$.init($,X)});function sI($){return GU(nV,$)}var tV=C("ZodNanoID",($,X)=>{VZ.init($,X),a$.init($,X)});function eI($){return UU(tV,$)}var aV=C("ZodCUID",($,X)=>{OZ.init($,X),a$.init($,X)});function $x($){return zU(aV,$)}var sV=C("ZodCUID2",($,X)=>{wZ.init($,X),a$.init($,X)});function Xx($){return WU(sV,$)}var eV=C("ZodULID",($,X)=>{DZ.init($,X),a$.init($,X)});function Yx($){return QU(eV,$)}var $O=C("ZodXID",($,X)=>{EZ.init($,X),a$.init($,X)});function Gx($){return ZU($O,$)}var XO=C("ZodKSUID",($,X)=>{NZ.init($,X),a$.init($,X)});function Ux($){return HU(XO,$)}var YO=C("ZodIPv4",($,X)=>{LZ.init($,X),a$.init($,X)});function zx($){return VU(YO,$)}var GO=C("ZodIPv6",($,X)=>{KZ.init($,X),a$.init($,X)});function Wx($){return OU(GO,$)}var UO=C("ZodCIDRv4",($,X)=>{_Z.init($,X),a$.init($,X)});function Qx($){return wU(UO,$)}var zO=C("ZodCIDRv6",($,X)=>{qZ.init($,X),a$.init($,X)});function Zx($){return DU(zO,$)}var WO=C("ZodBase64",($,X)=>{TZ.init($,X),a$.init($,X)});function Hx($){return EU(WO,$)}var QO=C("ZodBase64URL",($,X)=>{vZ.init($,X),a$.init($,X)});function Vx($){return NU(QO,$)}var ZO=C("ZodE164",($,X)=>{CZ.init($,X),a$.init($,X)});function Ox($){return FU(ZO,$)}var HO=C("ZodJWT",($,X)=>{BZ.init($,X),a$.init($,X)});function wx($){return MU(HO,$)}var uF=C("ZodCustomStringFormat",($,X)=>{jZ.init($,X),a$.init($,X)});function Dx($,X,Y={}){return xV(uF,$,X,Y)}var SY=C("ZodNumber",($,X)=>{i5.init($,X),T$.init($,X),$.gt=(U,G)=>$.check(T0(U,G)),$.gte=(U,G)=>$.check(u6(U,G)),$.min=(U,G)=>$.check(u6(U,G)),$.lt=(U,G)=>$.check(R0(U,G)),$.lte=(U,G)=>$.check(K1(U,G)),$.max=(U,G)=>$.check(K1(U,G)),$.int=(U)=>$.check(lV(U)),$.safe=(U)=>$.check(lV(U)),$.positive=(U)=>$.check(T0(0,U)),$.nonnegative=(U)=>$.check(u6(0,U)),$.negative=(U)=>$.check(R0(0,U)),$.nonpositive=(U)=>$.check(K1(0,U)),$.multipleOf=(U,G)=>$.check(W8(U,G)),$.step=(U,G)=>$.check(W8(U,G)),$.finite=()=>$;let Y=$._zod.bag;$.minValue=Math.max(Y.minimum??Number.NEGATIVE_INFINITY,Y.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(Y.maximum??Number.POSITIVE_INFINITY,Y.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(Y.format??"").includes("int")||Number.isSafeInteger(Y.multipleOf??0.5),$.isFinite=!0,$.format=Y.format??null});function cF($){return $V(SY,$)}var EX=C("ZodNumberFormat",($,X)=>{PZ.init($,X),SY.init($,X)});function lV($){return YV(EX,$)}function Ex($){return GV(EX,$)}function Nx($){return UV(EX,$)}function Fx($){return zV(EX,$)}function Mx($){return WV(EX,$)}var kY=C("ZodBoolean",($,X)=>{VY.init($,X),T$.init($,X)});function pF($){return QV(kY,$)}var bY=C("ZodBigInt",($,X)=>{o5.init($,X),T$.init($,X),$.gte=(U,G)=>$.check(u6(U,G)),$.min=(U,G)=>$.check(u6(U,G)),$.gt=(U,G)=>$.check(T0(U,G)),$.gte=(U,G)=>$.check(u6(U,G)),$.min=(U,G)=>$.check(u6(U,G)),$.lt=(U,G)=>$.check(R0(U,G)),$.lte=(U,G)=>$.check(K1(U,G)),$.max=(U,G)=>$.check(K1(U,G)),$.positive=(U)=>$.check(T0(BigInt(0),U)),$.negative=(U)=>$.check(R0(BigInt(0),U)),$.nonpositive=(U)=>$.check(K1(BigInt(0),U)),$.nonnegative=(U)=>$.check(u6(BigInt(0),U)),$.multipleOf=(U,G)=>$.check(W8(U,G));let Y=$._zod.bag;$.minValue=Y.minimum??null,$.maxValue=Y.maximum??null,$.format=Y.format??null});function Jx($){return HV(bY,$)}var VO=C("ZodBigIntFormat",($,X)=>{IZ.init($,X),bY.init($,X)});function Ax($){return OV(VO,$)}function Lx($){return wV(VO,$)}var dF=C("ZodSymbol",($,X)=>{xZ.init($,X),T$.init($,X)});function Kx($){return DV(dF,$)}var lF=C("ZodUndefined",($,X)=>{SZ.init($,X),T$.init($,X)});function _x($){return EV(lF,$)}var rF=C("ZodNull",($,X)=>{kZ.init($,X),T$.init($,X)});function iF($){return NV(rF,$)}var oF=C("ZodAny",($,X)=>{bZ.init($,X),T$.init($,X)});function qx(){return FV(oF)}var nF=C("ZodUnknown",($,X)=>{ZX.init($,X),T$.init($,X)});function TU(){return HX(nF)}var tF=C("ZodNever",($,X)=>{fZ.init($,X),T$.init($,X)});function jU($){return MV(tF,$)}var aF=C("ZodVoid",($,X)=>{hZ.init($,X),T$.init($,X)});function Rx($){return JV(aF,$)}var PU=C("ZodDate",($,X)=>{gZ.init($,X),T$.init($,X),$.min=(U,G)=>$.check(u6(U,G)),$.max=(U,G)=>$.check(K1(U,G));let Y=$._zod.bag;$.minDate=Y.minimum?new Date(Y.minimum):null,$.maxDate=Y.maximum?new Date(Y.maximum):null});function Tx($){return AV(PU,$)}var sF=C("ZodArray",($,X)=>{OY.init($,X),T$.init($,X),$.element=X.element,$.min=(Y,U)=>$.check(N2(Y,U)),$.nonempty=(Y)=>$.check(N2(1,Y)),$.max=(Y,U)=>$.check(OX(Y,U)),$.length=(Y,U)=>$.check(wX(Y,U)),$.unwrap=()=>$.element});function OO($,X){return PY(sF,$,X)}function vx($){let X=$._zod.def.shape;return ZM(Object.keys(X))}var IU=C("ZodObject",($,X)=>{yZ.init($,X),T$.init($,X),n.defineLazy($,"shape",()=>X.shape),$.keyof=()=>WM(Object.keys($._zod.def.shape)),$.catchall=(Y)=>$.clone({...$._zod.def,catchall:Y}),$.passthrough=()=>$.clone({...$._zod.def,catchall:TU()}),$.loose=()=>$.clone({...$._zod.def,catchall:TU()}),$.strict=()=>$.clone({...$._zod.def,catchall:jU()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(Y)=>{return n.extend($,Y)},$.merge=(Y)=>n.merge($,Y),$.pick=(Y)=>n.pick($,Y),$.omit=(Y)=>n.omit($,Y),$.partial=(...Y)=>n.partial(FO,$,Y[0]),$.required=(...Y)=>n.required(MO,$,Y[0])});function Cx($,X){let Y={type:"object",get shape(){return n.assignProp(this,"shape",{...$}),this.shape},...n.normalizeParams(X)};return new IU(Y)}function Bx($,X){return new IU({type:"object",get shape(){return n.assignProp(this,"shape",{...$}),this.shape},catchall:jU(),...n.normalizeParams(X)})}function jx($,X){return new IU({type:"object",get shape(){return n.assignProp(this,"shape",{...$}),this.shape},catchall:TU(),...n.normalizeParams(X)})}var wO=C("ZodUnion",($,X)=>{n5.init($,X),T$.init($,X),$.options=X.options});function xU($,X){return new wO({type:"union",options:$,...n.normalizeParams(X)})}var eF=C("ZodDiscriminatedUnion",($,X)=>{wO.init($,X),mZ.init($,X)});function Px($,X,Y){return new eF({type:"union",options:X,discriminator:$,...n.normalizeParams(Y)})}var $M=C("ZodIntersection",($,X)=>{uZ.init($,X),T$.init($,X)});function XM($,X){return new $M({type:"intersection",left:$,right:X})}var YM=C("ZodTuple",($,X)=>{z8.init($,X),T$.init($,X),$.rest=(Y)=>$.clone({...$._zod.def,rest:Y})});function Ix($,X,Y){let U=X instanceof N$,G=U?Y:X;return new YM({type:"tuple",items:$,rest:U?X:null,...n.normalizeParams(G)})}var DO=C("ZodRecord",($,X)=>{cZ.init($,X),T$.init($,X),$.keyType=X.keyType,$.valueType=X.valueType});function GM($,X,Y){return new DO({type:"record",keyType:$,valueType:X,...n.normalizeParams(Y)})}function xx($,X,Y){return new DO({type:"record",keyType:xU([$,jU()]),valueType:X,...n.normalizeParams(Y)})}var UM=C("ZodMap",($,X)=>{pZ.init($,X),T$.init($,X),$.keyType=X.keyType,$.valueType=X.valueType});function Sx($,X,Y){return new UM({type:"map",keyType:$,valueType:X,...n.normalizeParams(Y)})}var zM=C("ZodSet",($,X)=>{dZ.init($,X),T$.init($,X),$.min=(...Y)=>$.check(Q8(...Y)),$.nonempty=(Y)=>$.check(Q8(1,Y)),$.max=(...Y)=>$.check(VX(...Y)),$.size=(...Y)=>$.check(JY(...Y))});function kx($,X){return new zM({type:"set",valueType:$,...n.normalizeParams(X)})}var IY=C("ZodEnum",($,X)=>{lZ.init($,X),T$.init($,X),$.enum=X.entries,$.options=Object.values(X.entries);let Y=new Set(Object.keys(X.entries));$.extract=(U,G)=>{let z={};for(let W of U)if(Y.has(W))z[W]=X.entries[W];else throw new Error(`Key ${W} not found in enum`);return new IY({...X,checks:[],...n.normalizeParams(G),entries:z})},$.exclude=(U,G)=>{let z={...X.entries};for(let W of U)if(Y.has(W))delete z[W];else throw new Error(`Key ${W} not found in enum`);return new IY({...X,checks:[],...n.normalizeParams(G),entries:z})}});function WM($,X){let Y=Array.isArray($)?Object.fromEntries($.map((U)=>[U,U])):$;return new IY({type:"enum",entries:Y,...n.normalizeParams(X)})}function bx($,X){return new IY({type:"enum",entries:$,...n.normalizeParams(X)})}var QM=C("ZodLiteral",($,X)=>{rZ.init($,X),T$.init($,X),$.values=new Set(X.values),Object.defineProperty($,"value",{get(){if(X.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function ZM($,X){return new QM({type:"literal",values:Array.isArray($)?$:[$],...n.normalizeParams(X)})}var HM=C("ZodFile",($,X)=>{iZ.init($,X),T$.init($,X),$.min=(Y,U)=>$.check(Q8(Y,U)),$.max=(Y,U)=>$.check(VX(Y,U)),$.mime=(Y,U)=>$.check(TY(Array.isArray(Y)?Y:[Y],U))});function fx($){return BV(HM,$)}var EO=C("ZodTransform",($,X)=>{wY.init($,X),T$.init($,X),$._zod.parse=(Y,U)=>{Y.addIssue=(z)=>{if(typeof z==="string")Y.issues.push(n.issue(z,Y.value,X));else{let W=z;if(W.fatal)W.continue=!1;W.code??(W.code="custom"),W.input??(W.input=Y.value),W.inst??(W.inst=$),W.continue??(W.continue=!0),Y.issues.push(n.issue(W))}};let G=X.transform(Y.value,Y);if(G instanceof Promise)return G.then((z)=>{return Y.value=z,Y});return Y.value=G,Y}});function NO($){return new EO({type:"transform",transform:$})}var FO=C("ZodOptional",($,X)=>{oZ.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType});function vU($){return new FO({type:"optional",innerType:$})}var VM=C("ZodNullable",($,X)=>{nZ.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType});function CU($){return new VM({type:"nullable",innerType:$})}function hx($){return vU(CU($))}var OM=C("ZodDefault",($,X)=>{tZ.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function wM($,X){return new OM({type:"default",innerType:$,get defaultValue(){return typeof X==="function"?X():X}})}var DM=C("ZodPrefault",($,X)=>{aZ.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType});function EM($,X){return new DM({type:"prefault",innerType:$,get defaultValue(){return typeof X==="function"?X():X}})}var MO=C("ZodNonOptional",($,X)=>{sZ.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType});function NM($,X){return new MO({type:"nonoptional",innerType:$,...n.normalizeParams(X)})}var FM=C("ZodSuccess",($,X)=>{eZ.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType});function gx($){return new FM({type:"success",innerType:$})}var MM=C("ZodCatch",($,X)=>{$H.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function JM($,X){return new MM({type:"catch",innerType:$,catchValue:typeof X==="function"?X:()=>X})}var AM=C("ZodNaN",($,X)=>{XH.init($,X),T$.init($,X)});function yx($){return KV(AM,$)}var JO=C("ZodPipe",($,X)=>{DY.init($,X),T$.init($,X),$.in=X.in,$.out=X.out});function BU($,X){return new JO({type:"pipe",in:$,out:X})}var LM=C("ZodReadonly",($,X)=>{YH.init($,X),T$.init($,X)});function KM($){return new LM({type:"readonly",innerType:$})}var _M=C("ZodTemplateLiteral",($,X)=>{GH.init($,X),T$.init($,X)});function mx($,X){return new _M({type:"template_literal",parts:$,...n.normalizeParams(X)})}var qM=C("ZodLazy",($,X)=>{zH.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.getter()});function RM($){return new qM({type:"lazy",getter:$})}var TM=C("ZodPromise",($,X)=>{UH.init($,X),T$.init($,X),$.unwrap=()=>$._zod.def.innerType});function ux($){return new TM({type:"promise",innerType:$})}var SU=C("ZodCustom",($,X)=>{WH.init($,X),T$.init($,X)});function vM($){let X=new O4({check:"custom"});return X._zod.check=$,X}function cx($,X){return jV(SU,$??(()=>!0),X)}function CM($,X={}){return PV(SU,$,X)}function BM($){let X=vM((Y)=>{return Y.addIssue=(U)=>{if(typeof U==="string")Y.issues.push(n.issue(U,Y.value,X._zod.def));else{let G=U;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=Y.value),G.inst??(G.inst=X),G.continue??(G.continue=!X._zod.def.abort),Y.issues.push(n.issue(G))}},$(Y.value,Y)});return X}function px($,X={error:`Input not instance of ${$.name}`}){let Y=new SU({type:"custom",check:"custom",fn:(U)=>U instanceof $,abort:!0,...n.normalizeParams(X)});return Y._zod.bag.Class=$,Y}var dx=(...$)=>IV({Pipe:JO,Boolean:kY,String:xY,Transform:EO},...$);function lx($){let X=RM(()=>{return xU([dV($),cF(),pF(),iF(),OO(X),GM(dV(),X)])});return X}function rx($,X){return BU(NO($),X)}var ix={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"};function ox($){v4({customError:$})}function nx(){return v4().customError}var AO={};D2(AO,{string:()=>tx,number:()=>ax,date:()=>$S,boolean:()=>sx,bigint:()=>ex});function tx($){return oH(xY,$)}function ax($){return XV(SY,$)}function sx($){return ZV(kY,$)}function ex($){return VV(bY,$)}function $S($){return LV(PU,$)}v4(EY());function jM($,X){return function Y({schema:U,fallback:G,toJsonSchema:z=kU.toJSONSchema}){let W=z(U);return async function Q(Z,H=3){let V,O=[];while(O.length<H){V=await $(Z,W,G,O);let w=await U["~standard"].validate(V);if("value"in w)return w.value;X?.warn(`safegen failed to generate well-formed data.
|
|
44
44
|
`,`Here's what was returned last time:
|
|
45
45
|
`,JSON.stringify(V,null,"\t"),`
|
|
46
46
|
`,`Here are the issues returned from our validation:
|
|
@@ -69,20 +69,20 @@ RESPONSE:
|
|
|
69
69
|
`;let V=await G(`${$}
|
|
70
70
|
|
|
71
71
|
${Z}`,`choose-${$}-FROM-${X.join("-")}`,H);if(W){if(X.includes(V))return V;let E=V.toLowerCase();if(X.includes(E))return E;let F=Number(V);if(X.includes(F))return F;return new Error(bU($,V,`"${V}" is not found among [${X.join(", ")}]`))}if(V.toLowerCase()==="$none")return[];let w=V.split(`
|
|
72
|
-
`).filter((E)=>E.match(/^\d+\. /)),D=[];for(let E of w){let F=E.trim().split(". ")[1];if(X.includes(F))D.push(F);else if(X.includes(F.toLowerCase()))D.push(F.toLowerCase());else if(X.includes(Number(F)))D.push(Number(F));else if(F==="$none");else bU($,F,`"${F}" is not found among [${X.join(", ")}]`,"This element will not be included in the final result.")}if(D.length<Y)return new Error(`For prompt "${$}", at least ${Y} options must be chosen, but ${D.length} options were chosen.`);if(D.length>U)return z.warn(`For prompt "${$}", at most ${U} options must be chosen, but ${D.length} options were chosen.`),D.slice(0,U);return D}var cM=PN(fM(),1);import*as
|
|
72
|
+
`).filter((E)=>E.match(/^\d+\. /)),D=[];for(let E of w){let F=E.trim().split(". ")[1];if(X.includes(F))D.push(F);else if(X.includes(F.toLowerCase()))D.push(F.toLowerCase());else if(X.includes(Number(F)))D.push(Number(F));else if(F==="$none");else bU($,F,`"${F}" is not found among [${X.join(", ")}]`,"This element will not be included in the final result.")}if(D.length<Y)return new Error(`For prompt "${$}", at least ${Y} options must be chosen, but ${D.length} options were chosen.`);if(D.length>U)return z.warn(`For prompt "${$}", at most ${U} options must be chosen, but ${D.length} options were chosen.`),D.slice(0,U);return D}var cM=PN(fM(),1);import*as c6 from"fs";import*as NX from"path";import{resolve as WS}from"path";import{createHash as QS}from"crypto";import{copyFile as ZS}from"fs/promises";import{existsSync as LO,mkdirSync as hM,readFileSync as US,readdirSync as gM,rmSync as yM,statSync as mM,writeFileSync as zS}from"fs";import{resolve as KO}from"path";var uM=class{rootDir;get initialized(){return LO(this.rootDir)}initialize(){if(!this.initialized)hM(this.rootDir,{recursive:!0})}constructor($){if(this.rootDir=$.path,$.eagerInit)this.initialize()}getItem($){let X=KO(this.rootDir,$);if(LO(X))return US(X,"utf-8");return null}setItem($,X){this.initialize();let Y=KO(this.rootDir,$);zS(Y,X)}removeItem($){let X=KO(this.rootDir,$);if(LO(X))this.initialize(),yM(X)}key($){return gM(this.rootDir).sort((U,G)=>{let z=mM(U);return mM(G).ctimeMs-z.ctimeMs})[$]??null}clear(){yM(this.rootDir,{recursive:!0}),hM(this.rootDir,{recursive:!0})}get length(){return gM(this.rootDir).length}};var pM=/[^a-zA-Z0-9\-._]/g;function yY($,X=64){if(X%2===1)X+=1;let Y=$.replace(pM,"-");if(Y.length<=X)return Y;let U=QS("sha256").update($).digest("base64").slice(0,8).replaceAll("/","_"),G=Y;if(G.length>X){let z=G.slice(0,X/2),W=G.slice(-X/2);G=z+"_"+W}return G+"+"+U}var HS=cM.default("varmint"),gY=yY(process.cwd(),150),_O=WS(HS,gY),S4="_-$-_-$-_",dM=`file${S4}`,lM=`list${S4}`,rM=`root${S4}`,VS=`unmatched${S4}`,s$={storage:new uM({path:_O,eagerInit:!1}),startGlobalTracking(){if(console.log(`\uD83D\uDC3F\uFE0F Starting global tracking of varmint files using project identifier "${gY}"`),s$.storage.initialized)console.error(`\uD83D\uDCA5 The global cache for the project "${gY}" was found already initialized. Clearing it and starting fresh.`),s$.storage.clear();s$.storage.initialize()},async prepareUploads($){console.log(`\uD83D\uDC3F\uFE0F Moving unmatched inputs to /tmp/varmint-uploads using project identifier "${gY}"`);let X=[];for(let Y of c6.readdirSync(s$.storage.rootDir))if(fU(`unmatched${S4}`,Y))X.push(Y);if(X.length===0){console.log("\uD83D\uDC3F\uFE0F ","No unmatched input files found.");return}if(console.log("\uD83D\uDC3F\uFE0F ","Found the following unmatched files:",`
|
|
73
73
|
- ${X.join(`
|
|
74
74
|
`)}
|
|
75
75
|
`,`in root folder:
|
|
76
|
-
`,_O),process.env[$])u6.mkdirSync("/tmp/varmint-uploads",{recursive:!0}),await Promise.all(X.map(async(Y)=>{let U=NX.join(_O,Y),G=NX.join("/tmp/varmint-uploads",Y);await ZS(U,G)}));else console.warn("\uD83D\uDCA5 Skipping artifact upload because process.env.CI is not set.")},endGlobalTrackingAndFlushUnusedFiles(){if(console.log(`\uD83D\uDC3F\uFE0F Ending global tracking of varmint files using project identifier "${gY}" and starting cleanup of untouched files.`),!s$.storage.initialized){console.error("\uD83D\uDCA5 called flushGlobal, but the global cache wasn't initialized with startGlobalTracking");return}let $=u6.readdirSync(s$.storage.rootDir),X=new Map,Y=[],U=[],G=[];for(let W of $)if(fU(`root${S4}`,W))Y.push(W);else if(fU(`list${S4}`,W))U.push(W);else if(fU(`file${S4}`,W))G.push(W);if(s$.storage.getItem("DID_CACHE_MISS"))console.log("\uD83D\uDC3F\uFE0F ","Cache miss detected. Since this likely prevented the cache from being fully utilized, we will not attempt to flush unused files.");else{let W=new Map;for(let Q of Y){let Z=Q.replace(rM,"");W.set(Z,new Map);let H=s$.storage.getItem(Q);if(H)X.set(Z,H);else console.error(`\uD83D\uDCA5 Could not find folder ${H} referenced in the global cache`)}for(let Q of U){let Z=Q.replace(lM,""),[H,V]=Z.split(S4),O=W.get(H);if(O)O.set(V,new Set);else console.error(`\uD83D\uDCA5 Could not find root ${H} for list ${V}`)}for(let Q of G){let Z=Q.replace(dM,""),[H,V,O]=Z.split(S4),w=W.get(H);if(w){let D=w.get(V);if(D)D.add(O);else console.error(`\uD83D\uDCA5 Could not find list ${V} for file ${Z}`)}else console.error(`\uD83D\uDCA5 Could not find root ${H} for file ${Z}`)}console.log("\uD83D\uDC3F\uFE0F ",W);for(let[Q,Z]of W.entries()){let H=X.get(Q);if(!H){console.error(`\uD83D\uDCA5 Could not find root ${Q}`);continue}if(!u6.existsSync(H)){console.warn(`\uD83D\uDCA5 Root folder ${H}, identified as being used during tracking, no longer exists during cleanup.`);continue}let O=u6.readdirSync(H);for(let w of O)if(w!==".ferret"&&!Z.has(w)){let D=NX.join(H,w);console.log(`\uD83E\uDDF9 globalFlush: removing directory ${D}`),u6.rmSync(D,{recursive:!0})}for(let[w,D]of Z.entries()){let E=NX.join(H,w);if(!u6.existsSync(E)){console.warn(`\uD83D\uDCA5 List folder ${E}, identified as being used during tracking, no longer exists.`);continue}let J=u6.readdirSync(E);for(let A of J){let L=A.replace(".input.json","").replace(".output.json","").replace(".stream.txt","");if(!D.has(L)){let T=NX.join(E,A);console.log(`\uD83E\uDDF9 globalFlush: removing file ${T}`),u6.rmSync(T)}}}}}u6.rmSync(s$.storage.rootDir,{recursive:!0})}};function fU($,X){return X.startsWith($)}import*as z4 from"fs";import*as h1 from"path";import{inspect as dU}from"util";var j0=new Uint32Array(65536),OS=($,X)=>{let Y=$.length,U=X.length,G=1<<Y-1,z=-1,W=0,Q=Y,Z=Y;while(Z--)j0[$.charCodeAt(Z)]|=1<<Z;for(Z=0;Z<U;Z++){let H=j0[X.charCodeAt(Z)],V=H|W;if(H|=(H&z)+z^z,W|=~(H|z),z&=H,W&G)Q++;if(z&G)Q--;W=W<<1|1,z=z<<1|~(V|W),W&=V}Z=Y;while(Z--)j0[$.charCodeAt(Z)]=0;return Q},wS=($,X)=>{let Y=X.length,U=$.length,G=[],z=[],W=Math.ceil(Y/32),Q=Math.ceil(U/32);for(let E=0;E<W;E++)z[E]=-1,G[E]=0;let Z=0;for(;Z<Q-1;Z++){let E=0,F=-1,J=Z*32,A=Math.min(32,U)+J;for(let L=J;L<A;L++)j0[$.charCodeAt(L)]|=1<<L;for(let L=0;L<Y;L++){let T=j0[X.charCodeAt(L)],q=z[L/32|0]>>>L&1,v=G[L/32|0]>>>L&1,I=T|E,S=((T|v)&F)+F^F|T|v,y=E|~(S|F),r=F&S;if(y>>>31^q)z[L/32|0]^=1<<L;if(r>>>31^v)G[L/32|0]^=1<<L;y=y<<1|q,r=r<<1|v,F=r|~(I|y),E=y&I}for(let L=J;L<A;L++)j0[$.charCodeAt(L)]=0}let H=0,V=-1,O=Z*32,w=Math.min(32,U-O)+O;for(let E=O;E<w;E++)j0[$.charCodeAt(E)]|=1<<E;let D=U;for(let E=0;E<Y;E++){let F=j0[X.charCodeAt(E)],J=z[E/32|0]>>>E&1,A=G[E/32|0]>>>E&1,L=F|H,T=((F|A)&V)+V^V|F|A,q=H|~(T|V),v=V&T;if(D+=q>>>U-1&1,D-=v>>>U-1&1,q>>>31^J)z[E/32|0]^=1<<E;if(v>>>31^A)G[E/32|0]^=1<<E;q=q<<1|J,v=v<<1|A,V=v|~(L|q),H=q&L}for(let E=O;E<w;E++)j0[$.charCodeAt(E)]=0;return D},DS=($,X)=>{if($.length<X.length){let Y=X;X=$,$=Y}if(X.length===0)return $.length;if($.length<=32)return OS($,X);return wS($,X)},iM=($,X)=>{let Y=1/0,U=0;for(let G=0;G<X.length;G++){let z=DS($,X[G]);if(z<Y)Y=z,U=G}return X[U]};class p4{diff($,X,Y={}){let U;if(typeof Y==="function")U=Y,Y={};else if("callback"in Y)U=Y.callback;let G=this.castInput($,Y),z=this.castInput(X,Y),W=this.removeEmpty(this.tokenize(G,Y)),Q=this.removeEmpty(this.tokenize(z,Y));return this.diffWithOptionsObj(W,Q,Y,U)}diffWithOptionsObj($,X,Y,U){var G;let z=(A)=>{if(A=this.postProcess(A,Y),U){setTimeout(function(){U(A)},0);return}else return A},W=X.length,Q=$.length,Z=1,H=W+Q;if(Y.maxEditLength!=null)H=Math.min(H,Y.maxEditLength);let V=(G=Y.timeout)!==null&&G!==void 0?G:1/0,O=Date.now()+V,w=[{oldPos:-1,lastComponent:void 0}],D=this.extractCommon(w[0],X,$,0,Y);if(w[0].oldPos+1>=Q&&D+1>=W)return z(this.buildValues(w[0].lastComponent,X,$));let E=-1/0,F=1/0,J=()=>{for(let A=Math.max(E,-Z);A<=Math.min(F,Z);A+=2){let L,T=w[A-1],q=w[A+1];if(T)w[A-1]=void 0;let v=!1;if(q){let S=q.oldPos-A;v=q&&0<=S&&S<W}let I=T&&T.oldPos+1<Q;if(!v&&!I){w[A]=void 0;continue}if(!I||v&&T.oldPos<q.oldPos)L=this.addToPath(q,!0,!1,0,Y);else L=this.addToPath(T,!1,!0,1,Y);if(D=this.extractCommon(L,X,$,A,Y),L.oldPos+1>=Q&&D+1>=W)return z(this.buildValues(L.lastComponent,X,$))||!0;else{if(w[A]=L,L.oldPos+1>=Q)F=Math.min(F,A-1);if(D+1>=W)E=Math.max(E,A+1)}}Z++};if(U)(function A(){setTimeout(function(){if(Z>H||Date.now()>O)return U(void 0);if(!J())A()},0)})();else while(Z<=H&&Date.now()<=O){let A=J();if(A)return A}}addToPath($,X,Y,U,G){let z=$.lastComponent;if(z&&!G.oneChangePerToken&&z.added===X&&z.removed===Y)return{oldPos:$.oldPos+U,lastComponent:{count:z.count+1,added:X,removed:Y,previousComponent:z.previousComponent}};else return{oldPos:$.oldPos+U,lastComponent:{count:1,added:X,removed:Y,previousComponent:z}}}extractCommon($,X,Y,U,G){let z=X.length,W=Y.length,Q=$.oldPos,Z=Q-U,H=0;while(Z+1<z&&Q+1<W&&this.equals(Y[Q+1],X[Z+1],G))if(Z++,Q++,H++,G.oneChangePerToken)$.lastComponent={count:1,previousComponent:$.lastComponent,added:!1,removed:!1};if(H&&!G.oneChangePerToken)$.lastComponent={count:H,previousComponent:$.lastComponent,added:!1,removed:!1};return $.oldPos=Q,Z}equals($,X,Y){if(Y.comparator)return Y.comparator($,X);else return $===X||!!Y.ignoreCase&&$.toLowerCase()===X.toLowerCase()}removeEmpty($){let X=[];for(let Y=0;Y<$.length;Y++)if($[Y])X.push($[Y]);return X}castInput($,X){return $}tokenize($,X){return Array.from($)}join($){return $.join("")}postProcess($,X){return $}get useLongestToken(){return!1}buildValues($,X,Y){let U=[],G;while($)U.push($),G=$.previousComponent,delete $.previousComponent,$=G;U.reverse();let z=U.length,W=0,Q=0,Z=0;for(;W<z;W++){let H=U[W];if(!H.removed){if(!H.added&&this.useLongestToken){let V=X.slice(Q,Q+H.count);V=V.map(function(O,w){let D=Y[Z+w];return D.length>O.length?D:O}),H.value=this.join(V)}else H.value=this.join(X.slice(Q,Q+H.count));if(Q+=H.count,!H.added)Z+=H.count}else H.value=this.join(Y.slice(Z,Z+H.count)),Z+=H.count}return U}}class oM extends p4{}var nM=new oM;function qO($,X,Y){return nM.diff($,X,Y)}function RO($,X){let Y;for(Y=0;Y<$.length&&Y<X.length;Y++)if($[Y]!=X[Y])return $.slice(0,Y);return $.slice(0,Y)}function TO($,X){let Y;if(!$||!X||$[$.length-1]!=X[X.length-1])return"";for(Y=0;Y<$.length&&Y<X.length;Y++)if($[$.length-(Y+1)]!=X[X.length-(Y+1)])return $.slice(-Y);return $.slice(-Y)}function hU($,X,Y){if($.slice(0,X.length)!=X)throw Error(`string ${JSON.stringify($)} doesn't start with prefix ${JSON.stringify(X)}; this is a bug`);return Y+$.slice(X.length)}function gU($,X,Y){if(!X)return $+Y;if($.slice(-X.length)!=X)throw Error(`string ${JSON.stringify($)} doesn't end with suffix ${JSON.stringify(X)}; this is a bug`);return $.slice(0,-X.length)+Y}function FX($,X){return hU($,X,"")}function mY($,X){return gU($,X,"")}function vO($,X){return X.slice(0,ES($,X))}function ES($,X){let Y=0;if($.length>X.length)Y=$.length-X.length;let U=X.length;if($.length<X.length)U=$.length;let G=Array(U),z=0;G[0]=0;for(let W=1;W<U;W++){if(X[W]==X[z])G[W]=G[z];else G[W]=z;while(z>0&&X[W]!=X[z])z=G[z];if(X[W]==X[z])z++}z=0;for(let W=Y;W<$.length;W++){while(z>0&&$[W]!=X[z])z=G[z];if($[W]==X[z])z++}return z}function MX($){let X;for(X=$.length-1;X>=0;X--)if(!$[X].match(/\s/))break;return $.substring(X+1)}function P0($){let X=$.match(/^\s*/);return X?X[0]:""}var yU="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",NS=new RegExp(`[${yU}]+|\\s+|[^${yU}]`,"ug");class aM extends p4{equals($,X,Y){if(Y.ignoreCase)$=$.toLowerCase(),X=X.toLowerCase();return $.trim()===X.trim()}tokenize($,X={}){let Y;if(X.intlSegmenter){let z=X.intlSegmenter;if(z.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');Y=Array.from(z.segment($),(W)=>W.segment)}else Y=$.match(NS)||[];let U=[],G=null;return Y.forEach((z)=>{if(/\s/.test(z))if(G==null)U.push(z);else U.push(U.pop()+z);else if(G!=null&&/\s/.test(G))if(U[U.length-1]==G)U.push(U.pop()+z);else U.push(G+z);else U.push(z);G=z}),U}join($){return $.map((X,Y)=>{if(Y==0)return X;else return X.replace(/^\s+/,"")}).join("")}postProcess($,X){if(!$||X.oneChangePerToken)return $;let Y=null,U=null,G=null;if($.forEach((z)=>{if(z.added)U=z;else if(z.removed)G=z;else{if(U||G)tM(Y,G,U,z);Y=z,U=null,G=null}}),U||G)tM(Y,G,U,null);return $}}var sM=new aM;function CO($,X,Y){if((Y===null||Y===void 0?void 0:Y.ignoreWhitespace)!=null&&!Y.ignoreWhitespace)return XJ($,X,Y);return sM.diff($,X,Y)}function tM($,X,Y,U){if(X&&Y){let G=P0(X.value),z=MX(X.value),W=P0(Y.value),Q=MX(Y.value);if($){let Z=RO(G,W);$.value=gU($.value,W,Z),X.value=FX(X.value,Z),Y.value=FX(Y.value,Z)}if(U){let Z=TO(z,Q);U.value=hU(U.value,Q,Z),X.value=mY(X.value,Z),Y.value=mY(Y.value,Z)}}else if(Y){if($){let G=P0(Y.value);Y.value=Y.value.substring(G.length)}if(U){let G=P0(U.value);U.value=U.value.substring(G.length)}}else if($&&U){let G=P0(U.value),z=P0(X.value),W=MX(X.value),Q=RO(G,z);X.value=FX(X.value,Q);let Z=TO(FX(G,Q),W);X.value=mY(X.value,Z),U.value=hU(U.value,G,Z),$.value=gU($.value,G,G.slice(0,G.length-Z.length))}else if(U){let G=P0(U.value),z=MX(X.value),W=vO(z,G);X.value=mY(X.value,W)}else if($){let G=MX($.value),z=P0(X.value),W=vO(G,z);X.value=FX(X.value,W)}}class eM extends p4{tokenize($){let X=new RegExp(`(\\r?\\n)|[${yU}]+|[^\\S\\n\\r]+|[^${yU}]`,"ug");return $.match(X)||[]}}var $J=new eM;function XJ($,X,Y){return $J.diff($,X,Y)}class YJ extends p4{constructor(){super(...arguments);this.tokenize=BO}equals($,X,Y){if(Y.ignoreWhitespace){if(!Y.newlineIsToken||!$.includes(`
|
|
76
|
+
`,_O),process.env[$])c6.mkdirSync("/tmp/varmint-uploads",{recursive:!0}),await Promise.all(X.map(async(Y)=>{let U=NX.join(_O,Y),G=NX.join("/tmp/varmint-uploads",Y);await ZS(U,G)}));else console.warn("\uD83D\uDCA5 Skipping artifact upload because process.env.CI is not set.")},endGlobalTrackingAndFlushUnusedFiles(){if(console.log(`\uD83D\uDC3F\uFE0F Ending global tracking of varmint files using project identifier "${gY}" and starting cleanup of untouched files.`),!s$.storage.initialized){console.error("\uD83D\uDCA5 called flushGlobal, but the global cache wasn't initialized with startGlobalTracking");return}let $=c6.readdirSync(s$.storage.rootDir),X=new Map,Y=[],U=[],G=[];for(let W of $)if(fU(`root${S4}`,W))Y.push(W);else if(fU(`list${S4}`,W))U.push(W);else if(fU(`file${S4}`,W))G.push(W);if(s$.storage.getItem("DID_CACHE_MISS"))console.log("\uD83D\uDC3F\uFE0F ","Cache miss detected. Since this likely prevented the cache from being fully utilized, we will not attempt to flush unused files.");else{let W=new Map;for(let Q of Y){let Z=Q.replace(rM,"");W.set(Z,new Map);let H=s$.storage.getItem(Q);if(H)X.set(Z,H);else console.error(`\uD83D\uDCA5 Could not find folder ${H} referenced in the global cache`)}for(let Q of U){let Z=Q.replace(lM,""),[H,V]=Z.split(S4),O=W.get(H);if(O)O.set(V,new Set);else console.error(`\uD83D\uDCA5 Could not find root ${H} for list ${V}`)}for(let Q of G){let Z=Q.replace(dM,""),[H,V,O]=Z.split(S4),w=W.get(H);if(w){let D=w.get(V);if(D)D.add(O);else console.error(`\uD83D\uDCA5 Could not find list ${V} for file ${Z}`)}else console.error(`\uD83D\uDCA5 Could not find root ${H} for file ${Z}`)}console.log("\uD83D\uDC3F\uFE0F ",W);for(let[Q,Z]of W.entries()){let H=X.get(Q);if(!H){console.error(`\uD83D\uDCA5 Could not find root ${Q}`);continue}if(!c6.existsSync(H)){console.warn(`\uD83D\uDCA5 Root folder ${H}, identified as being used during tracking, no longer exists during cleanup.`);continue}let O=c6.readdirSync(H);for(let w of O)if(w!==".ferret"&&!Z.has(w)){let D=NX.join(H,w);console.log(`\uD83E\uDDF9 globalFlush: removing directory ${D}`),c6.rmSync(D,{recursive:!0})}for(let[w,D]of Z.entries()){let E=NX.join(H,w);if(!c6.existsSync(E)){console.warn(`\uD83D\uDCA5 List folder ${E}, identified as being used during tracking, no longer exists.`);continue}let J=c6.readdirSync(E);for(let A of J){let L=A.replace(".input.json","").replace(".output.json","").replace(".stream.txt","");if(!D.has(L)){let T=NX.join(E,A);console.log(`\uD83E\uDDF9 globalFlush: removing file ${T}`),c6.rmSync(T)}}}}}c6.rmSync(s$.storage.rootDir,{recursive:!0})}};function fU($,X){return X.startsWith($)}import*as z4 from"fs";import*as g1 from"path";import{inspect as dU}from"util";var j0=new Uint32Array(65536),OS=($,X)=>{let Y=$.length,U=X.length,G=1<<Y-1,z=-1,W=0,Q=Y,Z=Y;while(Z--)j0[$.charCodeAt(Z)]|=1<<Z;for(Z=0;Z<U;Z++){let H=j0[X.charCodeAt(Z)],V=H|W;if(H|=(H&z)+z^z,W|=~(H|z),z&=H,W&G)Q++;if(z&G)Q--;W=W<<1|1,z=z<<1|~(V|W),W&=V}Z=Y;while(Z--)j0[$.charCodeAt(Z)]=0;return Q},wS=($,X)=>{let Y=X.length,U=$.length,G=[],z=[],W=Math.ceil(Y/32),Q=Math.ceil(U/32);for(let E=0;E<W;E++)z[E]=-1,G[E]=0;let Z=0;for(;Z<Q-1;Z++){let E=0,F=-1,J=Z*32,A=Math.min(32,U)+J;for(let L=J;L<A;L++)j0[$.charCodeAt(L)]|=1<<L;for(let L=0;L<Y;L++){let T=j0[X.charCodeAt(L)],q=z[L/32|0]>>>L&1,v=G[L/32|0]>>>L&1,I=T|E,S=((T|v)&F)+F^F|T|v,y=E|~(S|F),r=F&S;if(y>>>31^q)z[L/32|0]^=1<<L;if(r>>>31^v)G[L/32|0]^=1<<L;y=y<<1|q,r=r<<1|v,F=r|~(I|y),E=y&I}for(let L=J;L<A;L++)j0[$.charCodeAt(L)]=0}let H=0,V=-1,O=Z*32,w=Math.min(32,U-O)+O;for(let E=O;E<w;E++)j0[$.charCodeAt(E)]|=1<<E;let D=U;for(let E=0;E<Y;E++){let F=j0[X.charCodeAt(E)],J=z[E/32|0]>>>E&1,A=G[E/32|0]>>>E&1,L=F|H,T=((F|A)&V)+V^V|F|A,q=H|~(T|V),v=V&T;if(D+=q>>>U-1&1,D-=v>>>U-1&1,q>>>31^J)z[E/32|0]^=1<<E;if(v>>>31^A)G[E/32|0]^=1<<E;q=q<<1|J,v=v<<1|A,V=v|~(L|q),H=q&L}for(let E=O;E<w;E++)j0[$.charCodeAt(E)]=0;return D},DS=($,X)=>{if($.length<X.length){let Y=X;X=$,$=Y}if(X.length===0)return $.length;if($.length<=32)return OS($,X);return wS($,X)},iM=($,X)=>{let Y=1/0,U=0;for(let G=0;G<X.length;G++){let z=DS($,X[G]);if(z<Y)Y=z,U=G}return X[U]};class p4{diff($,X,Y={}){let U;if(typeof Y==="function")U=Y,Y={};else if("callback"in Y)U=Y.callback;let G=this.castInput($,Y),z=this.castInput(X,Y),W=this.removeEmpty(this.tokenize(G,Y)),Q=this.removeEmpty(this.tokenize(z,Y));return this.diffWithOptionsObj(W,Q,Y,U)}diffWithOptionsObj($,X,Y,U){var G;let z=(A)=>{if(A=this.postProcess(A,Y),U){setTimeout(function(){U(A)},0);return}else return A},W=X.length,Q=$.length,Z=1,H=W+Q;if(Y.maxEditLength!=null)H=Math.min(H,Y.maxEditLength);let V=(G=Y.timeout)!==null&&G!==void 0?G:1/0,O=Date.now()+V,w=[{oldPos:-1,lastComponent:void 0}],D=this.extractCommon(w[0],X,$,0,Y);if(w[0].oldPos+1>=Q&&D+1>=W)return z(this.buildValues(w[0].lastComponent,X,$));let E=-1/0,F=1/0,J=()=>{for(let A=Math.max(E,-Z);A<=Math.min(F,Z);A+=2){let L,T=w[A-1],q=w[A+1];if(T)w[A-1]=void 0;let v=!1;if(q){let S=q.oldPos-A;v=q&&0<=S&&S<W}let I=T&&T.oldPos+1<Q;if(!v&&!I){w[A]=void 0;continue}if(!I||v&&T.oldPos<q.oldPos)L=this.addToPath(q,!0,!1,0,Y);else L=this.addToPath(T,!1,!0,1,Y);if(D=this.extractCommon(L,X,$,A,Y),L.oldPos+1>=Q&&D+1>=W)return z(this.buildValues(L.lastComponent,X,$))||!0;else{if(w[A]=L,L.oldPos+1>=Q)F=Math.min(F,A-1);if(D+1>=W)E=Math.max(E,A+1)}}Z++};if(U)(function A(){setTimeout(function(){if(Z>H||Date.now()>O)return U(void 0);if(!J())A()},0)})();else while(Z<=H&&Date.now()<=O){let A=J();if(A)return A}}addToPath($,X,Y,U,G){let z=$.lastComponent;if(z&&!G.oneChangePerToken&&z.added===X&&z.removed===Y)return{oldPos:$.oldPos+U,lastComponent:{count:z.count+1,added:X,removed:Y,previousComponent:z.previousComponent}};else return{oldPos:$.oldPos+U,lastComponent:{count:1,added:X,removed:Y,previousComponent:z}}}extractCommon($,X,Y,U,G){let z=X.length,W=Y.length,Q=$.oldPos,Z=Q-U,H=0;while(Z+1<z&&Q+1<W&&this.equals(Y[Q+1],X[Z+1],G))if(Z++,Q++,H++,G.oneChangePerToken)$.lastComponent={count:1,previousComponent:$.lastComponent,added:!1,removed:!1};if(H&&!G.oneChangePerToken)$.lastComponent={count:H,previousComponent:$.lastComponent,added:!1,removed:!1};return $.oldPos=Q,Z}equals($,X,Y){if(Y.comparator)return Y.comparator($,X);else return $===X||!!Y.ignoreCase&&$.toLowerCase()===X.toLowerCase()}removeEmpty($){let X=[];for(let Y=0;Y<$.length;Y++)if($[Y])X.push($[Y]);return X}castInput($,X){return $}tokenize($,X){return Array.from($)}join($){return $.join("")}postProcess($,X){return $}get useLongestToken(){return!1}buildValues($,X,Y){let U=[],G;while($)U.push($),G=$.previousComponent,delete $.previousComponent,$=G;U.reverse();let z=U.length,W=0,Q=0,Z=0;for(;W<z;W++){let H=U[W];if(!H.removed){if(!H.added&&this.useLongestToken){let V=X.slice(Q,Q+H.count);V=V.map(function(O,w){let D=Y[Z+w];return D.length>O.length?D:O}),H.value=this.join(V)}else H.value=this.join(X.slice(Q,Q+H.count));if(Q+=H.count,!H.added)Z+=H.count}else H.value=this.join(Y.slice(Z,Z+H.count)),Z+=H.count}return U}}class oM extends p4{}var nM=new oM;function qO($,X,Y){return nM.diff($,X,Y)}function RO($,X){let Y;for(Y=0;Y<$.length&&Y<X.length;Y++)if($[Y]!=X[Y])return $.slice(0,Y);return $.slice(0,Y)}function TO($,X){let Y;if(!$||!X||$[$.length-1]!=X[X.length-1])return"";for(Y=0;Y<$.length&&Y<X.length;Y++)if($[$.length-(Y+1)]!=X[X.length-(Y+1)])return $.slice(-Y);return $.slice(-Y)}function hU($,X,Y){if($.slice(0,X.length)!=X)throw Error(`string ${JSON.stringify($)} doesn't start with prefix ${JSON.stringify(X)}; this is a bug`);return Y+$.slice(X.length)}function gU($,X,Y){if(!X)return $+Y;if($.slice(-X.length)!=X)throw Error(`string ${JSON.stringify($)} doesn't end with suffix ${JSON.stringify(X)}; this is a bug`);return $.slice(0,-X.length)+Y}function FX($,X){return hU($,X,"")}function mY($,X){return gU($,X,"")}function vO($,X){return X.slice(0,ES($,X))}function ES($,X){let Y=0;if($.length>X.length)Y=$.length-X.length;let U=X.length;if($.length<X.length)U=$.length;let G=Array(U),z=0;G[0]=0;for(let W=1;W<U;W++){if(X[W]==X[z])G[W]=G[z];else G[W]=z;while(z>0&&X[W]!=X[z])z=G[z];if(X[W]==X[z])z++}z=0;for(let W=Y;W<$.length;W++){while(z>0&&$[W]!=X[z])z=G[z];if($[W]==X[z])z++}return z}function MX($){let X;for(X=$.length-1;X>=0;X--)if(!$[X].match(/\s/))break;return $.substring(X+1)}function P0($){let X=$.match(/^\s*/);return X?X[0]:""}var yU="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",NS=new RegExp(`[${yU}]+|\\s+|[^${yU}]`,"ug");class aM extends p4{equals($,X,Y){if(Y.ignoreCase)$=$.toLowerCase(),X=X.toLowerCase();return $.trim()===X.trim()}tokenize($,X={}){let Y;if(X.intlSegmenter){let z=X.intlSegmenter;if(z.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');Y=Array.from(z.segment($),(W)=>W.segment)}else Y=$.match(NS)||[];let U=[],G=null;return Y.forEach((z)=>{if(/\s/.test(z))if(G==null)U.push(z);else U.push(U.pop()+z);else if(G!=null&&/\s/.test(G))if(U[U.length-1]==G)U.push(U.pop()+z);else U.push(G+z);else U.push(z);G=z}),U}join($){return $.map((X,Y)=>{if(Y==0)return X;else return X.replace(/^\s+/,"")}).join("")}postProcess($,X){if(!$||X.oneChangePerToken)return $;let Y=null,U=null,G=null;if($.forEach((z)=>{if(z.added)U=z;else if(z.removed)G=z;else{if(U||G)tM(Y,G,U,z);Y=z,U=null,G=null}}),U||G)tM(Y,G,U,null);return $}}var sM=new aM;function CO($,X,Y){if((Y===null||Y===void 0?void 0:Y.ignoreWhitespace)!=null&&!Y.ignoreWhitespace)return XJ($,X,Y);return sM.diff($,X,Y)}function tM($,X,Y,U){if(X&&Y){let G=P0(X.value),z=MX(X.value),W=P0(Y.value),Q=MX(Y.value);if($){let Z=RO(G,W);$.value=gU($.value,W,Z),X.value=FX(X.value,Z),Y.value=FX(Y.value,Z)}if(U){let Z=TO(z,Q);U.value=hU(U.value,Q,Z),X.value=mY(X.value,Z),Y.value=mY(Y.value,Z)}}else if(Y){if($){let G=P0(Y.value);Y.value=Y.value.substring(G.length)}if(U){let G=P0(U.value);U.value=U.value.substring(G.length)}}else if($&&U){let G=P0(U.value),z=P0(X.value),W=MX(X.value),Q=RO(G,z);X.value=FX(X.value,Q);let Z=TO(FX(G,Q),W);X.value=mY(X.value,Z),U.value=hU(U.value,G,Z),$.value=gU($.value,G,G.slice(0,G.length-Z.length))}else if(U){let G=P0(U.value),z=MX(X.value),W=vO(z,G);X.value=mY(X.value,W)}else if($){let G=MX($.value),z=P0(X.value),W=vO(G,z);X.value=FX(X.value,W)}}class eM extends p4{tokenize($){let X=new RegExp(`(\\r?\\n)|[${yU}]+|[^\\S\\n\\r]+|[^${yU}]`,"ug");return $.match(X)||[]}}var $J=new eM;function XJ($,X,Y){return $J.diff($,X,Y)}class YJ extends p4{constructor(){super(...arguments);this.tokenize=BO}equals($,X,Y){if(Y.ignoreWhitespace){if(!Y.newlineIsToken||!$.includes(`
|
|
77
77
|
`))$=$.trim();if(!Y.newlineIsToken||!X.includes(`
|
|
78
78
|
`))X=X.trim()}else if(Y.ignoreNewlineAtEof&&!Y.newlineIsToken){if($.endsWith(`
|
|
79
79
|
`))$=$.slice(0,-1);if(X.endsWith(`
|
|
80
80
|
`))X=X.slice(0,-1)}return super.equals($,X,Y)}}var GJ=new YJ;function mU($,X,Y){return GJ.diff($,X,Y)}function BO($,X){if(X.stripTrailingCr)$=$.replace(/\r\n/g,`
|
|
81
|
-
`);let Y=[],U=$.split(/(\n|\r\n)/);if(!U[U.length-1])U.pop();for(let G=0;G<U.length;G++){let z=U[G];if(G%2&&!X.newlineIsToken)Y[Y.length-1]+=z;else Y.push(z)}return Y}function FS($){return $=="."||$=="!"||$=="?"}class UJ extends p4{tokenize($){var X;let Y=[],U=0;for(let G=0;G<$.length;G++){if(G==$.length-1){Y.push($.slice(U));break}if(FS($[G])&&$[G+1].match(/\s/)){Y.push($.slice(U,G+1)),G=U=G+1;while((X=$[G+1])===null||X===void 0?void 0:X.match(/\s/))G++;Y.push($.slice(U,G+1)),U=G+1}}return Y}}var MS=new UJ;class zJ extends p4{tokenize($){return $.split(/([{}:;,]|\s+)/)}}var JS=new zJ;class WJ extends p4{constructor(){super(...arguments);this.tokenize=BO}get useLongestToken(){return!0}castInput($,X){let{undefinedReplacement:Y,stringifyReplacer:U=(G,z)=>typeof z==="undefined"?Y:z}=X;return typeof $==="string"?$:JSON.stringify(uU($,null,null,U),null," ")}equals($,X,Y){return super.equals($.replace(/,([\r\n])/g,"$1"),X.replace(/,([\r\n])/g,"$1"),Y)}}var AS=new WJ;function uU($,X,Y,U,G){if(X=X||[],Y=Y||[],U)$=U(G===void 0?"":G,$);let z;for(z=0;z<X.length;z+=1)if(X[z]===$)return Y[z];let W;if(Object.prototype.toString.call($)==="[object Array]"){X.push($),W=new Array($.length),Y.push(W);for(z=0;z<$.length;z+=1)W[z]=uU($[z],X,Y,U,String(z));return X.pop(),Y.pop(),W}if($&&$.toJSON)$=$.toJSON();if(typeof $==="object"&&$!==null){X.push($),W={},Y.push(W);let Q=[],Z;for(Z in $)if(Object.prototype.hasOwnProperty.call($,Z))Q.push(Z);Q.sort();for(z=0;z<Q.length;z+=1)Z=Q[z],W[Z]=uU($[Z],X,Y,U,Z);X.pop(),Y.pop()}else W=$;return W}class QJ extends p4{tokenize($){return $.slice()}join($){return $}removeEmpty($){return $}}var LS=new QJ;var OJ=PN(VJ(),1)
|
|
82
|
-
`);if(H){let E=H,F=Math.max(E.length,D.length);for(let J=0;J<F;J++){let A=E[J]??"",L=D[J]??"",{left:T,right:q}=W(A,L);if(V(),A||L){if(A)Q.push(T);if(L)Q.push(q)}}H=null}else{V();for(let E of D)if(E)Q.push(
|
|
83
|
-
`);continue}if(H){V();for(let D of H)if(D)Q.push(
|
|
84
|
-
`);for(let D of w)if(D)Z.push(` ${D}`)}if(H){V();for(let O of H)if(O)Q.push(
|
|
85
|
-
`)}var wJ=class{filenameCache=new Map;filesTouched=new Map;mode;baseDir;rootName;constructor($="off",X=
|
|
81
|
+
`);let Y=[],U=$.split(/(\n|\r\n)/);if(!U[U.length-1])U.pop();for(let G=0;G<U.length;G++){let z=U[G];if(G%2&&!X.newlineIsToken)Y[Y.length-1]+=z;else Y.push(z)}return Y}function FS($){return $=="."||$=="!"||$=="?"}class UJ extends p4{tokenize($){var X;let Y=[],U=0;for(let G=0;G<$.length;G++){if(G==$.length-1){Y.push($.slice(U));break}if(FS($[G])&&$[G+1].match(/\s/)){Y.push($.slice(U,G+1)),G=U=G+1;while((X=$[G+1])===null||X===void 0?void 0:X.match(/\s/))G++;Y.push($.slice(U,G+1)),U=G+1}}return Y}}var MS=new UJ;class zJ extends p4{tokenize($){return $.split(/([{}:;,]|\s+)/)}}var JS=new zJ;class WJ extends p4{constructor(){super(...arguments);this.tokenize=BO}get useLongestToken(){return!0}castInput($,X){let{undefinedReplacement:Y,stringifyReplacer:U=(G,z)=>typeof z==="undefined"?Y:z}=X;return typeof $==="string"?$:JSON.stringify(uU($,null,null,U),null," ")}equals($,X,Y){return super.equals($.replace(/,([\r\n])/g,"$1"),X.replace(/,([\r\n])/g,"$1"),Y)}}var AS=new WJ;function uU($,X,Y,U,G){if(X=X||[],Y=Y||[],U)$=U(G===void 0?"":G,$);let z;for(z=0;z<X.length;z+=1)if(X[z]===$)return Y[z];let W;if(Object.prototype.toString.call($)==="[object Array]"){X.push($),W=new Array($.length),Y.push(W);for(z=0;z<$.length;z+=1)W[z]=uU($[z],X,Y,U,String(z));return X.pop(),Y.pop(),W}if($&&$.toJSON)$=$.toJSON();if(typeof $==="object"&&$!==null){X.push($),W={},Y.push(W);let Q=[],Z;for(Z in $)if(Object.prototype.hasOwnProperty.call($,Z))Q.push(Z);Q.sort();for(z=0;z<Q.length;z+=1)Z=Q[z],W[Z]=uU($[Z],X,Y,U,Z);X.pop(),Y.pop()}else W=$;return W}class QJ extends p4{tokenize($){return $.slice()}join($){return $}removeEmpty($){return $}}var LS=new QJ;var OJ=PN(VJ(),1),$0=OJ.default.createColors(!0);function TS($,X,Y={}){let{showContext:U=Number.POSITIVE_INFINITY,wordBoundary:G=!0}=Y,z=mU($,X),W=(O,w)=>{let D=G?CO(O,w):qO(O,w),E="",F="";for(let J of D)if(J.added)F+=$0.bgGreen($0.black(J.value));else if(J.removed)E+=$0.bgRed($0.black(J.value));else E+=J.value,F+=J.value;return{left:$0.red(`- ${E}`),right:$0.green(`+ ${F}`)}},Q=[],Z=[],H=null,V=()=>{if(!Z.length)return;if(Z.length>U*2+1){let O=Z.slice(0,U),w=Z.slice(-U);Q.push(...O,$0.dim(`\u2026 ${Z.length-O.length-w.length} lines unchanged \u2026`),...w)}else Q.push(...Z);Z=[]};for(let O of z){if(O.added){let D=O.value.split(`
|
|
82
|
+
`);if(H){let E=H,F=Math.max(E.length,D.length);for(let J=0;J<F;J++){let A=E[J]??"",L=D[J]??"",{left:T,right:q}=W(A,L);if(V(),A||L){if(A)Q.push(T);if(L)Q.push(q)}}H=null}else{V();for(let E of D)if(E)Q.push($0.green(`+ ${E}`))}continue}if(O.removed){H=O.value.split(`
|
|
83
|
+
`);continue}if(H){V();for(let D of H)if(D)Q.push($0.red(`- ${D}`));H=null}let w=O.value.split(`
|
|
84
|
+
`);for(let D of w)if(D)Z.push(` ${D}`)}if(H){V();for(let O of H)if(O)Q.push($0.red(`- ${O}`))}return V(),Q.join(`
|
|
85
|
+
`)}var wJ=class{filenameCache=new Map;filesTouched=new Map;mode;baseDir;rootName;constructor($="off",X=g1.join(process.cwd(),".varmint")){if(this.mode=$,this.baseDir=X,this.rootName=yY(this.baseDir),s$.storage.initialized&&!s$.storage.getItem(`root${S4}${this.rootName}`))s$.storage.setItem(`root${S4}${this.rootName}`,this.baseDir)}read($,X,Y){let U=g1.join(this.baseDir,$),G=`${X}.input.json`,z=g1.join(U,G);if(!z4.existsSync(z)){if(!z4.existsSync(U)){if(s$.storage.initialized&&this.mode==="read")s$.storage.setItem("DID_CACHE_MISS","true");throw new Error(`Squirrel: input file for key "${$}" with "${X}" was not found. Directory "${U}" does not exist.`)}let O=z4.readdirSync(U).map((v)=>[v,z4.readFileSync(g1.join(U,v),"utf-8")]).filter(([v])=>v.endsWith(".input.json")),w=[],D=new Map;for(let[v,I]of O){let S=` ${v}`,y=` ${dU(JSON.parse(I),{depth:Number.POSITIVE_INFINITY,colors:!1}).split(`
|
|
86
86
|
`).join(`
|
|
87
87
|
`)}`,r=S+`
|
|
88
88
|
`+y;w.push(r),D.set(r,{filename:S,contents:I})}let E={color:` ${X}.input.json
|
|
@@ -101,20 +101,20 @@ Provided:
|
|
|
101
101
|
${Q}
|
|
102
102
|
|
|
103
103
|
Cached:
|
|
104
|
-
${W}`)}let Z=h1.join(this.baseDir,`${$}/${X}.output.json`);return JSON.parse(z4.readFileSync(Z,"utf-8"))}async write($,X,Y,U){let G=h1.join(this.baseDir,$),z=h1.join(G,`${X}.input.json`),W=h1.join(G,`${X}.output.json`),Q=JSON.stringify(Y,null,"\t");if(!z4.existsSync(this.baseDir))z4.mkdirSync(this.baseDir,{recursive:!0});if(!z4.existsSync(G))z4.mkdirSync(G);if(z4.writeFileSync(z,Q),z4.existsSync(W))z4.unlinkSync(W);let Z=await U(...Y),H=JSON.stringify(Z,null,"\t");return z4.writeFileSync(W,H),Z}add($,X){let Y=`${this.rootName}${S4}${yY($)}`;return{flush:()=>{this.flush($)},for:(U)=>{if(this.mode!=="off"){if(this.filesTouched.set($,new Set),s$.storage.initialized&&!s$.storage.getItem(`list${S4}${Y}`))s$.storage.setItem(`list${S4}${Y}`,"true")}return{get:async(...G)=>{let z=U;if(this.mode!=="off"){let W=this.filenameCache.get(U);if(!W)W=yY(U),this.filenameCache.set(U,W);z=W,this.filesTouched.get($)?.add(z);let Q=`${Y}${S4}${z}`,Z=`file${S4}${Q}`;if(s$.storage.initialized&&!s$.storage.getItem(Z))s$.storage.setItem(Z,"true")}switch(this.mode){case"off":return X(...G);case"read":return this.read($,z,G);case"write":return this.write($,z,G,X);case"read-write":try{return this.read($,z,G)}catch(W){if(W instanceof Error)return this.write($,z,G,X);throw W}}}}}}}flush(...$){console.log(this.filesTouched);for(let[X,Y]of this.filesTouched.entries())if($.length===0||$.includes(X)){let U=h1.join(this.baseDir,X),G=z4.readdirSync(U);for(let z of G){let W=z.replace(".input.json","").replace(".output.json","");if(!Y.has(W))console.info(`\uD83E\uDDF9 Flushing ${W}`),z4.unlinkSync(h1.join(U,z))}}}};function Z$($,X,Y,U,G){if(U==="m")throw new TypeError("Private method is not writable");if(U==="a"&&!G)throw new TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!G:!X.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return U==="a"?G.call($,Y):G?G.value=Y:X.set($,Y),Y}function B($,X,Y,U){if(Y==="a"&&!U)throw new TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!U:!X.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return Y==="m"?U:Y==="a"?U.call($):U?U.value:X.get($)}var PO=function(){let{crypto:$}=globalThis;if($?.randomUUID)return PO=$.randomUUID.bind($),$.randomUUID();let X=new Uint8Array(1),Y=$?()=>$.getRandomValues(X)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(U)=>(+U^Y()&15>>+U/4).toString(16))};function uY($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var cY=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let X=new Error($.message,$.cause?{cause:$.cause}:{});if($.stack)X.stack=$.stack;if($.cause&&!X.cause)X.cause=$.cause;if($.name)X.name=$.name;return X}}catch{}try{return new Error(JSON.stringify($))}catch{}}return new Error($)};class G$ extends Error{}class C4 extends G${constructor($,X,Y,U){super(`${C4.makeMessage($,X,Y)}`);this.status=$,this.headers=U,this.requestID=U?.get("x-request-id"),this.error=X;let G=X;this.code=G?.code,this.param=G?.param,this.type=G?.type}static makeMessage($,X,Y){let U=X?.message?typeof X.message==="string"?X.message:JSON.stringify(X.message):X?JSON.stringify(X):Y;if($&&U)return`${$} ${U}`;if($)return`${$} status code (no body)`;if(U)return U;return"(no status code or body)"}static generate($,X,Y,U){if(!$||!U)return new Z8({message:Y,cause:cY(X)});let G=X?.error;if($===400)return new pY($,G,Y,U);if($===401)return new dY($,G,Y,U);if($===403)return new lY($,G,Y,U);if($===404)return new rY($,G,Y,U);if($===409)return new iY($,G,Y,U);if($===422)return new oY($,G,Y,U);if($===429)return new nY($,G,Y,U);if($>=500)return new tY($,G,Y,U);return new C4($,G,Y,U)}}class k4 extends C4{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class Z8 extends C4{constructor({message:$,cause:X}){super(void 0,void 0,$||"Connection error.",void 0);if(X)this.cause=X}}class H8 extends Z8{constructor({message:$}={}){super({message:$??"Request timed out."})}}class pY extends C4{}class dY extends C4{}class lY extends C4{}class rY extends C4{}class iY extends C4{}class oY extends C4{}class nY extends C4{}class tY extends C4{}class aY extends G${constructor(){super("Could not parse response content as the length limit was reached")}}class sY extends G${constructor(){super("Could not parse response content as the request was rejected by the content filter")}}class I0 extends Error{constructor($){super($)}}var CS=/^[a-z][a-z0-9+.-]*:/i,DJ=($)=>{return CS.test($)},z6=($)=>(z6=Array.isArray,z6($)),IO=z6;function xO($){if(typeof $!=="object")return{};return $??{}}function EJ($){if(!$)return!0;for(let X in $)return!1;return!0}function NJ($,X){return Object.prototype.hasOwnProperty.call($,X)}function eY($){return $!=null&&typeof $==="object"&&!Array.isArray($)}var FJ=($,X)=>{if(typeof X!=="number"||!Number.isInteger(X))throw new G$(`${$} must be an integer`);if(X<0)throw new G$(`${$} must be a positive integer`);return X};var MJ=($)=>{try{return JSON.parse($)}catch(X){return}};var $0=($)=>new Promise((X)=>setTimeout(X,$));var F2="5.16.0";var KJ=()=>{return typeof window!=="undefined"&&typeof window.document!=="undefined"&&typeof navigator!=="undefined"};function BS(){if(typeof Deno!=="undefined"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime!=="undefined")return"edge";if(Object.prototype.toString.call(typeof globalThis.process!=="undefined"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var jS=()=>{let $=BS();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":F2,"X-Stainless-OS":AJ(Deno.build.os),"X-Stainless-Arch":JJ(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime!=="undefined")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":F2,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":F2,"X-Stainless-OS":AJ(globalThis.process.platform??"unknown"),"X-Stainless-Arch":JJ(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let X=PS();if(X)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":F2,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${X.browser}`,"X-Stainless-Runtime-Version":X.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":F2,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function PS(){if(typeof navigator==="undefined"||!navigator)return null;let $=[{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:X,pattern:Y}of $){let U=Y.exec(navigator.userAgent);if(U){let G=U[1]||0,z=U[2]||0,W=U[3]||0;return{browser:X,version:`${G}.${z}.${W}`}}}return null}var JJ=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},AJ=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},LJ,_J=()=>{return LJ??(LJ=jS())};function qJ(){if(typeof fetch!=="undefined")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 SO(...$){let X=globalThis.ReadableStream;if(typeof X==="undefined")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new X(...$)}function lU($){let X=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return SO({start(){},async pull(Y){let{done:U,value:G}=await X.next();if(U)Y.close();else Y.enqueue(G)},async cancel(){await X.return?.()}})}function kO($){if($[Symbol.asyncIterator])return $;let X=$.getReader();return{async next(){try{let Y=await X.read();if(Y?.done)X.releaseLock();return Y}catch(Y){throw X.releaseLock(),Y}},async return(){let Y=X.cancel();return X.releaseLock(),await Y,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function RJ($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let X=$.getReader(),Y=X.cancel();X.releaseLock(),await Y}var TJ=({headers:$,body:X})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(X)}};var rU="RFC3986",bO=($)=>String($),iU={RFC1738:($)=>String($).replace(/%20/g,"+"),RFC3986:bO},fO="RFC1738";var oU=($,X)=>(oU=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),oU($,X)),X0=(()=>{let $=[];for(let X=0;X<256;++X)$.push("%"+((X<16?"0":"")+X.toString(16)).toUpperCase());return $})();var hO=1024,vJ=($,X,Y,U,G)=>{if($.length===0)return $;let z=$;if(typeof $==="symbol")z=Symbol.prototype.toString.call($);else if(typeof $!=="string")z=String($);if(Y==="iso-8859-1")return escape(z).replace(/%u[0-9a-f]{4}/gi,function(Q){return"%26%23"+parseInt(Q.slice(2),16)+"%3B"});let W="";for(let Q=0;Q<z.length;Q+=hO){let Z=z.length>=hO?z.slice(Q,Q+hO):z,H=[];for(let V=0;V<Z.length;++V){let O=Z.charCodeAt(V);if(O===45||O===46||O===95||O===126||O>=48&&O<=57||O>=65&&O<=90||O>=97&&O<=122||G===fO&&(O===40||O===41)){H[H.length]=Z.charAt(V);continue}if(O<128){H[H.length]=X0[O];continue}if(O<2048){H[H.length]=X0[192|O>>6]+X0[128|O&63];continue}if(O<55296||O>=57344){H[H.length]=X0[224|O>>12]+X0[128|O>>6&63]+X0[128|O&63];continue}V+=1,O=65536+((O&1023)<<10|Z.charCodeAt(V)&1023),H[H.length]=X0[240|O>>18]+X0[128|O>>12&63]+X0[128|O>>6&63]+X0[128|O&63]}W+=H.join("")}return W};function CJ($){if(!$||typeof $!=="object")return!1;return!!($.constructor&&$.constructor.isBuffer&&$.constructor.isBuffer($))}function gO($,X){if(z6($)){let Y=[];for(let U=0;U<$.length;U+=1)Y.push(X($[U]));return Y}return X($)}var jJ={brackets($){return String($)+"[]"},comma:"comma",indices($,X){return String($)+"["+X+"]"},repeat($){return String($)}},PJ=function($,X){Array.prototype.push.apply($,z6(X)?X:[X])},BJ,b4={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:vJ,encodeValuesOnly:!1,format:rU,formatter:bO,indices:!1,serializeDate($){return(BJ??(BJ=Function.prototype.call.bind(Date.prototype.toISOString)))($)},skipNulls:!1,strictNullHandling:!1};function SS($){return typeof $==="string"||typeof $==="number"||typeof $==="boolean"||typeof $==="symbol"||typeof $==="bigint"}var yO={};function IJ($,X,Y,U,G,z,W,Q,Z,H,V,O,w,D,E,F,J,A){let L=$,T=A,q=0,v=!1;while((T=T.get(yO))!==void 0&&!v){let j=T.get($);if(q+=1,typeof j!=="undefined")if(j===q)throw new RangeError("Cyclic object value");else v=!0;if(typeof T.get(yO)==="undefined")q=0}if(typeof H==="function")L=H(X,L);else if(L instanceof Date)L=w?.(L);else if(Y==="comma"&&z6(L))L=gO(L,function(j){if(j instanceof Date)return w?.(j);return j});if(L===null){if(z)return Z&&!F?Z(X,b4.encoder,J,"key",D):X;L=""}if(SS(L)||CJ(L)){if(Z){let j=F?X:Z(X,b4.encoder,J,"key",D);return[E?.(j)+"="+E?.(Z(L,b4.encoder,J,"value",D))]}return[E?.(X)+"="+E?.(String(L))]}let I=[];if(typeof L==="undefined")return I;let S;if(Y==="comma"&&z6(L)){if(F&&Z)L=gO(L,Z);S=[{value:L.length>0?L.join(",")||null:void 0}]}else if(z6(H))S=H;else{let j=Object.keys(L);S=V?j.sort(V):j}let y=Q?String(X).replace(/\./g,"%2E"):String(X),r=U&&z6(L)&&L.length===1?y+"[]":y;if(G&&z6(L)&&L.length===0)return r+"[]";for(let j=0;j<S.length;++j){let X$=S[j],l=typeof X$==="object"&&typeof X$.value!=="undefined"?X$.value:L[X$];if(W&&l===null)continue;let W$=O&&Q?X$.replace(/\./g,"%2E"):X$,L$=z6(L)?typeof Y==="function"?Y(r,W$):r:r+(O?"."+W$:"["+W$+"]");A.set($,q);let b$=new WeakMap;b$.set(yO,A),PJ(I,IJ(l,L$,Y,U,G,z,W,Q,Y==="comma"&&F&&z6(L)?null:Z,H,V,O,w,D,E,F,J,b$))}return I}function kS($=b4){if(typeof $.allowEmptyArrays!=="undefined"&&typeof $.allowEmptyArrays!=="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof $.encodeDotInKeys!=="undefined"&&typeof $.encodeDotInKeys!=="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if($.encoder!==null&&typeof $.encoder!=="undefined"&&typeof $.encoder!=="function")throw new TypeError("Encoder has to be a function.");let X=$.charset||b4.charset;if(typeof $.charset!=="undefined"&&$.charset!=="utf-8"&&$.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let Y=rU;if(typeof $.format!=="undefined"){if(!oU(iU,$.format))throw new TypeError("Unknown format option provided.");Y=$.format}let U=iU[Y],G=b4.filter;if(typeof $.filter==="function"||z6($.filter))G=$.filter;let z;if($.arrayFormat&&$.arrayFormat in jJ)z=$.arrayFormat;else if("indices"in $)z=$.indices?"indices":"repeat";else z=b4.arrayFormat;if("commaRoundTrip"in $&&typeof $.commaRoundTrip!=="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let W=typeof $.allowDots==="undefined"?!!$.encodeDotInKeys===!0?!0:b4.allowDots:!!$.allowDots;return{addQueryPrefix:typeof $.addQueryPrefix==="boolean"?$.addQueryPrefix:b4.addQueryPrefix,allowDots:W,allowEmptyArrays:typeof $.allowEmptyArrays==="boolean"?!!$.allowEmptyArrays:b4.allowEmptyArrays,arrayFormat:z,charset:X,charsetSentinel:typeof $.charsetSentinel==="boolean"?$.charsetSentinel:b4.charsetSentinel,commaRoundTrip:!!$.commaRoundTrip,delimiter:typeof $.delimiter==="undefined"?b4.delimiter:$.delimiter,encode:typeof $.encode==="boolean"?$.encode:b4.encode,encodeDotInKeys:typeof $.encodeDotInKeys==="boolean"?$.encodeDotInKeys:b4.encodeDotInKeys,encoder:typeof $.encoder==="function"?$.encoder:b4.encoder,encodeValuesOnly:typeof $.encodeValuesOnly==="boolean"?$.encodeValuesOnly:b4.encodeValuesOnly,filter:G,format:Y,formatter:U,serializeDate:typeof $.serializeDate==="function"?$.serializeDate:b4.serializeDate,skipNulls:typeof $.skipNulls==="boolean"?$.skipNulls:b4.skipNulls,sort:typeof $.sort==="function"?$.sort:null,strictNullHandling:typeof $.strictNullHandling==="boolean"?$.strictNullHandling:b4.strictNullHandling}}function mO($,X={}){let Y=$,U=kS(X),G,z;if(typeof U.filter==="function")z=U.filter,Y=z("",Y);else if(z6(U.filter))z=U.filter,G=z;let W=[];if(typeof Y!=="object"||Y===null)return"";let Q=jJ[U.arrayFormat],Z=Q==="comma"&&U.commaRoundTrip;if(!G)G=Object.keys(Y);if(U.sort)G.sort(U.sort);let H=new WeakMap;for(let w=0;w<G.length;++w){let D=G[w];if(U.skipNulls&&Y[D]===null)continue;PJ(W,IJ(Y[D],D,Q,Z,U.allowEmptyArrays,U.strictNullHandling,U.skipNulls,U.encodeDotInKeys,U.encode?U.encoder:null,U.filter,U.sort,U.allowDots,U.serializeDate,U.format,U.formatter,U.encodeValuesOnly,U.charset,H))}let V=W.join(U.delimiter),O=U.addQueryPrefix===!0?"?":"";if(U.charsetSentinel)if(U.charset==="iso-8859-1")O+="utf8=%26%2310003%3B&";else O+="utf8=%E2%9C%93&";return V.length>0?O+V:""}function kJ($){let X=0;for(let G of $)X+=G.length;let Y=new Uint8Array(X),U=0;for(let G of $)Y.set(G,U),U+=G.length;return Y}var xJ;function JX($){let X;return(xJ??(X=new globalThis.TextEncoder,xJ=X.encode.bind(X)))($)}var SJ;function uO($){let X;return(SJ??(X=new globalThis.TextDecoder,SJ=X.decode.bind(X)))($)}var G1,U1;class AX{constructor(){G1.set(this,void 0),U1.set(this,void 0),Z$(this,G1,new Uint8Array,"f"),Z$(this,U1,null,"f")}decode($){if($==null)return[];let X=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?JX($):$;Z$(this,G1,kJ([B(this,G1,"f"),X]),"f");let Y=[],U;while((U=fS(B(this,G1,"f"),B(this,U1,"f")))!=null){if(U.carriage&&B(this,U1,"f")==null){Z$(this,U1,U.index,"f");continue}if(B(this,U1,"f")!=null&&(U.index!==B(this,U1,"f")+1||U.carriage)){Y.push(uO(B(this,G1,"f").subarray(0,B(this,U1,"f")-1))),Z$(this,G1,B(this,G1,"f").subarray(B(this,U1,"f")),"f"),Z$(this,U1,null,"f");continue}let G=B(this,U1,"f")!==null?U.preceding-1:U.preceding,z=uO(B(this,G1,"f").subarray(0,G));Y.push(z),Z$(this,G1,B(this,G1,"f").subarray(U.index),"f"),Z$(this,U1,null,"f")}return Y}flush(){if(!B(this,G1,"f").length)return[];return this.decode(`
|
|
105
|
-
`)}}
|
|
106
|
-
`,"\r"]);AX.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function fS($,X){for(let G=X??0;G<$.length;G++){if($[G]===10)return{preceding:G,index:G+1,carriage:!1};if($[G]===13)return{preceding:G,index:G+1,carriage:!0}}return null}function bJ($){for(let U=0;U<$.length-1;U++){if($[U]===10&&$[U+1]===10)return U+2;if($[U]===13&&$[U+1]===13)return U+2;if($[U]===13&&$[U+1]===10&&U+3<$.length&&$[U+2]===13&&$[U+3]===10)return U+4}return-1}var tU={off:0,error:200,warn:300,info:400,debug:500},cO=($,X,Y)=>{if(!$)return;if(NJ(tU,$))return $;q4(Y).warn(`${X} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(tU))}`);return};function $G(){}function nU($,X,Y){if(!X||tU[$]>tU[Y])return $G;else return X[$].bind(X)}var hS={error:$G,warn:$G,info:$G,debug:$G},fJ=new WeakMap;function q4($){let X=$.logger,Y=$.logLevel??"off";if(!X)return hS;let U=fJ.get(X);if(U&&U[0]===Y)return U[1];let G={error:nU("error",X,Y),warn:nU("warn",X,Y),info:nU("info",X,Y),debug:nU("debug",X,Y)};return fJ.set(X,[Y,G]),G}var x0=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([X,Y])=>[X,X.toLowerCase()==="authorization"||X.toLowerCase()==="cookie"||X.toLowerCase()==="set-cookie"?"***":Y]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var XG;class
|
|
104
|
+
${W}`)}let Z=g1.join(this.baseDir,`${$}/${X}.output.json`);return JSON.parse(z4.readFileSync(Z,"utf-8"))}async write($,X,Y,U){let G=g1.join(this.baseDir,$),z=g1.join(G,`${X}.input.json`),W=g1.join(G,`${X}.output.json`),Q=JSON.stringify(Y,null,"\t");if(!z4.existsSync(this.baseDir))z4.mkdirSync(this.baseDir,{recursive:!0});if(!z4.existsSync(G))z4.mkdirSync(G);if(z4.writeFileSync(z,Q),z4.existsSync(W))z4.unlinkSync(W);let Z=await U(...Y),H=JSON.stringify(Z,null,"\t");return z4.writeFileSync(W,H),Z}add($,X){let Y=`${this.rootName}${S4}${yY($)}`;return{flush:()=>{this.flush($)},for:(U)=>{if(this.mode!=="off"){if(this.filesTouched.set($,new Set),s$.storage.initialized&&!s$.storage.getItem(`list${S4}${Y}`))s$.storage.setItem(`list${S4}${Y}`,"true")}return{get:async(...G)=>{let z=U;if(this.mode!=="off"){let W=this.filenameCache.get(U);if(!W)W=yY(U),this.filenameCache.set(U,W);z=W,this.filesTouched.get($)?.add(z);let Q=`${Y}${S4}${z}`,Z=`file${S4}${Q}`;if(s$.storage.initialized&&!s$.storage.getItem(Z))s$.storage.setItem(Z,"true")}switch(this.mode){case"off":return X(...G);case"read":return this.read($,z,G);case"write":return this.write($,z,G,X);case"read-write":try{return this.read($,z,G)}catch(W){if(W instanceof Error)return this.write($,z,G,X);throw W}}}}}}}flush(...$){console.log(this.filesTouched);for(let[X,Y]of this.filesTouched.entries())if($.length===0||$.includes(X)){let U=g1.join(this.baseDir,X),G=z4.readdirSync(U);for(let z of G){let W=z.replace(".input.json","").replace(".output.json","");if(!Y.has(W))console.info(`\uD83E\uDDF9 Flushing ${W}`),z4.unlinkSync(g1.join(U,z))}}}};function Z$($,X,Y,U,G){if(U==="m")throw new TypeError("Private method is not writable");if(U==="a"&&!G)throw new TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!G:!X.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return U==="a"?G.call($,Y):G?G.value=Y:X.set($,Y),Y}function B($,X,Y,U){if(Y==="a"&&!U)throw new TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!U:!X.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return Y==="m"?U:Y==="a"?U.call($):U?U.value:X.get($)}var PO=function(){let{crypto:$}=globalThis;if($?.randomUUID)return PO=$.randomUUID.bind($),$.randomUUID();let X=new Uint8Array(1),Y=$?()=>$.getRandomValues(X)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(U)=>(+U^Y()&15>>+U/4).toString(16))};function uY($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var cY=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let X=new Error($.message,$.cause?{cause:$.cause}:{});if($.stack)X.stack=$.stack;if($.cause&&!X.cause)X.cause=$.cause;if($.name)X.name=$.name;return X}}catch{}try{return new Error(JSON.stringify($))}catch{}}return new Error($)};class G$ extends Error{}class C4 extends G${constructor($,X,Y,U){super(`${C4.makeMessage($,X,Y)}`);this.status=$,this.headers=U,this.requestID=U?.get("x-request-id"),this.error=X;let G=X;this.code=G?.code,this.param=G?.param,this.type=G?.type}static makeMessage($,X,Y){let U=X?.message?typeof X.message==="string"?X.message:JSON.stringify(X.message):X?JSON.stringify(X):Y;if($&&U)return`${$} ${U}`;if($)return`${$} status code (no body)`;if(U)return U;return"(no status code or body)"}static generate($,X,Y,U){if(!$||!U)return new Z8({message:Y,cause:cY(X)});let G=X?.error;if($===400)return new pY($,G,Y,U);if($===401)return new dY($,G,Y,U);if($===403)return new lY($,G,Y,U);if($===404)return new rY($,G,Y,U);if($===409)return new iY($,G,Y,U);if($===422)return new oY($,G,Y,U);if($===429)return new nY($,G,Y,U);if($>=500)return new tY($,G,Y,U);return new C4($,G,Y,U)}}class k4 extends C4{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class Z8 extends C4{constructor({message:$,cause:X}){super(void 0,void 0,$||"Connection error.",void 0);if(X)this.cause=X}}class H8 extends Z8{constructor({message:$}={}){super({message:$??"Request timed out."})}}class pY extends C4{}class dY extends C4{}class lY extends C4{}class rY extends C4{}class iY extends C4{}class oY extends C4{}class nY extends C4{}class tY extends C4{}class aY extends G${constructor(){super("Could not parse response content as the length limit was reached")}}class sY extends G${constructor(){super("Could not parse response content as the request was rejected by the content filter")}}class I0 extends Error{constructor($){super($)}}var CS=/^[a-z][a-z0-9+.-]*:/i,DJ=($)=>{return CS.test($)},z6=($)=>(z6=Array.isArray,z6($)),IO=z6;function xO($){if(typeof $!=="object")return{};return $??{}}function EJ($){if(!$)return!0;for(let X in $)return!1;return!0}function NJ($,X){return Object.prototype.hasOwnProperty.call($,X)}function eY($){return $!=null&&typeof $==="object"&&!Array.isArray($)}var FJ=($,X)=>{if(typeof X!=="number"||!Number.isInteger(X))throw new G$(`${$} must be an integer`);if(X<0)throw new G$(`${$} must be a positive integer`);return X};var MJ=($)=>{try{return JSON.parse($)}catch(X){return}};var X0=($)=>new Promise((X)=>setTimeout(X,$));var F2="5.16.0";var KJ=()=>{return typeof window!=="undefined"&&typeof window.document!=="undefined"&&typeof navigator!=="undefined"};function BS(){if(typeof Deno!=="undefined"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime!=="undefined")return"edge";if(Object.prototype.toString.call(typeof globalThis.process!=="undefined"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var jS=()=>{let $=BS();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":F2,"X-Stainless-OS":AJ(Deno.build.os),"X-Stainless-Arch":JJ(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime!=="undefined")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":F2,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":F2,"X-Stainless-OS":AJ(globalThis.process.platform??"unknown"),"X-Stainless-Arch":JJ(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let X=PS();if(X)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":F2,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${X.browser}`,"X-Stainless-Runtime-Version":X.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":F2,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function PS(){if(typeof navigator==="undefined"||!navigator)return null;let $=[{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:X,pattern:Y}of $){let U=Y.exec(navigator.userAgent);if(U){let G=U[1]||0,z=U[2]||0,W=U[3]||0;return{browser:X,version:`${G}.${z}.${W}`}}}return null}var JJ=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},AJ=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},LJ,_J=()=>{return LJ??(LJ=jS())};function qJ(){if(typeof fetch!=="undefined")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 SO(...$){let X=globalThis.ReadableStream;if(typeof X==="undefined")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new X(...$)}function lU($){let X=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return SO({start(){},async pull(Y){let{done:U,value:G}=await X.next();if(U)Y.close();else Y.enqueue(G)},async cancel(){await X.return?.()}})}function kO($){if($[Symbol.asyncIterator])return $;let X=$.getReader();return{async next(){try{let Y=await X.read();if(Y?.done)X.releaseLock();return Y}catch(Y){throw X.releaseLock(),Y}},async return(){let Y=X.cancel();return X.releaseLock(),await Y,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function RJ($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let X=$.getReader(),Y=X.cancel();X.releaseLock(),await Y}var TJ=({headers:$,body:X})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(X)}};var rU="RFC3986",bO=($)=>String($),iU={RFC1738:($)=>String($).replace(/%20/g,"+"),RFC3986:bO},fO="RFC1738";var oU=($,X)=>(oU=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),oU($,X)),Y0=(()=>{let $=[];for(let X=0;X<256;++X)$.push("%"+((X<16?"0":"")+X.toString(16)).toUpperCase());return $})();var hO=1024,vJ=($,X,Y,U,G)=>{if($.length===0)return $;let z=$;if(typeof $==="symbol")z=Symbol.prototype.toString.call($);else if(typeof $!=="string")z=String($);if(Y==="iso-8859-1")return escape(z).replace(/%u[0-9a-f]{4}/gi,function(Q){return"%26%23"+parseInt(Q.slice(2),16)+"%3B"});let W="";for(let Q=0;Q<z.length;Q+=hO){let Z=z.length>=hO?z.slice(Q,Q+hO):z,H=[];for(let V=0;V<Z.length;++V){let O=Z.charCodeAt(V);if(O===45||O===46||O===95||O===126||O>=48&&O<=57||O>=65&&O<=90||O>=97&&O<=122||G===fO&&(O===40||O===41)){H[H.length]=Z.charAt(V);continue}if(O<128){H[H.length]=Y0[O];continue}if(O<2048){H[H.length]=Y0[192|O>>6]+Y0[128|O&63];continue}if(O<55296||O>=57344){H[H.length]=Y0[224|O>>12]+Y0[128|O>>6&63]+Y0[128|O&63];continue}V+=1,O=65536+((O&1023)<<10|Z.charCodeAt(V)&1023),H[H.length]=Y0[240|O>>18]+Y0[128|O>>12&63]+Y0[128|O>>6&63]+Y0[128|O&63]}W+=H.join("")}return W};function CJ($){if(!$||typeof $!=="object")return!1;return!!($.constructor&&$.constructor.isBuffer&&$.constructor.isBuffer($))}function gO($,X){if(z6($)){let Y=[];for(let U=0;U<$.length;U+=1)Y.push(X($[U]));return Y}return X($)}var jJ={brackets($){return String($)+"[]"},comma:"comma",indices($,X){return String($)+"["+X+"]"},repeat($){return String($)}},PJ=function($,X){Array.prototype.push.apply($,z6(X)?X:[X])},BJ,b4={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:vJ,encodeValuesOnly:!1,format:rU,formatter:bO,indices:!1,serializeDate($){return(BJ??(BJ=Function.prototype.call.bind(Date.prototype.toISOString)))($)},skipNulls:!1,strictNullHandling:!1};function SS($){return typeof $==="string"||typeof $==="number"||typeof $==="boolean"||typeof $==="symbol"||typeof $==="bigint"}var yO={};function IJ($,X,Y,U,G,z,W,Q,Z,H,V,O,w,D,E,F,J,A){let L=$,T=A,q=0,v=!1;while((T=T.get(yO))!==void 0&&!v){let j=T.get($);if(q+=1,typeof j!=="undefined")if(j===q)throw new RangeError("Cyclic object value");else v=!0;if(typeof T.get(yO)==="undefined")q=0}if(typeof H==="function")L=H(X,L);else if(L instanceof Date)L=w?.(L);else if(Y==="comma"&&z6(L))L=gO(L,function(j){if(j instanceof Date)return w?.(j);return j});if(L===null){if(z)return Z&&!F?Z(X,b4.encoder,J,"key",D):X;L=""}if(SS(L)||CJ(L)){if(Z){let j=F?X:Z(X,b4.encoder,J,"key",D);return[E?.(j)+"="+E?.(Z(L,b4.encoder,J,"value",D))]}return[E?.(X)+"="+E?.(String(L))]}let I=[];if(typeof L==="undefined")return I;let S;if(Y==="comma"&&z6(L)){if(F&&Z)L=gO(L,Z);S=[{value:L.length>0?L.join(",")||null:void 0}]}else if(z6(H))S=H;else{let j=Object.keys(L);S=V?j.sort(V):j}let y=Q?String(X).replace(/\./g,"%2E"):String(X),r=U&&z6(L)&&L.length===1?y+"[]":y;if(G&&z6(L)&&L.length===0)return r+"[]";for(let j=0;j<S.length;++j){let X$=S[j],l=typeof X$==="object"&&typeof X$.value!=="undefined"?X$.value:L[X$];if(W&&l===null)continue;let W$=O&&Q?X$.replace(/\./g,"%2E"):X$,L$=z6(L)?typeof Y==="function"?Y(r,W$):r:r+(O?"."+W$:"["+W$+"]");A.set($,q);let b$=new WeakMap;b$.set(yO,A),PJ(I,IJ(l,L$,Y,U,G,z,W,Q,Y==="comma"&&F&&z6(L)?null:Z,H,V,O,w,D,E,F,J,b$))}return I}function kS($=b4){if(typeof $.allowEmptyArrays!=="undefined"&&typeof $.allowEmptyArrays!=="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof $.encodeDotInKeys!=="undefined"&&typeof $.encodeDotInKeys!=="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if($.encoder!==null&&typeof $.encoder!=="undefined"&&typeof $.encoder!=="function")throw new TypeError("Encoder has to be a function.");let X=$.charset||b4.charset;if(typeof $.charset!=="undefined"&&$.charset!=="utf-8"&&$.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let Y=rU;if(typeof $.format!=="undefined"){if(!oU(iU,$.format))throw new TypeError("Unknown format option provided.");Y=$.format}let U=iU[Y],G=b4.filter;if(typeof $.filter==="function"||z6($.filter))G=$.filter;let z;if($.arrayFormat&&$.arrayFormat in jJ)z=$.arrayFormat;else if("indices"in $)z=$.indices?"indices":"repeat";else z=b4.arrayFormat;if("commaRoundTrip"in $&&typeof $.commaRoundTrip!=="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let W=typeof $.allowDots==="undefined"?!!$.encodeDotInKeys===!0?!0:b4.allowDots:!!$.allowDots;return{addQueryPrefix:typeof $.addQueryPrefix==="boolean"?$.addQueryPrefix:b4.addQueryPrefix,allowDots:W,allowEmptyArrays:typeof $.allowEmptyArrays==="boolean"?!!$.allowEmptyArrays:b4.allowEmptyArrays,arrayFormat:z,charset:X,charsetSentinel:typeof $.charsetSentinel==="boolean"?$.charsetSentinel:b4.charsetSentinel,commaRoundTrip:!!$.commaRoundTrip,delimiter:typeof $.delimiter==="undefined"?b4.delimiter:$.delimiter,encode:typeof $.encode==="boolean"?$.encode:b4.encode,encodeDotInKeys:typeof $.encodeDotInKeys==="boolean"?$.encodeDotInKeys:b4.encodeDotInKeys,encoder:typeof $.encoder==="function"?$.encoder:b4.encoder,encodeValuesOnly:typeof $.encodeValuesOnly==="boolean"?$.encodeValuesOnly:b4.encodeValuesOnly,filter:G,format:Y,formatter:U,serializeDate:typeof $.serializeDate==="function"?$.serializeDate:b4.serializeDate,skipNulls:typeof $.skipNulls==="boolean"?$.skipNulls:b4.skipNulls,sort:typeof $.sort==="function"?$.sort:null,strictNullHandling:typeof $.strictNullHandling==="boolean"?$.strictNullHandling:b4.strictNullHandling}}function mO($,X={}){let Y=$,U=kS(X),G,z;if(typeof U.filter==="function")z=U.filter,Y=z("",Y);else if(z6(U.filter))z=U.filter,G=z;let W=[];if(typeof Y!=="object"||Y===null)return"";let Q=jJ[U.arrayFormat],Z=Q==="comma"&&U.commaRoundTrip;if(!G)G=Object.keys(Y);if(U.sort)G.sort(U.sort);let H=new WeakMap;for(let w=0;w<G.length;++w){let D=G[w];if(U.skipNulls&&Y[D]===null)continue;PJ(W,IJ(Y[D],D,Q,Z,U.allowEmptyArrays,U.strictNullHandling,U.skipNulls,U.encodeDotInKeys,U.encode?U.encoder:null,U.filter,U.sort,U.allowDots,U.serializeDate,U.format,U.formatter,U.encodeValuesOnly,U.charset,H))}let V=W.join(U.delimiter),O=U.addQueryPrefix===!0?"?":"";if(U.charsetSentinel)if(U.charset==="iso-8859-1")O+="utf8=%26%2310003%3B&";else O+="utf8=%E2%9C%93&";return V.length>0?O+V:""}function kJ($){let X=0;for(let G of $)X+=G.length;let Y=new Uint8Array(X),U=0;for(let G of $)Y.set(G,U),U+=G.length;return Y}var xJ;function JX($){let X;return(xJ??(X=new globalThis.TextEncoder,xJ=X.encode.bind(X)))($)}var SJ;function uO($){let X;return(SJ??(X=new globalThis.TextDecoder,SJ=X.decode.bind(X)))($)}var U1,z1;class AX{constructor(){U1.set(this,void 0),z1.set(this,void 0),Z$(this,U1,new Uint8Array,"f"),Z$(this,z1,null,"f")}decode($){if($==null)return[];let X=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?JX($):$;Z$(this,U1,kJ([B(this,U1,"f"),X]),"f");let Y=[],U;while((U=fS(B(this,U1,"f"),B(this,z1,"f")))!=null){if(U.carriage&&B(this,z1,"f")==null){Z$(this,z1,U.index,"f");continue}if(B(this,z1,"f")!=null&&(U.index!==B(this,z1,"f")+1||U.carriage)){Y.push(uO(B(this,U1,"f").subarray(0,B(this,z1,"f")-1))),Z$(this,U1,B(this,U1,"f").subarray(B(this,z1,"f")),"f"),Z$(this,z1,null,"f");continue}let G=B(this,z1,"f")!==null?U.preceding-1:U.preceding,z=uO(B(this,U1,"f").subarray(0,G));Y.push(z),Z$(this,U1,B(this,U1,"f").subarray(U.index),"f"),Z$(this,z1,null,"f")}return Y}flush(){if(!B(this,U1,"f").length)return[];return this.decode(`
|
|
105
|
+
`)}}U1=new WeakMap,z1=new WeakMap;AX.NEWLINE_CHARS=new Set([`
|
|
106
|
+
`,"\r"]);AX.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function fS($,X){for(let G=X??0;G<$.length;G++){if($[G]===10)return{preceding:G,index:G+1,carriage:!1};if($[G]===13)return{preceding:G,index:G+1,carriage:!0}}return null}function bJ($){for(let U=0;U<$.length-1;U++){if($[U]===10&&$[U+1]===10)return U+2;if($[U]===13&&$[U+1]===13)return U+2;if($[U]===13&&$[U+1]===10&&U+3<$.length&&$[U+2]===13&&$[U+3]===10)return U+4}return-1}var tU={off:0,error:200,warn:300,info:400,debug:500},cO=($,X,Y)=>{if(!$)return;if(NJ(tU,$))return $;q4(Y).warn(`${X} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(tU))}`);return};function $G(){}function nU($,X,Y){if(!X||tU[$]>tU[Y])return $G;else return X[$].bind(X)}var hS={error:$G,warn:$G,info:$G,debug:$G},fJ=new WeakMap;function q4($){let X=$.logger,Y=$.logLevel??"off";if(!X)return hS;let U=fJ.get(X);if(U&&U[0]===Y)return U[1];let G={error:nU("error",X,Y),warn:nU("warn",X,Y),info:nU("info",X,Y),debug:nU("debug",X,Y)};return fJ.set(X,[Y,G]),G}var x0=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([X,Y])=>[X,X.toLowerCase()==="authorization"||X.toLowerCase()==="cookie"||X.toLowerCase()==="set-cookie"?"***":Y]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var XG;class W1{constructor($,X,Y){this.iterator=$,XG.set(this,void 0),this.controller=X,Z$(this,XG,Y,"f")}static fromSSEResponse($,X,Y){let U=!1,G=Y?q4(Y):console;async function*z(){if(U)throw new G$("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");U=!0;let W=!1;try{for await(let Q of gS($,X)){if(W)continue;if(Q.data.startsWith("[DONE]")){W=!0;continue}if(Q.event===null||!Q.event.startsWith("thread.")){let Z;try{Z=JSON.parse(Q.data)}catch(H){throw G.error("Could not parse message into JSON:",Q.data),G.error("From chunk:",Q.raw),H}if(Z&&Z.error)throw new C4(void 0,Z.error,void 0,$.headers);yield Z}else{let Z;try{Z=JSON.parse(Q.data)}catch(H){throw console.error("Could not parse message into JSON:",Q.data),console.error("From chunk:",Q.raw),H}if(Q.event=="error")throw new C4(void 0,Z.error,Z.message,void 0);yield{event:Q.event,data:Z}}}W=!0}catch(Q){if(uY(Q))return;throw Q}finally{if(!W)X.abort()}}return new W1(z,X,Y)}static fromReadableStream($,X,Y){let U=!1;async function*G(){let W=new AX,Q=kO($);for await(let Z of Q)for(let H of W.decode(Z))yield H;for(let Z of W.flush())yield Z}async function*z(){if(U)throw new G$("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");U=!0;let W=!1;try{for await(let Q of G()){if(W)continue;if(Q)yield JSON.parse(Q)}W=!0}catch(Q){if(uY(Q))return;throw Q}finally{if(!W)X.abort()}}return new W1(z,X,Y)}[(XG=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],X=[],Y=this.iterator(),U=(G)=>{return{next:()=>{if(G.length===0){let z=Y.next();$.push(z),X.push(z)}return G.shift()}}};return[new W1(()=>U($),this.controller,B(this,XG,"f")),new W1(()=>U(X),this.controller,B(this,XG,"f"))]}toReadableStream(){let $=this,X;return SO({async start(){X=$[Symbol.asyncIterator]()},async pull(Y){try{let{value:U,done:G}=await X.next();if(G)return Y.close();let z=JX(JSON.stringify(U)+`
|
|
107
107
|
`);Y.enqueue(z)}catch(U){Y.error(U)}},async cancel(){await X.return?.()}})}}async function*gS($,X){if(!$.body){if(X.abort(),typeof globalThis.navigator!=="undefined"&&globalThis.navigator.product==="ReactNative")throw new G$("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new G$("Attempted to iterate over a response with no body")}let Y=new hJ,U=new AX,G=kO($.body);for await(let z of yS(G))for(let W of U.decode(z)){let Q=Y.decode(W);if(Q)yield Q}for(let z of U.flush()){let W=Y.decode(z);if(W)yield W}}async function*yS($){let X=new Uint8Array;for await(let Y of $){if(Y==null)continue;let U=Y instanceof ArrayBuffer?new Uint8Array(Y):typeof Y==="string"?JX(Y):Y,G=new Uint8Array(X.length+U.length);G.set(X),G.set(U,X.length),X=G;let z;while((z=bJ(X))!==-1)yield X.slice(0,z),X=X.slice(z)}if(X.length>0)yield X}class hJ{constructor(){this.event=null,this.data=[],this.chunks=[]}decode($){if($.endsWith("\r"))$=$.substring(0,$.length-1);if(!$){if(!this.event&&!this.data.length)return null;let G={event:this.event,data:this.data.join(`
|
|
108
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],G}if(this.chunks.push($),$.startsWith(":"))return null;let[X,Y,U]=mS($,":");if(U.startsWith(" "))U=U.substring(1);if(X==="event")this.event=U;else if(X==="data")this.data.push(U);return null}}function mS($,X){let Y=$.indexOf(X);if(Y!==-1)return[$.substring(0,Y),X,$.substring(Y+X.length)];return[$,"",""]}async function aU($,X){let{response:Y,requestLogID:U,retryOfRequestLogID:G,startTime:z}=X,W=await(async()=>{if(X.options.stream){if(q4($).debug("response",Y.status,Y.url,Y.headers,Y.body),X.options.__streamClass)return X.options.__streamClass.fromSSEResponse(Y,X.controller,$);return
|
|
108
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],G}if(this.chunks.push($),$.startsWith(":"))return null;let[X,Y,U]=mS($,":");if(U.startsWith(" "))U=U.substring(1);if(X==="event")this.event=U;else if(X==="data")this.data.push(U);return null}}function mS($,X){let Y=$.indexOf(X);if(Y!==-1)return[$.substring(0,Y),X,$.substring(Y+X.length)];return[$,"",""]}async function aU($,X){let{response:Y,requestLogID:U,retryOfRequestLogID:G,startTime:z}=X,W=await(async()=>{if(X.options.stream){if(q4($).debug("response",Y.status,Y.url,Y.headers,Y.body),X.options.__streamClass)return X.options.__streamClass.fromSSEResponse(Y,X.controller,$);return W1.fromSSEResponse(Y,X.controller,$)}if(Y.status===204)return null;if(X.options.__binaryResponse)return Y;let Z=Y.headers.get("content-type")?.split(";")[0]?.trim();if(Z?.includes("application/json")||Z?.endsWith("+json")){let O=await Y.json();return pO(O,Y)}return await Y.text()})();return q4($).debug(`[${U}] response parsed`,x0({retryOfRequestLogID:G,url:Y.url,status:Y.status,body:W,durationMs:Date.now()-z})),W}function pO($,X){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:X.headers.get("x-request-id"),enumerable:!1})}var YG;class V8 extends Promise{constructor($,X,Y=aU){super((U)=>{U(null)});this.responsePromise=X,this.parseResponse=Y,YG.set(this,void 0),Z$(this,YG,$,"f")}_thenUnwrap($){return new V8(B(this,YG,"f"),this.responsePromise,async(X,Y)=>pO($(await this.parseResponse(X,Y),Y),Y.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,X]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:X,request_id:X.headers.get("x-request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(B(this,YG,"f"),$));return this.parsedPromise}then($,X){return this.parse().then($,X)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}}YG=new WeakMap;var sU;class eU{constructor($,X,Y,U){sU.set(this,void 0),Z$(this,sU,$,"f"),this.options=U,this.response=X,this.body=Y}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new G$("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await B(this,sU,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(sU=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let X of $.getPaginatedItems())yield X}}class $7 extends V8{constructor($,X,Y){super($,X,async(U,G)=>new Y(U,G.response,await aU(U,G),G.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let X of $)yield X}}class S0 extends eU{constructor($,X,Y,U){super($,X,Y,U);this.data=Y.data||[],this.object=Y.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}}class q$ extends eU{constructor($,X,Y,U){super($,X,Y,U);this.data=Y.data||[],this.has_more=Y.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let $=this.getPaginatedItems(),X=$[$.length-1]?.id;if(!X)return null;return{...this.options,query:{...xO(this.options.query),after:X}}}}class dO extends eU{constructor($,X,Y,U){super($,X,Y,U);this.data=Y.data||[],this.has_more=Y.has_more||!1,this.last_id=Y.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let $=this.last_id;if(!$)return null;return{...this.options,query:{...xO(this.options.query),after:$}}}}var rO=()=>{if(typeof File==="undefined"){let{process:$}=globalThis,X=typeof $?.versions?.node==="string"&&parseInt($.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(X?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function LX($,X,Y){return rO(),new File($,X??"unknown_file",Y)}function GG($){return(typeof $==="object"&&$!==null&&(("name"in $)&&$.name&&String($.name)||("url"in $)&&$.url&&String($.url)||("filename"in $)&&$.filename&&String($.filename)||("path"in $)&&$.path&&String($.path))||"").split(/[\\/]/).pop()||void 0}var iO=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function";var Q1=async($,X)=>{return{...$,body:await pS($.body,X)}},gJ=new WeakMap;function cS($){let X=typeof $==="function"?$:$.fetch,Y=gJ.get(X);if(Y)return Y;let U=(async()=>{try{let G="Response"in X?X.Response:(await X("data:,")).constructor,z=new FormData;if(z.toString()===await new G(z).text())return!1;return!0}catch{return!0}})();return gJ.set(X,U),U}var pS=async($,X)=>{if(!await cS(X))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let Y=new FormData;return await Promise.all(Object.entries($||{}).map(([U,G])=>lO(Y,U,G))),Y},dS=($)=>$ instanceof Blob&&("name"in $);var lO=async($,X,Y)=>{if(Y===void 0)return;if(Y==null)throw new TypeError(`Received null for "${X}"; to pass null in FormData, you must use the string 'null'`);if(typeof Y==="string"||typeof Y==="number"||typeof Y==="boolean")$.append(X,String(Y));else if(Y instanceof Response)$.append(X,LX([await Y.blob()],GG(Y)));else if(iO(Y))$.append(X,LX([await new Response(lU(Y)).blob()],GG(Y)));else if(dS(Y))$.append(X,Y,GG(Y));else if(Array.isArray(Y))await Promise.all(Y.map((U)=>lO($,X+"[]",U)));else if(typeof Y==="object")await Promise.all(Object.entries(Y).map(([U,G])=>lO($,`${X}[${U}]`,G)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${Y} instead`)};var yJ=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",lS=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&yJ($),rS=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";async function X7($,X,Y){if(rO(),$=await $,lS($)){if($ instanceof File)return $;return LX([await $.arrayBuffer()],$.name)}if(rS($)){let G=await $.blob();return X||(X=new URL($.url).pathname.split(/[\\/]/).pop()),LX(await oO(G),X,Y)}let U=await oO($);if(X||(X=GG($)),!Y?.type){let G=U.find((z)=>typeof z==="object"&&("type"in z)&&z.type);if(typeof G==="string")Y={...Y,type:G}}return LX(U,X,Y)}async function oO($){let X=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)X.push($);else if(yJ($))X.push($ instanceof Blob?$:await $.arrayBuffer());else if(iO($))for await(let Y of $)X.push(...await oO(Y));else{let Y=$?.constructor?.name;throw new Error(`Unexpected data type: ${typeof $}${Y?`; constructor: ${Y}`:""}${iS($)}`)}return X}function iS($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((Y)=>`"${Y}"`).join(", ")}]`}class u{constructor($){this._client=$}}function uJ($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var mJ=Object.freeze(Object.create(null)),nS=($=uJ)=>function X(Y,...U){if(Y.length===1)return Y[0];let G=!1,z=[],W=Y.reduce((V,O,w)=>{if(/[?#]/.test(O))G=!0;let D=U[w],E=(G?encodeURIComponent:$)(""+D);if(w!==U.length&&(D==null||typeof D==="object"&&D.toString===Object.getPrototypeOf(Object.getPrototypeOf(D.hasOwnProperty??mJ)??mJ)?.toString))E=D+"",z.push({start:V.length+O.length,length:E.length,error:`Value of type ${Object.prototype.toString.call(D).slice(8,-1)} is not a valid path parameter`});return V+O+(w===U.length?"":E)},""),Q=W.split(/[?#]/,1)[0],Z=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,H;while((H=Z.exec(Q))!==null)z.push({start:H.index,length:H[0].length,error:`Value "${H[0]}" can't be safely passed as a path parameter`});if(z.sort((V,O)=>V.start-O.start),z.length>0){let V=0,O=z.reduce((w,D)=>{let E=" ".repeat(D.start-V),F="^".repeat(D.length);return V=D.start+D.length,w+E+F},"");throw new G$(`Path parameters result in path with invalid segments:
|
|
109
109
|
${z.map((w)=>w.error).join(`
|
|
110
110
|
`)}
|
|
111
111
|
${W}
|
|
112
112
|
${O}`)}return W},g=nS(uJ);class KX extends u{list($,X={},Y){return this._client.getAPIList(g`/chat/completions/${$}/messages`,q$,{query:X,...Y})}}function UG($){return $!==void 0&&"function"in $&&$.function!==void 0}function zG($){return $?.$brand==="auto-parseable-response-format"}function O8($){return $?.$brand==="auto-parseable-tool"}function cJ($,X){if(!X||!nO(X))return{...$,choices:$.choices.map((Y)=>{return dJ(Y.message.tool_calls),{...Y,message:{...Y.message,parsed:null,...Y.message.tool_calls?{tool_calls:Y.message.tool_calls}:void 0}}})};return WG($,X)}function WG($,X){let Y=$.choices.map((U)=>{if(U.finish_reason==="length")throw new aY;if(U.finish_reason==="content_filter")throw new sY;return dJ(U.message.tool_calls),{...U,message:{...U.message,...U.message.tool_calls?{tool_calls:U.message.tool_calls?.map((G)=>eS(X,G))??void 0}:void 0,parsed:U.message.content&&!U.message.refusal?sS(X,U.message.content):null}}});return{...$,choices:Y}}function sS($,X){if($.response_format?.type!=="json_schema")return null;if($.response_format?.type==="json_schema"){if("$parseRaw"in $.response_format)return $.response_format.$parseRaw(X);return JSON.parse(X)}return null}function eS($,X){let Y=$.tools?.find((U)=>UG(U)&&U.function?.name===X.function.name);return{...X,function:{...X.function,parsed_arguments:O8(Y)?Y.$parseRaw(X.function.arguments):Y?.function.strict?JSON.parse(X.function.arguments):null}}}function pJ($,X){if(!$||!("tools"in $)||!$.tools)return!1;let Y=$.tools?.find((U)=>UG(U)&&U.function?.name===X.function.name);return UG(Y)&&(O8(Y)||Y?.function.strict||!1)}function nO($){if(zG($.response_format))return!0;return $.tools?.some((X)=>O8(X)||X.type==="function"&&X.function.strict===!0)??!1}function dJ($){for(let X of $||[])if(X.type!=="function")throw new G$(`Currently only \`function\` tool calls are supported; Received \`${X.type}\``)}function lJ($){for(let X of $??[]){if(X.type!=="function")throw new G$(`Currently only \`function\` tool types support auto-parsing; Received \`${X.type}\``);if(X.function.strict!==!0)throw new G$(`The \`${X.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var _X=($)=>{return $?.role==="assistant"},tO=($)=>{return $?.role==="tool"};var aO,Y7,G7,QG,ZG,U7,HG,k0,VG,z7,W7,qX,rJ;class w8{constructor(){aO.add(this),this.controller=new AbortController,Y7.set(this,void 0),G7.set(this,()=>{}),QG.set(this,()=>{}),ZG.set(this,void 0),U7.set(this,()=>{}),HG.set(this,()=>{}),k0.set(this,{}),VG.set(this,!1),z7.set(this,!1),W7.set(this,!1),qX.set(this,!1),Z$(this,Y7,new Promise(($,X)=>{Z$(this,G7,$,"f"),Z$(this,QG,X,"f")}),"f"),Z$(this,ZG,new Promise(($,X)=>{Z$(this,U7,$,"f"),Z$(this,HG,X,"f")}),"f"),B(this,Y7,"f").catch(()=>{}),B(this,ZG,"f").catch(()=>{})}_run($){setTimeout(()=>{$().then(()=>{this._emitFinal(),this._emit("end")},B(this,aO,"m",rJ).bind(this))},0)}_connected(){if(this.ended)return;B(this,G7,"f").call(this),this._emit("connect")}get ended(){return B(this,VG,"f")}get errored(){return B(this,z7,"f")}get aborted(){return B(this,W7,"f")}abort(){this.controller.abort()}on($,X){return(B(this,k0,"f")[$]||(B(this,k0,"f")[$]=[])).push({listener:X}),this}off($,X){let Y=B(this,k0,"f")[$];if(!Y)return this;let U=Y.findIndex((G)=>G.listener===X);if(U>=0)Y.splice(U,1);return this}once($,X){return(B(this,k0,"f")[$]||(B(this,k0,"f")[$]=[])).push({listener:X,once:!0}),this}emitted($){return new Promise((X,Y)=>{if(Z$(this,qX,!0,"f"),$!=="error")this.once("error",Y);this.once($,X)})}async done(){Z$(this,qX,!0,"f"),await B(this,ZG,"f")}_emit($,...X){if(B(this,VG,"f"))return;if($==="end")Z$(this,VG,!0,"f"),B(this,U7,"f").call(this);let Y=B(this,k0,"f")[$];if(Y)B(this,k0,"f")[$]=Y.filter((U)=>!U.once),Y.forEach(({listener:U})=>U(...X));if($==="abort"){let U=X[0];if(!B(this,qX,"f")&&!Y?.length)Promise.reject(U);B(this,QG,"f").call(this,U),B(this,HG,"f").call(this,U),this._emit("end");return}if($==="error"){let U=X[0];if(!B(this,qX,"f")&&!Y?.length)Promise.reject(U);B(this,QG,"f").call(this,U),B(this,HG,"f").call(this,U),this._emit("end")}}_emitFinal(){}}Y7=new WeakMap,G7=new WeakMap,QG=new WeakMap,ZG=new WeakMap,U7=new WeakMap,HG=new WeakMap,k0=new WeakMap,VG=new WeakMap,z7=new WeakMap,W7=new WeakMap,qX=new WeakMap,aO=new WeakSet,rJ=function $(X){if(Z$(this,z7,!0,"f"),X instanceof Error&&X.name==="AbortError")X=new k4;if(X instanceof k4)return Z$(this,W7,!0,"f"),this._emit("abort",X);if(X instanceof G$)return this._emit("error",X);if(X instanceof Error){let Y=new G$(X.message);return Y.cause=X,this._emit("error",Y)}return this._emit("error",new G$(String(X)))};function iJ($){return typeof $.parse==="function"}var F6,sO,Q7,eO,$w,Xw,oJ,nJ,$k=10;class OG extends w8{constructor(){super(...arguments);F6.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion($){this._chatCompletions.push($),this._emit("chatCompletion",$);let X=$.choices[0]?.message;if(X)this._addMessage(X);return $}_addMessage($,X=!0){if(!("content"in $))$.content=null;if(this.messages.push($),X){if(this._emit("message",$),tO($)&&$.content)this._emit("functionToolCallResult",$.content);else if(_X($)&&$.tool_calls){for(let Y of $.tool_calls)if(Y.type==="function")this._emit("functionToolCall",Y.function)}}}async finalChatCompletion(){await this.done();let $=this._chatCompletions[this._chatCompletions.length-1];if(!$)throw new G$("stream ended without producing a ChatCompletion");return $}async finalContent(){return await this.done(),B(this,F6,"m",sO).call(this)}async finalMessage(){return await this.done(),B(this,F6,"m",Q7).call(this)}async finalFunctionToolCall(){return await this.done(),B(this,F6,"m",eO).call(this)}async finalFunctionToolCallResult(){return await this.done(),B(this,F6,"m",$w).call(this)}async totalUsage(){return await this.done(),B(this,F6,"m",Xw).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let $=this._chatCompletions[this._chatCompletions.length-1];if($)this._emit("finalChatCompletion",$);let X=B(this,F6,"m",Q7).call(this);if(X)this._emit("finalMessage",X);let Y=B(this,F6,"m",sO).call(this);if(Y)this._emit("finalContent",Y);let U=B(this,F6,"m",eO).call(this);if(U)this._emit("finalFunctionToolCall",U);let G=B(this,F6,"m",$w).call(this);if(G!=null)this._emit("finalFunctionToolCallResult",G);if(this._chatCompletions.some((z)=>z.usage))this._emit("totalUsage",B(this,F6,"m",Xw).call(this))}async _createChatCompletion($,X,Y){let U=Y?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}B(this,F6,"m",oJ).call(this,X);let G=await $.chat.completions.create({...X,stream:!1},{...Y,signal:this.controller.signal});return this._connected(),this._addChatCompletion(WG(G,X))}async _runChatCompletion($,X,Y){for(let U of X.messages)this._addMessage(U,!1);return await this._createChatCompletion($,X,Y)}async _runTools($,X,Y){let{tool_choice:G="auto",stream:z,...W}=X,Q=typeof G!=="string"&&G.type==="function"&&G?.function?.name,{maxChatCompletions:Z=$k}=Y||{},H=X.tools.map((w)=>{if(O8(w)){if(!w.$callback)throw new G$("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:w.$callback,name:w.function.name,description:w.function.description||"",parameters:w.function.parameters,parse:w.$parseRaw,strict:!0}}}return w}),V={};for(let w of H)if(w.type==="function")V[w.function.name||w.function.function.name]=w.function;let O="tools"in X?H.map((w)=>w.type==="function"?{type:"function",function:{name:w.function.name||w.function.function.name,parameters:w.function.parameters,description:w.function.description,strict:w.function.strict}}:w):void 0;for(let w of X.messages)this._addMessage(w,!1);for(let w=0;w<Z;++w){let E=(await this._createChatCompletion($,{...W,tool_choice:G,tools:O,messages:[...this.messages]},Y)).choices[0]?.message;if(!E)throw new G$("missing message in ChatCompletion response");if(!E.tool_calls?.length)return;for(let F of E.tool_calls){if(F.type!=="function")continue;let J=F.id,{name:A,arguments:L}=F.function,T=V[A];if(!T){let S=`Invalid tool_call: ${JSON.stringify(A)}. Available options are: ${Object.keys(V).map((y)=>JSON.stringify(y)).join(", ")}. Please try again`;this._addMessage({role:"tool",tool_call_id:J,content:S});continue}else if(Q&&Q!==A){let S=`Invalid tool_call: ${JSON.stringify(A)}. ${JSON.stringify(Q)} requested. Please try again`;this._addMessage({role:"tool",tool_call_id:J,content:S});continue}let q;try{q=iJ(T)?await T.parse(L):L}catch(S){let y=S instanceof Error?S.message:String(S);this._addMessage({role:"tool",tool_call_id:J,content:y});continue}let v=await T.function(q,this),I=B(this,F6,"m",nJ).call(this,v);if(this._addMessage({role:"tool",tool_call_id:J,content:I}),Q)return}}return}}F6=new WeakSet,sO=function $(){return B(this,F6,"m",Q7).call(this).content??null},Q7=function $(){let X=this.messages.length;while(X-- >0){let Y=this.messages[X];if(_X(Y))return{...Y,content:Y.content??null,refusal:Y.refusal??null}}throw new G$("stream ended without producing a ChatCompletionMessage with role=assistant")},eO=function $(){for(let X=this.messages.length-1;X>=0;X--){let Y=this.messages[X];if(_X(Y)&&Y?.tool_calls?.length)return Y.tool_calls.filter((U)=>U.type==="function").at(-1)?.function}return},$w=function $(){for(let X=this.messages.length-1;X>=0;X--){let Y=this.messages[X];if(tO(Y)&&Y.content!=null&&typeof Y.content==="string"&&this.messages.some((U)=>U.role==="assistant"&&U.tool_calls?.some((G)=>G.type==="function"&&G.id===Y.tool_call_id)))return Y.content}return},Xw=function $(){let X={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:Y}of this._chatCompletions)if(Y)X.completion_tokens+=Y.completion_tokens,X.prompt_tokens+=Y.prompt_tokens,X.total_tokens+=Y.total_tokens;return X},oJ=function $(X){if(X.n!=null&&X.n>1)throw new G$("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},nJ=function $(X){return typeof X==="string"?X:X===void 0?"undefined":JSON.stringify(X)};class wG extends OG{static runTools($,X,Y){let U=new wG,G={...Y,headers:{...Y?.headers,"X-Stainless-Helper-Method":"runTools"}};return U._run(()=>U._runTools($,X,G)),U}_addMessage($,X=!0){if(super._addMessage($,X),_X($)&&$.content)this._emit("content",$.content)}}var d4={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511};class tJ extends Error{}class aJ extends Error{}function Xk($,X=d4.ALL){if(typeof $!=="string")throw new TypeError(`expecting str, got ${typeof $}`);if(!$.trim())throw new Error(`${$} is empty`);return Yk($.trim(),X)}var Yk=($,X)=>{let Y=$.length,U=0,G=(w)=>{throw new tJ(`${w} at position ${U}`)},z=(w)=>{throw new aJ(`${w} at position ${U}`)},W=()=>{if(O(),U>=Y)G("Unexpected end of input");if($[U]==='"')return Q();if($[U]==="{")return Z();if($[U]==="[")return H();if($.substring(U,U+4)==="null"||d4.NULL&X&&Y-U<4&&"null".startsWith($.substring(U)))return U+=4,null;if($.substring(U,U+4)==="true"||d4.BOOL&X&&Y-U<4&&"true".startsWith($.substring(U)))return U+=4,!0;if($.substring(U,U+5)==="false"||d4.BOOL&X&&Y-U<5&&"false".startsWith($.substring(U)))return U+=5,!1;if($.substring(U,U+8)==="Infinity"||d4.INFINITY&X&&Y-U<8&&"Infinity".startsWith($.substring(U)))return U+=8,1/0;if($.substring(U,U+9)==="-Infinity"||d4.MINUS_INFINITY&X&&1<Y-U&&Y-U<9&&"-Infinity".startsWith($.substring(U)))return U+=9,-1/0;if($.substring(U,U+3)==="NaN"||d4.NAN&X&&Y-U<3&&"NaN".startsWith($.substring(U)))return U+=3,NaN;return V()},Q=()=>{let w=U,D=!1;U++;while(U<Y&&($[U]!=='"'||D&&$[U-1]==="\\"))D=$[U]==="\\"?!D:!1,U++;if($.charAt(U)=='"')try{return JSON.parse($.substring(w,++U-Number(D)))}catch(E){z(String(E))}else if(d4.STR&X)try{return JSON.parse($.substring(w,U-Number(D))+'"')}catch(E){return JSON.parse($.substring(w,$.lastIndexOf("\\"))+'"')}G("Unterminated string literal")},Z=()=>{U++,O();let w={};try{while($[U]!=="}"){if(O(),U>=Y&&d4.OBJ&X)return w;let D=Q();O(),U++;try{let E=W();Object.defineProperty(w,D,{value:E,writable:!0,enumerable:!0,configurable:!0})}catch(E){if(d4.OBJ&X)return w;else throw E}if(O(),$[U]===",")U++}}catch(D){if(d4.OBJ&X)return w;else G("Expected '}' at end of object")}return U++,w},H=()=>{U++;let w=[];try{while($[U]!=="]")if(w.push(W()),O(),$[U]===",")U++}catch(D){if(d4.ARR&X)return w;G("Expected ']' at end of array")}return U++,w},V=()=>{if(U===0){if($==="-"&&d4.NUM&X)G("Not sure what '-' is");try{return JSON.parse($)}catch(D){if(d4.NUM&X)try{if($[$.length-1]===".")return JSON.parse($.substring(0,$.lastIndexOf(".")));return JSON.parse($.substring(0,$.lastIndexOf("e")))}catch(E){}z(String(D))}}let w=U;if($[U]==="-")U++;while($[U]&&!",]}".includes($[U]))U++;if(U==Y&&!(d4.NUM&X))G("Unterminated number literal");try{return JSON.parse($.substring(w,U))}catch(D){if($.substring(w,U)==="-"&&d4.NUM&X)G("Not sure what '-' is");try{return JSON.parse($.substring(w,$.lastIndexOf("e")))}catch(E){z(String(E))}}},O=()=>{while(U<Y&&`
|
|
113
|
-
\r `.includes($[U]))U++};return W()},Yw=($)=>Xk($,d4.ALL^d4.NUM);var f4,b0,RX,M2,Gw,Z7,Uw,zw,Ww,H7,Qw,sJ;class J2 extends OG{constructor($){super();f4.add(this),b0.set(this,void 0),RX.set(this,void 0),M2.set(this,void 0),Z$(this,b0,$,"f"),Z$(this,RX,[],"f")}get currentChatCompletionSnapshot(){return B(this,M2,"f")}static fromReadableStream($){let X=new J2(null);return X._run(()=>X._fromReadableStream($)),X}static createChatCompletion($,X,Y){let U=new J2(X);return U._run(()=>U._runChatCompletion($,{...X,stream:!0},{...Y,headers:{...Y?.headers,"X-Stainless-Helper-Method":"stream"}})),U}async _createChatCompletion($,X,Y){super._createChatCompletion;let U=Y?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}B(this,f4,"m",Gw).call(this);let G=await $.chat.completions.create({...X,stream:!0},{...Y,signal:this.controller.signal});this._connected();for await(let z of G)B(this,f4,"m",Uw).call(this,z);if(G.controller.signal?.aborted)throw new k4;return this._addChatCompletion(B(this,f4,"m",H7).call(this))}async _fromReadableStream($,X){let Y=X?.signal;if(Y){if(Y.aborted)this.controller.abort();Y.addEventListener("abort",()=>this.controller.abort())}B(this,f4,"m",Gw).call(this),this._connected();let U=
|
|
113
|
+
\r `.includes($[U]))U++};return W()},Yw=($)=>Xk($,d4.ALL^d4.NUM);var f4,b0,RX,M2,Gw,Z7,Uw,zw,Ww,H7,Qw,sJ;class J2 extends OG{constructor($){super();f4.add(this),b0.set(this,void 0),RX.set(this,void 0),M2.set(this,void 0),Z$(this,b0,$,"f"),Z$(this,RX,[],"f")}get currentChatCompletionSnapshot(){return B(this,M2,"f")}static fromReadableStream($){let X=new J2(null);return X._run(()=>X._fromReadableStream($)),X}static createChatCompletion($,X,Y){let U=new J2(X);return U._run(()=>U._runChatCompletion($,{...X,stream:!0},{...Y,headers:{...Y?.headers,"X-Stainless-Helper-Method":"stream"}})),U}async _createChatCompletion($,X,Y){super._createChatCompletion;let U=Y?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}B(this,f4,"m",Gw).call(this);let G=await $.chat.completions.create({...X,stream:!0},{...Y,signal:this.controller.signal});this._connected();for await(let z of G)B(this,f4,"m",Uw).call(this,z);if(G.controller.signal?.aborted)throw new k4;return this._addChatCompletion(B(this,f4,"m",H7).call(this))}async _fromReadableStream($,X){let Y=X?.signal;if(Y){if(Y.aborted)this.controller.abort();Y.addEventListener("abort",()=>this.controller.abort())}B(this,f4,"m",Gw).call(this),this._connected();let U=W1.fromReadableStream($,this.controller),G;for await(let z of U){if(G&&G!==z.id)this._addChatCompletion(B(this,f4,"m",H7).call(this));B(this,f4,"m",Uw).call(this,z),G=z.id}if(U.controller.signal?.aborted)throw new k4;return this._addChatCompletion(B(this,f4,"m",H7).call(this))}[(b0=new WeakMap,RX=new WeakMap,M2=new WeakMap,f4=new WeakSet,Gw=function $(){if(this.ended)return;Z$(this,M2,void 0,"f")},Z7=function $(X){let Y=B(this,RX,"f")[X.index];if(Y)return Y;return Y={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},B(this,RX,"f")[X.index]=Y,Y},Uw=function $(X){if(this.ended)return;let Y=B(this,f4,"m",sJ).call(this,X);this._emit("chunk",X,Y);for(let U of X.choices){let G=Y.choices[U.index];if(U.delta.content!=null&&G.message?.role==="assistant"&&G.message?.content)this._emit("content",U.delta.content,G.message.content),this._emit("content.delta",{delta:U.delta.content,snapshot:G.message.content,parsed:G.message.parsed});if(U.delta.refusal!=null&&G.message?.role==="assistant"&&G.message?.refusal)this._emit("refusal.delta",{delta:U.delta.refusal,snapshot:G.message.refusal});if(U.logprobs?.content!=null&&G.message?.role==="assistant")this._emit("logprobs.content.delta",{content:U.logprobs?.content,snapshot:G.logprobs?.content??[]});if(U.logprobs?.refusal!=null&&G.message?.role==="assistant")this._emit("logprobs.refusal.delta",{refusal:U.logprobs?.refusal,snapshot:G.logprobs?.refusal??[]});let z=B(this,f4,"m",Z7).call(this,G);if(G.finish_reason){if(B(this,f4,"m",Ww).call(this,G),z.current_tool_call_index!=null)B(this,f4,"m",zw).call(this,G,z.current_tool_call_index)}for(let W of U.delta.tool_calls??[]){if(z.current_tool_call_index!==W.index){if(B(this,f4,"m",Ww).call(this,G),z.current_tool_call_index!=null)B(this,f4,"m",zw).call(this,G,z.current_tool_call_index)}z.current_tool_call_index=W.index}for(let W of U.delta.tool_calls??[]){let Q=G.message.tool_calls?.[W.index];if(!Q?.type)continue;if(Q?.type==="function")this._emit("tool_calls.function.arguments.delta",{name:Q.function?.name,index:W.index,arguments:Q.function.arguments,parsed_arguments:Q.function.parsed_arguments,arguments_delta:W.function?.arguments??""});else $A(Q?.type)}}},zw=function $(X,Y){if(B(this,f4,"m",Z7).call(this,X).done_tool_calls.has(Y))return;let G=X.message.tool_calls?.[Y];if(!G)throw new Error("no tool call snapshot");if(!G.type)throw new Error("tool call snapshot missing `type`");if(G.type==="function"){let z=B(this,b0,"f")?.tools?.find((W)=>UG(W)&&W.function.name===G.function.name);this._emit("tool_calls.function.arguments.done",{name:G.function.name,index:Y,arguments:G.function.arguments,parsed_arguments:O8(z)?z.$parseRaw(G.function.arguments):z?.function.strict?JSON.parse(G.function.arguments):null})}else $A(G.type)},Ww=function $(X){let Y=B(this,f4,"m",Z7).call(this,X);if(X.message.content&&!Y.content_done){Y.content_done=!0;let U=B(this,f4,"m",Qw).call(this);this._emit("content.done",{content:X.message.content,parsed:U?U.$parseRaw(X.message.content):null})}if(X.message.refusal&&!Y.refusal_done)Y.refusal_done=!0,this._emit("refusal.done",{refusal:X.message.refusal});if(X.logprobs?.content&&!Y.logprobs_content_done)Y.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:X.logprobs.content});if(X.logprobs?.refusal&&!Y.logprobs_refusal_done)Y.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:X.logprobs.refusal})},H7=function $(){if(this.ended)throw new G$("stream has ended, this shouldn't happen");let X=B(this,M2,"f");if(!X)throw new G$("request ended without sending any chunks");return Z$(this,M2,void 0,"f"),Z$(this,RX,[],"f"),Gk(X,B(this,b0,"f"))},Qw=function $(){let X=B(this,b0,"f")?.response_format;if(zG(X))return X;return null},sJ=function $(X){var Y,U,G,z;let W=B(this,M2,"f"),{choices:Q,...Z}=X;if(!W)W=Z$(this,M2,{...Z,choices:[]},"f");else Object.assign(W,Z);for(let{delta:H,finish_reason:V,index:O,logprobs:w=null,...D}of X.choices){let E=W.choices[O];if(!E)E=W.choices[O]={finish_reason:V,index:O,message:{},logprobs:w,...D};if(w)if(!E.logprobs)E.logprobs=Object.assign({},w);else{let{content:v,refusal:I,...S}=w;if(eJ(S),Object.assign(E.logprobs,S),v)(Y=E.logprobs).content??(Y.content=[]),E.logprobs.content.push(...v);if(I)(U=E.logprobs).refusal??(U.refusal=[]),E.logprobs.refusal.push(...I)}if(V){if(E.finish_reason=V,B(this,b0,"f")&&nO(B(this,b0,"f"))){if(V==="length")throw new aY;if(V==="content_filter")throw new sY}}if(Object.assign(E,D),!H)continue;let{content:F,refusal:J,function_call:A,role:L,tool_calls:T,...q}=H;if(eJ(q),Object.assign(E.message,q),J)E.message.refusal=(E.message.refusal||"")+J;if(L)E.message.role=L;if(A)if(!E.message.function_call)E.message.function_call=A;else{if(A.name)E.message.function_call.name=A.name;if(A.arguments)(G=E.message.function_call).arguments??(G.arguments=""),E.message.function_call.arguments+=A.arguments}if(F){if(E.message.content=(E.message.content||"")+F,!E.message.refusal&&B(this,f4,"m",Qw).call(this))E.message.parsed=Yw(E.message.content)}if(T){if(!E.message.tool_calls)E.message.tool_calls=[];for(let{index:v,id:I,type:S,function:y,...r}of T){let j=(z=E.message.tool_calls)[v]??(z[v]={});if(Object.assign(j,r),I)j.id=I;if(S)j.type=S;if(y)j.function??(j.function={name:y.name??"",arguments:""});if(y?.name)j.function.name=y.name;if(y?.arguments){if(j.function.arguments+=y.arguments,pJ(B(this,b0,"f"),j))j.function.parsed_arguments=Yw(j.function.arguments)}}}}return W},Symbol.asyncIterator)](){let $=[],X=[],Y=!1;return this.on("chunk",(U)=>{let G=X.shift();if(G)G.resolve(U);else $.push(U)}),this.on("end",()=>{Y=!0;for(let U of X)U.resolve(void 0);X.length=0}),this.on("abort",(U)=>{Y=!0;for(let G of X)G.reject(U);X.length=0}),this.on("error",(U)=>{Y=!0;for(let G of X)G.reject(U);X.length=0}),{next:async()=>{if(!$.length){if(Y)return{value:void 0,done:!0};return new Promise((G,z)=>X.push({resolve:G,reject:z})).then((G)=>G?{value:G,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new W1(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function Gk($,X){let{id:Y,choices:U,created:G,model:z,system_fingerprint:W,...Q}=$,Z={...Q,id:Y,choices:U.map(({message:H,finish_reason:V,index:O,logprobs:w,...D})=>{if(!V)throw new G$(`missing finish_reason for choice ${O}`);let{content:E=null,function_call:F,tool_calls:J,...A}=H,L=H.role;if(!L)throw new G$(`missing role for choice ${O}`);if(F){let{arguments:T,name:q}=F;if(T==null)throw new G$(`missing function_call.arguments for choice ${O}`);if(!q)throw new G$(`missing function_call.name for choice ${O}`);return{...D,message:{content:E,function_call:{arguments:T,name:q},role:L,refusal:H.refusal??null},finish_reason:V,index:O,logprobs:w}}if(J)return{...D,index:O,finish_reason:V,logprobs:w,message:{...A,role:L,content:E,refusal:H.refusal??null,tool_calls:J.map((T,q)=>{let{function:v,type:I,id:S,...y}=T,{arguments:r,name:j,...X$}=v||{};if(S==null)throw new G$(`missing choices[${O}].tool_calls[${q}].id
|
|
114
114
|
${V7($)}`);if(I==null)throw new G$(`missing choices[${O}].tool_calls[${q}].type
|
|
115
115
|
${V7($)}`);if(j==null)throw new G$(`missing choices[${O}].tool_calls[${q}].function.name
|
|
116
116
|
${V7($)}`);if(r==null)throw new G$(`missing choices[${O}].tool_calls[${q}].function.arguments
|
|
117
|
-
${V7($)}`);return{...y,id:S,type:I,function:{...X$,name:j,arguments:r}}})}};return{...D,message:{...A,content:E,role:L,refusal:H.refusal??null},finish_reason:V,index:O,logprobs:w}}),created:G,model:z,object:"chat.completion",...W?{system_fingerprint:W}:{}};return cJ(Z,X)}function V7($){return JSON.stringify($)}function eJ($){return}function $A($){}class TX extends J2{static fromReadableStream($){let X=new TX(null);return X._run(()=>X._fromReadableStream($)),X}static runTools($,X,Y){let U=new TX(X),G={...Y,headers:{...Y?.headers,"X-Stainless-Helper-Method":"runTools"}};return U._run(()=>U._runTools($,X,G)),U}}class A2 extends u{constructor(){super(...arguments);this.messages=new KX(this._client)}create($,X){return this._client.post("/chat/completions",{body:$,...X,stream:$.stream??!1})}retrieve($,X){return this._client.get(g`/chat/completions/${$}`,X)}update($,X,Y){return this._client.post(g`/chat/completions/${$}`,{body:X,...Y})}list($={},X){return this._client.getAPIList("/chat/completions",q$,{query:$,...X})}delete($,X){return this._client.delete(g`/chat/completions/${$}`,X)}parse($,X){return lJ($.tools),this._client.chat.completions.create($,{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap((Y)=>WG(Y,$))}runTools($,X){if($.stream)return TX.runTools(this._client,$,X);return wG.runTools(this._client,$,X)}stream($,X){return J2.createChatCompletion(this._client,$,X)}}A2.Messages=KX;class D8 extends u{constructor(){super(...arguments);this.completions=new A2(this._client)}}D8.Completions=A2;var XA=Symbol("brand.privateNullableHeaders");function*zk($){if(!$)return;if(XA in $){let{values:U,nulls:G}=$;yield*U.entries();for(let z of G)yield[z,null];return}let X=!1,Y;if($ instanceof Headers)Y=$.entries();else if(IO($))Y=$;else X=!0,Y=Object.entries($??{});for(let U of Y){let G=U[0];if(typeof G!=="string")throw new TypeError("expected header name to be a string");let z=IO(U[1])?U[1]:[U[1]],W=!1;for(let Q of z){if(Q===void 0)continue;if(X&&!W)W=!0,yield[G,null];yield[G,Q]}}}var e=($)=>{let X=new Headers,Y=new Set;for(let U of $){let G=new Set;for(let[z,W]of zk(U)){let Q=z.toLowerCase();if(!G.has(Q))X.delete(z),G.add(Q);if(W===null)X.delete(z),Y.add(Q);else X.append(z,W),Y.delete(Q)}}return{[XA]:!0,values:X,nulls:Y}};class DG extends u{create($,X){return this._client.post("/audio/speech",{body:$,...X,headers:e([{Accept:"application/octet-stream"},X?.headers]),__binaryResponse:!0})}}class EG extends u{create($,X){return this._client.post("/audio/transcriptions",W1({body:$,...X,stream:$.stream??!1,__metadata:{model:$.model}},this._client))}}class NG extends u{create($,X){return this._client.post("/audio/translations",W1({body:$,...X,__metadata:{model:$.model}},this._client))}}class f0 extends u{constructor(){super(...arguments);this.transcriptions=new EG(this._client),this.translations=new NG(this._client),this.speech=new DG(this._client)}}f0.Transcriptions=EG;f0.Translations=NG;f0.Speech=DG;class vX extends u{create($,X){return this._client.post("/batches",{body:$,...X})}retrieve($,X){return this._client.get(g`/batches/${$}`,X)}list($={},X){return this._client.getAPIList("/batches",q$,{query:$,...X})}cancel($,X){return this._client.post(g`/batches/${$}/cancel`,X)}}class FG extends u{create($,X){return this._client.post("/assistants",{body:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}retrieve($,X){return this._client.get(g`/assistants/${$}`,{...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}update($,X,Y){return this._client.post(g`/assistants/${$}`,{body:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}list($={},X){return this._client.getAPIList("/assistants",q$,{query:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}delete($,X){return this._client.delete(g`/assistants/${$}`,{...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}}class MG extends u{create($,X){return this._client.post("/realtime/sessions",{body:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}}class JG extends u{create($,X){return this._client.post("/realtime/transcription_sessions",{body:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}}class E8 extends u{constructor(){super(...arguments);this.sessions=new MG(this._client),this.transcriptionSessions=new JG(this._client)}}E8.Sessions=MG;E8.TranscriptionSessions=JG;class AG extends u{create($,X,Y){return this._client.post(g`/threads/${$}/messages`,{body:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}retrieve($,X,Y){let{thread_id:U}=X;return this._client.get(g`/threads/${U}/messages/${$}`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}update($,X,Y){let{thread_id:U,...G}=X;return this._client.post(g`/threads/${U}/messages/${$}`,{body:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}list($,X={},Y){return this._client.getAPIList(g`/threads/${$}/messages`,q$,{query:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}delete($,X,Y){let{thread_id:U}=X;return this._client.delete(g`/threads/${U}/messages/${$}`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}}class LG extends u{retrieve($,X,Y){let{thread_id:U,run_id:G,...z}=X;return this._client.get(g`/threads/${U}/runs/${G}/steps/${$}`,{query:z,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}list($,X,Y){let{thread_id:U,...G}=X;return this._client.getAPIList(g`/threads/${U}/runs/${$}/steps`,q$,{query:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}}var YA=($)=>{if(typeof Buffer!=="undefined"){let X=Buffer.from($,"base64");return Array.from(new Float32Array(X.buffer,X.byteOffset,X.length/Float32Array.BYTES_PER_ELEMENT))}else{let X=atob($),Y=X.length,U=new Uint8Array(Y);for(let G=0;G<Y;G++)U[G]=X.charCodeAt(G);return Array.from(new Float32Array(U.buffer))}};var L2=($)=>{if(typeof globalThis.process!=="undefined")return globalThis.process.env?.[$]?.trim()??void 0;if(typeof globalThis.Deno!=="undefined")return globalThis.Deno.env?.get?.($)?.trim();return};var t4,F8,Zw,Y0,O7,g1,M8,CX,N8,E7,Q1,w7,D7,qG,KG,_G,GA,UA,zA,WA,QA,ZA,HA;class K2 extends w8{constructor(){super(...arguments);t4.add(this),Zw.set(this,[]),Y0.set(this,{}),O7.set(this,{}),g1.set(this,void 0),M8.set(this,void 0),CX.set(this,void 0),N8.set(this,void 0),E7.set(this,void 0),Q1.set(this,void 0),w7.set(this,void 0),D7.set(this,void 0),qG.set(this,void 0)}[(Zw=new WeakMap,Y0=new WeakMap,O7=new WeakMap,g1=new WeakMap,M8=new WeakMap,CX=new WeakMap,N8=new WeakMap,E7=new WeakMap,Q1=new WeakMap,w7=new WeakMap,D7=new WeakMap,qG=new WeakMap,t4=new WeakSet,Symbol.asyncIterator)](){let $=[],X=[],Y=!1;return this.on("event",(U)=>{let G=X.shift();if(G)G.resolve(U);else $.push(U)}),this.on("end",()=>{Y=!0;for(let U of X)U.resolve(void 0);X.length=0}),this.on("abort",(U)=>{Y=!0;for(let G of X)G.reject(U);X.length=0}),this.on("error",(U)=>{Y=!0;for(let G of X)G.reject(U);X.length=0}),{next:async()=>{if(!$.length){if(Y)return{value:void 0,done:!0};return new Promise((G,z)=>X.push({resolve:G,reject:z})).then((G)=>G?{value:G,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}static fromReadableStream($){let X=new F8;return X._run(()=>X._fromReadableStream($)),X}async _fromReadableStream($,X){let Y=X?.signal;if(Y){if(Y.aborted)this.controller.abort();Y.addEventListener("abort",()=>this.controller.abort())}this._connected();let U=z1.fromReadableStream($,this.controller);for await(let G of U)B(this,t4,"m",KG).call(this,G);if(U.controller.signal?.aborted)throw new k4;return this._addRun(B(this,t4,"m",_G).call(this))}toReadableStream(){return new z1(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream($,X,Y,U){let G=new F8;return G._run(()=>G._runToolAssistantStream($,X,Y,{...U,headers:{...U?.headers,"X-Stainless-Helper-Method":"stream"}})),G}async _createToolAssistantStream($,X,Y,U){let G=U?.signal;if(G){if(G.aborted)this.controller.abort();G.addEventListener("abort",()=>this.controller.abort())}let z={...Y,stream:!0},W=await $.submitToolOutputs(X,z,{...U,signal:this.controller.signal});this._connected();for await(let Q of W)B(this,t4,"m",KG).call(this,Q);if(W.controller.signal?.aborted)throw new k4;return this._addRun(B(this,t4,"m",_G).call(this))}static createThreadAssistantStream($,X,Y){let U=new F8;return U._run(()=>U._threadAssistantStream($,X,{...Y,headers:{...Y?.headers,"X-Stainless-Helper-Method":"stream"}})),U}static createAssistantStream($,X,Y,U){let G=new F8;return G._run(()=>G._runAssistantStream($,X,Y,{...U,headers:{...U?.headers,"X-Stainless-Helper-Method":"stream"}})),G}currentEvent(){return B(this,w7,"f")}currentRun(){return B(this,D7,"f")}currentMessageSnapshot(){return B(this,g1,"f")}currentRunStepSnapshot(){return B(this,qG,"f")}async finalRunSteps(){return await this.done(),Object.values(B(this,Y0,"f"))}async finalMessages(){return await this.done(),Object.values(B(this,O7,"f"))}async finalRun(){if(await this.done(),!B(this,M8,"f"))throw Error("Final run was not received.");return B(this,M8,"f")}async _createThreadAssistantStream($,X,Y){let U=Y?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}let G={...X,stream:!0},z=await $.createAndRun(G,{...Y,signal:this.controller.signal});this._connected();for await(let W of z)B(this,t4,"m",KG).call(this,W);if(z.controller.signal?.aborted)throw new k4;return this._addRun(B(this,t4,"m",_G).call(this))}async _createAssistantStream($,X,Y,U){let G=U?.signal;if(G){if(G.aborted)this.controller.abort();G.addEventListener("abort",()=>this.controller.abort())}let z={...Y,stream:!0},W=await $.create(X,z,{...U,signal:this.controller.signal});this._connected();for await(let Q of W)B(this,t4,"m",KG).call(this,Q);if(W.controller.signal?.aborted)throw new k4;return this._addRun(B(this,t4,"m",_G).call(this))}static accumulateDelta($,X){for(let[Y,U]of Object.entries(X)){if(!$.hasOwnProperty(Y)){$[Y]=U;continue}let G=$[Y];if(G===null||G===void 0){$[Y]=U;continue}if(Y==="index"||Y==="type"){$[Y]=U;continue}if(typeof G==="string"&&typeof U==="string")G+=U;else if(typeof G==="number"&&typeof U==="number")G+=U;else if(eY(G)&&eY(U))G=this.accumulateDelta(G,U);else if(Array.isArray(G)&&Array.isArray(U)){if(G.every((z)=>typeof z==="string"||typeof z==="number")){G.push(...U);continue}for(let z of U){if(!eY(z))throw new Error(`Expected array delta entry to be an object but got: ${z}`);let W=z.index;if(W==null)throw console.error(z),new Error("Expected array delta entry to have an `index` property");if(typeof W!=="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${W}`);let Q=G[W];if(Q==null)G.push(z);else G[W]=this.accumulateDelta(Q,z)}continue}else throw Error(`Unhandled record type: ${Y}, deltaValue: ${U}, accValue: ${G}`);$[Y]=G}return $}_addRun($){return $}async _threadAssistantStream($,X,Y){return await this._createThreadAssistantStream(X,$,Y)}async _runAssistantStream($,X,Y,U){return await this._createAssistantStream(X,$,Y,U)}async _runToolAssistantStream($,X,Y,U){return await this._createToolAssistantStream(X,$,Y,U)}}F8=K2,KG=function $(X){if(this.ended)return;switch(Z$(this,w7,X,"f"),B(this,t4,"m",zA).call(this,X),X.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":B(this,t4,"m",HA).call(this,X);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":B(this,t4,"m",UA).call(this,X);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":B(this,t4,"m",GA).call(this,X);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:Nk(X)}},_G=function $(){if(this.ended)throw new G$("stream has ended, this shouldn't happen");if(!B(this,M8,"f"))throw Error("Final run has not been received");return B(this,M8,"f")},GA=function $(X){let[Y,U]=B(this,t4,"m",QA).call(this,X,B(this,g1,"f"));Z$(this,g1,Y,"f"),B(this,O7,"f")[Y.id]=Y;for(let G of U){let z=Y.content[G.index];if(z?.type=="text")this._emit("textCreated",z.text)}switch(X.event){case"thread.message.created":this._emit("messageCreated",X.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",X.data.delta,Y),X.data.delta.content)for(let G of X.data.delta.content){if(G.type=="text"&&G.text){let z=G.text,W=Y.content[G.index];if(W&&W.type=="text")this._emit("textDelta",z,W.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(G.index!=B(this,CX,"f")){if(B(this,N8,"f"))switch(B(this,N8,"f").type){case"text":this._emit("textDone",B(this,N8,"f").text,B(this,g1,"f"));break;case"image_file":this._emit("imageFileDone",B(this,N8,"f").image_file,B(this,g1,"f"));break}Z$(this,CX,G.index,"f")}Z$(this,N8,Y.content[G.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(B(this,CX,"f")!==void 0){let G=X.data.content[B(this,CX,"f")];if(G)switch(G.type){case"image_file":this._emit("imageFileDone",G.image_file,B(this,g1,"f"));break;case"text":this._emit("textDone",G.text,B(this,g1,"f"));break}}if(B(this,g1,"f"))this._emit("messageDone",X.data);Z$(this,g1,void 0,"f")}},UA=function $(X){let Y=B(this,t4,"m",WA).call(this,X);switch(Z$(this,qG,Y,"f"),X.event){case"thread.run.step.created":this._emit("runStepCreated",X.data);break;case"thread.run.step.delta":let U=X.data.delta;if(U.step_details&&U.step_details.type=="tool_calls"&&U.step_details.tool_calls&&Y.step_details.type=="tool_calls")for(let z of U.step_details.tool_calls)if(z.index==B(this,E7,"f"))this._emit("toolCallDelta",z,Y.step_details.tool_calls[z.index]);else{if(B(this,Q1,"f"))this._emit("toolCallDone",B(this,Q1,"f"));if(Z$(this,E7,z.index,"f"),Z$(this,Q1,Y.step_details.tool_calls[z.index],"f"),B(this,Q1,"f"))this._emit("toolCallCreated",B(this,Q1,"f"))}this._emit("runStepDelta",X.data.delta,Y);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":if(Z$(this,qG,void 0,"f"),X.data.step_details.type=="tool_calls"){if(B(this,Q1,"f"))this._emit("toolCallDone",B(this,Q1,"f")),Z$(this,Q1,void 0,"f")}this._emit("runStepDone",X.data,Y);break;case"thread.run.step.in_progress":break}},zA=function $(X){B(this,Zw,"f").push(X),this._emit("event",X)},WA=function $(X){switch(X.event){case"thread.run.step.created":return B(this,Y0,"f")[X.data.id]=X.data,X.data;case"thread.run.step.delta":let Y=B(this,Y0,"f")[X.data.id];if(!Y)throw Error("Received a RunStepDelta before creation of a snapshot");let U=X.data;if(U.delta){let G=F8.accumulateDelta(Y,U.delta);B(this,Y0,"f")[X.data.id]=G}return B(this,Y0,"f")[X.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":B(this,Y0,"f")[X.data.id]=X.data;break}if(B(this,Y0,"f")[X.data.id])return B(this,Y0,"f")[X.data.id];throw new Error("No snapshot available")},QA=function $(X,Y){let U=[];switch(X.event){case"thread.message.created":return[X.data,U];case"thread.message.delta":if(!Y)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let G=X.data;if(G.delta.content)for(let z of G.delta.content)if(z.index in Y.content){let W=Y.content[z.index];Y.content[z.index]=B(this,t4,"m",ZA).call(this,z,W)}else Y.content[z.index]=z,U.push(z);return[Y,U];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(Y)return[Y,U];else throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},ZA=function $(X,Y){return F8.accumulateDelta(Y,X)},HA=function $(X){switch(Z$(this,D7,X.data,"f"),X.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":if(Z$(this,M8,X.data,"f"),B(this,Q1,"f"))this._emit("toolCallDone",B(this,Q1,"f")),Z$(this,Q1,void 0,"f");break;case"thread.run.cancelling":break}};function Nk($){}class BX extends u{constructor(){super(...arguments);this.steps=new LG(this._client)}create($,X,Y){let{include:U,...G}=X;return this._client.post(g`/threads/${$}/runs`,{query:{include:U},body:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers]),stream:X.stream??!1})}retrieve($,X,Y){let{thread_id:U}=X;return this._client.get(g`/threads/${U}/runs/${$}`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}update($,X,Y){let{thread_id:U,...G}=X;return this._client.post(g`/threads/${U}/runs/${$}`,{body:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}list($,X={},Y){return this._client.getAPIList(g`/threads/${$}/runs`,q$,{query:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}cancel($,X,Y){let{thread_id:U}=X;return this._client.post(g`/threads/${U}/runs/${$}/cancel`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}async createAndPoll($,X,Y){let U=await this.create($,X,Y);return await this.poll(U.id,{thread_id:$},Y)}createAndStream($,X,Y){return K2.createAssistantStream($,this._client.beta.threads.runs,X,Y)}async poll($,X,Y){let U=e([Y?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":Y?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:G,response:z}=await this.retrieve($,X,{...Y,headers:{...Y?.headers,...U}}).withResponse();switch(G.status){case"queued":case"in_progress":case"cancelling":let W=5000;if(Y?.pollIntervalMs)W=Y.pollIntervalMs;else{let Q=z.headers.get("openai-poll-after-ms");if(Q){let Z=parseInt(Q);if(!isNaN(Z))W=Z}}await $0(W);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return G}}}stream($,X,Y){return K2.createAssistantStream($,this._client.beta.threads.runs,X,Y)}submitToolOutputs($,X,Y){let{thread_id:U,...G}=X;return this._client.post(g`/threads/${U}/runs/${$}/submit_tool_outputs`,{body:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers]),stream:X.stream??!1})}async submitToolOutputsAndPoll($,X,Y){let U=await this.submitToolOutputs($,X,Y);return await this.poll(U.id,X,Y)}submitToolOutputsStream($,X,Y){return K2.createToolAssistantStream($,this._client.beta.threads.runs,X,Y)}}BX.Steps=LG;class J8 extends u{constructor(){super(...arguments);this.runs=new BX(this._client),this.messages=new AG(this._client)}create($={},X){return this._client.post("/threads",{body:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}retrieve($,X){return this._client.get(g`/threads/${$}`,{...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}update($,X,Y){return this._client.post(g`/threads/${$}`,{body:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}delete($,X){return this._client.delete(g`/threads/${$}`,{...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}createAndRun($,X){return this._client.post("/threads/runs",{body:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers]),stream:$.stream??!1})}async createAndRunPoll($,X){let Y=await this.createAndRun($,X);return await this.runs.poll(Y.id,{thread_id:Y.thread_id},X)}createAndRunStream($,X){return K2.createThreadAssistantStream($,this._client.beta.threads,X)}}J8.Runs=BX;J8.Messages=AG;class h0 extends u{constructor(){super(...arguments);this.realtime=new E8(this._client),this.assistants=new FG(this._client),this.threads=new J8(this._client)}}h0.Realtime=E8;h0.Assistants=FG;h0.Threads=J8;class jX extends u{create($,X){return this._client.post("/completions",{body:$,...X,stream:$.stream??!1})}}class RG extends u{retrieve($,X,Y){let{container_id:U}=X;return this._client.get(g`/containers/${U}/files/${$}/content`,{...Y,headers:e([{Accept:"application/binary"},Y?.headers]),__binaryResponse:!0})}}class PX extends u{constructor(){super(...arguments);this.content=new RG(this._client)}create($,X,Y){return this._client.post(g`/containers/${$}/files`,W1({body:X,...Y},this._client))}retrieve($,X,Y){let{container_id:U}=X;return this._client.get(g`/containers/${U}/files/${$}`,Y)}list($,X={},Y){return this._client.getAPIList(g`/containers/${$}/files`,q$,{query:X,...Y})}delete($,X,Y){let{container_id:U}=X;return this._client.delete(g`/containers/${U}/files/${$}`,{...Y,headers:e([{Accept:"*/*"},Y?.headers])})}}PX.Content=RG;class A8 extends u{constructor(){super(...arguments);this.files=new PX(this._client)}create($,X){return this._client.post("/containers",{body:$,...X})}retrieve($,X){return this._client.get(g`/containers/${$}`,X)}list($={},X){return this._client.getAPIList("/containers",q$,{query:$,...X})}delete($,X){return this._client.delete(g`/containers/${$}`,{...X,headers:e([{Accept:"*/*"},X?.headers])})}}A8.Files=PX;class TG extends u{create($,X,Y){let{include:U,...G}=X;return this._client.post(g`/conversations/${$}/items`,{query:{include:U},body:G,...Y})}retrieve($,X,Y){let{conversation_id:U,...G}=X;return this._client.get(g`/conversations/${U}/items/${$}`,{query:G,...Y})}list($,X={},Y){return this._client.getAPIList(g`/conversations/${$}/items`,dO,{query:X,...Y})}delete($,X,Y){let{conversation_id:U}=X;return this._client.delete(g`/conversations/${U}/items/${$}`,Y)}}class L8 extends u{constructor(){super(...arguments);this.items=new TG(this._client)}create($,X){return this._client.post("/conversations",{body:$,...X})}retrieve($,X){return this._client.get(g`/conversations/${$}`,X)}update($,X,Y){return this._client.post(g`/conversations/${$}`,{body:X,...Y})}delete($,X){return this._client.delete(g`/conversations/${$}`,X)}}L8.Items=TG;class IX extends u{create($,X){let Y=!!$.encoding_format,U=Y?$.encoding_format:"base64";if(Y)q4(this._client).debug("embeddings/user defined encoding_format:",$.encoding_format);let G=this._client.post("/embeddings",{body:{...$,encoding_format:U},...X});if(Y)return G;return q4(this._client).debug("embeddings/decoding base64 embeddings from base64"),G._thenUnwrap((z)=>{if(z&&z.data)z.data.forEach((W)=>{let Q=W.embedding;W.embedding=YA(Q)});return z})}}class vG extends u{retrieve($,X,Y){let{eval_id:U,run_id:G}=X;return this._client.get(g`/evals/${U}/runs/${G}/output_items/${$}`,Y)}list($,X,Y){let{eval_id:U,...G}=X;return this._client.getAPIList(g`/evals/${U}/runs/${$}/output_items`,q$,{query:G,...Y})}}class xX extends u{constructor(){super(...arguments);this.outputItems=new vG(this._client)}create($,X,Y){return this._client.post(g`/evals/${$}/runs`,{body:X,...Y})}retrieve($,X,Y){let{eval_id:U}=X;return this._client.get(g`/evals/${U}/runs/${$}`,Y)}list($,X={},Y){return this._client.getAPIList(g`/evals/${$}/runs`,q$,{query:X,...Y})}delete($,X,Y){let{eval_id:U}=X;return this._client.delete(g`/evals/${U}/runs/${$}`,Y)}cancel($,X,Y){let{eval_id:U}=X;return this._client.post(g`/evals/${U}/runs/${$}`,Y)}}xX.OutputItems=vG;class K8 extends u{constructor(){super(...arguments);this.runs=new xX(this._client)}create($,X){return this._client.post("/evals",{body:$,...X})}retrieve($,X){return this._client.get(g`/evals/${$}`,X)}update($,X,Y){return this._client.post(g`/evals/${$}`,{body:X,...Y})}list($={},X){return this._client.getAPIList("/evals",q$,{query:$,...X})}delete($,X){return this._client.delete(g`/evals/${$}`,X)}}K8.Runs=xX;class SX extends u{create($,X){return this._client.post("/files",W1({body:$,...X},this._client))}retrieve($,X){return this._client.get(g`/files/${$}`,X)}list($={},X){return this._client.getAPIList("/files",q$,{query:$,...X})}delete($,X){return this._client.delete(g`/files/${$}`,X)}content($,X){return this._client.get(g`/files/${$}/content`,{...X,headers:e([{Accept:"application/binary"},X?.headers]),__binaryResponse:!0})}async waitForProcessing($,{pollInterval:X=5000,maxWait:Y=1800000}={}){let U=new Set(["processed","error","deleted"]),G=Date.now(),z=await this.retrieve($);while(!z.status||!U.has(z.status))if(await $0(X),z=await this.retrieve($),Date.now()-G>Y)throw new H8({message:`Giving up on waiting for file ${$} to finish processing after ${Y} milliseconds.`});return z}}class CG extends u{}class BG extends u{run($,X){return this._client.post("/fine_tuning/alpha/graders/run",{body:$,...X})}validate($,X){return this._client.post("/fine_tuning/alpha/graders/validate",{body:$,...X})}}class kX extends u{constructor(){super(...arguments);this.graders=new BG(this._client)}}kX.Graders=BG;class jG extends u{create($,X,Y){return this._client.getAPIList(g`/fine_tuning/checkpoints/${$}/permissions`,S0,{body:X,method:"post",...Y})}retrieve($,X={},Y){return this._client.get(g`/fine_tuning/checkpoints/${$}/permissions`,{query:X,...Y})}delete($,X,Y){let{fine_tuned_model_checkpoint:U}=X;return this._client.delete(g`/fine_tuning/checkpoints/${U}/permissions/${$}`,Y)}}class bX extends u{constructor(){super(...arguments);this.permissions=new jG(this._client)}}bX.Permissions=jG;class PG extends u{list($,X={},Y){return this._client.getAPIList(g`/fine_tuning/jobs/${$}/checkpoints`,q$,{query:X,...Y})}}class fX extends u{constructor(){super(...arguments);this.checkpoints=new PG(this._client)}create($,X){return this._client.post("/fine_tuning/jobs",{body:$,...X})}retrieve($,X){return this._client.get(g`/fine_tuning/jobs/${$}`,X)}list($={},X){return this._client.getAPIList("/fine_tuning/jobs",q$,{query:$,...X})}cancel($,X){return this._client.post(g`/fine_tuning/jobs/${$}/cancel`,X)}listEvents($,X={},Y){return this._client.getAPIList(g`/fine_tuning/jobs/${$}/events`,q$,{query:X,...Y})}pause($,X){return this._client.post(g`/fine_tuning/jobs/${$}/pause`,X)}resume($,X){return this._client.post(g`/fine_tuning/jobs/${$}/resume`,X)}}fX.Checkpoints=PG;class G0 extends u{constructor(){super(...arguments);this.methods=new CG(this._client),this.jobs=new fX(this._client),this.checkpoints=new bX(this._client),this.alpha=new kX(this._client)}}G0.Methods=CG;G0.Jobs=fX;G0.Checkpoints=bX;G0.Alpha=kX;class IG extends u{}class _8 extends u{constructor(){super(...arguments);this.graderModels=new IG(this._client)}}_8.GraderModels=IG;class hX extends u{createVariation($,X){return this._client.post("/images/variations",W1({body:$,...X},this._client))}edit($,X){return this._client.post("/images/edits",W1({body:$,...X,stream:$.stream??!1},this._client))}generate($,X){return this._client.post("/images/generations",{body:$,...X,stream:$.stream??!1})}}class gX extends u{retrieve($,X){return this._client.get(g`/models/${$}`,X)}list($){return this._client.getAPIList("/models",S0,$)}delete($,X){return this._client.delete(g`/models/${$}`,X)}}class yX extends u{create($,X){return this._client.post("/moderations",{body:$,...X})}}function VA($,X){if(!X||!xk(X))return{...$,output_parsed:null,output:$.output.map((Y)=>{if(Y.type==="function_call")return{...Y,parsed_arguments:null};if(Y.type==="message")return{...Y,content:Y.content.map((U)=>({...U,parsed:null}))};else return Y})};return Hw($,X)}function Hw($,X){let Y=$.output.map((G)=>{if(G.type==="function_call")return{...G,parsed_arguments:bk(X,G)};if(G.type==="message"){let z=G.content.map((W)=>{if(W.type==="output_text")return{...W,parsed:Ik(X,W.text)};return W});return{...G,content:z}}return G}),U=Object.assign({},$,{output:Y});if(!Object.getOwnPropertyDescriptor($,"output_text"))N7(U);return Object.defineProperty(U,"output_parsed",{enumerable:!0,get(){for(let G of U.output){if(G.type!=="message")continue;for(let z of G.content)if(z.type==="output_text"&&z.parsed!==null)return z.parsed}return null}}),U}function Ik($,X){if($.text?.format?.type!=="json_schema")return null;if("$parseRaw"in $.text?.format)return($.text?.format).$parseRaw(X);return JSON.parse(X)}function xk($){if(zG($.text?.format))return!0;return!1}function Sk($){return $?.$brand==="auto-parseable-tool"}function kk($,X){return $.find((Y)=>Y.type==="function"&&Y.name===X)}function bk($,X){let Y=kk($.tools??[],X.name);return{...X,...X,parsed_arguments:Sk(Y)?Y.$parseRaw(X.arguments):Y?.strict?JSON.parse(X.arguments):null}}function N7($){let X=[];for(let Y of $.output){if(Y.type!=="message")continue;for(let U of Y.content)if(U.type==="output_text")X.push(U.text)}$.output_text=X.join("")}var mX,F7,_2,M7,OA,wA,DA,EA;class J7 extends w8{constructor($){super();mX.add(this),F7.set(this,void 0),_2.set(this,void 0),M7.set(this,void 0),Z$(this,F7,$,"f")}static createResponse($,X,Y){let U=new J7(X);return U._run(()=>U._createOrRetrieveResponse($,X,{...Y,headers:{...Y?.headers,"X-Stainless-Helper-Method":"stream"}})),U}async _createOrRetrieveResponse($,X,Y){let U=Y?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}B(this,mX,"m",OA).call(this);let G,z=null;if("response_id"in X)G=await $.responses.retrieve(X.response_id,{stream:!0},{...Y,signal:this.controller.signal,stream:!0}),z=X.starting_after??null;else G=await $.responses.create({...X,stream:!0},{...Y,signal:this.controller.signal});this._connected();for await(let W of G)B(this,mX,"m",wA).call(this,W,z);if(G.controller.signal?.aborted)throw new k4;return B(this,mX,"m",DA).call(this)}[(F7=new WeakMap,_2=new WeakMap,M7=new WeakMap,mX=new WeakSet,OA=function $(){if(this.ended)return;Z$(this,_2,void 0,"f")},wA=function $(X,Y){if(this.ended)return;let U=(z,W)=>{if(Y==null||W.sequence_number>Y)this._emit(z,W)},G=B(this,mX,"m",EA).call(this,X);switch(U("event",X),X.type){case"response.output_text.delta":{let z=G.output[X.output_index];if(!z)throw new G$(`missing output at index ${X.output_index}`);if(z.type==="message"){let W=z.content[X.content_index];if(!W)throw new G$(`missing content at index ${X.content_index}`);if(W.type!=="output_text")throw new G$(`expected content to be 'output_text', got ${W.type}`);U("response.output_text.delta",{...X,snapshot:W.text})}break}case"response.function_call_arguments.delta":{let z=G.output[X.output_index];if(!z)throw new G$(`missing output at index ${X.output_index}`);if(z.type==="function_call")U("response.function_call_arguments.delta",{...X,snapshot:z.arguments});break}default:U(X.type,X);break}},DA=function $(){if(this.ended)throw new G$("stream has ended, this shouldn't happen");let X=B(this,_2,"f");if(!X)throw new G$("request ended without sending any events");Z$(this,_2,void 0,"f");let Y=fk(X,B(this,F7,"f"));return Z$(this,M7,Y,"f"),Y},EA=function $(X){let Y=B(this,_2,"f");if(!Y){if(X.type!=="response.created")throw new G$(`When snapshot hasn't been set yet, expected 'response.created' event, got ${X.type}`);return Y=Z$(this,_2,X.response,"f"),Y}switch(X.type){case"response.output_item.added":{Y.output.push(X.item);break}case"response.content_part.added":{let U=Y.output[X.output_index];if(!U)throw new G$(`missing output at index ${X.output_index}`);if(U.type==="message")U.content.push(X.part);break}case"response.output_text.delta":{let U=Y.output[X.output_index];if(!U)throw new G$(`missing output at index ${X.output_index}`);if(U.type==="message"){let G=U.content[X.content_index];if(!G)throw new G$(`missing content at index ${X.content_index}`);if(G.type!=="output_text")throw new G$(`expected content to be 'output_text', got ${G.type}`);G.text+=X.delta}break}case"response.function_call_arguments.delta":{let U=Y.output[X.output_index];if(!U)throw new G$(`missing output at index ${X.output_index}`);if(U.type==="function_call")U.arguments+=X.delta;break}case"response.completed":{Z$(this,_2,X.response,"f");break}}return Y},Symbol.asyncIterator)](){let $=[],X=[],Y=!1;return this.on("event",(U)=>{let G=X.shift();if(G)G.resolve(U);else $.push(U)}),this.on("end",()=>{Y=!0;for(let U of X)U.resolve(void 0);X.length=0}),this.on("abort",(U)=>{Y=!0;for(let G of X)G.reject(U);X.length=0}),this.on("error",(U)=>{Y=!0;for(let G of X)G.reject(U);X.length=0}),{next:async()=>{if(!$.length){if(Y)return{value:void 0,done:!0};return new Promise((G,z)=>X.push({resolve:G,reject:z})).then((G)=>G?{value:G,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}async finalResponse(){await this.done();let $=B(this,M7,"f");if(!$)throw new G$("stream ended without producing a ChatCompletion");return $}}function fk($,X){return VA($,X)}class xG extends u{list($,X={},Y){return this._client.getAPIList(g`/responses/${$}/input_items`,q$,{query:X,...Y})}}class q8 extends u{constructor(){super(...arguments);this.inputItems=new xG(this._client)}create($,X){return this._client.post("/responses",{body:$,...X,stream:$.stream??!1})._thenUnwrap((Y)=>{if("object"in Y&&Y.object==="response")N7(Y);return Y})}retrieve($,X={},Y){return this._client.get(g`/responses/${$}`,{query:X,...Y,stream:X?.stream??!1})._thenUnwrap((U)=>{if("object"in U&&U.object==="response")N7(U);return U})}delete($,X){return this._client.delete(g`/responses/${$}`,{...X,headers:e([{Accept:"*/*"},X?.headers])})}parse($,X){return this._client.responses.create($,X)._thenUnwrap((Y)=>Hw(Y,$))}stream($,X){return J7.createResponse(this._client,$,X)}cancel($,X){return this._client.post(g`/responses/${$}/cancel`,X)}}q8.InputItems=xG;class SG extends u{create($,X,Y){return this._client.post(g`/uploads/${$}/parts`,W1({body:X,...Y},this._client))}}class R8 extends u{constructor(){super(...arguments);this.parts=new SG(this._client)}create($,X){return this._client.post("/uploads",{body:$,...X})}cancel($,X){return this._client.post(g`/uploads/${$}/cancel`,X)}complete($,X,Y){return this._client.post(g`/uploads/${$}/complete`,{body:X,...Y})}}R8.Parts=SG;var NA=async($)=>{let X=await Promise.allSettled($),Y=X.filter((G)=>G.status==="rejected");if(Y.length){for(let G of Y)console.error(G.reason);throw new Error(`${Y.length} promise(s) failed - see the above errors`)}let U=[];for(let G of X)if(G.status==="fulfilled")U.push(G.value);return U};class kG extends u{create($,X,Y){return this._client.post(g`/vector_stores/${$}/file_batches`,{body:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}retrieve($,X,Y){let{vector_store_id:U}=X;return this._client.get(g`/vector_stores/${U}/file_batches/${$}`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}cancel($,X,Y){let{vector_store_id:U}=X;return this._client.post(g`/vector_stores/${U}/file_batches/${$}/cancel`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}async createAndPoll($,X,Y){let U=await this.create($,X);return await this.poll($,U.id,Y)}listFiles($,X,Y){let{vector_store_id:U,...G}=X;return this._client.getAPIList(g`/vector_stores/${U}/file_batches/${$}/files`,q$,{query:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}async poll($,X,Y){let U=e([Y?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":Y?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:G,response:z}=await this.retrieve(X,{vector_store_id:$},{...Y,headers:U}).withResponse();switch(G.status){case"in_progress":let W=5000;if(Y?.pollIntervalMs)W=Y.pollIntervalMs;else{let Q=z.headers.get("openai-poll-after-ms");if(Q){let Z=parseInt(Q);if(!isNaN(Z))W=Z}}await $0(W);break;case"failed":case"cancelled":case"completed":return G}}}async uploadAndPoll($,{files:X,fileIds:Y=[]},U){if(X==null||X.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let G=U?.maxConcurrency??5,z=Math.min(G,X.length),W=this._client,Q=X.values(),Z=[...Y];async function H(O){for(let w of O){let D=await W.files.create({file:w,purpose:"assistants"},U);Z.push(D.id)}}let V=Array(z).fill(Q).map(H);return await NA(V),await this.createAndPoll($,{file_ids:Z})}}class bG extends u{create($,X,Y){return this._client.post(g`/vector_stores/${$}/files`,{body:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}retrieve($,X,Y){let{vector_store_id:U}=X;return this._client.get(g`/vector_stores/${U}/files/${$}`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}update($,X,Y){let{vector_store_id:U,...G}=X;return this._client.post(g`/vector_stores/${U}/files/${$}`,{body:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}list($,X={},Y){return this._client.getAPIList(g`/vector_stores/${$}/files`,q$,{query:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}delete($,X,Y){let{vector_store_id:U}=X;return this._client.delete(g`/vector_stores/${U}/files/${$}`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}async createAndPoll($,X,Y){let U=await this.create($,X,Y);return await this.poll($,U.id,Y)}async poll($,X,Y){let U=e([Y?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":Y?.pollIntervalMs?.toString()??void 0}]);while(!0){let G=await this.retrieve(X,{vector_store_id:$},{...Y,headers:U}).withResponse(),z=G.data;switch(z.status){case"in_progress":let W=5000;if(Y?.pollIntervalMs)W=Y.pollIntervalMs;else{let Q=G.response.headers.get("openai-poll-after-ms");if(Q){let Z=parseInt(Q);if(!isNaN(Z))W=Z}}await $0(W);break;case"failed":case"completed":return z}}}async upload($,X,Y){let U=await this._client.files.create({file:X,purpose:"assistants"},Y);return this.create($,{file_id:U.id},Y)}async uploadAndPoll($,X,Y){let U=await this.upload($,X,Y);return await this.poll($,U.id,Y)}content($,X,Y){let{vector_store_id:U}=X;return this._client.getAPIList(g`/vector_stores/${U}/files/${$}/content`,S0,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}}class q2 extends u{constructor(){super(...arguments);this.files=new bG(this._client),this.fileBatches=new kG(this._client)}create($,X){return this._client.post("/vector_stores",{body:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}retrieve($,X){return this._client.get(g`/vector_stores/${$}`,{...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}update($,X,Y){return this._client.post(g`/vector_stores/${$}`,{body:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}list($={},X){return this._client.getAPIList("/vector_stores",q$,{query:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}delete($,X){return this._client.delete(g`/vector_stores/${$}`,{...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}search($,X,Y){return this._client.getAPIList(g`/vector_stores/${$}/search`,S0,{body:X,method:"post",...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}}q2.Files=bG;q2.FileBatches=kG;var uX,FA,A7;class cX extends u{constructor(){super(...arguments);uX.add(this)}async unwrap($,X,Y=this._client.webhookSecret,U=300){return await this.verifySignature($,X,Y,U),JSON.parse($)}async verifySignature($,X,Y=this._client.webhookSecret,U=300){if(typeof crypto==="undefined"||typeof crypto.subtle.importKey!=="function"||typeof crypto.subtle.verify!=="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");B(this,uX,"m",FA).call(this,Y);let G=e([X]).values,z=B(this,uX,"m",A7).call(this,G,"webhook-signature"),W=B(this,uX,"m",A7).call(this,G,"webhook-timestamp"),Q=B(this,uX,"m",A7).call(this,G,"webhook-id"),Z=parseInt(W,10);if(isNaN(Z))throw new I0("Invalid webhook timestamp format");let H=Math.floor(Date.now()/1000);if(H-Z>U)throw new I0("Webhook timestamp is too old");if(Z>H+U)throw new I0("Webhook timestamp is too new");let V=z.split(" ").map((E)=>E.startsWith("v1,")?E.substring(3):E),O=Y.startsWith("whsec_")?Buffer.from(Y.replace("whsec_",""),"base64"):Buffer.from(Y,"utf-8"),w=Q?`${Q}.${W}.${$}`:`${W}.${$}`,D=await crypto.subtle.importKey("raw",O,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let E of V)try{let F=Buffer.from(E,"base64");if(await crypto.subtle.verify("HMAC",D,F,new TextEncoder().encode(w)))return}catch{continue}throw new I0("The given webhook signature does not match the expected signature")}}uX=new WeakSet,FA=function $(X){if(typeof X!=="string"||X.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},A7=function $(X,Y){if(!X)throw new Error("Headers are required");let U=X.get(Y);if(U===null||U===void 0)throw new Error(`Missing required header: ${Y}`);return U};var Vw,Ow,L7,MA;class K${constructor({baseURL:$=L2("OPENAI_BASE_URL"),apiKey:X=L2("OPENAI_API_KEY"),organization:Y=L2("OPENAI_ORG_ID")??null,project:U=L2("OPENAI_PROJECT_ID")??null,webhookSecret:G=L2("OPENAI_WEBHOOK_SECRET")??null,...z}={}){if(Vw.add(this),L7.set(this,void 0),this.completions=new jX(this),this.chat=new D8(this),this.embeddings=new IX(this),this.files=new SX(this),this.images=new hX(this),this.audio=new f0(this),this.moderations=new yX(this),this.models=new gX(this),this.fineTuning=new G0(this),this.graders=new _8(this),this.vectorStores=new q2(this),this.webhooks=new cX(this),this.beta=new h0(this),this.batches=new vX(this),this.uploads=new R8(this),this.responses=new q8(this),this.conversations=new L8(this),this.evals=new K8(this),this.containers=new A8(this),X===void 0)throw new G$("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");let W={apiKey:X,organization:Y,project:U,webhookSecret:G,...z,baseURL:$||"https://api.openai.com/v1"};if(!W.dangerouslyAllowBrowser&&KJ())throw new G$(`It looks like you're running in a browser-like environment.
|
|
117
|
+
${V7($)}`);return{...y,id:S,type:I,function:{...X$,name:j,arguments:r}}})}};return{...D,message:{...A,content:E,role:L,refusal:H.refusal??null},finish_reason:V,index:O,logprobs:w}}),created:G,model:z,object:"chat.completion",...W?{system_fingerprint:W}:{}};return cJ(Z,X)}function V7($){return JSON.stringify($)}function eJ($){return}function $A($){}class TX extends J2{static fromReadableStream($){let X=new TX(null);return X._run(()=>X._fromReadableStream($)),X}static runTools($,X,Y){let U=new TX(X),G={...Y,headers:{...Y?.headers,"X-Stainless-Helper-Method":"runTools"}};return U._run(()=>U._runTools($,X,G)),U}}class A2 extends u{constructor(){super(...arguments);this.messages=new KX(this._client)}create($,X){return this._client.post("/chat/completions",{body:$,...X,stream:$.stream??!1})}retrieve($,X){return this._client.get(g`/chat/completions/${$}`,X)}update($,X,Y){return this._client.post(g`/chat/completions/${$}`,{body:X,...Y})}list($={},X){return this._client.getAPIList("/chat/completions",q$,{query:$,...X})}delete($,X){return this._client.delete(g`/chat/completions/${$}`,X)}parse($,X){return lJ($.tools),this._client.chat.completions.create($,{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap((Y)=>WG(Y,$))}runTools($,X){if($.stream)return TX.runTools(this._client,$,X);return wG.runTools(this._client,$,X)}stream($,X){return J2.createChatCompletion(this._client,$,X)}}A2.Messages=KX;class D8 extends u{constructor(){super(...arguments);this.completions=new A2(this._client)}}D8.Completions=A2;var XA=Symbol("brand.privateNullableHeaders");function*zk($){if(!$)return;if(XA in $){let{values:U,nulls:G}=$;yield*U.entries();for(let z of G)yield[z,null];return}let X=!1,Y;if($ instanceof Headers)Y=$.entries();else if(IO($))Y=$;else X=!0,Y=Object.entries($??{});for(let U of Y){let G=U[0];if(typeof G!=="string")throw new TypeError("expected header name to be a string");let z=IO(U[1])?U[1]:[U[1]],W=!1;for(let Q of z){if(Q===void 0)continue;if(X&&!W)W=!0,yield[G,null];yield[G,Q]}}}var e=($)=>{let X=new Headers,Y=new Set;for(let U of $){let G=new Set;for(let[z,W]of zk(U)){let Q=z.toLowerCase();if(!G.has(Q))X.delete(z),G.add(Q);if(W===null)X.delete(z),Y.add(Q);else X.append(z,W),Y.delete(Q)}}return{[XA]:!0,values:X,nulls:Y}};class DG extends u{create($,X){return this._client.post("/audio/speech",{body:$,...X,headers:e([{Accept:"application/octet-stream"},X?.headers]),__binaryResponse:!0})}}class EG extends u{create($,X){return this._client.post("/audio/transcriptions",Q1({body:$,...X,stream:$.stream??!1,__metadata:{model:$.model}},this._client))}}class NG extends u{create($,X){return this._client.post("/audio/translations",Q1({body:$,...X,__metadata:{model:$.model}},this._client))}}class f0 extends u{constructor(){super(...arguments);this.transcriptions=new EG(this._client),this.translations=new NG(this._client),this.speech=new DG(this._client)}}f0.Transcriptions=EG;f0.Translations=NG;f0.Speech=DG;class vX extends u{create($,X){return this._client.post("/batches",{body:$,...X})}retrieve($,X){return this._client.get(g`/batches/${$}`,X)}list($={},X){return this._client.getAPIList("/batches",q$,{query:$,...X})}cancel($,X){return this._client.post(g`/batches/${$}/cancel`,X)}}class FG extends u{create($,X){return this._client.post("/assistants",{body:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}retrieve($,X){return this._client.get(g`/assistants/${$}`,{...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}update($,X,Y){return this._client.post(g`/assistants/${$}`,{body:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}list($={},X){return this._client.getAPIList("/assistants",q$,{query:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}delete($,X){return this._client.delete(g`/assistants/${$}`,{...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}}class MG extends u{create($,X){return this._client.post("/realtime/sessions",{body:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}}class JG extends u{create($,X){return this._client.post("/realtime/transcription_sessions",{body:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}}class E8 extends u{constructor(){super(...arguments);this.sessions=new MG(this._client),this.transcriptionSessions=new JG(this._client)}}E8.Sessions=MG;E8.TranscriptionSessions=JG;class AG extends u{create($,X,Y){return this._client.post(g`/threads/${$}/messages`,{body:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}retrieve($,X,Y){let{thread_id:U}=X;return this._client.get(g`/threads/${U}/messages/${$}`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}update($,X,Y){let{thread_id:U,...G}=X;return this._client.post(g`/threads/${U}/messages/${$}`,{body:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}list($,X={},Y){return this._client.getAPIList(g`/threads/${$}/messages`,q$,{query:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}delete($,X,Y){let{thread_id:U}=X;return this._client.delete(g`/threads/${U}/messages/${$}`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}}class LG extends u{retrieve($,X,Y){let{thread_id:U,run_id:G,...z}=X;return this._client.get(g`/threads/${U}/runs/${G}/steps/${$}`,{query:z,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}list($,X,Y){let{thread_id:U,...G}=X;return this._client.getAPIList(g`/threads/${U}/runs/${$}/steps`,q$,{query:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}}var YA=($)=>{if(typeof Buffer!=="undefined"){let X=Buffer.from($,"base64");return Array.from(new Float32Array(X.buffer,X.byteOffset,X.length/Float32Array.BYTES_PER_ELEMENT))}else{let X=atob($),Y=X.length,U=new Uint8Array(Y);for(let G=0;G<Y;G++)U[G]=X.charCodeAt(G);return Array.from(new Float32Array(U.buffer))}};var L2=($)=>{if(typeof globalThis.process!=="undefined")return globalThis.process.env?.[$]?.trim()??void 0;if(typeof globalThis.Deno!=="undefined")return globalThis.Deno.env?.get?.($)?.trim();return};var t4,F8,Zw,G0,O7,y1,M8,CX,N8,E7,Z1,w7,D7,qG,KG,_G,GA,UA,zA,WA,QA,ZA,HA;class K2 extends w8{constructor(){super(...arguments);t4.add(this),Zw.set(this,[]),G0.set(this,{}),O7.set(this,{}),y1.set(this,void 0),M8.set(this,void 0),CX.set(this,void 0),N8.set(this,void 0),E7.set(this,void 0),Z1.set(this,void 0),w7.set(this,void 0),D7.set(this,void 0),qG.set(this,void 0)}[(Zw=new WeakMap,G0=new WeakMap,O7=new WeakMap,y1=new WeakMap,M8=new WeakMap,CX=new WeakMap,N8=new WeakMap,E7=new WeakMap,Z1=new WeakMap,w7=new WeakMap,D7=new WeakMap,qG=new WeakMap,t4=new WeakSet,Symbol.asyncIterator)](){let $=[],X=[],Y=!1;return this.on("event",(U)=>{let G=X.shift();if(G)G.resolve(U);else $.push(U)}),this.on("end",()=>{Y=!0;for(let U of X)U.resolve(void 0);X.length=0}),this.on("abort",(U)=>{Y=!0;for(let G of X)G.reject(U);X.length=0}),this.on("error",(U)=>{Y=!0;for(let G of X)G.reject(U);X.length=0}),{next:async()=>{if(!$.length){if(Y)return{value:void 0,done:!0};return new Promise((G,z)=>X.push({resolve:G,reject:z})).then((G)=>G?{value:G,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}static fromReadableStream($){let X=new F8;return X._run(()=>X._fromReadableStream($)),X}async _fromReadableStream($,X){let Y=X?.signal;if(Y){if(Y.aborted)this.controller.abort();Y.addEventListener("abort",()=>this.controller.abort())}this._connected();let U=W1.fromReadableStream($,this.controller);for await(let G of U)B(this,t4,"m",KG).call(this,G);if(U.controller.signal?.aborted)throw new k4;return this._addRun(B(this,t4,"m",_G).call(this))}toReadableStream(){return new W1(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream($,X,Y,U){let G=new F8;return G._run(()=>G._runToolAssistantStream($,X,Y,{...U,headers:{...U?.headers,"X-Stainless-Helper-Method":"stream"}})),G}async _createToolAssistantStream($,X,Y,U){let G=U?.signal;if(G){if(G.aborted)this.controller.abort();G.addEventListener("abort",()=>this.controller.abort())}let z={...Y,stream:!0},W=await $.submitToolOutputs(X,z,{...U,signal:this.controller.signal});this._connected();for await(let Q of W)B(this,t4,"m",KG).call(this,Q);if(W.controller.signal?.aborted)throw new k4;return this._addRun(B(this,t4,"m",_G).call(this))}static createThreadAssistantStream($,X,Y){let U=new F8;return U._run(()=>U._threadAssistantStream($,X,{...Y,headers:{...Y?.headers,"X-Stainless-Helper-Method":"stream"}})),U}static createAssistantStream($,X,Y,U){let G=new F8;return G._run(()=>G._runAssistantStream($,X,Y,{...U,headers:{...U?.headers,"X-Stainless-Helper-Method":"stream"}})),G}currentEvent(){return B(this,w7,"f")}currentRun(){return B(this,D7,"f")}currentMessageSnapshot(){return B(this,y1,"f")}currentRunStepSnapshot(){return B(this,qG,"f")}async finalRunSteps(){return await this.done(),Object.values(B(this,G0,"f"))}async finalMessages(){return await this.done(),Object.values(B(this,O7,"f"))}async finalRun(){if(await this.done(),!B(this,M8,"f"))throw Error("Final run was not received.");return B(this,M8,"f")}async _createThreadAssistantStream($,X,Y){let U=Y?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}let G={...X,stream:!0},z=await $.createAndRun(G,{...Y,signal:this.controller.signal});this._connected();for await(let W of z)B(this,t4,"m",KG).call(this,W);if(z.controller.signal?.aborted)throw new k4;return this._addRun(B(this,t4,"m",_G).call(this))}async _createAssistantStream($,X,Y,U){let G=U?.signal;if(G){if(G.aborted)this.controller.abort();G.addEventListener("abort",()=>this.controller.abort())}let z={...Y,stream:!0},W=await $.create(X,z,{...U,signal:this.controller.signal});this._connected();for await(let Q of W)B(this,t4,"m",KG).call(this,Q);if(W.controller.signal?.aborted)throw new k4;return this._addRun(B(this,t4,"m",_G).call(this))}static accumulateDelta($,X){for(let[Y,U]of Object.entries(X)){if(!$.hasOwnProperty(Y)){$[Y]=U;continue}let G=$[Y];if(G===null||G===void 0){$[Y]=U;continue}if(Y==="index"||Y==="type"){$[Y]=U;continue}if(typeof G==="string"&&typeof U==="string")G+=U;else if(typeof G==="number"&&typeof U==="number")G+=U;else if(eY(G)&&eY(U))G=this.accumulateDelta(G,U);else if(Array.isArray(G)&&Array.isArray(U)){if(G.every((z)=>typeof z==="string"||typeof z==="number")){G.push(...U);continue}for(let z of U){if(!eY(z))throw new Error(`Expected array delta entry to be an object but got: ${z}`);let W=z.index;if(W==null)throw console.error(z),new Error("Expected array delta entry to have an `index` property");if(typeof W!=="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${W}`);let Q=G[W];if(Q==null)G.push(z);else G[W]=this.accumulateDelta(Q,z)}continue}else throw Error(`Unhandled record type: ${Y}, deltaValue: ${U}, accValue: ${G}`);$[Y]=G}return $}_addRun($){return $}async _threadAssistantStream($,X,Y){return await this._createThreadAssistantStream(X,$,Y)}async _runAssistantStream($,X,Y,U){return await this._createAssistantStream(X,$,Y,U)}async _runToolAssistantStream($,X,Y,U){return await this._createToolAssistantStream(X,$,Y,U)}}F8=K2,KG=function $(X){if(this.ended)return;switch(Z$(this,w7,X,"f"),B(this,t4,"m",zA).call(this,X),X.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":B(this,t4,"m",HA).call(this,X);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":B(this,t4,"m",UA).call(this,X);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":B(this,t4,"m",GA).call(this,X);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:Nk(X)}},_G=function $(){if(this.ended)throw new G$("stream has ended, this shouldn't happen");if(!B(this,M8,"f"))throw Error("Final run has not been received");return B(this,M8,"f")},GA=function $(X){let[Y,U]=B(this,t4,"m",QA).call(this,X,B(this,y1,"f"));Z$(this,y1,Y,"f"),B(this,O7,"f")[Y.id]=Y;for(let G of U){let z=Y.content[G.index];if(z?.type=="text")this._emit("textCreated",z.text)}switch(X.event){case"thread.message.created":this._emit("messageCreated",X.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",X.data.delta,Y),X.data.delta.content)for(let G of X.data.delta.content){if(G.type=="text"&&G.text){let z=G.text,W=Y.content[G.index];if(W&&W.type=="text")this._emit("textDelta",z,W.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(G.index!=B(this,CX,"f")){if(B(this,N8,"f"))switch(B(this,N8,"f").type){case"text":this._emit("textDone",B(this,N8,"f").text,B(this,y1,"f"));break;case"image_file":this._emit("imageFileDone",B(this,N8,"f").image_file,B(this,y1,"f"));break}Z$(this,CX,G.index,"f")}Z$(this,N8,Y.content[G.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(B(this,CX,"f")!==void 0){let G=X.data.content[B(this,CX,"f")];if(G)switch(G.type){case"image_file":this._emit("imageFileDone",G.image_file,B(this,y1,"f"));break;case"text":this._emit("textDone",G.text,B(this,y1,"f"));break}}if(B(this,y1,"f"))this._emit("messageDone",X.data);Z$(this,y1,void 0,"f")}},UA=function $(X){let Y=B(this,t4,"m",WA).call(this,X);switch(Z$(this,qG,Y,"f"),X.event){case"thread.run.step.created":this._emit("runStepCreated",X.data);break;case"thread.run.step.delta":let U=X.data.delta;if(U.step_details&&U.step_details.type=="tool_calls"&&U.step_details.tool_calls&&Y.step_details.type=="tool_calls")for(let z of U.step_details.tool_calls)if(z.index==B(this,E7,"f"))this._emit("toolCallDelta",z,Y.step_details.tool_calls[z.index]);else{if(B(this,Z1,"f"))this._emit("toolCallDone",B(this,Z1,"f"));if(Z$(this,E7,z.index,"f"),Z$(this,Z1,Y.step_details.tool_calls[z.index],"f"),B(this,Z1,"f"))this._emit("toolCallCreated",B(this,Z1,"f"))}this._emit("runStepDelta",X.data.delta,Y);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":if(Z$(this,qG,void 0,"f"),X.data.step_details.type=="tool_calls"){if(B(this,Z1,"f"))this._emit("toolCallDone",B(this,Z1,"f")),Z$(this,Z1,void 0,"f")}this._emit("runStepDone",X.data,Y);break;case"thread.run.step.in_progress":break}},zA=function $(X){B(this,Zw,"f").push(X),this._emit("event",X)},WA=function $(X){switch(X.event){case"thread.run.step.created":return B(this,G0,"f")[X.data.id]=X.data,X.data;case"thread.run.step.delta":let Y=B(this,G0,"f")[X.data.id];if(!Y)throw Error("Received a RunStepDelta before creation of a snapshot");let U=X.data;if(U.delta){let G=F8.accumulateDelta(Y,U.delta);B(this,G0,"f")[X.data.id]=G}return B(this,G0,"f")[X.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":B(this,G0,"f")[X.data.id]=X.data;break}if(B(this,G0,"f")[X.data.id])return B(this,G0,"f")[X.data.id];throw new Error("No snapshot available")},QA=function $(X,Y){let U=[];switch(X.event){case"thread.message.created":return[X.data,U];case"thread.message.delta":if(!Y)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let G=X.data;if(G.delta.content)for(let z of G.delta.content)if(z.index in Y.content){let W=Y.content[z.index];Y.content[z.index]=B(this,t4,"m",ZA).call(this,z,W)}else Y.content[z.index]=z,U.push(z);return[Y,U];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(Y)return[Y,U];else throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},ZA=function $(X,Y){return F8.accumulateDelta(Y,X)},HA=function $(X){switch(Z$(this,D7,X.data,"f"),X.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":if(Z$(this,M8,X.data,"f"),B(this,Z1,"f"))this._emit("toolCallDone",B(this,Z1,"f")),Z$(this,Z1,void 0,"f");break;case"thread.run.cancelling":break}};function Nk($){}class BX extends u{constructor(){super(...arguments);this.steps=new LG(this._client)}create($,X,Y){let{include:U,...G}=X;return this._client.post(g`/threads/${$}/runs`,{query:{include:U},body:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers]),stream:X.stream??!1})}retrieve($,X,Y){let{thread_id:U}=X;return this._client.get(g`/threads/${U}/runs/${$}`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}update($,X,Y){let{thread_id:U,...G}=X;return this._client.post(g`/threads/${U}/runs/${$}`,{body:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}list($,X={},Y){return this._client.getAPIList(g`/threads/${$}/runs`,q$,{query:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}cancel($,X,Y){let{thread_id:U}=X;return this._client.post(g`/threads/${U}/runs/${$}/cancel`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}async createAndPoll($,X,Y){let U=await this.create($,X,Y);return await this.poll(U.id,{thread_id:$},Y)}createAndStream($,X,Y){return K2.createAssistantStream($,this._client.beta.threads.runs,X,Y)}async poll($,X,Y){let U=e([Y?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":Y?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:G,response:z}=await this.retrieve($,X,{...Y,headers:{...Y?.headers,...U}}).withResponse();switch(G.status){case"queued":case"in_progress":case"cancelling":let W=5000;if(Y?.pollIntervalMs)W=Y.pollIntervalMs;else{let Q=z.headers.get("openai-poll-after-ms");if(Q){let Z=parseInt(Q);if(!isNaN(Z))W=Z}}await X0(W);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return G}}}stream($,X,Y){return K2.createAssistantStream($,this._client.beta.threads.runs,X,Y)}submitToolOutputs($,X,Y){let{thread_id:U,...G}=X;return this._client.post(g`/threads/${U}/runs/${$}/submit_tool_outputs`,{body:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers]),stream:X.stream??!1})}async submitToolOutputsAndPoll($,X,Y){let U=await this.submitToolOutputs($,X,Y);return await this.poll(U.id,X,Y)}submitToolOutputsStream($,X,Y){return K2.createToolAssistantStream($,this._client.beta.threads.runs,X,Y)}}BX.Steps=LG;class J8 extends u{constructor(){super(...arguments);this.runs=new BX(this._client),this.messages=new AG(this._client)}create($={},X){return this._client.post("/threads",{body:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}retrieve($,X){return this._client.get(g`/threads/${$}`,{...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}update($,X,Y){return this._client.post(g`/threads/${$}`,{body:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}delete($,X){return this._client.delete(g`/threads/${$}`,{...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}createAndRun($,X){return this._client.post("/threads/runs",{body:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers]),stream:$.stream??!1})}async createAndRunPoll($,X){let Y=await this.createAndRun($,X);return await this.runs.poll(Y.id,{thread_id:Y.thread_id},X)}createAndRunStream($,X){return K2.createThreadAssistantStream($,this._client.beta.threads,X)}}J8.Runs=BX;J8.Messages=AG;class h0 extends u{constructor(){super(...arguments);this.realtime=new E8(this._client),this.assistants=new FG(this._client),this.threads=new J8(this._client)}}h0.Realtime=E8;h0.Assistants=FG;h0.Threads=J8;class jX extends u{create($,X){return this._client.post("/completions",{body:$,...X,stream:$.stream??!1})}}class RG extends u{retrieve($,X,Y){let{container_id:U}=X;return this._client.get(g`/containers/${U}/files/${$}/content`,{...Y,headers:e([{Accept:"application/binary"},Y?.headers]),__binaryResponse:!0})}}class PX extends u{constructor(){super(...arguments);this.content=new RG(this._client)}create($,X,Y){return this._client.post(g`/containers/${$}/files`,Q1({body:X,...Y},this._client))}retrieve($,X,Y){let{container_id:U}=X;return this._client.get(g`/containers/${U}/files/${$}`,Y)}list($,X={},Y){return this._client.getAPIList(g`/containers/${$}/files`,q$,{query:X,...Y})}delete($,X,Y){let{container_id:U}=X;return this._client.delete(g`/containers/${U}/files/${$}`,{...Y,headers:e([{Accept:"*/*"},Y?.headers])})}}PX.Content=RG;class A8 extends u{constructor(){super(...arguments);this.files=new PX(this._client)}create($,X){return this._client.post("/containers",{body:$,...X})}retrieve($,X){return this._client.get(g`/containers/${$}`,X)}list($={},X){return this._client.getAPIList("/containers",q$,{query:$,...X})}delete($,X){return this._client.delete(g`/containers/${$}`,{...X,headers:e([{Accept:"*/*"},X?.headers])})}}A8.Files=PX;class TG extends u{create($,X,Y){let{include:U,...G}=X;return this._client.post(g`/conversations/${$}/items`,{query:{include:U},body:G,...Y})}retrieve($,X,Y){let{conversation_id:U,...G}=X;return this._client.get(g`/conversations/${U}/items/${$}`,{query:G,...Y})}list($,X={},Y){return this._client.getAPIList(g`/conversations/${$}/items`,dO,{query:X,...Y})}delete($,X,Y){let{conversation_id:U}=X;return this._client.delete(g`/conversations/${U}/items/${$}`,Y)}}class L8 extends u{constructor(){super(...arguments);this.items=new TG(this._client)}create($,X){return this._client.post("/conversations",{body:$,...X})}retrieve($,X){return this._client.get(g`/conversations/${$}`,X)}update($,X,Y){return this._client.post(g`/conversations/${$}`,{body:X,...Y})}delete($,X){return this._client.delete(g`/conversations/${$}`,X)}}L8.Items=TG;class IX extends u{create($,X){let Y=!!$.encoding_format,U=Y?$.encoding_format:"base64";if(Y)q4(this._client).debug("embeddings/user defined encoding_format:",$.encoding_format);let G=this._client.post("/embeddings",{body:{...$,encoding_format:U},...X});if(Y)return G;return q4(this._client).debug("embeddings/decoding base64 embeddings from base64"),G._thenUnwrap((z)=>{if(z&&z.data)z.data.forEach((W)=>{let Q=W.embedding;W.embedding=YA(Q)});return z})}}class vG extends u{retrieve($,X,Y){let{eval_id:U,run_id:G}=X;return this._client.get(g`/evals/${U}/runs/${G}/output_items/${$}`,Y)}list($,X,Y){let{eval_id:U,...G}=X;return this._client.getAPIList(g`/evals/${U}/runs/${$}/output_items`,q$,{query:G,...Y})}}class xX extends u{constructor(){super(...arguments);this.outputItems=new vG(this._client)}create($,X,Y){return this._client.post(g`/evals/${$}/runs`,{body:X,...Y})}retrieve($,X,Y){let{eval_id:U}=X;return this._client.get(g`/evals/${U}/runs/${$}`,Y)}list($,X={},Y){return this._client.getAPIList(g`/evals/${$}/runs`,q$,{query:X,...Y})}delete($,X,Y){let{eval_id:U}=X;return this._client.delete(g`/evals/${U}/runs/${$}`,Y)}cancel($,X,Y){let{eval_id:U}=X;return this._client.post(g`/evals/${U}/runs/${$}`,Y)}}xX.OutputItems=vG;class K8 extends u{constructor(){super(...arguments);this.runs=new xX(this._client)}create($,X){return this._client.post("/evals",{body:$,...X})}retrieve($,X){return this._client.get(g`/evals/${$}`,X)}update($,X,Y){return this._client.post(g`/evals/${$}`,{body:X,...Y})}list($={},X){return this._client.getAPIList("/evals",q$,{query:$,...X})}delete($,X){return this._client.delete(g`/evals/${$}`,X)}}K8.Runs=xX;class SX extends u{create($,X){return this._client.post("/files",Q1({body:$,...X},this._client))}retrieve($,X){return this._client.get(g`/files/${$}`,X)}list($={},X){return this._client.getAPIList("/files",q$,{query:$,...X})}delete($,X){return this._client.delete(g`/files/${$}`,X)}content($,X){return this._client.get(g`/files/${$}/content`,{...X,headers:e([{Accept:"application/binary"},X?.headers]),__binaryResponse:!0})}async waitForProcessing($,{pollInterval:X=5000,maxWait:Y=1800000}={}){let U=new Set(["processed","error","deleted"]),G=Date.now(),z=await this.retrieve($);while(!z.status||!U.has(z.status))if(await X0(X),z=await this.retrieve($),Date.now()-G>Y)throw new H8({message:`Giving up on waiting for file ${$} to finish processing after ${Y} milliseconds.`});return z}}class CG extends u{}class BG extends u{run($,X){return this._client.post("/fine_tuning/alpha/graders/run",{body:$,...X})}validate($,X){return this._client.post("/fine_tuning/alpha/graders/validate",{body:$,...X})}}class kX extends u{constructor(){super(...arguments);this.graders=new BG(this._client)}}kX.Graders=BG;class jG extends u{create($,X,Y){return this._client.getAPIList(g`/fine_tuning/checkpoints/${$}/permissions`,S0,{body:X,method:"post",...Y})}retrieve($,X={},Y){return this._client.get(g`/fine_tuning/checkpoints/${$}/permissions`,{query:X,...Y})}delete($,X,Y){let{fine_tuned_model_checkpoint:U}=X;return this._client.delete(g`/fine_tuning/checkpoints/${U}/permissions/${$}`,Y)}}class bX extends u{constructor(){super(...arguments);this.permissions=new jG(this._client)}}bX.Permissions=jG;class PG extends u{list($,X={},Y){return this._client.getAPIList(g`/fine_tuning/jobs/${$}/checkpoints`,q$,{query:X,...Y})}}class fX extends u{constructor(){super(...arguments);this.checkpoints=new PG(this._client)}create($,X){return this._client.post("/fine_tuning/jobs",{body:$,...X})}retrieve($,X){return this._client.get(g`/fine_tuning/jobs/${$}`,X)}list($={},X){return this._client.getAPIList("/fine_tuning/jobs",q$,{query:$,...X})}cancel($,X){return this._client.post(g`/fine_tuning/jobs/${$}/cancel`,X)}listEvents($,X={},Y){return this._client.getAPIList(g`/fine_tuning/jobs/${$}/events`,q$,{query:X,...Y})}pause($,X){return this._client.post(g`/fine_tuning/jobs/${$}/pause`,X)}resume($,X){return this._client.post(g`/fine_tuning/jobs/${$}/resume`,X)}}fX.Checkpoints=PG;class U0 extends u{constructor(){super(...arguments);this.methods=new CG(this._client),this.jobs=new fX(this._client),this.checkpoints=new bX(this._client),this.alpha=new kX(this._client)}}U0.Methods=CG;U0.Jobs=fX;U0.Checkpoints=bX;U0.Alpha=kX;class IG extends u{}class _8 extends u{constructor(){super(...arguments);this.graderModels=new IG(this._client)}}_8.GraderModels=IG;class hX extends u{createVariation($,X){return this._client.post("/images/variations",Q1({body:$,...X},this._client))}edit($,X){return this._client.post("/images/edits",Q1({body:$,...X,stream:$.stream??!1},this._client))}generate($,X){return this._client.post("/images/generations",{body:$,...X,stream:$.stream??!1})}}class gX extends u{retrieve($,X){return this._client.get(g`/models/${$}`,X)}list($){return this._client.getAPIList("/models",S0,$)}delete($,X){return this._client.delete(g`/models/${$}`,X)}}class yX extends u{create($,X){return this._client.post("/moderations",{body:$,...X})}}function VA($,X){if(!X||!xk(X))return{...$,output_parsed:null,output:$.output.map((Y)=>{if(Y.type==="function_call")return{...Y,parsed_arguments:null};if(Y.type==="message")return{...Y,content:Y.content.map((U)=>({...U,parsed:null}))};else return Y})};return Hw($,X)}function Hw($,X){let Y=$.output.map((G)=>{if(G.type==="function_call")return{...G,parsed_arguments:bk(X,G)};if(G.type==="message"){let z=G.content.map((W)=>{if(W.type==="output_text")return{...W,parsed:Ik(X,W.text)};return W});return{...G,content:z}}return G}),U=Object.assign({},$,{output:Y});if(!Object.getOwnPropertyDescriptor($,"output_text"))N7(U);return Object.defineProperty(U,"output_parsed",{enumerable:!0,get(){for(let G of U.output){if(G.type!=="message")continue;for(let z of G.content)if(z.type==="output_text"&&z.parsed!==null)return z.parsed}return null}}),U}function Ik($,X){if($.text?.format?.type!=="json_schema")return null;if("$parseRaw"in $.text?.format)return($.text?.format).$parseRaw(X);return JSON.parse(X)}function xk($){if(zG($.text?.format))return!0;return!1}function Sk($){return $?.$brand==="auto-parseable-tool"}function kk($,X){return $.find((Y)=>Y.type==="function"&&Y.name===X)}function bk($,X){let Y=kk($.tools??[],X.name);return{...X,...X,parsed_arguments:Sk(Y)?Y.$parseRaw(X.arguments):Y?.strict?JSON.parse(X.arguments):null}}function N7($){let X=[];for(let Y of $.output){if(Y.type!=="message")continue;for(let U of Y.content)if(U.type==="output_text")X.push(U.text)}$.output_text=X.join("")}var mX,F7,_2,M7,OA,wA,DA,EA;class J7 extends w8{constructor($){super();mX.add(this),F7.set(this,void 0),_2.set(this,void 0),M7.set(this,void 0),Z$(this,F7,$,"f")}static createResponse($,X,Y){let U=new J7(X);return U._run(()=>U._createOrRetrieveResponse($,X,{...Y,headers:{...Y?.headers,"X-Stainless-Helper-Method":"stream"}})),U}async _createOrRetrieveResponse($,X,Y){let U=Y?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}B(this,mX,"m",OA).call(this);let G,z=null;if("response_id"in X)G=await $.responses.retrieve(X.response_id,{stream:!0},{...Y,signal:this.controller.signal,stream:!0}),z=X.starting_after??null;else G=await $.responses.create({...X,stream:!0},{...Y,signal:this.controller.signal});this._connected();for await(let W of G)B(this,mX,"m",wA).call(this,W,z);if(G.controller.signal?.aborted)throw new k4;return B(this,mX,"m",DA).call(this)}[(F7=new WeakMap,_2=new WeakMap,M7=new WeakMap,mX=new WeakSet,OA=function $(){if(this.ended)return;Z$(this,_2,void 0,"f")},wA=function $(X,Y){if(this.ended)return;let U=(z,W)=>{if(Y==null||W.sequence_number>Y)this._emit(z,W)},G=B(this,mX,"m",EA).call(this,X);switch(U("event",X),X.type){case"response.output_text.delta":{let z=G.output[X.output_index];if(!z)throw new G$(`missing output at index ${X.output_index}`);if(z.type==="message"){let W=z.content[X.content_index];if(!W)throw new G$(`missing content at index ${X.content_index}`);if(W.type!=="output_text")throw new G$(`expected content to be 'output_text', got ${W.type}`);U("response.output_text.delta",{...X,snapshot:W.text})}break}case"response.function_call_arguments.delta":{let z=G.output[X.output_index];if(!z)throw new G$(`missing output at index ${X.output_index}`);if(z.type==="function_call")U("response.function_call_arguments.delta",{...X,snapshot:z.arguments});break}default:U(X.type,X);break}},DA=function $(){if(this.ended)throw new G$("stream has ended, this shouldn't happen");let X=B(this,_2,"f");if(!X)throw new G$("request ended without sending any events");Z$(this,_2,void 0,"f");let Y=fk(X,B(this,F7,"f"));return Z$(this,M7,Y,"f"),Y},EA=function $(X){let Y=B(this,_2,"f");if(!Y){if(X.type!=="response.created")throw new G$(`When snapshot hasn't been set yet, expected 'response.created' event, got ${X.type}`);return Y=Z$(this,_2,X.response,"f"),Y}switch(X.type){case"response.output_item.added":{Y.output.push(X.item);break}case"response.content_part.added":{let U=Y.output[X.output_index];if(!U)throw new G$(`missing output at index ${X.output_index}`);if(U.type==="message")U.content.push(X.part);break}case"response.output_text.delta":{let U=Y.output[X.output_index];if(!U)throw new G$(`missing output at index ${X.output_index}`);if(U.type==="message"){let G=U.content[X.content_index];if(!G)throw new G$(`missing content at index ${X.content_index}`);if(G.type!=="output_text")throw new G$(`expected content to be 'output_text', got ${G.type}`);G.text+=X.delta}break}case"response.function_call_arguments.delta":{let U=Y.output[X.output_index];if(!U)throw new G$(`missing output at index ${X.output_index}`);if(U.type==="function_call")U.arguments+=X.delta;break}case"response.completed":{Z$(this,_2,X.response,"f");break}}return Y},Symbol.asyncIterator)](){let $=[],X=[],Y=!1;return this.on("event",(U)=>{let G=X.shift();if(G)G.resolve(U);else $.push(U)}),this.on("end",()=>{Y=!0;for(let U of X)U.resolve(void 0);X.length=0}),this.on("abort",(U)=>{Y=!0;for(let G of X)G.reject(U);X.length=0}),this.on("error",(U)=>{Y=!0;for(let G of X)G.reject(U);X.length=0}),{next:async()=>{if(!$.length){if(Y)return{value:void 0,done:!0};return new Promise((G,z)=>X.push({resolve:G,reject:z})).then((G)=>G?{value:G,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}async finalResponse(){await this.done();let $=B(this,M7,"f");if(!$)throw new G$("stream ended without producing a ChatCompletion");return $}}function fk($,X){return VA($,X)}class xG extends u{list($,X={},Y){return this._client.getAPIList(g`/responses/${$}/input_items`,q$,{query:X,...Y})}}class q8 extends u{constructor(){super(...arguments);this.inputItems=new xG(this._client)}create($,X){return this._client.post("/responses",{body:$,...X,stream:$.stream??!1})._thenUnwrap((Y)=>{if("object"in Y&&Y.object==="response")N7(Y);return Y})}retrieve($,X={},Y){return this._client.get(g`/responses/${$}`,{query:X,...Y,stream:X?.stream??!1})._thenUnwrap((U)=>{if("object"in U&&U.object==="response")N7(U);return U})}delete($,X){return this._client.delete(g`/responses/${$}`,{...X,headers:e([{Accept:"*/*"},X?.headers])})}parse($,X){return this._client.responses.create($,X)._thenUnwrap((Y)=>Hw(Y,$))}stream($,X){return J7.createResponse(this._client,$,X)}cancel($,X){return this._client.post(g`/responses/${$}/cancel`,X)}}q8.InputItems=xG;class SG extends u{create($,X,Y){return this._client.post(g`/uploads/${$}/parts`,Q1({body:X,...Y},this._client))}}class R8 extends u{constructor(){super(...arguments);this.parts=new SG(this._client)}create($,X){return this._client.post("/uploads",{body:$,...X})}cancel($,X){return this._client.post(g`/uploads/${$}/cancel`,X)}complete($,X,Y){return this._client.post(g`/uploads/${$}/complete`,{body:X,...Y})}}R8.Parts=SG;var NA=async($)=>{let X=await Promise.allSettled($),Y=X.filter((G)=>G.status==="rejected");if(Y.length){for(let G of Y)console.error(G.reason);throw new Error(`${Y.length} promise(s) failed - see the above errors`)}let U=[];for(let G of X)if(G.status==="fulfilled")U.push(G.value);return U};class kG extends u{create($,X,Y){return this._client.post(g`/vector_stores/${$}/file_batches`,{body:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}retrieve($,X,Y){let{vector_store_id:U}=X;return this._client.get(g`/vector_stores/${U}/file_batches/${$}`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}cancel($,X,Y){let{vector_store_id:U}=X;return this._client.post(g`/vector_stores/${U}/file_batches/${$}/cancel`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}async createAndPoll($,X,Y){let U=await this.create($,X);return await this.poll($,U.id,Y)}listFiles($,X,Y){let{vector_store_id:U,...G}=X;return this._client.getAPIList(g`/vector_stores/${U}/file_batches/${$}/files`,q$,{query:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}async poll($,X,Y){let U=e([Y?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":Y?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:G,response:z}=await this.retrieve(X,{vector_store_id:$},{...Y,headers:U}).withResponse();switch(G.status){case"in_progress":let W=5000;if(Y?.pollIntervalMs)W=Y.pollIntervalMs;else{let Q=z.headers.get("openai-poll-after-ms");if(Q){let Z=parseInt(Q);if(!isNaN(Z))W=Z}}await X0(W);break;case"failed":case"cancelled":case"completed":return G}}}async uploadAndPoll($,{files:X,fileIds:Y=[]},U){if(X==null||X.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let G=U?.maxConcurrency??5,z=Math.min(G,X.length),W=this._client,Q=X.values(),Z=[...Y];async function H(O){for(let w of O){let D=await W.files.create({file:w,purpose:"assistants"},U);Z.push(D.id)}}let V=Array(z).fill(Q).map(H);return await NA(V),await this.createAndPoll($,{file_ids:Z})}}class bG extends u{create($,X,Y){return this._client.post(g`/vector_stores/${$}/files`,{body:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}retrieve($,X,Y){let{vector_store_id:U}=X;return this._client.get(g`/vector_stores/${U}/files/${$}`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}update($,X,Y){let{vector_store_id:U,...G}=X;return this._client.post(g`/vector_stores/${U}/files/${$}`,{body:G,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}list($,X={},Y){return this._client.getAPIList(g`/vector_stores/${$}/files`,q$,{query:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}delete($,X,Y){let{vector_store_id:U}=X;return this._client.delete(g`/vector_stores/${U}/files/${$}`,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}async createAndPoll($,X,Y){let U=await this.create($,X,Y);return await this.poll($,U.id,Y)}async poll($,X,Y){let U=e([Y?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":Y?.pollIntervalMs?.toString()??void 0}]);while(!0){let G=await this.retrieve(X,{vector_store_id:$},{...Y,headers:U}).withResponse(),z=G.data;switch(z.status){case"in_progress":let W=5000;if(Y?.pollIntervalMs)W=Y.pollIntervalMs;else{let Q=G.response.headers.get("openai-poll-after-ms");if(Q){let Z=parseInt(Q);if(!isNaN(Z))W=Z}}await X0(W);break;case"failed":case"completed":return z}}}async upload($,X,Y){let U=await this._client.files.create({file:X,purpose:"assistants"},Y);return this.create($,{file_id:U.id},Y)}async uploadAndPoll($,X,Y){let U=await this.upload($,X,Y);return await this.poll($,U.id,Y)}content($,X,Y){let{vector_store_id:U}=X;return this._client.getAPIList(g`/vector_stores/${U}/files/${$}/content`,S0,{...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}}class q2 extends u{constructor(){super(...arguments);this.files=new bG(this._client),this.fileBatches=new kG(this._client)}create($,X){return this._client.post("/vector_stores",{body:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}retrieve($,X){return this._client.get(g`/vector_stores/${$}`,{...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}update($,X,Y){return this._client.post(g`/vector_stores/${$}`,{body:X,...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}list($={},X){return this._client.getAPIList("/vector_stores",q$,{query:$,...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}delete($,X){return this._client.delete(g`/vector_stores/${$}`,{...X,headers:e([{"OpenAI-Beta":"assistants=v2"},X?.headers])})}search($,X,Y){return this._client.getAPIList(g`/vector_stores/${$}/search`,S0,{body:X,method:"post",...Y,headers:e([{"OpenAI-Beta":"assistants=v2"},Y?.headers])})}}q2.Files=bG;q2.FileBatches=kG;var uX,FA,A7;class cX extends u{constructor(){super(...arguments);uX.add(this)}async unwrap($,X,Y=this._client.webhookSecret,U=300){return await this.verifySignature($,X,Y,U),JSON.parse($)}async verifySignature($,X,Y=this._client.webhookSecret,U=300){if(typeof crypto==="undefined"||typeof crypto.subtle.importKey!=="function"||typeof crypto.subtle.verify!=="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");B(this,uX,"m",FA).call(this,Y);let G=e([X]).values,z=B(this,uX,"m",A7).call(this,G,"webhook-signature"),W=B(this,uX,"m",A7).call(this,G,"webhook-timestamp"),Q=B(this,uX,"m",A7).call(this,G,"webhook-id"),Z=parseInt(W,10);if(isNaN(Z))throw new I0("Invalid webhook timestamp format");let H=Math.floor(Date.now()/1000);if(H-Z>U)throw new I0("Webhook timestamp is too old");if(Z>H+U)throw new I0("Webhook timestamp is too new");let V=z.split(" ").map((E)=>E.startsWith("v1,")?E.substring(3):E),O=Y.startsWith("whsec_")?Buffer.from(Y.replace("whsec_",""),"base64"):Buffer.from(Y,"utf-8"),w=Q?`${Q}.${W}.${$}`:`${W}.${$}`,D=await crypto.subtle.importKey("raw",O,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let E of V)try{let F=Buffer.from(E,"base64");if(await crypto.subtle.verify("HMAC",D,F,new TextEncoder().encode(w)))return}catch{continue}throw new I0("The given webhook signature does not match the expected signature")}}uX=new WeakSet,FA=function $(X){if(typeof X!=="string"||X.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},A7=function $(X,Y){if(!X)throw new Error("Headers are required");let U=X.get(Y);if(U===null||U===void 0)throw new Error(`Missing required header: ${Y}`);return U};var Vw,Ow,L7,MA;class K${constructor({baseURL:$=L2("OPENAI_BASE_URL"),apiKey:X=L2("OPENAI_API_KEY"),organization:Y=L2("OPENAI_ORG_ID")??null,project:U=L2("OPENAI_PROJECT_ID")??null,webhookSecret:G=L2("OPENAI_WEBHOOK_SECRET")??null,...z}={}){if(Vw.add(this),L7.set(this,void 0),this.completions=new jX(this),this.chat=new D8(this),this.embeddings=new IX(this),this.files=new SX(this),this.images=new hX(this),this.audio=new f0(this),this.moderations=new yX(this),this.models=new gX(this),this.fineTuning=new U0(this),this.graders=new _8(this),this.vectorStores=new q2(this),this.webhooks=new cX(this),this.beta=new h0(this),this.batches=new vX(this),this.uploads=new R8(this),this.responses=new q8(this),this.conversations=new L8(this),this.evals=new K8(this),this.containers=new A8(this),X===void 0)throw new G$("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");let W={apiKey:X,organization:Y,project:U,webhookSecret:G,...z,baseURL:$||"https://api.openai.com/v1"};if(!W.dangerouslyAllowBrowser&&KJ())throw new G$(`It looks like you're running in a browser-like environment.
|
|
118
118
|
|
|
119
119
|
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
120
120
|
If you understand the risks and have appropriate mitigations in place,
|
|
@@ -123,20 +123,20 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
|
123
123
|
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
|
|
124
124
|
|
|
125
125
|
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
126
|
-
`);this.baseURL=W.baseURL,this.timeout=W.timeout??Ow.DEFAULT_TIMEOUT,this.logger=W.logger??console;let Q="warn";this.logLevel=Q,this.logLevel=cO(W.logLevel,"ClientOptions.logLevel",this)??cO(L2("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??Q,this.fetchOptions=W.fetchOptions,this.maxRetries=W.maxRetries??2,this.fetch=W.fetch??qJ(),Z$(this,L7,TJ,"f"),this._options=W,this.apiKey=X,this.organization=Y,this.project=U,this.webhookSecret=G}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:X}){return}async authHeaders($){return e([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery($){return mO($,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${F2}`}defaultIdempotencyKey(){return`stainless-node-retry-${PO()}`}makeStatusError($,X,Y,U){return C4.generate($,X,Y,U)}buildURL($,X,Y){let U=!B(this,Vw,"m",MA).call(this)&&Y||this.baseURL,G=DJ($)?new URL($):new URL(U+(U.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),z=this.defaultQuery();if(!EJ(z))X={...z,...X};if(typeof X==="object"&&X&&!Array.isArray(X))G.search=this.stringifyQuery(X);return G.toString()}async prepareOptions($){}async prepareRequest($,{url:X,options:Y}){}get($,X){return this.methodRequest("get",$,X)}post($,X){return this.methodRequest("post",$,X)}patch($,X){return this.methodRequest("patch",$,X)}put($,X){return this.methodRequest("put",$,X)}delete($,X){return this.methodRequest("delete",$,X)}methodRequest($,X,Y){return this.request(Promise.resolve(Y).then((U)=>{return{method:$,path:X,...U}}))}request($,X=null){return new V8(this,this.makeRequest($,X,void 0))}async makeRequest($,X,Y){let U=await $,G=U.maxRetries??this.maxRetries;if(X==null)X=G;await this.prepareOptions(U);let{req:z,url:W,timeout:Q}=await this.buildRequest(U,{retryCount:G-X});await this.prepareRequest(z,{url:W,options:U});let Z="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),H=Y===void 0?"":`, retryOf: ${Y}`,V=Date.now();if(q4(this).debug(`[${Z}] sending request`,x0({retryOfRequestLogID:Y,method:U.method,url:W,options:U,headers:z.headers})),U.signal?.aborted)throw new k4;let O=new AbortController,w=await this.fetchWithTimeout(W,z,Q,O).catch(cY),D=Date.now();if(w instanceof Error){let J=`retrying, ${X} attempts remaining`;if(U.signal?.aborted)throw new k4;let A=uY(w)||/timed? ?out/i.test(String(w)+("cause"in w?String(w.cause):""));if(X)return q4(this).info(`[${Z}] connection ${A?"timed out":"failed"} - ${J}`),q4(this).debug(`[${Z}] connection ${A?"timed out":"failed"} (${J})`,x0({retryOfRequestLogID:Y,url:W,durationMs:D-V,message:w.message})),this.retryRequest(U,X,Y??Z);if(q4(this).info(`[${Z}] connection ${A?"timed out":"failed"} - error; no more retries left`),q4(this).debug(`[${Z}] connection ${A?"timed out":"failed"} (error; no more retries left)`,x0({retryOfRequestLogID:Y,url:W,durationMs:D-V,message:w.message})),A)throw new H8;throw new Z8({cause:w})}let E=[...w.headers.entries()].filter(([J])=>J==="x-request-id").map(([J,A])=>", "+J+": "+JSON.stringify(A)).join(""),F=`[${Z}${H}${E}] ${z.method} ${W} ${w.ok?"succeeded":"failed"} with status ${w.status} in ${D-V}ms`;if(!w.ok){let J=await this.shouldRetry(w);if(X&&J){let I=`retrying, ${X} attempts remaining`;return await RJ(w.body),q4(this).info(`${F} - ${I}`),q4(this).debug(`[${Z}] response error (${I})`,x0({retryOfRequestLogID:Y,url:w.url,status:w.status,headers:w.headers,durationMs:D-V})),this.retryRequest(U,X,Y??Z,w.headers)}let A=J?"error; no more retries left":"error; not retryable";q4(this).info(`${F} - ${A}`);let L=await w.text().catch((I)=>cY(I).message),T=MJ(L),q=T?void 0:L;throw q4(this).debug(`[${Z}] response error (${A})`,x0({retryOfRequestLogID:Y,url:w.url,status:w.status,headers:w.headers,message:q,durationMs:Date.now()-V})),this.makeStatusError(w.status,T,q,w.headers)}return q4(this).info(F),q4(this).debug(`[${Z}] response start`,x0({retryOfRequestLogID:Y,url:w.url,status:w.status,headers:w.headers,durationMs:D-V})),{response:w,options:U,controller:O,requestLogID:Z,retryOfRequestLogID:Y,startTime:V}}getAPIList($,X,Y){return this.requestAPIList(X,{method:"get",path:$,...Y})}requestAPIList($,X){let Y=this.makeRequest(X,null,void 0);return new $7(this,Y,$)}async fetchWithTimeout($,X,Y,U){let{signal:G,method:z,...W}=X||{};if(G)G.addEventListener("abort",()=>U.abort());let Q=setTimeout(()=>U.abort(),Y),Z=globalThis.ReadableStream&&W.body instanceof globalThis.ReadableStream||typeof W.body==="object"&&W.body!==null&&Symbol.asyncIterator in W.body,H={signal:U.signal,...Z?{duplex:"half"}:{},method:"GET",...W};if(z)H.method=z.toUpperCase();try{return await this.fetch.call(void 0,$,H)}finally{clearTimeout(Q)}}async shouldRetry($){let X=$.headers.get("x-should-retry");if(X==="true")return!0;if(X==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,X,Y,U){let G,z=U?.get("retry-after-ms");if(z){let Q=parseFloat(z);if(!Number.isNaN(Q))G=Q}let W=U?.get("retry-after");if(W&&!G){let Q=parseFloat(W);if(!Number.isNaN(Q))G=Q*1000;else G=Date.parse(W)-Date.now()}if(!(G&&0<=G&&G<60000)){let Q=$.maxRetries??this.maxRetries;G=this.calculateDefaultRetryTimeoutMillis(X,Q)}return await
|
|
127
|
-
`)});return{model:$,messages:W}}var z$=1e6,JA={"gpt-5":{promptPricePerToken:1.25/z$,promptPricePerTokenCached:0.125/z$,completionPricePerToken:10/z$},"gpt-5-mini":{promptPricePerToken:0.25/z$,promptPricePerTokenCached:0.025/z$,completionPricePerToken:2/z$},"gpt-5-nano":{promptPricePerToken:0.05/z$,promptPricePerTokenCached:0.005/z$,completionPricePerToken:0.4/z$},"gpt-4.1":{promptPricePerToken:3/z$,promptPricePerTokenCached:0.75/z$,completionPricePerToken:12/z$},"gpt-4.1-mini":{promptPricePerToken:0.8/z$,promptPricePerTokenCached:0.2/z$,completionPricePerToken:3.2/z$},"gpt-4.1-nano":{promptPricePerToken:0.2/z$,promptPricePerTokenCached:0.05/z$,completionPricePerToken:0.8/z$},"gpt-4o":{promptPricePerToken:2.5/z$,promptPricePerTokenCached:1.25/z$,completionPricePerToken:10/z$},"gpt-4o-mini":{promptPricePerToken:0.15/z$,promptPricePerTokenCached:0.075/z$,completionPricePerToken:0.6/z$},o1:{promptPricePerToken:15/z$,promptPricePerTokenCached:7.5/z$,completionPricePerToken:60/z$},"o1-mini":{promptPricePerToken:1.1/z$,promptPricePerTokenCached:0.55/z$,completionPricePerToken:4.4/z$},o3:{promptPricePerToken:10/z$,promptPricePerTokenCached:2.5/z$,completionPricePerToken:40/z$},"o3-mini":{promptPricePerToken:1.1/z$,promptPricePerTokenCached:0.55/z$,completionPricePerToken:4.4/z$},"o4-mini":{promptPricePerToken:4/z$,promptPricePerTokenCached:1/z$,completionPricePerToken:16/z$},"codex-mini-latest":{promptPricePerToken:1.5/z$,promptPricePerTokenCached:0.375/z$,completionPricePerToken:6/z$},"chatgpt-4o-latest":{promptPricePerToken:5/z$,promptPricePerTokenCached:5/z$,completionPricePerToken:15/z$},"gpt-4":{promptPricePerToken:30/z$,promptPricePerTokenCached:30/z$,completionPricePerToken:60/z$},"gpt-4-turbo":{promptPricePerToken:10/z$,promptPricePerTokenCached:10/z$,completionPricePerToken:30/z$},"gpt-3.5-turbo":{promptPricePerToken:0.5/z$,promptPricePerTokenCached:0.5/z$,completionPricePerToken:1.5/z$},"gpt-4-32k":{promptPricePerToken:60/z$,promptPricePerTokenCached:60/z$,completionPricePerToken:120/z$},"gpt-3.5-turbo-16k":{promptPricePerToken:3/z$,promptPricePerTokenCached:3/z$,completionPricePerToken:4/z$}};function pk($){let Y=Object.keys(JA).filter((U)=>$.startsWith(U)).sort((U,G)=>G.length-U.length)[0];if(!Y)return;return JA[Y]}function LA($,X){let Y=$.prompt_tokens,U=$.prompt_tokens_details?.cached_tokens??0,G=Y-U,z=$.completion_tokens,W=pk(X),Q=0;if(W)Q=Y*W.promptPricePerToken+G*(W.promptPricePerTokenCached??0)+z*W.completionPricePerToken;else console.warn(`No pricing facts found for model ${X}. Giving a price of 0.`);return Q}function dk($,X){return async function Y(U,G){let z,W,Q=0;try{let Z=await $.chat.completions.create({...U,stream:!1,response_format:{type:"json_object"}},G),{content:H,refusal:V}=Z.choices[0].message;if(W=Z.usage,H&&W)Q=LA(W,U.model),z=JSON.parse(H);if(!H)throw new Error(`No content${W?"":" or usage"} was given in the completion from OpenAI.${V?` Instead, OpenAI gave the following refusal: "${V}"`:""}`)}catch(Z){X?.error(Z)}return z??={},W??={completion_tokens:0,prompt_tokens:0,total_tokens:0},{data:z,usage:W,usdPrice:Q}}}var AA=new Map,KA=class{usdBudget;usdMinimum;getCompletionSquirreled;getUnknownJsonFromOpenAi;getUnknownJsonFromOpenAiSquirreled;squirrel;model;client;lastUsage;logger;constructor({model:$,usdBudget:X,usdMinimum:Y,apiKey:U,cachingMode:G,cacheKey:z="openai-safegen",logger:W=console}){this.usdBudget=X,this.usdMinimum=Y,this.model=$,this.squirrel=new wJ(G),this.logger=W;let Q=AA.get(U);if(!Q)Q=new K$({apiKey:U,dangerouslyAllowBrowser:!1}),AA.set(U,Q);this.client=Q,this.getCompletionSquirreled=this.squirrel.add("openai-safegen",this.client.completions.create.bind(this.client.completions)),this.getUnknownJsonFromOpenAi=dk(this.client,this.logger),this.getUnknownJsonFromOpenAiSquirreled=this.squirrel.add(z,this.getUnknownJsonFromOpenAi),this.from=jM(async(...Z)=>{if(this.usdBudget<this.usdMinimum)return W?.warn("SafeGen budget exhausted"),Z[2];let H=ck($,...Z),V=Z[0],O=Z[3],{data:w,usage:D,usdPrice:E}=await this.getUnknownJsonFromOpenAiSquirreled.for(`${V.replace(/[^a-zA-Z0-9-_. ]/g,"_")}-${O.length}`).get(H);return this.lastUsage=D,this.usdBudget-=E,w},W),this.object=this.from}getCompletion=async($,X)=>{if(this.usdBudget<this.usdMinimum)return this.logger.warn("SafeGen budget exhausted"),"";let Y=await this.getCompletionSquirreled.for($).get(X),{usage:U}=Y;if(U){let G=LA(U,X.model);this.usdBudget-=G}return Y.choices[0].text.trim()};from;object;boolean($){return IM($,async(X,Y)=>{return(await this.getCompletion(Y,{model:this.model,prompt:X,max_tokens:1})).toLowerCase()})}number($,X,Y){return xM($,X,Y,async(U,G)=>this.getCompletion(G,{model:this.model,prompt:U,max_tokens:6}))}choose($,X,Y=1,U=Y){return SM($,X,Y,U,async(G,z,W)=>this.getCompletion(z,{model:this.model,prompt:G,max_tokens:W}),this.logger)}};import{exec as pm}from"child_process";class M extends Array{constructor($,X){if(super($),this.sign=X,Object.setPrototypeOf(this,M.prototype),$>M.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded")}static BigInt($){var X=Math.floor,Y=Number.isFinite;if(typeof $=="number"){if($===0)return M.__zero();if(M.__isOneDigitInt($))return 0>$?M.__oneDigit(-$,!0):M.__oneDigit($,!1);if(!Y($)||X($)!==$)throw new RangeError("The number "+$+" cannot be converted to BigInt because it is not an integer");return M.__fromDouble($)}if(typeof $=="string"){let U=M.__fromString($);if(U===null)throw new SyntaxError("Cannot convert "+$+" to a BigInt");return U}if(typeof $=="boolean")return $===!0?M.__oneDigit(1,!1):M.__zero();if(typeof $=="object"){if($.constructor===M)return $;let U=M.__toPrimitive($);return M.BigInt(U)}throw new TypeError("Cannot convert "+$+" to a BigInt")}toDebugString(){let $=["BigInt["];for(let X of this)$.push((X?(X>>>0).toString(16):X)+", ");return $.push("]"),$.join("")}toString($=10){if(2>$||36<$)throw new RangeError("toString() radix argument must be between 2 and 36");return this.length===0?"0":($&$-1)==0?M.__toStringBasePowerOfTwo(this,$):M.__toStringGeneric(this,$,!1)}valueOf(){throw new Error("Convert JSBI instances to native numbers using `toNumber`.")}static toNumber($){let X=$.length;if(X===0)return 0;if(X===1){let F=$.__unsignedDigit(0);return $.sign?-F:F}let Y=$.__digit(X-1),U=M.__clz30(Y),G=30*X-U;if(1024<G)return $.sign?-1/0:1/0;let z=G-1,W=Y,Q=X-1,Z=U+3,H=Z===32?0:W<<Z;H>>>=12;let V=Z-12,O=12<=Z?0:W<<20+Z,w=20+Z;for(0<V&&0<Q&&(Q--,W=$.__digit(Q),H|=W>>>30-V,O=W<<V+2,w=V+2);0<w&&0<Q;)Q--,W=$.__digit(Q),O|=30<=w?W<<w-30:W>>>30-w,w-=30;let D=M.__decideRounding($,w,Q,W);if((D===1||D===0&&(1&O)==1)&&(O=O+1>>>0,O===0&&(H++,H>>>20!=0&&(H=0,z++,1023<z))))return $.sign?-1/0:1/0;let E=$.sign?-2147483648:0;return z=z+1023<<20,M.__kBitConversionInts[M.__kBitConversionIntHigh]=E|z|H,M.__kBitConversionInts[M.__kBitConversionIntLow]=O,M.__kBitConversionDouble[0]}static unaryMinus($){if($.length===0)return $;let X=$.__copy();return X.sign=!$.sign,X}static bitwiseNot($){return $.sign?M.__absoluteSubOne($).__trim():M.__absoluteAddOne($,!0)}static exponentiate($,X){if(X.sign)throw new RangeError("Exponent must be positive");if(X.length===0)return M.__oneDigit(1,!1);if($.length===0)return $;if($.length===1&&$.__digit(0)===1)return $.sign&&(1&X.__digit(0))==0?M.unaryMinus($):$;if(1<X.length)throw new RangeError("BigInt too big");let Y=X.__unsignedDigit(0);if(Y===1)return $;if(Y>=M.__kMaxLengthBits)throw new RangeError("BigInt too big");if($.length===1&&$.__digit(0)===2){let z=1+(0|Y/30),W=$.sign&&(1&Y)!=0,Q=new M(z,W);Q.__initializeDigits();let Z=1<<Y%30;return Q.__setDigit(z-1,Z),Q}let U=null,G=$;for((1&Y)!=0&&(U=$),Y>>=1;Y!==0;Y>>=1)G=M.multiply(G,G),(1&Y)!=0&&(U===null?U=G:U=M.multiply(U,G));return U}static multiply($,X){if($.length===0)return $;if(X.length===0)return X;let Y=$.length+X.length;30<=$.__clzmsd()+X.__clzmsd()&&Y--;let U=new M(Y,$.sign!==X.sign);U.__initializeDigits();for(let G=0;G<$.length;G++)M.__multiplyAccumulate(X,$.__digit(G),U,G);return U.__trim()}static divide($,X){if(X.length===0)throw new RangeError("Division by zero");if(0>M.__absoluteCompare($,X))return M.__zero();let Y=$.sign!==X.sign,U=X.__unsignedDigit(0),G;if(X.length===1&&32767>=U){if(U===1)return Y===$.sign?$:M.unaryMinus($);G=M.__absoluteDivSmall($,U,null)}else G=M.__absoluteDivLarge($,X,!0,!1);return G.sign=Y,G.__trim()}static remainder($,X){if(X.length===0)throw new RangeError("Division by zero");if(0>M.__absoluteCompare($,X))return $;let Y=X.__unsignedDigit(0);if(X.length===1&&32767>=Y){if(Y===1)return M.__zero();let G=M.__absoluteModSmall($,Y);return G===0?M.__zero():M.__oneDigit(G,$.sign)}let U=M.__absoluteDivLarge($,X,!1,!0);return U.sign=$.sign,U.__trim()}static add($,X){let Y=$.sign;return Y===X.sign?M.__absoluteAdd($,X,Y):0<=M.__absoluteCompare($,X)?M.__absoluteSub($,X,Y):M.__absoluteSub(X,$,!Y)}static subtract($,X){let Y=$.sign;return Y===X.sign?0<=M.__absoluteCompare($,X)?M.__absoluteSub($,X,Y):M.__absoluteSub(X,$,!Y):M.__absoluteAdd($,X,Y)}static leftShift($,X){return X.length===0||$.length===0?$:X.sign?M.__rightShiftByAbsolute($,X):M.__leftShiftByAbsolute($,X)}static signedRightShift($,X){return X.length===0||$.length===0?$:X.sign?M.__leftShiftByAbsolute($,X):M.__rightShiftByAbsolute($,X)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan($,X){return 0>M.__compareToBigInt($,X)}static lessThanOrEqual($,X){return 0>=M.__compareToBigInt($,X)}static greaterThan($,X){return 0<M.__compareToBigInt($,X)}static greaterThanOrEqual($,X){return 0<=M.__compareToBigInt($,X)}static equal($,X){if($.sign!==X.sign)return!1;if($.length!==X.length)return!1;for(let Y=0;Y<$.length;Y++)if($.__digit(Y)!==X.__digit(Y))return!1;return!0}static notEqual($,X){return!M.equal($,X)}static bitwiseAnd($,X){var Y=Math.max;if(!$.sign&&!X.sign)return M.__absoluteAnd($,X).__trim();if($.sign&&X.sign){let U=Y($.length,X.length)+1,G=M.__absoluteSubOne($,U),z=M.__absoluteSubOne(X);return G=M.__absoluteOr(G,z,G),M.__absoluteAddOne(G,!0,G).__trim()}return $.sign&&([$,X]=[X,$]),M.__absoluteAndNot($,M.__absoluteSubOne(X)).__trim()}static bitwiseXor($,X){var Y=Math.max;if(!$.sign&&!X.sign)return M.__absoluteXor($,X).__trim();if($.sign&&X.sign){let z=Y($.length,X.length),W=M.__absoluteSubOne($,z),Q=M.__absoluteSubOne(X);return M.__absoluteXor(W,Q,W).__trim()}let U=Y($.length,X.length)+1;$.sign&&([$,X]=[X,$]);let G=M.__absoluteSubOne(X,U);return G=M.__absoluteXor(G,$,G),M.__absoluteAddOne(G,!0,G).__trim()}static bitwiseOr($,X){var Y=Math.max;let U=Y($.length,X.length);if(!$.sign&&!X.sign)return M.__absoluteOr($,X).__trim();if($.sign&&X.sign){let z=M.__absoluteSubOne($,U),W=M.__absoluteSubOne(X);return z=M.__absoluteAnd(z,W,z),M.__absoluteAddOne(z,!0,z).__trim()}$.sign&&([$,X]=[X,$]);let G=M.__absoluteSubOne(X,U);return G=M.__absoluteAndNot(G,$,G),M.__absoluteAddOne(G,!0,G).__trim()}static asIntN($,X){var Y=Math.floor;if(X.length===0)return X;if($=Y($),0>$)throw new RangeError("Invalid value: not (convertible to) a safe integer");if($===0)return M.__zero();if($>=M.__kMaxLengthBits)return X;let U=0|($+29)/30;if(X.length<U)return X;let G=X.__unsignedDigit(U-1),z=1<<($-1)%30;if(X.length===U&&G<z)return X;if((G&z)!==z)return M.__truncateToNBits($,X);if(!X.sign)return M.__truncateAndSubFromPowerOfTwo($,X,!0);if((G&z-1)==0){for(let W=U-2;0<=W;W--)if(X.__digit(W)!==0)return M.__truncateAndSubFromPowerOfTwo($,X,!1);return X.length===U&&G===z?X:M.__truncateToNBits($,X)}return M.__truncateAndSubFromPowerOfTwo($,X,!1)}static asUintN($,X){var Y=Math.floor;if(X.length===0)return X;if($=Y($),0>$)throw new RangeError("Invalid value: not (convertible to) a safe integer");if($===0)return M.__zero();if(X.sign){if($>M.__kMaxLengthBits)throw new RangeError("BigInt too big");return M.__truncateAndSubFromPowerOfTwo($,X,!1)}if($>=M.__kMaxLengthBits)return X;let U=0|($+29)/30;if(X.length<U)return X;let G=$%30;if(X.length==U){if(G===0)return X;if(X.__digit(U-1)>>>G==0)return X}return M.__truncateToNBits($,X)}static ADD($,X){if($=M.__toPrimitive($),X=M.__toPrimitive(X),typeof $=="string")return typeof X!="string"&&(X=X.toString()),$+X;if(typeof X=="string")return $.toString()+X;if($=M.__toNumeric($),X=M.__toNumeric(X),M.__isBigInt($)&&M.__isBigInt(X))return M.add($,X);if(typeof $=="number"&&typeof X=="number")return $+X;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT($,X){return M.__compare($,X,0)}static LE($,X){return M.__compare($,X,1)}static GT($,X){return M.__compare($,X,2)}static GE($,X){return M.__compare($,X,3)}static EQ($,X){for(;;){if(M.__isBigInt($))return M.__isBigInt(X)?M.equal($,X):M.EQ(X,$);if(typeof $=="number"){if(M.__isBigInt(X))return M.__equalToNumber(X,$);if(typeof X!="object")return $==X;X=M.__toPrimitive(X)}else if(typeof $=="string"){if(M.__isBigInt(X))return $=M.__fromString($),$!==null&&M.equal($,X);if(typeof X!="object")return $==X;X=M.__toPrimitive(X)}else if(typeof $=="boolean"){if(M.__isBigInt(X))return M.__equalToNumber(X,+$);if(typeof X!="object")return $==X;X=M.__toPrimitive(X)}else if(typeof $=="symbol"){if(M.__isBigInt(X))return!1;if(typeof X!="object")return $==X;X=M.__toPrimitive(X)}else if(typeof $=="object"){if(typeof X=="object"&&X.constructor!==M)return $==X;$=M.__toPrimitive($)}else return $==X}}static NE($,X){return!M.EQ($,X)}static DataViewGetBigInt64($,X,Y=!1){return M.asIntN(64,M.DataViewGetBigUint64($,X,Y))}static DataViewGetBigUint64($,X,Y=!1){let[U,G]=Y?[4,0]:[0,4],z=$.getUint32(X+U,Y),W=$.getUint32(X+G,Y),Q=new M(3,!1);return Q.__setDigit(0,1073741823&W),Q.__setDigit(1,(268435455&z)<<2|W>>>30),Q.__setDigit(2,z>>>28),Q.__trim()}static DataViewSetBigInt64($,X,Y,U=!1){M.DataViewSetBigUint64($,X,Y,U)}static DataViewSetBigUint64($,X,Y,U=!1){Y=M.asUintN(64,Y);let G=0,z=0;if(0<Y.length&&(z=Y.__digit(0),1<Y.length)){let Z=Y.__digit(1);z|=Z<<30,G=Z>>>2,2<Y.length&&(G|=Y.__digit(2)<<28)}let[W,Q]=U?[4,0]:[0,4];$.setUint32(X+W,G,U),$.setUint32(X+Q,z,U)}static __zero(){return new M(0,!1)}static __oneDigit($,X){let Y=new M(1,X);return Y.__setDigit(0,$),Y}__copy(){let $=new M(this.length,this.sign);for(let X=0;X<this.length;X++)$[X]=this[X];return $}__trim(){let $=this.length,X=this[$-1];for(;X===0;)$--,X=this[$-1],this.pop();return $===0&&(this.sign=!1),this}__initializeDigits(){for(let $=0;$<this.length;$++)this[$]=0}static __decideRounding($,X,Y,U){if(0<X)return-1;let G;if(0>X)G=-X-1;else{if(Y===0)return-1;Y--,U=$.__digit(Y),G=29}let z=1<<G;if((U&z)==0)return-1;if(z-=1,(U&z)!=0)return 1;for(;0<Y;)if(Y--,$.__digit(Y)!==0)return 1;return 0}static __fromDouble($){M.__kBitConversionDouble[0]=$;let X=2047&M.__kBitConversionInts[M.__kBitConversionIntHigh]>>>20,Y=X-1023,U=(0|Y/30)+1,G=new M(U,0>$),z=1048575&M.__kBitConversionInts[M.__kBitConversionIntHigh]|1048576,W=M.__kBitConversionInts[M.__kBitConversionIntLow],Q=20,Z=Y%30,H,V=0;if(Z<20){let O=Q-Z;V=O+32,H=z>>>O,z=z<<32-O|W>>>O,W<<=32-O}else if(Z===20)V=32,H=z,z=W,W=0;else{let O=Z-Q;V=32-O,H=z<<O|W>>>32-O,z=W<<O,W=0}G.__setDigit(U-1,H);for(let O=U-2;0<=O;O--)0<V?(V-=30,H=z>>>2,z=z<<30|W>>>2,W<<=30):H=0,G.__setDigit(O,H);return G.__trim()}static __isWhitespace($){return 13>=$&&9<=$||(159>=$?$==32:131071>=$?$==160||$==5760:196607>=$?($&=131071,10>=$||$==40||$==41||$==47||$==95||$==4096):$==65279)}static __fromString($,X=0){let Y=0,U=$.length,G=0;if(G===U)return M.__zero();let z=$.charCodeAt(G);for(;M.__isWhitespace(z);){if(++G===U)return M.__zero();z=$.charCodeAt(G)}if(z===43){if(++G===U)return null;z=$.charCodeAt(G),Y=1}else if(z===45){if(++G===U)return null;z=$.charCodeAt(G),Y=-1}if(X===0){if(X=10,z===48){if(++G===U)return M.__zero();if(z=$.charCodeAt(G),z===88||z===120){if(X=16,++G===U)return null;z=$.charCodeAt(G)}else if(z===79||z===111){if(X=8,++G===U)return null;z=$.charCodeAt(G)}else if(z===66||z===98){if(X=2,++G===U)return null;z=$.charCodeAt(G)}}}else if(X===16&&z===48){if(++G===U)return M.__zero();if(z=$.charCodeAt(G),z===88||z===120){if(++G===U)return null;z=$.charCodeAt(G)}}if(Y!=0&&X!==10)return null;for(;z===48;){if(++G===U)return M.__zero();z=$.charCodeAt(G)}let W=U-G,Q=M.__kMaxBitsPerChar[X],Z=M.__kBitsPerCharTableMultiplier-1;if(W>1073741824/Q)return null;let H=Q*W+Z>>>M.__kBitsPerCharTableShift,V=new M(0|(H+29)/30,!1),O=10>X?X:10,w=10<X?X-10:0;if((X&X-1)==0){Q>>=M.__kBitsPerCharTableShift;let D=[],E=[],F=!1;do{let J=0,A=0;for(;;){let L;if(z-48>>>0<O)L=z-48;else if((32|z)-97>>>0<w)L=(32|z)-87;else{F=!0;break}if(A+=Q,J=J<<Q|L,++G===U){F=!0;break}if(z=$.charCodeAt(G),30<A+Q)break}D.push(J),E.push(A)}while(!F);M.__fillFromParts(V,D,E)}else{V.__initializeDigits();let D=!1,E=0;do{let F=0,J=1;for(;;){let L;if(z-48>>>0<O)L=z-48;else if((32|z)-97>>>0<w)L=(32|z)-87;else{D=!0;break}let T=J*X;if(1073741823<T)break;if(J=T,F=F*X+L,E++,++G===U){D=!0;break}z=$.charCodeAt(G)}Z=30*M.__kBitsPerCharTableMultiplier-1;let A=0|(Q*E+Z>>>M.__kBitsPerCharTableShift)/30;V.__inplaceMultiplyAdd(J,F,A)}while(!D)}if(G!==U){if(!M.__isWhitespace(z))return null;for(G++;G<U;G++)if(z=$.charCodeAt(G),!M.__isWhitespace(z))return null}return V.sign=Y==-1,V.__trim()}static __fillFromParts($,X,Y){let U=0,G=0,z=0;for(let W=X.length-1;0<=W;W--){let Q=X[W],Z=Y[W];G|=Q<<z,z+=Z,z===30?($.__setDigit(U++,G),z=0,G=0):30<z&&($.__setDigit(U++,1073741823&G),z-=30,G=Q>>>Z-z)}if(G!==0){if(U>=$.length)throw new Error("implementation bug");$.__setDigit(U++,G)}for(;U<$.length;U++)$.__setDigit(U,0)}static __toStringBasePowerOfTwo($,X){let Y=$.length,U=X-1;U=(85&U>>>1)+(85&U),U=(51&U>>>2)+(51&U),U=(15&U>>>4)+(15&U);let G=U,z=X-1,W=$.__digit(Y-1),Q=M.__clz30(W),Z=0|(30*Y-Q+G-1)/G;if($.sign&&Z++,268435456<Z)throw new Error("string too long");let H=Array(Z),V=Z-1,O=0,w=0;for(let E=0;E<Y-1;E++){let F=$.__digit(E),J=(O|F<<w)&z;H[V--]=M.__kConversionChars[J];let A=G-w;for(O=F>>>A,w=30-A;w>=G;)H[V--]=M.__kConversionChars[O&z],O>>>=G,w-=G}let D=(O|W<<w)&z;for(H[V--]=M.__kConversionChars[D],O=W>>>G-w;O!==0;)H[V--]=M.__kConversionChars[O&z],O>>>=G;if($.sign&&(H[V--]="-"),V!=-1)throw new Error("implementation bug");return H.join("")}static __toStringGeneric($,X,Y){let U=$.length;if(U===0)return"";if(U===1){let E=$.__unsignedDigit(0).toString(X);return Y===!1&&$.sign&&(E="-"+E),E}let G=30*U-M.__clz30($.__digit(U-1)),z=M.__kMaxBitsPerChar[X],W=z-1,Q=G*M.__kBitsPerCharTableMultiplier;Q+=W-1,Q=0|Q/W;let Z=Q+1>>1,H=M.exponentiate(M.__oneDigit(X,!1),M.__oneDigit(Z,!1)),V,O,w=H.__unsignedDigit(0);if(H.length===1&&32767>=w){V=new M($.length,!1),V.__initializeDigits();let E=0;for(let F=2*$.length-1;0<=F;F--){let J=E<<15|$.__halfDigit(F);V.__setHalfDigit(F,0|J/w),E=0|J%w}O=E.toString(X)}else{let E=M.__absoluteDivLarge($,H,!0,!0);V=E.quotient;let F=E.remainder.__trim();O=M.__toStringGeneric(F,X,!0)}V.__trim();let D=M.__toStringGeneric(V,X,!0);for(;O.length<Z;)O="0"+O;return Y===!1&&$.sign&&(D="-"+D),D+O}static __unequalSign($){return $?-1:1}static __absoluteGreater($){return $?-1:1}static __absoluteLess($){return $?1:-1}static __compareToBigInt($,X){let Y=$.sign;if(Y!==X.sign)return M.__unequalSign(Y);let U=M.__absoluteCompare($,X);return 0<U?M.__absoluteGreater(Y):0>U?M.__absoluteLess(Y):0}static __compareToNumber($,X){if(M.__isOneDigitInt(X)){let Y=$.sign,U=0>X;if(Y!==U)return M.__unequalSign(Y);if($.length===0){if(U)throw new Error("implementation bug");return X===0?0:-1}if(1<$.length)return M.__absoluteGreater(Y);let G=Math.abs(X),z=$.__unsignedDigit(0);return z>G?M.__absoluteGreater(Y):z<G?M.__absoluteLess(Y):0}return M.__compareToDouble($,X)}static __compareToDouble($,X){if(X!==X)return X;if(X===1/0)return-1;if(X===-1/0)return 1;let Y=$.sign;if(Y!==0>X)return M.__unequalSign(Y);if(X===0)throw new Error("implementation bug: should be handled elsewhere");if($.length===0)return-1;M.__kBitConversionDouble[0]=X;let U=2047&M.__kBitConversionInts[M.__kBitConversionIntHigh]>>>20;if(U==2047)throw new Error("implementation bug: handled elsewhere");let G=U-1023;if(0>G)return M.__absoluteGreater(Y);let z=$.length,W=$.__digit(z-1),Q=M.__clz30(W),Z=30*z-Q,H=G+1;if(Z<H)return M.__absoluteLess(Y);if(Z>H)return M.__absoluteGreater(Y);let V=1048576|1048575&M.__kBitConversionInts[M.__kBitConversionIntHigh],O=M.__kBitConversionInts[M.__kBitConversionIntLow],w=20,D=29-Q;if(D!==(0|(Z-1)%30))throw new Error("implementation bug");let E,F=0;if(20>D){let J=w-D;F=J+32,E=V>>>J,V=V<<32-J|O>>>J,O<<=32-J}else if(D===20)F=32,E=V,V=O,O=0;else{let J=D-w;F=32-J,E=V<<J|O>>>32-J,V=O<<J,O=0}if(W>>>=0,E>>>=0,W>E)return M.__absoluteGreater(Y);if(W<E)return M.__absoluteLess(Y);for(let J=z-2;0<=J;J--){0<F?(F-=30,E=V>>>2,V=V<<30|O>>>2,O<<=30):E=0;let A=$.__unsignedDigit(J);if(A>E)return M.__absoluteGreater(Y);if(A<E)return M.__absoluteLess(Y)}if(V!==0||O!==0){if(F===0)throw new Error("implementation bug");return M.__absoluteLess(Y)}return 0}static __equalToNumber($,X){var Y=Math.abs;return M.__isOneDigitInt(X)?X===0?$.length===0:$.length===1&&$.sign===0>X&&$.__unsignedDigit(0)===Y(X):M.__compareToDouble($,X)===0}static __comparisonResultToBool($,X){return X===0?0>$:X===1?0>=$:X===2?0<$:X===3?0<=$:void 0}static __compare($,X,Y){if($=M.__toPrimitive($),X=M.__toPrimitive(X),typeof $=="string"&&typeof X=="string")switch(Y){case 0:return $<X;case 1:return $<=X;case 2:return $>X;case 3:return $>=X}if(M.__isBigInt($)&&typeof X=="string")return X=M.__fromString(X),X!==null&&M.__comparisonResultToBool(M.__compareToBigInt($,X),Y);if(typeof $=="string"&&M.__isBigInt(X))return $=M.__fromString($),$!==null&&M.__comparisonResultToBool(M.__compareToBigInt($,X),Y);if($=M.__toNumeric($),X=M.__toNumeric(X),M.__isBigInt($)){if(M.__isBigInt(X))return M.__comparisonResultToBool(M.__compareToBigInt($,X),Y);if(typeof X!="number")throw new Error("implementation bug");return M.__comparisonResultToBool(M.__compareToNumber($,X),Y)}if(typeof $!="number")throw new Error("implementation bug");if(M.__isBigInt(X))return M.__comparisonResultToBool(M.__compareToNumber(X,$),2^Y);if(typeof X!="number")throw new Error("implementation bug");return Y===0?$<X:Y===1?$<=X:Y===2?$>X:Y===3?$>=X:void 0}__clzmsd(){return M.__clz30(this.__digit(this.length-1))}static __absoluteAdd($,X,Y){if($.length<X.length)return M.__absoluteAdd(X,$,Y);if($.length===0)return $;if(X.length===0)return $.sign===Y?$:M.unaryMinus($);let U=$.length;($.__clzmsd()===0||X.length===$.length&&X.__clzmsd()===0)&&U++;let G=new M(U,Y),z=0,W=0;for(;W<X.length;W++){let Q=$.__digit(W)+X.__digit(W)+z;z=Q>>>30,G.__setDigit(W,1073741823&Q)}for(;W<$.length;W++){let Q=$.__digit(W)+z;z=Q>>>30,G.__setDigit(W,1073741823&Q)}return W<G.length&&G.__setDigit(W,z),G.__trim()}static __absoluteSub($,X,Y){if($.length===0)return $;if(X.length===0)return $.sign===Y?$:M.unaryMinus($);let U=new M($.length,Y),G=0,z=0;for(;z<X.length;z++){let W=$.__digit(z)-X.__digit(z)-G;G=1&W>>>30,U.__setDigit(z,1073741823&W)}for(;z<$.length;z++){let W=$.__digit(z)-G;G=1&W>>>30,U.__setDigit(z,1073741823&W)}return U.__trim()}static __absoluteAddOne($,X,Y=null){let U=$.length;Y===null?Y=new M(U,X):Y.sign=X;let G=1;for(let z=0;z<U;z++){let W=$.__digit(z)+G;G=W>>>30,Y.__setDigit(z,1073741823&W)}return G!=0&&Y.__setDigitGrow(U,1),Y}static __absoluteSubOne($,X){let Y=$.length;X=X||Y;let U=new M(X,!1),G=1;for(let z=0;z<Y;z++){let W=$.__digit(z)-G;G=1&W>>>30,U.__setDigit(z,1073741823&W)}if(G!=0)throw new Error("implementation bug");for(let z=Y;z<X;z++)U.__setDigit(z,0);return U}static __absoluteAnd($,X,Y=null){let U=$.length,G=X.length,z=G;if(U<G){z=U;let Z=$,H=U;$=X,U=G,X=Z,G=H}let W=z;Y===null?Y=new M(W,!1):W=Y.length;let Q=0;for(;Q<z;Q++)Y.__setDigit(Q,$.__digit(Q)&X.__digit(Q));for(;Q<W;Q++)Y.__setDigit(Q,0);return Y}static __absoluteAndNot($,X,Y=null){let U=$.length,G=X.length,z=G;U<G&&(z=U);let W=U;Y===null?Y=new M(W,!1):W=Y.length;let Q=0;for(;Q<z;Q++)Y.__setDigit(Q,$.__digit(Q)&~X.__digit(Q));for(;Q<U;Q++)Y.__setDigit(Q,$.__digit(Q));for(;Q<W;Q++)Y.__setDigit(Q,0);return Y}static __absoluteOr($,X,Y=null){let U=$.length,G=X.length,z=G;if(U<G){z=U;let Z=$,H=U;$=X,U=G,X=Z,G=H}let W=U;Y===null?Y=new M(W,!1):W=Y.length;let Q=0;for(;Q<z;Q++)Y.__setDigit(Q,$.__digit(Q)|X.__digit(Q));for(;Q<U;Q++)Y.__setDigit(Q,$.__digit(Q));for(;Q<W;Q++)Y.__setDigit(Q,0);return Y}static __absoluteXor($,X,Y=null){let U=$.length,G=X.length,z=G;if(U<G){z=U;let Z=$,H=U;$=X,U=G,X=Z,G=H}let W=U;Y===null?Y=new M(W,!1):W=Y.length;let Q=0;for(;Q<z;Q++)Y.__setDigit(Q,$.__digit(Q)^X.__digit(Q));for(;Q<U;Q++)Y.__setDigit(Q,$.__digit(Q));for(;Q<W;Q++)Y.__setDigit(Q,0);return Y}static __absoluteCompare($,X){let Y=$.length-X.length;if(Y!=0)return Y;let U=$.length-1;for(;0<=U&&$.__digit(U)===X.__digit(U);)U--;return 0>U?0:$.__unsignedDigit(U)>X.__unsignedDigit(U)?1:-1}static __multiplyAccumulate($,X,Y,U){if(X===0)return;let G=32767&X,z=X>>>15,W=0,Q=0;for(let Z,H=0;H<$.length;H++,U++){Z=Y.__digit(U);let V=$.__digit(H),O=32767&V,w=V>>>15,D=M.__imul(O,G),E=M.__imul(O,z),F=M.__imul(w,G),J=M.__imul(w,z);Z+=Q+D+W,W=Z>>>30,Z&=1073741823,Z+=((32767&E)<<15)+((32767&F)<<15),W+=Z>>>30,Q=J+(E>>>15)+(F>>>15),Y.__setDigit(U,1073741823&Z)}for(;W!=0||Q!==0;U++){let Z=Y.__digit(U);Z+=W+Q,Q=0,W=Z>>>30,Y.__setDigit(U,1073741823&Z)}}static __internalMultiplyAdd($,X,Y,U,G){let z=Y,W=0;for(let Q=0;Q<U;Q++){let Z=$.__digit(Q),H=M.__imul(32767&Z,X),V=M.__imul(Z>>>15,X),O=H+((32767&V)<<15)+W+z;z=O>>>30,W=V>>>15,G.__setDigit(Q,1073741823&O)}if(G.length>U)for(G.__setDigit(U++,z+W);U<G.length;)G.__setDigit(U++,0);else if(z+W!==0)throw new Error("implementation bug")}__inplaceMultiplyAdd($,X,Y){Y>this.length&&(Y=this.length);let U=32767&$,G=$>>>15,z=0,W=X;for(let Q=0;Q<Y;Q++){let Z=this.__digit(Q),H=32767&Z,V=Z>>>15,O=M.__imul(H,U),w=M.__imul(H,G),D=M.__imul(V,U),E=M.__imul(V,G),F=W+O+z;z=F>>>30,F&=1073741823,F+=((32767&w)<<15)+((32767&D)<<15),z+=F>>>30,W=E+(w>>>15)+(D>>>15),this.__setDigit(Q,1073741823&F)}if(z!=0||W!==0)throw new Error("implementation bug")}static __absoluteDivSmall($,X,Y=null){Y===null&&(Y=new M($.length,!1));let U=0;for(let G,z=2*$.length-1;0<=z;z-=2){G=(U<<15|$.__halfDigit(z))>>>0;let W=0|G/X;U=0|G%X,G=(U<<15|$.__halfDigit(z-1))>>>0;let Q=0|G/X;U=0|G%X,Y.__setDigit(z>>>1,W<<15|Q)}return Y}static __absoluteModSmall($,X){let Y=0;for(let U=2*$.length-1;0<=U;U--)Y=0|((Y<<15|$.__halfDigit(U))>>>0)%X;return Y}static __absoluteDivLarge($,X,Y,U){let G=X.__halfDigitLength(),z=X.length,W=$.__halfDigitLength()-G,Q=null;Y&&(Q=new M(W+2>>>1,!1),Q.__initializeDigits());let Z=new M(G+2>>>1,!1);Z.__initializeDigits();let H=M.__clz15(X.__halfDigit(G-1));0<H&&(X=M.__specialLeftShift(X,H,0));let V=M.__specialLeftShift($,H,1),O=X.__halfDigit(G-1),w=0;for(let D,E=W;0<=E;E--){D=32767;let F=V.__halfDigit(E+G);if(F!==O){let A=(F<<15|V.__halfDigit(E+G-1))>>>0;D=0|A/O;let L=0|A%O,T=X.__halfDigit(G-2),q=V.__halfDigit(E+G-2);for(;M.__imul(D,T)>>>0>(L<<16|q)>>>0&&(D--,L+=O,!(32767<L)););}M.__internalMultiplyAdd(X,D,0,z,Z);let J=V.__inplaceSub(Z,E,G+1);J!==0&&(J=V.__inplaceAdd(X,E,G),V.__setHalfDigit(E+G,32767&V.__halfDigit(E+G)+J),D--),Y&&(1&E?w=D<<15:Q.__setDigit(E>>>1,w|D))}if(U)return V.__inplaceRightShift(H),Y?{quotient:Q,remainder:V}:V;if(Y)return Q;throw new Error("unreachable")}static __clz15($){return M.__clz30($)-15}__inplaceAdd($,X,Y){let U=0;for(let G=0;G<Y;G++){let z=this.__halfDigit(X+G)+$.__halfDigit(G)+U;U=z>>>15,this.__setHalfDigit(X+G,32767&z)}return U}__inplaceSub($,X,Y){let U=0;if(1&X){X>>=1;let G=this.__digit(X),z=32767&G,W=0;for(;W<Y-1>>>1;W++){let H=$.__digit(W),V=(G>>>15)-(32767&H)-U;U=1&V>>>15,this.__setDigit(X+W,(32767&V)<<15|32767&z),G=this.__digit(X+W+1),z=(32767&G)-(H>>>15)-U,U=1&z>>>15}let Q=$.__digit(W),Z=(G>>>15)-(32767&Q)-U;if(U=1&Z>>>15,this.__setDigit(X+W,(32767&Z)<<15|32767&z),X+W+1>=this.length)throw new RangeError("out of bounds");(1&Y)==0&&(G=this.__digit(X+W+1),z=(32767&G)-(Q>>>15)-U,U=1&z>>>15,this.__setDigit(X+$.length,1073709056&G|32767&z))}else{X>>=1;let G=0;for(;G<$.length-1;G++){let H=this.__digit(X+G),V=$.__digit(G),O=(32767&H)-(32767&V)-U;U=1&O>>>15;let w=(H>>>15)-(V>>>15)-U;U=1&w>>>15,this.__setDigit(X+G,(32767&w)<<15|32767&O)}let z=this.__digit(X+G),W=$.__digit(G),Q=(32767&z)-(32767&W)-U;U=1&Q>>>15;let Z=0;(1&Y)==0&&(Z=(z>>>15)-(W>>>15)-U,U=1&Z>>>15),this.__setDigit(X+G,(32767&Z)<<15|32767&Q)}return U}__inplaceRightShift($){if($===0)return;let X=this.__digit(0)>>>$,Y=this.length-1;for(let U=0;U<Y;U++){let G=this.__digit(U+1);this.__setDigit(U,1073741823&G<<30-$|X),X=G>>>$}this.__setDigit(Y,X)}static __specialLeftShift($,X,Y){let U=$.length,G=new M(U+Y,!1);if(X===0){for(let W=0;W<U;W++)G.__setDigit(W,$.__digit(W));return 0<Y&&G.__setDigit(U,0),G}let z=0;for(let W=0;W<U;W++){let Q=$.__digit(W);G.__setDigit(W,1073741823&Q<<X|z),z=Q>>>30-X}return 0<Y&&G.__setDigit(U,z),G}static __leftShiftByAbsolute($,X){let Y=M.__toShiftAmount(X);if(0>Y)throw new RangeError("BigInt too big");let U=0|Y/30,G=Y%30,z=$.length,W=G!==0&&$.__digit(z-1)>>>30-G!=0,Q=z+U+(W?1:0),Z=new M(Q,$.sign);if(G===0){let H=0;for(;H<U;H++)Z.__setDigit(H,0);for(;H<Q;H++)Z.__setDigit(H,$.__digit(H-U))}else{let H=0;for(let V=0;V<U;V++)Z.__setDigit(V,0);for(let V=0;V<z;V++){let O=$.__digit(V);Z.__setDigit(V+U,1073741823&O<<G|H),H=O>>>30-G}if(W)Z.__setDigit(z+U,H);else if(H!==0)throw new Error("implementation bug")}return Z.__trim()}static __rightShiftByAbsolute($,X){let{length:Y,sign:U}=$,G=M.__toShiftAmount(X);if(0>G)return M.__rightShiftByMaximum(U);let z=0|G/30,W=G%30,Q=Y-z;if(0>=Q)return M.__rightShiftByMaximum(U);let Z=!1;if(U){if(($.__digit(z)&(1<<W)-1)!=0)Z=!0;else for(let V=0;V<z;V++)if($.__digit(V)!==0){Z=!0;break}}if(Z&&W===0)~$.__digit(Y-1)==0&&Q++;let H=new M(Q,U);if(W===0){H.__setDigit(Q-1,0);for(let V=z;V<Y;V++)H.__setDigit(V-z,$.__digit(V))}else{let V=$.__digit(z)>>>W,O=Y-z-1;for(let w=0;w<O;w++){let D=$.__digit(w+z+1);H.__setDigit(w,1073741823&D<<30-W|V),V=D>>>W}H.__setDigit(O,V)}return Z&&(H=M.__absoluteAddOne(H,!0,H)),H.__trim()}static __rightShiftByMaximum($){return $?M.__oneDigit(1,!0):M.__zero()}static __toShiftAmount($){if(1<$.length)return-1;let X=$.__unsignedDigit(0);return X>M.__kMaxLengthBits?-1:X}static __toPrimitive($,X="default"){if(typeof $!="object")return $;if($.constructor===M)return $;if(typeof Symbol!="undefined"&&typeof Symbol.toPrimitive=="symbol"&&$[Symbol.toPrimitive]){let G=$[Symbol.toPrimitive](X);if(typeof G!="object")return G;throw new TypeError("Cannot convert object to primitive value")}let Y=$.valueOf;if(Y){let G=Y.call($);if(typeof G!="object")return G}let U=$.toString;if(U){let G=U.call($);if(typeof G!="object")return G}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric($){return M.__isBigInt($)?$:+$}static __isBigInt($){return typeof $=="object"&&$!==null&&$.constructor===M}static __truncateToNBits($,X){let Y=0|($+29)/30,U=new M(Y,X.sign),G=Y-1;for(let W=0;W<G;W++)U.__setDigit(W,X.__digit(W));let z=X.__digit(G);if($%30!=0){let W=32-$%30;z=z<<W>>>W}return U.__setDigit(G,z),U.__trim()}static __truncateAndSubFromPowerOfTwo($,X,Y){var U=Math.min;let G=0|($+29)/30,z=new M(G,Y),W=0,Q=G-1,Z=0;for(let w=U(Q,X.length);W<w;W++){let D=0-X.__digit(W)-Z;Z=1&D>>>30,z.__setDigit(W,1073741823&D)}for(;W<Q;W++)z.__setDigit(W,0|1073741823&-Z);let H=Q<X.length?X.__digit(Q):0,V=$%30,O;if(V==0)O=0-H-Z,O&=1073741823;else{let w=32-V;H=H<<w>>>w;let D=1<<32-w;O=D-H-Z,O&=D-1}return z.__setDigit(Q,O),z.__trim()}__digit($){return this[$]}__unsignedDigit($){return this[$]>>>0}__setDigit($,X){this[$]=0|X}__setDigitGrow($,X){this[$]=0|X}__halfDigitLength(){let $=this.length;return 32767>=this.__unsignedDigit($-1)?2*$-1:2*$}__halfDigit($){return 32767&this[$>>>1]>>>15*(1&$)}__setHalfDigit($,X){let Y=$>>>1,U=this.__digit(Y),G=1&$?32767&U|X<<15:1073709056&U|32767&X;this.__setDigit(Y,G)}static __digitPow($,X){let Y=1;for(;0<X;)1&X&&(Y*=$),X>>>=1,$*=$;return Y}static __detectBigEndian(){return M.__kBitConversionDouble[0]=-0,M.__kBitConversionInts[0]!==0}static __isOneDigitInt($){return(1073741823&$)===$}}M.__kMaxLength=33554432,M.__kMaxLengthBits=M.__kMaxLength<<5,M.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],M.__kBitsPerCharTableShift=5,M.__kBitsPerCharTableMultiplier=1<<M.__kBitsPerCharTableShift,M.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],M.__kBitConversionBuffer=new ArrayBuffer(8),M.__kBitConversionDouble=new Float64Array(M.__kBitConversionBuffer),M.__kBitConversionInts=new Int32Array(M.__kBitConversionBuffer),M.__kBitConversionIntHigh=M.__detectBigEndian()?0:1,M.__kBitConversionIntLow=M.__detectBigEndian()?1:0,M.__clz30=Math.clz32?function($){return Math.clz32($)-2}:function($){return $===0?30:0|29-(0|Math.log($>>>0)/Math.LN2)},M.__imul=Math.imul||function($,X){return 0|$*X};var x=M;var H1=x.BigInt(0),eG=x.BigInt(1),hw=x.BigInt(2),lk=x.BigInt(10),rk=x.BigInt(24),ik=x.BigInt(60),ok=x.BigInt(1000),Z3=x.BigInt(1e6),iG=x.BigInt(1e9),YL=x.multiply(x.BigInt(3600),iG),nk=x.multiply(ik,iG),j2=x.multiply(YL,rk);function y0($){return typeof $=="bigint"?x.BigInt($.toString(10)):$}function GL($){return x.equal(x.remainder($,hw),H1)}function T8($){return x.lessThan($,H1)?x.unaryMinus($):$}function q7($,X){return x.lessThan($,X)?-1:x.greaterThan($,X)?1:0}function yG($,X){return{quotient:x.divide($,X),remainder:x.remainder($,X)}}var _A,qA,D$="slot-epochNanoSeconds",E$="slot-iso-date",W4="slot-iso-date-time",E4="slot-time",p="slot-calendar",UL="slot-date-brand",zL="slot-year-month-brand",WL="slot-month-day-brand",m$="slot-time-zone",L6="slot-years",K6="slot-months",c6="slot-weeks",_6="slot-days",q6="slot-hours",R6="slot-minutes",T6="slot-seconds",v6="slot-milliseconds",C6="slot-microseconds",p6="slot-nanoseconds",QL="date",ZL="ym",HL="md",VL="time",OL="datetime",wL="instant",b8="original",rX="timezone-canonical",Mw="timezone-original",mG="calendar-id",DL="locale",Jw="options",EL=new WeakMap,Aw=Symbol.for("@@Temporal__GetSlots");(_A=globalThis)[Aw]||(_A[Aw]=function($){return EL.get($)});var b7=globalThis[Aw],Lw=Symbol.for("@@Temporal__CreateSlots");(qA=globalThis)[Lw]||(qA[Lw]=function($){EL.set($,Object.create(null))});var n0=globalThis[Lw];function x6($,...X){if(!$||typeof $!="object")return!1;let Y=b7($);return!!Y&&X.every((U)=>(U in Y))}function N($,X){let Y=b7($)?.[X];if(Y===void 0)throw new TypeError(`Missing internal slot ${X}`);return Y}function R$($,X,Y){let U=b7($);if(U===void 0)throw new TypeError("Missing slots for the given container");if(U[X])throw new TypeError(`${X} already has set`);U[X]=Y}var Kw={};function t0($,X){Object.defineProperty($.prototype,Symbol.toStringTag,{value:X,writable:!1,enumerable:!1,configurable:!0});let Y=Object.getOwnPropertyNames($);for(let G=0;G<Y.length;G++){let z=Y[G],W=Object.getOwnPropertyDescriptor($,z);W.configurable&&W.enumerable&&(W.enumerable=!1,Object.defineProperty($,z,W))}let U=Object.getOwnPropertyNames($.prototype);for(let G=0;G<U.length;G++){let z=U[G],W=Object.getOwnPropertyDescriptor($.prototype,z);W.configurable&&W.enumerable&&(W.enumerable=!1,Object.defineProperty($.prototype,z,W))}_w(X,$),_w(`${X}.prototype`,$.prototype)}function _w($,X){let Y=`%${$}%`;if(Kw[Y]!==void 0)throw new Error(`intrinsic ${$} already exists`);Kw[Y]=X}function $6($){return Kw[$]}function oX($,X){let Y=$;if(Y===0)return{div:Y,mod:Y};let U=Math.sign(Y);Y=Math.abs(Y);let G=Math.trunc(1+Math.log10(Y));if(X>=G)return{div:0*U,mod:U*Y};if(X===0)return{div:U*Y,mod:0*U};let z=Y.toPrecision(G);return{div:U*Number.parseInt(z.slice(0,G-X),10),mod:U*Number.parseInt(z.slice(G-X),10)}}function ww($,X,Y){let U=$,G=Y;if(U===0)return G;let z=Math.sign(U)||Math.sign(G);U=Math.abs(U),G=Math.abs(G);let W=U.toPrecision(Math.trunc(1+Math.log10(U)));if(G===0)return z*Number.parseInt(W+"0".repeat(X),10);let Q=W+G.toPrecision(Math.trunc(1+Math.log10(G))).padStart(X,"0");return z*Number.parseInt(Q,10)}function f7($,X){let Y=X==="negative";switch($){case"ceil":return Y?"zero":"infinity";case"floor":return Y?"infinity":"zero";case"expand":return"infinity";case"trunc":return"zero";case"halfCeil":return Y?"half-zero":"half-infinity";case"halfFloor":return Y?"half-infinity":"half-zero";case"halfExpand":return"half-infinity";case"halfTrunc":return"half-zero";case"halfEven":return"half-even"}}function h7($,X,Y,U,G){return G==="zero"?$:G==="infinity"?X:Y<0?$:Y>0?X:G==="half-zero"?$:G==="half-infinity"?X:U?$:X}class C${constructor($){this.totalNs=y0($),this.sec=x.toNumber(x.divide(this.totalNs,iG)),this.subsec=x.toNumber(x.remainder(this.totalNs,iG))}static validateNew($,X){if(x.greaterThan(T8($),C$.MAX))throw new RangeError(`${X} of duration time units cannot exceed ${C$.MAX} s`);return new C$($)}static fromEpochNsDiff($,X){let Y=x.subtract(y0($),y0(X));return new C$(Y)}static fromComponents($,X,Y,U,G,z){let W=x.add(x.add(x.add(x.add(x.add(x.BigInt(z),x.multiply(x.BigInt(G),ok)),x.multiply(x.BigInt(U),Z3)),x.multiply(x.BigInt(Y),iG)),x.multiply(x.BigInt(X),nk)),x.multiply(x.BigInt($),YL));return C$.validateNew(W,"total")}abs(){return new C$(T8(this.totalNs))}add($){return C$.validateNew(x.add(this.totalNs,$.totalNs),"sum")}add24HourDays($){return C$.validateNew(x.add(this.totalNs,x.multiply(x.BigInt($),j2)),"sum")}addToEpochNs($){return x.add(y0($),this.totalNs)}cmp($){return q7(this.totalNs,$.totalNs)}divmod($){let{quotient:X,remainder:Y}=yG(this.totalNs,x.BigInt($));return{quotient:x.toNumber(X),remainder:new C$(Y)}}fdiv($){let X=y0($),Y=x.BigInt(X),{quotient:U,remainder:G}=yG(this.totalNs,Y),z=[],W,Q=(x.lessThan(this.totalNs,H1)?-1:1)*Math.sign(x.toNumber(X));for(;!x.equal(G,H1)&&z.length<50;)G=x.multiply(G,lk),{quotient:W,remainder:G}=yG(G,Y),z.push(Math.abs(x.toNumber(W)));return Q*Number(T8(U).toString()+"."+z.join(""))}isZero(){return x.equal(this.totalNs,H1)}round($,X){let Y=y0($);if(x.equal(Y,eG))return this;let{quotient:U,remainder:G}=yG(this.totalNs,Y),z=x.lessThan(this.totalNs,H1)?"negative":"positive",W=x.multiply(T8(U),Y),Q=x.add(W,Y),Z=q7(T8(x.multiply(G,hw)),Y),H=f7(X,z),V=x.equal(T8(this.totalNs),W)?W:h7(W,Q,Z,GL(U),H),O=z==="positive"?V:x.unaryMinus(V);return C$.validateNew(O,"rounding")}sign(){return this.cmp(new C$(H1))}subtract($){return C$.validateNew(x.subtract(this.totalNs,$.totalNs),"difference")}}C$.MAX=x.BigInt("9007199254740991999999999"),C$.ZERO=new C$(H1);var RA=/[A-Za-z._][A-Za-z._0-9+-]*/,H3=new RegExp(`(?:${/(?:[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)/.source}|(?:${RA.source})(?:\\/(?:${RA.source}))*)`),NL=/(?:[+-]\d{6}|\d{4})/,R7=/(?:0[1-9]|1[0-2])/,qw=/(?:0[1-9]|[12]\d|3[01])/,tk=new RegExp(`(${NL.source})(?:-(${R7.source})-(${qw.source})|(${R7.source})(${qw.source}))`),FL=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,ML=/((?:[+-])(?:[01][0-9]|2[0-3])(?::?(?:[0-5][0-9])(?::?(?:[0-5][0-9])(?:[.,](?:\d{1,9}))?)?)?)/,JL=new RegExp(`([zZ])|${ML.source}?`),sX=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,ak=new RegExp([`^${tk.source}`,`(?:(?:[tT]|\\s+)${FL.source}(?:${JL.source})?)?`,`(?:\\[!?(${H3.source})\\])?`,`((?:${sX.source})*)$`].join("")),sk=new RegExp([`^[tT]?${FL.source}`,`(?:${JL.source})?`,`(?:\\[!?${H3.source}\\])?`,`((?:${sX.source})*)$`].join("")),ek=new RegExp(`^(${NL.source})-?(${R7.source})(?:\\[!?${H3.source}\\])?((?:${sX.source})*)$`),$b=new RegExp(`^(?:--)?(${R7.source})-?(${qw.source})(?:\\[!?${H3.source}\\])?((?:${sX.source})*)$`),Dw=/(\d+)(?:[.,](\d{1,9}))?/,Xb=new RegExp(`(?:${Dw.source}H)?(?:${Dw.source}M)?(?:${Dw.source}S)?`),Yb=new RegExp(`^([+-])?P${/(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/.source}(?:T(?!$)${Xb.source})?$`,"i"),P2=86400000,T7=1e6*P2,Gb=60000000000,AL=1e8*P2,eX=u1(AL),$3=x.unaryMinus(eX),Ub=x.add(x.subtract($3,j2),eG),zb=x.subtract(x.add(eX,j2),eG),Wb=146097*P2,TA=-271821,vA=275760,oG=Date.UTC(1847,0,1),Qb=["iso8601","hebrew","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","islamicc","persian","ethiopic","ethioaa","ethiopic-amete-alem","coptic","chinese","dangi","roc","indian","buddhist","japanese","gregory"],Zb=new Set(["ACT","AET","AGT","ART","AST","BET","BST","CAT","CNT","CST","CTT","EAT","ECT","IET","IST","JST","MIT","NET","NST","PLT","PNT","PRT","PST","SST","VST"]);function N4($){return typeof $=="object"&&$!==null||typeof $=="function"}function g7($){if(typeof $=="bigint")throw new TypeError("Cannot convert BigInt to number");return Number($)}function y7($){if(typeof $=="symbol")throw new TypeError("Cannot convert a Symbol value to a String");return String($)}function F$($){let X=g7($);if(X===0)return 0;if(Number.isNaN(X)||X===1/0||X===-1/0)throw new RangeError("invalid number value");let Y=Math.trunc(X);return Y===0?0:Y}function CA($,X){let Y=F$($);if(Y<=0){if(X!==void 0)throw new RangeError(`property '${X}' cannot be a a number less than one`);throw new RangeError("Cannot convert a number less than one to a positive integer")}return Y}function y1($){let X=g7($);if(Number.isNaN(X))throw new RangeError("not a number");if(X===1/0||X===-1/0)throw new RangeError("infinity is out of range");if(!function(Y){if(typeof Y!="number"||Number.isNaN(Y)||Y===1/0||Y===-1/0)return!1;let U=Math.abs(Y);return Math.floor(U)===U}(X))throw new RangeError(`unsupported fractional value ${$}`);return X===0?0:X}function X3($,X){return String($).padStart(X,"0")}function h4($){if(typeof $!="string")throw new TypeError(`expected a string, not ${String($)}`);return $}function Rw($,X){if(N4($)){let Y=$?.toString();if(typeof Y=="string"||typeof Y=="number")return Y;throw new TypeError("Cannot convert object to primitive value")}return $}var Tw=["era","eraYear","year","month","monthCode","day","hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],Hb={era:y7,eraYear:F$,year:F$,month:CA,monthCode:function($){let X=h4(Rw($));if(X.length<3||X.length>4||X[0]!=="M"||"0123456789".indexOf(X[1])===-1||"0123456789".indexOf(X[2])===-1||X[1]+X[2]==="00"&&X[3]!=="L"||X[3]!=="L"&&X[3]!==void 0)throw new RangeError(`bad month code ${X}; must match M01-M99 or M00L-M99L`);return X},day:CA,hour:F$,minute:F$,second:F$,millisecond:F$,microsecond:F$,nanosecond:F$,offset:function($){let X=h4(Rw($));return V9(X),X},timeZone:P6},Vb={hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},$9=[["years","year","date"],["months","month","date"],["weeks","week","date"],["days","day","date"],["hours","hour","time"],["minutes","minute","time"],["seconds","second","time"],["milliseconds","millisecond","time"],["microseconds","microsecond","time"],["nanoseconds","nanosecond","time"]],BA=Object.fromEntries($9.map(($)=>[$[0],$[1]])),Ob=Object.fromEntries($9.map(([$,X])=>[X,$])),nG=$9.map(([,$])=>$),X9={day:T7,hour:3600000000000,minute:60000000000,second:1e9,millisecond:1e6,microsecond:1000,nanosecond:1},v7=["days","hours","microseconds","milliseconds","minutes","months","nanoseconds","seconds","weeks","years"],wb=Intl.DateTimeFormat,jA=new Map;function LL($){let X=W3($),Y=jA.get(X);return Y===void 0&&(Y=new wb("en-us",{timeZone:X,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),jA.set(X,Y)),Y}function a4($){return x6($,D$)&&!x6($,m$,p)}function w4($){return x6($,L6,K6,_6,q6,R6,T6,v6,C6,p6)}function D4($){return x6($,UL)}function J4($){return x6($,E4)}function e$($){return x6($,W4)}function s4($){return x6($,zL)}function Z1($){return x6($,WL)}function v$($){return x6($,D$,m$,p)}function k($,X){if(!X($))throw new TypeError("invalid receiver: method called with the wrong type of this-object")}function Q9($){if(x6($,p)||x6($,m$))throw new TypeError("with() does not support a calendar or timeZone property");if(J4($))throw new TypeError("with() does not accept Temporal.PlainTime, use withPlainTime() instead");if($.calendar!==void 0)throw new TypeError("with() does not support a calendar property");if($.timeZone!==void 0)throw new TypeError("with() does not support a timeZone property")}function V3($,X){return X==="never"||X==="auto"&&$==="iso8601"?"":`[${X==="critical"?"!":""}u-ca=${$}]`}function m7($){let X,Y,U=!1;for(sX.lastIndex=0;Y=sX.exec($);){let{1:G,2:z,3:W}=Y;if(z==="u-ca"){if(X===void 0)X=W,U=G==="!";else if(G==="!"||U)throw new RangeError(`Invalid annotations in ${$}: more than one u-ca present with critical flag`)}else if(G==="!")throw new RangeError(`Unrecognized annotation: !${z}=${W}`)}return X}function w0($){let X=ak.exec($);if(!X)throw new RangeError(`invalid RFC 9557 string: ${$}`);let Y=m7(X[16]),U=X[1];if(U==="-000000")throw new RangeError(`invalid RFC 9557 string: ${$}`);let G=+U,z=+(X[2]??X[4]??1),W=+(X[3]??X[5]??1),Q=X[6]!==void 0,Z=+(X[6]??0),H=+(X[7]??X[10]??0),V=+(X[8]??X[11]??0);V===60&&(V=59);let O=(X[9]??X[12]??"")+"000000000",w=+O.slice(0,3),D=+O.slice(3,6),E=+O.slice(6,9),F,J=!1;X[13]?(F=void 0,J=!0):X[14]&&(F=X[14]);let A=X[15];return pw(G,z,W,Z,H,V,w,D,E),{year:G,month:z,day:W,time:Q?{hour:Z,minute:H,second:V,millisecond:w,microsecond:D,nanosecond:E}:"start-of-day",tzAnnotation:A,offset:F,z:J,calendar:Y}}function KL($){let X=sk.exec($),Y,U,G,z,W,Q,Z;if(X){Z=m7(X[10]),Y=+(X[1]??0),U=+(X[2]??X[5]??0),G=+(X[3]??X[6]??0),G===60&&(G=59);let H=(X[4]??X[7]??"")+"000000000";if(z=+H.slice(0,3),W=+H.slice(3,6),Q=+H.slice(6,9),X[8])throw new RangeError("Z designator not supported for PlainTime")}else{let H,V;if({time:H,z:V,calendar:Z}=w0($),H==="start-of-day")throw new RangeError(`time is missing in string: ${$}`);if(V)throw new RangeError("Z designator not supported for PlainTime");({hour:Y,minute:U,second:G,millisecond:z,microsecond:W,nanosecond:Q}=H)}if(d7(Y,U,G,z,W,Q),/[tT ][0-9][0-9]/.test($))return{hour:Y,minute:U,second:G,millisecond:z,microsecond:W,nanosecond:Q,calendar:Z};try{let{month:H,day:V}=yw($);P8(1972,H,V)}catch{try{let{year:H,month:V}=gw($);P8(H,V,1)}catch{return{hour:Y,minute:U,second:G,millisecond:z,microsecond:W,nanosecond:Q,calendar:Z}}}throw new RangeError(`invalid RFC 9557 time-only string ${$}; may need a T prefix`)}function gw($){let X=ek.exec($),Y,U,G,z;if(X){G=m7(X[3]);let W=X[1];if(W==="-000000")throw new RangeError(`invalid RFC 9557 string: ${$}`);if(Y=+W,U=+X[2],z=1,G!==void 0&&G!=="iso8601")throw new RangeError("YYYY-MM format is only valid with iso8601 calendar")}else{let W;if({year:Y,month:U,calendar:G,day:z,z:W}=w0($),W)throw new RangeError("Z designator not supported for PlainYearMonth")}return{year:Y,month:U,calendar:G,referenceISODay:z}}function yw($){let X=$b.exec($),Y,U,G,z;if(X){if(G=m7(X[3]),Y=+X[1],U=+X[2],G!==void 0&&G!=="iso8601")throw new RangeError("MM-DD format is only valid with iso8601 calendar")}else{let W;if({month:Y,day:U,calendar:G,year:z,z:W}=w0($),W)throw new RangeError("Z designator not supported for PlainMonthDay")}return{month:Y,day:U,calendar:G,referenceISOYear:z}}var _L=new RegExp(`^${H3.source}$`,"i"),qL=new RegExp(`^${/([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])?)?/.source}$`);function RL($){let X=Eb.test($)?"Seconds not allowed in offset time zone":"Invalid time zone";throw new RangeError(`${X}: ${$}`)}function B2($){return _L.test($)||RL($),qL.test($)?{offsetMinutes:V9($)/60000000000}:{tzName:$}}function tG($,X,Y,U){let G=$,z=X,W=Y;switch(U){case"reject":P8(G,z,W);break;case"constrain":({year:G,month:z,day:W}=uL(G,z,W))}return{year:G,month:z,day:W}}function u7($,X,Y,U,G,z,W){let Q=$,Z=X,H=Y,V=U,O=G,w=z;switch(W){case"reject":d7(Q,Z,H,V,O,w);break;case"constrain":Q=B6(Q,0,23),Z=B6(Z,0,59),H=B6(H,0,59),V=B6(V,0,999),O=B6(O,0,999),w=B6(w,0,999)}return{hour:Q,minute:Z,second:H,millisecond:V,microsecond:O,nanosecond:w}}function TL($){if(!N4($))throw new TypeError("invalid duration-like");let X={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0},Y=!1;for(let U=0;U<v7.length;U++){let G=v7[U],z=$[G];z!==void 0&&(Y=!0,X[G]=y1(z))}if(!Y)throw new TypeError("invalid duration-like");return X}function Q6({years:$,months:X,weeks:Y,days:U},G,z,W){return{years:$,months:W??X,weeks:z??Y,days:G??U}}function k$($,X){return{isoDate:$,time:X}}function x$($){return r0($,"overflow",["constrain","reject"],"constrain")}function aG($){return r0($,"disambiguation",["compatible","earlier","later","reject"],"compatible")}function c1($,X){return r0($,"roundingMode",["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"],X)}function _7($,X){return r0($,"offset",["prefer","use","ignore","reject"],X)}function O3($){return r0($,"calendarName",["auto","always","never","critical"],"auto")}function Z9($){let X=$.roundingIncrement;if(X===void 0)return 1;let Y=F$(X);if(Y<1||Y>1e9)throw new RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${X}`);return Y}function H9($,X,Y){let U=Y?X:X-1;if($>U)throw new RangeError(`roundingIncrement must be at least 1 and less than ${U}, not ${$}`);if(X%$!=0)throw new RangeError(`Rounding increment must divide evenly into ${X}`)}function w3($){let X=$.fractionalSecondDigits;if(X===void 0)return"auto";if(typeof X!="number"){if(y7(X)!=="auto")throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${X}`);return"auto"}let Y=Math.floor(X);if(!Number.isFinite(Y)||Y<0||Y>9)throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${X}`);return Y}function D3($,X){switch($){case"minute":return{precision:"minute",unit:"minute",increment:1};case"second":return{precision:0,unit:"second",increment:1};case"millisecond":return{precision:3,unit:"millisecond",increment:1};case"microsecond":return{precision:6,unit:"microsecond",increment:1};case"nanosecond":return{precision:9,unit:"nanosecond",increment:1}}switch(X){case"auto":return{precision:X,unit:"nanosecond",increment:1};case 0:return{precision:X,unit:"second",increment:1};case 1:case 2:case 3:return{precision:X,unit:"millisecond",increment:10**(3-X)};case 4:case 5:case 6:return{precision:X,unit:"microsecond",increment:10**(6-X)};case 7:case 8:case 9:return{precision:X,unit:"nanosecond",increment:10**(9-X)};default:throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${X}`)}}var o0=Symbol("~required~");function l6($,X,Y,U,G=[]){let z=[];for(let H=0;H<$9.length;H++){let V=$9[H],O=V[1],w=V[2];Y!=="datetime"&&Y!==w||z.push(O)}z=z.concat(G);let W=U;W===o0?W=void 0:W!==void 0&&z.push(W);let Q=[];Q=Q.concat(z);for(let H=0;H<z.length;H++){let V=z[H],O=Ob[V];O!==void 0&&Q.push(O)}let Z=r0($,X,Q,W);if(Z===void 0&&U===o0)throw new RangeError(`${X} is required`);return Z&&Z in BA?BA[Z]:Z}function Ew($){let X=$.relativeTo;if(X===void 0)return{};let Y,U,G,z,W,Q="option",Z=!1;if(N4(X)){if(v$(X))return{zonedRelativeTo:X};if(D4(X))return{plainRelativeTo:X};if(e$(X))return{plainRelativeTo:j6(N(X,W4).isoDate,N(X,p))};G=J3(X);let H=D1(G,X,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],[]);({isoDate:Y,time:U}=N3(G,H,"constrain")),{offset:W,timeZone:z}=H,W===void 0&&(Q="wall")}else{let H,V,O,w,D;if({year:O,month:w,day:D,time:U,calendar:G,tzAnnotation:H,offset:W,z:V}=w0(h4(X)),H)z=P6(H),V?Q="exact":W||(Q="wall"),Z=!0;else if(V)throw new RangeError("Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone");G||(G="iso8601"),G=S6(G),Y={year:O,month:w,day:D}}return z===void 0?{plainRelativeTo:j6(Y,G)}:{zonedRelativeTo:W6(C7(Y,U,Q,Q==="option"?V9(W):0,z,"compatible","reject",Z),z,G)}}function m0($){return N($,L6)!==0?"year":N($,K6)!==0?"month":N($,c6)!==0?"week":N($,_6)!==0?"day":N($,q6)!==0?"hour":N($,R6)!==0?"minute":N($,T6)!==0?"second":N($,v6)!==0?"millisecond":N($,C6)!==0?"microsecond":"nanosecond"}function d0($,X){return nG.indexOf($)>nG.indexOf(X)?X:$}function z0($){return $==="year"||$==="month"||$==="week"}function u0($){return z0($)||$==="day"?"date":"time"}function x2($){return $6("%calendarImpl%")($)}function E3($){return $6("%calendarImpl%")(N($,p))}function I6($,X,Y="date"){let U=Object.create(null),G=x2($).isoToDate(X,{year:!0,monthCode:!0,day:!0});return U.monthCode=G.monthCode,Y!=="month-day"&&Y!=="date"||(U.day=G.day),Y!=="year-month"&&Y!=="date"||(U.year=G.year),U}function D1($,X,Y,U,G){let z=x2($).extraFields(Y),W=Y.concat(U,z),Q=Object.create(null),Z=!1;W.sort();for(let H=0;H<W.length;H++){let V=W[H],O=X[V];if(O!==void 0)Z=!0,Q[V]=(0,Hb[V])(O);else if(G!=="partial"){if(G.includes(V))throw new TypeError(`required property '${V}' missing or undefined`);Q[V]=Vb[V]}}if(G==="partial"&&!Z)throw new TypeError("no supported properties found");return Q}function vw($,X="complete"){let Y=["hour","microsecond","millisecond","minute","nanosecond","second"],U=!1,G=Object.create(null);for(let z=0;z<Y.length;z++){let W=Y[z],Q=$[W];Q!==void 0?(G[W]=F$(Q),U=!0):X==="complete"&&(G[W]=0)}if(!U)throw new TypeError("invalid time-like");return G}function uG($,X){if(N4($)){if(D4($))return x$(Q$(X)),j6(N($,E$),N($,p));if(v$($)){let Z=R1(N($,m$),N($,D$));return x$(Q$(X)),j6(Z.isoDate,N($,p))}if(e$($))return x$(Q$(X)),j6(N($,W4).isoDate,N($,p));let Q=J3($);return j6(I2(Q,D1(Q,$,["year","month","monthCode","day"],[],[]),x$(Q$(X))),Q)}let{year:Y,month:U,day:G,calendar:z,z:W}=w0(h4($));if(W)throw new RangeError("Z designator not supported for PlainDate");return z||(z="iso8601"),z=S6(z),x$(Q$(X)),j6({year:Y,month:U,day:G},z)}function N3($,X,Y){return k$(I2($,X,Y),u7(X.hour,X.minute,X.second,X.millisecond,X.microsecond,X.nanosecond,Y))}function cG($,X){let Y,U,G;if(N4($)){if(e$($))return x$(Q$(X)),K1(N($,W4),N($,p));if(v$($)){let Q=R1(N($,m$),N($,D$));return x$(Q$(X)),K1(Q,N($,p))}if(D4($))return x$(Q$(X)),K1(k$(N($,E$),{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),N($,p));G=J3($);let z=D1(G,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond"],[]),W=x$(Q$(X));({isoDate:Y,time:U}=N3(G,z,W))}else{let z,W,Q,Z;if({year:W,month:Q,day:Z,time:U,calendar:G,z}=w0(h4($)),z)throw new RangeError("Z designator not supported for PlainDateTime");U==="start-of-day"&&(U={deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),pw(W,Q,Z,U.hour,U.minute,U.second,U.millisecond,U.microsecond,U.nanosecond),G||(G="iso8601"),G=S6(G),x$(Q$(X)),Y={year:W,month:Q,day:Z}}return K1(k$(Y,U),G)}function q1($){let X=$6("%Temporal.Duration%");if(w4($))return new X(N($,L6),N($,K6),N($,c6),N($,_6),N($,q6),N($,R6),N($,T6),N($,v6),N($,C6),N($,p6));if(!N4($))return function(G){let{years:z,months:W,weeks:Q,days:Z,hours:H,minutes:V,seconds:O,milliseconds:w,microseconds:D,nanoseconds:E}=function(F){let J=Yb.exec(F);if(!J)throw new RangeError(`invalid duration: ${F}`);if(J.every((c,H$)=>H$<2||c===void 0))throw new RangeError(`invalid duration: ${F}`);let A=J[1]==="-"?-1:1,L=J[2]===void 0?0:F$(J[2])*A,T=J[3]===void 0?0:F$(J[3])*A,q=J[4]===void 0?0:F$(J[4])*A,v=J[5]===void 0?0:F$(J[5])*A,I=J[6]===void 0?0:F$(J[6])*A,S=J[7],y=J[8],r=J[9],j=J[10],X$=J[11],l=0,W$=0,L$=0;if(S!==void 0){if(y??r??j??X$)throw new RangeError("only the smallest unit can be fractional");L$=3600*F$((S+"000000000").slice(0,9))*A}else if(l=y===void 0?0:F$(y)*A,r!==void 0){if(j??X$)throw new RangeError("only the smallest unit can be fractional");L$=60*F$((r+"000000000").slice(0,9))*A}else W$=j===void 0?0:F$(j)*A,X$!==void 0&&(L$=F$((X$+"000000000").slice(0,9))*A);let b$=L$%1000,L4=Math.trunc(L$/1000)%1000,X6=Math.trunc(L$/1e6)%1000;return W$+=Math.trunc(L$/1e9)%60,l+=Math.trunc(L$/60000000000),l7(L,T,q,v,I,l,W$,X6,L4,b$),{years:L,months:T,weeks:q,days:v,hours:I,minutes:l,seconds:W$,milliseconds:X6,microseconds:L4,nanoseconds:b$}}(G);return new($6("%Temporal.Duration%"))(z,W,Q,Z,H,V,O,w,D,E)}(h4($));let Y={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},U=TL($);for(let G=0;G<v7.length;G++){let z=v7[G],W=U[z];W!==void 0&&(Y[z]=W)}return new X(Y.years,Y.months,Y.weeks,Y.days,Y.hours,Y.minutes,Y.seconds,Y.milliseconds,Y.microseconds,Y.nanoseconds)}function pG($){let X;if(N4($)){if(a4($)||v$($))return m1(N($,D$));X=Rw($)}else X=$;let{year:Y,month:U,day:G,time:z,offset:W,z:Q}=function(F){let J=w0(F);if(!J.z&&!J.offset)throw new RangeError("Temporal.Instant requires a time zone offset");return J}(h4(X)),{hour:Z=0,minute:H=0,second:V=0,millisecond:O=0,microsecond:w=0,nanosecond:D=0}=z==="start-of-day"?{}:z,E=z3(Y,U,G,Z,H,V,O,w,D-(Q?0:V9(W)));return aX(E.isoDate),m1(e4(E))}function PA($,X){if(N4($)){if(Z1($))return x$(Q$(X)),nX(N($,E$),N($,p));let Q;return x6($,p)?Q=N($,p):(Q=$.calendar,Q===void 0&&(Q="iso8601"),Q=M3(Q)),nX(B7(Q,D1(Q,$,["year","month","monthCode","day"],[],[]),x$(Q$(X))),Q)}let{month:Y,day:U,referenceISOYear:G,calendar:z}=yw(h4($));if(z===void 0&&(z="iso8601"),z=S6(z),x$(Q$(X)),z==="iso8601")return nX({year:1972,month:Y,day:U},z);let W={year:G,month:Y,day:U};return f8(W),W=B7(z,I6(z,W,"month-day"),"constrain"),nX(W,z)}function v2($,X){let Y;if(N4($)){if(J4($))return x$(Q$(X)),c0(N($,E4));if(e$($))return x$(Q$(X)),c0(N($,W4).time);if(v$($)){let H=R1(N($,m$),N($,D$));return x$(Q$(X)),c0(H.time)}let{hour:U,minute:G,second:z,millisecond:W,microsecond:Q,nanosecond:Z}=vw($);Y=u7(U,G,z,W,Q,Z,x$(Q$(X)))}else Y=KL(h4($)),x$(Q$(X));return c0(Y)}function vL($){return $===void 0?{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}:N(v2($),E4)}function dG($,X){if(N4($)){if(s4($))return x$(Q$(X)),tX(N($,E$),N($,p));let Q=J3($);return tX(Y3(Q,D1(Q,$,["year","month","monthCode"],[],[]),x$(Q$(X))),Q)}let{year:Y,month:U,referenceISODay:G,calendar:z}=gw(h4($));z===void 0&&(z="iso8601"),z=S6(z),x$(Q$(X));let W={year:Y,month:U,day:G};return dw(W),W=Y3(z,I6(z,W,"year-month"),"constrain"),tX(W,z)}function C7($,X,Y,U,G,z,W,Q){if(X==="start-of-day")return R2(G,$);let Z=k$($,X);if(Y==="wall"||W==="ignore")return Z6(G,Z,z);if(Y==="exact"||W==="use"){let O=z3($.year,$.month,$.day,X.hour,X.minute,X.second,X.millisecond,X.microsecond,X.nanosecond-U);aX(O.isoDate);let w=e4(O);return V0(w),w}aX($);let H=e4(Z),V=G3(G,Z);for(let O=0;O<V.length;O++){let w=V[O],D=x.toNumber(x.subtract(H,w)),E=C2(D,60000000000,"halfExpand");if(D===U||Q&&E===U)return w}if(W==="reject"){let O=Cw(U),w=U3(Z,"iso8601","auto");throw new RangeError(`Offset ${O} is invalid for ${w} in ${G}`)}return bL(V,G,Z,z)}function lG($,X){let Y,U,G,z,W,Q,Z,H=!1,V="option";if(N4($)){if(v$($)){let F=Q$(X);return aG(F),_7(F,"reject"),x$(F),W6(N($,D$),N($,m$),N($,p))}W=J3($);let w=D1(W,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],["timeZone"]);({offset:z,timeZone:G}=w),z===void 0&&(V="wall");let D=Q$(X);Q=aG(D),Z=_7(D,"reject");let E=x$(D);({isoDate:Y,time:U}=N3(W,w,E))}else{let w,D,E,F,J;({year:E,month:F,day:J,time:U,tzAnnotation:w,offset:z,z:D,calendar:W}=function(L){let T=w0(L);if(!T.tzAnnotation)throw new RangeError("Temporal.ZonedDateTime requires a time zone ID in brackets");return T}(h4($))),G=P6(w),D?V="exact":z||(V="wall"),W||(W="iso8601"),W=S6(W),H=!0;let A=Q$(X);Q=aG(A),Z=_7(A,"reject"),x$(A),Y={year:E,month:F,day:J}}let O=0;return V==="option"&&(O=V9(z)),W6(C7(Y,U,V,O,G,Q,Z,H),G,W)}function CL($,X,Y){f8(X),n0($),R$($,E$,X),R$($,p,Y),R$($,UL,!0)}function j6($,X){let Y=$6("%Temporal.PlainDate%"),U=Object.create(Y.prototype);return CL(U,$,X),U}function BL($,X,Y){I8(X),n0($),R$($,W4,X),R$($,p,Y)}function K1($,X){let Y=$6("%Temporal.PlainDateTime%"),U=Object.create(Y.prototype);return BL(U,$,X),U}function jL($,X,Y){f8(X),n0($),R$($,E$,X),R$($,p,Y),R$($,WL,!0)}function nX($,X){let Y=$6("%Temporal.PlainMonthDay%"),U=Object.create(Y.prototype);return jL(U,$,X),U}function PL($,X){n0($),R$($,E4,X)}function c0($){let X=$6("%Temporal.PlainTime%"),Y=Object.create(X.prototype);return PL(Y,$),Y}function IL($,X,Y){dw(X),n0($),R$($,E$,X),R$($,p,Y),R$($,zL,!0)}function tX($,X){let Y=$6("%Temporal.PlainYearMonth%"),U=Object.create(Y.prototype);return IL(U,$,X),U}function xL($,X){V0(X),n0($),R$($,D$,X)}function m1($){let X=$6("%Temporal.Instant%"),Y=Object.create(X.prototype);return xL(Y,$),Y}function SL($,X,Y,U){V0(X),n0($),R$($,D$,X),R$($,m$,Y),R$($,p,U)}function W6($,X,Y="iso8601"){let U=$6("%Temporal.ZonedDateTime%"),G=Object.create(U.prototype);return SL(G,$,X,Y),G}function IA($){return Tw.filter((X)=>$[X]!==void 0)}function j8($,X,Y){let U=IA(Y),G=x2($).fieldKeysToIgnore(U),z=Object.create(null),W=IA(X);for(let Q=0;Q<Tw.length;Q++){let Z,H=Tw[Q];W.includes(H)&&!G.includes(H)&&(Z=X[H]),U.includes(H)&&(Z=Y[H]),Z!==void 0&&(z[H]=Z)}return z}function O1($,X,Y,U){let G=x2($).dateAdd(X,Y,U);return f8(G),G}function F3($,X,Y,U){return x2($).dateUntil(X,Y,U)}function M3($){if(N4($)&&x6($,p))return N($,p);let X=h4($);try{return S6(X)}catch{}let Y;try{({calendar:Y}=w0(X))}catch{try{({calendar:Y}=KL(X))}catch{try{({calendar:Y}=gw(X))}catch{({calendar:Y}=yw(X))}}}return Y||(Y="iso8601"),S6(Y)}function J3($){if(x6($,p))return N($,p);let{calendar:X}=$;return X===void 0?"iso8601":M3(X)}function H0($,X){return S6($)===S6(X)}function I2($,X,Y){let U=x2($);U.resolveFields(X,"date");let G=U.dateToISO(X,Y);return f8(G),G}function Y3($,X,Y){let U=x2($);U.resolveFields(X,"year-month"),X.day=1;let G=U.dateToISO(X,Y);return dw(G),G}function B7($,X,Y){let U=x2($);U.resolveFields(X,"month-day");let G=U.monthDayToISOReferenceDate(X,Y);return f8(G),G}function P6($){if(N4($)&&v$($))return N($,m$);let X=h4($);if(X==="UTC")return"UTC";let{tzName:Y,offsetMinutes:U}=function(z){let{tzAnnotation:W,offset:Q,z:Z}=function(H){if(_L.test(H))return{tzAnnotation:H,offset:void 0,z:!1};try{let{tzAnnotation:V,offset:O,z:w}=w0(H);if(w||V||O)return{tzAnnotation:V,offset:O,z:w}}catch{}RL(H)}(z);return W?B2(W):Z?B2("UTC"):Q?B2(Q):void 0}(X);if(U!==void 0)return mw(U);let G=j7(Y);if(!G)throw new RangeError(`Unrecognized time zone ${Y}`);return G.identifier}function kL($,X){if($===X)return!0;let Y=B2($).offsetMinutes,U=B2(X).offsetMinutes;if(Y===void 0&&U===void 0){let G=j7(X);if(!G)return!1;let z=j7($);return!!z&&z.primaryIdentifier===G.primaryIdentifier}return Y===U}function p0($,X){let Y=B2($).offsetMinutes;return Y!==void 0?60000000000*Y:Bw($,X)}function Cw($){let X=$<0?"-":"+",Y=Math.abs($),U=Math.floor(Y/3600000000000),G=Math.floor(Y/60000000000)%60,z=Math.floor(Y/1e9)%60,W=Y%1e9;return`${X}${c7(U,G,z,W,z===0&&W===0?"minute":"auto")}`}function R1($,X){let Y=p0($,X),{isoDate:{year:U,month:G,day:z},time:{hour:W,minute:Q,second:Z,millisecond:H,microsecond:V,nanosecond:O}}=gL(X);return z3(U,G,z,W,Q,Z,H,V,O+Y)}function Z6($,X,Y){return bL(G3($,X),$,X,Y)}function bL($,X,Y,U){let G=$.length;if(G===1)return $[0];if(G)switch(U){case"compatible":case"earlier":return $[0];case"later":return $[G-1];case"reject":throw new RangeError("multiple instants found")}if(U==="reject")throw new RangeError("multiple instants found");let z=e4(Y),W=x.subtract(z,j2);V0(W);let Q=p0(X,W),Z=x.add(z,j2);V0(Z);let H=p0(X,Z)-Q;switch(U){case"earlier":{let V=C$.fromComponents(0,0,0,0,0,-H),O=Y9(Y.time,V);return G3(X,k$(r6(Y.isoDate.year,Y.isoDate.month,Y.isoDate.day+O.deltaDays),O))[0]}case"compatible":case"later":{let V=C$.fromComponents(0,0,0,0,0,H),O=Y9(Y.time,V),w=G3(X,k$(r6(Y.isoDate.year,Y.isoDate.month,Y.isoDate.day+O.deltaDays),O));return w[w.length-1]}}}function G3($,X){if($==="UTC")return aX(X.isoDate),[e4(X)];let Y=B2($).offsetMinutes;if(Y!==void 0){let U=z3(X.isoDate.year,X.isoDate.month,X.isoDate.day,X.time.hour,X.time.minute-Y,X.time.second,X.time.millisecond,X.time.microsecond,X.time.nanosecond);aX(U.isoDate);let G=e4(U);return V0(G),[G]}return aX(X.isoDate),function(U,G){let z=e4(G),W=x.subtract(z,j2);x.lessThan(W,$3)&&(W=z);let Q=x.add(z,j2);x.greaterThan(Q,eX)&&(Q=z);let Z=Bw(U,W),H=Bw(U,Q);return(Z===H?[Z]:[Z,H]).map((O)=>{let w=x.subtract(z,x.BigInt(O)),D=function(E,F){let{epochMilliseconds:J,time:{millisecond:A,microsecond:L,nanosecond:T}}=gL(F),{year:q,month:v,day:I,hour:S,minute:y,second:r}=yL(E,J);return z3(q,v,I,S,y,r,A,L,T)}(U,w);if(G9(G,D)===0)return V0(w),w}).filter((O)=>O!==void 0)}($,X)}function R2($,X){let Y=k$(X,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),U=G3($,Y);if(U.length)return U[0];let G=e4(Y),z=x.subtract(G,j2);return V0(z),cw($,z)}function A3($){let X;return X=$<0||$>9999?($<0?"-":"+")+X3(Math.abs($),6):X3($,4),X}function w1($){return X3($,2)}function fL($,X){let Y;if(X==="auto"){if($===0)return"";Y=X3($,9).replace(/0+$/,"")}else{if(X===0)return"";Y=X3($,9).slice(0,X)}return`.${Y}`}function c7($,X,Y,U,G){let z=`${w1($)}:${w1(X)}`;return G==="minute"||(z+=`:${w1(Y)}`,z+=fL(U,G)),z}function xA($,X,Y){let U=X;U===void 0&&(U="UTC");let G=N($,D$),z=U3(R1(U,G),"iso8601",Y,"never"),W="Z";return X!==void 0&&(W=hL(p0(U,G))),`${z}${W}`}function K7($,X){let Y=N($,L6),U=N($,K6),G=N($,c6),z=N($,_6),W=N($,q6),Q=N($,R6),Z=I7($),H="";Y!==0&&(H+=`${Math.abs(Y)}Y`),U!==0&&(H+=`${Math.abs(U)}M`),G!==0&&(H+=`${Math.abs(G)}W`),z!==0&&(H+=`${Math.abs(z)}D`);let V="";W!==0&&(V+=`${Math.abs(W)}H`),Q!==0&&(V+=`${Math.abs(Q)}M`);let O=C$.fromComponents(0,0,N($,T6),N($,v6),N($,C6),N($,p6));O.isZero()&&!["second","millisecond","microsecond","nanosecond"].includes(m0($))&&X==="auto"||(V+=`${Math.abs(O.sec)}${fL(Math.abs(O.subsec),X)}S`);let w=`${Z<0?"-":""}P${H}`;return V&&(w=`${w}T${V}`),w}function SA($,X="auto"){let{year:Y,month:U,day:G}=N($,E$);return`${A3(Y)}-${w1(U)}-${w1(G)}${V3(N($,p),X)}`}function kA({hour:$,minute:X,second:Y,millisecond:U,microsecond:G,nanosecond:z},W){return c7($,X,Y,1e6*U+1000*G+z,W)}function U3($,X,Y,U="auto"){let{isoDate:{year:G,month:z,day:W},time:{hour:Q,minute:Z,second:H,millisecond:V,microsecond:O,nanosecond:w}}=$;return`${A3(G)}-${w1(z)}-${w1(W)}T${c7(Q,Z,H,1e6*V+1000*O+w,Y)}${V3(X,U)}`}function bA($,X="auto"){let{year:Y,month:U,day:G}=N($,E$),z=`${w1(U)}-${w1(G)}`,W=N($,p);X!=="always"&&X!=="critical"&&W==="iso8601"||(z=`${A3(Y)}-${z}`);let Q=V3(W,X);return Q&&(z+=Q),z}function fA($,X="auto"){let{year:Y,month:U,day:G}=N($,E$),z=`${A3(Y)}-${w1(U)}`,W=N($,p);X!=="always"&&X!=="critical"&&W==="iso8601"||(z+=`-${w1(G)}`);let Q=V3(W,X);return Q&&(z+=Q),z}function hA($,X,Y="auto",U="auto",G="auto",z=void 0){let W=N($,D$);if(z){let{unit:V,increment:O,roundingMode:w}=z;W=xw(W,O,V,w)}let Q=N($,m$),Z=p0(Q,W),H=U3(R1(Q,W),"iso8601",X,"never");return G!=="never"&&(H+=hL(Z)),U!=="never"&&(H+=`[${U==="critical"?"!":""}${Q}]`),H+=V3(N($,p),Y),H}function gA($){return qL.test($)}function V9($){let X=Nb.exec($);if(!X)throw new RangeError(`invalid time zone offset: ${$}; must match \xB1HH:MM[:SS.SSSSSSSSS]`);return(X[1]==="-"?-1:1)*(1e9*(60*(60*+X[2]+ +(X[3]||0))+ +(X[4]||0))+ +((X[5]||0)+"000000000").slice(0,9))}var fG,Db=Object.assign(Object.create(null),{"/":!0,"-":!0,_:!0});function j7($){if(fG===void 0){let z=Intl.supportedValuesOf?.("timeZone");if(z){fG=new Map;for(let W=0;W<z.length;W++){let Q=z[W];fG.set(W3(Q),Q)}}else fG=null}let X=W3($),Y=fG?.get(X);if(Y)return{identifier:Y,primaryIdentifier:Y};try{Y=LL($).resolvedOptions().timeZone}catch{return}if(X==="antarctica/south_pole"&&(Y="Antarctica/McMurdo"),Zb.has($))throw new RangeError(`${$} is a legacy time zone identifier from ICU. Use ${Y} instead`);let U=[...X].map((z,W)=>W===0||Db[X[W-1]]?z.toUpperCase():z).join("").split("/");if(U.length===1)return X==="gb-eire"?{identifier:"GB-Eire",primaryIdentifier:Y}:{identifier:X.length<=3||/[-0-9]/.test(X)?X.toUpperCase():U[0],primaryIdentifier:Y};if(U[0]==="Etc")return{identifier:`Etc/${["Zulu","Greenwich","Universal"].includes(U[1])?U[1]:U[1].toUpperCase()}`,primaryIdentifier:Y};if(U[0]==="Us")return{identifier:`US/${U[1]}`,primaryIdentifier:Y};let G=new Map([["Act","ACT"],["Lhi","LHI"],["Nsw","NSW"],["Dar_Es_Salaam","Dar_es_Salaam"],["Port_Of_Spain","Port_of_Spain"],["Port-Au-Prince","Port-au-Prince"],["Isle_Of_Man","Isle_of_Man"],["Comodrivadavia","ComodRivadavia"],["Knox_In","Knox_IN"],["Dumontdurville","DumontDUrville"],["Mcmurdo","McMurdo"],["Denoronha","DeNoronha"],["Easterisland","EasterIsland"],["Bajanorte","BajaNorte"],["Bajasur","BajaSur"]]);return U[1]=G.get(U[1])??U[1],U.length>2&&(U[2]=G.get(U[2])??U[2]),{identifier:U.join("/"),primaryIdentifier:Y}}function C8($,X){let{year:Y,month:U,day:G,hour:z,minute:W,second:Q}=yL($,X),Z=X%1000;return Z<0&&(Z+=1000),1e6*(uw({isoDate:{year:Y,month:U,day:G},time:{hour:z,minute:W,second:Q,millisecond:Z}})-X)}function Bw($,X){return C8($,T1(X,"floor"))}function mw($){let X=$<0?"-":"+",Y=Math.abs($);return`${X}${c7(Math.floor(Y/60),Y%60,0,0,"minute")}`}function hL($){return mw(C2($,Gb,"halfExpand")/60000000000)}function uw({isoDate:{year:$,month:X,day:Y},time:{hour:U,minute:G,second:z,millisecond:W}}){let Q=$%400,Z=($-Q)/400,H=new Date;return H.setUTCHours(U,G,z,W),H.setUTCFullYear(Q,X-1,Y),H.getTime()+Wb*Z}function e4($){let X=uw($),Y=1000*$.time.microsecond+$.time.nanosecond;return x.add(u1(X),x.BigInt(Y))}function gL($){let X=T1($,"trunc"),Y=x.toNumber(x.remainder($,Z3));Y<0&&(Y+=1e6,X-=1);let U=Math.floor(Y/1000)%1000,G=Y%1000,z=new Date(X);return{epochMilliseconds:X,isoDate:{year:z.getUTCFullYear(),month:z.getUTCMonth()+1,day:z.getUTCDate()},time:{hour:z.getUTCHours(),minute:z.getUTCMinutes(),second:z.getUTCSeconds(),millisecond:z.getUTCMilliseconds(),microsecond:U,nanosecond:G}}}function cw($,X){if($==="UTC")return null;let Y=T1(X,"floor");if(Y<oG)return cw($,u1(oG));let U=Date.now(),G=Math.max(Y,U)+366*P2*3,z=Y,W=C8($,z),Q=z,Z=W;for(;W===Z&&z<G;){if(Q=z+2*P2*7,Q>AL)return null;Z=C8($,Q),W===Z&&(z=Q)}return W===Z?null:u1(nL((H)=>C8($,H),z,Q,W,Z))}function jw($,X){if($==="UTC")return null;let Y=T1(X,"ceil"),U=Date.now(),G=U+366*P2*3;if(Y>G){let H=jw($,u1(G));if(H===null||x.lessThan(H,u1(U)))return H}if($==="Africa/Casablanca"||$==="Africa/El_Aaiun"){let H=Date.UTC(2088,0,1);if(H<Y)return jw($,u1(H))}let z=Y-1;if(z<oG)return null;let W=C8($,z),Q=z,Z=W;for(;W===Z&&z>oG;){if(Q=z-2*P2*7,Q<oG)return null;Z=C8($,Q),W===Z&&(z=Q)}return W===Z?null:u1(nL((H)=>C8($,H),Q,z,Z,W))}function yL($,X){return function(Y){let U=Y.split(/[^\w]+/);if(U.length!==7)throw new RangeError(`expected 7 parts in "${Y}`);let G=+U[0],z=+U[1],W=+U[2],Q=U[3];if(Q[0]==="b"||Q[0]==="B")W=1-W;else if(Q[0]!=="a"&&Q[0]!=="A")throw new RangeError(`Unknown era ${Q} in "${Y}`);let Z=U[4]==="24"?0:+U[4],H=+U[5],V=+U[6];if(!(Number.isFinite(W)&&Number.isFinite(G)&&Number.isFinite(z)&&Number.isFinite(Z)&&Number.isFinite(H)&&Number.isFinite(V)))throw new RangeError(`Invalid number in "${Y}`);return{year:W,month:G,day:z,hour:Z,minute:H,second:V}}(LL($).format(X))}function P7($){return $!==void 0&&!($%4!=0||$%100==0&&$%400!=0)}function B8($,X){return{standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[P7($)?"leapyear":"standard"][X-1]}function I7($){let X=[N($,L6),N($,K6),N($,c6),N($,_6),N($,q6),N($,R6),N($,T6),N($,v6),N($,C6),N($,p6)];for(let Y=0;Y<X.length;Y++){let U=X[Y];if(U!==0)return U<0?-1:1}return 0}function p7($){let X=["years","months","weeks","days"];for(let Y=0;Y<X.length;Y++){let U=$[X[Y]];if(U!==0)return U<0?-1:1}return 0}function mL($){let X=p7($.date);return X!==0?X:$.time.sign()}function v8($,X){let Y=$,U=X;if(!Number.isFinite(Y)||!Number.isFinite(U))throw new RangeError("infinity is out of range");return U-=1,Y+=Math.floor(U/12),U%=12,U<0&&(U+=12),U+=1,{year:Y,month:U}}function r6($,X,Y){let U=$,G=X,z=Y;if(!Number.isFinite(z))throw new RangeError("infinity is out of range");({year:U,month:G}=v8(U,G));let W=146097;if(Math.abs(z)>W){let H=Math.trunc(z/W);U+=400*H,z-=H*W}let Q=0,Z=G>2?U:U-1;for(;Q=P7(Z)?366:365,z<-Q;)U-=1,Z-=1,z+=Q;for(Z+=1;Q=P7(Z)?366:365,z>Q;)U+=1,Z+=1,z-=Q;for(;z<1;)({year:U,month:G}=v8(U,G-1)),z+=B8(U,G);for(;z>B8(U,G);)z-=B8(U,G),{year:U,month:G}=v8(U,G+1);return{year:U,month:G,day:z}}function z3($,X,Y,U,G,z,W,Q,Z){let H=T2(U,G,z,W,Q,Z);return k$(r6($,X,Y+H.deltaDays),H)}function T2($,X,Y,U,G,z){let W,Q=$,Z=X,H=Y,V=U,O=G,w=z;({div:W,mod:w}=oX(w,3)),O+=W,w<0&&(O-=1,w+=1000),{div:W,mod:O}=oX(O,3),V+=W,O<0&&(V-=1,O+=1000),H+=Math.trunc(V/1000),V%=1000,V<0&&(H-=1,V+=1000),Z+=Math.trunc(H/60),H%=60,H<0&&(Z-=1,H+=60),Q+=Math.trunc(Z/60),Z%=60,Z<0&&(Q-=1,Z+=60);let D=Math.trunc(Q/24);return Q%=24,Q<0&&(D-=1,Q+=24),D+=0,Q+=0,Z+=0,H+=0,V+=0,O+=0,w+=0,{deltaDays:D,hour:Q,minute:Z,second:H,millisecond:V,microsecond:O,nanosecond:w}}function yA($,X){let Y=Q6($,0);if(p7(Y)===0)return $.days;let U=N(X,E$),G=O1(N(X,p),U,Y,"constrain"),z=x8(U.year,U.month-1,U.day),W=x8(G.year,G.month-1,G.day)-z;return $.days+W}function i6($){return new($6("%Temporal.Duration%"))(-N($,L6),-N($,K6),-N($,c6),-N($,_6),-N($,q6),-N($,R6),-N($,T6),-N($,v6),-N($,C6),-N($,p6))}function B6($,X,Y){return Math.min(Y,Math.max(X,$))}function uL($,X,Y){let U=B6(X,1,12);return{year:$,month:U,day:B6(Y,1,B8($,U))}}function r4($,X,Y){if($<X||$>Y)throw new RangeError(`value out of range: ${X} <= ${$} <= ${Y}`)}function P8($,X,Y){r4(X,1,12),r4(Y,1,B8($,X))}function f8($){I8(k$($,{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}))}function d7($,X,Y,U,G,z){r4($,0,23),r4(X,0,59),r4(Y,0,59),r4(U,0,999),r4(G,0,999),r4(z,0,999)}function pw($,X,Y,U,G,z,W,Q,Z){P8($,X,Y),d7(U,G,z,W,Q,Z)}function I8($){let X=e4($);(x.lessThan(X,Ub)||x.greaterThan(X,zb))&&V0(X)}function Pw($){e4($)}function V0($){if(x.lessThan($,$3)||x.greaterThan($,eX))throw new RangeError("date/time value is outside of supported range")}function dw({year:$,month:X}){r4($,TA,vA),$===TA?r4(X,4,12):$===vA&&r4(X,1,9)}function l7($,X,Y,U,G,z,W,Q,Z,H){let V=0,O=[$,X,Y,U,G,z,W,Q,Z,H];for(let A=0;A<O.length;A++){let L=O[A];if(L===1/0||L===-1/0)throw new RangeError("infinite values not allowed as duration fields");if(L!==0){let T=L<0?-1:1;if(V!==0&&T!==V)throw new RangeError("mixed-sign values not allowed as duration fields");V=T}}if(Math.abs($)>=4294967296||Math.abs(X)>=4294967296||Math.abs(Y)>=4294967296)throw new RangeError("years, months, and weeks must be < 2\xB3\xB2");let w=oX(Q,3),D=oX(Z,6),E=oX(H,9),F=oX(1e6*w.mod+1000*D.mod+E.mod,9).div,J=86400*U+3600*G+60*z+W+w.div+D.div+E.div+F;if(!Number.isSafeInteger(J))throw new RangeError("total of duration time units cannot exceed 9007199254740991.999999999 s")}function iX($){return{date:{years:N($,L6),months:N($,K6),weeks:N($,c6),days:N($,_6)},time:C$.fromComponents(N($,q6),N($,R6),N($,T6),N($,v6),N($,C6),N($,p6))}}function Q0($){let X=C$.fromComponents(N($,q6),N($,R6),N($,T6),N($,v6),N($,C6),N($,p6)).add24HourDays(N($,_6));return{date:{years:N($,L6),months:N($,K6),weeks:N($,c6),days:0},time:X}}function cL($){let X=Q0($),Y=Math.trunc(X.time.sec/86400);return l7(X.date.years,X.date.months,X.date.weeks,Y,0,0,0,0,0,0),{...X.date,days:Y}}function _1($,X){let Y=$.time.sign(),U=$.time.abs().subsec,G=0,z=0,W=$.time.abs().sec,Q=0,Z=0,H=0;switch(X){case"year":case"month":case"week":case"day":G=Math.trunc(U/1000),U%=1000,z=Math.trunc(G/1000),G%=1000,W+=Math.trunc(z/1000),z%=1000,Q=Math.trunc(W/60),W%=60,Z=Math.trunc(Q/60),Q%=60,H=Math.trunc(Z/24),Z%=24;break;case"hour":G=Math.trunc(U/1000),U%=1000,z=Math.trunc(G/1000),G%=1000,W+=Math.trunc(z/1000),z%=1000,Q=Math.trunc(W/60),W%=60,Z=Math.trunc(Q/60),Q%=60;break;case"minute":G=Math.trunc(U/1000),U%=1000,z=Math.trunc(G/1000),G%=1000,W+=Math.trunc(z/1000),z%=1000,Q=Math.trunc(W/60),W%=60;break;case"second":G=Math.trunc(U/1000),U%=1000,z=Math.trunc(G/1000),G%=1000,W+=Math.trunc(z/1000),z%=1000;break;case"millisecond":G=Math.trunc(U/1000),U%=1000,z=ww(W,3,Math.trunc(G/1000)),G%=1000,W=0;break;case"microsecond":G=ww(W,6,Math.trunc(U/1000)),U%=1000,W=0;break;case"nanosecond":U=ww(W,9,U),W=0}return new($6("%Temporal.Duration%"))($.date.years,$.date.months,$.date.weeks,$.date.days+Y*H,Y*Z,Y*Q,Y*W,Y*z,Y*G,Y*U)}function l0($,X){return p7($),X.sign(),{date:$,time:X}}function x8($,X,Y){return uw({isoDate:{year:$,month:X+1,day:Y},time:{hour:0,minute:0,second:0,millisecond:0}})/P2}function aX({year:$,month:X,day:Y}){if(Math.abs(x8($,X-1,Y))>1e8)throw new RangeError("date/time value is outside the supported range")}function lw($,X){let Y=X.hour-$.hour,U=X.minute-$.minute,G=X.second-$.second,z=X.millisecond-$.millisecond,W=X.microsecond-$.microsecond,Q=X.nanosecond-$.nanosecond;return C$.fromComponents(Y,U,G,z,W,Q)}function rw($,X,Y,U,G){let z=C$.fromEpochNsDiff(X,$);return z=x7(z,Y,U,G),l0({years:0,months:0,weeks:0,days:0},z)}function pL($,X,Y,U){Pw($),Pw(X);let G=lw($.time,X.time),z=G.sign(),W=O0($.isoDate,X.isoDate),Q=X.isoDate;W===z&&(Q=r6(Q.year,Q.month,Q.day+z),G=G.add24HourDays(-z));let Z=d0("day",U),H=F3(Y,$.isoDate,Q,Z);return U!==Z&&(G=G.add24HourDays(H.days),H.days=0),l0(H,G)}function dL($,X,Y,U,G){let z=x.subtract(X,$);if(x.equal(z,H1))return{date:{years:0,months:0,weeks:0,days:0},time:C$.ZERO};let W=x.lessThan(z,H1)?-1:1,Q=R1(Y,$),Z=R1(Y,X),H,V=0,O=W===1?2:1,w=lw(Q.time,Z.time);for(w.sign()===-W&&V++;V<=O;V++){H=k$(r6(Z.isoDate.year,Z.isoDate.month,Z.isoDate.day-V*W),Q.time);let E=Z6(Y,H,"compatible");if(w=C$.fromEpochNsDiff(X,E),w.sign()!==-W)break}let D=d0("day",G);return l0(F3(U,Q.isoDate,H.isoDate,D),w)}function lL($,X,Y,U,G,z,W,Q,Z){let H,V,O,w,D=X;switch(Q){case"year":{let l=C2(D.date.years,W,"trunc");H=l,V=l+W*$,O={years:H,months:0,weeks:0,days:0},w={...O,years:V};break}case"month":{let l=C2(D.date.months,W,"trunc");H=l,V=l+W*$,O=Q6(D.date,0,0,H),w=Q6(D.date,0,0,V);break}case"week":{let l=Q6(D.date,0,0),W$=O1(z,U.isoDate,l,"constrain"),L$=F3(z,W$,r6(W$.year,W$.month,W$.day+D.date.days),"week"),b$=C2(D.date.weeks+L$.weeks,W,"trunc");H=b$,V=b$+W*$,O=Q6(D.date,0,H),w=Q6(D.date,0,V);break}case"day":{let l=C2(D.date.days,W,"trunc");H=l,V=l+W*$,O=Q6(D.date,H),w=Q6(D.date,V);break}}let E=O1(z,U.isoDate,O,"constrain"),F=O1(z,U.isoDate,w,"constrain"),J,A,L=k$(E,U.time),T=k$(F,U.time);G?(J=Z6(G,L,"compatible"),A=Z6(G,T,"compatible")):(J=e4(L),A=e4(T));let q=C$.fromEpochNsDiff(Y,J),v=C$.fromEpochNsDiff(A,J),I=f7(Z,$<0?"negative":"positive"),S=q.add(q).abs().subtract(v.abs()).sign(),y=Math.abs(H)/W%2==0,r=q.isZero()?Math.abs(H):q.cmp(v)?h7(Math.abs(H),Math.abs(V),S,y,I):Math.abs(V),j=new C$(x.add(x.multiply(v.totalNs,x.BigInt(H)),x.multiply(q.totalNs,x.BigInt(W*$)))).fdiv(v.totalNs),X$=r===Math.abs(V);return D={date:X$?w:O,time:C$.ZERO},{nudgeResult:{duration:D,nudgedEpochNs:X$?A:J,didExpandCalendarUnit:X$},total:j}}function r7($,X,Y,U,G,z,W,Q,Z){let H=$,V=z0(Q)||U&&Q==="day",O=mL(H)<0?-1:1,w;return V?{nudgeResult:w}=lL(O,H,X,Y,U,G,W,Q,Z):w=U?function(D,E,F,J,A,L,T,q){let v=E,I=O1(A,F.isoDate,v.date,"constrain"),S=k$(I,F.time),y=k$(r6(I.year,I.month,I.day+D),F.time),r=Z6(J,S,"compatible"),j=Z6(J,y,"compatible"),X$=C$.fromEpochNsDiff(j,r);if(X$.sign()!==D)throw new RangeError("time zone returned inconsistent Instants");let l=x.BigInt(X9[T]*L),W$=v.time.round(l,q),L$=W$.subtract(X$),b$=L$.sign()!==-D,L4,X6;return b$?(L4=D,W$=L$.round(l,q),X6=W$.addToEpochNs(j)):(L4=0,X6=W$.addToEpochNs(r)),{duration:l0(Q6(v.date,v.date.days+L4),W$),nudgedEpochNs:X6,didExpandCalendarUnit:b$}}(O,H,Y,U,G,W,Q,Z):function(D,E,F,J,A,L){let T=D,q=T.time.add24HourDays(T.date.days),v=q.round(x.BigInt(J*X9[A]),L),I=v.subtract(q),{quotient:S}=q.divmod(T7),{quotient:y}=v.divmod(T7),r=Math.sign(y-S)===q.sign(),j=I.addToEpochNs(E),X$=0,l=v;return u0(F)==="date"&&(X$=y,l=v.add(C$.fromComponents(24*-y,0,0,0,0,0))),{duration:{date:Q6(T.date,X$),time:l},nudgedEpochNs:j,didExpandCalendarUnit:r}}(H,X,z,W,Q,Z),H=w.duration,w.didExpandCalendarUnit&&Q!=="week"&&(H=function(D,E,F,J,A,L,T,q){let v=E;if(q===T)return v;let I=nG.indexOf(T);for(let S=nG.indexOf(q)-1;S>=I;S--){let y=nG[S];if(y==="week"&&T!=="week")continue;let r;switch(y){case"year":r={years:v.date.years+D,months:0,weeks:0,days:0};break;case"month":{let l=v.date.months+D;r=Q6(v.date,0,0,l);break}case"week":{let l=v.date.weeks+D;r=Q6(v.date,0,l);break}}let j=k$(O1(L,J.isoDate,r,"constrain"),J.time),X$;if(X$=A?Z6(A,j,"compatible"):e4(j),q7(F,X$)===-D)break;v={date:r,time:C$.ZERO}}return v}(O,H,w.nudgedEpochNs,Y,U,G,z,d0(Q,"day"))),H}function mA($,X,Y,U,G,z){return z0(z)||U&&z==="day"?lL(mL($)<0?-1:1,$,X,Y,U,G,1,z,"trunc").total:sG($.time.add24HourDays($.date.days),z)}function rL($,X,Y,U,G,z,W){if(G9($,X)==0)return{date:{years:0,months:0,weeks:0,days:0},time:C$.ZERO};I8($),I8(X);let Q=pL($,X,Y,U);return z==="nanosecond"&&G===1?Q:r7(Q,e4(X),$,null,Y,U,G,z,W)}function iL($,X,Y,U,G,z,W,Q){if(u0(G)==="time")return rw($,X,z,W,Q);let Z=dL($,X,Y,U,G);return W==="nanosecond"&&z===1?Z:r7(Z,X,R1(Y,$),Y,U,G,z,W,Q)}function O9($,X,Y,U,G,z){let W=$9.reduce((D,E)=>{let F=E[0],J=E[1],A=E[2];return Y!=="datetime"&&A!==Y||U.includes(J)||D.push(J,F),D},[]),Q=l6(X,"largestUnit",Y,"auto");if(U.includes(Q))throw new RangeError(`largestUnit must be one of ${W.join(", ")}, not ${Q}`);let Z=Z9(X),H=c1(X,"trunc");$==="since"&&(H=function(D){switch(D){case"ceil":return"floor";case"floor":return"ceil";case"halfCeil":return"halfFloor";case"halfFloor":return"halfCeil";default:return D}}(H));let V=l6(X,"smallestUnit",Y,G);if(U.includes(V))throw new RangeError(`smallestUnit must be one of ${W.join(", ")}, not ${V}`);let O=d0(z,V);if(Q==="auto"&&(Q=O),d0(Q,V)!==Q)throw new RangeError(`largestUnit ${Q} cannot be smaller than smallestUnit ${V}`);let w={hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[V];return w!==void 0&&H9(Z,w,!1),{largestUnit:Q,roundingIncrement:Z,roundingMode:H,smallestUnit:V}}function uA($,X,Y,U){let G=pG(Y),z=O9($,Q$(U),"time",[],"nanosecond","second"),W=_1(rw(N(X,D$),N(G,D$),z.roundingIncrement,z.smallestUnit,z.roundingMode),z.largestUnit);return $==="since"&&(W=i6(W)),W}function cA($,X,Y,U){let G=uG(Y),z=N(X,p),W=N(G,p);if(!H0(z,W))throw new RangeError(`cannot compute difference between dates of ${z} and ${W} calendars`);let Q=O9($,Q$(U),"date",[],"day","day"),Z=$6("%Temporal.Duration%"),H=N(X,E$),V=N(G,E$);if(O0(H,V)===0)return new Z;let O={date:F3(z,H,V,Q.largestUnit),time:C$.ZERO};if(Q.smallestUnit!=="day"||Q.roundingIncrement!==1){let D=k$(H,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});O=r7(O,e4(k$(V,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),D,null,z,Q.largestUnit,Q.roundingIncrement,Q.smallestUnit,Q.roundingMode)}let w=_1(O,"day");return $==="since"&&(w=i6(w)),w}function pA($,X,Y,U){let G=cG(Y),z=N(X,p),W=N(G,p);if(!H0(z,W))throw new RangeError(`cannot compute difference between dates of ${z} and ${W} calendars`);let Q=O9($,Q$(U),"datetime",[],"nanosecond","day"),Z=$6("%Temporal.Duration%"),H=N(X,W4),V=N(G,W4);if(G9(H,V)===0)return new Z;let O=_1(rL(H,V,z,Q.largestUnit,Q.roundingIncrement,Q.smallestUnit,Q.roundingMode),Q.largestUnit);return $==="since"&&(O=i6(O)),O}function dA($,X,Y,U){let G=v2(Y),z=O9($,Q$(U),"time",[],"nanosecond","hour"),W=lw(N(X,E4),N(G,E4));W=x7(W,z.roundingIncrement,z.smallestUnit,z.roundingMode);let Q=_1(l0({years:0,months:0,weeks:0,days:0},W),z.largestUnit);return $==="since"&&(Q=i6(Q)),Q}function lA($,X,Y,U){let G=dG(Y),z=N(X,p),W=N(G,p);if(!H0(z,W))throw new RangeError(`cannot compute difference between months of ${z} and ${W} calendars`);let Q=O9($,Q$(U),"date",["week","day"],"month","year"),Z=$6("%Temporal.Duration%");if(O0(N(X,E$),N(G,E$))==0)return new Z;let H=I6(z,N(X,E$),"year-month");H.day=1;let V=I2(z,H,"constrain"),O=I6(z,N(G,E$),"year-month");O.day=1;let w=I2(z,O,"constrain"),D={date:Q6(F3(z,V,w,Q.largestUnit),0,0),time:C$.ZERO};if(Q.smallestUnit!=="month"||Q.roundingIncrement!==1){let F=k$(V,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});D=r7(D,e4(k$(w,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),F,null,z,Q.largestUnit,Q.roundingIncrement,Q.smallestUnit,Q.roundingMode)}let E=_1(D,"day");return $==="since"&&(E=i6(E)),E}function rA($,X,Y,U){let G=lG(Y),z=N(X,p),W=N(G,p);if(!H0(z,W))throw new RangeError(`cannot compute difference between dates of ${z} and ${W} calendars`);let Q=O9($,Q$(U),"datetime",[],"nanosecond","hour"),Z=N(X,D$),H=N(G,D$),V=$6("%Temporal.Duration%"),O;if(u0(Q.largestUnit)!=="date")O=_1(rw(Z,H,Q.roundingIncrement,Q.smallestUnit,Q.roundingMode),Q.largestUnit);else{let w=N(X,m$);if(!kL(w,N(G,m$)))throw new RangeError("When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.");if(x.equal(Z,H))return new V;O=_1(iL(Z,H,w,z,Q.largestUnit,Q.roundingIncrement,Q.smallestUnit,Q.roundingMode),"hour")}return $==="since"&&(O=i6(O)),O}function Y9({hour:$,minute:X,second:Y,millisecond:U,microsecond:G,nanosecond:z},W){let Q=Y,Z=z;return Q+=W.sec,Z+=W.subsec,T2($,X,Q,U,G,Z)}function Iw($,X){let Y=X.addToEpochNs($);return V0(Y),Y}function rG($,X,Y,U,G="constrain"){if(p7(U.date)===0)return Iw($,U.time);let z=R1(X,$);return Iw(Z6(X,k$(O1(Y,z.isoDate,U.date,G),z.time),"compatible"),U.time)}function iA($,X,Y){let U=q1(Y);$==="subtract"&&(U=i6(U));let G=d0(m0(X),m0(U));if(z0(G))throw new RangeError("For years, months, or weeks arithmetic, use date arithmetic relative to a starting point");let z=Q0(X),W=Q0(U);return _1(l0({years:0,months:0,weeks:0,days:0},z.time.add(W.time)),G)}function oA($,X,Y){let U=q1(Y);$==="subtract"&&(U=i6(U));let G=m0(U);if(u0(G)==="date")throw new RangeError(`Duration field ${G} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);let z=Q0(U);return m1(Iw(N(X,D$),z.time))}function nA($,X,Y,U){let G=N(X,p),z=q1(Y);$==="subtract"&&(z=i6(z));let W=cL(z),Q=x$(Q$(U));return j6(O1(G,N(X,E$),W,Q),G)}function tA($,X,Y,U){let G=q1(Y);$==="subtract"&&(G=i6(G));let z=x$(Q$(U)),W=N(X,p),Q=Q0(G),Z=N(X,W4),H=Y9(Z.time,Q.time),V=Q6(Q.date,H.deltaDays);return l7(V.years,V.months,V.weeks,V.days,0,0,0,0,0,0),K1(k$(O1(W,Z.isoDate,V,z),H),W)}function aA($,X,Y){let U=q1(Y);$==="subtract"&&(U=i6(U));let G=Q0(U),{hour:z,minute:W,second:Q,millisecond:Z,microsecond:H,nanosecond:V}=Y9(N(X,E4),G.time);return c0(u7(z,W,Q,Z,H,V,"reject"))}function sA($,X,Y,U){let G=q1(Y);$==="subtract"&&(G=i6(G));let z=x$(Q$(U)),W=I7(G),Q=N(X,p),Z=I6(Q,N(X,E$),"year-month");Z.day=1;let H=I2(Q,Z,"constrain");if(W<0){let O=O1(Q,H,{months:1},"constrain");H=r6(O.year,O.month,O.day-1)}let V=cL(G);return f8(H),tX(Y3(Q,I6(Q,O1(Q,H,V,z),"year-month"),z),Q)}function eA($,X,Y,U){let G=q1(Y);$==="subtract"&&(G=i6(G));let z=x$(Q$(U)),W=N(X,m$),Q=N(X,p),Z=iX(G);return W6(rG(N(X,D$),W,Q,Z,z),W,Q)}function C2($,X,Y){let U=Math.trunc($/X),G=$%X,z=$<0?"negative":"positive",W=Math.abs(U),Q=W+1,Z=d6(Math.abs(2*G)-X),H=W%2==0,V=f7(Y,z),O=G===0?W:h7(W,Q,Z,H,V);return X*(z==="positive"?O:-O)}function xw($,X,Y,U){let G=X9[Y]*X;return function(z,W,Q){let Z=y0(z),H=y0(W),V=x.divide(Z,H),O=x.remainder(Z,H),w=f7(Q,"positive"),D,E;x.lessThan(Z,H1)?(D=x.subtract(V,eG),E=V):(D=V,E=x.add(V,eG));let F=q7(T8(x.multiply(O,hw)),H)*(x.lessThan(Z,H1)?-1:1)+0,J=x.equal(O,H1)?V:h7(D,E,F,GL(D),w);return x.multiply(J,H)}($,x.BigInt(G),U)}function Sw($,X,Y,U){Pw($);let{year:G,month:z,day:W}=$.isoDate,Q=kw($.time,X,Y,U);return k$(r6(G,z,W+Q.deltaDays),Q)}function kw({hour:$,minute:X,second:Y,millisecond:U,microsecond:G,nanosecond:z},W,Q,Z){let H;switch(Q){case"day":case"hour":H=1000*(1000*(1000*(60*(60*$+X)+Y)+U)+G)+z;break;case"minute":H=1000*(1000*(1000*(60*X+Y)+U)+G)+z;break;case"second":H=1000*(1000*(1000*Y+U)+G)+z;break;case"millisecond":H=1000*(1000*U+G)+z;break;case"microsecond":H=1000*G+z;break;case"nanosecond":H=z}let V=X9[Q],O=C2(H,V*W,Z)/V;switch(Q){case"day":return{deltaDays:O,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case"hour":return T2(O,0,0,0,0,0);case"minute":return T2($,O,0,0,0,0);case"second":return T2($,X,O,0,0,0);case"millisecond":return T2($,X,Y,O,0,0);case"microsecond":return T2($,X,Y,U,O,0);case"nanosecond":return T2($,X,Y,U,G,O);default:throw new Error(`Invalid unit ${Q}`)}}function x7($,X,Y,U){let G=X9[Y];return $.round(x.BigInt(G*X),U)}function sG($,X){let Y=X9[X];return $.fdiv(x.BigInt(Y))}function O0($,X){return $.year!==X.year?d6($.year-X.year):$.month!==X.month?d6($.month-X.month):$.day!==X.day?d6($.day-X.day):0}function bw($,X){return $.hour!==X.hour?d6($.hour-X.hour):$.minute!==X.minute?d6($.minute-X.minute):$.second!==X.second?d6($.second-X.second):$.millisecond!==X.millisecond?d6($.millisecond-X.millisecond):$.microsecond!==X.microsecond?d6($.microsecond-X.microsecond):$.nanosecond!==X.nanosecond?d6($.nanosecond-X.nanosecond):0}function G9($,X){let Y=O0($.isoDate,X.isoDate);return Y!==0?Y:bw($.time,X.time)}function oL($){let X=S7($);return globalThis.BigInt!==void 0?globalThis.BigInt(X.toString(10)):X}function T1($,X){let Y=y0($),{quotient:U,remainder:G}=yG(Y,Z3),z=x.toNumber(U);return X==="floor"&&x.toNumber(G)<0&&(z-=1),X==="ceil"&&x.toNumber(G)>0&&(z+=1),z}function u1($){if(!Number.isInteger($))throw new RangeError("epoch milliseconds must be an integer");return x.multiply(x.BigInt($),Z3)}function S7($){let X=$;if(typeof $=="object"){let Y=$[Symbol.toPrimitive];Y&&typeof Y=="function"&&(X=Y.call($,"number"))}if(typeof X=="number")throw new TypeError("cannot convert number to bigint");return typeof X=="bigint"?x.BigInt(X.toString(10)):x.BigInt(X)}var fw=(()=>{let $=x.BigInt(Date.now()%1e6);return()=>{let X=Date.now(),Y=x.BigInt(X),U=x.add(u1(X),$);return $=x.remainder(Y,Z3),x.greaterThan(U,eX)?eX:x.lessThan(U,$3)?$3:U}})();function hG(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}function d6($){return $<0?-1:$>0?1:$}function Q$($){if($===void 0)return Object.create(null);if(N4($)&&$!==null)return $;throw new TypeError("Options parameter must be an object, not "+($===null?"null":typeof $))}function S8($,X){let Y=Object.create(null);return Y[$]=X,Y}function r0($,X,Y,U){let G=$[X];if(G!==void 0){if(G=y7(G),!Y.includes(G))throw new RangeError(`${X} must be one of ${Y.join(", ")}, not ${G}`);return G}if(U===o0)throw new RangeError(`${X} option is required`);return U}function S6($){let X=W3($);if(!Qb.includes(W3(X)))throw new RangeError(`invalid calendar identifier ${X}`);switch(X){case"ethiopic-amete-alem":return"ethioaa";case"islamicc":return"islamic-civil"}return X}function W3($){let X="";for(let Y=0;Y<$.length;Y++){let U=$.charCodeAt(Y);X+=U>=65&&U<=90?String.fromCharCode(U+32):String.fromCharCode(U)}return X}function S2($){throw new TypeError(`Do not use built-in arithmetic operators with Temporal objects. When comparing, use ${$==="PlainMonthDay"?"Temporal.PlainDate.compare(obj1.toPlainDate(year), obj2.toPlainDate(year))":`Temporal.${$}.compare(obj1, obj2)`}, not obj1 > obj2. When coercing to strings, use \`\${obj}\` or String(obj), not '' + obj. When coercing to numbers, use properties or methods of the object, not \`+obj\`. When concatenating with strings, use \`\${str}\${obj}\` or str.concat(obj), not str + obj. In React, coerce to a string before rendering a Temporal object.`)}var Eb=new RegExp(`^${ML.source}$`),Nb=new RegExp(`^${/([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?/.source}$`);function nL($,X,Y,U=$(X),G=$(Y)){let z=X,W=Y,Q=U,Z=G;for(;W-z>1;){let H=Math.trunc((z+W)/2),V=$(H);V===Q?(z=H,Q=V):V===Z&&(W=H,Z=V)}return W}function tL($){return[...$]}function aL($,X){if($!=="gregory"&&$!=="iso8601")return;let Y=L3[$],U=X.year,{dayOfWeek:G,dayOfYear:z,daysInYear:W}=Y.isoToDate(X,{dayOfWeek:!0,dayOfYear:!0,daysInYear:!0}),Q=Y.getFirstDayOfWeek(),Z=Y.getMinimalDaysInFirstWeek(),H=(G+7-Q)%7,V=(G-z+7001-Q)%7,O=Math.floor((z-1+V)/7);if(7-V>=Z&&++O,O==0)O=function(w,D,E,F){let J=(F-w-E+1)%7;J<0&&(J+=7);let A=Math.floor((E+J-1)/7);return 7-J>=D&&++A,A}(Q,Z,z+Y.isoToDate(Y.dateAdd(X,{years:-1},"constrain"),{daysInYear:!0}).daysInYear,G),U--;else if(z>=W-5){let w=(H+W-z)%7;w<0&&(w+=7),6-w>=Z&&z+7-H>W&&(O=1,U++)}return{week:O,year:U}}function $L($,X,Y,U,G){if(X!==G.year){if($*(X-G.year)>0)return!0}else if(Y!==G.month){if($*(Y-G.month)>0)return!0}else if(U!==G.day&&$*(U-G.day)>0)return!0;return!1}var L3={};function k8($){if(!$.startsWith("M"))throw new RangeError(`Invalid month code: ${$}. Month codes must start with M.`);let X=+$.slice(1);if(Number.isNaN(X))throw new RangeError(`Invalid month code: ${$}`);return X}function Z0($,X=!1){return`M${`${$}`.padStart(2,"0")}${X?"L":""}`}function iw($,X=void 0,Y=12){let{month:U,monthCode:G}=$;if(G===void 0){if(U===void 0)throw new TypeError("Either month or monthCode are required");X==="reject"&&r4(U,1,Y),X==="constrain"&&(U=B6(U,1,Y)),G=Z0(U)}else{let z=k8(G);if(G!==Z0(z))throw new RangeError(`Invalid month code: ${G}`);if(U!==void 0&&U!==z)throw new RangeError(`monthCode ${G} and month ${U} must match if both are present`);if(U=z,U<1||U>Y)throw new RangeError(`Invalid monthCode: ${G}`)}return{...$,month:U,monthCode:G}}L3.iso8601={resolveFields($,X){if((X==="date"||X==="year-month")&&$.year===void 0)throw new TypeError("year is required");if((X==="date"||X==="month-day")&&$.day===void 0)throw new TypeError("day is required");Object.assign($,iw($))},dateToISO:($,X)=>tG($.year,$.month,$.day,X),monthDayToISOReferenceDate($,X){let{month:Y,day:U}=tG($.year??1972,$.month,$.day,X);return{month:Y,day:U,year:1972}},extraFields:()=>[],fieldKeysToIgnore($){let X=new Set;for(let Y=0;Y<$.length;Y++){let U=$[Y];X.add(U),U==="month"?X.add("monthCode"):U==="monthCode"&&X.add("month")}return tL(X)},dateAdd($,{years:X=0,months:Y=0,weeks:U=0,days:G=0},z){let{year:W,month:Q,day:Z}=$;return W+=X,Q+=Y,{year:W,month:Q}=v8(W,Q),{year:W,month:Q,day:Z}=tG(W,Q,Z,z),Z+=G+7*U,r6(W,Q,Z)},dateUntil($,X,Y){let U=-O0($,X);if(U===0)return{years:0,months:0,weeks:0,days:0};let G,z=0,W=0;if(Y==="year"||Y==="month"){let V=X.year-$.year;for(V!==0&&(V-=U);!$L(U,$.year+V,$.month,$.day,X);)z=V,V+=U;let O=U;for(G=v8($.year+z,$.month+O);!$L(U,G.year,G.month,$.day,X);)W=O,O+=U,G=v8(G.year,G.month+U);Y==="month"&&(W+=12*z,z=0)}G=v8($.year+z,$.month+W);let Q=uL(G.year,G.month,$.day),Z=0,H=x8(X.year,X.month-1,X.day)-x8(Q.year,Q.month-1,Q.day);return Y==="week"&&(Z=Math.trunc(H/7),H%=7),{years:z,months:W,weeks:Z,days:H}},isoToDate({year:$,month:X,day:Y},U){let G={era:void 0,eraYear:void 0,year:$,month:X,day:Y,daysInWeek:7,monthsInYear:12};if(U.monthCode&&(G.monthCode=Z0(X)),U.dayOfWeek){let z=X+(X<3?10:-2),W=$-(X<3?1:0),Q=Math.floor(W/100),Z=W-100*Q,H=(Y+Math.floor(2.6*z-0.2)+(Z+Math.floor(Z/4))+(Math.floor(Q/4)-2*Q))%7;G.dayOfWeek=H+(H<=0?7:0)}if(U.dayOfYear){let z=Y;for(let W=X-1;W>0;W--)z+=B8($,W);G.dayOfYear=z}return U.weekOfYear&&(G.weekOfYear=aL("iso8601",{year:$,month:X,day:Y})),U.daysInMonth&&(G.daysInMonth=B8($,X)),(U.daysInYear||U.inLeapYear)&&(G.inLeapYear=P7($),G.daysInYear=G.inLeapYear?366:365),G},getFirstDayOfWeek:()=>1,getMinimalDaysInFirstWeek:()=>4};class l4{constructor($){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,$!==void 0){let X=0;for(let Y of $.map.entries()){if(++X>l4.MAX_CACHE_ENTRIES)break;this.map.set(...Y)}}}get($){let X=this.map.get($);return X&&(this.hits++,this.report()),this.calls++,X}set($,X){this.map.set($,X),this.misses++,this.report()}report(){}setObject($){if(l4.objectMap.get($))throw new RangeError("object already cached");l4.objectMap.set($,this),this.report()}static getCacheForObject($){let X=l4.objectMap.get($);return X||(X=new l4,l4.objectMap.set($,X)),X}}function sL({isoYear:$,isoMonth:X,isoDay:Y}){return`${A3($)}-${w1(X)}-${w1(Y)}T00:00Z`}function Nw($,X){return{years:$.year-X.year,months:$.month-X.month,days:$.day-X.day}}l4.objectMap=new WeakMap,l4.MAX_CACHE_ENTRIES=1000;class k2{constructor(){this.eras=[],this.hasEra=!1,this.erasBeginMidYear=!1}getFormatter(){return this.formatter===void 0&&(this.formatter=new Intl.DateTimeFormat(`en-US-u-ca-${this.id}`,{day:"numeric",month:"numeric",year:"numeric",era:"short",timeZone:"UTC"})),this.formatter}getCalendarParts($){let X=this.getFormatter(),Y=new Date($);if($==="-271821-04-19T00:00Z"){let U=X.resolvedOptions();X=new Intl.DateTimeFormat(U.locale,{...U,timeZone:"Etc/GMT+1"}),Y=new Date("-271821-04-20T00:00Z")}try{return X.formatToParts(Y)}catch(U){throw new RangeError(`Invalid ISO date: ${$}`)}}isoToCalendarDate($,X){let{year:Y,month:U,day:G}=$,z=JSON.stringify({func:"isoToCalendarDate",isoYear:Y,isoMonth:U,isoDay:G,id:this.id}),W=X.get(z);if(W)return W;let Q=sL({isoYear:Y,isoMonth:U,isoDay:G}),Z=this.getCalendarParts(Q),H={};for(let O=0;O<Z.length;O++){let{type:w,value:D}=Z[O];if(w!=="year"&&w!=="relatedYear"||(this.hasEra?H.eraYear=+D:H.year=+D),w==="month"){let E=/^([0-9]*)(.*?)$/.exec(D);if(!E||E.length!=3||!E[1]&&!E[2])throw new RangeError(`Unexpected month: ${D}`);if(H.month=E[1]?+E[1]:1,H.month<1)throw new RangeError(`Invalid month ${D} from ${Q}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(H.month>13)throw new RangeError(`Invalid month ${D} from ${Q}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);E[2]&&(H.monthExtra=E[2])}w==="day"&&(H.day=+D),this.hasEra&&w==="era"&&D!=null&&D!==""&&(H.era=D.split(" (")[0].normalize("NFD").replace(/[^-0-9 \p{L}]/gu,"").replace(/ /g,"-").toLowerCase())}if(this.hasEra&&H.eraYear===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.hasEra){let O=this.eras.find((w)=>H.era===w.genericName);O&&(H.era=O.code)}if(this.reviseIntlEra){let{era:O,eraYear:w}=this.reviseIntlEra(H,$);H.era=O,H.eraYear=w}this.checkIcuBugs&&this.checkIcuBugs($);let V=this.adjustCalendarDate(H,X,"constrain",!0);if(V.year===void 0)throw new RangeError(`Missing year converting ${JSON.stringify($)}`);if(V.month===void 0)throw new RangeError(`Missing month converting ${JSON.stringify($)}`);if(V.day===void 0)throw new RangeError(`Missing day converting ${JSON.stringify($)}`);return X.set(z,V),["constrain","reject"].forEach((O)=>{let w=JSON.stringify({func:"calendarToIsoDate",year:V.year,month:V.month,day:V.day,overflow:O,id:this.id});X.set(w,$)}),V}validateCalendarDate($){let{month:X,year:Y,day:U,eraYear:G,monthCode:z,monthExtra:W}=$;if(W!==void 0)throw new RangeError("Unexpected `monthExtra` value");if(Y===void 0&&G===void 0)throw new TypeError("year or eraYear is required");if(X===void 0&&z===void 0)throw new TypeError("month or monthCode is required");if(U===void 0)throw new RangeError("Missing day");if(z!==void 0){if(typeof z!="string")throw new RangeError("monthCode must be a string, not "+typeof z);if(!/^M([01]?\d)(L?)$/.test(z))throw new RangeError(`Invalid monthCode: ${z}`)}if(this.hasEra&&$.era===void 0!=($.eraYear===void 0))throw new TypeError("properties era and eraYear must be provided together")}adjustCalendarDate($,X=void 0,Y="constrain",U=!1){if(this.calendarType==="lunisolar")throw new RangeError("Override required for lunisolar calendars");let G=$;this.validateCalendarDate(G);let z=this.monthsInYear(G,X),{month:W,monthCode:Q}=G;return{month:W,monthCode:Q}=iw(G,Y,z),{...G,month:W,monthCode:Q}}regulateMonthDayNaive($,X,Y){let U=this.monthsInYear($,Y),{month:G,day:z}=$;return X==="reject"?(r4(G,1,U),r4(z,1,this.maximumMonthLength($))):(G=B6(G,1,U),z=B6(z,1,this.maximumMonthLength({...$,month:G}))),{...$,month:G,day:z}}calendarToIsoDate($,X="constrain",Y){let U=$,G=this.adjustCalendarDate($,Y,X,!1);G=this.regulateMonthDayNaive(G,X,Y);let{year:z,month:W,day:Q}=G,Z=JSON.stringify({func:"calendarToIsoDate",year:z,month:W,day:Q,overflow:X,id:this.id}),H,V=Y.get(Z);if(V)return V;if(U.year!==void 0&&U.month!==void 0&&U.day!==void 0&&(U.year!==G.year||U.month!==G.month||U.day!==G.day)&&(H=JSON.stringify({func:"calendarToIsoDate",year:U.year,month:U.month,day:U.day,overflow:X,id:this.id}),V=Y.get(H),V))return V;let O=this.estimateIsoDate({year:z,month:W,day:Q}),w=(A)=>{let L=this.addDaysIso(O,A);if(G.day>this.minimumMonthLength(G)){let T=this.isoToCalendarDate(L,Y);for(;T.month!==W||T.year!==z;){if(X==="reject")throw new RangeError(`day ${Q} does not exist in month ${W} of year ${z}`);L=this.addDaysIso(L,-1),T=this.isoToCalendarDate(L,Y)}}return L},D=0,E=this.isoToCalendarDate(O,Y),F=Nw(G,E);if(F.years!==0||F.months!==0||F.days!==0){let A=365*F.years+30*F.months+F.days;O=this.addDaysIso(O,A),E=this.isoToCalendarDate(O,Y),F=Nw(G,E),F.years===0&&F.months===0?O=w(F.days):D=this.compareCalendarDates(G,E)}let J=8;for(;D;){O=this.addDaysIso(O,D*J);let A=E;E=this.isoToCalendarDate(O,Y);let L=D;if(D=this.compareCalendarDates(G,E),D){if(F=Nw(G,E),F.years===0&&F.months===0)O=w(F.days),D=0;else if(L&&D!==L)if(J>1)J/=2;else{if(X==="reject")throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...U})}`);this.compareCalendarDates(E,A)>0&&(O=this.addDaysIso(O,-1)),D=0}}}if(Y.set(Z,O),H&&Y.set(H,O),G.year===void 0||G.month===void 0||G.day===void 0||G.monthCode===void 0||this.hasEra&&(G.era===void 0||G.eraYear===void 0))throw new RangeError("Unexpected missing property");return O}compareCalendarDates($,X){return $.year!==X.year?d6($.year-X.year):$.month!==X.month?d6($.month-X.month):$.day!==X.day?d6($.day-X.day):0}regulateDate($,X="constrain",Y){let U=this.calendarToIsoDate($,X,Y);return this.isoToCalendarDate(U,Y)}addDaysIso($,X){return r6($.year,$.month,$.day+X)}addDaysCalendar($,X,Y){let U=this.calendarToIsoDate($,"constrain",Y),G=this.addDaysIso(U,X);return this.isoToCalendarDate(G,Y)}addMonthsCalendar($,X,Y,U){let G=$,{day:z}=G;for(let W=0,Q=Math.abs(X);W<Q;W++){let{month:Z}=G,H=G,V=X<0?-Math.max(z,this.daysInPreviousMonth(G,U)):this.daysInMonth(G,U),O=this.calendarToIsoDate(G,"constrain",U),w=this.addDaysIso(O,V);if(G=this.isoToCalendarDate(w,U),X>0){let D=this.monthsInYear(H,U);for(;G.month-1!=Z%D;)w=this.addDaysIso(w,-1),G=this.isoToCalendarDate(w,U)}G.day!==z&&(G=this.regulateDate({...G,day:z},"constrain",U))}if(Y==="reject"&&G.day!==z)throw new RangeError(`Day ${z} does not exist in resulting calendar month`);return G}addCalendar($,{years:X=0,months:Y=0,weeks:U=0,days:G=0},z,W){let{year:Q,day:Z,monthCode:H}=$,V=this.adjustCalendarDate({year:Q+X,monthCode:H,day:Z},W),O=this.addMonthsCalendar(V,Y,z,W),w=G+7*U;return this.addDaysCalendar(O,w,W)}untilCalendar($,X,Y,U){let G=0,z=0,W=0,Q=0;switch(Y){case"day":G=this.calendarDaysUntil($,X,U);break;case"week":{let Z=this.calendarDaysUntil($,X,U);G=Z%7,z=(Z-G)/7;break}case"month":case"year":{let Z=this.compareCalendarDates(X,$);if(!Z)return{years:0,months:0,weeks:0,days:0};let H=X.year-$.year,V=X.day-$.day;if(Y==="year"&&H){let D=0;X.monthCode>$.monthCode&&(D=1),X.monthCode<$.monthCode&&(D=-1),D||(D=Math.sign(V)),Q=D*Z<0?H-Z:H}let O,w=Q?this.addCalendar($,{years:Q},"constrain",U):$;do W+=Z,O=w,w=this.addMonthsCalendar(O,Z,"constrain",U),w.day!==$.day&&(w=this.regulateDate({...w,day:$.day},"constrain",U));while(this.compareCalendarDates(X,w)*Z>=0);W-=Z,G=this.calendarDaysUntil(O,X,U);break}}return{years:Q,months:W,weeks:z,days:G}}daysInMonth($,X){let{day:Y}=$,U=this.maximumMonthLength($),G=this.minimumMonthLength($);if(G===U)return G;let z=Y<=U-G?U:G,W=this.calendarToIsoDate($,"constrain",X),Q=this.addDaysIso(W,z),Z=this.isoToCalendarDate(Q,X),H=this.addDaysIso(Q,-Z.day);return this.isoToCalendarDate(H,X).day}daysInPreviousMonth($,X){let{day:Y,month:U,year:G}=$,z={year:U>1?G:G-1,month:U,day:1},W=U>1?U-1:this.monthsInYear(z,X);z={...z,month:W};let Q=this.minimumMonthLength(z),Z=this.maximumMonthLength(z);if(Q===Z)return Z;let H=this.calendarToIsoDate($,"constrain",X),V=this.addDaysIso(H,-Y);return this.isoToCalendarDate(V,X).day}startOfCalendarYear($){return{year:$.year,month:1,monthCode:"M01",day:1}}startOfCalendarMonth($){return{year:$.year,month:$.month,day:1}}calendarDaysUntil($,X,Y){let U=this.calendarToIsoDate($,"constrain",Y),G=this.calendarToIsoDate(X,"constrain",Y);return x8(G.year,G.month-1,G.day)-x8(U.year,U.month-1,U.day)}monthDaySearchStartYear($,X){return 1972}monthDayFromFields($,X,Y){let U,G,z,W,Q,{era:Z,eraYear:H,year:V,month:O,monthCode:w,day:D}=$;if(O!==void 0&&V===void 0&&(!this.hasEra||Z===void 0||H===void 0))throw new TypeError("when month is present, year (or era and eraYear) are required");(w===void 0||V!==void 0||this.hasEra&&H!==void 0)&&({monthCode:w,day:D}=this.isoToCalendarDate(this.calendarToIsoDate($,X,Y),Y));let E={year:this.monthDaySearchStartYear(w,D),month:12,day:31},F=this.isoToCalendarDate(E,Y),J=F.monthCode>w||F.monthCode===w&&F.day>=D?F.year:F.year-1;for(let A=0;A<20;A++){let L=this.adjustCalendarDate({day:D,monthCode:w,year:J-A},Y),T=this.calendarToIsoDate(L,"constrain",Y),q=this.isoToCalendarDate(T,Y);if({year:U,month:G,day:z}=T,q.monthCode===w&&q.day===D)return{month:G,day:z,year:U};if(X==="constrain"){let v=this.maxLengthOfMonthCodeInAnyYear(q.monthCode);if(q.monthCode===w&&q.day===v&&D>v)return{month:G,day:z,year:U};(W===void 0||q.monthCode===W.monthCode&&q.day>W.day)&&(W=q,Q=T)}}if(X==="constrain"&&Q!==void 0)return Q;throw new RangeError(`No recent ${this.id} year with monthCode ${w} and day ${D}`)}getFirstDayOfWeek(){}getMinimalDaysInFirstWeek(){}}class eL extends k2{constructor(){super(...arguments),this.id="hebrew",this.calendarType="lunisolar",this.months={Tishri:{leap:1,regular:1,monthCode:"M01",days:30},Heshvan:{leap:2,regular:2,monthCode:"M02",days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:"M03",days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:"M04",days:29},Shevat:{leap:5,regular:5,monthCode:"M05",days:30},Adar:{leap:void 0,regular:6,monthCode:"M06",days:29},"Adar I":{leap:6,regular:void 0,monthCode:"M05L",days:30},"Adar II":{leap:7,regular:void 0,monthCode:"M06",days:29},Nisan:{leap:8,regular:7,monthCode:"M07",days:30},Iyar:{leap:9,regular:8,monthCode:"M08",days:29},Sivan:{leap:10,regular:9,monthCode:"M09",days:30},Tamuz:{leap:11,regular:10,monthCode:"M10",days:29},Av:{leap:12,regular:11,monthCode:"M11",days:30},Elul:{leap:13,regular:12,monthCode:"M12",days:29}}}inLeapYear($){let{year:X}=$;return(7*X+1)%19<7}monthsInYear($){return this.inLeapYear($)?13:12}minimumMonthLength($){return this.minMaxMonthLength($,"min")}maximumMonthLength($){return this.minMaxMonthLength($,"max")}minMaxMonthLength($,X){let{month:Y,year:U}=$,G=this.getMonthCode(U,Y),z=Object.entries(this.months).find((Q)=>Q[1].monthCode===G);if(z===void 0)throw new RangeError(`unmatched Hebrew month: ${Y}`);let W=z[1].days;return typeof W=="number"?W:W[X]}maxLengthOfMonthCodeInAnyYear($){return["M04","M06","M08","M10","M12"].includes($)?29:30}estimateIsoDate($){let{year:X}=$;return{year:X-3760,month:1,day:1}}getMonthCode($,X){return this.inLeapYear({year:$})?X===6?Z0(5,!0):Z0(X<6?X:X-1):Z0(X)}adjustCalendarDate($,X,Y="constrain",U=!1){let{year:G,month:z,monthCode:W,day:Q,monthExtra:Z}=$;if(G===void 0)throw new TypeError("Missing property: year");if(U){if(Z){let H=this.months[Z];if(!H)throw new RangeError(`Unrecognized month from formatToParts: ${Z}`);z=this.inLeapYear({year:G})?H.leap:H.regular}return W=this.getMonthCode(G,z),{year:G,month:z,day:Q,monthCode:W}}if(this.validateCalendarDate($),z===void 0)if(W.endsWith("L")){if(W!=="M05L")throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${W}`);if(z=6,!this.inLeapYear({year:G})){if(Y==="reject")throw new RangeError(`Hebrew monthCode M05L is invalid in year ${G} which is not a leap year`);z=6,W="M06"}}else{z=k8(W),this.inLeapYear({year:G})&&z>=6&&z++;let H=this.monthsInYear({year:G});if(z<1||z>H)throw new RangeError(`Invalid monthCode: ${W}`)}else if(Y==="reject"?(r4(z,1,this.monthsInYear({year:G})),r4(Q,1,this.maximumMonthLength({year:G,month:z}))):(z=B6(z,1,this.monthsInYear({year:G})),Q=B6(Q,1,this.maximumMonthLength({year:G,month:z}))),W===void 0)W=this.getMonthCode(G,z);else if(this.getMonthCode(G,z)!==W)throw new RangeError(`monthCode ${W} doesn't correspond to month ${z} in Hebrew year ${G}`);return{...$,day:Q,month:z,monthCode:W,year:G}}}class h8 extends k2{constructor(){super(...arguments),this.calendarType="lunar",this.DAYS_PER_ISLAMIC_YEAR=354.3666666666667,this.DAYS_PER_ISO_YEAR=365.2425}inLeapYear($,X){let Y={year:$.year,month:1,monthCode:"M01",day:1},U={year:$.year+1,month:1,monthCode:"M01",day:1};return this.calendarDaysUntil(Y,U,X)===355}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear(){return 30}estimateIsoDate($){let{year:X}=this.adjustCalendarDate($);return{year:Math.floor(X*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}}class $K extends h8{constructor(){super(...arguments),this.id="islamic"}}class XK extends h8{constructor(){super(...arguments),this.id="islamic-umalqura"}}class YK extends h8{constructor(){super(...arguments),this.id="islamic-tbla"}}class GK extends h8{constructor(){super(...arguments),this.id="islamic-civil"}}class UK extends h8{constructor(){super(...arguments),this.id="islamic-rgsa"}}class zK extends h8{constructor(){super(...arguments),this.id="islamicc"}}class WK extends k2{constructor(){super(...arguments),this.id="persian",this.calendarType="solar"}inLeapYear($,X){return this.daysInMonth({year:$.year,month:12,day:1},X)===30}monthsInYear(){return 12}minimumMonthLength($){let{month:X}=$;return X===12?29:X<=6?31:30}maximumMonthLength($){let{month:X}=$;return X===12?30:X<=6?31:30}maxLengthOfMonthCodeInAnyYear($){return k8($)<=6?31:30}estimateIsoDate($){let{year:X}=this.adjustCalendarDate($);return{year:X+621,month:1,day:1}}}class QK extends k2{constructor(){super(...arguments),this.id="indian",this.calendarType="solar",this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug=new Date("0000-01-01T00:00Z").toLocaleDateString("en-US-u-ca-indian",{timeZone:"UTC"})!=="10/11/-79 Saka"}inLeapYear($){return ow($.year+78)}monthsInYear(){return 12}minimumMonthLength($){return this.getMonthInfo($).length}maximumMonthLength($){return this.getMonthInfo($).length}maxLengthOfMonthCodeInAnyYear($){let X=k8($),Y=this.months[X];return Y=Y.leap??Y,Y.length}getMonthInfo($){let{month:X}=$,Y=this.months[X];if(Y===void 0)throw new RangeError(`Invalid month: ${X}`);return this.inLeapYear($)&&Y.leap&&(Y=Y.leap),Y}estimateIsoDate($){let X=this.adjustCalendarDate($),Y=this.getMonthInfo(X);return r6(X.year+78+(Y.nextYear?1:0),Y.month,Y.day+X.day-1)}checkIcuBugs($){if(this.vulnerableToBceBug&&$.year<1)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}}function ow($){return $%4==0&&($%100!=0||$%400==0)}class nw extends k2{constructor($,X){super(),this.calendarType="solar",this.id=$,this.isoEpoch=X}inLeapYear($){let{year:X}=this.estimateIsoDate({month:1,day:1,year:$.year});return ow(X)}monthsInYear(){return 12}minimumMonthLength($){let{month:X}=$;return X===2?this.inLeapYear($)?29:28:[4,6,9,11].indexOf(X)>=0?30:31}maximumMonthLength($){return this.minimumMonthLength($)}maxLengthOfMonthCodeInAnyYear($){return[31,29,31,30,31,30,31,31,30,31,30,31][k8($)-1]}estimateIsoDate($){let X=this.adjustCalendarDate($);return tG(X.year+this.isoEpoch.year,X.month+this.isoEpoch.month,X.day+this.isoEpoch.day,"constrain")}}class tw extends k2{constructor($,X){super(),this.hasEra=!0,this.calendarType="solar",this.id=$;let{eras:Y,anchorEra:U}=function(G){let z,W=G;if(W.length===0)throw new RangeError("Invalid era data: eras are required");if(W.length===1&&W[0].reverseOf)throw new RangeError("Invalid era data: anchor era cannot count years backwards");if(W.length===1&&!W[0].code)throw new RangeError("Invalid era data: at least one named era is required");if(W.filter((Z)=>Z.reverseOf!=null).length>1)throw new RangeError("Invalid era data: only one era can count years backwards");W.forEach((Z)=>{if(Z.isAnchor||!Z.anchorEpoch&&!Z.reverseOf){if(z)throw new RangeError("Invalid era data: cannot have multiple anchor eras");z=Z,Z.anchorEpoch={year:Z.hasYearZero?0:1}}else if(!Z.code)throw new RangeError("If era name is blank, it must be the anchor era")}),W=W.filter((Z)=>Z.code),W.forEach((Z)=>{let{reverseOf:H}=Z;if(H){let V=W.find((O)=>O.code===H);if(V===void 0)throw new RangeError(`Invalid era data: unmatched reverseOf era: ${H}`);Z.reverseOf=V,Z.anchorEpoch=V.anchorEpoch,Z.isoEpoch=V.isoEpoch}Z.anchorEpoch.month===void 0&&(Z.anchorEpoch.month=1),Z.anchorEpoch.day===void 0&&(Z.anchorEpoch.day=1)}),W.sort((Z,H)=>{if(Z.reverseOf)return 1;if(H.reverseOf)return-1;if(!Z.isoEpoch||!H.isoEpoch)throw new RangeError("Invalid era data: missing ISO epoch");return H.isoEpoch.year-Z.isoEpoch.year});let Q=W[W.length-1].reverseOf;if(Q&&Q!==W[W.length-2])throw new RangeError("Invalid era data: invalid reverse-sign era");return W.forEach((Z,H)=>{Z.genericName="era"+(W.length-1-H)}),{eras:W,anchorEra:z||W[0]}}(X);this.anchorEra=U,this.eras=Y}inLeapYear($){let{year:X}=this.estimateIsoDate({month:1,day:1,year:$.year});return ow(X)}monthsInYear(){return 12}minimumMonthLength($){let{month:X}=$;return X===2?this.inLeapYear($)?29:28:[4,6,9,11].indexOf(X)>=0?30:31}maximumMonthLength($){return this.minimumMonthLength($)}maxLengthOfMonthCodeInAnyYear($){return[31,29,31,30,31,30,31,31,30,31,30,31][k8($)-1]}completeEraYear($){let X=(W,Q,Z)=>{let H=$[W];if(H!=null&&H!=Q&&!(Z||[]).includes(H)){let V=Z?.[0];throw new RangeError(`Input ${W} ${H} doesn't match calculated value ${V?`${Q} (also called ${V})`:Q}`)}},Y=(W)=>{let Q,Z={...$,year:W},H=this.eras.find((V,O)=>{if(O===this.eras.length-1){if(V.reverseOf){if(W>0)throw new RangeError(`Signed year ${W} is invalid for era ${V.code}`);return Q=V.anchorEpoch.year-W,!0}return Q=W-V.anchorEpoch.year+(V.hasYearZero?0:1),!0}return this.compareCalendarDates(Z,V.anchorEpoch)>=0&&(Q=W-V.anchorEpoch.year+(V.hasYearZero?0:1),!0)});if(!H)throw new RangeError(`Year ${W} was not matched by any era`);return{eraYear:Q,era:H.code,eraNames:H.names}},{year:U,eraYear:G,era:z}=$;if(U!=null){let W=Y(U);({eraYear:G,era:z}=W),X("era",z,W?.eraNames),X("eraYear",G)}else{if(G==null)throw new RangeError("Either year or eraYear and era are required");{if(z===void 0)throw new RangeError("era and eraYear must be provided together");let W=this.eras.find(({code:Q,names:Z=[]})=>Q===z||Z.includes(z));if(!W)throw new RangeError(`Era ${z} (ISO year ${G}) was not matched by any era`);U=W.reverseOf?W.anchorEpoch.year-G:G+W.anchorEpoch.year-(W.hasYearZero?0:1),X("year",U),{eraYear:G,era:z}=Y(U)}}return{...$,year:U,eraYear:G,era:z}}adjustCalendarDate($,X,Y="constrain"){let U=$,{month:G,monthCode:z}=U;return G===void 0&&(U={...U,month:k8(z)}),this.validateCalendarDate(U),U=this.completeEraYear(U),super.adjustCalendarDate(U,X,Y)}estimateIsoDate($){let X=this.adjustCalendarDate($),{year:Y,month:U,day:G}=X,{anchorEra:z}=this;return tG(Y+z.isoEpoch.year-(z.hasYearZero?0:1),U,G,"constrain")}}class i7 extends tw{constructor($,X){super($,X)}isoToCalendarDate($){let{year:X,month:Y,day:U}=$,G=Z0(Y),z=X-this.anchorEra.isoEpoch.year+1;return this.completeEraYear({year:z,month:Y,monthCode:G,day:U})}}var W0={inLeapYear($){let{year:X}=$;return(X+1)%4==0},monthsInYear:()=>13,minimumMonthLength($){let{month:X}=$;return X===13?this.inLeapYear($)?6:5:30},maximumMonthLength($){return this.minimumMonthLength($)},maxLengthOfMonthCodeInAnyYear:($)=>$==="M13"?6:30};class ZK extends nw{constructor($,X){super($,X),this.inLeapYear=W0.inLeapYear,this.monthsInYear=W0.monthsInYear,this.minimumMonthLength=W0.minimumMonthLength,this.maximumMonthLength=W0.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=W0.maxLengthOfMonthCodeInAnyYear}}class aw extends tw{constructor($,X){super($,X),this.inLeapYear=W0.inLeapYear,this.monthsInYear=W0.monthsInYear,this.minimumMonthLength=W0.minimumMonthLength,this.maximumMonthLength=W0.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=W0.maxLengthOfMonthCodeInAnyYear}}class HK extends ZK{constructor(){super("ethioaa",{year:-5492,month:7,day:17})}}class VK extends aw{constructor(){super("coptic",[{code:"coptic",isoEpoch:{year:284,month:8,day:29}},{code:"coptic-inverse",reverseOf:"coptic"}])}}class OK extends aw{constructor(){super("ethiopic",[{code:"ethioaa",names:["ethiopic-amete-alem","mundi"],isoEpoch:{year:-5492,month:7,day:17}},{code:"ethiopic",names:["incar"],isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}])}}class wK extends i7{constructor(){super("roc",[{code:"roc",names:["minguo"],isoEpoch:{year:1912,month:1,day:1}},{code:"roc-inverse",names:["before-roc"],reverseOf:"roc"}])}}class DK extends nw{constructor(){super("buddhist",{year:-543,month:1,day:1})}}class EK extends i7{constructor(){super("gregory",[{code:"gregory",names:["ad","ce"],isoEpoch:{year:1,month:1,day:1}},{code:"gregory-inverse",names:["be","bce"],reverseOf:"gregory"}])}reviseIntlEra($){let{era:X,eraYear:Y}=$;return X==="b"&&(X="gregory-inverse"),X==="a"&&(X="gregory"),{era:X,eraYear:Y}}getFirstDayOfWeek(){return 1}getMinimalDaysInFirstWeek(){return 1}}class NK extends i7{constructor(){super("japanese",[{code:"reiwa",isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{code:"heisei",isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{code:"showa",isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{code:"taisho",isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{code:"meiji",isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{code:"japanese",names:["japanese","gregory","ad","ce"],isoEpoch:{year:1,month:1,day:1}},{code:"japanese-inverse",names:["japanese-inverse","gregory-inverse","bc","bce"],reverseOf:"japanese"}]),this.erasBeginMidYear=!0}reviseIntlEra($,X){let{era:Y,eraYear:U}=$,{year:G}=X;return this.eras.find((z)=>z.code===Y)?{era:Y,eraYear:U}:G<1?{era:"japanese-inverse",eraYear:1-G}:{era:"japanese",eraYear:G}}}class sw extends k2{constructor(){super(...arguments),this.calendarType="lunisolar"}inLeapYear($,X){let Y=this.getMonthList($.year,X);return Object.entries(Y).length===13}monthsInYear($,X){return this.inLeapYear($,X)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear($){return["M01L","M09L","M10L","M11L","M12L"].includes($)?29:30}monthDaySearchStartYear($,X){let Y={M01L:[1651,1651],M02L:[1947,1765],M03L:[1966,1955],M04L:[1963,1944],M05L:[1971,1952],M06L:[1960,1941],M07L:[1968,1938],M08L:[1957,1718],M09L:[1832,1832],M10L:[1870,1870],M11L:[1814,1814],M12L:[1890,1890]}[$]??[1972,1972];return X<30?Y[0]:Y[1]}getMonthList($,X){if($===void 0)throw new TypeError("Missing year");let Y=JSON.stringify({func:"getMonthList",calendarYear:$,id:this.id}),U=X.get(Y);if(U)return U;let G=this.getFormatter(),z=(F,J)=>{let A=sL({isoYear:F,isoMonth:2,isoDay:1}),L=new Date(A);L.setUTCDate(J+1);let T=G.formatToParts(L),q=T.find((y)=>y.type==="month").value,v=+T.find((y)=>y.type==="day").value,I=T.find((y)=>y.type==="relatedYear"),S;if(I===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return S=+I.value,{calendarMonthString:q,calendarDay:v,calendarYearToVerify:S}},W=17,{calendarMonthString:Q,calendarDay:Z,calendarYearToVerify:H}=z($,W);Q!=="1"&&(W+=29,{calendarMonthString:Q,calendarDay:Z}=z($,W)),W-=Z-5;let V={},O,w,D=1,E=!1;do({calendarMonthString:Q,calendarDay:Z,calendarYearToVerify:H}=z($,W)),O&&(V[w].daysInMonth=O+30-Z),H!==$?E=!0:(V[Q]={monthIndex:D++},W+=30),O=Z,w=Q;while(!E);return V[w].daysInMonth=O+30-Z,X.set(Y,V),V}estimateIsoDate($){let{year:X,month:Y}=$;return{year:X,month:Y>=12?12:Y+1,day:1}}adjustCalendarDate($,X,Y="constrain",U=!1){let{year:G,month:z,monthExtra:W,day:Q,monthCode:Z}=$;if(G===void 0)throw new TypeError("Missing property: year");if(U){if(W&&W!=="bis")throw new RangeError(`Unexpected leap month suffix: ${W}`);let H=Z0(z,W!==void 0),V=`${z}${W||""}`,O=this.getMonthList(G,X)[V];if(O===void 0)throw new RangeError(`Unmatched month ${V} in Chinese year ${G}`);return z=O.monthIndex,{year:G,month:z,day:Q,monthCode:H}}if(this.validateCalendarDate($),z===void 0){let H=this.getMonthList(G,X),V=Z.replace(/^M|L$/g,(w)=>w==="L"?"bis":"");V[0]==="0"&&(V=V.slice(1));let O=H[V];if(z=O&&O.monthIndex,z===void 0&&Z.endsWith("L")&&Z!="M13L"&&Y==="constrain"){let w=+Z.replace(/^M0?|L$/g,"");O=H[w],O&&(z=O.monthIndex,Z=Z0(w))}if(z===void 0)throw new RangeError(`Unmatched month ${Z} in Chinese year ${G}`)}else if(Z===void 0){let H=this.getMonthList(G,X),V=Object.entries(H),O=V.length;Y==="reject"?(r4(z,1,O),r4(Q,1,this.maximumMonthLength())):(z=B6(z,1,O),Q=B6(Q,1,this.maximumMonthLength()));let w=V.find((D)=>D[1].monthIndex===z);if(w===void 0)throw new RangeError(`Invalid month ${z} in Chinese year ${G}`);Z=Z0(+w[0].replace("bis",""),w[0].indexOf("bis")!==-1)}else{let H=this.getMonthList(G,X),V=Z.replace(/^M|L$/g,(w)=>w==="L"?"bis":"");V[0]==="0"&&(V=V.slice(1));let O=H[V];if(!O)throw new RangeError(`Unmatched monthCode ${Z} in Chinese year ${G}`);if(z!==O.monthIndex)throw new RangeError(`monthCode ${Z} doesn't correspond to month ${z} in Chinese year ${G}`)}return{...$,year:G,month:z,monthCode:Z,day:Q}}}class FK extends sw{constructor(){super(...arguments),this.id="chinese"}}class MK extends sw{constructor(){super(...arguments),this.id="dangi"}}class JK{constructor($){this.helper=$}extraFields($){return this.helper.hasEra&&$.includes("year")?["era","eraYear"]:[]}resolveFields($){if(this.helper.calendarType!=="lunisolar"){let X=new l4;iw($,void 0,this.helper.monthsInYear({year:$.year??1972},X))}}dateToISO($,X){let Y=new l4,U=this.helper.calendarToIsoDate($,X,Y);return Y.setObject(U),U}monthDayToISOReferenceDate($,X){let Y=new l4,U=this.helper.monthDayFromFields($,X,Y);return Y.setObject(U),U}fieldKeysToIgnore($){let X=new Set;for(let Y=0;Y<$.length;Y++){let U=$[Y];switch(X.add(U),U){case"era":X.add("eraYear"),X.add("year");break;case"eraYear":X.add("era"),X.add("year");break;case"year":X.add("era"),X.add("eraYear");break;case"month":X.add("monthCode"),this.helper.erasBeginMidYear&&(X.add("era"),X.add("eraYear"));break;case"monthCode":X.add("month"),this.helper.erasBeginMidYear&&(X.add("era"),X.add("eraYear"));break;case"day":this.helper.erasBeginMidYear&&(X.add("era"),X.add("eraYear"))}}return tL(X)}dateAdd($,{years:X,months:Y,weeks:U,days:G},z){let W=l4.getCacheForObject($),Q=this.helper.isoToCalendarDate($,W),Z=this.helper.addCalendar(Q,{years:X,months:Y,weeks:U,days:G},z,W),H=this.helper.calendarToIsoDate(Z,"constrain",W);return l4.getCacheForObject(H)||new l4(W).setObject(H),H}dateUntil($,X,Y){let U=l4.getCacheForObject($),G=l4.getCacheForObject(X),z=this.helper.isoToCalendarDate($,U),W=this.helper.isoToCalendarDate(X,G);return this.helper.untilCalendar(z,W,Y,U)}isoToDate($,X){let Y=l4.getCacheForObject($),U=this.helper.isoToCalendarDate($,Y);if(X.dayOfWeek&&(U.dayOfWeek=L3.iso8601.isoToDate($,{dayOfWeek:!0}).dayOfWeek),X.dayOfYear){let G=this.helper.startOfCalendarYear(U),z=this.helper.calendarDaysUntil(G,U,Y);U.dayOfYear=z+1}if(X.weekOfYear&&(U.weekOfYear=aL(this.helper.id,$)),U.daysInWeek=7,X.daysInMonth&&(U.daysInMonth=this.helper.daysInMonth(U,Y)),X.daysInYear){let G=this.helper.startOfCalendarYear(U),z=this.helper.addCalendar(G,{years:1},"constrain",Y);U.daysInYear=this.helper.calendarDaysUntil(G,z,Y)}return X.monthsInYear&&(U.monthsInYear=this.helper.monthsInYear(U,Y)),X.inLeapYear&&(U.inLeapYear=this.helper.inLeapYear(U,Y)),U}getFirstDayOfWeek(){return this.helper.getFirstDayOfWeek()}getMinimalDaysInFirstWeek(){return this.helper.getMinimalDaysInFirstWeek()}}for(let $ of[eL,WK,OK,HK,VK,FK,MK,wK,QK,DK,EK,NK,$K,XK,YK,GK,UK,zK]){let X=new $;L3[X.id]=new JK(X)}_w("calendarImpl",function($){return L3[$]});var Q3=Intl.DateTimeFormat;function pX($,X){let Y=N($,X);return typeof Y=="function"&&(Y=new Q3(N($,DL),Y(N($,Jw))),function(U,G,z){let W=b7(U);if(W===void 0)throw new TypeError("Missing slots for the given container");if(W[G]===void 0)throw new TypeError(`tried to reset ${G} which was not set`);W[G]=z}($,X,Y)),Y}function gG($){return x6($,b8)}class U9{constructor($=void 0,X=void 0){(function(Y,U,G){let z=G!==void 0,W;if(z){let V=["localeMatcher","calendar","numberingSystem","hour12","hourCycle","timeZone","weekday","era","year","month","day","dayPeriod","hour","minute","second","fractionalSecondDigits","timeZoneName","formatMatcher","dateStyle","timeStyle"];W=function(w){if(w==null)throw new TypeError(`Expected object not ${w}`);return Object(w)}(G);let O=Object.create(null);for(let w=0;w<V.length;w++){let D=V[w];Object.prototype.hasOwnProperty.call(W,D)&&(O[D]=W[D])}W=O}else W=Object.create(null);let Q=new Q3(U,W),Z=Q.resolvedOptions();if(n0(Y),z){let V=Object.assign(Object.create(null),Z);for(let O in V)Object.prototype.hasOwnProperty.call(W,O)||delete V[O];V.hour12=W.hour12,V.hourCycle=W.hourCycle,R$(Y,Jw,V)}else R$(Y,Jw,W);R$(Y,DL,Z.locale),R$(Y,b8,Q),R$(Y,rX,Z.timeZone),R$(Y,mG,Z.calendar),R$(Y,QL,Rb),R$(Y,ZL,_b),R$(Y,HL,qb),R$(Y,VL,Kb),R$(Y,OL,Tb),R$(Y,wL,vb);let H=z?W.timeZone:void 0;if(H===void 0)R$(Y,Mw,Z.timeZone);else{let V=y7(H);if(V.startsWith("\u2212"))throw new RangeError("Unicode minus (U+2212) is not supported in time zone offsets");R$(Y,Mw,P6(V))}})(this,$,X)}get format(){k(this,gG);let $=Mb.bind(this);return Object.defineProperties($,{length:{value:1,enumerable:!1,writable:!1,configurable:!0},name:{value:"",enumerable:!1,writable:!1,configurable:!0}}),$}formatRange($,X){return k(this,gG),Ab.call(this,$,X)}formatToParts($,...X){return k(this,gG),Jb.call(this,$,...X)}formatRangeToParts($,X){return k(this,gG),Lb.call(this,$,X)}resolvedOptions(){return k(this,gG),Fb.call(this)}}"formatToParts"in Q3.prototype||delete U9.prototype.formatToParts,"formatRangeToParts"in Q3.prototype||delete U9.prototype.formatRangeToParts;var V1=function($=void 0,X=void 0){return new U9($,X)};function Fb(){let $=N(this,b8).resolvedOptions();return $.timeZone=N(this,Mw),$}function Mb($,...X){let Y,U,G=z9($,this);return G.formatter?(Y=G.formatter,U=[T1(G.epochNs,"floor")]):(Y=N(this,b8),U=[$,...X]),Y.format(...U)}function Jb($,...X){let Y,U,G=z9($,this);return G.formatter?(Y=G.formatter,U=[T1(G.epochNs,"floor")]):(Y=N(this,b8),U=[$,...X]),Y.formatToParts(...U)}function Ab($,X){if($===void 0||X===void 0)throw new TypeError("Intl.DateTimeFormat.formatRange requires two values");let Y=k7($),U=k7(X),G,z=[Y,U];if(i0(Y)!==i0(U))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");if(i0(Y)){if(!AK(Y,U))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");let{epochNs:W,formatter:Q}=z9(Y,this),{epochNs:Z,formatter:H}=z9(U,this);Q&&(G=Q,z=[T1(W,"floor"),T1(Z,"floor")])}return G||(G=N(this,b8)),G.formatRange(...z)}function Lb($,X){if($===void 0||X===void 0)throw new TypeError("Intl.DateTimeFormat.formatRange requires two values");let Y=k7($),U=k7(X),G,z=[Y,U];if(i0(Y)!==i0(U))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");if(i0(Y)){if(!AK(Y,U))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");let{epochNs:W,formatter:Q}=z9(Y,this),{epochNs:Z,formatter:H}=z9(U,this);Q&&(G=Q,z=[T1(W,"floor"),T1(Z,"floor")])}return G||(G=N(this,b8)),G.formatRangeToParts(...z)}function K3($={},X={}){let Y=Object.assign({},$),U=["year","month","day","hour","minute","second","weekday","dayPeriod","timeZoneName","dateStyle","timeStyle"];for(let G=0;G<U.length;G++){let z=U[G];Y[z]=z in X?X[z]:Y[z],Y[z]!==!1&&Y[z]!==void 0||delete Y[z]}return Y}function Kb($){let X=K3($,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});if(X.timeStyle!=="long"&&X.timeStyle!=="full"||(delete X.timeStyle,Object.assign(X,{hour:"numeric",minute:"2-digit",second:"2-digit"})),!n7(X)){if(_3($))throw new TypeError(`cannot format Temporal.PlainTime with options [${Object.keys($)}]`);Object.assign(X,{hour:"numeric",minute:"numeric",second:"numeric"})}return X}function _b($){let X={short:{year:"2-digit",month:"numeric"},medium:{year:"numeric",month:"short"},long:{year:"numeric",month:"long"},full:{year:"numeric",month:"long"}},Y=K3($,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if("dateStyle"in Y&&Y.dateStyle){let U=Y.dateStyle;delete Y.dateStyle,Object.assign(Y,X[U])}if(!(("year"in Y)||("month"in Y)||("era"in Y))){if(_3($))throw new TypeError(`cannot format PlainYearMonth with options [${Object.keys($)}]`);Object.assign(Y,{year:"numeric",month:"numeric"})}return Y}function qb($){let X={short:{month:"numeric",day:"numeric"},medium:{month:"short",day:"numeric"},long:{month:"long",day:"numeric"},full:{month:"long",day:"numeric"}},Y=K3($,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if("dateStyle"in Y&&Y.dateStyle){let U=Y.dateStyle;delete Y.dateStyle,Object.assign(Y,X[U])}if(!("month"in Y)&&!("day"in Y)){if(_3($))throw new TypeError(`cannot format PlainMonthDay with options [${Object.keys($)}]`);Object.assign(Y,{month:"numeric",day:"numeric"})}return Y}function Rb($){let X=K3($,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(!o7(X)){if(_3($))throw new TypeError(`cannot format PlainDate with options [${Object.keys($)}]`);Object.assign(X,{year:"numeric",month:"numeric",day:"numeric"})}return X}function Tb($){let X=K3($,{timeZoneName:!1});if((X.timeStyle==="long"||X.timeStyle==="full")&&(delete X.timeStyle,Object.assign(X,{hour:"numeric",minute:"2-digit",second:"2-digit"}),X.dateStyle))Object.assign(X,{short:{year:"numeric",month:"numeric",day:"numeric"},medium:{year:"numeric",month:"short",day:"numeric"},long:{year:"numeric",month:"long",day:"numeric"},full:{year:"numeric",month:"long",day:"numeric",weekday:"long"}}[X.dateStyle]),delete X.dateStyle;if(!n7(X)&&!o7(X)){if(_3($))throw new TypeError(`cannot format PlainDateTime with options [${Object.keys($)}]`);Object.assign(X,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}return X}function vb($){let X=$;return n7(X)||o7(X)||(X=Object.assign({},X,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),X}function o7($){return"year"in $||"month"in $||"day"in $||"weekday"in $||"dateStyle"in $||"era"in $}function n7($){return"hour"in $||"minute"in $||"second"in $||"timeStyle"in $||"dayPeriod"in $||"fractionalSecondDigits"in $}function _3($){return o7($)||n7($)||"dateStyle"in $||"timeStyle"in $||"timeZoneName"in $}function i0($){return D4($)||J4($)||e$($)||v$($)||s4($)||Z1($)||a4($)}function k7($){return i0($)?$:g7($)}function AK($,X){return!(!i0($)||!i0(X)||J4($)&&!J4(X)||D4($)&&!D4(X)||e$($)&&!e$(X)||v$($)&&!v$(X)||s4($)&&!s4(X)||Z1($)&&!Z1(X)||a4($)&&!a4(X))}function z9($,X){if(J4($)){let Y={isoDate:{year:1970,month:1,day:1},time:N($,E4)};return{epochNs:Z6(N(X,rX),Y,"compatible"),formatter:pX(X,VL)}}if(s4($)){let Y=N($,p),U=N(X,mG);if(Y!==U)throw new RangeError(`cannot format PlainYearMonth with calendar ${Y} in locale with calendar ${U}`);let G=k$(N($,E$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:Z6(N(X,rX),G,"compatible"),formatter:pX(X,ZL)}}if(Z1($)){let Y=N($,p),U=N(X,mG);if(Y!==U)throw new RangeError(`cannot format PlainMonthDay with calendar ${Y} in locale with calendar ${U}`);let G=k$(N($,E$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:Z6(N(X,rX),G,"compatible"),formatter:pX(X,HL)}}if(D4($)){let Y=N($,p),U=N(X,mG);if(Y!=="iso8601"&&Y!==U)throw new RangeError(`cannot format PlainDate with calendar ${Y} in locale with calendar ${U}`);let G=k$(N($,E$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:Z6(N(X,rX),G,"compatible"),formatter:pX(X,QL)}}if(e$($)){let Y=N($,p),U=N(X,mG);if(Y!=="iso8601"&&Y!==U)throw new RangeError(`cannot format PlainDateTime with calendar ${Y} in locale with calendar ${U}`);let G=N($,W4);return{epochNs:Z6(N(X,rX),G,"compatible"),formatter:pX(X,OL)}}if(v$($))throw new TypeError("Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.");return a4($)?{epochNs:N($,D$),formatter:pX(X,wL)}:{}}function LK($){let X=Object.create(null);return X.years=N($,L6),X.months=N($,K6),X.weeks=N($,c6),X.days=N($,_6),X.hours=N($,q6),X.minutes=N($,R6),X.seconds=N($,T6),X.milliseconds=N($,v6),X.microseconds=N($,C6),X.nanoseconds=N($,p6),X}U9.prototype.constructor=V1,Object.defineProperty(V1,"prototype",{value:U9.prototype,writable:!1,enumerable:!1,configurable:!1}),V1.supportedLocalesOf=Q3.supportedLocalesOf,t0(V1,"Intl.DateTimeFormat");var{format:Cb,formatToParts:Bb}=Intl.DurationFormat?.prototype??Object.create(null);function ew($){Intl.DurationFormat.prototype.resolvedOptions.call(this);let X=LK(q1($));return Cb.call(this,X)}Intl.DurationFormat?.prototype&&(Intl.DurationFormat.prototype.format=ew,Intl.DurationFormat.prototype.formatToParts=function($){Intl.DurationFormat.prototype.resolvedOptions.call(this);let X=LK(q1($));return Bb.call(this,X)});var Ze=Object.freeze({__proto__:null,DateTimeFormat:V1,ModifiedIntlDurationFormatPrototypeFormat:ew});class t7{constructor($){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");xL(this,S7($))}get epochMilliseconds(){return k(this,a4),T1(N(this,D$),"floor")}get epochNanoseconds(){return k(this,a4),oL(x.BigInt(N(this,D$)))}add($){return k(this,a4),oA("add",this,$)}subtract($){return k(this,a4),oA("subtract",this,$)}until($,X=void 0){return k(this,a4),uA("until",this,$,X)}since($,X=void 0){return k(this,a4),uA("since",this,$,X)}round($){if(k(this,a4),$===void 0)throw new TypeError("options parameter is required");let X=typeof $=="string"?S8("smallestUnit",$):Q$($),Y=Z9(X),U=c1(X,"halfExpand"),G=l6(X,"smallestUnit","time",o0);return H9(Y,{hour:24,minute:1440,second:86400,millisecond:86400000,microsecond:86400000000,nanosecond:86400000000000}[G],!0),m1(xw(N(this,D$),Y,G,U))}equals($){k(this,a4);let X=pG($),Y=N(this,D$),U=N(X,D$);return x.equal(x.BigInt(Y),x.BigInt(U))}toString($=void 0){k(this,a4);let X=Q$($),Y=w3(X),U=c1(X,"trunc"),G=l6(X,"smallestUnit","time",void 0);if(G==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let z=X.timeZone;z!==void 0&&(z=P6(z));let{precision:W,unit:Q,increment:Z}=D3(G,Y);return xA(m1(xw(N(this,D$),Z,Q,U)),z,W)}toJSON(){return k(this,a4),xA(this,void 0,"auto")}toLocaleString($=void 0,X=void 0){return k(this,a4),new V1($,X).format(this)}valueOf(){S2("Instant")}toZonedDateTimeISO($){k(this,a4);let X=P6($);return W6(N(this,D$),X,"iso8601")}static fromEpochMilliseconds($){return m1(u1(g7($)))}static fromEpochNanoseconds($){return m1(S7($))}static from($){return pG($)}static compare($,X){let Y=pG($),U=pG(X),G=N(Y,D$),z=N(U,D$);return x.lessThan(G,z)?-1:x.greaterThan(G,z)?1:0}}t0(t7,"Temporal.Instant");class a7{constructor($,X,Y,U="iso8601"){let G=F$($),z=F$(X),W=F$(Y),Q=S6(U===void 0?"iso8601":h4(U));P8(G,z,W),CL(this,{year:G,month:z,day:W},Q)}get calendarId(){return k(this,D4),N(this,p)}get era(){return M6(this,"era")}get eraYear(){return M6(this,"eraYear")}get year(){return M6(this,"year")}get month(){return M6(this,"month")}get monthCode(){return M6(this,"monthCode")}get day(){return M6(this,"day")}get dayOfWeek(){return M6(this,"dayOfWeek")}get dayOfYear(){return M6(this,"dayOfYear")}get weekOfYear(){return M6(this,"weekOfYear")?.week}get yearOfWeek(){return M6(this,"weekOfYear")?.year}get daysInWeek(){return M6(this,"daysInWeek")}get daysInMonth(){return M6(this,"daysInMonth")}get daysInYear(){return M6(this,"daysInYear")}get monthsInYear(){return M6(this,"monthsInYear")}get inLeapYear(){return M6(this,"inLeapYear")}with($,X=void 0){if(k(this,D4),!N4($))throw new TypeError("invalid argument");Q9($);let Y=N(this,p),U=I6(Y,N(this,E$));return U=j8(Y,U,D1(Y,$,["year","month","monthCode","day"],[],"partial")),j6(I2(Y,U,x$(Q$(X))),Y)}withCalendar($){k(this,D4);let X=M3($);return j6(N(this,E$),X)}add($,X=void 0){return k(this,D4),nA("add",this,$,X)}subtract($,X=void 0){return k(this,D4),nA("subtract",this,$,X)}until($,X=void 0){return k(this,D4),cA("until",this,$,X)}since($,X=void 0){return k(this,D4),cA("since",this,$,X)}equals($){k(this,D4);let X=uG($);return O0(N(this,E$),N(X,E$))===0&&H0(N(this,p),N(X,p))}toString($=void 0){return k(this,D4),SA(this,O3(Q$($)))}toJSON(){return k(this,D4),SA(this)}toLocaleString($=void 0,X=void 0){return k(this,D4),new V1($,X).format(this)}valueOf(){S2("PlainDate")}toPlainDateTime($=void 0){k(this,D4);let X=vL($);return K1(k$(N(this,E$),X),N(this,p))}toZonedDateTime($){let X,Y;if(k(this,D4),N4($)){let z=$.timeZone;z===void 0?X=P6($):(X=P6(z),Y=$.plainTime)}else X=P6($);let U=N(this,E$),G;return Y===void 0?G=R2(X,U):(Y=v2(Y),G=Z6(X,k$(U,N(Y,E4)),"compatible")),W6(G,X,N(this,p))}toPlainYearMonth(){k(this,D4);let $=N(this,p);return tX(Y3($,I6($,N(this,E$)),"constrain"),$)}toPlainMonthDay(){k(this,D4);let $=N(this,p);return nX(B7($,I6($,N(this,E$)),"constrain"),$)}static from($,X=void 0){return uG($,X)}static compare($,X){let Y=uG($),U=uG(X);return O0(N(Y,E$),N(U,E$))}}function M6($,X){k($,D4);let Y=N($,E$);return E3($).isoToDate(Y,{[X]:!0})[X]}t0(a7,"Temporal.PlainDate");class s7{constructor($,X,Y,U=0,G=0,z=0,W=0,Q=0,Z=0,H="iso8601"){let V=F$($),O=F$(X),w=F$(Y),D=U===void 0?0:F$(U),E=G===void 0?0:F$(G),F=z===void 0?0:F$(z),J=W===void 0?0:F$(W),A=Q===void 0?0:F$(Q),L=Z===void 0?0:F$(Z),T=S6(H===void 0?"iso8601":h4(H));pw(V,O,w,D,E,F,J,A,L),BL(this,{isoDate:{year:V,month:O,day:w},time:{hour:D,minute:E,second:F,millisecond:J,microsecond:A,nanosecond:L}},T)}get calendarId(){return k(this,e$),N(this,p)}get year(){return J6(this,"year")}get month(){return J6(this,"month")}get monthCode(){return J6(this,"monthCode")}get day(){return J6(this,"day")}get hour(){return dX(this,"hour")}get minute(){return dX(this,"minute")}get second(){return dX(this,"second")}get millisecond(){return dX(this,"millisecond")}get microsecond(){return dX(this,"microsecond")}get nanosecond(){return dX(this,"nanosecond")}get era(){return J6(this,"era")}get eraYear(){return J6(this,"eraYear")}get dayOfWeek(){return J6(this,"dayOfWeek")}get dayOfYear(){return J6(this,"dayOfYear")}get weekOfYear(){return J6(this,"weekOfYear")?.week}get yearOfWeek(){return J6(this,"weekOfYear")?.year}get daysInWeek(){return J6(this,"daysInWeek")}get daysInYear(){return J6(this,"daysInYear")}get daysInMonth(){return J6(this,"daysInMonth")}get monthsInYear(){return J6(this,"monthsInYear")}get inLeapYear(){return J6(this,"inLeapYear")}with($,X=void 0){if(k(this,e$),!N4($))throw new TypeError("invalid argument");Q9($);let Y=N(this,p),U=N(this,W4),G={...I6(Y,U.isoDate),...U.time};return G=j8(Y,G,D1(Y,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond"],"partial")),K1(N3(Y,G,x$(Q$(X))),Y)}withPlainTime($=void 0){k(this,e$);let X=vL($);return K1(k$(N(this,W4).isoDate,X),N(this,p))}withCalendar($){k(this,e$);let X=M3($);return K1(N(this,W4),X)}add($,X=void 0){return k(this,e$),tA("add",this,$,X)}subtract($,X=void 0){return k(this,e$),tA("subtract",this,$,X)}until($,X=void 0){return k(this,e$),pA("until",this,$,X)}since($,X=void 0){return k(this,e$),pA("since",this,$,X)}round($){if(k(this,e$),$===void 0)throw new TypeError("options parameter is required");let X=typeof $=="string"?S8("smallestUnit",$):Q$($),Y=Z9(X),U=c1(X,"halfExpand"),G=l6(X,"smallestUnit","time",o0,["day"]),z={day:1,hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[G];H9(Y,z,z===1);let W=N(this,W4);return K1(Y===1&&G==="nanosecond"?W:Sw(W,Y,G,U),N(this,p))}equals($){k(this,e$);let X=cG($);return G9(N(this,W4),N(X,W4))===0&&H0(N(this,p),N(X,p))}toString($=void 0){k(this,e$);let X=Q$($),Y=O3(X),U=w3(X),G=c1(X,"trunc"),z=l6(X,"smallestUnit","time",void 0);if(z==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:W,unit:Q,increment:Z}=D3(z,U),H=Sw(N(this,W4),Z,Q,G);return I8(H),U3(H,N(this,p),W,Y)}toJSON(){return k(this,e$),U3(N(this,W4),N(this,p),"auto")}toLocaleString($=void 0,X=void 0){return k(this,e$),new V1($,X).format(this)}valueOf(){S2("PlainDateTime")}toZonedDateTime($,X=void 0){k(this,e$);let Y=P6($),U=aG(Q$(X));return W6(Z6(Y,N(this,W4),U),Y,N(this,p))}toPlainDate(){return k(this,e$),j6(N(this,W4).isoDate,N(this,p))}toPlainTime(){return k(this,e$),c0(N(this,W4).time)}static from($,X=void 0){return cG($,X)}static compare($,X){let Y=cG($),U=cG(X);return G9(N(Y,W4),N(U,W4))}}function J6($,X){k($,e$);let Y=N($,W4).isoDate;return E3($).isoToDate(Y,{[X]:!0})[X]}function dX($,X){return k($,e$),N($,W4).time[X]}t0(s7,"Temporal.PlainDateTime");class W9{constructor($=0,X=0,Y=0,U=0,G=0,z=0,W=0,Q=0,Z=0,H=0){let V=$===void 0?0:y1($),O=X===void 0?0:y1(X),w=Y===void 0?0:y1(Y),D=U===void 0?0:y1(U),E=G===void 0?0:y1(G),F=z===void 0?0:y1(z),J=W===void 0?0:y1(W),A=Q===void 0?0:y1(Q),L=Z===void 0?0:y1(Z),T=H===void 0?0:y1(H);l7(V,O,w,D,E,F,J,A,L,T),n0(this),R$(this,L6,V),R$(this,K6,O),R$(this,c6,w),R$(this,_6,D),R$(this,q6,E),R$(this,R6,F),R$(this,T6,J),R$(this,v6,A),R$(this,C6,L),R$(this,p6,T)}get years(){return k(this,w4),N(this,L6)}get months(){return k(this,w4),N(this,K6)}get weeks(){return k(this,w4),N(this,c6)}get days(){return k(this,w4),N(this,_6)}get hours(){return k(this,w4),N(this,q6)}get minutes(){return k(this,w4),N(this,R6)}get seconds(){return k(this,w4),N(this,T6)}get milliseconds(){return k(this,w4),N(this,v6)}get microseconds(){return k(this,w4),N(this,C6)}get nanoseconds(){return k(this,w4),N(this,p6)}get sign(){return k(this,w4),I7(this)}get blank(){return k(this,w4),I7(this)===0}with($){k(this,w4);let X=TL($),{years:Y=N(this,L6),months:U=N(this,K6),weeks:G=N(this,c6),days:z=N(this,_6),hours:W=N(this,q6),minutes:Q=N(this,R6),seconds:Z=N(this,T6),milliseconds:H=N(this,v6),microseconds:V=N(this,C6),nanoseconds:O=N(this,p6)}=X;return new W9(Y,U,G,z,W,Q,Z,H,V,O)}negated(){return k(this,w4),i6(this)}abs(){return k(this,w4),new W9(Math.abs(N(this,L6)),Math.abs(N(this,K6)),Math.abs(N(this,c6)),Math.abs(N(this,_6)),Math.abs(N(this,q6)),Math.abs(N(this,R6)),Math.abs(N(this,T6)),Math.abs(N(this,v6)),Math.abs(N(this,C6)),Math.abs(N(this,p6)))}add($){return k(this,w4),iA("add",this,$)}subtract($){return k(this,w4),iA("subtract",this,$)}round($){if(k(this,w4),$===void 0)throw new TypeError("options parameter is required");let X=m0(this),Y=typeof $=="string"?S8("smallestUnit",$):Q$($),U=l6(Y,"largestUnit","datetime",void 0,["auto"]),{plainRelativeTo:G,zonedRelativeTo:z}=Ew(Y),W=Z9(Y),Q=c1(Y,"halfExpand"),Z=l6(Y,"smallestUnit","datetime",void 0),H=!0;Z||(H=!1,Z="nanosecond");let V=d0(X,Z),O=!0;if(U||(O=!1,U=V),U==="auto"&&(U=V),!H&&!O)throw new RangeError("at least one of smallestUnit or largestUnit is required");if(d0(U,Z)!==U)throw new RangeError(`largestUnit ${U} cannot be smaller than smallestUnit ${Z}`);let w={hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[Z];if(w!==void 0&&H9(W,w,!1),W>1&&u0(Z)==="date"&&U!==Z)throw new RangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit");if(z){let E=iX(this),F=N(z,m$),J=N(z,p),A=N(z,D$);return E=iL(A,rG(A,F,J,E),F,J,U,W,Z,Q),u0(U)==="date"&&(U="hour"),_1(E,U)}if(G){let E=Q0(this),F=Y9({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},E.time),J=N(G,E$),A=N(G,p),L=O1(A,J,Q6(E.date,F.deltaDays),"constrain");return E=rL(k$(J,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),k$(L,F),A,U,W,Z,Q),_1(E,U)}if(z0(X))throw new RangeError(`a starting point is required for ${X}s balancing`);if(z0(U))throw new RangeError(`a starting point is required for ${U}s balancing`);let D=Q0(this);if(Z==="day"){let{quotient:E,remainder:F}=D.time.divmod(T7),J=D.date.days+E+sG(F,"day");J=C2(J,W,Q),D=l0({years:0,months:0,weeks:0,days:J},C$.ZERO)}else D=l0({years:0,months:0,weeks:0,days:0},x7(D.time,W,Z,Q));return _1(D,U)}total($){if(k(this,w4),$===void 0)throw new TypeError("options argument is required");let X=typeof $=="string"?S8("unit",$):Q$($),{plainRelativeTo:Y,zonedRelativeTo:U}=Ew(X),G=l6(X,"unit","datetime",o0);if(U){let W=iX(this),Q=N(U,m$),Z=N(U,p),H=N(U,D$);return function(V,O,w,D,E){return u0(E)==="time"?sG(C$.fromEpochNsDiff(O,V),E):mA(dL(V,O,w,D,E),O,R1(w,V),w,D,E)}(H,rG(H,Q,Z,W),Q,Z,G)}if(Y){let W=Q0(this),Q=Y9({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},W.time),Z=N(Y,E$),H=N(Y,p),V=O1(H,Z,Q6(W.date,Q.deltaDays),"constrain");return function(O,w,D,E){if(G9(O,w)==0)return 0;I8(O),I8(w);let F=pL(O,w,D,E);return E==="nanosecond"?x.toNumber(F.time.totalNs):mA(F,e4(w),O,null,D,E)}(k$(Z,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),k$(V,Q),H,G)}let z=m0(this);if(z0(z))throw new RangeError(`a starting point is required for ${z}s total`);if(z0(G))throw new RangeError(`a starting point is required for ${G}s total`);return sG(Q0(this).time,G)}toString($=void 0){k(this,w4);let X=Q$($),Y=w3(X),U=c1(X,"trunc"),G=l6(X,"smallestUnit","time",void 0);if(G==="hour"||G==="minute")throw new RangeError('smallestUnit must be a time unit other than "hours" or "minutes"');let{precision:z,unit:W,increment:Q}=D3(G,Y);if(W==="nanosecond"&&Q===1)return K7(this,z);let Z=m0(this),H=iX(this),V=x7(H.time,Q,W,U);return H=l0(H.date,V),K7(_1(H,d0(Z,"second")),z)}toJSON(){return k(this,w4),K7(this,"auto")}toLocaleString($=void 0,X=void 0){if(k(this,w4),typeof Intl.DurationFormat=="function"){let Y=new Intl.DurationFormat($,X);return ew.call(Y,this)}return console.warn("Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat."),K7(this,"auto")}valueOf(){S2("Duration")}static from($){return q1($)}static compare($,X,Y=void 0){let U=q1($),G=q1(X),z=Q$(Y),{plainRelativeTo:W,zonedRelativeTo:Q}=Ew(z);if(N(U,L6)===N(G,L6)&&N(U,K6)===N(G,K6)&&N(U,c6)===N(G,c6)&&N(U,_6)===N(G,_6)&&N(U,q6)===N(G,q6)&&N(U,R6)===N(G,R6)&&N(U,T6)===N(G,T6)&&N(U,v6)===N(G,v6)&&N(U,C6)===N(G,C6)&&N(U,p6)===N(G,p6))return 0;let Z=m0(U),H=m0(G),V=iX(U),O=iX(G);if(Q&&(u0(Z)==="date"||u0(H)==="date")){let J=N(Q,m$),A=N(Q,p),L=N(Q,D$),T=rG(L,J,A,V),q=rG(L,J,A,O);return d6(x.toNumber(x.subtract(T,q)))}let w=V.date.days,D=O.date.days;if(z0(Z)||z0(H)){if(!W)throw new RangeError("A starting point is required for years, months, or weeks comparison");w=yA(V.date,W),D=yA(O.date,W)}let E=V.time.add24HourDays(w),F=O.time.add24HourDays(D);return E.cmp(F)}}t0(W9,"Temporal.Duration");class e7{constructor($,X,Y="iso8601",U=1972){let G=F$($),z=F$(X),W=S6(Y===void 0?"iso8601":h4(Y)),Q=F$(U);P8(Q,G,z),jL(this,{year:Q,month:G,day:z},W)}get monthCode(){return XL(this,"monthCode")}get day(){return XL(this,"day")}get calendarId(){return k(this,Z1),N(this,p)}with($,X=void 0){if(k(this,Z1),!N4($))throw new TypeError("invalid argument");Q9($);let Y=N(this,p),U=I6(Y,N(this,E$),"month-day");return U=j8(Y,U,D1(Y,$,["year","month","monthCode","day"],[],"partial")),nX(B7(Y,U,x$(Q$(X))),Y)}equals($){k(this,Z1);let X=PA($);return O0(N(this,E$),N(X,E$))===0&&H0(N(this,p),N(X,p))}toString($=void 0){return k(this,Z1),bA(this,O3(Q$($)))}toJSON(){return k(this,Z1),bA(this)}toLocaleString($=void 0,X=void 0){return k(this,Z1),new V1($,X).format(this)}valueOf(){S2("PlainMonthDay")}toPlainDate($){if(k(this,Z1),!N4($))throw new TypeError("argument should be an object");let X=N(this,p);return j6(I2(X,j8(X,I6(X,N(this,E$),"month-day"),D1(X,$,["year"],[],[])),"constrain"),X)}static from($,X=void 0){return PA($,X)}}function XL($,X){k($,Z1);let Y=N($,E$);return E3($).isoToDate(Y,{[X]:!0})[X]}function Fw($){return R1($,fw())}t0(e7,"Temporal.PlainMonthDay");var KK={instant:()=>m1(fw()),plainDateTimeISO:($=hG())=>K1(Fw(P6($)),"iso8601"),plainDateISO:($=hG())=>j6(Fw(P6($)).isoDate,"iso8601"),plainTimeISO:($=hG())=>c0(Fw(P6($)).time),timeZoneId:()=>hG(),zonedDateTimeISO:($=hG())=>{let X=P6($);return W6(fw(),X,"iso8601")},[Symbol.toStringTag]:"Temporal.Now"};Object.defineProperty(KK,Symbol.toStringTag,{value:"Temporal.Now",writable:!1,enumerable:!1,configurable:!0});class q3{constructor($=0,X=0,Y=0,U=0,G=0,z=0){let W=$===void 0?0:F$($),Q=X===void 0?0:F$(X),Z=Y===void 0?0:F$(Y),H=U===void 0?0:F$(U),V=G===void 0?0:F$(G),O=z===void 0?0:F$(z);d7(W,Q,Z,H,V,O),PL(this,{hour:W,minute:Q,second:Z,millisecond:H,microsecond:V,nanosecond:O})}get hour(){return k(this,J4),N(this,E4).hour}get minute(){return k(this,J4),N(this,E4).minute}get second(){return k(this,J4),N(this,E4).second}get millisecond(){return k(this,J4),N(this,E4).millisecond}get microsecond(){return k(this,J4),N(this,E4).microsecond}get nanosecond(){return k(this,J4),N(this,E4).nanosecond}with($,X=void 0){if(k(this,J4),!N4($))throw new TypeError("invalid argument");Q9($);let Y=vw($,"partial"),U=vw(this),{hour:G,minute:z,second:W,millisecond:Q,microsecond:Z,nanosecond:H}=Object.assign(U,Y),V=x$(Q$(X));return{hour:G,minute:z,second:W,millisecond:Q,microsecond:Z,nanosecond:H}=u7(G,z,W,Q,Z,H,V),new q3(G,z,W,Q,Z,H)}add($){return k(this,J4),aA("add",this,$)}subtract($){return k(this,J4),aA("subtract",this,$)}until($,X=void 0){return k(this,J4),dA("until",this,$,X)}since($,X=void 0){return k(this,J4),dA("since",this,$,X)}round($){if(k(this,J4),$===void 0)throw new TypeError("options parameter is required");let X=typeof $=="string"?S8("smallestUnit",$):Q$($),Y=Z9(X),U=c1(X,"halfExpand"),G=l6(X,"smallestUnit","time",o0);return H9(Y,{hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[G],!1),c0(kw(N(this,E4),Y,G,U))}equals($){k(this,J4);let X=v2($);return bw(N(this,E4),N(X,E4))===0}toString($=void 0){k(this,J4);let X=Q$($),Y=w3(X),U=c1(X,"trunc"),G=l6(X,"smallestUnit","time",void 0);if(G==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:z,unit:W,increment:Q}=D3(G,Y);return kA(kw(N(this,E4),Q,W,U),z)}toJSON(){return k(this,J4),kA(N(this,E4),"auto")}toLocaleString($=void 0,X=void 0){return k(this,J4),new V1($,X).format(this)}valueOf(){S2("PlainTime")}static from($,X=void 0){return v2($,X)}static compare($,X){let Y=v2($),U=v2(X);return bw(N(Y,E4),N(U,E4))}}t0(q3,"Temporal.PlainTime");class $z{constructor($,X,Y="iso8601",U=1){let G=F$($),z=F$(X),W=S6(Y===void 0?"iso8601":h4(Y)),Q=F$(U);P8(G,z,Q),IL(this,{year:G,month:z,day:Q},W)}get year(){return g0(this,"year")}get month(){return g0(this,"month")}get monthCode(){return g0(this,"monthCode")}get calendarId(){return k(this,s4),N(this,p)}get era(){return g0(this,"era")}get eraYear(){return g0(this,"eraYear")}get daysInMonth(){return g0(this,"daysInMonth")}get daysInYear(){return g0(this,"daysInYear")}get monthsInYear(){return g0(this,"monthsInYear")}get inLeapYear(){return g0(this,"inLeapYear")}with($,X=void 0){if(k(this,s4),!N4($))throw new TypeError("invalid argument");Q9($);let Y=N(this,p),U=I6(Y,N(this,E$),"year-month");return U=j8(Y,U,D1(Y,$,["year","month","monthCode"],[],"partial")),tX(Y3(Y,U,x$(Q$(X))),Y)}add($,X=void 0){return k(this,s4),sA("add",this,$,X)}subtract($,X=void 0){return k(this,s4),sA("subtract",this,$,X)}until($,X=void 0){return k(this,s4),lA("until",this,$,X)}since($,X=void 0){return k(this,s4),lA("since",this,$,X)}equals($){k(this,s4);let X=dG($);return O0(N(this,E$),N(X,E$))===0&&H0(N(this,p),N(X,p))}toString($=void 0){return k(this,s4),fA(this,O3(Q$($)))}toJSON(){return k(this,s4),fA(this)}toLocaleString($=void 0,X=void 0){return k(this,s4),new V1($,X).format(this)}valueOf(){S2("PlainYearMonth")}toPlainDate($){if(k(this,s4),!N4($))throw new TypeError("argument should be an object");let X=N(this,p);return j6(I2(X,j8(X,I6(X,N(this,E$),"year-month"),D1(X,$,["day"],[],[])),"constrain"),X)}static from($,X=void 0){return dG($,X)}static compare($,X){let Y=dG($),U=dG(X);return O0(N(Y,E$),N(U,E$))}}function g0($,X){k($,s4);let Y=N($,E$);return E3($).isoToDate(Y,{[X]:!0})[X]}t0($z,"Temporal.PlainYearMonth");var jb=V1.prototype.resolvedOptions;class Xz{constructor($,X,Y="iso8601"){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");let U=S7($),G=h4(X),{tzName:z,offsetMinutes:W}=B2(G);if(W===void 0){let Q=j7(z);if(!Q)throw new RangeError(`unknown time zone ${z}`);G=Q.identifier}else G=mw(W);SL(this,U,G,S6(Y===void 0?"iso8601":h4(Y)))}get calendarId(){return k(this,v$),N(this,p)}get timeZoneId(){return k(this,v$),N(this,m$)}get year(){return A6(this,"year")}get month(){return A6(this,"month")}get monthCode(){return A6(this,"monthCode")}get day(){return A6(this,"day")}get hour(){return lX(this,"hour")}get minute(){return lX(this,"minute")}get second(){return lX(this,"second")}get millisecond(){return lX(this,"millisecond")}get microsecond(){return lX(this,"microsecond")}get nanosecond(){return lX(this,"nanosecond")}get era(){return A6(this,"era")}get eraYear(){return A6(this,"eraYear")}get epochMilliseconds(){return k(this,v$),T1(N(this,D$),"floor")}get epochNanoseconds(){return k(this,v$),oL(N(this,D$))}get dayOfWeek(){return A6(this,"dayOfWeek")}get dayOfYear(){return A6(this,"dayOfYear")}get weekOfYear(){return A6(this,"weekOfYear")?.week}get yearOfWeek(){return A6(this,"weekOfYear")?.year}get hoursInDay(){k(this,v$);let $=N(this,m$),X=U0(this).isoDate,Y=r6(X.year,X.month,X.day+1),U=R2($,X),G=R2($,Y);return sG(C$.fromEpochNsDiff(G,U),"hour")}get daysInWeek(){return A6(this,"daysInWeek")}get daysInMonth(){return A6(this,"daysInMonth")}get daysInYear(){return A6(this,"daysInYear")}get monthsInYear(){return A6(this,"monthsInYear")}get inLeapYear(){return A6(this,"inLeapYear")}get offset(){return k(this,v$),Cw(p0(N(this,m$),N(this,D$)))}get offsetNanoseconds(){return k(this,v$),p0(N(this,m$),N(this,D$))}with($,X=void 0){if(k(this,v$),!N4($))throw new TypeError("invalid zoned-date-time-like");Q9($);let Y=N(this,p),U=N(this,m$),G=p0(U,N(this,D$)),z=U0(this),W={...I6(Y,z.isoDate),...z.time,offset:Cw(G)};W=j8(Y,W,D1(Y,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset"],"partial"));let Q=Q$(X),Z=aG(Q),H=_7(Q,"prefer"),V=N3(Y,W,x$(Q)),O=V9(W.offset);return W6(C7(V.isoDate,V.time,"option",O,U,Z,H,!1),U,Y)}withPlainTime($=void 0){k(this,v$);let X=N(this,m$),Y=N(this,p),U=U0(this).isoDate,G;return G=$===void 0?R2(X,U):Z6(X,k$(U,N(v2($),E4)),"compatible"),W6(G,X,Y)}withTimeZone($){k(this,v$);let X=P6($);return W6(N(this,D$),X,N(this,p))}withCalendar($){k(this,v$);let X=M3($);return W6(N(this,D$),N(this,m$),X)}add($,X=void 0){return k(this,v$),eA("add",this,$,X)}subtract($,X=void 0){return k(this,v$),eA("subtract",this,$,X)}until($,X=void 0){return k(this,v$),rA("until",this,$,X)}since($,X=void 0){return k(this,v$),rA("since",this,$,X)}round($){if(k(this,v$),$===void 0)throw new TypeError("options parameter is required");let X=typeof $=="string"?S8("smallestUnit",$):Q$($),Y=Z9(X),U=c1(X,"halfExpand"),G=l6(X,"smallestUnit","time",o0,["day"]),z={day:1,hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[G];if(H9(Y,z,z===1),G==="nanosecond"&&Y===1)return W6(N(this,D$),N(this,m$),N(this,p));let W=N(this,m$),Q=N(this,D$),Z=U0(this),H;if(G==="day"){let V=Z.isoDate,O=r6(V.year,V.month,V.day+1),w=R2(W,V),D=R2(W,O),E=x.subtract(D,w);H=C$.fromEpochNsDiff(Q,w).round(E,U).addToEpochNs(w)}else{let V=Sw(Z,Y,G,U),O=p0(W,Q);H=C7(V.isoDate,V.time,"option",O,W,"compatible","prefer",!1)}return W6(H,W,N(this,p))}equals($){k(this,v$);let X=lG($),Y=N(this,D$),U=N(X,D$);return!!x.equal(x.BigInt(Y),x.BigInt(U))&&!!kL(N(this,m$),N(X,m$))&&H0(N(this,p),N(X,p))}toString($=void 0){k(this,v$);let X=Q$($),Y=O3(X),U=w3(X),G=function(O){return r0(O,"offset",["auto","never"],"auto")}(X),z=c1(X,"trunc"),W=l6(X,"smallestUnit","time",void 0);if(W==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let Q=function(O){return r0(O,"timeZoneName",["auto","never","critical"],"auto")}(X),{precision:Z,unit:H,increment:V}=D3(W,U);return hA(this,Z,Y,Q,G,{unit:H,increment:V,roundingMode:z})}toLocaleString($=void 0,X=void 0){k(this,v$);let Y=Q$(X),U=Object.create(null);if(function(Q,Z,H,V){if(Z==null)return;let O=Reflect.ownKeys(Z);for(let w=0;w<O.length;w++){let D=O[w];if(!H.some((E)=>Object.is(E,D))&&Object.prototype.propertyIsEnumerable.call(Z,D)){let E=Z[D];Q[D]=E}}}(U,Y,["timeZone"]),Y.timeZone!==void 0)throw new TypeError("ZonedDateTime toLocaleString does not accept a timeZone option");if(U.year===void 0&&U.month===void 0&&U.day===void 0&&U.era===void 0&&U.weekday===void 0&&U.dateStyle===void 0&&U.hour===void 0&&U.minute===void 0&&U.second===void 0&&U.fractionalSecondDigits===void 0&&U.timeStyle===void 0&&U.dayPeriod===void 0&&U.timeZoneName===void 0&&(U.timeZoneName="short"),U.timeZone=N(this,m$),gA(U.timeZone))throw new RangeError("toLocaleString does not currently support offset time zones");let G=new V1($,U),z=jb.call(G).calendar,W=N(this,p);if(W!=="iso8601"&&z!=="iso8601"&&!H0(z,W))throw new RangeError(`cannot format ZonedDateTime with calendar ${W} in locale with calendar ${z}`);return G.format(m1(N(this,D$)))}toJSON(){return k(this,v$),hA(this,"auto")}valueOf(){S2("ZonedDateTime")}startOfDay(){k(this,v$);let $=N(this,m$);return W6(R2($,U0(this).isoDate),$,N(this,p))}getTimeZoneTransition($){k(this,v$);let X=N(this,m$);if($===void 0)throw new TypeError("options parameter is required");let Y=r0(typeof $=="string"?S8("direction",$):Q$($),"direction",["next","previous"],o0);if(Y===void 0)throw new TypeError("direction option is required");if(gA(X)||X==="UTC")return null;let U=N(this,D$),G=Y==="next"?cw(X,U):jw(X,U);return G===null?null:W6(G,X,N(this,p))}toInstant(){return k(this,v$),m1(N(this,D$))}toPlainDate(){return k(this,v$),j6(U0(this).isoDate,N(this,p))}toPlainTime(){return k(this,v$),c0(U0(this).time)}toPlainDateTime(){return k(this,v$),K1(U0(this),N(this,p))}static from($,X=void 0){return lG($,X)}static compare($,X){let Y=lG($),U=lG(X),G=N(Y,D$),z=N(U,D$);return x.lessThan(x.BigInt(G),x.BigInt(z))?-1:x.greaterThan(x.BigInt(G),x.BigInt(z))?1:0}}function U0($){return R1(N($,m$),N($,D$))}function A6($,X){k($,v$);let Y=U0($).isoDate;return E3($).isoToDate(Y,{[X]:!0})[X]}function lX($,X){return k($,v$),U0($).time[X]}t0(Xz,"Temporal.ZonedDateTime");var Yz=Object.freeze({__proto__:null,Duration:W9,Instant:t7,Now:KK,PlainDate:a7,PlainDateTime:s7,PlainMonthDay:e7,PlainTime:q3,PlainYearMonth:$z,ZonedDateTime:Xz}),He=class ${toTemporalInstant(){return m1(u1(Date.prototype.valueOf.call(this)))}}.prototype.toTemporalInstant,Pb=[t7,a7,s7,W9,e7,q3,$z,Xz];for(let $ of Pb){let X=Object.getOwnPropertyDescriptor($,"prototype");(X.configurable||X.enumerable||X.writable)&&(X.configurable=!1,X.enumerable=!1,X.writable=!1,Object.defineProperty($,"prototype",X))}var Ib=($)=>{return t2($,{key:"\uD83D\uDD0D Atom Token Index",default:()=>{let X=new Map;for(let[Y,U]of $.atoms){if(GX(Y))continue;let G=f1(U);if(U.family){let z=X.get(U.family.key);if(!z||!("familyMembers"in z))z={key:U.family.key,familyMembers:new Map},X.set(U.family.key,z);z.familyMembers.set(U.family.subKey,G)}else X.set(Y,G)}return X},effects:[({setSelf:X})=>{$.on.atomCreation.subscribe("introspection",(Y)=>{if(GX(Y.key))return;X((U)=>{if(Y.family){let{key:G,subKey:z}=Y.family,W=U.get(G);if(W===void 0||!("familyMembers"in W))W={key:G,familyMembers:new Map},U.set(G,W);W.familyMembers.set(z,Y)}else U.set(Y.key,Y);return new Map(U)})}),$.on.atomDisposal.subscribe("introspection",(Y)=>{X((U)=>{if(Y.family){let{key:G,subKey:z}=Y.family,W=U.get(G);if(W&&"familyMembers"in W){if(W.familyMembers.delete(z),W.familyMembers.size===0)U.delete(G)}}return new Map(U)})})}]},void 0)},xb=($)=>{return t2($,{key:"\uD83D\uDD0D Selector Token Index",default:()=>{let X=new Map;for(let Y of[$.readonlySelectors,$.writableSelectors])for(let[U,G]of Y){if(GX(U))continue;let z=f1(G);if(G.family){let W=X.get(G.family.key);if(!W||!("familyMembers"in W))W={key:G.family.key,familyMembers:new Map},X.set(G.family.key,W);W.familyMembers.set(G.family.subKey,z)}else X.set(U,z)}return X},effects:[({setSelf:X})=>{$.on.selectorCreation.subscribe("introspection",(Y)=>{if(GX(Y.key))return;X((U)=>{if(Y.family){let{key:G,subKey:z}=Y.family,W=U.get(G);if(W===void 0||!("familyMembers"in W))W={key:G,familyMembers:new Map},U.set(G,W);W.familyMembers.set(z,Y)}else U.set(Y.key,Y);return new Map(U)})}),$.on.selectorDisposal.subscribe("introspection",(Y)=>{X((U)=>{if(Y.family){let{key:G,subKey:z}=Y.family,W=U.get(G);if(W&&"familyMembers"in W){if(W.familyMembers.delete(z),W.familyMembers.size===0)U.delete(G)}}else U.delete(Y.key);return new Map(U)})})}]},void 0)};var $D=class{supported;constructor($){this.supported=$}refine($){for(let[X,Y]of Object.entries(this.supported))try{if(Y($)===!0&&Y!==Boolean)return{type:X,data:$}}catch(U){try{if($ instanceof Y)return{type:X,data:$}}catch(G){}}return null}},qK=new $D({number:($)=>typeof $==="number",string:($)=>typeof $==="string",boolean:($)=>typeof $==="boolean",null:($)=>$===null});function RK($){if(!$)return!1;return Object.getPrototypeOf($)===Object.prototype}var TK=new $D({object:RK,array:($)=>Array.isArray($)}),Sb=new $D({...qK.supported,...TK.supported}),Gz=($)=>{if($===void 0)return"undefined";let X=Sb.refine($);if(X)return X.type;return Object.getPrototypeOf($).constructor.name};var De=class ${store;auditorCreatedAt=performance.now();statesCreatedAt=new Map;atomIndex;selectorIndex;disposed=!1;unsubscribeFromAtomCreation;unsubscribeFromAtomDisposal;unsubscribeFromSelectorCreation;unsubscribeFromSelectorDisposal;constructor(X=N6.STORE){this.store=X,this.atomIndex=Ib(this.store),this.selectorIndex=xb(this.store),this.unsubscribeFromAtomCreation=this.store.on.atomCreation.subscribe(`auditor-${this.auditorCreatedAt}`,({key:Y})=>{this.statesCreatedAt.set(Y,performance.now()-this.auditorCreatedAt)}),this.unsubscribeFromAtomDisposal=this.store.on.atomDisposal.subscribe(`auditor-${this.auditorCreatedAt}`,({key:Y})=>{this.statesCreatedAt.delete(Y)}),this.unsubscribeFromSelectorCreation=this.store.on.selectorCreation.subscribe(`auditor-${this.auditorCreatedAt}`,({key:Y})=>{this.statesCreatedAt.set(Y,performance.now()-this.auditorCreatedAt)}),this.unsubscribeFromSelectorDisposal=this.store.on.selectorDisposal.subscribe(`auditor-${this.auditorCreatedAt}`,({key:Y})=>{this.statesCreatedAt.delete(Y)})}static DEFAULT_LIST_RESOURCES_PARAM={atomFamilies:!0,selectorFamilies:!0};listResources(X=$.DEFAULT_LIST_RESOURCES_PARAM){if(this.disposed)throw new Error("This Auditor has been disposed");let Y=RW(this.atomIndex),U=RW(this.selectorIndex),G=[...Y.values()].filter((Z)=>("familyMembers"in Z)),z=[...U.values()].filter((Z)=>("familyMembers"in Z)),W=performance.now(),Q=[];if(X.atomFamilies)for(let Z of G){let H=Z.familyMembers.values();for(let V of H){let w=this.statesCreatedAt.get(V.key)??this.auditorCreatedAt,D=W-w;Q.push([V,D])}}if(X.selectorFamilies)for(let Z of z){let H=Z.familyMembers.values();for(let V of H){let w=this.statesCreatedAt.get(V.key)??this.auditorCreatedAt,D=W-w;Q.push([V,D])}}return Q}[Symbol.dispose](){this.unsubscribeFromAtomCreation(),this.unsubscribeFromAtomDisposal(),this.unsubscribeFromSelectorCreation(),this.unsubscribeFromSelectorDisposal(),this.disposed=!0}},_K=($,X)=>{let Y=(U,G)=>{let W=((Z,H)=>{let V=X(Z,H);if(V)return V;return null})(U,G);if(W?.jobComplete??W?.pathComplete)return W;let Q=Array.isArray(G)?G.map((Z,H)=>[H,Z]):RK(G)?Object.entries(G):[];for(let[Z,H]of Q){let V=Y([...U,Z],H);if(V?.jobComplete)return V}return{}};Y([],$)};function kb($,X){return{summary:`${$<X?"+":"-"}${Math.abs($-X)} (${$} \u2192 ${X})`}}function bb($,X){return{summary:`${$.length<X.length?"+":"-"}${Math.abs($.length-X.length)} ("${$}" \u2192 "${X}")`}}function fb($,X){return{summary:`${$} \u2192 ${X}`}}function vK($,X,Y){let U="",G=[],z=[],W=[];return _K($,(Q,Z)=>{let H;for(H of Q){let V=X[H];if(V===void 0)z.push([H,JSON.stringify(Z)]);else{let O=Y(Z,V);if(O.summary!=="No Change")W.push([H,O])}}}),_K(X,(Q,Z)=>{let H;for(H of Q)if($[H]===void 0)G.push([H,JSON.stringify(Z)])}),U=`\uFF5E${W.length} \uFF0B${G.length} \uFF0D${z.length}`,{summary:U,added:G,removed:z,changed:W}}function hb($,X,Y){return vK($,X,Y)}var gb=class{leafRefinery;treeRefinery;leafDiffers;treeDiffers;constructor($,X,Y){this.leafRefinery=$,this.treeRefinery=X,this.leafDiffers={},this.treeDiffers={};for(let U of Object.keys($.supported)){let G=Y[U];this.leafDiffers[U]=G}for(let U of Object.keys(X.supported)){let G=Y[U];this.treeDiffers[U]=G}}diff($,X){if($===X)return{summary:"No Change"};let Y=this.leafRefinery.refine($)??this.treeRefinery.refine($),U=this.leafRefinery.refine(X)??this.treeRefinery.refine(X);if(Y!==null&&U!==null){if(Y.type===U.type){if(Y.type in this.leafDiffers)return this.leafDiffers[Y.type](Y.data,U.data);if(Y.type in this.treeDiffers)return this.treeDiffers[Y.type](Y.data,U.data,(Q,Z)=>this.diff(Q,Z))}}let G=Gz($),z=Gz(X);if(G===z)return{summary:`${G} \u2192 ${z}`};return{summary:`Type change: ${G} \u2192 ${z}`}}},Ee=new gb(qK,TK,{number:kb,string:bb,boolean:fb,null:()=>({summary:"No Change"}),object:vK,array:hb});var _=Symbol.for("drizzle:entityKind");function b($,X){if(!$||typeof $!=="object")return!1;if($ instanceof X)return!0;if(!Object.prototype.hasOwnProperty.call(X,_))throw new Error(`Class "${X.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let Y=Object.getPrototypeOf($).constructor;if(Y)while(Y){if(_ in Y&&Y[_]===X[_])return!0;Y=Object.getPrototypeOf(Y)}return!1}class r${constructor($,X){this.table=$,this.config=X,this.name=X.name,this.keyAsName=X.keyAsName,this.notNull=X.notNull,this.default=X.default,this.defaultFn=X.defaultFn,this.onUpdateFn=X.onUpdateFn,this.hasDefault=X.hasDefault,this.primary=X.primaryKey,this.isUnique=X.isUnique,this.uniqueName=X.uniqueName,this.uniqueType=X.uniqueType,this.dataType=X.dataType,this.columnType=X.columnType,this.generated=X.generated,this.generatedIdentity=X.generatedIdentity}static[_]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue($){return $}mapToDriverValue($){return $}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}class XD{static[_]="ColumnBuilder";config;constructor($,X,Y){this.config={name:$,keyAsName:$==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:X,columnType:Y,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default($){return this.config.default=$,this.config.hasDefault=!0,this}$defaultFn($){return this.config.defaultFn=$,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn($){return this.config.onUpdateFn=$,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName($){if(this.config.name!=="")return;this.config.name=$}}var p1=Symbol.for("drizzle:Name");class YD{static[_]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor($,X){if(this.reference=()=>{let{name:Y,columns:U,foreignColumns:G}=$();return{name:Y,columns:U,foreignTable:G[0].table,foreignColumns:G}},X)this._onUpdate=X.onUpdate,this._onDelete=X.onDelete}onUpdate($){return this._onUpdate=$===void 0?"no action":$,this}onDelete($){return this._onDelete=$===void 0?"no action":$,this}build($){return new CK($,this)}}class CK{constructor($,X){this.table=$,this.reference=X.reference,this.onUpdate=X._onUpdate,this.onDelete=X._onDelete}static[_]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:$,columns:X,foreignColumns:Y}=this.reference(),U=X.map((W)=>W.name),G=Y.map((W)=>W.name),z=[this.table[p1],...U,Y[0].table[p1],...G];return $??`${z.join("_")}_fk`}}function Uz($,...X){return $(...X)}function BK($,X){return`${$[p1]}_${X.join("_")}_unique`}function jK($,X,Y){for(let U=X;U<$.length;U++){let G=$[U];if(G==="\\"){U++;continue}if(G==='"')return[$.slice(X,U).replace(/\\/g,""),U+1];if(Y)continue;if(G===","||G==="}")return[$.slice(X,U).replace(/\\/g,""),U]}return[$.slice(X).replace(/\\/g,""),$.length]}function PK($,X=0){let Y=[],U=X,G=!1;while(U<$.length){let z=$[U];if(z===","){if(G||U===X)Y.push("");G=!0,U++;continue}if(G=!1,z==="\\"){U+=2;continue}if(z==='"'){let[Z,H]=jK($,U+1,!0);Y.push(Z),U=H;continue}if(z==="}")return[Y,U+1];if(z==="{"){let[Z,H]=PK($,U+1);Y.push(Z),U=H;continue}let[W,Q]=jK($,U,!1);Y.push(W),U=Q}return[Y,U]}function IK($){let[X]=PK($,1);return X}function GD($){return`{${$.map((X)=>{if(Array.isArray(X))return GD(X);if(typeof X==="string")return`"${X.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${X}`}).join(",")}}`}class Y$ extends XD{foreignKeyConfigs=[];static[_]="PgColumnBuilder";array($){return new SK(this.config.name,this,$)}references($,X={}){return this.foreignKeyConfigs.push({ref:$,actions:X}),this}unique($,X){return this.config.isUnique=!0,this.config.uniqueName=$,this.config.uniqueType=X?.nulls,this}generatedAlwaysAs($){return this.config.generated={as:$,type:"always",mode:"stored"},this}buildForeignKeys($,X){return this.foreignKeyConfigs.map(({ref:Y,actions:U})=>{return Uz((G,z)=>{let W=new YD(()=>{let Q=G();return{columns:[$],foreignColumns:[Q]}});if(z.onUpdate)W.onUpdate(z.onUpdate);if(z.onDelete)W.onDelete(z.onDelete);return W.build(X)},Y,U)})}buildExtraConfigColumn($){return new xK($,this.config)}}class i extends r${constructor($,X){if(!X.uniqueName)X.uniqueName=BK($,[X.name]);super($,X);this.table=$}static[_]="PgColumn"}class xK extends i{static[_]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op($){return this.indexConfig.opClass=$,this}}class R3{static[_]="IndexedColumn";constructor($,X,Y,U){this.name=$,this.keyAsName=X,this.type=Y,this.indexConfig=U}name;keyAsName;type;indexConfig}class SK extends Y${static[_]="PgArrayBuilder";constructor($,X,Y){super($,"array","PgArray");this.config.baseBuilder=X,this.config.size=Y}build($){let X=this.config.baseBuilder.build($);return new UD($,this.config,X)}}class UD extends i{constructor($,X,Y,U){super($,X);this.baseColumn=Y,this.range=U,this.size=X.size}size;static[_]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==="number"?this.size:""}]`}mapFromDriverValue($){if(typeof $==="string")$=IK($);return $.map((X)=>this.baseColumn.mapFromDriverValue(X))}mapToDriverValue($,X=!1){let Y=$.map((U)=>U===null?null:b(this.baseColumn,UD)?this.baseColumn.mapToDriverValue(U,!0):this.baseColumn.mapToDriverValue(U));if(X)return Y;return GD(Y)}}class kK extends Y${static[_]="PgEnumObjectColumnBuilder";constructor($,X){super($,"string","PgEnumObjectColumn");this.config.enum=X}build($){return new bK($,this.config)}}class bK extends i{static[_]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor($,X){super($,X);this.enum=X.enum}getSQLType(){return this.enum.enumName}}var zz=Symbol.for("drizzle:isPgEnum");function fK($){return!!$&&typeof $==="function"&&zz in $&&$[zz]===!0}class hK extends Y${static[_]="PgEnumColumnBuilder";constructor($,X){super($,"string","PgEnumColumn");this.config.enum=X}build($){return new gK($,this.config)}}class gK extends i{static[_]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor($,X){super($,X);this.enum=X.enum}getSQLType(){return this.enum.enumName}}function T3($,X){return Array.isArray(X)?yb($,[...X],void 0):mb($,X,void 0)}function yb($,X,Y){let U=Object.assign((G)=>new hK(G??"",U),{enumName:$,enumValues:X,schema:Y,[zz]:!0});return U}function mb($,X,Y){let U=Object.assign((G)=>new kK(G??"",U),{enumName:$,enumValues:Object.values(X),schema:Y,[zz]:!0});return U}class R4{static[_]="Subquery";constructor($,X,Y,U=!1,G=[]){this._={brand:"Subquery",sql:$,selectedFields:X,alias:Y,isWith:U,usedTables:G}}}class v3 extends R4{static[_]="WithSubquery"}var yK="0.44.5";var zD,WD,i$={startActiveSpan($,X){if(!zD)return X();if(!WD)WD=zD.trace.getTracer("drizzle-orm",yK);return Uz((Y,U)=>U.startActiveSpan($,(G)=>{try{return X(G)}catch(z){throw G.setStatus({code:Y.SpanStatusCode.ERROR,message:z instanceof Error?z.message:"Unknown error"}),z}finally{G.end()}}),zD,WD)}};var $4=Symbol.for("drizzle:ViewBaseConfig");var g8=Symbol.for("drizzle:Schema"),Wz=Symbol.for("drizzle:Columns"),mK=Symbol.for("drizzle:ExtraConfigColumns"),QD=Symbol.for("drizzle:OriginalName"),ZD=Symbol.for("drizzle:BaseName"),C3=Symbol.for("drizzle:IsAlias"),uK=Symbol.for("drizzle:ExtraConfigBuilder"),ub=Symbol.for("drizzle:IsDrizzleTable");class t{static[_]="Table";static Symbol={Name:p1,Schema:g8,OriginalName:QD,Columns:Wz,ExtraConfigColumns:mK,BaseName:ZD,IsAlias:C3,ExtraConfigBuilder:uK};[p1];[QD];[g8];[Wz];[mK];[ZD];[C3]=!1;[ub]=!0;[uK]=void 0;constructor($,X,Y){this[p1]=this[QD]=$,this[g8]=X,this[ZD]=Y}}function i4($){return $[p1]}function y8($){return`${$[g8]??"public"}.${$[p1]}`}function HD($){return $!==null&&$!==void 0&&typeof $.getSQL==="function"}function cb($){let X={sql:"",params:[]};for(let Y of $)if(X.sql+=Y.sql,X.params.push(...Y.params),Y.typings?.length){if(!X.typings)X.typings=[];X.typings.push(...Y.typings)}return X}class g4{static[_]="StringChunk";value;constructor($){this.value=Array.isArray($)?$:[$]}getSQL(){return new $$([this])}}class $${constructor($){this.queryChunks=$;for(let X of $)if(b(X,t)){let Y=X[t.Symbol.Schema];this.usedTables.push(Y===void 0?X[t.Symbol.Name]:Y+"."+X[t.Symbol.Name])}}static[_]="SQL";decoder=pK;shouldInlineParams=!1;usedTables=[];append($){return this.queryChunks.push(...$.queryChunks),this}toQuery($){return i$.startActiveSpan("drizzle.buildSQL",(X)=>{let Y=this.buildQueryFromSourceParams(this.queryChunks,$);return X?.setAttributes({"drizzle.query.text":Y.sql,"drizzle.query.params":JSON.stringify(Y.params)}),Y})}buildQueryFromSourceParams($,X){let Y=Object.assign({},X,{inlineParams:X.inlineParams||this.shouldInlineParams,paramStartIndex:X.paramStartIndex||{value:0}}),{casing:U,escapeName:G,escapeParam:z,prepareTyping:W,inlineParams:Q,paramStartIndex:Z}=Y;return cb($.map((H)=>{if(b(H,g4))return{sql:H.value.join(""),params:[]};if(b(H,Qz))return{sql:G(H.value),params:[]};if(H===void 0)return{sql:"",params:[]};if(Array.isArray(H)){let V=[new g4("(")];for(let[O,w]of H.entries())if(V.push(w),O<H.length-1)V.push(new g4(", "));return V.push(new g4(")")),this.buildQueryFromSourceParams(V,Y)}if(b(H,$$))return this.buildQueryFromSourceParams(H.queryChunks,{...Y,inlineParams:Q||H.shouldInlineParams});if(b(H,t)){let V=H[t.Symbol.Schema],O=H[t.Symbol.Name];return{sql:V===void 0||H[C3]?G(O):G(V)+"."+G(O),params:[]}}if(b(H,r$)){let V=U.getColumnCasing(H);if(X.invokeSource==="indexes")return{sql:G(V),params:[]};let O=H.table[t.Symbol.Schema];return{sql:H.table[C3]||O===void 0?G(H.table[t.Symbol.Name])+"."+G(V):G(O)+"."+G(H.table[t.Symbol.Name])+"."+G(V),params:[]}}if(b(H,o6)){let V=H[$4].schema,O=H[$4].name;return{sql:V===void 0||H[$4].isAlias?G(O):G(V)+"."+G(O),params:[]}}if(b(H,E1)){if(b(H.value,b2))return{sql:z(Z.value++,H),params:[H],typings:["none"]};let V=H.value===null?null:H.encoder.mapToDriverValue(H.value);if(b(V,$$))return this.buildQueryFromSourceParams([V],Y);if(Q)return{sql:this.mapInlineParam(V,Y),params:[]};let O=["none"];if(W)O=[W(H.encoder)];return{sql:z(Z.value++,V),params:[V],typings:O}}if(b(H,b2))return{sql:z(Z.value++,H),params:[H],typings:["none"]};if(b(H,$$.Aliased)&&H.fieldAlias!==void 0)return{sql:G(H.fieldAlias),params:[]};if(b(H,R4)){if(H._.isWith)return{sql:G(H._.alias),params:[]};return this.buildQueryFromSourceParams([new g4("("),H._.sql,new g4(") "),new Qz(H._.alias)],Y)}if(fK(H)){if(H.schema)return{sql:G(H.schema)+"."+G(H.enumName),params:[]};return{sql:G(H.enumName),params:[]}}if(HD(H)){if(H.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([H.getSQL()],Y);return this.buildQueryFromSourceParams([new g4("("),H.getSQL(),new g4(")")],Y)}if(Q)return{sql:this.mapInlineParam(H,Y),params:[]};return{sql:z(Z.value++,H),params:[H],typings:["none"]}}))}mapInlineParam($,{escapeString:X}){if($===null)return"null";if(typeof $==="number"||typeof $==="boolean")return $.toString();if(typeof $==="string")return X($);if(typeof $==="object"){let Y=$.toString();if(Y==="[object Object]")return X(JSON.stringify($));return X(Y)}throw new Error("Unexpected param value: "+$)}getSQL(){return this}as($){if($===void 0)return this;return new $$.Aliased(this,$)}mapWith($){return this.decoder=typeof $==="function"?{mapFromDriverValue:$}:$,this}inlineParams(){return this.shouldInlineParams=!0,this}if($){return $?this:void 0}}class Qz{constructor($){this.value=$}static[_]="Name";brand;getSQL(){return new $$([this])}}function cK($){return typeof $==="object"&&$!==null&&"mapToDriverValue"in $&&typeof $.mapToDriverValue==="function"}var pK={mapFromDriverValue:($)=>$},dK={mapToDriverValue:($)=>$},z$$={...pK,...dK};class E1{constructor($,X=dK){this.value=$,this.encoder=X}static[_]="Param";brand;getSQL(){return new $$([this])}}function R($,...X){let Y=[];if(X.length>0||$.length>0&&$[0]!=="")Y.push(new g4($[0]));for(let[U,G]of X.entries())Y.push(G,new g4($[U+1]));return new $$(Y)}(($)=>{function X(){return new $$([])}$.empty=X;function Y(Z){return new $$(Z)}$.fromList=Y;function U(Z){return new $$([new g4(Z)])}$.raw=U;function G(Z,H){let V=[];for(let[O,w]of Z.entries()){if(O>0&&H!==void 0)V.push(H);V.push(w)}return new $$(V)}$.join=G;function z(Z){return new Qz(Z)}$.identifier=z;function W(Z){return new b2(Z)}$.placeholder=W;function Q(Z,H){return new E1(Z,H)}$.param=Q})(R||(R={}));(($)=>{class X{constructor(Y,U){this.sql=Y,this.fieldAlias=U}static[_]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new X(this.sql,this.fieldAlias)}}$.Aliased=X})($$||($$={}));class b2{constructor($){this.name=$}static[_]="Placeholder";getSQL(){return new $$([this])}}function VD($,X){return $.map((Y)=>{if(b(Y,b2)){if(!(Y.name in X))throw new Error(`No value for placeholder "${Y.name}" was provided`);return X[Y.name]}if(b(Y,E1)&&b(Y.value,b2)){if(!(Y.value.name in X))throw new Error(`No value for placeholder "${Y.value.name}" was provided`);return Y.encoder.mapToDriverValue(X[Y.value.name])}return Y})}var pb=Symbol.for("drizzle:IsDrizzleView");class o6{static[_]="View";[$4];[pb]=!0;constructor({name:$,schema:X,selectedFields:Y,query:U}){this[$4]={name:$,originalName:$,schema:X,selectedFields:Y,query:U,isExisting:!U,isAlias:!1}}getSQL(){return new $$([this])}}r$.prototype.getSQL=function(){return new $$([this])};t.prototype.getSQL=function(){return new $$([this])};R4.prototype.getSQL=function(){return new $$([this])};class w9{constructor($){this.table=$}static[_]="ColumnAliasProxyHandler";get($,X){if(X==="table")return this.table;return $[X]}}class B3{constructor($,X){this.alias=$,this.replaceOriginalName=X}static[_]="TableAliasProxyHandler";get($,X){if(X===t.Symbol.IsAlias)return!0;if(X===t.Symbol.Name)return this.alias;if(this.replaceOriginalName&&X===t.Symbol.OriginalName)return this.alias;if(X===$4)return{...$[$4],name:this.alias,isAlias:!0};if(X===t.Symbol.Columns){let U=$[t.Symbol.Columns];if(!U)return U;let G={};return Object.keys(U).map((z)=>{G[z]=new Proxy(U[z],new w9(new Proxy($,this)))}),G}let Y=$[X];if(b(Y,r$))return new Proxy(Y,new w9(new Proxy($,this)));return Y}}function Zz($,X){return new Proxy($,new B3(X,!1))}function D0($,X){return new Proxy($,new w9(new Proxy($.table,new B3(X,!1))))}function OD($,X){return new $$.Aliased(j3($.sql,X),$.fieldAlias)}function j3($,X){return R.join($.queryChunks.map((Y)=>{if(b(Y,r$))return D0(Y,X);if(b(Y,$$))return j3(Y,X);if(b(Y,$$.Aliased))return OD(Y,X);return Y}))}class Hz extends Error{static[_]="DrizzleError";constructor({message:$,cause:X}){super($);this.name="DrizzleError",this.cause=X}}class a0 extends Error{constructor($,X,Y){super(`Failed query: ${$}
|
|
128
|
-
params: ${X}`);if(this.query=$,this.params=X,this.cause=Y,Error.captureStackTrace(this,a0),Y)this.cause=Y}}class wD extends Hz{static[_]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class lK{static[_]="ConsoleLogWriter";write($){console.log($)}}class DD{static[_]="DefaultLogger";writer;constructor($){this.writer=$?.writer??new lK}logQuery($,X){let Y=X.map((G)=>{try{return JSON.stringify(G)}catch{return String(G)}}),U=Y.length?` -- params: [${Y.join(", ")}]`:"";this.writer.write(`Query: ${$}${U}`)}}class ED{static[_]="NoopLogger";logQuery(){}}class k6{static[_]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch($){return this.then(void 0,$)}finally($){return this.then((X)=>{return $?.(),X},(X)=>{throw $?.(),X})}then($,X){return this.execute().then($,X)}}function rK($,X,Y){let U={},G=$.reduce((z,{path:W,field:Q},Z)=>{let H;if(b(Q,r$))H=Q;else if(b(Q,$$))H=Q.decoder;else H=Q.sql.decoder;let V=z;for(let[O,w]of W.entries())if(O<W.length-1){if(!(w in V))V[w]={};V=V[w]}else{let D=X[Z],E=V[w]=D===null?null:H.mapFromDriverValue(D);if(Y&&b(Q,r$)&&W.length===2){let F=W[0];if(!(F in U))U[F]=E===null?i4(Q.table):!1;else if(typeof U[F]==="string"&&U[F]!==i4(Q.table))U[F]=!1}}return z},{});if(Y&&Object.keys(U).length>0){for(let[z,W]of Object.entries(U))if(typeof W==="string"&&!Y[W])G[z]=null}return G}function v1($,X){return Object.entries($).reduce((Y,[U,G])=>{if(typeof U!=="string")return Y;let z=X?[...X,U]:[U];if(b(G,r$)||b(G,$$)||b(G,$$.Aliased))Y.push({path:z,field:G});else if(b(G,t))Y.push(...v1(G[t.Symbol.Columns],z));else Y.push(...v1(G,z));return Y},[])}function P3($,X){let Y=Object.keys($),U=Object.keys(X);if(Y.length!==U.length)return!1;for(let[G,z]of Y.entries())if(z!==U[G])return!1;return!0}function Vz($,X){let Y=Object.entries(X).filter(([,U])=>U!==void 0).map(([U,G])=>{if(b(G,$$)||b(G,r$))return[U,G];else return[U,new E1(G,$[t.Symbol.Columns][U])]});if(Y.length===0)throw new Error("No values to set");return Object.fromEntries(Y)}function iK($,X){for(let Y of X)for(let U of Object.getOwnPropertyNames(Y.prototype)){if(U==="constructor")continue;Object.defineProperty($.prototype,U,Object.getOwnPropertyDescriptor(Y.prototype,U)||Object.create(null))}}function oK($){return $[t.Symbol.Columns]}function s0($){return b($,R4)?$._.alias:b($,o6)?$[$4].name:b($,$$)?void 0:$[t.Symbol.IsAlias]?$[t.Symbol.Name]:$[t.Symbol.BaseName]}function I$($,X){return{name:typeof $==="string"&&$.length>0?$:"",config:typeof $==="object"?$:X}}function nK($){if(typeof $!=="object"||$===null)return!1;if($.constructor.name!=="Object")return!1;if("logger"in $){let X=typeof $.logger;if(X!=="boolean"&&(X!=="object"||typeof $.logger.logQuery!=="function")&&X!=="undefined")return!1;return!0}if("schema"in $){let X=typeof $.schema;if(X!=="object"&&X!=="undefined")return!1;return!0}if("casing"in $){let X=typeof $.casing;if(X!=="string"&&X!=="undefined")return!1;return!0}if("mode"in $){if($.mode!=="default"||$.mode!=="planetscale"||$.mode!==void 0)return!1;return!0}if("connection"in $){let X=typeof $.connection;if(X!=="string"&&X!=="object"&&X!=="undefined")return!1;return!0}if("client"in $){let X=typeof $.client;if(X!=="object"&&X!=="function"&&X!=="undefined")return!1;return!0}if(Object.keys($).length===0)return!0;return!1}class f2 extends Y${static[_]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity($){if($){let{name:X,...Y}=$;this.config.generatedIdentity={type:"always",sequenceName:X,sequenceOptions:Y}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity($){if($){let{name:X,...Y}=$;this.config.generatedIdentity={type:"byDefault",sequenceName:X,sequenceOptions:Y}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class tK extends f2{static[_]="PgBigInt53Builder";constructor($){super($,"number","PgBigInt53")}build($){return new aK($,this.config)}}class aK extends i{static[_]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}}class sK extends f2{static[_]="PgBigInt64Builder";constructor($){super($,"bigint","PgBigInt64")}build($){return new eK($,this.config)}}class eK extends i{static[_]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue($){return BigInt($)}}function $_($,X){let{name:Y,config:U}=I$($,X);if(U.mode==="number")return new tK(Y);return new sK(Y)}class X_ extends Y${static[_]="PgBigSerial53Builder";constructor($){super($,"number","PgBigSerial53");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new Y_($,this.config)}}class Y_ extends i{static[_]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}}class G_ extends Y${static[_]="PgBigSerial64Builder";constructor($){super($,"bigint","PgBigSerial64");this.config.hasDefault=!0}build($){return new U_($,this.config)}}class U_ extends i{static[_]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue($){return BigInt($)}}function z_($,X){let{name:Y,config:U}=I$($,X);if(U.mode==="number")return new X_(Y);return new G_(Y)}class W_ extends Y${static[_]="PgBooleanBuilder";constructor($){super($,"boolean","PgBoolean")}build($){return new Q_($,this.config)}}class Q_ extends i{static[_]="PgBoolean";getSQLType(){return"boolean"}}function I3($){return new W_($??"")}class Z_ extends Y${static[_]="PgCharBuilder";constructor($,X){super($,"string","PgChar");this.config.length=X.length,this.config.enumValues=X.enum}build($){return new H_($,this.config)}}class H_ extends i{static[_]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}function V_($,X={}){let{name:Y,config:U}=I$($,X);return new Z_(Y,U)}class O_ extends Y${static[_]="PgCidrBuilder";constructor($){super($,"string","PgCidr")}build($){return new w_($,this.config)}}class w_ extends i{static[_]="PgCidr";getSQLType(){return"cidr"}}function D_($){return new O_($??"")}class E_ extends Y${static[_]="PgCustomColumnBuilder";constructor($,X,Y){super($,"custom","PgCustomColumn");this.config.fieldConfig=X,this.config.customTypeParams=Y}build($){return new N_($,this.config)}}class N_ extends i{static[_]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor($,X){super($,X);this.sqlName=X.customTypeParams.dataType(X.fieldConfig),this.mapTo=X.customTypeParams.toDriver,this.mapFrom=X.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue($){return typeof this.mapFrom==="function"?this.mapFrom($):$}mapToDriverValue($){return typeof this.mapTo==="function"?this.mapTo($):$}}function F_($){return(X,Y)=>{let{name:U,config:G}=I$(X,Y);return new E_(U,G,$)}}class e0 extends Y${static[_]="PgDateColumnBaseBuilder";defaultNow(){return this.default(R`now()`)}}class M_ extends e0{static[_]="PgDateBuilder";constructor($){super($,"date","PgDate")}build($){return new Oz($,this.config)}}class Oz extends i{static[_]="PgDate";getSQLType(){return"date"}mapFromDriverValue($){return new Date($)}mapToDriverValue($){return $.toISOString()}}class J_ extends e0{static[_]="PgDateStringBuilder";constructor($){super($,"string","PgDateString")}build($){return new wz($,this.config)}}class wz extends i{static[_]="PgDateString";getSQLType(){return"date"}}function A_($,X){let{name:Y,config:U}=I$($,X);if(U?.mode==="date")return new M_(Y);return new J_(Y)}class L_ extends Y${static[_]="PgDoublePrecisionBuilder";constructor($){super($,"number","PgDoublePrecision")}build($){return new K_($,this.config)}}class K_ extends i{static[_]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue($){if(typeof $==="string")return Number.parseFloat($);return $}}function __($){return new L_($??"")}class q_ extends Y${static[_]="PgInetBuilder";constructor($){super($,"string","PgInet")}build($){return new R_($,this.config)}}class R_ extends i{static[_]="PgInet";getSQLType(){return"inet"}}function T_($){return new q_($??"")}class v_ extends f2{static[_]="PgIntegerBuilder";constructor($){super($,"number","PgInteger")}build($){return new C_($,this.config)}}class C_ extends i{static[_]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue($){if(typeof $==="string")return Number.parseInt($);return $}}function x3($){return new v_($??"")}class B_ extends Y${static[_]="PgIntervalBuilder";constructor($,X){super($,"string","PgInterval");this.config.intervalConfig=X}build($){return new j_($,this.config)}}class j_ extends i{static[_]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let $=this.fields?` ${this.fields}`:"",X=this.precision?`(${this.precision})`:"";return`interval${$}${X}`}}function P_($,X={}){let{name:Y,config:U}=I$($,X);return new B_(Y,U)}class I_ extends Y${static[_]="PgJsonBuilder";constructor($){super($,"json","PgJson")}build($){return new Dz($,this.config)}}class Dz extends i{static[_]="PgJson";constructor($,X){super($,X)}getSQLType(){return"json"}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){if(typeof $==="string")try{return JSON.parse($)}catch{return $}return $}}function x_($){return new I_($??"")}class S_ extends Y${static[_]="PgJsonbBuilder";constructor($){super($,"json","PgJsonb")}build($){return new Ez($,this.config)}}class Ez extends i{static[_]="PgJsonb";constructor($,X){super($,X)}getSQLType(){return"jsonb"}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){if(typeof $==="string")try{return JSON.parse($)}catch{return $}return $}}function k_($){return new S_($??"")}class b_ extends Y${static[_]="PgLineBuilder";constructor($){super($,"array","PgLine")}build($){return new f_($,this.config)}}class f_ extends i{static[_]="PgLine";getSQLType(){return"line"}mapFromDriverValue($){let[X,Y,U]=$.slice(1,-1).split(",");return[Number.parseFloat(X),Number.parseFloat(Y),Number.parseFloat(U)]}mapToDriverValue($){return`{${$[0]},${$[1]},${$[2]}}`}}class h_ extends Y${static[_]="PgLineABCBuilder";constructor($){super($,"json","PgLineABC")}build($){return new g_($,this.config)}}class g_ extends i{static[_]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue($){let[X,Y,U]=$.slice(1,-1).split(",");return{a:Number.parseFloat(X),b:Number.parseFloat(Y),c:Number.parseFloat(U)}}mapToDriverValue($){return`{${$.a},${$.b},${$.c}}`}}function y_($,X){let{name:Y,config:U}=I$($,X);if(!U?.mode||U.mode==="tuple")return new b_(Y);return new h_(Y)}class m_ extends Y${static[_]="PgMacaddrBuilder";constructor($){super($,"string","PgMacaddr")}build($){return new u_($,this.config)}}class u_ extends i{static[_]="PgMacaddr";getSQLType(){return"macaddr"}}function c_($){return new m_($??"")}class p_ extends Y${static[_]="PgMacaddr8Builder";constructor($){super($,"string","PgMacaddr8")}build($){return new d_($,this.config)}}class d_ extends i{static[_]="PgMacaddr8";getSQLType(){return"macaddr8"}}function l_($){return new p_($??"")}class r_ extends Y${static[_]="PgNumericBuilder";constructor($,X,Y){super($,"string","PgNumeric");this.config.precision=X,this.config.scale=Y}build($){return new Nz($,this.config)}}class Nz extends i{static[_]="PgNumeric";precision;scale;constructor($,X){super($,X);this.precision=X.precision,this.scale=X.scale}mapFromDriverValue($){if(typeof $==="string")return $;return String($)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}}class i_ extends Y${static[_]="PgNumericNumberBuilder";constructor($,X,Y){super($,"number","PgNumericNumber");this.config.precision=X,this.config.scale=Y}build($){return new o_($,this.config)}}class o_ extends i{static[_]="PgNumericNumber";precision;scale;constructor($,X){super($,X);this.precision=X.precision,this.scale=X.scale}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}mapToDriverValue=String;getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}}class n_ extends Y${static[_]="PgNumericBigIntBuilder";constructor($,X,Y){super($,"bigint","PgNumericBigInt");this.config.precision=X,this.config.scale=Y}build($){return new t_($,this.config)}}class t_ extends i{static[_]="PgNumericBigInt";precision;scale;constructor($,X){super($,X);this.precision=X.precision,this.scale=X.scale}mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}}function a_($,X){let{name:Y,config:U}=I$($,X),G=U?.mode;return G==="number"?new i_(Y,U?.precision,U?.scale):G==="bigint"?new n_(Y,U?.precision,U?.scale):new r_(Y,U?.precision,U?.scale)}class s_ extends Y${static[_]="PgPointTupleBuilder";constructor($){super($,"array","PgPointTuple")}build($){return new e_($,this.config)}}class e_ extends i{static[_]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue($){if(typeof $==="string"){let[X,Y]=$.slice(1,-1).split(",");return[Number.parseFloat(X),Number.parseFloat(Y)]}return[$.x,$.y]}mapToDriverValue($){return`(${$[0]},${$[1]})`}}class $q extends Y${static[_]="PgPointObjectBuilder";constructor($){super($,"json","PgPointObject")}build($){return new Xq($,this.config)}}class Xq extends i{static[_]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue($){if(typeof $==="string"){let[X,Y]=$.slice(1,-1).split(",");return{x:Number.parseFloat(X),y:Number.parseFloat(Y)}}return $}mapToDriverValue($){return`(${$.x},${$.y})`}}function Yq($,X){let{name:Y,config:U}=I$($,X);if(!U?.mode||U.mode==="tuple")return new s_(Y);return new $q(Y)}function db($){let X=[];for(let Y=0;Y<$.length;Y+=2)X.push(Number.parseInt($.slice(Y,Y+2),16));return new Uint8Array(X)}function Gq($,X){let Y=new ArrayBuffer(8),U=new DataView(Y);for(let G=0;G<8;G++)U.setUint8(G,$[X+G]);return U.getFloat64(0,!0)}function ND($){let X=db($),Y=0,U=X[Y];Y+=1;let G=new DataView(X.buffer),z=G.getUint32(Y,U===1);Y+=4;let W;if(z&536870912)W=G.getUint32(Y,U===1),Y+=4;if((z&65535)===1){let Q=Gq(X,Y);Y+=8;let Z=Gq(X,Y);return Y+=8,[Q,Z]}throw new Error("Unsupported geometry type")}class Uq extends Y${static[_]="PgGeometryBuilder";constructor($){super($,"array","PgGeometry")}build($){return new zq($,this.config)}}class zq extends i{static[_]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue($){return ND($)}mapToDriverValue($){return`point(${$[0]} ${$[1]})`}}class Wq extends Y${static[_]="PgGeometryObjectBuilder";constructor($){super($,"json","PgGeometryObject")}build($){return new Qq($,this.config)}}class Qq extends i{static[_]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue($){let X=ND($);return{x:X[0],y:X[1]}}mapToDriverValue($){return`point(${$.x} ${$.y})`}}function Zq($,X){let{name:Y,config:U}=I$($,X);if(!U?.mode||U.mode==="tuple")return new Uq(Y);return new Wq(Y)}class Hq extends Y${static[_]="PgRealBuilder";constructor($,X){super($,"number","PgReal");this.config.length=X}build($){return new Vq($,this.config)}}class Vq extends i{static[_]="PgReal";constructor($,X){super($,X)}getSQLType(){return"real"}mapFromDriverValue=($)=>{if(typeof $==="string")return Number.parseFloat($);return $}}function Oq($){return new Hq($??"")}class wq extends Y${static[_]="PgSerialBuilder";constructor($){super($,"number","PgSerial");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new Dq($,this.config)}}class Dq extends i{static[_]="PgSerial";getSQLType(){return"serial"}}function Eq($){return new wq($??"")}class Nq extends f2{static[_]="PgSmallIntBuilder";constructor($){super($,"number","PgSmallInt")}build($){return new Fq($,this.config)}}class Fq extends i{static[_]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=($)=>{if(typeof $==="string")return Number($);return $}}function Mq($){return new Nq($??"")}class Jq extends Y${static[_]="PgSmallSerialBuilder";constructor($){super($,"number","PgSmallSerial");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new Aq($,this.config)}}class Aq extends i{static[_]="PgSmallSerial";getSQLType(){return"smallserial"}}function Lq($){return new Jq($??"")}class Kq extends Y${static[_]="PgTextBuilder";constructor($,X){super($,"string","PgText");this.config.enumValues=X.enum}build($){return new _q($,this.config)}}class _q extends i{static[_]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function qq($,X={}){let{name:Y,config:U}=I$($,X);return new Kq(Y,U)}class Rq extends e0{constructor($,X,Y){super($,"string","PgTime");this.withTimezone=X,this.precision=Y,this.config.withTimezone=X,this.config.precision=Y}static[_]="PgTimeBuilder";build($){return new Fz($,this.config)}}class Fz extends i{static[_]="PgTime";withTimezone;precision;constructor($,X){super($,X);this.withTimezone=X.withTimezone,this.precision=X.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function Tq($,X={}){let{name:Y,config:U}=I$($,X);return new Rq(Y,U.withTimezone??!1,U.precision)}class vq extends e0{static[_]="PgTimestampBuilder";constructor($,X,Y){super($,"date","PgTimestamp");this.config.withTimezone=X,this.config.precision=Y}build($){return new Mz($,this.config)}}class Mz extends i{static[_]="PgTimestamp";withTimezone;precision;constructor($,X){super($,X);this.withTimezone=X.withTimezone,this.precision=X.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=($)=>{return new Date(this.withTimezone?$:$+"+0000")};mapToDriverValue=($)=>{return $.toISOString()}}class Cq extends e0{static[_]="PgTimestampStringBuilder";constructor($,X,Y){super($,"string","PgTimestampString");this.config.withTimezone=X,this.config.precision=Y}build($){return new Jz($,this.config)}}class Jz extends i{static[_]="PgTimestampString";withTimezone;precision;constructor($,X){super($,X);this.withTimezone=X.withTimezone,this.precision=X.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function Bq($,X={}){let{name:Y,config:U}=I$($,X);if(U?.mode==="string")return new Cq(Y,U.withTimezone??!1,U.precision);return new vq(Y,U?.withTimezone??!1,U?.precision)}class jq extends Y${static[_]="PgUUIDBuilder";constructor($){super($,"string","PgUUID")}defaultRandom(){return this.default(R`gen_random_uuid()`)}build($){return new Az($,this.config)}}class Az extends i{static[_]="PgUUID";getSQLType(){return"uuid"}}function C1($){return new jq($??"")}class Pq extends Y${static[_]="PgVarcharBuilder";constructor($,X){super($,"string","PgVarchar");this.config.length=X.length,this.config.enumValues=X.enum}build($){return new Iq($,this.config)}}class Iq extends i{static[_]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function H6($,X={}){let{name:Y,config:U}=I$($,X);return new Pq(Y,U)}class xq extends Y${static[_]="PgBinaryVectorBuilder";constructor($,X){super($,"string","PgBinaryVector");this.config.dimensions=X.dimensions}build($){return new Sq($,this.config)}}class Sq extends i{static[_]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function kq($,X){let{name:Y,config:U}=I$($,X);return new xq(Y,U)}class bq extends Y${static[_]="PgHalfVectorBuilder";constructor($,X){super($,"array","PgHalfVector");this.config.dimensions=X.dimensions}build($){return new fq($,this.config)}}class fq extends i{static[_]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){return $.slice(1,-1).split(",").map((X)=>Number.parseFloat(X))}}function hq($,X){let{name:Y,config:U}=I$($,X);return new bq(Y,U)}class gq extends Y${static[_]="PgSparseVectorBuilder";constructor($,X){super($,"string","PgSparseVector");this.config.dimensions=X.dimensions}build($){return new yq($,this.config)}}class yq extends i{static[_]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}function mq($,X){let{name:Y,config:U}=I$($,X);return new gq(Y,U)}class uq extends Y${static[_]="PgVectorBuilder";constructor($,X){super($,"array","PgVector");this.config.dimensions=X.dimensions}build($){return new cq($,this.config)}}class cq extends i{static[_]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){return $.slice(1,-1).split(",").map((X)=>Number.parseFloat(X))}}function pq($,X){let{name:Y,config:U}=I$($,X);return new uq(Y,U)}function dq(){return{bigint:$_,bigserial:z_,boolean:I3,char:V_,cidr:D_,customType:F_,date:A_,doublePrecision:__,inet:T_,integer:x3,interval:P_,json:x_,jsonb:k_,line:y_,macaddr:c_,macaddr8:l_,numeric:a_,point:Yq,geometry:Zq,real:Oq,serial:Eq,smallint:Mq,smallserial:Lq,text:qq,time:Tq,timestamp:Bq,uuid:C1,varchar:H6,bit:kq,halfvec:hq,sparsevec:mq,vector:pq}}var FD=Symbol.for("drizzle:PgInlineForeignKeys"),lq=Symbol.for("drizzle:EnableRLS");class y4 extends t{static[_]="PgTable";static Symbol=Object.assign({},t.Symbol,{InlineForeignKeys:FD,EnableRLS:lq});[FD]=[];[lq]=!1;[t.Symbol.ExtraConfigBuilder]=void 0;[t.Symbol.ExtraConfigColumns]={}}function lb($,X,Y,U,G=$){let z=new y4($,U,G),W=typeof X==="function"?X(dq()):X,Q=Object.fromEntries(Object.entries(W).map(([V,O])=>{let w=O;w.setName(V);let D=w.build(z);return z[FD].push(...w.buildForeignKeys(D,z)),[V,D]})),Z=Object.fromEntries(Object.entries(W).map(([V,O])=>{let w=O;w.setName(V);let D=w.buildExtraConfigColumn(z);return[V,D]})),H=Object.assign(z,Q);if(H[t.Symbol.Columns]=Q,H[t.Symbol.ExtraConfigColumns]=Z,Y)H[y4.Symbol.ExtraConfigBuilder]=Y;return Object.assign(H,{enableRLS:()=>{return H[y4.Symbol.EnableRLS]=!0,H}})}var h2=($,X,Y)=>{return lb($,X,Y,void 0)};function rq(...$){if($[0].columns)return new S3($[0].columns,$[0].name);return new S3($)}class S3{static[_]="PgPrimaryKeyBuilder";columns;name;constructor($,X){this.columns=$,this.name=X}build($){return new iq($,this.columns,this.name)}}class iq{constructor($,X,Y){this.table=$,this.columns=X,this.name=Y}static[_]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[y4.Symbol.Name]}_${this.columns.map(($)=>$.name).join("_")}_pk`}}function n6($,X){if(cK(X)&&!HD($)&&!b($,E1)&&!b($,b2)&&!b($,r$)&&!b($,t)&&!b($,o6))return new E1($,X);return $}var Lz=($,X)=>{return R`${$} = ${n6(X,$)}`},oq=($,X)=>{return R`${$} <> ${n6(X,$)}`};function k3(...$){let X=$.filter((Y)=>Y!==void 0);if(X.length===0)return;if(X.length===1)return new $$(X);return new $$([new g4("("),R.join(X,new g4(" and ")),new g4(")")])}function nq(...$){let X=$.filter((Y)=>Y!==void 0);if(X.length===0)return;if(X.length===1)return new $$(X);return new $$([new g4("("),R.join(X,new g4(" or ")),new g4(")")])}function tq($){return R`not ${$}`}var Kz=($,X)=>{return R`${$} > ${n6(X,$)}`},aq=($,X)=>{return R`${$} >= ${n6(X,$)}`},sq=($,X)=>{return R`${$} < ${n6(X,$)}`},eq=($,X)=>{return R`${$} <= ${n6(X,$)}`};function $R($,X){if(Array.isArray(X)){if(X.length===0)return R`false`;return R`${$} in ${X.map((Y)=>n6(Y,$))}`}return R`${$} in ${n6(X,$)}`}function XR($,X){if(Array.isArray(X)){if(X.length===0)return R`true`;return R`${$} not in ${X.map((Y)=>n6(Y,$))}`}return R`${$} not in ${n6(X,$)}`}function YR($){return R`${$} is null`}function GR($){return R`${$} is not null`}function UR($){return R`exists ${$}`}function zR($){return R`not exists ${$}`}function WR($,X,Y){return R`${$} between ${n6(X,$)} and ${n6(Y,$)}`}function QR($,X,Y){return R`${$} not between ${n6(X,$)} and ${n6(Y,$)}`}function ZR($,X){return R`${$} like ${X}`}function HR($,X){return R`${$} not like ${X}`}function VR($,X){return R`${$} ilike ${X}`}function OR($,X){return R`${$} not ilike ${X}`}function wR($){return R`${$} asc`}function DR($){return R`${$} desc`}class MD{constructor($,X,Y){this.sourceTable=$,this.referencedTable=X,this.relationName=Y,this.referencedTableName=X[t.Symbol.Name]}static[_]="Relation";referencedTableName;fieldName}class ER{constructor($,X){this.table=$,this.config=X}static[_]="Relations"}class g2 extends MD{constructor($,X,Y,U){super($,X,Y?.relationName);this.config=Y,this.isNullable=U}static[_]="One";withFieldName($){let X=new g2(this.sourceTable,this.referencedTable,this.config,this.isNullable);return X.fieldName=$,X}}class b3 extends MD{constructor($,X,Y){super($,X,Y?.relationName);this.config=Y}static[_]="Many";withFieldName($){let X=new b3(this.sourceTable,this.referencedTable,this.config);return X.fieldName=$,X}}function NR(){return{and:k3,between:WR,eq:Lz,exists:UR,gt:Kz,gte:aq,ilike:VR,inArray:$R,isNull:YR,isNotNull:GR,like:ZR,lt:sq,lte:eq,ne:oq,not:tq,notBetween:QR,notExists:zR,notLike:HR,notIlike:OR,notInArray:XR,or:nq,sql:R}}function FR(){return{sql:R,asc:wR,desc:DR}}function MR($,X){if(Object.keys($).length===1&&"default"in $&&!b($.default,t))$=$.default;let Y={},U={},G={};for(let[z,W]of Object.entries($))if(b(W,t)){let Q=y8(W),Z=U[Q];Y[Q]=z,G[z]={tsName:z,dbName:W[t.Symbol.Name],schema:W[t.Symbol.Schema],columns:W[t.Symbol.Columns],relations:Z?.relations??{},primaryKey:Z?.primaryKey??[]};for(let V of Object.values(W[t.Symbol.Columns]))if(V.primary)G[z].primaryKey.push(V);let H=W[t.Symbol.ExtraConfigBuilder]?.(W[t.Symbol.ExtraConfigColumns]);if(H){for(let V of Object.values(H))if(b(V,S3))G[z].primaryKey.push(...V.columns)}}else if(b(W,ER)){let Q=y8(W.table),Z=Y[Q],H=W.config(X(W.table)),V;for(let[O,w]of Object.entries(H))if(Z){let D=G[Z];if(D.relations[O]=w,V)D.primaryKey.push(...V)}else{if(!(Q in U))U[Q]={relations:{},primaryKey:V};U[Q].relations[O]=w}}return{tables:G,tableNamesMap:Y}}function rb($){return function X(Y,U){return new g2($,Y,U,U?.fields.reduce((G,z)=>G&&z.notNull,!0)??!1)}}function ib($){return function X(Y,U){return new b3($,Y,U)}}function JR($,X,Y){if(b(Y,g2)&&Y.config)return{fields:Y.config.fields,references:Y.config.references};let U=X[y8(Y.referencedTable)];if(!U)throw new Error(`Table "${Y.referencedTable[t.Symbol.Name]}" not found in schema`);let G=$[U];if(!G)throw new Error(`Table "${U}" not found in schema`);let z=Y.sourceTable,W=X[y8(z)];if(!W)throw new Error(`Table "${z[t.Symbol.Name]}" not found in schema`);let Q=[];for(let Z of Object.values(G.relations))if(Y.relationName&&Y!==Z&&Z.relationName===Y.relationName||!Y.relationName&&Z.referencedTable===Y.sourceTable)Q.push(Z);if(Q.length>1)throw Y.relationName?new Error(`There are multiple relations with name "${Y.relationName}" in table "${U}"`):new Error(`There are multiple relations between "${U}" and "${Y.sourceTable[t.Symbol.Name]}". Please specify relation name`);if(Q[0]&&b(Q[0],g2)&&Q[0].config)return{fields:Q[0].config.references,references:Q[0].config.fields};throw new Error(`There is not enough information to infer relation "${W}.${Y.fieldName}"`)}function AR($){return{one:rb($),many:ib($)}}function _z($,X,Y,U,G=(z)=>z){let z={};for(let[W,Q]of U.entries())if(Q.isJson){let Z=X.relations[Q.tsKey],H=Y[W],V=typeof H==="string"?JSON.parse(H):H;z[Q.tsKey]=b(Z,g2)?V&&_z($,$[Q.relationTableTsKey],V,Q.selection,G):V.map((O)=>_z($,$[Q.relationTableTsKey],O,Q.selection,G))}else{let Z=G(Y[W]),H=Q.field,V;if(b(H,r$))V=H;else if(b(H,$$))V=H.decoder;else V=H.sql.decoder;z[Q.tsKey]=Z===null?null:V.mapFromDriverValue(Z)}return z}import hm from"path";import Mf from"os";import Jf from"fs";var qz=new Map,JD=new Map,AD=Symbol("OriginError"),D9={};class B1 extends Promise{constructor($,X,Y,U,G={}){let z,W;super((Q,Z)=>{z=Q,W=Z});this.tagged=Array.isArray($.raw),this.strings=$,this.args=X,this.handler=Y,this.canceller=U,this.options=G,this.state=null,this.statement=null,this.resolve=(Q)=>(this.active=!1,z(Q)),this.reject=(Q)=>(this.active=!1,W(Q)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[AD]=this.handler.debug?new Error:this.tagged&&ob(this.strings)}get origin(){return(this.handler.debug?this[AD].stack:this.tagged&&JD.has(this.strings)?JD.get(this.strings):JD.set(this.strings,this[AD].stack).get(this.strings))||""}static get[Symbol.species](){return Promise}cancel(){return this.canceller&&(this.canceller(this),this.canceller=null)}simple(){return this.options.simple=!0,this.options.prepare=!1,this}async readable(){return this.simple(),this.streaming=!0,this}async writable(){return this.simple(),this.streaming=!0,this}cursor($=1,X){if(this.options.simple=!1,typeof $==="function")X=$,$=1;if(this.cursorRows=$,typeof X==="function")return this.cursorFn=X,this;let Y;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};Y&&Y();let U=new Promise((G,z)=>{this.cursorFn=(W)=>{return G({value:W,done:!1}),new Promise((Q)=>Y=Q)},this.resolve=()=>(this.active=!1,G({done:!0})),this.reject=(W)=>(this.active=!1,z(W))});return this.execute(),U},return(){return Y&&Y(D9),{done:!0}}})}}describe(){return this.options.simple=!1,this.onlyDescribe=this.options.prepare=!0,this}stream(){throw new Error(".stream has been renamed to .forEach")}forEach($){return this.forEachFn=$,this.handle(),this}raw(){return this.isRaw=!0,this}values(){return this.isRaw="values",this}async handle(){!this.executed&&(this.executed=!0)&&await 1&&this.handler(this)}execute(){return this.handle(),this}then(){return this.handle(),super.then.apply(this,arguments)}catch(){return this.handle(),super.catch.apply(this,arguments)}finally(){return this.handle(),super.finally.apply(this,arguments)}}function ob($){if(qz.has($))return qz.get($);let X=Error.stackTraceLimit;return Error.stackTraceLimit=4,qz.set($,new Error),Error.stackTraceLimit=X,qz.get($)}class E9 extends Error{constructor($){super($.message);this.name=this.constructor.name,Object.assign(this,$)}}var B4={connection:LR,postgres:KR,generic:_R,notSupported:qR};function LR($,X,Y){let{host:U,port:G}=Y||X,z=Object.assign(new Error("write "+$+" "+(X.path||U+":"+G)),{code:$,errno:$,address:X.path||U},X.path?{}:{port:G});return Error.captureStackTrace(z,LR),z}function KR($){let X=new E9($);return Error.captureStackTrace(X,KR),X}function _R($,X){let Y=Object.assign(new Error($+": "+X),{code:$});return Error.captureStackTrace(Y,_R),Y}function qR($){let X=Object.assign(new Error($+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:$});return Error.captureStackTrace(X,qR),X}var nb={string:{to:25,from:null,serialize:($)=>""+$},number:{to:0,from:[21,23,26,700,701],serialize:($)=>""+$,parse:($)=>+$},json:{to:114,from:[114,3802],serialize:($)=>JSON.stringify($),parse:($)=>JSON.parse($)},boolean:{to:16,from:16,serialize:($)=>$===!0?"t":"f",parse:($)=>$==="t"},date:{to:1184,from:[1082,1114,1184],serialize:($)=>($ instanceof Date?$:new Date($)).toISOString(),parse:($)=>new Date($)},bytea:{to:17,from:17,serialize:($)=>"\\x"+Buffer.from($).toString("hex"),parse:($)=>Buffer.from($.slice(2),"hex")}};class vz{then(){LD()}catch(){LD()}finally(){LD()}}class y3 extends vz{constructor($){super();this.value=jz($)}}class E0 extends vz{constructor($,X,Y){super();this.value=$,this.type=X,this.array=Y}}class Cz extends vz{constructor($,X){super();this.first=$,this.rest=X}build($,X,Y,U){let G=tb.map(([z,W])=>({fn:W,i:$.search(z)})).sort((z,W)=>z.i-W.i).pop();return G.i===-1?TD(this.first,U):G.fn(this.first,this.rest,X,Y,U)}}function Bz($,X,Y,U){let G=$ instanceof E0?$.value:$;if(G===void 0){if($ instanceof E0?$.value=U.transform.undefined:G=$=U.transform.undefined,G===void 0)throw B4.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+Y.push($ instanceof E0?(X.push($.value),$.array?$.array[$.type||Tz($.value)]||$.type||CR($.value):$.type):(X.push($),Tz($)))}var TR=jR(nb);function qD($,X,Y,U,G,z){for(let W=1;W<$.strings.length;W++)X+=RD(X,Y,U,G,z)+$.strings[W],Y=$.args[W];return X}function RD($,X,Y,U,G){return X instanceof Cz?X.build($,Y,U,G):X instanceof B1?_D(X,Y,U,G):X instanceof y3?X.value:X&&X[0]instanceof B1?X.reduce((z,W)=>z+" "+_D(W,Y,U,G),""):Bz(X,Y,U,G)}function _D($,X,Y,U){return $.fragment=!0,qD($,$.strings[0],$.args[0],X,Y,U)}function vR($,X,Y,U,G){return $.map((z)=>"("+U.map((W)=>RD("values",z[W],X,Y,G)).join(",")+")").join(",")}function RR($,X,Y,U,G){let z=Array.isArray($[0]),W=X.length?X.flat():Object.keys(z?$[0]:$);return vR(z?$:[$],Y,U,W,G)}function Rz($,X,Y,U,G){if(typeof $==="string"&&($=[$].concat(X)),Array.isArray($))return TD($,G);let z;return(X.length?X.flat():Object.keys($)).map((Q)=>{return z=$[Q],(z instanceof B1?_D(z,Y,U,G):z instanceof y3?z.value:Bz(z,Y,U,G))+" as "+jz(G.transform.column.to?G.transform.column.to(Q):Q)}).join(",")}var tb=Object.entries({values:RR,in:(...$)=>{let X=RR(...$);return X==="()"?"(null)":X},select:Rz,as:Rz,returning:Rz,"\\(":Rz,update($,X,Y,U,G){return(X.length?X.flat():Object.keys($)).map((z)=>jz(G.transform.column.to?G.transform.column.to(z):z)+"="+RD("values",$[z],Y,U,G))},insert($,X,Y,U,G){let z=X.length?X.flat():Object.keys(Array.isArray($)?$[0]:$);return"("+TD(z,G)+")values"+vR(Array.isArray($)?$:[$],Y,U,z,G)}}).map(([$,X])=>[new RegExp("((?:^|[\\s(])"+$+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),X]);function LD(){throw B4.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:ab,parsers:sb}=TR;function CR($){if(Array.isArray($))return CR($[0]);return typeof $==="string"?1009:0}var BR=function($){let X=jR($||{});return{serializers:Object.assign({},ab,X.serializers),parsers:Object.assign({},sb,X.parsers)}};function jR($){return Object.keys($).reduce((X,Y)=>{if($[Y].from&&[].concat($[Y].from).forEach((U)=>X.parsers[U]=$[Y].parse),$[Y].serialize)X.serializers[$[Y].to]=$[Y].serialize,$[Y].from&&[].concat($[Y].from).forEach((U)=>X.serializers[U]=$[Y].serialize);return X},{parsers:{},serializers:{}})}function TD($,{transform:{column:X}}){return $.map((Y)=>jz(X.to?X.to(Y):Y)).join(",")}var jz=function $(X){return'"'+X.replace(/"/g,'""').replace(/\./g,'"."')+'"'},Tz=function $(X){return X instanceof E0?X.type:X instanceof Date?1184:X instanceof Uint8Array?17:X===!0||X===!1?16:typeof X==="bigint"?20:Array.isArray(X)?$(X[0]):0},eb=/\\/g,$f=/"/g;function Xf($){return $.replace(eb,"\\\\").replace($f,"\\\"")}var PR=function $(X,Y,U,G){if(Array.isArray(X)===!1)return X;if(!X.length)return"{}";let z=X[0],W=G===1020?";":",";if(Array.isArray(z)&&!z.type)return"{"+X.map((Q)=>$(Q,Y,U,G)).join(W)+"}";return"{"+X.map((Q)=>{if(Q===void 0){if(Q=U.transform.undefined,Q===void 0)throw B4.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return Q===null?"null":'"'+Xf(Y?Y(Q.type?Q.value:Q):""+Q)+'"'}).join(W)+"}"},KD={i:0,char:null,str:"",quoted:!1,last:0},IR=function $(X,Y,U){return KD.i=KD.last=0,xR(KD,X,Y,U)};function xR($,X,Y,U){let G=[],z=U===1020?";":",";for(;$.i<X.length;$.i++){if($.char=X[$.i],$.quoted)if($.char==="\\")$.str+=X[++$.i];else if($.char==='"')G.push(Y?Y($.str):$.str),$.str="",$.quoted=X[$.i+1]==='"',$.last=$.i+2;else $.str+=$.char;else if($.char==='"')$.quoted=!0;else if($.char==="{")$.last=++$.i,G.push(xR($,X,Y,U));else if($.char==="}"){$.quoted=!1,$.last<$.i&&G.push(Y?Y(X.slice($.last,$.i)):X.slice($.last,$.i)),$.last=$.i+1;break}else if($.char===z&&$.p!=="}"&&$.p!=='"')G.push(Y?Y(X.slice($.last,$.i)):X.slice($.last,$.i)),$.last=$.i+1;$.p=$.char}return $.last<$.i&&G.push(Y?Y(X.slice($.last,$.i+1)):X.slice($.last,$.i+1)),G}var m8=($)=>{let X=$[0];for(let Y=1;Y<$.length;Y++)X+=$[Y]==="_"?$[++Y].toUpperCase():$[Y];return X},u8=($)=>{let X=$[0].toUpperCase();for(let Y=1;Y<$.length;Y++)X+=$[Y]==="_"?$[++Y].toUpperCase():$[Y];return X},c8=($)=>$.replace(/_/g,"-"),f3=($)=>$.replace(/([A-Z])/g,"_$1").toLowerCase(),h3=($)=>($.slice(0,1)+$.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),g3=($)=>$.replace(/-/g,"_");function vD($){return function X(Y,U){return typeof Y==="object"&&Y!==null&&(U.type===114||U.type===3802)?Array.isArray(Y)?Y.map((G)=>X(G,U)):Object.entries(Y).reduce((G,[z,W])=>Object.assign(G,{[$(z)]:X(W,U)}),{}):Y}}m8.column={from:m8};m8.value={from:vD(m8)};f3.column={to:f3};var CD={...m8};CD.column.to=f3;u8.column={from:u8};u8.value={from:vD(u8)};h3.column={to:h3};var BD={...u8};BD.column.to=h3;c8.column={from:c8};c8.value={from:vD(c8)};g3.column={to:g3};var jD={...c8};jD.column.to=g3;import SR from"net";import zf from"tls";import m3 from"crypto";import PD from"stream";import{performance as kR}from"perf_hooks";class p8 extends Array{constructor(){super();Object.defineProperties(this,{count:{value:null,writable:!0},state:{value:null,writable:!0},command:{value:null,writable:!0},columns:{value:null,writable:!0},statement:{value:null,writable:!0}})}static get[Symbol.species](){return Array}}var N1=Yf;function Yf($=[]){let X=$.slice(),Y=0;return{get length(){return X.length-Y},remove:(U)=>{let G=X.indexOf(U);return G===-1?null:(X.splice(G,1),U)},push:(U)=>(X.push(U),U),shift:()=>{let U=X[Y++];if(Y===X.length)Y=0,X=[];else X[Y-1]=void 0;return U}}}var V6=Buffer.allocUnsafe(256),Gf="BCcDdEFfHPpQSX".split("").reduce(($,X)=>{let Y=X.charCodeAt(0);return $[X]=()=>{return V6[0]=Y,d$.i=5,d$},$},{}),d$=Object.assign(Uf,Gf,{N:String.fromCharCode(0),i:0,inc($){return d$.i+=$,d$},str($){let X=Buffer.byteLength($);return Pz(X),d$.i+=V6.write($,d$.i,X,"utf8"),d$},i16($){return Pz(2),V6.writeUInt16BE($,d$.i),d$.i+=2,d$},i32($,X){if(X||X===0)return V6.writeUInt32BE($,X),d$;return Pz(4),V6.writeUInt32BE($,d$.i),d$.i+=4,d$},z($){return Pz($),V6.fill(0,d$.i,d$.i+$),d$.i+=$,d$},raw($){return V6=Buffer.concat([V6.subarray(0,d$.i),$]),d$.i=V6.length,d$},end($=1){V6.writeUInt32BE(d$.i-$,$);let X=V6.subarray(0,d$.i);return d$.i=0,V6=Buffer.allocUnsafe(256),X}}),V$=d$;function Pz($){if(V6.length-d$.i<$){let X=V6,Y=X.length;V6=Buffer.allocUnsafe(Y+(Y>>1)+$),X.copy(V6)}}function Uf(){return d$.i=0,d$}var SD=hR,Wf=1,y2=V$().S().end(),bR=V$().H().end(),Qf=V$().i32(8).i32(80877103).end(8),Zf=Buffer.concat([V$().E().str(V$.N).i32(0).end(),y2]),Hf=V$().D().str("S").str(V$.N).end(),N9=()=>{},Vf=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),Of={83:"severity_local",86:"severity",67:"code",77:"message",68:"detail",72:"hint",80:"position",112:"internal_position",113:"internal_query",87:"where",115:"schema_name",116:"table_name",99:"column_name",100:"data type_name",110:"constraint_name",70:"file",76:"line",82:"routine"};function hR($,X={},{onopen:Y=N9,onend:U=N9,onclose:G=N9}={}){let{ssl:z,max:W,user:Q,host:Z,port:H,database:V,parsers:O,transform:w,onnotice:D,onnotify:E,onparameter:F,max_pipeline:J,keep_alive:A,backoff:L,target_session_attrs:T}=$,q=N1(),v=Wf++,I={pid:null,secret:null},S=xD(LW,$.idle_timeout),y=xD(LW,$.max_lifetime),r=xD(RB,$.connect_timeout),j=null,X$,l=new p8,W$=Buffer.alloc(0),L$=$.fetch_types,b$={},L4={},X6=Math.random().toString(36).slice(2),c=1,H$=0,f$=0,n$=0,P4=0,_$=0,c$=0,T4=0,V4=null,G4=null,Y6=!1,t$=null,S1=null,o4=null,O2=null,I4=null,U4=null,k1=null,t1=null,s=null,g9=null,G6={queue:X.closed,idleTimer:S,connect(K){o4=K,TN()},terminate:m9,execute:y9,cancel:LB,end:LW,count:0,id:v};return X.closed&&X.closed.push(G6),G6;async function AB(){let K;try{K=$.socket?await Promise.resolve($.socket($)):new SR.Socket}catch(P){e8(P);return}return K.on("error",e8),K.on("close",vN),K.on("drain",qN),K}async function LB({pid:K,secret:P},w$,h$){try{X$=V$().i32(16).i32(80877102).i32(K).i32(P).end(16),await RN(),j.once("error",h$),j.once("close",w$)}catch(M4){h$(M4)}}function y9(K){if(Y6)return q5(K,B4.connection("CONNECTION_DESTROYED",$));if(K.cancelled)return;try{return K.state=I,s?q.push(K):(s=K,s.active=!0),qB(K),n4(KB(K))&&!K.describeFirst&&!K.cursorFn&&q.length<J&&(!K.options.onexecute||K.options.onexecute(G6))}catch(P){return q.length===0&&n4(y2),a1(P),!0}}function KB(K){if(K.parameters.length>=65534)throw B4.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return K.options.simple?V$().Q().str(K.statement.string+V$.N).end():K.describeFirst?Buffer.concat([LN(K),bR]):K.prepare?K.prepared?_5(K):Buffer.concat([LN(K),_5(K)]):_B(K)}function LN(K){return Buffer.concat([BN(K.statement.string,K.parameters,K.statement.types,K.statement.name),Zj("S",K.statement.name)])}function _5(K){return Buffer.concat([Qj(K.parameters,K.statement.types,K.statement.name,K.cursorName),K.cursorFn?jN("",K.cursorRows):Zf])}function _B(K){return Buffer.concat([BN(K.statement.string,K.parameters,K.statement.types),Hf,_5(K)])}function qB(K){let P=[],w$=[],h$=qD(K,K.strings[0],K.args[0],P,w$,$);!K.tagged&&K.args.forEach((M4)=>Bz(M4,P,w$,$)),K.prepare=$.prepare&&("prepare"in K.options?K.options.prepare:!0),K.string=h$,K.signature=K.prepare&&w$+h$,K.onlyDescribe&&delete L4[K.signature],K.parameters=K.parameters||P,K.prepared=K.prepare&&K.signature in L4,K.describeFirst=K.onlyDescribe||P.length&&!K.prepared,K.statement=K.prepared?L4[K.signature]:{string:h$,types:w$,name:K.prepare?X6+c++:""},typeof $.debug==="function"&&$.debug(v,h$,P,w$)}function n4(K,P){if(U4=U4?Buffer.concat([U4,K]):Buffer.from(K),P||U4.length>=1024)return KN(P);return G4===null&&(G4=setImmediate(KN)),!0}function KN(K){let P=j.write(U4,K);return G4!==null&&clearImmediate(G4),U4=G4=null,P}function RB(){a1(B4.connection("CONNECT_TIMEOUT",$,j)),j.destroy()}async function _N(){if(n4(Qf),!await new Promise((P)=>j.once("data",(w$)=>P(w$[0]===83)))&&z==="prefer")return s8();j.removeAllListeners(),j=zf.connect({socket:j,servername:SR.isIP(j.host)?void 0:j.host,...z==="require"||z==="allow"||z==="prefer"?{rejectUnauthorized:!1}:z==="verify-full"?{}:typeof z==="object"?z:{}}),j.on("secureConnect",s8),j.on("error",e8),j.on("close",vN),j.on("drain",qN)}function qN(){!s&&Y(G6)}function AW(K){if(t$){if(t$.push(K),f$-=K.length,f$>0)return}W$=t$?Buffer.concat(t$,_$-f$):W$.length===0?K:Buffer.concat([W$,K],W$.length+K.length);while(W$.length>4){if(_$=W$.readUInt32BE(1),_$>=W$.length){f$=_$-W$.length,t$=[W$];break}try{TB(W$.subarray(0,_$+1))}catch(P){s&&(s.cursorFn||s.describeFirst)&&n4(y2),a1(P)}W$=W$.subarray(_$+1),f$=0,t$=null}}async function RN(){if(Y6=!1,b$={},j||(j=await AB()),!j)return;if(r.start(),$.socket)return z?_N():s8();if(j.on("connect",z?_N:s8),$.path)return j.connect($.path);j.ssl=z,j.connect(H[n$],Z[n$]),j.host=Z[n$],j.port=H[n$],n$=(n$+1)%H.length}function TN(){setTimeout(RN,H$?H$+c$-kR.now():0)}function s8(){try{L4={},L$=$.fetch_types,X6=Math.random().toString(36).slice(2),c=1,y.start(),j.on("data",AW),A&&j.setKeepAlive&&j.setKeepAlive(!0,1000*A);let K=Vj();n4(K)}catch(K){e8(K)}}function e8(K){if(G6.queue===X.connecting&&$.host[P4+1])return;a1(K);while(q.length)q5(q.shift(),K)}function a1(K){I4&&(I4.destroy(K),I4=null),s&&q5(s,K),o4&&(q5(o4,K),o4=null)}function q5(K,P){if(K.reserve)return K.reject(P);if(!P||typeof P!=="object")P=new Error(P);"query"in P||"parameters"in P||Object.defineProperties(P,{stack:{value:P.stack+K.origin.replace(/.*\n/,`
|
|
129
|
-
`),enumerable:$.debug},query:{value:K.string,enumerable:$.debug},parameters:{value:K.parameters,enumerable:$.debug},args:{value:K.args,enumerable:$.debug},types:{value:K.statement&&K.statement.types,enumerable:$.debug}}),K.reject(P)}function LW(){return O2||(!G6.reserved&&U(G6),!G6.reserved&&!o4&&!s&&q.length===0?(m9(),new Promise((K)=>j&&j.readyState!=="closed"?j.once("close",K):K())):O2=new Promise((K)=>
|
|
126
|
+
`);this.baseURL=W.baseURL,this.timeout=W.timeout??Ow.DEFAULT_TIMEOUT,this.logger=W.logger??console;let Q="warn";this.logLevel=Q,this.logLevel=cO(W.logLevel,"ClientOptions.logLevel",this)??cO(L2("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??Q,this.fetchOptions=W.fetchOptions,this.maxRetries=W.maxRetries??2,this.fetch=W.fetch??qJ(),Z$(this,L7,TJ,"f"),this._options=W,this.apiKey=X,this.organization=Y,this.project=U,this.webhookSecret=G}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:X}){return}async authHeaders($){return e([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery($){return mO($,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${F2}`}defaultIdempotencyKey(){return`stainless-node-retry-${PO()}`}makeStatusError($,X,Y,U){return C4.generate($,X,Y,U)}buildURL($,X,Y){let U=!B(this,Vw,"m",MA).call(this)&&Y||this.baseURL,G=DJ($)?new URL($):new URL(U+(U.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),z=this.defaultQuery();if(!EJ(z))X={...z,...X};if(typeof X==="object"&&X&&!Array.isArray(X))G.search=this.stringifyQuery(X);return G.toString()}async prepareOptions($){}async prepareRequest($,{url:X,options:Y}){}get($,X){return this.methodRequest("get",$,X)}post($,X){return this.methodRequest("post",$,X)}patch($,X){return this.methodRequest("patch",$,X)}put($,X){return this.methodRequest("put",$,X)}delete($,X){return this.methodRequest("delete",$,X)}methodRequest($,X,Y){return this.request(Promise.resolve(Y).then((U)=>{return{method:$,path:X,...U}}))}request($,X=null){return new V8(this,this.makeRequest($,X,void 0))}async makeRequest($,X,Y){let U=await $,G=U.maxRetries??this.maxRetries;if(X==null)X=G;await this.prepareOptions(U);let{req:z,url:W,timeout:Q}=await this.buildRequest(U,{retryCount:G-X});await this.prepareRequest(z,{url:W,options:U});let Z="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),H=Y===void 0?"":`, retryOf: ${Y}`,V=Date.now();if(q4(this).debug(`[${Z}] sending request`,x0({retryOfRequestLogID:Y,method:U.method,url:W,options:U,headers:z.headers})),U.signal?.aborted)throw new k4;let O=new AbortController,w=await this.fetchWithTimeout(W,z,Q,O).catch(cY),D=Date.now();if(w instanceof Error){let J=`retrying, ${X} attempts remaining`;if(U.signal?.aborted)throw new k4;let A=uY(w)||/timed? ?out/i.test(String(w)+("cause"in w?String(w.cause):""));if(X)return q4(this).info(`[${Z}] connection ${A?"timed out":"failed"} - ${J}`),q4(this).debug(`[${Z}] connection ${A?"timed out":"failed"} (${J})`,x0({retryOfRequestLogID:Y,url:W,durationMs:D-V,message:w.message})),this.retryRequest(U,X,Y??Z);if(q4(this).info(`[${Z}] connection ${A?"timed out":"failed"} - error; no more retries left`),q4(this).debug(`[${Z}] connection ${A?"timed out":"failed"} (error; no more retries left)`,x0({retryOfRequestLogID:Y,url:W,durationMs:D-V,message:w.message})),A)throw new H8;throw new Z8({cause:w})}let E=[...w.headers.entries()].filter(([J])=>J==="x-request-id").map(([J,A])=>", "+J+": "+JSON.stringify(A)).join(""),F=`[${Z}${H}${E}] ${z.method} ${W} ${w.ok?"succeeded":"failed"} with status ${w.status} in ${D-V}ms`;if(!w.ok){let J=await this.shouldRetry(w);if(X&&J){let I=`retrying, ${X} attempts remaining`;return await RJ(w.body),q4(this).info(`${F} - ${I}`),q4(this).debug(`[${Z}] response error (${I})`,x0({retryOfRequestLogID:Y,url:w.url,status:w.status,headers:w.headers,durationMs:D-V})),this.retryRequest(U,X,Y??Z,w.headers)}let A=J?"error; no more retries left":"error; not retryable";q4(this).info(`${F} - ${A}`);let L=await w.text().catch((I)=>cY(I).message),T=MJ(L),q=T?void 0:L;throw q4(this).debug(`[${Z}] response error (${A})`,x0({retryOfRequestLogID:Y,url:w.url,status:w.status,headers:w.headers,message:q,durationMs:Date.now()-V})),this.makeStatusError(w.status,T,q,w.headers)}return q4(this).info(F),q4(this).debug(`[${Z}] response start`,x0({retryOfRequestLogID:Y,url:w.url,status:w.status,headers:w.headers,durationMs:D-V})),{response:w,options:U,controller:O,requestLogID:Z,retryOfRequestLogID:Y,startTime:V}}getAPIList($,X,Y){return this.requestAPIList(X,{method:"get",path:$,...Y})}requestAPIList($,X){let Y=this.makeRequest(X,null,void 0);return new $7(this,Y,$)}async fetchWithTimeout($,X,Y,U){let{signal:G,method:z,...W}=X||{};if(G)G.addEventListener("abort",()=>U.abort());let Q=setTimeout(()=>U.abort(),Y),Z=globalThis.ReadableStream&&W.body instanceof globalThis.ReadableStream||typeof W.body==="object"&&W.body!==null&&Symbol.asyncIterator in W.body,H={signal:U.signal,...Z?{duplex:"half"}:{},method:"GET",...W};if(z)H.method=z.toUpperCase();try{return await this.fetch.call(void 0,$,H)}finally{clearTimeout(Q)}}async shouldRetry($){let X=$.headers.get("x-should-retry");if(X==="true")return!0;if(X==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,X,Y,U){let G,z=U?.get("retry-after-ms");if(z){let Q=parseFloat(z);if(!Number.isNaN(Q))G=Q}let W=U?.get("retry-after");if(W&&!G){let Q=parseFloat(W);if(!Number.isNaN(Q))G=Q*1000;else G=Date.parse(W)-Date.now()}if(!(G&&0<=G&&G<60000)){let Q=$.maxRetries??this.maxRetries;G=this.calculateDefaultRetryTimeoutMillis(X,Q)}return await X0(G),this.makeRequest($,X-1,Y)}calculateDefaultRetryTimeoutMillis($,X){let G=X-$,z=Math.min(0.5*Math.pow(2,G),8),W=1-Math.random()*0.25;return z*W*1000}async buildRequest($,{retryCount:X=0}={}){let Y={...$},{method:U,path:G,query:z,defaultBaseURL:W}=Y,Q=this.buildURL(G,z,W);if("timeout"in Y)FJ("timeout",Y.timeout);Y.timeout=Y.timeout??this.timeout;let{bodyHeaders:Z,body:H}=this.buildBody({options:Y}),V=await this.buildHeaders({options:$,method:U,bodyHeaders:Z,retryCount:X});return{req:{method:U,headers:V,...Y.signal&&{signal:Y.signal},...globalThis.ReadableStream&&H instanceof globalThis.ReadableStream&&{duplex:"half"},...H&&{body:H},...this.fetchOptions??{},...Y.fetchOptions??{}},url:Q,timeout:Y.timeout}}async buildHeaders({options:$,method:X,bodyHeaders:Y,retryCount:U}){let G={};if(this.idempotencyHeader&&X!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();G[this.idempotencyHeader]=$.idempotencyKey}let z=e([G,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(U),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},..._J(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders($),this._options.defaultHeaders,Y,$.headers]);return this.validateHeaders(z),z.values}buildBody({options:{body:$,headers:X}}){if(!$)return{bodyHeaders:void 0,body:void 0};let Y=e([X]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&Y.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:lU($)};else return B(this,L7,"f").call(this,{body:$,headers:Y})}}Ow=K$,L7=new WeakMap,Vw=new WeakSet,MA=function $(){return this.baseURL!=="https://api.openai.com/v1"};K$.OpenAI=Ow;K$.DEFAULT_TIMEOUT=600000;K$.OpenAIError=G$;K$.APIError=C4;K$.APIConnectionError=Z8;K$.APIConnectionTimeoutError=H8;K$.APIUserAbortError=k4;K$.NotFoundError=rY;K$.ConflictError=iY;K$.RateLimitError=nY;K$.BadRequestError=pY;K$.AuthenticationError=dY;K$.InternalServerError=tY;K$.PermissionDeniedError=lY;K$.UnprocessableEntityError=oY;K$.InvalidWebhookSignatureError=I0;K$.toFile=X7;K$.Completions=jX;K$.Chat=D8;K$.Embeddings=IX;K$.Files=SX;K$.Images=hX;K$.Audio=f0;K$.Moderations=yX;K$.Models=gX;K$.FineTuning=U0;K$.Graders=_8;K$.VectorStores=q2;K$.Webhooks=cX;K$.Beta=h0;K$.Batches=vX;K$.Uploads=R8;K$.Responses=q8;K$.Conversations=L8;K$.Evals=K8;K$.Containers=A8;function ck($,...X){let[Y,U,G,z]=X,W=[{role:"user",content:PM(U)},{role:"user",content:Y}],Q=z.at(-1);if(Q)W.push({role:"user",content:["Oops! That didn't work. Here's what was returned last time:",JSON.stringify(Q.response,null,2),"Here's the error message:",JSON.stringify(Q.error.issues,null,2)].join(`
|
|
127
|
+
`)});return{model:$,messages:W}}var z$=1e6,JA={"gpt-5":{promptPricePerToken:1.25/z$,promptPricePerTokenCached:0.125/z$,completionPricePerToken:10/z$},"gpt-5-mini":{promptPricePerToken:0.25/z$,promptPricePerTokenCached:0.025/z$,completionPricePerToken:2/z$},"gpt-5-nano":{promptPricePerToken:0.05/z$,promptPricePerTokenCached:0.005/z$,completionPricePerToken:0.4/z$},"gpt-4.1":{promptPricePerToken:3/z$,promptPricePerTokenCached:0.75/z$,completionPricePerToken:12/z$},"gpt-4.1-mini":{promptPricePerToken:0.8/z$,promptPricePerTokenCached:0.2/z$,completionPricePerToken:3.2/z$},"gpt-4.1-nano":{promptPricePerToken:0.2/z$,promptPricePerTokenCached:0.05/z$,completionPricePerToken:0.8/z$},"gpt-4o":{promptPricePerToken:2.5/z$,promptPricePerTokenCached:1.25/z$,completionPricePerToken:10/z$},"gpt-4o-mini":{promptPricePerToken:0.15/z$,promptPricePerTokenCached:0.075/z$,completionPricePerToken:0.6/z$},o1:{promptPricePerToken:15/z$,promptPricePerTokenCached:7.5/z$,completionPricePerToken:60/z$},"o1-mini":{promptPricePerToken:1.1/z$,promptPricePerTokenCached:0.55/z$,completionPricePerToken:4.4/z$},o3:{promptPricePerToken:10/z$,promptPricePerTokenCached:2.5/z$,completionPricePerToken:40/z$},"o3-mini":{promptPricePerToken:1.1/z$,promptPricePerTokenCached:0.55/z$,completionPricePerToken:4.4/z$},"o4-mini":{promptPricePerToken:4/z$,promptPricePerTokenCached:1/z$,completionPricePerToken:16/z$},"codex-mini-latest":{promptPricePerToken:1.5/z$,promptPricePerTokenCached:0.375/z$,completionPricePerToken:6/z$},"chatgpt-4o-latest":{promptPricePerToken:5/z$,promptPricePerTokenCached:5/z$,completionPricePerToken:15/z$},"gpt-4":{promptPricePerToken:30/z$,promptPricePerTokenCached:30/z$,completionPricePerToken:60/z$},"gpt-4-turbo":{promptPricePerToken:10/z$,promptPricePerTokenCached:10/z$,completionPricePerToken:30/z$},"gpt-3.5-turbo":{promptPricePerToken:0.5/z$,promptPricePerTokenCached:0.5/z$,completionPricePerToken:1.5/z$},"gpt-4-32k":{promptPricePerToken:60/z$,promptPricePerTokenCached:60/z$,completionPricePerToken:120/z$},"gpt-3.5-turbo-16k":{promptPricePerToken:3/z$,promptPricePerTokenCached:3/z$,completionPricePerToken:4/z$}};function pk($){let Y=Object.keys(JA).filter((U)=>$.startsWith(U)).sort((U,G)=>G.length-U.length)[0];if(!Y)return;return JA[Y]}function LA($,X){let Y=$.prompt_tokens,U=$.prompt_tokens_details?.cached_tokens??0,G=Y-U,z=$.completion_tokens,W=pk(X),Q=0;if(W)Q=Y*W.promptPricePerToken+G*(W.promptPricePerTokenCached??0)+z*W.completionPricePerToken;else console.warn(`No pricing facts found for model ${X}. Giving a price of 0.`);return Q}function dk($,X){return async function Y(U,G){let z,W,Q=0;try{let Z=await $.chat.completions.create({...U,stream:!1,response_format:{type:"json_object"}},G),{content:H,refusal:V}=Z.choices[0].message;if(W=Z.usage,H&&W)Q=LA(W,U.model),z=JSON.parse(H);if(!H)throw new Error(`No content${W?"":" or usage"} was given in the completion from OpenAI.${V?` Instead, OpenAI gave the following refusal: "${V}"`:""}`)}catch(Z){X?.error(Z)}return z??={},W??={completion_tokens:0,prompt_tokens:0,total_tokens:0},{data:z,usage:W,usdPrice:Q}}}var AA=new Map,KA=class{usdBudget;usdMinimum;getCompletionSquirreled;getUnknownJsonFromOpenAi;getUnknownJsonFromOpenAiSquirreled;squirrel;model;client;lastUsage;logger;constructor({model:$,usdBudget:X,usdMinimum:Y,apiKey:U,cachingMode:G,cacheKey:z="openai-safegen",logger:W=console}){this.usdBudget=X,this.usdMinimum=Y,this.model=$,this.squirrel=new wJ(G),this.logger=W;let Q=AA.get(U);if(!Q)Q=new K$({apiKey:U,dangerouslyAllowBrowser:!1}),AA.set(U,Q);this.client=Q,this.getCompletionSquirreled=this.squirrel.add("openai-safegen",this.client.completions.create.bind(this.client.completions)),this.getUnknownJsonFromOpenAi=dk(this.client,this.logger),this.getUnknownJsonFromOpenAiSquirreled=this.squirrel.add(z,this.getUnknownJsonFromOpenAi),this.from=jM(async(...Z)=>{if(this.usdBudget<this.usdMinimum)return W?.warn("SafeGen budget exhausted"),Z[2];let H=ck($,...Z),V=Z[0],O=Z[3],{data:w,usage:D,usdPrice:E}=await this.getUnknownJsonFromOpenAiSquirreled.for(`${V.replace(/[^a-zA-Z0-9-_. ]/g,"_")}-${O.length}`).get(H);return this.lastUsage=D,this.usdBudget-=E,w},W),this.object=this.from}getCompletion=async($,X)=>{if(this.usdBudget<this.usdMinimum)return this.logger.warn("SafeGen budget exhausted"),"";let Y=await this.getCompletionSquirreled.for($).get(X),{usage:U}=Y;if(U){let G=LA(U,X.model);this.usdBudget-=G}return Y.choices[0].text.trim()};from;object;boolean($){return IM($,async(X,Y)=>{return(await this.getCompletion(Y,{model:this.model,prompt:X,max_tokens:1})).toLowerCase()})}number($,X,Y){return xM($,X,Y,async(U,G)=>this.getCompletion(G,{model:this.model,prompt:U,max_tokens:6}))}choose($,X,Y=1,U=Y){return SM($,X,Y,U,async(G,z,W)=>this.getCompletion(z,{model:this.model,prompt:G,max_tokens:W}),this.logger)}};import{exec as pm}from"child_process";class M extends Array{constructor($,X){if(super($),this.sign=X,Object.setPrototypeOf(this,M.prototype),$>M.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded")}static BigInt($){var X=Math.floor,Y=Number.isFinite;if(typeof $=="number"){if($===0)return M.__zero();if(M.__isOneDigitInt($))return 0>$?M.__oneDigit(-$,!0):M.__oneDigit($,!1);if(!Y($)||X($)!==$)throw new RangeError("The number "+$+" cannot be converted to BigInt because it is not an integer");return M.__fromDouble($)}if(typeof $=="string"){let U=M.__fromString($);if(U===null)throw new SyntaxError("Cannot convert "+$+" to a BigInt");return U}if(typeof $=="boolean")return $===!0?M.__oneDigit(1,!1):M.__zero();if(typeof $=="object"){if($.constructor===M)return $;let U=M.__toPrimitive($);return M.BigInt(U)}throw new TypeError("Cannot convert "+$+" to a BigInt")}toDebugString(){let $=["BigInt["];for(let X of this)$.push((X?(X>>>0).toString(16):X)+", ");return $.push("]"),$.join("")}toString($=10){if(2>$||36<$)throw new RangeError("toString() radix argument must be between 2 and 36");return this.length===0?"0":($&$-1)==0?M.__toStringBasePowerOfTwo(this,$):M.__toStringGeneric(this,$,!1)}valueOf(){throw new Error("Convert JSBI instances to native numbers using `toNumber`.")}static toNumber($){let X=$.length;if(X===0)return 0;if(X===1){let F=$.__unsignedDigit(0);return $.sign?-F:F}let Y=$.__digit(X-1),U=M.__clz30(Y),G=30*X-U;if(1024<G)return $.sign?-1/0:1/0;let z=G-1,W=Y,Q=X-1,Z=U+3,H=Z===32?0:W<<Z;H>>>=12;let V=Z-12,O=12<=Z?0:W<<20+Z,w=20+Z;for(0<V&&0<Q&&(Q--,W=$.__digit(Q),H|=W>>>30-V,O=W<<V+2,w=V+2);0<w&&0<Q;)Q--,W=$.__digit(Q),O|=30<=w?W<<w-30:W>>>30-w,w-=30;let D=M.__decideRounding($,w,Q,W);if((D===1||D===0&&(1&O)==1)&&(O=O+1>>>0,O===0&&(H++,H>>>20!=0&&(H=0,z++,1023<z))))return $.sign?-1/0:1/0;let E=$.sign?-2147483648:0;return z=z+1023<<20,M.__kBitConversionInts[M.__kBitConversionIntHigh]=E|z|H,M.__kBitConversionInts[M.__kBitConversionIntLow]=O,M.__kBitConversionDouble[0]}static unaryMinus($){if($.length===0)return $;let X=$.__copy();return X.sign=!$.sign,X}static bitwiseNot($){return $.sign?M.__absoluteSubOne($).__trim():M.__absoluteAddOne($,!0)}static exponentiate($,X){if(X.sign)throw new RangeError("Exponent must be positive");if(X.length===0)return M.__oneDigit(1,!1);if($.length===0)return $;if($.length===1&&$.__digit(0)===1)return $.sign&&(1&X.__digit(0))==0?M.unaryMinus($):$;if(1<X.length)throw new RangeError("BigInt too big");let Y=X.__unsignedDigit(0);if(Y===1)return $;if(Y>=M.__kMaxLengthBits)throw new RangeError("BigInt too big");if($.length===1&&$.__digit(0)===2){let z=1+(0|Y/30),W=$.sign&&(1&Y)!=0,Q=new M(z,W);Q.__initializeDigits();let Z=1<<Y%30;return Q.__setDigit(z-1,Z),Q}let U=null,G=$;for((1&Y)!=0&&(U=$),Y>>=1;Y!==0;Y>>=1)G=M.multiply(G,G),(1&Y)!=0&&(U===null?U=G:U=M.multiply(U,G));return U}static multiply($,X){if($.length===0)return $;if(X.length===0)return X;let Y=$.length+X.length;30<=$.__clzmsd()+X.__clzmsd()&&Y--;let U=new M(Y,$.sign!==X.sign);U.__initializeDigits();for(let G=0;G<$.length;G++)M.__multiplyAccumulate(X,$.__digit(G),U,G);return U.__trim()}static divide($,X){if(X.length===0)throw new RangeError("Division by zero");if(0>M.__absoluteCompare($,X))return M.__zero();let Y=$.sign!==X.sign,U=X.__unsignedDigit(0),G;if(X.length===1&&32767>=U){if(U===1)return Y===$.sign?$:M.unaryMinus($);G=M.__absoluteDivSmall($,U,null)}else G=M.__absoluteDivLarge($,X,!0,!1);return G.sign=Y,G.__trim()}static remainder($,X){if(X.length===0)throw new RangeError("Division by zero");if(0>M.__absoluteCompare($,X))return $;let Y=X.__unsignedDigit(0);if(X.length===1&&32767>=Y){if(Y===1)return M.__zero();let G=M.__absoluteModSmall($,Y);return G===0?M.__zero():M.__oneDigit(G,$.sign)}let U=M.__absoluteDivLarge($,X,!1,!0);return U.sign=$.sign,U.__trim()}static add($,X){let Y=$.sign;return Y===X.sign?M.__absoluteAdd($,X,Y):0<=M.__absoluteCompare($,X)?M.__absoluteSub($,X,Y):M.__absoluteSub(X,$,!Y)}static subtract($,X){let Y=$.sign;return Y===X.sign?0<=M.__absoluteCompare($,X)?M.__absoluteSub($,X,Y):M.__absoluteSub(X,$,!Y):M.__absoluteAdd($,X,Y)}static leftShift($,X){return X.length===0||$.length===0?$:X.sign?M.__rightShiftByAbsolute($,X):M.__leftShiftByAbsolute($,X)}static signedRightShift($,X){return X.length===0||$.length===0?$:X.sign?M.__leftShiftByAbsolute($,X):M.__rightShiftByAbsolute($,X)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan($,X){return 0>M.__compareToBigInt($,X)}static lessThanOrEqual($,X){return 0>=M.__compareToBigInt($,X)}static greaterThan($,X){return 0<M.__compareToBigInt($,X)}static greaterThanOrEqual($,X){return 0<=M.__compareToBigInt($,X)}static equal($,X){if($.sign!==X.sign)return!1;if($.length!==X.length)return!1;for(let Y=0;Y<$.length;Y++)if($.__digit(Y)!==X.__digit(Y))return!1;return!0}static notEqual($,X){return!M.equal($,X)}static bitwiseAnd($,X){var Y=Math.max;if(!$.sign&&!X.sign)return M.__absoluteAnd($,X).__trim();if($.sign&&X.sign){let U=Y($.length,X.length)+1,G=M.__absoluteSubOne($,U),z=M.__absoluteSubOne(X);return G=M.__absoluteOr(G,z,G),M.__absoluteAddOne(G,!0,G).__trim()}return $.sign&&([$,X]=[X,$]),M.__absoluteAndNot($,M.__absoluteSubOne(X)).__trim()}static bitwiseXor($,X){var Y=Math.max;if(!$.sign&&!X.sign)return M.__absoluteXor($,X).__trim();if($.sign&&X.sign){let z=Y($.length,X.length),W=M.__absoluteSubOne($,z),Q=M.__absoluteSubOne(X);return M.__absoluteXor(W,Q,W).__trim()}let U=Y($.length,X.length)+1;$.sign&&([$,X]=[X,$]);let G=M.__absoluteSubOne(X,U);return G=M.__absoluteXor(G,$,G),M.__absoluteAddOne(G,!0,G).__trim()}static bitwiseOr($,X){var Y=Math.max;let U=Y($.length,X.length);if(!$.sign&&!X.sign)return M.__absoluteOr($,X).__trim();if($.sign&&X.sign){let z=M.__absoluteSubOne($,U),W=M.__absoluteSubOne(X);return z=M.__absoluteAnd(z,W,z),M.__absoluteAddOne(z,!0,z).__trim()}$.sign&&([$,X]=[X,$]);let G=M.__absoluteSubOne(X,U);return G=M.__absoluteAndNot(G,$,G),M.__absoluteAddOne(G,!0,G).__trim()}static asIntN($,X){var Y=Math.floor;if(X.length===0)return X;if($=Y($),0>$)throw new RangeError("Invalid value: not (convertible to) a safe integer");if($===0)return M.__zero();if($>=M.__kMaxLengthBits)return X;let U=0|($+29)/30;if(X.length<U)return X;let G=X.__unsignedDigit(U-1),z=1<<($-1)%30;if(X.length===U&&G<z)return X;if((G&z)!==z)return M.__truncateToNBits($,X);if(!X.sign)return M.__truncateAndSubFromPowerOfTwo($,X,!0);if((G&z-1)==0){for(let W=U-2;0<=W;W--)if(X.__digit(W)!==0)return M.__truncateAndSubFromPowerOfTwo($,X,!1);return X.length===U&&G===z?X:M.__truncateToNBits($,X)}return M.__truncateAndSubFromPowerOfTwo($,X,!1)}static asUintN($,X){var Y=Math.floor;if(X.length===0)return X;if($=Y($),0>$)throw new RangeError("Invalid value: not (convertible to) a safe integer");if($===0)return M.__zero();if(X.sign){if($>M.__kMaxLengthBits)throw new RangeError("BigInt too big");return M.__truncateAndSubFromPowerOfTwo($,X,!1)}if($>=M.__kMaxLengthBits)return X;let U=0|($+29)/30;if(X.length<U)return X;let G=$%30;if(X.length==U){if(G===0)return X;if(X.__digit(U-1)>>>G==0)return X}return M.__truncateToNBits($,X)}static ADD($,X){if($=M.__toPrimitive($),X=M.__toPrimitive(X),typeof $=="string")return typeof X!="string"&&(X=X.toString()),$+X;if(typeof X=="string")return $.toString()+X;if($=M.__toNumeric($),X=M.__toNumeric(X),M.__isBigInt($)&&M.__isBigInt(X))return M.add($,X);if(typeof $=="number"&&typeof X=="number")return $+X;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT($,X){return M.__compare($,X,0)}static LE($,X){return M.__compare($,X,1)}static GT($,X){return M.__compare($,X,2)}static GE($,X){return M.__compare($,X,3)}static EQ($,X){for(;;){if(M.__isBigInt($))return M.__isBigInt(X)?M.equal($,X):M.EQ(X,$);if(typeof $=="number"){if(M.__isBigInt(X))return M.__equalToNumber(X,$);if(typeof X!="object")return $==X;X=M.__toPrimitive(X)}else if(typeof $=="string"){if(M.__isBigInt(X))return $=M.__fromString($),$!==null&&M.equal($,X);if(typeof X!="object")return $==X;X=M.__toPrimitive(X)}else if(typeof $=="boolean"){if(M.__isBigInt(X))return M.__equalToNumber(X,+$);if(typeof X!="object")return $==X;X=M.__toPrimitive(X)}else if(typeof $=="symbol"){if(M.__isBigInt(X))return!1;if(typeof X!="object")return $==X;X=M.__toPrimitive(X)}else if(typeof $=="object"){if(typeof X=="object"&&X.constructor!==M)return $==X;$=M.__toPrimitive($)}else return $==X}}static NE($,X){return!M.EQ($,X)}static DataViewGetBigInt64($,X,Y=!1){return M.asIntN(64,M.DataViewGetBigUint64($,X,Y))}static DataViewGetBigUint64($,X,Y=!1){let[U,G]=Y?[4,0]:[0,4],z=$.getUint32(X+U,Y),W=$.getUint32(X+G,Y),Q=new M(3,!1);return Q.__setDigit(0,1073741823&W),Q.__setDigit(1,(268435455&z)<<2|W>>>30),Q.__setDigit(2,z>>>28),Q.__trim()}static DataViewSetBigInt64($,X,Y,U=!1){M.DataViewSetBigUint64($,X,Y,U)}static DataViewSetBigUint64($,X,Y,U=!1){Y=M.asUintN(64,Y);let G=0,z=0;if(0<Y.length&&(z=Y.__digit(0),1<Y.length)){let Z=Y.__digit(1);z|=Z<<30,G=Z>>>2,2<Y.length&&(G|=Y.__digit(2)<<28)}let[W,Q]=U?[4,0]:[0,4];$.setUint32(X+W,G,U),$.setUint32(X+Q,z,U)}static __zero(){return new M(0,!1)}static __oneDigit($,X){let Y=new M(1,X);return Y.__setDigit(0,$),Y}__copy(){let $=new M(this.length,this.sign);for(let X=0;X<this.length;X++)$[X]=this[X];return $}__trim(){let $=this.length,X=this[$-1];for(;X===0;)$--,X=this[$-1],this.pop();return $===0&&(this.sign=!1),this}__initializeDigits(){for(let $=0;$<this.length;$++)this[$]=0}static __decideRounding($,X,Y,U){if(0<X)return-1;let G;if(0>X)G=-X-1;else{if(Y===0)return-1;Y--,U=$.__digit(Y),G=29}let z=1<<G;if((U&z)==0)return-1;if(z-=1,(U&z)!=0)return 1;for(;0<Y;)if(Y--,$.__digit(Y)!==0)return 1;return 0}static __fromDouble($){M.__kBitConversionDouble[0]=$;let X=2047&M.__kBitConversionInts[M.__kBitConversionIntHigh]>>>20,Y=X-1023,U=(0|Y/30)+1,G=new M(U,0>$),z=1048575&M.__kBitConversionInts[M.__kBitConversionIntHigh]|1048576,W=M.__kBitConversionInts[M.__kBitConversionIntLow],Q=20,Z=Y%30,H,V=0;if(Z<20){let O=Q-Z;V=O+32,H=z>>>O,z=z<<32-O|W>>>O,W<<=32-O}else if(Z===20)V=32,H=z,z=W,W=0;else{let O=Z-Q;V=32-O,H=z<<O|W>>>32-O,z=W<<O,W=0}G.__setDigit(U-1,H);for(let O=U-2;0<=O;O--)0<V?(V-=30,H=z>>>2,z=z<<30|W>>>2,W<<=30):H=0,G.__setDigit(O,H);return G.__trim()}static __isWhitespace($){return 13>=$&&9<=$||(159>=$?$==32:131071>=$?$==160||$==5760:196607>=$?($&=131071,10>=$||$==40||$==41||$==47||$==95||$==4096):$==65279)}static __fromString($,X=0){let Y=0,U=$.length,G=0;if(G===U)return M.__zero();let z=$.charCodeAt(G);for(;M.__isWhitespace(z);){if(++G===U)return M.__zero();z=$.charCodeAt(G)}if(z===43){if(++G===U)return null;z=$.charCodeAt(G),Y=1}else if(z===45){if(++G===U)return null;z=$.charCodeAt(G),Y=-1}if(X===0){if(X=10,z===48){if(++G===U)return M.__zero();if(z=$.charCodeAt(G),z===88||z===120){if(X=16,++G===U)return null;z=$.charCodeAt(G)}else if(z===79||z===111){if(X=8,++G===U)return null;z=$.charCodeAt(G)}else if(z===66||z===98){if(X=2,++G===U)return null;z=$.charCodeAt(G)}}}else if(X===16&&z===48){if(++G===U)return M.__zero();if(z=$.charCodeAt(G),z===88||z===120){if(++G===U)return null;z=$.charCodeAt(G)}}if(Y!=0&&X!==10)return null;for(;z===48;){if(++G===U)return M.__zero();z=$.charCodeAt(G)}let W=U-G,Q=M.__kMaxBitsPerChar[X],Z=M.__kBitsPerCharTableMultiplier-1;if(W>1073741824/Q)return null;let H=Q*W+Z>>>M.__kBitsPerCharTableShift,V=new M(0|(H+29)/30,!1),O=10>X?X:10,w=10<X?X-10:0;if((X&X-1)==0){Q>>=M.__kBitsPerCharTableShift;let D=[],E=[],F=!1;do{let J=0,A=0;for(;;){let L;if(z-48>>>0<O)L=z-48;else if((32|z)-97>>>0<w)L=(32|z)-87;else{F=!0;break}if(A+=Q,J=J<<Q|L,++G===U){F=!0;break}if(z=$.charCodeAt(G),30<A+Q)break}D.push(J),E.push(A)}while(!F);M.__fillFromParts(V,D,E)}else{V.__initializeDigits();let D=!1,E=0;do{let F=0,J=1;for(;;){let L;if(z-48>>>0<O)L=z-48;else if((32|z)-97>>>0<w)L=(32|z)-87;else{D=!0;break}let T=J*X;if(1073741823<T)break;if(J=T,F=F*X+L,E++,++G===U){D=!0;break}z=$.charCodeAt(G)}Z=30*M.__kBitsPerCharTableMultiplier-1;let A=0|(Q*E+Z>>>M.__kBitsPerCharTableShift)/30;V.__inplaceMultiplyAdd(J,F,A)}while(!D)}if(G!==U){if(!M.__isWhitespace(z))return null;for(G++;G<U;G++)if(z=$.charCodeAt(G),!M.__isWhitespace(z))return null}return V.sign=Y==-1,V.__trim()}static __fillFromParts($,X,Y){let U=0,G=0,z=0;for(let W=X.length-1;0<=W;W--){let Q=X[W],Z=Y[W];G|=Q<<z,z+=Z,z===30?($.__setDigit(U++,G),z=0,G=0):30<z&&($.__setDigit(U++,1073741823&G),z-=30,G=Q>>>Z-z)}if(G!==0){if(U>=$.length)throw new Error("implementation bug");$.__setDigit(U++,G)}for(;U<$.length;U++)$.__setDigit(U,0)}static __toStringBasePowerOfTwo($,X){let Y=$.length,U=X-1;U=(85&U>>>1)+(85&U),U=(51&U>>>2)+(51&U),U=(15&U>>>4)+(15&U);let G=U,z=X-1,W=$.__digit(Y-1),Q=M.__clz30(W),Z=0|(30*Y-Q+G-1)/G;if($.sign&&Z++,268435456<Z)throw new Error("string too long");let H=Array(Z),V=Z-1,O=0,w=0;for(let E=0;E<Y-1;E++){let F=$.__digit(E),J=(O|F<<w)&z;H[V--]=M.__kConversionChars[J];let A=G-w;for(O=F>>>A,w=30-A;w>=G;)H[V--]=M.__kConversionChars[O&z],O>>>=G,w-=G}let D=(O|W<<w)&z;for(H[V--]=M.__kConversionChars[D],O=W>>>G-w;O!==0;)H[V--]=M.__kConversionChars[O&z],O>>>=G;if($.sign&&(H[V--]="-"),V!=-1)throw new Error("implementation bug");return H.join("")}static __toStringGeneric($,X,Y){let U=$.length;if(U===0)return"";if(U===1){let E=$.__unsignedDigit(0).toString(X);return Y===!1&&$.sign&&(E="-"+E),E}let G=30*U-M.__clz30($.__digit(U-1)),z=M.__kMaxBitsPerChar[X],W=z-1,Q=G*M.__kBitsPerCharTableMultiplier;Q+=W-1,Q=0|Q/W;let Z=Q+1>>1,H=M.exponentiate(M.__oneDigit(X,!1),M.__oneDigit(Z,!1)),V,O,w=H.__unsignedDigit(0);if(H.length===1&&32767>=w){V=new M($.length,!1),V.__initializeDigits();let E=0;for(let F=2*$.length-1;0<=F;F--){let J=E<<15|$.__halfDigit(F);V.__setHalfDigit(F,0|J/w),E=0|J%w}O=E.toString(X)}else{let E=M.__absoluteDivLarge($,H,!0,!0);V=E.quotient;let F=E.remainder.__trim();O=M.__toStringGeneric(F,X,!0)}V.__trim();let D=M.__toStringGeneric(V,X,!0);for(;O.length<Z;)O="0"+O;return Y===!1&&$.sign&&(D="-"+D),D+O}static __unequalSign($){return $?-1:1}static __absoluteGreater($){return $?-1:1}static __absoluteLess($){return $?1:-1}static __compareToBigInt($,X){let Y=$.sign;if(Y!==X.sign)return M.__unequalSign(Y);let U=M.__absoluteCompare($,X);return 0<U?M.__absoluteGreater(Y):0>U?M.__absoluteLess(Y):0}static __compareToNumber($,X){if(M.__isOneDigitInt(X)){let Y=$.sign,U=0>X;if(Y!==U)return M.__unequalSign(Y);if($.length===0){if(U)throw new Error("implementation bug");return X===0?0:-1}if(1<$.length)return M.__absoluteGreater(Y);let G=Math.abs(X),z=$.__unsignedDigit(0);return z>G?M.__absoluteGreater(Y):z<G?M.__absoluteLess(Y):0}return M.__compareToDouble($,X)}static __compareToDouble($,X){if(X!==X)return X;if(X===1/0)return-1;if(X===-1/0)return 1;let Y=$.sign;if(Y!==0>X)return M.__unequalSign(Y);if(X===0)throw new Error("implementation bug: should be handled elsewhere");if($.length===0)return-1;M.__kBitConversionDouble[0]=X;let U=2047&M.__kBitConversionInts[M.__kBitConversionIntHigh]>>>20;if(U==2047)throw new Error("implementation bug: handled elsewhere");let G=U-1023;if(0>G)return M.__absoluteGreater(Y);let z=$.length,W=$.__digit(z-1),Q=M.__clz30(W),Z=30*z-Q,H=G+1;if(Z<H)return M.__absoluteLess(Y);if(Z>H)return M.__absoluteGreater(Y);let V=1048576|1048575&M.__kBitConversionInts[M.__kBitConversionIntHigh],O=M.__kBitConversionInts[M.__kBitConversionIntLow],w=20,D=29-Q;if(D!==(0|(Z-1)%30))throw new Error("implementation bug");let E,F=0;if(20>D){let J=w-D;F=J+32,E=V>>>J,V=V<<32-J|O>>>J,O<<=32-J}else if(D===20)F=32,E=V,V=O,O=0;else{let J=D-w;F=32-J,E=V<<J|O>>>32-J,V=O<<J,O=0}if(W>>>=0,E>>>=0,W>E)return M.__absoluteGreater(Y);if(W<E)return M.__absoluteLess(Y);for(let J=z-2;0<=J;J--){0<F?(F-=30,E=V>>>2,V=V<<30|O>>>2,O<<=30):E=0;let A=$.__unsignedDigit(J);if(A>E)return M.__absoluteGreater(Y);if(A<E)return M.__absoluteLess(Y)}if(V!==0||O!==0){if(F===0)throw new Error("implementation bug");return M.__absoluteLess(Y)}return 0}static __equalToNumber($,X){var Y=Math.abs;return M.__isOneDigitInt(X)?X===0?$.length===0:$.length===1&&$.sign===0>X&&$.__unsignedDigit(0)===Y(X):M.__compareToDouble($,X)===0}static __comparisonResultToBool($,X){return X===0?0>$:X===1?0>=$:X===2?0<$:X===3?0<=$:void 0}static __compare($,X,Y){if($=M.__toPrimitive($),X=M.__toPrimitive(X),typeof $=="string"&&typeof X=="string")switch(Y){case 0:return $<X;case 1:return $<=X;case 2:return $>X;case 3:return $>=X}if(M.__isBigInt($)&&typeof X=="string")return X=M.__fromString(X),X!==null&&M.__comparisonResultToBool(M.__compareToBigInt($,X),Y);if(typeof $=="string"&&M.__isBigInt(X))return $=M.__fromString($),$!==null&&M.__comparisonResultToBool(M.__compareToBigInt($,X),Y);if($=M.__toNumeric($),X=M.__toNumeric(X),M.__isBigInt($)){if(M.__isBigInt(X))return M.__comparisonResultToBool(M.__compareToBigInt($,X),Y);if(typeof X!="number")throw new Error("implementation bug");return M.__comparisonResultToBool(M.__compareToNumber($,X),Y)}if(typeof $!="number")throw new Error("implementation bug");if(M.__isBigInt(X))return M.__comparisonResultToBool(M.__compareToNumber(X,$),2^Y);if(typeof X!="number")throw new Error("implementation bug");return Y===0?$<X:Y===1?$<=X:Y===2?$>X:Y===3?$>=X:void 0}__clzmsd(){return M.__clz30(this.__digit(this.length-1))}static __absoluteAdd($,X,Y){if($.length<X.length)return M.__absoluteAdd(X,$,Y);if($.length===0)return $;if(X.length===0)return $.sign===Y?$:M.unaryMinus($);let U=$.length;($.__clzmsd()===0||X.length===$.length&&X.__clzmsd()===0)&&U++;let G=new M(U,Y),z=0,W=0;for(;W<X.length;W++){let Q=$.__digit(W)+X.__digit(W)+z;z=Q>>>30,G.__setDigit(W,1073741823&Q)}for(;W<$.length;W++){let Q=$.__digit(W)+z;z=Q>>>30,G.__setDigit(W,1073741823&Q)}return W<G.length&&G.__setDigit(W,z),G.__trim()}static __absoluteSub($,X,Y){if($.length===0)return $;if(X.length===0)return $.sign===Y?$:M.unaryMinus($);let U=new M($.length,Y),G=0,z=0;for(;z<X.length;z++){let W=$.__digit(z)-X.__digit(z)-G;G=1&W>>>30,U.__setDigit(z,1073741823&W)}for(;z<$.length;z++){let W=$.__digit(z)-G;G=1&W>>>30,U.__setDigit(z,1073741823&W)}return U.__trim()}static __absoluteAddOne($,X,Y=null){let U=$.length;Y===null?Y=new M(U,X):Y.sign=X;let G=1;for(let z=0;z<U;z++){let W=$.__digit(z)+G;G=W>>>30,Y.__setDigit(z,1073741823&W)}return G!=0&&Y.__setDigitGrow(U,1),Y}static __absoluteSubOne($,X){let Y=$.length;X=X||Y;let U=new M(X,!1),G=1;for(let z=0;z<Y;z++){let W=$.__digit(z)-G;G=1&W>>>30,U.__setDigit(z,1073741823&W)}if(G!=0)throw new Error("implementation bug");for(let z=Y;z<X;z++)U.__setDigit(z,0);return U}static __absoluteAnd($,X,Y=null){let U=$.length,G=X.length,z=G;if(U<G){z=U;let Z=$,H=U;$=X,U=G,X=Z,G=H}let W=z;Y===null?Y=new M(W,!1):W=Y.length;let Q=0;for(;Q<z;Q++)Y.__setDigit(Q,$.__digit(Q)&X.__digit(Q));for(;Q<W;Q++)Y.__setDigit(Q,0);return Y}static __absoluteAndNot($,X,Y=null){let U=$.length,G=X.length,z=G;U<G&&(z=U);let W=U;Y===null?Y=new M(W,!1):W=Y.length;let Q=0;for(;Q<z;Q++)Y.__setDigit(Q,$.__digit(Q)&~X.__digit(Q));for(;Q<U;Q++)Y.__setDigit(Q,$.__digit(Q));for(;Q<W;Q++)Y.__setDigit(Q,0);return Y}static __absoluteOr($,X,Y=null){let U=$.length,G=X.length,z=G;if(U<G){z=U;let Z=$,H=U;$=X,U=G,X=Z,G=H}let W=U;Y===null?Y=new M(W,!1):W=Y.length;let Q=0;for(;Q<z;Q++)Y.__setDigit(Q,$.__digit(Q)|X.__digit(Q));for(;Q<U;Q++)Y.__setDigit(Q,$.__digit(Q));for(;Q<W;Q++)Y.__setDigit(Q,0);return Y}static __absoluteXor($,X,Y=null){let U=$.length,G=X.length,z=G;if(U<G){z=U;let Z=$,H=U;$=X,U=G,X=Z,G=H}let W=U;Y===null?Y=new M(W,!1):W=Y.length;let Q=0;for(;Q<z;Q++)Y.__setDigit(Q,$.__digit(Q)^X.__digit(Q));for(;Q<U;Q++)Y.__setDigit(Q,$.__digit(Q));for(;Q<W;Q++)Y.__setDigit(Q,0);return Y}static __absoluteCompare($,X){let Y=$.length-X.length;if(Y!=0)return Y;let U=$.length-1;for(;0<=U&&$.__digit(U)===X.__digit(U);)U--;return 0>U?0:$.__unsignedDigit(U)>X.__unsignedDigit(U)?1:-1}static __multiplyAccumulate($,X,Y,U){if(X===0)return;let G=32767&X,z=X>>>15,W=0,Q=0;for(let Z,H=0;H<$.length;H++,U++){Z=Y.__digit(U);let V=$.__digit(H),O=32767&V,w=V>>>15,D=M.__imul(O,G),E=M.__imul(O,z),F=M.__imul(w,G),J=M.__imul(w,z);Z+=Q+D+W,W=Z>>>30,Z&=1073741823,Z+=((32767&E)<<15)+((32767&F)<<15),W+=Z>>>30,Q=J+(E>>>15)+(F>>>15),Y.__setDigit(U,1073741823&Z)}for(;W!=0||Q!==0;U++){let Z=Y.__digit(U);Z+=W+Q,Q=0,W=Z>>>30,Y.__setDigit(U,1073741823&Z)}}static __internalMultiplyAdd($,X,Y,U,G){let z=Y,W=0;for(let Q=0;Q<U;Q++){let Z=$.__digit(Q),H=M.__imul(32767&Z,X),V=M.__imul(Z>>>15,X),O=H+((32767&V)<<15)+W+z;z=O>>>30,W=V>>>15,G.__setDigit(Q,1073741823&O)}if(G.length>U)for(G.__setDigit(U++,z+W);U<G.length;)G.__setDigit(U++,0);else if(z+W!==0)throw new Error("implementation bug")}__inplaceMultiplyAdd($,X,Y){Y>this.length&&(Y=this.length);let U=32767&$,G=$>>>15,z=0,W=X;for(let Q=0;Q<Y;Q++){let Z=this.__digit(Q),H=32767&Z,V=Z>>>15,O=M.__imul(H,U),w=M.__imul(H,G),D=M.__imul(V,U),E=M.__imul(V,G),F=W+O+z;z=F>>>30,F&=1073741823,F+=((32767&w)<<15)+((32767&D)<<15),z+=F>>>30,W=E+(w>>>15)+(D>>>15),this.__setDigit(Q,1073741823&F)}if(z!=0||W!==0)throw new Error("implementation bug")}static __absoluteDivSmall($,X,Y=null){Y===null&&(Y=new M($.length,!1));let U=0;for(let G,z=2*$.length-1;0<=z;z-=2){G=(U<<15|$.__halfDigit(z))>>>0;let W=0|G/X;U=0|G%X,G=(U<<15|$.__halfDigit(z-1))>>>0;let Q=0|G/X;U=0|G%X,Y.__setDigit(z>>>1,W<<15|Q)}return Y}static __absoluteModSmall($,X){let Y=0;for(let U=2*$.length-1;0<=U;U--)Y=0|((Y<<15|$.__halfDigit(U))>>>0)%X;return Y}static __absoluteDivLarge($,X,Y,U){let G=X.__halfDigitLength(),z=X.length,W=$.__halfDigitLength()-G,Q=null;Y&&(Q=new M(W+2>>>1,!1),Q.__initializeDigits());let Z=new M(G+2>>>1,!1);Z.__initializeDigits();let H=M.__clz15(X.__halfDigit(G-1));0<H&&(X=M.__specialLeftShift(X,H,0));let V=M.__specialLeftShift($,H,1),O=X.__halfDigit(G-1),w=0;for(let D,E=W;0<=E;E--){D=32767;let F=V.__halfDigit(E+G);if(F!==O){let A=(F<<15|V.__halfDigit(E+G-1))>>>0;D=0|A/O;let L=0|A%O,T=X.__halfDigit(G-2),q=V.__halfDigit(E+G-2);for(;M.__imul(D,T)>>>0>(L<<16|q)>>>0&&(D--,L+=O,!(32767<L)););}M.__internalMultiplyAdd(X,D,0,z,Z);let J=V.__inplaceSub(Z,E,G+1);J!==0&&(J=V.__inplaceAdd(X,E,G),V.__setHalfDigit(E+G,32767&V.__halfDigit(E+G)+J),D--),Y&&(1&E?w=D<<15:Q.__setDigit(E>>>1,w|D))}if(U)return V.__inplaceRightShift(H),Y?{quotient:Q,remainder:V}:V;if(Y)return Q;throw new Error("unreachable")}static __clz15($){return M.__clz30($)-15}__inplaceAdd($,X,Y){let U=0;for(let G=0;G<Y;G++){let z=this.__halfDigit(X+G)+$.__halfDigit(G)+U;U=z>>>15,this.__setHalfDigit(X+G,32767&z)}return U}__inplaceSub($,X,Y){let U=0;if(1&X){X>>=1;let G=this.__digit(X),z=32767&G,W=0;for(;W<Y-1>>>1;W++){let H=$.__digit(W),V=(G>>>15)-(32767&H)-U;U=1&V>>>15,this.__setDigit(X+W,(32767&V)<<15|32767&z),G=this.__digit(X+W+1),z=(32767&G)-(H>>>15)-U,U=1&z>>>15}let Q=$.__digit(W),Z=(G>>>15)-(32767&Q)-U;if(U=1&Z>>>15,this.__setDigit(X+W,(32767&Z)<<15|32767&z),X+W+1>=this.length)throw new RangeError("out of bounds");(1&Y)==0&&(G=this.__digit(X+W+1),z=(32767&G)-(Q>>>15)-U,U=1&z>>>15,this.__setDigit(X+$.length,1073709056&G|32767&z))}else{X>>=1;let G=0;for(;G<$.length-1;G++){let H=this.__digit(X+G),V=$.__digit(G),O=(32767&H)-(32767&V)-U;U=1&O>>>15;let w=(H>>>15)-(V>>>15)-U;U=1&w>>>15,this.__setDigit(X+G,(32767&w)<<15|32767&O)}let z=this.__digit(X+G),W=$.__digit(G),Q=(32767&z)-(32767&W)-U;U=1&Q>>>15;let Z=0;(1&Y)==0&&(Z=(z>>>15)-(W>>>15)-U,U=1&Z>>>15),this.__setDigit(X+G,(32767&Z)<<15|32767&Q)}return U}__inplaceRightShift($){if($===0)return;let X=this.__digit(0)>>>$,Y=this.length-1;for(let U=0;U<Y;U++){let G=this.__digit(U+1);this.__setDigit(U,1073741823&G<<30-$|X),X=G>>>$}this.__setDigit(Y,X)}static __specialLeftShift($,X,Y){let U=$.length,G=new M(U+Y,!1);if(X===0){for(let W=0;W<U;W++)G.__setDigit(W,$.__digit(W));return 0<Y&&G.__setDigit(U,0),G}let z=0;for(let W=0;W<U;W++){let Q=$.__digit(W);G.__setDigit(W,1073741823&Q<<X|z),z=Q>>>30-X}return 0<Y&&G.__setDigit(U,z),G}static __leftShiftByAbsolute($,X){let Y=M.__toShiftAmount(X);if(0>Y)throw new RangeError("BigInt too big");let U=0|Y/30,G=Y%30,z=$.length,W=G!==0&&$.__digit(z-1)>>>30-G!=0,Q=z+U+(W?1:0),Z=new M(Q,$.sign);if(G===0){let H=0;for(;H<U;H++)Z.__setDigit(H,0);for(;H<Q;H++)Z.__setDigit(H,$.__digit(H-U))}else{let H=0;for(let V=0;V<U;V++)Z.__setDigit(V,0);for(let V=0;V<z;V++){let O=$.__digit(V);Z.__setDigit(V+U,1073741823&O<<G|H),H=O>>>30-G}if(W)Z.__setDigit(z+U,H);else if(H!==0)throw new Error("implementation bug")}return Z.__trim()}static __rightShiftByAbsolute($,X){let{length:Y,sign:U}=$,G=M.__toShiftAmount(X);if(0>G)return M.__rightShiftByMaximum(U);let z=0|G/30,W=G%30,Q=Y-z;if(0>=Q)return M.__rightShiftByMaximum(U);let Z=!1;if(U){if(($.__digit(z)&(1<<W)-1)!=0)Z=!0;else for(let V=0;V<z;V++)if($.__digit(V)!==0){Z=!0;break}}if(Z&&W===0)~$.__digit(Y-1)==0&&Q++;let H=new M(Q,U);if(W===0){H.__setDigit(Q-1,0);for(let V=z;V<Y;V++)H.__setDigit(V-z,$.__digit(V))}else{let V=$.__digit(z)>>>W,O=Y-z-1;for(let w=0;w<O;w++){let D=$.__digit(w+z+1);H.__setDigit(w,1073741823&D<<30-W|V),V=D>>>W}H.__setDigit(O,V)}return Z&&(H=M.__absoluteAddOne(H,!0,H)),H.__trim()}static __rightShiftByMaximum($){return $?M.__oneDigit(1,!0):M.__zero()}static __toShiftAmount($){if(1<$.length)return-1;let X=$.__unsignedDigit(0);return X>M.__kMaxLengthBits?-1:X}static __toPrimitive($,X="default"){if(typeof $!="object")return $;if($.constructor===M)return $;if(typeof Symbol!="undefined"&&typeof Symbol.toPrimitive=="symbol"&&$[Symbol.toPrimitive]){let G=$[Symbol.toPrimitive](X);if(typeof G!="object")return G;throw new TypeError("Cannot convert object to primitive value")}let Y=$.valueOf;if(Y){let G=Y.call($);if(typeof G!="object")return G}let U=$.toString;if(U){let G=U.call($);if(typeof G!="object")return G}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric($){return M.__isBigInt($)?$:+$}static __isBigInt($){return typeof $=="object"&&$!==null&&$.constructor===M}static __truncateToNBits($,X){let Y=0|($+29)/30,U=new M(Y,X.sign),G=Y-1;for(let W=0;W<G;W++)U.__setDigit(W,X.__digit(W));let z=X.__digit(G);if($%30!=0){let W=32-$%30;z=z<<W>>>W}return U.__setDigit(G,z),U.__trim()}static __truncateAndSubFromPowerOfTwo($,X,Y){var U=Math.min;let G=0|($+29)/30,z=new M(G,Y),W=0,Q=G-1,Z=0;for(let w=U(Q,X.length);W<w;W++){let D=0-X.__digit(W)-Z;Z=1&D>>>30,z.__setDigit(W,1073741823&D)}for(;W<Q;W++)z.__setDigit(W,0|1073741823&-Z);let H=Q<X.length?X.__digit(Q):0,V=$%30,O;if(V==0)O=0-H-Z,O&=1073741823;else{let w=32-V;H=H<<w>>>w;let D=1<<32-w;O=D-H-Z,O&=D-1}return z.__setDigit(Q,O),z.__trim()}__digit($){return this[$]}__unsignedDigit($){return this[$]>>>0}__setDigit($,X){this[$]=0|X}__setDigitGrow($,X){this[$]=0|X}__halfDigitLength(){let $=this.length;return 32767>=this.__unsignedDigit($-1)?2*$-1:2*$}__halfDigit($){return 32767&this[$>>>1]>>>15*(1&$)}__setHalfDigit($,X){let Y=$>>>1,U=this.__digit(Y),G=1&$?32767&U|X<<15:1073709056&U|32767&X;this.__setDigit(Y,G)}static __digitPow($,X){let Y=1;for(;0<X;)1&X&&(Y*=$),X>>>=1,$*=$;return Y}static __detectBigEndian(){return M.__kBitConversionDouble[0]=-0,M.__kBitConversionInts[0]!==0}static __isOneDigitInt($){return(1073741823&$)===$}}M.__kMaxLength=33554432,M.__kMaxLengthBits=M.__kMaxLength<<5,M.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],M.__kBitsPerCharTableShift=5,M.__kBitsPerCharTableMultiplier=1<<M.__kBitsPerCharTableShift,M.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],M.__kBitConversionBuffer=new ArrayBuffer(8),M.__kBitConversionDouble=new Float64Array(M.__kBitConversionBuffer),M.__kBitConversionInts=new Int32Array(M.__kBitConversionBuffer),M.__kBitConversionIntHigh=M.__detectBigEndian()?0:1,M.__kBitConversionIntLow=M.__detectBigEndian()?1:0,M.__clz30=Math.clz32?function($){return Math.clz32($)-2}:function($){return $===0?30:0|29-(0|Math.log($>>>0)/Math.LN2)},M.__imul=Math.imul||function($,X){return 0|$*X};var x=M;var V1=x.BigInt(0),eG=x.BigInt(1),hw=x.BigInt(2),lk=x.BigInt(10),rk=x.BigInt(24),ik=x.BigInt(60),ok=x.BigInt(1000),Z3=x.BigInt(1e6),iG=x.BigInt(1e9),YL=x.multiply(x.BigInt(3600),iG),nk=x.multiply(ik,iG),j2=x.multiply(YL,rk);function y0($){return typeof $=="bigint"?x.BigInt($.toString(10)):$}function GL($){return x.equal(x.remainder($,hw),V1)}function T8($){return x.lessThan($,V1)?x.unaryMinus($):$}function q7($,X){return x.lessThan($,X)?-1:x.greaterThan($,X)?1:0}function yG($,X){return{quotient:x.divide($,X),remainder:x.remainder($,X)}}var _A,qA,D$="slot-epochNanoSeconds",E$="slot-iso-date",W4="slot-iso-date-time",E4="slot-time",p="slot-calendar",UL="slot-date-brand",zL="slot-year-month-brand",WL="slot-month-day-brand",m$="slot-time-zone",L6="slot-years",K6="slot-months",p6="slot-weeks",_6="slot-days",q6="slot-hours",R6="slot-minutes",T6="slot-seconds",v6="slot-milliseconds",C6="slot-microseconds",d6="slot-nanoseconds",QL="date",ZL="ym",HL="md",VL="time",OL="datetime",wL="instant",b8="original",rX="timezone-canonical",Mw="timezone-original",mG="calendar-id",DL="locale",Jw="options",EL=new WeakMap,Aw=Symbol.for("@@Temporal__GetSlots");(_A=globalThis)[Aw]||(_A[Aw]=function($){return EL.get($)});var b7=globalThis[Aw],Lw=Symbol.for("@@Temporal__CreateSlots");(qA=globalThis)[Lw]||(qA[Lw]=function($){EL.set($,Object.create(null))});var n0=globalThis[Lw];function x6($,...X){if(!$||typeof $!="object")return!1;let Y=b7($);return!!Y&&X.every((U)=>(U in Y))}function N($,X){let Y=b7($)?.[X];if(Y===void 0)throw new TypeError(`Missing internal slot ${X}`);return Y}function R$($,X,Y){let U=b7($);if(U===void 0)throw new TypeError("Missing slots for the given container");if(U[X])throw new TypeError(`${X} already has set`);U[X]=Y}var Kw={};function t0($,X){Object.defineProperty($.prototype,Symbol.toStringTag,{value:X,writable:!1,enumerable:!1,configurable:!0});let Y=Object.getOwnPropertyNames($);for(let G=0;G<Y.length;G++){let z=Y[G],W=Object.getOwnPropertyDescriptor($,z);W.configurable&&W.enumerable&&(W.enumerable=!1,Object.defineProperty($,z,W))}let U=Object.getOwnPropertyNames($.prototype);for(let G=0;G<U.length;G++){let z=U[G],W=Object.getOwnPropertyDescriptor($.prototype,z);W.configurable&&W.enumerable&&(W.enumerable=!1,Object.defineProperty($.prototype,z,W))}_w(X,$),_w(`${X}.prototype`,$.prototype)}function _w($,X){let Y=`%${$}%`;if(Kw[Y]!==void 0)throw new Error(`intrinsic ${$} already exists`);Kw[Y]=X}function $6($){return Kw[$]}function oX($,X){let Y=$;if(Y===0)return{div:Y,mod:Y};let U=Math.sign(Y);Y=Math.abs(Y);let G=Math.trunc(1+Math.log10(Y));if(X>=G)return{div:0*U,mod:U*Y};if(X===0)return{div:U*Y,mod:0*U};let z=Y.toPrecision(G);return{div:U*Number.parseInt(z.slice(0,G-X),10),mod:U*Number.parseInt(z.slice(G-X),10)}}function ww($,X,Y){let U=$,G=Y;if(U===0)return G;let z=Math.sign(U)||Math.sign(G);U=Math.abs(U),G=Math.abs(G);let W=U.toPrecision(Math.trunc(1+Math.log10(U)));if(G===0)return z*Number.parseInt(W+"0".repeat(X),10);let Q=W+G.toPrecision(Math.trunc(1+Math.log10(G))).padStart(X,"0");return z*Number.parseInt(Q,10)}function f7($,X){let Y=X==="negative";switch($){case"ceil":return Y?"zero":"infinity";case"floor":return Y?"infinity":"zero";case"expand":return"infinity";case"trunc":return"zero";case"halfCeil":return Y?"half-zero":"half-infinity";case"halfFloor":return Y?"half-infinity":"half-zero";case"halfExpand":return"half-infinity";case"halfTrunc":return"half-zero";case"halfEven":return"half-even"}}function h7($,X,Y,U,G){return G==="zero"?$:G==="infinity"?X:Y<0?$:Y>0?X:G==="half-zero"?$:G==="half-infinity"?X:U?$:X}class C${constructor($){this.totalNs=y0($),this.sec=x.toNumber(x.divide(this.totalNs,iG)),this.subsec=x.toNumber(x.remainder(this.totalNs,iG))}static validateNew($,X){if(x.greaterThan(T8($),C$.MAX))throw new RangeError(`${X} of duration time units cannot exceed ${C$.MAX} s`);return new C$($)}static fromEpochNsDiff($,X){let Y=x.subtract(y0($),y0(X));return new C$(Y)}static fromComponents($,X,Y,U,G,z){let W=x.add(x.add(x.add(x.add(x.add(x.BigInt(z),x.multiply(x.BigInt(G),ok)),x.multiply(x.BigInt(U),Z3)),x.multiply(x.BigInt(Y),iG)),x.multiply(x.BigInt(X),nk)),x.multiply(x.BigInt($),YL));return C$.validateNew(W,"total")}abs(){return new C$(T8(this.totalNs))}add($){return C$.validateNew(x.add(this.totalNs,$.totalNs),"sum")}add24HourDays($){return C$.validateNew(x.add(this.totalNs,x.multiply(x.BigInt($),j2)),"sum")}addToEpochNs($){return x.add(y0($),this.totalNs)}cmp($){return q7(this.totalNs,$.totalNs)}divmod($){let{quotient:X,remainder:Y}=yG(this.totalNs,x.BigInt($));return{quotient:x.toNumber(X),remainder:new C$(Y)}}fdiv($){let X=y0($),Y=x.BigInt(X),{quotient:U,remainder:G}=yG(this.totalNs,Y),z=[],W,Q=(x.lessThan(this.totalNs,V1)?-1:1)*Math.sign(x.toNumber(X));for(;!x.equal(G,V1)&&z.length<50;)G=x.multiply(G,lk),{quotient:W,remainder:G}=yG(G,Y),z.push(Math.abs(x.toNumber(W)));return Q*Number(T8(U).toString()+"."+z.join(""))}isZero(){return x.equal(this.totalNs,V1)}round($,X){let Y=y0($);if(x.equal(Y,eG))return this;let{quotient:U,remainder:G}=yG(this.totalNs,Y),z=x.lessThan(this.totalNs,V1)?"negative":"positive",W=x.multiply(T8(U),Y),Q=x.add(W,Y),Z=q7(T8(x.multiply(G,hw)),Y),H=f7(X,z),V=x.equal(T8(this.totalNs),W)?W:h7(W,Q,Z,GL(U),H),O=z==="positive"?V:x.unaryMinus(V);return C$.validateNew(O,"rounding")}sign(){return this.cmp(new C$(V1))}subtract($){return C$.validateNew(x.subtract(this.totalNs,$.totalNs),"difference")}}C$.MAX=x.BigInt("9007199254740991999999999"),C$.ZERO=new C$(V1);var RA=/[A-Za-z._][A-Za-z._0-9+-]*/,H3=new RegExp(`(?:${/(?:[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)/.source}|(?:${RA.source})(?:\\/(?:${RA.source}))*)`),NL=/(?:[+-]\d{6}|\d{4})/,R7=/(?:0[1-9]|1[0-2])/,qw=/(?:0[1-9]|[12]\d|3[01])/,tk=new RegExp(`(${NL.source})(?:-(${R7.source})-(${qw.source})|(${R7.source})(${qw.source}))`),FL=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,ML=/((?:[+-])(?:[01][0-9]|2[0-3])(?::?(?:[0-5][0-9])(?::?(?:[0-5][0-9])(?:[.,](?:\d{1,9}))?)?)?)/,JL=new RegExp(`([zZ])|${ML.source}?`),sX=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,ak=new RegExp([`^${tk.source}`,`(?:(?:[tT]|\\s+)${FL.source}(?:${JL.source})?)?`,`(?:\\[!?(${H3.source})\\])?`,`((?:${sX.source})*)$`].join("")),sk=new RegExp([`^[tT]?${FL.source}`,`(?:${JL.source})?`,`(?:\\[!?${H3.source}\\])?`,`((?:${sX.source})*)$`].join("")),ek=new RegExp(`^(${NL.source})-?(${R7.source})(?:\\[!?${H3.source}\\])?((?:${sX.source})*)$`),$b=new RegExp(`^(?:--)?(${R7.source})-?(${qw.source})(?:\\[!?${H3.source}\\])?((?:${sX.source})*)$`),Dw=/(\d+)(?:[.,](\d{1,9}))?/,Xb=new RegExp(`(?:${Dw.source}H)?(?:${Dw.source}M)?(?:${Dw.source}S)?`),Yb=new RegExp(`^([+-])?P${/(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/.source}(?:T(?!$)${Xb.source})?$`,"i"),P2=86400000,T7=1e6*P2,Gb=60000000000,AL=1e8*P2,eX=c1(AL),$3=x.unaryMinus(eX),Ub=x.add(x.subtract($3,j2),eG),zb=x.subtract(x.add(eX,j2),eG),Wb=146097*P2,TA=-271821,vA=275760,oG=Date.UTC(1847,0,1),Qb=["iso8601","hebrew","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","islamicc","persian","ethiopic","ethioaa","ethiopic-amete-alem","coptic","chinese","dangi","roc","indian","buddhist","japanese","gregory"],Zb=new Set(["ACT","AET","AGT","ART","AST","BET","BST","CAT","CNT","CST","CTT","EAT","ECT","IET","IST","JST","MIT","NET","NST","PLT","PNT","PRT","PST","SST","VST"]);function N4($){return typeof $=="object"&&$!==null||typeof $=="function"}function g7($){if(typeof $=="bigint")throw new TypeError("Cannot convert BigInt to number");return Number($)}function y7($){if(typeof $=="symbol")throw new TypeError("Cannot convert a Symbol value to a String");return String($)}function F$($){let X=g7($);if(X===0)return 0;if(Number.isNaN(X)||X===1/0||X===-1/0)throw new RangeError("invalid number value");let Y=Math.trunc(X);return Y===0?0:Y}function CA($,X){let Y=F$($);if(Y<=0){if(X!==void 0)throw new RangeError(`property '${X}' cannot be a a number less than one`);throw new RangeError("Cannot convert a number less than one to a positive integer")}return Y}function m1($){let X=g7($);if(Number.isNaN(X))throw new RangeError("not a number");if(X===1/0||X===-1/0)throw new RangeError("infinity is out of range");if(!function(Y){if(typeof Y!="number"||Number.isNaN(Y)||Y===1/0||Y===-1/0)return!1;let U=Math.abs(Y);return Math.floor(U)===U}(X))throw new RangeError(`unsupported fractional value ${$}`);return X===0?0:X}function X3($,X){return String($).padStart(X,"0")}function h4($){if(typeof $!="string")throw new TypeError(`expected a string, not ${String($)}`);return $}function Rw($,X){if(N4($)){let Y=$?.toString();if(typeof Y=="string"||typeof Y=="number")return Y;throw new TypeError("Cannot convert object to primitive value")}return $}var Tw=["era","eraYear","year","month","monthCode","day","hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],Hb={era:y7,eraYear:F$,year:F$,month:CA,monthCode:function($){let X=h4(Rw($));if(X.length<3||X.length>4||X[0]!=="M"||"0123456789".indexOf(X[1])===-1||"0123456789".indexOf(X[2])===-1||X[1]+X[2]==="00"&&X[3]!=="L"||X[3]!=="L"&&X[3]!==void 0)throw new RangeError(`bad month code ${X}; must match M01-M99 or M00L-M99L`);return X},day:CA,hour:F$,minute:F$,second:F$,millisecond:F$,microsecond:F$,nanosecond:F$,offset:function($){let X=h4(Rw($));return V9(X),X},timeZone:P6},Vb={hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},$9=[["years","year","date"],["months","month","date"],["weeks","week","date"],["days","day","date"],["hours","hour","time"],["minutes","minute","time"],["seconds","second","time"],["milliseconds","millisecond","time"],["microseconds","microsecond","time"],["nanoseconds","nanosecond","time"]],BA=Object.fromEntries($9.map(($)=>[$[0],$[1]])),Ob=Object.fromEntries($9.map(([$,X])=>[X,$])),nG=$9.map(([,$])=>$),X9={day:T7,hour:3600000000000,minute:60000000000,second:1e9,millisecond:1e6,microsecond:1000,nanosecond:1},v7=["days","hours","microseconds","milliseconds","minutes","months","nanoseconds","seconds","weeks","years"],wb=Intl.DateTimeFormat,jA=new Map;function LL($){let X=W3($),Y=jA.get(X);return Y===void 0&&(Y=new wb("en-us",{timeZone:X,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),jA.set(X,Y)),Y}function a4($){return x6($,D$)&&!x6($,m$,p)}function w4($){return x6($,L6,K6,_6,q6,R6,T6,v6,C6,d6)}function D4($){return x6($,UL)}function J4($){return x6($,E4)}function e$($){return x6($,W4)}function s4($){return x6($,zL)}function H1($){return x6($,WL)}function v$($){return x6($,D$,m$,p)}function k($,X){if(!X($))throw new TypeError("invalid receiver: method called with the wrong type of this-object")}function Q9($){if(x6($,p)||x6($,m$))throw new TypeError("with() does not support a calendar or timeZone property");if(J4($))throw new TypeError("with() does not accept Temporal.PlainTime, use withPlainTime() instead");if($.calendar!==void 0)throw new TypeError("with() does not support a calendar property");if($.timeZone!==void 0)throw new TypeError("with() does not support a timeZone property")}function V3($,X){return X==="never"||X==="auto"&&$==="iso8601"?"":`[${X==="critical"?"!":""}u-ca=${$}]`}function m7($){let X,Y,U=!1;for(sX.lastIndex=0;Y=sX.exec($);){let{1:G,2:z,3:W}=Y;if(z==="u-ca"){if(X===void 0)X=W,U=G==="!";else if(G==="!"||U)throw new RangeError(`Invalid annotations in ${$}: more than one u-ca present with critical flag`)}else if(G==="!")throw new RangeError(`Unrecognized annotation: !${z}=${W}`)}return X}function D0($){let X=ak.exec($);if(!X)throw new RangeError(`invalid RFC 9557 string: ${$}`);let Y=m7(X[16]),U=X[1];if(U==="-000000")throw new RangeError(`invalid RFC 9557 string: ${$}`);let G=+U,z=+(X[2]??X[4]??1),W=+(X[3]??X[5]??1),Q=X[6]!==void 0,Z=+(X[6]??0),H=+(X[7]??X[10]??0),V=+(X[8]??X[11]??0);V===60&&(V=59);let O=(X[9]??X[12]??"")+"000000000",w=+O.slice(0,3),D=+O.slice(3,6),E=+O.slice(6,9),F,J=!1;X[13]?(F=void 0,J=!0):X[14]&&(F=X[14]);let A=X[15];return pw(G,z,W,Z,H,V,w,D,E),{year:G,month:z,day:W,time:Q?{hour:Z,minute:H,second:V,millisecond:w,microsecond:D,nanosecond:E}:"start-of-day",tzAnnotation:A,offset:F,z:J,calendar:Y}}function KL($){let X=sk.exec($),Y,U,G,z,W,Q,Z;if(X){Z=m7(X[10]),Y=+(X[1]??0),U=+(X[2]??X[5]??0),G=+(X[3]??X[6]??0),G===60&&(G=59);let H=(X[4]??X[7]??"")+"000000000";if(z=+H.slice(0,3),W=+H.slice(3,6),Q=+H.slice(6,9),X[8])throw new RangeError("Z designator not supported for PlainTime")}else{let H,V;if({time:H,z:V,calendar:Z}=D0($),H==="start-of-day")throw new RangeError(`time is missing in string: ${$}`);if(V)throw new RangeError("Z designator not supported for PlainTime");({hour:Y,minute:U,second:G,millisecond:z,microsecond:W,nanosecond:Q}=H)}if(d7(Y,U,G,z,W,Q),/[tT ][0-9][0-9]/.test($))return{hour:Y,minute:U,second:G,millisecond:z,microsecond:W,nanosecond:Q,calendar:Z};try{let{month:H,day:V}=yw($);P8(1972,H,V)}catch{try{let{year:H,month:V}=gw($);P8(H,V,1)}catch{return{hour:Y,minute:U,second:G,millisecond:z,microsecond:W,nanosecond:Q,calendar:Z}}}throw new RangeError(`invalid RFC 9557 time-only string ${$}; may need a T prefix`)}function gw($){let X=ek.exec($),Y,U,G,z;if(X){G=m7(X[3]);let W=X[1];if(W==="-000000")throw new RangeError(`invalid RFC 9557 string: ${$}`);if(Y=+W,U=+X[2],z=1,G!==void 0&&G!=="iso8601")throw new RangeError("YYYY-MM format is only valid with iso8601 calendar")}else{let W;if({year:Y,month:U,calendar:G,day:z,z:W}=D0($),W)throw new RangeError("Z designator not supported for PlainYearMonth")}return{year:Y,month:U,calendar:G,referenceISODay:z}}function yw($){let X=$b.exec($),Y,U,G,z;if(X){if(G=m7(X[3]),Y=+X[1],U=+X[2],G!==void 0&&G!=="iso8601")throw new RangeError("MM-DD format is only valid with iso8601 calendar")}else{let W;if({month:Y,day:U,calendar:G,year:z,z:W}=D0($),W)throw new RangeError("Z designator not supported for PlainMonthDay")}return{month:Y,day:U,calendar:G,referenceISOYear:z}}var _L=new RegExp(`^${H3.source}$`,"i"),qL=new RegExp(`^${/([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])?)?/.source}$`);function RL($){let X=Eb.test($)?"Seconds not allowed in offset time zone":"Invalid time zone";throw new RangeError(`${X}: ${$}`)}function B2($){return _L.test($)||RL($),qL.test($)?{offsetMinutes:V9($)/60000000000}:{tzName:$}}function tG($,X,Y,U){let G=$,z=X,W=Y;switch(U){case"reject":P8(G,z,W);break;case"constrain":({year:G,month:z,day:W}=uL(G,z,W))}return{year:G,month:z,day:W}}function u7($,X,Y,U,G,z,W){let Q=$,Z=X,H=Y,V=U,O=G,w=z;switch(W){case"reject":d7(Q,Z,H,V,O,w);break;case"constrain":Q=B6(Q,0,23),Z=B6(Z,0,59),H=B6(H,0,59),V=B6(V,0,999),O=B6(O,0,999),w=B6(w,0,999)}return{hour:Q,minute:Z,second:H,millisecond:V,microsecond:O,nanosecond:w}}function TL($){if(!N4($))throw new TypeError("invalid duration-like");let X={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0},Y=!1;for(let U=0;U<v7.length;U++){let G=v7[U],z=$[G];z!==void 0&&(Y=!0,X[G]=m1(z))}if(!Y)throw new TypeError("invalid duration-like");return X}function Q6({years:$,months:X,weeks:Y,days:U},G,z,W){return{years:$,months:W??X,weeks:z??Y,days:G??U}}function k$($,X){return{isoDate:$,time:X}}function x$($){return r0($,"overflow",["constrain","reject"],"constrain")}function aG($){return r0($,"disambiguation",["compatible","earlier","later","reject"],"compatible")}function p1($,X){return r0($,"roundingMode",["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"],X)}function _7($,X){return r0($,"offset",["prefer","use","ignore","reject"],X)}function O3($){return r0($,"calendarName",["auto","always","never","critical"],"auto")}function Z9($){let X=$.roundingIncrement;if(X===void 0)return 1;let Y=F$(X);if(Y<1||Y>1e9)throw new RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${X}`);return Y}function H9($,X,Y){let U=Y?X:X-1;if($>U)throw new RangeError(`roundingIncrement must be at least 1 and less than ${U}, not ${$}`);if(X%$!=0)throw new RangeError(`Rounding increment must divide evenly into ${X}`)}function w3($){let X=$.fractionalSecondDigits;if(X===void 0)return"auto";if(typeof X!="number"){if(y7(X)!=="auto")throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${X}`);return"auto"}let Y=Math.floor(X);if(!Number.isFinite(Y)||Y<0||Y>9)throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${X}`);return Y}function D3($,X){switch($){case"minute":return{precision:"minute",unit:"minute",increment:1};case"second":return{precision:0,unit:"second",increment:1};case"millisecond":return{precision:3,unit:"millisecond",increment:1};case"microsecond":return{precision:6,unit:"microsecond",increment:1};case"nanosecond":return{precision:9,unit:"nanosecond",increment:1}}switch(X){case"auto":return{precision:X,unit:"nanosecond",increment:1};case 0:return{precision:X,unit:"second",increment:1};case 1:case 2:case 3:return{precision:X,unit:"millisecond",increment:10**(3-X)};case 4:case 5:case 6:return{precision:X,unit:"microsecond",increment:10**(6-X)};case 7:case 8:case 9:return{precision:X,unit:"nanosecond",increment:10**(9-X)};default:throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${X}`)}}var o0=Symbol("~required~");function r6($,X,Y,U,G=[]){let z=[];for(let H=0;H<$9.length;H++){let V=$9[H],O=V[1],w=V[2];Y!=="datetime"&&Y!==w||z.push(O)}z=z.concat(G);let W=U;W===o0?W=void 0:W!==void 0&&z.push(W);let Q=[];Q=Q.concat(z);for(let H=0;H<z.length;H++){let V=z[H],O=Ob[V];O!==void 0&&Q.push(O)}let Z=r0($,X,Q,W);if(Z===void 0&&U===o0)throw new RangeError(`${X} is required`);return Z&&Z in BA?BA[Z]:Z}function Ew($){let X=$.relativeTo;if(X===void 0)return{};let Y,U,G,z,W,Q="option",Z=!1;if(N4(X)){if(v$(X))return{zonedRelativeTo:X};if(D4(X))return{plainRelativeTo:X};if(e$(X))return{plainRelativeTo:j6(N(X,W4).isoDate,N(X,p))};G=J3(X);let H=E1(G,X,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],[]);({isoDate:Y,time:U}=N3(G,H,"constrain")),{offset:W,timeZone:z}=H,W===void 0&&(Q="wall")}else{let H,V,O,w,D;if({year:O,month:w,day:D,time:U,calendar:G,tzAnnotation:H,offset:W,z:V}=D0(h4(X)),H)z=P6(H),V?Q="exact":W||(Q="wall"),Z=!0;else if(V)throw new RangeError("Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone");G||(G="iso8601"),G=S6(G),Y={year:O,month:w,day:D}}return z===void 0?{plainRelativeTo:j6(Y,G)}:{zonedRelativeTo:W6(C7(Y,U,Q,Q==="option"?V9(W):0,z,"compatible","reject",Z),z,G)}}function m0($){return N($,L6)!==0?"year":N($,K6)!==0?"month":N($,p6)!==0?"week":N($,_6)!==0?"day":N($,q6)!==0?"hour":N($,R6)!==0?"minute":N($,T6)!==0?"second":N($,v6)!==0?"millisecond":N($,C6)!==0?"microsecond":"nanosecond"}function d0($,X){return nG.indexOf($)>nG.indexOf(X)?X:$}function W0($){return $==="year"||$==="month"||$==="week"}function u0($){return W0($)||$==="day"?"date":"time"}function x2($){return $6("%calendarImpl%")($)}function E3($){return $6("%calendarImpl%")(N($,p))}function I6($,X,Y="date"){let U=Object.create(null),G=x2($).isoToDate(X,{year:!0,monthCode:!0,day:!0});return U.monthCode=G.monthCode,Y!=="month-day"&&Y!=="date"||(U.day=G.day),Y!=="year-month"&&Y!=="date"||(U.year=G.year),U}function E1($,X,Y,U,G){let z=x2($).extraFields(Y),W=Y.concat(U,z),Q=Object.create(null),Z=!1;W.sort();for(let H=0;H<W.length;H++){let V=W[H],O=X[V];if(O!==void 0)Z=!0,Q[V]=(0,Hb[V])(O);else if(G!=="partial"){if(G.includes(V))throw new TypeError(`required property '${V}' missing or undefined`);Q[V]=Vb[V]}}if(G==="partial"&&!Z)throw new TypeError("no supported properties found");return Q}function vw($,X="complete"){let Y=["hour","microsecond","millisecond","minute","nanosecond","second"],U=!1,G=Object.create(null);for(let z=0;z<Y.length;z++){let W=Y[z],Q=$[W];Q!==void 0?(G[W]=F$(Q),U=!0):X==="complete"&&(G[W]=0)}if(!U)throw new TypeError("invalid time-like");return G}function uG($,X){if(N4($)){if(D4($))return x$(Q$(X)),j6(N($,E$),N($,p));if(v$($)){let Z=T1(N($,m$),N($,D$));return x$(Q$(X)),j6(Z.isoDate,N($,p))}if(e$($))return x$(Q$(X)),j6(N($,W4).isoDate,N($,p));let Q=J3($);return j6(I2(Q,E1(Q,$,["year","month","monthCode","day"],[],[]),x$(Q$(X))),Q)}let{year:Y,month:U,day:G,calendar:z,z:W}=D0(h4($));if(W)throw new RangeError("Z designator not supported for PlainDate");return z||(z="iso8601"),z=S6(z),x$(Q$(X)),j6({year:Y,month:U,day:G},z)}function N3($,X,Y){return k$(I2($,X,Y),u7(X.hour,X.minute,X.second,X.millisecond,X.microsecond,X.nanosecond,Y))}function cG($,X){let Y,U,G;if(N4($)){if(e$($))return x$(Q$(X)),_1(N($,W4),N($,p));if(v$($)){let Q=T1(N($,m$),N($,D$));return x$(Q$(X)),_1(Q,N($,p))}if(D4($))return x$(Q$(X)),_1(k$(N($,E$),{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),N($,p));G=J3($);let z=E1(G,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond"],[]),W=x$(Q$(X));({isoDate:Y,time:U}=N3(G,z,W))}else{let z,W,Q,Z;if({year:W,month:Q,day:Z,time:U,calendar:G,z}=D0(h4($)),z)throw new RangeError("Z designator not supported for PlainDateTime");U==="start-of-day"&&(U={deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),pw(W,Q,Z,U.hour,U.minute,U.second,U.millisecond,U.microsecond,U.nanosecond),G||(G="iso8601"),G=S6(G),x$(Q$(X)),Y={year:W,month:Q,day:Z}}return _1(k$(Y,U),G)}function R1($){let X=$6("%Temporal.Duration%");if(w4($))return new X(N($,L6),N($,K6),N($,p6),N($,_6),N($,q6),N($,R6),N($,T6),N($,v6),N($,C6),N($,d6));if(!N4($))return function(G){let{years:z,months:W,weeks:Q,days:Z,hours:H,minutes:V,seconds:O,milliseconds:w,microseconds:D,nanoseconds:E}=function(F){let J=Yb.exec(F);if(!J)throw new RangeError(`invalid duration: ${F}`);if(J.every((c,H$)=>H$<2||c===void 0))throw new RangeError(`invalid duration: ${F}`);let A=J[1]==="-"?-1:1,L=J[2]===void 0?0:F$(J[2])*A,T=J[3]===void 0?0:F$(J[3])*A,q=J[4]===void 0?0:F$(J[4])*A,v=J[5]===void 0?0:F$(J[5])*A,I=J[6]===void 0?0:F$(J[6])*A,S=J[7],y=J[8],r=J[9],j=J[10],X$=J[11],l=0,W$=0,L$=0;if(S!==void 0){if(y??r??j??X$)throw new RangeError("only the smallest unit can be fractional");L$=3600*F$((S+"000000000").slice(0,9))*A}else if(l=y===void 0?0:F$(y)*A,r!==void 0){if(j??X$)throw new RangeError("only the smallest unit can be fractional");L$=60*F$((r+"000000000").slice(0,9))*A}else W$=j===void 0?0:F$(j)*A,X$!==void 0&&(L$=F$((X$+"000000000").slice(0,9))*A);let b$=L$%1000,L4=Math.trunc(L$/1000)%1000,X6=Math.trunc(L$/1e6)%1000;return W$+=Math.trunc(L$/1e9)%60,l+=Math.trunc(L$/60000000000),l7(L,T,q,v,I,l,W$,X6,L4,b$),{years:L,months:T,weeks:q,days:v,hours:I,minutes:l,seconds:W$,milliseconds:X6,microseconds:L4,nanoseconds:b$}}(G);return new($6("%Temporal.Duration%"))(z,W,Q,Z,H,V,O,w,D,E)}(h4($));let Y={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},U=TL($);for(let G=0;G<v7.length;G++){let z=v7[G],W=U[z];W!==void 0&&(Y[z]=W)}return new X(Y.years,Y.months,Y.weeks,Y.days,Y.hours,Y.minutes,Y.seconds,Y.milliseconds,Y.microseconds,Y.nanoseconds)}function pG($){let X;if(N4($)){if(a4($)||v$($))return u1(N($,D$));X=Rw($)}else X=$;let{year:Y,month:U,day:G,time:z,offset:W,z:Q}=function(F){let J=D0(F);if(!J.z&&!J.offset)throw new RangeError("Temporal.Instant requires a time zone offset");return J}(h4(X)),{hour:Z=0,minute:H=0,second:V=0,millisecond:O=0,microsecond:w=0,nanosecond:D=0}=z==="start-of-day"?{}:z,E=z3(Y,U,G,Z,H,V,O,w,D-(Q?0:V9(W)));return aX(E.isoDate),u1(e4(E))}function PA($,X){if(N4($)){if(H1($))return x$(Q$(X)),nX(N($,E$),N($,p));let Q;return x6($,p)?Q=N($,p):(Q=$.calendar,Q===void 0&&(Q="iso8601"),Q=M3(Q)),nX(B7(Q,E1(Q,$,["year","month","monthCode","day"],[],[]),x$(Q$(X))),Q)}let{month:Y,day:U,referenceISOYear:G,calendar:z}=yw(h4($));if(z===void 0&&(z="iso8601"),z=S6(z),x$(Q$(X)),z==="iso8601")return nX({year:1972,month:Y,day:U},z);let W={year:G,month:Y,day:U};return f8(W),W=B7(z,I6(z,W,"month-day"),"constrain"),nX(W,z)}function v2($,X){let Y;if(N4($)){if(J4($))return x$(Q$(X)),c0(N($,E4));if(e$($))return x$(Q$(X)),c0(N($,W4).time);if(v$($)){let H=T1(N($,m$),N($,D$));return x$(Q$(X)),c0(H.time)}let{hour:U,minute:G,second:z,millisecond:W,microsecond:Q,nanosecond:Z}=vw($);Y=u7(U,G,z,W,Q,Z,x$(Q$(X)))}else Y=KL(h4($)),x$(Q$(X));return c0(Y)}function vL($){return $===void 0?{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}:N(v2($),E4)}function dG($,X){if(N4($)){if(s4($))return x$(Q$(X)),tX(N($,E$),N($,p));let Q=J3($);return tX(Y3(Q,E1(Q,$,["year","month","monthCode"],[],[]),x$(Q$(X))),Q)}let{year:Y,month:U,referenceISODay:G,calendar:z}=gw(h4($));z===void 0&&(z="iso8601"),z=S6(z),x$(Q$(X));let W={year:Y,month:U,day:G};return dw(W),W=Y3(z,I6(z,W,"year-month"),"constrain"),tX(W,z)}function C7($,X,Y,U,G,z,W,Q){if(X==="start-of-day")return R2(G,$);let Z=k$($,X);if(Y==="wall"||W==="ignore")return Z6(G,Z,z);if(Y==="exact"||W==="use"){let O=z3($.year,$.month,$.day,X.hour,X.minute,X.second,X.millisecond,X.microsecond,X.nanosecond-U);aX(O.isoDate);let w=e4(O);return O0(w),w}aX($);let H=e4(Z),V=G3(G,Z);for(let O=0;O<V.length;O++){let w=V[O],D=x.toNumber(x.subtract(H,w)),E=C2(D,60000000000,"halfExpand");if(D===U||Q&&E===U)return w}if(W==="reject"){let O=Cw(U),w=U3(Z,"iso8601","auto");throw new RangeError(`Offset ${O} is invalid for ${w} in ${G}`)}return bL(V,G,Z,z)}function lG($,X){let Y,U,G,z,W,Q,Z,H=!1,V="option";if(N4($)){if(v$($)){let F=Q$(X);return aG(F),_7(F,"reject"),x$(F),W6(N($,D$),N($,m$),N($,p))}W=J3($);let w=E1(W,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],["timeZone"]);({offset:z,timeZone:G}=w),z===void 0&&(V="wall");let D=Q$(X);Q=aG(D),Z=_7(D,"reject");let E=x$(D);({isoDate:Y,time:U}=N3(W,w,E))}else{let w,D,E,F,J;({year:E,month:F,day:J,time:U,tzAnnotation:w,offset:z,z:D,calendar:W}=function(L){let T=D0(L);if(!T.tzAnnotation)throw new RangeError("Temporal.ZonedDateTime requires a time zone ID in brackets");return T}(h4($))),G=P6(w),D?V="exact":z||(V="wall"),W||(W="iso8601"),W=S6(W),H=!0;let A=Q$(X);Q=aG(A),Z=_7(A,"reject"),x$(A),Y={year:E,month:F,day:J}}let O=0;return V==="option"&&(O=V9(z)),W6(C7(Y,U,V,O,G,Q,Z,H),G,W)}function CL($,X,Y){f8(X),n0($),R$($,E$,X),R$($,p,Y),R$($,UL,!0)}function j6($,X){let Y=$6("%Temporal.PlainDate%"),U=Object.create(Y.prototype);return CL(U,$,X),U}function BL($,X,Y){I8(X),n0($),R$($,W4,X),R$($,p,Y)}function _1($,X){let Y=$6("%Temporal.PlainDateTime%"),U=Object.create(Y.prototype);return BL(U,$,X),U}function jL($,X,Y){f8(X),n0($),R$($,E$,X),R$($,p,Y),R$($,WL,!0)}function nX($,X){let Y=$6("%Temporal.PlainMonthDay%"),U=Object.create(Y.prototype);return jL(U,$,X),U}function PL($,X){n0($),R$($,E4,X)}function c0($){let X=$6("%Temporal.PlainTime%"),Y=Object.create(X.prototype);return PL(Y,$),Y}function IL($,X,Y){dw(X),n0($),R$($,E$,X),R$($,p,Y),R$($,zL,!0)}function tX($,X){let Y=$6("%Temporal.PlainYearMonth%"),U=Object.create(Y.prototype);return IL(U,$,X),U}function xL($,X){O0(X),n0($),R$($,D$,X)}function u1($){let X=$6("%Temporal.Instant%"),Y=Object.create(X.prototype);return xL(Y,$),Y}function SL($,X,Y,U){O0(X),n0($),R$($,D$,X),R$($,m$,Y),R$($,p,U)}function W6($,X,Y="iso8601"){let U=$6("%Temporal.ZonedDateTime%"),G=Object.create(U.prototype);return SL(G,$,X,Y),G}function IA($){return Tw.filter((X)=>$[X]!==void 0)}function j8($,X,Y){let U=IA(Y),G=x2($).fieldKeysToIgnore(U),z=Object.create(null),W=IA(X);for(let Q=0;Q<Tw.length;Q++){let Z,H=Tw[Q];W.includes(H)&&!G.includes(H)&&(Z=X[H]),U.includes(H)&&(Z=Y[H]),Z!==void 0&&(z[H]=Z)}return z}function w1($,X,Y,U){let G=x2($).dateAdd(X,Y,U);return f8(G),G}function F3($,X,Y,U){return x2($).dateUntil(X,Y,U)}function M3($){if(N4($)&&x6($,p))return N($,p);let X=h4($);try{return S6(X)}catch{}let Y;try{({calendar:Y}=D0(X))}catch{try{({calendar:Y}=KL(X))}catch{try{({calendar:Y}=gw(X))}catch{({calendar:Y}=yw(X))}}}return Y||(Y="iso8601"),S6(Y)}function J3($){if(x6($,p))return N($,p);let{calendar:X}=$;return X===void 0?"iso8601":M3(X)}function V0($,X){return S6($)===S6(X)}function I2($,X,Y){let U=x2($);U.resolveFields(X,"date");let G=U.dateToISO(X,Y);return f8(G),G}function Y3($,X,Y){let U=x2($);U.resolveFields(X,"year-month"),X.day=1;let G=U.dateToISO(X,Y);return dw(G),G}function B7($,X,Y){let U=x2($);U.resolveFields(X,"month-day");let G=U.monthDayToISOReferenceDate(X,Y);return f8(G),G}function P6($){if(N4($)&&v$($))return N($,m$);let X=h4($);if(X==="UTC")return"UTC";let{tzName:Y,offsetMinutes:U}=function(z){let{tzAnnotation:W,offset:Q,z:Z}=function(H){if(_L.test(H))return{tzAnnotation:H,offset:void 0,z:!1};try{let{tzAnnotation:V,offset:O,z:w}=D0(H);if(w||V||O)return{tzAnnotation:V,offset:O,z:w}}catch{}RL(H)}(z);return W?B2(W):Z?B2("UTC"):Q?B2(Q):void 0}(X);if(U!==void 0)return mw(U);let G=j7(Y);if(!G)throw new RangeError(`Unrecognized time zone ${Y}`);return G.identifier}function kL($,X){if($===X)return!0;let Y=B2($).offsetMinutes,U=B2(X).offsetMinutes;if(Y===void 0&&U===void 0){let G=j7(X);if(!G)return!1;let z=j7($);return!!z&&z.primaryIdentifier===G.primaryIdentifier}return Y===U}function p0($,X){let Y=B2($).offsetMinutes;return Y!==void 0?60000000000*Y:Bw($,X)}function Cw($){let X=$<0?"-":"+",Y=Math.abs($),U=Math.floor(Y/3600000000000),G=Math.floor(Y/60000000000)%60,z=Math.floor(Y/1e9)%60,W=Y%1e9;return`${X}${c7(U,G,z,W,z===0&&W===0?"minute":"auto")}`}function T1($,X){let Y=p0($,X),{isoDate:{year:U,month:G,day:z},time:{hour:W,minute:Q,second:Z,millisecond:H,microsecond:V,nanosecond:O}}=gL(X);return z3(U,G,z,W,Q,Z,H,V,O+Y)}function Z6($,X,Y){return bL(G3($,X),$,X,Y)}function bL($,X,Y,U){let G=$.length;if(G===1)return $[0];if(G)switch(U){case"compatible":case"earlier":return $[0];case"later":return $[G-1];case"reject":throw new RangeError("multiple instants found")}if(U==="reject")throw new RangeError("multiple instants found");let z=e4(Y),W=x.subtract(z,j2);O0(W);let Q=p0(X,W),Z=x.add(z,j2);O0(Z);let H=p0(X,Z)-Q;switch(U){case"earlier":{let V=C$.fromComponents(0,0,0,0,0,-H),O=Y9(Y.time,V);return G3(X,k$(i6(Y.isoDate.year,Y.isoDate.month,Y.isoDate.day+O.deltaDays),O))[0]}case"compatible":case"later":{let V=C$.fromComponents(0,0,0,0,0,H),O=Y9(Y.time,V),w=G3(X,k$(i6(Y.isoDate.year,Y.isoDate.month,Y.isoDate.day+O.deltaDays),O));return w[w.length-1]}}}function G3($,X){if($==="UTC")return aX(X.isoDate),[e4(X)];let Y=B2($).offsetMinutes;if(Y!==void 0){let U=z3(X.isoDate.year,X.isoDate.month,X.isoDate.day,X.time.hour,X.time.minute-Y,X.time.second,X.time.millisecond,X.time.microsecond,X.time.nanosecond);aX(U.isoDate);let G=e4(U);return O0(G),[G]}return aX(X.isoDate),function(U,G){let z=e4(G),W=x.subtract(z,j2);x.lessThan(W,$3)&&(W=z);let Q=x.add(z,j2);x.greaterThan(Q,eX)&&(Q=z);let Z=Bw(U,W),H=Bw(U,Q);return(Z===H?[Z]:[Z,H]).map((O)=>{let w=x.subtract(z,x.BigInt(O)),D=function(E,F){let{epochMilliseconds:J,time:{millisecond:A,microsecond:L,nanosecond:T}}=gL(F),{year:q,month:v,day:I,hour:S,minute:y,second:r}=yL(E,J);return z3(q,v,I,S,y,r,A,L,T)}(U,w);if(G9(G,D)===0)return O0(w),w}).filter((O)=>O!==void 0)}($,X)}function R2($,X){let Y=k$(X,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),U=G3($,Y);if(U.length)return U[0];let G=e4(Y),z=x.subtract(G,j2);return O0(z),cw($,z)}function A3($){let X;return X=$<0||$>9999?($<0?"-":"+")+X3(Math.abs($),6):X3($,4),X}function D1($){return X3($,2)}function fL($,X){let Y;if(X==="auto"){if($===0)return"";Y=X3($,9).replace(/0+$/,"")}else{if(X===0)return"";Y=X3($,9).slice(0,X)}return`.${Y}`}function c7($,X,Y,U,G){let z=`${D1($)}:${D1(X)}`;return G==="minute"||(z+=`:${D1(Y)}`,z+=fL(U,G)),z}function xA($,X,Y){let U=X;U===void 0&&(U="UTC");let G=N($,D$),z=U3(T1(U,G),"iso8601",Y,"never"),W="Z";return X!==void 0&&(W=hL(p0(U,G))),`${z}${W}`}function K7($,X){let Y=N($,L6),U=N($,K6),G=N($,p6),z=N($,_6),W=N($,q6),Q=N($,R6),Z=I7($),H="";Y!==0&&(H+=`${Math.abs(Y)}Y`),U!==0&&(H+=`${Math.abs(U)}M`),G!==0&&(H+=`${Math.abs(G)}W`),z!==0&&(H+=`${Math.abs(z)}D`);let V="";W!==0&&(V+=`${Math.abs(W)}H`),Q!==0&&(V+=`${Math.abs(Q)}M`);let O=C$.fromComponents(0,0,N($,T6),N($,v6),N($,C6),N($,d6));O.isZero()&&!["second","millisecond","microsecond","nanosecond"].includes(m0($))&&X==="auto"||(V+=`${Math.abs(O.sec)}${fL(Math.abs(O.subsec),X)}S`);let w=`${Z<0?"-":""}P${H}`;return V&&(w=`${w}T${V}`),w}function SA($,X="auto"){let{year:Y,month:U,day:G}=N($,E$);return`${A3(Y)}-${D1(U)}-${D1(G)}${V3(N($,p),X)}`}function kA({hour:$,minute:X,second:Y,millisecond:U,microsecond:G,nanosecond:z},W){return c7($,X,Y,1e6*U+1000*G+z,W)}function U3($,X,Y,U="auto"){let{isoDate:{year:G,month:z,day:W},time:{hour:Q,minute:Z,second:H,millisecond:V,microsecond:O,nanosecond:w}}=$;return`${A3(G)}-${D1(z)}-${D1(W)}T${c7(Q,Z,H,1e6*V+1000*O+w,Y)}${V3(X,U)}`}function bA($,X="auto"){let{year:Y,month:U,day:G}=N($,E$),z=`${D1(U)}-${D1(G)}`,W=N($,p);X!=="always"&&X!=="critical"&&W==="iso8601"||(z=`${A3(Y)}-${z}`);let Q=V3(W,X);return Q&&(z+=Q),z}function fA($,X="auto"){let{year:Y,month:U,day:G}=N($,E$),z=`${A3(Y)}-${D1(U)}`,W=N($,p);X!=="always"&&X!=="critical"&&W==="iso8601"||(z+=`-${D1(G)}`);let Q=V3(W,X);return Q&&(z+=Q),z}function hA($,X,Y="auto",U="auto",G="auto",z=void 0){let W=N($,D$);if(z){let{unit:V,increment:O,roundingMode:w}=z;W=xw(W,O,V,w)}let Q=N($,m$),Z=p0(Q,W),H=U3(T1(Q,W),"iso8601",X,"never");return G!=="never"&&(H+=hL(Z)),U!=="never"&&(H+=`[${U==="critical"?"!":""}${Q}]`),H+=V3(N($,p),Y),H}function gA($){return qL.test($)}function V9($){let X=Nb.exec($);if(!X)throw new RangeError(`invalid time zone offset: ${$}; must match \xB1HH:MM[:SS.SSSSSSSSS]`);return(X[1]==="-"?-1:1)*(1e9*(60*(60*+X[2]+ +(X[3]||0))+ +(X[4]||0))+ +((X[5]||0)+"000000000").slice(0,9))}var fG,Db=Object.assign(Object.create(null),{"/":!0,"-":!0,_:!0});function j7($){if(fG===void 0){let z=Intl.supportedValuesOf?.("timeZone");if(z){fG=new Map;for(let W=0;W<z.length;W++){let Q=z[W];fG.set(W3(Q),Q)}}else fG=null}let X=W3($),Y=fG?.get(X);if(Y)return{identifier:Y,primaryIdentifier:Y};try{Y=LL($).resolvedOptions().timeZone}catch{return}if(X==="antarctica/south_pole"&&(Y="Antarctica/McMurdo"),Zb.has($))throw new RangeError(`${$} is a legacy time zone identifier from ICU. Use ${Y} instead`);let U=[...X].map((z,W)=>W===0||Db[X[W-1]]?z.toUpperCase():z).join("").split("/");if(U.length===1)return X==="gb-eire"?{identifier:"GB-Eire",primaryIdentifier:Y}:{identifier:X.length<=3||/[-0-9]/.test(X)?X.toUpperCase():U[0],primaryIdentifier:Y};if(U[0]==="Etc")return{identifier:`Etc/${["Zulu","Greenwich","Universal"].includes(U[1])?U[1]:U[1].toUpperCase()}`,primaryIdentifier:Y};if(U[0]==="Us")return{identifier:`US/${U[1]}`,primaryIdentifier:Y};let G=new Map([["Act","ACT"],["Lhi","LHI"],["Nsw","NSW"],["Dar_Es_Salaam","Dar_es_Salaam"],["Port_Of_Spain","Port_of_Spain"],["Port-Au-Prince","Port-au-Prince"],["Isle_Of_Man","Isle_of_Man"],["Comodrivadavia","ComodRivadavia"],["Knox_In","Knox_IN"],["Dumontdurville","DumontDUrville"],["Mcmurdo","McMurdo"],["Denoronha","DeNoronha"],["Easterisland","EasterIsland"],["Bajanorte","BajaNorte"],["Bajasur","BajaSur"]]);return U[1]=G.get(U[1])??U[1],U.length>2&&(U[2]=G.get(U[2])??U[2]),{identifier:U.join("/"),primaryIdentifier:Y}}function C8($,X){let{year:Y,month:U,day:G,hour:z,minute:W,second:Q}=yL($,X),Z=X%1000;return Z<0&&(Z+=1000),1e6*(uw({isoDate:{year:Y,month:U,day:G},time:{hour:z,minute:W,second:Q,millisecond:Z}})-X)}function Bw($,X){return C8($,v1(X,"floor"))}function mw($){let X=$<0?"-":"+",Y=Math.abs($);return`${X}${c7(Math.floor(Y/60),Y%60,0,0,"minute")}`}function hL($){return mw(C2($,Gb,"halfExpand")/60000000000)}function uw({isoDate:{year:$,month:X,day:Y},time:{hour:U,minute:G,second:z,millisecond:W}}){let Q=$%400,Z=($-Q)/400,H=new Date;return H.setUTCHours(U,G,z,W),H.setUTCFullYear(Q,X-1,Y),H.getTime()+Wb*Z}function e4($){let X=uw($),Y=1000*$.time.microsecond+$.time.nanosecond;return x.add(c1(X),x.BigInt(Y))}function gL($){let X=v1($,"trunc"),Y=x.toNumber(x.remainder($,Z3));Y<0&&(Y+=1e6,X-=1);let U=Math.floor(Y/1000)%1000,G=Y%1000,z=new Date(X);return{epochMilliseconds:X,isoDate:{year:z.getUTCFullYear(),month:z.getUTCMonth()+1,day:z.getUTCDate()},time:{hour:z.getUTCHours(),minute:z.getUTCMinutes(),second:z.getUTCSeconds(),millisecond:z.getUTCMilliseconds(),microsecond:U,nanosecond:G}}}function cw($,X){if($==="UTC")return null;let Y=v1(X,"floor");if(Y<oG)return cw($,c1(oG));let U=Date.now(),G=Math.max(Y,U)+366*P2*3,z=Y,W=C8($,z),Q=z,Z=W;for(;W===Z&&z<G;){if(Q=z+2*P2*7,Q>AL)return null;Z=C8($,Q),W===Z&&(z=Q)}return W===Z?null:c1(nL((H)=>C8($,H),z,Q,W,Z))}function jw($,X){if($==="UTC")return null;let Y=v1(X,"ceil"),U=Date.now(),G=U+366*P2*3;if(Y>G){let H=jw($,c1(G));if(H===null||x.lessThan(H,c1(U)))return H}if($==="Africa/Casablanca"||$==="Africa/El_Aaiun"){let H=Date.UTC(2088,0,1);if(H<Y)return jw($,c1(H))}let z=Y-1;if(z<oG)return null;let W=C8($,z),Q=z,Z=W;for(;W===Z&&z>oG;){if(Q=z-2*P2*7,Q<oG)return null;Z=C8($,Q),W===Z&&(z=Q)}return W===Z?null:c1(nL((H)=>C8($,H),Q,z,Z,W))}function yL($,X){return function(Y){let U=Y.split(/[^\w]+/);if(U.length!==7)throw new RangeError(`expected 7 parts in "${Y}`);let G=+U[0],z=+U[1],W=+U[2],Q=U[3];if(Q[0]==="b"||Q[0]==="B")W=1-W;else if(Q[0]!=="a"&&Q[0]!=="A")throw new RangeError(`Unknown era ${Q} in "${Y}`);let Z=U[4]==="24"?0:+U[4],H=+U[5],V=+U[6];if(!(Number.isFinite(W)&&Number.isFinite(G)&&Number.isFinite(z)&&Number.isFinite(Z)&&Number.isFinite(H)&&Number.isFinite(V)))throw new RangeError(`Invalid number in "${Y}`);return{year:W,month:G,day:z,hour:Z,minute:H,second:V}}(LL($).format(X))}function P7($){return $!==void 0&&!($%4!=0||$%100==0&&$%400!=0)}function B8($,X){return{standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[P7($)?"leapyear":"standard"][X-1]}function I7($){let X=[N($,L6),N($,K6),N($,p6),N($,_6),N($,q6),N($,R6),N($,T6),N($,v6),N($,C6),N($,d6)];for(let Y=0;Y<X.length;Y++){let U=X[Y];if(U!==0)return U<0?-1:1}return 0}function p7($){let X=["years","months","weeks","days"];for(let Y=0;Y<X.length;Y++){let U=$[X[Y]];if(U!==0)return U<0?-1:1}return 0}function mL($){let X=p7($.date);return X!==0?X:$.time.sign()}function v8($,X){let Y=$,U=X;if(!Number.isFinite(Y)||!Number.isFinite(U))throw new RangeError("infinity is out of range");return U-=1,Y+=Math.floor(U/12),U%=12,U<0&&(U+=12),U+=1,{year:Y,month:U}}function i6($,X,Y){let U=$,G=X,z=Y;if(!Number.isFinite(z))throw new RangeError("infinity is out of range");({year:U,month:G}=v8(U,G));let W=146097;if(Math.abs(z)>W){let H=Math.trunc(z/W);U+=400*H,z-=H*W}let Q=0,Z=G>2?U:U-1;for(;Q=P7(Z)?366:365,z<-Q;)U-=1,Z-=1,z+=Q;for(Z+=1;Q=P7(Z)?366:365,z>Q;)U+=1,Z+=1,z-=Q;for(;z<1;)({year:U,month:G}=v8(U,G-1)),z+=B8(U,G);for(;z>B8(U,G);)z-=B8(U,G),{year:U,month:G}=v8(U,G+1);return{year:U,month:G,day:z}}function z3($,X,Y,U,G,z,W,Q,Z){let H=T2(U,G,z,W,Q,Z);return k$(i6($,X,Y+H.deltaDays),H)}function T2($,X,Y,U,G,z){let W,Q=$,Z=X,H=Y,V=U,O=G,w=z;({div:W,mod:w}=oX(w,3)),O+=W,w<0&&(O-=1,w+=1000),{div:W,mod:O}=oX(O,3),V+=W,O<0&&(V-=1,O+=1000),H+=Math.trunc(V/1000),V%=1000,V<0&&(H-=1,V+=1000),Z+=Math.trunc(H/60),H%=60,H<0&&(Z-=1,H+=60),Q+=Math.trunc(Z/60),Z%=60,Z<0&&(Q-=1,Z+=60);let D=Math.trunc(Q/24);return Q%=24,Q<0&&(D-=1,Q+=24),D+=0,Q+=0,Z+=0,H+=0,V+=0,O+=0,w+=0,{deltaDays:D,hour:Q,minute:Z,second:H,millisecond:V,microsecond:O,nanosecond:w}}function yA($,X){let Y=Q6($,0);if(p7(Y)===0)return $.days;let U=N(X,E$),G=w1(N(X,p),U,Y,"constrain"),z=x8(U.year,U.month-1,U.day),W=x8(G.year,G.month-1,G.day)-z;return $.days+W}function o6($){return new($6("%Temporal.Duration%"))(-N($,L6),-N($,K6),-N($,p6),-N($,_6),-N($,q6),-N($,R6),-N($,T6),-N($,v6),-N($,C6),-N($,d6))}function B6($,X,Y){return Math.min(Y,Math.max(X,$))}function uL($,X,Y){let U=B6(X,1,12);return{year:$,month:U,day:B6(Y,1,B8($,U))}}function r4($,X,Y){if($<X||$>Y)throw new RangeError(`value out of range: ${X} <= ${$} <= ${Y}`)}function P8($,X,Y){r4(X,1,12),r4(Y,1,B8($,X))}function f8($){I8(k$($,{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}))}function d7($,X,Y,U,G,z){r4($,0,23),r4(X,0,59),r4(Y,0,59),r4(U,0,999),r4(G,0,999),r4(z,0,999)}function pw($,X,Y,U,G,z,W,Q,Z){P8($,X,Y),d7(U,G,z,W,Q,Z)}function I8($){let X=e4($);(x.lessThan(X,Ub)||x.greaterThan(X,zb))&&O0(X)}function Pw($){e4($)}function O0($){if(x.lessThan($,$3)||x.greaterThan($,eX))throw new RangeError("date/time value is outside of supported range")}function dw({year:$,month:X}){r4($,TA,vA),$===TA?r4(X,4,12):$===vA&&r4(X,1,9)}function l7($,X,Y,U,G,z,W,Q,Z,H){let V=0,O=[$,X,Y,U,G,z,W,Q,Z,H];for(let A=0;A<O.length;A++){let L=O[A];if(L===1/0||L===-1/0)throw new RangeError("infinite values not allowed as duration fields");if(L!==0){let T=L<0?-1:1;if(V!==0&&T!==V)throw new RangeError("mixed-sign values not allowed as duration fields");V=T}}if(Math.abs($)>=4294967296||Math.abs(X)>=4294967296||Math.abs(Y)>=4294967296)throw new RangeError("years, months, and weeks must be < 2\xB3\xB2");let w=oX(Q,3),D=oX(Z,6),E=oX(H,9),F=oX(1e6*w.mod+1000*D.mod+E.mod,9).div,J=86400*U+3600*G+60*z+W+w.div+D.div+E.div+F;if(!Number.isSafeInteger(J))throw new RangeError("total of duration time units cannot exceed 9007199254740991.999999999 s")}function iX($){return{date:{years:N($,L6),months:N($,K6),weeks:N($,p6),days:N($,_6)},time:C$.fromComponents(N($,q6),N($,R6),N($,T6),N($,v6),N($,C6),N($,d6))}}function Z0($){let X=C$.fromComponents(N($,q6),N($,R6),N($,T6),N($,v6),N($,C6),N($,d6)).add24HourDays(N($,_6));return{date:{years:N($,L6),months:N($,K6),weeks:N($,p6),days:0},time:X}}function cL($){let X=Z0($),Y=Math.trunc(X.time.sec/86400);return l7(X.date.years,X.date.months,X.date.weeks,Y,0,0,0,0,0,0),{...X.date,days:Y}}function q1($,X){let Y=$.time.sign(),U=$.time.abs().subsec,G=0,z=0,W=$.time.abs().sec,Q=0,Z=0,H=0;switch(X){case"year":case"month":case"week":case"day":G=Math.trunc(U/1000),U%=1000,z=Math.trunc(G/1000),G%=1000,W+=Math.trunc(z/1000),z%=1000,Q=Math.trunc(W/60),W%=60,Z=Math.trunc(Q/60),Q%=60,H=Math.trunc(Z/24),Z%=24;break;case"hour":G=Math.trunc(U/1000),U%=1000,z=Math.trunc(G/1000),G%=1000,W+=Math.trunc(z/1000),z%=1000,Q=Math.trunc(W/60),W%=60,Z=Math.trunc(Q/60),Q%=60;break;case"minute":G=Math.trunc(U/1000),U%=1000,z=Math.trunc(G/1000),G%=1000,W+=Math.trunc(z/1000),z%=1000,Q=Math.trunc(W/60),W%=60;break;case"second":G=Math.trunc(U/1000),U%=1000,z=Math.trunc(G/1000),G%=1000,W+=Math.trunc(z/1000),z%=1000;break;case"millisecond":G=Math.trunc(U/1000),U%=1000,z=ww(W,3,Math.trunc(G/1000)),G%=1000,W=0;break;case"microsecond":G=ww(W,6,Math.trunc(U/1000)),U%=1000,W=0;break;case"nanosecond":U=ww(W,9,U),W=0}return new($6("%Temporal.Duration%"))($.date.years,$.date.months,$.date.weeks,$.date.days+Y*H,Y*Z,Y*Q,Y*W,Y*z,Y*G,Y*U)}function l0($,X){return p7($),X.sign(),{date:$,time:X}}function x8($,X,Y){return uw({isoDate:{year:$,month:X+1,day:Y},time:{hour:0,minute:0,second:0,millisecond:0}})/P2}function aX({year:$,month:X,day:Y}){if(Math.abs(x8($,X-1,Y))>1e8)throw new RangeError("date/time value is outside the supported range")}function lw($,X){let Y=X.hour-$.hour,U=X.minute-$.minute,G=X.second-$.second,z=X.millisecond-$.millisecond,W=X.microsecond-$.microsecond,Q=X.nanosecond-$.nanosecond;return C$.fromComponents(Y,U,G,z,W,Q)}function rw($,X,Y,U,G){let z=C$.fromEpochNsDiff(X,$);return z=x7(z,Y,U,G),l0({years:0,months:0,weeks:0,days:0},z)}function pL($,X,Y,U){Pw($),Pw(X);let G=lw($.time,X.time),z=G.sign(),W=w0($.isoDate,X.isoDate),Q=X.isoDate;W===z&&(Q=i6(Q.year,Q.month,Q.day+z),G=G.add24HourDays(-z));let Z=d0("day",U),H=F3(Y,$.isoDate,Q,Z);return U!==Z&&(G=G.add24HourDays(H.days),H.days=0),l0(H,G)}function dL($,X,Y,U,G){let z=x.subtract(X,$);if(x.equal(z,V1))return{date:{years:0,months:0,weeks:0,days:0},time:C$.ZERO};let W=x.lessThan(z,V1)?-1:1,Q=T1(Y,$),Z=T1(Y,X),H,V=0,O=W===1?2:1,w=lw(Q.time,Z.time);for(w.sign()===-W&&V++;V<=O;V++){H=k$(i6(Z.isoDate.year,Z.isoDate.month,Z.isoDate.day-V*W),Q.time);let E=Z6(Y,H,"compatible");if(w=C$.fromEpochNsDiff(X,E),w.sign()!==-W)break}let D=d0("day",G);return l0(F3(U,Q.isoDate,H.isoDate,D),w)}function lL($,X,Y,U,G,z,W,Q,Z){let H,V,O,w,D=X;switch(Q){case"year":{let l=C2(D.date.years,W,"trunc");H=l,V=l+W*$,O={years:H,months:0,weeks:0,days:0},w={...O,years:V};break}case"month":{let l=C2(D.date.months,W,"trunc");H=l,V=l+W*$,O=Q6(D.date,0,0,H),w=Q6(D.date,0,0,V);break}case"week":{let l=Q6(D.date,0,0),W$=w1(z,U.isoDate,l,"constrain"),L$=F3(z,W$,i6(W$.year,W$.month,W$.day+D.date.days),"week"),b$=C2(D.date.weeks+L$.weeks,W,"trunc");H=b$,V=b$+W*$,O=Q6(D.date,0,H),w=Q6(D.date,0,V);break}case"day":{let l=C2(D.date.days,W,"trunc");H=l,V=l+W*$,O=Q6(D.date,H),w=Q6(D.date,V);break}}let E=w1(z,U.isoDate,O,"constrain"),F=w1(z,U.isoDate,w,"constrain"),J,A,L=k$(E,U.time),T=k$(F,U.time);G?(J=Z6(G,L,"compatible"),A=Z6(G,T,"compatible")):(J=e4(L),A=e4(T));let q=C$.fromEpochNsDiff(Y,J),v=C$.fromEpochNsDiff(A,J),I=f7(Z,$<0?"negative":"positive"),S=q.add(q).abs().subtract(v.abs()).sign(),y=Math.abs(H)/W%2==0,r=q.isZero()?Math.abs(H):q.cmp(v)?h7(Math.abs(H),Math.abs(V),S,y,I):Math.abs(V),j=new C$(x.add(x.multiply(v.totalNs,x.BigInt(H)),x.multiply(q.totalNs,x.BigInt(W*$)))).fdiv(v.totalNs),X$=r===Math.abs(V);return D={date:X$?w:O,time:C$.ZERO},{nudgeResult:{duration:D,nudgedEpochNs:X$?A:J,didExpandCalendarUnit:X$},total:j}}function r7($,X,Y,U,G,z,W,Q,Z){let H=$,V=W0(Q)||U&&Q==="day",O=mL(H)<0?-1:1,w;return V?{nudgeResult:w}=lL(O,H,X,Y,U,G,W,Q,Z):w=U?function(D,E,F,J,A,L,T,q){let v=E,I=w1(A,F.isoDate,v.date,"constrain"),S=k$(I,F.time),y=k$(i6(I.year,I.month,I.day+D),F.time),r=Z6(J,S,"compatible"),j=Z6(J,y,"compatible"),X$=C$.fromEpochNsDiff(j,r);if(X$.sign()!==D)throw new RangeError("time zone returned inconsistent Instants");let l=x.BigInt(X9[T]*L),W$=v.time.round(l,q),L$=W$.subtract(X$),b$=L$.sign()!==-D,L4,X6;return b$?(L4=D,W$=L$.round(l,q),X6=W$.addToEpochNs(j)):(L4=0,X6=W$.addToEpochNs(r)),{duration:l0(Q6(v.date,v.date.days+L4),W$),nudgedEpochNs:X6,didExpandCalendarUnit:b$}}(O,H,Y,U,G,W,Q,Z):function(D,E,F,J,A,L){let T=D,q=T.time.add24HourDays(T.date.days),v=q.round(x.BigInt(J*X9[A]),L),I=v.subtract(q),{quotient:S}=q.divmod(T7),{quotient:y}=v.divmod(T7),r=Math.sign(y-S)===q.sign(),j=I.addToEpochNs(E),X$=0,l=v;return u0(F)==="date"&&(X$=y,l=v.add(C$.fromComponents(24*-y,0,0,0,0,0))),{duration:{date:Q6(T.date,X$),time:l},nudgedEpochNs:j,didExpandCalendarUnit:r}}(H,X,z,W,Q,Z),H=w.duration,w.didExpandCalendarUnit&&Q!=="week"&&(H=function(D,E,F,J,A,L,T,q){let v=E;if(q===T)return v;let I=nG.indexOf(T);for(let S=nG.indexOf(q)-1;S>=I;S--){let y=nG[S];if(y==="week"&&T!=="week")continue;let r;switch(y){case"year":r={years:v.date.years+D,months:0,weeks:0,days:0};break;case"month":{let l=v.date.months+D;r=Q6(v.date,0,0,l);break}case"week":{let l=v.date.weeks+D;r=Q6(v.date,0,l);break}}let j=k$(w1(L,J.isoDate,r,"constrain"),J.time),X$;if(X$=A?Z6(A,j,"compatible"):e4(j),q7(F,X$)===-D)break;v={date:r,time:C$.ZERO}}return v}(O,H,w.nudgedEpochNs,Y,U,G,z,d0(Q,"day"))),H}function mA($,X,Y,U,G,z){return W0(z)||U&&z==="day"?lL(mL($)<0?-1:1,$,X,Y,U,G,1,z,"trunc").total:sG($.time.add24HourDays($.date.days),z)}function rL($,X,Y,U,G,z,W){if(G9($,X)==0)return{date:{years:0,months:0,weeks:0,days:0},time:C$.ZERO};I8($),I8(X);let Q=pL($,X,Y,U);return z==="nanosecond"&&G===1?Q:r7(Q,e4(X),$,null,Y,U,G,z,W)}function iL($,X,Y,U,G,z,W,Q){if(u0(G)==="time")return rw($,X,z,W,Q);let Z=dL($,X,Y,U,G);return W==="nanosecond"&&z===1?Z:r7(Z,X,T1(Y,$),Y,U,G,z,W,Q)}function O9($,X,Y,U,G,z){let W=$9.reduce((D,E)=>{let F=E[0],J=E[1],A=E[2];return Y!=="datetime"&&A!==Y||U.includes(J)||D.push(J,F),D},[]),Q=r6(X,"largestUnit",Y,"auto");if(U.includes(Q))throw new RangeError(`largestUnit must be one of ${W.join(", ")}, not ${Q}`);let Z=Z9(X),H=p1(X,"trunc");$==="since"&&(H=function(D){switch(D){case"ceil":return"floor";case"floor":return"ceil";case"halfCeil":return"halfFloor";case"halfFloor":return"halfCeil";default:return D}}(H));let V=r6(X,"smallestUnit",Y,G);if(U.includes(V))throw new RangeError(`smallestUnit must be one of ${W.join(", ")}, not ${V}`);let O=d0(z,V);if(Q==="auto"&&(Q=O),d0(Q,V)!==Q)throw new RangeError(`largestUnit ${Q} cannot be smaller than smallestUnit ${V}`);let w={hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[V];return w!==void 0&&H9(Z,w,!1),{largestUnit:Q,roundingIncrement:Z,roundingMode:H,smallestUnit:V}}function uA($,X,Y,U){let G=pG(Y),z=O9($,Q$(U),"time",[],"nanosecond","second"),W=q1(rw(N(X,D$),N(G,D$),z.roundingIncrement,z.smallestUnit,z.roundingMode),z.largestUnit);return $==="since"&&(W=o6(W)),W}function cA($,X,Y,U){let G=uG(Y),z=N(X,p),W=N(G,p);if(!V0(z,W))throw new RangeError(`cannot compute difference between dates of ${z} and ${W} calendars`);let Q=O9($,Q$(U),"date",[],"day","day"),Z=$6("%Temporal.Duration%"),H=N(X,E$),V=N(G,E$);if(w0(H,V)===0)return new Z;let O={date:F3(z,H,V,Q.largestUnit),time:C$.ZERO};if(Q.smallestUnit!=="day"||Q.roundingIncrement!==1){let D=k$(H,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});O=r7(O,e4(k$(V,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),D,null,z,Q.largestUnit,Q.roundingIncrement,Q.smallestUnit,Q.roundingMode)}let w=q1(O,"day");return $==="since"&&(w=o6(w)),w}function pA($,X,Y,U){let G=cG(Y),z=N(X,p),W=N(G,p);if(!V0(z,W))throw new RangeError(`cannot compute difference between dates of ${z} and ${W} calendars`);let Q=O9($,Q$(U),"datetime",[],"nanosecond","day"),Z=$6("%Temporal.Duration%"),H=N(X,W4),V=N(G,W4);if(G9(H,V)===0)return new Z;let O=q1(rL(H,V,z,Q.largestUnit,Q.roundingIncrement,Q.smallestUnit,Q.roundingMode),Q.largestUnit);return $==="since"&&(O=o6(O)),O}function dA($,X,Y,U){let G=v2(Y),z=O9($,Q$(U),"time",[],"nanosecond","hour"),W=lw(N(X,E4),N(G,E4));W=x7(W,z.roundingIncrement,z.smallestUnit,z.roundingMode);let Q=q1(l0({years:0,months:0,weeks:0,days:0},W),z.largestUnit);return $==="since"&&(Q=o6(Q)),Q}function lA($,X,Y,U){let G=dG(Y),z=N(X,p),W=N(G,p);if(!V0(z,W))throw new RangeError(`cannot compute difference between months of ${z} and ${W} calendars`);let Q=O9($,Q$(U),"date",["week","day"],"month","year"),Z=$6("%Temporal.Duration%");if(w0(N(X,E$),N(G,E$))==0)return new Z;let H=I6(z,N(X,E$),"year-month");H.day=1;let V=I2(z,H,"constrain"),O=I6(z,N(G,E$),"year-month");O.day=1;let w=I2(z,O,"constrain"),D={date:Q6(F3(z,V,w,Q.largestUnit),0,0),time:C$.ZERO};if(Q.smallestUnit!=="month"||Q.roundingIncrement!==1){let F=k$(V,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});D=r7(D,e4(k$(w,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),F,null,z,Q.largestUnit,Q.roundingIncrement,Q.smallestUnit,Q.roundingMode)}let E=q1(D,"day");return $==="since"&&(E=o6(E)),E}function rA($,X,Y,U){let G=lG(Y),z=N(X,p),W=N(G,p);if(!V0(z,W))throw new RangeError(`cannot compute difference between dates of ${z} and ${W} calendars`);let Q=O9($,Q$(U),"datetime",[],"nanosecond","hour"),Z=N(X,D$),H=N(G,D$),V=$6("%Temporal.Duration%"),O;if(u0(Q.largestUnit)!=="date")O=q1(rw(Z,H,Q.roundingIncrement,Q.smallestUnit,Q.roundingMode),Q.largestUnit);else{let w=N(X,m$);if(!kL(w,N(G,m$)))throw new RangeError("When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.");if(x.equal(Z,H))return new V;O=q1(iL(Z,H,w,z,Q.largestUnit,Q.roundingIncrement,Q.smallestUnit,Q.roundingMode),"hour")}return $==="since"&&(O=o6(O)),O}function Y9({hour:$,minute:X,second:Y,millisecond:U,microsecond:G,nanosecond:z},W){let Q=Y,Z=z;return Q+=W.sec,Z+=W.subsec,T2($,X,Q,U,G,Z)}function Iw($,X){let Y=X.addToEpochNs($);return O0(Y),Y}function rG($,X,Y,U,G="constrain"){if(p7(U.date)===0)return Iw($,U.time);let z=T1(X,$);return Iw(Z6(X,k$(w1(Y,z.isoDate,U.date,G),z.time),"compatible"),U.time)}function iA($,X,Y){let U=R1(Y);$==="subtract"&&(U=o6(U));let G=d0(m0(X),m0(U));if(W0(G))throw new RangeError("For years, months, or weeks arithmetic, use date arithmetic relative to a starting point");let z=Z0(X),W=Z0(U);return q1(l0({years:0,months:0,weeks:0,days:0},z.time.add(W.time)),G)}function oA($,X,Y){let U=R1(Y);$==="subtract"&&(U=o6(U));let G=m0(U);if(u0(G)==="date")throw new RangeError(`Duration field ${G} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);let z=Z0(U);return u1(Iw(N(X,D$),z.time))}function nA($,X,Y,U){let G=N(X,p),z=R1(Y);$==="subtract"&&(z=o6(z));let W=cL(z),Q=x$(Q$(U));return j6(w1(G,N(X,E$),W,Q),G)}function tA($,X,Y,U){let G=R1(Y);$==="subtract"&&(G=o6(G));let z=x$(Q$(U)),W=N(X,p),Q=Z0(G),Z=N(X,W4),H=Y9(Z.time,Q.time),V=Q6(Q.date,H.deltaDays);return l7(V.years,V.months,V.weeks,V.days,0,0,0,0,0,0),_1(k$(w1(W,Z.isoDate,V,z),H),W)}function aA($,X,Y){let U=R1(Y);$==="subtract"&&(U=o6(U));let G=Z0(U),{hour:z,minute:W,second:Q,millisecond:Z,microsecond:H,nanosecond:V}=Y9(N(X,E4),G.time);return c0(u7(z,W,Q,Z,H,V,"reject"))}function sA($,X,Y,U){let G=R1(Y);$==="subtract"&&(G=o6(G));let z=x$(Q$(U)),W=I7(G),Q=N(X,p),Z=I6(Q,N(X,E$),"year-month");Z.day=1;let H=I2(Q,Z,"constrain");if(W<0){let O=w1(Q,H,{months:1},"constrain");H=i6(O.year,O.month,O.day-1)}let V=cL(G);return f8(H),tX(Y3(Q,I6(Q,w1(Q,H,V,z),"year-month"),z),Q)}function eA($,X,Y,U){let G=R1(Y);$==="subtract"&&(G=o6(G));let z=x$(Q$(U)),W=N(X,m$),Q=N(X,p),Z=iX(G);return W6(rG(N(X,D$),W,Q,Z,z),W,Q)}function C2($,X,Y){let U=Math.trunc($/X),G=$%X,z=$<0?"negative":"positive",W=Math.abs(U),Q=W+1,Z=l6(Math.abs(2*G)-X),H=W%2==0,V=f7(Y,z),O=G===0?W:h7(W,Q,Z,H,V);return X*(z==="positive"?O:-O)}function xw($,X,Y,U){let G=X9[Y]*X;return function(z,W,Q){let Z=y0(z),H=y0(W),V=x.divide(Z,H),O=x.remainder(Z,H),w=f7(Q,"positive"),D,E;x.lessThan(Z,V1)?(D=x.subtract(V,eG),E=V):(D=V,E=x.add(V,eG));let F=q7(T8(x.multiply(O,hw)),H)*(x.lessThan(Z,V1)?-1:1)+0,J=x.equal(O,V1)?V:h7(D,E,F,GL(D),w);return x.multiply(J,H)}($,x.BigInt(G),U)}function Sw($,X,Y,U){Pw($);let{year:G,month:z,day:W}=$.isoDate,Q=kw($.time,X,Y,U);return k$(i6(G,z,W+Q.deltaDays),Q)}function kw({hour:$,minute:X,second:Y,millisecond:U,microsecond:G,nanosecond:z},W,Q,Z){let H;switch(Q){case"day":case"hour":H=1000*(1000*(1000*(60*(60*$+X)+Y)+U)+G)+z;break;case"minute":H=1000*(1000*(1000*(60*X+Y)+U)+G)+z;break;case"second":H=1000*(1000*(1000*Y+U)+G)+z;break;case"millisecond":H=1000*(1000*U+G)+z;break;case"microsecond":H=1000*G+z;break;case"nanosecond":H=z}let V=X9[Q],O=C2(H,V*W,Z)/V;switch(Q){case"day":return{deltaDays:O,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case"hour":return T2(O,0,0,0,0,0);case"minute":return T2($,O,0,0,0,0);case"second":return T2($,X,O,0,0,0);case"millisecond":return T2($,X,Y,O,0,0);case"microsecond":return T2($,X,Y,U,O,0);case"nanosecond":return T2($,X,Y,U,G,O);default:throw new Error(`Invalid unit ${Q}`)}}function x7($,X,Y,U){let G=X9[Y];return $.round(x.BigInt(G*X),U)}function sG($,X){let Y=X9[X];return $.fdiv(x.BigInt(Y))}function w0($,X){return $.year!==X.year?l6($.year-X.year):$.month!==X.month?l6($.month-X.month):$.day!==X.day?l6($.day-X.day):0}function bw($,X){return $.hour!==X.hour?l6($.hour-X.hour):$.minute!==X.minute?l6($.minute-X.minute):$.second!==X.second?l6($.second-X.second):$.millisecond!==X.millisecond?l6($.millisecond-X.millisecond):$.microsecond!==X.microsecond?l6($.microsecond-X.microsecond):$.nanosecond!==X.nanosecond?l6($.nanosecond-X.nanosecond):0}function G9($,X){let Y=w0($.isoDate,X.isoDate);return Y!==0?Y:bw($.time,X.time)}function oL($){let X=S7($);return globalThis.BigInt!==void 0?globalThis.BigInt(X.toString(10)):X}function v1($,X){let Y=y0($),{quotient:U,remainder:G}=yG(Y,Z3),z=x.toNumber(U);return X==="floor"&&x.toNumber(G)<0&&(z-=1),X==="ceil"&&x.toNumber(G)>0&&(z+=1),z}function c1($){if(!Number.isInteger($))throw new RangeError("epoch milliseconds must be an integer");return x.multiply(x.BigInt($),Z3)}function S7($){let X=$;if(typeof $=="object"){let Y=$[Symbol.toPrimitive];Y&&typeof Y=="function"&&(X=Y.call($,"number"))}if(typeof X=="number")throw new TypeError("cannot convert number to bigint");return typeof X=="bigint"?x.BigInt(X.toString(10)):x.BigInt(X)}var fw=(()=>{let $=x.BigInt(Date.now()%1e6);return()=>{let X=Date.now(),Y=x.BigInt(X),U=x.add(c1(X),$);return $=x.remainder(Y,Z3),x.greaterThan(U,eX)?eX:x.lessThan(U,$3)?$3:U}})();function hG(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}function l6($){return $<0?-1:$>0?1:$}function Q$($){if($===void 0)return Object.create(null);if(N4($)&&$!==null)return $;throw new TypeError("Options parameter must be an object, not "+($===null?"null":typeof $))}function S8($,X){let Y=Object.create(null);return Y[$]=X,Y}function r0($,X,Y,U){let G=$[X];if(G!==void 0){if(G=y7(G),!Y.includes(G))throw new RangeError(`${X} must be one of ${Y.join(", ")}, not ${G}`);return G}if(U===o0)throw new RangeError(`${X} option is required`);return U}function S6($){let X=W3($);if(!Qb.includes(W3(X)))throw new RangeError(`invalid calendar identifier ${X}`);switch(X){case"ethiopic-amete-alem":return"ethioaa";case"islamicc":return"islamic-civil"}return X}function W3($){let X="";for(let Y=0;Y<$.length;Y++){let U=$.charCodeAt(Y);X+=U>=65&&U<=90?String.fromCharCode(U+32):String.fromCharCode(U)}return X}function S2($){throw new TypeError(`Do not use built-in arithmetic operators with Temporal objects. When comparing, use ${$==="PlainMonthDay"?"Temporal.PlainDate.compare(obj1.toPlainDate(year), obj2.toPlainDate(year))":`Temporal.${$}.compare(obj1, obj2)`}, not obj1 > obj2. When coercing to strings, use \`\${obj}\` or String(obj), not '' + obj. When coercing to numbers, use properties or methods of the object, not \`+obj\`. When concatenating with strings, use \`\${str}\${obj}\` or str.concat(obj), not str + obj. In React, coerce to a string before rendering a Temporal object.`)}var Eb=new RegExp(`^${ML.source}$`),Nb=new RegExp(`^${/([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?/.source}$`);function nL($,X,Y,U=$(X),G=$(Y)){let z=X,W=Y,Q=U,Z=G;for(;W-z>1;){let H=Math.trunc((z+W)/2),V=$(H);V===Q?(z=H,Q=V):V===Z&&(W=H,Z=V)}return W}function tL($){return[...$]}function aL($,X){if($!=="gregory"&&$!=="iso8601")return;let Y=L3[$],U=X.year,{dayOfWeek:G,dayOfYear:z,daysInYear:W}=Y.isoToDate(X,{dayOfWeek:!0,dayOfYear:!0,daysInYear:!0}),Q=Y.getFirstDayOfWeek(),Z=Y.getMinimalDaysInFirstWeek(),H=(G+7-Q)%7,V=(G-z+7001-Q)%7,O=Math.floor((z-1+V)/7);if(7-V>=Z&&++O,O==0)O=function(w,D,E,F){let J=(F-w-E+1)%7;J<0&&(J+=7);let A=Math.floor((E+J-1)/7);return 7-J>=D&&++A,A}(Q,Z,z+Y.isoToDate(Y.dateAdd(X,{years:-1},"constrain"),{daysInYear:!0}).daysInYear,G),U--;else if(z>=W-5){let w=(H+W-z)%7;w<0&&(w+=7),6-w>=Z&&z+7-H>W&&(O=1,U++)}return{week:O,year:U}}function $L($,X,Y,U,G){if(X!==G.year){if($*(X-G.year)>0)return!0}else if(Y!==G.month){if($*(Y-G.month)>0)return!0}else if(U!==G.day&&$*(U-G.day)>0)return!0;return!1}var L3={};function k8($){if(!$.startsWith("M"))throw new RangeError(`Invalid month code: ${$}. Month codes must start with M.`);let X=+$.slice(1);if(Number.isNaN(X))throw new RangeError(`Invalid month code: ${$}`);return X}function H0($,X=!1){return`M${`${$}`.padStart(2,"0")}${X?"L":""}`}function iw($,X=void 0,Y=12){let{month:U,monthCode:G}=$;if(G===void 0){if(U===void 0)throw new TypeError("Either month or monthCode are required");X==="reject"&&r4(U,1,Y),X==="constrain"&&(U=B6(U,1,Y)),G=H0(U)}else{let z=k8(G);if(G!==H0(z))throw new RangeError(`Invalid month code: ${G}`);if(U!==void 0&&U!==z)throw new RangeError(`monthCode ${G} and month ${U} must match if both are present`);if(U=z,U<1||U>Y)throw new RangeError(`Invalid monthCode: ${G}`)}return{...$,month:U,monthCode:G}}L3.iso8601={resolveFields($,X){if((X==="date"||X==="year-month")&&$.year===void 0)throw new TypeError("year is required");if((X==="date"||X==="month-day")&&$.day===void 0)throw new TypeError("day is required");Object.assign($,iw($))},dateToISO:($,X)=>tG($.year,$.month,$.day,X),monthDayToISOReferenceDate($,X){let{month:Y,day:U}=tG($.year??1972,$.month,$.day,X);return{month:Y,day:U,year:1972}},extraFields:()=>[],fieldKeysToIgnore($){let X=new Set;for(let Y=0;Y<$.length;Y++){let U=$[Y];X.add(U),U==="month"?X.add("monthCode"):U==="monthCode"&&X.add("month")}return tL(X)},dateAdd($,{years:X=0,months:Y=0,weeks:U=0,days:G=0},z){let{year:W,month:Q,day:Z}=$;return W+=X,Q+=Y,{year:W,month:Q}=v8(W,Q),{year:W,month:Q,day:Z}=tG(W,Q,Z,z),Z+=G+7*U,i6(W,Q,Z)},dateUntil($,X,Y){let U=-w0($,X);if(U===0)return{years:0,months:0,weeks:0,days:0};let G,z=0,W=0;if(Y==="year"||Y==="month"){let V=X.year-$.year;for(V!==0&&(V-=U);!$L(U,$.year+V,$.month,$.day,X);)z=V,V+=U;let O=U;for(G=v8($.year+z,$.month+O);!$L(U,G.year,G.month,$.day,X);)W=O,O+=U,G=v8(G.year,G.month+U);Y==="month"&&(W+=12*z,z=0)}G=v8($.year+z,$.month+W);let Q=uL(G.year,G.month,$.day),Z=0,H=x8(X.year,X.month-1,X.day)-x8(Q.year,Q.month-1,Q.day);return Y==="week"&&(Z=Math.trunc(H/7),H%=7),{years:z,months:W,weeks:Z,days:H}},isoToDate({year:$,month:X,day:Y},U){let G={era:void 0,eraYear:void 0,year:$,month:X,day:Y,daysInWeek:7,monthsInYear:12};if(U.monthCode&&(G.monthCode=H0(X)),U.dayOfWeek){let z=X+(X<3?10:-2),W=$-(X<3?1:0),Q=Math.floor(W/100),Z=W-100*Q,H=(Y+Math.floor(2.6*z-0.2)+(Z+Math.floor(Z/4))+(Math.floor(Q/4)-2*Q))%7;G.dayOfWeek=H+(H<=0?7:0)}if(U.dayOfYear){let z=Y;for(let W=X-1;W>0;W--)z+=B8($,W);G.dayOfYear=z}return U.weekOfYear&&(G.weekOfYear=aL("iso8601",{year:$,month:X,day:Y})),U.daysInMonth&&(G.daysInMonth=B8($,X)),(U.daysInYear||U.inLeapYear)&&(G.inLeapYear=P7($),G.daysInYear=G.inLeapYear?366:365),G},getFirstDayOfWeek:()=>1,getMinimalDaysInFirstWeek:()=>4};class l4{constructor($){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,$!==void 0){let X=0;for(let Y of $.map.entries()){if(++X>l4.MAX_CACHE_ENTRIES)break;this.map.set(...Y)}}}get($){let X=this.map.get($);return X&&(this.hits++,this.report()),this.calls++,X}set($,X){this.map.set($,X),this.misses++,this.report()}report(){}setObject($){if(l4.objectMap.get($))throw new RangeError("object already cached");l4.objectMap.set($,this),this.report()}static getCacheForObject($){let X=l4.objectMap.get($);return X||(X=new l4,l4.objectMap.set($,X)),X}}function sL({isoYear:$,isoMonth:X,isoDay:Y}){return`${A3($)}-${D1(X)}-${D1(Y)}T00:00Z`}function Nw($,X){return{years:$.year-X.year,months:$.month-X.month,days:$.day-X.day}}l4.objectMap=new WeakMap,l4.MAX_CACHE_ENTRIES=1000;class k2{constructor(){this.eras=[],this.hasEra=!1,this.erasBeginMidYear=!1}getFormatter(){return this.formatter===void 0&&(this.formatter=new Intl.DateTimeFormat(`en-US-u-ca-${this.id}`,{day:"numeric",month:"numeric",year:"numeric",era:"short",timeZone:"UTC"})),this.formatter}getCalendarParts($){let X=this.getFormatter(),Y=new Date($);if($==="-271821-04-19T00:00Z"){let U=X.resolvedOptions();X=new Intl.DateTimeFormat(U.locale,{...U,timeZone:"Etc/GMT+1"}),Y=new Date("-271821-04-20T00:00Z")}try{return X.formatToParts(Y)}catch(U){throw new RangeError(`Invalid ISO date: ${$}`)}}isoToCalendarDate($,X){let{year:Y,month:U,day:G}=$,z=JSON.stringify({func:"isoToCalendarDate",isoYear:Y,isoMonth:U,isoDay:G,id:this.id}),W=X.get(z);if(W)return W;let Q=sL({isoYear:Y,isoMonth:U,isoDay:G}),Z=this.getCalendarParts(Q),H={};for(let O=0;O<Z.length;O++){let{type:w,value:D}=Z[O];if(w!=="year"&&w!=="relatedYear"||(this.hasEra?H.eraYear=+D:H.year=+D),w==="month"){let E=/^([0-9]*)(.*?)$/.exec(D);if(!E||E.length!=3||!E[1]&&!E[2])throw new RangeError(`Unexpected month: ${D}`);if(H.month=E[1]?+E[1]:1,H.month<1)throw new RangeError(`Invalid month ${D} from ${Q}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(H.month>13)throw new RangeError(`Invalid month ${D} from ${Q}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);E[2]&&(H.monthExtra=E[2])}w==="day"&&(H.day=+D),this.hasEra&&w==="era"&&D!=null&&D!==""&&(H.era=D.split(" (")[0].normalize("NFD").replace(/[^-0-9 \p{L}]/gu,"").replace(/ /g,"-").toLowerCase())}if(this.hasEra&&H.eraYear===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.hasEra){let O=this.eras.find((w)=>H.era===w.genericName);O&&(H.era=O.code)}if(this.reviseIntlEra){let{era:O,eraYear:w}=this.reviseIntlEra(H,$);H.era=O,H.eraYear=w}this.checkIcuBugs&&this.checkIcuBugs($);let V=this.adjustCalendarDate(H,X,"constrain",!0);if(V.year===void 0)throw new RangeError(`Missing year converting ${JSON.stringify($)}`);if(V.month===void 0)throw new RangeError(`Missing month converting ${JSON.stringify($)}`);if(V.day===void 0)throw new RangeError(`Missing day converting ${JSON.stringify($)}`);return X.set(z,V),["constrain","reject"].forEach((O)=>{let w=JSON.stringify({func:"calendarToIsoDate",year:V.year,month:V.month,day:V.day,overflow:O,id:this.id});X.set(w,$)}),V}validateCalendarDate($){let{month:X,year:Y,day:U,eraYear:G,monthCode:z,monthExtra:W}=$;if(W!==void 0)throw new RangeError("Unexpected `monthExtra` value");if(Y===void 0&&G===void 0)throw new TypeError("year or eraYear is required");if(X===void 0&&z===void 0)throw new TypeError("month or monthCode is required");if(U===void 0)throw new RangeError("Missing day");if(z!==void 0){if(typeof z!="string")throw new RangeError("monthCode must be a string, not "+typeof z);if(!/^M([01]?\d)(L?)$/.test(z))throw new RangeError(`Invalid monthCode: ${z}`)}if(this.hasEra&&$.era===void 0!=($.eraYear===void 0))throw new TypeError("properties era and eraYear must be provided together")}adjustCalendarDate($,X=void 0,Y="constrain",U=!1){if(this.calendarType==="lunisolar")throw new RangeError("Override required for lunisolar calendars");let G=$;this.validateCalendarDate(G);let z=this.monthsInYear(G,X),{month:W,monthCode:Q}=G;return{month:W,monthCode:Q}=iw(G,Y,z),{...G,month:W,monthCode:Q}}regulateMonthDayNaive($,X,Y){let U=this.monthsInYear($,Y),{month:G,day:z}=$;return X==="reject"?(r4(G,1,U),r4(z,1,this.maximumMonthLength($))):(G=B6(G,1,U),z=B6(z,1,this.maximumMonthLength({...$,month:G}))),{...$,month:G,day:z}}calendarToIsoDate($,X="constrain",Y){let U=$,G=this.adjustCalendarDate($,Y,X,!1);G=this.regulateMonthDayNaive(G,X,Y);let{year:z,month:W,day:Q}=G,Z=JSON.stringify({func:"calendarToIsoDate",year:z,month:W,day:Q,overflow:X,id:this.id}),H,V=Y.get(Z);if(V)return V;if(U.year!==void 0&&U.month!==void 0&&U.day!==void 0&&(U.year!==G.year||U.month!==G.month||U.day!==G.day)&&(H=JSON.stringify({func:"calendarToIsoDate",year:U.year,month:U.month,day:U.day,overflow:X,id:this.id}),V=Y.get(H),V))return V;let O=this.estimateIsoDate({year:z,month:W,day:Q}),w=(A)=>{let L=this.addDaysIso(O,A);if(G.day>this.minimumMonthLength(G)){let T=this.isoToCalendarDate(L,Y);for(;T.month!==W||T.year!==z;){if(X==="reject")throw new RangeError(`day ${Q} does not exist in month ${W} of year ${z}`);L=this.addDaysIso(L,-1),T=this.isoToCalendarDate(L,Y)}}return L},D=0,E=this.isoToCalendarDate(O,Y),F=Nw(G,E);if(F.years!==0||F.months!==0||F.days!==0){let A=365*F.years+30*F.months+F.days;O=this.addDaysIso(O,A),E=this.isoToCalendarDate(O,Y),F=Nw(G,E),F.years===0&&F.months===0?O=w(F.days):D=this.compareCalendarDates(G,E)}let J=8;for(;D;){O=this.addDaysIso(O,D*J);let A=E;E=this.isoToCalendarDate(O,Y);let L=D;if(D=this.compareCalendarDates(G,E),D){if(F=Nw(G,E),F.years===0&&F.months===0)O=w(F.days),D=0;else if(L&&D!==L)if(J>1)J/=2;else{if(X==="reject")throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...U})}`);this.compareCalendarDates(E,A)>0&&(O=this.addDaysIso(O,-1)),D=0}}}if(Y.set(Z,O),H&&Y.set(H,O),G.year===void 0||G.month===void 0||G.day===void 0||G.monthCode===void 0||this.hasEra&&(G.era===void 0||G.eraYear===void 0))throw new RangeError("Unexpected missing property");return O}compareCalendarDates($,X){return $.year!==X.year?l6($.year-X.year):$.month!==X.month?l6($.month-X.month):$.day!==X.day?l6($.day-X.day):0}regulateDate($,X="constrain",Y){let U=this.calendarToIsoDate($,X,Y);return this.isoToCalendarDate(U,Y)}addDaysIso($,X){return i6($.year,$.month,$.day+X)}addDaysCalendar($,X,Y){let U=this.calendarToIsoDate($,"constrain",Y),G=this.addDaysIso(U,X);return this.isoToCalendarDate(G,Y)}addMonthsCalendar($,X,Y,U){let G=$,{day:z}=G;for(let W=0,Q=Math.abs(X);W<Q;W++){let{month:Z}=G,H=G,V=X<0?-Math.max(z,this.daysInPreviousMonth(G,U)):this.daysInMonth(G,U),O=this.calendarToIsoDate(G,"constrain",U),w=this.addDaysIso(O,V);if(G=this.isoToCalendarDate(w,U),X>0){let D=this.monthsInYear(H,U);for(;G.month-1!=Z%D;)w=this.addDaysIso(w,-1),G=this.isoToCalendarDate(w,U)}G.day!==z&&(G=this.regulateDate({...G,day:z},"constrain",U))}if(Y==="reject"&&G.day!==z)throw new RangeError(`Day ${z} does not exist in resulting calendar month`);return G}addCalendar($,{years:X=0,months:Y=0,weeks:U=0,days:G=0},z,W){let{year:Q,day:Z,monthCode:H}=$,V=this.adjustCalendarDate({year:Q+X,monthCode:H,day:Z},W),O=this.addMonthsCalendar(V,Y,z,W),w=G+7*U;return this.addDaysCalendar(O,w,W)}untilCalendar($,X,Y,U){let G=0,z=0,W=0,Q=0;switch(Y){case"day":G=this.calendarDaysUntil($,X,U);break;case"week":{let Z=this.calendarDaysUntil($,X,U);G=Z%7,z=(Z-G)/7;break}case"month":case"year":{let Z=this.compareCalendarDates(X,$);if(!Z)return{years:0,months:0,weeks:0,days:0};let H=X.year-$.year,V=X.day-$.day;if(Y==="year"&&H){let D=0;X.monthCode>$.monthCode&&(D=1),X.monthCode<$.monthCode&&(D=-1),D||(D=Math.sign(V)),Q=D*Z<0?H-Z:H}let O,w=Q?this.addCalendar($,{years:Q},"constrain",U):$;do W+=Z,O=w,w=this.addMonthsCalendar(O,Z,"constrain",U),w.day!==$.day&&(w=this.regulateDate({...w,day:$.day},"constrain",U));while(this.compareCalendarDates(X,w)*Z>=0);W-=Z,G=this.calendarDaysUntil(O,X,U);break}}return{years:Q,months:W,weeks:z,days:G}}daysInMonth($,X){let{day:Y}=$,U=this.maximumMonthLength($),G=this.minimumMonthLength($);if(G===U)return G;let z=Y<=U-G?U:G,W=this.calendarToIsoDate($,"constrain",X),Q=this.addDaysIso(W,z),Z=this.isoToCalendarDate(Q,X),H=this.addDaysIso(Q,-Z.day);return this.isoToCalendarDate(H,X).day}daysInPreviousMonth($,X){let{day:Y,month:U,year:G}=$,z={year:U>1?G:G-1,month:U,day:1},W=U>1?U-1:this.monthsInYear(z,X);z={...z,month:W};let Q=this.minimumMonthLength(z),Z=this.maximumMonthLength(z);if(Q===Z)return Z;let H=this.calendarToIsoDate($,"constrain",X),V=this.addDaysIso(H,-Y);return this.isoToCalendarDate(V,X).day}startOfCalendarYear($){return{year:$.year,month:1,monthCode:"M01",day:1}}startOfCalendarMonth($){return{year:$.year,month:$.month,day:1}}calendarDaysUntil($,X,Y){let U=this.calendarToIsoDate($,"constrain",Y),G=this.calendarToIsoDate(X,"constrain",Y);return x8(G.year,G.month-1,G.day)-x8(U.year,U.month-1,U.day)}monthDaySearchStartYear($,X){return 1972}monthDayFromFields($,X,Y){let U,G,z,W,Q,{era:Z,eraYear:H,year:V,month:O,monthCode:w,day:D}=$;if(O!==void 0&&V===void 0&&(!this.hasEra||Z===void 0||H===void 0))throw new TypeError("when month is present, year (or era and eraYear) are required");(w===void 0||V!==void 0||this.hasEra&&H!==void 0)&&({monthCode:w,day:D}=this.isoToCalendarDate(this.calendarToIsoDate($,X,Y),Y));let E={year:this.monthDaySearchStartYear(w,D),month:12,day:31},F=this.isoToCalendarDate(E,Y),J=F.monthCode>w||F.monthCode===w&&F.day>=D?F.year:F.year-1;for(let A=0;A<20;A++){let L=this.adjustCalendarDate({day:D,monthCode:w,year:J-A},Y),T=this.calendarToIsoDate(L,"constrain",Y),q=this.isoToCalendarDate(T,Y);if({year:U,month:G,day:z}=T,q.monthCode===w&&q.day===D)return{month:G,day:z,year:U};if(X==="constrain"){let v=this.maxLengthOfMonthCodeInAnyYear(q.monthCode);if(q.monthCode===w&&q.day===v&&D>v)return{month:G,day:z,year:U};(W===void 0||q.monthCode===W.monthCode&&q.day>W.day)&&(W=q,Q=T)}}if(X==="constrain"&&Q!==void 0)return Q;throw new RangeError(`No recent ${this.id} year with monthCode ${w} and day ${D}`)}getFirstDayOfWeek(){}getMinimalDaysInFirstWeek(){}}class eL extends k2{constructor(){super(...arguments),this.id="hebrew",this.calendarType="lunisolar",this.months={Tishri:{leap:1,regular:1,monthCode:"M01",days:30},Heshvan:{leap:2,regular:2,monthCode:"M02",days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:"M03",days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:"M04",days:29},Shevat:{leap:5,regular:5,monthCode:"M05",days:30},Adar:{leap:void 0,regular:6,monthCode:"M06",days:29},"Adar I":{leap:6,regular:void 0,monthCode:"M05L",days:30},"Adar II":{leap:7,regular:void 0,monthCode:"M06",days:29},Nisan:{leap:8,regular:7,monthCode:"M07",days:30},Iyar:{leap:9,regular:8,monthCode:"M08",days:29},Sivan:{leap:10,regular:9,monthCode:"M09",days:30},Tamuz:{leap:11,regular:10,monthCode:"M10",days:29},Av:{leap:12,regular:11,monthCode:"M11",days:30},Elul:{leap:13,regular:12,monthCode:"M12",days:29}}}inLeapYear($){let{year:X}=$;return(7*X+1)%19<7}monthsInYear($){return this.inLeapYear($)?13:12}minimumMonthLength($){return this.minMaxMonthLength($,"min")}maximumMonthLength($){return this.minMaxMonthLength($,"max")}minMaxMonthLength($,X){let{month:Y,year:U}=$,G=this.getMonthCode(U,Y),z=Object.entries(this.months).find((Q)=>Q[1].monthCode===G);if(z===void 0)throw new RangeError(`unmatched Hebrew month: ${Y}`);let W=z[1].days;return typeof W=="number"?W:W[X]}maxLengthOfMonthCodeInAnyYear($){return["M04","M06","M08","M10","M12"].includes($)?29:30}estimateIsoDate($){let{year:X}=$;return{year:X-3760,month:1,day:1}}getMonthCode($,X){return this.inLeapYear({year:$})?X===6?H0(5,!0):H0(X<6?X:X-1):H0(X)}adjustCalendarDate($,X,Y="constrain",U=!1){let{year:G,month:z,monthCode:W,day:Q,monthExtra:Z}=$;if(G===void 0)throw new TypeError("Missing property: year");if(U){if(Z){let H=this.months[Z];if(!H)throw new RangeError(`Unrecognized month from formatToParts: ${Z}`);z=this.inLeapYear({year:G})?H.leap:H.regular}return W=this.getMonthCode(G,z),{year:G,month:z,day:Q,monthCode:W}}if(this.validateCalendarDate($),z===void 0)if(W.endsWith("L")){if(W!=="M05L")throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${W}`);if(z=6,!this.inLeapYear({year:G})){if(Y==="reject")throw new RangeError(`Hebrew monthCode M05L is invalid in year ${G} which is not a leap year`);z=6,W="M06"}}else{z=k8(W),this.inLeapYear({year:G})&&z>=6&&z++;let H=this.monthsInYear({year:G});if(z<1||z>H)throw new RangeError(`Invalid monthCode: ${W}`)}else if(Y==="reject"?(r4(z,1,this.monthsInYear({year:G})),r4(Q,1,this.maximumMonthLength({year:G,month:z}))):(z=B6(z,1,this.monthsInYear({year:G})),Q=B6(Q,1,this.maximumMonthLength({year:G,month:z}))),W===void 0)W=this.getMonthCode(G,z);else if(this.getMonthCode(G,z)!==W)throw new RangeError(`monthCode ${W} doesn't correspond to month ${z} in Hebrew year ${G}`);return{...$,day:Q,month:z,monthCode:W,year:G}}}class h8 extends k2{constructor(){super(...arguments),this.calendarType="lunar",this.DAYS_PER_ISLAMIC_YEAR=354.3666666666667,this.DAYS_PER_ISO_YEAR=365.2425}inLeapYear($,X){let Y={year:$.year,month:1,monthCode:"M01",day:1},U={year:$.year+1,month:1,monthCode:"M01",day:1};return this.calendarDaysUntil(Y,U,X)===355}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear(){return 30}estimateIsoDate($){let{year:X}=this.adjustCalendarDate($);return{year:Math.floor(X*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}}class $K extends h8{constructor(){super(...arguments),this.id="islamic"}}class XK extends h8{constructor(){super(...arguments),this.id="islamic-umalqura"}}class YK extends h8{constructor(){super(...arguments),this.id="islamic-tbla"}}class GK extends h8{constructor(){super(...arguments),this.id="islamic-civil"}}class UK extends h8{constructor(){super(...arguments),this.id="islamic-rgsa"}}class zK extends h8{constructor(){super(...arguments),this.id="islamicc"}}class WK extends k2{constructor(){super(...arguments),this.id="persian",this.calendarType="solar"}inLeapYear($,X){return this.daysInMonth({year:$.year,month:12,day:1},X)===30}monthsInYear(){return 12}minimumMonthLength($){let{month:X}=$;return X===12?29:X<=6?31:30}maximumMonthLength($){let{month:X}=$;return X===12?30:X<=6?31:30}maxLengthOfMonthCodeInAnyYear($){return k8($)<=6?31:30}estimateIsoDate($){let{year:X}=this.adjustCalendarDate($);return{year:X+621,month:1,day:1}}}class QK extends k2{constructor(){super(...arguments),this.id="indian",this.calendarType="solar",this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug=new Date("0000-01-01T00:00Z").toLocaleDateString("en-US-u-ca-indian",{timeZone:"UTC"})!=="10/11/-79 Saka"}inLeapYear($){return ow($.year+78)}monthsInYear(){return 12}minimumMonthLength($){return this.getMonthInfo($).length}maximumMonthLength($){return this.getMonthInfo($).length}maxLengthOfMonthCodeInAnyYear($){let X=k8($),Y=this.months[X];return Y=Y.leap??Y,Y.length}getMonthInfo($){let{month:X}=$,Y=this.months[X];if(Y===void 0)throw new RangeError(`Invalid month: ${X}`);return this.inLeapYear($)&&Y.leap&&(Y=Y.leap),Y}estimateIsoDate($){let X=this.adjustCalendarDate($),Y=this.getMonthInfo(X);return i6(X.year+78+(Y.nextYear?1:0),Y.month,Y.day+X.day-1)}checkIcuBugs($){if(this.vulnerableToBceBug&&$.year<1)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}}function ow($){return $%4==0&&($%100!=0||$%400==0)}class nw extends k2{constructor($,X){super(),this.calendarType="solar",this.id=$,this.isoEpoch=X}inLeapYear($){let{year:X}=this.estimateIsoDate({month:1,day:1,year:$.year});return ow(X)}monthsInYear(){return 12}minimumMonthLength($){let{month:X}=$;return X===2?this.inLeapYear($)?29:28:[4,6,9,11].indexOf(X)>=0?30:31}maximumMonthLength($){return this.minimumMonthLength($)}maxLengthOfMonthCodeInAnyYear($){return[31,29,31,30,31,30,31,31,30,31,30,31][k8($)-1]}estimateIsoDate($){let X=this.adjustCalendarDate($);return tG(X.year+this.isoEpoch.year,X.month+this.isoEpoch.month,X.day+this.isoEpoch.day,"constrain")}}class tw extends k2{constructor($,X){super(),this.hasEra=!0,this.calendarType="solar",this.id=$;let{eras:Y,anchorEra:U}=function(G){let z,W=G;if(W.length===0)throw new RangeError("Invalid era data: eras are required");if(W.length===1&&W[0].reverseOf)throw new RangeError("Invalid era data: anchor era cannot count years backwards");if(W.length===1&&!W[0].code)throw new RangeError("Invalid era data: at least one named era is required");if(W.filter((Z)=>Z.reverseOf!=null).length>1)throw new RangeError("Invalid era data: only one era can count years backwards");W.forEach((Z)=>{if(Z.isAnchor||!Z.anchorEpoch&&!Z.reverseOf){if(z)throw new RangeError("Invalid era data: cannot have multiple anchor eras");z=Z,Z.anchorEpoch={year:Z.hasYearZero?0:1}}else if(!Z.code)throw new RangeError("If era name is blank, it must be the anchor era")}),W=W.filter((Z)=>Z.code),W.forEach((Z)=>{let{reverseOf:H}=Z;if(H){let V=W.find((O)=>O.code===H);if(V===void 0)throw new RangeError(`Invalid era data: unmatched reverseOf era: ${H}`);Z.reverseOf=V,Z.anchorEpoch=V.anchorEpoch,Z.isoEpoch=V.isoEpoch}Z.anchorEpoch.month===void 0&&(Z.anchorEpoch.month=1),Z.anchorEpoch.day===void 0&&(Z.anchorEpoch.day=1)}),W.sort((Z,H)=>{if(Z.reverseOf)return 1;if(H.reverseOf)return-1;if(!Z.isoEpoch||!H.isoEpoch)throw new RangeError("Invalid era data: missing ISO epoch");return H.isoEpoch.year-Z.isoEpoch.year});let Q=W[W.length-1].reverseOf;if(Q&&Q!==W[W.length-2])throw new RangeError("Invalid era data: invalid reverse-sign era");return W.forEach((Z,H)=>{Z.genericName="era"+(W.length-1-H)}),{eras:W,anchorEra:z||W[0]}}(X);this.anchorEra=U,this.eras=Y}inLeapYear($){let{year:X}=this.estimateIsoDate({month:1,day:1,year:$.year});return ow(X)}monthsInYear(){return 12}minimumMonthLength($){let{month:X}=$;return X===2?this.inLeapYear($)?29:28:[4,6,9,11].indexOf(X)>=0?30:31}maximumMonthLength($){return this.minimumMonthLength($)}maxLengthOfMonthCodeInAnyYear($){return[31,29,31,30,31,30,31,31,30,31,30,31][k8($)-1]}completeEraYear($){let X=(W,Q,Z)=>{let H=$[W];if(H!=null&&H!=Q&&!(Z||[]).includes(H)){let V=Z?.[0];throw new RangeError(`Input ${W} ${H} doesn't match calculated value ${V?`${Q} (also called ${V})`:Q}`)}},Y=(W)=>{let Q,Z={...$,year:W},H=this.eras.find((V,O)=>{if(O===this.eras.length-1){if(V.reverseOf){if(W>0)throw new RangeError(`Signed year ${W} is invalid for era ${V.code}`);return Q=V.anchorEpoch.year-W,!0}return Q=W-V.anchorEpoch.year+(V.hasYearZero?0:1),!0}return this.compareCalendarDates(Z,V.anchorEpoch)>=0&&(Q=W-V.anchorEpoch.year+(V.hasYearZero?0:1),!0)});if(!H)throw new RangeError(`Year ${W} was not matched by any era`);return{eraYear:Q,era:H.code,eraNames:H.names}},{year:U,eraYear:G,era:z}=$;if(U!=null){let W=Y(U);({eraYear:G,era:z}=W),X("era",z,W?.eraNames),X("eraYear",G)}else{if(G==null)throw new RangeError("Either year or eraYear and era are required");{if(z===void 0)throw new RangeError("era and eraYear must be provided together");let W=this.eras.find(({code:Q,names:Z=[]})=>Q===z||Z.includes(z));if(!W)throw new RangeError(`Era ${z} (ISO year ${G}) was not matched by any era`);U=W.reverseOf?W.anchorEpoch.year-G:G+W.anchorEpoch.year-(W.hasYearZero?0:1),X("year",U),{eraYear:G,era:z}=Y(U)}}return{...$,year:U,eraYear:G,era:z}}adjustCalendarDate($,X,Y="constrain"){let U=$,{month:G,monthCode:z}=U;return G===void 0&&(U={...U,month:k8(z)}),this.validateCalendarDate(U),U=this.completeEraYear(U),super.adjustCalendarDate(U,X,Y)}estimateIsoDate($){let X=this.adjustCalendarDate($),{year:Y,month:U,day:G}=X,{anchorEra:z}=this;return tG(Y+z.isoEpoch.year-(z.hasYearZero?0:1),U,G,"constrain")}}class i7 extends tw{constructor($,X){super($,X)}isoToCalendarDate($){let{year:X,month:Y,day:U}=$,G=H0(Y),z=X-this.anchorEra.isoEpoch.year+1;return this.completeEraYear({year:z,month:Y,monthCode:G,day:U})}}var Q0={inLeapYear($){let{year:X}=$;return(X+1)%4==0},monthsInYear:()=>13,minimumMonthLength($){let{month:X}=$;return X===13?this.inLeapYear($)?6:5:30},maximumMonthLength($){return this.minimumMonthLength($)},maxLengthOfMonthCodeInAnyYear:($)=>$==="M13"?6:30};class ZK extends nw{constructor($,X){super($,X),this.inLeapYear=Q0.inLeapYear,this.monthsInYear=Q0.monthsInYear,this.minimumMonthLength=Q0.minimumMonthLength,this.maximumMonthLength=Q0.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=Q0.maxLengthOfMonthCodeInAnyYear}}class aw extends tw{constructor($,X){super($,X),this.inLeapYear=Q0.inLeapYear,this.monthsInYear=Q0.monthsInYear,this.minimumMonthLength=Q0.minimumMonthLength,this.maximumMonthLength=Q0.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=Q0.maxLengthOfMonthCodeInAnyYear}}class HK extends ZK{constructor(){super("ethioaa",{year:-5492,month:7,day:17})}}class VK extends aw{constructor(){super("coptic",[{code:"coptic",isoEpoch:{year:284,month:8,day:29}},{code:"coptic-inverse",reverseOf:"coptic"}])}}class OK extends aw{constructor(){super("ethiopic",[{code:"ethioaa",names:["ethiopic-amete-alem","mundi"],isoEpoch:{year:-5492,month:7,day:17}},{code:"ethiopic",names:["incar"],isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}])}}class wK extends i7{constructor(){super("roc",[{code:"roc",names:["minguo"],isoEpoch:{year:1912,month:1,day:1}},{code:"roc-inverse",names:["before-roc"],reverseOf:"roc"}])}}class DK extends nw{constructor(){super("buddhist",{year:-543,month:1,day:1})}}class EK extends i7{constructor(){super("gregory",[{code:"gregory",names:["ad","ce"],isoEpoch:{year:1,month:1,day:1}},{code:"gregory-inverse",names:["be","bce"],reverseOf:"gregory"}])}reviseIntlEra($){let{era:X,eraYear:Y}=$;return X==="b"&&(X="gregory-inverse"),X==="a"&&(X="gregory"),{era:X,eraYear:Y}}getFirstDayOfWeek(){return 1}getMinimalDaysInFirstWeek(){return 1}}class NK extends i7{constructor(){super("japanese",[{code:"reiwa",isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{code:"heisei",isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{code:"showa",isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{code:"taisho",isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{code:"meiji",isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{code:"japanese",names:["japanese","gregory","ad","ce"],isoEpoch:{year:1,month:1,day:1}},{code:"japanese-inverse",names:["japanese-inverse","gregory-inverse","bc","bce"],reverseOf:"japanese"}]),this.erasBeginMidYear=!0}reviseIntlEra($,X){let{era:Y,eraYear:U}=$,{year:G}=X;return this.eras.find((z)=>z.code===Y)?{era:Y,eraYear:U}:G<1?{era:"japanese-inverse",eraYear:1-G}:{era:"japanese",eraYear:G}}}class sw extends k2{constructor(){super(...arguments),this.calendarType="lunisolar"}inLeapYear($,X){let Y=this.getMonthList($.year,X);return Object.entries(Y).length===13}monthsInYear($,X){return this.inLeapYear($,X)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear($){return["M01L","M09L","M10L","M11L","M12L"].includes($)?29:30}monthDaySearchStartYear($,X){let Y={M01L:[1651,1651],M02L:[1947,1765],M03L:[1966,1955],M04L:[1963,1944],M05L:[1971,1952],M06L:[1960,1941],M07L:[1968,1938],M08L:[1957,1718],M09L:[1832,1832],M10L:[1870,1870],M11L:[1814,1814],M12L:[1890,1890]}[$]??[1972,1972];return X<30?Y[0]:Y[1]}getMonthList($,X){if($===void 0)throw new TypeError("Missing year");let Y=JSON.stringify({func:"getMonthList",calendarYear:$,id:this.id}),U=X.get(Y);if(U)return U;let G=this.getFormatter(),z=(F,J)=>{let A=sL({isoYear:F,isoMonth:2,isoDay:1}),L=new Date(A);L.setUTCDate(J+1);let T=G.formatToParts(L),q=T.find((y)=>y.type==="month").value,v=+T.find((y)=>y.type==="day").value,I=T.find((y)=>y.type==="relatedYear"),S;if(I===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return S=+I.value,{calendarMonthString:q,calendarDay:v,calendarYearToVerify:S}},W=17,{calendarMonthString:Q,calendarDay:Z,calendarYearToVerify:H}=z($,W);Q!=="1"&&(W+=29,{calendarMonthString:Q,calendarDay:Z}=z($,W)),W-=Z-5;let V={},O,w,D=1,E=!1;do({calendarMonthString:Q,calendarDay:Z,calendarYearToVerify:H}=z($,W)),O&&(V[w].daysInMonth=O+30-Z),H!==$?E=!0:(V[Q]={monthIndex:D++},W+=30),O=Z,w=Q;while(!E);return V[w].daysInMonth=O+30-Z,X.set(Y,V),V}estimateIsoDate($){let{year:X,month:Y}=$;return{year:X,month:Y>=12?12:Y+1,day:1}}adjustCalendarDate($,X,Y="constrain",U=!1){let{year:G,month:z,monthExtra:W,day:Q,monthCode:Z}=$;if(G===void 0)throw new TypeError("Missing property: year");if(U){if(W&&W!=="bis")throw new RangeError(`Unexpected leap month suffix: ${W}`);let H=H0(z,W!==void 0),V=`${z}${W||""}`,O=this.getMonthList(G,X)[V];if(O===void 0)throw new RangeError(`Unmatched month ${V} in Chinese year ${G}`);return z=O.monthIndex,{year:G,month:z,day:Q,monthCode:H}}if(this.validateCalendarDate($),z===void 0){let H=this.getMonthList(G,X),V=Z.replace(/^M|L$/g,(w)=>w==="L"?"bis":"");V[0]==="0"&&(V=V.slice(1));let O=H[V];if(z=O&&O.monthIndex,z===void 0&&Z.endsWith("L")&&Z!="M13L"&&Y==="constrain"){let w=+Z.replace(/^M0?|L$/g,"");O=H[w],O&&(z=O.monthIndex,Z=H0(w))}if(z===void 0)throw new RangeError(`Unmatched month ${Z} in Chinese year ${G}`)}else if(Z===void 0){let H=this.getMonthList(G,X),V=Object.entries(H),O=V.length;Y==="reject"?(r4(z,1,O),r4(Q,1,this.maximumMonthLength())):(z=B6(z,1,O),Q=B6(Q,1,this.maximumMonthLength()));let w=V.find((D)=>D[1].monthIndex===z);if(w===void 0)throw new RangeError(`Invalid month ${z} in Chinese year ${G}`);Z=H0(+w[0].replace("bis",""),w[0].indexOf("bis")!==-1)}else{let H=this.getMonthList(G,X),V=Z.replace(/^M|L$/g,(w)=>w==="L"?"bis":"");V[0]==="0"&&(V=V.slice(1));let O=H[V];if(!O)throw new RangeError(`Unmatched monthCode ${Z} in Chinese year ${G}`);if(z!==O.monthIndex)throw new RangeError(`monthCode ${Z} doesn't correspond to month ${z} in Chinese year ${G}`)}return{...$,year:G,month:z,monthCode:Z,day:Q}}}class FK extends sw{constructor(){super(...arguments),this.id="chinese"}}class MK extends sw{constructor(){super(...arguments),this.id="dangi"}}class JK{constructor($){this.helper=$}extraFields($){return this.helper.hasEra&&$.includes("year")?["era","eraYear"]:[]}resolveFields($){if(this.helper.calendarType!=="lunisolar"){let X=new l4;iw($,void 0,this.helper.monthsInYear({year:$.year??1972},X))}}dateToISO($,X){let Y=new l4,U=this.helper.calendarToIsoDate($,X,Y);return Y.setObject(U),U}monthDayToISOReferenceDate($,X){let Y=new l4,U=this.helper.monthDayFromFields($,X,Y);return Y.setObject(U),U}fieldKeysToIgnore($){let X=new Set;for(let Y=0;Y<$.length;Y++){let U=$[Y];switch(X.add(U),U){case"era":X.add("eraYear"),X.add("year");break;case"eraYear":X.add("era"),X.add("year");break;case"year":X.add("era"),X.add("eraYear");break;case"month":X.add("monthCode"),this.helper.erasBeginMidYear&&(X.add("era"),X.add("eraYear"));break;case"monthCode":X.add("month"),this.helper.erasBeginMidYear&&(X.add("era"),X.add("eraYear"));break;case"day":this.helper.erasBeginMidYear&&(X.add("era"),X.add("eraYear"))}}return tL(X)}dateAdd($,{years:X,months:Y,weeks:U,days:G},z){let W=l4.getCacheForObject($),Q=this.helper.isoToCalendarDate($,W),Z=this.helper.addCalendar(Q,{years:X,months:Y,weeks:U,days:G},z,W),H=this.helper.calendarToIsoDate(Z,"constrain",W);return l4.getCacheForObject(H)||new l4(W).setObject(H),H}dateUntil($,X,Y){let U=l4.getCacheForObject($),G=l4.getCacheForObject(X),z=this.helper.isoToCalendarDate($,U),W=this.helper.isoToCalendarDate(X,G);return this.helper.untilCalendar(z,W,Y,U)}isoToDate($,X){let Y=l4.getCacheForObject($),U=this.helper.isoToCalendarDate($,Y);if(X.dayOfWeek&&(U.dayOfWeek=L3.iso8601.isoToDate($,{dayOfWeek:!0}).dayOfWeek),X.dayOfYear){let G=this.helper.startOfCalendarYear(U),z=this.helper.calendarDaysUntil(G,U,Y);U.dayOfYear=z+1}if(X.weekOfYear&&(U.weekOfYear=aL(this.helper.id,$)),U.daysInWeek=7,X.daysInMonth&&(U.daysInMonth=this.helper.daysInMonth(U,Y)),X.daysInYear){let G=this.helper.startOfCalendarYear(U),z=this.helper.addCalendar(G,{years:1},"constrain",Y);U.daysInYear=this.helper.calendarDaysUntil(G,z,Y)}return X.monthsInYear&&(U.monthsInYear=this.helper.monthsInYear(U,Y)),X.inLeapYear&&(U.inLeapYear=this.helper.inLeapYear(U,Y)),U}getFirstDayOfWeek(){return this.helper.getFirstDayOfWeek()}getMinimalDaysInFirstWeek(){return this.helper.getMinimalDaysInFirstWeek()}}for(let $ of[eL,WK,OK,HK,VK,FK,MK,wK,QK,DK,EK,NK,$K,XK,YK,GK,UK,zK]){let X=new $;L3[X.id]=new JK(X)}_w("calendarImpl",function($){return L3[$]});var Q3=Intl.DateTimeFormat;function pX($,X){let Y=N($,X);return typeof Y=="function"&&(Y=new Q3(N($,DL),Y(N($,Jw))),function(U,G,z){let W=b7(U);if(W===void 0)throw new TypeError("Missing slots for the given container");if(W[G]===void 0)throw new TypeError(`tried to reset ${G} which was not set`);W[G]=z}($,X,Y)),Y}function gG($){return x6($,b8)}class U9{constructor($=void 0,X=void 0){(function(Y,U,G){let z=G!==void 0,W;if(z){let V=["localeMatcher","calendar","numberingSystem","hour12","hourCycle","timeZone","weekday","era","year","month","day","dayPeriod","hour","minute","second","fractionalSecondDigits","timeZoneName","formatMatcher","dateStyle","timeStyle"];W=function(w){if(w==null)throw new TypeError(`Expected object not ${w}`);return Object(w)}(G);let O=Object.create(null);for(let w=0;w<V.length;w++){let D=V[w];Object.prototype.hasOwnProperty.call(W,D)&&(O[D]=W[D])}W=O}else W=Object.create(null);let Q=new Q3(U,W),Z=Q.resolvedOptions();if(n0(Y),z){let V=Object.assign(Object.create(null),Z);for(let O in V)Object.prototype.hasOwnProperty.call(W,O)||delete V[O];V.hour12=W.hour12,V.hourCycle=W.hourCycle,R$(Y,Jw,V)}else R$(Y,Jw,W);R$(Y,DL,Z.locale),R$(Y,b8,Q),R$(Y,rX,Z.timeZone),R$(Y,mG,Z.calendar),R$(Y,QL,Rb),R$(Y,ZL,_b),R$(Y,HL,qb),R$(Y,VL,Kb),R$(Y,OL,Tb),R$(Y,wL,vb);let H=z?W.timeZone:void 0;if(H===void 0)R$(Y,Mw,Z.timeZone);else{let V=y7(H);if(V.startsWith("\u2212"))throw new RangeError("Unicode minus (U+2212) is not supported in time zone offsets");R$(Y,Mw,P6(V))}})(this,$,X)}get format(){k(this,gG);let $=Mb.bind(this);return Object.defineProperties($,{length:{value:1,enumerable:!1,writable:!1,configurable:!0},name:{value:"",enumerable:!1,writable:!1,configurable:!0}}),$}formatRange($,X){return k(this,gG),Ab.call(this,$,X)}formatToParts($,...X){return k(this,gG),Jb.call(this,$,...X)}formatRangeToParts($,X){return k(this,gG),Lb.call(this,$,X)}resolvedOptions(){return k(this,gG),Fb.call(this)}}"formatToParts"in Q3.prototype||delete U9.prototype.formatToParts,"formatRangeToParts"in Q3.prototype||delete U9.prototype.formatRangeToParts;var O1=function($=void 0,X=void 0){return new U9($,X)};function Fb(){let $=N(this,b8).resolvedOptions();return $.timeZone=N(this,Mw),$}function Mb($,...X){let Y,U,G=z9($,this);return G.formatter?(Y=G.formatter,U=[v1(G.epochNs,"floor")]):(Y=N(this,b8),U=[$,...X]),Y.format(...U)}function Jb($,...X){let Y,U,G=z9($,this);return G.formatter?(Y=G.formatter,U=[v1(G.epochNs,"floor")]):(Y=N(this,b8),U=[$,...X]),Y.formatToParts(...U)}function Ab($,X){if($===void 0||X===void 0)throw new TypeError("Intl.DateTimeFormat.formatRange requires two values");let Y=k7($),U=k7(X),G,z=[Y,U];if(i0(Y)!==i0(U))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");if(i0(Y)){if(!AK(Y,U))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");let{epochNs:W,formatter:Q}=z9(Y,this),{epochNs:Z,formatter:H}=z9(U,this);Q&&(G=Q,z=[v1(W,"floor"),v1(Z,"floor")])}return G||(G=N(this,b8)),G.formatRange(...z)}function Lb($,X){if($===void 0||X===void 0)throw new TypeError("Intl.DateTimeFormat.formatRange requires two values");let Y=k7($),U=k7(X),G,z=[Y,U];if(i0(Y)!==i0(U))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");if(i0(Y)){if(!AK(Y,U))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");let{epochNs:W,formatter:Q}=z9(Y,this),{epochNs:Z,formatter:H}=z9(U,this);Q&&(G=Q,z=[v1(W,"floor"),v1(Z,"floor")])}return G||(G=N(this,b8)),G.formatRangeToParts(...z)}function K3($={},X={}){let Y=Object.assign({},$),U=["year","month","day","hour","minute","second","weekday","dayPeriod","timeZoneName","dateStyle","timeStyle"];for(let G=0;G<U.length;G++){let z=U[G];Y[z]=z in X?X[z]:Y[z],Y[z]!==!1&&Y[z]!==void 0||delete Y[z]}return Y}function Kb($){let X=K3($,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});if(X.timeStyle!=="long"&&X.timeStyle!=="full"||(delete X.timeStyle,Object.assign(X,{hour:"numeric",minute:"2-digit",second:"2-digit"})),!n7(X)){if(_3($))throw new TypeError(`cannot format Temporal.PlainTime with options [${Object.keys($)}]`);Object.assign(X,{hour:"numeric",minute:"numeric",second:"numeric"})}return X}function _b($){let X={short:{year:"2-digit",month:"numeric"},medium:{year:"numeric",month:"short"},long:{year:"numeric",month:"long"},full:{year:"numeric",month:"long"}},Y=K3($,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if("dateStyle"in Y&&Y.dateStyle){let U=Y.dateStyle;delete Y.dateStyle,Object.assign(Y,X[U])}if(!(("year"in Y)||("month"in Y)||("era"in Y))){if(_3($))throw new TypeError(`cannot format PlainYearMonth with options [${Object.keys($)}]`);Object.assign(Y,{year:"numeric",month:"numeric"})}return Y}function qb($){let X={short:{month:"numeric",day:"numeric"},medium:{month:"short",day:"numeric"},long:{month:"long",day:"numeric"},full:{month:"long",day:"numeric"}},Y=K3($,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if("dateStyle"in Y&&Y.dateStyle){let U=Y.dateStyle;delete Y.dateStyle,Object.assign(Y,X[U])}if(!("month"in Y)&&!("day"in Y)){if(_3($))throw new TypeError(`cannot format PlainMonthDay with options [${Object.keys($)}]`);Object.assign(Y,{month:"numeric",day:"numeric"})}return Y}function Rb($){let X=K3($,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(!o7(X)){if(_3($))throw new TypeError(`cannot format PlainDate with options [${Object.keys($)}]`);Object.assign(X,{year:"numeric",month:"numeric",day:"numeric"})}return X}function Tb($){let X=K3($,{timeZoneName:!1});if((X.timeStyle==="long"||X.timeStyle==="full")&&(delete X.timeStyle,Object.assign(X,{hour:"numeric",minute:"2-digit",second:"2-digit"}),X.dateStyle))Object.assign(X,{short:{year:"numeric",month:"numeric",day:"numeric"},medium:{year:"numeric",month:"short",day:"numeric"},long:{year:"numeric",month:"long",day:"numeric"},full:{year:"numeric",month:"long",day:"numeric",weekday:"long"}}[X.dateStyle]),delete X.dateStyle;if(!n7(X)&&!o7(X)){if(_3($))throw new TypeError(`cannot format PlainDateTime with options [${Object.keys($)}]`);Object.assign(X,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}return X}function vb($){let X=$;return n7(X)||o7(X)||(X=Object.assign({},X,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),X}function o7($){return"year"in $||"month"in $||"day"in $||"weekday"in $||"dateStyle"in $||"era"in $}function n7($){return"hour"in $||"minute"in $||"second"in $||"timeStyle"in $||"dayPeriod"in $||"fractionalSecondDigits"in $}function _3($){return o7($)||n7($)||"dateStyle"in $||"timeStyle"in $||"timeZoneName"in $}function i0($){return D4($)||J4($)||e$($)||v$($)||s4($)||H1($)||a4($)}function k7($){return i0($)?$:g7($)}function AK($,X){return!(!i0($)||!i0(X)||J4($)&&!J4(X)||D4($)&&!D4(X)||e$($)&&!e$(X)||v$($)&&!v$(X)||s4($)&&!s4(X)||H1($)&&!H1(X)||a4($)&&!a4(X))}function z9($,X){if(J4($)){let Y={isoDate:{year:1970,month:1,day:1},time:N($,E4)};return{epochNs:Z6(N(X,rX),Y,"compatible"),formatter:pX(X,VL)}}if(s4($)){let Y=N($,p),U=N(X,mG);if(Y!==U)throw new RangeError(`cannot format PlainYearMonth with calendar ${Y} in locale with calendar ${U}`);let G=k$(N($,E$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:Z6(N(X,rX),G,"compatible"),formatter:pX(X,ZL)}}if(H1($)){let Y=N($,p),U=N(X,mG);if(Y!==U)throw new RangeError(`cannot format PlainMonthDay with calendar ${Y} in locale with calendar ${U}`);let G=k$(N($,E$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:Z6(N(X,rX),G,"compatible"),formatter:pX(X,HL)}}if(D4($)){let Y=N($,p),U=N(X,mG);if(Y!=="iso8601"&&Y!==U)throw new RangeError(`cannot format PlainDate with calendar ${Y} in locale with calendar ${U}`);let G=k$(N($,E$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:Z6(N(X,rX),G,"compatible"),formatter:pX(X,QL)}}if(e$($)){let Y=N($,p),U=N(X,mG);if(Y!=="iso8601"&&Y!==U)throw new RangeError(`cannot format PlainDateTime with calendar ${Y} in locale with calendar ${U}`);let G=N($,W4);return{epochNs:Z6(N(X,rX),G,"compatible"),formatter:pX(X,OL)}}if(v$($))throw new TypeError("Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.");return a4($)?{epochNs:N($,D$),formatter:pX(X,wL)}:{}}function LK($){let X=Object.create(null);return X.years=N($,L6),X.months=N($,K6),X.weeks=N($,p6),X.days=N($,_6),X.hours=N($,q6),X.minutes=N($,R6),X.seconds=N($,T6),X.milliseconds=N($,v6),X.microseconds=N($,C6),X.nanoseconds=N($,d6),X}U9.prototype.constructor=O1,Object.defineProperty(O1,"prototype",{value:U9.prototype,writable:!1,enumerable:!1,configurable:!1}),O1.supportedLocalesOf=Q3.supportedLocalesOf,t0(O1,"Intl.DateTimeFormat");var{format:Cb,formatToParts:Bb}=Intl.DurationFormat?.prototype??Object.create(null);function ew($){Intl.DurationFormat.prototype.resolvedOptions.call(this);let X=LK(R1($));return Cb.call(this,X)}Intl.DurationFormat?.prototype&&(Intl.DurationFormat.prototype.format=ew,Intl.DurationFormat.prototype.formatToParts=function($){Intl.DurationFormat.prototype.resolvedOptions.call(this);let X=LK(R1($));return Bb.call(this,X)});var Ze=Object.freeze({__proto__:null,DateTimeFormat:O1,ModifiedIntlDurationFormatPrototypeFormat:ew});class t7{constructor($){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");xL(this,S7($))}get epochMilliseconds(){return k(this,a4),v1(N(this,D$),"floor")}get epochNanoseconds(){return k(this,a4),oL(x.BigInt(N(this,D$)))}add($){return k(this,a4),oA("add",this,$)}subtract($){return k(this,a4),oA("subtract",this,$)}until($,X=void 0){return k(this,a4),uA("until",this,$,X)}since($,X=void 0){return k(this,a4),uA("since",this,$,X)}round($){if(k(this,a4),$===void 0)throw new TypeError("options parameter is required");let X=typeof $=="string"?S8("smallestUnit",$):Q$($),Y=Z9(X),U=p1(X,"halfExpand"),G=r6(X,"smallestUnit","time",o0);return H9(Y,{hour:24,minute:1440,second:86400,millisecond:86400000,microsecond:86400000000,nanosecond:86400000000000}[G],!0),u1(xw(N(this,D$),Y,G,U))}equals($){k(this,a4);let X=pG($),Y=N(this,D$),U=N(X,D$);return x.equal(x.BigInt(Y),x.BigInt(U))}toString($=void 0){k(this,a4);let X=Q$($),Y=w3(X),U=p1(X,"trunc"),G=r6(X,"smallestUnit","time",void 0);if(G==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let z=X.timeZone;z!==void 0&&(z=P6(z));let{precision:W,unit:Q,increment:Z}=D3(G,Y);return xA(u1(xw(N(this,D$),Z,Q,U)),z,W)}toJSON(){return k(this,a4),xA(this,void 0,"auto")}toLocaleString($=void 0,X=void 0){return k(this,a4),new O1($,X).format(this)}valueOf(){S2("Instant")}toZonedDateTimeISO($){k(this,a4);let X=P6($);return W6(N(this,D$),X,"iso8601")}static fromEpochMilliseconds($){return u1(c1(g7($)))}static fromEpochNanoseconds($){return u1(S7($))}static from($){return pG($)}static compare($,X){let Y=pG($),U=pG(X),G=N(Y,D$),z=N(U,D$);return x.lessThan(G,z)?-1:x.greaterThan(G,z)?1:0}}t0(t7,"Temporal.Instant");class a7{constructor($,X,Y,U="iso8601"){let G=F$($),z=F$(X),W=F$(Y),Q=S6(U===void 0?"iso8601":h4(U));P8(G,z,W),CL(this,{year:G,month:z,day:W},Q)}get calendarId(){return k(this,D4),N(this,p)}get era(){return M6(this,"era")}get eraYear(){return M6(this,"eraYear")}get year(){return M6(this,"year")}get month(){return M6(this,"month")}get monthCode(){return M6(this,"monthCode")}get day(){return M6(this,"day")}get dayOfWeek(){return M6(this,"dayOfWeek")}get dayOfYear(){return M6(this,"dayOfYear")}get weekOfYear(){return M6(this,"weekOfYear")?.week}get yearOfWeek(){return M6(this,"weekOfYear")?.year}get daysInWeek(){return M6(this,"daysInWeek")}get daysInMonth(){return M6(this,"daysInMonth")}get daysInYear(){return M6(this,"daysInYear")}get monthsInYear(){return M6(this,"monthsInYear")}get inLeapYear(){return M6(this,"inLeapYear")}with($,X=void 0){if(k(this,D4),!N4($))throw new TypeError("invalid argument");Q9($);let Y=N(this,p),U=I6(Y,N(this,E$));return U=j8(Y,U,E1(Y,$,["year","month","monthCode","day"],[],"partial")),j6(I2(Y,U,x$(Q$(X))),Y)}withCalendar($){k(this,D4);let X=M3($);return j6(N(this,E$),X)}add($,X=void 0){return k(this,D4),nA("add",this,$,X)}subtract($,X=void 0){return k(this,D4),nA("subtract",this,$,X)}until($,X=void 0){return k(this,D4),cA("until",this,$,X)}since($,X=void 0){return k(this,D4),cA("since",this,$,X)}equals($){k(this,D4);let X=uG($);return w0(N(this,E$),N(X,E$))===0&&V0(N(this,p),N(X,p))}toString($=void 0){return k(this,D4),SA(this,O3(Q$($)))}toJSON(){return k(this,D4),SA(this)}toLocaleString($=void 0,X=void 0){return k(this,D4),new O1($,X).format(this)}valueOf(){S2("PlainDate")}toPlainDateTime($=void 0){k(this,D4);let X=vL($);return _1(k$(N(this,E$),X),N(this,p))}toZonedDateTime($){let X,Y;if(k(this,D4),N4($)){let z=$.timeZone;z===void 0?X=P6($):(X=P6(z),Y=$.plainTime)}else X=P6($);let U=N(this,E$),G;return Y===void 0?G=R2(X,U):(Y=v2(Y),G=Z6(X,k$(U,N(Y,E4)),"compatible")),W6(G,X,N(this,p))}toPlainYearMonth(){k(this,D4);let $=N(this,p);return tX(Y3($,I6($,N(this,E$)),"constrain"),$)}toPlainMonthDay(){k(this,D4);let $=N(this,p);return nX(B7($,I6($,N(this,E$)),"constrain"),$)}static from($,X=void 0){return uG($,X)}static compare($,X){let Y=uG($),U=uG(X);return w0(N(Y,E$),N(U,E$))}}function M6($,X){k($,D4);let Y=N($,E$);return E3($).isoToDate(Y,{[X]:!0})[X]}t0(a7,"Temporal.PlainDate");class s7{constructor($,X,Y,U=0,G=0,z=0,W=0,Q=0,Z=0,H="iso8601"){let V=F$($),O=F$(X),w=F$(Y),D=U===void 0?0:F$(U),E=G===void 0?0:F$(G),F=z===void 0?0:F$(z),J=W===void 0?0:F$(W),A=Q===void 0?0:F$(Q),L=Z===void 0?0:F$(Z),T=S6(H===void 0?"iso8601":h4(H));pw(V,O,w,D,E,F,J,A,L),BL(this,{isoDate:{year:V,month:O,day:w},time:{hour:D,minute:E,second:F,millisecond:J,microsecond:A,nanosecond:L}},T)}get calendarId(){return k(this,e$),N(this,p)}get year(){return J6(this,"year")}get month(){return J6(this,"month")}get monthCode(){return J6(this,"monthCode")}get day(){return J6(this,"day")}get hour(){return dX(this,"hour")}get minute(){return dX(this,"minute")}get second(){return dX(this,"second")}get millisecond(){return dX(this,"millisecond")}get microsecond(){return dX(this,"microsecond")}get nanosecond(){return dX(this,"nanosecond")}get era(){return J6(this,"era")}get eraYear(){return J6(this,"eraYear")}get dayOfWeek(){return J6(this,"dayOfWeek")}get dayOfYear(){return J6(this,"dayOfYear")}get weekOfYear(){return J6(this,"weekOfYear")?.week}get yearOfWeek(){return J6(this,"weekOfYear")?.year}get daysInWeek(){return J6(this,"daysInWeek")}get daysInYear(){return J6(this,"daysInYear")}get daysInMonth(){return J6(this,"daysInMonth")}get monthsInYear(){return J6(this,"monthsInYear")}get inLeapYear(){return J6(this,"inLeapYear")}with($,X=void 0){if(k(this,e$),!N4($))throw new TypeError("invalid argument");Q9($);let Y=N(this,p),U=N(this,W4),G={...I6(Y,U.isoDate),...U.time};return G=j8(Y,G,E1(Y,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond"],"partial")),_1(N3(Y,G,x$(Q$(X))),Y)}withPlainTime($=void 0){k(this,e$);let X=vL($);return _1(k$(N(this,W4).isoDate,X),N(this,p))}withCalendar($){k(this,e$);let X=M3($);return _1(N(this,W4),X)}add($,X=void 0){return k(this,e$),tA("add",this,$,X)}subtract($,X=void 0){return k(this,e$),tA("subtract",this,$,X)}until($,X=void 0){return k(this,e$),pA("until",this,$,X)}since($,X=void 0){return k(this,e$),pA("since",this,$,X)}round($){if(k(this,e$),$===void 0)throw new TypeError("options parameter is required");let X=typeof $=="string"?S8("smallestUnit",$):Q$($),Y=Z9(X),U=p1(X,"halfExpand"),G=r6(X,"smallestUnit","time",o0,["day"]),z={day:1,hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[G];H9(Y,z,z===1);let W=N(this,W4);return _1(Y===1&&G==="nanosecond"?W:Sw(W,Y,G,U),N(this,p))}equals($){k(this,e$);let X=cG($);return G9(N(this,W4),N(X,W4))===0&&V0(N(this,p),N(X,p))}toString($=void 0){k(this,e$);let X=Q$($),Y=O3(X),U=w3(X),G=p1(X,"trunc"),z=r6(X,"smallestUnit","time",void 0);if(z==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:W,unit:Q,increment:Z}=D3(z,U),H=Sw(N(this,W4),Z,Q,G);return I8(H),U3(H,N(this,p),W,Y)}toJSON(){return k(this,e$),U3(N(this,W4),N(this,p),"auto")}toLocaleString($=void 0,X=void 0){return k(this,e$),new O1($,X).format(this)}valueOf(){S2("PlainDateTime")}toZonedDateTime($,X=void 0){k(this,e$);let Y=P6($),U=aG(Q$(X));return W6(Z6(Y,N(this,W4),U),Y,N(this,p))}toPlainDate(){return k(this,e$),j6(N(this,W4).isoDate,N(this,p))}toPlainTime(){return k(this,e$),c0(N(this,W4).time)}static from($,X=void 0){return cG($,X)}static compare($,X){let Y=cG($),U=cG(X);return G9(N(Y,W4),N(U,W4))}}function J6($,X){k($,e$);let Y=N($,W4).isoDate;return E3($).isoToDate(Y,{[X]:!0})[X]}function dX($,X){return k($,e$),N($,W4).time[X]}t0(s7,"Temporal.PlainDateTime");class W9{constructor($=0,X=0,Y=0,U=0,G=0,z=0,W=0,Q=0,Z=0,H=0){let V=$===void 0?0:m1($),O=X===void 0?0:m1(X),w=Y===void 0?0:m1(Y),D=U===void 0?0:m1(U),E=G===void 0?0:m1(G),F=z===void 0?0:m1(z),J=W===void 0?0:m1(W),A=Q===void 0?0:m1(Q),L=Z===void 0?0:m1(Z),T=H===void 0?0:m1(H);l7(V,O,w,D,E,F,J,A,L,T),n0(this),R$(this,L6,V),R$(this,K6,O),R$(this,p6,w),R$(this,_6,D),R$(this,q6,E),R$(this,R6,F),R$(this,T6,J),R$(this,v6,A),R$(this,C6,L),R$(this,d6,T)}get years(){return k(this,w4),N(this,L6)}get months(){return k(this,w4),N(this,K6)}get weeks(){return k(this,w4),N(this,p6)}get days(){return k(this,w4),N(this,_6)}get hours(){return k(this,w4),N(this,q6)}get minutes(){return k(this,w4),N(this,R6)}get seconds(){return k(this,w4),N(this,T6)}get milliseconds(){return k(this,w4),N(this,v6)}get microseconds(){return k(this,w4),N(this,C6)}get nanoseconds(){return k(this,w4),N(this,d6)}get sign(){return k(this,w4),I7(this)}get blank(){return k(this,w4),I7(this)===0}with($){k(this,w4);let X=TL($),{years:Y=N(this,L6),months:U=N(this,K6),weeks:G=N(this,p6),days:z=N(this,_6),hours:W=N(this,q6),minutes:Q=N(this,R6),seconds:Z=N(this,T6),milliseconds:H=N(this,v6),microseconds:V=N(this,C6),nanoseconds:O=N(this,d6)}=X;return new W9(Y,U,G,z,W,Q,Z,H,V,O)}negated(){return k(this,w4),o6(this)}abs(){return k(this,w4),new W9(Math.abs(N(this,L6)),Math.abs(N(this,K6)),Math.abs(N(this,p6)),Math.abs(N(this,_6)),Math.abs(N(this,q6)),Math.abs(N(this,R6)),Math.abs(N(this,T6)),Math.abs(N(this,v6)),Math.abs(N(this,C6)),Math.abs(N(this,d6)))}add($){return k(this,w4),iA("add",this,$)}subtract($){return k(this,w4),iA("subtract",this,$)}round($){if(k(this,w4),$===void 0)throw new TypeError("options parameter is required");let X=m0(this),Y=typeof $=="string"?S8("smallestUnit",$):Q$($),U=r6(Y,"largestUnit","datetime",void 0,["auto"]),{plainRelativeTo:G,zonedRelativeTo:z}=Ew(Y),W=Z9(Y),Q=p1(Y,"halfExpand"),Z=r6(Y,"smallestUnit","datetime",void 0),H=!0;Z||(H=!1,Z="nanosecond");let V=d0(X,Z),O=!0;if(U||(O=!1,U=V),U==="auto"&&(U=V),!H&&!O)throw new RangeError("at least one of smallestUnit or largestUnit is required");if(d0(U,Z)!==U)throw new RangeError(`largestUnit ${U} cannot be smaller than smallestUnit ${Z}`);let w={hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[Z];if(w!==void 0&&H9(W,w,!1),W>1&&u0(Z)==="date"&&U!==Z)throw new RangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit");if(z){let E=iX(this),F=N(z,m$),J=N(z,p),A=N(z,D$);return E=iL(A,rG(A,F,J,E),F,J,U,W,Z,Q),u0(U)==="date"&&(U="hour"),q1(E,U)}if(G){let E=Z0(this),F=Y9({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},E.time),J=N(G,E$),A=N(G,p),L=w1(A,J,Q6(E.date,F.deltaDays),"constrain");return E=rL(k$(J,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),k$(L,F),A,U,W,Z,Q),q1(E,U)}if(W0(X))throw new RangeError(`a starting point is required for ${X}s balancing`);if(W0(U))throw new RangeError(`a starting point is required for ${U}s balancing`);let D=Z0(this);if(Z==="day"){let{quotient:E,remainder:F}=D.time.divmod(T7),J=D.date.days+E+sG(F,"day");J=C2(J,W,Q),D=l0({years:0,months:0,weeks:0,days:J},C$.ZERO)}else D=l0({years:0,months:0,weeks:0,days:0},x7(D.time,W,Z,Q));return q1(D,U)}total($){if(k(this,w4),$===void 0)throw new TypeError("options argument is required");let X=typeof $=="string"?S8("unit",$):Q$($),{plainRelativeTo:Y,zonedRelativeTo:U}=Ew(X),G=r6(X,"unit","datetime",o0);if(U){let W=iX(this),Q=N(U,m$),Z=N(U,p),H=N(U,D$);return function(V,O,w,D,E){return u0(E)==="time"?sG(C$.fromEpochNsDiff(O,V),E):mA(dL(V,O,w,D,E),O,T1(w,V),w,D,E)}(H,rG(H,Q,Z,W),Q,Z,G)}if(Y){let W=Z0(this),Q=Y9({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},W.time),Z=N(Y,E$),H=N(Y,p),V=w1(H,Z,Q6(W.date,Q.deltaDays),"constrain");return function(O,w,D,E){if(G9(O,w)==0)return 0;I8(O),I8(w);let F=pL(O,w,D,E);return E==="nanosecond"?x.toNumber(F.time.totalNs):mA(F,e4(w),O,null,D,E)}(k$(Z,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),k$(V,Q),H,G)}let z=m0(this);if(W0(z))throw new RangeError(`a starting point is required for ${z}s total`);if(W0(G))throw new RangeError(`a starting point is required for ${G}s total`);return sG(Z0(this).time,G)}toString($=void 0){k(this,w4);let X=Q$($),Y=w3(X),U=p1(X,"trunc"),G=r6(X,"smallestUnit","time",void 0);if(G==="hour"||G==="minute")throw new RangeError('smallestUnit must be a time unit other than "hours" or "minutes"');let{precision:z,unit:W,increment:Q}=D3(G,Y);if(W==="nanosecond"&&Q===1)return K7(this,z);let Z=m0(this),H=iX(this),V=x7(H.time,Q,W,U);return H=l0(H.date,V),K7(q1(H,d0(Z,"second")),z)}toJSON(){return k(this,w4),K7(this,"auto")}toLocaleString($=void 0,X=void 0){if(k(this,w4),typeof Intl.DurationFormat=="function"){let Y=new Intl.DurationFormat($,X);return ew.call(Y,this)}return console.warn("Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat."),K7(this,"auto")}valueOf(){S2("Duration")}static from($){return R1($)}static compare($,X,Y=void 0){let U=R1($),G=R1(X),z=Q$(Y),{plainRelativeTo:W,zonedRelativeTo:Q}=Ew(z);if(N(U,L6)===N(G,L6)&&N(U,K6)===N(G,K6)&&N(U,p6)===N(G,p6)&&N(U,_6)===N(G,_6)&&N(U,q6)===N(G,q6)&&N(U,R6)===N(G,R6)&&N(U,T6)===N(G,T6)&&N(U,v6)===N(G,v6)&&N(U,C6)===N(G,C6)&&N(U,d6)===N(G,d6))return 0;let Z=m0(U),H=m0(G),V=iX(U),O=iX(G);if(Q&&(u0(Z)==="date"||u0(H)==="date")){let J=N(Q,m$),A=N(Q,p),L=N(Q,D$),T=rG(L,J,A,V),q=rG(L,J,A,O);return l6(x.toNumber(x.subtract(T,q)))}let w=V.date.days,D=O.date.days;if(W0(Z)||W0(H)){if(!W)throw new RangeError("A starting point is required for years, months, or weeks comparison");w=yA(V.date,W),D=yA(O.date,W)}let E=V.time.add24HourDays(w),F=O.time.add24HourDays(D);return E.cmp(F)}}t0(W9,"Temporal.Duration");class e7{constructor($,X,Y="iso8601",U=1972){let G=F$($),z=F$(X),W=S6(Y===void 0?"iso8601":h4(Y)),Q=F$(U);P8(Q,G,z),jL(this,{year:Q,month:G,day:z},W)}get monthCode(){return XL(this,"monthCode")}get day(){return XL(this,"day")}get calendarId(){return k(this,H1),N(this,p)}with($,X=void 0){if(k(this,H1),!N4($))throw new TypeError("invalid argument");Q9($);let Y=N(this,p),U=I6(Y,N(this,E$),"month-day");return U=j8(Y,U,E1(Y,$,["year","month","monthCode","day"],[],"partial")),nX(B7(Y,U,x$(Q$(X))),Y)}equals($){k(this,H1);let X=PA($);return w0(N(this,E$),N(X,E$))===0&&V0(N(this,p),N(X,p))}toString($=void 0){return k(this,H1),bA(this,O3(Q$($)))}toJSON(){return k(this,H1),bA(this)}toLocaleString($=void 0,X=void 0){return k(this,H1),new O1($,X).format(this)}valueOf(){S2("PlainMonthDay")}toPlainDate($){if(k(this,H1),!N4($))throw new TypeError("argument should be an object");let X=N(this,p);return j6(I2(X,j8(X,I6(X,N(this,E$),"month-day"),E1(X,$,["year"],[],[])),"constrain"),X)}static from($,X=void 0){return PA($,X)}}function XL($,X){k($,H1);let Y=N($,E$);return E3($).isoToDate(Y,{[X]:!0})[X]}function Fw($){return T1($,fw())}t0(e7,"Temporal.PlainMonthDay");var KK={instant:()=>u1(fw()),plainDateTimeISO:($=hG())=>_1(Fw(P6($)),"iso8601"),plainDateISO:($=hG())=>j6(Fw(P6($)).isoDate,"iso8601"),plainTimeISO:($=hG())=>c0(Fw(P6($)).time),timeZoneId:()=>hG(),zonedDateTimeISO:($=hG())=>{let X=P6($);return W6(fw(),X,"iso8601")},[Symbol.toStringTag]:"Temporal.Now"};Object.defineProperty(KK,Symbol.toStringTag,{value:"Temporal.Now",writable:!1,enumerable:!1,configurable:!0});class q3{constructor($=0,X=0,Y=0,U=0,G=0,z=0){let W=$===void 0?0:F$($),Q=X===void 0?0:F$(X),Z=Y===void 0?0:F$(Y),H=U===void 0?0:F$(U),V=G===void 0?0:F$(G),O=z===void 0?0:F$(z);d7(W,Q,Z,H,V,O),PL(this,{hour:W,minute:Q,second:Z,millisecond:H,microsecond:V,nanosecond:O})}get hour(){return k(this,J4),N(this,E4).hour}get minute(){return k(this,J4),N(this,E4).minute}get second(){return k(this,J4),N(this,E4).second}get millisecond(){return k(this,J4),N(this,E4).millisecond}get microsecond(){return k(this,J4),N(this,E4).microsecond}get nanosecond(){return k(this,J4),N(this,E4).nanosecond}with($,X=void 0){if(k(this,J4),!N4($))throw new TypeError("invalid argument");Q9($);let Y=vw($,"partial"),U=vw(this),{hour:G,minute:z,second:W,millisecond:Q,microsecond:Z,nanosecond:H}=Object.assign(U,Y),V=x$(Q$(X));return{hour:G,minute:z,second:W,millisecond:Q,microsecond:Z,nanosecond:H}=u7(G,z,W,Q,Z,H,V),new q3(G,z,W,Q,Z,H)}add($){return k(this,J4),aA("add",this,$)}subtract($){return k(this,J4),aA("subtract",this,$)}until($,X=void 0){return k(this,J4),dA("until",this,$,X)}since($,X=void 0){return k(this,J4),dA("since",this,$,X)}round($){if(k(this,J4),$===void 0)throw new TypeError("options parameter is required");let X=typeof $=="string"?S8("smallestUnit",$):Q$($),Y=Z9(X),U=p1(X,"halfExpand"),G=r6(X,"smallestUnit","time",o0);return H9(Y,{hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[G],!1),c0(kw(N(this,E4),Y,G,U))}equals($){k(this,J4);let X=v2($);return bw(N(this,E4),N(X,E4))===0}toString($=void 0){k(this,J4);let X=Q$($),Y=w3(X),U=p1(X,"trunc"),G=r6(X,"smallestUnit","time",void 0);if(G==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:z,unit:W,increment:Q}=D3(G,Y);return kA(kw(N(this,E4),Q,W,U),z)}toJSON(){return k(this,J4),kA(N(this,E4),"auto")}toLocaleString($=void 0,X=void 0){return k(this,J4),new O1($,X).format(this)}valueOf(){S2("PlainTime")}static from($,X=void 0){return v2($,X)}static compare($,X){let Y=v2($),U=v2(X);return bw(N(Y,E4),N(U,E4))}}t0(q3,"Temporal.PlainTime");class $z{constructor($,X,Y="iso8601",U=1){let G=F$($),z=F$(X),W=S6(Y===void 0?"iso8601":h4(Y)),Q=F$(U);P8(G,z,Q),IL(this,{year:G,month:z,day:Q},W)}get year(){return g0(this,"year")}get month(){return g0(this,"month")}get monthCode(){return g0(this,"monthCode")}get calendarId(){return k(this,s4),N(this,p)}get era(){return g0(this,"era")}get eraYear(){return g0(this,"eraYear")}get daysInMonth(){return g0(this,"daysInMonth")}get daysInYear(){return g0(this,"daysInYear")}get monthsInYear(){return g0(this,"monthsInYear")}get inLeapYear(){return g0(this,"inLeapYear")}with($,X=void 0){if(k(this,s4),!N4($))throw new TypeError("invalid argument");Q9($);let Y=N(this,p),U=I6(Y,N(this,E$),"year-month");return U=j8(Y,U,E1(Y,$,["year","month","monthCode"],[],"partial")),tX(Y3(Y,U,x$(Q$(X))),Y)}add($,X=void 0){return k(this,s4),sA("add",this,$,X)}subtract($,X=void 0){return k(this,s4),sA("subtract",this,$,X)}until($,X=void 0){return k(this,s4),lA("until",this,$,X)}since($,X=void 0){return k(this,s4),lA("since",this,$,X)}equals($){k(this,s4);let X=dG($);return w0(N(this,E$),N(X,E$))===0&&V0(N(this,p),N(X,p))}toString($=void 0){return k(this,s4),fA(this,O3(Q$($)))}toJSON(){return k(this,s4),fA(this)}toLocaleString($=void 0,X=void 0){return k(this,s4),new O1($,X).format(this)}valueOf(){S2("PlainYearMonth")}toPlainDate($){if(k(this,s4),!N4($))throw new TypeError("argument should be an object");let X=N(this,p);return j6(I2(X,j8(X,I6(X,N(this,E$),"year-month"),E1(X,$,["day"],[],[])),"constrain"),X)}static from($,X=void 0){return dG($,X)}static compare($,X){let Y=dG($),U=dG(X);return w0(N(Y,E$),N(U,E$))}}function g0($,X){k($,s4);let Y=N($,E$);return E3($).isoToDate(Y,{[X]:!0})[X]}t0($z,"Temporal.PlainYearMonth");var jb=O1.prototype.resolvedOptions;class Xz{constructor($,X,Y="iso8601"){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");let U=S7($),G=h4(X),{tzName:z,offsetMinutes:W}=B2(G);if(W===void 0){let Q=j7(z);if(!Q)throw new RangeError(`unknown time zone ${z}`);G=Q.identifier}else G=mw(W);SL(this,U,G,S6(Y===void 0?"iso8601":h4(Y)))}get calendarId(){return k(this,v$),N(this,p)}get timeZoneId(){return k(this,v$),N(this,m$)}get year(){return A6(this,"year")}get month(){return A6(this,"month")}get monthCode(){return A6(this,"monthCode")}get day(){return A6(this,"day")}get hour(){return lX(this,"hour")}get minute(){return lX(this,"minute")}get second(){return lX(this,"second")}get millisecond(){return lX(this,"millisecond")}get microsecond(){return lX(this,"microsecond")}get nanosecond(){return lX(this,"nanosecond")}get era(){return A6(this,"era")}get eraYear(){return A6(this,"eraYear")}get epochMilliseconds(){return k(this,v$),v1(N(this,D$),"floor")}get epochNanoseconds(){return k(this,v$),oL(N(this,D$))}get dayOfWeek(){return A6(this,"dayOfWeek")}get dayOfYear(){return A6(this,"dayOfYear")}get weekOfYear(){return A6(this,"weekOfYear")?.week}get yearOfWeek(){return A6(this,"weekOfYear")?.year}get hoursInDay(){k(this,v$);let $=N(this,m$),X=z0(this).isoDate,Y=i6(X.year,X.month,X.day+1),U=R2($,X),G=R2($,Y);return sG(C$.fromEpochNsDiff(G,U),"hour")}get daysInWeek(){return A6(this,"daysInWeek")}get daysInMonth(){return A6(this,"daysInMonth")}get daysInYear(){return A6(this,"daysInYear")}get monthsInYear(){return A6(this,"monthsInYear")}get inLeapYear(){return A6(this,"inLeapYear")}get offset(){return k(this,v$),Cw(p0(N(this,m$),N(this,D$)))}get offsetNanoseconds(){return k(this,v$),p0(N(this,m$),N(this,D$))}with($,X=void 0){if(k(this,v$),!N4($))throw new TypeError("invalid zoned-date-time-like");Q9($);let Y=N(this,p),U=N(this,m$),G=p0(U,N(this,D$)),z=z0(this),W={...I6(Y,z.isoDate),...z.time,offset:Cw(G)};W=j8(Y,W,E1(Y,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset"],"partial"));let Q=Q$(X),Z=aG(Q),H=_7(Q,"prefer"),V=N3(Y,W,x$(Q)),O=V9(W.offset);return W6(C7(V.isoDate,V.time,"option",O,U,Z,H,!1),U,Y)}withPlainTime($=void 0){k(this,v$);let X=N(this,m$),Y=N(this,p),U=z0(this).isoDate,G;return G=$===void 0?R2(X,U):Z6(X,k$(U,N(v2($),E4)),"compatible"),W6(G,X,Y)}withTimeZone($){k(this,v$);let X=P6($);return W6(N(this,D$),X,N(this,p))}withCalendar($){k(this,v$);let X=M3($);return W6(N(this,D$),N(this,m$),X)}add($,X=void 0){return k(this,v$),eA("add",this,$,X)}subtract($,X=void 0){return k(this,v$),eA("subtract",this,$,X)}until($,X=void 0){return k(this,v$),rA("until",this,$,X)}since($,X=void 0){return k(this,v$),rA("since",this,$,X)}round($){if(k(this,v$),$===void 0)throw new TypeError("options parameter is required");let X=typeof $=="string"?S8("smallestUnit",$):Q$($),Y=Z9(X),U=p1(X,"halfExpand"),G=r6(X,"smallestUnit","time",o0,["day"]),z={day:1,hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[G];if(H9(Y,z,z===1),G==="nanosecond"&&Y===1)return W6(N(this,D$),N(this,m$),N(this,p));let W=N(this,m$),Q=N(this,D$),Z=z0(this),H;if(G==="day"){let V=Z.isoDate,O=i6(V.year,V.month,V.day+1),w=R2(W,V),D=R2(W,O),E=x.subtract(D,w);H=C$.fromEpochNsDiff(Q,w).round(E,U).addToEpochNs(w)}else{let V=Sw(Z,Y,G,U),O=p0(W,Q);H=C7(V.isoDate,V.time,"option",O,W,"compatible","prefer",!1)}return W6(H,W,N(this,p))}equals($){k(this,v$);let X=lG($),Y=N(this,D$),U=N(X,D$);return!!x.equal(x.BigInt(Y),x.BigInt(U))&&!!kL(N(this,m$),N(X,m$))&&V0(N(this,p),N(X,p))}toString($=void 0){k(this,v$);let X=Q$($),Y=O3(X),U=w3(X),G=function(O){return r0(O,"offset",["auto","never"],"auto")}(X),z=p1(X,"trunc"),W=r6(X,"smallestUnit","time",void 0);if(W==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let Q=function(O){return r0(O,"timeZoneName",["auto","never","critical"],"auto")}(X),{precision:Z,unit:H,increment:V}=D3(W,U);return hA(this,Z,Y,Q,G,{unit:H,increment:V,roundingMode:z})}toLocaleString($=void 0,X=void 0){k(this,v$);let Y=Q$(X),U=Object.create(null);if(function(Q,Z,H,V){if(Z==null)return;let O=Reflect.ownKeys(Z);for(let w=0;w<O.length;w++){let D=O[w];if(!H.some((E)=>Object.is(E,D))&&Object.prototype.propertyIsEnumerable.call(Z,D)){let E=Z[D];Q[D]=E}}}(U,Y,["timeZone"]),Y.timeZone!==void 0)throw new TypeError("ZonedDateTime toLocaleString does not accept a timeZone option");if(U.year===void 0&&U.month===void 0&&U.day===void 0&&U.era===void 0&&U.weekday===void 0&&U.dateStyle===void 0&&U.hour===void 0&&U.minute===void 0&&U.second===void 0&&U.fractionalSecondDigits===void 0&&U.timeStyle===void 0&&U.dayPeriod===void 0&&U.timeZoneName===void 0&&(U.timeZoneName="short"),U.timeZone=N(this,m$),gA(U.timeZone))throw new RangeError("toLocaleString does not currently support offset time zones");let G=new O1($,U),z=jb.call(G).calendar,W=N(this,p);if(W!=="iso8601"&&z!=="iso8601"&&!V0(z,W))throw new RangeError(`cannot format ZonedDateTime with calendar ${W} in locale with calendar ${z}`);return G.format(u1(N(this,D$)))}toJSON(){return k(this,v$),hA(this,"auto")}valueOf(){S2("ZonedDateTime")}startOfDay(){k(this,v$);let $=N(this,m$);return W6(R2($,z0(this).isoDate),$,N(this,p))}getTimeZoneTransition($){k(this,v$);let X=N(this,m$);if($===void 0)throw new TypeError("options parameter is required");let Y=r0(typeof $=="string"?S8("direction",$):Q$($),"direction",["next","previous"],o0);if(Y===void 0)throw new TypeError("direction option is required");if(gA(X)||X==="UTC")return null;let U=N(this,D$),G=Y==="next"?cw(X,U):jw(X,U);return G===null?null:W6(G,X,N(this,p))}toInstant(){return k(this,v$),u1(N(this,D$))}toPlainDate(){return k(this,v$),j6(z0(this).isoDate,N(this,p))}toPlainTime(){return k(this,v$),c0(z0(this).time)}toPlainDateTime(){return k(this,v$),_1(z0(this),N(this,p))}static from($,X=void 0){return lG($,X)}static compare($,X){let Y=lG($),U=lG(X),G=N(Y,D$),z=N(U,D$);return x.lessThan(x.BigInt(G),x.BigInt(z))?-1:x.greaterThan(x.BigInt(G),x.BigInt(z))?1:0}}function z0($){return T1(N($,m$),N($,D$))}function A6($,X){k($,v$);let Y=z0($).isoDate;return E3($).isoToDate(Y,{[X]:!0})[X]}function lX($,X){return k($,v$),z0($).time[X]}t0(Xz,"Temporal.ZonedDateTime");var Yz=Object.freeze({__proto__:null,Duration:W9,Instant:t7,Now:KK,PlainDate:a7,PlainDateTime:s7,PlainMonthDay:e7,PlainTime:q3,PlainYearMonth:$z,ZonedDateTime:Xz}),He=class ${toTemporalInstant(){return u1(c1(Date.prototype.valueOf.call(this)))}}.prototype.toTemporalInstant,Pb=[t7,a7,s7,W9,e7,q3,$z,Xz];for(let $ of Pb){let X=Object.getOwnPropertyDescriptor($,"prototype");(X.configurable||X.enumerable||X.writable)&&(X.configurable=!1,X.enumerable=!1,X.writable=!1,Object.defineProperty($,"prototype",X))}var Ib=($)=>{return t2($,{key:"\uD83D\uDD0D Atom Token Index",default:()=>{let X=new Map;for(let[Y,U]of $.atoms){if(GX(Y))continue;let G=h1(U);if(U.family){let z=X.get(U.family.key);if(!z||!("familyMembers"in z))z={key:U.family.key,familyMembers:new Map},X.set(U.family.key,z);z.familyMembers.set(U.family.subKey,G)}else X.set(Y,G)}return X},effects:[({setSelf:X})=>{$.on.atomCreation.subscribe("introspection",(Y)=>{if(GX(Y.key))return;X((U)=>{if(Y.family){let{key:G,subKey:z}=Y.family,W=U.get(G);if(W===void 0||!("familyMembers"in W))W={key:G,familyMembers:new Map},U.set(G,W);W.familyMembers.set(z,Y)}else U.set(Y.key,Y);return new Map(U)})}),$.on.atomDisposal.subscribe("introspection",(Y)=>{X((U)=>{if(Y.family){let{key:G,subKey:z}=Y.family,W=U.get(G);if(W&&"familyMembers"in W){if(W.familyMembers.delete(z),W.familyMembers.size===0)U.delete(G)}}return new Map(U)})})}]},void 0)},xb=($)=>{return t2($,{key:"\uD83D\uDD0D Selector Token Index",default:()=>{let X=new Map;for(let Y of[$.readonlySelectors,$.writableSelectors])for(let[U,G]of Y){if(GX(U))continue;let z=h1(G);if(G.family){let W=X.get(G.family.key);if(!W||!("familyMembers"in W))W={key:G.family.key,familyMembers:new Map},X.set(G.family.key,W);W.familyMembers.set(G.family.subKey,z)}else X.set(U,z)}return X},effects:[({setSelf:X})=>{$.on.selectorCreation.subscribe("introspection",(Y)=>{if(GX(Y.key))return;X((U)=>{if(Y.family){let{key:G,subKey:z}=Y.family,W=U.get(G);if(W===void 0||!("familyMembers"in W))W={key:G,familyMembers:new Map},U.set(G,W);W.familyMembers.set(z,Y)}else U.set(Y.key,Y);return new Map(U)})}),$.on.selectorDisposal.subscribe("introspection",(Y)=>{X((U)=>{if(Y.family){let{key:G,subKey:z}=Y.family,W=U.get(G);if(W&&"familyMembers"in W){if(W.familyMembers.delete(z),W.familyMembers.size===0)U.delete(G)}}else U.delete(Y.key);return new Map(U)})})}]},void 0)};var $D=class{supported;constructor($){this.supported=$}refine($){for(let[X,Y]of Object.entries(this.supported))try{if(Y($)===!0&&Y!==Boolean)return{type:X,data:$}}catch(U){try{if($ instanceof Y)return{type:X,data:$}}catch(G){}}return null}},qK=new $D({number:($)=>typeof $==="number",string:($)=>typeof $==="string",boolean:($)=>typeof $==="boolean",null:($)=>$===null});function RK($){if(!$)return!1;return Object.getPrototypeOf($)===Object.prototype}var TK=new $D({object:RK,array:($)=>Array.isArray($)}),Sb=new $D({...qK.supported,...TK.supported}),Gz=($)=>{if($===void 0)return"undefined";let X=Sb.refine($);if(X)return X.type;return Object.getPrototypeOf($).constructor.name};var De=class ${store;auditorCreatedAt=performance.now();statesCreatedAt=new Map;atomIndex;selectorIndex;disposed=!1;unsubscribeFromAtomCreation;unsubscribeFromAtomDisposal;unsubscribeFromSelectorCreation;unsubscribeFromSelectorDisposal;constructor(X=N6.STORE){this.store=X,this.atomIndex=Ib(this.store),this.selectorIndex=xb(this.store),this.unsubscribeFromAtomCreation=this.store.on.atomCreation.subscribe(`auditor-${this.auditorCreatedAt}`,({key:Y})=>{this.statesCreatedAt.set(Y,performance.now()-this.auditorCreatedAt)}),this.unsubscribeFromAtomDisposal=this.store.on.atomDisposal.subscribe(`auditor-${this.auditorCreatedAt}`,({key:Y})=>{this.statesCreatedAt.delete(Y)}),this.unsubscribeFromSelectorCreation=this.store.on.selectorCreation.subscribe(`auditor-${this.auditorCreatedAt}`,({key:Y})=>{this.statesCreatedAt.set(Y,performance.now()-this.auditorCreatedAt)}),this.unsubscribeFromSelectorDisposal=this.store.on.selectorDisposal.subscribe(`auditor-${this.auditorCreatedAt}`,({key:Y})=>{this.statesCreatedAt.delete(Y)})}static DEFAULT_LIST_RESOURCES_PARAM={atomFamilies:!0,selectorFamilies:!0};listResources(X=$.DEFAULT_LIST_RESOURCES_PARAM){if(this.disposed)throw new Error("This Auditor has been disposed");let Y=RW(this.atomIndex),U=RW(this.selectorIndex),G=[...Y.values()].filter((Z)=>("familyMembers"in Z)),z=[...U.values()].filter((Z)=>("familyMembers"in Z)),W=performance.now(),Q=[];if(X.atomFamilies)for(let Z of G){let H=Z.familyMembers.values();for(let V of H){let w=this.statesCreatedAt.get(V.key)??this.auditorCreatedAt,D=W-w;Q.push([V,D])}}if(X.selectorFamilies)for(let Z of z){let H=Z.familyMembers.values();for(let V of H){let w=this.statesCreatedAt.get(V.key)??this.auditorCreatedAt,D=W-w;Q.push([V,D])}}return Q}[Symbol.dispose](){this.unsubscribeFromAtomCreation(),this.unsubscribeFromAtomDisposal(),this.unsubscribeFromSelectorCreation(),this.unsubscribeFromSelectorDisposal(),this.disposed=!0}},_K=($,X)=>{let Y=(U,G)=>{let W=((Z,H)=>{let V=X(Z,H);if(V)return V;return null})(U,G);if(W?.jobComplete??W?.pathComplete)return W;let Q=Array.isArray(G)?G.map((Z,H)=>[H,Z]):RK(G)?Object.entries(G):[];for(let[Z,H]of Q){let V=Y([...U,Z],H);if(V?.jobComplete)return V}return{}};Y([],$)};function kb($,X){return{summary:`${$<X?"+":"-"}${Math.abs($-X)} (${$} \u2192 ${X})`}}function bb($,X){return{summary:`${$.length<X.length?"+":"-"}${Math.abs($.length-X.length)} ("${$}" \u2192 "${X}")`}}function fb($,X){return{summary:`${$} \u2192 ${X}`}}function vK($,X,Y){let U="",G=[],z=[],W=[];return _K($,(Q,Z)=>{let H;for(H of Q){let V=X[H];if(V===void 0)z.push([H,JSON.stringify(Z)]);else{let O=Y(Z,V);if(O.summary!=="No Change")W.push([H,O])}}}),_K(X,(Q,Z)=>{let H;for(H of Q)if($[H]===void 0)G.push([H,JSON.stringify(Z)])}),U=`\uFF5E${W.length} \uFF0B${G.length} \uFF0D${z.length}`,{summary:U,added:G,removed:z,changed:W}}function hb($,X,Y){return vK($,X,Y)}var gb=class{leafRefinery;treeRefinery;leafDiffers;treeDiffers;constructor($,X,Y){this.leafRefinery=$,this.treeRefinery=X,this.leafDiffers={},this.treeDiffers={};for(let U of Object.keys($.supported)){let G=Y[U];this.leafDiffers[U]=G}for(let U of Object.keys(X.supported)){let G=Y[U];this.treeDiffers[U]=G}}diff($,X){if($===X)return{summary:"No Change"};let Y=this.leafRefinery.refine($)??this.treeRefinery.refine($),U=this.leafRefinery.refine(X)??this.treeRefinery.refine(X);if(Y!==null&&U!==null){if(Y.type===U.type){if(Y.type in this.leafDiffers)return this.leafDiffers[Y.type](Y.data,U.data);if(Y.type in this.treeDiffers)return this.treeDiffers[Y.type](Y.data,U.data,(Q,Z)=>this.diff(Q,Z))}}let G=Gz($),z=Gz(X);if(G===z)return{summary:`${G} \u2192 ${z}`};return{summary:`Type change: ${G} \u2192 ${z}`}}},Ee=new gb(qK,TK,{number:kb,string:bb,boolean:fb,null:()=>({summary:"No Change"}),object:vK,array:hb});var _=Symbol.for("drizzle:entityKind");function b($,X){if(!$||typeof $!=="object")return!1;if($ instanceof X)return!0;if(!Object.prototype.hasOwnProperty.call(X,_))throw new Error(`Class "${X.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let Y=Object.getPrototypeOf($).constructor;if(Y)while(Y){if(_ in Y&&Y[_]===X[_])return!0;Y=Object.getPrototypeOf(Y)}return!1}class r${constructor($,X){this.table=$,this.config=X,this.name=X.name,this.keyAsName=X.keyAsName,this.notNull=X.notNull,this.default=X.default,this.defaultFn=X.defaultFn,this.onUpdateFn=X.onUpdateFn,this.hasDefault=X.hasDefault,this.primary=X.primaryKey,this.isUnique=X.isUnique,this.uniqueName=X.uniqueName,this.uniqueType=X.uniqueType,this.dataType=X.dataType,this.columnType=X.columnType,this.generated=X.generated,this.generatedIdentity=X.generatedIdentity}static[_]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue($){return $}mapToDriverValue($){return $}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}class XD{static[_]="ColumnBuilder";config;constructor($,X,Y){this.config={name:$,keyAsName:$==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:X,columnType:Y,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default($){return this.config.default=$,this.config.hasDefault=!0,this}$defaultFn($){return this.config.defaultFn=$,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn($){return this.config.onUpdateFn=$,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName($){if(this.config.name!=="")return;this.config.name=$}}var d1=Symbol.for("drizzle:Name");class YD{static[_]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor($,X){if(this.reference=()=>{let{name:Y,columns:U,foreignColumns:G}=$();return{name:Y,columns:U,foreignTable:G[0].table,foreignColumns:G}},X)this._onUpdate=X.onUpdate,this._onDelete=X.onDelete}onUpdate($){return this._onUpdate=$===void 0?"no action":$,this}onDelete($){return this._onDelete=$===void 0?"no action":$,this}build($){return new CK($,this)}}class CK{constructor($,X){this.table=$,this.reference=X.reference,this.onUpdate=X._onUpdate,this.onDelete=X._onDelete}static[_]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:$,columns:X,foreignColumns:Y}=this.reference(),U=X.map((W)=>W.name),G=Y.map((W)=>W.name),z=[this.table[d1],...U,Y[0].table[d1],...G];return $??`${z.join("_")}_fk`}}function Uz($,...X){return $(...X)}function BK($,X){return`${$[d1]}_${X.join("_")}_unique`}function jK($,X,Y){for(let U=X;U<$.length;U++){let G=$[U];if(G==="\\"){U++;continue}if(G==='"')return[$.slice(X,U).replace(/\\/g,""),U+1];if(Y)continue;if(G===","||G==="}")return[$.slice(X,U).replace(/\\/g,""),U]}return[$.slice(X).replace(/\\/g,""),$.length]}function PK($,X=0){let Y=[],U=X,G=!1;while(U<$.length){let z=$[U];if(z===","){if(G||U===X)Y.push("");G=!0,U++;continue}if(G=!1,z==="\\"){U+=2;continue}if(z==='"'){let[Z,H]=jK($,U+1,!0);Y.push(Z),U=H;continue}if(z==="}")return[Y,U+1];if(z==="{"){let[Z,H]=PK($,U+1);Y.push(Z),U=H;continue}let[W,Q]=jK($,U,!1);Y.push(W),U=Q}return[Y,U]}function IK($){let[X]=PK($,1);return X}function GD($){return`{${$.map((X)=>{if(Array.isArray(X))return GD(X);if(typeof X==="string")return`"${X.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${X}`}).join(",")}}`}class Y$ extends XD{foreignKeyConfigs=[];static[_]="PgColumnBuilder";array($){return new SK(this.config.name,this,$)}references($,X={}){return this.foreignKeyConfigs.push({ref:$,actions:X}),this}unique($,X){return this.config.isUnique=!0,this.config.uniqueName=$,this.config.uniqueType=X?.nulls,this}generatedAlwaysAs($){return this.config.generated={as:$,type:"always",mode:"stored"},this}buildForeignKeys($,X){return this.foreignKeyConfigs.map(({ref:Y,actions:U})=>{return Uz((G,z)=>{let W=new YD(()=>{let Q=G();return{columns:[$],foreignColumns:[Q]}});if(z.onUpdate)W.onUpdate(z.onUpdate);if(z.onDelete)W.onDelete(z.onDelete);return W.build(X)},Y,U)})}buildExtraConfigColumn($){return new xK($,this.config)}}class i extends r${constructor($,X){if(!X.uniqueName)X.uniqueName=BK($,[X.name]);super($,X);this.table=$}static[_]="PgColumn"}class xK extends i{static[_]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op($){return this.indexConfig.opClass=$,this}}class R3{static[_]="IndexedColumn";constructor($,X,Y,U){this.name=$,this.keyAsName=X,this.type=Y,this.indexConfig=U}name;keyAsName;type;indexConfig}class SK extends Y${static[_]="PgArrayBuilder";constructor($,X,Y){super($,"array","PgArray");this.config.baseBuilder=X,this.config.size=Y}build($){let X=this.config.baseBuilder.build($);return new UD($,this.config,X)}}class UD extends i{constructor($,X,Y,U){super($,X);this.baseColumn=Y,this.range=U,this.size=X.size}size;static[_]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==="number"?this.size:""}]`}mapFromDriverValue($){if(typeof $==="string")$=IK($);return $.map((X)=>this.baseColumn.mapFromDriverValue(X))}mapToDriverValue($,X=!1){let Y=$.map((U)=>U===null?null:b(this.baseColumn,UD)?this.baseColumn.mapToDriverValue(U,!0):this.baseColumn.mapToDriverValue(U));if(X)return Y;return GD(Y)}}class kK extends Y${static[_]="PgEnumObjectColumnBuilder";constructor($,X){super($,"string","PgEnumObjectColumn");this.config.enum=X}build($){return new bK($,this.config)}}class bK extends i{static[_]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor($,X){super($,X);this.enum=X.enum}getSQLType(){return this.enum.enumName}}var zz=Symbol.for("drizzle:isPgEnum");function fK($){return!!$&&typeof $==="function"&&zz in $&&$[zz]===!0}class hK extends Y${static[_]="PgEnumColumnBuilder";constructor($,X){super($,"string","PgEnumColumn");this.config.enum=X}build($){return new gK($,this.config)}}class gK extends i{static[_]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor($,X){super($,X);this.enum=X.enum}getSQLType(){return this.enum.enumName}}function T3($,X){return Array.isArray(X)?yb($,[...X],void 0):mb($,X,void 0)}function yb($,X,Y){let U=Object.assign((G)=>new hK(G??"",U),{enumName:$,enumValues:X,schema:Y,[zz]:!0});return U}function mb($,X,Y){let U=Object.assign((G)=>new kK(G??"",U),{enumName:$,enumValues:Object.values(X),schema:Y,[zz]:!0});return U}class R4{static[_]="Subquery";constructor($,X,Y,U=!1,G=[]){this._={brand:"Subquery",sql:$,selectedFields:X,alias:Y,isWith:U,usedTables:G}}}class v3 extends R4{static[_]="WithSubquery"}var yK="0.44.5";var zD,WD,i$={startActiveSpan($,X){if(!zD)return X();if(!WD)WD=zD.trace.getTracer("drizzle-orm",yK);return Uz((Y,U)=>U.startActiveSpan($,(G)=>{try{return X(G)}catch(z){throw G.setStatus({code:Y.SpanStatusCode.ERROR,message:z instanceof Error?z.message:"Unknown error"}),z}finally{G.end()}}),zD,WD)}};var $4=Symbol.for("drizzle:ViewBaseConfig");var g8=Symbol.for("drizzle:Schema"),Wz=Symbol.for("drizzle:Columns"),mK=Symbol.for("drizzle:ExtraConfigColumns"),QD=Symbol.for("drizzle:OriginalName"),ZD=Symbol.for("drizzle:BaseName"),C3=Symbol.for("drizzle:IsAlias"),uK=Symbol.for("drizzle:ExtraConfigBuilder"),ub=Symbol.for("drizzle:IsDrizzleTable");class t{static[_]="Table";static Symbol={Name:d1,Schema:g8,OriginalName:QD,Columns:Wz,ExtraConfigColumns:mK,BaseName:ZD,IsAlias:C3,ExtraConfigBuilder:uK};[d1];[QD];[g8];[Wz];[mK];[ZD];[C3]=!1;[ub]=!0;[uK]=void 0;constructor($,X,Y){this[d1]=this[QD]=$,this[g8]=X,this[ZD]=Y}}function i4($){return $[d1]}function y8($){return`${$[g8]??"public"}.${$[d1]}`}function HD($){return $!==null&&$!==void 0&&typeof $.getSQL==="function"}function cb($){let X={sql:"",params:[]};for(let Y of $)if(X.sql+=Y.sql,X.params.push(...Y.params),Y.typings?.length){if(!X.typings)X.typings=[];X.typings.push(...Y.typings)}return X}class g4{static[_]="StringChunk";value;constructor($){this.value=Array.isArray($)?$:[$]}getSQL(){return new $$([this])}}class $${constructor($){this.queryChunks=$;for(let X of $)if(b(X,t)){let Y=X[t.Symbol.Schema];this.usedTables.push(Y===void 0?X[t.Symbol.Name]:Y+"."+X[t.Symbol.Name])}}static[_]="SQL";decoder=pK;shouldInlineParams=!1;usedTables=[];append($){return this.queryChunks.push(...$.queryChunks),this}toQuery($){return i$.startActiveSpan("drizzle.buildSQL",(X)=>{let Y=this.buildQueryFromSourceParams(this.queryChunks,$);return X?.setAttributes({"drizzle.query.text":Y.sql,"drizzle.query.params":JSON.stringify(Y.params)}),Y})}buildQueryFromSourceParams($,X){let Y=Object.assign({},X,{inlineParams:X.inlineParams||this.shouldInlineParams,paramStartIndex:X.paramStartIndex||{value:0}}),{casing:U,escapeName:G,escapeParam:z,prepareTyping:W,inlineParams:Q,paramStartIndex:Z}=Y;return cb($.map((H)=>{if(b(H,g4))return{sql:H.value.join(""),params:[]};if(b(H,Qz))return{sql:G(H.value),params:[]};if(H===void 0)return{sql:"",params:[]};if(Array.isArray(H)){let V=[new g4("(")];for(let[O,w]of H.entries())if(V.push(w),O<H.length-1)V.push(new g4(", "));return V.push(new g4(")")),this.buildQueryFromSourceParams(V,Y)}if(b(H,$$))return this.buildQueryFromSourceParams(H.queryChunks,{...Y,inlineParams:Q||H.shouldInlineParams});if(b(H,t)){let V=H[t.Symbol.Schema],O=H[t.Symbol.Name];return{sql:V===void 0||H[C3]?G(O):G(V)+"."+G(O),params:[]}}if(b(H,r$)){let V=U.getColumnCasing(H);if(X.invokeSource==="indexes")return{sql:G(V),params:[]};let O=H.table[t.Symbol.Schema];return{sql:H.table[C3]||O===void 0?G(H.table[t.Symbol.Name])+"."+G(V):G(O)+"."+G(H.table[t.Symbol.Name])+"."+G(V),params:[]}}if(b(H,n6)){let V=H[$4].schema,O=H[$4].name;return{sql:V===void 0||H[$4].isAlias?G(O):G(V)+"."+G(O),params:[]}}if(b(H,N1)){if(b(H.value,b2))return{sql:z(Z.value++,H),params:[H],typings:["none"]};let V=H.value===null?null:H.encoder.mapToDriverValue(H.value);if(b(V,$$))return this.buildQueryFromSourceParams([V],Y);if(Q)return{sql:this.mapInlineParam(V,Y),params:[]};let O=["none"];if(W)O=[W(H.encoder)];return{sql:z(Z.value++,V),params:[V],typings:O}}if(b(H,b2))return{sql:z(Z.value++,H),params:[H],typings:["none"]};if(b(H,$$.Aliased)&&H.fieldAlias!==void 0)return{sql:G(H.fieldAlias),params:[]};if(b(H,R4)){if(H._.isWith)return{sql:G(H._.alias),params:[]};return this.buildQueryFromSourceParams([new g4("("),H._.sql,new g4(") "),new Qz(H._.alias)],Y)}if(fK(H)){if(H.schema)return{sql:G(H.schema)+"."+G(H.enumName),params:[]};return{sql:G(H.enumName),params:[]}}if(HD(H)){if(H.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([H.getSQL()],Y);return this.buildQueryFromSourceParams([new g4("("),H.getSQL(),new g4(")")],Y)}if(Q)return{sql:this.mapInlineParam(H,Y),params:[]};return{sql:z(Z.value++,H),params:[H],typings:["none"]}}))}mapInlineParam($,{escapeString:X}){if($===null)return"null";if(typeof $==="number"||typeof $==="boolean")return $.toString();if(typeof $==="string")return X($);if(typeof $==="object"){let Y=$.toString();if(Y==="[object Object]")return X(JSON.stringify($));return X(Y)}throw new Error("Unexpected param value: "+$)}getSQL(){return this}as($){if($===void 0)return this;return new $$.Aliased(this,$)}mapWith($){return this.decoder=typeof $==="function"?{mapFromDriverValue:$}:$,this}inlineParams(){return this.shouldInlineParams=!0,this}if($){return $?this:void 0}}class Qz{constructor($){this.value=$}static[_]="Name";brand;getSQL(){return new $$([this])}}function cK($){return typeof $==="object"&&$!==null&&"mapToDriverValue"in $&&typeof $.mapToDriverValue==="function"}var pK={mapFromDriverValue:($)=>$},dK={mapToDriverValue:($)=>$},z$$={...pK,...dK};class N1{constructor($,X=dK){this.value=$,this.encoder=X}static[_]="Param";brand;getSQL(){return new $$([this])}}function R($,...X){let Y=[];if(X.length>0||$.length>0&&$[0]!=="")Y.push(new g4($[0]));for(let[U,G]of X.entries())Y.push(G,new g4($[U+1]));return new $$(Y)}(($)=>{function X(){return new $$([])}$.empty=X;function Y(Z){return new $$(Z)}$.fromList=Y;function U(Z){return new $$([new g4(Z)])}$.raw=U;function G(Z,H){let V=[];for(let[O,w]of Z.entries()){if(O>0&&H!==void 0)V.push(H);V.push(w)}return new $$(V)}$.join=G;function z(Z){return new Qz(Z)}$.identifier=z;function W(Z){return new b2(Z)}$.placeholder=W;function Q(Z,H){return new N1(Z,H)}$.param=Q})(R||(R={}));(($)=>{class X{constructor(Y,U){this.sql=Y,this.fieldAlias=U}static[_]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new X(this.sql,this.fieldAlias)}}$.Aliased=X})($$||($$={}));class b2{constructor($){this.name=$}static[_]="Placeholder";getSQL(){return new $$([this])}}function VD($,X){return $.map((Y)=>{if(b(Y,b2)){if(!(Y.name in X))throw new Error(`No value for placeholder "${Y.name}" was provided`);return X[Y.name]}if(b(Y,N1)&&b(Y.value,b2)){if(!(Y.value.name in X))throw new Error(`No value for placeholder "${Y.value.name}" was provided`);return Y.encoder.mapToDriverValue(X[Y.value.name])}return Y})}var pb=Symbol.for("drizzle:IsDrizzleView");class n6{static[_]="View";[$4];[pb]=!0;constructor({name:$,schema:X,selectedFields:Y,query:U}){this[$4]={name:$,originalName:$,schema:X,selectedFields:Y,query:U,isExisting:!U,isAlias:!1}}getSQL(){return new $$([this])}}r$.prototype.getSQL=function(){return new $$([this])};t.prototype.getSQL=function(){return new $$([this])};R4.prototype.getSQL=function(){return new $$([this])};class w9{constructor($){this.table=$}static[_]="ColumnAliasProxyHandler";get($,X){if(X==="table")return this.table;return $[X]}}class B3{constructor($,X){this.alias=$,this.replaceOriginalName=X}static[_]="TableAliasProxyHandler";get($,X){if(X===t.Symbol.IsAlias)return!0;if(X===t.Symbol.Name)return this.alias;if(this.replaceOriginalName&&X===t.Symbol.OriginalName)return this.alias;if(X===$4)return{...$[$4],name:this.alias,isAlias:!0};if(X===t.Symbol.Columns){let U=$[t.Symbol.Columns];if(!U)return U;let G={};return Object.keys(U).map((z)=>{G[z]=new Proxy(U[z],new w9(new Proxy($,this)))}),G}let Y=$[X];if(b(Y,r$))return new Proxy(Y,new w9(new Proxy($,this)));return Y}}function Zz($,X){return new Proxy($,new B3(X,!1))}function E0($,X){return new Proxy($,new w9(new Proxy($.table,new B3(X,!1))))}function OD($,X){return new $$.Aliased(j3($.sql,X),$.fieldAlias)}function j3($,X){return R.join($.queryChunks.map((Y)=>{if(b(Y,r$))return E0(Y,X);if(b(Y,$$))return j3(Y,X);if(b(Y,$$.Aliased))return OD(Y,X);return Y}))}class Hz extends Error{static[_]="DrizzleError";constructor({message:$,cause:X}){super($);this.name="DrizzleError",this.cause=X}}class a0 extends Error{constructor($,X,Y){super(`Failed query: ${$}
|
|
128
|
+
params: ${X}`);if(this.query=$,this.params=X,this.cause=Y,Error.captureStackTrace(this,a0),Y)this.cause=Y}}class wD extends Hz{static[_]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class lK{static[_]="ConsoleLogWriter";write($){console.log($)}}class DD{static[_]="DefaultLogger";writer;constructor($){this.writer=$?.writer??new lK}logQuery($,X){let Y=X.map((G)=>{try{return JSON.stringify(G)}catch{return String(G)}}),U=Y.length?` -- params: [${Y.join(", ")}]`:"";this.writer.write(`Query: ${$}${U}`)}}class ED{static[_]="NoopLogger";logQuery(){}}class k6{static[_]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch($){return this.then(void 0,$)}finally($){return this.then((X)=>{return $?.(),X},(X)=>{throw $?.(),X})}then($,X){return this.execute().then($,X)}}function rK($,X,Y){let U={},G=$.reduce((z,{path:W,field:Q},Z)=>{let H;if(b(Q,r$))H=Q;else if(b(Q,$$))H=Q.decoder;else H=Q.sql.decoder;let V=z;for(let[O,w]of W.entries())if(O<W.length-1){if(!(w in V))V[w]={};V=V[w]}else{let D=X[Z],E=V[w]=D===null?null:H.mapFromDriverValue(D);if(Y&&b(Q,r$)&&W.length===2){let F=W[0];if(!(F in U))U[F]=E===null?i4(Q.table):!1;else if(typeof U[F]==="string"&&U[F]!==i4(Q.table))U[F]=!1}}return z},{});if(Y&&Object.keys(U).length>0){for(let[z,W]of Object.entries(U))if(typeof W==="string"&&!Y[W])G[z]=null}return G}function C1($,X){return Object.entries($).reduce((Y,[U,G])=>{if(typeof U!=="string")return Y;let z=X?[...X,U]:[U];if(b(G,r$)||b(G,$$)||b(G,$$.Aliased))Y.push({path:z,field:G});else if(b(G,t))Y.push(...C1(G[t.Symbol.Columns],z));else Y.push(...C1(G,z));return Y},[])}function P3($,X){let Y=Object.keys($),U=Object.keys(X);if(Y.length!==U.length)return!1;for(let[G,z]of Y.entries())if(z!==U[G])return!1;return!0}function Vz($,X){let Y=Object.entries(X).filter(([,U])=>U!==void 0).map(([U,G])=>{if(b(G,$$)||b(G,r$))return[U,G];else return[U,new N1(G,$[t.Symbol.Columns][U])]});if(Y.length===0)throw new Error("No values to set");return Object.fromEntries(Y)}function iK($,X){for(let Y of X)for(let U of Object.getOwnPropertyNames(Y.prototype)){if(U==="constructor")continue;Object.defineProperty($.prototype,U,Object.getOwnPropertyDescriptor(Y.prototype,U)||Object.create(null))}}function oK($){return $[t.Symbol.Columns]}function s0($){return b($,R4)?$._.alias:b($,n6)?$[$4].name:b($,$$)?void 0:$[t.Symbol.IsAlias]?$[t.Symbol.Name]:$[t.Symbol.BaseName]}function I$($,X){return{name:typeof $==="string"&&$.length>0?$:"",config:typeof $==="object"?$:X}}function nK($){if(typeof $!=="object"||$===null)return!1;if($.constructor.name!=="Object")return!1;if("logger"in $){let X=typeof $.logger;if(X!=="boolean"&&(X!=="object"||typeof $.logger.logQuery!=="function")&&X!=="undefined")return!1;return!0}if("schema"in $){let X=typeof $.schema;if(X!=="object"&&X!=="undefined")return!1;return!0}if("casing"in $){let X=typeof $.casing;if(X!=="string"&&X!=="undefined")return!1;return!0}if("mode"in $){if($.mode!=="default"||$.mode!=="planetscale"||$.mode!==void 0)return!1;return!0}if("connection"in $){let X=typeof $.connection;if(X!=="string"&&X!=="object"&&X!=="undefined")return!1;return!0}if("client"in $){let X=typeof $.client;if(X!=="object"&&X!=="function"&&X!=="undefined")return!1;return!0}if(Object.keys($).length===0)return!0;return!1}class f2 extends Y${static[_]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity($){if($){let{name:X,...Y}=$;this.config.generatedIdentity={type:"always",sequenceName:X,sequenceOptions:Y}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity($){if($){let{name:X,...Y}=$;this.config.generatedIdentity={type:"byDefault",sequenceName:X,sequenceOptions:Y}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class tK extends f2{static[_]="PgBigInt53Builder";constructor($){super($,"number","PgBigInt53")}build($){return new aK($,this.config)}}class aK extends i{static[_]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}}class sK extends f2{static[_]="PgBigInt64Builder";constructor($){super($,"bigint","PgBigInt64")}build($){return new eK($,this.config)}}class eK extends i{static[_]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue($){return BigInt($)}}function $_($,X){let{name:Y,config:U}=I$($,X);if(U.mode==="number")return new tK(Y);return new sK(Y)}class X_ extends Y${static[_]="PgBigSerial53Builder";constructor($){super($,"number","PgBigSerial53");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new Y_($,this.config)}}class Y_ extends i{static[_]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}}class G_ extends Y${static[_]="PgBigSerial64Builder";constructor($){super($,"bigint","PgBigSerial64");this.config.hasDefault=!0}build($){return new U_($,this.config)}}class U_ extends i{static[_]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue($){return BigInt($)}}function z_($,X){let{name:Y,config:U}=I$($,X);if(U.mode==="number")return new X_(Y);return new G_(Y)}class W_ extends Y${static[_]="PgBooleanBuilder";constructor($){super($,"boolean","PgBoolean")}build($){return new Q_($,this.config)}}class Q_ extends i{static[_]="PgBoolean";getSQLType(){return"boolean"}}function I3($){return new W_($??"")}class Z_ extends Y${static[_]="PgCharBuilder";constructor($,X){super($,"string","PgChar");this.config.length=X.length,this.config.enumValues=X.enum}build($){return new H_($,this.config)}}class H_ extends i{static[_]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}function V_($,X={}){let{name:Y,config:U}=I$($,X);return new Z_(Y,U)}class O_ extends Y${static[_]="PgCidrBuilder";constructor($){super($,"string","PgCidr")}build($){return new w_($,this.config)}}class w_ extends i{static[_]="PgCidr";getSQLType(){return"cidr"}}function D_($){return new O_($??"")}class E_ extends Y${static[_]="PgCustomColumnBuilder";constructor($,X,Y){super($,"custom","PgCustomColumn");this.config.fieldConfig=X,this.config.customTypeParams=Y}build($){return new N_($,this.config)}}class N_ extends i{static[_]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor($,X){super($,X);this.sqlName=X.customTypeParams.dataType(X.fieldConfig),this.mapTo=X.customTypeParams.toDriver,this.mapFrom=X.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue($){return typeof this.mapFrom==="function"?this.mapFrom($):$}mapToDriverValue($){return typeof this.mapTo==="function"?this.mapTo($):$}}function F_($){return(X,Y)=>{let{name:U,config:G}=I$(X,Y);return new E_(U,G,$)}}class e0 extends Y${static[_]="PgDateColumnBaseBuilder";defaultNow(){return this.default(R`now()`)}}class M_ extends e0{static[_]="PgDateBuilder";constructor($){super($,"date","PgDate")}build($){return new Oz($,this.config)}}class Oz extends i{static[_]="PgDate";getSQLType(){return"date"}mapFromDriverValue($){return new Date($)}mapToDriverValue($){return $.toISOString()}}class J_ extends e0{static[_]="PgDateStringBuilder";constructor($){super($,"string","PgDateString")}build($){return new wz($,this.config)}}class wz extends i{static[_]="PgDateString";getSQLType(){return"date"}}function A_($,X){let{name:Y,config:U}=I$($,X);if(U?.mode==="date")return new M_(Y);return new J_(Y)}class L_ extends Y${static[_]="PgDoublePrecisionBuilder";constructor($){super($,"number","PgDoublePrecision")}build($){return new K_($,this.config)}}class K_ extends i{static[_]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue($){if(typeof $==="string")return Number.parseFloat($);return $}}function __($){return new L_($??"")}class q_ extends Y${static[_]="PgInetBuilder";constructor($){super($,"string","PgInet")}build($){return new R_($,this.config)}}class R_ extends i{static[_]="PgInet";getSQLType(){return"inet"}}function T_($){return new q_($??"")}class v_ extends f2{static[_]="PgIntegerBuilder";constructor($){super($,"number","PgInteger")}build($){return new C_($,this.config)}}class C_ extends i{static[_]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue($){if(typeof $==="string")return Number.parseInt($);return $}}function x3($){return new v_($??"")}class B_ extends Y${static[_]="PgIntervalBuilder";constructor($,X){super($,"string","PgInterval");this.config.intervalConfig=X}build($){return new j_($,this.config)}}class j_ extends i{static[_]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let $=this.fields?` ${this.fields}`:"",X=this.precision?`(${this.precision})`:"";return`interval${$}${X}`}}function P_($,X={}){let{name:Y,config:U}=I$($,X);return new B_(Y,U)}class I_ extends Y${static[_]="PgJsonBuilder";constructor($){super($,"json","PgJson")}build($){return new Dz($,this.config)}}class Dz extends i{static[_]="PgJson";constructor($,X){super($,X)}getSQLType(){return"json"}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){if(typeof $==="string")try{return JSON.parse($)}catch{return $}return $}}function x_($){return new I_($??"")}class S_ extends Y${static[_]="PgJsonbBuilder";constructor($){super($,"json","PgJsonb")}build($){return new Ez($,this.config)}}class Ez extends i{static[_]="PgJsonb";constructor($,X){super($,X)}getSQLType(){return"jsonb"}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){if(typeof $==="string")try{return JSON.parse($)}catch{return $}return $}}function k_($){return new S_($??"")}class b_ extends Y${static[_]="PgLineBuilder";constructor($){super($,"array","PgLine")}build($){return new f_($,this.config)}}class f_ extends i{static[_]="PgLine";getSQLType(){return"line"}mapFromDriverValue($){let[X,Y,U]=$.slice(1,-1).split(",");return[Number.parseFloat(X),Number.parseFloat(Y),Number.parseFloat(U)]}mapToDriverValue($){return`{${$[0]},${$[1]},${$[2]}}`}}class h_ extends Y${static[_]="PgLineABCBuilder";constructor($){super($,"json","PgLineABC")}build($){return new g_($,this.config)}}class g_ extends i{static[_]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue($){let[X,Y,U]=$.slice(1,-1).split(",");return{a:Number.parseFloat(X),b:Number.parseFloat(Y),c:Number.parseFloat(U)}}mapToDriverValue($){return`{${$.a},${$.b},${$.c}}`}}function y_($,X){let{name:Y,config:U}=I$($,X);if(!U?.mode||U.mode==="tuple")return new b_(Y);return new h_(Y)}class m_ extends Y${static[_]="PgMacaddrBuilder";constructor($){super($,"string","PgMacaddr")}build($){return new u_($,this.config)}}class u_ extends i{static[_]="PgMacaddr";getSQLType(){return"macaddr"}}function c_($){return new m_($??"")}class p_ extends Y${static[_]="PgMacaddr8Builder";constructor($){super($,"string","PgMacaddr8")}build($){return new d_($,this.config)}}class d_ extends i{static[_]="PgMacaddr8";getSQLType(){return"macaddr8"}}function l_($){return new p_($??"")}class r_ extends Y${static[_]="PgNumericBuilder";constructor($,X,Y){super($,"string","PgNumeric");this.config.precision=X,this.config.scale=Y}build($){return new Nz($,this.config)}}class Nz extends i{static[_]="PgNumeric";precision;scale;constructor($,X){super($,X);this.precision=X.precision,this.scale=X.scale}mapFromDriverValue($){if(typeof $==="string")return $;return String($)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}}class i_ extends Y${static[_]="PgNumericNumberBuilder";constructor($,X,Y){super($,"number","PgNumericNumber");this.config.precision=X,this.config.scale=Y}build($){return new o_($,this.config)}}class o_ extends i{static[_]="PgNumericNumber";precision;scale;constructor($,X){super($,X);this.precision=X.precision,this.scale=X.scale}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}mapToDriverValue=String;getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}}class n_ extends Y${static[_]="PgNumericBigIntBuilder";constructor($,X,Y){super($,"bigint","PgNumericBigInt");this.config.precision=X,this.config.scale=Y}build($){return new t_($,this.config)}}class t_ extends i{static[_]="PgNumericBigInt";precision;scale;constructor($,X){super($,X);this.precision=X.precision,this.scale=X.scale}mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}}function a_($,X){let{name:Y,config:U}=I$($,X),G=U?.mode;return G==="number"?new i_(Y,U?.precision,U?.scale):G==="bigint"?new n_(Y,U?.precision,U?.scale):new r_(Y,U?.precision,U?.scale)}class s_ extends Y${static[_]="PgPointTupleBuilder";constructor($){super($,"array","PgPointTuple")}build($){return new e_($,this.config)}}class e_ extends i{static[_]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue($){if(typeof $==="string"){let[X,Y]=$.slice(1,-1).split(",");return[Number.parseFloat(X),Number.parseFloat(Y)]}return[$.x,$.y]}mapToDriverValue($){return`(${$[0]},${$[1]})`}}class $q extends Y${static[_]="PgPointObjectBuilder";constructor($){super($,"json","PgPointObject")}build($){return new Xq($,this.config)}}class Xq extends i{static[_]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue($){if(typeof $==="string"){let[X,Y]=$.slice(1,-1).split(",");return{x:Number.parseFloat(X),y:Number.parseFloat(Y)}}return $}mapToDriverValue($){return`(${$.x},${$.y})`}}function Yq($,X){let{name:Y,config:U}=I$($,X);if(!U?.mode||U.mode==="tuple")return new s_(Y);return new $q(Y)}function db($){let X=[];for(let Y=0;Y<$.length;Y+=2)X.push(Number.parseInt($.slice(Y,Y+2),16));return new Uint8Array(X)}function Gq($,X){let Y=new ArrayBuffer(8),U=new DataView(Y);for(let G=0;G<8;G++)U.setUint8(G,$[X+G]);return U.getFloat64(0,!0)}function ND($){let X=db($),Y=0,U=X[Y];Y+=1;let G=new DataView(X.buffer),z=G.getUint32(Y,U===1);Y+=4;let W;if(z&536870912)W=G.getUint32(Y,U===1),Y+=4;if((z&65535)===1){let Q=Gq(X,Y);Y+=8;let Z=Gq(X,Y);return Y+=8,[Q,Z]}throw new Error("Unsupported geometry type")}class Uq extends Y${static[_]="PgGeometryBuilder";constructor($){super($,"array","PgGeometry")}build($){return new zq($,this.config)}}class zq extends i{static[_]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue($){return ND($)}mapToDriverValue($){return`point(${$[0]} ${$[1]})`}}class Wq extends Y${static[_]="PgGeometryObjectBuilder";constructor($){super($,"json","PgGeometryObject")}build($){return new Qq($,this.config)}}class Qq extends i{static[_]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue($){let X=ND($);return{x:X[0],y:X[1]}}mapToDriverValue($){return`point(${$.x} ${$.y})`}}function Zq($,X){let{name:Y,config:U}=I$($,X);if(!U?.mode||U.mode==="tuple")return new Uq(Y);return new Wq(Y)}class Hq extends Y${static[_]="PgRealBuilder";constructor($,X){super($,"number","PgReal");this.config.length=X}build($){return new Vq($,this.config)}}class Vq extends i{static[_]="PgReal";constructor($,X){super($,X)}getSQLType(){return"real"}mapFromDriverValue=($)=>{if(typeof $==="string")return Number.parseFloat($);return $}}function Oq($){return new Hq($??"")}class wq extends Y${static[_]="PgSerialBuilder";constructor($){super($,"number","PgSerial");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new Dq($,this.config)}}class Dq extends i{static[_]="PgSerial";getSQLType(){return"serial"}}function Eq($){return new wq($??"")}class Nq extends f2{static[_]="PgSmallIntBuilder";constructor($){super($,"number","PgSmallInt")}build($){return new Fq($,this.config)}}class Fq extends i{static[_]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=($)=>{if(typeof $==="string")return Number($);return $}}function Mq($){return new Nq($??"")}class Jq extends Y${static[_]="PgSmallSerialBuilder";constructor($){super($,"number","PgSmallSerial");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new Aq($,this.config)}}class Aq extends i{static[_]="PgSmallSerial";getSQLType(){return"smallserial"}}function Lq($){return new Jq($??"")}class Kq extends Y${static[_]="PgTextBuilder";constructor($,X){super($,"string","PgText");this.config.enumValues=X.enum}build($){return new _q($,this.config)}}class _q extends i{static[_]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function qq($,X={}){let{name:Y,config:U}=I$($,X);return new Kq(Y,U)}class Rq extends e0{constructor($,X,Y){super($,"string","PgTime");this.withTimezone=X,this.precision=Y,this.config.withTimezone=X,this.config.precision=Y}static[_]="PgTimeBuilder";build($){return new Fz($,this.config)}}class Fz extends i{static[_]="PgTime";withTimezone;precision;constructor($,X){super($,X);this.withTimezone=X.withTimezone,this.precision=X.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function Tq($,X={}){let{name:Y,config:U}=I$($,X);return new Rq(Y,U.withTimezone??!1,U.precision)}class vq extends e0{static[_]="PgTimestampBuilder";constructor($,X,Y){super($,"date","PgTimestamp");this.config.withTimezone=X,this.config.precision=Y}build($){return new Mz($,this.config)}}class Mz extends i{static[_]="PgTimestamp";withTimezone;precision;constructor($,X){super($,X);this.withTimezone=X.withTimezone,this.precision=X.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=($)=>{return new Date(this.withTimezone?$:$+"+0000")};mapToDriverValue=($)=>{return $.toISOString()}}class Cq extends e0{static[_]="PgTimestampStringBuilder";constructor($,X,Y){super($,"string","PgTimestampString");this.config.withTimezone=X,this.config.precision=Y}build($){return new Jz($,this.config)}}class Jz extends i{static[_]="PgTimestampString";withTimezone;precision;constructor($,X){super($,X);this.withTimezone=X.withTimezone,this.precision=X.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function Bq($,X={}){let{name:Y,config:U}=I$($,X);if(U?.mode==="string")return new Cq(Y,U.withTimezone??!1,U.precision);return new vq(Y,U?.withTimezone??!1,U?.precision)}class jq extends Y${static[_]="PgUUIDBuilder";constructor($){super($,"string","PgUUID")}defaultRandom(){return this.default(R`gen_random_uuid()`)}build($){return new Az($,this.config)}}class Az extends i{static[_]="PgUUID";getSQLType(){return"uuid"}}function B1($){return new jq($??"")}class Pq extends Y${static[_]="PgVarcharBuilder";constructor($,X){super($,"string","PgVarchar");this.config.length=X.length,this.config.enumValues=X.enum}build($){return new Iq($,this.config)}}class Iq extends i{static[_]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function H6($,X={}){let{name:Y,config:U}=I$($,X);return new Pq(Y,U)}class xq extends Y${static[_]="PgBinaryVectorBuilder";constructor($,X){super($,"string","PgBinaryVector");this.config.dimensions=X.dimensions}build($){return new Sq($,this.config)}}class Sq extends i{static[_]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function kq($,X){let{name:Y,config:U}=I$($,X);return new xq(Y,U)}class bq extends Y${static[_]="PgHalfVectorBuilder";constructor($,X){super($,"array","PgHalfVector");this.config.dimensions=X.dimensions}build($){return new fq($,this.config)}}class fq extends i{static[_]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){return $.slice(1,-1).split(",").map((X)=>Number.parseFloat(X))}}function hq($,X){let{name:Y,config:U}=I$($,X);return new bq(Y,U)}class gq extends Y${static[_]="PgSparseVectorBuilder";constructor($,X){super($,"string","PgSparseVector");this.config.dimensions=X.dimensions}build($){return new yq($,this.config)}}class yq extends i{static[_]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}function mq($,X){let{name:Y,config:U}=I$($,X);return new gq(Y,U)}class uq extends Y${static[_]="PgVectorBuilder";constructor($,X){super($,"array","PgVector");this.config.dimensions=X.dimensions}build($){return new cq($,this.config)}}class cq extends i{static[_]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){return $.slice(1,-1).split(",").map((X)=>Number.parseFloat(X))}}function pq($,X){let{name:Y,config:U}=I$($,X);return new uq(Y,U)}function dq(){return{bigint:$_,bigserial:z_,boolean:I3,char:V_,cidr:D_,customType:F_,date:A_,doublePrecision:__,inet:T_,integer:x3,interval:P_,json:x_,jsonb:k_,line:y_,macaddr:c_,macaddr8:l_,numeric:a_,point:Yq,geometry:Zq,real:Oq,serial:Eq,smallint:Mq,smallserial:Lq,text:qq,time:Tq,timestamp:Bq,uuid:B1,varchar:H6,bit:kq,halfvec:hq,sparsevec:mq,vector:pq}}var FD=Symbol.for("drizzle:PgInlineForeignKeys"),lq=Symbol.for("drizzle:EnableRLS");class y4 extends t{static[_]="PgTable";static Symbol=Object.assign({},t.Symbol,{InlineForeignKeys:FD,EnableRLS:lq});[FD]=[];[lq]=!1;[t.Symbol.ExtraConfigBuilder]=void 0;[t.Symbol.ExtraConfigColumns]={}}function lb($,X,Y,U,G=$){let z=new y4($,U,G),W=typeof X==="function"?X(dq()):X,Q=Object.fromEntries(Object.entries(W).map(([V,O])=>{let w=O;w.setName(V);let D=w.build(z);return z[FD].push(...w.buildForeignKeys(D,z)),[V,D]})),Z=Object.fromEntries(Object.entries(W).map(([V,O])=>{let w=O;w.setName(V);let D=w.buildExtraConfigColumn(z);return[V,D]})),H=Object.assign(z,Q);if(H[t.Symbol.Columns]=Q,H[t.Symbol.ExtraConfigColumns]=Z,Y)H[y4.Symbol.ExtraConfigBuilder]=Y;return Object.assign(H,{enableRLS:()=>{return H[y4.Symbol.EnableRLS]=!0,H}})}var h2=($,X,Y)=>{return lb($,X,Y,void 0)};function rq(...$){if($[0].columns)return new S3($[0].columns,$[0].name);return new S3($)}class S3{static[_]="PgPrimaryKeyBuilder";columns;name;constructor($,X){this.columns=$,this.name=X}build($){return new iq($,this.columns,this.name)}}class iq{constructor($,X,Y){this.table=$,this.columns=X,this.name=Y}static[_]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[y4.Symbol.Name]}_${this.columns.map(($)=>$.name).join("_")}_pk`}}function t6($,X){if(cK(X)&&!HD($)&&!b($,N1)&&!b($,b2)&&!b($,r$)&&!b($,t)&&!b($,n6))return new N1($,X);return $}var Lz=($,X)=>{return R`${$} = ${t6(X,$)}`},oq=($,X)=>{return R`${$} <> ${t6(X,$)}`};function k3(...$){let X=$.filter((Y)=>Y!==void 0);if(X.length===0)return;if(X.length===1)return new $$(X);return new $$([new g4("("),R.join(X,new g4(" and ")),new g4(")")])}function nq(...$){let X=$.filter((Y)=>Y!==void 0);if(X.length===0)return;if(X.length===1)return new $$(X);return new $$([new g4("("),R.join(X,new g4(" or ")),new g4(")")])}function tq($){return R`not ${$}`}var Kz=($,X)=>{return R`${$} > ${t6(X,$)}`},aq=($,X)=>{return R`${$} >= ${t6(X,$)}`},sq=($,X)=>{return R`${$} < ${t6(X,$)}`},eq=($,X)=>{return R`${$} <= ${t6(X,$)}`};function $R($,X){if(Array.isArray(X)){if(X.length===0)return R`false`;return R`${$} in ${X.map((Y)=>t6(Y,$))}`}return R`${$} in ${t6(X,$)}`}function XR($,X){if(Array.isArray(X)){if(X.length===0)return R`true`;return R`${$} not in ${X.map((Y)=>t6(Y,$))}`}return R`${$} not in ${t6(X,$)}`}function YR($){return R`${$} is null`}function GR($){return R`${$} is not null`}function UR($){return R`exists ${$}`}function zR($){return R`not exists ${$}`}function WR($,X,Y){return R`${$} between ${t6(X,$)} and ${t6(Y,$)}`}function QR($,X,Y){return R`${$} not between ${t6(X,$)} and ${t6(Y,$)}`}function ZR($,X){return R`${$} like ${X}`}function HR($,X){return R`${$} not like ${X}`}function VR($,X){return R`${$} ilike ${X}`}function OR($,X){return R`${$} not ilike ${X}`}function wR($){return R`${$} asc`}function DR($){return R`${$} desc`}class MD{constructor($,X,Y){this.sourceTable=$,this.referencedTable=X,this.relationName=Y,this.referencedTableName=X[t.Symbol.Name]}static[_]="Relation";referencedTableName;fieldName}class ER{constructor($,X){this.table=$,this.config=X}static[_]="Relations"}class g2 extends MD{constructor($,X,Y,U){super($,X,Y?.relationName);this.config=Y,this.isNullable=U}static[_]="One";withFieldName($){let X=new g2(this.sourceTable,this.referencedTable,this.config,this.isNullable);return X.fieldName=$,X}}class b3 extends MD{constructor($,X,Y){super($,X,Y?.relationName);this.config=Y}static[_]="Many";withFieldName($){let X=new b3(this.sourceTable,this.referencedTable,this.config);return X.fieldName=$,X}}function NR(){return{and:k3,between:WR,eq:Lz,exists:UR,gt:Kz,gte:aq,ilike:VR,inArray:$R,isNull:YR,isNotNull:GR,like:ZR,lt:sq,lte:eq,ne:oq,not:tq,notBetween:QR,notExists:zR,notLike:HR,notIlike:OR,notInArray:XR,or:nq,sql:R}}function FR(){return{sql:R,asc:wR,desc:DR}}function MR($,X){if(Object.keys($).length===1&&"default"in $&&!b($.default,t))$=$.default;let Y={},U={},G={};for(let[z,W]of Object.entries($))if(b(W,t)){let Q=y8(W),Z=U[Q];Y[Q]=z,G[z]={tsName:z,dbName:W[t.Symbol.Name],schema:W[t.Symbol.Schema],columns:W[t.Symbol.Columns],relations:Z?.relations??{},primaryKey:Z?.primaryKey??[]};for(let V of Object.values(W[t.Symbol.Columns]))if(V.primary)G[z].primaryKey.push(V);let H=W[t.Symbol.ExtraConfigBuilder]?.(W[t.Symbol.ExtraConfigColumns]);if(H){for(let V of Object.values(H))if(b(V,S3))G[z].primaryKey.push(...V.columns)}}else if(b(W,ER)){let Q=y8(W.table),Z=Y[Q],H=W.config(X(W.table)),V;for(let[O,w]of Object.entries(H))if(Z){let D=G[Z];if(D.relations[O]=w,V)D.primaryKey.push(...V)}else{if(!(Q in U))U[Q]={relations:{},primaryKey:V};U[Q].relations[O]=w}}return{tables:G,tableNamesMap:Y}}function rb($){return function X(Y,U){return new g2($,Y,U,U?.fields.reduce((G,z)=>G&&z.notNull,!0)??!1)}}function ib($){return function X(Y,U){return new b3($,Y,U)}}function JR($,X,Y){if(b(Y,g2)&&Y.config)return{fields:Y.config.fields,references:Y.config.references};let U=X[y8(Y.referencedTable)];if(!U)throw new Error(`Table "${Y.referencedTable[t.Symbol.Name]}" not found in schema`);let G=$[U];if(!G)throw new Error(`Table "${U}" not found in schema`);let z=Y.sourceTable,W=X[y8(z)];if(!W)throw new Error(`Table "${z[t.Symbol.Name]}" not found in schema`);let Q=[];for(let Z of Object.values(G.relations))if(Y.relationName&&Y!==Z&&Z.relationName===Y.relationName||!Y.relationName&&Z.referencedTable===Y.sourceTable)Q.push(Z);if(Q.length>1)throw Y.relationName?new Error(`There are multiple relations with name "${Y.relationName}" in table "${U}"`):new Error(`There are multiple relations between "${U}" and "${Y.sourceTable[t.Symbol.Name]}". Please specify relation name`);if(Q[0]&&b(Q[0],g2)&&Q[0].config)return{fields:Q[0].config.references,references:Q[0].config.fields};throw new Error(`There is not enough information to infer relation "${W}.${Y.fieldName}"`)}function AR($){return{one:rb($),many:ib($)}}function _z($,X,Y,U,G=(z)=>z){let z={};for(let[W,Q]of U.entries())if(Q.isJson){let Z=X.relations[Q.tsKey],H=Y[W],V=typeof H==="string"?JSON.parse(H):H;z[Q.tsKey]=b(Z,g2)?V&&_z($,$[Q.relationTableTsKey],V,Q.selection,G):V.map((O)=>_z($,$[Q.relationTableTsKey],O,Q.selection,G))}else{let Z=G(Y[W]),H=Q.field,V;if(b(H,r$))V=H;else if(b(H,$$))V=H.decoder;else V=H.sql.decoder;z[Q.tsKey]=Z===null?null:V.mapFromDriverValue(Z)}return z}import hm from"path";import Mf from"os";import Jf from"fs";var qz=new Map,JD=new Map,AD=Symbol("OriginError"),D9={};class j1 extends Promise{constructor($,X,Y,U,G={}){let z,W;super((Q,Z)=>{z=Q,W=Z});this.tagged=Array.isArray($.raw),this.strings=$,this.args=X,this.handler=Y,this.canceller=U,this.options=G,this.state=null,this.statement=null,this.resolve=(Q)=>(this.active=!1,z(Q)),this.reject=(Q)=>(this.active=!1,W(Q)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[AD]=this.handler.debug?new Error:this.tagged&&ob(this.strings)}get origin(){return(this.handler.debug?this[AD].stack:this.tagged&&JD.has(this.strings)?JD.get(this.strings):JD.set(this.strings,this[AD].stack).get(this.strings))||""}static get[Symbol.species](){return Promise}cancel(){return this.canceller&&(this.canceller(this),this.canceller=null)}simple(){return this.options.simple=!0,this.options.prepare=!1,this}async readable(){return this.simple(),this.streaming=!0,this}async writable(){return this.simple(),this.streaming=!0,this}cursor($=1,X){if(this.options.simple=!1,typeof $==="function")X=$,$=1;if(this.cursorRows=$,typeof X==="function")return this.cursorFn=X,this;let Y;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};Y&&Y();let U=new Promise((G,z)=>{this.cursorFn=(W)=>{return G({value:W,done:!1}),new Promise((Q)=>Y=Q)},this.resolve=()=>(this.active=!1,G({done:!0})),this.reject=(W)=>(this.active=!1,z(W))});return this.execute(),U},return(){return Y&&Y(D9),{done:!0}}})}}describe(){return this.options.simple=!1,this.onlyDescribe=this.options.prepare=!0,this}stream(){throw new Error(".stream has been renamed to .forEach")}forEach($){return this.forEachFn=$,this.handle(),this}raw(){return this.isRaw=!0,this}values(){return this.isRaw="values",this}async handle(){!this.executed&&(this.executed=!0)&&await 1&&this.handler(this)}execute(){return this.handle(),this}then(){return this.handle(),super.then.apply(this,arguments)}catch(){return this.handle(),super.catch.apply(this,arguments)}finally(){return this.handle(),super.finally.apply(this,arguments)}}function ob($){if(qz.has($))return qz.get($);let X=Error.stackTraceLimit;return Error.stackTraceLimit=4,qz.set($,new Error),Error.stackTraceLimit=X,qz.get($)}class E9 extends Error{constructor($){super($.message);this.name=this.constructor.name,Object.assign(this,$)}}var B4={connection:LR,postgres:KR,generic:_R,notSupported:qR};function LR($,X,Y){let{host:U,port:G}=Y||X,z=Object.assign(new Error("write "+$+" "+(X.path||U+":"+G)),{code:$,errno:$,address:X.path||U},X.path?{}:{port:G});return Error.captureStackTrace(z,LR),z}function KR($){let X=new E9($);return Error.captureStackTrace(X,KR),X}function _R($,X){let Y=Object.assign(new Error($+": "+X),{code:$});return Error.captureStackTrace(Y,_R),Y}function qR($){let X=Object.assign(new Error($+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:$});return Error.captureStackTrace(X,qR),X}var nb={string:{to:25,from:null,serialize:($)=>""+$},number:{to:0,from:[21,23,26,700,701],serialize:($)=>""+$,parse:($)=>+$},json:{to:114,from:[114,3802],serialize:($)=>JSON.stringify($),parse:($)=>JSON.parse($)},boolean:{to:16,from:16,serialize:($)=>$===!0?"t":"f",parse:($)=>$==="t"},date:{to:1184,from:[1082,1114,1184],serialize:($)=>($ instanceof Date?$:new Date($)).toISOString(),parse:($)=>new Date($)},bytea:{to:17,from:17,serialize:($)=>"\\x"+Buffer.from($).toString("hex"),parse:($)=>Buffer.from($.slice(2),"hex")}};class vz{then(){LD()}catch(){LD()}finally(){LD()}}class y3 extends vz{constructor($){super();this.value=jz($)}}class N0 extends vz{constructor($,X,Y){super();this.value=$,this.type=X,this.array=Y}}class Cz extends vz{constructor($,X){super();this.first=$,this.rest=X}build($,X,Y,U){let G=tb.map(([z,W])=>({fn:W,i:$.search(z)})).sort((z,W)=>z.i-W.i).pop();return G.i===-1?TD(this.first,U):G.fn(this.first,this.rest,X,Y,U)}}function Bz($,X,Y,U){let G=$ instanceof N0?$.value:$;if(G===void 0){if($ instanceof N0?$.value=U.transform.undefined:G=$=U.transform.undefined,G===void 0)throw B4.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+Y.push($ instanceof N0?(X.push($.value),$.array?$.array[$.type||Tz($.value)]||$.type||CR($.value):$.type):(X.push($),Tz($)))}var TR=jR(nb);function qD($,X,Y,U,G,z){for(let W=1;W<$.strings.length;W++)X+=RD(X,Y,U,G,z)+$.strings[W],Y=$.args[W];return X}function RD($,X,Y,U,G){return X instanceof Cz?X.build($,Y,U,G):X instanceof j1?_D(X,Y,U,G):X instanceof y3?X.value:X&&X[0]instanceof j1?X.reduce((z,W)=>z+" "+_D(W,Y,U,G),""):Bz(X,Y,U,G)}function _D($,X,Y,U){return $.fragment=!0,qD($,$.strings[0],$.args[0],X,Y,U)}function vR($,X,Y,U,G){return $.map((z)=>"("+U.map((W)=>RD("values",z[W],X,Y,G)).join(",")+")").join(",")}function RR($,X,Y,U,G){let z=Array.isArray($[0]),W=X.length?X.flat():Object.keys(z?$[0]:$);return vR(z?$:[$],Y,U,W,G)}function Rz($,X,Y,U,G){if(typeof $==="string"&&($=[$].concat(X)),Array.isArray($))return TD($,G);let z;return(X.length?X.flat():Object.keys($)).map((Q)=>{return z=$[Q],(z instanceof j1?_D(z,Y,U,G):z instanceof y3?z.value:Bz(z,Y,U,G))+" as "+jz(G.transform.column.to?G.transform.column.to(Q):Q)}).join(",")}var tb=Object.entries({values:RR,in:(...$)=>{let X=RR(...$);return X==="()"?"(null)":X},select:Rz,as:Rz,returning:Rz,"\\(":Rz,update($,X,Y,U,G){return(X.length?X.flat():Object.keys($)).map((z)=>jz(G.transform.column.to?G.transform.column.to(z):z)+"="+RD("values",$[z],Y,U,G))},insert($,X,Y,U,G){let z=X.length?X.flat():Object.keys(Array.isArray($)?$[0]:$);return"("+TD(z,G)+")values"+vR(Array.isArray($)?$:[$],Y,U,z,G)}}).map(([$,X])=>[new RegExp("((?:^|[\\s(])"+$+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),X]);function LD(){throw B4.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:ab,parsers:sb}=TR;function CR($){if(Array.isArray($))return CR($[0]);return typeof $==="string"?1009:0}var BR=function($){let X=jR($||{});return{serializers:Object.assign({},ab,X.serializers),parsers:Object.assign({},sb,X.parsers)}};function jR($){return Object.keys($).reduce((X,Y)=>{if($[Y].from&&[].concat($[Y].from).forEach((U)=>X.parsers[U]=$[Y].parse),$[Y].serialize)X.serializers[$[Y].to]=$[Y].serialize,$[Y].from&&[].concat($[Y].from).forEach((U)=>X.serializers[U]=$[Y].serialize);return X},{parsers:{},serializers:{}})}function TD($,{transform:{column:X}}){return $.map((Y)=>jz(X.to?X.to(Y):Y)).join(",")}var jz=function $(X){return'"'+X.replace(/"/g,'""').replace(/\./g,'"."')+'"'},Tz=function $(X){return X instanceof N0?X.type:X instanceof Date?1184:X instanceof Uint8Array?17:X===!0||X===!1?16:typeof X==="bigint"?20:Array.isArray(X)?$(X[0]):0},eb=/\\/g,$f=/"/g;function Xf($){return $.replace(eb,"\\\\").replace($f,"\\\"")}var PR=function $(X,Y,U,G){if(Array.isArray(X)===!1)return X;if(!X.length)return"{}";let z=X[0],W=G===1020?";":",";if(Array.isArray(z)&&!z.type)return"{"+X.map((Q)=>$(Q,Y,U,G)).join(W)+"}";return"{"+X.map((Q)=>{if(Q===void 0){if(Q=U.transform.undefined,Q===void 0)throw B4.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return Q===null?"null":'"'+Xf(Y?Y(Q.type?Q.value:Q):""+Q)+'"'}).join(W)+"}"},KD={i:0,char:null,str:"",quoted:!1,last:0},IR=function $(X,Y,U){return KD.i=KD.last=0,xR(KD,X,Y,U)};function xR($,X,Y,U){let G=[],z=U===1020?";":",";for(;$.i<X.length;$.i++){if($.char=X[$.i],$.quoted)if($.char==="\\")$.str+=X[++$.i];else if($.char==='"')G.push(Y?Y($.str):$.str),$.str="",$.quoted=X[$.i+1]==='"',$.last=$.i+2;else $.str+=$.char;else if($.char==='"')$.quoted=!0;else if($.char==="{")$.last=++$.i,G.push(xR($,X,Y,U));else if($.char==="}"){$.quoted=!1,$.last<$.i&&G.push(Y?Y(X.slice($.last,$.i)):X.slice($.last,$.i)),$.last=$.i+1;break}else if($.char===z&&$.p!=="}"&&$.p!=='"')G.push(Y?Y(X.slice($.last,$.i)):X.slice($.last,$.i)),$.last=$.i+1;$.p=$.char}return $.last<$.i&&G.push(Y?Y(X.slice($.last,$.i+1)):X.slice($.last,$.i+1)),G}var m8=($)=>{let X=$[0];for(let Y=1;Y<$.length;Y++)X+=$[Y]==="_"?$[++Y].toUpperCase():$[Y];return X},u8=($)=>{let X=$[0].toUpperCase();for(let Y=1;Y<$.length;Y++)X+=$[Y]==="_"?$[++Y].toUpperCase():$[Y];return X},c8=($)=>$.replace(/_/g,"-"),f3=($)=>$.replace(/([A-Z])/g,"_$1").toLowerCase(),h3=($)=>($.slice(0,1)+$.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),g3=($)=>$.replace(/-/g,"_");function vD($){return function X(Y,U){return typeof Y==="object"&&Y!==null&&(U.type===114||U.type===3802)?Array.isArray(Y)?Y.map((G)=>X(G,U)):Object.entries(Y).reduce((G,[z,W])=>Object.assign(G,{[$(z)]:X(W,U)}),{}):Y}}m8.column={from:m8};m8.value={from:vD(m8)};f3.column={to:f3};var CD={...m8};CD.column.to=f3;u8.column={from:u8};u8.value={from:vD(u8)};h3.column={to:h3};var BD={...u8};BD.column.to=h3;c8.column={from:c8};c8.value={from:vD(c8)};g3.column={to:g3};var jD={...c8};jD.column.to=g3;import SR from"net";import zf from"tls";import m3 from"crypto";import PD from"stream";import{performance as kR}from"perf_hooks";class p8 extends Array{constructor(){super();Object.defineProperties(this,{count:{value:null,writable:!0},state:{value:null,writable:!0},command:{value:null,writable:!0},columns:{value:null,writable:!0},statement:{value:null,writable:!0}})}static get[Symbol.species](){return Array}}var F1=Yf;function Yf($=[]){let X=$.slice(),Y=0;return{get length(){return X.length-Y},remove:(U)=>{let G=X.indexOf(U);return G===-1?null:(X.splice(G,1),U)},push:(U)=>(X.push(U),U),shift:()=>{let U=X[Y++];if(Y===X.length)Y=0,X=[];else X[Y-1]=void 0;return U}}}var V6=Buffer.allocUnsafe(256),Gf="BCcDdEFfHPpQSX".split("").reduce(($,X)=>{let Y=X.charCodeAt(0);return $[X]=()=>{return V6[0]=Y,d$.i=5,d$},$},{}),d$=Object.assign(Uf,Gf,{N:String.fromCharCode(0),i:0,inc($){return d$.i+=$,d$},str($){let X=Buffer.byteLength($);return Pz(X),d$.i+=V6.write($,d$.i,X,"utf8"),d$},i16($){return Pz(2),V6.writeUInt16BE($,d$.i),d$.i+=2,d$},i32($,X){if(X||X===0)return V6.writeUInt32BE($,X),d$;return Pz(4),V6.writeUInt32BE($,d$.i),d$.i+=4,d$},z($){return Pz($),V6.fill(0,d$.i,d$.i+$),d$.i+=$,d$},raw($){return V6=Buffer.concat([V6.subarray(0,d$.i),$]),d$.i=V6.length,d$},end($=1){V6.writeUInt32BE(d$.i-$,$);let X=V6.subarray(0,d$.i);return d$.i=0,V6=Buffer.allocUnsafe(256),X}}),V$=d$;function Pz($){if(V6.length-d$.i<$){let X=V6,Y=X.length;V6=Buffer.allocUnsafe(Y+(Y>>1)+$),X.copy(V6)}}function Uf(){return d$.i=0,d$}var SD=hR,Wf=1,y2=V$().S().end(),bR=V$().H().end(),Qf=V$().i32(8).i32(80877103).end(8),Zf=Buffer.concat([V$().E().str(V$.N).i32(0).end(),y2]),Hf=V$().D().str("S").str(V$.N).end(),N9=()=>{},Vf=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),Of={83:"severity_local",86:"severity",67:"code",77:"message",68:"detail",72:"hint",80:"position",112:"internal_position",113:"internal_query",87:"where",115:"schema_name",116:"table_name",99:"column_name",100:"data type_name",110:"constraint_name",70:"file",76:"line",82:"routine"};function hR($,X={},{onopen:Y=N9,onend:U=N9,onclose:G=N9}={}){let{ssl:z,max:W,user:Q,host:Z,port:H,database:V,parsers:O,transform:w,onnotice:D,onnotify:E,onparameter:F,max_pipeline:J,keep_alive:A,backoff:L,target_session_attrs:T}=$,q=F1(),v=Wf++,I={pid:null,secret:null},S=xD(LW,$.idle_timeout),y=xD(LW,$.max_lifetime),r=xD(RB,$.connect_timeout),j=null,X$,l=new p8,W$=Buffer.alloc(0),L$=$.fetch_types,b$={},L4={},X6=Math.random().toString(36).slice(2),c=1,H$=0,f$=0,n$=0,P4=0,_$=0,c$=0,T4=0,V4=null,G4=null,Y6=!1,t$=null,k1=null,o4=null,O2=null,I4=null,U4=null,b1=null,a1=null,s=null,g9=null,G6={queue:X.closed,idleTimer:S,connect(K){o4=K,TN()},terminate:m9,execute:y9,cancel:LB,end:LW,count:0,id:v};return X.closed&&X.closed.push(G6),G6;async function AB(){let K;try{K=$.socket?await Promise.resolve($.socket($)):new SR.Socket}catch(P){e8(P);return}return K.on("error",e8),K.on("close",vN),K.on("drain",qN),K}async function LB({pid:K,secret:P},w$,h$){try{X$=V$().i32(16).i32(80877102).i32(K).i32(P).end(16),await RN(),j.once("error",h$),j.once("close",w$)}catch(M4){h$(M4)}}function y9(K){if(Y6)return q5(K,B4.connection("CONNECTION_DESTROYED",$));if(K.cancelled)return;try{return K.state=I,s?q.push(K):(s=K,s.active=!0),qB(K),n4(KB(K))&&!K.describeFirst&&!K.cursorFn&&q.length<J&&(!K.options.onexecute||K.options.onexecute(G6))}catch(P){return q.length===0&&n4(y2),s1(P),!0}}function KB(K){if(K.parameters.length>=65534)throw B4.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return K.options.simple?V$().Q().str(K.statement.string+V$.N).end():K.describeFirst?Buffer.concat([LN(K),bR]):K.prepare?K.prepared?_5(K):Buffer.concat([LN(K),_5(K)]):_B(K)}function LN(K){return Buffer.concat([BN(K.statement.string,K.parameters,K.statement.types,K.statement.name),Zj("S",K.statement.name)])}function _5(K){return Buffer.concat([Qj(K.parameters,K.statement.types,K.statement.name,K.cursorName),K.cursorFn?jN("",K.cursorRows):Zf])}function _B(K){return Buffer.concat([BN(K.statement.string,K.parameters,K.statement.types),Hf,_5(K)])}function qB(K){let P=[],w$=[],h$=qD(K,K.strings[0],K.args[0],P,w$,$);!K.tagged&&K.args.forEach((M4)=>Bz(M4,P,w$,$)),K.prepare=$.prepare&&("prepare"in K.options?K.options.prepare:!0),K.string=h$,K.signature=K.prepare&&w$+h$,K.onlyDescribe&&delete L4[K.signature],K.parameters=K.parameters||P,K.prepared=K.prepare&&K.signature in L4,K.describeFirst=K.onlyDescribe||P.length&&!K.prepared,K.statement=K.prepared?L4[K.signature]:{string:h$,types:w$,name:K.prepare?X6+c++:""},typeof $.debug==="function"&&$.debug(v,h$,P,w$)}function n4(K,P){if(U4=U4?Buffer.concat([U4,K]):Buffer.from(K),P||U4.length>=1024)return KN(P);return G4===null&&(G4=setImmediate(KN)),!0}function KN(K){let P=j.write(U4,K);return G4!==null&&clearImmediate(G4),U4=G4=null,P}function RB(){s1(B4.connection("CONNECT_TIMEOUT",$,j)),j.destroy()}async function _N(){if(n4(Qf),!await new Promise((P)=>j.once("data",(w$)=>P(w$[0]===83)))&&z==="prefer")return s8();j.removeAllListeners(),j=zf.connect({socket:j,servername:SR.isIP(j.host)?void 0:j.host,...z==="require"||z==="allow"||z==="prefer"?{rejectUnauthorized:!1}:z==="verify-full"?{}:typeof z==="object"?z:{}}),j.on("secureConnect",s8),j.on("error",e8),j.on("close",vN),j.on("drain",qN)}function qN(){!s&&Y(G6)}function AW(K){if(t$){if(t$.push(K),f$-=K.length,f$>0)return}W$=t$?Buffer.concat(t$,_$-f$):W$.length===0?K:Buffer.concat([W$,K],W$.length+K.length);while(W$.length>4){if(_$=W$.readUInt32BE(1),_$>=W$.length){f$=_$-W$.length,t$=[W$];break}try{TB(W$.subarray(0,_$+1))}catch(P){s&&(s.cursorFn||s.describeFirst)&&n4(y2),s1(P)}W$=W$.subarray(_$+1),f$=0,t$=null}}async function RN(){if(Y6=!1,b$={},j||(j=await AB()),!j)return;if(r.start(),$.socket)return z?_N():s8();if(j.on("connect",z?_N:s8),$.path)return j.connect($.path);j.ssl=z,j.connect(H[n$],Z[n$]),j.host=Z[n$],j.port=H[n$],n$=(n$+1)%H.length}function TN(){setTimeout(RN,H$?H$+c$-kR.now():0)}function s8(){try{L4={},L$=$.fetch_types,X6=Math.random().toString(36).slice(2),c=1,y.start(),j.on("data",AW),A&&j.setKeepAlive&&j.setKeepAlive(!0,1000*A);let K=Vj();n4(K)}catch(K){e8(K)}}function e8(K){if(G6.queue===X.connecting&&$.host[P4+1])return;s1(K);while(q.length)q5(q.shift(),K)}function s1(K){I4&&(I4.destroy(K),I4=null),s&&q5(s,K),o4&&(q5(o4,K),o4=null)}function q5(K,P){if(K.reserve)return K.reject(P);if(!P||typeof P!=="object")P=new Error(P);"query"in P||"parameters"in P||Object.defineProperties(P,{stack:{value:P.stack+K.origin.replace(/.*\n/,`
|
|
129
|
+
`),enumerable:$.debug},query:{value:K.string,enumerable:$.debug},parameters:{value:K.parameters,enumerable:$.debug},args:{value:K.args,enumerable:$.debug},types:{value:K.statement&&K.statement.types,enumerable:$.debug}}),K.reject(P)}function LW(){return O2||(!G6.reserved&&U(G6),!G6.reserved&&!o4&&!s&&q.length===0?(m9(),new Promise((K)=>j&&j.readyState!=="closed"?j.once("close",K):K())):O2=new Promise((K)=>b1=K))}function m9(){if(Y6=!0,I4||s||o4||q.length)e8(B4.connection("CONNECTION_DESTROYED",$));if(clearImmediate(G4),j)j.removeListener("data",AW),j.removeListener("connect",s8),j.readyState==="open"&&j.end(V$().X().end());b1&&(b1(),O2=b1=null)}async function vN(K){if(W$=Buffer.alloc(0),f$=0,t$=null,clearImmediate(G4),j.removeListener("data",AW),j.removeListener("connect",s8),S.cancel(),y.cancel(),r.cancel(),j.removeAllListeners(),j=null,o4)return TN();!K&&(s||q.length)&&e8(B4.connection("CONNECTION_CLOSED",$,j)),H$=kR.now(),K&&$.shared.retries++,c$=(typeof L==="function"?L($.shared.retries):L)*1000,G(G6,B4.connection("CONNECTION_CLOSED",$,j))}function TB(K,P=K[0]){(P===68?vB:P===100?eB:P===65?iB:P===83?CB:P===90?BB:P===67?jB:P===50?CN:P===49?PB:P===116?IB:P===84?xB:P===82?SB:P===110?yB:P===75?mB:P===69?lB:P===115?oB:P===51?nB:P===71?tB:P===78?Xj:P===72?aB:P===99?$j:P===73?Yj:P===86?Gj:P===118?Uj:P===87?sB:zj)(K)}function vB(K){let P=7,w$,h$,M4,U6=s.isRaw?new Array(s.statement.columns.length):{};for(let D6=0;D6<s.statement.columns.length;D6++)h$=s.statement.columns[D6],w$=K.readInt32BE(P),P+=4,M4=w$===-1?null:s.isRaw===!0?K.subarray(P,P+=w$):h$.parser===void 0?K.toString("utf8",P,P+=w$):h$.parser.array===!0?h$.parser(K.toString("utf8",P+1,P+=w$)):h$.parser(K.toString("utf8",P,P+=w$)),s.isRaw?U6[D6]=s.isRaw===!0?M4:w.value.from?w.value.from(M4,h$):M4:U6[h$.name]=w.value.from?w.value.from(M4,h$):M4;s.forEachFn?s.forEachFn(w.row.from?w.row.from(U6):U6,l):l[T4++]=w.row.from?w.row.from(U6):U6}function CB(K){let[P,w$]=K.toString("utf8",5,K.length-1).split(V$.N);if(b$[P]=w$,$.parameters[P]!==w$)$.parameters[P]=w$,F&&F(P,w$)}function BB(K){if(s&&s.options.simple&&s.resolve(k1||l),s=k1=null,l=new p8,r.cancel(),o4){if(T){if(!b$.in_hot_standby||!b$.default_transaction_read_only)return dB();else if(pB(T,b$))return m9()}if(L$)return o4.reserve&&(o4=null),uB();o4&&!o4.reserve&&y9(o4),$.shared.retries=P4=0,o4=null;return}while(q.length&&(s=q.shift())&&(s.active=!0,s.cancelled))hR($).cancel(s.state,s.cancelled.resolve,s.cancelled.reject);if(s)return;G6.reserved?!G6.reserved.release&&K[5]===73?O2?m9():(G6.reserved=null,Y(G6)):G6.reserved():O2?m9():Y(G6)}function jB(K){T4=0;for(let P=K.length-1;P>0;P--){if(K[P]===32&&K[P+1]<58&&l.count===null)l.count=+K.toString("utf8",P+1,K.length-1);if(K[P-1]>=65){l.command=K.toString("utf8",5,P),l.state=I;break}}if(g9&&(g9(),g9=null),l.command==="BEGIN"&&W!==1&&!G6.reserved)return s1(B4.generic("UNSAFE_TRANSACTION","Only use sql.begin, sql.reserved or max: 1"));if(s.options.simple)return CN();if(s.cursorFn)l.count&&s.cursorFn(l),n4(y2);s.resolve(l)}function PB(){s.parsing=!1}function CN(){!l.statement&&(l.statement=s.statement),l.columns=s.statement.columns}function IB(K){let P=K.readUInt16BE(5);for(let w$=0;w$<P;++w$)!s.statement.types[w$]&&(s.statement.types[w$]=K.readUInt32BE(7+w$*4));s.prepare&&(L4[s.signature]=s.statement),s.describeFirst&&!s.onlyDescribe&&(n4(_5(s)),s.describeFirst=!1)}function xB(K){if(l.command)k1=k1||[l],k1.push(l=new p8),l.count=null,s.statement.columns=null;let P=K.readUInt16BE(5),w$=7,h$;s.statement.columns=Array(P);for(let M4=0;M4<P;++M4){h$=w$;while(K[w$++]!==0);let U6=K.readUInt32BE(w$),D6=K.readUInt16BE(w$+4),w2=K.readUInt32BE(w$+6);s.statement.columns[M4]={name:w.column.from?w.column.from(K.toString("utf8",h$,w$-1)):K.toString("utf8",h$,w$-1),parser:O[w2],table:U6,number:D6,type:w2},w$+=18}if(l.statement=s.statement,s.onlyDescribe)return s.resolve(s.statement),n4(y2)}async function SB(K,P=K.readUInt32BE(5)){(P===3?kB:P===5?bB:P===10?fB:P===11?hB:P===12?gB:P!==0?Wj:N9)(K,P)}async function kB(){let K=await KW();n4(V$().p().str(K).z(1).end())}async function bB(K){let P="md5"+await fR(Buffer.concat([Buffer.from(await fR(await KW()+Q)),K.subarray(9)]));n4(V$().p().str(P).z(1).end())}async function fB(){a1=(await m3.randomBytes(18)).toString("base64"),V$().p().str("SCRAM-SHA-256"+V$.N);let K=V$.i;n4(V$.inc(4).str("n,,n=*,r="+a1).i32(V$.i-K-4,K).end())}async function hB(K){let P=K.toString("utf8",9).split(",").reduce((D6,w2)=>(D6[w2[0]]=w2.slice(2),D6),{}),w$=await m3.pbkdf2Sync(await KW(),Buffer.from(P.s,"base64"),parseInt(P.i),32,"sha256"),h$=await Iz(w$,"Client Key"),M4="n=*,r="+a1+",r="+P.r+",s="+P.s+",i="+P.i+",c=biws,r="+P.r;V4=(await Iz(await Iz(w$,"Server Key"),M4)).toString("base64");let U6="c=biws,r="+P.r+",p="+Df(h$,Buffer.from(await Iz(await wf(h$),M4))).toString("base64");n4(V$().p().str(U6).end())}function gB(K){if(K.toString("utf8",9).split(V$.N,1)[0].slice(2)===V4)return;s1(B4.generic("SASL_SIGNATURE_MISMATCH","The server did not return the correct signature")),j.destroy()}function KW(){return Promise.resolve(typeof $.pass==="function"?$.pass():$.pass)}function yB(){if(l.statement=s.statement,l.statement.columns=[],s.onlyDescribe)return s.resolve(s.statement),n4(y2)}function mB(K){I.pid=K.readUInt32BE(5),I.secret=K.readUInt32BE(9)}async function uB(){L$=!1,(await new j1([`
|
|
130
130
|
select b.oid, b.typarray
|
|
131
131
|
from pg_catalog.pg_type a
|
|
132
132
|
left join pg_catalog.pg_type b on b.oid = a.typelem
|
|
133
133
|
where a.typcategory = 'A'
|
|
134
134
|
group by b.oid, b.typarray
|
|
135
135
|
order by b.oid
|
|
136
|
-
`],[],y9)).forEach(({oid:P,typarray:w$})=>cB(P,w$))}function cB(K,P){if(!!$.parsers[P]&&!!$.serializers[P])return;let w$=$.parsers[K];$.shared.typeArrayMap[K]=P,$.parsers[P]=(h$)=>IR(h$,w$,P),$.parsers[P].array=!0,$.serializers[P]=(h$)=>PR(h$,$.serializers[K],$,P)}function pB(K,P){return K==="read-write"&&P.default_transaction_read_only==="on"||K==="read-only"&&P.default_transaction_read_only==="off"||K==="primary"&&P.in_hot_standby==="on"||K==="standby"&&P.in_hot_standby==="off"||K==="prefer-standby"&&P.in_hot_standby==="off"&&$.host[P4]}function dB(){let K=new
|
|
136
|
+
`],[],y9)).forEach(({oid:P,typarray:w$})=>cB(P,w$))}function cB(K,P){if(!!$.parsers[P]&&!!$.serializers[P])return;let w$=$.parsers[K];$.shared.typeArrayMap[K]=P,$.parsers[P]=(h$)=>IR(h$,w$,P),$.parsers[P].array=!0,$.serializers[P]=(h$)=>PR(h$,$.serializers[K],$,P)}function pB(K,P){return K==="read-write"&&P.default_transaction_read_only==="on"||K==="read-only"&&P.default_transaction_read_only==="off"||K==="primary"&&P.in_hot_standby==="on"||K==="standby"&&P.in_hot_standby==="off"||K==="prefer-standby"&&P.in_hot_standby==="off"&&$.host[P4]}function dB(){let K=new j1([`
|
|
137
137
|
show transaction_read_only;
|
|
138
138
|
select pg_catalog.pg_is_in_recovery()
|
|
139
|
-
`],[],y9,null,{simple:!0});K.resolve=([[P],[w$]])=>{b$.default_transaction_read_only=P.transaction_read_only,b$.in_hot_standby=w$.pg_is_in_recovery?"on":"off"},K.execute()}function lB(K){s&&(s.cursorFn||s.describeFirst)&&n4(y2);let P=B4.postgres(ID(K));s&&s.retried?
|
|
139
|
+
`],[],y9,null,{simple:!0});K.resolve=([[P],[w$]])=>{b$.default_transaction_read_only=P.transaction_read_only,b$.in_hot_standby=w$.pg_is_in_recovery?"on":"off"},K.execute()}function lB(K){s&&(s.cursorFn||s.describeFirst)&&n4(y2);let P=B4.postgres(ID(K));s&&s.retried?s1(s.retried):s&&s.prepared&&Vf.has(P.routine)?rB(s,P):s1(P)}function rB(K,P){delete L4[K.signature],K.retried=P,y9(K)}function iB(K){if(!E)return;let P=9;while(K[P++]!==0);E(K.toString("utf8",9,P-1),K.toString("utf8",P,K.length-1))}async function oB(){try{let K=await Promise.resolve(s.cursorFn(l));T4=0,K===D9?n4(Hj(s.portal)):(l=new p8,n4(jN("",s.cursorRows)))}catch(K){n4(y2),s.reject(K)}}function nB(){l.count&&s.cursorFn(l),s.resolve(l)}function tB(){I4=new PD.Writable({autoDestroy:!0,write(K,P,w$){j.write(V$().d().raw(K).end(),w$)},destroy(K,P){P(K),j.write(V$().f().str(K+V$.N).end()),I4=null},final(K){j.write(V$().c().end()),g9=K}}),s.resolve(I4)}function aB(){I4=new PD.Readable({read(){j.resume()}}),s.resolve(I4)}function sB(){I4=new PD.Duplex({autoDestroy:!0,read(){j.resume()},write(K,P,w$){j.write(V$().d().raw(K).end(),w$)},destroy(K,P){P(K),j.write(V$().f().str(K+V$.N).end()),I4=null},final(K){j.write(V$().c().end()),g9=K}}),s.resolve(I4)}function eB(K){I4&&(I4.push(K.subarray(5))||j.pause())}function $j(){I4&&I4.push(null),I4=null}function Xj(K){D?D(ID(K)):console.log(ID(K))}function Yj(){}function Gj(){s1(B4.notSupported("FunctionCallResponse"))}function Uj(){s1(B4.notSupported("NegotiateProtocolVersion"))}function zj(K){console.error("Postgres.js : Unknown Message:",K[0])}function Wj(K,P){console.error("Postgres.js : Unknown Auth:",P)}function Qj(K,P,w$="",h$=""){let M4,U6;return V$().B().str(h$+V$.N).str(w$+V$.N).i16(0).i16(K.length),K.forEach((D6,w2)=>{if(D6===null)return V$.i32(4294967295);U6=P[w2],K[w2]=D6=U6 in $.serializers?$.serializers[U6](D6):""+D6,M4=V$.i,V$.inc(4).str(D6).i32(V$.i-M4-4,M4)}),V$.i16(0),V$.end()}function BN(K,P,w$,h$=""){return V$().P().str(h$+V$.N).str(K+V$.N).i16(P.length),P.forEach((M4,U6)=>V$.i32(w$[U6]||0)),V$.end()}function Zj(K,P=""){return V$().D().str(K).str(P+V$.N).end()}function jN(K="",P=0){return Buffer.concat([V$().E().str(K+V$.N).i32(P).end(),bR])}function Hj(K=""){return Buffer.concat([V$().C().str("P").str(K+V$.N).end(),V$().S().end()])}function Vj(){return X$||V$().inc(4).i16(3).z(2).str(Object.entries(Object.assign({user:Q,database:V,client_encoding:"UTF8"},$.connection)).filter(([,K])=>K).map(([K,P])=>K+V$.N+P).join(V$.N)).z(2).end(0)}}function ID($){let X={},Y=5;for(let U=5;U<$.length-1;U++)if($[U]===0)X[Of[$[Y]]]=$.toString("utf8",Y+1,U),Y=U+1;return X}function fR($){return m3.createHash("md5").update($).digest("hex")}function Iz($,X){return m3.createHmac("sha256",$).update(X).digest()}function wf($){return m3.createHash("sha256").update($).digest()}function Df($,X){let Y=Math.max($.length,X.length),U=Buffer.allocUnsafe(Y);for(let G=0;G<Y;G++)U[G]=$[G]^X[G];return U}function xD($,X){if(X=typeof X==="function"?X():X,!X)return{cancel:N9,start:N9};let Y;return{cancel(){Y&&(clearTimeout(Y),Y=null)},start(){Y&&clearTimeout(Y),Y=setTimeout(U,X*1000,arguments)}};function U(G){$.apply(null,G),Y=null}}var gR=()=>{};function kD($,X){let Y=new Map,U="postgresjs_"+Math.random().toString(36).slice(2),G={},z,W,Q=!1,Z=O.sql=$({...X,transform:{column:{},value:{},row:{}},max:1,fetch_types:!1,idle_timeout:null,max_lifetime:null,connection:{...X.connection,replication:"database"},onclose:async function(){if(Q)return;W=null,G.pid=G.secret=void 0,w(await D(Z,U,X.publications)),Y.forEach((F)=>F.forEach(({onsubscribe:J})=>J()))},no_subscribe:!0}),H=Z.end,V=Z.close;return Z.end=async()=>{return Q=!0,W&&await new Promise((F)=>(W.once("close",F),W.end())),H()},Z.close=async()=>{return W&&await new Promise((F)=>(W.once("close",F),W.end())),V()},O;async function O(F,J,A=gR,L=gR){if(F=Ff(F),!z)z=D(Z,U,X.publications);let T={fn:J,onsubscribe:A},q=Y.has(F)?Y.get(F).add(T):Y.set(F,new Set([T])).get(F),v=()=>{q.delete(T),q.size===0&&Y.delete(F)};return z.then((I)=>{return w(I),A(),W&&W.on("error",L),{unsubscribe:v,state:G,sql:Z}})}function w(F){W=F.stream,G.pid=F.state.pid,G.secret=F.state.secret}async function D(F,J,A){if(!A)throw new Error("Missing publication names");let L=await F.unsafe(`CREATE_REPLICATION_SLOT ${J} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`),[T]=L,q=await F.unsafe(`START_REPLICATION SLOT ${J} LOGICAL ${T.consistent_point} (proto_version '1', publication_names '${A}')`).writable(),v={lsn:Buffer.concat(T.consistent_point.split("/").map((j)=>Buffer.from(("00000000"+j).slice(-8),"hex")))};return q.on("data",S),q.on("error",I),q.on("close",F.close),{stream:q,state:L.state};function I(j){console.error("Unexpected error during logical streaming - reconnecting",j)}function S(j){if(j[0]===119)Nf(j.subarray(25),v,F.options.parsers,y,X.transform);else if(j[0]===107&&j[17])v.lsn=j.subarray(1,9),r()}function y(j,X$){let l=X$.relation.schema+"."+X$.relation.table;E("*",j,X$),E("*:"+l,j,X$),X$.relation.keys.length&&E("*:"+l+"="+X$.relation.keys.map((W$)=>j[W$.name]),j,X$),E(X$.command,j,X$),E(X$.command+":"+l,j,X$),X$.relation.keys.length&&E(X$.command+":"+l+"="+X$.relation.keys.map((W$)=>j[W$.name]),j,X$)}function r(){let j=Buffer.alloc(34);j[0]=114,j.fill(v.lsn,1),j.writeBigInt64BE(BigInt(Date.now()-Date.UTC(2000,0,1))*BigInt(1000),25),q.write(j)}}function E(F,J,A){Y.has(F)&&Y.get(F).forEach(({fn:L})=>L(J,A,F))}}function Ef($){return new Date(Date.UTC(2000,0,1)+Number($/BigInt(1000)))}function Nf($,X,Y,U,G){let z=(W,[Q,Z])=>(W[Q.charCodeAt(0)]=Z,W);Object.entries({R:(W)=>{let Q=1,Z=X[W.readUInt32BE(Q)]={schema:W.toString("utf8",Q+=4,Q=W.indexOf(0,Q))||"pg_catalog",table:W.toString("utf8",Q+1,Q=W.indexOf(0,Q+1)),columns:Array(W.readUInt16BE(Q+=2)),keys:[]};Q+=2;let H=0,V;while(Q<W.length)V=Z.columns[H++]={key:W[Q++],name:G.column.from?G.column.from(W.toString("utf8",Q,Q=W.indexOf(0,Q))):W.toString("utf8",Q,Q=W.indexOf(0,Q)),type:W.readUInt32BE(Q+=1),parser:Y[W.readUInt32BE(Q)],atttypmod:W.readUInt32BE(Q+=4)},V.key&&Z.keys.push(V),Q+=4},Y:()=>{},O:()=>{},B:(W)=>{X.date=Ef(W.readBigInt64BE(9)),X.lsn=W.subarray(1,9)},I:(W)=>{let Q=1,Z=X[W.readUInt32BE(Q)],{row:H}=xz(W,Z.columns,Q+=7,G);U(H,{command:"insert",relation:Z})},D:(W)=>{let Q=1,Z=X[W.readUInt32BE(Q)];Q+=4;let H=W[Q]===75;U(H||W[Q]===79?xz(W,Z.columns,Q+=3,G).row:null,{command:"delete",relation:Z,key:H})},U:(W)=>{let Q=1,Z=X[W.readUInt32BE(Q)];Q+=4;let H=W[Q]===75,V=H||W[Q]===79?xz(W,Z.columns,Q+=3,G):null;V&&(Q=V.i);let{row:O}=xz(W,Z.columns,Q+3,G);U(O,{command:"update",relation:Z,key:H,old:V&&V.row})},T:()=>{},C:()=>{}}).reduce(z,{})[$[0]]($)}function xz($,X,Y,U){let G,z,W,Q=U.raw?new Array(X.length):{};for(let Z=0;Z<X.length;Z++)G=$[Y++],z=X[Z],W=G===110?null:G===117?void 0:z.parser===void 0?$.toString("utf8",Y+4,Y+=4+$.readUInt32BE(Y)):z.parser.array===!0?z.parser($.toString("utf8",Y+5,Y+=4+$.readUInt32BE(Y))):z.parser($.toString("utf8",Y+4,Y+=4+$.readUInt32BE(Y))),U.raw?Q[Z]=U.raw===!0?W:U.value.from?U.value.from(W,z):W:Q[z.name]=U.value.from?U.value.from(W,z):W;return{i:Y,row:U.row.from?U.row.from(Q):Q}}function Ff($){let X=$.match(/^(\*|insert|update|delete)?:?([^.]+?\.?[^=]+)?=?(.+)?/i)||[];if(!X)throw new Error("Malformed subscribe pattern: "+$);let[,Y,U,G]=X;return(Y||"*")+(U?":"+(U.indexOf(".")===-1?"public."+U:U):"")+(G?"="+G:"")}import yR from"stream";function bD($,X,Y=393216){return new Promise(async(U,G)=>{await $.begin(async(z)=>{let W;!X&&([{oid:X}]=await z`select lo_creat(-1) as oid`);let[{fd:Q}]=await z`select lo_open(${X}, ${Y}) as fd`,Z={writable:V,readable:H,close:()=>z`select lo_close(${Q})`.then(W),tell:()=>z`select lo_tell64(${Q})`,read:(O)=>z`select loread(${Q}, ${O}) as data`,write:(O)=>z`select lowrite(${Q}, ${O})`,truncate:(O)=>z`select lo_truncate64(${Q}, ${O})`,seek:(O,w=0)=>z`select lo_lseek64(${Q}, ${O}, ${w})`,size:()=>z`
|
|
140
140
|
select
|
|
141
141
|
lo_lseek64(${Q}, location, 0) as position,
|
|
142
142
|
seek.size
|
|
@@ -146,60 +146,60 @@ params: ${X}`);if(this.query=$,this.params=X,this.cause=Y,Error.captureStackTrac
|
|
|
146
146
|
tell.location
|
|
147
147
|
from (select lo_tell64($1) as location) tell
|
|
148
148
|
) seek
|
|
149
|
-
`};return U(Z),new Promise(async(O)=>W=O);async function H({highWaterMark:O=16384,start:w=0,end:D=1/0}={}){let E=D-w;return w&&await Z.seek(w),new yR.Readable({highWaterMark:O,async read(F){let J=F>E?F-E:F;E-=F;let[{data:A}]=await Z.read(J);if(this.push(A),A.length<F)this.push(null)}})}async function V({highWaterMark:O=16384,start:w=0}={}){return w&&await Z.seek(w),new yR.Writable({highWaterMark:O,write(D,E,F){Z.write(D).then(()=>F(),F)}})}}).catch(G)})}Object.assign(Sz,{PostgresError:E9,toPascal:u8,pascal:BD,toCamel:m8,camel:CD,toKebab:c8,kebab:jD,fromPascal:h3,fromCamel:f3,fromKebab:g3,BigInt:{to:20,from:[20],parse:($)=>BigInt($),serialize:($)=>$.toString()}});var F9=Sz;function Sz($,X){let Y=Af($,X),U=Y.no_subscribe||kD(Sz,{...Y}),G=!1,z=N1(),W=N1(),Q=N1(),Z=N1(),H=N1(),V=N1(),O=N1(),w=N1(),D={connecting:W,reserved:Q,closed:Z,ended:H,open:V,busy:O,full:w},E=[...Array(Y.max)].map(()=>SD(Y,D,{onopen:L4,onend:b$,onclose:X6})),F=J(y);return Object.assign(F,{get parameters(){return Y.parameters},largeObject:bD.bind(null,F),subscribe:U,CLOSE:D9,END:D9,PostgresError:E9,options:Y,reserve:T,listen:A,begin:q,close:l,end:X$}),F;function J(c){return c.debug=Y.debug,Object.entries(Y.types).reduce((_$,[c$,T4])=>{return _$[c$]=(V4)=>new E0(V4,T4.to),_$},H$),Object.assign(f$,{types:H$,typed:H$,unsafe:n$,notify:L,array:S,json:I,file:P4}),f$;function H$(_$,c$){return new E0(_$,c$)}function f$(_$,...c$){return _$&&Array.isArray(_$.raw)?new B1(_$,c$,c,j):typeof _$==="string"&&!c$.length?new y3(Y.transform.column.to?Y.transform.column.to(_$):_$):new Cz(_$,c$)}function n$(_$,c$=[],T4={}){return arguments.length===2&&!Array.isArray(c$)&&(T4=c$,c$=[]),new B1([_$],c$,c,j,{prepare:!1,...T4,simple:"simple"in T4?T4.simple:c$.length===0})}function P4(_$,c$=[],T4={}){return arguments.length===2&&!Array.isArray(c$)&&(T4=c$,c$=[]),new B1([],c$,(G4)=>{Jf.readFile(_$,"utf8",(Y6,t$)=>{if(Y6)return G4.reject(Y6);G4.strings=[t$],c(G4)})},j,{...T4,simple:"simple"in T4?T4.simple:c$.length===0})}}async function A(c,H$,f$){let n$={fn:H$,onlisten:f$},P4=A.sql||(A.sql=Sz({...Y,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(A.channels).forEach(([G4,{listeners:Y6}])=>{delete A.channels[G4],Promise.all(Y6.map((t$)=>A(G4,t$.fn,t$.onlisten).catch(()=>{})))})},onnotify(G4,Y6){G4 in A.channels&&A.channels[G4].listeners.forEach((t$)=>t$.fn(Y6))}})),_$=A.channels||(A.channels={});if(c in _$){_$[c].listeners.push(n$);let G4=await _$[c].result;return n$.onlisten&&n$.onlisten(),{state:G4.state,unlisten:V4}}_$[c]={result:P4`listen ${P4.unsafe('"'+c.replace(/"/g,'""')+'"')}`,listeners:[n$]};let T4=await _$[c].result;return n$.onlisten&&n$.onlisten(),{state:T4.state,unlisten:V4};async function V4(){if(c in _$===!1)return;if(_$[c].listeners=_$[c].listeners.filter((G4)=>G4!==n$),_$[c].listeners.length)return;return delete _$[c],P4`unlisten ${P4.unsafe('"'+c.replace(/"/g,'""')+'"')}`}}async function L(c,H$){return await F`select pg_notify(${c}, ${""+H$})`}async function T(){let c=N1(),H$=V.length?V.shift():await new Promise((P4,_$)=>{let c$={reserve:P4,reject:_$};z.push(c$),Z.length&&L$(Z.shift(),c$)});v(H$,Q),H$.reserved=()=>c.length?H$.execute(c.shift()):v(H$,Q),H$.reserved.release=!0;let f$=J(n$);return f$.release=()=>{H$.reserved=null,L4(H$)},f$;function n$(P4){H$.queue===w?c.push(P4):H$.execute(P4)||v(H$,w)}}async function q(c,H$){!H$&&(H$=c,c="");let f$=N1(),n$=0,P4,_$=null;try{return await F.unsafe("begin "+c.replace(/[^a-z ]/ig,""),[],{onexecute:T4}).execute(),await Promise.race([c$(P4,H$),new Promise((V4,G4)=>P4.onclose=G4)])}catch(V4){throw V4}async function c$(V4,G4,Y6){let t$=J(I4);t$.savepoint=O2,t$.prepare=(U4)=>_$=U4.replace(/[^a-z0-9$-_. ]/gi);let S1,o4;Y6&&await t$`savepoint ${t$(Y6)}`;try{if(o4=await new Promise((U4,k1)=>{let t1=G4(t$);Promise.resolve(Array.isArray(t1)?Promise.all(t1):t1).then(U4,k1)}),S1)throw S1}catch(U4){throw await(Y6?t$`rollback to ${t$(Y6)}`:t$`rollback`),U4 instanceof E9&&U4.code==="25P02"&&S1||U4}if(!Y6)_$?await t$`prepare transaction '${t$.unsafe(_$)}'`:await t$`commit`;return o4;function O2(U4,k1){if(U4&&Array.isArray(U4.raw))return O2((t1)=>t1.apply(t1,arguments));return arguments.length===1&&(k1=U4,U4=null),c$(V4,k1,"s"+n$+++(U4?"_"+U4:""))}function I4(U4){U4.catch((k1)=>S1||(S1=k1)),V4.queue===w?f$.push(U4):V4.execute(U4)||v(V4,w)}}function T4(V4){P4=V4,v(V4,Q),V4.reserved=()=>f$.length?V4.execute(f$.shift()):v(V4,Q)}}function v(c,H$){return c.queue.remove(c),H$.push(c),c.queue=H$,H$===V?c.idleTimer.start():c.idleTimer.cancel(),c}function I(c){return new E0(c,3802)}function S(c,H$){if(!Array.isArray(c))return S(Array.from(arguments));return new E0(c,H$||(c.length?Tz(c)||25:0),Y.shared.typeArrayMap)}function y(c){if(G)return c.reject(B4.connection("CONNECTION_ENDED",Y,Y));if(V.length)return r(V.shift(),c);if(Z.length)return L$(Z.shift(),c);O.length?r(O.shift(),c):z.push(c)}function r(c,H$){return c.execute(H$)?v(c,O):v(c,w)}function j(c){return new Promise((H$,f$)=>{c.state?c.active?SD(Y).cancel(c.state,H$,f$):c.cancelled={resolve:H$,reject:f$}:(z.remove(c),c.cancelled=!0,c.reject(B4.generic("57014","canceling statement due to user request")),H$())})}async function X$({timeout:c=null}={}){if(G)return G;await 1;let H$;return G=Promise.race([new Promise((f$)=>c!==null&&(H$=setTimeout(W$,c*1000,f$))),Promise.all(E.map((f$)=>f$.end()).concat(A.sql?A.sql.end({timeout:0}):[],U.sql?U.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(H$))}async function l(){await Promise.all(E.map((c)=>c.end()))}async function W$(c){await Promise.all(E.map((H$)=>H$.terminate()));while(z.length)z.shift().reject(B4.connection("CONNECTION_DESTROYED",Y));c()}function L$(c,H$){return v(c,W),c.connect(H$),c}function b$(c){v(c,H)}function L4(c){if(z.length===0)return v(c,V);let H$=Math.ceil(z.length/(W.length+1)),f$=!0;while(f$&&z.length&&H$-- >0){let n$=z.shift();if(n$.reserve)return n$.reserve(c);f$=c.execute(n$)}f$?v(c,O):v(c,w)}function X6(c,H$){v(c,Z),c.reserved=null,c.onclose&&(c.onclose(H$),c.onclose=null),Y.onclose&&Y.onclose(c.id),z.length&&L$(c,z.shift())}}function Af($,X){if($&&$.shared)return $;let Y=process.env,U=(!$||typeof $==="string"?X:$)||{},{url:G,multihost:z}=Rf($),W=[...G.searchParams].reduce((w,[D,E])=>(w[D]=E,w),{}),Q=U.hostname||U.host||z||G.hostname||Y.PGHOST||"localhost",Z=U.port||G.port||Y.PGPORT||5432,H=U.user||U.username||G.username||Y.PGUSERNAME||Y.PGUSER||Tf();U.no_prepare&&(U.prepare=!1),W.sslmode&&(W.ssl=W.sslmode,delete W.sslmode),"timeout"in U&&(console.log("The timeout option is deprecated, use idle_timeout instead"),U.idle_timeout=U.timeout),W.sslrootcert==="system"&&(W.ssl="verify-full");let V=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],O={max:10,ssl:!1,idle_timeout:null,connect_timeout:30,max_lifetime:_f,max_pipeline:100,backoff:Kf,keep_alive:60,prepare:!0,debug:!1,fetch_types:!0,publications:"alltables",target_session_attrs:null};return{host:Array.isArray(Q)?Q:Q.split(",").map((w)=>w.split(":")[0]),port:Array.isArray(Z)?Z:Q.split(",").map((w)=>parseInt(w.split(":")[1]||Z)),path:U.path||Q.indexOf("/")>-1&&Q+"/.s.PGSQL."+Z,database:U.database||U.db||(G.pathname||"").slice(1)||Y.PGDATABASE||H,user:H,pass:U.pass||U.password||G.password||Y.PGPASSWORD||"",...Object.entries(O).reduce((w,[D,E])=>{let F=D in U?U[D]:(D in W)?W[D]==="disable"||W[D]==="false"?!1:W[D]:Y["PG"+D.toUpperCase()]||E;return w[D]=typeof F==="string"&&V.includes(D)?+F:F,w},{}),connection:{application_name:Y.PGAPPNAME||"postgres.js",...U.connection,...Object.entries(W).reduce((w,[D,E])=>((D in O)||(w[D]=E),w),{})},types:U.types||{},target_session_attrs:Lf(U,G,Y),onnotice:U.onnotice,onnotify:U.onnotify,onclose:U.onclose,onparameter:U.onparameter,socket:U.socket,transform:qf(U.transform||{undefined:void 0}),parameters:{},shared:{retries:0,typeArrayMap:{}},...BR(U.types)}}function Lf($,X,Y){let U=$.target_session_attrs||X.searchParams.get("target_session_attrs")||Y.PGTARGETSESSIONATTRS;if(!U||["read-write","read-only","primary","standby","prefer-standby"].includes(U))return U;throw new Error("target_session_attrs "+U+" is not supported")}function Kf($){return(0.5+Math.random()/2)*Math.min(3**$/100,20)}function _f(){return 60*(30+Math.random()*30)}function qf($){return{undefined:$.undefined,column:{from:typeof $.column==="function"?$.column:$.column&&$.column.from,to:$.column&&$.column.to},value:{from:typeof $.value==="function"?$.value:$.value&&$.value.from,to:$.value&&$.value.to},row:{from:typeof $.row==="function"?$.row:$.row&&$.row.from,to:$.row&&$.row.to}}}function Rf($){if(!$||typeof $!=="string")return{url:{searchParams:new Map}};let X=$;X=X.slice(X.indexOf("://")+3).split(/[?/]/)[0],X=decodeURIComponent(X.slice(X.indexOf("@")+1));let Y=new URL($.replace(X,X.split(",")[0]));return{url:{username:decodeURIComponent(Y.username),password:decodeURIComponent(Y.password),host:Y.host,hostname:Y.hostname,port:Y.port,pathname:Y.pathname,searchParams:Y.searchParams},multihost:X.indexOf(",")>-1&&X}}function Tf(){try{return Mf.userInfo().username}catch($){return process.env.USERNAME||process.env.USER||process.env.LOGNAME}}class A4{static[_]="SelectionProxyHandler";config;constructor($){this.config={...$}}get($,X){if(X==="_")return{...$._,selectedFields:new Proxy($._.selectedFields,this)};if(X===$4)return{...$[$4],selectedFields:new Proxy($[$4].selectedFields,this)};if(typeof X==="symbol")return $[X];let U=(b($,R4)?$._.selectedFields:b($,o6)?$[$4].selectedFields:$)[X];if(b(U,$$.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!U.isSelectionField)return U.sql;let G=U.clone();return G.isSelectionField=!0,G}if(b(U,$$)){if(this.config.sqlBehavior==="sql")return U;throw new Error(`You tried to reference "${X}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}if(b(U,r$)){if(this.config.alias)return new Proxy(U,new w9(new Proxy(U.table,new B3(this.config.alias,this.config.replaceOriginalName??!1))));return U}if(typeof U!=="object"||U===null)return U;return new Proxy(U,new A4(this.config))}}class mR{constructor($,X){this.unique=$,this.name=X}static[_]="PgIndexBuilderOn";on(...$){return new kz($.map((X)=>{if(b(X,$$))return X;X=X;let Y=new R3(X.name,!!X.keyAsName,X.columnType,X.indexConfig);return X.indexConfig=JSON.parse(JSON.stringify(X.defaultConfig)),Y}),this.unique,!1,this.name)}onOnly(...$){return new kz($.map((X)=>{if(b(X,$$))return X;X=X;let Y=new R3(X.name,!!X.keyAsName,X.columnType,X.indexConfig);return X.indexConfig=X.defaultConfig,Y}),this.unique,!0,this.name)}using($,...X){return new kz(X.map((Y)=>{if(b(Y,$$))return Y;Y=Y;let U=new R3(Y.name,!!Y.keyAsName,Y.columnType,Y.indexConfig);return Y.indexConfig=JSON.parse(JSON.stringify(Y.defaultConfig)),U}),this.unique,!0,this.name,$)}}class kz{static[_]="PgIndexBuilder";config;constructor($,X,Y,U,G="btree"){this.config={name:U,columns:$,unique:X,only:Y,method:G}}concurrently(){return this.config.concurrently=!0,this}with($){return this.config.with=$,this}where($){return this.config.where=$,this}build($){return new uR(this.config,$)}}class uR{static[_]="PgIndex";config;constructor($,X){this.config={...$,table:X}}}function fD($){return new mR(!0,$)}function vf($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((Y)=>Y.toLowerCase()).join("_")}function Cf($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((Y,U,G)=>{let z=G===0?U.toLowerCase():`${U[0].toUpperCase()}${U.slice(1)}`;return Y+z},"")}function Bf($){return $}class hD{static[_]="CasingCache";cache={};cachedTables={};convert;constructor($){this.convert=$==="snake_case"?vf:$==="camelCase"?Cf:Bf}getColumnCasing($){if(!$.keyAsName)return $.name;let X=$.table[t.Symbol.Schema]??"public",Y=$.table[t.Symbol.OriginalName],U=`${X}.${Y}.${$.name}`;if(!this.cache[U])this.cacheTable($.table);return this.cache[U]}cacheTable($){let X=$[t.Symbol.Schema]??"public",Y=$[t.Symbol.OriginalName],U=`${X}.${Y}`;if(!this.cachedTables[U]){for(let G of Object.values($[t.Symbol.Columns])){let z=`${U}.${G.name}`;this.cache[z]=this.convert(G.name)}this.cachedTables[U]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class u3 extends o6{static[_]="PgViewBase"}class d8{static[_]="PgDialect";casing;constructor($){this.casing=new hD($?.casing)}async migrate($,X,Y){let U=typeof Y==="string"?"__drizzle_migrations":Y.migrationsTable??"__drizzle_migrations",G=typeof Y==="string"?"drizzle":Y.migrationsSchema??"drizzle",z=R`
|
|
149
|
+
`};return U(Z),new Promise(async(O)=>W=O);async function H({highWaterMark:O=16384,start:w=0,end:D=1/0}={}){let E=D-w;return w&&await Z.seek(w),new yR.Readable({highWaterMark:O,async read(F){let J=F>E?F-E:F;E-=F;let[{data:A}]=await Z.read(J);if(this.push(A),A.length<F)this.push(null)}})}async function V({highWaterMark:O=16384,start:w=0}={}){return w&&await Z.seek(w),new yR.Writable({highWaterMark:O,write(D,E,F){Z.write(D).then(()=>F(),F)}})}}).catch(G)})}Object.assign(Sz,{PostgresError:E9,toPascal:u8,pascal:BD,toCamel:m8,camel:CD,toKebab:c8,kebab:jD,fromPascal:h3,fromCamel:f3,fromKebab:g3,BigInt:{to:20,from:[20],parse:($)=>BigInt($),serialize:($)=>$.toString()}});var F9=Sz;function Sz($,X){let Y=Af($,X),U=Y.no_subscribe||kD(Sz,{...Y}),G=!1,z=F1(),W=F1(),Q=F1(),Z=F1(),H=F1(),V=F1(),O=F1(),w=F1(),D={connecting:W,reserved:Q,closed:Z,ended:H,open:V,busy:O,full:w},E=[...Array(Y.max)].map(()=>SD(Y,D,{onopen:L4,onend:b$,onclose:X6})),F=J(y);return Object.assign(F,{get parameters(){return Y.parameters},largeObject:bD.bind(null,F),subscribe:U,CLOSE:D9,END:D9,PostgresError:E9,options:Y,reserve:T,listen:A,begin:q,close:l,end:X$}),F;function J(c){return c.debug=Y.debug,Object.entries(Y.types).reduce((_$,[c$,T4])=>{return _$[c$]=(V4)=>new N0(V4,T4.to),_$},H$),Object.assign(f$,{types:H$,typed:H$,unsafe:n$,notify:L,array:S,json:I,file:P4}),f$;function H$(_$,c$){return new N0(_$,c$)}function f$(_$,...c$){return _$&&Array.isArray(_$.raw)?new j1(_$,c$,c,j):typeof _$==="string"&&!c$.length?new y3(Y.transform.column.to?Y.transform.column.to(_$):_$):new Cz(_$,c$)}function n$(_$,c$=[],T4={}){return arguments.length===2&&!Array.isArray(c$)&&(T4=c$,c$=[]),new j1([_$],c$,c,j,{prepare:!1,...T4,simple:"simple"in T4?T4.simple:c$.length===0})}function P4(_$,c$=[],T4={}){return arguments.length===2&&!Array.isArray(c$)&&(T4=c$,c$=[]),new j1([],c$,(G4)=>{Jf.readFile(_$,"utf8",(Y6,t$)=>{if(Y6)return G4.reject(Y6);G4.strings=[t$],c(G4)})},j,{...T4,simple:"simple"in T4?T4.simple:c$.length===0})}}async function A(c,H$,f$){let n$={fn:H$,onlisten:f$},P4=A.sql||(A.sql=Sz({...Y,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(A.channels).forEach(([G4,{listeners:Y6}])=>{delete A.channels[G4],Promise.all(Y6.map((t$)=>A(G4,t$.fn,t$.onlisten).catch(()=>{})))})},onnotify(G4,Y6){G4 in A.channels&&A.channels[G4].listeners.forEach((t$)=>t$.fn(Y6))}})),_$=A.channels||(A.channels={});if(c in _$){_$[c].listeners.push(n$);let G4=await _$[c].result;return n$.onlisten&&n$.onlisten(),{state:G4.state,unlisten:V4}}_$[c]={result:P4`listen ${P4.unsafe('"'+c.replace(/"/g,'""')+'"')}`,listeners:[n$]};let T4=await _$[c].result;return n$.onlisten&&n$.onlisten(),{state:T4.state,unlisten:V4};async function V4(){if(c in _$===!1)return;if(_$[c].listeners=_$[c].listeners.filter((G4)=>G4!==n$),_$[c].listeners.length)return;return delete _$[c],P4`unlisten ${P4.unsafe('"'+c.replace(/"/g,'""')+'"')}`}}async function L(c,H$){return await F`select pg_notify(${c}, ${""+H$})`}async function T(){let c=F1(),H$=V.length?V.shift():await new Promise((P4,_$)=>{let c$={reserve:P4,reject:_$};z.push(c$),Z.length&&L$(Z.shift(),c$)});v(H$,Q),H$.reserved=()=>c.length?H$.execute(c.shift()):v(H$,Q),H$.reserved.release=!0;let f$=J(n$);return f$.release=()=>{H$.reserved=null,L4(H$)},f$;function n$(P4){H$.queue===w?c.push(P4):H$.execute(P4)||v(H$,w)}}async function q(c,H$){!H$&&(H$=c,c="");let f$=F1(),n$=0,P4,_$=null;try{return await F.unsafe("begin "+c.replace(/[^a-z ]/ig,""),[],{onexecute:T4}).execute(),await Promise.race([c$(P4,H$),new Promise((V4,G4)=>P4.onclose=G4)])}catch(V4){throw V4}async function c$(V4,G4,Y6){let t$=J(I4);t$.savepoint=O2,t$.prepare=(U4)=>_$=U4.replace(/[^a-z0-9$-_. ]/gi);let k1,o4;Y6&&await t$`savepoint ${t$(Y6)}`;try{if(o4=await new Promise((U4,b1)=>{let a1=G4(t$);Promise.resolve(Array.isArray(a1)?Promise.all(a1):a1).then(U4,b1)}),k1)throw k1}catch(U4){throw await(Y6?t$`rollback to ${t$(Y6)}`:t$`rollback`),U4 instanceof E9&&U4.code==="25P02"&&k1||U4}if(!Y6)_$?await t$`prepare transaction '${t$.unsafe(_$)}'`:await t$`commit`;return o4;function O2(U4,b1){if(U4&&Array.isArray(U4.raw))return O2((a1)=>a1.apply(a1,arguments));return arguments.length===1&&(b1=U4,U4=null),c$(V4,b1,"s"+n$+++(U4?"_"+U4:""))}function I4(U4){U4.catch((b1)=>k1||(k1=b1)),V4.queue===w?f$.push(U4):V4.execute(U4)||v(V4,w)}}function T4(V4){P4=V4,v(V4,Q),V4.reserved=()=>f$.length?V4.execute(f$.shift()):v(V4,Q)}}function v(c,H$){return c.queue.remove(c),H$.push(c),c.queue=H$,H$===V?c.idleTimer.start():c.idleTimer.cancel(),c}function I(c){return new N0(c,3802)}function S(c,H$){if(!Array.isArray(c))return S(Array.from(arguments));return new N0(c,H$||(c.length?Tz(c)||25:0),Y.shared.typeArrayMap)}function y(c){if(G)return c.reject(B4.connection("CONNECTION_ENDED",Y,Y));if(V.length)return r(V.shift(),c);if(Z.length)return L$(Z.shift(),c);O.length?r(O.shift(),c):z.push(c)}function r(c,H$){return c.execute(H$)?v(c,O):v(c,w)}function j(c){return new Promise((H$,f$)=>{c.state?c.active?SD(Y).cancel(c.state,H$,f$):c.cancelled={resolve:H$,reject:f$}:(z.remove(c),c.cancelled=!0,c.reject(B4.generic("57014","canceling statement due to user request")),H$())})}async function X$({timeout:c=null}={}){if(G)return G;await 1;let H$;return G=Promise.race([new Promise((f$)=>c!==null&&(H$=setTimeout(W$,c*1000,f$))),Promise.all(E.map((f$)=>f$.end()).concat(A.sql?A.sql.end({timeout:0}):[],U.sql?U.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(H$))}async function l(){await Promise.all(E.map((c)=>c.end()))}async function W$(c){await Promise.all(E.map((H$)=>H$.terminate()));while(z.length)z.shift().reject(B4.connection("CONNECTION_DESTROYED",Y));c()}function L$(c,H$){return v(c,W),c.connect(H$),c}function b$(c){v(c,H)}function L4(c){if(z.length===0)return v(c,V);let H$=Math.ceil(z.length/(W.length+1)),f$=!0;while(f$&&z.length&&H$-- >0){let n$=z.shift();if(n$.reserve)return n$.reserve(c);f$=c.execute(n$)}f$?v(c,O):v(c,w)}function X6(c,H$){v(c,Z),c.reserved=null,c.onclose&&(c.onclose(H$),c.onclose=null),Y.onclose&&Y.onclose(c.id),z.length&&L$(c,z.shift())}}function Af($,X){if($&&$.shared)return $;let Y=process.env,U=(!$||typeof $==="string"?X:$)||{},{url:G,multihost:z}=Rf($),W=[...G.searchParams].reduce((w,[D,E])=>(w[D]=E,w),{}),Q=U.hostname||U.host||z||G.hostname||Y.PGHOST||"localhost",Z=U.port||G.port||Y.PGPORT||5432,H=U.user||U.username||G.username||Y.PGUSERNAME||Y.PGUSER||Tf();U.no_prepare&&(U.prepare=!1),W.sslmode&&(W.ssl=W.sslmode,delete W.sslmode),"timeout"in U&&(console.log("The timeout option is deprecated, use idle_timeout instead"),U.idle_timeout=U.timeout),W.sslrootcert==="system"&&(W.ssl="verify-full");let V=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],O={max:10,ssl:!1,idle_timeout:null,connect_timeout:30,max_lifetime:_f,max_pipeline:100,backoff:Kf,keep_alive:60,prepare:!0,debug:!1,fetch_types:!0,publications:"alltables",target_session_attrs:null};return{host:Array.isArray(Q)?Q:Q.split(",").map((w)=>w.split(":")[0]),port:Array.isArray(Z)?Z:Q.split(",").map((w)=>parseInt(w.split(":")[1]||Z)),path:U.path||Q.indexOf("/")>-1&&Q+"/.s.PGSQL."+Z,database:U.database||U.db||(G.pathname||"").slice(1)||Y.PGDATABASE||H,user:H,pass:U.pass||U.password||G.password||Y.PGPASSWORD||"",...Object.entries(O).reduce((w,[D,E])=>{let F=D in U?U[D]:(D in W)?W[D]==="disable"||W[D]==="false"?!1:W[D]:Y["PG"+D.toUpperCase()]||E;return w[D]=typeof F==="string"&&V.includes(D)?+F:F,w},{}),connection:{application_name:Y.PGAPPNAME||"postgres.js",...U.connection,...Object.entries(W).reduce((w,[D,E])=>((D in O)||(w[D]=E),w),{})},types:U.types||{},target_session_attrs:Lf(U,G,Y),onnotice:U.onnotice,onnotify:U.onnotify,onclose:U.onclose,onparameter:U.onparameter,socket:U.socket,transform:qf(U.transform||{undefined:void 0}),parameters:{},shared:{retries:0,typeArrayMap:{}},...BR(U.types)}}function Lf($,X,Y){let U=$.target_session_attrs||X.searchParams.get("target_session_attrs")||Y.PGTARGETSESSIONATTRS;if(!U||["read-write","read-only","primary","standby","prefer-standby"].includes(U))return U;throw new Error("target_session_attrs "+U+" is not supported")}function Kf($){return(0.5+Math.random()/2)*Math.min(3**$/100,20)}function _f(){return 60*(30+Math.random()*30)}function qf($){return{undefined:$.undefined,column:{from:typeof $.column==="function"?$.column:$.column&&$.column.from,to:$.column&&$.column.to},value:{from:typeof $.value==="function"?$.value:$.value&&$.value.from,to:$.value&&$.value.to},row:{from:typeof $.row==="function"?$.row:$.row&&$.row.from,to:$.row&&$.row.to}}}function Rf($){if(!$||typeof $!=="string")return{url:{searchParams:new Map}};let X=$;X=X.slice(X.indexOf("://")+3).split(/[?/]/)[0],X=decodeURIComponent(X.slice(X.indexOf("@")+1));let Y=new URL($.replace(X,X.split(",")[0]));return{url:{username:decodeURIComponent(Y.username),password:decodeURIComponent(Y.password),host:Y.host,hostname:Y.hostname,port:Y.port,pathname:Y.pathname,searchParams:Y.searchParams},multihost:X.indexOf(",")>-1&&X}}function Tf(){try{return Mf.userInfo().username}catch($){return process.env.USERNAME||process.env.USER||process.env.LOGNAME}}class A4{static[_]="SelectionProxyHandler";config;constructor($){this.config={...$}}get($,X){if(X==="_")return{...$._,selectedFields:new Proxy($._.selectedFields,this)};if(X===$4)return{...$[$4],selectedFields:new Proxy($[$4].selectedFields,this)};if(typeof X==="symbol")return $[X];let U=(b($,R4)?$._.selectedFields:b($,n6)?$[$4].selectedFields:$)[X];if(b(U,$$.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!U.isSelectionField)return U.sql;let G=U.clone();return G.isSelectionField=!0,G}if(b(U,$$)){if(this.config.sqlBehavior==="sql")return U;throw new Error(`You tried to reference "${X}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}if(b(U,r$)){if(this.config.alias)return new Proxy(U,new w9(new Proxy(U.table,new B3(this.config.alias,this.config.replaceOriginalName??!1))));return U}if(typeof U!=="object"||U===null)return U;return new Proxy(U,new A4(this.config))}}class mR{constructor($,X){this.unique=$,this.name=X}static[_]="PgIndexBuilderOn";on(...$){return new kz($.map((X)=>{if(b(X,$$))return X;X=X;let Y=new R3(X.name,!!X.keyAsName,X.columnType,X.indexConfig);return X.indexConfig=JSON.parse(JSON.stringify(X.defaultConfig)),Y}),this.unique,!1,this.name)}onOnly(...$){return new kz($.map((X)=>{if(b(X,$$))return X;X=X;let Y=new R3(X.name,!!X.keyAsName,X.columnType,X.indexConfig);return X.indexConfig=X.defaultConfig,Y}),this.unique,!0,this.name)}using($,...X){return new kz(X.map((Y)=>{if(b(Y,$$))return Y;Y=Y;let U=new R3(Y.name,!!Y.keyAsName,Y.columnType,Y.indexConfig);return Y.indexConfig=JSON.parse(JSON.stringify(Y.defaultConfig)),U}),this.unique,!0,this.name,$)}}class kz{static[_]="PgIndexBuilder";config;constructor($,X,Y,U,G="btree"){this.config={name:U,columns:$,unique:X,only:Y,method:G}}concurrently(){return this.config.concurrently=!0,this}with($){return this.config.with=$,this}where($){return this.config.where=$,this}build($){return new uR(this.config,$)}}class uR{static[_]="PgIndex";config;constructor($,X){this.config={...$,table:X}}}function fD($){return new mR(!0,$)}function vf($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((Y)=>Y.toLowerCase()).join("_")}function Cf($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((Y,U,G)=>{let z=G===0?U.toLowerCase():`${U[0].toUpperCase()}${U.slice(1)}`;return Y+z},"")}function Bf($){return $}class hD{static[_]="CasingCache";cache={};cachedTables={};convert;constructor($){this.convert=$==="snake_case"?vf:$==="camelCase"?Cf:Bf}getColumnCasing($){if(!$.keyAsName)return $.name;let X=$.table[t.Symbol.Schema]??"public",Y=$.table[t.Symbol.OriginalName],U=`${X}.${Y}.${$.name}`;if(!this.cache[U])this.cacheTable($.table);return this.cache[U]}cacheTable($){let X=$[t.Symbol.Schema]??"public",Y=$[t.Symbol.OriginalName],U=`${X}.${Y}`;if(!this.cachedTables[U]){for(let G of Object.values($[t.Symbol.Columns])){let z=`${U}.${G.name}`;this.cache[z]=this.convert(G.name)}this.cachedTables[U]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class u3 extends n6{static[_]="PgViewBase"}class d8{static[_]="PgDialect";casing;constructor($){this.casing=new hD($?.casing)}async migrate($,X,Y){let U=typeof Y==="string"?"__drizzle_migrations":Y.migrationsTable??"__drizzle_migrations",G=typeof Y==="string"?"drizzle":Y.migrationsSchema??"drizzle",z=R`
|
|
150
150
|
CREATE TABLE IF NOT EXISTS ${R.identifier(G)}.${R.identifier(U)} (
|
|
151
151
|
id SERIAL PRIMARY KEY,
|
|
152
152
|
hash text NOT NULL,
|
|
153
153
|
created_at bigint
|
|
154
154
|
)
|
|
155
|
-
`;await X.execute(R`CREATE SCHEMA IF NOT EXISTS ${R.identifier(G)}`),await X.execute(z);let Q=(await X.all(R`select id, hash, created_at from ${R.identifier(G)}.${R.identifier(U)} order by created_at desc limit 1`))[0];await X.transaction(async(Z)=>{for await(let H of $)if(!Q||Number(Q.created_at)<H.folderMillis){for(let V of H.sql)await Z.execute(R.raw(V));await Z.execute(R`insert into ${R.identifier(G)}.${R.identifier(U)} ("hash", "created_at") values(${H.hash}, ${H.folderMillis})`)}})}escapeName($){return`"${$}"`}escapeParam($){return`$${$+1}`}escapeString($){return`'${$.replace(/'/g,"''")}'`}buildWithCTE($){if(!$?.length)return;let X=[R`with `];for(let[Y,U]of $.entries())if(X.push(R`${R.identifier(U._.alias)} as (${U._.sql})`),Y<$.length-1)X.push(R`, `);return X.push(R` `),R.join(X)}buildDeleteQuery({table:$,where:X,returning:Y,withList:U}){let G=this.buildWithCTE(U),z=Y?R` returning ${this.buildSelection(Y,{isSingleTable:!0})}`:void 0,W=X?R` where ${X}`:void 0;return R`${G}delete from ${$}${W}${z}`}buildUpdateSet($,X){let Y=$[t.Symbol.Columns],U=Object.keys(Y).filter((z)=>X[z]!==void 0||Y[z]?.onUpdateFn!==void 0),G=U.length;return R.join(U.flatMap((z,W)=>{let Q=Y[z],Z=X[z]??R.param(Q.onUpdateFn(),Q),H=R`${R.identifier(this.casing.getColumnCasing(Q))} = ${Z}`;if(W<G-1)return[H,R.raw(", ")];return[H]}))}buildUpdateQuery({table:$,set:X,where:Y,returning:U,withList:G,from:z,joins:W}){let Q=this.buildWithCTE(G),Z=$[y4.Symbol.Name],H=$[y4.Symbol.Schema],V=$[y4.Symbol.OriginalName],O=Z===V?void 0:Z,w=R`${H?R`${R.identifier(H)}.`:void 0}${R.identifier(V)}${O&&R` ${R.identifier(O)}`}`,D=this.buildUpdateSet($,X),E=z&&R.join([R.raw(" from "),this.buildFromTable(z)]),F=this.buildJoins(W),J=U?R` returning ${this.buildSelection(U,{isSingleTable:!z})}`:void 0,A=Y?R` where ${Y}`:void 0;return R`${Q}update ${w} set ${D}${E}${F}${A}${J}`}buildSelection($,{isSingleTable:X=!1}={}){let Y=$.length,U=$.flatMap(({field:G},z)=>{let W=[];if(b(G,$$.Aliased)&&G.isSelectionField)W.push(R.identifier(G.fieldAlias));else if(b(G,$$.Aliased)||b(G,$$)){let Q=b(G,$$.Aliased)?G.sql:G;if(X)W.push(new $$(Q.queryChunks.map((Z)=>{if(b(Z,i))return R.identifier(this.casing.getColumnCasing(Z));return Z})));else W.push(Q);if(b(G,$$.Aliased))W.push(R` as ${R.identifier(G.fieldAlias)}`)}else if(b(G,r$))if(X)W.push(R.identifier(this.casing.getColumnCasing(G)));else W.push(G);if(z<Y-1)W.push(R`, `);return W});return R.join(U)}buildJoins($){if(!$||$.length===0)return;let X=[];for(let[Y,U]of $.entries()){if(Y===0)X.push(R` `);let G=U.table,z=U.lateral?R` lateral`:void 0,W=U.on?R` on ${U.on}`:void 0;if(b(G,y4)){let Q=G[y4.Symbol.Name],Z=G[y4.Symbol.Schema],H=G[y4.Symbol.OriginalName],V=Q===H?void 0:U.alias;X.push(R`${R.raw(U.joinType)} join${z} ${Z?R`${R.identifier(Z)}.`:void 0}${R.identifier(H)}${V&&R` ${R.identifier(V)}`}${W}`)}else if(b(G,o6)){let Q=G[$4].name,Z=G[$4].schema,H=G[$4].originalName,V=Q===H?void 0:U.alias;X.push(R`${R.raw(U.joinType)} join${z} ${Z?R`${R.identifier(Z)}.`:void 0}${R.identifier(H)}${V&&R` ${R.identifier(V)}`}${W}`)}else X.push(R`${R.raw(U.joinType)} join${z} ${G}${W}`);if(Y<$.length-1)X.push(R` `)}return R.join(X)}buildFromTable($){if(b($,t)&&$[t.Symbol.IsAlias]){let X=R`${R.identifier($[t.Symbol.OriginalName])}`;if($[t.Symbol.Schema])X=R`${R.identifier($[t.Symbol.Schema])}.${X}`;return R`${X} ${R.identifier($[t.Symbol.Name])}`}return $}buildSelectQuery({withList:$,fields:X,fieldsFlat:Y,where:U,having:G,table:z,joins:W,orderBy:Q,groupBy:Z,limit:H,offset:V,lockingClause:O,distinct:w,setOperators:D}){let E=Y??v1(X);for(let W$ of E)if(b(W$.field,r$)&&i4(W$.field.table)!==(b(z,R4)?z._.alias:b(z,u3)?z[$4].name:b(z,$$)?void 0:i4(z))&&!((L$)=>W?.some(({alias:b$})=>b$===(L$[t.Symbol.IsAlias]?i4(L$):L$[t.Symbol.BaseName])))(W$.field.table)){let L$=i4(W$.field.table);throw new Error(`Your "${W$.path.join("->")}" field references a column "${L$}"."${W$.field.name}", but the table "${L$}" is not part of the query! Did you forget to join it?`)}let F=!W||W.length===0,J=this.buildWithCTE($),A;if(w)A=w===!0?R` distinct`:R` distinct on (${R.join(w.on,R`, `)})`;let L=this.buildSelection(E,{isSingleTable:F}),T=this.buildFromTable(z),q=this.buildJoins(W),v=U?R` where ${U}`:void 0,I=G?R` having ${G}`:void 0,S;if(Q&&Q.length>0)S=R` order by ${R.join(Q,R`, `)}`;let y;if(Z&&Z.length>0)y=R` group by ${R.join(Z,R`, `)}`;let r=typeof H==="object"||typeof H==="number"&&H>=0?R` limit ${H}`:void 0,j=V?R` offset ${V}`:void 0,X$=R.empty();if(O){let W$=R` for ${R.raw(O.strength)}`;if(O.config.of)W$.append(R` of ${R.join(Array.isArray(O.config.of)?O.config.of:[O.config.of],R`, `)}`);if(O.config.noWait)W$.append(R` nowait`);else if(O.config.skipLocked)W$.append(R` skip locked`);X$.append(W$)}let l=R`${J}select${A} ${L} from ${T}${q}${v}${y}${I}${S}${r}${j}${X$}`;if(D.length>0)return this.buildSetOperations(l,D);return l}buildSetOperations($,X){let[Y,...U]=X;if(!Y)throw new Error("Cannot pass undefined values to any set operator");if(U.length===0)return this.buildSetOperationQuery({leftSelect:$,setOperator:Y});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:$,setOperator:Y}),U)}buildSetOperationQuery({leftSelect:$,setOperator:{type:X,isAll:Y,rightSelect:U,limit:G,orderBy:z,offset:W}}){let Q=R`(${$.getSQL()}) `,Z=R`(${U.getSQL()})`,H;if(z&&z.length>0){let D=[];for(let E of z)if(b(E,i))D.push(R.identifier(E.name));else if(b(E,$$)){for(let F=0;F<E.queryChunks.length;F++){let J=E.queryChunks[F];if(b(J,i))E.queryChunks[F]=R.identifier(J.name)}D.push(R`${E}`)}else D.push(R`${E}`);H=R` order by ${R.join(D,R`, `)} `}let V=typeof G==="object"||typeof G==="number"&&G>=0?R` limit ${G}`:void 0,O=R.raw(`${X} ${Y?"all ":""}`),w=W?R` offset ${W}`:void 0;return R`${Q}${O}${Z}${H}${V}${w}`}buildInsertQuery({table:$,values:X,onConflict:Y,returning:U,withList:G,select:z,overridingSystemValue_:W}){let Q=[],Z=$[t.Symbol.Columns],H=Object.entries(Z).filter(([J,A])=>!A.shouldDisableInsert()),V=H.map(([,J])=>R.identifier(this.casing.getColumnCasing(J)));if(z){let J=X;if(b(J,$$))Q.push(J);else Q.push(J.getSQL())}else{let J=X;Q.push(R.raw("values "));for(let[A,L]of J.entries()){let T=[];for(let[q,v]of H){let I=L[q];if(I===void 0||b(I,E1)&&I.value===void 0)if(v.defaultFn!==void 0){let S=v.defaultFn(),y=b(S,$$)?S:R.param(S,v);T.push(y)}else if(!v.default&&v.onUpdateFn!==void 0){let S=v.onUpdateFn(),y=b(S,$$)?S:R.param(S,v);T.push(y)}else T.push(R`default`);else T.push(I)}if(Q.push(T),A<J.length-1)Q.push(R`, `)}}let O=this.buildWithCTE(G),w=R.join(Q),D=U?R` returning ${this.buildSelection(U,{isSingleTable:!0})}`:void 0,E=Y?R` on conflict ${Y}`:void 0,F=W===!0?R`overriding system value `:void 0;return R`${O}insert into ${$} ${V} ${F}${w}${E}${D}`}buildRefreshMaterializedViewQuery({view:$,concurrently:X,withNoData:Y}){let U=X?R` concurrently`:void 0,G=Y?R` with no data`:void 0;return R`refresh materialized view${U} ${$}${G}`}prepareTyping($){if(b($,Ez)||b($,Dz))return"json";else if(b($,Nz))return"decimal";else if(b($,Fz))return"time";else if(b($,Mz)||b($,Jz))return"timestamp";else if(b($,Oz)||b($,wz))return"date";else if(b($,Az))return"uuid";else return"none"}sqlToQuery($,X){return $.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:X})}buildRelationalQueryWithoutPK({fullSchema:$,schema:X,tableNamesMap:Y,table:U,tableConfig:G,queryConfig:z,tableAlias:W,nestedQueryRelation:Q,joinOn:Z}){let H=[],V,O,w=[],D,E=[];if(z===!0)H=Object.entries(G.columns).map(([A,L])=>({dbKey:L.name,tsKey:A,field:D0(L,W),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let J=Object.fromEntries(Object.entries(G.columns).map(([I,S])=>[I,D0(S,W)]));if(z.where){let I=typeof z.where==="function"?z.where(J,NR()):z.where;D=I&&j3(I,W)}let A=[],L=[];if(z.columns){let I=!1;for(let[S,y]of Object.entries(z.columns)){if(y===void 0)continue;if(S in G.columns){if(!I&&y===!0)I=!0;L.push(S)}}if(L.length>0)L=I?L.filter((S)=>z.columns?.[S]===!0):Object.keys(G.columns).filter((S)=>!L.includes(S))}else L=Object.keys(G.columns);for(let I of L){let S=G.columns[I];A.push({tsKey:I,value:S})}let T=[];if(z.with)T=Object.entries(z.with).filter((I)=>!!I[1]).map(([I,S])=>({tsKey:I,queryConfig:S,relation:G.relations[I]}));let q;if(z.extras){q=typeof z.extras==="function"?z.extras(J,{sql:R}):z.extras;for(let[I,S]of Object.entries(q))A.push({tsKey:I,value:OD(S,W)})}for(let{tsKey:I,value:S}of A)H.push({dbKey:b(S,$$.Aliased)?S.fieldAlias:G.columns[I].name,tsKey:I,field:b(S,r$)?D0(S,W):S,relationTableTsKey:void 0,isJson:!1,selection:[]});let v=typeof z.orderBy==="function"?z.orderBy(J,FR()):z.orderBy??[];if(!Array.isArray(v))v=[v];w=v.map((I)=>{if(b(I,r$))return D0(I,W);return j3(I,W)}),V=z.limit,O=z.offset;for(let{tsKey:I,queryConfig:S,relation:y}of T){let r=JR(X,Y,y),j=y8(y.referencedTable),X$=Y[j],l=`${W}_${I}`,W$=k3(...r.fields.map((L4,X6)=>Lz(D0(r.references[X6],l),D0(L4,W)))),L$=this.buildRelationalQueryWithoutPK({fullSchema:$,schema:X,tableNamesMap:Y,table:$[X$],tableConfig:X[X$],queryConfig:b(y,g2)?S===!0?{limit:1}:{...S,limit:1}:S,tableAlias:l,joinOn:W$,nestedQueryRelation:y}),b$=R`${R.identifier(l)}.${R.identifier("data")}`.as(I);E.push({on:R`true`,table:new R4(L$.sql,{},l),alias:l,joinType:"left",lateral:!0}),H.push({dbKey:I,tsKey:I,field:b$,relationTableTsKey:X$,isJson:!0,selection:L$.selection})}}if(H.length===0)throw new Hz({message:`No fields selected for table "${G.tsName}" ("${W}")`});let F;if(D=k3(Z,D),Q){let J=R`json_build_array(${R.join(H.map(({field:T,tsKey:q,isJson:v})=>v?R`${R.identifier(`${W}_${q}`)}.${R.identifier("data")}`:b(T,$$.Aliased)?T.sql:T),R`, `)})`;if(b(Q,b3))J=R`coalesce(json_agg(${J}${w.length>0?R` order by ${R.join(w,R`, `)}`:void 0}), '[]'::json)`;let A=[{dbKey:"data",tsKey:"data",field:J.as("data"),isJson:!0,relationTableTsKey:G.tsName,selection:H}];if(V!==void 0||O!==void 0||w.length>0)F=this.buildSelectQuery({table:Zz(U,W),fields:{},fieldsFlat:[{path:[],field:R.raw("*")}],where:D,limit:V,offset:O,orderBy:w,setOperators:[]}),D=void 0,V=void 0,O=void 0,w=[];else F=Zz(U,W);F=this.buildSelectQuery({table:b(F,y4)?F:new R4(F,{},W),fields:{},fieldsFlat:A.map(({field:T})=>({path:[],field:b(T,r$)?D0(T,W):T})),joins:E,where:D,limit:V,offset:O,orderBy:w,setOperators:[]})}else F=this.buildSelectQuery({table:Zz(U,W),fields:{},fieldsFlat:H.map(({field:J})=>({path:[],field:b(J,r$)?D0(J,W):J})),joins:E,where:D,limit:V,offset:O,orderBy:w,setOperators:[]});return{tableTsKey:G.tsName,sql:F,selection:H}}}class gD{static[_]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class b6{static[_]="PgSelectBuilder";fields;session;dialect;withList=[];distinct;constructor($){if(this.fields=$.fields,this.session=$.session,this.dialect=$.dialect,$.withList)this.withList=$.withList;this.distinct=$.distinct}authToken;setToken($){return this.authToken=$,this}from($){let X=!!this.fields,Y=$,U;if(this.fields)U=this.fields;else if(b(Y,R4))U=Object.fromEntries(Object.keys(Y._.selectedFields).map((G)=>[G,Y[G]]));else if(b(Y,u3))U=Y[$4].selectedFields;else if(b(Y,$$))U={};else U=oK(Y);return new yD({table:Y,fields:U,isPartialSelect:X,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}class cR extends gD{static[_]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:$,fields:X,isPartialSelect:Y,session:U,dialect:G,withList:z,distinct:W}){super();this.config={withList:z,table:$,fields:{...X},distinct:W,setOperators:[]},this.isPartialSelect=Y,this.session=U,this.dialect=G,this._={selectedFields:X,config:this.config},this.tableName=s0($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let Q of d1($))this.usedTables.add(Q)}getUsedTables(){return[...this.usedTables]}createJoin($,X){return(Y,U)=>{let G=this.tableName,z=s0(Y);for(let W of d1(Y))this.usedTables.add(W);if(typeof z==="string"&&this.config.joins?.some((W)=>W.alias===z))throw new Error(`Alias "${z}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof G==="string")this.config.fields={[G]:this.config.fields};if(typeof z==="string"&&!b(Y,$$)){let W=b(Y,R4)?Y._.selectedFields:b(Y,o6)?Y[$4].selectedFields:Y[t.Symbol.Columns];this.config.fields[z]=W}}if(typeof U==="function")U=U(new Proxy(this.config.fields,new A4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:U,table:Y,joinType:$,alias:z,lateral:X}),typeof z==="string")switch($){case"left":{this.joinsNotNullableMap[z]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([W])=>[W,!1])),this.joinsNotNullableMap[z]=!0;break}case"cross":case"inner":{this.joinsNotNullableMap[z]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([W])=>[W,!1])),this.joinsNotNullableMap[z]=!1;break}}return this}}leftJoin=this.createJoin("left",!1);leftJoinLateral=this.createJoin("left",!0);rightJoin=this.createJoin("right",!1);innerJoin=this.createJoin("inner",!1);innerJoinLateral=this.createJoin("inner",!0);fullJoin=this.createJoin("full",!1);crossJoin=this.createJoin("cross",!1);crossJoinLateral=this.createJoin("cross",!0);createSetOperator($,X){return(Y)=>{let U=typeof Y==="function"?Y(jf()):Y;if(!P3(this.getSelectedFields(),U.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:$,isAll:X,rightSelect:U}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);intersectAll=this.createSetOperator("intersect",!0);except=this.createSetOperator("except",!1);exceptAll=this.createSetOperator("except",!0);addSetOperators($){return this.config.setOperators.push(...$),this}where($){if(typeof $==="function")$=$(new Proxy(this.config.fields,new A4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=$,this}having($){if(typeof $==="function")$=$(new Proxy(this.config.fields,new A4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=$,this}groupBy(...$){if(typeof $[0]==="function"){let X=$[0](new Proxy(this.config.fields,new A4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(X)?X:[X]}else this.config.groupBy=$;return this}orderBy(...$){if(typeof $[0]==="function"){let X=$[0](new Proxy(this.config.fields,new A4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Y=Array.isArray(X)?X:[X];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=Y;else this.config.orderBy=Y}else{let X=$;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=X;else this.config.orderBy=X}return this}limit($){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=$;else this.config.limit=$;return this}offset($){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=$;else this.config.offset=$;return this}for($,X={}){return this.config.lockingClause={strength:$,config:X},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}as($){let X=[];if(X.push(...d1(this.config.table)),this.config.joins)for(let Y of this.config.joins)X.push(...d1(Y.table));return new Proxy(new R4(this.getSQL(),this.config.fields,$,!1,[...new Set(X)]),new A4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new A4({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}$withCache($){return this.cacheConfig=$===void 0?{config:{},enable:!0,autoInvalidate:!0}:$===!1?{enable:!1}:{enable:!0,autoInvalidate:!0,...$},this}}class yD extends cR{static[_]="PgSelect";_prepare($){let{session:X,config:Y,dialect:U,joinsNotNullableMap:G,authToken:z,cacheConfig:W,usedTables:Q}=this;if(!X)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");let{fields:Z}=Y;return i$.startActiveSpan("drizzle.prepareQuery",()=>{let H=v1(Z),V=X.prepareQuery(U.sqlToQuery(this.getSQL()),H,$,!0,void 0,{type:"select",tables:[...Q]},W);return V.joinsNotNullableMap=G,V.setToken(z)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return i$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})}}iK(yD,[k6]);function M9($,X){return(Y,U,...G)=>{let z=[U,...G].map((W)=>({type:$,isAll:X,rightSelect:W}));for(let W of z)if(!P3(Y.getSelectedFields(),W.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return Y.addSetOperators(z)}}var jf=()=>({union:Pf,unionAll:If,intersect:xf,intersectAll:Sf,except:kf,exceptAll:bf}),Pf=M9("union",!1),If=M9("union",!0),xf=M9("intersect",!1),Sf=M9("intersect",!0),kf=M9("except",!1),bf=M9("except",!0);class c3{static[_]="PgQueryBuilder";dialect;dialectConfig;constructor($){this.dialect=b($,d8)?$:void 0,this.dialectConfig=b($,d8)?void 0:$}$with=($,X)=>{let Y=this;return{as:(G)=>{if(typeof G==="function")G=G(Y);return new Proxy(new v3(G.getSQL(),X??("getSelectedFields"in G?G.getSelectedFields()??{}:{}),$,!0),new A4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...$){let X=this;function Y(z){return new b6({fields:z??void 0,session:void 0,dialect:X.getDialect(),withList:$})}function U(z){return new b6({fields:z??void 0,session:void 0,dialect:X.getDialect(),distinct:!0})}function G(z,W){return new b6({fields:W??void 0,session:void 0,dialect:X.getDialect(),distinct:{on:z}})}return{select:Y,selectDistinct:U,selectDistinctOn:G}}select($){return new b6({fields:$??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct($){return new b6({fields:$??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn($,X){return new b6({fields:X??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:$}})}getDialect(){if(!this.dialect)this.dialect=new d8(this.dialectConfig);return this.dialect}}function d1($){if(b($,y4))return[$[g8]?`${$[g8]}.${$[t.Symbol.BaseName]}`:$[t.Symbol.BaseName]];if(b($,R4))return $._.usedTables??[];if(b($,$$))return $.usedTables??[];return[]}class bz extends k6{constructor($,X,Y,U){super();this.session=X,this.dialect=Y,this.config={table:$,withList:U}}static[_]="PgDelete";config;cacheConfig;where($){return this.config.where=$,this}returning($=this.config.table[t.Symbol.Columns]){return this.config.returningFields=$,this.config.returning=v1($),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}_prepare($){return i$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"delete",tables:d1(this.config.table)},this.cacheConfig)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return i$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new A4({alias:i4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class fz{constructor($,X,Y,U,G){this.table=$,this.session=X,this.dialect=Y,this.withList=U,this.overridingSystemValue_=G}static[_]="PgInsertBuilder";authToken;setToken($){return this.authToken=$,this}overridingSystemValue(){return this.overridingSystemValue_=!0,this}values($){if($=Array.isArray($)?$:[$],$.length===0)throw new Error("values() must be called with at least one value");let X=$.map((Y)=>{let U={},G=this.table[t.Symbol.Columns];for(let z of Object.keys(Y)){let W=Y[z];U[z]=b(W,$$)?W:new E1(W,G[z])}return U});return new mD(this.table,X,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select($){let X=typeof $==="function"?$(new c3):$;if(!b(X,$$)&&!P3(this.table[Wz],X._.selectedFields))throw new Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new mD(this.table,X,this.session,this.dialect,this.withList,!0)}}class mD extends k6{constructor($,X,Y,U,G,z,W){super();this.session=Y,this.dialect=U,this.config={table:$,values:X,withList:G,select:z,overridingSystemValue_:W}}static[_]="PgInsert";config;cacheConfig;returning($=this.config.table[t.Symbol.Columns]){return this.config.returningFields=$,this.config.returning=v1($),this}onConflictDoNothing($={}){if($.target===void 0)this.config.onConflict=R`do nothing`;else{let X="";X=Array.isArray($.target)?$.target.map((U)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(U))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing($.target));let Y=$.where?R` where ${$.where}`:void 0;this.config.onConflict=R`(${R.raw(X)})${Y} do nothing`}return this}onConflictDoUpdate($){if($.where&&($.targetWhere||$.setWhere))throw new Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');let X=$.where?R` where ${$.where}`:void 0,Y=$.targetWhere?R` where ${$.targetWhere}`:void 0,U=$.setWhere?R` where ${$.setWhere}`:void 0,G=this.dialect.buildUpdateSet(this.config.table,Vz(this.config.table,$.set)),z="";return z=Array.isArray($.target)?$.target.map((W)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(W))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing($.target)),this.config.onConflict=R`(${R.raw(z)})${Y} do update set ${G}${X}${U}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}_prepare($){return i$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"insert",tables:d1(this.config.table)},this.cacheConfig)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return i$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new A4({alias:i4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class uD extends k6{constructor($,X,Y){super();this.session=X,this.dialect=Y,this.config={view:$}}static[_]="PgRefreshMaterializedView";config;concurrently(){if(this.config.withNoData!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.concurrently=!0,this}withNoData(){if(this.config.concurrently!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.withNoData=!0,this}getSQL(){return this.dialect.buildRefreshMaterializedViewQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}_prepare($){return i$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,$,!0)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return i$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})}}class hz{constructor($,X,Y,U){this.table=$,this.session=X,this.dialect=Y,this.withList=U}static[_]="PgUpdateBuilder";authToken;setToken($){return this.authToken=$,this}set($){return new pR(this.table,Vz(this.table,$),this.session,this.dialect,this.withList).setToken(this.authToken)}}class pR extends k6{constructor($,X,Y,U,G){super();this.session=Y,this.dialect=U,this.config={set:X,table:$,withList:G,joins:[]},this.tableName=s0($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{}}static[_]="PgUpdate";config;tableName;joinsNotNullableMap;cacheConfig;from($){let X=$,Y=s0(X);if(typeof Y==="string")this.joinsNotNullableMap[Y]=!0;return this.config.from=X,this}getTableLikeFields($){if(b($,y4))return $[t.Symbol.Columns];else if(b($,R4))return $._.selectedFields;return $[$4].selectedFields}createJoin($){return(X,Y)=>{let U=s0(X);if(typeof U==="string"&&this.config.joins.some((G)=>G.alias===U))throw new Error(`Alias "${U}" is already used in this query`);if(typeof Y==="function"){let G=this.config.from&&!b(this.config.from,$$)?this.getTableLikeFields(this.config.from):void 0;Y=Y(new Proxy(this.config.table[t.Symbol.Columns],new A4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),G&&new Proxy(G,new A4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}if(this.config.joins.push({on:Y,table:X,joinType:$,alias:U}),typeof U==="string")switch($){case"left":{this.joinsNotNullableMap[U]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([G])=>[G,!1])),this.joinsNotNullableMap[U]=!0;break}case"inner":{this.joinsNotNullableMap[U]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([G])=>[G,!1])),this.joinsNotNullableMap[U]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where($){return this.config.where=$,this}returning($){if(!$){if($=Object.assign({},this.config.table[t.Symbol.Columns]),this.config.from){let X=s0(this.config.from);if(typeof X==="string"&&this.config.from&&!b(this.config.from,$$)){let Y=this.getTableLikeFields(this.config.from);$[X]=Y}for(let Y of this.config.joins){let U=s0(Y.table);if(typeof U==="string"&&!b(Y.table,$$)){let G=this.getTableLikeFields(Y.table);$[U]=G}}}}return this.config.returningFields=$,this.config.returning=v1($),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}_prepare($){let X=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"insert",tables:d1(this.config.table)},this.cacheConfig);return X.joinsNotNullableMap=this.joinsNotNullableMap,X}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return this._prepare().execute($,this.authToken)};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new A4({alias:i4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class p3 extends $${constructor($){super(p3.buildEmbeddedCount($.source,$.filters).queryChunks);this.params=$,this.mapWith(Number),this.session=$.session,this.sql=p3.buildCount($.source,$.filters)}sql;token;static[_]="PgCountBuilder";[Symbol.toStringTag]="PgCountBuilder";session;static buildEmbeddedCount($,X){return R`(select count(*) from ${$}${R.raw(" where ").if(X)}${X})`}static buildCount($,X){return R`select count(*) as count from ${$}${R.raw(" where ").if(X)}${X};`}setToken($){return this.token=$,this}then($,X){return Promise.resolve(this.session.count(this.sql,this.token)).then($,X)}catch($){return this.then(void 0,$)}finally($){return this.then((X)=>{return $?.(),X},(X)=>{throw $?.(),X})}}class pD{constructor($,X,Y,U,G,z,W){this.fullSchema=$,this.schema=X,this.tableNamesMap=Y,this.table=U,this.tableConfig=G,this.dialect=z,this.session=W}static[_]="PgRelationalQueryBuilder";findMany($){return new cD(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?$:{},"many")}findFirst($){return new cD(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?{...$,limit:1}:{limit:1},"first")}}class cD extends k6{constructor($,X,Y,U,G,z,W,Q,Z){super();this.fullSchema=$,this.schema=X,this.tableNamesMap=Y,this.table=U,this.tableConfig=G,this.dialect=z,this.session=W,this.config=Q,this.mode=Z}static[_]="PgRelationalQuery";_prepare($){return i$.startActiveSpan("drizzle.prepareQuery",()=>{let{query:X,builtQuery:Y}=this._toSQL();return this.session.prepareQuery(Y,void 0,$,!0,(U,G)=>{let z=U.map((W)=>_z(this.schema,this.tableConfig,W,X.selection,G));if(this.mode==="first")return z[0];return z})})}prepare($){return this._prepare($)}_getQuery(){return this.dialect.buildRelationalQueryWithoutPK({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName})}getSQL(){return this._getQuery().sql}_toSQL(){let $=this._getQuery(),X=this.dialect.sqlToQuery($.sql);return{query:$,builtQuery:X}}toSQL(){return this._toSQL().builtQuery}authToken;setToken($){return this.authToken=$,this}execute(){return i$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(void 0,this.authToken)})}}class dD extends k6{constructor($,X,Y,U){super();this.execute=$,this.sql=X,this.query=Y,this.mapBatchResult=U}static[_]="PgRaw";getSQL(){return this.sql}getQuery(){return this.query}mapResult($,X){return X?this.mapBatchResult($):$}_prepare(){return this}isResponseInArrayMode(){return!1}}class d3{constructor($,X,Y){if(this.dialect=$,this.session=X,this._=Y?{schema:Y.schema,fullSchema:Y.fullSchema,tableNamesMap:Y.tableNamesMap,session:X}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:X},this.query={},this._.schema)for(let[U,G]of Object.entries(this._.schema))this.query[U]=new pD(Y.fullSchema,this._.schema,this._.tableNamesMap,Y.fullSchema[U],G,$,X);this.$cache={invalidate:async(U)=>{}}}static[_]="PgDatabase";query;$with=($,X)=>{let Y=this;return{as:(G)=>{if(typeof G==="function")G=G(new c3(Y.dialect));return new Proxy(new v3(G.getSQL(),X??("getSelectedFields"in G?G.getSelectedFields()??{}:{}),$,!0),new A4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count($,X){return new p3({source:$,filters:X,session:this.session})}$cache;with(...$){let X=this;function Y(Z){return new b6({fields:Z??void 0,session:X.session,dialect:X.dialect,withList:$})}function U(Z){return new b6({fields:Z??void 0,session:X.session,dialect:X.dialect,withList:$,distinct:!0})}function G(Z,H){return new b6({fields:H??void 0,session:X.session,dialect:X.dialect,withList:$,distinct:{on:Z}})}function z(Z){return new hz(Z,X.session,X.dialect,$)}function W(Z){return new fz(Z,X.session,X.dialect,$)}function Q(Z){return new bz(Z,X.session,X.dialect,$)}return{select:Y,selectDistinct:U,selectDistinctOn:G,update:z,insert:W,delete:Q}}select($){return new b6({fields:$??void 0,session:this.session,dialect:this.dialect})}selectDistinct($){return new b6({fields:$??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn($,X){return new b6({fields:X??void 0,session:this.session,dialect:this.dialect,distinct:{on:$}})}update($){return new hz($,this.session,this.dialect)}insert($){return new fz($,this.session,this.dialect)}delete($){return new bz($,this.session,this.dialect)}refreshMaterializedView($){return new uD($,this.session,this.dialect)}authToken;execute($){let X=typeof $==="string"?R.raw($):$.getSQL(),Y=this.dialect.sqlToQuery(X),U=this.session.prepareQuery(Y,void 0,void 0,!1);return new dD(()=>U.execute(void 0,this.authToken),X,Y,(G)=>U.mapResult(G,!0))}transaction($,X){return this.session.transaction($,X)}}class dR{static[_]="Cache"}class l3 extends dR{strategy(){return"all"}static[_]="NoopCache";async get($){return}async put($,X,Y,U){}async onMutate($){}}async function lD($,X){let Y=`${$}-${JSON.stringify(X)}`,G=new TextEncoder().encode(Y),z=await crypto.subtle.digest("SHA-256",G);return[...new Uint8Array(z)].map((Z)=>Z.toString(16).padStart(2,"0")).join("")}class rD{constructor($,X,Y,U){if(this.query=$,this.cache=X,this.queryMetadata=Y,this.cacheConfig=U,X&&X.strategy()==="all"&&U===void 0)this.cacheConfig={enable:!0,autoInvalidate:!0};if(!this.cacheConfig?.enable)this.cacheConfig=void 0}authToken;getQuery(){return this.query}mapResult($,X){return $}setToken($){return this.authToken=$,this}static[_]="PgPreparedQuery";joinsNotNullableMap;async queryWithCache($,X,Y){if(this.cache===void 0||b(this.cache,l3)||this.queryMetadata===void 0)try{return await Y()}catch(U){throw new a0($,X,U)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await Y()}catch(U){throw new a0($,X,U)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[U]=await Promise.all([Y(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return U}catch(U){throw new a0($,X,U)}if(!this.cacheConfig)try{return await Y()}catch(U){throw new a0($,X,U)}if(this.queryMetadata.type==="select"){let U=await this.cache.get(this.cacheConfig.tag??await lD($,X),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(U===void 0){let G;try{G=await Y()}catch(z){throw new a0($,X,z)}return await this.cache.put(this.cacheConfig.tag??await lD($,X),G,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),G}return U}try{return await Y()}catch(U){throw new a0($,X,U)}}}class iD{constructor($){this.dialect=$}static[_]="PgSession";execute($,X){return i$.startActiveSpan("drizzle.operation",()=>{return i$.startActiveSpan("drizzle.prepareQuery",()=>{return this.prepareQuery(this.dialect.sqlToQuery($),void 0,void 0,!1)}).setToken(X).execute(void 0,X)})}all($){return this.prepareQuery(this.dialect.sqlToQuery($),void 0,void 0,!1).all()}async count($,X){let Y=await this.execute($,X);return Number(Y[0].count)}}class oD extends d3{constructor($,X,Y,U=0){super($,X,Y);this.schema=Y,this.nestedIndex=U}static[_]="PgTransaction";rollback(){throw new wD}getTransactionConfigSQL($){let X=[];if($.isolationLevel)X.push(`isolation level ${$.isolationLevel}`);if($.accessMode)X.push($.accessMode);if(typeof $.deferrable==="boolean")X.push($.deferrable?"deferrable":"not deferrable");return R.raw(X.join(" "))}setTransaction($){return this.session.execute(R`set transaction ${this.getTransactionConfigSQL($)}`)}}class lR extends rD{constructor($,X,Y,U,G,z,W,Q,Z,H){super({sql:X,params:Y},G,z,W);this.client=$,this.queryString=X,this.params=Y,this.logger=U,this.fields=Q,this._isResponseInArrayMode=Z,this.customResultMapper=H}static[_]="PostgresJsPreparedQuery";async execute($={}){return i$.startActiveSpan("drizzle.execute",async(X)=>{let Y=VD(this.params,$);X?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(Y)}),this.logger.logQuery(this.queryString,Y);let{fields:U,queryString:G,client:z,joinsNotNullableMap:W,customResultMapper:Q}=this;if(!U&&!Q)return i$.startActiveSpan("drizzle.driver.execute",()=>{return this.queryWithCache(G,Y,async()=>{return await z.unsafe(G,Y)})});let Z=await i$.startActiveSpan("drizzle.driver.execute",()=>{return X?.setAttributes({"drizzle.query.text":G,"drizzle.query.params":JSON.stringify(Y)}),this.queryWithCache(G,Y,async()=>{return await z.unsafe(G,Y).values()})});return i$.startActiveSpan("drizzle.mapResponse",()=>{return Q?Q(Z):Z.map((H)=>rK(U,H,W))})})}all($={}){return i$.startActiveSpan("drizzle.execute",async(X)=>{let Y=VD(this.params,$);return X?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(Y)}),this.logger.logQuery(this.queryString,Y),i$.startActiveSpan("drizzle.driver.execute",()=>{return X?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(Y)}),this.queryWithCache(this.queryString,Y,async()=>{return this.client.unsafe(this.queryString,Y)})})})}isResponseInArrayMode(){return this._isResponseInArrayMode}}class r3 extends iD{constructor($,X,Y,U={}){super(X);this.client=$,this.schema=Y,this.options=U,this.logger=U.logger??new ED,this.cache=U.cache??new l3}static[_]="PostgresJsSession";logger;cache;prepareQuery($,X,Y,U,G,z,W){return new lR(this.client,$.sql,$.params,this.logger,this.cache,z,W,X,U,G)}query($,X){return this.logger.logQuery($,X),this.client.unsafe($,X).values()}queryObjects($,X){return this.client.unsafe($,X)}transaction($,X){return this.client.begin(async(Y)=>{let U=new r3(Y,this.dialect,this.schema,this.options),G=new nD(this.dialect,U,this.schema);if(X)await G.setTransaction(X);return $(G)})}}class nD extends oD{constructor($,X,Y,U=0){super($,X,Y,U);this.session=X}static[_]="PostgresJsTransaction";transaction($){return this.session.client.savepoint((X)=>{let Y=new r3(X,this.dialect,this.schema,this.session.options),U=new nD(this.dialect,Y,this.schema);return $(U)})}}class rR extends d3{static[_]="PostgresJsDatabase"}function J9($,X={}){let Y=(Z)=>Z;for(let Z of["1184","1082","1083","1114","1182","1185","1115","1231"])$.options.parsers[Z]=Y,$.options.serializers[Z]=Y;$.options.serializers["114"]=Y,$.options.serializers["3802"]=Y;let U=new d8({casing:X.casing}),G;if(X.logger===!0)G=new DD;else if(X.logger!==!1)G=X.logger;let z;if(X.schema){let Z=MR(X.schema,AR);z={fullSchema:X.schema,schema:Z.tables,tableNamesMap:Z.tableNamesMap}}let W=new r3($,U,z,{logger:G,cache:X.cache}),Q=new rR(U,W,z);if(Q.$client=$,Q.$cache=X.cache,Q.$cache)Q.$cache.invalidate=X.cache?.onMutate;return Q}function gz(...$){if(typeof $[0]==="string"){let X=F9($[0]);return J9(X,$[1])}if(nK($[0])){let{connection:X,client:Y,...U}=$[0];if(Y)return J9(Y,U);if(typeof X==="object"&&X.url!==void 0){let{url:z,...W}=X,Q=F9(z,W);return J9(Q,U)}let G=F9(X);return J9(G,U)}return J9($[0],$[1])}(($)=>{function X(Y){return J9({options:{parsers:{},serializers:{}}},Y)}$.mock=X})(gz||(gz={}));function iR($,X){if($ instanceof Promise)throw new Error(X)}function ff($,X){let Y={},U=[];for(let G in $){let z=$[G]["~standard"].validate(X[G]);if(iR(z,`Validation must be synchronous, but ${G} returned a Promise.`),z.issues){U.push(...z.issues.map((W)=>({...W,message:W.message,path:[G,...W.path??[]]})));continue}Y[G]=z.value}if(U.length)return{issues:U};return{value:Y}}function tD($){let X=$.runtimeEnvStrict??$.runtimeEnv??process.env;if($.emptyStringAsUndefined??!1){for(let[L,T]of Object.entries(X))if(T==="")delete X[L]}if(!!$.skipValidation)return X;let G=typeof $.client==="object"?$.client:{},z=typeof $.server==="object"?$.server:{},W=typeof $.shared==="object"?$.shared:{},Q=$.isServer??(typeof window==="undefined"||("Deno"in window)),Z=Q?{...z,...W,...G}:{...G,...W},H=$.createFinalSchema?.(Z,Q)["~standard"].validate(X)??ff(Z,X);iR(H,"Validation must be synchronous");let V=$.onValidationError??((L)=>{throw console.error("\u274C Invalid environment variables:",L),new Error("Invalid environment variables")}),O=$.onInvalidAccess??(()=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(H.issues)return V(H.issues);let w=(L)=>{if(!$.clientPrefix)return!0;return!L.startsWith($.clientPrefix)&&!(L in W)},D=(L)=>{return Q||!w(L)},E=(L)=>{return L==="__esModule"||L==="$$typeof"},F=($.extends??[]).reduce((L,T)=>{return Object.assign(L,T)},{}),J=Object.assign(F,H.value);return new Proxy(J,{get(L,T){if(typeof T!=="string")return;if(E(T))return;if(!D(T))return O(T);return Reflect.get(L,T)}})}var m2=($)=>Array.isArray($)?$:[$],oR=($,X)=>{let Y=[[],[]];for(let U of $)if(X(U))Y[0].push(U);else Y[1].push(U);return Y},yz=Array,$2=($,X)=>$.includes(X),nR=($,X=0)=>[...new Array($)].map((Y,U)=>U+X),P$=($,X,Y)=>{if($===void 0)return X===void 0?[]:Array.isArray(X)?X:[X];if(Y?.prepend)if(Array.isArray(X))$.unshift(...X);else $.unshift(X);else if(Array.isArray(X))$.push(...X);else $.push(X);return $},X2=($,X)=>{if(X===void 0||X===null)return $??[];if($===void 0||$===null)return m2(X);return $.concat(X)},tR=(...$)=>$.reduce(X2,[]),N0=($,X,Y)=>{if($===void 0)return Array.isArray(X)?X:[X];let U=Y?.isEqual??((G,z)=>G===z);for(let G of m2(X))if(!$.some((z)=>U(z,G)))$.push(G);return $},aR=($,X)=>$.reduce((Y,U)=>{let G=U[X];return Y[G]=P$(Y[G],U),Y},{}),Y2=($,X,Y)=>$.length===X.length&&$.every(Y?.isEqual?(U,G)=>Y.isEqual(U,X[G]):(U,G)=>U===X[G]);var t6=($,X)=>m4($)===X,m4=($)=>{let X=typeof $;return X==="object"?$===null?"null":"object":X==="function"?"object":X},a6={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},sR={...a6,function:"a function"};class eR extends Error{}var S$=($)=>l8($,eR),l8=($,X=Error)=>{throw new X($)};class i3 extends Error{name="ParseError"}var f=($)=>l8($,i3),l1=($)=>` ${$}`;var M$=($,X)=>{let Y={},U=Array.isArray($),G=!1;for(let[z,W]of Object.entries($).entries()){let Q=U?X(z,W[1]):X(...W,z);G||=typeof Q[0]==="number";let Z=Array.isArray(Q[0])||Q.length===0?Q:[Q];for(let[H,V]of Z)if(typeof H==="object")Y[H.group]=P$(Y[H.group],V);else Y[H]=V}return G?Object.values(Y):Y};var aD=Object.entries;var u4=($,X)=>($ in X),A9=($,X)=>(X in $);class sD{constructor($){Object.assign(this,$)}}var $T=class{};class o3 extends $T{}var hf=($,X)=>{let Y={},U={},G;for(G in $)if(G in X)Y[G]=$[G];else U[G]=$[G];return[Y,U]};var XT=($,X)=>hf($,X)[1],F0=($)=>Object.keys($).length===0,r8=($)=>[...Object.entries($),...Object.getOwnPropertySymbols($).map((X)=>[X,$[X]])],YT=($,X)=>Object.defineProperties($,Object.getOwnPropertyDescriptors(X)),GT=($)=>{let X=Object.keys($).sort(),Y={};for(let U=0;U<X.length;U++)Y[X[U]]=$[X[U]];return Y};var F1=l1("represents an uninitialized value"),UT=($)=>Object.values($).filter((X)=>{if(typeof X==="number")return!0;return typeof $[X]!=="number"});var eD={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},$E=globalThis.File??Blob,XE={ArrayBuffer,Blob,File:$E,FormData,Headers,Request,Response,URL},gf={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},i8={...eD,...XE,...gf,String,Number,Boolean},n3=($)=>{let X=Object.getPrototypeOf($);while(X?.constructor&&(!u4(X.constructor.name,i8)||!($ instanceof i8[X.constructor.name])))X=Object.getPrototypeOf(X);let Y=X?.constructor?.name;if(Y===void 0||Y==="Object")return;return Y},t3=($)=>typeof $==="object"&&$!==null?n3($)??"object":m4($);var o$=Array.isArray,yf={Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},mf={ArrayBuffer:"an ArrayBuffer instance",Blob:"a Blob instance",File:"a File instance",FormData:"a FormData instance",Headers:"a Headers instance",Request:"a Request instance",Response:"a Response instance",URL:"a URL instance"},uf={Int8Array:"an Int8Array",Uint8Array:"a Uint8Array",Uint8ClampedArray:"a Uint8ClampedArray",Int16Array:"an Int16Array",Uint16Array:"a Uint16Array",Int32Array:"an Int32Array",Uint32Array:"a Uint32Array",Float32Array:"a Float32Array",Float64Array:"a Float64Array",BigInt64Array:"a BigInt64Array",BigUint64Array:"a BigUint64Array"},zT={...yf,...mf,...uf},a3=($)=>{let X=Object($).name??null;return X&&u4(X,i8)&&i8[X]===$?X:null};var YE=($,X)=>{let Y=$.prototype;while(Y!==null){if(Y===X.prototype)return!0;Y=Object.getPrototypeOf(Y)}return!1};var WT=($)=>QT($,new Map),QT=($,X)=>{if(typeof $!=="object"||$===null)return $;if(X?.has($))return X.get($);let Y=a3($.constructor);if(Y==="Date")return new Date($.getTime());if(Y&&Y!=="Array")return $;let U=Array.isArray($)?$.slice():Object.create(Object.getPrototypeOf($)),G=Object.getOwnPropertyDescriptors($);if(X){X.set($,U);for(let z in G){let W=G[z];if("get"in W||"set"in W)continue;W.value=QT(W.value,X)}}return Object.defineProperties(U,G),U};var cf=($)=>{let X=F1;return()=>X===F1?X=$():X},u2=($)=>typeof $==="function"&&$.length===0;var ZT=class extends Function{constructor(...$){let X=$.slice(0,-1),Y=$.at(-1);try{super(...X,Y)}catch(U){return S$(`Encountered an unexpected error while compiling your definition:
|
|
155
|
+
`;await X.execute(R`CREATE SCHEMA IF NOT EXISTS ${R.identifier(G)}`),await X.execute(z);let Q=(await X.all(R`select id, hash, created_at from ${R.identifier(G)}.${R.identifier(U)} order by created_at desc limit 1`))[0];await X.transaction(async(Z)=>{for await(let H of $)if(!Q||Number(Q.created_at)<H.folderMillis){for(let V of H.sql)await Z.execute(R.raw(V));await Z.execute(R`insert into ${R.identifier(G)}.${R.identifier(U)} ("hash", "created_at") values(${H.hash}, ${H.folderMillis})`)}})}escapeName($){return`"${$}"`}escapeParam($){return`$${$+1}`}escapeString($){return`'${$.replace(/'/g,"''")}'`}buildWithCTE($){if(!$?.length)return;let X=[R`with `];for(let[Y,U]of $.entries())if(X.push(R`${R.identifier(U._.alias)} as (${U._.sql})`),Y<$.length-1)X.push(R`, `);return X.push(R` `),R.join(X)}buildDeleteQuery({table:$,where:X,returning:Y,withList:U}){let G=this.buildWithCTE(U),z=Y?R` returning ${this.buildSelection(Y,{isSingleTable:!0})}`:void 0,W=X?R` where ${X}`:void 0;return R`${G}delete from ${$}${W}${z}`}buildUpdateSet($,X){let Y=$[t.Symbol.Columns],U=Object.keys(Y).filter((z)=>X[z]!==void 0||Y[z]?.onUpdateFn!==void 0),G=U.length;return R.join(U.flatMap((z,W)=>{let Q=Y[z],Z=X[z]??R.param(Q.onUpdateFn(),Q),H=R`${R.identifier(this.casing.getColumnCasing(Q))} = ${Z}`;if(W<G-1)return[H,R.raw(", ")];return[H]}))}buildUpdateQuery({table:$,set:X,where:Y,returning:U,withList:G,from:z,joins:W}){let Q=this.buildWithCTE(G),Z=$[y4.Symbol.Name],H=$[y4.Symbol.Schema],V=$[y4.Symbol.OriginalName],O=Z===V?void 0:Z,w=R`${H?R`${R.identifier(H)}.`:void 0}${R.identifier(V)}${O&&R` ${R.identifier(O)}`}`,D=this.buildUpdateSet($,X),E=z&&R.join([R.raw(" from "),this.buildFromTable(z)]),F=this.buildJoins(W),J=U?R` returning ${this.buildSelection(U,{isSingleTable:!z})}`:void 0,A=Y?R` where ${Y}`:void 0;return R`${Q}update ${w} set ${D}${E}${F}${A}${J}`}buildSelection($,{isSingleTable:X=!1}={}){let Y=$.length,U=$.flatMap(({field:G},z)=>{let W=[];if(b(G,$$.Aliased)&&G.isSelectionField)W.push(R.identifier(G.fieldAlias));else if(b(G,$$.Aliased)||b(G,$$)){let Q=b(G,$$.Aliased)?G.sql:G;if(X)W.push(new $$(Q.queryChunks.map((Z)=>{if(b(Z,i))return R.identifier(this.casing.getColumnCasing(Z));return Z})));else W.push(Q);if(b(G,$$.Aliased))W.push(R` as ${R.identifier(G.fieldAlias)}`)}else if(b(G,r$))if(X)W.push(R.identifier(this.casing.getColumnCasing(G)));else W.push(G);if(z<Y-1)W.push(R`, `);return W});return R.join(U)}buildJoins($){if(!$||$.length===0)return;let X=[];for(let[Y,U]of $.entries()){if(Y===0)X.push(R` `);let G=U.table,z=U.lateral?R` lateral`:void 0,W=U.on?R` on ${U.on}`:void 0;if(b(G,y4)){let Q=G[y4.Symbol.Name],Z=G[y4.Symbol.Schema],H=G[y4.Symbol.OriginalName],V=Q===H?void 0:U.alias;X.push(R`${R.raw(U.joinType)} join${z} ${Z?R`${R.identifier(Z)}.`:void 0}${R.identifier(H)}${V&&R` ${R.identifier(V)}`}${W}`)}else if(b(G,n6)){let Q=G[$4].name,Z=G[$4].schema,H=G[$4].originalName,V=Q===H?void 0:U.alias;X.push(R`${R.raw(U.joinType)} join${z} ${Z?R`${R.identifier(Z)}.`:void 0}${R.identifier(H)}${V&&R` ${R.identifier(V)}`}${W}`)}else X.push(R`${R.raw(U.joinType)} join${z} ${G}${W}`);if(Y<$.length-1)X.push(R` `)}return R.join(X)}buildFromTable($){if(b($,t)&&$[t.Symbol.IsAlias]){let X=R`${R.identifier($[t.Symbol.OriginalName])}`;if($[t.Symbol.Schema])X=R`${R.identifier($[t.Symbol.Schema])}.${X}`;return R`${X} ${R.identifier($[t.Symbol.Name])}`}return $}buildSelectQuery({withList:$,fields:X,fieldsFlat:Y,where:U,having:G,table:z,joins:W,orderBy:Q,groupBy:Z,limit:H,offset:V,lockingClause:O,distinct:w,setOperators:D}){let E=Y??C1(X);for(let W$ of E)if(b(W$.field,r$)&&i4(W$.field.table)!==(b(z,R4)?z._.alias:b(z,u3)?z[$4].name:b(z,$$)?void 0:i4(z))&&!((L$)=>W?.some(({alias:b$})=>b$===(L$[t.Symbol.IsAlias]?i4(L$):L$[t.Symbol.BaseName])))(W$.field.table)){let L$=i4(W$.field.table);throw new Error(`Your "${W$.path.join("->")}" field references a column "${L$}"."${W$.field.name}", but the table "${L$}" is not part of the query! Did you forget to join it?`)}let F=!W||W.length===0,J=this.buildWithCTE($),A;if(w)A=w===!0?R` distinct`:R` distinct on (${R.join(w.on,R`, `)})`;let L=this.buildSelection(E,{isSingleTable:F}),T=this.buildFromTable(z),q=this.buildJoins(W),v=U?R` where ${U}`:void 0,I=G?R` having ${G}`:void 0,S;if(Q&&Q.length>0)S=R` order by ${R.join(Q,R`, `)}`;let y;if(Z&&Z.length>0)y=R` group by ${R.join(Z,R`, `)}`;let r=typeof H==="object"||typeof H==="number"&&H>=0?R` limit ${H}`:void 0,j=V?R` offset ${V}`:void 0,X$=R.empty();if(O){let W$=R` for ${R.raw(O.strength)}`;if(O.config.of)W$.append(R` of ${R.join(Array.isArray(O.config.of)?O.config.of:[O.config.of],R`, `)}`);if(O.config.noWait)W$.append(R` nowait`);else if(O.config.skipLocked)W$.append(R` skip locked`);X$.append(W$)}let l=R`${J}select${A} ${L} from ${T}${q}${v}${y}${I}${S}${r}${j}${X$}`;if(D.length>0)return this.buildSetOperations(l,D);return l}buildSetOperations($,X){let[Y,...U]=X;if(!Y)throw new Error("Cannot pass undefined values to any set operator");if(U.length===0)return this.buildSetOperationQuery({leftSelect:$,setOperator:Y});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:$,setOperator:Y}),U)}buildSetOperationQuery({leftSelect:$,setOperator:{type:X,isAll:Y,rightSelect:U,limit:G,orderBy:z,offset:W}}){let Q=R`(${$.getSQL()}) `,Z=R`(${U.getSQL()})`,H;if(z&&z.length>0){let D=[];for(let E of z)if(b(E,i))D.push(R.identifier(E.name));else if(b(E,$$)){for(let F=0;F<E.queryChunks.length;F++){let J=E.queryChunks[F];if(b(J,i))E.queryChunks[F]=R.identifier(J.name)}D.push(R`${E}`)}else D.push(R`${E}`);H=R` order by ${R.join(D,R`, `)} `}let V=typeof G==="object"||typeof G==="number"&&G>=0?R` limit ${G}`:void 0,O=R.raw(`${X} ${Y?"all ":""}`),w=W?R` offset ${W}`:void 0;return R`${Q}${O}${Z}${H}${V}${w}`}buildInsertQuery({table:$,values:X,onConflict:Y,returning:U,withList:G,select:z,overridingSystemValue_:W}){let Q=[],Z=$[t.Symbol.Columns],H=Object.entries(Z).filter(([J,A])=>!A.shouldDisableInsert()),V=H.map(([,J])=>R.identifier(this.casing.getColumnCasing(J)));if(z){let J=X;if(b(J,$$))Q.push(J);else Q.push(J.getSQL())}else{let J=X;Q.push(R.raw("values "));for(let[A,L]of J.entries()){let T=[];for(let[q,v]of H){let I=L[q];if(I===void 0||b(I,N1)&&I.value===void 0)if(v.defaultFn!==void 0){let S=v.defaultFn(),y=b(S,$$)?S:R.param(S,v);T.push(y)}else if(!v.default&&v.onUpdateFn!==void 0){let S=v.onUpdateFn(),y=b(S,$$)?S:R.param(S,v);T.push(y)}else T.push(R`default`);else T.push(I)}if(Q.push(T),A<J.length-1)Q.push(R`, `)}}let O=this.buildWithCTE(G),w=R.join(Q),D=U?R` returning ${this.buildSelection(U,{isSingleTable:!0})}`:void 0,E=Y?R` on conflict ${Y}`:void 0,F=W===!0?R`overriding system value `:void 0;return R`${O}insert into ${$} ${V} ${F}${w}${E}${D}`}buildRefreshMaterializedViewQuery({view:$,concurrently:X,withNoData:Y}){let U=X?R` concurrently`:void 0,G=Y?R` with no data`:void 0;return R`refresh materialized view${U} ${$}${G}`}prepareTyping($){if(b($,Ez)||b($,Dz))return"json";else if(b($,Nz))return"decimal";else if(b($,Fz))return"time";else if(b($,Mz)||b($,Jz))return"timestamp";else if(b($,Oz)||b($,wz))return"date";else if(b($,Az))return"uuid";else return"none"}sqlToQuery($,X){return $.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:X})}buildRelationalQueryWithoutPK({fullSchema:$,schema:X,tableNamesMap:Y,table:U,tableConfig:G,queryConfig:z,tableAlias:W,nestedQueryRelation:Q,joinOn:Z}){let H=[],V,O,w=[],D,E=[];if(z===!0)H=Object.entries(G.columns).map(([A,L])=>({dbKey:L.name,tsKey:A,field:E0(L,W),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let J=Object.fromEntries(Object.entries(G.columns).map(([I,S])=>[I,E0(S,W)]));if(z.where){let I=typeof z.where==="function"?z.where(J,NR()):z.where;D=I&&j3(I,W)}let A=[],L=[];if(z.columns){let I=!1;for(let[S,y]of Object.entries(z.columns)){if(y===void 0)continue;if(S in G.columns){if(!I&&y===!0)I=!0;L.push(S)}}if(L.length>0)L=I?L.filter((S)=>z.columns?.[S]===!0):Object.keys(G.columns).filter((S)=>!L.includes(S))}else L=Object.keys(G.columns);for(let I of L){let S=G.columns[I];A.push({tsKey:I,value:S})}let T=[];if(z.with)T=Object.entries(z.with).filter((I)=>!!I[1]).map(([I,S])=>({tsKey:I,queryConfig:S,relation:G.relations[I]}));let q;if(z.extras){q=typeof z.extras==="function"?z.extras(J,{sql:R}):z.extras;for(let[I,S]of Object.entries(q))A.push({tsKey:I,value:OD(S,W)})}for(let{tsKey:I,value:S}of A)H.push({dbKey:b(S,$$.Aliased)?S.fieldAlias:G.columns[I].name,tsKey:I,field:b(S,r$)?E0(S,W):S,relationTableTsKey:void 0,isJson:!1,selection:[]});let v=typeof z.orderBy==="function"?z.orderBy(J,FR()):z.orderBy??[];if(!Array.isArray(v))v=[v];w=v.map((I)=>{if(b(I,r$))return E0(I,W);return j3(I,W)}),V=z.limit,O=z.offset;for(let{tsKey:I,queryConfig:S,relation:y}of T){let r=JR(X,Y,y),j=y8(y.referencedTable),X$=Y[j],l=`${W}_${I}`,W$=k3(...r.fields.map((L4,X6)=>Lz(E0(r.references[X6],l),E0(L4,W)))),L$=this.buildRelationalQueryWithoutPK({fullSchema:$,schema:X,tableNamesMap:Y,table:$[X$],tableConfig:X[X$],queryConfig:b(y,g2)?S===!0?{limit:1}:{...S,limit:1}:S,tableAlias:l,joinOn:W$,nestedQueryRelation:y}),b$=R`${R.identifier(l)}.${R.identifier("data")}`.as(I);E.push({on:R`true`,table:new R4(L$.sql,{},l),alias:l,joinType:"left",lateral:!0}),H.push({dbKey:I,tsKey:I,field:b$,relationTableTsKey:X$,isJson:!0,selection:L$.selection})}}if(H.length===0)throw new Hz({message:`No fields selected for table "${G.tsName}" ("${W}")`});let F;if(D=k3(Z,D),Q){let J=R`json_build_array(${R.join(H.map(({field:T,tsKey:q,isJson:v})=>v?R`${R.identifier(`${W}_${q}`)}.${R.identifier("data")}`:b(T,$$.Aliased)?T.sql:T),R`, `)})`;if(b(Q,b3))J=R`coalesce(json_agg(${J}${w.length>0?R` order by ${R.join(w,R`, `)}`:void 0}), '[]'::json)`;let A=[{dbKey:"data",tsKey:"data",field:J.as("data"),isJson:!0,relationTableTsKey:G.tsName,selection:H}];if(V!==void 0||O!==void 0||w.length>0)F=this.buildSelectQuery({table:Zz(U,W),fields:{},fieldsFlat:[{path:[],field:R.raw("*")}],where:D,limit:V,offset:O,orderBy:w,setOperators:[]}),D=void 0,V=void 0,O=void 0,w=[];else F=Zz(U,W);F=this.buildSelectQuery({table:b(F,y4)?F:new R4(F,{},W),fields:{},fieldsFlat:A.map(({field:T})=>({path:[],field:b(T,r$)?E0(T,W):T})),joins:E,where:D,limit:V,offset:O,orderBy:w,setOperators:[]})}else F=this.buildSelectQuery({table:Zz(U,W),fields:{},fieldsFlat:H.map(({field:J})=>({path:[],field:b(J,r$)?E0(J,W):J})),joins:E,where:D,limit:V,offset:O,orderBy:w,setOperators:[]});return{tableTsKey:G.tsName,sql:F,selection:H}}}class gD{static[_]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class b6{static[_]="PgSelectBuilder";fields;session;dialect;withList=[];distinct;constructor($){if(this.fields=$.fields,this.session=$.session,this.dialect=$.dialect,$.withList)this.withList=$.withList;this.distinct=$.distinct}authToken;setToken($){return this.authToken=$,this}from($){let X=!!this.fields,Y=$,U;if(this.fields)U=this.fields;else if(b(Y,R4))U=Object.fromEntries(Object.keys(Y._.selectedFields).map((G)=>[G,Y[G]]));else if(b(Y,u3))U=Y[$4].selectedFields;else if(b(Y,$$))U={};else U=oK(Y);return new yD({table:Y,fields:U,isPartialSelect:X,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}class cR extends gD{static[_]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:$,fields:X,isPartialSelect:Y,session:U,dialect:G,withList:z,distinct:W}){super();this.config={withList:z,table:$,fields:{...X},distinct:W,setOperators:[]},this.isPartialSelect=Y,this.session=U,this.dialect=G,this._={selectedFields:X,config:this.config},this.tableName=s0($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let Q of l1($))this.usedTables.add(Q)}getUsedTables(){return[...this.usedTables]}createJoin($,X){return(Y,U)=>{let G=this.tableName,z=s0(Y);for(let W of l1(Y))this.usedTables.add(W);if(typeof z==="string"&&this.config.joins?.some((W)=>W.alias===z))throw new Error(`Alias "${z}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof G==="string")this.config.fields={[G]:this.config.fields};if(typeof z==="string"&&!b(Y,$$)){let W=b(Y,R4)?Y._.selectedFields:b(Y,n6)?Y[$4].selectedFields:Y[t.Symbol.Columns];this.config.fields[z]=W}}if(typeof U==="function")U=U(new Proxy(this.config.fields,new A4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:U,table:Y,joinType:$,alias:z,lateral:X}),typeof z==="string")switch($){case"left":{this.joinsNotNullableMap[z]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([W])=>[W,!1])),this.joinsNotNullableMap[z]=!0;break}case"cross":case"inner":{this.joinsNotNullableMap[z]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([W])=>[W,!1])),this.joinsNotNullableMap[z]=!1;break}}return this}}leftJoin=this.createJoin("left",!1);leftJoinLateral=this.createJoin("left",!0);rightJoin=this.createJoin("right",!1);innerJoin=this.createJoin("inner",!1);innerJoinLateral=this.createJoin("inner",!0);fullJoin=this.createJoin("full",!1);crossJoin=this.createJoin("cross",!1);crossJoinLateral=this.createJoin("cross",!0);createSetOperator($,X){return(Y)=>{let U=typeof Y==="function"?Y(jf()):Y;if(!P3(this.getSelectedFields(),U.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:$,isAll:X,rightSelect:U}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);intersectAll=this.createSetOperator("intersect",!0);except=this.createSetOperator("except",!1);exceptAll=this.createSetOperator("except",!0);addSetOperators($){return this.config.setOperators.push(...$),this}where($){if(typeof $==="function")$=$(new Proxy(this.config.fields,new A4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=$,this}having($){if(typeof $==="function")$=$(new Proxy(this.config.fields,new A4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=$,this}groupBy(...$){if(typeof $[0]==="function"){let X=$[0](new Proxy(this.config.fields,new A4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(X)?X:[X]}else this.config.groupBy=$;return this}orderBy(...$){if(typeof $[0]==="function"){let X=$[0](new Proxy(this.config.fields,new A4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Y=Array.isArray(X)?X:[X];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=Y;else this.config.orderBy=Y}else{let X=$;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=X;else this.config.orderBy=X}return this}limit($){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=$;else this.config.limit=$;return this}offset($){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=$;else this.config.offset=$;return this}for($,X={}){return this.config.lockingClause={strength:$,config:X},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}as($){let X=[];if(X.push(...l1(this.config.table)),this.config.joins)for(let Y of this.config.joins)X.push(...l1(Y.table));return new Proxy(new R4(this.getSQL(),this.config.fields,$,!1,[...new Set(X)]),new A4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new A4({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}$withCache($){return this.cacheConfig=$===void 0?{config:{},enable:!0,autoInvalidate:!0}:$===!1?{enable:!1}:{enable:!0,autoInvalidate:!0,...$},this}}class yD extends cR{static[_]="PgSelect";_prepare($){let{session:X,config:Y,dialect:U,joinsNotNullableMap:G,authToken:z,cacheConfig:W,usedTables:Q}=this;if(!X)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");let{fields:Z}=Y;return i$.startActiveSpan("drizzle.prepareQuery",()=>{let H=C1(Z),V=X.prepareQuery(U.sqlToQuery(this.getSQL()),H,$,!0,void 0,{type:"select",tables:[...Q]},W);return V.joinsNotNullableMap=G,V.setToken(z)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return i$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})}}iK(yD,[k6]);function M9($,X){return(Y,U,...G)=>{let z=[U,...G].map((W)=>({type:$,isAll:X,rightSelect:W}));for(let W of z)if(!P3(Y.getSelectedFields(),W.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return Y.addSetOperators(z)}}var jf=()=>({union:Pf,unionAll:If,intersect:xf,intersectAll:Sf,except:kf,exceptAll:bf}),Pf=M9("union",!1),If=M9("union",!0),xf=M9("intersect",!1),Sf=M9("intersect",!0),kf=M9("except",!1),bf=M9("except",!0);class c3{static[_]="PgQueryBuilder";dialect;dialectConfig;constructor($){this.dialect=b($,d8)?$:void 0,this.dialectConfig=b($,d8)?void 0:$}$with=($,X)=>{let Y=this;return{as:(G)=>{if(typeof G==="function")G=G(Y);return new Proxy(new v3(G.getSQL(),X??("getSelectedFields"in G?G.getSelectedFields()??{}:{}),$,!0),new A4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...$){let X=this;function Y(z){return new b6({fields:z??void 0,session:void 0,dialect:X.getDialect(),withList:$})}function U(z){return new b6({fields:z??void 0,session:void 0,dialect:X.getDialect(),distinct:!0})}function G(z,W){return new b6({fields:W??void 0,session:void 0,dialect:X.getDialect(),distinct:{on:z}})}return{select:Y,selectDistinct:U,selectDistinctOn:G}}select($){return new b6({fields:$??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct($){return new b6({fields:$??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn($,X){return new b6({fields:X??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:$}})}getDialect(){if(!this.dialect)this.dialect=new d8(this.dialectConfig);return this.dialect}}function l1($){if(b($,y4))return[$[g8]?`${$[g8]}.${$[t.Symbol.BaseName]}`:$[t.Symbol.BaseName]];if(b($,R4))return $._.usedTables??[];if(b($,$$))return $.usedTables??[];return[]}class bz extends k6{constructor($,X,Y,U){super();this.session=X,this.dialect=Y,this.config={table:$,withList:U}}static[_]="PgDelete";config;cacheConfig;where($){return this.config.where=$,this}returning($=this.config.table[t.Symbol.Columns]){return this.config.returningFields=$,this.config.returning=C1($),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}_prepare($){return i$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"delete",tables:l1(this.config.table)},this.cacheConfig)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return i$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new A4({alias:i4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class fz{constructor($,X,Y,U,G){this.table=$,this.session=X,this.dialect=Y,this.withList=U,this.overridingSystemValue_=G}static[_]="PgInsertBuilder";authToken;setToken($){return this.authToken=$,this}overridingSystemValue(){return this.overridingSystemValue_=!0,this}values($){if($=Array.isArray($)?$:[$],$.length===0)throw new Error("values() must be called with at least one value");let X=$.map((Y)=>{let U={},G=this.table[t.Symbol.Columns];for(let z of Object.keys(Y)){let W=Y[z];U[z]=b(W,$$)?W:new N1(W,G[z])}return U});return new mD(this.table,X,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select($){let X=typeof $==="function"?$(new c3):$;if(!b(X,$$)&&!P3(this.table[Wz],X._.selectedFields))throw new Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new mD(this.table,X,this.session,this.dialect,this.withList,!0)}}class mD extends k6{constructor($,X,Y,U,G,z,W){super();this.session=Y,this.dialect=U,this.config={table:$,values:X,withList:G,select:z,overridingSystemValue_:W}}static[_]="PgInsert";config;cacheConfig;returning($=this.config.table[t.Symbol.Columns]){return this.config.returningFields=$,this.config.returning=C1($),this}onConflictDoNothing($={}){if($.target===void 0)this.config.onConflict=R`do nothing`;else{let X="";X=Array.isArray($.target)?$.target.map((U)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(U))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing($.target));let Y=$.where?R` where ${$.where}`:void 0;this.config.onConflict=R`(${R.raw(X)})${Y} do nothing`}return this}onConflictDoUpdate($){if($.where&&($.targetWhere||$.setWhere))throw new Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');let X=$.where?R` where ${$.where}`:void 0,Y=$.targetWhere?R` where ${$.targetWhere}`:void 0,U=$.setWhere?R` where ${$.setWhere}`:void 0,G=this.dialect.buildUpdateSet(this.config.table,Vz(this.config.table,$.set)),z="";return z=Array.isArray($.target)?$.target.map((W)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(W))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing($.target)),this.config.onConflict=R`(${R.raw(z)})${Y} do update set ${G}${X}${U}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}_prepare($){return i$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"insert",tables:l1(this.config.table)},this.cacheConfig)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return i$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new A4({alias:i4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class uD extends k6{constructor($,X,Y){super();this.session=X,this.dialect=Y,this.config={view:$}}static[_]="PgRefreshMaterializedView";config;concurrently(){if(this.config.withNoData!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.concurrently=!0,this}withNoData(){if(this.config.concurrently!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.withNoData=!0,this}getSQL(){return this.dialect.buildRefreshMaterializedViewQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}_prepare($){return i$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,$,!0)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return i$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})}}class hz{constructor($,X,Y,U){this.table=$,this.session=X,this.dialect=Y,this.withList=U}static[_]="PgUpdateBuilder";authToken;setToken($){return this.authToken=$,this}set($){return new pR(this.table,Vz(this.table,$),this.session,this.dialect,this.withList).setToken(this.authToken)}}class pR extends k6{constructor($,X,Y,U,G){super();this.session=Y,this.dialect=U,this.config={set:X,table:$,withList:G,joins:[]},this.tableName=s0($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{}}static[_]="PgUpdate";config;tableName;joinsNotNullableMap;cacheConfig;from($){let X=$,Y=s0(X);if(typeof Y==="string")this.joinsNotNullableMap[Y]=!0;return this.config.from=X,this}getTableLikeFields($){if(b($,y4))return $[t.Symbol.Columns];else if(b($,R4))return $._.selectedFields;return $[$4].selectedFields}createJoin($){return(X,Y)=>{let U=s0(X);if(typeof U==="string"&&this.config.joins.some((G)=>G.alias===U))throw new Error(`Alias "${U}" is already used in this query`);if(typeof Y==="function"){let G=this.config.from&&!b(this.config.from,$$)?this.getTableLikeFields(this.config.from):void 0;Y=Y(new Proxy(this.config.table[t.Symbol.Columns],new A4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),G&&new Proxy(G,new A4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}if(this.config.joins.push({on:Y,table:X,joinType:$,alias:U}),typeof U==="string")switch($){case"left":{this.joinsNotNullableMap[U]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([G])=>[G,!1])),this.joinsNotNullableMap[U]=!0;break}case"inner":{this.joinsNotNullableMap[U]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([G])=>[G,!1])),this.joinsNotNullableMap[U]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where($){return this.config.where=$,this}returning($){if(!$){if($=Object.assign({},this.config.table[t.Symbol.Columns]),this.config.from){let X=s0(this.config.from);if(typeof X==="string"&&this.config.from&&!b(this.config.from,$$)){let Y=this.getTableLikeFields(this.config.from);$[X]=Y}for(let Y of this.config.joins){let U=s0(Y.table);if(typeof U==="string"&&!b(Y.table,$$)){let G=this.getTableLikeFields(Y.table);$[U]=G}}}}return this.config.returningFields=$,this.config.returning=C1($),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}_prepare($){let X=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"insert",tables:l1(this.config.table)},this.cacheConfig);return X.joinsNotNullableMap=this.joinsNotNullableMap,X}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return this._prepare().execute($,this.authToken)};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new A4({alias:i4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class p3 extends $${constructor($){super(p3.buildEmbeddedCount($.source,$.filters).queryChunks);this.params=$,this.mapWith(Number),this.session=$.session,this.sql=p3.buildCount($.source,$.filters)}sql;token;static[_]="PgCountBuilder";[Symbol.toStringTag]="PgCountBuilder";session;static buildEmbeddedCount($,X){return R`(select count(*) from ${$}${R.raw(" where ").if(X)}${X})`}static buildCount($,X){return R`select count(*) as count from ${$}${R.raw(" where ").if(X)}${X};`}setToken($){return this.token=$,this}then($,X){return Promise.resolve(this.session.count(this.sql,this.token)).then($,X)}catch($){return this.then(void 0,$)}finally($){return this.then((X)=>{return $?.(),X},(X)=>{throw $?.(),X})}}class pD{constructor($,X,Y,U,G,z,W){this.fullSchema=$,this.schema=X,this.tableNamesMap=Y,this.table=U,this.tableConfig=G,this.dialect=z,this.session=W}static[_]="PgRelationalQueryBuilder";findMany($){return new cD(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?$:{},"many")}findFirst($){return new cD(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?{...$,limit:1}:{limit:1},"first")}}class cD extends k6{constructor($,X,Y,U,G,z,W,Q,Z){super();this.fullSchema=$,this.schema=X,this.tableNamesMap=Y,this.table=U,this.tableConfig=G,this.dialect=z,this.session=W,this.config=Q,this.mode=Z}static[_]="PgRelationalQuery";_prepare($){return i$.startActiveSpan("drizzle.prepareQuery",()=>{let{query:X,builtQuery:Y}=this._toSQL();return this.session.prepareQuery(Y,void 0,$,!0,(U,G)=>{let z=U.map((W)=>_z(this.schema,this.tableConfig,W,X.selection,G));if(this.mode==="first")return z[0];return z})})}prepare($){return this._prepare($)}_getQuery(){return this.dialect.buildRelationalQueryWithoutPK({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName})}getSQL(){return this._getQuery().sql}_toSQL(){let $=this._getQuery(),X=this.dialect.sqlToQuery($.sql);return{query:$,builtQuery:X}}toSQL(){return this._toSQL().builtQuery}authToken;setToken($){return this.authToken=$,this}execute(){return i$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(void 0,this.authToken)})}}class dD extends k6{constructor($,X,Y,U){super();this.execute=$,this.sql=X,this.query=Y,this.mapBatchResult=U}static[_]="PgRaw";getSQL(){return this.sql}getQuery(){return this.query}mapResult($,X){return X?this.mapBatchResult($):$}_prepare(){return this}isResponseInArrayMode(){return!1}}class d3{constructor($,X,Y){if(this.dialect=$,this.session=X,this._=Y?{schema:Y.schema,fullSchema:Y.fullSchema,tableNamesMap:Y.tableNamesMap,session:X}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:X},this.query={},this._.schema)for(let[U,G]of Object.entries(this._.schema))this.query[U]=new pD(Y.fullSchema,this._.schema,this._.tableNamesMap,Y.fullSchema[U],G,$,X);this.$cache={invalidate:async(U)=>{}}}static[_]="PgDatabase";query;$with=($,X)=>{let Y=this;return{as:(G)=>{if(typeof G==="function")G=G(new c3(Y.dialect));return new Proxy(new v3(G.getSQL(),X??("getSelectedFields"in G?G.getSelectedFields()??{}:{}),$,!0),new A4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count($,X){return new p3({source:$,filters:X,session:this.session})}$cache;with(...$){let X=this;function Y(Z){return new b6({fields:Z??void 0,session:X.session,dialect:X.dialect,withList:$})}function U(Z){return new b6({fields:Z??void 0,session:X.session,dialect:X.dialect,withList:$,distinct:!0})}function G(Z,H){return new b6({fields:H??void 0,session:X.session,dialect:X.dialect,withList:$,distinct:{on:Z}})}function z(Z){return new hz(Z,X.session,X.dialect,$)}function W(Z){return new fz(Z,X.session,X.dialect,$)}function Q(Z){return new bz(Z,X.session,X.dialect,$)}return{select:Y,selectDistinct:U,selectDistinctOn:G,update:z,insert:W,delete:Q}}select($){return new b6({fields:$??void 0,session:this.session,dialect:this.dialect})}selectDistinct($){return new b6({fields:$??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn($,X){return new b6({fields:X??void 0,session:this.session,dialect:this.dialect,distinct:{on:$}})}update($){return new hz($,this.session,this.dialect)}insert($){return new fz($,this.session,this.dialect)}delete($){return new bz($,this.session,this.dialect)}refreshMaterializedView($){return new uD($,this.session,this.dialect)}authToken;execute($){let X=typeof $==="string"?R.raw($):$.getSQL(),Y=this.dialect.sqlToQuery(X),U=this.session.prepareQuery(Y,void 0,void 0,!1);return new dD(()=>U.execute(void 0,this.authToken),X,Y,(G)=>U.mapResult(G,!0))}transaction($,X){return this.session.transaction($,X)}}class dR{static[_]="Cache"}class l3 extends dR{strategy(){return"all"}static[_]="NoopCache";async get($){return}async put($,X,Y,U){}async onMutate($){}}async function lD($,X){let Y=`${$}-${JSON.stringify(X)}`,G=new TextEncoder().encode(Y),z=await crypto.subtle.digest("SHA-256",G);return[...new Uint8Array(z)].map((Z)=>Z.toString(16).padStart(2,"0")).join("")}class rD{constructor($,X,Y,U){if(this.query=$,this.cache=X,this.queryMetadata=Y,this.cacheConfig=U,X&&X.strategy()==="all"&&U===void 0)this.cacheConfig={enable:!0,autoInvalidate:!0};if(!this.cacheConfig?.enable)this.cacheConfig=void 0}authToken;getQuery(){return this.query}mapResult($,X){return $}setToken($){return this.authToken=$,this}static[_]="PgPreparedQuery";joinsNotNullableMap;async queryWithCache($,X,Y){if(this.cache===void 0||b(this.cache,l3)||this.queryMetadata===void 0)try{return await Y()}catch(U){throw new a0($,X,U)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await Y()}catch(U){throw new a0($,X,U)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[U]=await Promise.all([Y(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return U}catch(U){throw new a0($,X,U)}if(!this.cacheConfig)try{return await Y()}catch(U){throw new a0($,X,U)}if(this.queryMetadata.type==="select"){let U=await this.cache.get(this.cacheConfig.tag??await lD($,X),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(U===void 0){let G;try{G=await Y()}catch(z){throw new a0($,X,z)}return await this.cache.put(this.cacheConfig.tag??await lD($,X),G,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),G}return U}try{return await Y()}catch(U){throw new a0($,X,U)}}}class iD{constructor($){this.dialect=$}static[_]="PgSession";execute($,X){return i$.startActiveSpan("drizzle.operation",()=>{return i$.startActiveSpan("drizzle.prepareQuery",()=>{return this.prepareQuery(this.dialect.sqlToQuery($),void 0,void 0,!1)}).setToken(X).execute(void 0,X)})}all($){return this.prepareQuery(this.dialect.sqlToQuery($),void 0,void 0,!1).all()}async count($,X){let Y=await this.execute($,X);return Number(Y[0].count)}}class oD extends d3{constructor($,X,Y,U=0){super($,X,Y);this.schema=Y,this.nestedIndex=U}static[_]="PgTransaction";rollback(){throw new wD}getTransactionConfigSQL($){let X=[];if($.isolationLevel)X.push(`isolation level ${$.isolationLevel}`);if($.accessMode)X.push($.accessMode);if(typeof $.deferrable==="boolean")X.push($.deferrable?"deferrable":"not deferrable");return R.raw(X.join(" "))}setTransaction($){return this.session.execute(R`set transaction ${this.getTransactionConfigSQL($)}`)}}class lR extends rD{constructor($,X,Y,U,G,z,W,Q,Z,H){super({sql:X,params:Y},G,z,W);this.client=$,this.queryString=X,this.params=Y,this.logger=U,this.fields=Q,this._isResponseInArrayMode=Z,this.customResultMapper=H}static[_]="PostgresJsPreparedQuery";async execute($={}){return i$.startActiveSpan("drizzle.execute",async(X)=>{let Y=VD(this.params,$);X?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(Y)}),this.logger.logQuery(this.queryString,Y);let{fields:U,queryString:G,client:z,joinsNotNullableMap:W,customResultMapper:Q}=this;if(!U&&!Q)return i$.startActiveSpan("drizzle.driver.execute",()=>{return this.queryWithCache(G,Y,async()=>{return await z.unsafe(G,Y)})});let Z=await i$.startActiveSpan("drizzle.driver.execute",()=>{return X?.setAttributes({"drizzle.query.text":G,"drizzle.query.params":JSON.stringify(Y)}),this.queryWithCache(G,Y,async()=>{return await z.unsafe(G,Y).values()})});return i$.startActiveSpan("drizzle.mapResponse",()=>{return Q?Q(Z):Z.map((H)=>rK(U,H,W))})})}all($={}){return i$.startActiveSpan("drizzle.execute",async(X)=>{let Y=VD(this.params,$);return X?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(Y)}),this.logger.logQuery(this.queryString,Y),i$.startActiveSpan("drizzle.driver.execute",()=>{return X?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(Y)}),this.queryWithCache(this.queryString,Y,async()=>{return this.client.unsafe(this.queryString,Y)})})})}isResponseInArrayMode(){return this._isResponseInArrayMode}}class r3 extends iD{constructor($,X,Y,U={}){super(X);this.client=$,this.schema=Y,this.options=U,this.logger=U.logger??new ED,this.cache=U.cache??new l3}static[_]="PostgresJsSession";logger;cache;prepareQuery($,X,Y,U,G,z,W){return new lR(this.client,$.sql,$.params,this.logger,this.cache,z,W,X,U,G)}query($,X){return this.logger.logQuery($,X),this.client.unsafe($,X).values()}queryObjects($,X){return this.client.unsafe($,X)}transaction($,X){return this.client.begin(async(Y)=>{let U=new r3(Y,this.dialect,this.schema,this.options),G=new nD(this.dialect,U,this.schema);if(X)await G.setTransaction(X);return $(G)})}}class nD extends oD{constructor($,X,Y,U=0){super($,X,Y,U);this.session=X}static[_]="PostgresJsTransaction";transaction($){return this.session.client.savepoint((X)=>{let Y=new r3(X,this.dialect,this.schema,this.session.options),U=new nD(this.dialect,Y,this.schema);return $(U)})}}class rR extends d3{static[_]="PostgresJsDatabase"}function J9($,X={}){let Y=(Z)=>Z;for(let Z of["1184","1082","1083","1114","1182","1185","1115","1231"])$.options.parsers[Z]=Y,$.options.serializers[Z]=Y;$.options.serializers["114"]=Y,$.options.serializers["3802"]=Y;let U=new d8({casing:X.casing}),G;if(X.logger===!0)G=new DD;else if(X.logger!==!1)G=X.logger;let z;if(X.schema){let Z=MR(X.schema,AR);z={fullSchema:X.schema,schema:Z.tables,tableNamesMap:Z.tableNamesMap}}let W=new r3($,U,z,{logger:G,cache:X.cache}),Q=new rR(U,W,z);if(Q.$client=$,Q.$cache=X.cache,Q.$cache)Q.$cache.invalidate=X.cache?.onMutate;return Q}function gz(...$){if(typeof $[0]==="string"){let X=F9($[0]);return J9(X,$[1])}if(nK($[0])){let{connection:X,client:Y,...U}=$[0];if(Y)return J9(Y,U);if(typeof X==="object"&&X.url!==void 0){let{url:z,...W}=X,Q=F9(z,W);return J9(Q,U)}let G=F9(X);return J9(G,U)}return J9($[0],$[1])}(($)=>{function X(Y){return J9({options:{parsers:{},serializers:{}}},Y)}$.mock=X})(gz||(gz={}));function iR($,X){if($ instanceof Promise)throw new Error(X)}function ff($,X){let Y={},U=[];for(let G in $){let z=$[G]["~standard"].validate(X[G]);if(iR(z,`Validation must be synchronous, but ${G} returned a Promise.`),z.issues){U.push(...z.issues.map((W)=>({...W,message:W.message,path:[G,...W.path??[]]})));continue}Y[G]=z.value}if(U.length)return{issues:U};return{value:Y}}function tD($){let X=$.runtimeEnvStrict??$.runtimeEnv??process.env;if($.emptyStringAsUndefined??!1){for(let[L,T]of Object.entries(X))if(T==="")delete X[L]}if(!!$.skipValidation)return X;let G=typeof $.client==="object"?$.client:{},z=typeof $.server==="object"?$.server:{},W=typeof $.shared==="object"?$.shared:{},Q=$.isServer??(typeof window==="undefined"||("Deno"in window)),Z=Q?{...z,...W,...G}:{...G,...W},H=$.createFinalSchema?.(Z,Q)["~standard"].validate(X)??ff(Z,X);iR(H,"Validation must be synchronous");let V=$.onValidationError??((L)=>{throw console.error("\u274C Invalid environment variables:",L),new Error("Invalid environment variables")}),O=$.onInvalidAccess??(()=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(H.issues)return V(H.issues);let w=(L)=>{if(!$.clientPrefix)return!0;return!L.startsWith($.clientPrefix)&&!(L in W)},D=(L)=>{return Q||!w(L)},E=(L)=>{return L==="__esModule"||L==="$$typeof"},F=($.extends??[]).reduce((L,T)=>{return Object.assign(L,T)},{}),J=Object.assign(F,H.value);return new Proxy(J,{get(L,T){if(typeof T!=="string")return;if(E(T))return;if(!D(T))return O(T);return Reflect.get(L,T)}})}var m2=($)=>Array.isArray($)?$:[$],oR=($,X)=>{let Y=[[],[]];for(let U of $)if(X(U))Y[0].push(U);else Y[1].push(U);return Y},yz=Array,$2=($,X)=>$.includes(X),nR=($,X=0)=>[...new Array($)].map((Y,U)=>U+X),P$=($,X,Y)=>{if($===void 0)return X===void 0?[]:Array.isArray(X)?X:[X];if(Y?.prepend)if(Array.isArray(X))$.unshift(...X);else $.unshift(X);else if(Array.isArray(X))$.push(...X);else $.push(X);return $},X2=($,X)=>{if(X===void 0||X===null)return $??[];if($===void 0||$===null)return m2(X);return $.concat(X)},tR=(...$)=>$.reduce(X2,[]),F0=($,X,Y)=>{if($===void 0)return Array.isArray(X)?X:[X];let U=Y?.isEqual??((G,z)=>G===z);for(let G of m2(X))if(!$.some((z)=>U(z,G)))$.push(G);return $},aR=($,X)=>$.reduce((Y,U)=>{let G=U[X];return Y[G]=P$(Y[G],U),Y},{}),Y2=($,X,Y)=>$.length===X.length&&$.every(Y?.isEqual?(U,G)=>Y.isEqual(U,X[G]):(U,G)=>U===X[G]);var a6=($,X)=>m4($)===X,m4=($)=>{let X=typeof $;return X==="object"?$===null?"null":"object":X==="function"?"object":X},s6={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},sR={...s6,function:"a function"};class eR extends Error{}var S$=($)=>l8($,eR),l8=($,X=Error)=>{throw new X($)};class i3 extends Error{name="ParseError"}var f=($)=>l8($,i3),r1=($)=>` ${$}`;var M$=($,X)=>{let Y={},U=Array.isArray($),G=!1;for(let[z,W]of Object.entries($).entries()){let Q=U?X(z,W[1]):X(...W,z);G||=typeof Q[0]==="number";let Z=Array.isArray(Q[0])||Q.length===0?Q:[Q];for(let[H,V]of Z)if(typeof H==="object")Y[H.group]=P$(Y[H.group],V);else Y[H]=V}return G?Object.values(Y):Y};var aD=Object.entries;var u4=($,X)=>($ in X),A9=($,X)=>(X in $);class sD{constructor($){Object.assign(this,$)}}var $T=class{};class o3 extends $T{}var hf=($,X)=>{let Y={},U={},G;for(G in $)if(G in X)Y[G]=$[G];else U[G]=$[G];return[Y,U]};var XT=($,X)=>hf($,X)[1],M0=($)=>Object.keys($).length===0,r8=($)=>[...Object.entries($),...Object.getOwnPropertySymbols($).map((X)=>[X,$[X]])],YT=($,X)=>Object.defineProperties($,Object.getOwnPropertyDescriptors(X)),GT=($)=>{let X=Object.keys($).sort(),Y={};for(let U=0;U<X.length;U++)Y[X[U]]=$[X[U]];return Y};var M1=r1("represents an uninitialized value"),UT=($)=>Object.values($).filter((X)=>{if(typeof X==="number")return!0;return typeof $[X]!=="number"});var eD={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},$E=globalThis.File??Blob,XE={ArrayBuffer,Blob,File:$E,FormData,Headers,Request,Response,URL},gf={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},i8={...eD,...XE,...gf,String,Number,Boolean},n3=($)=>{let X=Object.getPrototypeOf($);while(X?.constructor&&(!u4(X.constructor.name,i8)||!($ instanceof i8[X.constructor.name])))X=Object.getPrototypeOf(X);let Y=X?.constructor?.name;if(Y===void 0||Y==="Object")return;return Y},t3=($)=>typeof $==="object"&&$!==null?n3($)??"object":m4($);var o$=Array.isArray,yf={Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},mf={ArrayBuffer:"an ArrayBuffer instance",Blob:"a Blob instance",File:"a File instance",FormData:"a FormData instance",Headers:"a Headers instance",Request:"a Request instance",Response:"a Response instance",URL:"a URL instance"},uf={Int8Array:"an Int8Array",Uint8Array:"a Uint8Array",Uint8ClampedArray:"a Uint8ClampedArray",Int16Array:"an Int16Array",Uint16Array:"a Uint16Array",Int32Array:"an Int32Array",Uint32Array:"a Uint32Array",Float32Array:"a Float32Array",Float64Array:"a Float64Array",BigInt64Array:"a BigInt64Array",BigUint64Array:"a BigUint64Array"},zT={...yf,...mf,...uf},a3=($)=>{let X=Object($).name??null;return X&&u4(X,i8)&&i8[X]===$?X:null};var YE=($,X)=>{let Y=$.prototype;while(Y!==null){if(Y===X.prototype)return!0;Y=Object.getPrototypeOf(Y)}return!1};var WT=($)=>QT($,new Map),QT=($,X)=>{if(typeof $!=="object"||$===null)return $;if(X?.has($))return X.get($);let Y=a3($.constructor);if(Y==="Date")return new Date($.getTime());if(Y&&Y!=="Array")return $;let U=Array.isArray($)?$.slice():Object.create(Object.getPrototypeOf($)),G=Object.getOwnPropertyDescriptors($);if(X){X.set($,U);for(let z in G){let W=G[z];if("get"in W||"set"in W)continue;W.value=QT(W.value,X)}}return Object.defineProperties(U,G),U};var cf=($)=>{let X=M1;return()=>X===M1?X=$():X},u2=($)=>typeof $==="function"&&$.length===0;var ZT=class extends Function{constructor(...$){let X=$.slice(0,-1),Y=$.at(-1);try{super(...X,Y)}catch(U){return S$(`Encountered an unexpected error while compiling your definition:
|
|
156
156
|
Message: ${U}
|
|
157
157
|
Source: (${$.slice(0,-1)}) => {
|
|
158
158
|
${$.at(-1)}
|
|
159
|
-
}`)}}};class
|
|
159
|
+
}`)}}};class i1{constructor($,...[X]){return Object.assign(Object.setPrototypeOf($.bind(X?.bind??this),this.constructor.prototype),X?.attach)}}var HT=cf(()=>{try{return new Function("return false")()}catch{return!0}});var jX$=r1("brand");var VT=r1("arkInferred");var xX$=r1("args");class O6{constructor(){}}var pf=()=>{try{return((new Error().stack?.split(`
|
|
160
160
|
`)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},df=globalThis.process?.env??{},OT={fileName:pf,env:df};var wT=($)=>$[0].toUpperCase()+$.slice(1);var GE=($)=>new RegExp(lf($),typeof $==="string"?"":$.flags);var lf=($)=>{return`^(?:${typeof $==="string"?$:$.source})$`};var G2={negativeLookahead:($)=>`(?!${$})`,nonCapturingGroup:($)=>`(?:${$})`},s3="\\",c2={" ":1,"\n":1,"\t":1};var rf=/^-0\.?0*$/.source,ET=/[1-9]\d*/.source,of=/\.\d+/.source,nf=/\.\d*[1-9]/.source,NT=($)=>GE(G2.negativeLookahead(rf)+G2.nonCapturingGroup("-?"+G2.nonCapturingGroup(G2.nonCapturingGroup("0|"+ET)+G2.nonCapturingGroup($.decimalPattern)+"?")+($.allowDecimalOnly?"|"+$.decimalPattern:"")+"?")),DT=NT({decimalPattern:nf,allowDecimalOnly:!1}),tf=DT.test.bind(DT),mz=NT({decimalPattern:of,allowDecimalOnly:!0}),yX$=mz.test.bind(mz),af=/^-?\d*\.?\d*$/,sf=($)=>$.length!==0&&af.test($),e3=GE(G2.negativeLookahead("^-0$")+"-?"+G2.nonCapturingGroup(G2.nonCapturingGroup("0|"+ET))),ef=e3.test.bind(e3),UE=/^-?\d+$/,$h=UE.test.bind(UE),FT={number:"a number",bigint:"a bigint",integer:"an integer"},MT=($,X)=>`'${$}' was parsed as ${FT[X]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,Xh=($,X)=>X==="number"?tf($):ef($),Yh=($,X)=>X==="number"?Number($):Number.parseInt($),Gh=($,X)=>X==="number"?sf($):$h($),JT=($,X)=>zE($,"number",X),AT=($,X)=>zE($,"number",{...X,strict:!0}),LT=($,X)=>zE($,"integer",X),zE=($,X,Y)=>{let U=Yh($,X);if(!Number.isNaN(U)){if(Gh($,X)){if(Y?.strict)return Xh($,X)?U:f(MT($,X));return U}}return Y?.errorOnFail?f(Y?.errorOnFail===!0?`Failed to parse ${FT[X]} from '${$}'`:Y?.errorOnFail):void 0},KT=($)=>{if($[$.length-1]!=="n")return;let X=$.slice(0,-1),Y;try{Y=BigInt(X)}catch{return}if(e3.test(X))return Y;if(UE.test(X))return f(MT($,"bigint"))};var Uh="0.46.0",zh={version:Uh,filename:OT.fileName(),FileConstructor:$E},o8=zh,_T=new Map,WE=Object.create(null),$5=($)=>{let X=_T.get($);if(X)return X;let Y=Wh($);if(WE[Y])Y=`${Y}${WE[Y]++}`;else WE[Y]=1;return o8[Y]=$,_T.set($,Y),Y},p2=($)=>/^[$A-Z_a-z][\w$]*$/.test($),Wh=($)=>{switch(typeof $){case"object":{if($===null)break;let X=n3($)??"object";return X[0].toLowerCase()+X.slice(1)}case"function":return p2($.name)?$.name:"fn";case"symbol":return $.description&&p2($.description)?$.description:"symbol"}return S$(`Unexpected attempt to register serializable value of type ${m4($)}`)};var X5=($)=>typeof $==="string"?JSON.stringify($):typeof $==="bigint"?`${$}n`:`${$}`;var qT=($,X={})=>Y5($,{onUndefined:"$ark.undefined",onBigInt:(Y)=>`$ark.bigint-${Y}`,...X},[]);var J$=($,X)=>{switch(m4($)){case"object":let Y=$,U=Y.constructor.name;return U==="Object"||U==="Array"?X?.quoteKeys===!1?uz(Y,X?.indent??0,""):JSON.stringify(Y5(Y,L9,[]),null,X?.indent):uz(Y,X?.indent??0,"");case"symbol":return L9.onSymbol($);default:return X5($)}},uz=($,X,Y)=>{if(typeof $==="function")return L9.onFunction($);if(typeof $!=="object"||$===null)return X5($);let U=Y+" ".repeat(X);if(Array.isArray($)){if($.length===0)return"[]";let z=$.map((W)=>uz(W,X,U)).join(`,
|
|
161
161
|
`+U);return X?`[
|
|
162
162
|
${U}${z}
|
|
163
163
|
${Y}]`:`[${z}]`}let G=$.constructor.name;if(G==="Object"){let z=r8($).map(([W,Q])=>{let Z=typeof W==="symbol"?L9.onSymbol(W):p2(W)?W:JSON.stringify(W),H=uz(Q,X,U);return`${U}${Z}: ${H}`});if(z.length===0)return"{}";return X?`{
|
|
164
164
|
${z.join(`,
|
|
165
165
|
`)}
|
|
166
|
-
${Y}}`:`{${z.join(", ")}}`}if($ instanceof Date)return n8($);if("expression"in $&&typeof $.expression==="string")return $.expression;return G},L9={onCycle:()=>"(cycle)",onSymbol:($)=>`Symbol(${$5($)})`,onFunction:($)=>`Function(${$5($)})`},Y5=($,X,Y)=>{switch(m4($)){case"object":{let U=$;if("toJSON"in U&&typeof U.toJSON==="function")return U.toJSON();if(typeof U==="function")return L9.onFunction(U);if(Y.includes(U))return"(cycle)";let G=[...Y,U];if(Array.isArray(U))return U.map((W)=>Y5(W,X,G));if(U instanceof Date)return U.toDateString();let z={};for(let W in U)z[W]=Y5(U[W],X,G);for(let W of Object.getOwnPropertySymbols(U))z[X.onSymbol?.(W)??W.toString()]=Y5(U[W],X,G);return z}case"symbol":return L9.onSymbol($);case"bigint":return X.onBigInt?.($)??`${$}n`;case"undefined":return X.onUndefined??"undefined";case"string":return $.replaceAll("\\","\\\\");default:return $}},n8=($)=>{let X=$.getFullYear(),Y=$.getMonth(),U=$.getDate(),G=$.getHours(),z=$.getMinutes(),W=$.getSeconds(),Q=$.getMilliseconds();if(Y===0&&U===1&&G===0&&z===0&&W===0&&Q===0)return`${X}`;let Z=`${Qh[Y]} ${U}, ${X}`;if(G===0&&z===0&&W===0&&Q===0)return Z;let H=$.toLocaleTimeString(),V=H.endsWith(" AM")||H.endsWith(" PM")?H.slice(-3):"";if(V)H=H.slice(0,-V.length);if(Q)H+=`.${Hh(Q,3)}`;else if(Zh.test(H))H=H.slice(0,-3);return`${H+V}, ${Z}`},Qh=["January","February","March","April","May","June","July","August","September","October","November","December"],Zh=/:\d\d:00$/,Hh=($,X)=>String($).padStart(X,"0");var RT=($,X,...[Y])=>{let U=Y?.stringifySymbol??J$,G=$;switch(typeof X){case"string":G=p2(X)?$===""?X:`${$}.${X}`:`${$}[${JSON.stringify(X)}]`;break;case"number":G=`${$}[${X}]`;break;case"symbol":G=`${$}[${U(X)}]`;break;default:if(Y?.stringifyNonKey)G=`${$}[${Y.stringifyNonKey(X)}]`;else f(`${J$(X)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return G},U2=($,...X)=>$.reduce((Y,U)=>RT(Y,U,...X),"");class G5 extends yz{cache={};constructor(...$){super();this.push(...$)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let $=0;$<this.length;$++)this.cache.json.push(typeof this[$]==="symbol"?J$(this[$]):this[$]);return this.cache.json}stringify(){if(this.cache.stringify)return this.cache.stringify;return this.cache.stringify=U2(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let $="",X=[$];for(let Y of this)$=RT($,Y),X.push($);return this.cache.stringifyAncestors=X}}class QE{chars;i;def;constructor($){this.def=$,this.chars=[...$],this.i=0}shift(){return this.chars[this.i++]??""}get lookahead(){return this.chars[this.i]??""}get nextLookahead(){return this.chars[this.i+1]??""}get length(){return this.chars.length}shiftUntil($){let X="";while(this.lookahead){if($(this,X))if(X[X.length-1]===s3)X=X.slice(0,-1);else break;X+=this.shift()}return X}shiftUntilLookahead($){return typeof $==="string"?this.shiftUntil((X)=>X.lookahead===$):this.shiftUntil((X)=>(X.lookahead in $))}shiftUntilNonWhitespace(){return this.shiftUntil(()=>!(this.lookahead in c2))}jumpToIndex($){this.i=$<0?this.length+$:$}jumpForward($){this.i+=$}get location(){return this.i}get unscanned(){return this.chars.slice(this.i,this.length).join("")}get scanned(){return this.chars.slice(0,this.i).join("")}sliceChars($,X){return this.chars.slice($,X).join("")}lookaheadIs($){return this.lookahead===$}lookaheadIsIn($){return this.lookahead in $}}var V9$=
|
|
166
|
+
${Y}}`:`{${z.join(", ")}}`}if($ instanceof Date)return n8($);if("expression"in $&&typeof $.expression==="string")return $.expression;return G},L9={onCycle:()=>"(cycle)",onSymbol:($)=>`Symbol(${$5($)})`,onFunction:($)=>`Function(${$5($)})`},Y5=($,X,Y)=>{switch(m4($)){case"object":{let U=$;if("toJSON"in U&&typeof U.toJSON==="function")return U.toJSON();if(typeof U==="function")return L9.onFunction(U);if(Y.includes(U))return"(cycle)";let G=[...Y,U];if(Array.isArray(U))return U.map((W)=>Y5(W,X,G));if(U instanceof Date)return U.toDateString();let z={};for(let W in U)z[W]=Y5(U[W],X,G);for(let W of Object.getOwnPropertySymbols(U))z[X.onSymbol?.(W)??W.toString()]=Y5(U[W],X,G);return z}case"symbol":return L9.onSymbol($);case"bigint":return X.onBigInt?.($)??`${$}n`;case"undefined":return X.onUndefined??"undefined";case"string":return $.replaceAll("\\","\\\\");default:return $}},n8=($)=>{let X=$.getFullYear(),Y=$.getMonth(),U=$.getDate(),G=$.getHours(),z=$.getMinutes(),W=$.getSeconds(),Q=$.getMilliseconds();if(Y===0&&U===1&&G===0&&z===0&&W===0&&Q===0)return`${X}`;let Z=`${Qh[Y]} ${U}, ${X}`;if(G===0&&z===0&&W===0&&Q===0)return Z;let H=$.toLocaleTimeString(),V=H.endsWith(" AM")||H.endsWith(" PM")?H.slice(-3):"";if(V)H=H.slice(0,-V.length);if(Q)H+=`.${Hh(Q,3)}`;else if(Zh.test(H))H=H.slice(0,-3);return`${H+V}, ${Z}`},Qh=["January","February","March","April","May","June","July","August","September","October","November","December"],Zh=/:\d\d:00$/,Hh=($,X)=>String($).padStart(X,"0");var RT=($,X,...[Y])=>{let U=Y?.stringifySymbol??J$,G=$;switch(typeof X){case"string":G=p2(X)?$===""?X:`${$}.${X}`:`${$}[${JSON.stringify(X)}]`;break;case"number":G=`${$}[${X}]`;break;case"symbol":G=`${$}[${U(X)}]`;break;default:if(Y?.stringifyNonKey)G=`${$}[${Y.stringifyNonKey(X)}]`;else f(`${J$(X)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return G},U2=($,...X)=>$.reduce((Y,U)=>RT(Y,U,...X),"");class G5 extends yz{cache={};constructor(...$){super();this.push(...$)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let $=0;$<this.length;$++)this.cache.json.push(typeof this[$]==="symbol"?J$(this[$]):this[$]);return this.cache.json}stringify(){if(this.cache.stringify)return this.cache.stringify;return this.cache.stringify=U2(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let $="",X=[$];for(let Y of this)$=RT($,Y),X.push($);return this.cache.stringifyAncestors=X}}class QE{chars;i;def;constructor($){this.def=$,this.chars=[...$],this.i=0}shift(){return this.chars[this.i++]??""}get lookahead(){return this.chars[this.i]??""}get nextLookahead(){return this.chars[this.i+1]??""}get length(){return this.chars.length}shiftUntil($){let X="";while(this.lookahead){if($(this,X))if(X[X.length-1]===s3)X=X.slice(0,-1);else break;X+=this.shift()}return X}shiftUntilLookahead($){return typeof $==="string"?this.shiftUntil((X)=>X.lookahead===$):this.shiftUntil((X)=>(X.lookahead in $))}shiftUntilNonWhitespace(){return this.shiftUntil(()=>!(this.lookahead in c2))}jumpToIndex($){this.i=$<0?this.length+$:$}jumpForward($){this.i+=$}get location(){return this.i}get unscanned(){return this.chars.slice(this.i,this.length).join("")}get scanned(){return this.chars.slice(0,this.i).join("")}sliceChars($,X){return this.chars.slice($,X).join("")}lookaheadIs($){return this.lookahead===$}lookaheadIsIn($){return this.lookahead in $}}var V9$=r1("implementedTraits");var ZE="$ark",Vh=2;while(ZE in globalThis)ZE=`$ark${Vh++}`;var TT=ZE;globalThis[TT]=o8;var m=o8,Oh=($)=>`${TT}.${$}`,F4=($)=>Oh($5($));class cz extends o3{argNames;body="";constructor(...$){super();this.argNames=$;for(let X of $){if(X in this)throw new Error(`Arg name '${X}' would overwrite an existing property on FunctionBody`);this[X]=X}}indentation=0;indent(){return this.indentation+=4,this}dedent(){return this.indentation-=4,this}prop($,X=!1){return HE($,X)}index($,X=!1){return vT(`${$}`,X)}line($){return this.body+=`${" ".repeat(this.indentation)}${$}
|
|
167
167
|
`,this}const($,X){return this.line(`const ${$} = ${X}`),this}let($,X){return this.line(`let ${$} = ${X}`)}set($,X){return this.line(`${$} = ${X}`)}if($,X){return this.block(`if (${$})`,X)}elseIf($,X){return this.block(`else if (${$})`,X)}else($){return this.block("else",$)}for($,X,Y=0){return this.block(`for (let i = ${Y}; ${$}; i++)`,X)}forIn($,X){return this.block(`for (const k in ${$})`,X)}block($,X,Y=""){return this.line(`${$} {`),this.indent(),X(this),this.dedent(),this.line(`}${Y}`)}return($=""){return this.line(`return ${$}`)}write($="anonymous",X=0){return`${$}(${this.argNames.join(", ")}) { ${X?this.body.split(`
|
|
168
168
|
`).map((Y)=>" ".repeat(X)+`${Y}`).join(`
|
|
169
|
-
`):this.body} }`}compile(){return new ZT(...this.argNames,this.body)}}var z2=($)=>
|
|
169
|
+
`):this.body} }`}compile(){return new ZT(...this.argNames,this.body)}}var z2=($)=>a6($,"object")||typeof $==="symbol"?F4($):X5($),HE=($,X=!1)=>{if(typeof $==="string"&&p2($))return`${X?"?":""}.${$}`;return vT(wh($),X)},wh=($)=>typeof $==="symbol"?F4($):JSON.stringify($),vT=($,X=!1)=>`${X?"?.":""}[${$}]`;class U5 extends cz{traversalKind;optimistic;constructor($){super("data","ctx");this.traversalKind=$.kind,this.optimistic=$.optimistic===!0}invoke($,X){let Y=X?.arg??this.data,U=typeof $==="string"?!0:this.requiresContextFor($),G=typeof $==="string"?$:$.id;if(U)return`${this.referenceToId(G,X)}(${Y}, ${this.ctx})`;return`${this.referenceToId(G,X)}(${Y})`}referenceToId($,X){let Y=X?.kind??this.traversalKind,U=`this.${$}${Y}`;return X?.bind?`${U}.bind(${X?.bind})`:U}requiresContextFor($){return this.traversalKind==="Apply"||$.allowsRequiresContext}initializeErrorCount(){return this.const("errorCount","ctx.currentErrorCount")}returnIfFail(){return this.if("ctx.currentErrorCount > errorCount",()=>this.return())}returnIfFailFast(){return this.if("ctx.failFast && ctx.currentErrorCount > errorCount",()=>this.return())}traverseKey($,X,Y){let U=this.requiresContextFor(Y);if(U)this.line(`${this.ctx}.path.push(${$})`);if(this.check(Y,{arg:X}),U)this.line(`${this.ctx}.path.pop()`);return this}check($,X){return this.traversalKind==="Allows"?this.if(`!${this.invoke($,X)}`,()=>this.return(!1)):this.line(this.invoke($,X))}}var pz=($)=>M$($,(X,Y)=>[X,o$(Y)?[...Y]:Y]),f6=r1("arkKind"),U$=($,X)=>$?.[f6]===X,X4=($)=>U$($,"root")||U$($,"constraint");var CT=["unit","proto","domain"],K9=["required","optional","index","sequence"],VE=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],dz=[...VE,...K9,"structure","predicate"],_9=["alias","union","morph","unit","intersection","proto","domain"],Dh=[..._9,...dz],lz=M$(dz,($,X)=>[X,1]),BT=M$([...K9,"undeclared"],($,X)=>[X,1]),jT=M$(Dh,($,X)=>[X,$]),q9=($)=>typeof $==="string"&&($ in jT);var R9=($)=>jT[$],rz=($)=>_9.slice(R9($)+1),i9$=[...rz("union"),"alias"],o9$=[...rz("morph"),"alias"],P1=($)=>{if(typeof $==="string"||typeof $==="boolean"||$===null)return $;if(typeof $==="number"){if(Number.isNaN($))return"NaN";if($===Number.POSITIVE_INFINITY)return"Infinity";if($===Number.NEGATIVE_INFINITY)return"-Infinity";return $}return z2($)},d2=($)=>{let X="{ ";for(let[Y,U]of Object.entries($))X+=`${Y}: ${z2(U)}, `;return X+" }"},A$=($)=>{let X=$;if(X.hasAssociatedError)X.defaults.expected??=(Y)=>("description"in Y)?Y.description:X.defaults.description(Y),X.defaults.actual??=(Y)=>J$(Y),X.defaults.problem??=(Y)=>`must be ${Y.expected}${Y.actual?` (was ${Y.actual})`:""}`,X.defaults.message??=(Y)=>{if(Y.path.length===0)return Y.problem;let U=`${Y.propString} ${Y.problem}`;if(U[0]==="[")return`value at ${U}`;return U};return X};class PT extends Error{name="ToJsonSchemaError";code;context;constructor($,X){super(J$(X,{quoteKeys:!1,indent:4}));this.code=$,this.context=X}hasCode($){return this.code===$}}var Eh={dialect:"https://json-schema.org/draft/2020-12/schema",useRefs:!1,fallback:{arrayObject:($)=>Q4.throw("arrayObject",$),arrayPostfix:($)=>Q4.throw("arrayPostfix",$),defaultValue:($)=>Q4.throw("defaultValue",$),domain:($)=>Q4.throw("domain",$),morph:($)=>Q4.throw("morph",$),patternIntersection:($)=>Q4.throw("patternIntersection",$),predicate:($)=>Q4.throw("predicate",$),proto:($)=>Q4.throw("proto",$),symbolKey:($)=>Q4.throw("symbolKey",$),unit:($)=>Q4.throw("unit",$),date:($)=>Q4.throw("date",$)}},Q4={Error:PT,throw:(...$)=>{throw new Q4.Error(...$)},throwInternalOperandError:($,X)=>S$(`Unexpected JSON Schema input for ${$}: ${J$(X)}`),defaultConfig:Eh};m.config??={};var z5=($,X)=>{if(!X)return $;let Y={...$},U;for(U in X){let G={...$.keywords};if(U==="keywords"){for(let z in X[U]){let W=X.keywords[z];if(W===void 0)continue;G[z]=typeof W==="string"?{description:W}:W}Y.keywords=G}else if(U==="toJsonSchema")Y[U]=OE($.toJsonSchema,X.toJsonSchema);else if(q9(U))Y[U]={...$[U],...X[U]};else Y[U]=X[U]}return Y},OE=($,X)=>{if(!$)return X??{};if(!X)return $;let Y={...$},U;for(U in X)if(U==="fallback")Y.fallback=Nh($.fallback,X.fallback);else Y[U]=X[U];return Y},Nh=($,X)=>{$=IT($),X=IT(X);let Y={},U;for(U in Q4.defaultConfig.fallback)Y[U]=X[U]??X.default??$[U]??$.default??Q4.defaultConfig.fallback[U];return Y},IT=($)=>typeof $==="function"?{default:$}:$??{};class l2 extends o3{[f6]="error";path;data;nodeConfig;input;ctx;constructor({prefixPath:$,relativePath:X,...Y},U){super();this.input=Y,this.ctx=U,YT(this,Y);let G=U.data;if(Y.code==="union")Y.errors=Y.errors.flatMap((W)=>{let Q=W.hasCode("union")?W.errors:[W];if(!$&&!X)return Q;return Q.map((Z)=>Z.transform((H)=>({...H,path:tR($,H.path,X)})))});this.nodeConfig=U.config[this.code];let z=[...Y.path??U.path];if(X)z.push(...X);if($)z.unshift(...$);this.path=new G5(...z),this.data="data"in Y?Y.data:G}transform($){return new l2($({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode($){return this.code===$}get propString(){return U2(this.path)}get expected(){if(this.input.expected)return this.input.expected;let $=this.meta?.expected??this.nodeConfig.expected;return typeof $==="function"?$(this.input):$}get actual(){if(this.input.actual)return this.input.actual;let $=this.meta?.actual??this.nodeConfig.actual;return typeof $==="function"?$(this.data):$}get problem(){if(this.input.problem)return this.input.problem;let $=this.meta?.problem??this.nodeConfig.problem;return typeof $==="function"?$(this):$}get message(){if(this.input.message)return this.input.message;let $=this.meta?.message??this.nodeConfig.message;return typeof $==="function"?$(this):$}get flat(){return this.hasCode("intersection")?[...this.errors]:[this]}toJSON(){return{data:this.data,path:this.path,...this.input,expected:this.expected,actual:this.actual,problem:this.problem,message:this.message}}toString(){return this.message}throw(){throw this}}class e6 extends yz{[f6]="errors";ctx;constructor($){super();this.ctx=$}byPath=Object.create(null);get flatByPath(){return M$(this.byPath,($,X)=>[$,X.flat])}get flatProblemsByPath(){return M$(this.byPath,($,X)=>[$,X.flat.map((Y)=>Y.problem)])}byAncestorPath=Object.create(null);count=0;mutable=this;throw(){throw this.toTraversalError()}toTraversalError(){return new wE(this)}add($){if(this.includes($))return;this._add($)}transform($){let X=new e6(this.ctx);for(let Y of this)X.add($(Y));return X}merge($){for(let X of $){if(this.includes(X))continue;this._add(new l2({...X,path:[...this.ctx.path,...X.path]},this.ctx))}}affectsPath($){if(this.length===0)return!1;return $.stringifyAncestors().some((X)=>(X in this.byPath))||$.stringify()in this.byAncestorPath}get summary(){return this.toString()}get issues(){return this}toJSON(){return[...this.map(($)=>$.toJSON())]}toString(){return this.join(`
|
|
170
170
|
`)}_add($){let X=this.byPath[$.propString];if(X){if(X.hasCode("union")&&X.errors.length===0)return;let Y=$.hasCode("union")&&$.errors.length===0?$:new l2({code:"intersection",errors:X.hasCode("intersection")?[...X.errors,$]:[X,$]},this.ctx),U=this.indexOf(X);this.mutable[U===-1?this.length:U]=Y,this.byPath[$.propString]=Y,this.addAncestorPaths($)}else this.byPath[$.propString]=$,this.addAncestorPaths($),this.mutable.push($);this.count++}addAncestorPaths($){for(let X of $.path.stringifyAncestors())this.byAncestorPath[X]=P$(this.byAncestorPath[X],$)}}class wE extends Error{name="TraversalError";constructor($){if($.length===1)super($.summary);else super(`
|
|
171
171
|
`+$.map((X)=>` \u2022 ${Fh(X)}`).join(`
|
|
172
172
|
`));Object.defineProperty(this,"arkErrors",{value:$,enumerable:!1})}}var Fh=($)=>$.toString().split(`
|
|
173
173
|
`).join(`
|
|
174
|
-
`);class i1{path=[];errors=new s6(this);root;config;queuedMorphs=[];branches=[];seen={};constructor($,X){this.root=$,this.config=X}get data(){let $=this.root;for(let X of this.path)$=$?.[X];return $}get propString(){return U2(this.path)}reject($){return this.error($),!1}mustBe($){return this.error($),!1}error($){let X=typeof $==="object"?$.code?$:{...$,code:"predicate"}:{code:"predicate",expected:$};return this.errorFromContext(X)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches.at(-1)}queueMorphs($){let X={path:new G5(...this.path),morphs:$};if(this.currentBranch)this.currentBranch.queuedMorphs.push(X);else this.queuedMorphs.push(X)}finalize($){if(this.queuedMorphs.length){if(typeof this.root==="object"&&this.root!==null&&this.config.clone)this.root=this.config.clone(this.root);this.applyQueuedMorphs()}if(this.hasError())return $?$(this.errors):this.errors;return this.root}get currentErrorCount(){return this.currentBranch?this.currentBranch.error?1:0:this.errors.count}get failFast(){return this.branches.length!==0}pushBranch(){this.branches.push({error:void 0,queuedMorphs:[]})}popBranch(){return this.branches.pop()}get external(){return this}errorFromNodeContext($){return this.errorFromContext($)}errorFromContext($){let X=new l2($,this);if(this.currentBranch)this.currentBranch.error=X;else this.errors.add(X);return X}applyQueuedMorphs(){while(this.queuedMorphs.length){let $=this.queuedMorphs;this.queuedMorphs=[];for(let{path:X,morphs:Y}of $){if(this.errors.affectsPath(X))continue;this.applyMorphsAtPath(X,Y)}}}applyMorphsAtPath($,X){let Y=$.at(-1),U;if(Y!==void 0){U=this.root;for(let G=0;G<$.length-1;G++)U=U[$[G]]}this.path=[...$];for(let G of X){let z=X4(G),W=G(U===void 0?this.root:U[Y],this);if(W instanceof l2){this.errors.add(W);break}if(W instanceof s6){if(!z)this.errors.merge(W);break}if(U===void 0)this.root=W;else U[Y]=W;this.applyQueuedMorphs()}}}var e6=($,X,Y)=>{if(!Y)return X();Y.path.push($);let U=X();return Y.path.pop(),U};class Q5 extends r1{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor($,X){super((U,G,z=this.onFail)=>{if(G)return this.traverseApply(U,G),G.hasError()?G.errors:G.data;return this.rootApply(U,z)},{attach:$});this.attachments=$,this.$=X,this.onFail=this.meta.onFail??this.$.resolvedConfig.onFail,this.includesTransform=this.hasKind("morph")||this.hasKind("structure")&&this.structuralMorph!==void 0,this.includesContextualPredicate=this.hasKind("predicate")&&this.inner.predicate.length!==1,this.isCyclic=this.kind==="alias",this.referencesById={[this.id]:this},this.shallowReferences=this.hasKind("structure")?[this,...this.children]:this.children.reduce((U,G)=>Lh(U,G.shallowReferences),[this]);let Y=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let U=0;U<this.children.length;U++){if(this.includesTransform||=this.children[U].includesTransform,this.includesContextualPredicate||=this.children[U].includesContextualPredicate,this.isCyclic||=this.children[U].isCyclic,!Y){let G=this.children[U].flatRefs;for(let z=0;z<G.length;z++){let W=G[z];if(!this.flatRefs.some((Q)=>ST(Q,W))){this.flatRefs.push(W);for(let Q of W.node.branches)if(Q.hasKind("morph")||Q.hasKind("intersection")&&Q.structure?.structuralMorph!==void 0)this.flatMorphs.push({path:W.path,propString:W.propString,node:Q})}}}Object.assign(this.referencesById,this.children[U].referencesById)}this.flatRefs.sort((U,G)=>U.path.length>G.path.length?1:U.path.length<G.path.length?-1:U.propString>G.propString?1:U.propString<G.propString?-1:U.node.expression<G.node.expression?-1:1),this.allowsRequiresContext=this.includesContextualPredicate||this.isCyclic,this.rootApplyStrategy=!this.allowsRequiresContext&&this.flatMorphs.length===0?this.shallowMorphs.length===0?"allows":this.shallowMorphs.every((U)=>U.length===1||U.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some((U)=>U.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?(U)=>this.traverseAllows(U,new i1(U,this.$.resolvedConfig)):(U)=>this.traverseAllows(U)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(X,Y)=>{if(this.allows(X))return X;let U=new i1(X,this.$.resolvedConfig);return this.traverseApply(X,U),U.finalize(Y)};case"contextual":return(X,Y)=>{let U=new i1(X,this.$.resolvedConfig);return this.traverseApply(X,U),U.finalize(Y)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];let $=this.$.resolvedConfig.clone;return(X,Y)=>{if(this.allows(X))return this.contextFreeMorph($&&(typeof X==="object"&&X!==null||typeof X==="function")?$(X):X);let U=new i1(X,this.$.resolvedConfig);return this.traverseApply(X,U),U.finalize(Y)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,S$(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=Ah(this.metaJson);cacheGetter($,X){return Object.defineProperty(this,$,{value:X}),X}get description(){return this.cacheGetter("description",this.meta?.description??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}precedence=R9(this.kind);precompilation;assert=($,X)=>this($,X,(Y)=>Y.throw());traverse($,X){return this($,X,null)}get in(){return this.cacheGetter("in",this.getIo("in"))}get out(){return this.cacheGetter("out",this.getIo("out"))}getIo($){if(!this.includesTransform)return this;let X={};for(let[Y,U]of this.innerEntries){let G=this.impl.keys[Y];if(G.reduceIo)G.reduceIo($,X,U);else if(G.child){let z=U;X[Y]=o$(z)?z.map((W)=>W[$]):z[$]}else X[Y]=U}return this.$.node(this.kind,X)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals($){let X=X4($)?$:this.$.parseDefinition($);return this.innerHash===X.innerHash}ifEquals($){return this.equals($)?this:void 0}hasKind($){return this.kind===$}assertHasKind($){if(this.kind!==$)l8(`${this.kind} node was not of asserted kind ${$}`);return this}hasKindIn(...$){return $.includes(this.kind)}assertHasKindIn(...$){if(!$2($,this.kind))l8(`${this.kind} node was not one of asserted kinds ${$}`);return this}isBasis(){return $2(CT,this.kind)}isConstraint(){return $2(dz,this.kind)}isStructural(){return $2(K9,this.kind)}isRefinement(){return $2(VE,this.kind)}isRoot(){return $2(_9,this.kind)}isUnknown(){return this.hasKind("intersection")&&this.children.length===0}isNever(){return this.hasKind("union")&&this.children.length===0}hasUnit($){return this.hasKind("unit")&&this.allows($)}hasOpenIntersection(){return this.impl.intersectionIsOpen}get nestableExpression(){return this.expression}select($){let X=W5.normalize($);return this._select(X)}_select($){let X=W5.applyBoundary[$.boundary??"references"](this);if($.kind)X=X.filter((Y)=>Y.kind===$.kind);if($.where)X=X.filter($.where);return W5.applyMethod[$.method??"filter"](X,this,$)}transform($,X){return this._transform($,this._createTransformContext(X))}_createTransformContext($){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:$?.prereduced??!1},undeclaredKeyHandling:void 0,...$}}_transform($,X){let Y=X.bindScope??this.$;if(X.seen[this.id])return this.$.lazilyResolve(X.seen[this.id]);if(X.shouldTransform?.(this,X)===!1)return this;let U;if(X.seen[this.id]=()=>U,this.hasKind("structure")&&this.undeclared!==X.undeclaredKeyHandling)X={...X,undeclaredKeyHandling:this.undeclared};let G=M$(this.inner,(H,V)=>{if(!this.impl.keys[H].child)return[H,V];let O=V;if(!o$(O)){let D=O._transform($,X);return D?[H,D]:[]}if(O.length===0)return[H,V];let w=O.flatMap((D)=>{return D._transform($,X)??[]});return w.length?[H,w]:[]});delete X.seen[this.id];let z=Object.assign(G,{meta:this.meta}),W=X.selected&&!X.selected.includes(this)?z:$(this.kind,z,X);if(W===null)return null;if(X4(W))return U=W;let Q=Object.keys(W);if((Q.length===0||Q.length===1&&Q[0]==="meta")&&!F0(this.inner))return null;if((this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in W))return X.undeclaredKeyHandling?{...W,value:m.intrinsic.unknown}:null;if(this.kind==="morph")W.in??=m.intrinsic.unknown;return U=Y.node(this.kind,W,X.parseOptions)}configureReferences($,X="references"){let Y=W5.normalize(X),U=typeof $==="string"?(Q,Z)=>({...Z,meta:{...Z.meta,description:$}}):typeof $==="function"?(Q,Z)=>({...Z,meta:$(Z.meta)}):(Q,Z)=>({...Z,meta:{...Z.meta,...$}});if(Y.boundary==="self")return this.$.node(this.kind,U(this.kind,{...this.inner,meta:this.meta}));let G=this._select(Y),z=G&&m2(G),W=Y.boundary==="child"?(Q,Z)=>Z.root.children.includes(Q):Y.boundary==="shallow"?(Q)=>Q.kind!=="structure":()=>!0;return this.$.finalize(this.transform(U,{shouldTransform:W,selected:z}))}}var W5={applyBoundary:{self:($)=>[$],child:($)=>[...$.children],shallow:($)=>[...$.shallowReferences],references:($)=>[...$.references]},applyMethod:{filter:($)=>$,assertFilter:($,X,Y)=>{if($.length===0)l8(xT(X,Y));return $},find:($)=>$[0],assertFind:($,X,Y)=>{if($.length===0)l8(xT(X,Y));return $[0]}},normalize:($)=>typeof $==="function"?{boundary:"references",method:"filter",where:$}:typeof $==="string"?u4($,W5.applyBoundary)?{method:"filter",boundary:$}:{boundary:"references",method:"filter",kind:$}:{boundary:"references",method:"filter",...$}},xT=($,X)=>`${$} had no references matching ${J$(X)}.`,Mh=($)=>U2($,{stringifyNonKey:(X)=>X.expression}),Jh=/"(\$ark\.[^"]+)"/g,Ah=($)=>JSON.stringify($).replaceAll(Jh,"$1"),o1=($,X)=>({path:$,node:X,propString:Mh($)}),ST=($,X)=>$.propString===X.propString&&$.node.equals(X.node),DE=($,X)=>N0($,X,{isEqual:ST}),Lh=($,X)=>N0($,X,{isEqual:(Y,U)=>Y.equals(U)});class a extends Array{static init($,X,Y,U){return new a({kind:$,l:X,r:Y,path:U?.path??[],optional:U?.optional??!1})}add($,X,Y,U){return this.push({kind:$,l:X,r:Y,path:U?.path??[],optional:U?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){let{path:$,l:X,r:Y}=this[0],U=U2($);return NE(`Intersection${U&&` at ${U}`} of ${kT(X,Y)}`)}return`The following intersections result in unsatisfiable types:
|
|
174
|
+
`);class o1{path=[];errors=new e6(this);root;config;queuedMorphs=[];branches=[];seen={};constructor($,X){this.root=$,this.config=X}get data(){let $=this.root;for(let X of this.path)$=$?.[X];return $}get propString(){return U2(this.path)}reject($){return this.error($),!1}mustBe($){return this.error($),!1}error($){let X=typeof $==="object"?$.code?$:{...$,code:"predicate"}:{code:"predicate",expected:$};return this.errorFromContext(X)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches.at(-1)}queueMorphs($){let X={path:new G5(...this.path),morphs:$};if(this.currentBranch)this.currentBranch.queuedMorphs.push(X);else this.queuedMorphs.push(X)}finalize($){if(this.queuedMorphs.length){if(typeof this.root==="object"&&this.root!==null&&this.config.clone)this.root=this.config.clone(this.root);this.applyQueuedMorphs()}if(this.hasError())return $?$(this.errors):this.errors;return this.root}get currentErrorCount(){return this.currentBranch?this.currentBranch.error?1:0:this.errors.count}get failFast(){return this.branches.length!==0}pushBranch(){this.branches.push({error:void 0,queuedMorphs:[]})}popBranch(){return this.branches.pop()}get external(){return this}errorFromNodeContext($){return this.errorFromContext($)}errorFromContext($){let X=new l2($,this);if(this.currentBranch)this.currentBranch.error=X;else this.errors.add(X);return X}applyQueuedMorphs(){while(this.queuedMorphs.length){let $=this.queuedMorphs;this.queuedMorphs=[];for(let{path:X,morphs:Y}of $){if(this.errors.affectsPath(X))continue;this.applyMorphsAtPath(X,Y)}}}applyMorphsAtPath($,X){let Y=$.at(-1),U;if(Y!==void 0){U=this.root;for(let G=0;G<$.length-1;G++)U=U[$[G]]}this.path=[...$];for(let G of X){let z=X4(G),W=G(U===void 0?this.root:U[Y],this);if(W instanceof l2){this.errors.add(W);break}if(W instanceof e6){if(!z)this.errors.merge(W);break}if(U===void 0)this.root=W;else U[Y]=W;this.applyQueuedMorphs()}}}var $1=($,X,Y)=>{if(!Y)return X();Y.path.push($);let U=X();return Y.path.pop(),U};class Q5 extends i1{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor($,X){super((U,G,z=this.onFail)=>{if(G)return this.traverseApply(U,G),G.hasError()?G.errors:G.data;return this.rootApply(U,z)},{attach:$});this.attachments=$,this.$=X,this.onFail=this.meta.onFail??this.$.resolvedConfig.onFail,this.includesTransform=this.hasKind("morph")||this.hasKind("structure")&&this.structuralMorph!==void 0,this.includesContextualPredicate=this.hasKind("predicate")&&this.inner.predicate.length!==1,this.isCyclic=this.kind==="alias",this.referencesById={[this.id]:this},this.shallowReferences=this.hasKind("structure")?[this,...this.children]:this.children.reduce((U,G)=>Lh(U,G.shallowReferences),[this]);let Y=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let U=0;U<this.children.length;U++){if(this.includesTransform||=this.children[U].includesTransform,this.includesContextualPredicate||=this.children[U].includesContextualPredicate,this.isCyclic||=this.children[U].isCyclic,!Y){let G=this.children[U].flatRefs;for(let z=0;z<G.length;z++){let W=G[z];if(!this.flatRefs.some((Q)=>ST(Q,W))){this.flatRefs.push(W);for(let Q of W.node.branches)if(Q.hasKind("morph")||Q.hasKind("intersection")&&Q.structure?.structuralMorph!==void 0)this.flatMorphs.push({path:W.path,propString:W.propString,node:Q})}}}Object.assign(this.referencesById,this.children[U].referencesById)}this.flatRefs.sort((U,G)=>U.path.length>G.path.length?1:U.path.length<G.path.length?-1:U.propString>G.propString?1:U.propString<G.propString?-1:U.node.expression<G.node.expression?-1:1),this.allowsRequiresContext=this.includesContextualPredicate||this.isCyclic,this.rootApplyStrategy=!this.allowsRequiresContext&&this.flatMorphs.length===0?this.shallowMorphs.length===0?"allows":this.shallowMorphs.every((U)=>U.length===1||U.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some((U)=>U.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?(U)=>this.traverseAllows(U,new o1(U,this.$.resolvedConfig)):(U)=>this.traverseAllows(U)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(X,Y)=>{if(this.allows(X))return X;let U=new o1(X,this.$.resolvedConfig);return this.traverseApply(X,U),U.finalize(Y)};case"contextual":return(X,Y)=>{let U=new o1(X,this.$.resolvedConfig);return this.traverseApply(X,U),U.finalize(Y)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];let $=this.$.resolvedConfig.clone;return(X,Y)=>{if(this.allows(X))return this.contextFreeMorph($&&(typeof X==="object"&&X!==null||typeof X==="function")?$(X):X);let U=new o1(X,this.$.resolvedConfig);return this.traverseApply(X,U),U.finalize(Y)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,S$(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=Ah(this.metaJson);cacheGetter($,X){return Object.defineProperty(this,$,{value:X}),X}get description(){return this.cacheGetter("description",this.meta?.description??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}precedence=R9(this.kind);precompilation;assert=($,X)=>this($,X,(Y)=>Y.throw());traverse($,X){return this($,X,null)}get in(){return this.cacheGetter("in",this.getIo("in"))}get out(){return this.cacheGetter("out",this.getIo("out"))}getIo($){if(!this.includesTransform)return this;let X={};for(let[Y,U]of this.innerEntries){let G=this.impl.keys[Y];if(G.reduceIo)G.reduceIo($,X,U);else if(G.child){let z=U;X[Y]=o$(z)?z.map((W)=>W[$]):z[$]}else X[Y]=U}return this.$.node(this.kind,X)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals($){let X=X4($)?$:this.$.parseDefinition($);return this.innerHash===X.innerHash}ifEquals($){return this.equals($)?this:void 0}hasKind($){return this.kind===$}assertHasKind($){if(this.kind!==$)l8(`${this.kind} node was not of asserted kind ${$}`);return this}hasKindIn(...$){return $.includes(this.kind)}assertHasKindIn(...$){if(!$2($,this.kind))l8(`${this.kind} node was not one of asserted kinds ${$}`);return this}isBasis(){return $2(CT,this.kind)}isConstraint(){return $2(dz,this.kind)}isStructural(){return $2(K9,this.kind)}isRefinement(){return $2(VE,this.kind)}isRoot(){return $2(_9,this.kind)}isUnknown(){return this.hasKind("intersection")&&this.children.length===0}isNever(){return this.hasKind("union")&&this.children.length===0}hasUnit($){return this.hasKind("unit")&&this.allows($)}hasOpenIntersection(){return this.impl.intersectionIsOpen}get nestableExpression(){return this.expression}select($){let X=W5.normalize($);return this._select(X)}_select($){let X=W5.applyBoundary[$.boundary??"references"](this);if($.kind)X=X.filter((Y)=>Y.kind===$.kind);if($.where)X=X.filter($.where);return W5.applyMethod[$.method??"filter"](X,this,$)}transform($,X){return this._transform($,this._createTransformContext(X))}_createTransformContext($){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:$?.prereduced??!1},undeclaredKeyHandling:void 0,...$}}_transform($,X){let Y=X.bindScope??this.$;if(X.seen[this.id])return this.$.lazilyResolve(X.seen[this.id]);if(X.shouldTransform?.(this,X)===!1)return this;let U;if(X.seen[this.id]=()=>U,this.hasKind("structure")&&this.undeclared!==X.undeclaredKeyHandling)X={...X,undeclaredKeyHandling:this.undeclared};let G=M$(this.inner,(H,V)=>{if(!this.impl.keys[H].child)return[H,V];let O=V;if(!o$(O)){let D=O._transform($,X);return D?[H,D]:[]}if(O.length===0)return[H,V];let w=O.flatMap((D)=>{return D._transform($,X)??[]});return w.length?[H,w]:[]});delete X.seen[this.id];let z=Object.assign(G,{meta:this.meta}),W=X.selected&&!X.selected.includes(this)?z:$(this.kind,z,X);if(W===null)return null;if(X4(W))return U=W;let Q=Object.keys(W);if((Q.length===0||Q.length===1&&Q[0]==="meta")&&!M0(this.inner))return null;if((this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in W))return X.undeclaredKeyHandling?{...W,value:m.intrinsic.unknown}:null;if(this.kind==="morph")W.in??=m.intrinsic.unknown;return U=Y.node(this.kind,W,X.parseOptions)}configureReferences($,X="references"){let Y=W5.normalize(X),U=typeof $==="string"?(Q,Z)=>({...Z,meta:{...Z.meta,description:$}}):typeof $==="function"?(Q,Z)=>({...Z,meta:$(Z.meta)}):(Q,Z)=>({...Z,meta:{...Z.meta,...$}});if(Y.boundary==="self")return this.$.node(this.kind,U(this.kind,{...this.inner,meta:this.meta}));let G=this._select(Y),z=G&&m2(G),W=Y.boundary==="child"?(Q,Z)=>Z.root.children.includes(Q):Y.boundary==="shallow"?(Q)=>Q.kind!=="structure":()=>!0;return this.$.finalize(this.transform(U,{shouldTransform:W,selected:z}))}}var W5={applyBoundary:{self:($)=>[$],child:($)=>[...$.children],shallow:($)=>[...$.shallowReferences],references:($)=>[...$.references]},applyMethod:{filter:($)=>$,assertFilter:($,X,Y)=>{if($.length===0)l8(xT(X,Y));return $},find:($)=>$[0],assertFind:($,X,Y)=>{if($.length===0)l8(xT(X,Y));return $[0]}},normalize:($)=>typeof $==="function"?{boundary:"references",method:"filter",where:$}:typeof $==="string"?u4($,W5.applyBoundary)?{method:"filter",boundary:$}:{boundary:"references",method:"filter",kind:$}:{boundary:"references",method:"filter",...$}},xT=($,X)=>`${$} had no references matching ${J$(X)}.`,Mh=($)=>U2($,{stringifyNonKey:(X)=>X.expression}),Jh=/"(\$ark\.[^"]+)"/g,Ah=($)=>JSON.stringify($).replaceAll(Jh,"$1"),n1=($,X)=>({path:$,node:X,propString:Mh($)}),ST=($,X)=>$.propString===X.propString&&$.node.equals(X.node),DE=($,X)=>F0($,X,{isEqual:ST}),Lh=($,X)=>F0($,X,{isEqual:(Y,U)=>Y.equals(U)});class a extends Array{static init($,X,Y,U){return new a({kind:$,l:X,r:Y,path:U?.path??[],optional:U?.optional??!1})}add($,X,Y,U){return this.push({kind:$,l:X,r:Y,path:U?.path??[],optional:U?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){let{path:$,l:X,r:Y}=this[0],U=U2($);return NE(`Intersection${U&&` at ${U}`} of ${kT(X,Y)}`)}return`The following intersections result in unsatisfiable types:
|
|
175
175
|
\u2022 ${this.map(({path:$,l:X,r:Y})=>`${$}: ${kT(X,Y)}`).join(`
|
|
176
|
-
\u2022 `)}`}throw(){return f(this.describeReasons())}invert(){let $=this.map((X)=>({...X,l:X.r,r:X.l}));if(!($ instanceof a))return new a(...$);return $}withPrefixKey($,X){return this.map((Y)=>({...Y,path:[$,...Y.path],optional:Y.optional||X==="optional"}))}toNeverIfDisjoint(){return m.intrinsic.never}}var kT=($,X)=>`${EE($)} and ${EE(X)}`,EE=($)=>X4($)?$.expression:o$($)?$.map(EE).join(" | ")||"never":String($),NE=($)=>`${$} results in an unsatisfiable type`;var T9={},$1=($,X,Y)=>Y4($,X,{$:Y,invert:!1,pipe:!1}),Z5=($,X,Y)=>Y4($,X,{$:Y,invert:!1,pipe:!0}),Y4=($,X,Y)=>{let U=Y.pipe?"|>":"&",G=`${$.hash}${U}${X.hash}`;if(T9[G]!==void 0)return T9[G];if(!Y.pipe){let Q=`${X.hash}${U}${$.hash}`;if(T9[Q]!==void 0){let Z=T9[Q],H=Z instanceof a?Z.invert():Z;return T9[G]=H,H}}let z=!Y.pipe||!$.includesTransform&&!X.includesTransform;if(z&&$.equals(X))return $;let W=z?FE($,X,Y):$.hasKindIn(..._9)?Kh($,X,Y):FE($,X,Y);if(X4(W)){if($.equals(W))W=$;else if(X.equals(W))W=X}return T9[G]=W,W},FE=($,X,Y)=>{let U=$.precedence<X.precedence?$.kind:X.kind,G=$.impl.intersections[X.kind]??X.impl.intersections[$.kind];if(G===void 0)return null;else if(U===$.kind)return G($,X,Y);else{let z=G(X,$,{...Y,invert:!Y.invert});if(z instanceof a)z=z.invert();return z}},Kh=($,X,Y)=>$.includesTransform||X.includesTransform?Y.invert?bT(X,$,Y):bT($,X,Y):FE($,X,Y),bT=($,X,Y)=>$.distribute((U)=>_h(U,X,Y),(U)=>{let G=U.filter(X4);if(G.length===0)return a.init("union",$.branches,X.branches);if(G.length<$.branches.length||!$.branches.every((Q,Z)=>Q.in.equals(G[Z].in)))return Y.$.parseSchema(G);let z;if(G.length===1){let Q=G[0];if(!z)return Q;return Y.$.node("morph",{...Q.inner,in:Q.in.configure(z,"self")})}let W={branches:G};if(z)W.meta=z;return Y.$.parseSchema(W)}),_h=($,X,Y)=>{if($.hasKind("morph")){let G=[...$.morphs];if($.lastMorphIfNode){let z=Y4($.lastMorphIfNode,X,Y);if(z instanceof a)return z;G[G.length-1]=z}else G.push(X);return Y.$.node("morph",{morphs:G,in:$.inner.in})}if(X.hasKind("morph")){let G=Y4($,X.in,Y);if(G instanceof a)return G;return Y.$.node("morph",{morphs:[X],in:G})}return Y.$.node("morph",{morphs:[X],in:$})};class P1 extends Q5{constructor($,X){super($,X);Object.defineProperty(this,f6,{value:"constraint",enumerable:!1})}impliedSiblings;intersect($){return $1(this,$,this.$)}}class W2 extends P1{traverseApply=($,X)=>{if(!this.traverseAllows($,X))X.errorFromNodeContext(this.errorContext)};compile($){if($.traversalKind==="Allows")$.return(this.compiledCondition);else $.if(this.compiledNegation,()=>$.line(`${$.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return d2(this.errorContext)}}var w6=($)=>(X,Y)=>{if(o$(X)){if(X.length===0)return;let G=X.map((z)=>Y.$.node($,z));if($==="predicate")return G;return G.sort((z,W)=>z.hash<W.hash?-1:1)}let U=Y.$.node($,X);return U.hasOpenIntersection()?[U]:U},v9=($)=>{let X=$.r.shift();if(!X){let U=$.l.length===0&&$.kind==="structure"?m.intrinsic.unknown.internal:$.ctx.$.node($.kind,Object.assign($.baseInner,qh($.l)),{prereduced:!0});for(let G of $.roots){if(U instanceof a)return U;U=Y4(G,U,$.ctx)}return U}let Y=!1;for(let U=0;U<$.l.length;U++){let G=Y4($.l[U],X,$.ctx);if(G===null)continue;if(G instanceof a)return G;if(!Y){if(G.isRoot())return $.roots.push(G),$.l.splice(U),v9($);$.l[U]=G,Y=!0}else if(!$.l.includes(G))return S$(`Unexpectedly encountered multiple distinct intersection results for refinement ${G}`)}if(!Y)$.l.push(X);if($.kind==="intersection"){if(X.impliedSiblings)for(let U of X.impliedSiblings)N0($.r,U)}return v9($)},C9=($)=>{return Object.entries($).flatMap(([Y,U])=>(Y in lz)?U:[]).sort((Y,U)=>Y.precedence<U.precedence?-1:Y.precedence>U.precedence?1:Y.kind==="predicate"&&U.kind==="predicate"?0:Y.hash<U.hash?-1:1)},qh=($)=>{let X={};for(let Y of $)if(Y.hasOpenIntersection())X[Y.kind]=P$(X[Y.kind],Y);else{if(X[Y.kind])return S$(`Unexpected intersection of closed refinements of kind ${Y.kind}`);X[Y.kind]=Y}return X},fT=(...$)=>f(hT(...$)),hT=($,X,Y)=>{let U=Y.hasKind("morph")?"a morph":Y.isUnknown()?"unknown":Y.exclude(X).defaultShortDescription;return`${wT($)} operand must be ${X.description} (was ${U})`};var gT=($,X,Y)=>new r2($,X,Y,Y,null);class iz extends r1{}class r2 extends r1{[f6]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor($,X,Y,U,G){super((...z)=>{let W=M$(this.names,(Q,Z)=>{let H=this.arg$.parse(z[Q]);if(!H.extends(this.constraints[Q]))f(Rh(Z,this.constraints[Q].expression,H.expression));return[Z,H]});if(this.defIsLazy()){let Q=this.bodyDef(W);return this.$.parse(Q)}return this.$.parse(X,{args:W})});this.paramDefs=$,this.bodyDef=X,this.$=Y,this.arg$=U,this.hkt=G,this.description=G?new G().description??`a generic type for ${G.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof iz}cacheGetter($,X){return Object.defineProperty(this,$,{value:X}),X}get json(){return this.cacheGetter("json",{params:this.params.map(($)=>$[1].isUnknown()?$[0]:[$[0],$[1].json]),body:qT(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(($)=>typeof $==="string"?[$,m.intrinsic.unknown]:[$[0],this.$.parse($[1])]))}get names(){return this.cacheGetter("names",this.params.map(($)=>$[0]))}get constraints(){return this.cacheGetter("constraints",this.params.map(($)=>$[1]))}get internal(){return this}get referencesById(){return this.baseInstantiation.internal.referencesById}get references(){return this.baseInstantiation.internal.references}}var Rh=($,X,Y)=>`${$} must be assignable to ${X} (was ${Y})`;var Th=A$({kind:"predicate",hasAssociatedError:!0,collapsibleKey:"predicate",keys:{predicate:{}},normalize:($)=>typeof $==="function"?{predicate:$}:$,defaults:{description:($)=>`valid according to ${$.predicate.name||"an anonymous predicate"}`},intersectionIsOpen:!0,intersections:{predicate:()=>null}});class yT extends P1{serializedPredicate=F4(this.predicate);compiledCondition=`${this.serializedPredicate}(data, ctx)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=null;expression=this.serializedPredicate;traverseAllows=this.predicate;errorContext={code:"predicate",description:this.description,meta:this.meta};compiledErrorContext=d2(this.errorContext);traverseApply=($,X)=>{if(!this.predicate($,X.external)&&!X.hasError())X.errorFromNodeContext(this.errorContext)};compile($){if($.traversalKind==="Allows"){$.return(this.compiledCondition);return}$.if(`${this.compiledNegation} && !ctx.hasError()`,()=>$.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema($,X){return X.fallback.predicate({code:"predicate",base:$,predicate:this.predicate})}}var ME={implementation:Th,Node:yT};var vh=A$({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:($)=>Number.isInteger($)?$:f(Ch($))}},normalize:($)=>typeof $==="number"?{rule:$}:$,hasAssociatedError:!0,defaults:{description:($)=>$.rule===1?"an integer":$.rule===2?"even":`a multiple of ${$.rule}`},intersections:{divisor:($,X,Y)=>Y.$.node("divisor",{rule:Math.abs($.rule*X.rule/Bh($.rule,X.rule))})},obviatesBasisDescription:!0});class mT extends W2{traverseAllows=($)=>$%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=m.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema($){if($.type="integer",this.rule===1)return $;return $.multipleOf=this.rule,$}}var JE={implementation:vh,Node:mT};var Ch=($)=>`divisor must be an integer (was ${$})`,Bh=($,X)=>{let Y,U=$,G=X;while(G!==0)Y=G,G=U%G,U=Y;return U};class M1 extends W2{boundOperandKind=xh[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=Sh(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${jh[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?kh(this.numericLimit):`${this.numericLimit}`;limitKind=this.comparator["0"]==="<"?"upper":"lower";isStricterThan($){return(this.limitKind==="upper"?this.numericLimit<$.numericLimit:this.numericLimit>$.numericLimit)||this.numericLimit===$.numericLimit&&this.exclusive===!0&&!$.exclusive}overlapsRange($){if(this.isStricterThan($))return!1;if(this.numericLimit===$.numericLimit&&(this.exclusive||$.exclusive))return!1;return!0}overlapIsUnit($){return this.numericLimit===$.numericLimit&&!this.exclusive&&!$.exclusive}}var jh={"<":">=","<=":">",">":"<=",">=":"<"},Ph={min:"max",minLength:"maxLength",after:"before"},oz={parse:($)=>$||void 0},nz=($)=>(X)=>{if(typeof X==="number")return{rule:X};let{exclusive:Y,...U}=X;return Y?{...U,rule:$==="minLength"?U.rule+1:U.rule-1}:U},tz=($)=>(X)=>{if(typeof X==="number"||typeof X==="string"||X instanceof Date)return{rule:X};let{exclusive:Y,...U}=X;if(!Y)return U;let G=typeof U.rule==="number"?U.rule:typeof U.rule==="string"?new Date(U.rule).valueOf():U.rule.valueOf();return Y?{...U,rule:$==="after"?G+1:G-1}:U},az=($)=>typeof $==="string"||typeof $==="number"?new Date($):$,Ih=($,X)=>`${$} bound must be a positive integer (was ${X})`,B9=($)=>(X)=>{if(!Number.isInteger(X)||X<0)f(Ih($,X));return X},xh={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},Sh=($,X)=>`${u4($,Ph)?">":"<"}${X?"":"="}`,kh=($)=>typeof $==="string"?$:new Date($).toLocaleString(),uT=($)=>`Bounded expression ${$} must be exactly one of number, string, Array, or Date`;var bh=A$({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:az,serialize:($)=>$.toISOString()}},normalize:tz("after"),defaults:{description:($)=>`${$.collapsibleLimitString} or later`,actual:n8},intersections:{after:($,X)=>$.isStricterThan(X)?$:X}});class cT extends M1{impliedBasis=m.intrinsic.Date.internal;collapsibleLimitString=n8(this.rule);traverseAllows=($)=>$>=this.rule;reduceJsonSchema($,X){return X.fallback.date({code:"date",base:$,after:this.rule})}}var AE={implementation:bh,Node:cT};var fh=A$({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:az,serialize:($)=>$.toISOString()}},normalize:tz("before"),defaults:{description:($)=>`${$.collapsibleLimitString} or earlier`,actual:n8},intersections:{before:($,X)=>$.isStricterThan(X)?$:X,after:($,X,Y)=>$.overlapsRange(X)?$.overlapIsUnit(X)?Y.$.node("unit",{unit:$.rule}):null:a.init("range",$,X)}});class pT extends M1{collapsibleLimitString=n8(this.rule);traverseAllows=($)=>$<=this.rule;impliedBasis=m.intrinsic.Date.internal;reduceJsonSchema($,X){return X.fallback.date({code:"date",base:$,before:this.rule})}}var LE={implementation:fh,Node:pT};var hh=A$({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:B9("exactLength")}},normalize:($)=>typeof $==="number"?{rule:$}:$,hasAssociatedError:!0,defaults:{description:($)=>`exactly length ${$.rule}`,actual:($)=>`${$.length}`},intersections:{exactLength:($,X,Y)=>a.init("unit",Y.$.node("unit",{unit:$.rule}),Y.$.node("unit",{unit:X.rule}),{path:["length"]}),minLength:($,X)=>$.rule>=X.rule?$:a.init("range",$,X),maxLength:($,X)=>$.rule<=X.rule?$:a.init("range",$,X)}});class dT extends W2{traverseAllows=($)=>$.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=m.intrinsic.lengthBoundable.internal;expression=`== ${this.rule}`;reduceJsonSchema($){switch($.type){case"string":return $.minLength=this.rule,$.maxLength=this.rule,$;case"array":return $.minItems=this.rule,$.maxItems=this.rule,$;default:return Q4.throwInternalOperandError("exactLength",$)}}}var KE={implementation:hh,Node:dT};var gh=A$({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:oz},normalize:($)=>typeof $==="number"?{rule:$}:$,defaults:{description:($)=>{if($.rule===0)return $.exclusive?"negative":"non-positive";return`${$.exclusive?"less than":"at most"} ${$.rule}`}},intersections:{max:($,X)=>$.isStricterThan(X)?$:X,min:($,X,Y)=>$.overlapsRange(X)?$.overlapIsUnit(X)?Y.$.node("unit",{unit:$.rule}):null:a.init("range",$,X)},obviatesBasisDescription:!0});class lT extends M1{impliedBasis=m.intrinsic.number.internal;traverseAllows=this.exclusive?($)=>$<this.rule:($)=>$<=this.rule;reduceJsonSchema($){if(this.exclusive)$.exclusiveMaximum=this.rule;else $.maximum=this.rule;return $}}var _E={implementation:gh,Node:lT};var yh=A$({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:B9("maxLength")}},reduce:($,X)=>$.rule===0?X.node("exactLength",$):void 0,normalize:nz("maxLength"),defaults:{description:($)=>`at most length ${$.rule}`,actual:($)=>`${$.length}`},intersections:{maxLength:($,X)=>$.isStricterThan(X)?$:X,minLength:($,X,Y)=>$.overlapsRange(X)?$.overlapIsUnit(X)?Y.$.node("exactLength",{rule:$.rule}):null:a.init("range",$,X)}});class rT extends M1{impliedBasis=m.intrinsic.lengthBoundable.internal;traverseAllows=($)=>$.length<=this.rule;reduceJsonSchema($){switch($.type){case"string":return $.maxLength=this.rule,$;case"array":return $.maxItems=this.rule,$;default:return Q4.throwInternalOperandError("maxLength",$)}}}var qE={implementation:yh,Node:rT};var mh=A$({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:oz},normalize:($)=>typeof $==="number"?{rule:$}:$,defaults:{description:($)=>{if($.rule===0)return $.exclusive?"positive":"non-negative";return`${$.exclusive?"more than":"at least"} ${$.rule}`}},intersections:{min:($,X)=>$.isStricterThan(X)?$:X},obviatesBasisDescription:!0});class iT extends M1{impliedBasis=m.intrinsic.number.internal;traverseAllows=this.exclusive?($)=>$>this.rule:($)=>$>=this.rule;reduceJsonSchema($){if(this.exclusive)$.exclusiveMinimum=this.rule;else $.minimum=this.rule;return $}}var RE={implementation:mh,Node:iT};var uh=A$({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:B9("minLength")}},reduce:($)=>$.rule===0?m.intrinsic.unknown:void 0,normalize:nz("minLength"),defaults:{description:($)=>$.rule===1?"non-empty":`at least length ${$.rule}`,actual:($)=>$.length===0?"":`${$.length}`},intersections:{minLength:($,X)=>$.isStricterThan(X)?$:X}});class oT extends M1{impliedBasis=m.intrinsic.lengthBoundable.internal;traverseAllows=($)=>$.length>=this.rule;reduceJsonSchema($){switch($.type){case"string":return $.minLength=this.rule,$;case"array":return $.minItems=this.rule,$;default:return Q4.throwInternalOperandError("minLength",$)}}}var TE={implementation:uh,Node:oT};var nT={min:RE.implementation,max:_E.implementation,minLength:TE.implementation,maxLength:qE.implementation,exactLength:KE.implementation,after:AE.implementation,before:LE.implementation},tT={min:RE.Node,max:_E.Node,minLength:TE.Node,maxLength:qE.Node,exactLength:KE.Node,after:AE.Node,before:LE.Node};var ch=A$({kind:"pattern",collapsibleKey:"rule",keys:{rule:{},flags:{}},normalize:($)=>typeof $==="string"?{rule:$}:$ instanceof RegExp?$.flags?{rule:$.source,flags:$.flags}:{rule:$.source}:$,obviatesBasisDescription:!0,obviatesBasisExpression:!0,hasAssociatedError:!0,intersectionIsOpen:!0,defaults:{description:($)=>`matched by ${$.rule}`},intersections:{pattern:()=>null}});class aT extends W2{instance=new RegExp(this.rule,this.flags);expression=`${this.instance}`;traverseAllows=this.instance.test.bind(this.instance);compiledCondition=`${this.expression}.test(data)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=m.intrinsic.string.internal;reduceJsonSchema($,X){if($.pattern)return X.fallback.patternIntersection({code:"patternIntersection",base:$,pattern:this.rule});return $.pattern=this.rule,$}}var vE={implementation:ch,Node:aT};var H5=($,X)=>{let Y=ph($);if(X&&!X.includes(Y))return f(`Root of kind ${Y} should be one of ${X}`);return Y},ph=($)=>{if(U$($,"root"))return $.kind;if(typeof $==="string")return $[0]==="$"?"alias":($ in a6)?"domain":"proto";if(typeof $==="function")return"proto";if(typeof $!=="object"||$===null)return f(sT($));if("morphs"in $)return"morph";if("branches"in $||o$($))return"union";if("unit"in $)return"unit";if("reference"in $)return"alias";let X=Object.keys($);if(X.length===0||X.some((Y)=>(Y in lz)))return"intersection";if("proto"in $)return"proto";if("domain"in $)return"domain";return f(sT($))},sT=($)=>`${J$($)} is not a valid type schema`,eT={},dh=($)=>o$($)?$.map((X)=>X.collapsibleJson):$.collapsibleJson,h6={};m.nodesByRegisteredId=h6;var CE=($)=>{return eT[$]??=0,`${$}${++eT[$]}`},BE=($)=>{let X=j9[$.kind],Y=X.applyConfig?.($.def,$.$.resolvedConfig)??$.def,U={},{meta:G,...z}=Y,W=G===void 0?{}:typeof G==="string"?{description:G}:G,Q=aD(z).sort(([H],[V])=>q9(H)?q9(V)?R9(H)-R9(V):1:q9(V)?-1:H<V?-1:1).filter(([H,V])=>{if(H.startsWith("meta.")){let O=H.slice(5);return W[O]=V,!1}return!0});for(let H of Q){let V=H[0],O=X.keys[V];if(!O)return f(`Key ${V} is not valid on ${$.kind} schema`);let w=O.parse?O.parse(H[1],$):H[1];if(w!==F1&&(w!==void 0||O.preserveUndefined))U[V]=w}if(X.reduce&&!$.prereduced){let H=X.reduce(U,$.$);if(H){if(H instanceof a)return H.throw();return lh(H,W)}}return jE({id:$.id,kind:$.kind,inner:U,meta:W,$:$.$})},jE=({id:$,kind:X,inner:Y,meta:U,$:G,ignoreCache:z})=>{let W=j9[X],Q=aD(Y),Z=[],H={};for(let[A,L]of Q){let T=W.keys[A],q=T.serialize??(T.child?dh:j1);if(H[A]=q(L),T.child===!0){let v=L;if(o$(v))Z.push(...v);else Z.push(v)}else if(typeof T.child==="function")Z.push(...T.child(L))}if(W.finalizeInnerJson)H=W.finalizeInnerJson(H);let V={...H},O={};if(!F0(U))O=M$(U,(A,L)=>[A,A==="examples"?L:j1(L)]),V.meta=sz(O,"description",!0);H=sz(H,W.collapsibleKey,!1);let w=JSON.stringify({kind:X,...H});V=sz(V,W.collapsibleKey,!1);let D=sz(V,W.collapsibleKey,!0),E=JSON.stringify({kind:X,...V});if(G.nodesByHash[E]&&!z)return G.nodesByHash[E];let F={id:$,kind:X,impl:W,inner:Y,innerEntries:Q,innerJson:H,innerHash:w,meta:U,metaJson:O,json:V,hash:E,collapsibleJson:D,children:Z};if(X!=="intersection"){for(let A in Y)if(A!=="in"&&A!=="out")F[A]=Y[A]}let J=new Xv[X](F,G);return G.nodesByHash[E]=J},$v=($,X)=>{if($.id===X)return $;if(X4(h6[X]))S$(`Unexpected attempt to overwrite node id ${X}`);return jE({id:X,kind:$.kind,inner:$.inner,meta:$.meta,$:$.$,ignoreCache:!0})},lh=($,X,Y)=>{if(Y&&X4(h6[Y]))S$(`Unexpected attempt to overwrite node id ${Y}`);return jE({id:Y??CE(X.alias??$.kind),kind:$.kind,inner:$.inner,meta:X,$:$.$})},sz=($,X,Y)=>{let U=Object.keys($);if(U.length===1&&U[0]===X){let G=$[X];if(Y)return G;if(t6(G,"object")&&(Object.keys(G).length===1||Array.isArray(G)))return G}return $};var V5=($,X,Y)=>{if($.key!==X.key)return null;let U=$.key,G=Y4($.value,X.value,Y),z=$.required||X.required?"required":"optional";if(G instanceof a)if(z==="optional")G=m.intrinsic.never.internal;else return G.withPrefixKey($.key,$.required&&X.required?"required":"optional");if(z==="required")return Y.$.node("required",{key:U,value:G});let W=$.hasDefault()?X.hasDefault()?$.default===X.default?$.default:f(PE($.default,X.default)):$.default:X.hasDefault()?X.default:F1;return Y.$.node("optional",{key:U,value:G,default:W})};class O5 extends P1{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=m.intrinsic.object.internal;serializedKey=z2(this.key);compiledKey=typeof this.key==="string"?this.key:this.serializedKey;flatRefs=P$(this.value.flatRefs.map(($)=>o1([this.key,...$.path],$.node)),o1([this.key],this.value));_transform($,X){X.path.push(this.key);let Y=super._transform($,X);return X.path.pop(),Y}hasDefault(){return"default"in this.inner}traverseAllows=($,X)=>{if(this.key in $)return e6(this.key,()=>this.value.traverseAllows($[this.key],X),X);return this.optional};traverseApply=($,X)=>{if(this.key in $)e6(this.key,()=>this.value.traverseApply($[this.key],X),X);else if(this.hasKind("required"))X.errorFromNodeContext(this.errorContext)};compile($){if($.if(`${this.serializedKey} in data`,()=>$.traverseKey(this.serializedKey,`data${$.prop(this.key)}`,this.value)),this.hasKind("required"))$.else(()=>$.traversalKind==="Apply"?$.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`):$.return(!1));if($.traversalKind==="Allows")$.return(!0)}}var PE=($,X)=>`Invalid intersection of default values ${J$($)} & ${J$(X)}`;var rh=A$({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:($,X)=>X.$.parseSchema($)},default:{preserveUndefined:!0}},normalize:($)=>$,reduce:($,X)=>{if(X.resolvedConfig.exactOptionalPropertyTypes===!1){if(!$.value.allows(void 0))return X.node("optional",{...$,value:$.value.or(O$.undefined)},{prereduced:!0})}},defaults:{description:($)=>`${$.compiledKey}?: ${$.value.description}`},intersections:{optional:V5}});class Yv extends O5{constructor(...$){super(...$);if("default"in this.inner)D5(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;let{default:$,...X}=this.inner;return this.cacheGetter("outProp",this.$.node("required",X,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${J$(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=oh(this);defaultValueMorphRef=this.defaultValueMorph&&F4(this.defaultValueMorph)}var w5={implementation:rh,Node:Yv},ih={},oh=($)=>{if(!$.hasDefault())return;let X=`{${$.compiledKey}: ${$.value.id} = ${j1($.default)}}`;return ih[X]??=IE($.key,$.value,$.default)},IE=($,X,Y)=>{if(typeof Y==="function")return X.includesTransform?(G,z)=>{return e6($,()=>X(G[$]=Y(),z),z),G}:(G)=>{return G[$]=Y(),G};let U=X.includesTransform?X.assert(Y):Y;return t6(U,"object")?(G,z)=>{return e6($,()=>X(G[$]=Y,z),z),G}:(G)=>{return G[$]=U,G}},D5=($,X,Y)=>{let U=u2(X);if(t6(X,"object")&&!U)f(nh(Y));let G=$.in(U?X():X);if(G instanceof s6){if(Y===null)f(`Default ${G.summary}`);let z=G.transform((W)=>W.transform((Q)=>({...Q,prefixPath:[Y]})));f(`Default for ${z.summary}`)}return X},nh=($)=>{return`Non-primitive default ${$===null?"":typeof $==="number"?`for value at [${$}] `:`for ${z2($)} `}must be specified as a function like () => ({my: 'object'})`};class I1 extends Q5{constructor($,X){super($,X);Object.defineProperty(this,f6,{value:"root",enumerable:!1})}get internal(){return this}get "~standard"(){return{vendor:"arktype",version:1,validate:($)=>{let X=this($);if(X instanceof s6)return X;return{value:X}}}}as(){return this}brand($){if($==="")return f(th);return this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute($,X){let Y=this.branches.map($);return X?.(Y)??Y}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema($={}){let X=OE(this.$.resolvedConfig.toJsonSchema,$);X.useRefs||=this.isCyclic;let Y=typeof X.dialect==="string"?{$schema:X.dialect}:{};if(Object.assign(Y,this.toJsonSchemaRecurse(X)),X.useRefs)Y.$defs=M$(this.references,(U,G)=>G.isRoot()&&!G.alwaysExpandJsonSchema?[G.id,G.toResolvedJsonSchema(X)]:[]);return Y}toJsonSchemaRecurse($){if($.useRefs&&!this.alwaysExpandJsonSchema)return{$ref:`#/$defs/${this.id}`};return this.toResolvedJsonSchema($)}get alwaysExpandJsonSchema(){return this.isBasis()||this.kind==="alias"||this.hasKind("union")&&this.isBoolean}toResolvedJsonSchema($){let X=this.innerToJsonSchema($);return Object.assign(X,this.metaJson)}intersect($){let X=this.$.parseDefinition($),Y=this.rawIntersect(X);if(Y instanceof a)return Y;return this.$.finalize(Y)}rawIntersect($){return $1(this,$,this.$)}toNeverIfDisjoint(){return this}and($){let X=this.intersect($);return X instanceof a?X.throw():X}rawAnd($){let X=this.rawIntersect($);return X instanceof a?X.throw():X}or($){let X=this.$.parseDefinition($);return this.$.finalize(this.rawOr(X))}rawOr($){let X=[...this.branches,...$.branches];return this.$.node("union",X)}map($){return this.$.schema(this.applyStructuralOperation("map",[$]))}pick(...$){return this.$.schema(this.applyStructuralOperation("pick",$))}omit(...$){return this.$.schema(this.applyStructuralOperation("omit",$))}required(){return this.$.schema(this.applyStructuralOperation("required",[]))}partial(){return this.$.schema(this.applyStructuralOperation("partial",[]))}_keyof;keyof(){if(this._keyof)return this._keyof;let $=this.applyStructuralOperation("keyof",[]).reduce((X,Y)=>X.intersect(Y).toNeverIfDisjoint(),m.intrinsic.unknown.internal);if($.branches.length===0)f(NE(`keyof ${this.expression}`));return this._keyof=this.$.finalize($)}get props(){if(this.branches.length!==1)return f(ah(this.expression));return[...this.applyStructuralOperation("props",[])[0]]}merge($){let X=this.$.parseDefinition($);return this.$.schema(X.distribute((Y)=>this.applyStructuralOperation("merge",[Gv(Y)??f(Uv("merge",Y.expression))])))}applyStructuralOperation($,X){return this.distribute((Y)=>{if(Y.equals(m.intrinsic.object)&&$!=="merge")return Y;let U=Gv(Y);if(!U)f(Uv($,Y.expression));if($==="keyof")return U.keyof();if($==="get")return U.get(...X);if($==="props")return U.props;let G=$==="required"?"require":$==="partial"?"optionalize":$;return this.$.node("intersection",{...Y.inner,structure:U[G](...X)})})}get(...$){if($[0]===void 0)return this;return this.$.schema(this.applyStructuralOperation("get",$))}extract($){let X=this.$.parseDefinition($);return this.$.schema(this.branches.filter((Y)=>Y.extends(X)))}exclude($){let X=this.$.parseDefinition($);return this.$.schema(this.branches.filter((Y)=>!Y.extends(X)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps($){return!(this.intersect($)instanceof a)}extends($){let X=this.intersect($);return!(X instanceof a)&&this.equals(X)}ifExtends($){return this.extends($)?this:void 0}subsumes($){return this.$.parseDefinition($).extends(this)}configure($,X="shallow"){return this.configureReferences($,X)}describe($,X="shallow"){return this.configure({description:$},X)}optional(){return[this,"?"]}default($){return D5(this,$,null),[this,"=",$]}from($){return this.assert($)}_pipe(...$){let X=$.reduce((Y,U)=>Y.rawPipeOnce(U),this);return this.$.finalize(X)}tryPipe(...$){let X=$.reduce((Y,U)=>Y.rawPipeOnce(U$(U,"root")?U:(G,z)=>{try{return U(G,z)}catch(W){return z.error({code:"predicate",predicate:U,actual:`aborted due to error:
|
|
176
|
+
\u2022 `)}`}throw(){return f(this.describeReasons())}invert(){let $=this.map((X)=>({...X,l:X.r,r:X.l}));if(!($ instanceof a))return new a(...$);return $}withPrefixKey($,X){return this.map((Y)=>({...Y,path:[$,...Y.path],optional:Y.optional||X==="optional"}))}toNeverIfDisjoint(){return m.intrinsic.never}}var kT=($,X)=>`${EE($)} and ${EE(X)}`,EE=($)=>X4($)?$.expression:o$($)?$.map(EE).join(" | ")||"never":String($),NE=($)=>`${$} results in an unsatisfiable type`;var T9={},X1=($,X,Y)=>Y4($,X,{$:Y,invert:!1,pipe:!1}),Z5=($,X,Y)=>Y4($,X,{$:Y,invert:!1,pipe:!0}),Y4=($,X,Y)=>{let U=Y.pipe?"|>":"&",G=`${$.hash}${U}${X.hash}`;if(T9[G]!==void 0)return T9[G];if(!Y.pipe){let Q=`${X.hash}${U}${$.hash}`;if(T9[Q]!==void 0){let Z=T9[Q],H=Z instanceof a?Z.invert():Z;return T9[G]=H,H}}let z=!Y.pipe||!$.includesTransform&&!X.includesTransform;if(z&&$.equals(X))return $;let W=z?FE($,X,Y):$.hasKindIn(..._9)?Kh($,X,Y):FE($,X,Y);if(X4(W)){if($.equals(W))W=$;else if(X.equals(W))W=X}return T9[G]=W,W},FE=($,X,Y)=>{let U=$.precedence<X.precedence?$.kind:X.kind,G=$.impl.intersections[X.kind]??X.impl.intersections[$.kind];if(G===void 0)return null;else if(U===$.kind)return G($,X,Y);else{let z=G(X,$,{...Y,invert:!Y.invert});if(z instanceof a)z=z.invert();return z}},Kh=($,X,Y)=>$.includesTransform||X.includesTransform?Y.invert?bT(X,$,Y):bT($,X,Y):FE($,X,Y),bT=($,X,Y)=>$.distribute((U)=>_h(U,X,Y),(U)=>{let G=U.filter(X4);if(G.length===0)return a.init("union",$.branches,X.branches);if(G.length<$.branches.length||!$.branches.every((Q,Z)=>Q.in.equals(G[Z].in)))return Y.$.parseSchema(G);let z;if(G.length===1){let Q=G[0];if(!z)return Q;return Y.$.node("morph",{...Q.inner,in:Q.in.configure(z,"self")})}let W={branches:G};if(z)W.meta=z;return Y.$.parseSchema(W)}),_h=($,X,Y)=>{if($.hasKind("morph")){let G=[...$.morphs];if($.lastMorphIfNode){let z=Y4($.lastMorphIfNode,X,Y);if(z instanceof a)return z;G[G.length-1]=z}else G.push(X);return Y.$.node("morph",{morphs:G,in:$.inner.in})}if(X.hasKind("morph")){let G=Y4($,X.in,Y);if(G instanceof a)return G;return Y.$.node("morph",{morphs:[X],in:G})}return Y.$.node("morph",{morphs:[X],in:$})};class I1 extends Q5{constructor($,X){super($,X);Object.defineProperty(this,f6,{value:"constraint",enumerable:!1})}impliedSiblings;intersect($){return X1(this,$,this.$)}}class W2 extends I1{traverseApply=($,X)=>{if(!this.traverseAllows($,X))X.errorFromNodeContext(this.errorContext)};compile($){if($.traversalKind==="Allows")$.return(this.compiledCondition);else $.if(this.compiledNegation,()=>$.line(`${$.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return d2(this.errorContext)}}var w6=($)=>(X,Y)=>{if(o$(X)){if(X.length===0)return;let G=X.map((z)=>Y.$.node($,z));if($==="predicate")return G;return G.sort((z,W)=>z.hash<W.hash?-1:1)}let U=Y.$.node($,X);return U.hasOpenIntersection()?[U]:U},v9=($)=>{let X=$.r.shift();if(!X){let U=$.l.length===0&&$.kind==="structure"?m.intrinsic.unknown.internal:$.ctx.$.node($.kind,Object.assign($.baseInner,qh($.l)),{prereduced:!0});for(let G of $.roots){if(U instanceof a)return U;U=Y4(G,U,$.ctx)}return U}let Y=!1;for(let U=0;U<$.l.length;U++){let G=Y4($.l[U],X,$.ctx);if(G===null)continue;if(G instanceof a)return G;if(!Y){if(G.isRoot())return $.roots.push(G),$.l.splice(U),v9($);$.l[U]=G,Y=!0}else if(!$.l.includes(G))return S$(`Unexpectedly encountered multiple distinct intersection results for refinement ${G}`)}if(!Y)$.l.push(X);if($.kind==="intersection"){if(X.impliedSiblings)for(let U of X.impliedSiblings)F0($.r,U)}return v9($)},C9=($)=>{return Object.entries($).flatMap(([Y,U])=>(Y in lz)?U:[]).sort((Y,U)=>Y.precedence<U.precedence?-1:Y.precedence>U.precedence?1:Y.kind==="predicate"&&U.kind==="predicate"?0:Y.hash<U.hash?-1:1)},qh=($)=>{let X={};for(let Y of $)if(Y.hasOpenIntersection())X[Y.kind]=P$(X[Y.kind],Y);else{if(X[Y.kind])return S$(`Unexpected intersection of closed refinements of kind ${Y.kind}`);X[Y.kind]=Y}return X},fT=(...$)=>f(hT(...$)),hT=($,X,Y)=>{let U=Y.hasKind("morph")?"a morph":Y.isUnknown()?"unknown":Y.exclude(X).defaultShortDescription;return`${wT($)} operand must be ${X.description} (was ${U})`};var gT=($,X,Y)=>new r2($,X,Y,Y,null);class iz extends i1{}class r2 extends i1{[f6]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor($,X,Y,U,G){super((...z)=>{let W=M$(this.names,(Q,Z)=>{let H=this.arg$.parse(z[Q]);if(!H.extends(this.constraints[Q]))f(Rh(Z,this.constraints[Q].expression,H.expression));return[Z,H]});if(this.defIsLazy()){let Q=this.bodyDef(W);return this.$.parse(Q)}return this.$.parse(X,{args:W})});this.paramDefs=$,this.bodyDef=X,this.$=Y,this.arg$=U,this.hkt=G,this.description=G?new G().description??`a generic type for ${G.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof iz}cacheGetter($,X){return Object.defineProperty(this,$,{value:X}),X}get json(){return this.cacheGetter("json",{params:this.params.map(($)=>$[1].isUnknown()?$[0]:[$[0],$[1].json]),body:qT(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(($)=>typeof $==="string"?[$,m.intrinsic.unknown]:[$[0],this.$.parse($[1])]))}get names(){return this.cacheGetter("names",this.params.map(($)=>$[0]))}get constraints(){return this.cacheGetter("constraints",this.params.map(($)=>$[1]))}get internal(){return this}get referencesById(){return this.baseInstantiation.internal.referencesById}get references(){return this.baseInstantiation.internal.references}}var Rh=($,X,Y)=>`${$} must be assignable to ${X} (was ${Y})`;var Th=A$({kind:"predicate",hasAssociatedError:!0,collapsibleKey:"predicate",keys:{predicate:{}},normalize:($)=>typeof $==="function"?{predicate:$}:$,defaults:{description:($)=>`valid according to ${$.predicate.name||"an anonymous predicate"}`},intersectionIsOpen:!0,intersections:{predicate:()=>null}});class yT extends I1{serializedPredicate=F4(this.predicate);compiledCondition=`${this.serializedPredicate}(data, ctx)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=null;expression=this.serializedPredicate;traverseAllows=this.predicate;errorContext={code:"predicate",description:this.description,meta:this.meta};compiledErrorContext=d2(this.errorContext);traverseApply=($,X)=>{if(!this.predicate($,X.external)&&!X.hasError())X.errorFromNodeContext(this.errorContext)};compile($){if($.traversalKind==="Allows"){$.return(this.compiledCondition);return}$.if(`${this.compiledNegation} && !ctx.hasError()`,()=>$.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema($,X){return X.fallback.predicate({code:"predicate",base:$,predicate:this.predicate})}}var ME={implementation:Th,Node:yT};var vh=A$({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:($)=>Number.isInteger($)?$:f(Ch($))}},normalize:($)=>typeof $==="number"?{rule:$}:$,hasAssociatedError:!0,defaults:{description:($)=>$.rule===1?"an integer":$.rule===2?"even":`a multiple of ${$.rule}`},intersections:{divisor:($,X,Y)=>Y.$.node("divisor",{rule:Math.abs($.rule*X.rule/Bh($.rule,X.rule))})},obviatesBasisDescription:!0});class mT extends W2{traverseAllows=($)=>$%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=m.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema($){if($.type="integer",this.rule===1)return $;return $.multipleOf=this.rule,$}}var JE={implementation:vh,Node:mT};var Ch=($)=>`divisor must be an integer (was ${$})`,Bh=($,X)=>{let Y,U=$,G=X;while(G!==0)Y=G,G=U%G,U=Y;return U};class J1 extends W2{boundOperandKind=xh[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=Sh(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${jh[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?kh(this.numericLimit):`${this.numericLimit}`;limitKind=this.comparator["0"]==="<"?"upper":"lower";isStricterThan($){return(this.limitKind==="upper"?this.numericLimit<$.numericLimit:this.numericLimit>$.numericLimit)||this.numericLimit===$.numericLimit&&this.exclusive===!0&&!$.exclusive}overlapsRange($){if(this.isStricterThan($))return!1;if(this.numericLimit===$.numericLimit&&(this.exclusive||$.exclusive))return!1;return!0}overlapIsUnit($){return this.numericLimit===$.numericLimit&&!this.exclusive&&!$.exclusive}}var jh={"<":">=","<=":">",">":"<=",">=":"<"},Ph={min:"max",minLength:"maxLength",after:"before"},oz={parse:($)=>$||void 0},nz=($)=>(X)=>{if(typeof X==="number")return{rule:X};let{exclusive:Y,...U}=X;return Y?{...U,rule:$==="minLength"?U.rule+1:U.rule-1}:U},tz=($)=>(X)=>{if(typeof X==="number"||typeof X==="string"||X instanceof Date)return{rule:X};let{exclusive:Y,...U}=X;if(!Y)return U;let G=typeof U.rule==="number"?U.rule:typeof U.rule==="string"?new Date(U.rule).valueOf():U.rule.valueOf();return Y?{...U,rule:$==="after"?G+1:G-1}:U},az=($)=>typeof $==="string"||typeof $==="number"?new Date($):$,Ih=($,X)=>`${$} bound must be a positive integer (was ${X})`,B9=($)=>(X)=>{if(!Number.isInteger(X)||X<0)f(Ih($,X));return X},xh={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},Sh=($,X)=>`${u4($,Ph)?">":"<"}${X?"":"="}`,kh=($)=>typeof $==="string"?$:new Date($).toLocaleString(),uT=($)=>`Bounded expression ${$} must be exactly one of number, string, Array, or Date`;var bh=A$({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:az,serialize:($)=>$.toISOString()}},normalize:tz("after"),defaults:{description:($)=>`${$.collapsibleLimitString} or later`,actual:n8},intersections:{after:($,X)=>$.isStricterThan(X)?$:X}});class cT extends J1{impliedBasis=m.intrinsic.Date.internal;collapsibleLimitString=n8(this.rule);traverseAllows=($)=>$>=this.rule;reduceJsonSchema($,X){return X.fallback.date({code:"date",base:$,after:this.rule})}}var AE={implementation:bh,Node:cT};var fh=A$({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:az,serialize:($)=>$.toISOString()}},normalize:tz("before"),defaults:{description:($)=>`${$.collapsibleLimitString} or earlier`,actual:n8},intersections:{before:($,X)=>$.isStricterThan(X)?$:X,after:($,X,Y)=>$.overlapsRange(X)?$.overlapIsUnit(X)?Y.$.node("unit",{unit:$.rule}):null:a.init("range",$,X)}});class pT extends J1{collapsibleLimitString=n8(this.rule);traverseAllows=($)=>$<=this.rule;impliedBasis=m.intrinsic.Date.internal;reduceJsonSchema($,X){return X.fallback.date({code:"date",base:$,before:this.rule})}}var LE={implementation:fh,Node:pT};var hh=A$({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:B9("exactLength")}},normalize:($)=>typeof $==="number"?{rule:$}:$,hasAssociatedError:!0,defaults:{description:($)=>`exactly length ${$.rule}`,actual:($)=>`${$.length}`},intersections:{exactLength:($,X,Y)=>a.init("unit",Y.$.node("unit",{unit:$.rule}),Y.$.node("unit",{unit:X.rule}),{path:["length"]}),minLength:($,X)=>$.rule>=X.rule?$:a.init("range",$,X),maxLength:($,X)=>$.rule<=X.rule?$:a.init("range",$,X)}});class dT extends W2{traverseAllows=($)=>$.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=m.intrinsic.lengthBoundable.internal;expression=`== ${this.rule}`;reduceJsonSchema($){switch($.type){case"string":return $.minLength=this.rule,$.maxLength=this.rule,$;case"array":return $.minItems=this.rule,$.maxItems=this.rule,$;default:return Q4.throwInternalOperandError("exactLength",$)}}}var KE={implementation:hh,Node:dT};var gh=A$({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:oz},normalize:($)=>typeof $==="number"?{rule:$}:$,defaults:{description:($)=>{if($.rule===0)return $.exclusive?"negative":"non-positive";return`${$.exclusive?"less than":"at most"} ${$.rule}`}},intersections:{max:($,X)=>$.isStricterThan(X)?$:X,min:($,X,Y)=>$.overlapsRange(X)?$.overlapIsUnit(X)?Y.$.node("unit",{unit:$.rule}):null:a.init("range",$,X)},obviatesBasisDescription:!0});class lT extends J1{impliedBasis=m.intrinsic.number.internal;traverseAllows=this.exclusive?($)=>$<this.rule:($)=>$<=this.rule;reduceJsonSchema($){if(this.exclusive)$.exclusiveMaximum=this.rule;else $.maximum=this.rule;return $}}var _E={implementation:gh,Node:lT};var yh=A$({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:B9("maxLength")}},reduce:($,X)=>$.rule===0?X.node("exactLength",$):void 0,normalize:nz("maxLength"),defaults:{description:($)=>`at most length ${$.rule}`,actual:($)=>`${$.length}`},intersections:{maxLength:($,X)=>$.isStricterThan(X)?$:X,minLength:($,X,Y)=>$.overlapsRange(X)?$.overlapIsUnit(X)?Y.$.node("exactLength",{rule:$.rule}):null:a.init("range",$,X)}});class rT extends J1{impliedBasis=m.intrinsic.lengthBoundable.internal;traverseAllows=($)=>$.length<=this.rule;reduceJsonSchema($){switch($.type){case"string":return $.maxLength=this.rule,$;case"array":return $.maxItems=this.rule,$;default:return Q4.throwInternalOperandError("maxLength",$)}}}var qE={implementation:yh,Node:rT};var mh=A$({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:oz},normalize:($)=>typeof $==="number"?{rule:$}:$,defaults:{description:($)=>{if($.rule===0)return $.exclusive?"positive":"non-negative";return`${$.exclusive?"more than":"at least"} ${$.rule}`}},intersections:{min:($,X)=>$.isStricterThan(X)?$:X},obviatesBasisDescription:!0});class iT extends J1{impliedBasis=m.intrinsic.number.internal;traverseAllows=this.exclusive?($)=>$>this.rule:($)=>$>=this.rule;reduceJsonSchema($){if(this.exclusive)$.exclusiveMinimum=this.rule;else $.minimum=this.rule;return $}}var RE={implementation:mh,Node:iT};var uh=A$({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:B9("minLength")}},reduce:($)=>$.rule===0?m.intrinsic.unknown:void 0,normalize:nz("minLength"),defaults:{description:($)=>$.rule===1?"non-empty":`at least length ${$.rule}`,actual:($)=>$.length===0?"":`${$.length}`},intersections:{minLength:($,X)=>$.isStricterThan(X)?$:X}});class oT extends J1{impliedBasis=m.intrinsic.lengthBoundable.internal;traverseAllows=($)=>$.length>=this.rule;reduceJsonSchema($){switch($.type){case"string":return $.minLength=this.rule,$;case"array":return $.minItems=this.rule,$;default:return Q4.throwInternalOperandError("minLength",$)}}}var TE={implementation:uh,Node:oT};var nT={min:RE.implementation,max:_E.implementation,minLength:TE.implementation,maxLength:qE.implementation,exactLength:KE.implementation,after:AE.implementation,before:LE.implementation},tT={min:RE.Node,max:_E.Node,minLength:TE.Node,maxLength:qE.Node,exactLength:KE.Node,after:AE.Node,before:LE.Node};var ch=A$({kind:"pattern",collapsibleKey:"rule",keys:{rule:{},flags:{}},normalize:($)=>typeof $==="string"?{rule:$}:$ instanceof RegExp?$.flags?{rule:$.source,flags:$.flags}:{rule:$.source}:$,obviatesBasisDescription:!0,obviatesBasisExpression:!0,hasAssociatedError:!0,intersectionIsOpen:!0,defaults:{description:($)=>`matched by ${$.rule}`},intersections:{pattern:()=>null}});class aT extends W2{instance=new RegExp(this.rule,this.flags);expression=`${this.instance}`;traverseAllows=this.instance.test.bind(this.instance);compiledCondition=`${this.expression}.test(data)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=m.intrinsic.string.internal;reduceJsonSchema($,X){if($.pattern)return X.fallback.patternIntersection({code:"patternIntersection",base:$,pattern:this.rule});return $.pattern=this.rule,$}}var vE={implementation:ch,Node:aT};var H5=($,X)=>{let Y=ph($);if(X&&!X.includes(Y))return f(`Root of kind ${Y} should be one of ${X}`);return Y},ph=($)=>{if(U$($,"root"))return $.kind;if(typeof $==="string")return $[0]==="$"?"alias":($ in s6)?"domain":"proto";if(typeof $==="function")return"proto";if(typeof $!=="object"||$===null)return f(sT($));if("morphs"in $)return"morph";if("branches"in $||o$($))return"union";if("unit"in $)return"unit";if("reference"in $)return"alias";let X=Object.keys($);if(X.length===0||X.some((Y)=>(Y in lz)))return"intersection";if("proto"in $)return"proto";if("domain"in $)return"domain";return f(sT($))},sT=($)=>`${J$($)} is not a valid type schema`,eT={},dh=($)=>o$($)?$.map((X)=>X.collapsibleJson):$.collapsibleJson,h6={};m.nodesByRegisteredId=h6;var CE=($)=>{return eT[$]??=0,`${$}${++eT[$]}`},BE=($)=>{let X=j9[$.kind],Y=X.applyConfig?.($.def,$.$.resolvedConfig)??$.def,U={},{meta:G,...z}=Y,W=G===void 0?{}:typeof G==="string"?{description:G}:G,Q=aD(z).sort(([H],[V])=>q9(H)?q9(V)?R9(H)-R9(V):1:q9(V)?-1:H<V?-1:1).filter(([H,V])=>{if(H.startsWith("meta.")){let O=H.slice(5);return W[O]=V,!1}return!0});for(let H of Q){let V=H[0],O=X.keys[V];if(!O)return f(`Key ${V} is not valid on ${$.kind} schema`);let w=O.parse?O.parse(H[1],$):H[1];if(w!==M1&&(w!==void 0||O.preserveUndefined))U[V]=w}if(X.reduce&&!$.prereduced){let H=X.reduce(U,$.$);if(H){if(H instanceof a)return H.throw();return lh(H,W)}}return jE({id:$.id,kind:$.kind,inner:U,meta:W,$:$.$})},jE=({id:$,kind:X,inner:Y,meta:U,$:G,ignoreCache:z})=>{let W=j9[X],Q=aD(Y),Z=[],H={};for(let[A,L]of Q){let T=W.keys[A],q=T.serialize??(T.child?dh:P1);if(H[A]=q(L),T.child===!0){let v=L;if(o$(v))Z.push(...v);else Z.push(v)}else if(typeof T.child==="function")Z.push(...T.child(L))}if(W.finalizeInnerJson)H=W.finalizeInnerJson(H);let V={...H},O={};if(!M0(U))O=M$(U,(A,L)=>[A,A==="examples"?L:P1(L)]),V.meta=sz(O,"description",!0);H=sz(H,W.collapsibleKey,!1);let w=JSON.stringify({kind:X,...H});V=sz(V,W.collapsibleKey,!1);let D=sz(V,W.collapsibleKey,!0),E=JSON.stringify({kind:X,...V});if(G.nodesByHash[E]&&!z)return G.nodesByHash[E];let F={id:$,kind:X,impl:W,inner:Y,innerEntries:Q,innerJson:H,innerHash:w,meta:U,metaJson:O,json:V,hash:E,collapsibleJson:D,children:Z};if(X!=="intersection"){for(let A in Y)if(A!=="in"&&A!=="out")F[A]=Y[A]}let J=new Xv[X](F,G);return G.nodesByHash[E]=J},$v=($,X)=>{if($.id===X)return $;if(X4(h6[X]))S$(`Unexpected attempt to overwrite node id ${X}`);return jE({id:X,kind:$.kind,inner:$.inner,meta:$.meta,$:$.$,ignoreCache:!0})},lh=($,X,Y)=>{if(Y&&X4(h6[Y]))S$(`Unexpected attempt to overwrite node id ${Y}`);return jE({id:Y??CE(X.alias??$.kind),kind:$.kind,inner:$.inner,meta:X,$:$.$})},sz=($,X,Y)=>{let U=Object.keys($);if(U.length===1&&U[0]===X){let G=$[X];if(Y)return G;if(a6(G,"object")&&(Object.keys(G).length===1||Array.isArray(G)))return G}return $};var V5=($,X,Y)=>{if($.key!==X.key)return null;let U=$.key,G=Y4($.value,X.value,Y),z=$.required||X.required?"required":"optional";if(G instanceof a)if(z==="optional")G=m.intrinsic.never.internal;else return G.withPrefixKey($.key,$.required&&X.required?"required":"optional");if(z==="required")return Y.$.node("required",{key:U,value:G});let W=$.hasDefault()?X.hasDefault()?$.default===X.default?$.default:f(PE($.default,X.default)):$.default:X.hasDefault()?X.default:M1;return Y.$.node("optional",{key:U,value:G,default:W})};class O5 extends I1{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=m.intrinsic.object.internal;serializedKey=z2(this.key);compiledKey=typeof this.key==="string"?this.key:this.serializedKey;flatRefs=P$(this.value.flatRefs.map(($)=>n1([this.key,...$.path],$.node)),n1([this.key],this.value));_transform($,X){X.path.push(this.key);let Y=super._transform($,X);return X.path.pop(),Y}hasDefault(){return"default"in this.inner}traverseAllows=($,X)=>{if(this.key in $)return $1(this.key,()=>this.value.traverseAllows($[this.key],X),X);return this.optional};traverseApply=($,X)=>{if(this.key in $)$1(this.key,()=>this.value.traverseApply($[this.key],X),X);else if(this.hasKind("required"))X.errorFromNodeContext(this.errorContext)};compile($){if($.if(`${this.serializedKey} in data`,()=>$.traverseKey(this.serializedKey,`data${$.prop(this.key)}`,this.value)),this.hasKind("required"))$.else(()=>$.traversalKind==="Apply"?$.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`):$.return(!1));if($.traversalKind==="Allows")$.return(!0)}}var PE=($,X)=>`Invalid intersection of default values ${J$($)} & ${J$(X)}`;var rh=A$({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:($,X)=>X.$.parseSchema($)},default:{preserveUndefined:!0}},normalize:($)=>$,reduce:($,X)=>{if(X.resolvedConfig.exactOptionalPropertyTypes===!1){if(!$.value.allows(void 0))return X.node("optional",{...$,value:$.value.or(O$.undefined)},{prereduced:!0})}},defaults:{description:($)=>`${$.compiledKey}?: ${$.value.description}`},intersections:{optional:V5}});class Yv extends O5{constructor(...$){super(...$);if("default"in this.inner)D5(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;let{default:$,...X}=this.inner;return this.cacheGetter("outProp",this.$.node("required",X,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${J$(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=oh(this);defaultValueMorphRef=this.defaultValueMorph&&F4(this.defaultValueMorph)}var w5={implementation:rh,Node:Yv},ih={},oh=($)=>{if(!$.hasDefault())return;let X=`{${$.compiledKey}: ${$.value.id} = ${P1($.default)}}`;return ih[X]??=IE($.key,$.value,$.default)},IE=($,X,Y)=>{if(typeof Y==="function")return X.includesTransform?(G,z)=>{return $1($,()=>X(G[$]=Y(),z),z),G}:(G)=>{return G[$]=Y(),G};let U=X.includesTransform?X.assert(Y):Y;return a6(U,"object")?(G,z)=>{return $1($,()=>X(G[$]=Y,z),z),G}:(G)=>{return G[$]=U,G}},D5=($,X,Y)=>{let U=u2(X);if(a6(X,"object")&&!U)f(nh(Y));let G=$.in(U?X():X);if(G instanceof e6){if(Y===null)f(`Default ${G.summary}`);let z=G.transform((W)=>W.transform((Q)=>({...Q,prefixPath:[Y]})));f(`Default for ${z.summary}`)}return X},nh=($)=>{return`Non-primitive default ${$===null?"":typeof $==="number"?`for value at [${$}] `:`for ${z2($)} `}must be specified as a function like () => ({my: 'object'})`};class x1 extends Q5{constructor($,X){super($,X);Object.defineProperty(this,f6,{value:"root",enumerable:!1})}get internal(){return this}get "~standard"(){return{vendor:"arktype",version:1,validate:($)=>{let X=this($);if(X instanceof e6)return X;return{value:X}}}}as(){return this}brand($){if($==="")return f(th);return this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute($,X){let Y=this.branches.map($);return X?.(Y)??Y}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema($={}){let X=OE(this.$.resolvedConfig.toJsonSchema,$);X.useRefs||=this.isCyclic;let Y=typeof X.dialect==="string"?{$schema:X.dialect}:{};if(Object.assign(Y,this.toJsonSchemaRecurse(X)),X.useRefs)Y.$defs=M$(this.references,(U,G)=>G.isRoot()&&!G.alwaysExpandJsonSchema?[G.id,G.toResolvedJsonSchema(X)]:[]);return Y}toJsonSchemaRecurse($){if($.useRefs&&!this.alwaysExpandJsonSchema)return{$ref:`#/$defs/${this.id}`};return this.toResolvedJsonSchema($)}get alwaysExpandJsonSchema(){return this.isBasis()||this.kind==="alias"||this.hasKind("union")&&this.isBoolean}toResolvedJsonSchema($){let X=this.innerToJsonSchema($);return Object.assign(X,this.metaJson)}intersect($){let X=this.$.parseDefinition($),Y=this.rawIntersect(X);if(Y instanceof a)return Y;return this.$.finalize(Y)}rawIntersect($){return X1(this,$,this.$)}toNeverIfDisjoint(){return this}and($){let X=this.intersect($);return X instanceof a?X.throw():X}rawAnd($){let X=this.rawIntersect($);return X instanceof a?X.throw():X}or($){let X=this.$.parseDefinition($);return this.$.finalize(this.rawOr(X))}rawOr($){let X=[...this.branches,...$.branches];return this.$.node("union",X)}map($){return this.$.schema(this.applyStructuralOperation("map",[$]))}pick(...$){return this.$.schema(this.applyStructuralOperation("pick",$))}omit(...$){return this.$.schema(this.applyStructuralOperation("omit",$))}required(){return this.$.schema(this.applyStructuralOperation("required",[]))}partial(){return this.$.schema(this.applyStructuralOperation("partial",[]))}_keyof;keyof(){if(this._keyof)return this._keyof;let $=this.applyStructuralOperation("keyof",[]).reduce((X,Y)=>X.intersect(Y).toNeverIfDisjoint(),m.intrinsic.unknown.internal);if($.branches.length===0)f(NE(`keyof ${this.expression}`));return this._keyof=this.$.finalize($)}get props(){if(this.branches.length!==1)return f(ah(this.expression));return[...this.applyStructuralOperation("props",[])[0]]}merge($){let X=this.$.parseDefinition($);return this.$.schema(X.distribute((Y)=>this.applyStructuralOperation("merge",[Gv(Y)??f(Uv("merge",Y.expression))])))}applyStructuralOperation($,X){return this.distribute((Y)=>{if(Y.equals(m.intrinsic.object)&&$!=="merge")return Y;let U=Gv(Y);if(!U)f(Uv($,Y.expression));if($==="keyof")return U.keyof();if($==="get")return U.get(...X);if($==="props")return U.props;let G=$==="required"?"require":$==="partial"?"optionalize":$;return this.$.node("intersection",{...Y.inner,structure:U[G](...X)})})}get(...$){if($[0]===void 0)return this;return this.$.schema(this.applyStructuralOperation("get",$))}extract($){let X=this.$.parseDefinition($);return this.$.schema(this.branches.filter((Y)=>Y.extends(X)))}exclude($){let X=this.$.parseDefinition($);return this.$.schema(this.branches.filter((Y)=>!Y.extends(X)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps($){return!(this.intersect($)instanceof a)}extends($){let X=this.intersect($);return!(X instanceof a)&&this.equals(X)}ifExtends($){return this.extends($)?this:void 0}subsumes($){return this.$.parseDefinition($).extends(this)}configure($,X="shallow"){return this.configureReferences($,X)}describe($,X="shallow"){return this.configure({description:$},X)}optional(){return[this,"?"]}default($){return D5(this,$,null),[this,"=",$]}from($){return this.assert($)}_pipe(...$){let X=$.reduce((Y,U)=>Y.rawPipeOnce(U),this);return this.$.finalize(X)}tryPipe(...$){let X=$.reduce((Y,U)=>Y.rawPipeOnce(U$(U,"root")?U:(G,z)=>{try{return U(G,z)}catch(W){return z.error({code:"predicate",predicate:U,actual:`aborted due to error:
|
|
177
177
|
${W}
|
|
178
|
-
`})}}),this);return this.$.finalize(X)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to($){return this.$.finalize(this.toNode(this.$.parseDefinition($)))}toNode($){let X=Z5(this,$,this.$);if(X instanceof a)return X.throw();return X}rawPipeOnce($){if(U$($,"root"))return this.toNode($);return this.distribute((X)=>X.hasKind("morph")?this.$.node("morph",{in:X.inner.in,morphs:[...X.morphs,$]}):this.$.node("morph",{in:X,morphs:[$]}),this.$.parseSchema)}narrow($){return this.constrainOut("predicate",$)}constrain($,X){return this._constrain("root",$,X)}constrainIn($,X){return this._constrain("in",$,X)}constrainOut($,X){return this._constrain("out",$,X)}_constrain($,X,Y){let U=this.$.node(X,Y);if(U.isRoot())return U.isUnknown()?this:S$(`Unexpected constraint node ${U}`);let G=$==="root"?this:this[$];if(G.hasKind("morph")||U.impliedBasis&&!G.extends(U.impliedBasis))return fT(X,U.impliedBasis,this);let z=this.$.node("intersection",{[U.kind]:U}),W=$==="out"?Z5(this,z,this.$)
|
|
179
|
-
${$}`,Uv=($,X)=>`${$} operand must be an object (was ${X})`;var
|
|
178
|
+
`})}}),this);return this.$.finalize(X)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to($){return this.$.finalize(this.toNode(this.$.parseDefinition($)))}toNode($){let X=Z5(this,$,this.$);if(X instanceof a)return X.throw();return X}rawPipeOnce($){if(U$($,"root"))return this.toNode($);return this.distribute((X)=>X.hasKind("morph")?this.$.node("morph",{in:X.inner.in,morphs:[...X.morphs,$]}):this.$.node("morph",{in:X,morphs:[$]}),this.$.parseSchema)}narrow($){return this.constrainOut("predicate",$)}constrain($,X){return this._constrain("root",$,X)}constrainIn($,X){return this._constrain("in",$,X)}constrainOut($,X){return this._constrain("out",$,X)}_constrain($,X,Y){let U=this.$.node(X,Y);if(U.isRoot())return U.isUnknown()?this:S$(`Unexpected constraint node ${U}`);let G=$==="root"?this:this[$];if(G.hasKind("morph")||U.impliedBasis&&!G.extends(U.impliedBasis))return fT(X,U.impliedBasis,this);let z=this.$.node("intersection",{[U.kind]:U}),W=$==="out"?Z5(this,z,this.$):X1(this,z,this.$);if(W instanceof a)W.throw();return this.$.finalize(W)}onUndeclaredKey($){let X=typeof $==="string"?$:$.rule,Y=typeof $==="string"?!1:$.deep;return this.$.finalize(this.transform((U,G)=>U==="structure"?X==="ignore"?XT(G,{undeclared:1}):{...G,undeclared:X}:G,Y?void 0:{shouldTransform:(U)=>!$2(K9,U.kind)}))}hasEqualMorphs($){if(!this.includesTransform&&!$.includesTransform)return!0;if(!Y2(this.shallowMorphs,$.shallowMorphs))return!1;if(!Y2(this.flatMorphs,$.flatMorphs,{isEqual:(X,Y)=>X.propString===Y.propString&&(X.node.hasKind("morph")&&Y.node.hasKind("morph")?X.node.hasEqualMorphs(Y.node):X.node.hasKind("intersection")&&Y.node.hasKind("intersection")?X.node.structure?.structuralMorphRef===Y.node.structure?.structuralMorphRef:!1)}))return!1;return!0}onDeepUndeclaredKey($){return this.onUndeclaredKey({rule:$,deep:!0})}filter($){return this.constrainIn("predicate",$)}divisibleBy($){return this.constrain("divisor",$)}matching($){return this.constrain("pattern",$)}atLeast($){return this.constrain("min",$)}atMost($){return this.constrain("max",$)}moreThan($){return this.constrain("min",P9($))}lessThan($){return this.constrain("max",P9($))}atLeastLength($){return this.constrain("minLength",$)}atMostLength($){return this.constrain("maxLength",$)}moreThanLength($){return this.constrain("minLength",P9($))}lessThanLength($){return this.constrain("maxLength",P9($))}exactlyLength($){return this.constrain("exactLength",$)}atOrAfter($){return this.constrain("after",$)}atOrBefore($){return this.constrain("before",$)}laterThan($){return this.constrain("after",P9($))}earlierThan($){return this.constrain("before",P9($))}}var th="Expected a non-empty brand name after #",P9=($)=>typeof $==="object"&&!($ instanceof Date)?{...$,exclusive:!0}:{rule:$,exclusive:!0},E5=($,X)=>U$(X,"root")?U$($,"root")?$.extends(X):X.allows($):U$($,"root")?$.hasUnit(X):X===$,Gv=($)=>{if($.hasKind("morph"))return null;if($.hasKind("intersection"))return $.inner.structure??($.basis?.domain==="object"?$.$.bindReference(m.intrinsic.emptyStructure):null);if($.isBasis()&&$.domain==="object")return $.$.bindReference(m.intrinsic.emptyStructure);return null},ah=($)=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
|
|
179
|
+
${$}`,Uv=($,X)=>`${$} operand must be an object (was ${X})`;var J0=($,X)=>M$(rz($),(Y,U)=>[U,X]);var sh=($)=>typeof $==="string"?{reference:$}:$,zv=($)=>$ instanceof a?m.intrinsic.never.internal:$,eh=A$({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:($)=>$.startsWith("$")?$:`$ark.${$}`},resolve:{}},normalize:sh,defaults:{description:($)=>$.reference},intersections:{alias:($,X,Y)=>Y.$.lazilyResolve(()=>zv(Y4($.resolution,X.resolution,Y)),`${$.reference}${Y.pipe?"=>":"&"}${X.reference}`),...J0("alias",($,X,Y)=>{if(X.isUnknown())return $;if(X.isNever())return X;if(X.isBasis()&&!X.overlaps(m.intrinsic.object))return a.init("assignability",m.intrinsic.object,X);return Y.$.lazilyResolve(()=>zv(Y4($.resolution,X,Y)),`${$.reference}${Y.pipe?"=>":"&"}${X.id}`)})}});class Wv extends x1{expression=this.reference;structure=void 0;get resolution(){let $=this._resolve();return h6[this.id]=$}_resolve(){if(this.resolve)return this.resolve();if(this.reference[0]==="$")return this.$.resolveRoot(this.reference.slice(1));let $=this.reference,X=h6[$],Y=[];while(U$(X,"context")){if(Y.includes(X.id))return f($g(X.id,Y));Y.push(X.id),X=h6[X.id]}if(!U$(X,"root"))return S$(`Unexpected resolution for reference ${this.reference}
|
|
180
180
|
Seen: [${Y.join("->")}]
|
|
181
|
-
Resolution: ${J$(X)}`);return X}get resolutionId(){if(this.reference.includes("&")||this.reference.includes("=>"))return this.resolution.id;if(this.reference[0]!=="$")return this.reference;let $=this.reference.slice(1),X=this.$.resolutions[$];if(typeof X==="string")return X;if(U$(X,"root"))return X.id;return S$(`Unexpected resolution for reference ${this.reference}: ${J$(X)}`)}get defaultShortDescription(){return
|
|
181
|
+
Resolution: ${J$(X)}`);return X}get resolutionId(){if(this.reference.includes("&")||this.reference.includes("=>"))return this.resolution.id;if(this.reference[0]!=="$")return this.reference;let $=this.reference.slice(1),X=this.$.resolutions[$];if(typeof X==="string")return X;if(U$(X,"root"))return X.id;return S$(`Unexpected resolution for reference ${this.reference}: ${J$(X)}`)}get defaultShortDescription(){return s6.object}innerToJsonSchema($){return this.resolution.toJsonSchemaRecurse($)}traverseAllows=($,X)=>{let Y=X.seen[this.reference];if(Y?.includes($))return!0;return X.seen[this.reference]=P$(Y,$),this.resolution.traverseAllows($,X)};traverseApply=($,X)=>{let Y=X.seen[this.reference];if(Y?.includes($))return;X.seen[this.reference]=P$(Y,$),this.resolution.traverseApply($,X)};compile($){let X=this.resolutionId;$.if(`ctx.seen.${X} && ctx.seen.${X}.includes(data)`,()=>$.return(!0)),$.if(`!ctx.seen.${X}`,()=>$.line(`ctx.seen.${X} = []`)),$.line(`ctx.seen.${X}.push(data)`),$.return($.invoke(X))}}var $g=($,X)=>`Alias '${$}' has a shallow resolution cycle: ${[...X,$].join("->")}`,N5={implementation:eh,Node:Wv};class t8 extends x1{traverseApply=($,X)=>{if(!this.traverseAllows($,X))X.errorFromNodeContext(this.errorContext)};get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return d2(this.errorContext)}compile($){if($.traversalKind==="Allows")$.return(this.compiledCondition);else $.if(this.compiledNegation,()=>$.line(`${$.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}}var Xg=A$({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:($)=>typeof $==="string"?{domain:$}:A9($,"numberAllowsNaN")&&$.domain!=="number"?f(ez.writeBadAllowNanMessage($.domain)):$,applyConfig:($,X)=>$.numberAllowsNaN===void 0&&$.domain==="number"&&X.numberAllowsNaN?{...$,numberAllowsNaN:!0}:$,defaults:{description:($)=>s6[$.domain],actual:($)=>Number.isNaN($)?"NaN":s6[m4($)]},intersections:{domain:($,X)=>$.domain==="number"&&X.domain==="number"?$.numberAllowsNaN?X:$:a.init("domain",$,X)}});class Qv extends t8{requiresNaNCheck=this.domain==="number"&&!this.numberAllowsNaN;traverseAllows=this.requiresNaNCheck?($)=>typeof $==="number"&&!Number.isNaN($):($)=>m4($)===this.domain;compiledCondition=this.domain==="object"?'((typeof data === "object" && data !== null) || typeof data === "function")':`typeof data === "${this.domain}"${this.requiresNaNCheck?" && !Number.isNaN(data)":""}`;compiledNegation=this.domain==="object"?'((typeof data !== "object" || data === null) && typeof data !== "function")':`typeof data !== "${this.domain}"${this.requiresNaNCheck?" || Number.isNaN(data)":""}`;expression=this.numberAllowsNaN?"number | NaN":this.domain;get nestableExpression(){return this.numberAllowsNaN?`(${this.expression})`:this.expression}get defaultShortDescription(){return s6[this.domain]}innerToJsonSchema($){if(this.domain==="bigint"||this.domain==="symbol")return $.fallback.domain({code:"domain",base:{},domain:this.domain});return{type:this.domain}}}var ez={implementation:Xg,Node:Qv,writeBadAllowNanMessage:($)=>`numberAllowsNaN may only be specified with domain "number" (was ${$})`};var Yg=A$({kind:"intersection",hasAssociatedError:!0,normalize:($)=>{if(X4($))return $;let{structure:X,...Y}=$,U=!!X,G=X??{},z=M$(Y,(W,Q)=>{if(u4(W,BT)){if(U)f(`Flattened structure key ${W} cannot be specified alongside a root 'structure' key.`);return G[W]=Q,[]}return[W,Q]});if(U$(G,"constraint")||!M0(G))z.structure=G;return z},finalizeInnerJson:({structure:$,...X})=>a6($,"object")?{...$,...X}:X,keys:{domain:{child:!0,parse:($,X)=>X.$.node("domain",$)},proto:{child:!0,parse:($,X)=>X.$.node("proto",$)},structure:{child:!0,parse:($,X)=>X.$.node("structure",$),serialize:($)=>{if(!$.sequence?.minLength)return $.collapsibleJson;let{sequence:X,...Y}=$.collapsibleJson,{minVariadicLength:U,...G}=X,z=G.variadic&&Object.keys(G).length===1?G.variadic:G;return{...Y,sequence:z}}},divisor:{child:!0,parse:w6("divisor")},max:{child:!0,parse:w6("max")},min:{child:!0,parse:w6("min")},maxLength:{child:!0,parse:w6("maxLength")},minLength:{child:!0,parse:w6("minLength")},exactLength:{child:!0,parse:w6("exactLength")},before:{child:!0,parse:w6("before")},after:{child:!0,parse:w6("after")},pattern:{child:!0,parse:w6("pattern")},predicate:{child:!0,parse:w6("predicate")}},reduce:($,X)=>Zv({},$,{$:X,invert:!1,pipe:!1}),defaults:{description:($)=>{if($.children.length===0)return"unknown";if($.structure)return $.structure.description;let X=[];if($.basis&&!$.refinements.some((Y)=>Y.impl.obviatesBasisDescription))X.push($.basis.description);if($.refinements.length){let Y=$.refinements.toSorted((U,G)=>U.kind==="min"&&G.kind==="max"?-1:0).map((U)=>U.description);X.push(...Y)}if($.inner.predicate)X.push(...$.inner.predicate.map((Y)=>Y.description));return X.join(" and ")},expected:($)=>` \u25E6 ${$.errors.map((X)=>X.expected).join(`
|
|
182
182
|
\u25E6 `)}`,problem:($)=>`(${$.actual}) must be...
|
|
183
|
-
${$.expected}`},intersections:{intersection:($,X,Y)=>Zv($.inner,X.inner,Y),...
|
|
183
|
+
${$.expected}`},intersections:{intersection:($,X,Y)=>Zv($.inner,X.inner,Y),...J0("intersection",($,X,Y)=>{if($.children.length===0)return X;let{domain:U,proto:G,...z}=$.inner,W=G??U,Q=W?Y4(W,X,Y):X;return Q instanceof a?Q:$?.basis?.equals(Q)?$:$.$.node("intersection",{...z,[Q.kind]:Q},{prereduced:!0})})}});class Hv extends x1{basis=this.inner.domain??this.inner.proto??null;refinements=this.children.filter(($)=>$.isRefinement());structure=this.inner.structure;expression=Gg(this);get shallowMorphs(){return this.inner.structure?.structuralMorph?[this.inner.structure.structuralMorph]:[]}get defaultShortDescription(){return this.basis?.defaultShortDescription??"present"}innerToJsonSchema($){return this.children.reduce((X,Y)=>Y.isBasis()?Y.toJsonSchemaRecurse($):Y.reduceJsonSchema(X,$),{})}traverseAllows=($,X)=>this.children.every((Y)=>Y.traverseAllows($,X));traverseApply=($,X)=>{let Y=X.currentErrorCount;if(this.basis){if(this.basis.traverseApply($,X),X.currentErrorCount>Y)return}if(this.refinements.length){for(let U=0;U<this.refinements.length-1;U++)if(this.refinements[U].traverseApply($,X),X.failFast&&X.currentErrorCount>Y)return;if(this.refinements.at(-1).traverseApply($,X),X.currentErrorCount>Y)return}if(this.structure){if(this.structure.traverseApply($,X),X.currentErrorCount>Y)return}if(this.inner.predicate){for(let U=0;U<this.inner.predicate.length-1;U++)if(this.inner.predicate[U].traverseApply($,X),X.failFast&&X.currentErrorCount>Y)return;this.inner.predicate.at(-1).traverseApply($,X)}};compile($){if($.traversalKind==="Allows"){for(let X of this.children)$.check(X);$.return(!0);return}if($.initializeErrorCount(),this.basis){if($.check(this.basis),this.children.length>1)$.returnIfFail()}if(this.refinements.length){for(let X=0;X<this.refinements.length-1;X++)$.check(this.refinements[X]),$.returnIfFailFast();if($.check(this.refinements.at(-1)),this.structure||this.inner.predicate)$.returnIfFail()}if(this.structure){if($.check(this.structure),this.inner.predicate)$.returnIfFail()}if(this.inner.predicate){for(let X=0;X<this.inner.predicate.length-1;X++)$.check(this.inner.predicate[X]),$.returnIfFail();$.check(this.inner.predicate.at(-1))}}}var xE={implementation:Yg,Node:Hv},Gg=($)=>{let X=$.structure?.expression||`${$.basis&&!$.refinements.some((Y)=>Y.impl.obviatesBasisExpression)?$.basis.nestableExpression+" ":""}${$.refinements.map((Y)=>Y.expression).join(" & ")}`||"unknown";if(X==="Array == 0")X="[]";return X},Zv=($,X,Y)=>{let U={},G=$.proto??$.domain,z=X.proto??X.domain,W=G?z?Y4(G,z,Y):G:z;if(W instanceof a)return W;if(W)U[W.kind]=W;return v9({kind:"intersection",baseInner:U,l:C9($),r:C9(X),roots:[],ctx:Y})};var Ug=A$({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:($,X)=>X.$.parseSchema($)},morphs:{parse:m2,serialize:($)=>$.map((X)=>U$(X,"root")?X.json:F4(X))},declaredIn:{child:!1,serialize:($)=>$.json},declaredOut:{child:!1,serialize:($)=>$.json}},normalize:($)=>$,defaults:{description:($)=>`a morph from ${$.in.description} to ${$.out?.description??"unknown"}`},intersections:{morph:($,X,Y)=>{if(!$.hasEqualMorphs(X))return f(zg($.expression,X.expression));let U=Y4($.in,X.in,Y);if(U instanceof a)return U;let G={morphs:$.morphs};if($.declaredIn||X.declaredIn){let z=Y4($.in,X.in,Y);if(z instanceof a)return z.throw();else G.declaredIn=z}if($.declaredOut||X.declaredOut){let z=Y4($.out,X.out,Y);if(z instanceof a)return z.throw();else G.declaredOut=z}return U.distribute((z)=>Y.$.node("morph",{...G,in:z}),Y.$.parseSchema)},...J0("morph",($,X,Y)=>{let U=$.inner.in?Y4($.inner.in,X,Y):X;return U instanceof a?U:U.equals($.inner.in)?$:Y.$.node("morph",{...$.inner,in:U})})}});class Vv extends x1{serializedMorphs=this.morphs.map(F4);compiledMorphs=`[${this.serializedMorphs}]`;lastMorph=this.inner.morphs.at(-1);lastMorphIfNode=U$(this.lastMorph,"root")?this.lastMorph:void 0;introspectableIn=this.inner.in;introspectableOut=this.lastMorphIfNode?Object.assign(this.referencesById,this.lastMorphIfNode.referencesById)&&this.lastMorphIfNode.out:void 0;get shallowMorphs(){return Array.isArray(this.inner.in?.shallowMorphs)?[...this.inner.in.shallowMorphs,...this.morphs]:this.morphs}get in(){return this.declaredIn??this.inner.in?.in??m.intrinsic.unknown.internal}get out(){return this.declaredOut??this.introspectableOut??m.intrinsic.unknown.internal}declareIn($){return this.$.node("morph",{...this.inner,declaredIn:$})}declareOut($){return this.$.node("morph",{...this.inner,declaredOut:$})}expression=`(In: ${this.in.expression}) => ${this.lastMorphIfNode?"To":"Out"}<${this.out.expression}>`;get defaultShortDescription(){return this.in.meta.description??this.in.defaultShortDescription}innerToJsonSchema($){return $.fallback.morph({code:"morph",base:this.in.toJsonSchemaRecurse($),out:this.introspectableOut?.toJsonSchemaRecurse($)??null})}compile($){if($.traversalKind==="Allows"){if(!this.introspectableIn)return;$.return($.invoke(this.introspectableIn));return}if(this.introspectableIn)$.line($.invoke(this.introspectableIn));$.line(`ctx.queueMorphs(${this.compiledMorphs})`)}traverseAllows=($,X)=>!this.introspectableIn||this.introspectableIn.traverseAllows($,X);traverseApply=($,X)=>{if(this.introspectableIn)this.introspectableIn.traverseApply($,X);X.queueMorphs(this.morphs)};hasEqualMorphs($){return Y2(this.morphs,$.morphs,{isEqual:(X,Y)=>X===Y||U$(X,"root")&&U$(Y,"root")&&X.equals(Y)})}}var SE={implementation:Ug,Node:Vv},zg=($,X)=>`The intersection of distinct morphs at a single path is indeterminate:
|
|
184
184
|
Left: ${$}
|
|
185
|
-
Right: ${X}`;var Wg=A$({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:($)=>a3($)??
|
|
185
|
+
Right: ${X}`;var Wg=A$({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:($)=>a3($)??P1($)},dateAllowsInvalid:{}},normalize:($)=>{let X=typeof $==="string"?{proto:i8[$]}:typeof $==="function"?X4($)?$:{proto:$}:typeof $.proto==="string"?{...$,proto:i8[$.proto]}:$;if(typeof X.proto!=="function")f(F5.writeInvalidSchemaMessage(X.proto));if(A9(X,"dateAllowsInvalid")&&X.proto!==Date)f(F5.writeBadInvalidDateMessage(X.proto));return X},applyConfig:($,X)=>{if($.dateAllowsInvalid===void 0&&$.proto===Date&&X.dateAllowsInvalid)return{...$,dateAllowsInvalid:!0};return $},defaults:{description:($)=>$.builtinName?zT[$.builtinName]:`an instance of ${$.proto.name}`,actual:($)=>$ instanceof Date&&$.toString()==="Invalid Date"?"an invalid Date":t3($)},intersections:{proto:($,X)=>$.proto===Date&&X.proto===Date?$.dateAllowsInvalid?X:$:YE($.proto,X.proto)?$:YE(X.proto,$.proto)?X:a.init("proto",$,X),domain:($,X)=>X.domain==="object"?$:a.init("domain",m.intrinsic.object.internal,X)}});class Ov extends t8{builtinName=a3(this.proto);serializedConstructor=this.json.proto;requiresInvalidDateCheck=this.proto===Date&&!this.dateAllowsInvalid;traverseAllows=this.requiresInvalidDateCheck?($)=>$ instanceof Date&&$.toString()!=="Invalid Date":($)=>$ instanceof this.proto;compiledCondition=`data instanceof ${this.serializedConstructor}${this.requiresInvalidDateCheck?' && data.toString() !== "Invalid Date"':""}`;compiledNegation=`!(${this.compiledCondition})`;innerToJsonSchema($){switch(this.builtinName){case"Array":return{type:"array"};case"Date":return $.fallback.date?.({code:"date",base:{}})??$.fallback.proto({code:"proto",base:{},proto:this.proto});default:return $.fallback.proto({code:"proto",base:{},proto:this.proto})}}expression=this.dateAllowsInvalid?"Date | InvalidDate":this.proto.name;get nestableExpression(){return this.dateAllowsInvalid?`(${this.expression})`:this.expression}domain="object";get defaultShortDescription(){return this.description}}var F5={implementation:Wg,Node:Ov,writeBadInvalidDateMessage:($)=>`dateAllowsInvalid may only be specified with constructor Date (was ${$.name})`,writeInvalidSchemaMessage:($)=>`instanceOf operand must be a function (was ${m4($)})`};var Qg=A$({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:($,X)=>{let Y=[];for(let U of $){let G=U$(U,"root")?U.branches:X.$.parseSchema(U).branches;for(let z of G)if(z.hasKind("morph")){let W=Y.findIndex((Q)=>Q.hasKind("morph")&&Q.hasEqualMorphs(z));if(W===-1)Y.push(z);else{let Q=Y[W];Y[W]=X.$.node("morph",{...Q.inner,in:Q.in.rawOr(z.in)})}}else Y.push(z)}if(!X.def.ordered)Y.sort((U,G)=>U.hash<G.hash?-1:1);return Y}}},normalize:($)=>o$($)?{branches:$}:$,reduce:($,X)=>{let Y=Mg($);if(Y.length===1)return Y[0];if(Y.length===$.branches.length)return;return X.node("union",{...$,branches:Y},{prereduced:!0})},defaults:{description:($)=>$.distribute((X)=>X.description,I9),expected:($)=>{let X=aR($.errors,"propString"),Y=Object.entries(X).map(([U,G])=>{let z=[];for(let Z of G)F0(z,Z.expected);let W=I9(z),Q=G.every((Z)=>Z.actual===G[0].actual)?G[0].actual:J$(G[0].data);return`${U&&`${U} `}must be ${W}${Q&&` (was ${Q})`}`});return I9(Y)},problem:($)=>$.expected,message:($)=>$.problem},intersections:{union:($,X,Y)=>{if($.isNever!==X.isNever)return a.init("presence",$,X);let U;if($.ordered){if(X.ordered)f(Ag($.expression,X.expression));if(U=kE(X.branches,$.branches,Y),U instanceof a)U.invert()}else U=kE($.branches,X.branches,Y);if(U instanceof a)return U;return Y.$.parseSchema($.ordered||X.ordered?{branches:U,ordered:!0}:{branches:U})},...J0("union",($,X,Y)=>{let U=kE($.branches,[X],Y);if(U instanceof a)return U;if(U.length===1)return U[0];return Y.$.parseSchema($.ordered?{branches:U,ordered:!0}:{branches:U})})}});class Ev extends x1{isBoolean=this.branches.length===2&&this.branches[0].hasUnit(!1)&&this.branches[1].hasUnit(!0);get branchGroups(){let $=[],X=-1;for(let Y of this.branches){if(Y.hasKind("unit")&&Y.domain==="boolean"){if(X===-1)X=$.length,$.push(Y);else $[X]=m.intrinsic.boolean;continue}$.push(Y)}return $}unitBranches=this.branches.filter(($)=>$.in.hasKind("unit"));discriminant=this.discriminate();discriminantJson=this.discriminant?Eg(this.discriminant):null;expression=this.distribute(($)=>$.nestableExpression,Fg);createBranchedOptimisticRootApply(){return($,X)=>{let Y=this.traverseOptimistic($);if(Y!==M1)return Y;let U=new o1($,this.$.resolvedConfig);return this.traverseApply($,U),U.finalize(X)}}get shallowMorphs(){return this.branches.reduce(($,X)=>F0($,X.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(($)=>$.defaultShortDescription,I9)}innerToJsonSchema($){if(this.branchGroups.length===1&&this.branchGroups[0].equals(m.intrinsic.boolean))return{type:"boolean"};let X=this.branchGroups.map((Y)=>Y.toJsonSchemaRecurse($));if(X.every((Y)=>Object.keys(Y).length===1&&A9(Y,"const")))return{enum:X.map((Y)=>Y.const)};return{anyOf:X}}traverseAllows=($,X)=>this.branches.some((Y)=>Y.traverseAllows($,X));traverseApply=($,X)=>{let Y=[];for(let U=0;U<this.branches.length;U++){if(X.pushBranch(),this.branches[U].traverseApply($,X),!X.hasError()){if(this.branches[U].includesTransform)return X.queuedMorphs.push(...X.popBranch().queuedMorphs);return X.popBranch()}Y.push(X.popBranch().error)}X.errorFromNodeContext({code:"union",errors:Y,meta:this.meta})};traverseOptimistic=($)=>{for(let X=0;X<this.branches.length;X++){let Y=this.branches[X];if(Y.traverseAllows($)){if(Y.contextFreeMorph)return Y.contextFreeMorph($);return $}}return M1};compile($){if(!this.discriminant||this.unitBranches.length===this.branches.length&&this.branches.length===2)return this.compileIndiscriminable($);let X=this.discriminant.optionallyChainedPropString;if(this.discriminant.kind==="domain")X=`typeof ${X} === "object" ? ${X} === null ? "null" : "object" : typeof ${X} === "function" ? "object" : typeof ${X}`;let Y=this.discriminant.cases,U=Object.keys(Y),{optimistic:G}=$;if($.optimistic=!1,$.block(`switch(${X})`,()=>{for(let H in Y){let V=Y[H],O=H==="default"?H:`case ${H}`;$.line(`${O}: return ${V===!0?G?$.data:V:G?`${$.invoke(V)} ? ${V.contextFreeMorph?`${F4(V.contextFreeMorph)}(${$.data})`:$.data} : "${M1}"`:$.invoke(V)}`)}return $}),$.traversalKind==="Allows"){$.return(G?`"${M1}"`:!1);return}let z=I9(this.discriminant.kind==="domain"?U.map((H)=>{let V=H.slice(1,-1);return V==="function"?s6.object:s6[V]}):U),W=this.discriminant.path.map((H)=>typeof H==="symbol"?F4(H):JSON.stringify(H)),Q=JSON.stringify(z),Z=this.discriminant.kind==="domain"?`${wg}[${X}]`:`${Dg}(${X})`;$.line(`ctx.errorFromNodeContext({
|
|
186
186
|
code: "predicate",
|
|
187
187
|
expected: ${Q},
|
|
188
188
|
actual: ${Z},
|
|
189
189
|
relativePath: [${W}],
|
|
190
190
|
meta: ${this.compiledMeta}
|
|
191
|
-
})`)}compileIndiscriminable($){if($.traversalKind==="Apply"){$.const("errors","[]");for(let X of this.branches)$.line("ctx.pushBranch()").line($.invoke(X)).if("!ctx.hasError()",()=>$.return(X.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)");$.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`)}else{let{optimistic:X}=$;$.optimistic=!1;for(let Y of this.branches)$.if(`${$.invoke(Y)}`,()=>$.return(X?Y.contextFreeMorph?`${F4(Y.contextFreeMorph)}(${$.data})`:$.data:!0));$.return(X?`"${
|
|
191
|
+
})`)}compileIndiscriminable($){if($.traversalKind==="Apply"){$.const("errors","[]");for(let X of this.branches)$.line("ctx.pushBranch()").line($.invoke(X)).if("!ctx.hasError()",()=>$.return(X.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)");$.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`)}else{let{optimistic:X}=$;$.optimistic=!1;for(let Y of this.branches)$.if(`${$.invoke(Y)}`,()=>$.return(X?Y.contextFreeMorph?`${F4(Y.contextFreeMorph)}(${$.data})`:$.data:!0));$.return(X?`"${M1}"`:!1)}}get nestableExpression(){return this.isBoolean?"boolean":`(${this.expression})`}discriminate(){if(this.branches.length<2||this.isCyclic)return null;if(this.unitBranches.length===this.branches.length){let G=M$(this.unitBranches,(z,W)=>[`${W.in.serializedValue}`,W.hasKind("morph")?W:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:G}}let $=[];for(let G=0;G<this.branches.length-1;G++){let z=this.branches[G];for(let W=G+1;W<this.branches.length;W++){let Q=this.branches[W],Z=X1(z.in,Q.in,z.$);if(!(Z instanceof a))continue;for(let H of Z){if(!H.kind||H.optional)continue;let V,O;if(H.kind==="domain"){let{l:D,r:E}=H;V=`"${typeof D==="string"?D:D.domain}"`,O=`"${typeof E==="string"?E:E.domain}"`}else if(H.kind==="unit")V=H.l.serializedValue,O=H.r.serializedValue;else continue;let w=$.find((D)=>Y2(D.path,H.path)&&D.kind===H.kind);if(!w)$.push({kind:H.kind,cases:{[V]:{branchIndices:[G],condition:H.l},[O]:{branchIndices:[W],condition:H.r}},path:H.path});else{if(w.cases[V])w.cases[V].branchIndices=F0(w.cases[V].branchIndices,G);else w.cases[V]??={branchIndices:[G],condition:H.l};if(w.cases[O])w.cases[O].branchIndices=F0(w.cases[O].branchIndices,W);else w.cases[O]??={branchIndices:[W],condition:H.r}}}}}let X=this.ordered?Vg($,this.branches):$;if(!X.length)return null;let Y=Zg(X,this),U={};for(let G in Y.best.cases){let z=Hg(Y,G);if(z===null){U[G]=!0;continue}if(z.length===this.branches.length)return null;if(this.ordered)z.sort((Z,H)=>Z.originalIndex-H.originalIndex);let W=z.map((Z)=>Z.branch),Q=W.length===1?W[0]:this.$.node("union",this.ordered?{branches:W,ordered:!0}:W);Object.assign(this.referencesById,Q.referencesById),U[G]=Q}if(Y.defaultEntries.length){let G=Y.defaultEntries.map((z)=>z.branch);U.default=this.$.node("union",this.ordered?{branches:G,ordered:!0}:G,{prereduced:!0}),Object.assign(this.referencesById,U.default.referencesById)}return Object.assign(Y.location,{cases:U})}}var Zg=($,X)=>{let Y=$.sort((z,W)=>Object.keys(W.cases).length-Object.keys(z.cases).length)[0],U={kind:Y.kind,path:Y.path,optionallyChainedPropString:Nv(Y.path)},G=X.branches.map((z,W)=>({originalIndex:W,branch:z}));return{best:Y,location:U,defaultEntries:G,node:X}},Hg=($,X)=>{let Y=$.best.cases[X],U=Og(Y.condition,$.location.path,$.node.$),G=[],z=[];for(let W=0;W<$.defaultEntries.length;W++){let Q=$.defaultEntries[W];if(Y.branchIndices.includes(Q.originalIndex)){let Z=wv($.node.branches[Q.originalIndex],$.location);if(Z===null)G=null;else G?.push({originalIndex:Q.originalIndex,branch:Z})}else if(Q.branch.hasKind("alias")&&U.hasKind("domain")&&U.domain==="object")G?.push(Q);else{if(Q.branch.in.overlaps(U)){let Z=wv(Q.branch,$.location);G?.push({originalIndex:Q.originalIndex,branch:Z})}z.push(Q)}}return $.defaultEntries=z,G},Vg=($,X)=>{return $.filter((U)=>{let G=Object.values(U.cases).map((z)=>z.branchIndices);for(let z=0;z<G.length-1;z++){let W=G[z];for(let Q=z+1;Q<G.length;Q++){let Z=G[Q];for(let H of W)for(let V of Z)if(H>V){if(X[H].overlaps(X[V]))return!1}}}return!0})},Og=($,X,Y)=>{let U=$==="undefined"?Y.node("unit",{unit:void 0}):$==="null"?Y.node("unit",{unit:null}):$==="boolean"?Y.units([!0,!1]):$;for(let G=X.length-1;G>=0;G--){let z=X[G];U=Y.node("intersection",typeof z==="number"?{proto:"Array",sequence:[...nR(z).map((W)=>({})),U]}:{domain:"object",required:[{key:z,value:U}]})}return U},Nv=($)=>$.reduce((X,Y)=>X+HE(Y,!0),"data"),wg=F4(sR),Dg=F4(J$),bE={implementation:Qg,Node:Ev},Eg=($)=>({kind:$.kind,path:$.path.map((X)=>typeof X==="string"?X:z2(X)),cases:M$($.cases,(X,Y)=>[X,Y===!0?Y:Y.hasKind("union")&&Y.discriminantJson?Y.discriminantJson:Y.json])}),Ng={delimiter:" | ",finalDelimiter:" | "},Fg=($)=>I9($,Ng),I9=($,X)=>{let Y=X?.delimiter??", ",U=X?.finalDelimiter??" or ";if($.length===0)return"never";if($.length===1)return $[0];if($.length===2&&$[0]==="false"&&$[1]==="true"||$[0]==="true"&&$[1]==="false")return"boolean";let G={},z=$.filter((Q)=>G[Q]?!1:G[Q]=!0),W=z.pop();return`${z.join(Y)}${z.length?U:""}${W}`},kE=($,X,Y)=>{let U=X.map(()=>[]);for(let z=0;z<$.length;z++){let W={};for(let Q=0;Q<X.length;Q++){if(U[Q]===null)continue;if($[z].equals(X[Q])){U[Q]=null,W={};break}let Z=Y4($[z],X[Q],Y);if(Z instanceof a)continue;if(Z.equals($[z])){U[Q].push($[z]),W={};break}if(Z.equals(X[Q]))U[Q]=null;else W[Q]=Z}for(let Q in W)U[Q][z]=W[Q]}let G=U.flatMap((z,W)=>z?.flatMap((Q)=>Q.branches)??X[W]);return G.length===0?a.init("union",$,X):G},Mg=({branches:$,ordered:X})=>{if($.length<2)return $;let Y=$.map(()=>!0);for(let U=0;U<$.length;U++)for(let G=U+1;G<$.length&&Y[U]&&Y[G];G++){if($[U].equals($[G])){Y[G]=!1;continue}let z=X1($[U].in,$[G].in,$[0].$);if(z instanceof a)continue;if(!X)Jg($[U],$[G]);if(z.equals($[U].in))Y[U]=!!X;else if(z.equals($[G].in))Y[G]=!1}return $.filter((U,G)=>Y[G])},Jg=($,X)=>{if(!$.includesTransform&&!X.includesTransform)return;if(!Y2($.shallowMorphs,X.shallowMorphs))f(Dv($.expression,X.expression));if(!Y2($.flatMorphs,X.flatMorphs,{isEqual:(Y,U)=>Y.propString===U.propString&&(Y.node.hasKind("morph")&&U.node.hasKind("morph")?Y.node.hasEqualMorphs(U.node):Y.node.hasKind("intersection")&&U.node.hasKind("intersection")?Y.node.structure?.structuralMorphRef===U.node.structure?.structuralMorphRef:!1)}))f(Dv($.expression,X.expression))},wv=($,X)=>$.transform((Y,U)=>{if(Y==="domain"||Y==="unit")return null;return U},{shouldTransform:(Y,U)=>{let G=Nv(U.path);if(!X.optionallyChainedPropString.startsWith(G))return!1;if(Y.hasKind("domain")&&Y.domain==="object")return!0;if((Y.hasKind("domain")||X.kind==="unit")&&G===X.optionallyChainedPropString)return!0;return Y.children.length!==0&&Y.kind!=="index"}}),Dv=($,X)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
|
|
192
192
|
Left: ${$}
|
|
193
193
|
Right: ${X}`,Ag=($,X)=>`The intersection of two ordered unions is indeterminate:
|
|
194
194
|
Left: ${$}
|
|
195
|
-
Right: ${X}`;var Lg=A$({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:($)=>$ instanceof Date?$.toISOString():j1($)}},normalize:($)=>$,defaults:{description:($)=>J$($.unit),problem:({expected:$,actual:X})=>`${$===X?`must be reference equal to ${$} (serialized to the same value)`:`must be ${$} (was ${X})`}`},intersections:{unit:($,X)=>a.init("unit",$,X),...M0("unit",($,X)=>{if(X.allows($.unit))return $;let Y=X.hasKind("intersection")?X.basis:X;if(Y){let U=Y.hasKind("domain")?Y:m.intrinsic.object;if($.domain!==U.domain){let G=$.domain==="undefined"||$.domain==="null"||$.domain==="boolean"?$.domain:m.intrinsic[$.domain];return a.init("domain",G,U)}}return a.init("assignability",$,X.hasKind("intersection")?X.children.find((U)=>!U.allows($.unit)):X)})}});class Mv extends t8{compiledValue=this.json.unit;serializedValue=typeof this.unit==="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=Fv(this.unit,this.serializedValue);compiledNegation=Fv(this.unit,this.serializedValue,"negated");expression=J$(this.unit);domain=m4(this.unit);get defaultShortDescription(){return this.domain==="object"?a6.object:this.description}innerToJsonSchema($){return this.unit===null?{type:"null"}:m.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:$.fallback.unit({code:"unit",base:{},unit:this.unit})}traverseAllows=this.unit instanceof Date?($)=>$ instanceof Date&&$.toISOString()===this.compiledValue:Number.isNaN(this.unit)?($)=>Number.isNaN($):($)=>$===this.unit}var fE={implementation:Lg,Node:Mv},Fv=($,X,Y)=>{if($ instanceof Date){let U=`data instanceof Date && data.toISOString() === ${X}`;return Y?`!(${U})`:U}if(Number.isNaN($))return`${Y?"!":""}Number.isNaN(data)`;return`data ${Y?"!":"="}== ${X}`};var Kg=A$({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:($,X)=>{let Y=X.$.parseSchema($);if(!Y.extends(m.intrinsic.key))return f(qg(Y.expression));let U=Y.branches.filter((G)=>G.hasKind("unit"));if(U.length)return f(_g(U.map((G)=>J$(G.unit))));return Y}},value:{child:!0,parse:($,X)=>X.$.parseSchema($)}},normalize:($)=>$,defaults:{description:($)=>`[${$.signature.expression}]: ${$.value.description}`},intersections:{index:($,X,Y)=>{if($.signature.equals(X.signature)){let U=Y4($.value,X.value,Y),G=U instanceof a?m.intrinsic.never.internal:U;return Y.$.node("index",{signature:$.signature,value:G})}if($.signature.extends(X.signature)&&$.value.subsumes(X.value))return X;if(X.signature.extends($.signature)&&X.value.subsumes($.value))return $;return null}}});class Jv extends P1{impliedBasis=m.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=P$(this.value.flatRefs.map(($)=>o1([this.signature,...$.path],$.node)),o1([this.signature],this.value));traverseAllows=($,X)=>r8($).every((Y)=>{if(this.signature.traverseAllows(Y[0],X))return e6(Y[0],()=>this.value.traverseAllows(Y[1],X),X);return!0});traverseApply=($,X)=>{for(let Y of r8($))if(this.signature.traverseAllows(Y[0],X))e6(Y[0],()=>this.value.traverseApply(Y[1],X),X)};_transform($,X){X.path.push(this.signature);let Y=super._transform($,X);return X.path.pop(),Y}compile(){}}var hE={implementation:Kg,Node:Jv},_g=($)=>`Index keys ${$.join(", ")} should be specified as named props.`,qg=($)=>`Indexed key definition '${$}' must be a string or symbol`;var Rg=A$({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:($,X)=>X.$.parseSchema($)}},normalize:($)=>$,defaults:{description:($)=>`${$.compiledKey}: ${$.value.description}`,expected:($)=>$.missingValueDescription,actual:()=>"missing"},intersections:{required:V5,optional:V5}});class Av extends O5{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=d2(this.errorContext)}var gE={implementation:Rg,Node:Av};var Tg=A$({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:($,X)=>{if($.length===0)return;return $.map((Y)=>X.$.parseSchema(Y))}},optionals:{child:!0,parse:($,X)=>{if($.length===0)return;return $.map((Y)=>X.$.parseSchema(Y))}},defaultables:{child:($)=>$.map((X)=>X[0]),parse:($,X)=>{if($.length===0)return;return $.map((Y)=>{let U=X.$.parseSchema(Y[0]);return D5(U,Y[1],null),[U,Y[1]]})},serialize:($)=>$.map((X)=>[X[0].collapsibleJson,j1(X[1])])},variadic:{child:!0,parse:($,X)=>X.$.parseSchema($,X)},minVariadicLength:{parse:($)=>$===0?void 0:$},postfix:{child:!0,parse:($,X)=>{if($.length===0)return;return $.map((Y)=>X.$.parseSchema(Y))}}},normalize:($)=>{if(typeof $==="string")return{variadic:$};if("variadic"in $||"prefix"in $||"defaultables"in $||"optionals"in $||"postfix"in $||"minVariadicLength"in $){if($.postfix?.length){if(!$.variadic)return f(jg);if($.optionals?.length||$.defaultables?.length)return f(mE)}if($.minVariadicLength&&!$.variadic)return f("minVariadicLength may not be specified without a variadic element");return $}return{variadic:$}},reduce:($,X)=>{let Y=$.minVariadicLength??0,U=$.prefix?.slice()??[],G=$.defaultables?.slice()??[],z=$.optionals?.slice()??[],W=$.postfix?.slice()??[];if($.variadic){while(z.at(-1)?.equals($.variadic))z.pop();if(z.length===0&&G.length===0)while(U.at(-1)?.equals($.variadic))U.pop(),Y++;while(W[0]?.equals($.variadic))W.shift(),Y++}else if(z.length===0&&G.length===0)U.push(...W.splice(0));if(Y!==$.minVariadicLength||$.prefix&&$.prefix.length!==U.length)return X.node("sequence",{...$,prefix:U,defaultables:G,optionals:z,postfix:W,minVariadicLength:Y},{prereduced:!0})},defaults:{description:($)=>{if($.isVariadicOnly)return`${$.variadic.nestableExpression}[]`;return`[${$.tuple.map((Y)=>Y.kind==="defaultables"?`${Y.node.nestableExpression} = ${J$(Y.default)}`:Y.kind==="optionals"?`${Y.node.nestableExpression}?`:Y.kind==="variadic"?`...${Y.node.nestableExpression}[]`:Y.node.expression).join(", ")}]`}},intersections:{sequence:($,X,Y)=>{let U=M5({l:$.tuple,r:X.tuple,disjoint:new a,result:[],fixedVariants:[],ctx:Y}),G=U.disjoint.length===0?[U,...U.fixedVariants]:U.fixedVariants;return G.length===0?U.disjoint:G.length===1?Y.$.node("sequence",Lv(G[0].result)):Y.$.node("union",G.map((z)=>({proto:Array,sequence:Lv(z.result)})))}}});class Kv extends P1{impliedBasis=m.intrinsic.Array.internal;tuple=Bg(this.inner);prefixLength=this.prefix?.length??0;defaultablesLength=this.defaultables?.length??0;optionalsLength=this.optionals?.length??0;postfixLength=this.postfix?.length??0;defaultablesAndOptionals=[];prevariadic=this.tuple.filter(($)=>{if($.kind==="defaultables"||$.kind==="optionals")return this.defaultablesAndOptionals.push($.node),!0;return $.kind==="prefix"});variadicOrPostfix=X2(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return DE(this.flatRefs,this.prevariadic.flatMap(($,X)=>P$($.node.flatRefs.map((Y)=>o1([`${X}`,...Y.path],Y.node)),o1([`${X}`],$.node)))),DE(this.flatRefs,this.variadicOrPostfix.flatMap(($)=>P$($.flatRefs.map((X)=>o1([m.intrinsic.nonNegativeIntegerString.internal,...X.path],X.node)),o1([m.intrinsic.nonNegativeIntegerString.internal],$)))),this.flatRefs}isVariadicOnly=this.prevariadic.length+this.postfixLength===0;minVariadicLength=this.inner.minVariadicLength??0;minLength=this.prefixLength+this.minVariadicLength+this.postfixLength;minLengthNode=this.minLength===0?null:this.$.node("minLength",this.minLength);maxLength=this.variadic?null:this.tuple.length;maxLengthNode=this.maxLength===null?null:this.$.node("maxLength",this.maxLength);impliedSiblings=this.minLengthNode?this.maxLengthNode?[this.minLengthNode,this.maxLengthNode]:[this.minLengthNode]:this.maxLengthNode?[this.maxLengthNode]:[];defaultValueMorphs=Cg(this);defaultValueMorphsReference=this.defaultValueMorphs.length?F4(this.defaultValueMorphs):void 0;elementAtIndex($,X){if(X<this.prevariadic.length)return this.tuple[X];let Y=$.length-this.postfixLength;if(X>=Y)return{kind:"postfix",node:this.postfix[X-Y]};return{kind:"variadic",node:this.variadic??S$(`Unexpected attempt to access index ${X} on ${this}`)}}traverseAllows=($,X)=>{for(let Y=0;Y<$.length;Y++)if(!this.elementAtIndex($,Y).node.traverseAllows($[Y],X))return!1;return!0};traverseApply=($,X)=>{let Y=0;for(;Y<$.length;Y++)e6(Y,()=>this.elementAtIndex($,Y).node.traverseApply($[Y],X),X)};get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile($){if(this.prefix)for(let[X,Y]of this.prefix.entries())$.traverseKey(`${X}`,`data[${X}]`,Y);for(let[X,Y]of this.defaultablesAndOptionals.entries()){let U=`${X+this.prefixLength}`;$.if(`${U} >= ${$.data}.length`,()=>$.traversalKind==="Allows"?$.return(!0):$.return()),$.traverseKey(U,`data[${U}]`,Y)}if(this.variadic){if(this.postfix)$.const("firstPostfixIndex",`${$.data}.length${this.postfix?`- ${this.postfix.length}`:""}`);if($.for(`i < ${this.postfix?"firstPostfixIndex":"data.length"}`,()=>$.traverseKey("i","data[i]",this.variadic),this.prevariadic.length),this.postfix)for(let[X,Y]of this.postfix.entries()){let U=`firstPostfixIndex + ${X}`;$.traverseKey(U,`data[${U}]`,Y)}}if($.traversalKind==="Allows")$.return(!0)}_transform($,X){X.path.push(m.intrinsic.nonNegativeIntegerString.internal);let Y=super._transform($,X);return X.path.pop(),Y}expression=this.description;reduceJsonSchema($,X){if(this.prevariadic.length)$.prefixItems=this.prevariadic.map((Y)=>{let U=Y.node.toJsonSchemaRecurse(X);if(Y.kind==="defaultables"){let G=typeof Y.default==="function"?Y.default():Y.default;U.default=m.intrinsic.jsonData.allows(G)?G:X.fallback.defaultValue({code:"defaultValue",base:U,value:G})}return U});if(this.minLength)$.minItems=this.minLength;if(this.variadic){let Y=Object.assign($,{items:this.variadic.toJsonSchemaRecurse(X)});if(this.maxLength)Y.maxItems=this.maxLength;if(this.postfix){let U=this.postfix.map((G)=>G.toJsonSchemaRecurse(X));$=X.fallback.arrayPostfix({code:"arrayPostfix",base:Y,elements:U})}}else $.items=!1,delete $.maxItems;return $}}var vg={},Cg=($)=>{if(!$.defaultables)return[];let X=[],Y="[",U=$.prefixLength+$.defaultablesLength-1;for(let G=$.prefixLength;G<=U;G++){let[z,W]=$.defaultables[G-$.prefixLength];X.push(IE(G,z,W)),Y+=`${G}: ${z.id} = ${j1(W)}, `}return Y+="]",vg[Y]??=X},yE={implementation:Tg,Node:Kv},Bg=($)=>{let X=[];if($.prefix)for(let Y of $.prefix)X.push({kind:"prefix",node:Y});if($.defaultables)for(let[Y,U]of $.defaultables)X.push({kind:"defaultables",node:Y,default:U});if($.optionals)for(let Y of $.optionals)X.push({kind:"optionals",node:Y});if($.variadic)X.push({kind:"variadic",node:$.variadic});if($.postfix)for(let Y of $.postfix)X.push({kind:"postfix",node:Y});return X},Lv=($)=>$.reduce((X,Y)=>{if(Y.kind==="variadic")X.variadic=Y.node;else if(Y.kind==="defaultables")X.defaultables=P$(X.defaultables,[[Y.node,Y.default]]);else X[Y.kind]=P$(X[Y.kind],Y.node);return X},{}),mE="A postfix required element cannot follow an optional or defaultable element",jg="A postfix element requires a variadic element",M5=($)=>{let[X,...Y]=$.l,[U,...G]=$.r;if(!X||!U)return $;let z=Y.at(-1)?.kind==="postfix",W=G.at(-1)?.kind==="postfix",Q=X.kind==="prefix"||U.kind==="prefix"?"prefix":X.kind==="postfix"||U.kind==="postfix"?"postfix":X.kind==="variadic"&&U.kind==="variadic"?"variadic":z||W?"prefix":X.kind==="defaultables"||U.kind==="defaultables"?"defaultables":"optionals";if(X.kind==="prefix"&&U.kind==="variadic"&&W){let O=M5({...$,fixedVariants:[],r:G.map((w)=>({...w,kind:"prefix"}))});if(O.disjoint.length===0)$.fixedVariants.push(O)}else if(U.kind==="prefix"&&X.kind==="variadic"&&z){let O=M5({...$,fixedVariants:[],l:Y.map((w)=>({...w,kind:"prefix"}))});if(O.disjoint.length===0)$.fixedVariants.push(O)}let Z=Y4(X.node,U.node,$.ctx);if(Z instanceof a)if(Q==="prefix"||Q==="postfix")$.disjoint.push(...Z.withPrefixKey(Q==="prefix"?$.result.length:`-${Y.length+1}`,"required")),$.result=[...$.result,{kind:Q,node:m.intrinsic.never.internal}];else if(Q==="optionals"||Q==="defaultables")return $;else return M5({...$,fixedVariants:[],l:Y.map((O)=>({...O,kind:"prefix"})),r:Y.map((O)=>({...O,kind:"prefix"}))});else if(Q==="defaultables"){if(X.kind==="defaultables"&&U.kind==="defaultables"&&X.default!==U.default)f(PE(X.default,U.default));$.result=[...$.result,{kind:Q,node:Z,default:X.kind==="defaultables"?X.default:U.kind==="defaultables"?U.default:S$(`Unexpected defaultable intersection from ${X.kind} and ${U.kind} elements.`)}]}else $.result=[...$.result,{kind:Q,node:Z}];let H=$.l.length,V=$.r.length;if(X.kind!=="variadic"||H>=V&&(U.kind==="variadic"||V===1))$.l=Y;if(U.kind!=="variadic"||V>=H&&(X.kind==="variadic"||H===1))$.r=G;return M5($)};var Rv=($)=>(X)=>{if(X.props.length||X.index){let Y=X.index?.map((G)=>G[$])??[];for(let G of X.props)Y.push(G[$]);if(X.undeclared)Y.push(`+ (undeclared): ${X.undeclared}`);let U=`{ ${Y.join(", ")} }`;return X.sequence?`${U} & ${X.sequence.description}`:U}return X.sequence?.description??"{}"},Pg=Rv("description"),Ig=Rv("expression"),_v=($,X,Y)=>{let U=$.required?"required":"optional";if(!X.signature.allows($.key))return null;let G=$1($.value,X.value,Y);if(G instanceof a)return U==="optional"?Y.node("optional",{key:$.key,value:m.intrinsic.never.internal}):G.withPrefixKey($.key,$.kind);return null},xg=A$({kind:"structure",hasAssociatedError:!1,normalize:($)=>$,applyConfig:($,X)=>{if(!$.undeclared&&X.onUndeclaredKey!=="ignore")return{...$,undeclared:X.onUndeclaredKey};return $},keys:{required:{child:!0,parse:w6("required"),reduceIo:($,X,Y)=>{X.required=P$(X.required,Y.map((U)=>U[$]));return}},optional:{child:!0,parse:w6("optional"),reduceIo:($,X,Y)=>{if($==="in"){X.optional=Y.map((U)=>U.in);return}for(let U of Y)X[U.outProp.kind]=P$(X[U.outProp.kind],U.outProp.out)}},index:{child:!0,parse:w6("index")},sequence:{child:!0,parse:w6("sequence")},undeclared:{parse:($)=>$==="ignore"?void 0:$,reduceIo:($,X,Y)=>{if(Y!=="delete")return;if($==="in")delete X.undeclared;else X.undeclared="reject"}}},defaults:{description:Pg},intersections:{structure:($,X,Y)=>{let U={...$.inner},G={...X.inner},z=new a;if($.undeclared){let Z=$.keyof();for(let H of X.requiredKeys)if(!Z.allows(H))z.add("presence",m.intrinsic.never.internal,X.propsByKey[H].value,{path:[H]});if(G.optional)G.optional=G.optional.filter((H)=>Z.allows(H.key));if(G.index)G.index=G.index.flatMap((H)=>{if(H.signature.extends(Z))return H;let V=$1(Z,H.signature,Y.$);if(V instanceof a)return[];let O=$W(V,H.value,Y.$);if(O.required)G.required=X2(G.required,O.required);if(O.optional)G.optional=X2(G.optional,O.optional);return O.index??[]})}if(X.undeclared){let Z=X.keyof();for(let H of $.requiredKeys)if(!Z.allows(H))z.add("presence",$.propsByKey[H].value,m.intrinsic.never.internal,{path:[H]});if(U.optional)U.optional=U.optional.filter((H)=>Z.allows(H.key));if(U.index)U.index=U.index.flatMap((H)=>{if(H.signature.extends(Z))return H;let V=$1(Z,H.signature,Y.$);if(V instanceof a)return[];let O=$W(V,H.value,Y.$);if(O.required)U.required=X2(U.required,O.required);if(O.optional)U.optional=X2(U.optional,O.optional);return O.index??[]})}let W={};if($.undeclared||X.undeclared)W.undeclared=$.undeclared==="reject"||X.undeclared==="reject"?"reject":"delete";let Q=v9({kind:"structure",baseInner:W,l:C9(U),r:C9(G),roots:[],ctx:Y});if(Q instanceof a)z.push(...Q);if(z.length)return z;return Q}},reduce:($,X)=>{if($.index){if(!($.required||$.optional))return;let Y=!1,U=$.required??[],G=$.optional??[],z=[...G];for(let W of $.index){for(let Q of U){let Z=_v(Q,W,X);if(Z instanceof a)return Z}for(let[Q,Z]of G.entries()){let H=_v(Z,W,X);if(H instanceof a)return H;if(H===null)continue;z[Q]=H,Y=!0}}if(Y)return X.node("structure",{...$,optional:z},{prereduced:!0})}}});class Tv extends P1{impliedBasis=m.intrinsic.object.internal;impliedSiblings=this.children.flatMap(($)=>$.impliedSiblings??[]);props=X2(this.required,this.optional);propsByKey=M$(this.props,($,X)=>[X.key,X]);propsByKeyReference=F4(this.propsByKey);expression=Ig(this);requiredKeys=this.required?.map(($)=>$.key)??[];optionalKeys=this.optional?.map(($)=>$.key)??[];literalKeys=[...this.requiredKeys,...this.optionalKeys];_keyof;keyof(){if(this._keyof)return this._keyof;let $=this.$.units(this.literalKeys).branches;if(this.index)for(let{signature:X}of this.index)$=$.concat(X.branches);return this._keyof=this.$.node("union",$)}map($){return this.$.node("structure",this.props.flatMap($).reduce((X,Y)=>{let U=this.propsByKey[Y.key];if(X4(Y)){if(Y.kind!=="required"&&Y.kind!=="optional")return f(`Map result must have kind "required" or "optional" (was ${Y.kind})`);return X[Y.kind]=P$(X[Y.kind],Y),X}let G=Y.kind??U?.kind??"required",z=M$(Y,(W,Q)=>(W in w5.implementation.keys)?[W,Q]:[]);return X[G]=P$(X[G],this.$.node(G,z)),X},{}))}assertHasKeys($){let X=$.filter((Y)=>!E5(Y,this.keyof()));if(X.length)return f(qv(this.expression,X))}get($,...X){let Y,U=!1,G=fg($);if((typeof G==="string"||typeof G==="symbol")&&this.propsByKey[G])Y=this.propsByKey[G].value,U=this.propsByKey[G].required;if(this.index){for(let W of this.index)if(E5(G,W.signature))Y=Y?.and(W.value)??W.value}if(this.sequence&&E5(G,m.intrinsic.nonNegativeIntegerString))if(U$(G,"root")){if(this.sequence.variadic)Y=Y?.and(this.sequence.element)??this.sequence.element}else{let W=Number.parseInt(G);if(W<this.sequence.prevariadic.length){let Q=this.sequence.prevariadic[W].node;Y=Y?.and(Q)??Q,U||=W<this.sequence.prefixLength}else if(this.sequence.variadic){let Q=this.$.node("union",this.sequence.variadicOrPostfix);Y=Y?.and(Q)??Q}}if(!Y){if(this.sequence?.variadic&&U$(G,"root")&&G.extends(m.intrinsic.number))return f(hg(G.expression,this.sequence.expression));return f(qv(this.expression,[G]))}let z=Y.get(...X);return U?z:z.or(m.intrinsic.undefined)}pick(...$){return this.assertHasKeys($),this.$.node("structure",this.filterKeys("pick",$))}omit(...$){return this.assertHasKeys($),this.$.node("structure",this.filterKeys("omit",$))}optionalize(){let{required:$,...X}=this.inner;return this.$.node("structure",{...X,optional:this.props.map((Y)=>Y.hasKind("required")?this.$.node("optional",Y.inner):Y)})}require(){let{optional:$,...X}=this.inner;return this.$.node("structure",{...X,required:this.props.map((Y)=>Y.hasKind("optional")?{key:Y.key,value:Y.value}:Y)})}merge($){let X=this.filterKeys("omit",[$.keyof()]);if($.required)X.required=P$(X.required,$.required);if($.optional)X.optional=P$(X.optional,$.optional);if($.index)X.index=P$(X.index,$.index);if($.sequence)X.sequence=$.sequence;if($.undeclared)X.undeclared=$.undeclared;else delete X.undeclared;return this.$.node("structure",X)}filterKeys($,X){let Y=pz(this.inner),U=(G)=>{let z=X.some((W)=>E5(G,W));return $==="pick"?z:!z};if(Y.required)Y.required=Y.required.filter((G)=>U(G.key));if(Y.optional)Y.optional=Y.optional.filter((G)=>U(G.key));if(Y.index)Y.index=Y.index.filter((G)=>U(G.signature));return Y}traverseAllows=($,X)=>this._traverse("Allows",$,X);traverseApply=($,X)=>this._traverse("Apply",$,X);_traverse=($,X,Y)=>{let U=Y?.currentErrorCount??0;for(let G=0;G<this.props.length;G++)if($==="Allows"){if(!this.props[G].traverseAllows(X,Y))return!1}else if(this.props[G].traverseApply(X,Y),Y.failFast&&Y.currentErrorCount>U)return!1;if(this.sequence){if($==="Allows"){if(!this.sequence.traverseAllows(X,Y))return!1}else if(this.sequence.traverseApply(X,Y),Y.failFast&&Y.currentErrorCount>U)return!1}if(this.index||this.undeclared==="reject"){let G=Object.keys(X);G.push(...Object.getOwnPropertySymbols(X));for(let z=0;z<G.length;z++){let W=G[z];if(this.index){for(let Q of this.index)if(Q.signature.traverseAllows(W,Y)){if($==="Allows"){if(!e6(W,()=>Q.value.traverseAllows(X[W],Y),Y))return!1}else if(e6(W,()=>Q.value.traverseApply(X[W],Y),Y),Y.failFast&&Y.currentErrorCount>U)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(W)){if($==="Allows")return!1;if(Y.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[W],meta:this.meta}),Y.failFast)return!1}}}if(this.structuralMorph&&Y&&!Y.hasError())Y.queueMorphs([this.structuralMorph]);return!0};get defaultable(){return this.cacheGetter("defaultable",this.optional?.filter(($)=>$.hasDefault())??[])}declaresKey=($)=>($ in this.propsByKey)||this.index?.some((X)=>X.signature.allows($))||this.sequence!==void 0&&m.intrinsic.nonNegativeIntegerString.allows($);_compileDeclaresKey($){let X=[];if(this.props.length)X.push(`k in ${this.propsByKeyReference}`);if(this.index)for(let Y of this.index)X.push($.invoke(Y.signature,{kind:"Allows",arg:"k"}));if(this.sequence)X.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)");return X.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",kg(this))}structuralMorphRef=this.structuralMorph&&F4(this.structuralMorph);compile($){if($.traversalKind==="Apply")$.initializeErrorCount();for(let X of this.props)if($.check(X),$.traversalKind==="Apply")$.returnIfFailFast();if(this.sequence){if($.check(this.sequence),$.traversalKind==="Apply")$.returnIfFailFast()}if(this.index||this.undeclared==="reject")$.const("keys","Object.keys(data)"),$.line("keys.push(...Object.getOwnPropertySymbols(data))"),$.for("i < keys.length",()=>this.compileExhaustiveEntry($));if($.traversalKind==="Allows")return $.return(!0);if(this.structuralMorphRef)$.if("ctx && !ctx.hasError()",()=>{return $.line("ctx.queueMorphs(["),bg($,this),$.line("])")})}compileExhaustiveEntry($){if($.const("k","keys[i]"),this.index)for(let X of this.index)$.if(`${$.invoke(X.signature,{arg:"k",kind:"Allows"})}`,()=>$.traverseKey("k","data[k]",X.value));if(this.undeclared==="reject")$.if(`!(${this._compileDeclaresKey($)})`,()=>{if($.traversalKind==="Allows")return $.return(!1);return $.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if("ctx.failFast",()=>$.return())});return $}reduceJsonSchema($,X){switch($.type){case"object":return this.reduceObjectJsonSchema($,X);case"array":let Y=this.sequence?.reduceJsonSchema($,X)??$;if(this.props.length||this.index)return X.fallback.arrayObject({code:"arrayObject",base:Y,object:this.reduceObjectJsonSchema({type:"object"},X)});return Y;default:return Q4.throwInternalOperandError("structure",$)}}reduceObjectJsonSchema($,X){if(this.props.length){$.properties={};for(let Y of this.props){let U=Y.value.toJsonSchemaRecurse(X);if(typeof Y.key==="symbol"){X.fallback.symbolKey({code:"symbolKey",base:$,key:Y.key,value:U,optional:Y.optional});continue}if(Y.hasDefault()){let G=typeof Y.default==="function"?Y.default():Y.default;U.default=m.intrinsic.jsonData.allows(G)?G:X.fallback.defaultValue({code:"defaultValue",base:U,value:G})}$.properties[Y.key]=U}if(this.requiredKeys.length&&$.properties)$.required=this.requiredKeys.filter((Y)=>typeof Y==="string"&&(Y in $.properties))}if(this.index)for(let Y of this.index){let U=Y.value.toJsonSchemaRecurse(X);if(Y.signature.equals(m.intrinsic.string)){$.additionalProperties=U;continue}for(let G of Y.signature.branches){if(!G.extends(m.intrinsic.string)){$=X.fallback.symbolKey({code:"symbolKey",base:$,key:null,value:U,optional:!1});continue}let z={type:"string"};if(G.hasKind("morph"))z=X.fallback.morph({code:"morph",base:G.in.toJsonSchemaRecurse(X),out:G.out.toJsonSchemaRecurse(X)});if(!G.hasKind("intersection"))return S$(`Unexpected index branch kind ${G.kind}.`);let{pattern:W}=G.inner;if(W){let Q=Object.assign(z,{pattern:W[0].rule});for(let Z=1;Z<W.length;Z++)z=X.fallback.patternIntersection({code:"patternIntersection",base:Q,pattern:W[Z].rule});$.patternProperties??={},$.patternProperties[Q.pattern]=U}}}if(this.undeclared&&!$.additionalProperties)$.additionalProperties=!1;return $}}var uE={},Sg=($)=>{let X="";for(let Y=0;Y<$.defaultable.length;Y++)X+=$.defaultable[Y].defaultValueMorphRef;if($.sequence?.defaultValueMorphsReference)X+=$.sequence?.defaultValueMorphsReference;if($.undeclared==="delete"){if(X+="delete !(",$.required)for(let Y of $.required)X+=Y.compiledKey+" | ";if($.optional)for(let Y of $.optional)X+=Y.compiledKey+" | ";if($.index)for(let Y of $.index)X+=Y.signature.id+" | ";if($.sequence)if($.sequence.maxLength===null)X+=O$.nonNegativeIntegerString.id;else for(let Y=0;Y<$.sequence.tuple.length;Y++)X+=Y+" | ";X+=")"}return X},kg=($)=>{let X=Sg($);if(!X)return;if(uE[X])return uE[X];let Y=(U,G)=>{for(let z=0;z<$.defaultable.length;z++)if(!($.defaultable[z].key in U))$.defaultable[z].defaultValueMorph(U,G);if($.sequence?.defaultables)for(let z=U.length-$.sequence.prefixLength;z<$.sequence.defaultables.length;z++)$.sequence.defaultValueMorphs[z](U,G);if($.undeclared==="delete"){for(let z in U)if(!$.declaresKey(z))delete U[z]}return U};return uE[X]=Y},bg=($,X)=>{let U=`(data${X.defaultable.some((G)=>G.defaultValueMorph.length===2)||X.sequence?.defaultValueMorphs.some((G)=>G.length===2)?", ctx":""})`;return $.block(`${U} => `,(G)=>{for(let z=0;z<X.defaultable.length;z++){let{serializedKey:W,defaultValueMorphRef:Q}=X.defaultable[z];G.if(`!(${W} in data)`,(Z)=>Z.line(`${Q}${U}`))}if(X.sequence?.defaultables)G.for(`i < ${X.sequence.defaultables.length}`,(z)=>z.set("data[i]",5),`data.length - ${X.sequence.prefixLength}`);if(X.undeclared==="delete")G.forIn("data",(z)=>z.if(`!(${X._compileDeclaresKey(z)})`,(W)=>W.line("delete data[k]")));return G.return("data")})},cE={implementation:xg,Node:Tv},fg=($)=>{if(U$($,"root")&&$.hasKind("unit"))$=$.unit;if(typeof $==="number")$=`${$}`;return $},hg=($,X)=>`${$} is not allowed as an array index on ${X}. Use the 'nonNegativeIntegerString' keyword instead.`,$W=($,X,Y)=>{let[U,G]=oR($.branches,(W)=>W.hasKind("unit"));if(!U.length)return{index:Y.node("index",{signature:$,value:X})};let z={};for(let W of U){let Q=Y.node("required",{key:W.unit,value:X});z[Q.kind]=P$(z[Q.kind],Q)}if(G.length)z.index=Y.node("index",{signature:G,value:X});return z},gg=($)=>U$($,"root")?$.expression:J$($),qv=($,X)=>`Key${X.length===1?"":"s"} ${X.map(gg).join(", ")} ${X.length===1?"does":"do"} not exist on ${$}`;var j9={...nT,alias:N5.implementation,domain:ez.implementation,unit:fE.implementation,proto:F5.implementation,union:bE.implementation,morph:SE.implementation,intersection:xE.implementation,divisor:JE.implementation,pattern:vE.implementation,predicate:ME.implementation,required:gE.implementation,optional:w5.implementation,index:hE.implementation,sequence:yE.implementation,structure:cE.implementation};m.defaultConfig=GT(Object.assign(M$(j9,($,X)=>[$,X.defaults]),{jitless:HT(),clone:WT,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:Q4.defaultConfig}));m.resolvedConfig=z5(m.defaultConfig,m.config);var Xv={...tT,alias:N5.Node,domain:ez.Node,unit:fE.Node,proto:F5.Node,union:bE.Node,morph:SE.Node,intersection:xE.Node,divisor:JE.Node,pattern:vE.Node,predicate:ME.Node,required:gE.Node,optional:w5.Node,index:hE.Node,sequence:yE.Node,structure:cE.Node};class x9 extends sD{get[f6](){return"module"}}var pE=($,X)=>new x9(M$($,(Y,U)=>[Y,U$(U,"module")?pE(U,X):X.bindReference(U)]));var yg=($)=>o$($)?$:("branches"in $)&&o$($.branches)?$.branches:void 0,mg=($,X)=>f(`Node of kind ${X} is not valid as a ${$} definition`),vv=($)=>`#${$} duplicates public alias ${$}`,dE={};m.ambient??={};var Cv,jv="function $",ug=($)=>Pv($,Iv($)),Pv=($,X)=>{let Y=X.write(jv,4),U=X.compile()();for(let G of $){if(G.precompilation)continue;if(G.traverseAllows=U[`${G.id}Allows`].bind(U),G.isRoot()&&!G.allowsRequiresContext)G.allows=G.traverseAllows;if(G.traverseApply=U[`${G.id}Apply`].bind(U),U[`${G.id}Optimistic`])G.traverseOptimistic=U[`${G.id}Optimistic`].bind(U);G.precompilation=Y}},Iv=($)=>new cz().return($.reduce((X,Y)=>{let U=new U5({kind:"Allows"}).indent();Y.compile(U);let G=U.write(`${Y.id}Allows`),z=new U5({kind:"Apply"}).indent();Y.compile(z);let W=z.write(`${Y.id}Apply`),Q=`${X}${G},
|
|
195
|
+
Right: ${X}`;var Lg=A$({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:($)=>$ instanceof Date?$.toISOString():P1($)}},normalize:($)=>$,defaults:{description:($)=>J$($.unit),problem:({expected:$,actual:X})=>`${$===X?`must be reference equal to ${$} (serialized to the same value)`:`must be ${$} (was ${X})`}`},intersections:{unit:($,X)=>a.init("unit",$,X),...J0("unit",($,X)=>{if(X.allows($.unit))return $;let Y=X.hasKind("intersection")?X.basis:X;if(Y){let U=Y.hasKind("domain")?Y:m.intrinsic.object;if($.domain!==U.domain){let G=$.domain==="undefined"||$.domain==="null"||$.domain==="boolean"?$.domain:m.intrinsic[$.domain];return a.init("domain",G,U)}}return a.init("assignability",$,X.hasKind("intersection")?X.children.find((U)=>!U.allows($.unit)):X)})}});class Mv extends t8{compiledValue=this.json.unit;serializedValue=typeof this.unit==="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=Fv(this.unit,this.serializedValue);compiledNegation=Fv(this.unit,this.serializedValue,"negated");expression=J$(this.unit);domain=m4(this.unit);get defaultShortDescription(){return this.domain==="object"?s6.object:this.description}innerToJsonSchema($){return this.unit===null?{type:"null"}:m.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:$.fallback.unit({code:"unit",base:{},unit:this.unit})}traverseAllows=this.unit instanceof Date?($)=>$ instanceof Date&&$.toISOString()===this.compiledValue:Number.isNaN(this.unit)?($)=>Number.isNaN($):($)=>$===this.unit}var fE={implementation:Lg,Node:Mv},Fv=($,X,Y)=>{if($ instanceof Date){let U=`data instanceof Date && data.toISOString() === ${X}`;return Y?`!(${U})`:U}if(Number.isNaN($))return`${Y?"!":""}Number.isNaN(data)`;return`data ${Y?"!":"="}== ${X}`};var Kg=A$({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:($,X)=>{let Y=X.$.parseSchema($);if(!Y.extends(m.intrinsic.key))return f(qg(Y.expression));let U=Y.branches.filter((G)=>G.hasKind("unit"));if(U.length)return f(_g(U.map((G)=>J$(G.unit))));return Y}},value:{child:!0,parse:($,X)=>X.$.parseSchema($)}},normalize:($)=>$,defaults:{description:($)=>`[${$.signature.expression}]: ${$.value.description}`},intersections:{index:($,X,Y)=>{if($.signature.equals(X.signature)){let U=Y4($.value,X.value,Y),G=U instanceof a?m.intrinsic.never.internal:U;return Y.$.node("index",{signature:$.signature,value:G})}if($.signature.extends(X.signature)&&$.value.subsumes(X.value))return X;if(X.signature.extends($.signature)&&X.value.subsumes($.value))return $;return null}}});class Jv extends I1{impliedBasis=m.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=P$(this.value.flatRefs.map(($)=>n1([this.signature,...$.path],$.node)),n1([this.signature],this.value));traverseAllows=($,X)=>r8($).every((Y)=>{if(this.signature.traverseAllows(Y[0],X))return $1(Y[0],()=>this.value.traverseAllows(Y[1],X),X);return!0});traverseApply=($,X)=>{for(let Y of r8($))if(this.signature.traverseAllows(Y[0],X))$1(Y[0],()=>this.value.traverseApply(Y[1],X),X)};_transform($,X){X.path.push(this.signature);let Y=super._transform($,X);return X.path.pop(),Y}compile(){}}var hE={implementation:Kg,Node:Jv},_g=($)=>`Index keys ${$.join(", ")} should be specified as named props.`,qg=($)=>`Indexed key definition '${$}' must be a string or symbol`;var Rg=A$({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:($,X)=>X.$.parseSchema($)}},normalize:($)=>$,defaults:{description:($)=>`${$.compiledKey}: ${$.value.description}`,expected:($)=>$.missingValueDescription,actual:()=>"missing"},intersections:{required:V5,optional:V5}});class Av extends O5{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=d2(this.errorContext)}var gE={implementation:Rg,Node:Av};var Tg=A$({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:($,X)=>{if($.length===0)return;return $.map((Y)=>X.$.parseSchema(Y))}},optionals:{child:!0,parse:($,X)=>{if($.length===0)return;return $.map((Y)=>X.$.parseSchema(Y))}},defaultables:{child:($)=>$.map((X)=>X[0]),parse:($,X)=>{if($.length===0)return;return $.map((Y)=>{let U=X.$.parseSchema(Y[0]);return D5(U,Y[1],null),[U,Y[1]]})},serialize:($)=>$.map((X)=>[X[0].collapsibleJson,P1(X[1])])},variadic:{child:!0,parse:($,X)=>X.$.parseSchema($,X)},minVariadicLength:{parse:($)=>$===0?void 0:$},postfix:{child:!0,parse:($,X)=>{if($.length===0)return;return $.map((Y)=>X.$.parseSchema(Y))}}},normalize:($)=>{if(typeof $==="string")return{variadic:$};if("variadic"in $||"prefix"in $||"defaultables"in $||"optionals"in $||"postfix"in $||"minVariadicLength"in $){if($.postfix?.length){if(!$.variadic)return f(jg);if($.optionals?.length||$.defaultables?.length)return f(mE)}if($.minVariadicLength&&!$.variadic)return f("minVariadicLength may not be specified without a variadic element");return $}return{variadic:$}},reduce:($,X)=>{let Y=$.minVariadicLength??0,U=$.prefix?.slice()??[],G=$.defaultables?.slice()??[],z=$.optionals?.slice()??[],W=$.postfix?.slice()??[];if($.variadic){while(z.at(-1)?.equals($.variadic))z.pop();if(z.length===0&&G.length===0)while(U.at(-1)?.equals($.variadic))U.pop(),Y++;while(W[0]?.equals($.variadic))W.shift(),Y++}else if(z.length===0&&G.length===0)U.push(...W.splice(0));if(Y!==$.minVariadicLength||$.prefix&&$.prefix.length!==U.length)return X.node("sequence",{...$,prefix:U,defaultables:G,optionals:z,postfix:W,minVariadicLength:Y},{prereduced:!0})},defaults:{description:($)=>{if($.isVariadicOnly)return`${$.variadic.nestableExpression}[]`;return`[${$.tuple.map((Y)=>Y.kind==="defaultables"?`${Y.node.nestableExpression} = ${J$(Y.default)}`:Y.kind==="optionals"?`${Y.node.nestableExpression}?`:Y.kind==="variadic"?`...${Y.node.nestableExpression}[]`:Y.node.expression).join(", ")}]`}},intersections:{sequence:($,X,Y)=>{let U=M5({l:$.tuple,r:X.tuple,disjoint:new a,result:[],fixedVariants:[],ctx:Y}),G=U.disjoint.length===0?[U,...U.fixedVariants]:U.fixedVariants;return G.length===0?U.disjoint:G.length===1?Y.$.node("sequence",Lv(G[0].result)):Y.$.node("union",G.map((z)=>({proto:Array,sequence:Lv(z.result)})))}}});class Kv extends I1{impliedBasis=m.intrinsic.Array.internal;tuple=Bg(this.inner);prefixLength=this.prefix?.length??0;defaultablesLength=this.defaultables?.length??0;optionalsLength=this.optionals?.length??0;postfixLength=this.postfix?.length??0;defaultablesAndOptionals=[];prevariadic=this.tuple.filter(($)=>{if($.kind==="defaultables"||$.kind==="optionals")return this.defaultablesAndOptionals.push($.node),!0;return $.kind==="prefix"});variadicOrPostfix=X2(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return DE(this.flatRefs,this.prevariadic.flatMap(($,X)=>P$($.node.flatRefs.map((Y)=>n1([`${X}`,...Y.path],Y.node)),n1([`${X}`],$.node)))),DE(this.flatRefs,this.variadicOrPostfix.flatMap(($)=>P$($.flatRefs.map((X)=>n1([m.intrinsic.nonNegativeIntegerString.internal,...X.path],X.node)),n1([m.intrinsic.nonNegativeIntegerString.internal],$)))),this.flatRefs}isVariadicOnly=this.prevariadic.length+this.postfixLength===0;minVariadicLength=this.inner.minVariadicLength??0;minLength=this.prefixLength+this.minVariadicLength+this.postfixLength;minLengthNode=this.minLength===0?null:this.$.node("minLength",this.minLength);maxLength=this.variadic?null:this.tuple.length;maxLengthNode=this.maxLength===null?null:this.$.node("maxLength",this.maxLength);impliedSiblings=this.minLengthNode?this.maxLengthNode?[this.minLengthNode,this.maxLengthNode]:[this.minLengthNode]:this.maxLengthNode?[this.maxLengthNode]:[];defaultValueMorphs=Cg(this);defaultValueMorphsReference=this.defaultValueMorphs.length?F4(this.defaultValueMorphs):void 0;elementAtIndex($,X){if(X<this.prevariadic.length)return this.tuple[X];let Y=$.length-this.postfixLength;if(X>=Y)return{kind:"postfix",node:this.postfix[X-Y]};return{kind:"variadic",node:this.variadic??S$(`Unexpected attempt to access index ${X} on ${this}`)}}traverseAllows=($,X)=>{for(let Y=0;Y<$.length;Y++)if(!this.elementAtIndex($,Y).node.traverseAllows($[Y],X))return!1;return!0};traverseApply=($,X)=>{let Y=0;for(;Y<$.length;Y++)$1(Y,()=>this.elementAtIndex($,Y).node.traverseApply($[Y],X),X)};get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile($){if(this.prefix)for(let[X,Y]of this.prefix.entries())$.traverseKey(`${X}`,`data[${X}]`,Y);for(let[X,Y]of this.defaultablesAndOptionals.entries()){let U=`${X+this.prefixLength}`;$.if(`${U} >= ${$.data}.length`,()=>$.traversalKind==="Allows"?$.return(!0):$.return()),$.traverseKey(U,`data[${U}]`,Y)}if(this.variadic){if(this.postfix)$.const("firstPostfixIndex",`${$.data}.length${this.postfix?`- ${this.postfix.length}`:""}`);if($.for(`i < ${this.postfix?"firstPostfixIndex":"data.length"}`,()=>$.traverseKey("i","data[i]",this.variadic),this.prevariadic.length),this.postfix)for(let[X,Y]of this.postfix.entries()){let U=`firstPostfixIndex + ${X}`;$.traverseKey(U,`data[${U}]`,Y)}}if($.traversalKind==="Allows")$.return(!0)}_transform($,X){X.path.push(m.intrinsic.nonNegativeIntegerString.internal);let Y=super._transform($,X);return X.path.pop(),Y}expression=this.description;reduceJsonSchema($,X){if(this.prevariadic.length)$.prefixItems=this.prevariadic.map((Y)=>{let U=Y.node.toJsonSchemaRecurse(X);if(Y.kind==="defaultables"){let G=typeof Y.default==="function"?Y.default():Y.default;U.default=m.intrinsic.jsonData.allows(G)?G:X.fallback.defaultValue({code:"defaultValue",base:U,value:G})}return U});if(this.minLength)$.minItems=this.minLength;if(this.variadic){let Y=Object.assign($,{items:this.variadic.toJsonSchemaRecurse(X)});if(this.maxLength)Y.maxItems=this.maxLength;if(this.postfix){let U=this.postfix.map((G)=>G.toJsonSchemaRecurse(X));$=X.fallback.arrayPostfix({code:"arrayPostfix",base:Y,elements:U})}}else $.items=!1,delete $.maxItems;return $}}var vg={},Cg=($)=>{if(!$.defaultables)return[];let X=[],Y="[",U=$.prefixLength+$.defaultablesLength-1;for(let G=$.prefixLength;G<=U;G++){let[z,W]=$.defaultables[G-$.prefixLength];X.push(IE(G,z,W)),Y+=`${G}: ${z.id} = ${P1(W)}, `}return Y+="]",vg[Y]??=X},yE={implementation:Tg,Node:Kv},Bg=($)=>{let X=[];if($.prefix)for(let Y of $.prefix)X.push({kind:"prefix",node:Y});if($.defaultables)for(let[Y,U]of $.defaultables)X.push({kind:"defaultables",node:Y,default:U});if($.optionals)for(let Y of $.optionals)X.push({kind:"optionals",node:Y});if($.variadic)X.push({kind:"variadic",node:$.variadic});if($.postfix)for(let Y of $.postfix)X.push({kind:"postfix",node:Y});return X},Lv=($)=>$.reduce((X,Y)=>{if(Y.kind==="variadic")X.variadic=Y.node;else if(Y.kind==="defaultables")X.defaultables=P$(X.defaultables,[[Y.node,Y.default]]);else X[Y.kind]=P$(X[Y.kind],Y.node);return X},{}),mE="A postfix required element cannot follow an optional or defaultable element",jg="A postfix element requires a variadic element",M5=($)=>{let[X,...Y]=$.l,[U,...G]=$.r;if(!X||!U)return $;let z=Y.at(-1)?.kind==="postfix",W=G.at(-1)?.kind==="postfix",Q=X.kind==="prefix"||U.kind==="prefix"?"prefix":X.kind==="postfix"||U.kind==="postfix"?"postfix":X.kind==="variadic"&&U.kind==="variadic"?"variadic":z||W?"prefix":X.kind==="defaultables"||U.kind==="defaultables"?"defaultables":"optionals";if(X.kind==="prefix"&&U.kind==="variadic"&&W){let O=M5({...$,fixedVariants:[],r:G.map((w)=>({...w,kind:"prefix"}))});if(O.disjoint.length===0)$.fixedVariants.push(O)}else if(U.kind==="prefix"&&X.kind==="variadic"&&z){let O=M5({...$,fixedVariants:[],l:Y.map((w)=>({...w,kind:"prefix"}))});if(O.disjoint.length===0)$.fixedVariants.push(O)}let Z=Y4(X.node,U.node,$.ctx);if(Z instanceof a)if(Q==="prefix"||Q==="postfix")$.disjoint.push(...Z.withPrefixKey(Q==="prefix"?$.result.length:`-${Y.length+1}`,"required")),$.result=[...$.result,{kind:Q,node:m.intrinsic.never.internal}];else if(Q==="optionals"||Q==="defaultables")return $;else return M5({...$,fixedVariants:[],l:Y.map((O)=>({...O,kind:"prefix"})),r:Y.map((O)=>({...O,kind:"prefix"}))});else if(Q==="defaultables"){if(X.kind==="defaultables"&&U.kind==="defaultables"&&X.default!==U.default)f(PE(X.default,U.default));$.result=[...$.result,{kind:Q,node:Z,default:X.kind==="defaultables"?X.default:U.kind==="defaultables"?U.default:S$(`Unexpected defaultable intersection from ${X.kind} and ${U.kind} elements.`)}]}else $.result=[...$.result,{kind:Q,node:Z}];let H=$.l.length,V=$.r.length;if(X.kind!=="variadic"||H>=V&&(U.kind==="variadic"||V===1))$.l=Y;if(U.kind!=="variadic"||V>=H&&(X.kind==="variadic"||H===1))$.r=G;return M5($)};var Rv=($)=>(X)=>{if(X.props.length||X.index){let Y=X.index?.map((G)=>G[$])??[];for(let G of X.props)Y.push(G[$]);if(X.undeclared)Y.push(`+ (undeclared): ${X.undeclared}`);let U=`{ ${Y.join(", ")} }`;return X.sequence?`${U} & ${X.sequence.description}`:U}return X.sequence?.description??"{}"},Pg=Rv("description"),Ig=Rv("expression"),_v=($,X,Y)=>{let U=$.required?"required":"optional";if(!X.signature.allows($.key))return null;let G=X1($.value,X.value,Y);if(G instanceof a)return U==="optional"?Y.node("optional",{key:$.key,value:m.intrinsic.never.internal}):G.withPrefixKey($.key,$.kind);return null},xg=A$({kind:"structure",hasAssociatedError:!1,normalize:($)=>$,applyConfig:($,X)=>{if(!$.undeclared&&X.onUndeclaredKey!=="ignore")return{...$,undeclared:X.onUndeclaredKey};return $},keys:{required:{child:!0,parse:w6("required"),reduceIo:($,X,Y)=>{X.required=P$(X.required,Y.map((U)=>U[$]));return}},optional:{child:!0,parse:w6("optional"),reduceIo:($,X,Y)=>{if($==="in"){X.optional=Y.map((U)=>U.in);return}for(let U of Y)X[U.outProp.kind]=P$(X[U.outProp.kind],U.outProp.out)}},index:{child:!0,parse:w6("index")},sequence:{child:!0,parse:w6("sequence")},undeclared:{parse:($)=>$==="ignore"?void 0:$,reduceIo:($,X,Y)=>{if(Y!=="delete")return;if($==="in")delete X.undeclared;else X.undeclared="reject"}}},defaults:{description:Pg},intersections:{structure:($,X,Y)=>{let U={...$.inner},G={...X.inner},z=new a;if($.undeclared){let Z=$.keyof();for(let H of X.requiredKeys)if(!Z.allows(H))z.add("presence",m.intrinsic.never.internal,X.propsByKey[H].value,{path:[H]});if(G.optional)G.optional=G.optional.filter((H)=>Z.allows(H.key));if(G.index)G.index=G.index.flatMap((H)=>{if(H.signature.extends(Z))return H;let V=X1(Z,H.signature,Y.$);if(V instanceof a)return[];let O=$W(V,H.value,Y.$);if(O.required)G.required=X2(G.required,O.required);if(O.optional)G.optional=X2(G.optional,O.optional);return O.index??[]})}if(X.undeclared){let Z=X.keyof();for(let H of $.requiredKeys)if(!Z.allows(H))z.add("presence",$.propsByKey[H].value,m.intrinsic.never.internal,{path:[H]});if(U.optional)U.optional=U.optional.filter((H)=>Z.allows(H.key));if(U.index)U.index=U.index.flatMap((H)=>{if(H.signature.extends(Z))return H;let V=X1(Z,H.signature,Y.$);if(V instanceof a)return[];let O=$W(V,H.value,Y.$);if(O.required)U.required=X2(U.required,O.required);if(O.optional)U.optional=X2(U.optional,O.optional);return O.index??[]})}let W={};if($.undeclared||X.undeclared)W.undeclared=$.undeclared==="reject"||X.undeclared==="reject"?"reject":"delete";let Q=v9({kind:"structure",baseInner:W,l:C9(U),r:C9(G),roots:[],ctx:Y});if(Q instanceof a)z.push(...Q);if(z.length)return z;return Q}},reduce:($,X)=>{if($.index){if(!($.required||$.optional))return;let Y=!1,U=$.required??[],G=$.optional??[],z=[...G];for(let W of $.index){for(let Q of U){let Z=_v(Q,W,X);if(Z instanceof a)return Z}for(let[Q,Z]of G.entries()){let H=_v(Z,W,X);if(H instanceof a)return H;if(H===null)continue;z[Q]=H,Y=!0}}if(Y)return X.node("structure",{...$,optional:z},{prereduced:!0})}}});class Tv extends I1{impliedBasis=m.intrinsic.object.internal;impliedSiblings=this.children.flatMap(($)=>$.impliedSiblings??[]);props=X2(this.required,this.optional);propsByKey=M$(this.props,($,X)=>[X.key,X]);propsByKeyReference=F4(this.propsByKey);expression=Ig(this);requiredKeys=this.required?.map(($)=>$.key)??[];optionalKeys=this.optional?.map(($)=>$.key)??[];literalKeys=[...this.requiredKeys,...this.optionalKeys];_keyof;keyof(){if(this._keyof)return this._keyof;let $=this.$.units(this.literalKeys).branches;if(this.index)for(let{signature:X}of this.index)$=$.concat(X.branches);return this._keyof=this.$.node("union",$)}map($){return this.$.node("structure",this.props.flatMap($).reduce((X,Y)=>{let U=this.propsByKey[Y.key];if(X4(Y)){if(Y.kind!=="required"&&Y.kind!=="optional")return f(`Map result must have kind "required" or "optional" (was ${Y.kind})`);return X[Y.kind]=P$(X[Y.kind],Y),X}let G=Y.kind??U?.kind??"required",z=M$(Y,(W,Q)=>(W in w5.implementation.keys)?[W,Q]:[]);return X[G]=P$(X[G],this.$.node(G,z)),X},{}))}assertHasKeys($){let X=$.filter((Y)=>!E5(Y,this.keyof()));if(X.length)return f(qv(this.expression,X))}get($,...X){let Y,U=!1,G=fg($);if((typeof G==="string"||typeof G==="symbol")&&this.propsByKey[G])Y=this.propsByKey[G].value,U=this.propsByKey[G].required;if(this.index){for(let W of this.index)if(E5(G,W.signature))Y=Y?.and(W.value)??W.value}if(this.sequence&&E5(G,m.intrinsic.nonNegativeIntegerString))if(U$(G,"root")){if(this.sequence.variadic)Y=Y?.and(this.sequence.element)??this.sequence.element}else{let W=Number.parseInt(G);if(W<this.sequence.prevariadic.length){let Q=this.sequence.prevariadic[W].node;Y=Y?.and(Q)??Q,U||=W<this.sequence.prefixLength}else if(this.sequence.variadic){let Q=this.$.node("union",this.sequence.variadicOrPostfix);Y=Y?.and(Q)??Q}}if(!Y){if(this.sequence?.variadic&&U$(G,"root")&&G.extends(m.intrinsic.number))return f(hg(G.expression,this.sequence.expression));return f(qv(this.expression,[G]))}let z=Y.get(...X);return U?z:z.or(m.intrinsic.undefined)}pick(...$){return this.assertHasKeys($),this.$.node("structure",this.filterKeys("pick",$))}omit(...$){return this.assertHasKeys($),this.$.node("structure",this.filterKeys("omit",$))}optionalize(){let{required:$,...X}=this.inner;return this.$.node("structure",{...X,optional:this.props.map((Y)=>Y.hasKind("required")?this.$.node("optional",Y.inner):Y)})}require(){let{optional:$,...X}=this.inner;return this.$.node("structure",{...X,required:this.props.map((Y)=>Y.hasKind("optional")?{key:Y.key,value:Y.value}:Y)})}merge($){let X=this.filterKeys("omit",[$.keyof()]);if($.required)X.required=P$(X.required,$.required);if($.optional)X.optional=P$(X.optional,$.optional);if($.index)X.index=P$(X.index,$.index);if($.sequence)X.sequence=$.sequence;if($.undeclared)X.undeclared=$.undeclared;else delete X.undeclared;return this.$.node("structure",X)}filterKeys($,X){let Y=pz(this.inner),U=(G)=>{let z=X.some((W)=>E5(G,W));return $==="pick"?z:!z};if(Y.required)Y.required=Y.required.filter((G)=>U(G.key));if(Y.optional)Y.optional=Y.optional.filter((G)=>U(G.key));if(Y.index)Y.index=Y.index.filter((G)=>U(G.signature));return Y}traverseAllows=($,X)=>this._traverse("Allows",$,X);traverseApply=($,X)=>this._traverse("Apply",$,X);_traverse=($,X,Y)=>{let U=Y?.currentErrorCount??0;for(let G=0;G<this.props.length;G++)if($==="Allows"){if(!this.props[G].traverseAllows(X,Y))return!1}else if(this.props[G].traverseApply(X,Y),Y.failFast&&Y.currentErrorCount>U)return!1;if(this.sequence){if($==="Allows"){if(!this.sequence.traverseAllows(X,Y))return!1}else if(this.sequence.traverseApply(X,Y),Y.failFast&&Y.currentErrorCount>U)return!1}if(this.index||this.undeclared==="reject"){let G=Object.keys(X);G.push(...Object.getOwnPropertySymbols(X));for(let z=0;z<G.length;z++){let W=G[z];if(this.index){for(let Q of this.index)if(Q.signature.traverseAllows(W,Y)){if($==="Allows"){if(!$1(W,()=>Q.value.traverseAllows(X[W],Y),Y))return!1}else if($1(W,()=>Q.value.traverseApply(X[W],Y),Y),Y.failFast&&Y.currentErrorCount>U)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(W)){if($==="Allows")return!1;if(Y.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[W],meta:this.meta}),Y.failFast)return!1}}}if(this.structuralMorph&&Y&&!Y.hasError())Y.queueMorphs([this.structuralMorph]);return!0};get defaultable(){return this.cacheGetter("defaultable",this.optional?.filter(($)=>$.hasDefault())??[])}declaresKey=($)=>($ in this.propsByKey)||this.index?.some((X)=>X.signature.allows($))||this.sequence!==void 0&&m.intrinsic.nonNegativeIntegerString.allows($);_compileDeclaresKey($){let X=[];if(this.props.length)X.push(`k in ${this.propsByKeyReference}`);if(this.index)for(let Y of this.index)X.push($.invoke(Y.signature,{kind:"Allows",arg:"k"}));if(this.sequence)X.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)");return X.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",kg(this))}structuralMorphRef=this.structuralMorph&&F4(this.structuralMorph);compile($){if($.traversalKind==="Apply")$.initializeErrorCount();for(let X of this.props)if($.check(X),$.traversalKind==="Apply")$.returnIfFailFast();if(this.sequence){if($.check(this.sequence),$.traversalKind==="Apply")$.returnIfFailFast()}if(this.index||this.undeclared==="reject")$.const("keys","Object.keys(data)"),$.line("keys.push(...Object.getOwnPropertySymbols(data))"),$.for("i < keys.length",()=>this.compileExhaustiveEntry($));if($.traversalKind==="Allows")return $.return(!0);if(this.structuralMorphRef)$.if("ctx && !ctx.hasError()",()=>{return $.line("ctx.queueMorphs(["),bg($,this),$.line("])")})}compileExhaustiveEntry($){if($.const("k","keys[i]"),this.index)for(let X of this.index)$.if(`${$.invoke(X.signature,{arg:"k",kind:"Allows"})}`,()=>$.traverseKey("k","data[k]",X.value));if(this.undeclared==="reject")$.if(`!(${this._compileDeclaresKey($)})`,()=>{if($.traversalKind==="Allows")return $.return(!1);return $.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if("ctx.failFast",()=>$.return())});return $}reduceJsonSchema($,X){switch($.type){case"object":return this.reduceObjectJsonSchema($,X);case"array":let Y=this.sequence?.reduceJsonSchema($,X)??$;if(this.props.length||this.index)return X.fallback.arrayObject({code:"arrayObject",base:Y,object:this.reduceObjectJsonSchema({type:"object"},X)});return Y;default:return Q4.throwInternalOperandError("structure",$)}}reduceObjectJsonSchema($,X){if(this.props.length){$.properties={};for(let Y of this.props){let U=Y.value.toJsonSchemaRecurse(X);if(typeof Y.key==="symbol"){X.fallback.symbolKey({code:"symbolKey",base:$,key:Y.key,value:U,optional:Y.optional});continue}if(Y.hasDefault()){let G=typeof Y.default==="function"?Y.default():Y.default;U.default=m.intrinsic.jsonData.allows(G)?G:X.fallback.defaultValue({code:"defaultValue",base:U,value:G})}$.properties[Y.key]=U}if(this.requiredKeys.length&&$.properties)$.required=this.requiredKeys.filter((Y)=>typeof Y==="string"&&(Y in $.properties))}if(this.index)for(let Y of this.index){let U=Y.value.toJsonSchemaRecurse(X);if(Y.signature.equals(m.intrinsic.string)){$.additionalProperties=U;continue}for(let G of Y.signature.branches){if(!G.extends(m.intrinsic.string)){$=X.fallback.symbolKey({code:"symbolKey",base:$,key:null,value:U,optional:!1});continue}let z={type:"string"};if(G.hasKind("morph"))z=X.fallback.morph({code:"morph",base:G.in.toJsonSchemaRecurse(X),out:G.out.toJsonSchemaRecurse(X)});if(!G.hasKind("intersection"))return S$(`Unexpected index branch kind ${G.kind}.`);let{pattern:W}=G.inner;if(W){let Q=Object.assign(z,{pattern:W[0].rule});for(let Z=1;Z<W.length;Z++)z=X.fallback.patternIntersection({code:"patternIntersection",base:Q,pattern:W[Z].rule});$.patternProperties??={},$.patternProperties[Q.pattern]=U}}}if(this.undeclared&&!$.additionalProperties)$.additionalProperties=!1;return $}}var uE={},Sg=($)=>{let X="";for(let Y=0;Y<$.defaultable.length;Y++)X+=$.defaultable[Y].defaultValueMorphRef;if($.sequence?.defaultValueMorphsReference)X+=$.sequence?.defaultValueMorphsReference;if($.undeclared==="delete"){if(X+="delete !(",$.required)for(let Y of $.required)X+=Y.compiledKey+" | ";if($.optional)for(let Y of $.optional)X+=Y.compiledKey+" | ";if($.index)for(let Y of $.index)X+=Y.signature.id+" | ";if($.sequence)if($.sequence.maxLength===null)X+=O$.nonNegativeIntegerString.id;else for(let Y=0;Y<$.sequence.tuple.length;Y++)X+=Y+" | ";X+=")"}return X},kg=($)=>{let X=Sg($);if(!X)return;if(uE[X])return uE[X];let Y=(U,G)=>{for(let z=0;z<$.defaultable.length;z++)if(!($.defaultable[z].key in U))$.defaultable[z].defaultValueMorph(U,G);if($.sequence?.defaultables)for(let z=U.length-$.sequence.prefixLength;z<$.sequence.defaultables.length;z++)$.sequence.defaultValueMorphs[z](U,G);if($.undeclared==="delete"){for(let z in U)if(!$.declaresKey(z))delete U[z]}return U};return uE[X]=Y},bg=($,X)=>{let U=`(data${X.defaultable.some((G)=>G.defaultValueMorph.length===2)||X.sequence?.defaultValueMorphs.some((G)=>G.length===2)?", ctx":""})`;return $.block(`${U} => `,(G)=>{for(let z=0;z<X.defaultable.length;z++){let{serializedKey:W,defaultValueMorphRef:Q}=X.defaultable[z];G.if(`!(${W} in data)`,(Z)=>Z.line(`${Q}${U}`))}if(X.sequence?.defaultables)G.for(`i < ${X.sequence.defaultables.length}`,(z)=>z.set("data[i]",5),`data.length - ${X.sequence.prefixLength}`);if(X.undeclared==="delete")G.forIn("data",(z)=>z.if(`!(${X._compileDeclaresKey(z)})`,(W)=>W.line("delete data[k]")));return G.return("data")})},cE={implementation:xg,Node:Tv},fg=($)=>{if(U$($,"root")&&$.hasKind("unit"))$=$.unit;if(typeof $==="number")$=`${$}`;return $},hg=($,X)=>`${$} is not allowed as an array index on ${X}. Use the 'nonNegativeIntegerString' keyword instead.`,$W=($,X,Y)=>{let[U,G]=oR($.branches,(W)=>W.hasKind("unit"));if(!U.length)return{index:Y.node("index",{signature:$,value:X})};let z={};for(let W of U){let Q=Y.node("required",{key:W.unit,value:X});z[Q.kind]=P$(z[Q.kind],Q)}if(G.length)z.index=Y.node("index",{signature:G,value:X});return z},gg=($)=>U$($,"root")?$.expression:J$($),qv=($,X)=>`Key${X.length===1?"":"s"} ${X.map(gg).join(", ")} ${X.length===1?"does":"do"} not exist on ${$}`;var j9={...nT,alias:N5.implementation,domain:ez.implementation,unit:fE.implementation,proto:F5.implementation,union:bE.implementation,morph:SE.implementation,intersection:xE.implementation,divisor:JE.implementation,pattern:vE.implementation,predicate:ME.implementation,required:gE.implementation,optional:w5.implementation,index:hE.implementation,sequence:yE.implementation,structure:cE.implementation};m.defaultConfig=GT(Object.assign(M$(j9,($,X)=>[$,X.defaults]),{jitless:HT(),clone:WT,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:Q4.defaultConfig}));m.resolvedConfig=z5(m.defaultConfig,m.config);var Xv={...tT,alias:N5.Node,domain:ez.Node,unit:fE.Node,proto:F5.Node,union:bE.Node,morph:SE.Node,intersection:xE.Node,divisor:JE.Node,pattern:vE.Node,predicate:ME.Node,required:gE.Node,optional:w5.Node,index:hE.Node,sequence:yE.Node,structure:cE.Node};class x9 extends sD{get[f6](){return"module"}}var pE=($,X)=>new x9(M$($,(Y,U)=>[Y,U$(U,"module")?pE(U,X):X.bindReference(U)]));var yg=($)=>o$($)?$:("branches"in $)&&o$($.branches)?$.branches:void 0,mg=($,X)=>f(`Node of kind ${X} is not valid as a ${$} definition`),vv=($)=>`#${$} duplicates public alias ${$}`,dE={};m.ambient??={};var Cv,jv="function $",ug=($)=>Pv($,Iv($)),Pv=($,X)=>{let Y=X.write(jv,4),U=X.compile()();for(let G of $){if(G.precompilation)continue;if(G.traverseAllows=U[`${G.id}Allows`].bind(U),G.isRoot()&&!G.allowsRequiresContext)G.allows=G.traverseAllows;if(G.traverseApply=U[`${G.id}Apply`].bind(U),U[`${G.id}Optimistic`])G.traverseOptimistic=U[`${G.id}Optimistic`].bind(U);G.precompilation=Y}},Iv=($)=>new cz().return($.reduce((X,Y)=>{let U=new U5({kind:"Allows"}).indent();Y.compile(U);let G=U.write(`${Y.id}Allows`),z=new U5({kind:"Apply"}).indent();Y.compile(z);let W=z.write(`${Y.id}Apply`),Q=`${X}${G},
|
|
196
196
|
${W},
|
|
197
197
|
`;if(!Y.hasKind("union"))return Q;let Z=new U5({kind:"Allows",optimistic:!0}).indent();Y.compile(Z);let H=Z.write(`${Y.id}Optimistic`);return`${Q}${H},
|
|
198
198
|
`},`{
|
|
199
|
-
`)+"}");class XW{config;resolvedConfig;name;get[f6](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor($,X){if(this.config=z5(m.config,X),this.resolvedConfig=z5(m.resolvedConfig,X),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(dE).length}`,this.name in dE)f(`A Scope already named ${this.name} already exists`);dE[this.name]=this;let Y=Object.entries($).map((U)=>this.preparseOwnAliasEntry(...U));for(let[U,G]of Y){let z=U;if(U[0]==="#"){if(z=U.slice(1),z in this.aliases)f(vv(z));this.aliases[z]=G}else{if(z in this.aliases)f(vv(U));this.aliases[z]=G,this.exportedNames.push(z)}if(!U$(G,"module")&&!U$(G,"generic")&&!u2(G)){let W=this.preparseOwnDefinitionFormat(G,{alias:z});this.resolutions[z]=U$(W,"root")?this.bindReference(W):this.createParseContext(W).id}}Cv??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[Cv.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=m.intrinsic?M$(m.intrinsic,(U,G)=>U.startsWith("json")?[]:[U,this.bindReference(G)]):{}}cacheGetter($,X){return Object.defineProperty(this,$,{value:X}),X}get internal(){return this}_json;get json(){if(!this._json)this.export();return this._json}defineSchema($){return $}generic=(...$)=>{let X=this;return(Y,U)=>new r2($,U?new iz(Y):Y,X,X,U??null)};units=($,X)=>{let Y=[];for(let G of $)if(!Y.includes(G))Y.push(G);let U=Y.map((G)=>this.node("unit",{unit:G},X));return this.node("union",U,{...X,prereduced:!0})};lazyResolutions=[];lazilyResolve($,X){let Y=this.node("alias",{reference:X??"synthetic",resolve:$},{prereduced:!0});if(!this.resolved)this.lazyResolutions.push(Y);return Y}schema=($,X)=>this.finalize(this.parseSchema($,X));parseSchema=($,X)=>this.node(H5($),$,X);preparseNode($,X,Y){let U=typeof $==="string"?$:H5(X,$);if(X4(X)&&X.kind===U)return X;if(U==="alias"&&!Y?.prereduced){let{reference:W}=N5.implementation.normalize(X,this);if(W.startsWith("$")){let Q=this.resolveRoot(W.slice(1));X=Q,U=Q.kind}}else if(U==="union"&&t6(X,"object")){let W=yg(X);if(W?.length===1)X=W[0],U=H5(X)}if(X4(X)&&X.kind===U)return X;let z=j9[U].normalize?.(X,this)??X;if(X4(z))return z.kind===U?z:mg(U,z.kind);return{...Y,$:this,kind:U,def:z,prefix:Y.alias??U}}bindReference($){let X;if(X4($))X=$.$===this?$:new $.constructor($.attachments,this);else X=$.$===this?$:new r2($.params,$.bodyDef,$.$,this,$.hkt);if(!this.resolved)Object.assign(this.referencesById,X.referencesById);return X}resolveRoot($){return this.maybeResolveRoot($)??f(iE($))}maybeResolveRoot($){let X=this.maybeResolve($);if(U$(X,"generic"))return;return X}maybeResolveSubalias($){return lE(this.aliases,$)??lE(this.ambient,$)}get ambient(){return m.ambient}maybeResolve($){let X=this.resolutions[$];if(X){if(typeof X!=="string")return this.bindReference(X);let U=h6[X];if(U$(U,"root"))return this.resolutions[$]=U;if(U$(U,"context")){if(U.phase==="resolving")return this.node("alias",{reference:`$${$}`},{prereduced:!0});if(U.phase==="resolved")return S$(`Unexpected resolved context for was uncached by its scope: ${J$(U)}`);U.phase="resolving";let G=this.bindReference(this.parseOwnDefinitionFormat(U.def,U));return U.phase="resolved",h6[G.id]=G,h6[U.id]=G,this.resolutions[$]=G}return S$(`Unexpected nodesById entry for ${X}: ${J$(U)}`)}let Y=this.aliases[$]??this.ambient?.[$];if(!Y)return this.maybeResolveSubalias($);if(Y=this.normalizeRootScopeValue(Y),U$(Y,"generic"))return this.resolutions[$]=this.bindReference(Y);if(U$(Y,"module")){if(!Y.root)f(kv($));return this.resolutions[$]=this.bindReference(Y.root)}return this.resolutions[$]=this.parse(Y,{alias:$})}createParseContext($){let X=$.id??CE($.prefix);return h6[X]=Object.assign($,{[f6]:"context",$:this,id:X,phase:"unresolved"})}traversal($){return new i1($,this.resolvedConfig)}import(...$){return new x9(M$(this.export(...$),(X,Y)=>[`#${X}`,Y]))}precompilation;_exportedResolutions;_exports;export(...$){if(!this._exports){this._exports={};for(let Y of this.exportedNames){let U=this.aliases[Y];this._exports[Y]=U$(U,"module")?pE(U,this):Bv(this.maybeResolve(Y))}for(let Y of this.lazyResolutions)Y.resolution;if(this._exportedResolutions=Sv(this,this._exports),this._json=xv(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){let Y=Iv(this.references);this.precompilation=Y.write(jv,4),Pv(this.references,Y)}this.resolved=!0}let X=$.length?$:this.exportedNames;return new x9(M$(X,(Y,U)=>[U,this._exports[U]]))}resolve($){return this.export()[$]}node=($,X,Y={})=>{let U=this.preparseNode($,X,Y);if(X4(U))return this.bindReference(U);let G=this.createParseContext(U),z=BE(G),W=this.bindReference(z);return h6[G.id]=W};parse=($,X={})=>this.finalize(this.parseDefinition($,X));parseDefinition($,X={}){if(U$($,"root"))return this.bindReference($);let Y=this.preparseOwnDefinitionFormat($,X);if(U$(Y,"root"))return this.bindReference(Y);let U=this.createParseContext(Y);h6[U.id]=U;let G=this.bindReference(this.parseOwnDefinitionFormat($,U));if(G.isCyclic)G=$v(G,U.id);return h6[U.id]=G,G}finalize($){if(Bv($),!$.precompilation&&!this.resolvedConfig.jitless)ug($.references);return $}}class rE extends XW{parseOwnDefinitionFormat($,X){return BE(X)}preparseOwnDefinitionFormat($,X){return this.preparseNode(H5($),$,X)}preparseOwnAliasEntry($,X){return[$,X]}normalizeRootScopeValue($){return $}}var Bv=($)=>{let X=$.references.filter((Y)=>Y.hasKind("alias"));for(let Y of X){Object.assign(Y.referencesById,Y.resolution.referencesById);for(let U of $.references)if(Y.id in U.referencesById)Object.assign(U.referencesById,Y.referencesById)}return $},xv=($)=>M$($,(X,Y)=>[X,U$(Y,"root")||U$(Y,"generic")?Y.json:U$(Y,"module")?xv(Y):S$(`Unexpected resolution ${J$(Y)}`)]),lE=($,X)=>{let Y=X.indexOf(".");if(Y===-1)return;let U=X.slice(0,Y),G=$[U];if(G===void 0)return;if(!U$(G,"module"))return f(cg(U));let z=X.slice(Y+1),W=G[z];if(W===void 0)return lE(G,z);if(U$(W,"root")||U$(W,"generic"))return W;if(U$(W,"module"))return W.root??f(kv(X));S$(`Unexpected resolution for alias '${X}': ${J$(W)}`)},YW=($,X)=>new rE($,X),J5=new rE({});var Sv=($,X)=>{let Y={};for(let U in X){let G=X[U];if(U$(G,"module")){let z=Sv($,G),W=M$(z,(Q,Z)=>[`${U}.${Q}`,Z]);Object.assign(Y,W)}else if(U$(G,"root")||U$(G,"generic"))Y[U]=G;else S$(`Unexpected scope resolution ${J$(G)}`)}return Y},iE=($)=>`'${$}' is unresolvable`,cg=($)=>`'${$}' must reference a module to be accessed using dot syntax`,kv=($)=>`Reference to submodule '${$}' must specify an alias`;J5.export();var{schema:u$,node:S9,defineSchema:eU$,generic:x1}=J5;var oE="^(?:0|[1-9]\\d*)$",pg=new RegExp(oE),Y7$=F4(pg);var bv=YW({bigint:"bigint",boolean:[{unit:!1},{unit:!0}],false:{unit:!1},never:[],null:{unit:null},number:"number",object:"object",string:"string",symbol:"symbol",true:{unit:!0},unknown:{},undefined:{unit:void 0},Array,Date},{prereducedAliases:!0}).export();m.intrinsic={...bv};var fv=YW({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:oE}},{prereducedAliases:!0}).export();Object.assign(m.intrinsic,fv);var dg=YW({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),O$={...bv,...fv,...dg,emptyStructure:S9("structure",{},{prereduced:!0})};m.intrinsic={...O$};var gv=($)=>typeof $==="string"&&$[0]==="d"&&($[1]==="'"||$[1]==='"')&&$.at(-1)===$[1],hv=($)=>$.toString()!=="Invalid Date",yv=($)=>$.slice(2,-1),nE=($)=>`'${$}' could not be parsed by the Date constructor`,mv=($,X)=>lg($,X),lg=($,X)=>{let Y=new Date($);if(hv(Y))return Y;let U=JT($);if(U!==void 0){let G=new Date(U);if(hv(G))return G}return X?f(X===!0?nE($):X):void 0};var tE=($,X)=>{let Y=$.scanner.shiftUntil(rg[cv[X]]);if($.scanner.lookahead==="")return $.error(og(Y,X));if($.scanner.shift(),X==="/"){try{new RegExp(Y)}catch(U){f(String(U))}$.root=$.ctx.$.node("intersection",{domain:"string",pattern:Y},{prereduced:!0})}else if(u4(X,aE))$.root=$.ctx.$.node("unit",{unit:Y});else{let U=mv(Y,nE(Y));$.root=$.ctx.$.node("unit",{meta:Y,unit:U})}},aE={"'":1,'"':1},uv={"/":1,"'":1,'"':1},cv={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},rg={"'":($)=>$.lookahead==="'",'"':($)=>$.lookahead==='"',"/":($)=>$.lookahead==="/"},ig={'"':"double-quote","'":"single-quote","/":"forward slash"},og=($,X)=>`${X}${$} requires a closing ${ig[cv[X]]}`;var pv=($)=>`Private type references should not include '#'. Use '${$}' instead.`,GW="Optional definitions like 'string?' are only valid as properties in an object or tuple",UW="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple";var dv={">":!0,">=":!0},lv={"<":!0,"<=":!0};var k9={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},rv=($)=>`Unmatched )${$===""?"":` before ${$}`}`,zW=($)=>`Missing ${$}`,iv=($,X)=>`Left bounds are only valid when paired with right bounds (try ...${X}${$})`,WW=($)=>`Left-bounded expressions must specify their limits using < or <= (was ${$})`,ov=($,X,Y,U)=>`An expression may have at most one left bound (parsed ${$}${k9[X]}, ${Y}${k9[U]})`;var nv=($,X,Y)=>tv($,X,Y,[]),tv=($,X,Y,U)=>{let G=Y.parseUntilFinalizer();if(U.push(G.root),G.finalizer===">"){if(U.length!==X.params.length)return Y.error(sE($,X.names,U.map((z)=>z.expression)));return U}if(G.finalizer===",")return tv($,X,Y,U);return G.error(zW(">"))},sE=($,X,Y)=>`${$}<${X.join(", ")}> requires exactly ${X.length} args (got ${Y.length}${Y.length===0?"":`: ${Y.join(", ")}`})`;var eE=($)=>{let X=$.scanner.shiftUntilNextTerminator();if(X==="keyof")$.addPrefix("keyof");else $.root=tg($,X)},ng=($,X,Y)=>{if(Y.scanner.shiftUntilNonWhitespace(),Y.scanner.shift()!=="<")return Y.error(sE($,X.names,[]));let G=nv($,X,Y);return X(...G)},tg=($,X)=>ag($,X)??sg($,X)??$.error(X===""?$.scanner.lookahead==="#"?pv($.shiftedByOne().scanner.shiftUntilNextTerminator()):$N($):iE(X)),ag=($,X)=>{if($.ctx.args?.[X]){let U=$.ctx.args[X];if(typeof U!=="string")return U;return $.ctx.$.node("alias",{reference:U},{prereduced:!0})}let Y=$.ctx.$.maybeResolve(X);if(U$(Y,"root"))return Y;if(Y===void 0)return;if(U$(Y,"generic"))return ng(X,Y,$);return f(`Unexpected resolution ${J$(Y)}`)},sg=($,X)=>{let Y=AT(X);if(Y!==void 0)return $.ctx.$.node("unit",{unit:Y});let U=KT(X);if(U!==void 0)return $.ctx.$.node("unit",{unit:U})},$N=($)=>{let X=$.previousOperator();return X?XN(X,$.scanner.unscanned):eg($.scanner.unscanned)},XN=($,X="")=>`Token '${$}' requires a right operand${X?` before '${X}'`:""}`,eg=($)=>`Expected an expression${$?` before '${$}'`:""}`;var YN=($)=>$.scanner.lookahead===""?$.error($N($)):$.scanner.lookahead==="("?$.shiftedByOne().reduceGroupOpen():$.scanner.lookaheadIsIn(uv)?tE($,$.scanner.shift()):$.scanner.lookaheadIsIn(c2)?YN($.shiftedByOne()):$.scanner.lookahead==="d"?$.scanner.nextLookahead in aE?tE($,`${$.scanner.shift()}${$.scanner.shift()}`):eE($):eE($);class Q2 extends QE{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>(this.lookahead in Q2.terminatingChars))}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...c2};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=($,X)=>$===">"?X[0]==="="?X[1]==="=":X.trimStart()===""||u4(X.trimStart()[0],Q2.terminatingChars):$==="="?X[0]!=="=":$===","||$==="?"}var sv=($,X)=>{let Y=$y($,X);if($.root.hasKind("unit")){if(typeof $.root.unit==="number"){$.reduceLeftBound($.root.unit,Y),$.unsetRoot();return}if($.root.unit instanceof Date){let U=`d'${$.root.description??$.root.unit.toISOString()}'`;$.unsetRoot(),$.reduceLeftBound(U,Y);return}}return Yy($,Y)},ev={"<":1,">":1,"=":1},$y=($,X)=>$.scanner.lookaheadIs("=")?`${X}${$.scanner.shift()}`:X;var av=($,X,Y,U)=>{if(Y.extends(m.intrinsic.number)){if(typeof X!=="number")return f(GN($,X,U));return $==="=="?["min","max"]:$[0]===">"?["min"]:["max"]}if(Y.extends(m.intrinsic.lengthBoundable)){if(typeof X!=="number")return f(GN($,X,U));return $==="=="?["exactLength"]:$[0]===">"?["minLength"]:["maxLength"]}if(Y.extends(m.intrinsic.Date))return $==="=="?["after","before"]:$[0]===">"?["after"]:["before"];return f(uT(Y.expression))},Xy=($)=>({rule:gv($.limit)?yv($.limit):$.limit,exclusive:$.comparator.length===1}),Yy=($,X)=>{let Y=$.unsetRoot(),U=$.scanner.location;$.parseOperand();let G=$.unsetRoot(),z=$.scanner.sliceChars(U,$.scanner.location);if($.root=Y,!G.hasKind("unit")||typeof G.unit!=="number"&&!(G.unit instanceof Date))return $.error(GN(X,z,"right"));let W=G.unit,Q=X.length===1,Z=av(X,typeof W==="number"?W:z,Y,"right");for(let V of Z)$.constrainRoot(V,X==="=="?{rule:W}:{rule:W,exclusive:Q});if(!$.branches.leftBound)return;if(!u4(X,lv))return $.error(WW(X));let H=av($.branches.leftBound.comparator,$.branches.leftBound.limit,Y,"left");$.constrainRoot(H[0],Xy($.branches.leftBound)),$.branches.leftBound=null},GN=($,X,Y)=>`Comparator ${Y==="left"?k9[$]:$} must be ${Y==="left"?"preceded":"followed"} by a corresponding literal (was ${X})`;var $C=($)=>{$.scanner.shiftUntilNonWhitespace();let X=$.scanner.shiftUntilNextTerminator();$.root=$.root.brand(X)};var YC=($)=>{let X=$.scanner.shiftUntilNextTerminator(),Y=LT(X,{errorOnFail:XC(X)});if(Y===0)$.error(XC(0));$.root=$.root.constrain("divisor",Y)},XC=($)=>`% operator must be followed by a non-zero integer literal (was ${$})`;var UN=($)=>{let X=$.scanner.shift();return X===""?$.finalize(""):X==="["?$.scanner.shift()==="]"?$.setRoot($.root.array()):$.error(Gy):X==="|"?$.scanner.lookahead===">"?$.shiftedByOne().pushRootToBranch("|>"):$.pushRootToBranch(X):X==="&"?$.pushRootToBranch(X):X===")"?$.finalizeGroup():Q2.lookaheadIsFinalizing(X,$.scanner.unscanned)?$.finalize(X):u4(X,ev)?sv($,X):X==="%"?YC($):X==="#"?$C($):(X in c2)?UN($):$.error(QW(X))},QW=($,X="")=>`'${$}' is not allowed here${X&&` (should be ${X})`}`,Gy="Missing expected ']'";var GC=($)=>{let X=$.unsetRoot();$.parseOperand();let Y=$.unsetRoot();if(!Y.hasKind("unit"))return $.error(Uy(Y.expression));let U=Y.unit instanceof Date?()=>new Date(Y.unit):Y.unit;return[X,"=",U]},Uy=($)=>`Default value '${$}' must a literal value`;var zN=($,X)=>{let Y=X.$.maybeResolveRoot($);if(Y)return Y;if($.endsWith("[]")){let z=X.$.maybeResolveRoot($.slice(0,-2));if(z)return z.array()}let U=new b9(new Q2($),X),G=zy(U);if(U.finalizer===">")f(QW(">"));return G},zy=($)=>{$.parseOperand();let X=A5($).root;if(!X)return S$(`Root was unexpectedly unset after parsing string '${$.scanner.scanned}'`);if($.finalizer==="=")X=GC($);else if($.finalizer==="?")X=[X,"?"];if($.scanner.shiftUntilNonWhitespace(),$.scanner.lookahead)f(QW($.scanner.lookahead));return X},A5=($)=>{while($.finalizer===void 0)Wy($);return $},Wy=($)=>$.hasRoot()?$.parseOperator():$.parseOperand();class b9{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor($,X){this.scanner=$,this.ctx=X}error($){return f($)}hasRoot(){return this.root!==void 0}setRoot($){this.root=$}unsetRoot(){let $=this.root;return this.root=void 0,$}constrainRoot(...$){this.root=this.root.constrain($[0],$[1])}finalize($){if(this.groups.length)return this.error(zW(")"));this.finalizeBranches(),this.finalizer=$}reduceLeftBound($,X){let Y=k9[X];if(!u4(Y,dv))return this.error(WW(X));if(this.branches.leftBound)return this.error(ov(this.branches.leftBound.limit,this.branches.leftBound.comparator,$,Y));this.branches.leftBound={comparator:Y,limit:$}}finalizeBranches(){if(this.assertRangeUnset(),this.branches.pipe){this.pushRootToBranch("|>"),this.root=this.branches.pipe;return}if(this.branches.union){this.pushRootToBranch("|"),this.root=this.branches.union;return}if(this.branches.intersection){this.pushRootToBranch("&"),this.root=this.branches.intersection;return}this.applyPrefixes()}finalizeGroup(){this.finalizeBranches();let $=this.groups.pop();if(!$)return this.error(rv(this.scanner.unscanned));this.branches=$}addPrefix($){this.branches.prefixes.push($)}applyPrefixes(){while(this.branches.prefixes.length){let $=this.branches.prefixes.pop();this.root=$==="keyof"?this.root.keyof():S$(`Unexpected prefix '${$}'`)}}pushRootToBranch($){this.assertRangeUnset(),this.applyPrefixes();let X=this.root;if(this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(X)??X,$==="&")return;if(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,$==="|")return;this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null}parseUntilFinalizer(){return A5(new b9(this.scanner,this.ctx))}parseOperator(){return UN(this)}parseOperand(){return YN(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(iv(this.branches.leftBound.limit,this.branches.leftBound.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={prefixes:[],leftBound:null,union:null,intersection:null,pipe:null}}previousOperator(){return this.branches.leftBound?.comparator??this.branches.prefixes.at(-1)??(this.branches.intersection?"&":this.branches.union?"|":this.branches.pipe?"|>":void 0)}shiftedByOne(){return this.scanner.shift(),this}}var Qy="An empty string is not a valid generic parameter name",ZW=($,X,Y)=>{$.shiftUntilNonWhitespace();let U=$.shiftUntilNextTerminator();if(U===""){if($.lookahead===""&&X.length)return X;return f(Qy)}return $.shiftUntilNonWhitespace(),Zy($,U,X,Y)},UC="extends ",Zy=($,X,Y,U)=>{if($.shiftUntilNonWhitespace(),$.unscanned.startsWith(UC))$.jumpForward(UC.length);else{if($.lookahead===",")$.shift();return Y.push(X),ZW($,Y,U)}let G=A5(new b9($,U));return Y.push([X,G.root]),ZW($,Y,U)};class WN extends r1{$;constructor($){super((...X)=>new L5($)(...X),{bind:$});this.$=$}in($){return new L5(this.$,$===void 0?void 0:this.$.parse($))}at($,X){return new L5(this.$).at($,X)}case($,X){return new L5(this.$).case($,X)}}class L5 extends r1{$;in;key;branches=[];constructor($,X){super((Y)=>this.caseEntries(Object.entries(Y).map(([U,G])=>U==="default"?[U,G]:[this.$.parse(U),G])));this.$=$,this.in=X}at($,X){if(this.key)f(Vy);if(this.branches.length)f(Hy);return this.key=$,X?this.match(X):this}case($,X){return this.caseEntry(this.$.parse($),X)}caseEntry($,X){let U=(this.key?this.$.parse({[this.key]:$}):$).pipe(X);return this.branches.push(U),this}match($){return this($)}strings($){return this.caseEntries(Object.entries($).map(([X,Y])=>X==="default"?[X,Y]:[this.$.node("unit",{unit:X}),Y]))}caseEntries($){for(let X=0;X<$.length;X++){let[Y,U]=$[X];if(Y==="default"){if(X!==$.length-1)f("default may only be specified as the last key of a switch definition");return this.default(U)}if(typeof U!=="function")return f(`Value for case "${Y}" must be a function (was ${m4(U)})`);this.caseEntry(Y,U)}return this}default($){if(typeof $==="function")this.case(O$.unknown,$);let X={branches:this.branches,ordered:!0};if($==="never"||$==="assert")X.meta={onFail:zC};let Y=this.$.node("union",X);if(!this.in)return this.$.finalize(Y);let U=this.in.pipe(Y);if($==="never"||$==="assert")U=U.configureReferences({onFail:zC},"self");return this.$.finalize(U)}}var zC=($)=>$.throw(),Hy="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",Vy="At most one key matcher may be specified per expression";var HW=($,X)=>{if(o$($)){if($[1]==="=")return[X.$.parseOwnDefinitionFormat($[0],X),"=",$[2]];if($[1]==="?")return[X.$.parseOwnDefinitionFormat($[0],X),"?"]}return VW($,X)},WC="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",QC="Only required keys may specify default values, e.g. { value: 'number = 0' }";var ZC=($,X)=>{let Y,U={},G=r8($);for(let[W,Q]of G){let Z=Dy(W);if(Z.kind==="spread"){if(!F0(U))return f(wy);let D=X.$.parseOwnDefinitionFormat(Q,X);if(D.equals(O$.object))continue;if(!D.hasKind("intersection")||!D.basis?.equals(O$.object))return f(Ey(D.expression));Y=D.structure;continue}if(Z.kind==="undeclared"){if(Q!=="reject"&&Q!=="delete"&&Q!=="ignore")f(Oy(Q));U.undeclared=Q;continue}let H=HW(Q,X),V=Z;if(Z.kind==="required"){if(!o$(H))QN(U,"required",{key:Z.normalized,value:H},X);else QN(U,"optional",H[1]==="="?{key:Z.normalized,value:H[0],default:H[2]}:{key:Z.normalized,value:H[0]},X);continue}if(o$(H)){if(H[1]==="?")f(WC);if(H[1]==="=")f(QC)}if(Z.kind==="optional"){QN(U,"optional",{key:Z.normalized,value:H},X);continue}let O=X.$.parseOwnDefinitionFormat(V.normalized,X),w=$W(O,H,X.$);if(w.index)U.index=P$(U.index,w.index);if(w.required)U.required=P$(U.required,w.required)}let z=X.$.node("structure",U);return X.$.parseSchema({domain:"object",structure:Y?.merge(z)??z})},QN=($,X,Y,U)=>{$[X]=P$($[X],U.$.node(X,Y))},Oy=($)=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${J$($)})`,wy="Spread operator may only be used as the first key in an object",Dy=($)=>typeof $==="symbol"?{kind:"required",normalized:$}:$.at(-1)==="?"?$.at(-2)===s3?{kind:"required",normalized:`${$.slice(0,-2)}?`}:{kind:"optional",normalized:$.slice(0,-1)}:$[0]==="["&&$.at(-1)==="]"?{kind:"index",normalized:$.slice(1,-1)}:$[0]===s3&&$[1]==="["&&$.at(-1)==="]"?{kind:"required",normalized:$.slice(1)}:$==="..."?{kind:"spread"}:$==="+"?{kind:"undeclared"}:{kind:"required",normalized:$==="\\..."?"...":$==="\\+"?"+":$},Ey=($)=>`Spread operand must resolve to an object literal type (was ${$})`;var VC=($,X)=>Ry($)?EC[$[0]]($,X):_y($)?DC[$[1]]($,X):null,Ny=($,X)=>X.$.parseOwnDefinitionFormat($[1],X).keyof(),ZN=($,X)=>{if($[2]===void 0)return f(XN($[1],""));let Y=X.$.parseOwnDefinitionFormat($[0],X),U=X.$.parseOwnDefinitionFormat($[2],X);if($[1]==="|")return X.$.node("union",{branches:[Y,U]});let G=$[1]==="&"?$1(Y,U,X.$):Z5(Y,U,X.$);if(G instanceof a)return G.throw();return G},Fy=($,X)=>X.$.parseOwnDefinitionFormat($[0],X).array(),My=($,X)=>{if(typeof $[2]!=="function")return f(OC("=>",$[2]));return X.$.parseOwnDefinitionFormat($[0],X).pipe($[2])},OC=($,X)=>`${$===":"?"Narrow":"Morph"} expression requires a function following '${$}' (was ${typeof X})`,Jy=($,X)=>{if(typeof $[2]!=="function")return f(OC(":",$[2]));return X.$.parseOwnDefinitionFormat($[0],X).constrain("predicate",$[2])},Ay=($,X)=>X.$.parseOwnDefinitionFormat($[0],X).configureReferences($[2],"shallow"),wC=($)=>$,Ly=wC({"[]":Fy,"?":()=>f(GW)}),Ky=wC({"|":ZN,"&":ZN,":":Jy,"=>":My,"|>":ZN,"@":Ay,"=":()=>f(UW)}),DC={...Ly,...Ky},_y=($)=>DC[$[1]]!==void 0,qy=($)=>$,EC=qy({keyof:Ny,instanceof:($,X)=>{if(typeof $[1]!=="function")return f(HC(t3($[1])));let Y=$.slice(1).map((U)=>typeof U==="function"?X.$.node("proto",{proto:U}):f(HC(t3(U))));return Y.length===1?Y[0]:X.$.node("union",{branches:Y})},"===":($,X)=>X.$.units($.slice(1))}),Ry=($)=>EC[$[0]]!==void 0,HC=($)=>`Expected a constructor following 'instanceof' operator (was ${$})`;var MC=($,X)=>{let Y=[{}],U=0;while(U<$.length){let G=!1;if($[U]==="..."&&U<$.length-1)G=!0,U++;let z=HW($[U],X),[W,Q,Z]=!o$(z)?[z]:z;if(U++,G){if(!W.extends(m.intrinsic.Array))return f(Cy(W.expression));Y=Y.flatMap((H)=>W.distribute((V)=>vy(pz(H),V)))}else Y=Y.map((H)=>{if(Q==="?")return JC(H,W);if(Q==="=")return Ty(H,W,Z);return HN(H,W)})}return X.$.parseSchema(Y.map((G)=>F0(G)?{proto:Array,exactLength:0}:{proto:Array,sequence:G}))},HN=($,X)=>{if($.defaultables||$.optionals)return f($.variadic?mE:By);if($.variadic)$.postfix=P$($.postfix,X);else $.prefix=P$($.prefix,X);return $},JC=($,X)=>{if($.variadic)return f(AC);return $.optionals=P$($.optionals,X),$},Ty=($,X,Y)=>{if($.variadic)return f(AC);if($.optionals)return f(jy);return $.defaultables=P$($.defaultables,[[X,Y]]),$},NC=($,X)=>{if($.postfix)f(FC);if($.variadic){if(!$.variadic.equals(X))f(FC)}else $.variadic=X.internal;return $},vy=($,X)=>{let Y=X.select({method:"find",kind:"sequence"});if(!Y)return NC($,m.intrinsic.unknown);if(Y.prefix)for(let U of Y.prefix)HN($,U);if(Y.optionals)for(let U of Y.optionals)JC($,U);if(Y.variadic)NC($,Y.variadic);if(Y.postfix)for(let U of Y.postfix)HN($,U);return $},Cy=($)=>`Spread element must be an array (was ${$})`,FC="A tuple may have at most one variadic element",By="A required element may not follow an optional element",AC="An optional element may not follow a variadic element";var jy="A defaultable element may not follow an optional element without a default";var Py={},VW=($,X)=>{if(typeof $==="string"){if(X.args&&Object.keys(X.args).some((U)=>$.includes(U)))return zN($,X);let Y=Py[X.$.name]??={};return Y[$]??=zN($,X)}return t6($,"object")?Iy($,X):f(VN(m4($)))},Iy=($,X)=>{let Y=n3($);switch(Y){case void 0:if(U$($,"root"))return $;return ZC($,X);case"Array":return xy($,X);case"RegExp":return X.$.node("intersection",{domain:"string",pattern:$},{prereduced:!0});case"Function":{let U=u2($)?$():$;if(U$(U,"root"))return U;return f(VN("Function"))}default:return f(VN(Y??J$($)))}},xy=($,X)=>VC($,X)??MC($,X),VN=($)=>`Type definitions must be strings or objects (was ${$})`;class ON extends r1{constructor($){let X=Object.assign({errors:s6,hkt:O6,$,raw:$.parse,module:$.constructor.module,scope:$.constructor.scope,define:$.define,match:$.match,generic:$.generic,schema:$.schema,keywords:$.ambient,unit:$.unit,enumerated:$.enumerated,instanceOf:$.instanceOf,valueOf:$.valueOf,or:$.or,and:$.and,merge:$.merge,pipe:$.pipe},$.ambientAttachments);super((...Y)=>{if(Y.length===1)return $.parse(Y[0]);if(Y.length===2&&typeof Y[0]==="string"&&Y[0][0]==="<"&&Y[0].at(-1)===">"){let U=Y[0].slice(1,-1),G=$.parseGenericParams(U,{});return new r2(G,Y[1],$,$,null)}return $.parse(Y)},{bind:$,attach:X})}}var f9=m;class OW extends XW{get ambientAttachments(){if(!f9.typeAttachments)return;return this.cacheGetter("ambientAttachments",M$(f9.typeAttachments,($,X)=>[$,this.bindReference(X)]))}preparseOwnAliasEntry($,X){let Y=$.indexOf("<");if(Y===-1){if(U$(X,"module")||U$(X,"generic"))return[$,X];let z=this.name==="ark"?$:$==="root"?this.name:`${this.name}.${$}`,W=this.resolvedConfig.keywords?.[z];if(W)X=[X,"@",W];return[$,X]}if($.at(-1)!==">")f("'>' must be the last character of a generic declaration in a scope");let U=$.slice(0,Y),G=$.slice(Y+1,-1);return[U,()=>{let z=this.parseGenericParams(G,{alias:U});return gT(z,X,this)}]}parseGenericParams($,X){return ZW(new Q2($),[],this.createParseContext({...X,def:$,prefix:"generic"}))}normalizeRootScopeValue($){if(u2($)&&!U$($,"generic"))return $();return $}preparseOwnDefinitionFormat($,X){return{...X,def:$,prefix:X.alias??"type"}}parseOwnDefinitionFormat($,X){if(!(X.alias&&(X.alias in this.aliases))&&!X.args)X.args={this:X.id};let U=VW($,X);if(o$(U)){if(U[1]==="=")return f(UW);if(U[1]==="?")return f(GW)}return U}unit=($)=>this.units([$]);valueOf=($)=>this.units(UT($));enumerated=(...$)=>this.units($);instanceOf=($)=>this.node("proto",{proto:$},{prereduced:!0});or=(...$)=>this.schema($.map((X)=>this.parse(X)));and=(...$)=>$.reduce((X,Y)=>X.and(this.parse(Y)),this.intrinsic.unknown);merge=(...$)=>$.reduce((X,Y)=>X.merge(this.parse(Y)),this.intrinsic.object);pipe=(...$)=>this.intrinsic.unknown.pipe(...$);match=new WN(this);declare=()=>({type:this.type});define($){return $}type=new ON(this);static scope=($,X={})=>new OW($,X);static module=($,X={})=>this.scope($,X).export()}var wN=Object.assign(OW.scope,{define:($)=>$}),B$=OW;class LC extends O6{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}var Sy=x1(["base",O$.object],["props",O$.object])(($)=>$.base.merge($.props),LC),KC=B$.module({Key:O$.key,Merge:Sy});class _C extends O6{}var ky=x1("element")(($)=>{let X=$.element.exclude(O$.Array),Y=X.array();return X.rawOr(Y).pipe(m2).distribute((U)=>U.assertHasKind("morph").declareOut(Y),u$)},_C),qC=B$.module({root:O$.Array,readonly:"root",index:O$.nonNegativeIntegerString,liftFrom:ky},{name:"Array"});var DN=u$(["string",o8.FileConstructor]),by=DN.rawOr(DN.array()),RC=u$({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:by}}),TC=B$.module({root:["instanceof",FormData],value:DN,parsed:RC,parse:u$({in:FormData,morphs:($)=>{let X={};for(let[Y,U]of $)if(Y in X){let G=X[Y];if(typeof G==="string"||G instanceof o8.FileConstructor)X[Y]=[G,U];else G.push(U)}else X[Y]=U;return X},declaredOut:RC})},{name:"FormData"});var vC=B$.module({Int8:["instanceof",Int8Array],Uint8:["instanceof",Uint8Array],Uint8Clamped:["instanceof",Uint8ClampedArray],Int16:["instanceof",Int16Array],Uint16:["instanceof",Uint16Array],Int32:["instanceof",Int32Array],Uint32:["instanceof",Uint32Array],Float32:["instanceof",Float32Array],Float64:["instanceof",Float64Array],BigInt64:["instanceof",BigInt64Array],BigUint64:["instanceof",BigUint64Array]},{name:"TypedArray"});var fy={Boolean:1,Number:1,String:1},CC=B$.module({...M$({...eD,...XE},($,X)=>($ in fy)?[]:[$,["instanceof",X]]),Array:qC,TypedArray:vC,FormData:TC});var hy=u$({domain:{domain:"number",meta:"a number representing a Unix timestamp"},divisor:{rule:1,meta:"an integer representing a Unix timestamp"},min:{rule:-8640000000000000,meta:"a Unix timestamp after -8640000000000000"},max:{rule:8640000000000000,meta:"a Unix timestamp before 8640000000000000"},meta:"an integer representing a safe Unix timestamp"}),gy=u$({domain:"number",divisor:1}),wW=B$.module({root:O$.number,integer:gy,epoch:hy,safe:u$({domain:{domain:"number",numberAllowsNaN:!1},min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}),NaN:["===",Number.NaN],Infinity:["===",Number.POSITIVE_INFINITY],NegativeInfinity:["===",Number.NEGATIVE_INFINITY]},{name:"number"});var Z4=($,X,Y)=>{let U={domain:"string",pattern:{rule:$.source,flags:$.flags,meta:X}};if(Y)U.meta={format:Y};return S9("intersection",U)},BC=Z4(e3,"a well-formed integer string"),mC=B$.module({root:BC,parse:u$({in:BC,morphs:($,X)=>{let Y=Number.parseInt($);return Number.isSafeInteger(Y)?Y:X.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:O$.integer})},{name:"string.integer"}),yy=Z4(/^[\dA-Fa-f]+$/,"hex characters only"),my=B$.module({root:Z4(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:Z4(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),jC=Z4(/^[A-Z].*$/,"capitalized"),uy=B$.module({root:u$({in:"string",morphs:($)=>$.charAt(0).toUpperCase()+$.slice(1),declaredOut:jC}),preformatted:jC},{name:"string.capitalize"}),cy=($)=>{let X=$.replaceAll(/[ -]+/g,""),Y=0,U,G,z=!1;for(let W=X.length-1;W>=0;W--){if(U=X.substring(W,W+1),G=Number.parseInt(U,10),z)G*=2,Y+=G>=10?G%10+1:G;else Y+=G;z=!z}return!!(Y%10===0?X:!1)},py=/^(?:4\d{12}(?:\d{3,6})?|5[1-5]\d{14}|(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}|6(?:011|5\d\d)\d{12,15}|3[47]\d{13}|3(?:0[0-5]|[68]\d)\d{11}|(?:2131|1800|35\d{3})\d{11}|6[27]\d{14}|^(81\d{14,17}))$/,dy=u$({domain:"string",pattern:{meta:"a credit card number",rule:py.source},predicate:{meta:"a credit card number",predicate:cy}});var ly=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;var ry=($)=>!Number.isNaN(new Date($).valueOf()),PC=u$({domain:"string",predicate:{meta:"a parsable date",predicate:ry}}).assertHasKind("intersection"),IC=mC.root.internal.narrow(($,X)=>{let Y=Number.parseInt($),U=wW.epoch(Y);if(U instanceof s6)return X.errors.merge(U),!1;return!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),iy=B$.module({root:IC,parse:u$({in:IC,morphs:($)=>new Date($),declaredOut:O$.Date})},{name:"string.date.epoch"}),xC=Z4(ly,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),oy=B$.module({root:xC,parse:u$({in:xC,morphs:($)=>new Date($),declaredOut:O$.Date})},{name:"string.date.iso"}),ny=B$.module({root:PC,parse:u$({declaredIn:PC,in:"string",morphs:($,X)=>{let Y=new Date($);if(Number.isNaN(Y.valueOf()))return X.error("a parsable date");return Y},declaredOut:O$.Date}),iso:oy,epoch:iy},{name:"string.date"}),ty=Z4(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),SC="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",i2=`(${SC}[.]){3}${SC}`,ay=new RegExp(`^${i2}$`),j4="(?:[0-9a-fA-F]{1,4})",sy=new RegExp(`^((?:${j4}:){7}(?:${j4}|:)|(?:${j4}:){6}(?:${i2}|:${j4}|:)|(?:${j4}:){5}(?::${i2}|(:${j4}){1,2}|:)|(?:${j4}:){4}(?:(:${j4}){0,1}:${i2}|(:${j4}){1,3}|:)|(?:${j4}:){3}(?:(:${j4}){0,2}:${i2}|(:${j4}){1,4}|:)|(?:${j4}:){2}(?:(:${j4}){0,3}:${i2}|(:${j4}){1,5}|:)|(?:${j4}:){1}(?:(:${j4}){0,4}:${i2}|(:${j4}){1,6}|:)|(?::((?::${j4}){0,5}:${i2}|(?::${j4}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),ey=B$.module({root:["v4 | v6","@","an IP address"],v4:Z4(ay,"an IPv4 address","ipv4"),v6:Z4(sy,"an IPv6 address","ipv6")},{name:"string.ip"}),h9="a JSON string",uC=($)=>{if(!($ instanceof SyntaxError))throw $;return`must be ${h9} (${$})`},$m=u$({meta:h9,domain:"string",predicate:{meta:h9,predicate:($,X)=>{try{return JSON.parse($),!0}catch(Y){return X.reject({code:"predicate",expected:h9,problem:uC(Y)})}}}}),Xm=($,X)=>{if($.length===0)return X.error({code:"predicate",expected:h9,actual:"empty"});try{return JSON.parse($)}catch(Y){return X.error({code:"predicate",expected:h9,problem:uC(Y)})}},Ym=B$.module({root:$m,parse:u$({meta:"safe JSON string parser",in:"string",morphs:Xm,declaredOut:O$.jsonObject})},{name:"string.json"}),kC=Z4(/^[a-z]*$/,"only lowercase letters"),Gm=B$.module({root:u$({in:"string",morphs:($)=>$.toLowerCase(),declaredOut:kC}),preformatted:kC},{name:"string.lower"}),cC=["NFC","NFD","NFKC","NFKD"],K5=M$(cC,($,X)=>[X,u$({domain:"string",predicate:(Y)=>Y.normalize(X)===Y,meta:`${X}-normalized unicode`})]),DW=M$(cC,($,X)=>[X,u$({in:"string",morphs:(Y)=>Y.normalize(X),declaredOut:K5[X]})]),Um=B$.module({root:DW.NFC,preformatted:K5.NFC},{name:"string.normalize.NFC"}),zm=B$.module({root:DW.NFD,preformatted:K5.NFD},{name:"string.normalize.NFD"}),Wm=B$.module({root:DW.NFKC,preformatted:K5.NFKC},{name:"string.normalize.NFKC"}),Qm=B$.module({root:DW.NFKD,preformatted:K5.NFKD},{name:"string.normalize.NFKD"}),Zm=B$.module({root:"NFC",NFC:Um,NFD:zm,NFKC:Wm,NFKD:Qm},{name:"string.normalize"}),bC=Z4(mz,"a well-formed numeric string"),Hm=B$.module({root:bC,parse:u$({in:bC,morphs:($)=>Number.parseFloat($),declaredOut:O$.number})},{name:"string.numeric"}),fC="a regex pattern",Vm=u$({domain:"string",predicate:{meta:fC,predicate:($,X)=>{try{return new RegExp($),!0}catch(Y){return X.reject({code:"predicate",expected:fC,problem:String(Y)})}}},meta:{format:"regex"}}),Om=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,wm=Z4(Om,"a semantic version (see https://semver.org/)"),hC=Z4(/^\S.*\S$|^\S?$/,"trimmed"),Dm=B$.module({root:u$({in:"string",morphs:($)=>$.trim(),declaredOut:hC}),preformatted:hC},{name:"string.trim"}),gC=Z4(/^[A-Z]*$/,"only uppercase letters"),Em=B$.module({root:u$({in:"string",morphs:($)=>$.toUpperCase(),declaredOut:gC}),preformatted:gC},{name:"string.upper"}),Nm=($)=>{if(URL.canParse)return URL.canParse($);try{return new URL($),!0}catch{return!1}},yC=u$({domain:"string",predicate:{meta:"a URL string",predicate:Nm},meta:{format:"uri"}}),Fm=B$.module({root:yC,parse:u$({declaredIn:yC,in:"string",morphs:($,X)=>{try{return new URL($)}catch{return X.error("a URL string")}},declaredOut:u$(URL)})},{name:"string.url"}),Mm=B$.module({root:["versioned | nil | max","@",{description:"a UUID",format:"uuid"}],"#nil":"'00000000-0000-0000-0000-000000000000'","#max":"'ffffffff-ffff-ffff-ffff-ffffffffffff'","#versioned":/[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}/i,v1:Z4(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:Z4(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:Z4(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:Z4(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:Z4(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:Z4(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:Z4(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:Z4(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),pC=B$.module({root:O$.string,alpha:Z4(/^[A-Za-z]*$/,"only letters"),alphanumeric:Z4(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:yy,base64:my,capitalize:uy,creditCard:dy,date:ny,digits:Z4(/^\d*$/,"only digits 0-9"),email:ty,integer:mC,ip:ey,json:Ym,lower:Gm,normalize:Zm,numeric:Hm,regex:Vm,semver:wm,trim:Dm,upper:Em,url:Fm,uuid:Mm},{name:"string"});var dC=B$.module({bigint:O$.bigint,boolean:O$.boolean,false:O$.false,never:O$.never,null:O$.null,number:O$.number,object:O$.object,string:O$.string,symbol:O$.symbol,true:O$.true,unknown:O$.unknown,undefined:O$.undefined}),lC=B$.module({root:O$.unknown,any:O$.unknown},{name:"unknown"}),Jm=B$.module({root:O$.jsonObject,stringify:S9("morph",{in:O$.jsonObject,morphs:($)=>JSON.stringify($),declaredOut:O$.string})},{name:"object.json"}),rC=B$.module({root:O$.object,json:Jm},{name:"object"});class iC extends O6{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}var Am=x1(["K",O$.key],"V")(($)=>({domain:"object",index:{signature:$.K,value:$.V}}),iC);class oC extends O6{description='pick a set of properties from an object like `Pick(User, "name | age")`'}var Lm=x1(["T",O$.object],["K",O$.key])(($)=>$.T.pick($.K),oC);class nC extends O6{description='omit a set of properties from an object like `Omit(User, "age")`'}var Km=x1(["T",O$.object],["K",O$.key])(($)=>$.T.omit($.K),nC);class tC extends O6{description="make all named properties of an object optional like `Partial(User)`"}var _m=x1(["T",O$.object])(($)=>$.T.partial(),tC);class aC extends O6{description="make all named properties of an object required like `Required(User)`"}var qm=x1(["T",O$.object])(($)=>$.T.required(),aC);class sC extends O6{description='exclude branches of a union like `Exclude("boolean", "true")`'}var Rm=x1("T","U")(($)=>$.T.exclude($.U),sC);class eC extends O6{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}var Tm=x1("T","U")(($)=>$.T.extract($.U),eC),$B=B$.module({Exclude:Rm,Extract:Tm,Omit:Km,Partial:_m,Pick:Lm,Record:Am,Required:qm});var o2=wN({...dC,...$B,...CC,...KC,string:pC,number:wW,object:rC,unknown:lC},{prereducedAliases:!0,name:"ark"}),c4=o2.export();Object.assign(f9.ambient,c4);f9.typeAttachments={string:c4.string.root,number:c4.number.root,bigint:c4.bigint,boolean:c4.boolean,symbol:c4.symbol,undefined:c4.undefined,null:c4.null,object:c4.object.root,unknown:c4.unknown.root,false:c4.false,true:c4.true,never:c4.never,arrayIndex:c4.Array.index,Key:c4.Key,Record:c4.Record,Array:c4.Array.root,Date:c4.Date};var n1=Object.assign(o2.type,f9.typeAttachments),vm=o2.match,Cm=o2.generic,RQ$=o2.schema,Bm=o2.define,jm=o2.declare;var Pm="__vite_start_time"in globalThis,Im=typeof window!=="undefined",cQ$="vitest"in globalThis,Z2=n1("string"),XB=n1('"true" | "false" | undefined'),H2=tD({isServer:!Pm&&!Im,server:{CI:n1("string | undefined").pipe(Boolean),POSTGRES_USER:Z2,POSTGRES_PASSWORD:Z2,POSTGRES_DATABASE:Z2,POSTGRES_HOST:Z2,POSTGRES_PORT:Z2.pipe(($)=>Number.parseInt($,10)),BACKEND_PORT:Z2.pipe(($)=>Number.parseInt($,10)),RUN_WORKERS_FROM_SOURCE:XB.pipe(($)=>$==="true"),FRONTEND_PORT:Z2.pipe(($)=>Number.parseInt($,10)),FRONTEND_ORIGINS:Z2.pipe.try(($)=>JSON.parse($),n1("string[]")),API_KEY_OPENAI:n1("string | undefined"),API_KEY_RESEND:n1("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:Z2,VITE_DEV_FRONTEND_HOST:n1("string | undefined"),VITE_DEV_HTTPS:XB.pipe(($)=>$==="true")},runtimeEnv:import.meta.env,emptyStringAsUndefined:!0});var NN={};D2(NN,{users:()=>a8,untrackedUserColumnNames:()=>xm,twoFactorMethod:()=>WB,trackedUserColumnName:()=>Sm,trackableUserColumnNames:()=>UB,signInHistory:()=>bm,role:()=>GB,players:()=>EN,passwordResetAttempts:()=>fm,games:()=>NW,banishedIps:()=>FW,accountActions:()=>km,accountAction:()=>zB});function n2(){return H6({length:24}).$type()}function YB($){return R`lower(${$})`}var EW=R`TO_CHAR(NOW() AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`,GB=T3("role",["admin","user"]),a8=h2("users",{id:C1().primaryKey().defaultRandom(),username:H6({length:16}).notNull(),emailOffered:H6({length:254}).notNull(),emailVerified:H6({length:254}),password:H6({length:254}),createdAtIso:n2().notNull().default(EW),createdIp:H6({length:45}).notNull(),isActive:I3().notNull().default(!1),verifiedAtIso:n2(),userRole:GB().default("user")},($)=>[fD("usernameUniqueIndex").on(YB($.username)),fD("emailVerifiedUniqueIndex").on(YB($.emailVerified))]),xm=["id","createdAtIso","createdIp","isActive","verifiedAtIso"],UB=["username","emailOffered","emailVerified","password","userRole"],Sm=T3("trackedUserColumnName",UB),zB=T3("accountAction",["cooldown","confirmEmail","signIn","resetPassword"]),km=h2("accountActions",{userId:C1().references(()=>a8.id).primaryKey(),action:zB().notNull(),code:H6({length:254}).notNull(),wrongCodeCount:x3().notNull().default(0),expiresAtIso:n2().notNull()}),NW=h2("games",{id:C1().primaryKey().defaultRandom()}),EN=h2("players",{userId:C1().notNull().references(()=>a8.id,{onDelete:"cascade"}),gameId:C1().notNull().references(()=>NW.id,{onDelete:"cascade"}),score:x3().notNull()},($)=>[rq({name:"players_userId_gameId_pk",columns:[$.userId,$.gameId]})]),bm=h2("signInHistory",{id:C1().primaryKey().defaultRandom(),userId:C1().references(()=>a8.id,{onDelete:"cascade"}),signInTimeIso:n2().notNull().default(EW),ipAddress:H6({length:45}).notNull(),userAgent:H6({length:1024}),successful:I3().notNull().default(!1)}),WB=T3("twoFactorMethod",["email","phone"]),fm=h2("passwordResetAttempts",{id:C1().primaryKey().defaultRandom(),userId:C1().notNull().references(()=>a8.id,{onDelete:"cascade"}),requestedIp:H6({length:45}).notNull(),requestedAtIso:n2().notNull().default(EW),succeededIp:H6({length:45}),succeededAtIso:n2(),verificationMethod:WB().notNull()}),FW=h2("banishedIps",{ip:H6({length:45}).primaryKey(),reason:H6({length:2048}).notNull(),banishedAtIso:n2().notNull().default(EW),banishedUntilIso:n2()});var __dirname="/home/runner/work/wayforge/wayforge/apps/tempest.games/src/database";class FN{options;sql;drizzle;observers=new Map;async setupTriggersAndNotifications(){await this.sql.file(hm.resolve(__dirname,"notify_update.sql"));let $=[i4(a8),i4(NW),i4(EN)];await this.sql`SELECT create_notify_triggers(${this.sql.array($)})`,await this.sql.listen("table_update",(X)=>{let Y=X.split(","),U=Y[0],G=Y[1],z=`${U}("${G}")`;if(this.observers.has(z))this.observers.get(z).next(z)})}constructor($=!1,X={host:H2.POSTGRES_HOST,port:H2.POSTGRES_PORT,user:H2.POSTGRES_USER,password:H2.POSTGRES_PASSWORD,database:H2.POSTGRES_DATABASE}){this.options=X,this.sql=F9(X),this.drizzle=gz(this.sql,{schema:NN,logger:$})}observe($,X){if(!this.observers.has($))this.observers.set($,new g$);this.observers.get($).subscribe("SINGLETON",X)}}import{resolve as mm}from"path";import{existsSync as MN,mkdirSync as QB,readFileSync as gm,readdirSync as ZB,rmSync as HB,statSync as VB,writeFileSync as ym}from"fs";import{resolve as JN}from"path";var OB=class{get initialized(){return MN(this.rootDir)}initialize(){if(!this.initialized)QB(this.rootDir,{recursive:!0})}constructor($){if(this.rootDir=$.path,$.eagerInit)this.initialize()}getItem($){let X=JN(this.rootDir,$);if(MN(X))return gm(X,"utf-8");return null}setItem($,X){this.initialize();let Y=JN(this.rootDir,$);ym(Y,X)}removeItem($){let X=JN(this.rootDir,$);if(MN(X))this.initialize(),HB(X)}key($){return ZB(this.rootDir).sort((U,G)=>{let z=VB(U);return VB(G).ctimeMs-z.ctimeMs})[$]??null}clear(){HB(this.rootDir,{recursive:!0}),QB(this.rootDir,{recursive:!0})}get length(){return ZB(this.rootDir).length}};var AN=new OB({path:mm(process.cwd(),"storage")});function wB($){return $.toString({smallestUnit:"millisecond"})}function ZZ$($){return Yz.Instant.from($)}import*as MW from"fs";import*as DB from"readline";function um($){let Y=$.replace(":","T").replace(" ","").replace(/(\d{2})\/(\w{3})\/(\d{4})T(.+)/,(U,G,z,W,Q)=>{let H={Jan:"01",Feb:"02",Mar:"03",Apr:"04",May:"05",Jun:"06",Jul:"07",Aug:"08",Sep:"09",Oct:"10",Nov:"11",Dec:"12"}[z];return`${W}-${H}-${G}T${Q}`});return new Date(Y)}async function EB($,X="/var/log/nginx/access.log",Y=new Date){let U=new Map;if(!MW.existsSync(X))return $.error(`Log file not found: ${X}`),U;let G=MW.createReadStream(X),z=DB.createInterface({input:G,crlfDelay:Number.POSITIVE_INFINITY}),W=new Date(Y.getTime()-3600000);return z.on("line",(Q)=>{let Z=/^(?<ip>\S+) \S+ \S+ \[(?<dateTime>.*?)\]/,H=Q.match(Z);if(H?.groups){let V=H.groups.ip,O=H.groups.dateTime,w=um(O);if(!Number.isNaN(w.getTime())){if(w>=W&&w<=Y){let D=U.get(V);if(!D)D=[],U.set(V,D);D.push(Q)}}else $.error(`Failed to parse date: ${O}`)}}),new Promise((Q,Z)=>{z.on("error",(H)=>{Z(H)}),z.on("close",()=>{Q(U)})})}function NB($){return $.toJsonSchema()}var cm=["Network security adjudicator, your job is to determine if an IP address should be banned.","The IP address in question created the following logs on our server today:","```nginx.log\n"].join(`
|
|
199
|
+
`)+"}");class XW{config;resolvedConfig;name;get[f6](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor($,X){if(this.config=z5(m.config,X),this.resolvedConfig=z5(m.resolvedConfig,X),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(dE).length}`,this.name in dE)f(`A Scope already named ${this.name} already exists`);dE[this.name]=this;let Y=Object.entries($).map((U)=>this.preparseOwnAliasEntry(...U));for(let[U,G]of Y){let z=U;if(U[0]==="#"){if(z=U.slice(1),z in this.aliases)f(vv(z));this.aliases[z]=G}else{if(z in this.aliases)f(vv(U));this.aliases[z]=G,this.exportedNames.push(z)}if(!U$(G,"module")&&!U$(G,"generic")&&!u2(G)){let W=this.preparseOwnDefinitionFormat(G,{alias:z});this.resolutions[z]=U$(W,"root")?this.bindReference(W):this.createParseContext(W).id}}Cv??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[Cv.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=m.intrinsic?M$(m.intrinsic,(U,G)=>U.startsWith("json")?[]:[U,this.bindReference(G)]):{}}cacheGetter($,X){return Object.defineProperty(this,$,{value:X}),X}get internal(){return this}_json;get json(){if(!this._json)this.export();return this._json}defineSchema($){return $}generic=(...$)=>{let X=this;return(Y,U)=>new r2($,U?new iz(Y):Y,X,X,U??null)};units=($,X)=>{let Y=[];for(let G of $)if(!Y.includes(G))Y.push(G);let U=Y.map((G)=>this.node("unit",{unit:G},X));return this.node("union",U,{...X,prereduced:!0})};lazyResolutions=[];lazilyResolve($,X){let Y=this.node("alias",{reference:X??"synthetic",resolve:$},{prereduced:!0});if(!this.resolved)this.lazyResolutions.push(Y);return Y}schema=($,X)=>this.finalize(this.parseSchema($,X));parseSchema=($,X)=>this.node(H5($),$,X);preparseNode($,X,Y){let U=typeof $==="string"?$:H5(X,$);if(X4(X)&&X.kind===U)return X;if(U==="alias"&&!Y?.prereduced){let{reference:W}=N5.implementation.normalize(X,this);if(W.startsWith("$")){let Q=this.resolveRoot(W.slice(1));X=Q,U=Q.kind}}else if(U==="union"&&a6(X,"object")){let W=yg(X);if(W?.length===1)X=W[0],U=H5(X)}if(X4(X)&&X.kind===U)return X;let z=j9[U].normalize?.(X,this)??X;if(X4(z))return z.kind===U?z:mg(U,z.kind);return{...Y,$:this,kind:U,def:z,prefix:Y.alias??U}}bindReference($){let X;if(X4($))X=$.$===this?$:new $.constructor($.attachments,this);else X=$.$===this?$:new r2($.params,$.bodyDef,$.$,this,$.hkt);if(!this.resolved)Object.assign(this.referencesById,X.referencesById);return X}resolveRoot($){return this.maybeResolveRoot($)??f(iE($))}maybeResolveRoot($){let X=this.maybeResolve($);if(U$(X,"generic"))return;return X}maybeResolveSubalias($){return lE(this.aliases,$)??lE(this.ambient,$)}get ambient(){return m.ambient}maybeResolve($){let X=this.resolutions[$];if(X){if(typeof X!=="string")return this.bindReference(X);let U=h6[X];if(U$(U,"root"))return this.resolutions[$]=U;if(U$(U,"context")){if(U.phase==="resolving")return this.node("alias",{reference:`$${$}`},{prereduced:!0});if(U.phase==="resolved")return S$(`Unexpected resolved context for was uncached by its scope: ${J$(U)}`);U.phase="resolving";let G=this.bindReference(this.parseOwnDefinitionFormat(U.def,U));return U.phase="resolved",h6[G.id]=G,h6[U.id]=G,this.resolutions[$]=G}return S$(`Unexpected nodesById entry for ${X}: ${J$(U)}`)}let Y=this.aliases[$]??this.ambient?.[$];if(!Y)return this.maybeResolveSubalias($);if(Y=this.normalizeRootScopeValue(Y),U$(Y,"generic"))return this.resolutions[$]=this.bindReference(Y);if(U$(Y,"module")){if(!Y.root)f(kv($));return this.resolutions[$]=this.bindReference(Y.root)}return this.resolutions[$]=this.parse(Y,{alias:$})}createParseContext($){let X=$.id??CE($.prefix);return h6[X]=Object.assign($,{[f6]:"context",$:this,id:X,phase:"unresolved"})}traversal($){return new o1($,this.resolvedConfig)}import(...$){return new x9(M$(this.export(...$),(X,Y)=>[`#${X}`,Y]))}precompilation;_exportedResolutions;_exports;export(...$){if(!this._exports){this._exports={};for(let Y of this.exportedNames){let U=this.aliases[Y];this._exports[Y]=U$(U,"module")?pE(U,this):Bv(this.maybeResolve(Y))}for(let Y of this.lazyResolutions)Y.resolution;if(this._exportedResolutions=Sv(this,this._exports),this._json=xv(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){let Y=Iv(this.references);this.precompilation=Y.write(jv,4),Pv(this.references,Y)}this.resolved=!0}let X=$.length?$:this.exportedNames;return new x9(M$(X,(Y,U)=>[U,this._exports[U]]))}resolve($){return this.export()[$]}node=($,X,Y={})=>{let U=this.preparseNode($,X,Y);if(X4(U))return this.bindReference(U);let G=this.createParseContext(U),z=BE(G),W=this.bindReference(z);return h6[G.id]=W};parse=($,X={})=>this.finalize(this.parseDefinition($,X));parseDefinition($,X={}){if(U$($,"root"))return this.bindReference($);let Y=this.preparseOwnDefinitionFormat($,X);if(U$(Y,"root"))return this.bindReference(Y);let U=this.createParseContext(Y);h6[U.id]=U;let G=this.bindReference(this.parseOwnDefinitionFormat($,U));if(G.isCyclic)G=$v(G,U.id);return h6[U.id]=G,G}finalize($){if(Bv($),!$.precompilation&&!this.resolvedConfig.jitless)ug($.references);return $}}class rE extends XW{parseOwnDefinitionFormat($,X){return BE(X)}preparseOwnDefinitionFormat($,X){return this.preparseNode(H5($),$,X)}preparseOwnAliasEntry($,X){return[$,X]}normalizeRootScopeValue($){return $}}var Bv=($)=>{let X=$.references.filter((Y)=>Y.hasKind("alias"));for(let Y of X){Object.assign(Y.referencesById,Y.resolution.referencesById);for(let U of $.references)if(Y.id in U.referencesById)Object.assign(U.referencesById,Y.referencesById)}return $},xv=($)=>M$($,(X,Y)=>[X,U$(Y,"root")||U$(Y,"generic")?Y.json:U$(Y,"module")?xv(Y):S$(`Unexpected resolution ${J$(Y)}`)]),lE=($,X)=>{let Y=X.indexOf(".");if(Y===-1)return;let U=X.slice(0,Y),G=$[U];if(G===void 0)return;if(!U$(G,"module"))return f(cg(U));let z=X.slice(Y+1),W=G[z];if(W===void 0)return lE(G,z);if(U$(W,"root")||U$(W,"generic"))return W;if(U$(W,"module"))return W.root??f(kv(X));S$(`Unexpected resolution for alias '${X}': ${J$(W)}`)},YW=($,X)=>new rE($,X),J5=new rE({});var Sv=($,X)=>{let Y={};for(let U in X){let G=X[U];if(U$(G,"module")){let z=Sv($,G),W=M$(z,(Q,Z)=>[`${U}.${Q}`,Z]);Object.assign(Y,W)}else if(U$(G,"root")||U$(G,"generic"))Y[U]=G;else S$(`Unexpected scope resolution ${J$(G)}`)}return Y},iE=($)=>`'${$}' is unresolvable`,cg=($)=>`'${$}' must reference a module to be accessed using dot syntax`,kv=($)=>`Reference to submodule '${$}' must specify an alias`;J5.export();var{schema:u$,node:S9,defineSchema:eU$,generic:S1}=J5;var oE="^(?:0|[1-9]\\d*)$",pg=new RegExp(oE),Y7$=F4(pg);var bv=YW({bigint:"bigint",boolean:[{unit:!1},{unit:!0}],false:{unit:!1},never:[],null:{unit:null},number:"number",object:"object",string:"string",symbol:"symbol",true:{unit:!0},unknown:{},undefined:{unit:void 0},Array,Date},{prereducedAliases:!0}).export();m.intrinsic={...bv};var fv=YW({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:oE}},{prereducedAliases:!0}).export();Object.assign(m.intrinsic,fv);var dg=YW({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),O$={...bv,...fv,...dg,emptyStructure:S9("structure",{},{prereduced:!0})};m.intrinsic={...O$};var gv=($)=>typeof $==="string"&&$[0]==="d"&&($[1]==="'"||$[1]==='"')&&$.at(-1)===$[1],hv=($)=>$.toString()!=="Invalid Date",yv=($)=>$.slice(2,-1),nE=($)=>`'${$}' could not be parsed by the Date constructor`,mv=($,X)=>lg($,X),lg=($,X)=>{let Y=new Date($);if(hv(Y))return Y;let U=JT($);if(U!==void 0){let G=new Date(U);if(hv(G))return G}return X?f(X===!0?nE($):X):void 0};var tE=($,X)=>{let Y=$.scanner.shiftUntil(rg[cv[X]]);if($.scanner.lookahead==="")return $.error(og(Y,X));if($.scanner.shift(),X==="/"){try{new RegExp(Y)}catch(U){f(String(U))}$.root=$.ctx.$.node("intersection",{domain:"string",pattern:Y},{prereduced:!0})}else if(u4(X,aE))$.root=$.ctx.$.node("unit",{unit:Y});else{let U=mv(Y,nE(Y));$.root=$.ctx.$.node("unit",{meta:Y,unit:U})}},aE={"'":1,'"':1},uv={"/":1,"'":1,'"':1},cv={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},rg={"'":($)=>$.lookahead==="'",'"':($)=>$.lookahead==='"',"/":($)=>$.lookahead==="/"},ig={'"':"double-quote","'":"single-quote","/":"forward slash"},og=($,X)=>`${X}${$} requires a closing ${ig[cv[X]]}`;var pv=($)=>`Private type references should not include '#'. Use '${$}' instead.`,GW="Optional definitions like 'string?' are only valid as properties in an object or tuple",UW="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple";var dv={">":!0,">=":!0},lv={"<":!0,"<=":!0};var k9={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},rv=($)=>`Unmatched )${$===""?"":` before ${$}`}`,zW=($)=>`Missing ${$}`,iv=($,X)=>`Left bounds are only valid when paired with right bounds (try ...${X}${$})`,WW=($)=>`Left-bounded expressions must specify their limits using < or <= (was ${$})`,ov=($,X,Y,U)=>`An expression may have at most one left bound (parsed ${$}${k9[X]}, ${Y}${k9[U]})`;var nv=($,X,Y)=>tv($,X,Y,[]),tv=($,X,Y,U)=>{let G=Y.parseUntilFinalizer();if(U.push(G.root),G.finalizer===">"){if(U.length!==X.params.length)return Y.error(sE($,X.names,U.map((z)=>z.expression)));return U}if(G.finalizer===",")return tv($,X,Y,U);return G.error(zW(">"))},sE=($,X,Y)=>`${$}<${X.join(", ")}> requires exactly ${X.length} args (got ${Y.length}${Y.length===0?"":`: ${Y.join(", ")}`})`;var eE=($)=>{let X=$.scanner.shiftUntilNextTerminator();if(X==="keyof")$.addPrefix("keyof");else $.root=tg($,X)},ng=($,X,Y)=>{if(Y.scanner.shiftUntilNonWhitespace(),Y.scanner.shift()!=="<")return Y.error(sE($,X.names,[]));let G=nv($,X,Y);return X(...G)},tg=($,X)=>ag($,X)??sg($,X)??$.error(X===""?$.scanner.lookahead==="#"?pv($.shiftedByOne().scanner.shiftUntilNextTerminator()):$N($):iE(X)),ag=($,X)=>{if($.ctx.args?.[X]){let U=$.ctx.args[X];if(typeof U!=="string")return U;return $.ctx.$.node("alias",{reference:U},{prereduced:!0})}let Y=$.ctx.$.maybeResolve(X);if(U$(Y,"root"))return Y;if(Y===void 0)return;if(U$(Y,"generic"))return ng(X,Y,$);return f(`Unexpected resolution ${J$(Y)}`)},sg=($,X)=>{let Y=AT(X);if(Y!==void 0)return $.ctx.$.node("unit",{unit:Y});let U=KT(X);if(U!==void 0)return $.ctx.$.node("unit",{unit:U})},$N=($)=>{let X=$.previousOperator();return X?XN(X,$.scanner.unscanned):eg($.scanner.unscanned)},XN=($,X="")=>`Token '${$}' requires a right operand${X?` before '${X}'`:""}`,eg=($)=>`Expected an expression${$?` before '${$}'`:""}`;var YN=($)=>$.scanner.lookahead===""?$.error($N($)):$.scanner.lookahead==="("?$.shiftedByOne().reduceGroupOpen():$.scanner.lookaheadIsIn(uv)?tE($,$.scanner.shift()):$.scanner.lookaheadIsIn(c2)?YN($.shiftedByOne()):$.scanner.lookahead==="d"?$.scanner.nextLookahead in aE?tE($,`${$.scanner.shift()}${$.scanner.shift()}`):eE($):eE($);class Q2 extends QE{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>(this.lookahead in Q2.terminatingChars))}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...c2};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=($,X)=>$===">"?X[0]==="="?X[1]==="=":X.trimStart()===""||u4(X.trimStart()[0],Q2.terminatingChars):$==="="?X[0]!=="=":$===","||$==="?"}var sv=($,X)=>{let Y=$y($,X);if($.root.hasKind("unit")){if(typeof $.root.unit==="number"){$.reduceLeftBound($.root.unit,Y),$.unsetRoot();return}if($.root.unit instanceof Date){let U=`d'${$.root.description??$.root.unit.toISOString()}'`;$.unsetRoot(),$.reduceLeftBound(U,Y);return}}return Yy($,Y)},ev={"<":1,">":1,"=":1},$y=($,X)=>$.scanner.lookaheadIs("=")?`${X}${$.scanner.shift()}`:X;var av=($,X,Y,U)=>{if(Y.extends(m.intrinsic.number)){if(typeof X!=="number")return f(GN($,X,U));return $==="=="?["min","max"]:$[0]===">"?["min"]:["max"]}if(Y.extends(m.intrinsic.lengthBoundable)){if(typeof X!=="number")return f(GN($,X,U));return $==="=="?["exactLength"]:$[0]===">"?["minLength"]:["maxLength"]}if(Y.extends(m.intrinsic.Date))return $==="=="?["after","before"]:$[0]===">"?["after"]:["before"];return f(uT(Y.expression))},Xy=($)=>({rule:gv($.limit)?yv($.limit):$.limit,exclusive:$.comparator.length===1}),Yy=($,X)=>{let Y=$.unsetRoot(),U=$.scanner.location;$.parseOperand();let G=$.unsetRoot(),z=$.scanner.sliceChars(U,$.scanner.location);if($.root=Y,!G.hasKind("unit")||typeof G.unit!=="number"&&!(G.unit instanceof Date))return $.error(GN(X,z,"right"));let W=G.unit,Q=X.length===1,Z=av(X,typeof W==="number"?W:z,Y,"right");for(let V of Z)$.constrainRoot(V,X==="=="?{rule:W}:{rule:W,exclusive:Q});if(!$.branches.leftBound)return;if(!u4(X,lv))return $.error(WW(X));let H=av($.branches.leftBound.comparator,$.branches.leftBound.limit,Y,"left");$.constrainRoot(H[0],Xy($.branches.leftBound)),$.branches.leftBound=null},GN=($,X,Y)=>`Comparator ${Y==="left"?k9[$]:$} must be ${Y==="left"?"preceded":"followed"} by a corresponding literal (was ${X})`;var $C=($)=>{$.scanner.shiftUntilNonWhitespace();let X=$.scanner.shiftUntilNextTerminator();$.root=$.root.brand(X)};var YC=($)=>{let X=$.scanner.shiftUntilNextTerminator(),Y=LT(X,{errorOnFail:XC(X)});if(Y===0)$.error(XC(0));$.root=$.root.constrain("divisor",Y)},XC=($)=>`% operator must be followed by a non-zero integer literal (was ${$})`;var UN=($)=>{let X=$.scanner.shift();return X===""?$.finalize(""):X==="["?$.scanner.shift()==="]"?$.setRoot($.root.array()):$.error(Gy):X==="|"?$.scanner.lookahead===">"?$.shiftedByOne().pushRootToBranch("|>"):$.pushRootToBranch(X):X==="&"?$.pushRootToBranch(X):X===")"?$.finalizeGroup():Q2.lookaheadIsFinalizing(X,$.scanner.unscanned)?$.finalize(X):u4(X,ev)?sv($,X):X==="%"?YC($):X==="#"?$C($):(X in c2)?UN($):$.error(QW(X))},QW=($,X="")=>`'${$}' is not allowed here${X&&` (should be ${X})`}`,Gy="Missing expected ']'";var GC=($)=>{let X=$.unsetRoot();$.parseOperand();let Y=$.unsetRoot();if(!Y.hasKind("unit"))return $.error(Uy(Y.expression));let U=Y.unit instanceof Date?()=>new Date(Y.unit):Y.unit;return[X,"=",U]},Uy=($)=>`Default value '${$}' must a literal value`;var zN=($,X)=>{let Y=X.$.maybeResolveRoot($);if(Y)return Y;if($.endsWith("[]")){let z=X.$.maybeResolveRoot($.slice(0,-2));if(z)return z.array()}let U=new b9(new Q2($),X),G=zy(U);if(U.finalizer===">")f(QW(">"));return G},zy=($)=>{$.parseOperand();let X=A5($).root;if(!X)return S$(`Root was unexpectedly unset after parsing string '${$.scanner.scanned}'`);if($.finalizer==="=")X=GC($);else if($.finalizer==="?")X=[X,"?"];if($.scanner.shiftUntilNonWhitespace(),$.scanner.lookahead)f(QW($.scanner.lookahead));return X},A5=($)=>{while($.finalizer===void 0)Wy($);return $},Wy=($)=>$.hasRoot()?$.parseOperator():$.parseOperand();class b9{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor($,X){this.scanner=$,this.ctx=X}error($){return f($)}hasRoot(){return this.root!==void 0}setRoot($){this.root=$}unsetRoot(){let $=this.root;return this.root=void 0,$}constrainRoot(...$){this.root=this.root.constrain($[0],$[1])}finalize($){if(this.groups.length)return this.error(zW(")"));this.finalizeBranches(),this.finalizer=$}reduceLeftBound($,X){let Y=k9[X];if(!u4(Y,dv))return this.error(WW(X));if(this.branches.leftBound)return this.error(ov(this.branches.leftBound.limit,this.branches.leftBound.comparator,$,Y));this.branches.leftBound={comparator:Y,limit:$}}finalizeBranches(){if(this.assertRangeUnset(),this.branches.pipe){this.pushRootToBranch("|>"),this.root=this.branches.pipe;return}if(this.branches.union){this.pushRootToBranch("|"),this.root=this.branches.union;return}if(this.branches.intersection){this.pushRootToBranch("&"),this.root=this.branches.intersection;return}this.applyPrefixes()}finalizeGroup(){this.finalizeBranches();let $=this.groups.pop();if(!$)return this.error(rv(this.scanner.unscanned));this.branches=$}addPrefix($){this.branches.prefixes.push($)}applyPrefixes(){while(this.branches.prefixes.length){let $=this.branches.prefixes.pop();this.root=$==="keyof"?this.root.keyof():S$(`Unexpected prefix '${$}'`)}}pushRootToBranch($){this.assertRangeUnset(),this.applyPrefixes();let X=this.root;if(this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(X)??X,$==="&")return;if(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,$==="|")return;this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null}parseUntilFinalizer(){return A5(new b9(this.scanner,this.ctx))}parseOperator(){return UN(this)}parseOperand(){return YN(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(iv(this.branches.leftBound.limit,this.branches.leftBound.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={prefixes:[],leftBound:null,union:null,intersection:null,pipe:null}}previousOperator(){return this.branches.leftBound?.comparator??this.branches.prefixes.at(-1)??(this.branches.intersection?"&":this.branches.union?"|":this.branches.pipe?"|>":void 0)}shiftedByOne(){return this.scanner.shift(),this}}var Qy="An empty string is not a valid generic parameter name",ZW=($,X,Y)=>{$.shiftUntilNonWhitespace();let U=$.shiftUntilNextTerminator();if(U===""){if($.lookahead===""&&X.length)return X;return f(Qy)}return $.shiftUntilNonWhitespace(),Zy($,U,X,Y)},UC="extends ",Zy=($,X,Y,U)=>{if($.shiftUntilNonWhitespace(),$.unscanned.startsWith(UC))$.jumpForward(UC.length);else{if($.lookahead===",")$.shift();return Y.push(X),ZW($,Y,U)}let G=A5(new b9($,U));return Y.push([X,G.root]),ZW($,Y,U)};class WN extends i1{$;constructor($){super((...X)=>new L5($)(...X),{bind:$});this.$=$}in($){return new L5(this.$,$===void 0?void 0:this.$.parse($))}at($,X){return new L5(this.$).at($,X)}case($,X){return new L5(this.$).case($,X)}}class L5 extends i1{$;in;key;branches=[];constructor($,X){super((Y)=>this.caseEntries(Object.entries(Y).map(([U,G])=>U==="default"?[U,G]:[this.$.parse(U),G])));this.$=$,this.in=X}at($,X){if(this.key)f(Vy);if(this.branches.length)f(Hy);return this.key=$,X?this.match(X):this}case($,X){return this.caseEntry(this.$.parse($),X)}caseEntry($,X){let U=(this.key?this.$.parse({[this.key]:$}):$).pipe(X);return this.branches.push(U),this}match($){return this($)}strings($){return this.caseEntries(Object.entries($).map(([X,Y])=>X==="default"?[X,Y]:[this.$.node("unit",{unit:X}),Y]))}caseEntries($){for(let X=0;X<$.length;X++){let[Y,U]=$[X];if(Y==="default"){if(X!==$.length-1)f("default may only be specified as the last key of a switch definition");return this.default(U)}if(typeof U!=="function")return f(`Value for case "${Y}" must be a function (was ${m4(U)})`);this.caseEntry(Y,U)}return this}default($){if(typeof $==="function")this.case(O$.unknown,$);let X={branches:this.branches,ordered:!0};if($==="never"||$==="assert")X.meta={onFail:zC};let Y=this.$.node("union",X);if(!this.in)return this.$.finalize(Y);let U=this.in.pipe(Y);if($==="never"||$==="assert")U=U.configureReferences({onFail:zC},"self");return this.$.finalize(U)}}var zC=($)=>$.throw(),Hy="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",Vy="At most one key matcher may be specified per expression";var HW=($,X)=>{if(o$($)){if($[1]==="=")return[X.$.parseOwnDefinitionFormat($[0],X),"=",$[2]];if($[1]==="?")return[X.$.parseOwnDefinitionFormat($[0],X),"?"]}return VW($,X)},WC="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",QC="Only required keys may specify default values, e.g. { value: 'number = 0' }";var ZC=($,X)=>{let Y,U={},G=r8($);for(let[W,Q]of G){let Z=Dy(W);if(Z.kind==="spread"){if(!M0(U))return f(wy);let D=X.$.parseOwnDefinitionFormat(Q,X);if(D.equals(O$.object))continue;if(!D.hasKind("intersection")||!D.basis?.equals(O$.object))return f(Ey(D.expression));Y=D.structure;continue}if(Z.kind==="undeclared"){if(Q!=="reject"&&Q!=="delete"&&Q!=="ignore")f(Oy(Q));U.undeclared=Q;continue}let H=HW(Q,X),V=Z;if(Z.kind==="required"){if(!o$(H))QN(U,"required",{key:Z.normalized,value:H},X);else QN(U,"optional",H[1]==="="?{key:Z.normalized,value:H[0],default:H[2]}:{key:Z.normalized,value:H[0]},X);continue}if(o$(H)){if(H[1]==="?")f(WC);if(H[1]==="=")f(QC)}if(Z.kind==="optional"){QN(U,"optional",{key:Z.normalized,value:H},X);continue}let O=X.$.parseOwnDefinitionFormat(V.normalized,X),w=$W(O,H,X.$);if(w.index)U.index=P$(U.index,w.index);if(w.required)U.required=P$(U.required,w.required)}let z=X.$.node("structure",U);return X.$.parseSchema({domain:"object",structure:Y?.merge(z)??z})},QN=($,X,Y,U)=>{$[X]=P$($[X],U.$.node(X,Y))},Oy=($)=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${J$($)})`,wy="Spread operator may only be used as the first key in an object",Dy=($)=>typeof $==="symbol"?{kind:"required",normalized:$}:$.at(-1)==="?"?$.at(-2)===s3?{kind:"required",normalized:`${$.slice(0,-2)}?`}:{kind:"optional",normalized:$.slice(0,-1)}:$[0]==="["&&$.at(-1)==="]"?{kind:"index",normalized:$.slice(1,-1)}:$[0]===s3&&$[1]==="["&&$.at(-1)==="]"?{kind:"required",normalized:$.slice(1)}:$==="..."?{kind:"spread"}:$==="+"?{kind:"undeclared"}:{kind:"required",normalized:$==="\\..."?"...":$==="\\+"?"+":$},Ey=($)=>`Spread operand must resolve to an object literal type (was ${$})`;var VC=($,X)=>Ry($)?EC[$[0]]($,X):_y($)?DC[$[1]]($,X):null,Ny=($,X)=>X.$.parseOwnDefinitionFormat($[1],X).keyof(),ZN=($,X)=>{if($[2]===void 0)return f(XN($[1],""));let Y=X.$.parseOwnDefinitionFormat($[0],X),U=X.$.parseOwnDefinitionFormat($[2],X);if($[1]==="|")return X.$.node("union",{branches:[Y,U]});let G=$[1]==="&"?X1(Y,U,X.$):Z5(Y,U,X.$);if(G instanceof a)return G.throw();return G},Fy=($,X)=>X.$.parseOwnDefinitionFormat($[0],X).array(),My=($,X)=>{if(typeof $[2]!=="function")return f(OC("=>",$[2]));return X.$.parseOwnDefinitionFormat($[0],X).pipe($[2])},OC=($,X)=>`${$===":"?"Narrow":"Morph"} expression requires a function following '${$}' (was ${typeof X})`,Jy=($,X)=>{if(typeof $[2]!=="function")return f(OC(":",$[2]));return X.$.parseOwnDefinitionFormat($[0],X).constrain("predicate",$[2])},Ay=($,X)=>X.$.parseOwnDefinitionFormat($[0],X).configureReferences($[2],"shallow"),wC=($)=>$,Ly=wC({"[]":Fy,"?":()=>f(GW)}),Ky=wC({"|":ZN,"&":ZN,":":Jy,"=>":My,"|>":ZN,"@":Ay,"=":()=>f(UW)}),DC={...Ly,...Ky},_y=($)=>DC[$[1]]!==void 0,qy=($)=>$,EC=qy({keyof:Ny,instanceof:($,X)=>{if(typeof $[1]!=="function")return f(HC(t3($[1])));let Y=$.slice(1).map((U)=>typeof U==="function"?X.$.node("proto",{proto:U}):f(HC(t3(U))));return Y.length===1?Y[0]:X.$.node("union",{branches:Y})},"===":($,X)=>X.$.units($.slice(1))}),Ry=($)=>EC[$[0]]!==void 0,HC=($)=>`Expected a constructor following 'instanceof' operator (was ${$})`;var MC=($,X)=>{let Y=[{}],U=0;while(U<$.length){let G=!1;if($[U]==="..."&&U<$.length-1)G=!0,U++;let z=HW($[U],X),[W,Q,Z]=!o$(z)?[z]:z;if(U++,G){if(!W.extends(m.intrinsic.Array))return f(Cy(W.expression));Y=Y.flatMap((H)=>W.distribute((V)=>vy(pz(H),V)))}else Y=Y.map((H)=>{if(Q==="?")return JC(H,W);if(Q==="=")return Ty(H,W,Z);return HN(H,W)})}return X.$.parseSchema(Y.map((G)=>M0(G)?{proto:Array,exactLength:0}:{proto:Array,sequence:G}))},HN=($,X)=>{if($.defaultables||$.optionals)return f($.variadic?mE:By);if($.variadic)$.postfix=P$($.postfix,X);else $.prefix=P$($.prefix,X);return $},JC=($,X)=>{if($.variadic)return f(AC);return $.optionals=P$($.optionals,X),$},Ty=($,X,Y)=>{if($.variadic)return f(AC);if($.optionals)return f(jy);return $.defaultables=P$($.defaultables,[[X,Y]]),$},NC=($,X)=>{if($.postfix)f(FC);if($.variadic){if(!$.variadic.equals(X))f(FC)}else $.variadic=X.internal;return $},vy=($,X)=>{let Y=X.select({method:"find",kind:"sequence"});if(!Y)return NC($,m.intrinsic.unknown);if(Y.prefix)for(let U of Y.prefix)HN($,U);if(Y.optionals)for(let U of Y.optionals)JC($,U);if(Y.variadic)NC($,Y.variadic);if(Y.postfix)for(let U of Y.postfix)HN($,U);return $},Cy=($)=>`Spread element must be an array (was ${$})`,FC="A tuple may have at most one variadic element",By="A required element may not follow an optional element",AC="An optional element may not follow a variadic element";var jy="A defaultable element may not follow an optional element without a default";var Py={},VW=($,X)=>{if(typeof $==="string"){if(X.args&&Object.keys(X.args).some((U)=>$.includes(U)))return zN($,X);let Y=Py[X.$.name]??={};return Y[$]??=zN($,X)}return a6($,"object")?Iy($,X):f(VN(m4($)))},Iy=($,X)=>{let Y=n3($);switch(Y){case void 0:if(U$($,"root"))return $;return ZC($,X);case"Array":return xy($,X);case"RegExp":return X.$.node("intersection",{domain:"string",pattern:$},{prereduced:!0});case"Function":{let U=u2($)?$():$;if(U$(U,"root"))return U;return f(VN("Function"))}default:return f(VN(Y??J$($)))}},xy=($,X)=>VC($,X)??MC($,X),VN=($)=>`Type definitions must be strings or objects (was ${$})`;class ON extends i1{constructor($){let X=Object.assign({errors:e6,hkt:O6,$,raw:$.parse,module:$.constructor.module,scope:$.constructor.scope,define:$.define,match:$.match,generic:$.generic,schema:$.schema,keywords:$.ambient,unit:$.unit,enumerated:$.enumerated,instanceOf:$.instanceOf,valueOf:$.valueOf,or:$.or,and:$.and,merge:$.merge,pipe:$.pipe},$.ambientAttachments);super((...Y)=>{if(Y.length===1)return $.parse(Y[0]);if(Y.length===2&&typeof Y[0]==="string"&&Y[0][0]==="<"&&Y[0].at(-1)===">"){let U=Y[0].slice(1,-1),G=$.parseGenericParams(U,{});return new r2(G,Y[1],$,$,null)}return $.parse(Y)},{bind:$,attach:X})}}var f9=m;class OW extends XW{get ambientAttachments(){if(!f9.typeAttachments)return;return this.cacheGetter("ambientAttachments",M$(f9.typeAttachments,($,X)=>[$,this.bindReference(X)]))}preparseOwnAliasEntry($,X){let Y=$.indexOf("<");if(Y===-1){if(U$(X,"module")||U$(X,"generic"))return[$,X];let z=this.name==="ark"?$:$==="root"?this.name:`${this.name}.${$}`,W=this.resolvedConfig.keywords?.[z];if(W)X=[X,"@",W];return[$,X]}if($.at(-1)!==">")f("'>' must be the last character of a generic declaration in a scope");let U=$.slice(0,Y),G=$.slice(Y+1,-1);return[U,()=>{let z=this.parseGenericParams(G,{alias:U});return gT(z,X,this)}]}parseGenericParams($,X){return ZW(new Q2($),[],this.createParseContext({...X,def:$,prefix:"generic"}))}normalizeRootScopeValue($){if(u2($)&&!U$($,"generic"))return $();return $}preparseOwnDefinitionFormat($,X){return{...X,def:$,prefix:X.alias??"type"}}parseOwnDefinitionFormat($,X){if(!(X.alias&&(X.alias in this.aliases))&&!X.args)X.args={this:X.id};let U=VW($,X);if(o$(U)){if(U[1]==="=")return f(UW);if(U[1]==="?")return f(GW)}return U}unit=($)=>this.units([$]);valueOf=($)=>this.units(UT($));enumerated=(...$)=>this.units($);instanceOf=($)=>this.node("proto",{proto:$},{prereduced:!0});or=(...$)=>this.schema($.map((X)=>this.parse(X)));and=(...$)=>$.reduce((X,Y)=>X.and(this.parse(Y)),this.intrinsic.unknown);merge=(...$)=>$.reduce((X,Y)=>X.merge(this.parse(Y)),this.intrinsic.object);pipe=(...$)=>this.intrinsic.unknown.pipe(...$);match=new WN(this);declare=()=>({type:this.type});define($){return $}type=new ON(this);static scope=($,X={})=>new OW($,X);static module=($,X={})=>this.scope($,X).export()}var wN=Object.assign(OW.scope,{define:($)=>$}),B$=OW;class LC extends O6{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}var Sy=S1(["base",O$.object],["props",O$.object])(($)=>$.base.merge($.props),LC),KC=B$.module({Key:O$.key,Merge:Sy});class _C extends O6{}var ky=S1("element")(($)=>{let X=$.element.exclude(O$.Array),Y=X.array();return X.rawOr(Y).pipe(m2).distribute((U)=>U.assertHasKind("morph").declareOut(Y),u$)},_C),qC=B$.module({root:O$.Array,readonly:"root",index:O$.nonNegativeIntegerString,liftFrom:ky},{name:"Array"});var DN=u$(["string",o8.FileConstructor]),by=DN.rawOr(DN.array()),RC=u$({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:by}}),TC=B$.module({root:["instanceof",FormData],value:DN,parsed:RC,parse:u$({in:FormData,morphs:($)=>{let X={};for(let[Y,U]of $)if(Y in X){let G=X[Y];if(typeof G==="string"||G instanceof o8.FileConstructor)X[Y]=[G,U];else G.push(U)}else X[Y]=U;return X},declaredOut:RC})},{name:"FormData"});var vC=B$.module({Int8:["instanceof",Int8Array],Uint8:["instanceof",Uint8Array],Uint8Clamped:["instanceof",Uint8ClampedArray],Int16:["instanceof",Int16Array],Uint16:["instanceof",Uint16Array],Int32:["instanceof",Int32Array],Uint32:["instanceof",Uint32Array],Float32:["instanceof",Float32Array],Float64:["instanceof",Float64Array],BigInt64:["instanceof",BigInt64Array],BigUint64:["instanceof",BigUint64Array]},{name:"TypedArray"});var fy={Boolean:1,Number:1,String:1},CC=B$.module({...M$({...eD,...XE},($,X)=>($ in fy)?[]:[$,["instanceof",X]]),Array:qC,TypedArray:vC,FormData:TC});var hy=u$({domain:{domain:"number",meta:"a number representing a Unix timestamp"},divisor:{rule:1,meta:"an integer representing a Unix timestamp"},min:{rule:-8640000000000000,meta:"a Unix timestamp after -8640000000000000"},max:{rule:8640000000000000,meta:"a Unix timestamp before 8640000000000000"},meta:"an integer representing a safe Unix timestamp"}),gy=u$({domain:"number",divisor:1}),wW=B$.module({root:O$.number,integer:gy,epoch:hy,safe:u$({domain:{domain:"number",numberAllowsNaN:!1},min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}),NaN:["===",Number.NaN],Infinity:["===",Number.POSITIVE_INFINITY],NegativeInfinity:["===",Number.NEGATIVE_INFINITY]},{name:"number"});var Z4=($,X,Y)=>{let U={domain:"string",pattern:{rule:$.source,flags:$.flags,meta:X}};if(Y)U.meta={format:Y};return S9("intersection",U)},BC=Z4(e3,"a well-formed integer string"),mC=B$.module({root:BC,parse:u$({in:BC,morphs:($,X)=>{let Y=Number.parseInt($);return Number.isSafeInteger(Y)?Y:X.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:O$.integer})},{name:"string.integer"}),yy=Z4(/^[\dA-Fa-f]+$/,"hex characters only"),my=B$.module({root:Z4(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:Z4(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),jC=Z4(/^[A-Z].*$/,"capitalized"),uy=B$.module({root:u$({in:"string",morphs:($)=>$.charAt(0).toUpperCase()+$.slice(1),declaredOut:jC}),preformatted:jC},{name:"string.capitalize"}),cy=($)=>{let X=$.replaceAll(/[ -]+/g,""),Y=0,U,G,z=!1;for(let W=X.length-1;W>=0;W--){if(U=X.substring(W,W+1),G=Number.parseInt(U,10),z)G*=2,Y+=G>=10?G%10+1:G;else Y+=G;z=!z}return!!(Y%10===0?X:!1)},py=/^(?:4\d{12}(?:\d{3,6})?|5[1-5]\d{14}|(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}|6(?:011|5\d\d)\d{12,15}|3[47]\d{13}|3(?:0[0-5]|[68]\d)\d{11}|(?:2131|1800|35\d{3})\d{11}|6[27]\d{14}|^(81\d{14,17}))$/,dy=u$({domain:"string",pattern:{meta:"a credit card number",rule:py.source},predicate:{meta:"a credit card number",predicate:cy}});var ly=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;var ry=($)=>!Number.isNaN(new Date($).valueOf()),PC=u$({domain:"string",predicate:{meta:"a parsable date",predicate:ry}}).assertHasKind("intersection"),IC=mC.root.internal.narrow(($,X)=>{let Y=Number.parseInt($),U=wW.epoch(Y);if(U instanceof e6)return X.errors.merge(U),!1;return!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),iy=B$.module({root:IC,parse:u$({in:IC,morphs:($)=>new Date($),declaredOut:O$.Date})},{name:"string.date.epoch"}),xC=Z4(ly,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),oy=B$.module({root:xC,parse:u$({in:xC,morphs:($)=>new Date($),declaredOut:O$.Date})},{name:"string.date.iso"}),ny=B$.module({root:PC,parse:u$({declaredIn:PC,in:"string",morphs:($,X)=>{let Y=new Date($);if(Number.isNaN(Y.valueOf()))return X.error("a parsable date");return Y},declaredOut:O$.Date}),iso:oy,epoch:iy},{name:"string.date"}),ty=Z4(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),SC="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",i2=`(${SC}[.]){3}${SC}`,ay=new RegExp(`^${i2}$`),j4="(?:[0-9a-fA-F]{1,4})",sy=new RegExp(`^((?:${j4}:){7}(?:${j4}|:)|(?:${j4}:){6}(?:${i2}|:${j4}|:)|(?:${j4}:){5}(?::${i2}|(:${j4}){1,2}|:)|(?:${j4}:){4}(?:(:${j4}){0,1}:${i2}|(:${j4}){1,3}|:)|(?:${j4}:){3}(?:(:${j4}){0,2}:${i2}|(:${j4}){1,4}|:)|(?:${j4}:){2}(?:(:${j4}){0,3}:${i2}|(:${j4}){1,5}|:)|(?:${j4}:){1}(?:(:${j4}){0,4}:${i2}|(:${j4}){1,6}|:)|(?::((?::${j4}){0,5}:${i2}|(?::${j4}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),ey=B$.module({root:["v4 | v6","@","an IP address"],v4:Z4(ay,"an IPv4 address","ipv4"),v6:Z4(sy,"an IPv6 address","ipv6")},{name:"string.ip"}),h9="a JSON string",uC=($)=>{if(!($ instanceof SyntaxError))throw $;return`must be ${h9} (${$})`},$m=u$({meta:h9,domain:"string",predicate:{meta:h9,predicate:($,X)=>{try{return JSON.parse($),!0}catch(Y){return X.reject({code:"predicate",expected:h9,problem:uC(Y)})}}}}),Xm=($,X)=>{if($.length===0)return X.error({code:"predicate",expected:h9,actual:"empty"});try{return JSON.parse($)}catch(Y){return X.error({code:"predicate",expected:h9,problem:uC(Y)})}},Ym=B$.module({root:$m,parse:u$({meta:"safe JSON string parser",in:"string",morphs:Xm,declaredOut:O$.jsonObject})},{name:"string.json"}),kC=Z4(/^[a-z]*$/,"only lowercase letters"),Gm=B$.module({root:u$({in:"string",morphs:($)=>$.toLowerCase(),declaredOut:kC}),preformatted:kC},{name:"string.lower"}),cC=["NFC","NFD","NFKC","NFKD"],K5=M$(cC,($,X)=>[X,u$({domain:"string",predicate:(Y)=>Y.normalize(X)===Y,meta:`${X}-normalized unicode`})]),DW=M$(cC,($,X)=>[X,u$({in:"string",morphs:(Y)=>Y.normalize(X),declaredOut:K5[X]})]),Um=B$.module({root:DW.NFC,preformatted:K5.NFC},{name:"string.normalize.NFC"}),zm=B$.module({root:DW.NFD,preformatted:K5.NFD},{name:"string.normalize.NFD"}),Wm=B$.module({root:DW.NFKC,preformatted:K5.NFKC},{name:"string.normalize.NFKC"}),Qm=B$.module({root:DW.NFKD,preformatted:K5.NFKD},{name:"string.normalize.NFKD"}),Zm=B$.module({root:"NFC",NFC:Um,NFD:zm,NFKC:Wm,NFKD:Qm},{name:"string.normalize"}),bC=Z4(mz,"a well-formed numeric string"),Hm=B$.module({root:bC,parse:u$({in:bC,morphs:($)=>Number.parseFloat($),declaredOut:O$.number})},{name:"string.numeric"}),fC="a regex pattern",Vm=u$({domain:"string",predicate:{meta:fC,predicate:($,X)=>{try{return new RegExp($),!0}catch(Y){return X.reject({code:"predicate",expected:fC,problem:String(Y)})}}},meta:{format:"regex"}}),Om=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,wm=Z4(Om,"a semantic version (see https://semver.org/)"),hC=Z4(/^\S.*\S$|^\S?$/,"trimmed"),Dm=B$.module({root:u$({in:"string",morphs:($)=>$.trim(),declaredOut:hC}),preformatted:hC},{name:"string.trim"}),gC=Z4(/^[A-Z]*$/,"only uppercase letters"),Em=B$.module({root:u$({in:"string",morphs:($)=>$.toUpperCase(),declaredOut:gC}),preformatted:gC},{name:"string.upper"}),Nm=($)=>{if(URL.canParse)return URL.canParse($);try{return new URL($),!0}catch{return!1}},yC=u$({domain:"string",predicate:{meta:"a URL string",predicate:Nm},meta:{format:"uri"}}),Fm=B$.module({root:yC,parse:u$({declaredIn:yC,in:"string",morphs:($,X)=>{try{return new URL($)}catch{return X.error("a URL string")}},declaredOut:u$(URL)})},{name:"string.url"}),Mm=B$.module({root:["versioned | nil | max","@",{description:"a UUID",format:"uuid"}],"#nil":"'00000000-0000-0000-0000-000000000000'","#max":"'ffffffff-ffff-ffff-ffff-ffffffffffff'","#versioned":/[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}/i,v1:Z4(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:Z4(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:Z4(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:Z4(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:Z4(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:Z4(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:Z4(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:Z4(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),pC=B$.module({root:O$.string,alpha:Z4(/^[A-Za-z]*$/,"only letters"),alphanumeric:Z4(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:yy,base64:my,capitalize:uy,creditCard:dy,date:ny,digits:Z4(/^\d*$/,"only digits 0-9"),email:ty,integer:mC,ip:ey,json:Ym,lower:Gm,normalize:Zm,numeric:Hm,regex:Vm,semver:wm,trim:Dm,upper:Em,url:Fm,uuid:Mm},{name:"string"});var dC=B$.module({bigint:O$.bigint,boolean:O$.boolean,false:O$.false,never:O$.never,null:O$.null,number:O$.number,object:O$.object,string:O$.string,symbol:O$.symbol,true:O$.true,unknown:O$.unknown,undefined:O$.undefined}),lC=B$.module({root:O$.unknown,any:O$.unknown},{name:"unknown"}),Jm=B$.module({root:O$.jsonObject,stringify:S9("morph",{in:O$.jsonObject,morphs:($)=>JSON.stringify($),declaredOut:O$.string})},{name:"object.json"}),rC=B$.module({root:O$.object,json:Jm},{name:"object"});class iC extends O6{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}var Am=S1(["K",O$.key],"V")(($)=>({domain:"object",index:{signature:$.K,value:$.V}}),iC);class oC extends O6{description='pick a set of properties from an object like `Pick(User, "name | age")`'}var Lm=S1(["T",O$.object],["K",O$.key])(($)=>$.T.pick($.K),oC);class nC extends O6{description='omit a set of properties from an object like `Omit(User, "age")`'}var Km=S1(["T",O$.object],["K",O$.key])(($)=>$.T.omit($.K),nC);class tC extends O6{description="make all named properties of an object optional like `Partial(User)`"}var _m=S1(["T",O$.object])(($)=>$.T.partial(),tC);class aC extends O6{description="make all named properties of an object required like `Required(User)`"}var qm=S1(["T",O$.object])(($)=>$.T.required(),aC);class sC extends O6{description='exclude branches of a union like `Exclude("boolean", "true")`'}var Rm=S1("T","U")(($)=>$.T.exclude($.U),sC);class eC extends O6{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}var Tm=S1("T","U")(($)=>$.T.extract($.U),eC),$B=B$.module({Exclude:Rm,Extract:Tm,Omit:Km,Partial:_m,Pick:Lm,Record:Am,Required:qm});var o2=wN({...dC,...$B,...CC,...KC,string:pC,number:wW,object:rC,unknown:lC},{prereducedAliases:!0,name:"ark"}),c4=o2.export();Object.assign(f9.ambient,c4);f9.typeAttachments={string:c4.string.root,number:c4.number.root,bigint:c4.bigint,boolean:c4.boolean,symbol:c4.symbol,undefined:c4.undefined,null:c4.null,object:c4.object.root,unknown:c4.unknown.root,false:c4.false,true:c4.true,never:c4.never,arrayIndex:c4.Array.index,Key:c4.Key,Record:c4.Record,Array:c4.Array.root,Date:c4.Date};var t1=Object.assign(o2.type,f9.typeAttachments),vm=o2.match,Cm=o2.generic,RQ$=o2.schema,Bm=o2.define,jm=o2.declare;var Pm="__vite_start_time"in globalThis,Im=typeof window!=="undefined",cQ$="vitest"in globalThis,Z2=t1("string"),XB=t1('"true" | "false" | undefined'),H2=tD({isServer:!Pm&&!Im,server:{CI:t1("string | undefined").pipe(Boolean),POSTGRES_USER:Z2,POSTGRES_PASSWORD:Z2,POSTGRES_DATABASE:Z2,POSTGRES_HOST:Z2,POSTGRES_PORT:Z2.pipe(($)=>Number.parseInt($,10)),BACKEND_PORT:Z2.pipe(($)=>Number.parseInt($,10)),RUN_WORKERS_FROM_SOURCE:XB.pipe(($)=>$==="true"),FRONTEND_PORT:Z2.pipe(($)=>Number.parseInt($,10)),FRONTEND_ORIGINS:Z2.pipe.try(($)=>JSON.parse($),t1("string[]")),API_KEY_OPENAI:t1("string | undefined"),API_KEY_RESEND:t1("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:Z2,VITE_DEV_FRONTEND_HOST:t1("string | undefined"),VITE_DEV_HTTPS:XB.pipe(($)=>$==="true")},runtimeEnv:import.meta.env,emptyStringAsUndefined:!0});var NN={};D2(NN,{users:()=>a8,untrackedUserColumnNames:()=>xm,twoFactorMethod:()=>WB,trackedUserColumnName:()=>Sm,trackableUserColumnNames:()=>UB,signInHistory:()=>bm,role:()=>GB,players:()=>EN,passwordResetAttempts:()=>fm,games:()=>NW,banishedIps:()=>FW,accountActions:()=>km,accountAction:()=>zB});function n2(){return H6({length:24}).$type()}function YB($){return R`lower(${$})`}var EW=R`TO_CHAR(NOW() AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`,GB=T3("role",["admin","user"]),a8=h2("users",{id:B1().primaryKey().defaultRandom(),username:H6({length:16}).notNull(),emailOffered:H6({length:254}).notNull(),emailVerified:H6({length:254}),password:H6({length:254}),createdAtIso:n2().notNull().default(EW),createdIp:H6({length:45}).notNull(),isActive:I3().notNull().default(!1),verifiedAtIso:n2(),userRole:GB().default("user")},($)=>[fD("usernameUniqueIndex").on(YB($.username)),fD("emailVerifiedUniqueIndex").on(YB($.emailVerified))]),xm=["id","createdAtIso","createdIp","isActive","verifiedAtIso"],UB=["username","emailOffered","emailVerified","password","userRole"],Sm=T3("trackedUserColumnName",UB),zB=T3("accountAction",["cooldown","confirmEmail","signIn","resetPassword"]),km=h2("accountActions",{userId:B1().references(()=>a8.id).primaryKey(),action:zB().notNull(),code:H6({length:254}).notNull(),wrongCodeCount:x3().notNull().default(0),expiresAtIso:n2().notNull()}),NW=h2("games",{id:B1().primaryKey().defaultRandom()}),EN=h2("players",{userId:B1().notNull().references(()=>a8.id,{onDelete:"cascade"}),gameId:B1().notNull().references(()=>NW.id,{onDelete:"cascade"}),score:x3().notNull()},($)=>[rq({name:"players_userId_gameId_pk",columns:[$.userId,$.gameId]})]),bm=h2("signInHistory",{id:B1().primaryKey().defaultRandom(),userId:B1().references(()=>a8.id,{onDelete:"cascade"}),signInTimeIso:n2().notNull().default(EW),ipAddress:H6({length:45}).notNull(),userAgent:H6({length:1024}),successful:I3().notNull().default(!1)}),WB=T3("twoFactorMethod",["email","phone"]),fm=h2("passwordResetAttempts",{id:B1().primaryKey().defaultRandom(),userId:B1().notNull().references(()=>a8.id,{onDelete:"cascade"}),requestedIp:H6({length:45}).notNull(),requestedAtIso:n2().notNull().default(EW),succeededIp:H6({length:45}),succeededAtIso:n2(),verificationMethod:WB().notNull()}),FW=h2("banishedIps",{ip:H6({length:45}).primaryKey(),reason:H6({length:2048}).notNull(),banishedAtIso:n2().notNull().default(EW),banishedUntilIso:n2()});var __dirname="/home/runner/work/wayforge/wayforge/apps/tempest.games/src/database";class FN{options;sql;drizzle;observers=new Map;async setupTriggersAndNotifications(){await this.sql.file(hm.resolve(__dirname,"notify_update.sql"));let $=[i4(a8),i4(NW),i4(EN)];await this.sql`SELECT create_notify_triggers(${this.sql.array($)})`,await this.sql.listen("table_update",(X)=>{let Y=X.split(","),U=Y[0],G=Y[1],z=`${U}("${G}")`;if(this.observers.has(z))this.observers.get(z).next(z)})}constructor($=!1,X={host:H2.POSTGRES_HOST,port:H2.POSTGRES_PORT,user:H2.POSTGRES_USER,password:H2.POSTGRES_PASSWORD,database:H2.POSTGRES_DATABASE}){this.options=X,this.sql=F9(X),this.drizzle=gz(this.sql,{schema:NN,logger:$})}observe($,X){if(!this.observers.has($))this.observers.set($,new g$);this.observers.get($).subscribe("SINGLETON",X)}}import{resolve as mm}from"path";import{existsSync as MN,mkdirSync as QB,readFileSync as gm,readdirSync as ZB,rmSync as HB,statSync as VB,writeFileSync as ym}from"fs";import{resolve as JN}from"path";var OB=class{get initialized(){return MN(this.rootDir)}initialize(){if(!this.initialized)QB(this.rootDir,{recursive:!0})}constructor($){if(this.rootDir=$.path,$.eagerInit)this.initialize()}getItem($){let X=JN(this.rootDir,$);if(MN(X))return gm(X,"utf-8");return null}setItem($,X){this.initialize();let Y=JN(this.rootDir,$);ym(Y,X)}removeItem($){let X=JN(this.rootDir,$);if(MN(X))this.initialize(),HB(X)}key($){return ZB(this.rootDir).sort((U,G)=>{let z=VB(U);return VB(G).ctimeMs-z.ctimeMs})[$]??null}clear(){HB(this.rootDir,{recursive:!0}),QB(this.rootDir,{recursive:!0})}get length(){return ZB(this.rootDir).length}};var AN=new OB({path:mm(process.cwd(),"storage")});function wB($){return $.toString({smallestUnit:"millisecond"})}function ZZ$($){return Yz.Instant.from($)}import*as MW from"fs";import*as DB from"readline";function um($){let Y=$.replace(":","T").replace(" ","").replace(/(\d{2})\/(\w{3})\/(\d{4})T(.+)/,(U,G,z,W,Q)=>{let H={Jan:"01",Feb:"02",Mar:"03",Apr:"04",May:"05",Jun:"06",Jul:"07",Aug:"08",Sep:"09",Oct:"10",Nov:"11",Dec:"12"}[z];return`${W}-${H}-${G}T${Q}`});return new Date(Y)}async function EB($,X="/var/log/nginx/access.log",Y=new Date){let U=new Map;if(!MW.existsSync(X))return $.error(`Log file not found: ${X}`),U;let G=MW.createReadStream(X),z=DB.createInterface({input:G,crlfDelay:Number.POSITIVE_INFINITY}),W=new Date(Y.getTime()-3600000);return z.on("line",(Q)=>{let Z=/^(?<ip>\S+) \S+ \S+ \[(?<dateTime>.*?)\]/,H=Q.match(Z);if(H?.groups){let V=H.groups.ip,O=H.groups.dateTime,w=um(O);if(!Number.isNaN(w.getTime())){if(w>=W&&w<=Y){let D=U.get(V);if(!D)D=[],U.set(V,D);D.push(Q)}}else $.error(`Failed to parse date: ${O}`)}}),new Promise((Q,Z)=>{z.on("error",(H)=>{Z(H)}),z.on("close",()=>{Q(U)})})}function NB($){return $.toJsonSchema()}var cm=["Network security adjudicator, your job is to determine if an IP address should be banned.","The IP address in question created the following logs on our server today:","```nginx.log\n"].join(`
|
|
200
200
|
`);function FB($){return cm+$.join(`
|
|
201
201
|
|
|
202
|
-
`)}var MB={schema:
|
|
202
|
+
`)}var MB={schema:t1([{shouldBanIp:"false"},"|",{shouldBanIp:"true",veryConciseReason:"string"}]),toJsonSchema:NB,fallback:{shouldBanIp:!1}};var dm=[".env","php"];async function JB({generator:$,logFilePath:X,logger:Y,now:U=new Date}){let G=$.usdBudget,z=new FN({logQuery(T,q){Y.info("\uD83D\uDCDD query",T,q)}}),W=await EB(Y,X,U),Q=[],Z=$.object(MB),H=0,V=0;for(let[T,q]of W){Y.info(`\uD83D\uDD0D ruling on ${T}. logs:`),Y.info(q.map((I)=>` ${I}`).join(`
|
|
203
203
|
`));let v=!1;for(let I of dm)if(q.some((S)=>S.includes(I))){Q.push({ip:T,reason:`Always ban ${I}`}),Y.info(` \uD83E\uDDD1\u200D\u2696\uFE0F banning ${T}--always ban ${I}
|
|
204
204
|
`),v=!0;break}if(v)continue;if($.usdBudget>$.usdMinimum){let I=FB(q),S=await Z(I);if(S.shouldBanIp)Q.push({ip:T,reason:S.veryConciseReason}),Y.info(` \uD83E\uDDD1\u200D\u2696\uFE0F banning ${T}--${S.veryConciseReason}
|
|
205
205
|
`);else V++,Y.info(` \uD83D\uDD4A\uFE0F not banning ${T}
|