tempest.games 0.2.14 → 0.2.16
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 +15 -1
- package/app/assets/index-DV2ldfnq.js +109 -0
- package/app/index.html +1 -1
- package/bin/backend.bun.js +202 -207
- package/bin/backend.worker.tribunal.bun.js +89 -65
- package/bin/frontend.bun.js +2 -2
- package/bin/setup-db.bun.js +54 -54
- package/package.json +18 -19
- package/app/assets/index-XXIFAPT4.js +0 -109
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var HP=Object.create;var{getPrototypeOf:FP,defineProperty:B9,getOwnPropertyNames:OP}=Object;var QP=Object.prototype.hasOwnProperty;var ZP=($,T,W)=>{W=$!=null?HP(FP($)):{};let X=T||!$||!$.__esModule?B9(W,"default",{value:$,enumerable:!0}):W;for(let U of OP($))if(!QP.call(X,U))B9(X,U,{get:()=>$[U],enumerable:!0});return X};var VP=($,T)=>()=>(T||$((T={exports:{}}).exports,T),T.exports);var e0=($,T)=>{for(var W in T)B9($,W,{get:T[W],enumerable:!0,configurable:!0,set:(X)=>T[W]=()=>X})};var py=($,T)=>()=>($&&(T=$($=0)),T);var VV=import.meta.require;var YA=VP((bp,wA)=>{var ZX=VV("os"),VX=VV("path");function XA($){let T=process.env.XDG_CACHE_HOME||VX.join(ZX.homedir(),".cache");return VX.join(T,$)}function VS($){return VX.join(ZX.homedir(),"Library","Caches",$)}function KS($){let T=process.env.LOCALAPPDATA||VX.join(ZX.homedir(),"AppData","Local");return VX.join(T,$,"Cache")}var AS=function(){switch(ZX.platform()){case"darwin":return VS;case"win32":return KS;case"aix":case"android":case"freebsd":case"linux":case"netbsd":case"openbsd":case"sunos":return XA;default:return console.error(`(node:${process.pid}) [cachedir] Warning: the platform "${ZX.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`),XA}}();wA.exports=function $(T){if(typeof T!=="string")throw new TypeError("id is not a string");if(T.length===0)throw new Error("id cannot be empty");if(/[^0-9a-zA-Z-]/.test(T))throw new Error("id cannot contain special characters");return AS(T)}});class LU extends Promise{fate;resolve;reject;done=!1;constructor($){let T,W;super((X,U)=>{T=X,W=U});this.resolve=T,this.reject=W,this.use($ instanceof Promise?$:new Promise($))}pass($,T){if($===this.fate)this.resolve(T),this.done=!0}fail($,T){if($===this.fate)this.reject(T),this.done=!0}use($){if($ instanceof Promise){let T=$;this.fate=T,T.then((W)=>{this.pass(T,W)},(W)=>{this.fail(T,W)})}else this.resolve($),this.fate=void 0}}var ry=($,T,W=AV.STORE)=>{return KV(W,{key:`${$.key}:JSON`,get:({get:X})=>T.toJson(X($)),set:({set:X},U)=>{X($,T.fromJson(U))}})};function ty($,T,W){return x9($,{key:`${T.key}:JSON`,get:(U)=>({get:w})=>{let Y=w(T,U);return W.toJson(Y)},set:(U)=>({set:w},Y)=>{w(T,U,W.fromJson(Y))}},["mutable","json"])}var JU=($)=>JSON.parse($),G6=($)=>JSON.stringify($),sy=[Array.prototype,Boolean.prototype,Number.prototype,Object.prototype,String.prototype];function Q$($){while($.child!==null)$=$.child;return $}class e8{_buffer;_index=0;constructor($){let T;if(typeof $==="number")T=$;else T=$.length;this._buffer=Array.from({length:T})}get buffer(){return this._buffer}get index(){return this._index}add($){this._buffer[this._index]=$,this._index=(this._index+1)%this._buffer.length}copy(){let $=new e8([...this._buffer]);return $._index=this._index,$}}var KP={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 EV($,T){let W=G6(T),X=`${$.key}(${W})`,U=KP[$.type],w={key:X,type:U};return Object.assign(w,{family:{key:$.key,subKey:W}}),Object.assign(w,{counterfeit:!0}),w}function RU($){let T={key:$.key,type:$.type};if("family"in $)T.family=$.family;return T}var f9=($)=>(T,W,X,U,...w)=>{console[$](`${T} ${W} "${X}" ${U}`,...w)},AP={error:f9("error"),info:f9("info"),warn:f9("warn")};class b9{logLevel;filter;logger;constructor($,T,W=AP){this.logLevel=$,this.filter=T,this.logger=W}error=(...$)=>{let T=this.filter?.(...$)??!0;if(this.logLevel!==null){if(T===!0)this.logger.error(...$);else if(T!==!1)this.logger.error(...T)}};info=(...$)=>{let T=this.filter?.(...$)??!0;if(this.logLevel==="info"){if(T===!0)this.logger.info(...$);else if(T!==!1)this.logger.info(...T)}};warn=(...$)=>{let T=this.filter?.(...$)??!0;if(this.logLevel!=="error"&&this.logLevel!==null){if(T===!0)this.logger.warn(...$);else if(T!==!1)this.logger.warn(...T)}}}class d1{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=($,T)=>`${$}:${T}`;warn;getRelatedKeys($){return this.relations.get($)}addRelation($,T){let W=this.relations.get($),X=this.relations.get(T);if(W)W.add(T);else W=new Set([T]),this.relations.set($,W);if(X)X.add($);else X=new Set([$]),this.relations.set(T,X)}deleteRelation($,T){let W=this.relations.get($);if(W){if(W.delete(T),W.size===0)this.relations.delete($);let X=this.relations.get(T);if(X){if(X.delete($),X.size===0)this.relations.delete(T)}}}replaceRelationsUnsafely($,T){this.relations.set($,new Set(T));for(let W of T){let X=new Set().add($);this.relations.set(W,X)}}replaceRelationsSafely($,T){let W=this.relations.get($),X=this.isAType?.($)?$:void 0,U=X===void 0?$:void 0;if(W)for(let w of W){X??=w,U??=w;let Y=this.relations.get(w);if(Y){if(Y.size===1)this.relations.delete(w);else Y.delete($);this.contents.delete(this.makeContentKey(X,U))}}this.relations.set($,new Set(T));for(let w of T){let Y=this.relations.get(w);if(Y)Y.add($);else Y=new Set().add($),this.relations.set(w,Y)}}getContentInternal($){return this.contents.get($)}setContent($,T){this.contents.set($,T)}deleteContent($){this.contents.delete($)}constructor($,T){if(this.a=$.between[0],this.b=$.between[1],this.cardinality=$.cardinality,!T?.externalStore)this.relations=new Map($.relations?.map(([W,X])=>[W,new Set(X)])),this.contents=new Map($.contents);if(this.isAType=T?.isAType??null,this.isBType=T?.isBType??null,this.isContent=T?.isContent??null,T?.makeContentKey)this.makeContentKey=T.makeContentKey;if(T?.externalStore){let W=T.externalStore;if(this.has=(X,U)=>W.has(X,U),this.addRelation=(X,U)=>{W.addRelation(X,U)},this.deleteRelation=(X,U)=>{W.deleteRelation(X,U)},this.replaceRelationsSafely=(X,U)=>{W.replaceRelationsSafely(X,U)},this.replaceRelationsUnsafely=(X,U)=>{W.replaceRelationsUnsafely(X,U)},this.getRelatedKeys=(X)=>W.getRelatedKeys(X),W.getContent)this.getContentInternal=(X)=>{return W.getContent(X)},this.setContent=(X,U)=>{W.setContent(X,U)},this.deleteContent=(X)=>{W.deleteContent(X)};for(let[X,U]of $.relations??[]){let w=this.isAType?.(X)?X:void 0,Y=w===void 0?X:void 0;for(let G of U)w??=G,Y??=G,this.addRelation(w,Y)}for(let[X,U]of $.contents??[])this.setContent(X,U)}if(T?.warn)this.warn=T.warn}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([$,T])=>[$,[...T]]),contents:[...this.contents.entries()]}}set(...$){let T,W,X;switch($.length){case 1:{let U=$[0];T=U[this.a],W=U[this.b],X=void 0;break}case 2:{let U=$[0];if(typeof U==="string")[T,W]=$;else T=U[this.a],W=U[this.b],X=$[1];break}default:{T=$[0],W=$[1],X=$[2];break}}switch(this.cardinality){case"1:1":{let U=this.getRelatedKey(T);if(U&&U!==W)this.delete(T,U)}case"1:n":{let U=this.getRelatedKey(W);if(U&&U!==T)this.delete(U,W)}break;case"n:n":}if(X){let U=this.makeContentKey(T,W);this.setContent(U,X)}return this.addRelation(T,W),this}delete($,T){T=typeof T==="string"?T:$[this.b];let W=typeof $==="string"?$:$[this.a];if(W===void 0&&typeof T==="string"){let X=this.getRelatedKeys(T);if(X)for(let U of X)this.delete(U,T)}if(typeof W==="string"&&T===void 0){let X=this.getRelatedKeys(W);if(X)for(let U of X)this.delete(W,U)}if(typeof W==="string"&&typeof T==="string"){this.deleteRelation(W,T);let X=this.makeContentKey(W,T);this.deleteContent(X)}return this}getRelatedKey($){let T=this.getRelatedKeys($);if(T){if(T.size>1)this.warn?.(`${T.size} related keys were found for key "${$}": (${[...T].map((X)=>`"${X}"`).join(", ")}). Only one related key was expected.`);let W;for(let X of T){W=X;break}return W}}replaceRelations($,T,W){let X=!Array.isArray(T),U=X?Object.keys(T):T;if(W?.reckless)this.replaceRelationsUnsafely($,U);else this.replaceRelationsSafely($,U);if(X)for(let w of U){let Y=this.makeContentKey($,w),G=T[w];this.setContent(Y,G)}return this}getContent($,T){let W=this.makeContentKey($,T);return this.getContentInternal(W)}getRelationEntries($){let T=$[this.a],W=$[this.b];if(T!==void 0&&W===void 0){let X=this.getRelatedKeys(T);if(X)return[...X].map((U)=>{return[U,this.getContent(T,U)]})}if(T===void 0&&W!==void 0){let X=this.getRelatedKeys(W);if(X)return[...X].map((U)=>{return[U,this.getContent(U,W)]})}return[]}has($,T){if(T)return this.getRelatedKeys($)?.has(T)??!1;return this.relations.has($)}}class b${Subscriber;subscribers=new Map;subscribe($,T){return this.subscribers.set($,T),()=>{this.unsubscribe($)}}unsubscribe($){this.subscribers.delete($)}next($){let T=this.subscribers.values();for(let W of T)W($)}}class y9 extends b${state;constructor($){super();this.state=$}next($){this.state=$,super.next($)}}function $T($){return"epoch"in $.transactionMeta}function i6($){return"phase"in $.transactionMeta}function MV($){return $[0].toUpperCase()+$.slice(1)}function $Y($){return $.type.split("_").map(MV).join(" ")}class _U extends Error{constructor($,T){super(`${$Y($)} ${G6($.key)} not found in store "${T.config.name}".`)}}var mW=($)=>(T)=>$ instanceof Function?$(T):$;var TT=($,T)=>{if($.valueMap.has(T.key))return $.logger.info("\uD83D\uDCD6",T.type,T.key,"reading cached value"),DV(T,$);switch(T.type){case"readonly_held_selector":case"readonly_pure_selector":case"writable_held_selector":case"writable_pure_selector":return $.logger.info("\uD83E\uDDEE",T.type,T.key,"computing value"),T.get();case"atom":case"mutable_atom":{let W=T.default,X;if(W instanceof Function)X=W();else X=W;return $.logger.info("\uD83D\uDC81","atom",T.key,"could not find cached value; using default",X),X}}};var NV=($,T)=>{if($.operation.open){let W=performance.now();return $.logger.info("\u2757",T.type,T.key,`deferring setState at T-${W} until setState for "${$.operation.token.key}" is done`),W}$.operation={open:!0,done:new Set,prev:new Map,time:Date.now(),token:T},$.logger.info("\u2B55",T.type,T.key,`operation start in store "${$.config.name}"${!i6($)?"":` ${$.transactionMeta.phase} "${$.transactionMeta.update.key}"`}`)},LV=($)=>{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)},JV=($,T)=>{if(!$.operation.open)return $.logger.error("\uD83D\uDC1E","unknown",T,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0;return $.operation.done.has(T)},WT=($,T)=>{if(!$.operation.open){$.logger.error("\uD83D\uDC1E","unknown",T,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}$.operation.done.add(T)};var RV=($,T,W)=>{switch(T.type){case"mutable_atom":$.logger.info("\uD83D\uDCE2",T.type,T.key,"is now (",W.newValue,") subscribers:",T.subject.subscribers);break;case"atom":case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":$.logger.info("\uD83D\uDCE2",T.type,T.key,"went (",W.oldValue,"->",W.newValue,") subscribers:",T.subject.subscribers)}T.subject.next(W)};var h9=($,T)=>{let W=Q$($),X=W.selectorAtoms.getRelatedKeys(T.key);if(W.logger.info("\uD83E\uDDF9",T.type,T.key,X?`evicting ${X.size} states downstream:`:"no downstream states",X??"to evict"),X){if(W.operation.open)W.logger.info("\uD83E\uDDF9",T.type,T.key,`[ ${[...W.operation.done].join(", ")} ] already done`);for(let U of X){if(JV(W,U))continue;_V(U,W),WT(W,U)}}};var kV=($,T,W)=>{let X=TT($,T),U=X;if(T.type==="mutable_atom"&&i6($)){let{parent:Y}=$;U=kU($,T,Y)}if(U=mW(W)(U),$.logger.info("\uD83D\uDCDD","atom",T.key,"set to",U),U=z6($,T.key,U,T.subject),PV($,T.key))qV($,T.key);WT($,T.key),h9($,T);let w={oldValue:X,newValue:U};if(!i6($)){RV($,T,w);return}if($.on.transactionApplying.state===null){let{key:Y}=T;if(vV(w.newValue))return;let G={type:"atom_update",key:Y,...w};if(T.family)G.family=T.family;$.transactionMeta.update.updates.push(G),$.logger.info("\uD83D\uDCC1","atom",Y,"stowed (",w.oldValue,"->",w.newValue,")")}else if(T.key.startsWith("*")){let Y=T.key.slice(1),G=$.atoms.get(Y),H=$.valueMap.get(Y);if(G.type==="mutable_atom"&&i6($)){let{parent:F}=$;H=kU($,G,F)}if(H.do(w.newValue)===null)h9($,G)}};var TY=($,T,W)=>{switch(T.type){case"atom":case"mutable_atom":kV($,T,W);break;case"writable_pure_selector":case"writable_held_selector":T.set(W);break}};var WY=($,T)=>Q$($).atoms.has(T),EP=($,T)=>Q$($).writableSelectors.has(T),MP=($,T)=>Q$($).readonlySelectors.has(T),CV=($,T)=>WY($,T)||EP($,T)||MP($,T);var UY=($,T)=>{return Q$($).selectorGraph.getRelationEntries({downstreamSelectorKey:T}).filter(([X,{source:U}])=>U!==T).map(([X,{source:U}])=>U).filter((X)=>CV($,X))};var g9=($,T,W)=>{let X=[],U=UY($,T);while(U.length>0){let w=U.shift();if(W.has(w))continue;if(W.add(w),!WY($,w))U.push(...UY($,w));else if(!X.includes(w))X.push(w)}return X},SV=($,T)=>{let W=$.key,X=UY(T,W),U=new Set;return X.flatMap((w)=>WY(T,w)?w:g9(T,w,U))};var jV=($,T,W,X,U)=>{let w=Q$($),{type:Y,key:G}=X;if(Y==="atom"||Y==="mutable_atom")w.selectorAtoms.set({selectorKey:W,atomKey:G}),$.logger.info("\uD83D\uDD0D",T,W,`discovers root atom "${G}"`);else{let H=g9($,G,U);$.logger.info("\uD83D\uDD0D",T,W,`discovers root atoms: [ ${H.map((z)=>`"${z}"`).join(", ")} ]`);for(let z of H)w.selectorAtoms=w.selectorAtoms.set({selectorKey:W,atomKey:z})}U.add(G)};var UT=($,T,W,X)=>({get:(...U)=>{let w=Q$($),Y;if(U.length===2){let[F,O]=U;Y=t6($,F,O)}else[Y]=U;let G=j6($,Y),H=TT($,G),z=Y.key;return $.logger.info("\uD83D\uDD0C",T,W,`registers dependency ( "${z}" =`,H,")"),w.selectorGraph.set({upstreamSelectorKey:z,downstreamSelectorKey:W},{source:Y.key}),jV($,T,W,Y,X),H},set:(...U)=>{let w,Y;if(U.length===2)w=U[0],Y=U[1];else{let z=U[0],F=U[1];Y=U[2],w=t6($,z,F)}let G=Q$($),H=j6(G,w);TY(G,H,Y)},find:(...U)=>t6($,...U),json:(U)=>cW($,U)});var m9=($,T,W)=>{let X=Q$($),U=new b$,w=new Set,{key:Y,const:G}=T,H="readonly_held_selector",{get:z,find:F,json:O}=UT(X,"readonly_held_selector",Y,w),Z={...T,type:"readonly_held_selector",subject:U,install:(A)=>m9(A,T,W),get:()=>{return T.get({get:z,find:F,json:O},G),z6(Q$($),Y,G,U),w.clear(),G},...W&&{family:W}};X.readonlySelectors.set(Y,Z),$.logger.info("\u2728","readonly_held_selector",Y,"=",G);let K={key:Y,type:"readonly_held_selector"};if(W)K.family=W;return K};var c9=($,T,W)=>{let X=Q$($),U=new b$,w=new Set,Y=T.key,G="readonly_pure_selector",{get:H,find:z,json:F}=UT(X,"readonly_pure_selector",Y,w),O=()=>{let A=T.get({get:H,find:z,json:F});return z6(Q$($),Y,A,U),w.clear(),A},Q={...T,type:"readonly_pure_selector",subject:U,install:(A)=>c9(A,T,W),get:O,...W&&{family:W}};X.readonlySelectors.set(Y,Q);let Z=O();$.logger.info("\u2728","readonly_pure_selector",Y,"=",Z);let K={key:Y,type:"readonly_pure_selector"};if(W)K.family=W;return K};var u9=($,T,W)=>{let X=Q$($),U=new b$,w=new Set,{key:Y,const:G}=T,H="writable_held_selector",z=UT(X,"writable_held_selector",Y,w),{find:F,get:O,json:Q}=z,Z={find:F,get:O,json:Q},K=(_=T.get,C=Q$($))=>{return _(Z,G),z6(C,Y,G,U),w.clear(),G},D={...T,type:"writable_held_selector",subject:U,install:(_)=>u9(_,T,W),get:K,set:(_)=>{let C=Q$($),f=K(T.get,C),b=mW(_)(f);if($.logger.info("\uD83D\uDCDD","writable_held_selector",Y,"set (",f,"->",b,")"),z6(C,Y,b,U),WT(C,Y),$T(C))U.next({newValue:b,oldValue:f});T.set(z,b)},...W&&{family:W}};X.writableSelectors.set(Y,D);let L=K();$.logger.info("\u2728","writable_held_selector",Y,"=",L);let J={key:Y,type:"writable_held_selector"};if(W)J.family=W;return J};var vU=($,T,W)=>{let X=Q$($),U=new b$,w=new Set,Y=T.key,G="writable_pure_selector",H=UT(X,"writable_pure_selector",Y,w),{find:z,get:F,json:O}=H,Q={find:z,get:F,json:O},Z=(J=T.get,_=Q$($))=>{let C=J(Q);return z6(_,Y,C,U),w.clear(),C},A={...T,type:"writable_pure_selector",subject:U,install:(J)=>vU(J,T,W),get:Z,set:(J)=>{let _=Q$($),C=Z(T.get,_),f=mW(J)(C);if($.logger.info("\uD83D\uDCDD","writable_pure_selector",Y,"set (",C,"->",f,")"),z6(_,T.key,f,U),WT(_,T.key),$T(_))U.next({newValue:f,oldValue:C});T.set(H,f)},...W&&{family:W}};X.writableSelectors.set(Y,A);let D=Z();$.logger.info("\u2728",A.type,A.key,"=",D);let L={key:Y,type:"writable_pure_selector"};if(W)L.family=W;return L};function KV($,T){let W="set"in T,X="const"in T;if(X&&W){let w=u9($,T,void 0);return $.on.selectorCreation.next(w),w}if(X){let w=m9($,T,void 0);return $.on.selectorCreation.next(w),w}if(W){let w=vU($,T,void 0);return $.on.selectorCreation.next(w),w}let U=c9($,T,void 0);return $.on.selectorCreation.next(U),U}function x9($,T,W){let X=T.key,U="writable_pure_selector_family",w={key:X,type:"writable_pure_selector_family"},Y=$.families.get(X);if(Y)$.logger.error("\u2757","writable_pure_selector_family",X,`Overwriting an existing ${$Y(Y)} "${Y.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let G=new b$,z=Object.assign((F)=>{let O=G6(F),Q={key:X,subKey:O},Z=`${X}(${O})`,K=Q$($),A=vU(K,{key:Z,get:T.get(F),set:T.set(F)},Q);return G.next({type:"state_creation",token:A}),A},w,{internalRoles:W,subject:G,install:(F)=>x9(F,T),default:(F)=>{return T.get(F)({get:(...Q)=>PU($,...Q),find:(...Q)=>t6($,...Q),json:(Q)=>cW($,Q)})}});return $.families.set(X,z),w}function IV($,T,W){let X=$.families.get(T.key);if(X===void 0)throw new _U(T,$);let U=X(W),w=Q$($);if(U.family){if($T(w))switch(U.type){case"atom":case"mutable_atom":$.on.atomCreation.next(U);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":$.on.selectorCreation.next(U);break}else if(i6(w)&&w.on.transactionApplying.state===null)w.transactionMeta.update.updates.push({type:"state_creation",token:U})}return U}function BV($,T,W){let X=G6(W),U=`${T.key}(${X})`,w=Q$($),Y;switch(T.type){case"atom_family":case"mutable_atom_family":Y=w.atoms.get(U);break;case"writable_held_selector_family":case"writable_pure_selector_family":Y=w.writableSelectors.get(U);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":Y=w.readonlySelectors.get(U);break}if(Y)return RU(Y);return Y}function t6($,T,W){let X=BV($,T,W);if(X)return X;let U=G6(W),w=$.molecules.get(U);if(!w&&$.config.lifespan==="immortal"){let Y=EV(T,W);return $.logger.error("\u274C",Y.type,Y.key,`was not found in store "${$.config.name}"; returned a counterfeit token.`),Y}if(X=IV($,T,W),w)Q$($).moleculeData.set(U,T.key);return X}function xV($,T){if(T.family){let W=$.families.get(T.family.key);if(W)return W}}function XT($,...T){let W,X,U,w;if(T.length===2){if(W=T[0],w=T[1],X=xV($,W)??null,X)U=W.family?JU(W.family.subKey):null,W=t6($,X,U)}else X=T[0],U=T[1],w=T[2],W=t6($,X,U);if("counterfeit"in W&&"family"in W){let H=W.family.subKey,z=$.disposalTraces.buffer.find((F)=>F?.key===H);$.logger.error("\u274C",W.type,W.key,`could not be set because it was not found in the store "${$.config.name}".`,z?`This state was previously disposed:
|
|
4
|
-
${z.trace}`:"No previous disposal trace was found.");return}let Y=
|
|
5
|
-
${Y.trace}`:"No previous disposal trace was found."),X.type){case"atom_family":case"mutable_atom_family":return $.defaults.get(X.key);case"readonly_pure_selector_family":case"writable_pure_selector_family":case"readonly_held_selector_family":case"writable_held_selector_family":{if($.defaults.has(X.key))return $.defaults.get(W.family.key);let G=j6($,X).default(w);return $.defaults.set(X.key,G),G}}}return TT($,j6($,W))}class fV{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;writableSelectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new d1({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new d1({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 d1({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new d1({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new e8(100);molecules=new Map;moleculeJoins=new d1({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});moleculeGraph=new d1({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});moleculeData=new d1({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});miscResources=new Map;on={atomCreation:new b$,atomDisposal:new b$,selectorCreation:new b$,selectorDisposal:new b$,timelineCreation:new b$,transactionCreation:new b$,transactionApplying:new y9(null),operationClose:new b$,moleculeCreation:new b$,moleculeDisposal:new b$};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new b9("warn",($,T,W)=>!yV(W))];logger={error:(...$)=>{for(let T of this.loggers)T.error(...$)},info:(...$)=>{for(let T of this.loggers)T.info(...$)},warn:(...$)=>{for(let T of this.loggers)T.warn(...$)}};constructor($,T=null){if(this.config={...T?.config,...$},T!==null){if(this.valueMap=new Map(T?.valueMap),this.operation={...T?.operation},$T(T))this.transactionMeta={epoch:new Map(T?.transactionMeta.epoch),actionContinuities:new d1(T?.transactionMeta.actionContinuities.toJSON())};for(let[,X]of T.families){if(X.internalRoles?.includes("mutable")||X.internalRoles?.includes("join"))continue;X.install(this)}let W=new Set;for(let[,X]of T.atoms){if(W.has(X.key))continue;if(X.install(this),X.type==="mutable_atom"){let U=cW(T,X),w=bV(X);W.add(U.key),W.add(w.key)}}for(let[,X]of T.readonlySelectors)X.install(this);for(let[,X]of T.writableSelectors){if(W.has(X.key))continue;X.install(this)}for(let[,X]of T.transactions)X.install(this);for(let[,X]of T.timelines)X.install(this)}}}var AV={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new fV({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function j6($,T){let W,X=$;while(X!==null){switch(T.type){case"atom":case"mutable_atom":W=X.atoms.get(T.key);break;case"writable_pure_selector":case"writable_held_selector":W=X.writableSelectors.get(T.key);break;case"readonly_pure_selector":case"readonly_held_selector":W=X.readonlySelectors.get(T.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":W=X.families.get(T.key);break;case"timeline":W=X.timelines.get(T.key);break;case"transaction":W=X.transactions.get(T.key);break}if(W)return W;X=X.child}throw new _U(T,$)}var hV=($,T)=>{let W=Q$($);if(W.operation.open)return W.operation.prev.get(T.key);return W.valueMap.get(T.key)};var p9=($,T)=>{let W=Q$($);return SV(T,$).map((U)=>{let w=W.atoms.get(U);if(w===void 0)throw new Error(`Atom "${U}", a dependency of selector "${T.key}", not found in store "${$.config.name}".`);return w.subject.subscribe(`${T.type}:${T.key}`,(Y)=>{$.logger.info("\uD83D\uDCE2",T.type,T.key,"root",U,"went",Y.oldValue,"->",Y.newValue);let G=hV(W,T),H=TT(W,T);$.logger.info("\u2728",T.type,T.key,"went",G,"->",H),T.subject.next({newValue:H,oldValue:G})})})};function qU($,T,W,X){function U(O){if($.operation.open){let Q=$.on.operationClose.subscribe(`state subscription ${W}`,()=>{Q(),X(O)})}else X(O)}let w=j6($,T);$.logger.info("\uD83D\uDC40",w.type,w.key,`Adding subscription "${W}"`);let Y=w.type==="writable_pure_selector"||w.type==="readonly_pure_selector",G=null,H=U;if(Y)G=p9($,w),H=(O)=>{if(G)G.length=0,G.push(...p9($,w));U(O)};let z=w.subject.subscribe(W,H);return()=>{if($.logger.info("\uD83D\uDE48",w.type,w.key,`Removing subscription "${W}"`),z(),G)for(let O of G)O()}}var gV=($,T,W,X)=>{let U=j6($,T);$.logger.info("\uD83D\uDC40","timeline",T.key,`Adding subscription "${W}"`);let w=U.subject.subscribe(W,X);return()=>{$.logger.info("\uD83D\uDE48","timeline",T.key,`Removing subscription "${W}" from timeline`),w()}};class d9{initializeState($,T){let W=`*${$.key}`;T.atoms.delete(W),T.valueMap.delete(W);let X=$.family?{key:`*${$.family.key}`,subKey:$.family.subKey}:void 0,U=o9(T,{key:W,default:null},X);if(T.parent?.valueMap.has(W)){let w=T.parent.valueMap.get(W);T.valueMap.set(W,w)}return U}unsubscribeFromInnerValue;unsubscribeFromState;observeCore($,T,W){let X=`tracker:${W.config.name}:${i6(W)?W.transactionMeta.update.key:"main"}:${$.key}`,U=PU(W,$);this.unsubscribeFromInnerValue=U.subscribe(X,(w)=>{XT(W,T,w)}),this.unsubscribeFromState=qU(W,$,X,(w)=>{if(w.newValue!==w.oldValue)this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=w.newValue.subscribe(X,(Y)=>{XT(W,T,Y)})})}updateCore($,T,W){let X=`tracker:${W.config.name}:${i6(W)?W.transactionMeta.update.key:"main"}:${$.key}`;qU(W,T,X,({newValue:U,oldValue:w})=>{let Y=W.timelineTopics.getRelatedKey(T.key);if(Y){if(W.timelines.get(Y)?.timeTraveling){let z=gV(W,{key:Y,type:"timeline"},X,(F)=>{z(),XT(W,$,(O)=>{if(F==="redo"&&U)O.do(U);else if(F==="undo"&&w)O.undo(w);return O})});return}}let G=W.on.operationClose.subscribe(X,()=>{G();let H=PU(W,$),z=U===null?-1:H.getUpdateNumber(U),F=z-H.cacheUpdateNumber;if(U&&F===1)XT(W,$,(O)=>(O.do(U),O));else W.logger.info("\u274C","mutable_atom",$.key,`could not be updated. Expected update number ${H.cacheUpdateNumber+1}, but got ${z}`)})})}mutableState;latestUpdateState;[Symbol.dispose];constructor($,T){this.mutableState=$;let W=Q$(T);this.latestUpdateState=this.initializeState($,W),this.observeCore($,this.latestUpdateState,W),this.updateCore($,this.latestUpdateState,W),W.trackers.set($.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),W.trackers.delete($.key)}}}var cW=($,T)=>{if(T.family){let X=Q$($),w={key:`${T.family.key}:JSON`,type:"writable_pure_selector_family"},Y=j6(X,w),G=JSON.parse(T.family.subKey);return t6($,Y,G)}return{type:"writable_pure_selector",key:`${T.key}:JSON`}};var bV=($)=>{let W={type:"atom",key:`*${$.key}`};if($.family)W.family={key:`*${$.family.key}`,subKey:$.family.subKey};return W};function vV($){return typeof $==="object"&&$!==null&&"do"in $&&"undo"in $&&"subscribe"in $}function kU($,T,W){let X=W.valueMap.get(T.key),U=$.valueMap.get(T.key);if(X!==U)return U;if(X===void 0)return T.default();W.logger.info("\uD83D\uDCC3","atom",T.key,"copying");let w=T.toJson(X),Y=T.fromJson(w);return $.valueMap.set(T.key,Y),new d9(T,W),Y}function z6($,T,W,X){let U=$.valueMap.get(T);if(U instanceof LU)U.use(W);if(W instanceof Promise){let w=new LU(W);return $.valueMap.set(T,w),w.then((Y)=>{z6($,T,Y,X),X.next({newValue:Y,oldValue:w})}).catch((Y)=>{$.logger.error("\uD83D\uDCA5","state",T,"rejected:",Y)}),w}return $.valueMap.set(T,W),W}var DV=($,T)=>{let W=T.valueMap.get($.key);if($.type==="mutable_atom"&&i6(T)){let{parent:X}=T;W=kU(T,$,X)}return W},_V=($,T)=>{let W=T.valueMap.get($);if(W instanceof LU){let X=W,U=T.writableSelectors.get($)??T.readonlySelectors.get($);if(U)X.use(U.get());return}if(T.operation.open)T.operation.prev.set($,W);T.valueMap.delete($),T.logger.info("\uD83D\uDDD1","state",$,"evicted")};var PV=($,T)=>{return Q$($).atomsThatAreDefault.has(T)},mV=($,T)=>{let W=Q$($);W.atomsThatAreDefault=new Set(W.atomsThatAreDefault).add(T)},qV=($,T)=>{let W=Q$($);W.atomsThatAreDefault=new Set(Q$($).atomsThatAreDefault),W.atomsThatAreDefault.delete(T)};function o9($,T,W){let{key:U,default:w}=T;$.logger.info("\uD83D\uDD28","atom",U,`creating in store "${$.config.name}"`);let Y=Q$($),G=Y.atoms.get(U);if(G&&G.type==="atom")return $.logger.error("\u274C","atom",U,"Tried to create atom, but it already exists in the store."),RU(G);let H=new b$,z={...T,type:"atom",install:(Q)=>{return Q.logger.info("\uD83D\uDEE0\uFE0F","atom",U,`installing in store "${Q.config.name}"`),o9(Q,T,W)},subject:H};if(W)z.family=W;let F=w;if(w instanceof Function)F=w();Y.atoms.set(U,z),mV($,U),z6(Y,U,F,H);let O=RU(z);if(T.effects){let Q=0,Z=[];for(let K of T.effects){let A=K({setSelf:(D)=>{XT($,O,D)},onSet:(D)=>qU($,O,`effect[${Q}]`,D)});if(A)Z.push(A);++Q}z.cleanup=()=>{for(let K of Z)K()}}return O}class uW extends Set{mode="record";subject=new b$;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor($,T=0){super($);if($ instanceof uW)this.parent=$,this.cacheUpdateNumber=$.cacheUpdateNumber;if(T)this.cacheLimit=T,this.cache=new Array(T),this.subscribe("auto cache",(W)=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=W})}toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON($){let T=new uW($.members,$.cacheLimit);return T.cache=$.cache,T.cacheIdx=$.cacheIdx,T.cacheUpdateNumber=$.cacheUpdateNumber,T}add($){let T=super.add($);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`add:${G6($)}`);return T}clear(){let $=this.mode==="record"?[...this]:null;if(super.clear(),$)this.cacheUpdateNumber++,this.emit(`clear:${JSON.stringify($)}`)}delete($){let T=super.delete($);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`del:${G6($)}`);return T}parent=null;child=null;transactionUpdates=null;transaction($){this.mode="transaction",this.transactionUpdates=[],this.child=new uW(this);let T=this.child._subscribe("transaction",(W)=>{this.transactionUpdates?.push(W)});try{if($(this.child)){for(let X of this.transactionUpdates)this.doStep(X);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(W){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",W),W}finally{T(),this.child=null,this.transactionUpdates=null,this.mode="record"}}_subscribe($,T){return this.subject.subscribe($,T)}subscribe($,T){return this.subject.subscribe($,(W)=>{T(`${this.cacheUpdateNumber}=${W}`)})}emit($){this.subject.next($)}doStep($){let T=$.indexOf(":"),W=$.substring(0,T),X=$.substring(T+1);switch(W){case"add":this.add(JSON.parse(X));break;case"clear":this.clear();break;case"del":this.delete(JSON.parse(X));break;case"tx":for(let U of X.split(";"))this.doStep(U)}}getUpdateNumber($){let T=$.indexOf("=");return Number($.substring(0,T))}do($){let T=$.indexOf("="),W=Number($.substring(0,T)),X=W-this.cacheUpdateNumber;if(X>0){if(X===1){this.mode="playback";let w=$.substring(T+1);return this.doStep(w),this.mode="record",this.cacheUpdateNumber=W,null}return this.cacheUpdateNumber+1}if(Math.abs(X)<this.cacheLimit){let w=this.cacheIdx+X;if(this.cache[w]===$)return null;this.mode="playback";let G=!1;while(!G){this.cacheIdx%=this.cacheLimit;let z=this.cache[this.cacheIdx];if(this.cacheIdx--,!z)return"OUT_OF_RANGE";this.undo(z),G=this.cacheIdx===w-1}let H=$.substring(T+1);return this.doStep(H),this.mode="record",this.cacheUpdateNumber=W,null}return"OUT_OF_RANGE"}undoStep($){let T=$.indexOf(":"),W=$.substring(0,T),X=$.substring(T+1);switch(W){case"add":this.delete(JSON.parse(X));break;case"del":this.add(JSON.parse(X));break;case"clear":{let U=JSON.parse(X);for(let w of U)this.add(w);break}case"tx":{let U=X.split(";");for(let w=U.length-1;w>=0;w--)this.undoStep(U[w])}}}undo($){let T=$.indexOf("=");if(Number($.substring(0,T))===this.cacheUpdateNumber){this.mode="playback";let X=$.substring(T+1);return this.undoStep(X),this.mode="record",this.cacheUpdateNumber--,null}return this.cacheUpdateNumber}}function yV($){return $.startsWith("\uD83D\uDD0D ")}class XY{listeners;globalListeners;handleEvent($,...T){for(let X of this.globalListeners)X($,...T);let W=this.listeners.get($);if(W)for(let X of W)X(...T)}id="no_id_retrieved";emit;constructor($){this.emit=$,this.listeners=new Map,this.globalListeners=new Set}on($,T){let W=this.listeners.get($);if(W)W.add(T);else this.listeners.set($,new Set([T]));return this}onAny($){return this.globalListeners.add($),this}off($,T){let W=this.listeners.get($);if(W)if(T)W.delete(T);else this.listeners.delete($);return this}offAny($){return this.globalListeners.delete($),this}}class cV extends XY{in;out;id="no_id_retrieved";disposalFunctions=[];constructor($){super((...T)=>{return this.out.next(T),this});this.id=$,this.in=new b$,this.out=new b$,this.in.subscribe("socket",(T)=>{this.handleEvent(...T)})}dispose(){for(let $ of this.disposalFunctions)$()}}class l9 extends XY{incompleteData="";unprocessedEvents=[];relays;relayServices;process;id="#####";log(...$){this.process.stderr.write(G6($.map((T)=>T instanceof uW?`{ ${T.toJSON().members.join(" | ")} }`:T))+"\x03")}logger={info:(...$)=>{this.log("i",...$)},warn:(...$)=>{this.log("w",...$)},error:(...$)=>{this.log("e",...$)}};constructor(){super(($,...T)=>{let W=JSON.stringify([$,...T]);return this.process.stdout.write(W+"\x03"),this});if(this.process=process,this.process.stdin.resume(),this.relays=new Map,this.relayServices=[],this.process.stdin.on("data",($)=>{let T=$.toString();this.unprocessedEvents.push(...T.split("\x03"));let W=this.unprocessedEvents.shift();this.incompleteData+=W??"";try{let X=JU(this.incompleteData);this.logger.info("\uD83C\uDFB0","received",X),this.handleEvent(...X);while(this.unprocessedEvents.length>0){let U=this.unprocessedEvents.shift();if(U){if(this.unprocessedEvents.length===0)this.incompleteData=U;let w=JU(U);this.handleEvent(...w)}}this.incompleteData=""}catch(X){if(X instanceof Error)this.logger.error("\u2757",X.message,X.cause,X.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 T=new cV(`user:${$}`);this.relays.set($,T),this.logger.info("\uD83D\uDD17","attaching services:",`[${[...this.relayServices.keys()].join(", ")}]`);for(let W of this.relayServices){let X=W(T);if(X)T.disposalFunctions.push(X)}this.on(`user:${$}`,(...W)=>{T.in.next(W)}),T.out.subscribe("socket",(W)=>{this.emit(...W)})}),this.on("user-leaves",($)=>{let T=this.relays.get($);if(this.off(`relay:${$}`),T)T.dispose(),this.relays.delete($)}),process.stdout.write("ALIVE")}relay($){this.logger.info("\uD83D\uDD17","running relay method"),this.relayServices.push($)}}var YG={};e0(YG,{xid:()=>KC,void:()=>fC,uuidv7:()=>zC,uuidv6:()=>GC,uuidv4:()=>YC,uuid:()=>wC,url:()=>HC,uppercase:()=>sU,unknown:()=>aY,union:()=>XG,undefined:()=>BC,ulid:()=>VC,uint64:()=>jC,uint32:()=>qC,tuple:()=>uC,trim:()=>XX,treeifyError:()=>X5,transform:()=>FF,toUpperCase:()=>YX,toLowerCase:()=>wX,toJSONSchema:()=>SH,templateLiteral:()=>aC,symbol:()=>IC,superRefine:()=>TA,success:()=>iC,stringbool:()=>TS,string:()=>gH,strictObject:()=>gC,startsWith:()=>$X,size:()=>iU,setErrorMap:()=>GS,set:()=>oC,safeParseAsync:()=>hH,safeParse:()=>yH,registry:()=>JY,regexes:()=>pT,regex:()=>tU,refine:()=>$A,record:()=>SK,readonly:()=>nK,property:()=>JH,promise:()=>sC,prettifyError:()=>w5,preprocess:()=>US,prefault:()=>cK,positive:()=>MH,pipe:()=>$G,partialRecord:()=>pC,parseAsync:()=>bH,parse:()=>fH,overwrite:()=>K0,optional:()=>sY,object:()=>hC,number:()=>KK,nullish:()=>nC,nullable:()=>eY,null:()=>NK,normalize:()=>UX,nonpositive:()=>NH,nonoptional:()=>uK,nonnegative:()=>LH,never:()=>TG,negative:()=>DH,nativeEnum:()=>lC,nanoid:()=>OC,nan:()=>tC,multipleOf:()=>lT,minSize:()=>rT,minLength:()=>YT,mime:()=>WX,maxSize:()=>nW,maxLength:()=>iW,map:()=>dC,lte:()=>V1,lt:()=>Z0,lowercase:()=>aU,looseObject:()=>mC,locales:()=>lU,literal:()=>fK,length:()=>tW,lazy:()=>aK,ksuid:()=>AC,keyof:()=>yC,jwt:()=>_C,json:()=>WS,iso:()=>iY,ipv6:()=>MC,ipv4:()=>EC,intersection:()=>qK,int64:()=>SC,int32:()=>PC,int:()=>mH,instanceof:()=>$S,includes:()=>eU,guid:()=>XC,gte:()=>B6,gt:()=>V0,globalRegistry:()=>o1,getErrorMap:()=>zS,function:()=>CH,formatError:()=>mU,float64:()=>vC,float32:()=>kC,flattenError:()=>gU,file:()=>rC,enum:()=>BK,endsWith:()=>TX,emoji:()=>FC,email:()=>UC,e164:()=>RC,discriminatedUnion:()=>cC,date:()=>bC,custom:()=>eC,cuid2:()=>ZC,cuid:()=>QC,core:()=>A0,config:()=>N4,coerce:()=>VF,clone:()=>a6,cidrv6:()=>NC,cidrv4:()=>DC,check:()=>eK,catch:()=>oK,boolean:()=>AK,bigint:()=>CC,base64url:()=>JC,base64:()=>LC,array:()=>YF,any:()=>xC,_default:()=>gK,_ZodString:()=>cH,ZodXID:()=>iH,ZodVoid:()=>_K,ZodUnknown:()=>JK,ZodUnion:()=>GF,ZodUndefined:()=>MK,ZodUUID:()=>E0,ZodURL:()=>pH,ZodULID:()=>nH,ZodType:()=>k$,ZodTuple:()=>CK,ZodTransform:()=>HF,ZodTemplateLiteral:()=>iK,ZodSymbol:()=>EK,ZodSuccess:()=>pK,ZodStringFormat:()=>W4,ZodString:()=>HX,ZodSet:()=>IK,ZodRecord:()=>zF,ZodRealError:()=>aW,ZodReadonly:()=>rK,ZodPromise:()=>sK,ZodPrefault:()=>mK,ZodPipe:()=>ZF,ZodOptional:()=>OF,ZodObject:()=>UG,ZodNumberFormat:()=>sW,ZodNumber:()=>FX,ZodNullable:()=>yK,ZodNull:()=>DK,ZodNonOptional:()=>QF,ZodNever:()=>RK,ZodNanoID:()=>oH,ZodNaN:()=>lK,ZodMap:()=>jK,ZodLiteral:()=>xK,ZodLazy:()=>tK,ZodKSUID:()=>tH,ZodJWT:()=>XF,ZodIssueCode:()=>XS,ZodIntersection:()=>PK,ZodISOTime:()=>rY,ZodISODuration:()=>nY,ZodISODateTime:()=>oY,ZodISODate:()=>lY,ZodIPv6:()=>sH,ZodIPv4:()=>aH,ZodGUID:()=>tY,ZodFile:()=>bK,ZodError:()=>TC,ZodEnum:()=>zX,ZodEmoji:()=>dH,ZodEmail:()=>uH,ZodE164:()=>UF,ZodDiscriminatedUnion:()=>vK,ZodDefault:()=>hK,ZodDate:()=>WG,ZodCustom:()=>wG,ZodCatch:()=>dK,ZodCUID2:()=>rH,ZodCUID:()=>lH,ZodCIDRv6:()=>$F,ZodCIDRv4:()=>eH,ZodBoolean:()=>OX,ZodBigIntFormat:()=>wF,ZodBigInt:()=>QX,ZodBase64URL:()=>WF,ZodBase64:()=>TF,ZodArray:()=>kK,ZodAny:()=>LK,TimePrecision:()=>o3,NEVER:()=>YS,$output:()=>c3,$input:()=>u3,$brand:()=>r9});var A0={};e0(A0,{version:()=>T7,util:()=>o,treeifyError:()=>X5,toJSONSchema:()=>SH,toDotPath:()=>dV,safeParseAsync:()=>G5,safeParse:()=>Y5,registry:()=>JY,regexes:()=>pT,prettifyError:()=>w5,parseAsync:()=>FY,parse:()=>zY,locales:()=>lU,isValidJWT:()=>zK,isValidBase64URL:()=>GK,isValidBase64:()=>J7,globalRegistry:()=>o1,globalConfig:()=>CU,function:()=>CH,formatError:()=>mU,flattenError:()=>gU,config:()=>N4,clone:()=>a6,_xid:()=>xY,_void:()=>VH,_uuidv7:()=>PY,_uuidv6:()=>vY,_uuidv4:()=>kY,_uuid:()=>_Y,_url:()=>qY,_uppercase:()=>sU,_unknown:()=>rW,_union:()=>Bq,_undefined:()=>FH,_ulid:()=>BY,_uint64:()=>zH,_uint32:()=>WH,_tuple:()=>RH,_trim:()=>XX,_transform:()=>uq,_toUpperCase:()=>YX,_toLowerCase:()=>wX,_templateLiteral:()=>aq,_symbol:()=>HH,_success:()=>rq,_stringbool:()=>PH,_string:()=>p3,_startsWith:()=>$X,_size:()=>iU,_set:()=>hq,_safeParseAsync:()=>QY,_safeParse:()=>OY,_regex:()=>tU,_refine:()=>vH,_record:()=>bq,_readonly:()=>tq,_property:()=>JH,_promise:()=>eq,_positive:()=>MH,_pipe:()=>iq,_parseAsync:()=>HY,_parse:()=>GY,_overwrite:()=>K0,_optional:()=>pq,_number:()=>t3,_nullable:()=>dq,_null:()=>OH,_normalize:()=>UX,_nonpositive:()=>NH,_nonoptional:()=>lq,_nonnegative:()=>LH,_never:()=>ZH,_negative:()=>DH,_nativeEnum:()=>mq,_nanoid:()=>SY,_nan:()=>EH,_multipleOf:()=>lT,_minSize:()=>rT,_minLength:()=>YT,_min:()=>B6,_mime:()=>WX,_maxSize:()=>nW,_maxLength:()=>iW,_max:()=>V1,_map:()=>yq,_lte:()=>V1,_lt:()=>Z0,_lowercase:()=>aU,_literal:()=>cq,_length:()=>tW,_lazy:()=>sq,_ksuid:()=>fY,_jwt:()=>pY,_isoTime:()=>n3,_isoDuration:()=>i3,_isoDateTime:()=>l3,_isoDate:()=>r3,_ipv6:()=>yY,_ipv4:()=>bY,_intersection:()=>fq,_int64:()=>GH,_int32:()=>TH,_int:()=>s3,_includes:()=>eU,_guid:()=>nU,_gte:()=>B6,_gt:()=>V0,_float64:()=>$H,_float32:()=>e3,_file:()=>_H,_enum:()=>gq,_endsWith:()=>TX,_emoji:()=>CY,_email:()=>RY,_e164:()=>uY,_discriminatedUnion:()=>xq,_default:()=>oq,_date:()=>KH,_custom:()=>kH,_cuid2:()=>IY,_cuid:()=>jY,_coercedString:()=>d3,_coercedNumber:()=>a3,_coercedDate:()=>AH,_coercedBoolean:()=>XH,_coercedBigint:()=>YH,_cidrv6:()=>gY,_cidrv4:()=>hY,_catch:()=>nq,_boolean:()=>UH,_bigint:()=>wH,_base64url:()=>cY,_base64:()=>mY,_array:()=>GX,_any:()=>QH,TimePrecision:()=>o3,JSONSchemaGenerator:()=>dY,JSONSchema:()=>QK,Doc:()=>AY,$output:()=>c3,$input:()=>u3,$constructor:()=>k,$brand:()=>r9,$ZodXID:()=>Q7,$ZodVoid:()=>x7,$ZodUnknown:()=>lW,$ZodUnion:()=>LY,$ZodUndefined:()=>S7,$ZodUUID:()=>X7,$ZodURL:()=>Y7,$ZodULID:()=>O7,$ZodType:()=>K$,$ZodTuple:()=>oT,$ZodTransform:()=>pU,$ZodTemplateLiteral:()=>$3,$ZodSymbol:()=>C7,$ZodSuccess:()=>t7,$ZodStringFormat:()=>r$,$ZodString:()=>dT,$ZodSet:()=>c7,$ZodRegistry:()=>rU,$ZodRecord:()=>g7,$ZodRealError:()=>dW,$ZodReadonly:()=>e7,$ZodPromise:()=>T3,$ZodPrefault:()=>n7,$ZodPipe:()=>dU,$ZodOptional:()=>o7,$ZodObject:()=>b7,$ZodNumberFormat:()=>P7,$ZodNumber:()=>DY,$ZodNullable:()=>l7,$ZodNull:()=>j7,$ZodNonOptional:()=>i7,$ZodNever:()=>B7,$ZodNanoID:()=>z7,$ZodNaN:()=>s7,$ZodMap:()=>m7,$ZodLiteral:()=>p7,$ZodLazy:()=>W3,$ZodKSUID:()=>Z7,$ZodJWT:()=>v7,$ZodIntersection:()=>h7,$ZodISOTime:()=>A7,$ZodISODuration:()=>E7,$ZodISODateTime:()=>V7,$ZodISODate:()=>K7,$ZodIPv6:()=>D7,$ZodIPv4:()=>M7,$ZodGUID:()=>U7,$ZodFunction:()=>qH,$ZodFile:()=>d7,$ZodError:()=>hU,$ZodEnum:()=>u7,$ZodEmoji:()=>G7,$ZodEmail:()=>w7,$ZodE164:()=>k7,$ZodDiscriminatedUnion:()=>y7,$ZodDefault:()=>r7,$ZodDate:()=>f7,$ZodCustom:()=>U3,$ZodCheckUpperCase:()=>n5,$ZodCheckStringFormat:()=>oW,$ZodCheckStartsWith:()=>t5,$ZodCheckSizeEquals:()=>u5,$ZodCheckRegex:()=>l5,$ZodCheckProperty:()=>s5,$ZodCheckOverwrite:()=>$7,$ZodCheckNumberFormat:()=>h5,$ZodCheckMultipleOf:()=>y5,$ZodCheckMinSize:()=>c5,$ZodCheckMinLength:()=>d5,$ZodCheckMimeType:()=>e5,$ZodCheckMaxSize:()=>m5,$ZodCheckMaxLength:()=>p5,$ZodCheckLowerCase:()=>r5,$ZodCheckLessThan:()=>VY,$ZodCheckLengthEquals:()=>o5,$ZodCheckIncludes:()=>i5,$ZodCheckGreaterThan:()=>KY,$ZodCheckEndsWith:()=>a5,$ZodCheckBigIntFormat:()=>g5,$ZodCheck:()=>z4,$ZodCatch:()=>a7,$ZodCUID2:()=>F7,$ZodCUID:()=>H7,$ZodCIDRv6:()=>L7,$ZodCIDRv4:()=>N7,$ZodBoolean:()=>cU,$ZodBigIntFormat:()=>q7,$ZodBigInt:()=>NY,$ZodBase64URL:()=>_7,$ZodBase64:()=>R7,$ZodAsyncError:()=>O0,$ZodArray:()=>uU,$ZodAny:()=>I7});function k($,T,W){function X(G,H){var z;Object.defineProperty(G,"_zod",{value:G._zod??{},enumerable:!1}),(z=G._zod).traits??(z.traits=new Set),G._zod.traits.add($),T(G,H);for(let F in Y.prototype)if(!(F in G))Object.defineProperty(G,F,{value:Y.prototype[F].bind(G)});G._zod.constr=Y,G._zod.def=H}let U=W?.Parent??Object;class w extends U{}Object.defineProperty(w,"name",{value:$});function Y(G){var H;let z=W?.Parent?new w:this;X(z,G),(H=z._zod).deferred??(H.deferred=[]);for(let F of z._zod.deferred)F();return z}return Object.defineProperty(Y,"init",{value:X}),Object.defineProperty(Y,Symbol.hasInstance,{value:(G)=>{if(W?.Parent&&G instanceof W.Parent)return!0;return G?._zod?.traits?.has($)}}),Object.defineProperty(Y,"name",{value:$}),Y}var r9=Symbol("zod_brand");class O0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var CU={};function N4($){if($)Object.assign(CU,$);return CU}var o={};e0(o,{unwrapMessage:()=>SU,stringifyPrimitive:()=>n,required:()=>xP,randomString:()=>wY,propertyKeyTypes:()=>fU,promiseAllObject:()=>kP,primitiveTypes:()=>e9,prefixIssues:()=>I6,pick:()=>CP,partial:()=>BP,optionalKeys:()=>$5,omit:()=>SP,numKeys:()=>vP,nullish:()=>wT,normalizeParams:()=>p,merge:()=>IP,jsonStringifyReplacer:()=>i9,joinValues:()=>x,issue:()=>U5,isPlainObject:()=>xU,isObject:()=>pW,getSizableOrigin:()=>bU,getParsedType:()=>PP,getLengthableOrigin:()=>yU,getEnumValues:()=>jU,getElementAtPath:()=>_P,floatSafeRemainder:()=>t9,finalizeIssue:()=>s6,extend:()=>jP,escapeRegex:()=>Q0,esc:()=>mT,defineLazy:()=>h$,createTransparentProxy:()=>qP,clone:()=>a6,cleanRegex:()=>BU,cleanEnum:()=>fP,captureStackTrace:()=>YY,cached:()=>IU,assignProp:()=>a9,assertNotEqual:()=>NP,assertNever:()=>JP,assertIs:()=>LP,assertEqual:()=>DP,assert:()=>RP,allowsEval:()=>s9,aborted:()=>cT,NUMBER_FORMAT_RANGES:()=>T5,Class:()=>uV,BIGINT_FORMAT_RANGES:()=>W5});function DP($){return $}function NP($){return $}function LP($){}function JP($){throw new Error}function RP($){}function jU($){let T=Object.values($).filter((X)=>typeof X==="number");return Object.entries($).filter(([X,U])=>T.indexOf(+X)===-1).map(([X,U])=>U)}function x($,T="|"){return $.map((W)=>n(W)).join(T)}function i9($,T){if(typeof T==="bigint")return T.toString();return T}function IU($){return{get value(){{let W=$();return Object.defineProperty(this,"value",{value:W}),W}throw new Error("cached value already set")}}}function wT($){return $===null||$===void 0}function BU($){let T=$.startsWith("^")?1:0,W=$.endsWith("$")?$.length-1:$.length;return $.slice(T,W)}function t9($,T){let W=($.toString().split(".")[1]||"").length,X=(T.toString().split(".")[1]||"").length,U=W>X?W:X,w=Number.parseInt($.toFixed(U).replace(".","")),Y=Number.parseInt(T.toFixed(U).replace(".",""));return w%Y/10**U}function h$($,T,W){Object.defineProperty($,T,{get(){{let U=W();return $[T]=U,U}throw new Error("cached value already set")},set(U){Object.defineProperty($,T,{value:U})},configurable:!0})}function a9($,T,W){Object.defineProperty($,T,{value:W,writable:!0,enumerable:!0,configurable:!0})}function _P($,T){if(!T)return $;return T.reduce((W,X)=>W?.[X],$)}function kP($){let T=Object.keys($),W=T.map((X)=>$[X]);return Promise.all(W).then((X)=>{let U={};for(let w=0;w<T.length;w++)U[T[w]]=X[w];return U})}function wY($=10){let W="";for(let X=0;X<$;X++)W+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return W}function mT($){return JSON.stringify($)}var YY=Error.captureStackTrace?Error.captureStackTrace:(...$)=>{};function pW($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var s9=IU(()=>{if(typeof navigator!=="undefined"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function xU($){if(pW($)===!1)return!1;let T=$.constructor;if(T===void 0)return!0;let W=T.prototype;if(pW(W)===!1)return!1;if(Object.prototype.hasOwnProperty.call(W,"isPrototypeOf")===!1)return!1;return!0}function vP($){let T=0;for(let W in $)if(Object.prototype.hasOwnProperty.call($,W))T++;return T}var PP=($)=>{let T=typeof $;switch(T){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: ${T}`)}},fU=new Set(["string","number","symbol"]),e9=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Q0($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a6($,T,W){let X=new $._zod.constr(T??$._zod.def);if(!T||W?.parent)X._zod.parent=$;return X}function p($){let T=$;if(!T)return{};if(typeof T==="string")return{error:()=>T};if(T?.message!==void 0){if(T?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");T.error=T.message}if(delete T.message,typeof T.error==="string")return{...T,error:()=>T.error};return T}function qP($){let T;return new Proxy({},{get(W,X,U){return T??(T=$()),Reflect.get(T,X,U)},set(W,X,U,w){return T??(T=$()),Reflect.set(T,X,U,w)},has(W,X){return T??(T=$()),Reflect.has(T,X)},deleteProperty(W,X){return T??(T=$()),Reflect.deleteProperty(T,X)},ownKeys(W){return T??(T=$()),Reflect.ownKeys(T)},getOwnPropertyDescriptor(W,X){return T??(T=$()),Reflect.getOwnPropertyDescriptor(T,X)},defineProperty(W,X,U){return T??(T=$()),Reflect.defineProperty(T,X,U)}})}function n($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function $5($){return Object.keys($).filter((T)=>{return $[T]._zod.optin==="optional"&&$[T]._zod.optout==="optional"})}var T5={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]},W5={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function CP($,T){let W={},X=$._zod.def;for(let U in T){if(!(U in X.shape))throw new Error(`Unrecognized key: "${U}"`);if(!T[U])continue;W[U]=X.shape[U]}return a6($,{...$._zod.def,shape:W,checks:[]})}function SP($,T){let W={...$._zod.def.shape},X=$._zod.def;for(let U in T){if(!(U in X.shape))throw new Error(`Unrecognized key: "${U}"`);if(!T[U])continue;delete W[U]}return a6($,{...$._zod.def,shape:W,checks:[]})}function jP($,T){let W={...$._zod.def,get shape(){let X={...$._zod.def.shape,...T};return a9(this,"shape",X),X},checks:[]};return a6($,W)}function IP($,T){return a6($,{...$._zod.def,get shape(){let W={...$._zod.def.shape,...T._zod.def.shape};return a9(this,"shape",W),W},catchall:T._zod.def.catchall,checks:[]})}function BP($,T,W){let X=T._zod.def.shape,U={...X};if(W)for(let w in W){if(!(w in X))throw new Error(`Unrecognized key: "${w}"`);if(!W[w])continue;U[w]=$?new $({type:"optional",innerType:X[w]}):X[w]}else for(let w in X)U[w]=$?new $({type:"optional",innerType:X[w]}):X[w];return a6(T,{...T._zod.def,shape:U,checks:[]})}function xP($,T,W){let X=T._zod.def.shape,U={...X};if(W)for(let w in W){if(!(w in U))throw new Error(`Unrecognized key: "${w}"`);if(!W[w])continue;U[w]=new $({type:"nonoptional",innerType:X[w]})}else for(let w in X)U[w]=new $({type:"nonoptional",innerType:X[w]});return a6(T,{...T._zod.def,shape:U,checks:[]})}function cT($,T=0){for(let W=T;W<$.issues.length;W++)if($.issues[W].continue!==!0)return!0;return!1}function I6($,T){return T.map((W)=>{var X;return(X=W).path??(X.path=[]),W.path.unshift($),W})}function SU($){return typeof $==="string"?$:$?.message}function s6($,T,W){let X={...$,path:$.path??[]};if(!$.message){let U=SU($.inst?._zod.def?.error?.($))??SU(T?.error?.($))??SU(W.customError?.($))??SU(W.localeError?.($))??"Invalid input";X.message=U}if(delete X.inst,delete X.continue,!T?.reportInput)delete X.input;return X}function bU($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function yU($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function U5(...$){let[T,W,X]=$;if(typeof T==="string")return{message:T,code:"custom",input:W,inst:X};return{...T}}function fP($){return Object.entries($).filter(([T,W])=>{return Number.isNaN(Number.parseInt(T,10))}).map((T)=>T[1])}class uV{constructor(...$){}}var pV=($,T)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:T,enumerable:!1}),Object.defineProperty($,"message",{get(){return JSON.stringify(T,i9,2)},enumerable:!0})},hU=k("$ZodError",pV),dW=k("$ZodError",pV,{Parent:Error});function gU($,T=(W)=>W.message){let W={},X=[];for(let U of $.issues)if(U.path.length>0)W[U.path[0]]=W[U.path[0]]||[],W[U.path[0]].push(T(U));else X.push(T(U));return{formErrors:X,fieldErrors:W}}function mU($,T){let W=T||function(w){return w.message},X={_errors:[]},U=(w)=>{for(let Y of w.issues)if(Y.code==="invalid_union"&&Y.errors.length)Y.errors.map((G)=>U({issues:G}));else if(Y.code==="invalid_key")U({issues:Y.issues});else if(Y.code==="invalid_element")U({issues:Y.issues});else if(Y.path.length===0)X._errors.push(W(Y));else{let G=X,H=0;while(H<Y.path.length){let z=Y.path[H];if(H!==Y.path.length-1)G[z]=G[z]||{_errors:[]};else G[z]=G[z]||{_errors:[]},G[z]._errors.push(W(Y));G=G[z],H++}}};return U($),X}function X5($,T){let W=T||function(w){return w.message},X={errors:[]},U=(w,Y=[])=>{var G,H;for(let z of w.issues)if(z.code==="invalid_union"&&z.errors.length)z.errors.map((F)=>U({issues:F},z.path));else if(z.code==="invalid_key")U({issues:z.issues},z.path);else if(z.code==="invalid_element")U({issues:z.issues},z.path);else{let F=[...Y,...z.path];if(F.length===0){X.errors.push(W(z));continue}let O=X,Q=0;while(Q<F.length){let Z=F[Q],K=Q===F.length-1;if(typeof Z==="string")O.properties??(O.properties={}),(G=O.properties)[Z]??(G[Z]={errors:[]}),O=O.properties[Z];else O.items??(O.items=[]),(H=O.items)[Z]??(H[Z]={errors:[]}),O=O.items[Z];if(K)O.errors.push(W(z));Q++}}};return U($),X}function dV($){let T=[];for(let W of $)if(typeof W==="number")T.push(`[${W}]`);else if(typeof W==="symbol")T.push(`[${JSON.stringify(String(W))}]`);else if(/[^\w$]/.test(W))T.push(`[${JSON.stringify(W)}]`);else{if(T.length)T.push(".");T.push(W)}return T.join("")}function w5($){let T=[],W=[...$.issues].sort((X,U)=>X.path.length-U.path.length);for(let X of W)if(T.push(`\u2716 ${X.message}`),X.path?.length)T.push(` \u2192 at ${dV(X.path)}`);return T.join(`
|
|
6
|
-
`)}var GY=($)=>(T,W,X,U)=>{let w=X?Object.assign(X,{async:!1}):{async:!1},Y=T._zod.run({value:W,issues:[]},w);if(Y instanceof Promise)throw new O0;if(Y.issues.length){let G=new(U?.Err??$)(Y.issues.map((H)=>s6(H,w,N4())));throw YY(G,U?.callee),G}return Y.value},zY=GY(dW),HY=($)=>async(T,W,X,U)=>{let w=X?Object.assign(X,{async:!0}):{async:!0},Y=T._zod.run({value:W,issues:[]},w);if(Y instanceof Promise)Y=await Y;if(Y.issues.length){let G=new(U?.Err??$)(Y.issues.map((H)=>s6(H,w,N4())));throw YY(G,U?.callee),G}return Y.value},FY=HY(dW),OY=($)=>(T,W,X)=>{let U=X?{...X,async:!1}:{async:!1},w=T._zod.run({value:W,issues:[]},U);if(w instanceof Promise)throw new O0;return w.issues.length?{success:!1,error:new($??hU)(w.issues.map((Y)=>s6(Y,U,N4())))}:{success:!0,data:w.value}},Y5=OY(dW),QY=($)=>async(T,W,X)=>{let U=X?Object.assign(X,{async:!0}):{async:!0},w=T._zod.run({value:W,issues:[]},U);if(w instanceof Promise)w=await w;return w.issues.length?{success:!1,error:new $(w.issues.map((Y)=>s6(Y,U,N4())))}:{success:!0,data:w.value}},G5=QY(dW);var pT={};e0(pT,{xid:()=>O5,uuid7:()=>mP,uuid6:()=>gP,uuid4:()=>hP,uuid:()=>uT,uppercase:()=>b5,unicodeEmail:()=>pP,undefined:()=>x5,ulid:()=>F5,time:()=>v5,string:()=>q5,rfc5322Email:()=>uP,number:()=>j5,null:()=>B5,nanoid:()=>Z5,lowercase:()=>f5,ksuid:()=>Q5,ipv6:()=>D5,ipv4:()=>M5,integer:()=>S5,html5Email:()=>cP,hostname:()=>R5,guid:()=>K5,extendedDuration:()=>yP,emoji:()=>E5,email:()=>A5,e164:()=>_5,duration:()=>V5,domain:()=>lP,datetime:()=>P5,date:()=>k5,cuid2:()=>H5,cuid:()=>z5,cidrv6:()=>L5,cidrv4:()=>N5,browserEmail:()=>dP,boolean:()=>I5,bigint:()=>C5,base64url:()=>ZY,base64:()=>J5,_emoji:()=>oP});var z5=/^[cC][^\s-]{8,}$/,H5=/^[0-9a-z]+$/,F5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,O5=/^[0-9a-vA-V]{20}$/,Q5=/^[A-Za-z0-9]{27}$/,Z5=/^[a-zA-Z0-9_-]{21}$/,V5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,yP=/^[-+]?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)?)??$/,K5=/^([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})$/,uT=($)=>{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})$`)},hP=uT(4),gP=uT(6),mP=uT(7),A5=/^(?!\.)(?!.*\.\.)([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])?)*$/,uP=/^(([^<>()\[\]\\.,;:\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,}))$/,pP=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,dP=/^[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])?)*$/,oP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function E5(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var M5=/^(?:(?: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])$/,D5=/^(([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})$/,N5=/^((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])$/,L5=/^(([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])$/,J5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ZY=/^[A-Za-z0-9_-]*$/,R5=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,lP=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,_5=/^\+(?:[0-9]){6,14}[0-9]$/,oV="(?:(?:\\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])))",k5=new RegExp(`^${oV}$`);function lV($){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 v5($){return new RegExp(`^${lV($)}$`)}function P5($){let T=lV({precision:$.precision}),W=["Z"];if($.local)W.push("");if($.offset)W.push("([+-]\\d{2}:\\d{2})");let X=`${T}(?:${W.join("|")})`;return new RegExp(`^${oV}T(?:${X})$`)}var q5=($)=>{let T=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${T}$`)},C5=/^\d+n?$/,S5=/^\d+$/,j5=/^-?\d+(?:\.\d+)?/i,I5=/true|false/i,B5=/null/i;var x5=/undefined/i;var f5=/^[^A-Z]*$/,b5=/^[^a-z]*$/;var z4=k("$ZodCheck",($,T)=>{var W;$._zod??($._zod={}),$._zod.def=T,(W=$._zod).onattach??(W.onattach=[])}),nV={number:"number",bigint:"bigint",object:"date"},VY=k("$ZodCheckLessThan",($,T)=>{z4.init($,T);let W=nV[typeof T.value];$._zod.onattach.push((X)=>{let U=X._zod.bag,w=(T.inclusive?U.maximum:U.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(T.value<w)if(T.inclusive)U.maximum=T.value;else U.exclusiveMaximum=T.value}),$._zod.check=(X)=>{if(T.inclusive?X.value<=T.value:X.value<T.value)return;X.issues.push({origin:W,code:"too_big",maximum:T.value,input:X.value,inclusive:T.inclusive,inst:$,continue:!T.abort})}}),KY=k("$ZodCheckGreaterThan",($,T)=>{z4.init($,T);let W=nV[typeof T.value];$._zod.onattach.push((X)=>{let U=X._zod.bag,w=(T.inclusive?U.minimum:U.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(T.value>w)if(T.inclusive)U.minimum=T.value;else U.exclusiveMinimum=T.value}),$._zod.check=(X)=>{if(T.inclusive?X.value>=T.value:X.value>T.value)return;X.issues.push({origin:W,code:"too_small",minimum:T.value,input:X.value,inclusive:T.inclusive,inst:$,continue:!T.abort})}}),y5=k("$ZodCheckMultipleOf",($,T)=>{z4.init($,T),$._zod.onattach.push((W)=>{var X;(X=W._zod.bag).multipleOf??(X.multipleOf=T.value)}),$._zod.check=(W)=>{if(typeof W.value!==typeof T.value)throw new Error("Cannot mix number and bigint in multiple_of check.");if(typeof W.value==="bigint"?W.value%T.value===BigInt(0):t9(W.value,T.value)===0)return;W.issues.push({origin:typeof W.value,code:"not_multiple_of",divisor:T.value,input:W.value,inst:$,continue:!T.abort})}}),h5=k("$ZodCheckNumberFormat",($,T)=>{z4.init($,T),T.format=T.format||"float64";let W=T.format?.includes("int"),X=W?"int":"number",[U,w]=T5[T.format];$._zod.onattach.push((Y)=>{let G=Y._zod.bag;if(G.format=T.format,G.minimum=U,G.maximum=w,W)G.pattern=S5}),$._zod.check=(Y)=>{let G=Y.value;if(W){if(!Number.isInteger(G)){Y.issues.push({expected:X,format:T.format,code:"invalid_type",input:G,inst:$});return}if(!Number.isSafeInteger(G)){if(G>0)Y.issues.push({input:G,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:X,continue:!T.abort});else Y.issues.push({input:G,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:X,continue:!T.abort});return}}if(G<U)Y.issues.push({origin:"number",input:G,code:"too_small",minimum:U,inclusive:!0,inst:$,continue:!T.abort});if(G>w)Y.issues.push({origin:"number",input:G,code:"too_big",maximum:w,inst:$})}}),g5=k("$ZodCheckBigIntFormat",($,T)=>{z4.init($,T);let[W,X]=W5[T.format];$._zod.onattach.push((U)=>{let w=U._zod.bag;w.format=T.format,w.minimum=W,w.maximum=X}),$._zod.check=(U)=>{let w=U.value;if(w<W)U.issues.push({origin:"bigint",input:w,code:"too_small",minimum:W,inclusive:!0,inst:$,continue:!T.abort});if(w>X)U.issues.push({origin:"bigint",input:w,code:"too_big",maximum:X,inst:$})}}),m5=k("$ZodCheckMaxSize",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let X=W.value;return!wT(X)&&X.size!==void 0},$._zod.onattach.push((W)=>{let X=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(T.maximum<X)W._zod.bag.maximum=T.maximum}),$._zod.check=(W)=>{let X=W.value;if(X.size<=T.maximum)return;W.issues.push({origin:bU(X),code:"too_big",maximum:T.maximum,input:X,inst:$,continue:!T.abort})}}),c5=k("$ZodCheckMinSize",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let X=W.value;return!wT(X)&&X.size!==void 0},$._zod.onattach.push((W)=>{let X=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(T.minimum>X)W._zod.bag.minimum=T.minimum}),$._zod.check=(W)=>{let X=W.value;if(X.size>=T.minimum)return;W.issues.push({origin:bU(X),code:"too_small",minimum:T.minimum,input:X,inst:$,continue:!T.abort})}}),u5=k("$ZodCheckSizeEquals",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let X=W.value;return!wT(X)&&X.size!==void 0},$._zod.onattach.push((W)=>{let X=W._zod.bag;X.minimum=T.size,X.maximum=T.size,X.size=T.size}),$._zod.check=(W)=>{let X=W.value,U=X.size;if(U===T.size)return;let w=U>T.size;W.issues.push({origin:bU(X),...w?{code:"too_big",maximum:T.size}:{code:"too_small",minimum:T.size},input:W.value,inst:$,continue:!T.abort})}}),p5=k("$ZodCheckMaxLength",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let X=W.value;return!wT(X)&&X.length!==void 0},$._zod.onattach.push((W)=>{let X=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(T.maximum<X)W._zod.bag.maximum=T.maximum}),$._zod.check=(W)=>{let X=W.value;if(X.length<=T.maximum)return;let w=yU(X);W.issues.push({origin:w,code:"too_big",maximum:T.maximum,inclusive:!0,input:X,inst:$,continue:!T.abort})}}),d5=k("$ZodCheckMinLength",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let X=W.value;return!wT(X)&&X.length!==void 0},$._zod.onattach.push((W)=>{let X=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(T.minimum>X)W._zod.bag.minimum=T.minimum}),$._zod.check=(W)=>{let X=W.value;if(X.length>=T.minimum)return;let w=yU(X);W.issues.push({origin:w,code:"too_small",minimum:T.minimum,inclusive:!0,input:X,inst:$,continue:!T.abort})}}),o5=k("$ZodCheckLengthEquals",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let X=W.value;return!wT(X)&&X.length!==void 0},$._zod.onattach.push((W)=>{let X=W._zod.bag;X.minimum=T.length,X.maximum=T.length,X.length=T.length}),$._zod.check=(W)=>{let X=W.value,U=X.length;if(U===T.length)return;let w=yU(X),Y=U>T.length;W.issues.push({origin:w,...Y?{code:"too_big",maximum:T.length}:{code:"too_small",minimum:T.length},input:W.value,inst:$,continue:!T.abort})}}),oW=k("$ZodCheckStringFormat",($,T)=>{var W;z4.init($,T),$._zod.onattach.push((X)=>{let U=X._zod.bag;if(U.format=T.format,T.pattern)U.patterns??(U.patterns=new Set),U.patterns.add(T.pattern)}),(W=$._zod).check??(W.check=(X)=>{if(!T.pattern)throw new Error("Not implemented.");if(T.pattern.lastIndex=0,T.pattern.test(X.value))return;X.issues.push({origin:"string",code:"invalid_format",format:T.format,input:X.value,...T.pattern?{pattern:T.pattern.toString()}:{},inst:$,continue:!T.abort})})}),l5=k("$ZodCheckRegex",($,T)=>{oW.init($,T),$._zod.check=(W)=>{if(T.pattern.lastIndex=0,T.pattern.test(W.value))return;W.issues.push({origin:"string",code:"invalid_format",format:"regex",input:W.value,pattern:T.pattern.toString(),inst:$,continue:!T.abort})}}),r5=k("$ZodCheckLowerCase",($,T)=>{T.pattern??(T.pattern=f5),oW.init($,T)}),n5=k("$ZodCheckUpperCase",($,T)=>{T.pattern??(T.pattern=b5),oW.init($,T)}),i5=k("$ZodCheckIncludes",($,T)=>{z4.init($,T);let W=Q0(T.includes),X=new RegExp(typeof T.position==="number"?`^.{${T.position}}${W}`:W);T.pattern=X,$._zod.onattach.push((U)=>{let w=U._zod.bag;w.patterns??(w.patterns=new Set),w.patterns.add(X)}),$._zod.check=(U)=>{if(U.value.includes(T.includes,T.position))return;U.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:T.includes,input:U.value,inst:$,continue:!T.abort})}}),t5=k("$ZodCheckStartsWith",($,T)=>{z4.init($,T);let W=new RegExp(`^${Q0(T.prefix)}.*`);T.pattern??(T.pattern=W),$._zod.onattach.push((X)=>{let U=X._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(W)}),$._zod.check=(X)=>{if(X.value.startsWith(T.prefix))return;X.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:T.prefix,input:X.value,inst:$,continue:!T.abort})}}),a5=k("$ZodCheckEndsWith",($,T)=>{z4.init($,T);let W=new RegExp(`.*${Q0(T.suffix)}$`);T.pattern??(T.pattern=W),$._zod.onattach.push((X)=>{let U=X._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(W)}),$._zod.check=(X)=>{if(X.value.endsWith(T.suffix))return;X.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:T.suffix,input:X.value,inst:$,continue:!T.abort})}});function rV($,T,W){if($.issues.length)T.issues.push(...I6(W,$.issues))}var s5=k("$ZodCheckProperty",($,T)=>{z4.init($,T),$._zod.check=(W)=>{let X=T.schema._zod.run({value:W.value[T.property],issues:[]},{});if(X instanceof Promise)return X.then((U)=>rV(U,W,T.property));rV(X,W,T.property);return}}),e5=k("$ZodCheckMimeType",($,T)=>{z4.init($,T);let W=new Set(T.mime);$._zod.onattach.push((X)=>{X._zod.bag.mime=T.mime}),$._zod.check=(X)=>{if(W.has(X.value.type))return;X.issues.push({code:"invalid_value",values:T.mime,input:X.value.type,inst:$})}}),$7=k("$ZodCheckOverwrite",($,T)=>{z4.init($,T),$._zod.check=(W)=>{W.value=T.tx(W.value)}});class AY{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 W=$.split(`
|
|
7
|
-
`).filter((w)=>w),
|
|
8
|
-
`))}}var
|
|
3
|
+
var DP=Object.create;var{getPrototypeOf:NP,defineProperty:f9,getOwnPropertyNames:JP}=Object;var LP=Object.prototype.hasOwnProperty;var RP=($,T,W)=>{W=$!=null?DP(NP($)):{};let U=T||!$||!$.__esModule?f9(W,"default",{value:$,enumerable:!0}):W;for(let X of JP($))if(!LP.call(U,X))f9(U,X,{get:()=>$[X],enumerable:!0});return U};var _P=($,T)=>()=>(T||$((T={exports:{}}).exports,T),T.exports);var e0=($,T)=>{for(var W in T)f9($,W,{get:T[W],enumerable:!0,configurable:!0,set:(U)=>T[W]=()=>U})};var iy=($,T)=>()=>($&&(T=$($=0)),T);var DV=import.meta.require;var VA=_P((cp,ZA)=>{var Z8=DV("os"),V8=DV("path");function QA($){let T=process.env.XDG_CACHE_HOME||V8.join(Z8.homedir(),".cache");return V8.join(T,$)}function _S($){return V8.join(Z8.homedir(),"Library","Caches",$)}function kS($){let T=process.env.LOCALAPPDATA||V8.join(Z8.homedir(),"AppData","Local");return V8.join(T,$,"Cache")}var vS=function(){switch(Z8.platform()){case"darwin":return _S;case"win32":return kS;case"aix":case"android":case"freebsd":case"linux":case"netbsd":case"openbsd":case"sunos":return QA;default:return console.error(`(node:${process.pid}) [cachedir] Warning: the platform "${Z8.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`),QA}}();ZA.exports=function $(T){if(typeof T!=="string")throw new TypeError("id is not a string");if(T.length===0)throw new Error("id cannot be empty");if(/[^0-9a-zA-Z-]/.test(T))throw new Error("id cannot contain special characters");return vS(T)}});class JX extends Promise{fate;resolve;reject;done=!1;constructor($){let T,W;super((U,X)=>{T=U,W=X});this.resolve=T,this.reject=W,this.use($ instanceof Promise?$:new Promise($))}pass($,T){if($===this.fate)this.resolve(T),this.done=!0}fail($,T){if($===this.fate)this.reject(T),this.done=!0}use($){if($ instanceof Promise){let T=$;this.fate=T,T.then((W)=>{this.pass(T,W)},(W)=>{this.fail(T,W)})}else this.resolve($),this.fate=void 0}}var ey=($,T,W=JV.STORE)=>{return NV(W,{key:`${$.key}:JSON`,get:({get:U})=>T.toJson(U($)),set:({set:U},X)=>{U($,T.fromJson(X))}})};function Wh($,T,W){return b9($,{key:`${T.key}:JSON`,get:(X)=>({get:w})=>{let Y=w(T,X);return W.toJson(Y)},set:(X)=>({set:w},Y)=>{w(T,X,W.fromJson(Y))}},["mutable","json"])}var LX=($)=>JSON.parse($),z6=($)=>JSON.stringify($),Uh=[Array.prototype,Boolean.prototype,Number.prototype,Object.prototype,String.prototype];function Q$($){while($.child!==null)$=$.child;return $}class aw{_buffer;_index=0;constructor($){let T;if(typeof $==="number")T=$;else T=$.length;this._buffer=Array.from({length:T})}get buffer(){return this._buffer}get index(){return this._index}add($){this._buffer[this._index]=$,this._index=(this._index+1)%this._buffer.length}copy(){let $=new aw([...this._buffer]);return $._index=this._index,$}}var kP={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 LV($,T){let W=z6(T),U=`${$.key}(${W})`,X=kP[$.type],w={key:U,type:X};return Object.assign(w,{family:{key:$.key,subKey:W}}),Object.assign(w,{counterfeit:!0}),w}function RX($){let T={key:$.key,type:$.type};if("family"in $)T.family=$.family;return T}var y9=($)=>(T,W,U,X,...w)=>{console[$](`${T} ${W} "${U}" ${X}`,...w)},vP={error:y9("error"),info:y9("info"),warn:y9("warn")};class h9{logLevel;filter;logger;constructor($,T,W=vP){this.logLevel=$,this.filter=T,this.logger=W}error=(...$)=>{let T=this.filter?.(...$)??!0;if(this.logLevel!==null){if(T===!0)this.logger.error(...$);else if(T!==!1)this.logger.error(...T)}};info=(...$)=>{let T=this.filter?.(...$)??!0;if(this.logLevel==="info"){if(T===!0)this.logger.info(...$);else if(T!==!1)this.logger.info(...T)}};warn=(...$)=>{let T=this.filter?.(...$)??!0;if(this.logLevel!=="error"&&this.logLevel!==null){if(T===!0)this.logger.warn(...$);else if(T!==!1)this.logger.warn(...T)}}}class o1{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=($,T)=>`${$}:${T}`;warn;getRelatedKeys($){return this.relations.get($)}addRelation($,T){let W=this.relations.get($),U=this.relations.get(T);if(W)W.add(T);else W=new Set([T]),this.relations.set($,W);if(U)U.add($);else U=new Set([$]),this.relations.set(T,U)}deleteRelation($,T){let W=this.relations.get($);if(W){if(W.delete(T),W.size===0)this.relations.delete($);let U=this.relations.get(T);if(U){if(U.delete($),U.size===0)this.relations.delete(T)}}}replaceRelationsUnsafely($,T){this.relations.set($,new Set(T));for(let W of T){let U=new Set().add($);this.relations.set(W,U)}}replaceRelationsSafely($,T){let W=this.relations.get($),U=this.isAType?.($)?$:void 0,X=U===void 0?$:void 0;if(W)for(let w of W){U??=w,X??=w;let Y=this.relations.get(w);if(Y){if(Y.size===1)this.relations.delete(w);else Y.delete($);this.contents.delete(this.makeContentKey(U,X))}}this.relations.set($,new Set(T));for(let w of T){let Y=this.relations.get(w);if(Y)Y.add($);else Y=new Set().add($),this.relations.set(w,Y)}}getContentInternal($){return this.contents.get($)}setContent($,T){this.contents.set($,T)}deleteContent($){this.contents.delete($)}constructor($,T){if(this.a=$.between[0],this.b=$.between[1],this.cardinality=$.cardinality,!T?.externalStore)this.relations=new Map($.relations?.map(([W,U])=>[W,new Set(U)])),this.contents=new Map($.contents);if(this.isAType=T?.isAType??null,this.isBType=T?.isBType??null,this.isContent=T?.isContent??null,T?.makeContentKey)this.makeContentKey=T.makeContentKey;if(T?.externalStore){let W=T.externalStore;if(this.has=(U,X)=>W.has(U,X),this.addRelation=(U,X)=>{W.addRelation(U,X)},this.deleteRelation=(U,X)=>{W.deleteRelation(U,X)},this.replaceRelationsSafely=(U,X)=>{W.replaceRelationsSafely(U,X)},this.replaceRelationsUnsafely=(U,X)=>{W.replaceRelationsUnsafely(U,X)},this.getRelatedKeys=(U)=>W.getRelatedKeys(U),W.getContent)this.getContentInternal=(U)=>{return W.getContent(U)},this.setContent=(U,X)=>{W.setContent(U,X)},this.deleteContent=(U)=>{W.deleteContent(U)};for(let[U,X]of $.relations??[]){let w=this.isAType?.(U)?U:void 0,Y=w===void 0?U:void 0;for(let G of X)w??=G,Y??=G,this.addRelation(w,Y)}for(let[U,X]of $.contents??[])this.setContent(U,X)}if(T?.warn)this.warn=T.warn}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([$,T])=>[$,[...T]]),contents:[...this.contents.entries()]}}set(...$){let T,W,U;switch($.length){case 1:{let X=$[0];T=X[this.a],W=X[this.b],U=void 0;break}case 2:{let X=$[0];if(typeof X==="string")[T,W]=$;else T=X[this.a],W=X[this.b],U=$[1];break}default:{T=$[0],W=$[1],U=$[2];break}}switch(this.cardinality){case"1:1":{let X=this.getRelatedKey(T);if(X&&X!==W)this.delete(T,X)}case"1:n":{let X=this.getRelatedKey(W);if(X&&X!==T)this.delete(X,W)}break;case"n:n":}if(U){let X=this.makeContentKey(T,W);this.setContent(X,U)}return this.addRelation(T,W),this}delete($,T){T=typeof T==="string"?T:$[this.b];let W=typeof $==="string"?$:$[this.a];if(W===void 0&&typeof T==="string"){let U=this.getRelatedKeys(T);if(U)for(let X of U)this.delete(X,T)}if(typeof W==="string"&&T===void 0){let U=this.getRelatedKeys(W);if(U)for(let X of U)this.delete(W,X)}if(typeof W==="string"&&typeof T==="string"){this.deleteRelation(W,T);let U=this.makeContentKey(W,T);this.deleteContent(U)}return this}getRelatedKey($){let T=this.getRelatedKeys($);if(T){if(T.size>1)this.warn?.(`${T.size} related keys were found for key "${$}": (${[...T].map((U)=>`"${U}"`).join(", ")}). Only one related key was expected.`);let W;for(let U of T){W=U;break}return W}}replaceRelations($,T,W){let U=!Array.isArray(T),X=U?Object.keys(T):T;if(W?.reckless)this.replaceRelationsUnsafely($,X);else this.replaceRelationsSafely($,X);if(U)for(let w of X){let Y=this.makeContentKey($,w),G=T[w];this.setContent(Y,G)}return this}getContent($,T){let W=this.makeContentKey($,T);return this.getContentInternal(W)}getRelationEntries($){let T=$[this.a],W=$[this.b];if(T!==void 0&&W===void 0){let U=this.getRelatedKeys(T);if(U)return[...U].map((X)=>{return[X,this.getContent(T,X)]})}if(T===void 0&&W!==void 0){let U=this.getRelatedKeys(W);if(U)return[...U].map((X)=>{return[X,this.getContent(X,W)]})}return[]}has($,T){if(T)return this.getRelatedKeys($)?.has(T)??!1;return this.relations.has($)}}class b${Subscriber;subscribers=new Map;subscribe($,T){return this.subscribers.set($,T),()=>{this.unsubscribe($)}}unsubscribe($){this.subscribers.delete($)}next($){let T=this.subscribers.values();for(let W of T)W($)}}class g9 extends b${state;constructor($){super();this.state=$}next($){this.state=$,super.next($)}}function $T($){return"epoch"in $.transactionMeta}function t6($){return"phase"in $.transactionMeta}function RV($){return $[0].toUpperCase()+$.slice(1)}function sw($){return $.type.split("_").map(RV).join(" ")}class _X extends Error{constructor($,T){super(`${sw($)} ${z6($.key)} not found in store "${T.config.name}".`)}}var mW=($)=>(T)=>$ instanceof Function?$(T):$;var TT=($,T)=>{if($.valueMap.has(T.key))return $.logger.info("\uD83D\uDCD6",T.type,T.key,"reading cached value"),_V(T,$);switch(T.type){case"readonly_held_selector":case"readonly_pure_selector":case"writable_held_selector":case"writable_pure_selector":return $.logger.info("\uD83E\uDDEE",T.type,T.key,"computing value"),T.get();case"atom":case"mutable_atom":{let W=T.default,U;if(W instanceof Function)U=W();else U=W;return $.logger.info("\uD83D\uDC81","atom",T.key,"could not find cached value; using default",U),U}}};var kV=($,T)=>{if($.operation.open){let W=performance.now();return $.logger.info("\u2757",T.type,T.key,`deferring setState at T-${W} until setState for "${$.operation.token.key}" is done`),W}$.operation={open:!0,done:new Set,prev:new Map,time:Date.now(),token:T},$.logger.info("\u2B55",T.type,T.key,`operation start in store "${$.config.name}"${!t6($)?"":` ${$.transactionMeta.phase} "${$.transactionMeta.update.key}"`}`)},vV=($)=>{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)},PV=($,T)=>{if(!$.operation.open)return $.logger.error("\uD83D\uDC1E","unknown",T,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0;return $.operation.done.has(T)},WT=($,T)=>{if(!$.operation.open){$.logger.error("\uD83D\uDC1E","unknown",T,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}$.operation.done.add(T)};var qV=($,T,W)=>{switch(T.type){case"mutable_atom":$.logger.info("\uD83D\uDCE2",T.type,T.key,"is now (",W.newValue,") subscribers:",T.subject.subscribers);break;case"atom":case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":$.logger.info("\uD83D\uDCE2",T.type,T.key,"went (",W.oldValue,"->",W.newValue,") subscribers:",T.subject.subscribers)}T.subject.next(W)};var m9=($,T)=>{let W=Q$($),U=W.selectorAtoms.getRelatedKeys(T.key);if(W.logger.info("\uD83E\uDDF9",T.type,T.key,U?`evicting ${U.size} states downstream:`:"no downstream states",U??"to evict"),U){if(W.operation.open)W.logger.info("\uD83E\uDDF9",T.type,T.key,`[ ${[...W.operation.done].join(", ")} ] already done`);for(let X of U){if(PV(W,X))continue;CV(X,W),WT(W,X)}}};var SV=($,T,W)=>{let U=TT($,T),X=U;if(T.type==="mutable_atom"&&t6($)){let{parent:Y}=$;X=kX($,T,Y)}if(X=mW(W)(X),$.logger.info("\uD83D\uDCDD","atom",T.key,"set to",X),X=H6($,T.key,X,T.subject),BV($,T.key))IV($,T.key);WT($,T.key),m9($,T);let w={oldValue:U,newValue:X};if(!t6($)){qV($,T,w);return}if($.on.transactionApplying.state===null){let{key:Y}=T;if(jV(w.newValue))return;let G={type:"atom_update",key:Y,...w};if(T.family)G.family=T.family;$.transactionMeta.update.updates.push(G),$.logger.info("\uD83D\uDCC1","atom",Y,"stowed (",w.oldValue,"->",w.newValue,")")}else if(T.key.startsWith("*")){let Y=T.key.slice(1),G=$.atoms.get(Y),H=$.valueMap.get(Y);if(G.type==="mutable_atom"&&t6($)){let{parent:F}=$;H=kX($,G,F)}if(H.do(w.newValue)===null)m9($,G)}};var ew=($,T,W)=>{switch(T.type){case"atom":case"mutable_atom":SV($,T,W);break;case"writable_pure_selector":case"writable_held_selector":T.set(W);break}};var $Y=($,T)=>Q$($).atoms.has(T),PP=($,T)=>Q$($).writableSelectors.has(T),qP=($,T)=>Q$($).readonlySelectors.has(T),xV=($,T)=>$Y($,T)||PP($,T)||qP($,T);var TY=($,T)=>{return Q$($).selectorGraph.getRelationEntries({downstreamSelectorKey:T}).filter(([U,{source:X}])=>X!==T).map(([U,{source:X}])=>X).filter((U)=>xV($,U))};var c9=($,T,W)=>{let U=[],X=TY($,T);while(X.length>0){let w=X.shift();if(W.has(w))continue;if(W.add(w),!$Y($,w))X.push(...TY($,w));else if(!U.includes(w))U.push(w)}return U},fV=($,T)=>{let W=$.key,U=TY(T,W),X=new Set;return U.flatMap((w)=>$Y(T,w)?w:c9(T,w,X))};var bV=($,T,W,U,X)=>{let w=Q$($),{type:Y,key:G}=U;if(Y==="atom"||Y==="mutable_atom")w.selectorAtoms.set({selectorKey:W,atomKey:G}),$.logger.info("\uD83D\uDD0D",T,W,`discovers root atom "${G}"`);else{let H=c9($,G,X);$.logger.info("\uD83D\uDD0D",T,W,`discovers root atoms: [ ${H.map((z)=>`"${z}"`).join(", ")} ]`);for(let z of H)w.selectorAtoms=w.selectorAtoms.set({selectorKey:W,atomKey:z})}X.add(G)};var XT=($,T,W,U)=>({get:(...X)=>{let w=Q$($),Y;if(X.length===2){let[F,O]=X;Y=a6($,F,O)}else[Y]=X;let G=B6($,Y),H=TT($,G),z=Y.key;return $.logger.info("\uD83D\uDD0C",T,W,`registers dependency ( "${z}" =`,H,")"),w.selectorGraph.set({upstreamSelectorKey:z,downstreamSelectorKey:W},{source:Y.key}),bV($,T,W,Y,U),H},set:(...X)=>{let w,Y;if(X.length===2)w=X[0],Y=X[1];else{let z=X[0],F=X[1];Y=X[2],w=a6($,z,F)}let G=Q$($),H=B6(G,w);ew(G,H,Y)},find:(...X)=>a6($,...X),json:(X)=>cW($,X)});var u9=($,T,W)=>{let U=Q$($),X=new b$,w=new Set,{key:Y,const:G}=T,H="readonly_held_selector",{get:z,find:F,json:O}=XT(U,"readonly_held_selector",Y,w),Z={...T,type:"readonly_held_selector",subject:X,install:(A)=>u9(A,T,W),get:()=>{return T.get({get:z,find:F,json:O},G),H6(Q$($),Y,G,X),w.clear(),G},...W&&{family:W}};U.readonlySelectors.set(Y,Z),$.logger.info("\u2728","readonly_held_selector",Y,"=",G);let V={key:Y,type:"readonly_held_selector"};if(W)V.family=W;return V};var p9=($,T,W)=>{let U=Q$($),X=new b$,w=new Set,Y=T.key,G="readonly_pure_selector",{get:H,find:z,json:F}=XT(U,"readonly_pure_selector",Y,w),O=()=>{let A=T.get({get:H,find:z,json:F});return H6(Q$($),Y,A,X),w.clear(),A},Q={...T,type:"readonly_pure_selector",subject:X,install:(A)=>p9(A,T,W),get:O,...W&&{family:W}};U.readonlySelectors.set(Y,Q);let Z=O();$.logger.info("\u2728","readonly_pure_selector",Y,"=",Z);let V={key:Y,type:"readonly_pure_selector"};if(W)V.family=W;return V};var d9=($,T,W)=>{let U=Q$($),X=new b$,w=new Set,{key:Y,const:G}=T,H="writable_held_selector",z=XT(U,"writable_held_selector",Y,w),{find:F,get:O,json:Q}=z,Z={find:F,get:O,json:Q},V=(_=T.get,C=Q$($))=>{return _(Z,G),H6(C,Y,G,X),w.clear(),G},D={...T,type:"writable_held_selector",subject:X,install:(_)=>d9(_,T,W),get:V,set:(_)=>{let C=Q$($),f=V(T.get,C),b=mW(_)(f);if($.logger.info("\uD83D\uDCDD","writable_held_selector",Y,"set (",f,"->",b,")"),H6(C,Y,b,X),WT(C,Y),$T(C))X.next({newValue:b,oldValue:f});T.set(z,b)},...W&&{family:W}};U.writableSelectors.set(Y,D);let J=V();$.logger.info("\u2728","writable_held_selector",Y,"=",J);let L={key:Y,type:"writable_held_selector"};if(W)L.family=W;return L};var vX=($,T,W)=>{let U=Q$($),X=new b$,w=new Set,Y=T.key,G="writable_pure_selector",H=XT(U,"writable_pure_selector",Y,w),{find:z,get:F,json:O}=H,Q={find:z,get:F,json:O},Z=(L=T.get,_=Q$($))=>{let C=L(Q);return H6(_,Y,C,X),w.clear(),C},A={...T,type:"writable_pure_selector",subject:X,install:(L)=>vX(L,T,W),get:Z,set:(L)=>{let _=Q$($),C=Z(T.get,_),f=mW(L)(C);if($.logger.info("\uD83D\uDCDD","writable_pure_selector",Y,"set (",C,"->",f,")"),H6(_,T.key,f,X),WT(_,T.key),$T(_))X.next({newValue:f,oldValue:C});T.set(H,f)},...W&&{family:W}};U.writableSelectors.set(Y,A);let D=Z();$.logger.info("\u2728",A.type,A.key,"=",D);let J={key:Y,type:"writable_pure_selector"};if(W)J.family=W;return J};function NV($,T){let W="set"in T,U="const"in T;if(U&&W){let w=d9($,T,void 0);return $.on.selectorCreation.next(w),w}if(U){let w=u9($,T,void 0);return $.on.selectorCreation.next(w),w}if(W){let w=vX($,T,void 0);return $.on.selectorCreation.next(w),w}let X=p9($,T,void 0);return $.on.selectorCreation.next(X),X}function b9($,T,W){let U=T.key,X="writable_pure_selector_family",w={key:U,type:"writable_pure_selector_family"},Y=$.families.get(U);if(Y)$.logger.error("\u2757","writable_pure_selector_family",U,`Overwriting an existing ${sw(Y)} "${Y.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let G=new b$,z=Object.assign((F)=>{let O=z6(F),Q={key:U,subKey:O},Z=`${U}(${O})`,V=Q$($),A=vX(V,{key:Z,get:T.get(F),set:T.set(F)},Q);return G.next({type:"state_creation",token:A}),A},w,{internalRoles:W,subject:G,install:(F)=>b9(F,T),default:(F)=>{return T.get(F)({get:(...Q)=>PX($,...Q),find:(...Q)=>a6($,...Q),json:(Q)=>cW($,Q)})}});return $.families.set(U,z),w}function yV($,T,W){let U=$.families.get(T.key);if(U===void 0)throw new _X(T,$);let X=U(W),w=Q$($);if(X.family){if($T(w))switch(X.type){case"atom":case"mutable_atom":$.on.atomCreation.next(X);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":$.on.selectorCreation.next(X);break}else if(t6(w)&&w.on.transactionApplying.state===null)w.transactionMeta.update.updates.push({type:"state_creation",token:X})}return X}function hV($,T,W){let U=z6(W),X=`${T.key}(${U})`,w=Q$($),Y;switch(T.type){case"atom_family":case"mutable_atom_family":Y=w.atoms.get(X);break;case"writable_held_selector_family":case"writable_pure_selector_family":Y=w.writableSelectors.get(X);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":Y=w.readonlySelectors.get(X);break}if(Y)return RX(Y);return Y}function a6($,T,W){let U=hV($,T,W);if(U)return U;let X=z6(W),w=$.molecules.get(X);if(!w&&$.config.lifespan==="immortal"){let Y=LV(T,W);return $.logger.error("\u274C",Y.type,Y.key,`was not found in store "${$.config.name}"; returned a counterfeit token.`),Y}if(U=yV($,T,W),w)Q$($).moleculeData.set(X,T.key);return U}function gV($,T){if(T.family){let W=$.families.get(T.family.key);if(W)return W}}function UT($,...T){let W,U,X,w;if(T.length===2){if(W=T[0],w=T[1],U=gV($,W)??null,U)X=W.family?LX(W.family.subKey):null,W=a6($,U,X)}else U=T[0],X=T[1],w=T[2],W=a6($,U,X);if("counterfeit"in W&&"family"in W){let H=W.family.subKey,z=$.disposalTraces.buffer.find((F)=>F?.key===H);$.logger.error("\u274C",W.type,W.key,`could not be set because it was not found in the store "${$.config.name}".`,z?`This state was previously disposed:
|
|
4
|
+
${z.trace}`:"No previous disposal trace was found.");return}let Y=kV($,W);if(Y){let H=$.on.operationClose.subscribe(`waiting to set "${W.key}" at T-${Y}`,()=>{H(),$.logger.info("\uD83D\uDFE2",W.type,W.key,`resuming deferred setState from T-${Y}`),UT($,W,w)});return}let G=B6($,W);ew($,G,w),vV($)}function PX($,...T){let W,U,X;if(T.length===1)W=T[0];else U=T[0],X=T[1],W=a6($,U,X);if("counterfeit"in W&&"family"in W){U=$.families.get(W.family.key);let w=W.family.subKey,Y=$.disposalTraces.buffer.find((G)=>G?.key===w);switch($.logger.error("\u274C",W.type,W.key,`could not be retrieved because it was not found in the store "${$.config.name}".`,Y?`This state was previously disposed:
|
|
5
|
+
${Y.trace}`:"No previous disposal trace was found."),U.type){case"atom_family":case"mutable_atom_family":return $.defaults.get(U.key);case"readonly_pure_selector_family":case"writable_pure_selector_family":case"readonly_held_selector_family":case"writable_held_selector_family":{if($.defaults.has(U.key))return $.defaults.get(W.family.key);let G=B6($,U).default(w);return $.defaults.set(U.key,G),G}}}return TT($,B6($,W))}class mV{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;writableSelectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new o1({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new o1({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 o1({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new o1({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new aw(100);molecules=new Map;moleculeJoins=new o1({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});moleculeGraph=new o1({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});moleculeData=new o1({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});miscResources=new Map;on={atomCreation:new b$,atomDisposal:new b$,selectorCreation:new b$,selectorDisposal:new b$,timelineCreation:new b$,transactionCreation:new b$,transactionApplying:new g9(null),operationClose:new b$,moleculeCreation:new b$,moleculeDisposal:new b$};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new h9("warn",($,T,W)=>!uV(W))];logger={error:(...$)=>{for(let T of this.loggers)T.error(...$)},info:(...$)=>{for(let T of this.loggers)T.info(...$)},warn:(...$)=>{for(let T of this.loggers)T.warn(...$)}};constructor($,T=null){if(this.config={...T?.config,...$},T!==null){if(this.valueMap=new Map(T?.valueMap),this.operation={...T?.operation},$T(T))this.transactionMeta={epoch:new Map(T?.transactionMeta.epoch),actionContinuities:new o1(T?.transactionMeta.actionContinuities.toJSON())};for(let[,U]of T.families){if(U.internalRoles?.includes("mutable")||U.internalRoles?.includes("join"))continue;U.install(this)}let W=new Set;for(let[,U]of T.atoms){if(W.has(U.key))continue;if(U.install(this),U.type==="mutable_atom"){let X=cW(T,U),w=cV(U);W.add(X.key),W.add(w.key)}}for(let[,U]of T.readonlySelectors)U.install(this);for(let[,U]of T.writableSelectors){if(W.has(U.key))continue;U.install(this)}for(let[,U]of T.transactions)U.install(this);for(let[,U]of T.timelines)U.install(this)}}}var JV={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new mV({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function B6($,T){let W,U=$;while(U!==null){switch(T.type){case"atom":case"mutable_atom":W=U.atoms.get(T.key);break;case"writable_pure_selector":case"writable_held_selector":W=U.writableSelectors.get(T.key);break;case"readonly_pure_selector":case"readonly_held_selector":W=U.readonlySelectors.get(T.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":W=U.families.get(T.key);break;case"timeline":W=U.timelines.get(T.key);break;case"transaction":W=U.transactions.get(T.key);break}if(W)return W;U=U.child}throw new _X(T,$)}var pV=($,T)=>{let W=Q$($);if(W.operation.open)return W.operation.prev.get(T.key);return W.valueMap.get(T.key)};var o9=($,T)=>{let W=Q$($);return fV(T,$).map((X)=>{let w=W.atoms.get(X);if(w===void 0)throw new Error(`Atom "${X}", a dependency of selector "${T.key}", not found in store "${$.config.name}".`);return w.subject.subscribe(`${T.type}:${T.key}`,(Y)=>{$.logger.info("\uD83D\uDCE2",T.type,T.key,"root",X,"went",Y.oldValue,"->",Y.newValue);let G=pV(W,T),H=TT(W,T);$.logger.info("\u2728",T.type,T.key,"went",G,"->",H),T.subject.next({newValue:H,oldValue:G})})})};function qX($,T,W,U){function X(O){if($.operation.open){let Q=$.on.operationClose.subscribe(`state subscription ${W}`,()=>{Q(),U(O)})}else U(O)}let w=B6($,T);$.logger.info("\uD83D\uDC40",w.type,w.key,`Adding subscription "${W}"`);let Y=w.type==="writable_pure_selector"||w.type==="readonly_pure_selector",G=null,H=X;if(Y)G=o9($,w),H=(O)=>{if(G)G.length=0,G.push(...o9($,w));X(O)};let z=w.subject.subscribe(W,H);return()=>{if($.logger.info("\uD83D\uDE48",w.type,w.key,`Removing subscription "${W}"`),z(),G)for(let O of G)O()}}var dV=($,T,W,U)=>{let X=B6($,T);$.logger.info("\uD83D\uDC40","timeline",T.key,`Adding subscription "${W}"`);let w=X.subject.subscribe(W,U);return()=>{$.logger.info("\uD83D\uDE48","timeline",T.key,`Removing subscription "${W}" from timeline`),w()}};class l9{initializeState($,T){let W=`*${$.key}`;T.atoms.delete(W),T.valueMap.delete(W);let U=$.family?{key:`*${$.family.key}`,subKey:$.family.subKey}:void 0,X=r9(T,{key:W,default:null},U);if(T.parent?.valueMap.has(W)){let w=T.parent.valueMap.get(W);T.valueMap.set(W,w)}return X}unsubscribeFromInnerValue;unsubscribeFromState;observeCore($,T,W){let U=`tracker:${W.config.name}:${t6(W)?W.transactionMeta.update.key:"main"}:${$.key}`,X=PX(W,$);this.unsubscribeFromInnerValue=X.subscribe(U,(w)=>{UT(W,T,w)}),this.unsubscribeFromState=qX(W,$,U,(w)=>{if(w.newValue!==w.oldValue)this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=w.newValue.subscribe(U,(Y)=>{UT(W,T,Y)})})}updateCore($,T,W){let U=`tracker:${W.config.name}:${t6(W)?W.transactionMeta.update.key:"main"}:${$.key}`;qX(W,T,U,({newValue:X,oldValue:w})=>{let Y=W.timelineTopics.getRelatedKey(T.key);if(Y){if(W.timelines.get(Y)?.timeTraveling){let z=dV(W,{key:Y,type:"timeline"},U,(F)=>{z(),UT(W,$,(O)=>{if(F==="redo"&&X)O.do(X);else if(F==="undo"&&w)O.undo(w);return O})});return}}let G=W.on.operationClose.subscribe(U,()=>{G();let H=PX(W,$),z=X===null?-1:H.getUpdateNumber(X),F=z-H.cacheUpdateNumber;if(X&&F===1)UT(W,$,(O)=>(O.do(X),O));else W.logger.info("\u274C","mutable_atom",$.key,`could not be updated. Expected update number ${H.cacheUpdateNumber+1}, but got ${z}`)})})}mutableState;latestUpdateState;[Symbol.dispose];constructor($,T){this.mutableState=$;let W=Q$(T);this.latestUpdateState=this.initializeState($,W),this.observeCore($,this.latestUpdateState,W),this.updateCore($,this.latestUpdateState,W),W.trackers.set($.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),W.trackers.delete($.key)}}}var cW=($,T)=>{if(T.family){let U=Q$($),w={key:`${T.family.key}:JSON`,type:"writable_pure_selector_family"},Y=B6(U,w),G=JSON.parse(T.family.subKey);return a6($,Y,G)}return{type:"writable_pure_selector",key:`${T.key}:JSON`}};var cV=($)=>{let W={type:"atom",key:`*${$.key}`};if($.family)W.family={key:`*${$.family.key}`,subKey:$.family.subKey};return W};function jV($){return typeof $==="object"&&$!==null&&"do"in $&&"undo"in $&&"subscribe"in $}function kX($,T,W){let U=W.valueMap.get(T.key),X=$.valueMap.get(T.key);if(U!==X)return X;if(U===void 0)return T.default();W.logger.info("\uD83D\uDCC3","atom",T.key,"copying");let w=T.toJson(U),Y=T.fromJson(w);return $.valueMap.set(T.key,Y),new l9(T,W),Y}function H6($,T,W,U){let X=$.valueMap.get(T);if(X instanceof JX)X.use(W);if(W instanceof Promise){let w=new JX(W);return $.valueMap.set(T,w),w.then((Y)=>{H6($,T,Y,U),U.next({newValue:Y,oldValue:w})}).catch((Y)=>{$.logger.error("\uD83D\uDCA5","state",T,"rejected:",Y)}),w}return $.valueMap.set(T,W),W}var _V=($,T)=>{let W=T.valueMap.get($.key);if($.type==="mutable_atom"&&t6(T)){let{parent:U}=T;W=kX(T,$,U)}return W},CV=($,T)=>{let W=T.valueMap.get($);if(W instanceof JX){let U=W,X=T.writableSelectors.get($)??T.readonlySelectors.get($);if(X)U.use(X.get());return}if(T.operation.open)T.operation.prev.set($,W);T.valueMap.delete($),T.logger.info("\uD83D\uDDD1","state",$,"evicted")};var BV=($,T)=>{return Q$($).atomsThatAreDefault.has(T)},oV=($,T)=>{let W=Q$($);W.atomsThatAreDefault=new Set(W.atomsThatAreDefault).add(T)},IV=($,T)=>{let W=Q$($);W.atomsThatAreDefault=new Set(Q$($).atomsThatAreDefault),W.atomsThatAreDefault.delete(T)};function r9($,T,W){let{key:X,default:w}=T;$.logger.info("\uD83D\uDD28","atom",X,`creating in store "${$.config.name}"`);let Y=Q$($),G=Y.atoms.get(X);if(G&&G.type==="atom")return $.logger.error("\u274C","atom",X,"Tried to create atom, but it already exists in the store."),RX(G);let H=new b$,z={...T,type:"atom",install:(Q)=>{return Q.logger.info("\uD83D\uDEE0\uFE0F","atom",X,`installing in store "${Q.config.name}"`),r9(Q,T,W)},subject:H};if(W)z.family=W;let F=w;if(w instanceof Function)F=w();Y.atoms.set(X,z),oV($,X),H6(Y,X,F,H);let O=RX(z);if(T.effects){let Q=0,Z=[];for(let V of T.effects){let A=V({setSelf:(D)=>{UT($,O,D)},onSet:(D)=>qX($,O,`effect[${Q}]`,D)});if(A)Z.push(A);++Q}z.cleanup=()=>{for(let V of Z)V()}}return O}class uW extends Set{mode="record";subject=new b$;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor($,T=0){super($);if($ instanceof uW)this.parent=$,this.cacheUpdateNumber=$.cacheUpdateNumber;if(T)this.cacheLimit=T,this.cache=new Array(T),this.subscribe("auto cache",(W)=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=W})}toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON($){let T=new uW($.members,$.cacheLimit);return T.cache=$.cache,T.cacheIdx=$.cacheIdx,T.cacheUpdateNumber=$.cacheUpdateNumber,T}add($){let T=super.add($);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`add:${z6($)}`);return T}clear(){let $=this.mode==="record"?[...this]:null;if(super.clear(),$)this.cacheUpdateNumber++,this.emit(`clear:${JSON.stringify($)}`)}delete($){let T=super.delete($);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`del:${z6($)}`);return T}parent=null;child=null;transactionUpdates=null;transaction($){this.mode="transaction",this.transactionUpdates=[],this.child=new uW(this);let T=this.child._subscribe("transaction",(W)=>{this.transactionUpdates?.push(W)});try{if($(this.child)){for(let U of this.transactionUpdates)this.doStep(U);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(W){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",W),W}finally{T(),this.child=null,this.transactionUpdates=null,this.mode="record"}}_subscribe($,T){return this.subject.subscribe($,T)}subscribe($,T){return this.subject.subscribe($,(W)=>{T(`${this.cacheUpdateNumber}=${W}`)})}emit($){this.subject.next($)}doStep($){let T=$.indexOf(":"),W=$.substring(0,T),U=$.substring(T+1);switch(W){case"add":this.add(JSON.parse(U));break;case"clear":this.clear();break;case"del":this.delete(JSON.parse(U));break;case"tx":for(let X of U.split(";"))this.doStep(X)}}getUpdateNumber($){let T=$.indexOf("=");return Number($.substring(0,T))}do($){let T=$.indexOf("="),W=Number($.substring(0,T)),U=W-this.cacheUpdateNumber;if(U>0){if(U===1){this.mode="playback";let w=$.substring(T+1);return this.doStep(w),this.mode="record",this.cacheUpdateNumber=W,null}return this.cacheUpdateNumber+1}if(Math.abs(U)<this.cacheLimit){let w=this.cacheIdx+U;if(this.cache[w]===$)return null;this.mode="playback";let G=!1;while(!G){this.cacheIdx%=this.cacheLimit;let z=this.cache[this.cacheIdx];if(this.cacheIdx--,!z)return"OUT_OF_RANGE";this.undo(z),G=this.cacheIdx===w-1}let H=$.substring(T+1);return this.doStep(H),this.mode="record",this.cacheUpdateNumber=W,null}return"OUT_OF_RANGE"}undoStep($){let T=$.indexOf(":"),W=$.substring(0,T),U=$.substring(T+1);switch(W){case"add":this.delete(JSON.parse(U));break;case"del":this.add(JSON.parse(U));break;case"clear":{let X=JSON.parse(U);for(let w of X)this.add(w);break}case"tx":{let X=U.split(";");for(let w=X.length-1;w>=0;w--)this.undoStep(X[w])}}}undo($){let T=$.indexOf("=");if(Number($.substring(0,T))===this.cacheUpdateNumber){this.mode="playback";let U=$.substring(T+1);return this.undoStep(U),this.mode="record",this.cacheUpdateNumber--,null}return this.cacheUpdateNumber}}function uV($){return $.startsWith("\uD83D\uDD0D ")}class WY{listeners;globalListeners;handleEvent($,...T){for(let U of this.globalListeners)U($,...T);let W=this.listeners.get($);if(W)for(let U of W)U(...T)}id="no_id_retrieved";emit;constructor($){this.emit=$,this.listeners=new Map,this.globalListeners=new Set}on($,T){let W=this.listeners.get($);if(W)W.add(T);else this.listeners.set($,new Set([T]));return this}onAny($){return this.globalListeners.add($),this}off($,T){let W=this.listeners.get($);if(W)if(T)W.delete(T);else this.listeners.delete($);return this}offAny($){return this.globalListeners.delete($),this}}class lV extends WY{in;out;id="no_id_retrieved";disposalFunctions=[];constructor($){super((...T)=>{return this.out.next(T),this});this.id=$,this.in=new b$,this.out=new b$,this.in.subscribe("socket",(T)=>{this.handleEvent(...T)})}dispose(){for(let $ of this.disposalFunctions)$()}}class n9 extends WY{incompleteData="";unprocessedEvents=[];relays;relayServices;process;id="#####";log(...$){this.process.stderr.write(z6($.map((T)=>T instanceof uW?`{ ${T.toJSON().members.join(" | ")} }`:T))+"\x03")}logger={info:(...$)=>{this.log("i",...$)},warn:(...$)=>{this.log("w",...$)},error:(...$)=>{this.log("e",...$)}};constructor(){super(($,...T)=>{let W=JSON.stringify([$,...T]);return this.process.stdout.write(W+"\x03"),this});if(this.process=process,this.process.stdin.resume(),this.relays=new Map,this.relayServices=[],this.process.stdin.on("data",($)=>{let T=$.toString();this.unprocessedEvents.push(...T.split("\x03"));let W=this.unprocessedEvents.shift();this.incompleteData+=W??"";try{let U=LX(this.incompleteData);this.logger.info("\uD83C\uDFB0","received",U),this.handleEvent(...U);while(this.unprocessedEvents.length>0){let X=this.unprocessedEvents.shift();if(X){if(this.unprocessedEvents.length===0)this.incompleteData=X;let w=LX(X);this.handleEvent(...w)}}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 T=new lV(`user:${$}`);this.relays.set($,T),this.logger.info("\uD83D\uDD17","attaching services:",`[${[...this.relayServices.keys()].join(", ")}]`);for(let W of this.relayServices){let U=W(T);if(U)T.disposalFunctions.push(U)}this.on(`user:${$}`,(...W)=>{T.in.next(W)}),T.out.subscribe("socket",(W)=>{this.emit(...W)})}),this.on("user-leaves",($)=>{let T=this.relays.get($);if(this.off(`relay:${$}`),T)T.dispose(),this.relays.delete($)}),process.stdout.write("ALIVE")}relay($){this.logger.info("\uD83D\uDD17","running relay method"),this.relayServices.push($)}}var UG={};e0(UG,{xid:()=>kC,void:()=>oC,uuidv7:()=>MC,uuidv6:()=>EC,uuidv4:()=>AC,uuid:()=>KC,url:()=>DC,uppercase:()=>sX,unknown:()=>iY,union:()=>WG,undefined:()=>pC,ulid:()=>_C,uint64:()=>cC,uint32:()=>hC,tuple:()=>sC,trim:()=>U8,treeifyError:()=>Y5,transform:()=>QF,toUpperCase:()=>Y8,toLowerCase:()=>w8,toJSONSchema:()=>BH,templateLiteral:()=>GS,symbol:()=>uC,superRefine:()=>YA,success:()=>wS,stringbool:()=>OS,string:()=>cH,strictObject:()=>iC,startsWith:()=>$8,size:()=>iX,setErrorMap:()=>ES,set:()=>TS,safeParseAsync:()=>mH,safeParse:()=>gH,registry:()=>NY,regexes:()=>pT,regex:()=>tX,refine:()=>wA,record:()=>fK,readonly:()=>eK,property:()=>_H,promise:()=>zS,prettifyError:()=>G5,preprocess:()=>ZS,prefault:()=>lK,positive:()=>NH,pipe:()=>sY,partialRecord:()=>eC,parseAsync:()=>hH,parse:()=>yH,overwrite:()=>K0,optional:()=>tY,object:()=>nC,number:()=>NK,nullish:()=>US,nullable:()=>aY,null:()=>kK,normalize:()=>X8,nonpositive:()=>LH,nonoptional:()=>rK,nonnegative:()=>RH,never:()=>eY,negative:()=>JH,nativeEnum:()=>WS,nanoid:()=>JC,nan:()=>YS,multipleOf:()=>lT,minSize:()=>rT,minLength:()=>YT,mime:()=>W8,maxSize:()=>nW,maxLength:()=>iW,map:()=>$S,lte:()=>K1,lt:()=>Z0,lowercase:()=>aX,looseObject:()=>tC,locales:()=>lX,literal:()=>mK,length:()=>tW,lazy:()=>WA,ksuid:()=>vC,keyof:()=>rC,jwt:()=>xC,json:()=>QS,iso:()=>rY,ipv6:()=>qC,ipv4:()=>PC,intersection:()=>IK,int64:()=>mC,int32:()=>yC,int:()=>uH,instanceof:()=>FS,includes:()=>eX,guid:()=>VC,gte:()=>x6,gt:()=>V0,globalRegistry:()=>l1,getErrorMap:()=>MS,function:()=>jH,formatError:()=>mX,float64:()=>bC,float32:()=>fC,flattenError:()=>gX,file:()=>XS,enum:()=>hK,endsWith:()=>T8,emoji:()=>NC,email:()=>ZC,e164:()=>IC,discriminatedUnion:()=>aC,date:()=>lC,custom:()=>HS,cuid2:()=>RC,cuid:()=>LC,core:()=>A0,config:()=>N4,coerce:()=>AF,clone:()=>s6,cidrv6:()=>SC,cidrv4:()=>CC,check:()=>UA,catch:()=>tK,boolean:()=>JK,bigint:()=>gC,base64url:()=>BC,base64:()=>jC,array:()=>zF,any:()=>dC,_default:()=>dK,_ZodString:()=>pH,ZodXID:()=>aH,ZodVoid:()=>CK,ZodUnknown:()=>PK,ZodUnion:()=>HF,ZodUndefined:()=>RK,ZodUUID:()=>E0,ZodURL:()=>oH,ZodULID:()=>tH,ZodType:()=>k$,ZodTuple:()=>xK,ZodTransform:()=>OF,ZodTemplateLiteral:()=>$A,ZodSymbol:()=>LK,ZodSuccess:()=>nK,ZodStringFormat:()=>W4,ZodString:()=>H8,ZodSet:()=>yK,ZodRecord:()=>FF,ZodRealError:()=>aW,ZodReadonly:()=>sK,ZodPromise:()=>XA,ZodPrefault:()=>oK,ZodPipe:()=>KF,ZodOptional:()=>ZF,ZodObject:()=>TG,ZodNumberFormat:()=>sW,ZodNumber:()=>F8,ZodNullable:()=>uK,ZodNull:()=>_K,ZodNonOptional:()=>VF,ZodNever:()=>qK,ZodNanoID:()=>rH,ZodNaN:()=>aK,ZodMap:()=>bK,ZodLiteral:()=>gK,ZodLazy:()=>TA,ZodKSUID:()=>sH,ZodJWT:()=>YF,ZodIssueCode:()=>VS,ZodIntersection:()=>BK,ZodISOTime:()=>oY,ZodISODuration:()=>lY,ZodISODateTime:()=>pY,ZodISODate:()=>dY,ZodIPv6:()=>$F,ZodIPv4:()=>eH,ZodGUID:()=>nY,ZodFile:()=>cK,ZodError:()=>OC,ZodEnum:()=>z8,ZodEmoji:()=>lH,ZodEmail:()=>dH,ZodE164:()=>wF,ZodDiscriminatedUnion:()=>jK,ZodDefault:()=>pK,ZodDate:()=>$G,ZodCustom:()=>XG,ZodCatch:()=>iK,ZodCUID2:()=>iH,ZodCUID:()=>nH,ZodCIDRv6:()=>WF,ZodCIDRv4:()=>TF,ZodBoolean:()=>O8,ZodBigIntFormat:()=>GF,ZodBigInt:()=>Q8,ZodBase64URL:()=>UF,ZodBase64:()=>XF,ZodArray:()=>SK,ZodAny:()=>vK,TimePrecision:()=>r3,NEVER:()=>AS,$output:()=>p3,$input:()=>d3,$brand:()=>i9});var A0={};e0(A0,{version:()=>X7,util:()=>o,treeifyError:()=>Y5,toJSONSchema:()=>BH,toDotPath:()=>iV,safeParseAsync:()=>H5,safeParse:()=>z5,registry:()=>NY,regexes:()=>pT,prettifyError:()=>G5,parseAsync:()=>zY,parse:()=>YY,locales:()=>lX,isValidJWT:()=>ZK,isValidBase64URL:()=>QK,isValidBase64:()=>_7,globalRegistry:()=>l1,globalConfig:()=>CX,function:()=>jH,formatError:()=>mX,flattenError:()=>gX,config:()=>N4,clone:()=>s6,_xid:()=>BY,_void:()=>AH,_uuidv7:()=>kY,_uuidv6:()=>_Y,_uuidv4:()=>RY,_uuid:()=>LY,_url:()=>vY,_uppercase:()=>sX,_unknown:()=>rW,_union:()=>pq,_undefined:()=>QH,_ulid:()=>jY,_uint64:()=>FH,_uint32:()=>UH,_tuple:()=>kH,_trim:()=>U8,_transform:()=>sq,_toUpperCase:()=>Y8,_toLowerCase:()=>w8,_templateLiteral:()=>GC,_symbol:()=>OH,_success:()=>XC,_stringbool:()=>CH,_string:()=>o3,_startsWith:()=>$8,_size:()=>iX,_set:()=>nq,_safeParseAsync:()=>FY,_safeParse:()=>HY,_regex:()=>tX,_refine:()=>qH,_record:()=>lq,_readonly:()=>YC,_property:()=>_H,_promise:()=>HC,_positive:()=>NH,_pipe:()=>wC,_parseAsync:()=>GY,_parse:()=>wY,_overwrite:()=>K0,_optional:()=>eq,_number:()=>s3,_nullable:()=>$C,_null:()=>ZH,_normalize:()=>X8,_nonpositive:()=>LH,_nonoptional:()=>WC,_nonnegative:()=>RH,_never:()=>KH,_negative:()=>JH,_nativeEnum:()=>tq,_nanoid:()=>qY,_nan:()=>DH,_multipleOf:()=>lT,_minSize:()=>rT,_minLength:()=>YT,_min:()=>x6,_mime:()=>W8,_maxSize:()=>nW,_maxLength:()=>iW,_max:()=>K1,_map:()=>rq,_lte:()=>K1,_lt:()=>Z0,_lowercase:()=>aX,_literal:()=>aq,_length:()=>tW,_lazy:()=>zC,_ksuid:()=>IY,_jwt:()=>cY,_isoTime:()=>t3,_isoDuration:()=>a3,_isoDateTime:()=>n3,_isoDate:()=>i3,_ipv6:()=>fY,_ipv4:()=>xY,_intersection:()=>oq,_int64:()=>HH,_int32:()=>XH,_int:()=>$H,_includes:()=>eX,_guid:()=>nX,_gte:()=>x6,_gt:()=>V0,_float64:()=>WH,_float32:()=>TH,_file:()=>vH,_enum:()=>iq,_endsWith:()=>T8,_emoji:()=>PY,_email:()=>JY,_e164:()=>mY,_discriminatedUnion:()=>dq,_default:()=>TC,_date:()=>EH,_custom:()=>PH,_cuid2:()=>SY,_cuid:()=>CY,_coercedString:()=>l3,_coercedNumber:()=>e3,_coercedDate:()=>MH,_coercedBoolean:()=>YH,_coercedBigint:()=>zH,_cidrv6:()=>yY,_cidrv4:()=>bY,_catch:()=>UC,_boolean:()=>wH,_bigint:()=>GH,_base64url:()=>gY,_base64:()=>hY,_array:()=>G8,_any:()=>VH,TimePrecision:()=>r3,JSONSchemaGenerator:()=>uY,JSONSchema:()=>EK,Doc:()=>VY,$output:()=>p3,$input:()=>d3,$constructor:()=>k,$brand:()=>i9,$ZodXID:()=>V7,$ZodVoid:()=>b7,$ZodUnknown:()=>lW,$ZodUnion:()=>DY,$ZodUndefined:()=>B7,$ZodUUID:()=>Y7,$ZodURL:()=>z7,$ZodULID:()=>Z7,$ZodType:()=>K$,$ZodTuple:()=>oT,$ZodTransform:()=>pX,$ZodTemplateLiteral:()=>W3,$ZodSymbol:()=>j7,$ZodSuccess:()=>s7,$ZodStringFormat:()=>r$,$ZodString:()=>dT,$ZodSet:()=>p7,$ZodRegistry:()=>rX,$ZodRecord:()=>c7,$ZodRealError:()=>dW,$ZodReadonly:()=>T3,$ZodPromise:()=>X3,$ZodPrefault:()=>t7,$ZodPipe:()=>dX,$ZodOptional:()=>r7,$ZodObject:()=>h7,$ZodNumberFormat:()=>C7,$ZodNumber:()=>EY,$ZodNullable:()=>n7,$ZodNull:()=>I7,$ZodNonOptional:()=>a7,$ZodNever:()=>f7,$ZodNanoID:()=>F7,$ZodNaN:()=>$3,$ZodMap:()=>u7,$ZodLiteral:()=>o7,$ZodLazy:()=>U3,$ZodKSUID:()=>K7,$ZodJWT:()=>q7,$ZodIntersection:()=>m7,$ZodISOTime:()=>M7,$ZodISODuration:()=>D7,$ZodISODateTime:()=>A7,$ZodISODate:()=>E7,$ZodIPv6:()=>J7,$ZodIPv4:()=>N7,$ZodGUID:()=>w7,$ZodFunction:()=>SH,$ZodFile:()=>l7,$ZodError:()=>hX,$ZodEnum:()=>d7,$ZodEmoji:()=>H7,$ZodEmail:()=>G7,$ZodE164:()=>P7,$ZodDiscriminatedUnion:()=>g7,$ZodDefault:()=>i7,$ZodDate:()=>y7,$ZodCustom:()=>w3,$ZodCheckUpperCase:()=>t5,$ZodCheckStringFormat:()=>oW,$ZodCheckStartsWith:()=>s5,$ZodCheckSizeEquals:()=>d5,$ZodCheckRegex:()=>n5,$ZodCheckProperty:()=>$7,$ZodCheckOverwrite:()=>W7,$ZodCheckNumberFormat:()=>m5,$ZodCheckMultipleOf:()=>g5,$ZodCheckMinSize:()=>p5,$ZodCheckMinLength:()=>l5,$ZodCheckMimeType:()=>T7,$ZodCheckMaxSize:()=>u5,$ZodCheckMaxLength:()=>o5,$ZodCheckLowerCase:()=>i5,$ZodCheckLessThan:()=>QY,$ZodCheckLengthEquals:()=>r5,$ZodCheckIncludes:()=>a5,$ZodCheckGreaterThan:()=>ZY,$ZodCheckEndsWith:()=>e5,$ZodCheckBigIntFormat:()=>c5,$ZodCheck:()=>z4,$ZodCatch:()=>e7,$ZodCUID2:()=>Q7,$ZodCUID:()=>O7,$ZodCIDRv6:()=>R7,$ZodCIDRv4:()=>L7,$ZodBoolean:()=>cX,$ZodBigIntFormat:()=>S7,$ZodBigInt:()=>MY,$ZodBase64URL:()=>v7,$ZodBase64:()=>k7,$ZodAsyncError:()=>O0,$ZodArray:()=>uX,$ZodAny:()=>x7});function k($,T,W){function U(G,H){var z;Object.defineProperty(G,"_zod",{value:G._zod??{},enumerable:!1}),(z=G._zod).traits??(z.traits=new Set),G._zod.traits.add($),T(G,H);for(let F in Y.prototype)if(!(F in G))Object.defineProperty(G,F,{value:Y.prototype[F].bind(G)});G._zod.constr=Y,G._zod.def=H}let X=W?.Parent??Object;class w extends X{}Object.defineProperty(w,"name",{value:$});function Y(G){var H;let z=W?.Parent?new w:this;U(z,G),(H=z._zod).deferred??(H.deferred=[]);for(let F of z._zod.deferred)F();return z}return Object.defineProperty(Y,"init",{value:U}),Object.defineProperty(Y,Symbol.hasInstance,{value:(G)=>{if(W?.Parent&&G instanceof W.Parent)return!0;return G?._zod?.traits?.has($)}}),Object.defineProperty(Y,"name",{value:$}),Y}var i9=Symbol("zod_brand");class O0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var CX={};function N4($){if($)Object.assign(CX,$);return CX}var o={};e0(o,{unwrapMessage:()=>SX,stringifyPrimitive:()=>n,required:()=>dP,randomString:()=>XY,propertyKeyTypes:()=>fX,promiseAllObject:()=>fP,primitiveTypes:()=>T5,prefixIssues:()=>I6,pick:()=>gP,partial:()=>pP,optionalKeys:()=>W5,omit:()=>mP,numKeys:()=>bP,nullish:()=>wT,normalizeParams:()=>p,merge:()=>uP,jsonStringifyReplacer:()=>a9,joinValues:()=>x,issue:()=>w5,isPlainObject:()=>xX,isObject:()=>pW,getSizableOrigin:()=>bX,getParsedType:()=>yP,getLengthableOrigin:()=>yX,getEnumValues:()=>jX,getElementAtPath:()=>xP,floatSafeRemainder:()=>s9,finalizeIssue:()=>e6,extend:()=>cP,escapeRegex:()=>Q0,esc:()=>mT,defineLazy:()=>h$,createTransparentProxy:()=>hP,clone:()=>s6,cleanRegex:()=>IX,cleanEnum:()=>oP,captureStackTrace:()=>UY,cached:()=>BX,assignProp:()=>e9,assertNotEqual:()=>SP,assertNever:()=>BP,assertIs:()=>jP,assertEqual:()=>CP,assert:()=>IP,allowsEval:()=>$5,aborted:()=>cT,NUMBER_FORMAT_RANGES:()=>X5,Class:()=>rV,BIGINT_FORMAT_RANGES:()=>U5});function CP($){return $}function SP($){return $}function jP($){}function BP($){throw new Error}function IP($){}function jX($){let T=Object.values($).filter((U)=>typeof U==="number");return Object.entries($).filter(([U,X])=>T.indexOf(+U)===-1).map(([U,X])=>X)}function x($,T="|"){return $.map((W)=>n(W)).join(T)}function a9($,T){if(typeof T==="bigint")return T.toString();return T}function BX($){return{get value(){{let W=$();return Object.defineProperty(this,"value",{value:W}),W}throw new Error("cached value already set")}}}function wT($){return $===null||$===void 0}function IX($){let T=$.startsWith("^")?1:0,W=$.endsWith("$")?$.length-1:$.length;return $.slice(T,W)}function s9($,T){let W=($.toString().split(".")[1]||"").length,U=(T.toString().split(".")[1]||"").length,X=W>U?W:U,w=Number.parseInt($.toFixed(X).replace(".","")),Y=Number.parseInt(T.toFixed(X).replace(".",""));return w%Y/10**X}function h$($,T,W){Object.defineProperty($,T,{get(){{let X=W();return $[T]=X,X}throw new Error("cached value already set")},set(X){Object.defineProperty($,T,{value:X})},configurable:!0})}function e9($,T,W){Object.defineProperty($,T,{value:W,writable:!0,enumerable:!0,configurable:!0})}function xP($,T){if(!T)return $;return T.reduce((W,U)=>W?.[U],$)}function fP($){let T=Object.keys($),W=T.map((U)=>$[U]);return Promise.all(W).then((U)=>{let X={};for(let w=0;w<T.length;w++)X[T[w]]=U[w];return X})}function XY($=10){let W="";for(let U=0;U<$;U++)W+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return W}function mT($){return JSON.stringify($)}var UY=Error.captureStackTrace?Error.captureStackTrace:(...$)=>{};function pW($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var $5=BX(()=>{if(typeof navigator!=="undefined"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function xX($){if(pW($)===!1)return!1;let T=$.constructor;if(T===void 0)return!0;let W=T.prototype;if(pW(W)===!1)return!1;if(Object.prototype.hasOwnProperty.call(W,"isPrototypeOf")===!1)return!1;return!0}function bP($){let T=0;for(let W in $)if(Object.prototype.hasOwnProperty.call($,W))T++;return T}var yP=($)=>{let T=typeof $;switch(T){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: ${T}`)}},fX=new Set(["string","number","symbol"]),T5=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Q0($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function s6($,T,W){let U=new $._zod.constr(T??$._zod.def);if(!T||W?.parent)U._zod.parent=$;return U}function p($){let T=$;if(!T)return{};if(typeof T==="string")return{error:()=>T};if(T?.message!==void 0){if(T?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");T.error=T.message}if(delete T.message,typeof T.error==="string")return{...T,error:()=>T.error};return T}function hP($){let T;return new Proxy({},{get(W,U,X){return T??(T=$()),Reflect.get(T,U,X)},set(W,U,X,w){return T??(T=$()),Reflect.set(T,U,X,w)},has(W,U){return T??(T=$()),Reflect.has(T,U)},deleteProperty(W,U){return T??(T=$()),Reflect.deleteProperty(T,U)},ownKeys(W){return T??(T=$()),Reflect.ownKeys(T)},getOwnPropertyDescriptor(W,U){return T??(T=$()),Reflect.getOwnPropertyDescriptor(T,U)},defineProperty(W,U,X){return T??(T=$()),Reflect.defineProperty(T,U,X)}})}function n($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function W5($){return Object.keys($).filter((T)=>{return $[T]._zod.optin==="optional"&&$[T]._zod.optout==="optional"})}var X5={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]},U5={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function gP($,T){let W={},U=$._zod.def;for(let X in T){if(!(X in U.shape))throw new Error(`Unrecognized key: "${X}"`);if(!T[X])continue;W[X]=U.shape[X]}return s6($,{...$._zod.def,shape:W,checks:[]})}function mP($,T){let W={...$._zod.def.shape},U=$._zod.def;for(let X in T){if(!(X in U.shape))throw new Error(`Unrecognized key: "${X}"`);if(!T[X])continue;delete W[X]}return s6($,{...$._zod.def,shape:W,checks:[]})}function cP($,T){let W={...$._zod.def,get shape(){let U={...$._zod.def.shape,...T};return e9(this,"shape",U),U},checks:[]};return s6($,W)}function uP($,T){return s6($,{...$._zod.def,get shape(){let W={...$._zod.def.shape,...T._zod.def.shape};return e9(this,"shape",W),W},catchall:T._zod.def.catchall,checks:[]})}function pP($,T,W){let U=T._zod.def.shape,X={...U};if(W)for(let w in W){if(!(w in U))throw new Error(`Unrecognized key: "${w}"`);if(!W[w])continue;X[w]=$?new $({type:"optional",innerType:U[w]}):U[w]}else for(let w in U)X[w]=$?new $({type:"optional",innerType:U[w]}):U[w];return s6(T,{...T._zod.def,shape:X,checks:[]})}function dP($,T,W){let U=T._zod.def.shape,X={...U};if(W)for(let w in W){if(!(w in X))throw new Error(`Unrecognized key: "${w}"`);if(!W[w])continue;X[w]=new $({type:"nonoptional",innerType:U[w]})}else for(let w in U)X[w]=new $({type:"nonoptional",innerType:U[w]});return s6(T,{...T._zod.def,shape:X,checks:[]})}function cT($,T=0){for(let W=T;W<$.issues.length;W++)if($.issues[W].continue!==!0)return!0;return!1}function I6($,T){return T.map((W)=>{var U;return(U=W).path??(U.path=[]),W.path.unshift($),W})}function SX($){return typeof $==="string"?$:$?.message}function e6($,T,W){let U={...$,path:$.path??[]};if(!$.message){let X=SX($.inst?._zod.def?.error?.($))??SX(T?.error?.($))??SX(W.customError?.($))??SX(W.localeError?.($))??"Invalid input";U.message=X}if(delete U.inst,delete U.continue,!T?.reportInput)delete U.input;return U}function bX($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function yX($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function w5(...$){let[T,W,U]=$;if(typeof T==="string")return{message:T,code:"custom",input:W,inst:U};return{...T}}function oP($){return Object.entries($).filter(([T,W])=>{return Number.isNaN(Number.parseInt(T,10))}).map((T)=>T[1])}class rV{constructor(...$){}}var nV=($,T)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:T,enumerable:!1}),Object.defineProperty($,"message",{get(){return JSON.stringify(T,a9,2)},enumerable:!0})},hX=k("$ZodError",nV),dW=k("$ZodError",nV,{Parent:Error});function gX($,T=(W)=>W.message){let W={},U=[];for(let X of $.issues)if(X.path.length>0)W[X.path[0]]=W[X.path[0]]||[],W[X.path[0]].push(T(X));else U.push(T(X));return{formErrors:U,fieldErrors:W}}function mX($,T){let W=T||function(w){return w.message},U={_errors:[]},X=(w)=>{for(let Y of w.issues)if(Y.code==="invalid_union"&&Y.errors.length)Y.errors.map((G)=>X({issues:G}));else if(Y.code==="invalid_key")X({issues:Y.issues});else if(Y.code==="invalid_element")X({issues:Y.issues});else if(Y.path.length===0)U._errors.push(W(Y));else{let G=U,H=0;while(H<Y.path.length){let z=Y.path[H];if(H!==Y.path.length-1)G[z]=G[z]||{_errors:[]};else G[z]=G[z]||{_errors:[]},G[z]._errors.push(W(Y));G=G[z],H++}}};return X($),U}function Y5($,T){let W=T||function(w){return w.message},U={errors:[]},X=(w,Y=[])=>{var G,H;for(let z of w.issues)if(z.code==="invalid_union"&&z.errors.length)z.errors.map((F)=>X({issues:F},z.path));else if(z.code==="invalid_key")X({issues:z.issues},z.path);else if(z.code==="invalid_element")X({issues:z.issues},z.path);else{let F=[...Y,...z.path];if(F.length===0){U.errors.push(W(z));continue}let O=U,Q=0;while(Q<F.length){let Z=F[Q],V=Q===F.length-1;if(typeof Z==="string")O.properties??(O.properties={}),(G=O.properties)[Z]??(G[Z]={errors:[]}),O=O.properties[Z];else O.items??(O.items=[]),(H=O.items)[Z]??(H[Z]={errors:[]}),O=O.items[Z];if(V)O.errors.push(W(z));Q++}}};return X($),U}function iV($){let T=[];for(let W of $)if(typeof W==="number")T.push(`[${W}]`);else if(typeof W==="symbol")T.push(`[${JSON.stringify(String(W))}]`);else if(/[^\w$]/.test(W))T.push(`[${JSON.stringify(W)}]`);else{if(T.length)T.push(".");T.push(W)}return T.join("")}function G5($){let T=[],W=[...$.issues].sort((U,X)=>U.path.length-X.path.length);for(let U of W)if(T.push(`\u2716 ${U.message}`),U.path?.length)T.push(` \u2192 at ${iV(U.path)}`);return T.join(`
|
|
6
|
+
`)}var wY=($)=>(T,W,U,X)=>{let w=U?Object.assign(U,{async:!1}):{async:!1},Y=T._zod.run({value:W,issues:[]},w);if(Y instanceof Promise)throw new O0;if(Y.issues.length){let G=new(X?.Err??$)(Y.issues.map((H)=>e6(H,w,N4())));throw UY(G,X?.callee),G}return Y.value},YY=wY(dW),GY=($)=>async(T,W,U,X)=>{let w=U?Object.assign(U,{async:!0}):{async:!0},Y=T._zod.run({value:W,issues:[]},w);if(Y instanceof Promise)Y=await Y;if(Y.issues.length){let G=new(X?.Err??$)(Y.issues.map((H)=>e6(H,w,N4())));throw UY(G,X?.callee),G}return Y.value},zY=GY(dW),HY=($)=>(T,W,U)=>{let X=U?{...U,async:!1}:{async:!1},w=T._zod.run({value:W,issues:[]},X);if(w instanceof Promise)throw new O0;return w.issues.length?{success:!1,error:new($??hX)(w.issues.map((Y)=>e6(Y,X,N4())))}:{success:!0,data:w.value}},z5=HY(dW),FY=($)=>async(T,W,U)=>{let X=U?Object.assign(U,{async:!0}):{async:!0},w=T._zod.run({value:W,issues:[]},X);if(w instanceof Promise)w=await w;return w.issues.length?{success:!1,error:new $(w.issues.map((Y)=>e6(Y,X,N4())))}:{success:!0,data:w.value}},H5=FY(dW);var pT={};e0(pT,{xid:()=>Z5,uuid7:()=>tP,uuid6:()=>iP,uuid4:()=>nP,uuid:()=>uT,uppercase:()=>h5,unicodeEmail:()=>eP,undefined:()=>b5,ulid:()=>Q5,time:()=>q5,string:()=>S5,rfc5322Email:()=>sP,number:()=>I5,null:()=>f5,nanoid:()=>K5,lowercase:()=>y5,ksuid:()=>V5,ipv6:()=>J5,ipv4:()=>N5,integer:()=>B5,html5Email:()=>aP,hostname:()=>k5,guid:()=>E5,extendedDuration:()=>rP,emoji:()=>D5,email:()=>M5,e164:()=>v5,duration:()=>A5,domain:()=>Wq,datetime:()=>C5,date:()=>P5,cuid2:()=>O5,cuid:()=>F5,cidrv6:()=>R5,cidrv4:()=>L5,browserEmail:()=>$q,boolean:()=>x5,bigint:()=>j5,base64url:()=>OY,base64:()=>_5,_emoji:()=>Tq});var F5=/^[cC][^\s-]{8,}$/,O5=/^[0-9a-z]+$/,Q5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Z5=/^[0-9a-vA-V]{20}$/,V5=/^[A-Za-z0-9]{27}$/,K5=/^[a-zA-Z0-9_-]{21}$/,A5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,rP=/^[-+]?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)?)??$/,E5=/^([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})$/,uT=($)=>{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})$`)},nP=uT(4),iP=uT(6),tP=uT(7),M5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,aP=/^[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])?)*$/,sP=/^(([^<>()\[\]\\.,;:\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,}))$/,eP=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,$q=/^[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])?)*$/,Tq="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function D5(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var N5=/^(?:(?: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])$/,J5=/^(([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})$/,L5=/^((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])$/,R5=/^(([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])$/,_5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,OY=/^[A-Za-z0-9_-]*$/,k5=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Wq=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,v5=/^\+(?:[0-9]){6,14}[0-9]$/,tV="(?:(?:\\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])))",P5=new RegExp(`^${tV}$`);function aV($){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 q5($){return new RegExp(`^${aV($)}$`)}function C5($){let T=aV({precision:$.precision}),W=["Z"];if($.local)W.push("");if($.offset)W.push("([+-]\\d{2}:\\d{2})");let U=`${T}(?:${W.join("|")})`;return new RegExp(`^${tV}T(?:${U})$`)}var S5=($)=>{let T=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${T}$`)},j5=/^\d+n?$/,B5=/^\d+$/,I5=/^-?\d+(?:\.\d+)?/i,x5=/true|false/i,f5=/null/i;var b5=/undefined/i;var y5=/^[^A-Z]*$/,h5=/^[^a-z]*$/;var z4=k("$ZodCheck",($,T)=>{var W;$._zod??($._zod={}),$._zod.def=T,(W=$._zod).onattach??(W.onattach=[])}),eV={number:"number",bigint:"bigint",object:"date"},QY=k("$ZodCheckLessThan",($,T)=>{z4.init($,T);let W=eV[typeof T.value];$._zod.onattach.push((U)=>{let X=U._zod.bag,w=(T.inclusive?X.maximum:X.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(T.value<w)if(T.inclusive)X.maximum=T.value;else X.exclusiveMaximum=T.value}),$._zod.check=(U)=>{if(T.inclusive?U.value<=T.value:U.value<T.value)return;U.issues.push({origin:W,code:"too_big",maximum:T.value,input:U.value,inclusive:T.inclusive,inst:$,continue:!T.abort})}}),ZY=k("$ZodCheckGreaterThan",($,T)=>{z4.init($,T);let W=eV[typeof T.value];$._zod.onattach.push((U)=>{let X=U._zod.bag,w=(T.inclusive?X.minimum:X.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(T.value>w)if(T.inclusive)X.minimum=T.value;else X.exclusiveMinimum=T.value}),$._zod.check=(U)=>{if(T.inclusive?U.value>=T.value:U.value>T.value)return;U.issues.push({origin:W,code:"too_small",minimum:T.value,input:U.value,inclusive:T.inclusive,inst:$,continue:!T.abort})}}),g5=k("$ZodCheckMultipleOf",($,T)=>{z4.init($,T),$._zod.onattach.push((W)=>{var U;(U=W._zod.bag).multipleOf??(U.multipleOf=T.value)}),$._zod.check=(W)=>{if(typeof W.value!==typeof T.value)throw new Error("Cannot mix number and bigint in multiple_of check.");if(typeof W.value==="bigint"?W.value%T.value===BigInt(0):s9(W.value,T.value)===0)return;W.issues.push({origin:typeof W.value,code:"not_multiple_of",divisor:T.value,input:W.value,inst:$,continue:!T.abort})}}),m5=k("$ZodCheckNumberFormat",($,T)=>{z4.init($,T),T.format=T.format||"float64";let W=T.format?.includes("int"),U=W?"int":"number",[X,w]=X5[T.format];$._zod.onattach.push((Y)=>{let G=Y._zod.bag;if(G.format=T.format,G.minimum=X,G.maximum=w,W)G.pattern=B5}),$._zod.check=(Y)=>{let G=Y.value;if(W){if(!Number.isInteger(G)){Y.issues.push({expected:U,format:T.format,code:"invalid_type",input:G,inst:$});return}if(!Number.isSafeInteger(G)){if(G>0)Y.issues.push({input:G,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:U,continue:!T.abort});else Y.issues.push({input:G,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:U,continue:!T.abort});return}}if(G<X)Y.issues.push({origin:"number",input:G,code:"too_small",minimum:X,inclusive:!0,inst:$,continue:!T.abort});if(G>w)Y.issues.push({origin:"number",input:G,code:"too_big",maximum:w,inst:$})}}),c5=k("$ZodCheckBigIntFormat",($,T)=>{z4.init($,T);let[W,U]=U5[T.format];$._zod.onattach.push((X)=>{let w=X._zod.bag;w.format=T.format,w.minimum=W,w.maximum=U}),$._zod.check=(X)=>{let w=X.value;if(w<W)X.issues.push({origin:"bigint",input:w,code:"too_small",minimum:W,inclusive:!0,inst:$,continue:!T.abort});if(w>U)X.issues.push({origin:"bigint",input:w,code:"too_big",maximum:U,inst:$})}}),u5=k("$ZodCheckMaxSize",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let U=W.value;return!wT(U)&&U.size!==void 0},$._zod.onattach.push((W)=>{let U=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(T.maximum<U)W._zod.bag.maximum=T.maximum}),$._zod.check=(W)=>{let U=W.value;if(U.size<=T.maximum)return;W.issues.push({origin:bX(U),code:"too_big",maximum:T.maximum,input:U,inst:$,continue:!T.abort})}}),p5=k("$ZodCheckMinSize",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let U=W.value;return!wT(U)&&U.size!==void 0},$._zod.onattach.push((W)=>{let U=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(T.minimum>U)W._zod.bag.minimum=T.minimum}),$._zod.check=(W)=>{let U=W.value;if(U.size>=T.minimum)return;W.issues.push({origin:bX(U),code:"too_small",minimum:T.minimum,input:U,inst:$,continue:!T.abort})}}),d5=k("$ZodCheckSizeEquals",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let U=W.value;return!wT(U)&&U.size!==void 0},$._zod.onattach.push((W)=>{let U=W._zod.bag;U.minimum=T.size,U.maximum=T.size,U.size=T.size}),$._zod.check=(W)=>{let U=W.value,X=U.size;if(X===T.size)return;let w=X>T.size;W.issues.push({origin:bX(U),...w?{code:"too_big",maximum:T.size}:{code:"too_small",minimum:T.size},input:W.value,inst:$,continue:!T.abort})}}),o5=k("$ZodCheckMaxLength",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let U=W.value;return!wT(U)&&U.length!==void 0},$._zod.onattach.push((W)=>{let U=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(T.maximum<U)W._zod.bag.maximum=T.maximum}),$._zod.check=(W)=>{let U=W.value;if(U.length<=T.maximum)return;let w=yX(U);W.issues.push({origin:w,code:"too_big",maximum:T.maximum,inclusive:!0,input:U,inst:$,continue:!T.abort})}}),l5=k("$ZodCheckMinLength",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let U=W.value;return!wT(U)&&U.length!==void 0},$._zod.onattach.push((W)=>{let U=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(T.minimum>U)W._zod.bag.minimum=T.minimum}),$._zod.check=(W)=>{let U=W.value;if(U.length>=T.minimum)return;let w=yX(U);W.issues.push({origin:w,code:"too_small",minimum:T.minimum,inclusive:!0,input:U,inst:$,continue:!T.abort})}}),r5=k("$ZodCheckLengthEquals",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let U=W.value;return!wT(U)&&U.length!==void 0},$._zod.onattach.push((W)=>{let U=W._zod.bag;U.minimum=T.length,U.maximum=T.length,U.length=T.length}),$._zod.check=(W)=>{let U=W.value,X=U.length;if(X===T.length)return;let w=yX(U),Y=X>T.length;W.issues.push({origin:w,...Y?{code:"too_big",maximum:T.length}:{code:"too_small",minimum:T.length},input:W.value,inst:$,continue:!T.abort})}}),oW=k("$ZodCheckStringFormat",($,T)=>{var W;z4.init($,T),$._zod.onattach.push((U)=>{let X=U._zod.bag;if(X.format=T.format,T.pattern)X.patterns??(X.patterns=new Set),X.patterns.add(T.pattern)}),(W=$._zod).check??(W.check=(U)=>{if(!T.pattern)throw new Error("Not implemented.");if(T.pattern.lastIndex=0,T.pattern.test(U.value))return;U.issues.push({origin:"string",code:"invalid_format",format:T.format,input:U.value,...T.pattern?{pattern:T.pattern.toString()}:{},inst:$,continue:!T.abort})})}),n5=k("$ZodCheckRegex",($,T)=>{oW.init($,T),$._zod.check=(W)=>{if(T.pattern.lastIndex=0,T.pattern.test(W.value))return;W.issues.push({origin:"string",code:"invalid_format",format:"regex",input:W.value,pattern:T.pattern.toString(),inst:$,continue:!T.abort})}}),i5=k("$ZodCheckLowerCase",($,T)=>{T.pattern??(T.pattern=y5),oW.init($,T)}),t5=k("$ZodCheckUpperCase",($,T)=>{T.pattern??(T.pattern=h5),oW.init($,T)}),a5=k("$ZodCheckIncludes",($,T)=>{z4.init($,T);let W=Q0(T.includes),U=new RegExp(typeof T.position==="number"?`^.{${T.position}}${W}`:W);T.pattern=U,$._zod.onattach.push((X)=>{let w=X._zod.bag;w.patterns??(w.patterns=new Set),w.patterns.add(U)}),$._zod.check=(X)=>{if(X.value.includes(T.includes,T.position))return;X.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:T.includes,input:X.value,inst:$,continue:!T.abort})}}),s5=k("$ZodCheckStartsWith",($,T)=>{z4.init($,T);let W=new RegExp(`^${Q0(T.prefix)}.*`);T.pattern??(T.pattern=W),$._zod.onattach.push((U)=>{let X=U._zod.bag;X.patterns??(X.patterns=new Set),X.patterns.add(W)}),$._zod.check=(U)=>{if(U.value.startsWith(T.prefix))return;U.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:T.prefix,input:U.value,inst:$,continue:!T.abort})}}),e5=k("$ZodCheckEndsWith",($,T)=>{z4.init($,T);let W=new RegExp(`.*${Q0(T.suffix)}$`);T.pattern??(T.pattern=W),$._zod.onattach.push((U)=>{let X=U._zod.bag;X.patterns??(X.patterns=new Set),X.patterns.add(W)}),$._zod.check=(U)=>{if(U.value.endsWith(T.suffix))return;U.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:T.suffix,input:U.value,inst:$,continue:!T.abort})}});function sV($,T,W){if($.issues.length)T.issues.push(...I6(W,$.issues))}var $7=k("$ZodCheckProperty",($,T)=>{z4.init($,T),$._zod.check=(W)=>{let U=T.schema._zod.run({value:W.value[T.property],issues:[]},{});if(U instanceof Promise)return U.then((X)=>sV(X,W,T.property));sV(U,W,T.property);return}}),T7=k("$ZodCheckMimeType",($,T)=>{z4.init($,T);let W=new Set(T.mime);$._zod.onattach.push((U)=>{U._zod.bag.mime=T.mime}),$._zod.check=(U)=>{if(W.has(U.value.type))return;U.issues.push({code:"invalid_value",values:T.mime,input:U.value.type,inst:$})}}),W7=k("$ZodCheckOverwrite",($,T)=>{z4.init($,T),$._zod.check=(W)=>{W.value=T.tx(W.value)}});class VY{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 W=$.split(`
|
|
7
|
+
`).filter((w)=>w),U=Math.min(...W.map((w)=>w.length-w.trimStart().length)),X=W.map((w)=>w.slice(U)).map((w)=>" ".repeat(this.indent*2)+w);for(let w of X)this.content.push(w)}compile(){let $=Function,T=this?.args,U=[...(this?.content??[""]).map((X)=>` ${X}`)];return new $(...T,U.join(`
|
|
8
|
+
`))}}var X7={major:4,minor:0,patch:0};var K$=k("$ZodType",($,T)=>{var W;$??($={}),h$($._zod,"id",()=>T.type+"_"+XY(10)),$._zod.def=T,$._zod.bag=$._zod.bag||{},$._zod.version=X7;let U=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))U.unshift($);for(let X of U)for(let w of X._zod.onattach)w($);if(U.length===0)(W=$._zod).deferred??(W.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let X=(w,Y,G)=>{let H=cT(w),z;for(let F of Y){if(F._zod.when){if(!F._zod.when(w))continue}else if(H)continue;let O=w.issues.length,Q=F._zod.check(w);if(Q instanceof Promise&&G?.async===!1)throw new O0;if(z||Q instanceof Promise)z=(z??Promise.resolve()).then(async()=>{if(await Q,w.issues.length===O)return;if(!H)H=cT(w,O)});else{if(w.issues.length===O)continue;if(!H)H=cT(w,O)}}if(z)return z.then(()=>{return w});return w};$._zod.run=(w,Y)=>{let G=$._zod.parse(w,Y);if(G instanceof Promise){if(Y.async===!1)throw new O0;return G.then((H)=>X(H,U,Y))}return X(G,U,Y)}}$["~standard"]={validate:(X)=>{try{let w=z5($,X);return w.success?{value:w.data}:{issues:w.error?.issues}}catch(w){return H5($,X).then((Y)=>Y.success?{value:Y.data}:{issues:Y.error?.issues})}},vendor:"zod",version:1}}),dT=k("$ZodString",($,T)=>{K$.init($,T),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??S5($._zod.bag),$._zod.parse=(W,U)=>{if(T.coerce)try{W.value=String(W.value)}catch(X){}if(typeof W.value==="string")return W;return W.issues.push({expected:"string",code:"invalid_type",input:W.value,inst:$}),W}}),r$=k("$ZodStringFormat",($,T)=>{oW.init($,T),dT.init($,T)}),w7=k("$ZodGUID",($,T)=>{T.pattern??(T.pattern=E5),r$.init($,T)}),Y7=k("$ZodUUID",($,T)=>{if(T.version){let U={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[T.version];if(U===void 0)throw new Error(`Invalid UUID version: "${T.version}"`);T.pattern??(T.pattern=uT(U))}else T.pattern??(T.pattern=uT());r$.init($,T)}),G7=k("$ZodEmail",($,T)=>{T.pattern??(T.pattern=M5),r$.init($,T)}),z7=k("$ZodURL",($,T)=>{r$.init($,T),$._zod.check=(W)=>{try{let U=new URL(W.value);if(T.hostname){if(T.hostname.lastIndex=0,!T.hostname.test(U.hostname))W.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:k5.source,input:W.value,inst:$,continue:!T.abort})}if(T.protocol){if(T.protocol.lastIndex=0,!T.protocol.test(U.protocol.endsWith(":")?U.protocol.slice(0,-1):U.protocol))W.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:T.protocol.source,input:W.value,inst:$,continue:!T.abort})}return}catch(U){W.issues.push({code:"invalid_format",format:"url",input:W.value,inst:$,continue:!T.abort})}}}),H7=k("$ZodEmoji",($,T)=>{T.pattern??(T.pattern=D5()),r$.init($,T)}),F7=k("$ZodNanoID",($,T)=>{T.pattern??(T.pattern=K5),r$.init($,T)}),O7=k("$ZodCUID",($,T)=>{T.pattern??(T.pattern=F5),r$.init($,T)}),Q7=k("$ZodCUID2",($,T)=>{T.pattern??(T.pattern=O5),r$.init($,T)}),Z7=k("$ZodULID",($,T)=>{T.pattern??(T.pattern=Q5),r$.init($,T)}),V7=k("$ZodXID",($,T)=>{T.pattern??(T.pattern=Z5),r$.init($,T)}),K7=k("$ZodKSUID",($,T)=>{T.pattern??(T.pattern=V5),r$.init($,T)}),A7=k("$ZodISODateTime",($,T)=>{T.pattern??(T.pattern=C5(T)),r$.init($,T);let W=$._zod.check}),E7=k("$ZodISODate",($,T)=>{T.pattern??(T.pattern=P5),r$.init($,T)}),M7=k("$ZodISOTime",($,T)=>{T.pattern??(T.pattern=q5(T)),r$.init($,T);let W=$._zod.check}),D7=k("$ZodISODuration",($,T)=>{T.pattern??(T.pattern=A5),r$.init($,T)}),N7=k("$ZodIPv4",($,T)=>{T.pattern??(T.pattern=N5),r$.init($,T),$._zod.onattach.push((W)=>{let U=W._zod.bag;U.format="ipv4"})}),J7=k("$ZodIPv6",($,T)=>{T.pattern??(T.pattern=J5),r$.init($,T),$._zod.onattach.push((W)=>{let U=W._zod.bag;U.format="ipv6"}),$._zod.check=(W)=>{try{new URL(`http://[${W.value}]`)}catch{W.issues.push({code:"invalid_format",format:"ipv6",input:W.value,inst:$,continue:!T.abort})}}}),L7=k("$ZodCIDRv4",($,T)=>{T.pattern??(T.pattern=L5),r$.init($,T)}),R7=k("$ZodCIDRv6",($,T)=>{T.pattern??(T.pattern=R5),r$.init($,T),$._zod.check=(W)=>{let[U,X]=W.value.split("/");try{if(!X)throw new Error;let w=Number(X);if(`${w}`!==X)throw new Error;if(w<0||w>128)throw new Error;new URL(`http://[${U}]`)}catch{W.issues.push({code:"invalid_format",format:"cidrv6",input:W.value,inst:$,continue:!T.abort})}}});function _7($){if($==="")return!0;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var k7=k("$ZodBase64",($,T)=>{T.pattern??(T.pattern=_5),r$.init($,T),$._zod.onattach.push((W)=>{W._zod.bag.contentEncoding="base64"}),$._zod.check=(W)=>{if(_7(W.value))return;W.issues.push({code:"invalid_format",format:"base64",input:W.value,inst:$,continue:!T.abort})}});function QK($){if(!OY.test($))return!1;let T=$.replace(/[-_]/g,(U)=>U==="-"?"+":"/"),W=T.padEnd(Math.ceil(T.length/4)*4,"=");return _7(W)}var v7=k("$ZodBase64URL",($,T)=>{T.pattern??(T.pattern=OY),r$.init($,T),$._zod.onattach.push((W)=>{W._zod.bag.contentEncoding="base64url"}),$._zod.check=(W)=>{if(QK(W.value))return;W.issues.push({code:"invalid_format",format:"base64url",input:W.value,inst:$,continue:!T.abort})}}),P7=k("$ZodE164",($,T)=>{T.pattern??(T.pattern=v5),r$.init($,T)});function ZK($,T=null){try{let W=$.split(".");if(W.length!==3)return!1;let[U]=W,X=JSON.parse(atob(U));if("typ"in X&&X?.typ!=="JWT")return!1;if(!X.alg)return!1;if(T&&(!("alg"in X)||X.alg!==T))return!1;return!0}catch{return!1}}var q7=k("$ZodJWT",($,T)=>{r$.init($,T),$._zod.check=(W)=>{if(ZK(W.value,T.alg))return;W.issues.push({code:"invalid_format",format:"jwt",input:W.value,inst:$,continue:!T.abort})}}),EY=k("$ZodNumber",($,T)=>{K$.init($,T),$._zod.pattern=$._zod.bag.pattern??I5,$._zod.parse=(W,U)=>{if(T.coerce)try{W.value=Number(W.value)}catch(Y){}let X=W.value;if(typeof X==="number"&&!Number.isNaN(X)&&Number.isFinite(X))return W;let w=typeof X==="number"?Number.isNaN(X)?"NaN":!Number.isFinite(X)?"Infinity":void 0:void 0;return W.issues.push({expected:"number",code:"invalid_type",input:X,inst:$,...w?{received:w}:{}}),W}}),C7=k("$ZodNumber",($,T)=>{m5.init($,T),EY.init($,T)}),cX=k("$ZodBoolean",($,T)=>{K$.init($,T),$._zod.pattern=x5,$._zod.parse=(W,U)=>{if(T.coerce)try{W.value=Boolean(W.value)}catch(w){}let X=W.value;if(typeof X==="boolean")return W;return W.issues.push({expected:"boolean",code:"invalid_type",input:X,inst:$}),W}}),MY=k("$ZodBigInt",($,T)=>{K$.init($,T),$._zod.pattern=j5,$._zod.parse=(W,U)=>{if(T.coerce)try{W.value=BigInt(W.value)}catch(w){}let{value:X}=W;if(typeof X==="bigint")return W;return W.issues.push({expected:"bigint",code:"invalid_type",input:X,inst:$}),W}}),S7=k("$ZodBigInt",($,T)=>{c5.init($,T),MY.init($,T)}),j7=k("$ZodSymbol",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{let{value:X}=W;if(typeof X==="symbol")return W;return W.issues.push({expected:"symbol",code:"invalid_type",input:X,inst:$}),W}}),B7=k("$ZodUndefined",($,T)=>{K$.init($,T),$._zod.pattern=b5,$._zod.values=new Set([void 0]),$._zod.parse=(W,U)=>{let{value:X}=W;if(typeof X==="undefined")return W;return W.issues.push({expected:"undefined",code:"invalid_type",input:X,inst:$}),W}}),I7=k("$ZodNull",($,T)=>{K$.init($,T),$._zod.pattern=f5,$._zod.values=new Set([null]),$._zod.parse=(W,U)=>{let{value:X}=W;if(X===null)return W;return W.issues.push({expected:"null",code:"invalid_type",input:X,inst:$}),W}}),x7=k("$ZodAny",($,T)=>{K$.init($,T),$._zod.parse=(W)=>W}),lW=k("$ZodUnknown",($,T)=>{K$.init($,T),$._zod.parse=(W)=>W}),f7=k("$ZodNever",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{return W.issues.push({expected:"never",code:"invalid_type",input:W.value,inst:$}),W}}),b7=k("$ZodVoid",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{let{value:X}=W;if(typeof X==="undefined")return W;return W.issues.push({expected:"void",code:"invalid_type",input:X,inst:$}),W}}),y7=k("$ZodDate",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{if(T.coerce)try{W.value=new Date(W.value)}catch(G){}let X=W.value,w=X instanceof Date;if(w&&!Number.isNaN(X.getTime()))return W;return W.issues.push({expected:"date",code:"invalid_type",input:X,...w?{received:"Invalid Date"}:{},inst:$}),W}});function TK($,T,W){if($.issues.length)T.issues.push(...I6(W,$.issues));T.value[W]=$.value}var uX=k("$ZodArray",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{let X=W.value;if(!Array.isArray(X))return W.issues.push({expected:"array",code:"invalid_type",input:X,inst:$}),W;W.value=Array(X.length);let w=[];for(let Y=0;Y<X.length;Y++){let G=X[Y],H=T.element._zod.run({value:G,issues:[]},U);if(H instanceof Promise)w.push(H.then((z)=>TK(z,W,Y)));else TK(H,W,Y)}if(w.length)return Promise.all(w).then(()=>W);return W}});function KY($,T,W){if($.issues.length)T.issues.push(...I6(W,$.issues));T.value[W]=$.value}function WK($,T,W,U){if($.issues.length)if(U[W]===void 0)if(W in U)T.value[W]=void 0;else T.value[W]=$.value;else T.issues.push(...I6(W,$.issues));else if($.value===void 0){if(W in U)T.value[W]=void 0}else T.value[W]=$.value}var h7=k("$ZodObject",($,T)=>{K$.init($,T);let W=BX(()=>{let O=Object.keys(T.shape);for(let Z of O)if(!(T.shape[Z]instanceof K$))throw new Error(`Invalid element at key "${Z}": expected a Zod schema`);let Q=W5(T.shape);return{shape:T.shape,keys:O,keySet:new Set(O),numKeys:O.length,optionalKeys:new Set(Q)}});h$($._zod,"propValues",()=>{let O=T.shape,Q={};for(let Z in O){let V=O[Z]._zod;if(V.values){Q[Z]??(Q[Z]=new Set);for(let A of V.values)Q[Z].add(A)}}return Q});let U=(O)=>{let Q=new VY(["shape","payload","ctx"]),{keys:Z,optionalKeys:V}=W.value,A=(L)=>{let _=mT(L);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};Q.write("const input = payload.value;");let D=Object.create(null);for(let L of Z)D[L]=XY(15);Q.write("const newResult = {}");for(let L of Z)if(V.has(L)){let _=D[L];Q.write(`const ${_} = ${A(L)};`);let C=mT(L);Q.write(`
|
|
9
9
|
if (${_}.issues.length) {
|
|
10
10
|
if (input[${C}] === undefined) {
|
|
11
11
|
if (${C} in input) {
|
|
@@ -24,27 +24,51 @@ ${Y.trace}`:"No previous disposal trace was found."),X.type){case"atom_family":c
|
|
|
24
24
|
} else {
|
|
25
25
|
newResult[${C}] = ${_}.value;
|
|
26
26
|
}
|
|
27
|
-
`)}else{let _=D[
|
|
27
|
+
`)}else{let _=D[L];Q.write(`const ${_} = ${A(L)};`),Q.write(`
|
|
28
28
|
if (${_}.issues.length) payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
|
29
29
|
...iss,
|
|
30
|
-
path: iss.path ? [${mT(
|
|
31
|
-
})));`),Q.write(`newResult[${mT(J)}] = ${_}.value`)}Q.write("payload.value = newResult;"),Q.write("return payload;");let L=Q.compile();return(J,_)=>L(O,J,_)},U,w=pW,Y=!CU.jitless,H=Y&&s9.value,{catchall:z}=T,F;$._zod.parse=(O,Q)=>{F??(F=W.value);let Z=O.value;if(!w(Z))return O.issues.push({expected:"object",code:"invalid_type",input:Z,inst:$}),O;let K=[];if(Y&&H&&Q?.async===!1&&Q.jitless!==!0){if(!U)U=X(T.shape);O=U(O,Q)}else{O.value={};let _=F.shape;for(let C of F.keys){let f=_[C],b=f._zod.run({value:Z[C],issues:[]},Q),g=f._zod.optin==="optional"&&f._zod.optout==="optional";if(b instanceof Promise)K.push(b.then((T$)=>g?aV(T$,O,C,Z):EY(T$,O,C)));else if(g)aV(b,O,C,Z);else EY(b,O,C)}}if(!z)return K.length?Promise.all(K).then(()=>O):O;let A=[],D=F.keySet,L=z._zod,J=L.def.type;for(let _ of Object.keys(Z)){if(D.has(_))continue;if(J==="never"){A.push(_);continue}let C=L.run({value:Z[_],issues:[]},Q);if(C instanceof Promise)K.push(C.then((f)=>EY(f,O,_)));else EY(C,O,_)}if(A.length)O.issues.push({code:"unrecognized_keys",keys:A,input:Z,inst:$});if(!K.length)return O;return Promise.all(K).then(()=>{return O})}});function sV($,T,W,X){for(let U of $)if(U.issues.length===0)return T.value=U.value,T;return T.issues.push({code:"invalid_union",input:T.value,inst:W,errors:$.map((U)=>U.issues.map((w)=>s6(w,X,N4())))}),T}var LY=k("$ZodUnion",($,T)=>{K$.init($,T),h$($._zod,"values",()=>{if(T.options.every((W)=>W._zod.values))return new Set(T.options.flatMap((W)=>Array.from(W._zod.values)));return}),h$($._zod,"pattern",()=>{if(T.options.every((W)=>W._zod.pattern)){let W=T.options.map((X)=>X._zod.pattern);return new RegExp(`^(${W.map((X)=>BU(X.source)).join("|")})$`)}return}),$._zod.parse=(W,X)=>{let U=!1,w=[];for(let Y of T.options){let G=Y._zod.run({value:W.value,issues:[]},X);if(G instanceof Promise)w.push(G),U=!0;else{if(G.issues.length===0)return G;w.push(G)}}if(!U)return sV(w,W,$,X);return Promise.all(w).then((Y)=>{return sV(Y,W,$,X)})}}),y7=k("$ZodDiscriminatedUnion",($,T)=>{LY.init($,T);let W=$._zod.parse;h$($._zod,"propValues",()=>{let U={};for(let w of T.options){let Y=w._zod.propValues;if(!Y||Object.keys(Y).length===0)throw new Error(`Invalid discriminated union option at index "${T.options.indexOf(w)}"`);for(let[G,H]of Object.entries(Y)){if(!U[G])U[G]=new Set;for(let z of H)U[G].add(z)}}return U});let X=IU(()=>{let U=T.options,w=new Map;for(let Y of U){let G=Y._zod.propValues[T.discriminator];if(!G||G.size===0)throw new Error(`Invalid discriminated union option at index "${T.options.indexOf(Y)}"`);for(let H of G){if(w.has(H))throw new Error(`Duplicate discriminator value "${String(H)}"`);w.set(H,Y)}}return w});$._zod.parse=(U,w)=>{let Y=U.value;if(!pW(Y))return U.issues.push({code:"invalid_type",expected:"object",input:Y,inst:$}),U;let G=X.value.get(Y?.[T.discriminator]);if(G)return G._zod.run(U,w);if(T.unionFallback)return W(U,w);return U.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:Y,path:[T.discriminator],inst:$}),U}}),h7=k("$ZodIntersection",($,T)=>{K$.init($,T),$._zod.parse=(W,X)=>{let{value:U}=W,w=T.left._zod.run({value:U,issues:[]},X),Y=T.right._zod.run({value:U,issues:[]},X);if(w instanceof Promise||Y instanceof Promise)return Promise.all([w,Y]).then(([H,z])=>{return eV(W,H,z)});return eV(W,w,Y)}});function W7($,T){if($===T)return{valid:!0,data:$};if($ instanceof Date&&T instanceof Date&&+$===+T)return{valid:!0,data:$};if(xU($)&&xU(T)){let W=Object.keys(T),X=Object.keys($).filter((w)=>W.indexOf(w)!==-1),U={...$,...T};for(let w of X){let Y=W7($[w],T[w]);if(!Y.valid)return{valid:!1,mergeErrorPath:[w,...Y.mergeErrorPath]};U[w]=Y.data}return{valid:!0,data:U}}if(Array.isArray($)&&Array.isArray(T)){if($.length!==T.length)return{valid:!1,mergeErrorPath:[]};let W=[];for(let X=0;X<$.length;X++){let U=$[X],w=T[X],Y=W7(U,w);if(!Y.valid)return{valid:!1,mergeErrorPath:[X,...Y.mergeErrorPath]};W.push(Y.data)}return{valid:!0,data:W}}return{valid:!1,mergeErrorPath:[]}}function eV($,T,W){if(T.issues.length)$.issues.push(...T.issues);if(W.issues.length)$.issues.push(...W.issues);if(cT($))return $;let X=W7(T.value,W.value);if(!X.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(X.mergeErrorPath)}`);return $.value=X.data,$}var oT=k("$ZodTuple",($,T)=>{K$.init($,T);let W=T.items,X=W.length-[...W].reverse().findIndex((U)=>U._zod.optin!=="optional");$._zod.parse=(U,w)=>{let Y=U.value;if(!Array.isArray(Y))return U.issues.push({input:Y,inst:$,expected:"tuple",code:"invalid_type"}),U;U.value=[];let G=[];if(!T.rest){let z=Y.length>W.length,F=Y.length<X-1;if(z||F)return U.issues.push({input:Y,inst:$,origin:"array",...z?{code:"too_big",maximum:W.length}:{code:"too_small",minimum:W.length}}),U}let H=-1;for(let z of W){if(H++,H>=Y.length){if(H>=X)continue}let F=z._zod.run({value:Y[H],issues:[]},w);if(F instanceof Promise)G.push(F.then((O)=>MY(O,U,H)));else MY(F,U,H)}if(T.rest){let z=Y.slice(W.length);for(let F of z){H++;let O=T.rest._zod.run({value:F,issues:[]},w);if(O instanceof Promise)G.push(O.then((Q)=>MY(Q,U,H)));else MY(O,U,H)}}if(G.length)return Promise.all(G).then(()=>U);return U}});function MY($,T,W){if($.issues.length)T.issues.push(...I6(W,$.issues));T.value[W]=$.value}var g7=k("$ZodRecord",($,T)=>{K$.init($,T),$._zod.parse=(W,X)=>{let U=W.value;if(!xU(U))return W.issues.push({expected:"record",code:"invalid_type",input:U,inst:$}),W;let w=[];if(T.keyType._zod.values){let Y=T.keyType._zod.values;W.value={};for(let H of Y)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let z=T.valueType._zod.run({value:U[H],issues:[]},X);if(z instanceof Promise)w.push(z.then((F)=>{if(F.issues.length)W.issues.push(...I6(H,F.issues));W.value[H]=F.value}));else{if(z.issues.length)W.issues.push(...I6(H,z.issues));W.value[H]=z.value}}let G;for(let H in U)if(!Y.has(H))G=G??[],G.push(H);if(G&&G.length>0)W.issues.push({code:"unrecognized_keys",input:U,inst:$,keys:G})}else{W.value={};for(let Y of Reflect.ownKeys(U)){if(Y==="__proto__")continue;let G=T.keyType._zod.run({value:Y,issues:[]},X);if(G instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(G.issues.length){W.issues.push({origin:"record",code:"invalid_key",issues:G.issues.map((z)=>s6(z,X,N4())),input:Y,path:[Y],inst:$}),W.value[G.value]=G.value;continue}let H=T.valueType._zod.run({value:U[Y],issues:[]},X);if(H instanceof Promise)w.push(H.then((z)=>{if(z.issues.length)W.issues.push(...I6(Y,z.issues));W.value[G.value]=z.value}));else{if(H.issues.length)W.issues.push(...I6(Y,H.issues));W.value[G.value]=H.value}}}if(w.length)return Promise.all(w).then(()=>W);return W}}),m7=k("$ZodMap",($,T)=>{K$.init($,T),$._zod.parse=(W,X)=>{let U=W.value;if(!(U instanceof Map))return W.issues.push({expected:"map",code:"invalid_type",input:U,inst:$}),W;let w=[];W.value=new Map;for(let[Y,G]of U){let H=T.keyType._zod.run({value:Y,issues:[]},X),z=T.valueType._zod.run({value:G,issues:[]},X);if(H instanceof Promise||z instanceof Promise)w.push(Promise.all([H,z]).then(([F,O])=>{$K(F,O,W,Y,U,$,X)}));else $K(H,z,W,Y,U,$,X)}if(w.length)return Promise.all(w).then(()=>W);return W}});function $K($,T,W,X,U,w,Y){if($.issues.length)if(fU.has(typeof X))W.issues.push(...I6(X,$.issues));else W.issues.push({origin:"map",code:"invalid_key",input:U,inst:w,issues:$.issues.map((G)=>s6(G,Y,N4()))});if(T.issues.length)if(fU.has(typeof X))W.issues.push(...I6(X,T.issues));else W.issues.push({origin:"map",code:"invalid_element",input:U,inst:w,key:X,issues:T.issues.map((G)=>s6(G,Y,N4()))});W.value.set($.value,T.value)}var c7=k("$ZodSet",($,T)=>{K$.init($,T),$._zod.parse=(W,X)=>{let U=W.value;if(!(U instanceof Set))return W.issues.push({input:U,inst:$,expected:"set",code:"invalid_type"}),W;let w=[];W.value=new Set;for(let Y of U){let G=T.valueType._zod.run({value:Y,issues:[]},X);if(G instanceof Promise)w.push(G.then((H)=>TK(H,W)));else TK(G,W)}if(w.length)return Promise.all(w).then(()=>W);return W}});function TK($,T){if($.issues.length)T.issues.push(...$.issues);T.value.add($.value)}var u7=k("$ZodEnum",($,T)=>{K$.init($,T);let W=jU(T.entries);$._zod.values=new Set(W),$._zod.pattern=new RegExp(`^(${W.filter((X)=>fU.has(typeof X)).map((X)=>typeof X==="string"?Q0(X):X.toString()).join("|")})$`),$._zod.parse=(X,U)=>{let w=X.value;if($._zod.values.has(w))return X;return X.issues.push({code:"invalid_value",values:W,input:w,inst:$}),X}}),p7=k("$ZodLiteral",($,T)=>{K$.init($,T),$._zod.values=new Set(T.values),$._zod.pattern=new RegExp(`^(${T.values.map((W)=>typeof W==="string"?Q0(W):W?W.toString():String(W)).join("|")})$`),$._zod.parse=(W,X)=>{let U=W.value;if($._zod.values.has(U))return W;return W.issues.push({code:"invalid_value",values:T.values,input:U,inst:$}),W}}),d7=k("$ZodFile",($,T)=>{K$.init($,T),$._zod.parse=(W,X)=>{let U=W.value;if(U instanceof File)return W;return W.issues.push({expected:"file",code:"invalid_type",input:U,inst:$}),W}}),pU=k("$ZodTransform",($,T)=>{K$.init($,T),$._zod.parse=(W,X)=>{let U=T.transform(W.value,W);if(X.async)return(U instanceof Promise?U:Promise.resolve(U)).then((Y)=>{return W.value=Y,W});if(U instanceof Promise)throw new O0;return W.value=U,W}}),o7=k("$ZodOptional",($,T)=>{K$.init($,T),$._zod.optin="optional",$._zod.optout="optional",h$($._zod,"values",()=>{return T.innerType._zod.values?new Set([...T.innerType._zod.values,void 0]):void 0}),h$($._zod,"pattern",()=>{let W=T.innerType._zod.pattern;return W?new RegExp(`^(${BU(W.source)})?$`):void 0}),$._zod.parse=(W,X)=>{if(W.value===void 0)return W;return T.innerType._zod.run(W,X)}}),l7=k("$ZodNullable",($,T)=>{K$.init($,T),h$($._zod,"optin",()=>T.innerType._zod.optin),h$($._zod,"optout",()=>T.innerType._zod.optout),h$($._zod,"pattern",()=>{let W=T.innerType._zod.pattern;return W?new RegExp(`^(${BU(W.source)}|null)$`):void 0}),h$($._zod,"values",()=>{return T.innerType._zod.values?new Set([...T.innerType._zod.values,null]):void 0}),$._zod.parse=(W,X)=>{if(W.value===null)return W;return T.innerType._zod.run(W,X)}}),r7=k("$ZodDefault",($,T)=>{K$.init($,T),$._zod.optin="optional",h$($._zod,"values",()=>T.innerType._zod.values),$._zod.parse=(W,X)=>{if(W.value===void 0)return W.value=T.defaultValue,W;let U=T.innerType._zod.run(W,X);if(U instanceof Promise)return U.then((w)=>WK(w,T));return WK(U,T)}});function WK($,T){if($.value===void 0)$.value=T.defaultValue;return $}var n7=k("$ZodPrefault",($,T)=>{K$.init($,T),$._zod.optin="optional",h$($._zod,"values",()=>T.innerType._zod.values),$._zod.parse=(W,X)=>{if(W.value===void 0)W.value=T.defaultValue;return T.innerType._zod.run(W,X)}}),i7=k("$ZodNonOptional",($,T)=>{K$.init($,T),h$($._zod,"values",()=>{let W=T.innerType._zod.values;return W?new Set([...W].filter((X)=>X!==void 0)):void 0}),$._zod.parse=(W,X)=>{let U=T.innerType._zod.run(W,X);if(U instanceof Promise)return U.then((w)=>UK(w,$));return UK(U,$)}});function UK($,T){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:T});return $}var t7=k("$ZodSuccess",($,T)=>{K$.init($,T),$._zod.parse=(W,X)=>{let U=T.innerType._zod.run(W,X);if(U instanceof Promise)return U.then((w)=>{return W.value=w.issues.length===0,W});return W.value=U.issues.length===0,W}}),a7=k("$ZodCatch",($,T)=>{K$.init($,T),h$($._zod,"optin",()=>T.innerType._zod.optin),h$($._zod,"optout",()=>T.innerType._zod.optout),h$($._zod,"values",()=>T.innerType._zod.values),$._zod.parse=(W,X)=>{let U=T.innerType._zod.run(W,X);if(U instanceof Promise)return U.then((w)=>{if(W.value=w.value,w.issues.length)W.value=T.catchValue({...W,error:{issues:w.issues.map((Y)=>s6(Y,X,N4()))},input:W.value}),W.issues=[];return W});if(W.value=U.value,U.issues.length)W.value=T.catchValue({...W,error:{issues:U.issues.map((w)=>s6(w,X,N4()))},input:W.value}),W.issues=[];return W}}),s7=k("$ZodNaN",($,T)=>{K$.init($,T),$._zod.parse=(W,X)=>{if(typeof W.value!=="number"||!Number.isNaN(W.value))return W.issues.push({input:W.value,inst:$,expected:"nan",code:"invalid_type"}),W;return W}}),dU=k("$ZodPipe",($,T)=>{K$.init($,T),h$($._zod,"values",()=>T.in._zod.values),h$($._zod,"optin",()=>T.in._zod.optin),h$($._zod,"optout",()=>T.out._zod.optout),$._zod.parse=(W,X)=>{let U=T.in._zod.run(W,X);if(U instanceof Promise)return U.then((w)=>XK(w,T,X));return XK(U,T,X)}});function XK($,T,W){if(cT($))return $;return T.out._zod.run({value:$.value,issues:$.issues},W)}var e7=k("$ZodReadonly",($,T)=>{K$.init($,T),h$($._zod,"propValues",()=>T.innerType._zod.propValues),h$($._zod,"optin",()=>T.innerType._zod.optin),h$($._zod,"optout",()=>T.innerType._zod.optout),$._zod.parse=(W,X)=>{let U=T.innerType._zod.run(W,X);if(U instanceof Promise)return U.then(wK);return wK(U)}});function wK($){return $.value=Object.freeze($.value),$}var $3=k("$ZodTemplateLiteral",($,T)=>{K$.init($,T);let W=[];for(let X of T.parts)if(X instanceof K$){if(!X._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...X._zod.traits].shift()}`);let U=X._zod.pattern instanceof RegExp?X._zod.pattern.source:X._zod.pattern;if(!U)throw new Error(`Invalid template literal part: ${X._zod.traits}`);let w=U.startsWith("^")?1:0,Y=U.endsWith("$")?U.length-1:U.length;W.push(U.slice(w,Y))}else if(X===null||e9.has(typeof X))W.push(Q0(`${X}`));else throw new Error(`Invalid template literal part: ${X}`);$._zod.pattern=new RegExp(`^${W.join("")}$`),$._zod.parse=(X,U)=>{if(typeof X.value!=="string")return X.issues.push({input:X.value,inst:$,expected:"template_literal",code:"invalid_type"}),X;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(X.value))return X.issues.push({input:X.value,inst:$,code:"invalid_format",format:"template_literal",pattern:$._zod.pattern.source}),X;return X}}),T3=k("$ZodPromise",($,T)=>{K$.init($,T),$._zod.parse=(W,X)=>{return Promise.resolve(W.value).then((U)=>T.innerType._zod.run({value:U,issues:[]},X))}}),W3=k("$ZodLazy",($,T)=>{K$.init($,T),h$($._zod,"innerType",()=>T.getter()),h$($._zod,"pattern",()=>$._zod.innerType._zod.pattern),h$($._zod,"propValues",()=>$._zod.innerType._zod.propValues),h$($._zod,"optin",()=>$._zod.innerType._zod.optin),h$($._zod,"optout",()=>$._zod.innerType._zod.optout),$._zod.parse=(W,X)=>{return $._zod.innerType._zod.run(W,X)}}),U3=k("$ZodCustom",($,T)=>{z4.init($,T),K$.init($,T),$._zod.parse=(W,X)=>{return W},$._zod.check=(W)=>{let X=W.value,U=T.fn(X);if(U instanceof Promise)return U.then((w)=>YK(w,W,X,$));YK(U,W,X,$);return}});function YK($,T,W,X){if(!$){let U={code:"custom",input:W,inst:X,path:[...X._zod.def.path??[]],continue:!X._zod.def.abort};if(X._zod.def.params)U.params=X._zod.def.params;T.issues.push(U5(U))}}var lU={};e0(lU,{zhTW:()=>m3,zhCN:()=>g3,vi:()=>h3,ur:()=>y3,ua:()=>b3,tr:()=>f3,th:()=>x3,ta:()=>B3,sv:()=>I3,sl:()=>j3,ru:()=>S3,pt:()=>C3,ps:()=>P3,pl:()=>q3,ota:()=>v3,no:()=>k3,nl:()=>_3,ms:()=>R3,mk:()=>J3,ko:()=>L3,kh:()=>N3,ja:()=>D3,it:()=>M3,id:()=>E3,hu:()=>A3,he:()=>K3,frCA:()=>V3,fr:()=>Z3,fi:()=>Q3,fa:()=>O3,es:()=>F3,en:()=>oU,de:()=>H3,cs:()=>z3,ca:()=>G3,be:()=>Y3,az:()=>w3,ar:()=>X3});var rP=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"number";case"object":{if(Array.isArray(U))return"array";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.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 ${U.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${W(U.input)}`;case"invalid_value":if(U.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 ${n(U.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: ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${U.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${w} ${U.maximum.toString()} ${Y.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 ${U.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${w} ${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${U.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${w} ${U.minimum.toString()} ${Y.unit}`;return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${U.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${w} ${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.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 "${U.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`${X[w.format]??U.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 ${U.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${U.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${U.keys.length>1?"\u0629":""}: ${x(U.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${U.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 ${U.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function X3(){return{localeError:rP()}}var nP=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"number";case"object":{if(Array.isArray(U))return"array";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${U.expected}, daxil olan ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${n(U.values[0])}`;return`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${U.origin??"d\u0259y\u0259r"} ${w}${U.maximum.toString()} ${Y.unit??"element"}`;return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${U.origin??"d\u0259y\u0259r"} ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${U.origin} ${w}${U.minimum.toString()} ${Y.unit}`;return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${U.origin} ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Yanl\u0131\u015F m\u0259tn: "${w.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`;if(w.format==="ends_with")return`Yanl\u0131\u015F m\u0259tn: "${w.suffix}" il\u0259 bitm\u0259lidir`;if(w.format==="includes")return`Yanl\u0131\u015F m\u0259tn: "${w.includes}" daxil olmal\u0131d\u0131r`;if(w.format==="regex")return`Yanl\u0131\u015F m\u0259tn: ${w.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`;return`Yanl\u0131\u015F ${X[w.format]??U.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${U.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${U.keys.length>1?"lar":""}: ${x(U.keys,", ")}`;case"invalid_key":return`${U.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${U.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function w3(){return{localeError:nP()}}function FK($,T,W,X){let U=Math.abs($),w=U%10,Y=U%100;if(Y>=11&&Y<=19)return X;if(w===1)return T;if(w>=2&&w<=4)return W;return X}var iP=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(U))return"\u043C\u0430\u0441\u0456\u045E";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.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 ${U.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${W(U.input)}`;case"invalid_value":if(U.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 ${n(U.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 ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y){let G=Number(U.maximum),H=FK(G,Y.unit.one,Y.unit.few,Y.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 ${U.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${Y.verb} ${w}${U.maximum.toString()} ${H}`}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 ${U.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y){let G=Number(U.minimum),H=FK(G,Y.unit.one,Y.unit.few,Y.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 ${U.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${Y.verb} ${w}${U.minimum.toString()} ${H}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${U.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.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 "${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${X[w.format]??U.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 ${U.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${U.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${x(U.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${U.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 ${U.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function Y3(){return{localeError:iP()}}var tP=()=>{let $={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"number";case"object":{if(Array.isArray(U))return"array";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${U.expected}, s'ha rebut ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Valor inv\xE0lid: s'esperava ${n(U.values[0])}`;return`Opci\xF3 inv\xE0lida: s'esperava una de ${x(U.values," o ")}`;case"too_big":{let w=U.inclusive?"com a m\xE0xim":"menys de",Y=T(U.origin);if(Y)return`Massa gran: s'esperava que ${U.origin??"el valor"} contingu\xE9s ${w} ${U.maximum.toString()} ${Y.unit??"elements"}`;return`Massa gran: s'esperava que ${U.origin??"el valor"} fos ${w} ${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?"com a m\xEDnim":"m\xE9s de",Y=T(U.origin);if(Y)return`Massa petit: s'esperava que ${U.origin} contingu\xE9s ${w} ${U.minimum.toString()} ${Y.unit}`;return`Massa petit: s'esperava que ${U.origin} fos ${w} ${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Format inv\xE0lid: ha de comen\xE7ar amb "${w.prefix}"`;if(w.format==="ends_with")return`Format inv\xE0lid: ha d'acabar amb "${w.suffix}"`;if(w.format==="includes")return`Format inv\xE0lid: ha d'incloure "${w.includes}"`;if(w.format==="regex")return`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${w.pattern}`;return`Format inv\xE0lid per a ${X[w.format]??U.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${U.divisor}`;case"unrecognized_keys":return`Clau${U.keys.length>1?"s":""} no reconeguda${U.keys.length>1?"s":""}: ${x(U.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${U.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${U.origin}`;default:return"Entrada inv\xE0lida"}}};function G3(){return{localeError:tP()}}var aP=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"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(U))return"pole";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${U.expected}, obdr\u017Eeno ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${n(U.values[0])}`;return`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${U.origin??"hodnota"} mus\xED m\xEDt ${w}${U.maximum.toString()} ${Y.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${U.origin??"hodnota"} mus\xED b\xFDt ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${U.origin??"hodnota"} mus\xED m\xEDt ${w}${U.minimum.toString()} ${Y.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${U.origin??"hodnota"} mus\xED b\xFDt ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${w.prefix}"`;if(w.format==="ends_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${w.suffix}"`;if(w.format==="includes")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${w.includes}"`;if(w.format==="regex")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${w.pattern}`;return`Neplatn\xFD form\xE1t ${X[w.format]??U.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${U.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${x(U.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${U.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${U.origin}`;default:return"Neplatn\xFD vstup"}}};function z3(){return{localeError:aP()}}var sP=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"Zahl";case"object":{if(Array.isArray(U))return"Array";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${U.expected}, erhalten ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Ung\xFCltige Eingabe: erwartet ${n(U.values[0])}`;return`Ung\xFCltige Option: erwartet eine von ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Zu gro\xDF: erwartet, dass ${U.origin??"Wert"} ${w}${U.maximum.toString()} ${Y.unit??"Elemente"} hat`;return`Zu gro\xDF: erwartet, dass ${U.origin??"Wert"} ${w}${U.maximum.toString()} ist`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Zu klein: erwartet, dass ${U.origin} ${w}${U.minimum.toString()} ${Y.unit} hat`;return`Zu klein: erwartet, dass ${U.origin} ${w}${U.minimum.toString()} ist`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Ung\xFCltiger String: muss mit "${w.prefix}" beginnen`;if(w.format==="ends_with")return`Ung\xFCltiger String: muss mit "${w.suffix}" enden`;if(w.format==="includes")return`Ung\xFCltiger String: muss "${w.includes}" enthalten`;if(w.format==="regex")return`Ung\xFCltiger String: muss dem Muster ${w.pattern} entsprechen`;return`Ung\xFCltig: ${X[w.format]??U.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${U.divisor} sein`;case"unrecognized_keys":return`${U.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${x(U.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${U.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${U.origin}`;default:return"Ung\xFCltige Eingabe"}}};function H3(){return{localeError:sP()}}var eP=($)=>{let T=typeof $;switch(T){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 T},$q=()=>{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 T(X){return $[X]??null}let W={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(X)=>{switch(X.code){case"invalid_type":return`Invalid input: expected ${X.expected}, received ${eP(X.input)}`;case"invalid_value":if(X.values.length===1)return`Invalid input: expected ${n(X.values[0])}`;return`Invalid option: expected one of ${x(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",w=T(X.origin);if(w)return`Too big: expected ${X.origin??"value"} to have ${U}${X.maximum.toString()} ${w.unit??"elements"}`;return`Too big: expected ${X.origin??"value"} to be ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",w=T(X.origin);if(w)return`Too small: expected ${X.origin} to have ${U}${X.minimum.toString()} ${w.unit}`;return`Too small: expected ${X.origin} to be ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Invalid string: must start with "${U.prefix}"`;if(U.format==="ends_with")return`Invalid string: must end with "${U.suffix}"`;if(U.format==="includes")return`Invalid string: must include "${U.includes}"`;if(U.format==="regex")return`Invalid string: must match pattern ${U.pattern}`;return`Invalid ${W[U.format]??X.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${X.divisor}`;case"unrecognized_keys":return`Unrecognized key${X.keys.length>1?"s":""}: ${x(X.keys,", ")}`;case"invalid_key":return`Invalid key in ${X.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${X.origin}`;default:return"Invalid input"}}};function oU(){return{localeError:$q()}}var Tq=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(U))return"arreglo";if(U===null)return"nulo";if(Object.getPrototypeOf(U)!==Object.prototype)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${U.expected}, recibido ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Entrada inv\xE1lida: se esperaba ${n(U.values[0])}`;return`Opci\xF3n inv\xE1lida: se esperaba una de ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Demasiado grande: se esperaba que ${U.origin??"valor"} tuviera ${w}${U.maximum.toString()} ${Y.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${U.origin??"valor"} fuera ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Demasiado peque\xF1o: se esperaba que ${U.origin} tuviera ${w}${U.minimum.toString()} ${Y.unit}`;return`Demasiado peque\xF1o: se esperaba que ${U.origin} fuera ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Cadena inv\xE1lida: debe comenzar con "${w.prefix}"`;if(w.format==="ends_with")return`Cadena inv\xE1lida: debe terminar en "${w.suffix}"`;if(w.format==="includes")return`Cadena inv\xE1lida: debe incluir "${w.includes}"`;if(w.format==="regex")return`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${w.pattern}`;return`Inv\xE1lido ${X[w.format]??U.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${U.divisor}`;case"unrecognized_keys":return`Llave${U.keys.length>1?"s":""} desconocida${U.keys.length>1?"s":""}: ${x(U.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${U.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${U.origin}`;default:return"Entrada inv\xE1lida"}}};function F3(){return{localeError:Tq()}}var Wq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(U))return"\u0622\u0631\u0627\u06CC\u0647";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.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 ${U.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${W(U.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":if(U.values.length===1)return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${n(U.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 ${x(U.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${U.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${w}${U.maximum.toString()} ${Y.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${U.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${w}${U.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${U.origin} \u0628\u0627\u06CC\u062F ${w}${U.minimum.toString()} ${Y.unit} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${U.origin} \u0628\u0627\u06CC\u062F ${w}${U.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${w.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`;if(w.format==="ends_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${w.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`;if(w.format==="includes")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${w.includes}" \u0628\u0627\u0634\u062F`;if(w.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 ${w.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`;return`${X[w.format]??U.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 ${U.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${U.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${x(U.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${U.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 ${U.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function O3(){return{localeError:Wq()}}var Uq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"number";case"object":{if(Array.isArray(U))return"array";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${U.expected}, oli ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Virheellinen sy\xF6te: t\xE4ytyy olla ${n(U.values[0])}`;return`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Liian suuri: ${Y.subject} t\xE4ytyy olla ${w}${U.maximum.toString()} ${Y.unit}`.trim();return`Liian suuri: arvon t\xE4ytyy olla ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Liian pieni: ${Y.subject} t\xE4ytyy olla ${w}${U.minimum.toString()} ${Y.unit}`.trim();return`Liian pieni: arvon t\xE4ytyy olla ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${w.prefix}"`;if(w.format==="ends_with")return`Virheellinen sy\xF6te: t\xE4ytyy loppua "${w.suffix}"`;if(w.format==="includes")return`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${w.includes}"`;if(w.format==="regex")return`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${w.pattern}`;return`Virheellinen ${X[w.format]??U.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${U.divisor} monikerta`;case"unrecognized_keys":return`${U.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${x(U.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 Q3(){return{localeError:Uq()}}var Xq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"nombre";case"object":{if(Array.isArray(U))return"tableau";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Entr\xE9e invalide : ${U.expected} attendu, ${W(U.input)} re\xE7u`;case"invalid_value":if(U.values.length===1)return`Entr\xE9e invalide : ${n(U.values[0])} attendu`;return`Option invalide : une valeur parmi ${x(U.values,"|")} attendue`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Trop grand : ${U.origin??"valeur"} doit ${Y.verb} ${w}${U.maximum.toString()} ${Y.unit??"\xE9l\xE9ment(s)"}`;return`Trop grand : ${U.origin??"valeur"} doit \xEAtre ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Trop petit : ${U.origin} doit ${Y.verb} ${w}${U.minimum.toString()} ${Y.unit}`;return`Trop petit : ${U.origin} doit \xEAtre ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${w.prefix}"`;if(w.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${w.suffix}"`;if(w.format==="includes")return`Cha\xEEne invalide : doit inclure "${w.includes}"`;if(w.format==="regex")return`Cha\xEEne invalide : doit correspondre au mod\xE8le ${w.pattern}`;return`${X[w.format]??U.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${U.divisor}`;case"unrecognized_keys":return`Cl\xE9${U.keys.length>1?"s":""} non reconnue${U.keys.length>1?"s":""} : ${x(U.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${U.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${U.origin}`;default:return"Entr\xE9e invalide"}}};function Z3(){return{localeError:Xq()}}var wq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"number";case"object":{if(Array.isArray(U))return"array";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${U.expected}, re\xE7u ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Entr\xE9e invalide : attendu ${n(U.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"\u2264":"<",Y=T(U.origin);if(Y)return`Trop grand : attendu que ${U.origin??"la valeur"} ait ${w}${U.maximum.toString()} ${Y.unit}`;return`Trop grand : attendu que ${U.origin??"la valeur"} soit ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?"\u2265":">",Y=T(U.origin);if(Y)return`Trop petit : attendu que ${U.origin} ait ${w}${U.minimum.toString()} ${Y.unit}`;return`Trop petit : attendu que ${U.origin} soit ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${w.prefix}"`;if(w.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${w.suffix}"`;if(w.format==="includes")return`Cha\xEEne invalide : doit inclure "${w.includes}"`;if(w.format==="regex")return`Cha\xEEne invalide : doit correspondre au motif ${w.pattern}`;return`${X[w.format]??U.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${U.divisor}`;case"unrecognized_keys":return`Cl\xE9${U.keys.length>1?"s":""} non reconnue${U.keys.length>1?"s":""} : ${x(U.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${U.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${U.origin}`;default:return"Entr\xE9e invalide"}}};function V3(){return{localeError:wq()}}var Yq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"number";case"object":{if(Array.isArray(U))return"array";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${U.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${n(U.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 ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${U.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${w}${U.maximum.toString()} ${Y.unit??"elements"}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${U.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${U.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${w}${U.minimum.toString()} ${Y.unit}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${U.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.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"${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`${X[w.format]??U.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 ${U.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${U.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${U.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${x(U.keys,", ")}`;case"invalid_key":return`\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${U.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${U.origin}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function K3(){return{localeError:Yq()}}var Gq=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(U))return"t\xF6mb";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${U.expected}, a kapott \xE9rt\xE9k ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${n(U.values[0])}`;return`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`T\xFAl nagy: ${U.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${w}${U.maximum.toString()} ${Y.unit??"elem"}`;return`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${U.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${U.origin} m\xE9rete t\xFAl kicsi ${w}${U.minimum.toString()} ${Y.unit}`;return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${U.origin} t\xFAl kicsi ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`\xC9rv\xE9nytelen string: "${w.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`;if(w.format==="ends_with")return`\xC9rv\xE9nytelen string: "${w.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`;if(w.format==="includes")return`\xC9rv\xE9nytelen string: "${w.includes}" \xE9rt\xE9ket kell tartalmaznia`;if(w.format==="regex")return`\xC9rv\xE9nytelen string: ${w.pattern} mint\xE1nak kell megfelelnie`;return`\xC9rv\xE9nytelen ${X[w.format]??U.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${U.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${U.keys.length>1?"s":""}: ${x(U.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${U.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${U.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function A3(){return{localeError:Gq()}}var zq=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"number";case"object":{if(Array.isArray(U))return"array";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Input tidak valid: diharapkan ${U.expected}, diterima ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Input tidak valid: diharapkan ${n(U.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Terlalu besar: diharapkan ${U.origin??"value"} memiliki ${w}${U.maximum.toString()} ${Y.unit??"elemen"}`;return`Terlalu besar: diharapkan ${U.origin??"value"} menjadi ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Terlalu kecil: diharapkan ${U.origin} memiliki ${w}${U.minimum.toString()} ${Y.unit}`;return`Terlalu kecil: diharapkan ${U.origin} menjadi ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`String tidak valid: harus dimulai dengan "${w.prefix}"`;if(w.format==="ends_with")return`String tidak valid: harus berakhir dengan "${w.suffix}"`;if(w.format==="includes")return`String tidak valid: harus menyertakan "${w.includes}"`;if(w.format==="regex")return`String tidak valid: harus sesuai pola ${w.pattern}`;return`${X[w.format]??U.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${U.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${U.keys.length>1?"s":""}: ${x(U.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${U.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${U.origin}`;default:return"Input tidak valid"}}};function E3(){return{localeError:zq()}}var Hq=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"numero";case"object":{if(Array.isArray(U))return"vettore";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Input non valido: atteso ${U.expected}, ricevuto ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Input non valido: atteso ${n(U.values[0])}`;return`Opzione non valida: atteso uno tra ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Troppo grande: ${U.origin??"valore"} deve avere ${w}${U.maximum.toString()} ${Y.unit??"elementi"}`;return`Troppo grande: ${U.origin??"valore"} deve essere ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Troppo piccolo: ${U.origin} deve avere ${w}${U.minimum.toString()} ${Y.unit}`;return`Troppo piccolo: ${U.origin} deve essere ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Stringa non valida: deve iniziare con "${w.prefix}"`;if(w.format==="ends_with")return`Stringa non valida: deve terminare con "${w.suffix}"`;if(w.format==="includes")return`Stringa non valida: deve includere "${w.includes}"`;if(w.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${w.pattern}`;return`Invalid ${X[w.format]??U.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${U.divisor}`;case"unrecognized_keys":return`Chiav${U.keys.length>1?"i":"e"} non riconosciut${U.keys.length>1?"e":"a"}: ${x(U.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${U.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${U.origin}`;default:return"Input non valido"}}};function M3(){return{localeError:Hq()}}var Fq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(U))return"\u914D\u5217";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${U.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${W(U.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":if(U.values.length===1)return`\u7121\u52B9\u306A\u5165\u529B: ${n(U.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u9078\u629E: ${x(U.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let w=U.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",Y=T(U.origin);if(Y)return`\u5927\u304D\u3059\u304E\u308B\u5024: ${U.origin??"\u5024"}\u306F${U.maximum.toString()}${Y.unit??"\u8981\u7D20"}${w}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5927\u304D\u3059\u304E\u308B\u5024: ${U.origin??"\u5024"}\u306F${U.maximum.toString()}${w}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let w=U.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",Y=T(U.origin);if(Y)return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${U.origin}\u306F${U.minimum.toString()}${Y.unit}${w}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${U.origin}\u306F${U.minimum.toString()}${w}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${w.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(w.format==="ends_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${w.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(w.format==="includes")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${w.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(w.format==="regex")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${w.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u7121\u52B9\u306A${X[w.format]??U.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${U.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${U.keys.length>1?"\u7FA4":""}: ${x(U.keys,"\u3001")}`;case"invalid_key":return`${U.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${U.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function D3(){return{localeError:Fq()}}var Oq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(U))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(U===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.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 ${U.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${W(U.input)}`;case"invalid_value":if(U.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 ${n(U.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 ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${U.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${w} ${U.maximum.toString()} ${Y.unit??"\u1792\u17B6\u178F\u17BB"}`;return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${U.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${w} ${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${U.origin} ${w} ${U.minimum.toString()} ${Y.unit}`;return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${U.origin} ${w} ${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.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 "${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${X[w.format]??U.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 ${U.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${x(U.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 ${U.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 ${U.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 N3(){return{localeError:Oq()}}var Qq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"number";case"object":{if(Array.isArray(U))return"array";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${U.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${W(U.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":if(U.values.length===1)return`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${n(U.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC635\uC158: ${x(U.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let w=U.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",Y=w==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",G=T(U.origin),H=G?.unit??"\uC694\uC18C";if(G)return`${U.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${U.maximum.toString()}${H} ${w}${Y}`;return`${U.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${U.maximum.toString()} ${w}${Y}`}case"too_small":{let w=U.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",Y=w==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",G=T(U.origin),H=G?.unit??"\uC694\uC18C";if(G)return`${U.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${U.minimum.toString()}${H} ${w}${Y}`;return`${U.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${U.minimum.toString()} ${w}${Y}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${w.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`;if(w.format==="ends_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${w.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`;if(w.format==="includes")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${w.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`;if(w.format==="regex")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${w.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C ${X[w.format]??U.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${U.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${x(U.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${U.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${U.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function L3(){return{localeError:Qq()}}var Zq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(U))return"\u043D\u0438\u0437\u0430";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${U.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${n(U.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 ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${U.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${w}${U.maximum.toString()} ${Y.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 ${U.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${U.origin} \u0434\u0430 \u0438\u043C\u0430 ${w}${U.minimum.toString()} ${Y.unit}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${U.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.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 "${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`Invalid ${X[w.format]??U.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 ${U.divisor}`;case"unrecognized_keys":return`${U.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"}: ${x(U.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${U.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 ${U.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function J3(){return{localeError:Zq()}}var Vq=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"nombor";case"object":{if(Array.isArray(U))return"array";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Input tidak sah: dijangka ${U.expected}, diterima ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Input tidak sah: dijangka ${n(U.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Terlalu besar: dijangka ${U.origin??"nilai"} ${Y.verb} ${w}${U.maximum.toString()} ${Y.unit??"elemen"}`;return`Terlalu besar: dijangka ${U.origin??"nilai"} adalah ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Terlalu kecil: dijangka ${U.origin} ${Y.verb} ${w}${U.minimum.toString()} ${Y.unit}`;return`Terlalu kecil: dijangka ${U.origin} adalah ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`String tidak sah: mesti bermula dengan "${w.prefix}"`;if(w.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${w.suffix}"`;if(w.format==="includes")return`String tidak sah: mesti mengandungi "${w.includes}"`;if(w.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${w.pattern}`;return`${X[w.format]??U.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${U.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${x(U.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${U.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${U.origin}`;default:return"Input tidak sah"}}};function R3(){return{localeError:Vq()}}var Kq=()=>{let $={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"getal";case"object":{if(Array.isArray(U))return"array";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Ongeldige invoer: verwacht ${U.expected}, ontving ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Ongeldige invoer: verwacht ${n(U.values[0])}`;return`Ongeldige optie: verwacht \xE9\xE9n van ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Te lang: verwacht dat ${U.origin??"waarde"} ${w}${U.maximum.toString()} ${Y.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${U.origin??"waarde"} ${w}${U.maximum.toString()} is`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Te kort: verwacht dat ${U.origin} ${w}${U.minimum.toString()} ${Y.unit} bevat`;return`Te kort: verwacht dat ${U.origin} ${w}${U.minimum.toString()} is`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Ongeldige tekst: moet met "${w.prefix}" beginnen`;if(w.format==="ends_with")return`Ongeldige tekst: moet op "${w.suffix}" eindigen`;if(w.format==="includes")return`Ongeldige tekst: moet "${w.includes}" bevatten`;if(w.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${w.pattern}`;return`Ongeldig: ${X[w.format]??U.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${U.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${U.keys.length>1?"s":""}: ${x(U.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${U.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${U.origin}`;default:return"Ongeldige invoer"}}};function _3(){return{localeError:Kq()}}var Aq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"tall";case"object":{if(Array.isArray(U))return"liste";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Ugyldig input: forventet ${U.expected}, fikk ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Ugyldig verdi: forventet ${n(U.values[0])}`;return`Ugyldig valg: forventet en av ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`For stor(t): forventet ${U.origin??"value"} til \xE5 ha ${w}${U.maximum.toString()} ${Y.unit??"elementer"}`;return`For stor(t): forventet ${U.origin??"value"} til \xE5 ha ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`For lite(n): forventet ${U.origin} til \xE5 ha ${w}${U.minimum.toString()} ${Y.unit}`;return`For lite(n): forventet ${U.origin} til \xE5 ha ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Ugyldig streng: m\xE5 starte med "${w.prefix}"`;if(w.format==="ends_with")return`Ugyldig streng: m\xE5 ende med "${w.suffix}"`;if(w.format==="includes")return`Ugyldig streng: m\xE5 inneholde "${w.includes}"`;if(w.format==="regex")return`Ugyldig streng: m\xE5 matche m\xF8nsteret ${w.pattern}`;return`Ugyldig ${X[w.format]??U.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${x(U.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${U.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${U.origin}`;default:return"Ugyldig input"}}};function k3(){return{localeError:Aq()}}var Eq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"numara";case"object":{if(Array.isArray(U))return"saf";if(U===null)return"gayb";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`F\xE2sit giren: umulan ${U.expected}, al\u0131nan ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`F\xE2sit giren: umulan ${n(U.values[0])}`;return`F\xE2sit tercih: m\xFBteberler ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Fazla b\xFCy\xFCk: ${U.origin??"value"}, ${w}${U.maximum.toString()} ${Y.unit??"elements"} sahip olmal\u0131yd\u0131.`;return`Fazla b\xFCy\xFCk: ${U.origin??"value"}, ${w}${U.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Fazla k\xFC\xE7\xFCk: ${U.origin}, ${w}${U.minimum.toString()} ${Y.unit} sahip olmal\u0131yd\u0131.`;return`Fazla k\xFC\xE7\xFCk: ${U.origin}, ${w}${U.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`F\xE2sit metin: "${w.prefix}" ile ba\u015Flamal\u0131.`;if(w.format==="ends_with")return`F\xE2sit metin: "${w.suffix}" ile bitmeli.`;if(w.format==="includes")return`F\xE2sit metin: "${w.includes}" ihtiv\xE2 etmeli.`;if(w.format==="regex")return`F\xE2sit metin: ${w.pattern} nak\u015F\u0131na uymal\u0131.`;return`F\xE2sit ${X[w.format]??U.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${U.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${U.keys.length>1?"s":""}: ${x(U.keys,", ")}`;case"invalid_key":return`${U.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${U.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function v3(){return{localeError:Eq()}}var Mq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(U))return"\u0627\u0631\u06D0";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${U.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${W(U.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":if(U.values.length===1)return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${n(U.values[0])} \u0648\u0627\u06CC`;return`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${x(U.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${U.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${w}${U.maximum.toString()} ${Y.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${U.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${w}${U.maximum.toString()} \u0648\u064A`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${U.origin} \u0628\u0627\u06CC\u062F ${w}${U.minimum.toString()} ${Y.unit} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${U.origin} \u0628\u0627\u06CC\u062F ${w}${U.minimum.toString()} \u0648\u064A`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${w.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`;if(w.format==="ends_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${w.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`;if(w.format==="includes")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${w.includes}" \u0648\u0644\u0631\u064A`;if(w.format==="regex")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${w.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`;return`${X[w.format]??U.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${U.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${U.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${x(U.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${U.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 ${U.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function P3(){return{localeError:Mq()}}var Dq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"liczba";case"object":{if(Array.isArray(U))return"tablica";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${U.expected}, otrzymano ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${n(U.values[0])}`;return`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${U.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${w}${U.maximum.toString()} ${Y.unit??"element\xF3w"}`;return`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${U.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${U.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${w}${U.minimum.toString()} ${Y.unit??"element\xF3w"}`;return`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${U.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${w.prefix}"`;if(w.format==="ends_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${w.suffix}"`;if(w.format==="includes")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${w.includes}"`;if(w.format==="regex")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${w.pattern}`;return`Nieprawid\u0142ow(y/a/e) ${X[w.format]??U.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${U.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${U.keys.length>1?"s":""}: ${x(U.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${U.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${U.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function q3(){return{localeError:Dq()}}var Nq=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(U))return"array";if(U===null)return"nulo";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${U.expected}, recebido ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Entrada inv\xE1lida: esperado ${n(U.values[0])}`;return`Op\xE7\xE3o inv\xE1lida: esperada uma das ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Muito grande: esperado que ${U.origin??"valor"} tivesse ${w}${U.maximum.toString()} ${Y.unit??"elementos"}`;return`Muito grande: esperado que ${U.origin??"valor"} fosse ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Muito pequeno: esperado que ${U.origin} tivesse ${w}${U.minimum.toString()} ${Y.unit}`;return`Muito pequeno: esperado que ${U.origin} fosse ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Texto inv\xE1lido: deve come\xE7ar com "${w.prefix}"`;if(w.format==="ends_with")return`Texto inv\xE1lido: deve terminar com "${w.suffix}"`;if(w.format==="includes")return`Texto inv\xE1lido: deve incluir "${w.includes}"`;if(w.format==="regex")return`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${w.pattern}`;return`${X[w.format]??U.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${U.divisor}`;case"unrecognized_keys":return`Chave${U.keys.length>1?"s":""} desconhecida${U.keys.length>1?"s":""}: ${x(U.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${U.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${U.origin}`;default:return"Campo inv\xE1lido"}}};function C3(){return{localeError:Nq()}}function OK($,T,W,X){let U=Math.abs($),w=U%10,Y=U%100;if(Y>=11&&Y<=19)return X;if(w===1)return T;if(w>=2&&w<=4)return W;return X}var Lq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(U))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.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 ${U.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${W(U.input)}`;case"invalid_value":if(U.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 ${n(U.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 ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y){let G=Number(U.maximum),H=OK(G,Y.unit.one,Y.unit.few,Y.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 ${U.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${w}${U.maximum.toString()} ${H}`}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 ${U.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y){let G=Number(U.minimum),H=OK(G,Y.unit.one,Y.unit.few,Y.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 ${U.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${w}${U.minimum.toString()} ${H}`}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 ${U.origin} \u0431\u0443\u0434\u0435\u0442 ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.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 "${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${X[w.format]??U.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 ${U.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${U.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${U.keys.length>1?"\u0438":""}: ${x(U.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${U.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 ${U.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 S3(){return{localeError:Lq()}}var Jq=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(U))return"tabela";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${U.expected}, prejeto ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Neveljaven vnos: pri\u010Dakovano ${n(U.values[0])}`;return`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Preveliko: pri\u010Dakovano, da bo ${U.origin??"vrednost"} imelo ${w}${U.maximum.toString()} ${Y.unit??"elementov"}`;return`Preveliko: pri\u010Dakovano, da bo ${U.origin??"vrednost"} ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Premajhno: pri\u010Dakovano, da bo ${U.origin} imelo ${w}${U.minimum.toString()} ${Y.unit}`;return`Premajhno: pri\u010Dakovano, da bo ${U.origin} ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Neveljaven niz: mora se za\u010Deti z "${w.prefix}"`;if(w.format==="ends_with")return`Neveljaven niz: mora se kon\u010Dati z "${w.suffix}"`;if(w.format==="includes")return`Neveljaven niz: mora vsebovati "${w.includes}"`;if(w.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${w.pattern}`;return`Neveljaven ${X[w.format]??U.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${U.divisor}`;case"unrecognized_keys":return`Neprepoznan${U.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${x(U.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${U.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${U.origin}`;default:return"Neveljaven vnos"}}};function j3(){return{localeError:Jq()}}var Rq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"antal";case"object":{if(Array.isArray(U))return"lista";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${U.expected}, fick ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`Ogiltig inmatning: f\xF6rv\xE4ntat ${n(U.values[0])}`;return`Ogiltigt val: f\xF6rv\xE4ntade en av ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`F\xF6r stor(t): f\xF6rv\xE4ntade ${U.origin??"v\xE4rdet"} att ha ${w}${U.maximum.toString()} ${Y.unit??"element"}`;return`F\xF6r stor(t): f\xF6rv\xE4ntat ${U.origin??"v\xE4rdet"} att ha ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`F\xF6r lite(t): f\xF6rv\xE4ntade ${U.origin??"v\xE4rdet"} att ha ${w}${U.minimum.toString()} ${Y.unit}`;return`F\xF6r lite(t): f\xF6rv\xE4ntade ${U.origin??"v\xE4rdet"} att ha ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${w.prefix}"`;if(w.format==="ends_with")return`Ogiltig str\xE4ng: m\xE5ste sluta med "${w.suffix}"`;if(w.format==="includes")return`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${w.includes}"`;if(w.format==="regex")return`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${w.pattern}"`;return`Ogiltig(t) ${X[w.format]??U.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${x(U.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${U.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${U.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function I3(){return{localeError:Rq()}}var _q=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(U))return"\u0B85\u0BA3\u0BBF";if(U===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.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 ${U.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${W(U.input)}`;case"invalid_value":if(U.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 ${n(U.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 ${x(U.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)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 ${U.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${w}${U.maximum.toString()} ${Y.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 ${U.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${w}${U.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)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 ${U.origin} ${w}${U.minimum.toString()} ${Y.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 ${U.origin} ${w}${U.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${w.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(w.format==="ends_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${w.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(w.format==="includes")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${w.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(w.format==="regex")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${w.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 ${X[w.format]??U.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${U.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${U.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${x(U.keys,", ")}`;case"invalid_key":return`${U.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`${U.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 B3(){return{localeError:_q()}}var kq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(U))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(U===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.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 ${U.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${n(U.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 ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",Y=T(U.origin);if(Y)return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${U.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${w} ${U.maximum.toString()} ${Y.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`;return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${U.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${w} ${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",Y=T(U.origin);if(Y)return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${U.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${w} ${U.minimum.toString()} ${Y.unit}`;return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${U.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${w} ${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.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 "${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`;if(w.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 ${w.pattern}`;return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${X[w.format]??U.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 ${U.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: ${x(U.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${U.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 ${U.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function x3(){return{localeError:kq()}}var vq=($)=>{let T=typeof $;switch(T){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 T},Pq=()=>{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 T(X){return $[X]??null}let W={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(X)=>{switch(X.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${X.expected}, al\u0131nan ${vq(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ge\xE7ersiz de\u011Fer: beklenen ${n(X.values[0])}`;return`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${x(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",w=T(X.origin);if(w)return`\xC7ok b\xFCy\xFCk: beklenen ${X.origin??"de\u011Fer"} ${U}${X.maximum.toString()} ${w.unit??"\xF6\u011Fe"}`;return`\xC7ok b\xFCy\xFCk: beklenen ${X.origin??"de\u011Fer"} ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",w=T(X.origin);if(w)return`\xC7ok k\xFC\xE7\xFCk: beklenen ${X.origin} ${U}${X.minimum.toString()} ${w.unit}`;return`\xC7ok k\xFC\xE7\xFCk: beklenen ${X.origin} ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Ge\xE7ersiz metin: "${U.prefix}" ile ba\u015Flamal\u0131`;if(U.format==="ends_with")return`Ge\xE7ersiz metin: "${U.suffix}" ile bitmeli`;if(U.format==="includes")return`Ge\xE7ersiz metin: "${U.includes}" i\xE7ermeli`;if(U.format==="regex")return`Ge\xE7ersiz metin: ${U.pattern} desenine uymal\u0131`;return`Ge\xE7ersiz ${W[U.format]??X.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${X.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${X.keys.length>1?"lar":""}: ${x(X.keys,", ")}`;case"invalid_key":return`${X.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${X.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function f3(){return{localeError:Pq()}}var qq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(U))return"\u043C\u0430\u0441\u0438\u0432";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.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 ${U.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${W(U.input)}`;case"invalid_value":if(U.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 ${n(U.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 ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)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 ${U.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${Y.verb} ${w}${U.maximum.toString()} ${Y.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 ${U.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${U.origin} ${Y.verb} ${w}${U.minimum.toString()} ${Y.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 ${U.origin} \u0431\u0443\u0434\u0435 ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.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 "${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${X[w.format]??U.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 ${U.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${U.keys.length>1?"\u0456":""}: ${x(U.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${U.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 ${U.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 b3(){return{localeError:qq()}}var Cq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(U))return"\u0622\u0631\u06D2";if(U===null)return"\u0646\u0644";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${U.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${W(U.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":if(U.values.length===1)return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${n(U.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;return`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${x(U.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${U.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${w}${U.maximum.toString()} ${Y.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: ${U.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${w}${U.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${U.origin} \u06A9\u06D2 ${w}${U.minimum.toString()} ${Y.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${U.origin} \u06A9\u0627 ${w}${U.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${w.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(w.format==="ends_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${w.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(w.format==="includes")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${w.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(w.format==="regex")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${w.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;return`\u063A\u0644\u0637 ${X[w.format]??U.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${U.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${U.keys.length>1?"\u0632":""}: ${x(U.keys,"\u060C ")}`;case"invalid_key":return`${U.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${U.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function y3(){return{localeError:Cq()}}var Sq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(U))return"m\u1EA3ng";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${U.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${n(U.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 ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${U.origin??"gi\xE1 tr\u1ECB"} ${Y.verb} ${w}${U.maximum.toString()} ${Y.unit??"ph\u1EA7n t\u1EED"}`;return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${U.origin??"gi\xE1 tr\u1ECB"} ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${U.origin} ${Y.verb} ${w}${U.minimum.toString()} ${Y.unit}`;return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${U.origin} ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${w.prefix}"`;if(w.format==="ends_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${w.suffix}"`;if(w.format==="includes")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${w.includes}"`;if(w.format==="regex")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${w.pattern}`;return`${X[w.format]??U.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 ${U.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${x(U.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${U.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 ${U.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function h3(){return{localeError:Sq()}}var jq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(U))return"\u6570\u7EC4";if(U===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${U.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${n(U.values[0])}`;return`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${U.origin??"\u503C"} ${w}${U.maximum.toString()} ${Y.unit??"\u4E2A\u5143\u7D20"}`;return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${U.origin??"\u503C"} ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${U.origin} ${w}${U.minimum.toString()} ${Y.unit}`;return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${U.origin} ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${w.prefix}" \u5F00\u5934`;if(w.format==="ends_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${w.suffix}" \u7ED3\u5C3E`;if(w.format==="includes")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${w.includes}"`;if(w.format==="regex")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${w.pattern}`;return`\u65E0\u6548${X[w.format]??U.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${U.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${x(U.keys,", ")}`;case"invalid_key":return`${U.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${U.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function g3(){return{localeError:jq()}}var Iq=()=>{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 T(U){return $[U]??null}let W=(U)=>{let w=typeof U;switch(w){case"number":return Number.isNaN(U)?"NaN":"number";case"object":{if(Array.isArray(U))return"array";if(U===null)return"null";if(Object.getPrototypeOf(U)!==Object.prototype&&U.constructor)return U.constructor.name}}return w},X={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(U)=>{switch(U.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${U.expected}\uFF0C\u4F46\u6536\u5230 ${W(U.input)}`;case"invalid_value":if(U.values.length===1)return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${n(U.values[0])}`;return`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${x(U.values,"|")}`;case"too_big":{let w=U.inclusive?"<=":"<",Y=T(U.origin);if(Y)return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${U.origin??"\u503C"} \u61C9\u70BA ${w}${U.maximum.toString()} ${Y.unit??"\u500B\u5143\u7D20"}`;return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${U.origin??"\u503C"} \u61C9\u70BA ${w}${U.maximum.toString()}`}case"too_small":{let w=U.inclusive?">=":">",Y=T(U.origin);if(Y)return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${U.origin} \u61C9\u70BA ${w}${U.minimum.toString()} ${Y.unit}`;return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${U.origin} \u61C9\u70BA ${w}${U.minimum.toString()}`}case"invalid_format":{let w=U;if(w.format==="starts_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${w.prefix}" \u958B\u982D`;if(w.format==="ends_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${w.suffix}" \u7D50\u5C3E`;if(w.format==="includes")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${w.includes}"`;if(w.format==="regex")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${w.pattern}`;return`\u7121\u6548\u7684 ${X[w.format]??U.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${U.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${U.keys.length>1?"\u5011":""}\uFF1A${x(U.keys,"\u3001")}`;case"invalid_key":return`${U.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${U.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function m3(){return{localeError:Iq()}}var c3=Symbol("ZodOutput"),u3=Symbol("ZodInput");class rU{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...T){let W=T[0];if(this._map.set($,W),W&&typeof W==="object"&&"id"in W){if(this._idmap.has(W.id))throw new Error(`ID ${W.id} already exists in the registry`);this._idmap.set(W.id,$)}return this}remove($){return this._map.delete($),this}get($){let T=$._zod.parent;if(T){let W={...this.get(T)??{}};return delete W.id,{...W,...this._map.get($)}}return this._map.get($)}has($){return this._map.has($)}}function JY(){return new rU}var o1=JY();function p3($,T){return new $({type:"string",...p(T)})}function d3($,T){return new $({type:"string",coerce:!0,...p(T)})}function RY($,T){return new $({type:"string",format:"email",check:"string_format",abort:!1,...p(T)})}function nU($,T){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...p(T)})}function _Y($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...p(T)})}function kY($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...p(T)})}function vY($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...p(T)})}function PY($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...p(T)})}function qY($,T){return new $({type:"string",format:"url",check:"string_format",abort:!1,...p(T)})}function CY($,T){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...p(T)})}function SY($,T){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...p(T)})}function jY($,T){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...p(T)})}function IY($,T){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...p(T)})}function BY($,T){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...p(T)})}function xY($,T){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...p(T)})}function fY($,T){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...p(T)})}function bY($,T){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...p(T)})}function yY($,T){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...p(T)})}function hY($,T){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...p(T)})}function gY($,T){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...p(T)})}function mY($,T){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...p(T)})}function cY($,T){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...p(T)})}function uY($,T){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...p(T)})}function pY($,T){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...p(T)})}var o3={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function l3($,T){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...p(T)})}function r3($,T){return new $({type:"string",format:"date",check:"string_format",...p(T)})}function n3($,T){return new $({type:"string",format:"time",check:"string_format",precision:null,...p(T)})}function i3($,T){return new $({type:"string",format:"duration",check:"string_format",...p(T)})}function t3($,T){return new $({type:"number",checks:[],...p(T)})}function a3($,T){return new $({type:"number",coerce:!0,checks:[],...p(T)})}function s3($,T){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...p(T)})}function e3($,T){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...p(T)})}function $H($,T){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...p(T)})}function TH($,T){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...p(T)})}function WH($,T){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...p(T)})}function UH($,T){return new $({type:"boolean",...p(T)})}function XH($,T){return new $({type:"boolean",coerce:!0,...p(T)})}function wH($,T){return new $({type:"bigint",...p(T)})}function YH($,T){return new $({type:"bigint",coerce:!0,...p(T)})}function GH($,T){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...p(T)})}function zH($,T){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...p(T)})}function HH($,T){return new $({type:"symbol",...p(T)})}function FH($,T){return new $({type:"undefined",...p(T)})}function OH($,T){return new $({type:"null",...p(T)})}function QH($){return new $({type:"any"})}function rW($){return new $({type:"unknown"})}function ZH($,T){return new $({type:"never",...p(T)})}function VH($,T){return new $({type:"void",...p(T)})}function KH($,T){return new $({type:"date",...p(T)})}function AH($,T){return new $({type:"date",coerce:!0,...p(T)})}function EH($,T){return new $({type:"nan",...p(T)})}function Z0($,T){return new VY({check:"less_than",...p(T),value:$,inclusive:!1})}function V1($,T){return new VY({check:"less_than",...p(T),value:$,inclusive:!0})}function V0($,T){return new KY({check:"greater_than",...p(T),value:$,inclusive:!1})}function B6($,T){return new KY({check:"greater_than",...p(T),value:$,inclusive:!0})}function MH($){return V0(0,$)}function DH($){return Z0(0,$)}function NH($){return V1(0,$)}function LH($){return B6(0,$)}function lT($,T){return new y5({check:"multiple_of",...p(T),value:$})}function nW($,T){return new m5({check:"max_size",...p(T),maximum:$})}function rT($,T){return new c5({check:"min_size",...p(T),minimum:$})}function iU($,T){return new u5({check:"size_equals",...p(T),size:$})}function iW($,T){return new p5({check:"max_length",...p(T),maximum:$})}function YT($,T){return new d5({check:"min_length",...p(T),minimum:$})}function tW($,T){return new o5({check:"length_equals",...p(T),length:$})}function tU($,T){return new l5({check:"string_format",format:"regex",...p(T),pattern:$})}function aU($){return new r5({check:"string_format",format:"lowercase",...p($)})}function sU($){return new n5({check:"string_format",format:"uppercase",...p($)})}function eU($,T){return new i5({check:"string_format",format:"includes",...p(T),includes:$})}function $X($,T){return new t5({check:"string_format",format:"starts_with",...p(T),prefix:$})}function TX($,T){return new a5({check:"string_format",format:"ends_with",...p(T),suffix:$})}function JH($,T,W){return new s5({check:"property",property:$,schema:T,...p(W)})}function WX($,T){return new e5({check:"mime_type",mime:$,...p(T)})}function K0($){return new $7({check:"overwrite",tx:$})}function UX($){return K0((T)=>T.normalize($))}function XX(){return K0(($)=>$.trim())}function wX(){return K0(($)=>$.toLowerCase())}function YX(){return K0(($)=>$.toUpperCase())}function GX($,T,W){return new $({type:"array",element:T,...p(W)})}function Bq($,T,W){return new $({type:"union",options:T,...p(W)})}function xq($,T,W,X){return new $({type:"union",options:W,discriminator:T,...p(X)})}function fq($,T,W){return new $({type:"intersection",left:T,right:W})}function RH($,T,W,X){let U=W instanceof K$;return new $({type:"tuple",items:T,rest:U?W:null,...p(U?X:W)})}function bq($,T,W,X){return new $({type:"record",keyType:T,valueType:W,...p(X)})}function yq($,T,W,X){return new $({type:"map",keyType:T,valueType:W,...p(X)})}function hq($,T,W){return new $({type:"set",valueType:T,...p(W)})}function gq($,T,W){let X=Array.isArray(T)?Object.fromEntries(T.map((U)=>[U,U])):T;return new $({type:"enum",entries:X,...p(W)})}function mq($,T,W){return new $({type:"enum",entries:T,...p(W)})}function cq($,T,W){return new $({type:"literal",values:Array.isArray(T)?T:[T],...p(W)})}function _H($,T){return new $({type:"file",...p(T)})}function uq($,T){return new $({type:"transform",transform:T})}function pq($,T){return new $({type:"optional",innerType:T})}function dq($,T){return new $({type:"nullable",innerType:T})}function oq($,T,W){return new $({type:"default",innerType:T,get defaultValue(){return typeof W==="function"?W():W}})}function lq($,T,W){return new $({type:"nonoptional",innerType:T,...p(W)})}function rq($,T){return new $({type:"success",innerType:T})}function nq($,T,W){return new $({type:"catch",innerType:T,catchValue:typeof W==="function"?W:()=>W})}function iq($,T,W){return new $({type:"pipe",in:T,out:W})}function tq($,T){return new $({type:"readonly",innerType:T})}function aq($,T,W){return new $({type:"template_literal",parts:T,...p(W)})}function sq($,T){return new $({type:"lazy",getter:T})}function eq($,T){return new $({type:"promise",innerType:T})}function kH($,T,W){let X=p(W);return X.abort??(X.abort=!0),new $({type:"custom",check:"custom",fn:T,...X})}function vH($,T,W){return new $({type:"custom",check:"custom",fn:T,...p(W)})}function PH($,T){let{case:W,error:X,truthy:U,falsy:w}=p(T),Y=U??["true","1","yes","on","y","enabled"],G=w??["false","0","no","off","n","disabled"];if(W!=="sensitive")Y=Y.map((L)=>typeof L==="string"?L.toLowerCase():L),G=G.map((L)=>typeof L==="string"?L.toLowerCase():L);let H=new Set(Y),z=new Set(G),F=$.Pipe??dU,O=$.Boolean??cU,Q=$.String??dT,K=new($.Transform??pU)({type:"transform",transform:(L,J)=>{let _=L;if(W!=="sensitive")_=_.toLowerCase();if(H.has(_))return!0;else if(z.has(_))return!1;else return J.issues.push({code:"invalid_value",expected:"stringbool",values:[...H,...z],input:J.value,inst:K}),{}},error:X}),A=new F({type:"pipe",in:new Q({type:"string",error:X}),out:K,error:X});return new F({type:"pipe",in:A,out:new O({type:"boolean",error:X}),error:X})}class qH{constructor($){this._def=$,this.def=$}implement($){if(typeof $!=="function")throw new Error("implement() must be called with a function");let T=(...W)=>{let X=this._def.input?zY(this._def.input,W,void 0,{callee:T}):W;if(!Array.isArray(X))throw new Error("Invalid arguments schema: not an array or tuple schema.");let U=$(...X);return this._def.output?zY(this._def.output,U,void 0,{callee:T}):U};return T}implementAsync($){if(typeof $!=="function")throw new Error("implement() must be called with a function");let T=async(...W)=>{let X=this._def.input?await FY(this._def.input,W,void 0,{callee:T}):W;if(!Array.isArray(X))throw new Error("Invalid arguments schema: not an array or tuple schema.");let U=await $(...X);return this._def.output?FY(this._def.output,U,void 0,{callee:T}):U};return T}input(...$){let T=this.constructor;if(Array.isArray($[0]))return new T({type:"function",input:new oT({type:"tuple",items:$[0],rest:$[1]}),output:this._def.output});return new T({type:"function",input:$[0],output:this._def.output})}output($){return new this.constructor({type:"function",input:this._def.input,output:$})}}function CH($){return new qH({type:"function",input:Array.isArray($?.input)?RH(oT,$?.input):$?.input??GX(uU,rW(lW)),output:$?.output??rW(lW)})}class dY{constructor($){this.counter=0,this.metadataRegistry=$?.metadata??o1,this.target=$?.target??"draft-2020-12",this.unrepresentable=$?.unrepresentable??"throw",this.override=$?.override??(()=>{}),this.io=$?.io??"output",this.seen=new Map}process($,T={path:[],schemaPath:[]}){var W;let X=$._zod.def,U={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},w=this.seen.get($);if(w){if(w.count++,T.schemaPath.includes($))w.cycle=T.path;return w.schema}let Y={schema:{},count:1,cycle:void 0};this.seen.set($,Y);let G=$._zod.toJSONSchema?.();if(G)Y.schema=G;else{let F={...T,schemaPath:[...T.schemaPath,$],path:T.path},O=$._zod.parent;if(O)Y.ref=O,this.process(O,F),this.seen.get(O).isParent=!0;else{let Q=Y.schema;switch(X.type){case"string":{let Z=Q;Z.type="string";let{minimum:K,maximum:A,format:D,patterns:L,contentEncoding:J}=$._zod.bag;if(typeof K==="number")Z.minLength=K;if(typeof A==="number")Z.maxLength=A;if(D){if(Z.format=U[D]??D,Z.format==="")delete Z.format}if(J)Z.contentEncoding=J;if(L&&L.size>0){let _=[...L];if(_.length===1)Z.pattern=_[0].source;else if(_.length>1)Y.schema.allOf=[..._.map((C)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:C.source}))]}break}case"number":{let Z=Q,{minimum:K,maximum:A,format:D,multipleOf:L,exclusiveMaximum:J,exclusiveMinimum:_}=$._zod.bag;if(typeof D==="string"&&D.includes("int"))Z.type="integer";else Z.type="number";if(typeof _==="number")Z.exclusiveMinimum=_;if(typeof K==="number"){if(Z.minimum=K,typeof _==="number")if(_>=K)delete Z.minimum;else delete Z.exclusiveMinimum}if(typeof J==="number")Z.exclusiveMaximum=J;if(typeof A==="number"){if(Z.maximum=A,typeof J==="number")if(J<=A)delete Z.maximum;else delete Z.exclusiveMaximum}if(typeof L==="number")Z.multipleOf=L;break}case"boolean":{let Z=Q;Z.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"undefined":{let Z=Q;Z.type="null";break}case"null":{Q.type="null";break}case"any":break;case"unknown":break;case"never":{Q.not={};break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let Z=Q,{minimum:K,maximum:A}=$._zod.bag;if(typeof K==="number")Z.minItems=K;if(typeof A==="number")Z.maxItems=A;Z.type="array",Z.items=this.process(X.element,{...F,path:[...F.path,"items"]});break}case"object":{let Z=Q;Z.type="object",Z.properties={};let K=X.shape;for(let L in K)Z.properties[L]=this.process(K[L],{...F,path:[...F.path,"properties",L]});let A=new Set(Object.keys(K)),D=new Set([...A].filter((L)=>{let J=X.shape[L]._zod;if(this.io==="input")return J.optin===void 0;else return J.optout===void 0}));if(D.size>0)Z.required=Array.from(D);if(X.catchall?._zod.def.type==="never")Z.additionalProperties=!1;else if(!X.catchall){if(this.io==="output")Z.additionalProperties=!1}else if(X.catchall)Z.additionalProperties=this.process(X.catchall,{...F,path:[...F.path,"additionalProperties"]});break}case"union":{let Z=Q;Z.anyOf=X.options.map((K,A)=>this.process(K,{...F,path:[...F.path,"anyOf",A]}));break}case"intersection":{let Z=Q,K=this.process(X.left,{...F,path:[...F.path,"allOf",0]}),A=this.process(X.right,{...F,path:[...F.path,"allOf",1]}),D=(J)=>("allOf"in J)&&Object.keys(J).length===1,L=[...D(K)?K.allOf:[K],...D(A)?A.allOf:[A]];Z.allOf=L;break}case"tuple":{let Z=Q;Z.type="array";let K=X.items.map((L,J)=>this.process(L,{...F,path:[...F.path,"prefixItems",J]}));if(this.target==="draft-2020-12")Z.prefixItems=K;else Z.items=K;if(X.rest){let L=this.process(X.rest,{...F,path:[...F.path,"items"]});if(this.target==="draft-2020-12")Z.items=L;else Z.additionalItems=L}if(X.rest)Z.items=this.process(X.rest,{...F,path:[...F.path,"items"]});let{minimum:A,maximum:D}=$._zod.bag;if(typeof A==="number")Z.minItems=A;if(typeof D==="number")Z.maxItems=D;break}case"record":{let Z=Q;Z.type="object",Z.propertyNames=this.process(X.keyType,{...F,path:[...F.path,"propertyNames"]}),Z.additionalProperties=this.process(X.valueType,{...F,path:[...F.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 Z=Q,K=jU(X.entries);if(K.every((A)=>typeof A==="number"))Z.type="number";if(K.every((A)=>typeof A==="string"))Z.type="string";Z.enum=K;break}case"literal":{let Z=Q,K=[];for(let A of X.values)if(A===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof A==="bigint")if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");else K.push(Number(A));else K.push(A);if(K.length===0);else if(K.length===1){let A=K[0];Z.type=A===null?"null":typeof A,Z.const=A}else{if(K.every((A)=>typeof A==="number"))Z.type="number";if(K.every((A)=>typeof A==="string"))Z.type="string";if(K.every((A)=>typeof A==="boolean"))Z.type="string";if(K.every((A)=>A===null))Z.type="null";Z.enum=K}break}case"file":{let Z=Q,K={type:"string",format:"binary",contentEncoding:"binary"},{minimum:A,maximum:D,mime:L}=$._zod.bag;if(A!==void 0)K.minLength=A;if(D!==void 0)K.maxLength=D;if(L)if(L.length===1)K.contentMediaType=L[0],Object.assign(Z,K);else Z.anyOf=L.map((J)=>{return{...K,contentMediaType:J}});else Object.assign(Z,K);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let Z=this.process(X.innerType,F);Q.anyOf=[Z,{type:"null"}];break}case"nonoptional":{this.process(X.innerType,F),Y.ref=X.innerType;break}case"success":{let Z=Q;Z.type="boolean";break}case"default":{this.process(X.innerType,F),Y.ref=X.innerType,Q.default=JSON.parse(JSON.stringify(X.defaultValue));break}case"prefault":{if(this.process(X.innerType,F),Y.ref=X.innerType,this.io==="input")Q._prefault=JSON.parse(JSON.stringify(X.defaultValue));break}case"catch":{this.process(X.innerType,F),Y.ref=X.innerType;let Z;try{Z=X.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}Q.default=Z;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let Z=Q,K=$._zod.pattern;if(!K)throw new Error("Pattern not found in template literal");Z.type="string",Z.pattern=K.source;break}case"pipe":{let Z=this.io==="input"?X.in._zod.def.type==="transform"?X.out:X.in:X.out;this.process(Z,F),Y.ref=Z;break}case"readonly":{this.process(X.innerType,F),Y.ref=X.innerType,Q.readOnly=!0;break}case"promise":{this.process(X.innerType,F),Y.ref=X.innerType;break}case"optional":{this.process(X.innerType,F),Y.ref=X.innerType;break}case"lazy":{let Z=$._zod.innerType;this.process(Z,F),Y.ref=Z;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let H=this.metadataRegistry.get($);if(H)Object.assign(Y.schema,H);if(this.io==="input"&&v4($))delete Y.schema.examples,delete Y.schema.default;if(this.io==="input"&&Y.schema._prefault)(W=Y.schema).default??(W.default=Y.schema._prefault);return delete Y.schema._prefault,this.seen.get($).schema}emit($,T){let W={cycles:T?.cycles??"ref",reused:T?.reused??"inline",external:T?.external??void 0},X=this.seen.get($);if(!X)throw new Error("Unprocessed schema. This is a bug in Zod.");let U=(z)=>{let F=this.target==="draft-2020-12"?"$defs":"definitions";if(W.external){let K=W.external.registry.get(z[0])?.id;if(K)return{ref:W.external.uri(K)};let A=z[1].defId??z[1].schema.id??`schema${this.counter++}`;return z[1].defId=A,{defId:A,ref:`${W.external.uri("__shared")}#/${F}/${A}`}}if(z[1]===X)return{ref:"#"};let Q=`${"#"}/${F}/`,Z=z[1].schema.id??`__schema${this.counter++}`;return{defId:Z,ref:Q+Z}},w=(z)=>{if(z[1].schema.$ref)return;let F=z[1],{ref:O,defId:Q}=U(z);if(F.def={...F.schema},Q)F.defId=Q;let Z=F.schema;for(let K in Z)delete Z[K];Z.$ref=O};for(let z of this.seen.entries()){let F=z[1];if($===z[0]){w(z);continue}if(W.external){let Q=W.external.registry.get(z[0])?.id;if($!==z[0]&&Q){w(z);continue}}if(this.metadataRegistry.get(z[0])?.id){w(z);continue}if(F.cycle){if(W.cycles==="throw")throw new Error(`Cycle detected: #/${F.cycle?.join("/")}/<root>
|
|
30
|
+
path: iss.path ? [${mT(L)}, ...iss.path] : [${mT(L)}]
|
|
31
|
+
})));`),Q.write(`newResult[${mT(L)}] = ${_}.value`)}Q.write("payload.value = newResult;"),Q.write("return payload;");let J=Q.compile();return(L,_)=>J(O,L,_)},X,w=pW,Y=!CX.jitless,H=Y&&$5.value,{catchall:z}=T,F;$._zod.parse=(O,Q)=>{F??(F=W.value);let Z=O.value;if(!w(Z))return O.issues.push({expected:"object",code:"invalid_type",input:Z,inst:$}),O;let V=[];if(Y&&H&&Q?.async===!1&&Q.jitless!==!0){if(!X)X=U(T.shape);O=X(O,Q)}else{O.value={};let _=F.shape;for(let C of F.keys){let f=_[C],b=f._zod.run({value:Z[C],issues:[]},Q),g=f._zod.optin==="optional"&&f._zod.optout==="optional";if(b instanceof Promise)V.push(b.then((T$)=>g?WK(T$,O,C,Z):KY(T$,O,C)));else if(g)WK(b,O,C,Z);else KY(b,O,C)}}if(!z)return V.length?Promise.all(V).then(()=>O):O;let A=[],D=F.keySet,J=z._zod,L=J.def.type;for(let _ of Object.keys(Z)){if(D.has(_))continue;if(L==="never"){A.push(_);continue}let C=J.run({value:Z[_],issues:[]},Q);if(C instanceof Promise)V.push(C.then((f)=>KY(f,O,_)));else KY(C,O,_)}if(A.length)O.issues.push({code:"unrecognized_keys",keys:A,input:Z,inst:$});if(!V.length)return O;return Promise.all(V).then(()=>{return O})}});function XK($,T,W,U){for(let X of $)if(X.issues.length===0)return T.value=X.value,T;return T.issues.push({code:"invalid_union",input:T.value,inst:W,errors:$.map((X)=>X.issues.map((w)=>e6(w,U,N4())))}),T}var DY=k("$ZodUnion",($,T)=>{K$.init($,T),h$($._zod,"values",()=>{if(T.options.every((W)=>W._zod.values))return new Set(T.options.flatMap((W)=>Array.from(W._zod.values)));return}),h$($._zod,"pattern",()=>{if(T.options.every((W)=>W._zod.pattern)){let W=T.options.map((U)=>U._zod.pattern);return new RegExp(`^(${W.map((U)=>IX(U.source)).join("|")})$`)}return}),$._zod.parse=(W,U)=>{let X=!1,w=[];for(let Y of T.options){let G=Y._zod.run({value:W.value,issues:[]},U);if(G instanceof Promise)w.push(G),X=!0;else{if(G.issues.length===0)return G;w.push(G)}}if(!X)return XK(w,W,$,U);return Promise.all(w).then((Y)=>{return XK(Y,W,$,U)})}}),g7=k("$ZodDiscriminatedUnion",($,T)=>{DY.init($,T);let W=$._zod.parse;h$($._zod,"propValues",()=>{let X={};for(let w of T.options){let Y=w._zod.propValues;if(!Y||Object.keys(Y).length===0)throw new Error(`Invalid discriminated union option at index "${T.options.indexOf(w)}"`);for(let[G,H]of Object.entries(Y)){if(!X[G])X[G]=new Set;for(let z of H)X[G].add(z)}}return X});let U=BX(()=>{let X=T.options,w=new Map;for(let Y of X){let G=Y._zod.propValues[T.discriminator];if(!G||G.size===0)throw new Error(`Invalid discriminated union option at index "${T.options.indexOf(Y)}"`);for(let H of G){if(w.has(H))throw new Error(`Duplicate discriminator value "${String(H)}"`);w.set(H,Y)}}return w});$._zod.parse=(X,w)=>{let Y=X.value;if(!pW(Y))return X.issues.push({code:"invalid_type",expected:"object",input:Y,inst:$}),X;let G=U.value.get(Y?.[T.discriminator]);if(G)return G._zod.run(X,w);if(T.unionFallback)return W(X,w);return X.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:Y,path:[T.discriminator],inst:$}),X}}),m7=k("$ZodIntersection",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{let{value:X}=W,w=T.left._zod.run({value:X,issues:[]},U),Y=T.right._zod.run({value:X,issues:[]},U);if(w instanceof Promise||Y instanceof Promise)return Promise.all([w,Y]).then(([H,z])=>{return UK(W,H,z)});return UK(W,w,Y)}});function U7($,T){if($===T)return{valid:!0,data:$};if($ instanceof Date&&T instanceof Date&&+$===+T)return{valid:!0,data:$};if(xX($)&&xX(T)){let W=Object.keys(T),U=Object.keys($).filter((w)=>W.indexOf(w)!==-1),X={...$,...T};for(let w of U){let Y=U7($[w],T[w]);if(!Y.valid)return{valid:!1,mergeErrorPath:[w,...Y.mergeErrorPath]};X[w]=Y.data}return{valid:!0,data:X}}if(Array.isArray($)&&Array.isArray(T)){if($.length!==T.length)return{valid:!1,mergeErrorPath:[]};let W=[];for(let U=0;U<$.length;U++){let X=$[U],w=T[U],Y=U7(X,w);if(!Y.valid)return{valid:!1,mergeErrorPath:[U,...Y.mergeErrorPath]};W.push(Y.data)}return{valid:!0,data:W}}return{valid:!1,mergeErrorPath:[]}}function UK($,T,W){if(T.issues.length)$.issues.push(...T.issues);if(W.issues.length)$.issues.push(...W.issues);if(cT($))return $;let U=U7(T.value,W.value);if(!U.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(U.mergeErrorPath)}`);return $.value=U.data,$}var oT=k("$ZodTuple",($,T)=>{K$.init($,T);let W=T.items,U=W.length-[...W].reverse().findIndex((X)=>X._zod.optin!=="optional");$._zod.parse=(X,w)=>{let Y=X.value;if(!Array.isArray(Y))return X.issues.push({input:Y,inst:$,expected:"tuple",code:"invalid_type"}),X;X.value=[];let G=[];if(!T.rest){let z=Y.length>W.length,F=Y.length<U-1;if(z||F)return X.issues.push({input:Y,inst:$,origin:"array",...z?{code:"too_big",maximum:W.length}:{code:"too_small",minimum:W.length}}),X}let H=-1;for(let z of W){if(H++,H>=Y.length){if(H>=U)continue}let F=z._zod.run({value:Y[H],issues:[]},w);if(F instanceof Promise)G.push(F.then((O)=>AY(O,X,H)));else AY(F,X,H)}if(T.rest){let z=Y.slice(W.length);for(let F of z){H++;let O=T.rest._zod.run({value:F,issues:[]},w);if(O instanceof Promise)G.push(O.then((Q)=>AY(Q,X,H)));else AY(O,X,H)}}if(G.length)return Promise.all(G).then(()=>X);return X}});function AY($,T,W){if($.issues.length)T.issues.push(...I6(W,$.issues));T.value[W]=$.value}var c7=k("$ZodRecord",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{let X=W.value;if(!xX(X))return W.issues.push({expected:"record",code:"invalid_type",input:X,inst:$}),W;let w=[];if(T.keyType._zod.values){let Y=T.keyType._zod.values;W.value={};for(let H of Y)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let z=T.valueType._zod.run({value:X[H],issues:[]},U);if(z instanceof Promise)w.push(z.then((F)=>{if(F.issues.length)W.issues.push(...I6(H,F.issues));W.value[H]=F.value}));else{if(z.issues.length)W.issues.push(...I6(H,z.issues));W.value[H]=z.value}}let G;for(let H in X)if(!Y.has(H))G=G??[],G.push(H);if(G&&G.length>0)W.issues.push({code:"unrecognized_keys",input:X,inst:$,keys:G})}else{W.value={};for(let Y of Reflect.ownKeys(X)){if(Y==="__proto__")continue;let G=T.keyType._zod.run({value:Y,issues:[]},U);if(G instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(G.issues.length){W.issues.push({origin:"record",code:"invalid_key",issues:G.issues.map((z)=>e6(z,U,N4())),input:Y,path:[Y],inst:$}),W.value[G.value]=G.value;continue}let H=T.valueType._zod.run({value:X[Y],issues:[]},U);if(H instanceof Promise)w.push(H.then((z)=>{if(z.issues.length)W.issues.push(...I6(Y,z.issues));W.value[G.value]=z.value}));else{if(H.issues.length)W.issues.push(...I6(Y,H.issues));W.value[G.value]=H.value}}}if(w.length)return Promise.all(w).then(()=>W);return W}}),u7=k("$ZodMap",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{let X=W.value;if(!(X instanceof Map))return W.issues.push({expected:"map",code:"invalid_type",input:X,inst:$}),W;let w=[];W.value=new Map;for(let[Y,G]of X){let H=T.keyType._zod.run({value:Y,issues:[]},U),z=T.valueType._zod.run({value:G,issues:[]},U);if(H instanceof Promise||z instanceof Promise)w.push(Promise.all([H,z]).then(([F,O])=>{wK(F,O,W,Y,X,$,U)}));else wK(H,z,W,Y,X,$,U)}if(w.length)return Promise.all(w).then(()=>W);return W}});function wK($,T,W,U,X,w,Y){if($.issues.length)if(fX.has(typeof U))W.issues.push(...I6(U,$.issues));else W.issues.push({origin:"map",code:"invalid_key",input:X,inst:w,issues:$.issues.map((G)=>e6(G,Y,N4()))});if(T.issues.length)if(fX.has(typeof U))W.issues.push(...I6(U,T.issues));else W.issues.push({origin:"map",code:"invalid_element",input:X,inst:w,key:U,issues:T.issues.map((G)=>e6(G,Y,N4()))});W.value.set($.value,T.value)}var p7=k("$ZodSet",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{let X=W.value;if(!(X instanceof Set))return W.issues.push({input:X,inst:$,expected:"set",code:"invalid_type"}),W;let w=[];W.value=new Set;for(let Y of X){let G=T.valueType._zod.run({value:Y,issues:[]},U);if(G instanceof Promise)w.push(G.then((H)=>YK(H,W)));else YK(G,W)}if(w.length)return Promise.all(w).then(()=>W);return W}});function YK($,T){if($.issues.length)T.issues.push(...$.issues);T.value.add($.value)}var d7=k("$ZodEnum",($,T)=>{K$.init($,T);let W=jX(T.entries);$._zod.values=new Set(W),$._zod.pattern=new RegExp(`^(${W.filter((U)=>fX.has(typeof U)).map((U)=>typeof U==="string"?Q0(U):U.toString()).join("|")})$`),$._zod.parse=(U,X)=>{let w=U.value;if($._zod.values.has(w))return U;return U.issues.push({code:"invalid_value",values:W,input:w,inst:$}),U}}),o7=k("$ZodLiteral",($,T)=>{K$.init($,T),$._zod.values=new Set(T.values),$._zod.pattern=new RegExp(`^(${T.values.map((W)=>typeof W==="string"?Q0(W):W?W.toString():String(W)).join("|")})$`),$._zod.parse=(W,U)=>{let X=W.value;if($._zod.values.has(X))return W;return W.issues.push({code:"invalid_value",values:T.values,input:X,inst:$}),W}}),l7=k("$ZodFile",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{let X=W.value;if(X instanceof File)return W;return W.issues.push({expected:"file",code:"invalid_type",input:X,inst:$}),W}}),pX=k("$ZodTransform",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{let X=T.transform(W.value,W);if(U.async)return(X instanceof Promise?X:Promise.resolve(X)).then((Y)=>{return W.value=Y,W});if(X instanceof Promise)throw new O0;return W.value=X,W}}),r7=k("$ZodOptional",($,T)=>{K$.init($,T),$._zod.optin="optional",$._zod.optout="optional",h$($._zod,"values",()=>{return T.innerType._zod.values?new Set([...T.innerType._zod.values,void 0]):void 0}),h$($._zod,"pattern",()=>{let W=T.innerType._zod.pattern;return W?new RegExp(`^(${IX(W.source)})?$`):void 0}),$._zod.parse=(W,U)=>{if(W.value===void 0)return W;return T.innerType._zod.run(W,U)}}),n7=k("$ZodNullable",($,T)=>{K$.init($,T),h$($._zod,"optin",()=>T.innerType._zod.optin),h$($._zod,"optout",()=>T.innerType._zod.optout),h$($._zod,"pattern",()=>{let W=T.innerType._zod.pattern;return W?new RegExp(`^(${IX(W.source)}|null)$`):void 0}),h$($._zod,"values",()=>{return T.innerType._zod.values?new Set([...T.innerType._zod.values,null]):void 0}),$._zod.parse=(W,U)=>{if(W.value===null)return W;return T.innerType._zod.run(W,U)}}),i7=k("$ZodDefault",($,T)=>{K$.init($,T),$._zod.optin="optional",h$($._zod,"values",()=>T.innerType._zod.values),$._zod.parse=(W,U)=>{if(W.value===void 0)return W.value=T.defaultValue,W;let X=T.innerType._zod.run(W,U);if(X instanceof Promise)return X.then((w)=>GK(w,T));return GK(X,T)}});function GK($,T){if($.value===void 0)$.value=T.defaultValue;return $}var t7=k("$ZodPrefault",($,T)=>{K$.init($,T),$._zod.optin="optional",h$($._zod,"values",()=>T.innerType._zod.values),$._zod.parse=(W,U)=>{if(W.value===void 0)W.value=T.defaultValue;return T.innerType._zod.run(W,U)}}),a7=k("$ZodNonOptional",($,T)=>{K$.init($,T),h$($._zod,"values",()=>{let W=T.innerType._zod.values;return W?new Set([...W].filter((U)=>U!==void 0)):void 0}),$._zod.parse=(W,U)=>{let X=T.innerType._zod.run(W,U);if(X instanceof Promise)return X.then((w)=>zK(w,$));return zK(X,$)}});function zK($,T){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:T});return $}var s7=k("$ZodSuccess",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{let X=T.innerType._zod.run(W,U);if(X instanceof Promise)return X.then((w)=>{return W.value=w.issues.length===0,W});return W.value=X.issues.length===0,W}}),e7=k("$ZodCatch",($,T)=>{K$.init($,T),h$($._zod,"optin",()=>T.innerType._zod.optin),h$($._zod,"optout",()=>T.innerType._zod.optout),h$($._zod,"values",()=>T.innerType._zod.values),$._zod.parse=(W,U)=>{let X=T.innerType._zod.run(W,U);if(X instanceof Promise)return X.then((w)=>{if(W.value=w.value,w.issues.length)W.value=T.catchValue({...W,error:{issues:w.issues.map((Y)=>e6(Y,U,N4()))},input:W.value}),W.issues=[];return W});if(W.value=X.value,X.issues.length)W.value=T.catchValue({...W,error:{issues:X.issues.map((w)=>e6(w,U,N4()))},input:W.value}),W.issues=[];return W}}),$3=k("$ZodNaN",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{if(typeof W.value!=="number"||!Number.isNaN(W.value))return W.issues.push({input:W.value,inst:$,expected:"nan",code:"invalid_type"}),W;return W}}),dX=k("$ZodPipe",($,T)=>{K$.init($,T),h$($._zod,"values",()=>T.in._zod.values),h$($._zod,"optin",()=>T.in._zod.optin),h$($._zod,"optout",()=>T.out._zod.optout),$._zod.parse=(W,U)=>{let X=T.in._zod.run(W,U);if(X instanceof Promise)return X.then((w)=>HK(w,T,U));return HK(X,T,U)}});function HK($,T,W){if(cT($))return $;return T.out._zod.run({value:$.value,issues:$.issues},W)}var T3=k("$ZodReadonly",($,T)=>{K$.init($,T),h$($._zod,"propValues",()=>T.innerType._zod.propValues),h$($._zod,"optin",()=>T.innerType._zod.optin),h$($._zod,"optout",()=>T.innerType._zod.optout),$._zod.parse=(W,U)=>{let X=T.innerType._zod.run(W,U);if(X instanceof Promise)return X.then(FK);return FK(X)}});function FK($){return $.value=Object.freeze($.value),$}var W3=k("$ZodTemplateLiteral",($,T)=>{K$.init($,T);let W=[];for(let U of T.parts)if(U instanceof K$){if(!U._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...U._zod.traits].shift()}`);let X=U._zod.pattern instanceof RegExp?U._zod.pattern.source:U._zod.pattern;if(!X)throw new Error(`Invalid template literal part: ${U._zod.traits}`);let w=X.startsWith("^")?1:0,Y=X.endsWith("$")?X.length-1:X.length;W.push(X.slice(w,Y))}else if(U===null||T5.has(typeof U))W.push(Q0(`${U}`));else throw new Error(`Invalid template literal part: ${U}`);$._zod.pattern=new RegExp(`^${W.join("")}$`),$._zod.parse=(U,X)=>{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}}),X3=k("$ZodPromise",($,T)=>{K$.init($,T),$._zod.parse=(W,U)=>{return Promise.resolve(W.value).then((X)=>T.innerType._zod.run({value:X,issues:[]},U))}}),U3=k("$ZodLazy",($,T)=>{K$.init($,T),h$($._zod,"innerType",()=>T.getter()),h$($._zod,"pattern",()=>$._zod.innerType._zod.pattern),h$($._zod,"propValues",()=>$._zod.innerType._zod.propValues),h$($._zod,"optin",()=>$._zod.innerType._zod.optin),h$($._zod,"optout",()=>$._zod.innerType._zod.optout),$._zod.parse=(W,U)=>{return $._zod.innerType._zod.run(W,U)}}),w3=k("$ZodCustom",($,T)=>{z4.init($,T),K$.init($,T),$._zod.parse=(W,U)=>{return W},$._zod.check=(W)=>{let U=W.value,X=T.fn(U);if(X instanceof Promise)return X.then((w)=>OK(w,W,U,$));OK(X,W,U,$);return}});function OK($,T,W,U){if(!$){let X={code:"custom",input:W,inst:U,path:[...U._zod.def.path??[]],continue:!U._zod.def.abort};if(U._zod.def.params)X.params=U._zod.def.params;T.issues.push(w5(X))}}var lX={};e0(lX,{zhTW:()=>u3,zhCN:()=>c3,vi:()=>m3,ur:()=>g3,ua:()=>h3,tr:()=>y3,th:()=>b3,ta:()=>f3,sv:()=>x3,sl:()=>I3,ru:()=>B3,pt:()=>j3,ps:()=>C3,pl:()=>S3,ota:()=>q3,no:()=>P3,nl:()=>v3,ms:()=>k3,mk:()=>_3,ko:()=>R3,kh:()=>L3,ja:()=>J3,it:()=>N3,id:()=>D3,hu:()=>M3,he:()=>E3,frCA:()=>A3,fr:()=>K3,fi:()=>V3,fa:()=>Z3,es:()=>Q3,en:()=>oX,de:()=>O3,cs:()=>F3,ca:()=>H3,be:()=>z3,az:()=>G3,ar:()=>Y3});var Xq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.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 ${X.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${W(X.input)}`;case"invalid_value":if(X.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 ${n(X.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: ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${X.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${w} ${X.maximum.toString()} ${Y.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 ${X.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${w} ${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${X.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${w} ${X.minimum.toString()} ${Y.unit}`;return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${X.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${w} ${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.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 "${X.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`${U[w.format]??X.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 ${X.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${X.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${X.keys.length>1?"\u0629":""}: ${x(X.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${X.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 ${X.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function Y3(){return{localeError:Xq()}}var Uq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${X.expected}, daxil olan ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${n(X.values[0])}`;return`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${X.origin??"d\u0259y\u0259r"} ${w}${X.maximum.toString()} ${Y.unit??"element"}`;return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${X.origin??"d\u0259y\u0259r"} ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${X.origin} ${w}${X.minimum.toString()} ${Y.unit}`;return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${X.origin} ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Yanl\u0131\u015F m\u0259tn: "${w.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`;if(w.format==="ends_with")return`Yanl\u0131\u015F m\u0259tn: "${w.suffix}" il\u0259 bitm\u0259lidir`;if(w.format==="includes")return`Yanl\u0131\u015F m\u0259tn: "${w.includes}" daxil olmal\u0131d\u0131r`;if(w.format==="regex")return`Yanl\u0131\u015F m\u0259tn: ${w.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`;return`Yanl\u0131\u015F ${U[w.format]??X.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${X.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${X.keys.length>1?"lar":""}: ${x(X.keys,", ")}`;case"invalid_key":return`${X.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${X.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function G3(){return{localeError:Uq()}}function KK($,T,W,U){let X=Math.abs($),w=X%10,Y=X%100;if(Y>=11&&Y<=19)return U;if(w===1)return T;if(w>=2&&w<=4)return W;return U}var wq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(X))return"\u043C\u0430\u0441\u0456\u045E";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.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 ${X.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${W(X.input)}`;case"invalid_value":if(X.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 ${n(X.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 ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y){let G=Number(X.maximum),H=KK(G,Y.unit.one,Y.unit.few,Y.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 ${X.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${Y.verb} ${w}${X.maximum.toString()} ${H}`}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 ${X.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y){let G=Number(X.minimum),H=KK(G,Y.unit.one,Y.unit.few,Y.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 ${X.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${Y.verb} ${w}${X.minimum.toString()} ${H}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${X.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.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 "${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${U[w.format]??X.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 ${X.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${X.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${x(X.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${X.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 ${X.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function z3(){return{localeError:wq()}}var Yq=()=>{let $={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${X.expected}, s'ha rebut ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Valor inv\xE0lid: s'esperava ${n(X.values[0])}`;return`Opci\xF3 inv\xE0lida: s'esperava una de ${x(X.values," o ")}`;case"too_big":{let w=X.inclusive?"com a m\xE0xim":"menys de",Y=T(X.origin);if(Y)return`Massa gran: s'esperava que ${X.origin??"el valor"} contingu\xE9s ${w} ${X.maximum.toString()} ${Y.unit??"elements"}`;return`Massa gran: s'esperava que ${X.origin??"el valor"} fos ${w} ${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?"com a m\xEDnim":"m\xE9s de",Y=T(X.origin);if(Y)return`Massa petit: s'esperava que ${X.origin} contingu\xE9s ${w} ${X.minimum.toString()} ${Y.unit}`;return`Massa petit: s'esperava que ${X.origin} fos ${w} ${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Format inv\xE0lid: ha de comen\xE7ar amb "${w.prefix}"`;if(w.format==="ends_with")return`Format inv\xE0lid: ha d'acabar amb "${w.suffix}"`;if(w.format==="includes")return`Format inv\xE0lid: ha d'incloure "${w.includes}"`;if(w.format==="regex")return`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${w.pattern}`;return`Format inv\xE0lid per a ${U[w.format]??X.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${X.divisor}`;case"unrecognized_keys":return`Clau${X.keys.length>1?"s":""} no reconeguda${X.keys.length>1?"s":""}: ${x(X.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${X.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${X.origin}`;default:return"Entrada inv\xE0lida"}}};function H3(){return{localeError:Yq()}}var Gq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"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(X))return"pole";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${X.expected}, obdr\u017Eeno ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${n(X.values[0])}`;return`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${X.origin??"hodnota"} mus\xED m\xEDt ${w}${X.maximum.toString()} ${Y.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${X.origin??"hodnota"} mus\xED b\xFDt ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${X.origin??"hodnota"} mus\xED m\xEDt ${w}${X.minimum.toString()} ${Y.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${X.origin??"hodnota"} mus\xED b\xFDt ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${w.prefix}"`;if(w.format==="ends_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${w.suffix}"`;if(w.format==="includes")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${w.includes}"`;if(w.format==="regex")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${w.pattern}`;return`Neplatn\xFD form\xE1t ${U[w.format]??X.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${X.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${x(X.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${X.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${X.origin}`;default:return"Neplatn\xFD vstup"}}};function F3(){return{localeError:Gq()}}var zq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"Zahl";case"object":{if(Array.isArray(X))return"Array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${X.expected}, erhalten ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ung\xFCltige Eingabe: erwartet ${n(X.values[0])}`;return`Ung\xFCltige Option: erwartet eine von ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Zu gro\xDF: erwartet, dass ${X.origin??"Wert"} ${w}${X.maximum.toString()} ${Y.unit??"Elemente"} hat`;return`Zu gro\xDF: erwartet, dass ${X.origin??"Wert"} ${w}${X.maximum.toString()} ist`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Zu klein: erwartet, dass ${X.origin} ${w}${X.minimum.toString()} ${Y.unit} hat`;return`Zu klein: erwartet, dass ${X.origin} ${w}${X.minimum.toString()} ist`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Ung\xFCltiger String: muss mit "${w.prefix}" beginnen`;if(w.format==="ends_with")return`Ung\xFCltiger String: muss mit "${w.suffix}" enden`;if(w.format==="includes")return`Ung\xFCltiger String: muss "${w.includes}" enthalten`;if(w.format==="regex")return`Ung\xFCltiger String: muss dem Muster ${w.pattern} entsprechen`;return`Ung\xFCltig: ${U[w.format]??X.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${X.divisor} sein`;case"unrecognized_keys":return`${X.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${x(X.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${X.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${X.origin}`;default:return"Ung\xFCltige Eingabe"}}};function O3(){return{localeError:zq()}}var Hq=($)=>{let T=typeof $;switch(T){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 T},Fq=()=>{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 T(U){return $[U]??null}let W={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 ${Hq(U.input)}`;case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${n(U.values[0])}`;return`Invalid option: expected one of ${x(U.values,"|")}`;case"too_big":{let X=U.inclusive?"<=":"<",w=T(U.origin);if(w)return`Too big: expected ${U.origin??"value"} to have ${X}${U.maximum.toString()} ${w.unit??"elements"}`;return`Too big: expected ${U.origin??"value"} to be ${X}${U.maximum.toString()}`}case"too_small":{let X=U.inclusive?">=":">",w=T(U.origin);if(w)return`Too small: expected ${U.origin} to have ${X}${U.minimum.toString()} ${w.unit}`;return`Too small: expected ${U.origin} to be ${X}${U.minimum.toString()}`}case"invalid_format":{let X=U;if(X.format==="starts_with")return`Invalid string: must start with "${X.prefix}"`;if(X.format==="ends_with")return`Invalid string: must end with "${X.suffix}"`;if(X.format==="includes")return`Invalid string: must include "${X.includes}"`;if(X.format==="regex")return`Invalid string: must match pattern ${X.pattern}`;return`Invalid ${W[X.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":""}: ${x(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 oX(){return{localeError:Fq()}}var Oq=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(X))return"arreglo";if(X===null)return"nulo";if(Object.getPrototypeOf(X)!==Object.prototype)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${X.expected}, recibido ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Entrada inv\xE1lida: se esperaba ${n(X.values[0])}`;return`Opci\xF3n inv\xE1lida: se esperaba una de ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Demasiado grande: se esperaba que ${X.origin??"valor"} tuviera ${w}${X.maximum.toString()} ${Y.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${X.origin??"valor"} fuera ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Demasiado peque\xF1o: se esperaba que ${X.origin} tuviera ${w}${X.minimum.toString()} ${Y.unit}`;return`Demasiado peque\xF1o: se esperaba que ${X.origin} fuera ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Cadena inv\xE1lida: debe comenzar con "${w.prefix}"`;if(w.format==="ends_with")return`Cadena inv\xE1lida: debe terminar en "${w.suffix}"`;if(w.format==="includes")return`Cadena inv\xE1lida: debe incluir "${w.includes}"`;if(w.format==="regex")return`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${w.pattern}`;return`Inv\xE1lido ${U[w.format]??X.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${X.divisor}`;case"unrecognized_keys":return`Llave${X.keys.length>1?"s":""} desconocida${X.keys.length>1?"s":""}: ${x(X.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${X.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${X.origin}`;default:return"Entrada inv\xE1lida"}}};function Q3(){return{localeError:Oq()}}var Qq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(X))return"\u0622\u0631\u0627\u06CC\u0647";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.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 ${X.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${W(X.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":if(X.values.length===1)return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${n(X.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 ${x(X.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${X.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${w}${X.maximum.toString()} ${Y.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${X.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${w}${X.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${X.origin} \u0628\u0627\u06CC\u062F ${w}${X.minimum.toString()} ${Y.unit} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${X.origin} \u0628\u0627\u06CC\u062F ${w}${X.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${w.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`;if(w.format==="ends_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${w.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`;if(w.format==="includes")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${w.includes}" \u0628\u0627\u0634\u062F`;if(w.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 ${w.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`;return`${U[w.format]??X.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 ${X.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${X.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${x(X.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${X.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 ${X.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function Z3(){return{localeError:Qq()}}var Zq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${X.expected}, oli ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Virheellinen sy\xF6te: t\xE4ytyy olla ${n(X.values[0])}`;return`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Liian suuri: ${Y.subject} t\xE4ytyy olla ${w}${X.maximum.toString()} ${Y.unit}`.trim();return`Liian suuri: arvon t\xE4ytyy olla ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Liian pieni: ${Y.subject} t\xE4ytyy olla ${w}${X.minimum.toString()} ${Y.unit}`.trim();return`Liian pieni: arvon t\xE4ytyy olla ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${w.prefix}"`;if(w.format==="ends_with")return`Virheellinen sy\xF6te: t\xE4ytyy loppua "${w.suffix}"`;if(w.format==="includes")return`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${w.includes}"`;if(w.format==="regex")return`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${w.pattern}`;return`Virheellinen ${U[w.format]??X.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${X.divisor} monikerta`;case"unrecognized_keys":return`${X.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${x(X.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 V3(){return{localeError:Zq()}}var Vq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"nombre";case"object":{if(Array.isArray(X))return"tableau";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Entr\xE9e invalide : ${X.expected} attendu, ${W(X.input)} re\xE7u`;case"invalid_value":if(X.values.length===1)return`Entr\xE9e invalide : ${n(X.values[0])} attendu`;return`Option invalide : une valeur parmi ${x(X.values,"|")} attendue`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Trop grand : ${X.origin??"valeur"} doit ${Y.verb} ${w}${X.maximum.toString()} ${Y.unit??"\xE9l\xE9ment(s)"}`;return`Trop grand : ${X.origin??"valeur"} doit \xEAtre ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Trop petit : ${X.origin} doit ${Y.verb} ${w}${X.minimum.toString()} ${Y.unit}`;return`Trop petit : ${X.origin} doit \xEAtre ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${w.prefix}"`;if(w.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${w.suffix}"`;if(w.format==="includes")return`Cha\xEEne invalide : doit inclure "${w.includes}"`;if(w.format==="regex")return`Cha\xEEne invalide : doit correspondre au mod\xE8le ${w.pattern}`;return`${U[w.format]??X.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${X.divisor}`;case"unrecognized_keys":return`Cl\xE9${X.keys.length>1?"s":""} non reconnue${X.keys.length>1?"s":""} : ${x(X.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${X.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${X.origin}`;default:return"Entr\xE9e invalide"}}};function K3(){return{localeError:Vq()}}var Kq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${X.expected}, re\xE7u ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Entr\xE9e invalide : attendu ${n(X.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"\u2264":"<",Y=T(X.origin);if(Y)return`Trop grand : attendu que ${X.origin??"la valeur"} ait ${w}${X.maximum.toString()} ${Y.unit}`;return`Trop grand : attendu que ${X.origin??"la valeur"} soit ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?"\u2265":">",Y=T(X.origin);if(Y)return`Trop petit : attendu que ${X.origin} ait ${w}${X.minimum.toString()} ${Y.unit}`;return`Trop petit : attendu que ${X.origin} soit ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${w.prefix}"`;if(w.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${w.suffix}"`;if(w.format==="includes")return`Cha\xEEne invalide : doit inclure "${w.includes}"`;if(w.format==="regex")return`Cha\xEEne invalide : doit correspondre au motif ${w.pattern}`;return`${U[w.format]??X.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${X.divisor}`;case"unrecognized_keys":return`Cl\xE9${X.keys.length>1?"s":""} non reconnue${X.keys.length>1?"s":""} : ${x(X.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${X.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${X.origin}`;default:return"Entr\xE9e invalide"}}};function A3(){return{localeError:Kq()}}var Aq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${X.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${n(X.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 ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${X.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${w}${X.maximum.toString()} ${Y.unit??"elements"}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${X.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${X.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${w}${X.minimum.toString()} ${Y.unit}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${X.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.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"${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`${U[w.format]??X.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 ${X.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${X.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${X.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${x(X.keys,", ")}`;case"invalid_key":return`\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${X.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${X.origin}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function E3(){return{localeError:Aq()}}var Eq=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(X))return"t\xF6mb";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${X.expected}, a kapott \xE9rt\xE9k ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${n(X.values[0])}`;return`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`T\xFAl nagy: ${X.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${w}${X.maximum.toString()} ${Y.unit??"elem"}`;return`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${X.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${X.origin} m\xE9rete t\xFAl kicsi ${w}${X.minimum.toString()} ${Y.unit}`;return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${X.origin} t\xFAl kicsi ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`\xC9rv\xE9nytelen string: "${w.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`;if(w.format==="ends_with")return`\xC9rv\xE9nytelen string: "${w.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`;if(w.format==="includes")return`\xC9rv\xE9nytelen string: "${w.includes}" \xE9rt\xE9ket kell tartalmaznia`;if(w.format==="regex")return`\xC9rv\xE9nytelen string: ${w.pattern} mint\xE1nak kell megfelelnie`;return`\xC9rv\xE9nytelen ${U[w.format]??X.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${X.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${X.keys.length>1?"s":""}: ${x(X.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${X.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${X.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function M3(){return{localeError:Eq()}}var Mq=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Input tidak valid: diharapkan ${X.expected}, diterima ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Input tidak valid: diharapkan ${n(X.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Terlalu besar: diharapkan ${X.origin??"value"} memiliki ${w}${X.maximum.toString()} ${Y.unit??"elemen"}`;return`Terlalu besar: diharapkan ${X.origin??"value"} menjadi ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Terlalu kecil: diharapkan ${X.origin} memiliki ${w}${X.minimum.toString()} ${Y.unit}`;return`Terlalu kecil: diharapkan ${X.origin} menjadi ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`String tidak valid: harus dimulai dengan "${w.prefix}"`;if(w.format==="ends_with")return`String tidak valid: harus berakhir dengan "${w.suffix}"`;if(w.format==="includes")return`String tidak valid: harus menyertakan "${w.includes}"`;if(w.format==="regex")return`String tidak valid: harus sesuai pola ${w.pattern}`;return`${U[w.format]??X.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${X.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${X.keys.length>1?"s":""}: ${x(X.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${X.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${X.origin}`;default:return"Input tidak valid"}}};function D3(){return{localeError:Mq()}}var Dq=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"numero";case"object":{if(Array.isArray(X))return"vettore";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Input non valido: atteso ${X.expected}, ricevuto ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Input non valido: atteso ${n(X.values[0])}`;return`Opzione non valida: atteso uno tra ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Troppo grande: ${X.origin??"valore"} deve avere ${w}${X.maximum.toString()} ${Y.unit??"elementi"}`;return`Troppo grande: ${X.origin??"valore"} deve essere ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Troppo piccolo: ${X.origin} deve avere ${w}${X.minimum.toString()} ${Y.unit}`;return`Troppo piccolo: ${X.origin} deve essere ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Stringa non valida: deve iniziare con "${w.prefix}"`;if(w.format==="ends_with")return`Stringa non valida: deve terminare con "${w.suffix}"`;if(w.format==="includes")return`Stringa non valida: deve includere "${w.includes}"`;if(w.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${w.pattern}`;return`Invalid ${U[w.format]??X.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${X.divisor}`;case"unrecognized_keys":return`Chiav${X.keys.length>1?"i":"e"} non riconosciut${X.keys.length>1?"e":"a"}: ${x(X.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${X.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${X.origin}`;default:return"Input non valido"}}};function N3(){return{localeError:Dq()}}var Nq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(X))return"\u914D\u5217";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${X.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${W(X.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":if(X.values.length===1)return`\u7121\u52B9\u306A\u5165\u529B: ${n(X.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u9078\u629E: ${x(X.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let w=X.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",Y=T(X.origin);if(Y)return`\u5927\u304D\u3059\u304E\u308B\u5024: ${X.origin??"\u5024"}\u306F${X.maximum.toString()}${Y.unit??"\u8981\u7D20"}${w}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5927\u304D\u3059\u304E\u308B\u5024: ${X.origin??"\u5024"}\u306F${X.maximum.toString()}${w}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let w=X.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",Y=T(X.origin);if(Y)return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${X.origin}\u306F${X.minimum.toString()}${Y.unit}${w}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${X.origin}\u306F${X.minimum.toString()}${w}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${w.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(w.format==="ends_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${w.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(w.format==="includes")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${w.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(w.format==="regex")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${w.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u7121\u52B9\u306A${U[w.format]??X.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${X.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${X.keys.length>1?"\u7FA4":""}: ${x(X.keys,"\u3001")}`;case"invalid_key":return`${X.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${X.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function J3(){return{localeError:Nq()}}var Jq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(X))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(X===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.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 ${X.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${W(X.input)}`;case"invalid_value":if(X.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 ${n(X.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 ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${X.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${w} ${X.maximum.toString()} ${Y.unit??"\u1792\u17B6\u178F\u17BB"}`;return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${X.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${w} ${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${X.origin} ${w} ${X.minimum.toString()} ${Y.unit}`;return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${X.origin} ${w} ${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.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 "${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${U[w.format]??X.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 ${X.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${x(X.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 ${X.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 ${X.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 L3(){return{localeError:Jq()}}var Lq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${X.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${W(X.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":if(X.values.length===1)return`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${n(X.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC635\uC158: ${x(X.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let w=X.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",Y=w==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",G=T(X.origin),H=G?.unit??"\uC694\uC18C";if(G)return`${X.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${X.maximum.toString()}${H} ${w}${Y}`;return`${X.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${X.maximum.toString()} ${w}${Y}`}case"too_small":{let w=X.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",Y=w==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",G=T(X.origin),H=G?.unit??"\uC694\uC18C";if(G)return`${X.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${X.minimum.toString()}${H} ${w}${Y}`;return`${X.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${X.minimum.toString()} ${w}${Y}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${w.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`;if(w.format==="ends_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${w.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`;if(w.format==="includes")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${w.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`;if(w.format==="regex")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${w.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C ${U[w.format]??X.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${X.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${x(X.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${X.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${X.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function R3(){return{localeError:Lq()}}var Rq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(X))return"\u043D\u0438\u0437\u0430";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${X.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Invalid input: expected ${n(X.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 ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${X.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${w}${X.maximum.toString()} ${Y.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 ${X.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${X.origin} \u0434\u0430 \u0438\u043C\u0430 ${w}${X.minimum.toString()} ${Y.unit}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${X.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.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 "${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`Invalid ${U[w.format]??X.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 ${X.divisor}`;case"unrecognized_keys":return`${X.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"}: ${x(X.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${X.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 ${X.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function _3(){return{localeError:Rq()}}var _q=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"nombor";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Input tidak sah: dijangka ${X.expected}, diterima ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Input tidak sah: dijangka ${n(X.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Terlalu besar: dijangka ${X.origin??"nilai"} ${Y.verb} ${w}${X.maximum.toString()} ${Y.unit??"elemen"}`;return`Terlalu besar: dijangka ${X.origin??"nilai"} adalah ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Terlalu kecil: dijangka ${X.origin} ${Y.verb} ${w}${X.minimum.toString()} ${Y.unit}`;return`Terlalu kecil: dijangka ${X.origin} adalah ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`String tidak sah: mesti bermula dengan "${w.prefix}"`;if(w.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${w.suffix}"`;if(w.format==="includes")return`String tidak sah: mesti mengandungi "${w.includes}"`;if(w.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${w.pattern}`;return`${U[w.format]??X.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${X.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${x(X.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${X.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${X.origin}`;default:return"Input tidak sah"}}};function k3(){return{localeError:_q()}}var kq=()=>{let $={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"getal";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Ongeldige invoer: verwacht ${X.expected}, ontving ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ongeldige invoer: verwacht ${n(X.values[0])}`;return`Ongeldige optie: verwacht \xE9\xE9n van ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Te lang: verwacht dat ${X.origin??"waarde"} ${w}${X.maximum.toString()} ${Y.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${X.origin??"waarde"} ${w}${X.maximum.toString()} is`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Te kort: verwacht dat ${X.origin} ${w}${X.minimum.toString()} ${Y.unit} bevat`;return`Te kort: verwacht dat ${X.origin} ${w}${X.minimum.toString()} is`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Ongeldige tekst: moet met "${w.prefix}" beginnen`;if(w.format==="ends_with")return`Ongeldige tekst: moet op "${w.suffix}" eindigen`;if(w.format==="includes")return`Ongeldige tekst: moet "${w.includes}" bevatten`;if(w.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${w.pattern}`;return`Ongeldig: ${U[w.format]??X.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${X.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${X.keys.length>1?"s":""}: ${x(X.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${X.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${X.origin}`;default:return"Ongeldige invoer"}}};function v3(){return{localeError:kq()}}var vq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"tall";case"object":{if(Array.isArray(X))return"liste";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Ugyldig input: forventet ${X.expected}, fikk ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ugyldig verdi: forventet ${n(X.values[0])}`;return`Ugyldig valg: forventet en av ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`For stor(t): forventet ${X.origin??"value"} til \xE5 ha ${w}${X.maximum.toString()} ${Y.unit??"elementer"}`;return`For stor(t): forventet ${X.origin??"value"} til \xE5 ha ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`For lite(n): forventet ${X.origin} til \xE5 ha ${w}${X.minimum.toString()} ${Y.unit}`;return`For lite(n): forventet ${X.origin} til \xE5 ha ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Ugyldig streng: m\xE5 starte med "${w.prefix}"`;if(w.format==="ends_with")return`Ugyldig streng: m\xE5 ende med "${w.suffix}"`;if(w.format==="includes")return`Ugyldig streng: m\xE5 inneholde "${w.includes}"`;if(w.format==="regex")return`Ugyldig streng: m\xE5 matche m\xF8nsteret ${w.pattern}`;return`Ugyldig ${U[w.format]??X.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${X.divisor}`;case"unrecognized_keys":return`${X.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${x(X.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${X.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${X.origin}`;default:return"Ugyldig input"}}};function P3(){return{localeError:vq()}}var Pq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"numara";case"object":{if(Array.isArray(X))return"saf";if(X===null)return"gayb";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`F\xE2sit giren: umulan ${X.expected}, al\u0131nan ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`F\xE2sit giren: umulan ${n(X.values[0])}`;return`F\xE2sit tercih: m\xFBteberler ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Fazla b\xFCy\xFCk: ${X.origin??"value"}, ${w}${X.maximum.toString()} ${Y.unit??"elements"} sahip olmal\u0131yd\u0131.`;return`Fazla b\xFCy\xFCk: ${X.origin??"value"}, ${w}${X.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Fazla k\xFC\xE7\xFCk: ${X.origin}, ${w}${X.minimum.toString()} ${Y.unit} sahip olmal\u0131yd\u0131.`;return`Fazla k\xFC\xE7\xFCk: ${X.origin}, ${w}${X.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`F\xE2sit metin: "${w.prefix}" ile ba\u015Flamal\u0131.`;if(w.format==="ends_with")return`F\xE2sit metin: "${w.suffix}" ile bitmeli.`;if(w.format==="includes")return`F\xE2sit metin: "${w.includes}" ihtiv\xE2 etmeli.`;if(w.format==="regex")return`F\xE2sit metin: ${w.pattern} nak\u015F\u0131na uymal\u0131.`;return`F\xE2sit ${U[w.format]??X.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${X.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${X.keys.length>1?"s":""}: ${x(X.keys,", ")}`;case"invalid_key":return`${X.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${X.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function q3(){return{localeError:Pq()}}var qq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(X))return"\u0627\u0631\u06D0";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${X.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${W(X.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":if(X.values.length===1)return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${n(X.values[0])} \u0648\u0627\u06CC`;return`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${x(X.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${X.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${w}${X.maximum.toString()} ${Y.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${X.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${w}${X.maximum.toString()} \u0648\u064A`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${X.origin} \u0628\u0627\u06CC\u062F ${w}${X.minimum.toString()} ${Y.unit} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${X.origin} \u0628\u0627\u06CC\u062F ${w}${X.minimum.toString()} \u0648\u064A`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${w.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`;if(w.format==="ends_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${w.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`;if(w.format==="includes")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${w.includes}" \u0648\u0644\u0631\u064A`;if(w.format==="regex")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${w.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`;return`${U[w.format]??X.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${X.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${X.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${x(X.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${X.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 ${X.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function C3(){return{localeError:qq()}}var Cq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"liczba";case"object":{if(Array.isArray(X))return"tablica";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${X.expected}, otrzymano ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${n(X.values[0])}`;return`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${X.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${w}${X.maximum.toString()} ${Y.unit??"element\xF3w"}`;return`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${X.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${X.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${w}${X.minimum.toString()} ${Y.unit??"element\xF3w"}`;return`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${X.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${w.prefix}"`;if(w.format==="ends_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${w.suffix}"`;if(w.format==="includes")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${w.includes}"`;if(w.format==="regex")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${w.pattern}`;return`Nieprawid\u0142ow(y/a/e) ${U[w.format]??X.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${X.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${X.keys.length>1?"s":""}: ${x(X.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${X.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${X.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function S3(){return{localeError:Cq()}}var Sq=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(X))return"array";if(X===null)return"nulo";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${X.expected}, recebido ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Entrada inv\xE1lida: esperado ${n(X.values[0])}`;return`Op\xE7\xE3o inv\xE1lida: esperada uma das ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Muito grande: esperado que ${X.origin??"valor"} tivesse ${w}${X.maximum.toString()} ${Y.unit??"elementos"}`;return`Muito grande: esperado que ${X.origin??"valor"} fosse ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Muito pequeno: esperado que ${X.origin} tivesse ${w}${X.minimum.toString()} ${Y.unit}`;return`Muito pequeno: esperado que ${X.origin} fosse ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Texto inv\xE1lido: deve come\xE7ar com "${w.prefix}"`;if(w.format==="ends_with")return`Texto inv\xE1lido: deve terminar com "${w.suffix}"`;if(w.format==="includes")return`Texto inv\xE1lido: deve incluir "${w.includes}"`;if(w.format==="regex")return`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${w.pattern}`;return`${U[w.format]??X.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${X.divisor}`;case"unrecognized_keys":return`Chave${X.keys.length>1?"s":""} desconhecida${X.keys.length>1?"s":""}: ${x(X.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${X.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${X.origin}`;default:return"Campo inv\xE1lido"}}};function j3(){return{localeError:Sq()}}function AK($,T,W,U){let X=Math.abs($),w=X%10,Y=X%100;if(Y>=11&&Y<=19)return U;if(w===1)return T;if(w>=2&&w<=4)return W;return U}var jq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(X))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.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 ${X.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${W(X.input)}`;case"invalid_value":if(X.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 ${n(X.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 ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y){let G=Number(X.maximum),H=AK(G,Y.unit.one,Y.unit.few,Y.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 ${X.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${w}${X.maximum.toString()} ${H}`}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 ${X.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y){let G=Number(X.minimum),H=AK(G,Y.unit.one,Y.unit.few,Y.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 ${X.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${w}${X.minimum.toString()} ${H}`}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 ${X.origin} \u0431\u0443\u0434\u0435\u0442 ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.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 "${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${U[w.format]??X.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 ${X.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${X.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${X.keys.length>1?"\u0438":""}: ${x(X.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${X.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 ${X.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 B3(){return{localeError:jq()}}var Bq=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(X))return"tabela";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${X.expected}, prejeto ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Neveljaven vnos: pri\u010Dakovano ${n(X.values[0])}`;return`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Preveliko: pri\u010Dakovano, da bo ${X.origin??"vrednost"} imelo ${w}${X.maximum.toString()} ${Y.unit??"elementov"}`;return`Preveliko: pri\u010Dakovano, da bo ${X.origin??"vrednost"} ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Premajhno: pri\u010Dakovano, da bo ${X.origin} imelo ${w}${X.minimum.toString()} ${Y.unit}`;return`Premajhno: pri\u010Dakovano, da bo ${X.origin} ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Neveljaven niz: mora se za\u010Deti z "${w.prefix}"`;if(w.format==="ends_with")return`Neveljaven niz: mora se kon\u010Dati z "${w.suffix}"`;if(w.format==="includes")return`Neveljaven niz: mora vsebovati "${w.includes}"`;if(w.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${w.pattern}`;return`Neveljaven ${U[w.format]??X.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${X.divisor}`;case"unrecognized_keys":return`Neprepoznan${X.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${x(X.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${X.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${X.origin}`;default:return"Neveljaven vnos"}}};function I3(){return{localeError:Bq()}}var Iq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"antal";case"object":{if(Array.isArray(X))return"lista";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${X.expected}, fick ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ogiltig inmatning: f\xF6rv\xE4ntat ${n(X.values[0])}`;return`Ogiltigt val: f\xF6rv\xE4ntade en av ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`F\xF6r stor(t): f\xF6rv\xE4ntade ${X.origin??"v\xE4rdet"} att ha ${w}${X.maximum.toString()} ${Y.unit??"element"}`;return`F\xF6r stor(t): f\xF6rv\xE4ntat ${X.origin??"v\xE4rdet"} att ha ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`F\xF6r lite(t): f\xF6rv\xE4ntade ${X.origin??"v\xE4rdet"} att ha ${w}${X.minimum.toString()} ${Y.unit}`;return`F\xF6r lite(t): f\xF6rv\xE4ntade ${X.origin??"v\xE4rdet"} att ha ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${w.prefix}"`;if(w.format==="ends_with")return`Ogiltig str\xE4ng: m\xE5ste sluta med "${w.suffix}"`;if(w.format==="includes")return`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${w.includes}"`;if(w.format==="regex")return`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${w.pattern}"`;return`Ogiltig(t) ${U[w.format]??X.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${X.divisor}`;case"unrecognized_keys":return`${X.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${x(X.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${X.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${X.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function x3(){return{localeError:Iq()}}var xq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(X))return"\u0B85\u0BA3\u0BBF";if(X===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.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 ${X.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${W(X.input)}`;case"invalid_value":if(X.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 ${n(X.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 ${x(X.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)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 ${X.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${w}${X.maximum.toString()} ${Y.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 ${X.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${w}${X.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)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 ${X.origin} ${w}${X.minimum.toString()} ${Y.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 ${X.origin} ${w}${X.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${w.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(w.format==="ends_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${w.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(w.format==="includes")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${w.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(w.format==="regex")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${w.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[w.format]??X.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${X.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${X.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${x(X.keys,", ")}`;case"invalid_key":return`${X.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`${X.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 f3(){return{localeError:xq()}}var fq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(X))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(X===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.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 ${X.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${n(X.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 ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",Y=T(X.origin);if(Y)return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${X.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${w} ${X.maximum.toString()} ${Y.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`;return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${X.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${w} ${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",Y=T(X.origin);if(Y)return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${X.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${w} ${X.minimum.toString()} ${Y.unit}`;return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${X.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${w} ${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.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 "${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`;if(w.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 ${w.pattern}`;return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${U[w.format]??X.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 ${X.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: ${x(X.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${X.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 ${X.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function b3(){return{localeError:fq()}}var bq=($)=>{let T=typeof $;switch(T){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 T},yq=()=>{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 T(U){return $[U]??null}let W={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 ${bq(U.input)}`;case"invalid_value":if(U.values.length===1)return`Ge\xE7ersiz de\u011Fer: beklenen ${n(U.values[0])}`;return`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${x(U.values,"|")}`;case"too_big":{let X=U.inclusive?"<=":"<",w=T(U.origin);if(w)return`\xC7ok b\xFCy\xFCk: beklenen ${U.origin??"de\u011Fer"} ${X}${U.maximum.toString()} ${w.unit??"\xF6\u011Fe"}`;return`\xC7ok b\xFCy\xFCk: beklenen ${U.origin??"de\u011Fer"} ${X}${U.maximum.toString()}`}case"too_small":{let X=U.inclusive?">=":">",w=T(U.origin);if(w)return`\xC7ok k\xFC\xE7\xFCk: beklenen ${U.origin} ${X}${U.minimum.toString()} ${w.unit}`;return`\xC7ok k\xFC\xE7\xFCk: beklenen ${U.origin} ${X}${U.minimum.toString()}`}case"invalid_format":{let X=U;if(X.format==="starts_with")return`Ge\xE7ersiz metin: "${X.prefix}" ile ba\u015Flamal\u0131`;if(X.format==="ends_with")return`Ge\xE7ersiz metin: "${X.suffix}" ile bitmeli`;if(X.format==="includes")return`Ge\xE7ersiz metin: "${X.includes}" i\xE7ermeli`;if(X.format==="regex")return`Ge\xE7ersiz metin: ${X.pattern} desenine uymal\u0131`;return`Ge\xE7ersiz ${W[X.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":""}: ${x(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 y3(){return{localeError:yq()}}var hq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(X))return"\u043C\u0430\u0441\u0438\u0432";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.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 ${X.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${W(X.input)}`;case"invalid_value":if(X.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 ${n(X.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 ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)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 ${X.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${Y.verb} ${w}${X.maximum.toString()} ${Y.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 ${X.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${X.origin} ${Y.verb} ${w}${X.minimum.toString()} ${Y.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 ${X.origin} \u0431\u0443\u0434\u0435 ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.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 "${w.prefix}"`;if(w.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 "${w.suffix}"`;if(w.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 "${w.includes}"`;if(w.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 ${w.pattern}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${U[w.format]??X.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 ${X.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${X.keys.length>1?"\u0456":""}: ${x(X.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${X.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 ${X.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 h3(){return{localeError:hq()}}var gq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(X))return"\u0622\u0631\u06D2";if(X===null)return"\u0646\u0644";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${X.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${W(X.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":if(X.values.length===1)return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${n(X.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;return`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${x(X.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${X.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${w}${X.maximum.toString()} ${Y.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: ${X.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${w}${X.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${X.origin} \u06A9\u06D2 ${w}${X.minimum.toString()} ${Y.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${X.origin} \u06A9\u0627 ${w}${X.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${w.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(w.format==="ends_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${w.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(w.format==="includes")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${w.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(w.format==="regex")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${w.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;return`\u063A\u0644\u0637 ${U[w.format]??X.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${X.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${X.keys.length>1?"\u0632":""}: ${x(X.keys,"\u060C ")}`;case"invalid_key":return`${X.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${X.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function g3(){return{localeError:gq()}}var mq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(X))return"m\u1EA3ng";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${X.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${n(X.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 ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${X.origin??"gi\xE1 tr\u1ECB"} ${Y.verb} ${w}${X.maximum.toString()} ${Y.unit??"ph\u1EA7n t\u1EED"}`;return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${X.origin??"gi\xE1 tr\u1ECB"} ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${X.origin} ${Y.verb} ${w}${X.minimum.toString()} ${Y.unit}`;return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${X.origin} ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${w.prefix}"`;if(w.format==="ends_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${w.suffix}"`;if(w.format==="includes")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${w.includes}"`;if(w.format==="regex")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${w.pattern}`;return`${U[w.format]??X.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 ${X.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${x(X.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${X.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 ${X.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function m3(){return{localeError:mq()}}var cq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(X))return"\u6570\u7EC4";if(X===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${X.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${n(X.values[0])}`;return`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${X.origin??"\u503C"} ${w}${X.maximum.toString()} ${Y.unit??"\u4E2A\u5143\u7D20"}`;return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${X.origin??"\u503C"} ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${X.origin} ${w}${X.minimum.toString()} ${Y.unit}`;return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${X.origin} ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${w.prefix}" \u5F00\u5934`;if(w.format==="ends_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${w.suffix}" \u7ED3\u5C3E`;if(w.format==="includes")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${w.includes}"`;if(w.format==="regex")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${w.pattern}`;return`\u65E0\u6548${U[w.format]??X.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${X.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${x(X.keys,", ")}`;case"invalid_key":return`${X.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${X.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function c3(){return{localeError:cq()}}var uq=()=>{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 T(X){return $[X]??null}let W=(X)=>{let w=typeof X;switch(w){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return w},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(X)=>{switch(X.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${X.expected}\uFF0C\u4F46\u6536\u5230 ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${n(X.values[0])}`;return`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${x(X.values,"|")}`;case"too_big":{let w=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${X.origin??"\u503C"} \u61C9\u70BA ${w}${X.maximum.toString()} ${Y.unit??"\u500B\u5143\u7D20"}`;return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${X.origin??"\u503C"} \u61C9\u70BA ${w}${X.maximum.toString()}`}case"too_small":{let w=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${X.origin} \u61C9\u70BA ${w}${X.minimum.toString()} ${Y.unit}`;return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${X.origin} \u61C9\u70BA ${w}${X.minimum.toString()}`}case"invalid_format":{let w=X;if(w.format==="starts_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${w.prefix}" \u958B\u982D`;if(w.format==="ends_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${w.suffix}" \u7D50\u5C3E`;if(w.format==="includes")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${w.includes}"`;if(w.format==="regex")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${w.pattern}`;return`\u7121\u6548\u7684 ${U[w.format]??X.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${X.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${X.keys.length>1?"\u5011":""}\uFF1A${x(X.keys,"\u3001")}`;case"invalid_key":return`${X.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${X.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function u3(){return{localeError:uq()}}var p3=Symbol("ZodOutput"),d3=Symbol("ZodInput");class rX{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...T){let W=T[0];if(this._map.set($,W),W&&typeof W==="object"&&"id"in W){if(this._idmap.has(W.id))throw new Error(`ID ${W.id} already exists in the registry`);this._idmap.set(W.id,$)}return this}remove($){return this._map.delete($),this}get($){let T=$._zod.parent;if(T){let W={...this.get(T)??{}};return delete W.id,{...W,...this._map.get($)}}return this._map.get($)}has($){return this._map.has($)}}function NY(){return new rX}var l1=NY();function o3($,T){return new $({type:"string",...p(T)})}function l3($,T){return new $({type:"string",coerce:!0,...p(T)})}function JY($,T){return new $({type:"string",format:"email",check:"string_format",abort:!1,...p(T)})}function nX($,T){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...p(T)})}function LY($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...p(T)})}function RY($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...p(T)})}function _Y($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...p(T)})}function kY($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...p(T)})}function vY($,T){return new $({type:"string",format:"url",check:"string_format",abort:!1,...p(T)})}function PY($,T){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...p(T)})}function qY($,T){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...p(T)})}function CY($,T){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...p(T)})}function SY($,T){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...p(T)})}function jY($,T){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...p(T)})}function BY($,T){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...p(T)})}function IY($,T){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...p(T)})}function xY($,T){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...p(T)})}function fY($,T){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...p(T)})}function bY($,T){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...p(T)})}function yY($,T){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...p(T)})}function hY($,T){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...p(T)})}function gY($,T){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...p(T)})}function mY($,T){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...p(T)})}function cY($,T){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...p(T)})}var r3={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function n3($,T){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...p(T)})}function i3($,T){return new $({type:"string",format:"date",check:"string_format",...p(T)})}function t3($,T){return new $({type:"string",format:"time",check:"string_format",precision:null,...p(T)})}function a3($,T){return new $({type:"string",format:"duration",check:"string_format",...p(T)})}function s3($,T){return new $({type:"number",checks:[],...p(T)})}function e3($,T){return new $({type:"number",coerce:!0,checks:[],...p(T)})}function $H($,T){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...p(T)})}function TH($,T){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...p(T)})}function WH($,T){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...p(T)})}function XH($,T){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...p(T)})}function UH($,T){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...p(T)})}function wH($,T){return new $({type:"boolean",...p(T)})}function YH($,T){return new $({type:"boolean",coerce:!0,...p(T)})}function GH($,T){return new $({type:"bigint",...p(T)})}function zH($,T){return new $({type:"bigint",coerce:!0,...p(T)})}function HH($,T){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...p(T)})}function FH($,T){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...p(T)})}function OH($,T){return new $({type:"symbol",...p(T)})}function QH($,T){return new $({type:"undefined",...p(T)})}function ZH($,T){return new $({type:"null",...p(T)})}function VH($){return new $({type:"any"})}function rW($){return new $({type:"unknown"})}function KH($,T){return new $({type:"never",...p(T)})}function AH($,T){return new $({type:"void",...p(T)})}function EH($,T){return new $({type:"date",...p(T)})}function MH($,T){return new $({type:"date",coerce:!0,...p(T)})}function DH($,T){return new $({type:"nan",...p(T)})}function Z0($,T){return new QY({check:"less_than",...p(T),value:$,inclusive:!1})}function K1($,T){return new QY({check:"less_than",...p(T),value:$,inclusive:!0})}function V0($,T){return new ZY({check:"greater_than",...p(T),value:$,inclusive:!1})}function x6($,T){return new ZY({check:"greater_than",...p(T),value:$,inclusive:!0})}function NH($){return V0(0,$)}function JH($){return Z0(0,$)}function LH($){return K1(0,$)}function RH($){return x6(0,$)}function lT($,T){return new g5({check:"multiple_of",...p(T),value:$})}function nW($,T){return new u5({check:"max_size",...p(T),maximum:$})}function rT($,T){return new p5({check:"min_size",...p(T),minimum:$})}function iX($,T){return new d5({check:"size_equals",...p(T),size:$})}function iW($,T){return new o5({check:"max_length",...p(T),maximum:$})}function YT($,T){return new l5({check:"min_length",...p(T),minimum:$})}function tW($,T){return new r5({check:"length_equals",...p(T),length:$})}function tX($,T){return new n5({check:"string_format",format:"regex",...p(T),pattern:$})}function aX($){return new i5({check:"string_format",format:"lowercase",...p($)})}function sX($){return new t5({check:"string_format",format:"uppercase",...p($)})}function eX($,T){return new a5({check:"string_format",format:"includes",...p(T),includes:$})}function $8($,T){return new s5({check:"string_format",format:"starts_with",...p(T),prefix:$})}function T8($,T){return new e5({check:"string_format",format:"ends_with",...p(T),suffix:$})}function _H($,T,W){return new $7({check:"property",property:$,schema:T,...p(W)})}function W8($,T){return new T7({check:"mime_type",mime:$,...p(T)})}function K0($){return new W7({check:"overwrite",tx:$})}function X8($){return K0((T)=>T.normalize($))}function U8(){return K0(($)=>$.trim())}function w8(){return K0(($)=>$.toLowerCase())}function Y8(){return K0(($)=>$.toUpperCase())}function G8($,T,W){return new $({type:"array",element:T,...p(W)})}function pq($,T,W){return new $({type:"union",options:T,...p(W)})}function dq($,T,W,U){return new $({type:"union",options:W,discriminator:T,...p(U)})}function oq($,T,W){return new $({type:"intersection",left:T,right:W})}function kH($,T,W,U){let X=W instanceof K$;return new $({type:"tuple",items:T,rest:X?W:null,...p(X?U:W)})}function lq($,T,W,U){return new $({type:"record",keyType:T,valueType:W,...p(U)})}function rq($,T,W,U){return new $({type:"map",keyType:T,valueType:W,...p(U)})}function nq($,T,W){return new $({type:"set",valueType:T,...p(W)})}function iq($,T,W){let U=Array.isArray(T)?Object.fromEntries(T.map((X)=>[X,X])):T;return new $({type:"enum",entries:U,...p(W)})}function tq($,T,W){return new $({type:"enum",entries:T,...p(W)})}function aq($,T,W){return new $({type:"literal",values:Array.isArray(T)?T:[T],...p(W)})}function vH($,T){return new $({type:"file",...p(T)})}function sq($,T){return new $({type:"transform",transform:T})}function eq($,T){return new $({type:"optional",innerType:T})}function $C($,T){return new $({type:"nullable",innerType:T})}function TC($,T,W){return new $({type:"default",innerType:T,get defaultValue(){return typeof W==="function"?W():W}})}function WC($,T,W){return new $({type:"nonoptional",innerType:T,...p(W)})}function XC($,T){return new $({type:"success",innerType:T})}function UC($,T,W){return new $({type:"catch",innerType:T,catchValue:typeof W==="function"?W:()=>W})}function wC($,T,W){return new $({type:"pipe",in:T,out:W})}function YC($,T){return new $({type:"readonly",innerType:T})}function GC($,T,W){return new $({type:"template_literal",parts:T,...p(W)})}function zC($,T){return new $({type:"lazy",getter:T})}function HC($,T){return new $({type:"promise",innerType:T})}function PH($,T,W){let U=p(W);return U.abort??(U.abort=!0),new $({type:"custom",check:"custom",fn:T,...U})}function qH($,T,W){return new $({type:"custom",check:"custom",fn:T,...p(W)})}function CH($,T){let{case:W,error:U,truthy:X,falsy:w}=p(T),Y=X??["true","1","yes","on","y","enabled"],G=w??["false","0","no","off","n","disabled"];if(W!=="sensitive")Y=Y.map((J)=>typeof J==="string"?J.toLowerCase():J),G=G.map((J)=>typeof J==="string"?J.toLowerCase():J);let H=new Set(Y),z=new Set(G),F=$.Pipe??dX,O=$.Boolean??cX,Q=$.String??dT,V=new($.Transform??pX)({type:"transform",transform:(J,L)=>{let _=J;if(W!=="sensitive")_=_.toLowerCase();if(H.has(_))return!0;else if(z.has(_))return!1;else return L.issues.push({code:"invalid_value",expected:"stringbool",values:[...H,...z],input:L.value,inst:V}),{}},error:U}),A=new F({type:"pipe",in:new Q({type:"string",error:U}),out:V,error:U});return new F({type:"pipe",in:A,out:new O({type:"boolean",error:U}),error:U})}class SH{constructor($){this._def=$,this.def=$}implement($){if(typeof $!=="function")throw new Error("implement() must be called with a function");let T=(...W)=>{let U=this._def.input?YY(this._def.input,W,void 0,{callee:T}):W;if(!Array.isArray(U))throw new Error("Invalid arguments schema: not an array or tuple schema.");let X=$(...U);return this._def.output?YY(this._def.output,X,void 0,{callee:T}):X};return T}implementAsync($){if(typeof $!=="function")throw new Error("implement() must be called with a function");let T=async(...W)=>{let U=this._def.input?await zY(this._def.input,W,void 0,{callee:T}):W;if(!Array.isArray(U))throw new Error("Invalid arguments schema: not an array or tuple schema.");let X=await $(...U);return this._def.output?zY(this._def.output,X,void 0,{callee:T}):X};return T}input(...$){let T=this.constructor;if(Array.isArray($[0]))return new T({type:"function",input:new oT({type:"tuple",items:$[0],rest:$[1]}),output:this._def.output});return new T({type:"function",input:$[0],output:this._def.output})}output($){return new this.constructor({type:"function",input:this._def.input,output:$})}}function jH($){return new SH({type:"function",input:Array.isArray($?.input)?kH(oT,$?.input):$?.input??G8(uX,rW(lW)),output:$?.output??rW(lW)})}class uY{constructor($){this.counter=0,this.metadataRegistry=$?.metadata??l1,this.target=$?.target??"draft-2020-12",this.unrepresentable=$?.unrepresentable??"throw",this.override=$?.override??(()=>{}),this.io=$?.io??"output",this.seen=new Map}process($,T={path:[],schemaPath:[]}){var W;let U=$._zod.def,X={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},w=this.seen.get($);if(w){if(w.count++,T.schemaPath.includes($))w.cycle=T.path;return w.schema}let Y={schema:{},count:1,cycle:void 0};this.seen.set($,Y);let G=$._zod.toJSONSchema?.();if(G)Y.schema=G;else{let F={...T,schemaPath:[...T.schemaPath,$],path:T.path},O=$._zod.parent;if(O)Y.ref=O,this.process(O,F),this.seen.get(O).isParent=!0;else{let Q=Y.schema;switch(U.type){case"string":{let Z=Q;Z.type="string";let{minimum:V,maximum:A,format:D,patterns:J,contentEncoding:L}=$._zod.bag;if(typeof V==="number")Z.minLength=V;if(typeof A==="number")Z.maxLength=A;if(D){if(Z.format=X[D]??D,Z.format==="")delete Z.format}if(L)Z.contentEncoding=L;if(J&&J.size>0){let _=[...J];if(_.length===1)Z.pattern=_[0].source;else if(_.length>1)Y.schema.allOf=[..._.map((C)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:C.source}))]}break}case"number":{let Z=Q,{minimum:V,maximum:A,format:D,multipleOf:J,exclusiveMaximum:L,exclusiveMinimum:_}=$._zod.bag;if(typeof D==="string"&&D.includes("int"))Z.type="integer";else Z.type="number";if(typeof _==="number")Z.exclusiveMinimum=_;if(typeof V==="number"){if(Z.minimum=V,typeof _==="number")if(_>=V)delete Z.minimum;else delete Z.exclusiveMinimum}if(typeof L==="number")Z.exclusiveMaximum=L;if(typeof A==="number"){if(Z.maximum=A,typeof L==="number")if(L<=A)delete Z.maximum;else delete Z.exclusiveMaximum}if(typeof J==="number")Z.multipleOf=J;break}case"boolean":{let Z=Q;Z.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"undefined":{let Z=Q;Z.type="null";break}case"null":{Q.type="null";break}case"any":break;case"unknown":break;case"never":{Q.not={};break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let Z=Q,{minimum:V,maximum:A}=$._zod.bag;if(typeof V==="number")Z.minItems=V;if(typeof A==="number")Z.maxItems=A;Z.type="array",Z.items=this.process(U.element,{...F,path:[...F.path,"items"]});break}case"object":{let Z=Q;Z.type="object",Z.properties={};let V=U.shape;for(let J in V)Z.properties[J]=this.process(V[J],{...F,path:[...F.path,"properties",J]});let A=new Set(Object.keys(V)),D=new Set([...A].filter((J)=>{let L=U.shape[J]._zod;if(this.io==="input")return L.optin===void 0;else return L.optout===void 0}));if(D.size>0)Z.required=Array.from(D);if(U.catchall?._zod.def.type==="never")Z.additionalProperties=!1;else if(!U.catchall){if(this.io==="output")Z.additionalProperties=!1}else if(U.catchall)Z.additionalProperties=this.process(U.catchall,{...F,path:[...F.path,"additionalProperties"]});break}case"union":{let Z=Q;Z.anyOf=U.options.map((V,A)=>this.process(V,{...F,path:[...F.path,"anyOf",A]}));break}case"intersection":{let Z=Q,V=this.process(U.left,{...F,path:[...F.path,"allOf",0]}),A=this.process(U.right,{...F,path:[...F.path,"allOf",1]}),D=(L)=>("allOf"in L)&&Object.keys(L).length===1,J=[...D(V)?V.allOf:[V],...D(A)?A.allOf:[A]];Z.allOf=J;break}case"tuple":{let Z=Q;Z.type="array";let V=U.items.map((J,L)=>this.process(J,{...F,path:[...F.path,"prefixItems",L]}));if(this.target==="draft-2020-12")Z.prefixItems=V;else Z.items=V;if(U.rest){let J=this.process(U.rest,{...F,path:[...F.path,"items"]});if(this.target==="draft-2020-12")Z.items=J;else Z.additionalItems=J}if(U.rest)Z.items=this.process(U.rest,{...F,path:[...F.path,"items"]});let{minimum:A,maximum:D}=$._zod.bag;if(typeof A==="number")Z.minItems=A;if(typeof D==="number")Z.maxItems=D;break}case"record":{let Z=Q;Z.type="object",Z.propertyNames=this.process(U.keyType,{...F,path:[...F.path,"propertyNames"]}),Z.additionalProperties=this.process(U.valueType,{...F,path:[...F.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 Z=Q,V=jX(U.entries);if(V.every((A)=>typeof A==="number"))Z.type="number";if(V.every((A)=>typeof A==="string"))Z.type="string";Z.enum=V;break}case"literal":{let Z=Q,V=[];for(let A of U.values)if(A===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof A==="bigint")if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");else V.push(Number(A));else V.push(A);if(V.length===0);else if(V.length===1){let A=V[0];Z.type=A===null?"null":typeof A,Z.const=A}else{if(V.every((A)=>typeof A==="number"))Z.type="number";if(V.every((A)=>typeof A==="string"))Z.type="string";if(V.every((A)=>typeof A==="boolean"))Z.type="string";if(V.every((A)=>A===null))Z.type="null";Z.enum=V}break}case"file":{let Z=Q,V={type:"string",format:"binary",contentEncoding:"binary"},{minimum:A,maximum:D,mime:J}=$._zod.bag;if(A!==void 0)V.minLength=A;if(D!==void 0)V.maxLength=D;if(J)if(J.length===1)V.contentMediaType=J[0],Object.assign(Z,V);else Z.anyOf=J.map((L)=>{return{...V,contentMediaType:L}});else Object.assign(Z,V);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let Z=this.process(U.innerType,F);Q.anyOf=[Z,{type:"null"}];break}case"nonoptional":{this.process(U.innerType,F),Y.ref=U.innerType;break}case"success":{let Z=Q;Z.type="boolean";break}case"default":{this.process(U.innerType,F),Y.ref=U.innerType,Q.default=JSON.parse(JSON.stringify(U.defaultValue));break}case"prefault":{if(this.process(U.innerType,F),Y.ref=U.innerType,this.io==="input")Q._prefault=JSON.parse(JSON.stringify(U.defaultValue));break}case"catch":{this.process(U.innerType,F),Y.ref=U.innerType;let Z;try{Z=U.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}Q.default=Z;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let Z=Q,V=$._zod.pattern;if(!V)throw new Error("Pattern not found in template literal");Z.type="string",Z.pattern=V.source;break}case"pipe":{let Z=this.io==="input"?U.in._zod.def.type==="transform"?U.out:U.in:U.out;this.process(Z,F),Y.ref=Z;break}case"readonly":{this.process(U.innerType,F),Y.ref=U.innerType,Q.readOnly=!0;break}case"promise":{this.process(U.innerType,F),Y.ref=U.innerType;break}case"optional":{this.process(U.innerType,F),Y.ref=U.innerType;break}case"lazy":{let Z=$._zod.innerType;this.process(Z,F),Y.ref=Z;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let H=this.metadataRegistry.get($);if(H)Object.assign(Y.schema,H);if(this.io==="input"&&v4($))delete Y.schema.examples,delete Y.schema.default;if(this.io==="input"&&Y.schema._prefault)(W=Y.schema).default??(W.default=Y.schema._prefault);return delete Y.schema._prefault,this.seen.get($).schema}emit($,T){let W={cycles:T?.cycles??"ref",reused:T?.reused??"inline",external:T?.external??void 0},U=this.seen.get($);if(!U)throw new Error("Unprocessed schema. This is a bug in Zod.");let X=(z)=>{let F=this.target==="draft-2020-12"?"$defs":"definitions";if(W.external){let V=W.external.registry.get(z[0])?.id;if(V)return{ref:W.external.uri(V)};let A=z[1].defId??z[1].schema.id??`schema${this.counter++}`;return z[1].defId=A,{defId:A,ref:`${W.external.uri("__shared")}#/${F}/${A}`}}if(z[1]===U)return{ref:"#"};let Q=`${"#"}/${F}/`,Z=z[1].schema.id??`__schema${this.counter++}`;return{defId:Z,ref:Q+Z}},w=(z)=>{if(z[1].schema.$ref)return;let F=z[1],{ref:O,defId:Q}=X(z);if(F.def={...F.schema},Q)F.defId=Q;let Z=F.schema;for(let V in Z)delete Z[V];Z.$ref=O};for(let z of this.seen.entries()){let F=z[1];if($===z[0]){w(z);continue}if(W.external){let Q=W.external.registry.get(z[0])?.id;if($!==z[0]&&Q){w(z);continue}}if(this.metadataRegistry.get(z[0])?.id){w(z);continue}if(F.cycle){if(W.cycles==="throw")throw new Error(`Cycle detected: #/${F.cycle?.join("/")}/<root>
|
|
32
32
|
|
|
33
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);else if(W.cycles==="ref")w(z);continue}if(F.count>1){if(W.reused==="ref"){w(z);continue}}}let Y=(z,F)=>{let O=this.seen.get(z),Q=O.def??O.schema,Z={...Q};if(O.ref===null)return;let K=O.ref;if(O.ref=null,K){Y(K,F);let A=this.seen.get(K).schema;if(A.$ref&&F.target==="draft-7")Q.allOf=Q.allOf??[],Q.allOf.push(A);else Object.assign(Q,A),Object.assign(Q,Z)}if(!O.isParent)this.override({zodSchema:z,jsonSchema:Q})};for(let z of[...this.seen.entries()].reverse())Y(z[0],{target:this.target});let G={};if(this.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")G.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);Object.assign(G,X.def);let H=W.external?.defs??{};for(let z of this.seen.entries()){let F=z[1];if(F.def&&F.defId)H[F.defId]=F.def}if(!W.external&&Object.keys(H).length>0)if(this.target==="draft-2020-12")G.$defs=H;else G.definitions=H;try{return JSON.parse(JSON.stringify(G))}catch(z){throw new Error("Error converting schema to JSON.")}}}function SH($,T){if($ instanceof rU){let X=new dY(T),U={};for(let G of $._idmap.entries()){let[H,z]=G;X.process(z)}let w={},Y={registry:$,uri:T?.uri||((G)=>G),defs:U};for(let G of $._idmap.entries()){let[H,z]=G;w[H]=X.emit(z,{...T,external:Y})}if(Object.keys(U).length>0){let G=X.target==="draft-2020-12"?"$defs":"definitions";w.__shared={[G]:U}}return{schemas:w}}let W=new dY(T);return W.process($),W.emit($,T)}function v4($,T){let W=T??{seen:new Set};if(W.seen.has($))return!1;W.seen.add($);let U=$._zod.def;switch(U.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 v4(U.element,W);case"object":{for(let w in U.shape)if(v4(U.shape[w],W))return!0;return!1}case"union":{for(let w of U.options)if(v4(w,W))return!0;return!1}case"intersection":return v4(U.left,W)||v4(U.right,W);case"tuple":{for(let w of U.items)if(v4(w,W))return!0;if(U.rest&&v4(U.rest,W))return!0;return!1}case"record":return v4(U.keyType,W)||v4(U.valueType,W);case"map":return v4(U.keyType,W)||v4(U.valueType,W);case"set":return v4(U.valueType,W);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return v4(U.innerType,W);case"lazy":return v4(U.getter(),W);case"default":return v4(U.innerType,W);case"prefault":return v4(U.innerType,W);case"custom":return!1;case"transform":return!0;case"pipe":return v4(U.in,W)||v4(U.out,W);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${U.type}`)}var QK={};var iY={};e0(iY,{time:()=>BH,duration:()=>xH,datetime:()=>jH,date:()=>IH,ZodISOTime:()=>rY,ZodISODuration:()=>nY,ZodISODateTime:()=>oY,ZodISODate:()=>lY});var oY=k("ZodISODateTime",($,T)=>{V7.init($,T),W4.init($,T)});function jH($){return l3(oY,$)}var lY=k("ZodISODate",($,T)=>{K7.init($,T),W4.init($,T)});function IH($){return r3(lY,$)}var rY=k("ZodISOTime",($,T)=>{A7.init($,T),W4.init($,T)});function BH($){return n3(rY,$)}var nY=k("ZodISODuration",($,T)=>{E7.init($,T),W4.init($,T)});function xH($){return i3(nY,$)}var VK=($,T)=>{hU.init($,T),$.name="ZodError",Object.defineProperties($,{format:{value:(W)=>mU($,W)},flatten:{value:(W)=>gU($,W)},addIssue:{value:(W)=>$.issues.push(W)},addIssues:{value:(W)=>$.issues.push(...W)},isEmpty:{get(){return $.issues.length===0}}})},TC=k("ZodError",VK),aW=k("ZodError",VK,{Parent:Error});var fH=GY(aW),bH=HY(aW),yH=OY(aW),hH=QY(aW);var k$=k("ZodType",($,T)=>{return K$.init($,T),$.def=T,Object.defineProperty($,"_def",{value:T}),$.check=(...W)=>{return $.clone({...T,checks:[...T.checks??[],...W.map((X)=>typeof X==="function"?{_zod:{check:X,def:{check:"custom"},onattach:[]}}:X)]})},$.clone=(W,X)=>a6($,W,X),$.brand=()=>$,$.register=(W,X)=>{return W.add($,X),$},$.parse=(W,X)=>fH($,W,X,{callee:$.parse}),$.safeParse=(W,X)=>yH($,W,X),$.parseAsync=async(W,X)=>bH($,W,X,{callee:$.parseAsync}),$.safeParseAsync=async(W,X)=>hH($,W,X),$.spa=$.safeParseAsync,$.refine=(W,X)=>$.check($A(W,X)),$.superRefine=(W)=>$.check(TA(W)),$.overwrite=(W)=>$.check(K0(W)),$.optional=()=>sY($),$.nullable=()=>eY($),$.nullish=()=>sY(eY($)),$.nonoptional=(W)=>uK($,W),$.array=()=>YF($),$.or=(W)=>XG([$,W]),$.and=(W)=>qK($,W),$.transform=(W)=>$G($,FF(W)),$.default=(W)=>gK($,W),$.prefault=(W)=>cK($,W),$.catch=(W)=>oK($,W),$.pipe=(W)=>$G($,W),$.readonly=()=>nK($),$.describe=(W)=>{let X=$.clone();return o1.add(X,{description:W}),X},Object.defineProperty($,"description",{get(){return o1.get($)?.description},configurable:!0}),$.meta=(...W)=>{if(W.length===0)return o1.get($);let X=$.clone();return o1.add(X,W[0]),X},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$}),cH=k("_ZodString",($,T)=>{dT.init($,T),k$.init($,T);let W=$._zod.bag;$.format=W.format??null,$.minLength=W.minimum??null,$.maxLength=W.maximum??null,$.regex=(...X)=>$.check(tU(...X)),$.includes=(...X)=>$.check(eU(...X)),$.startsWith=(...X)=>$.check($X(...X)),$.endsWith=(...X)=>$.check(TX(...X)),$.min=(...X)=>$.check(YT(...X)),$.max=(...X)=>$.check(iW(...X)),$.length=(...X)=>$.check(tW(...X)),$.nonempty=(...X)=>$.check(YT(1,...X)),$.lowercase=(X)=>$.check(aU(X)),$.uppercase=(X)=>$.check(sU(X)),$.trim=()=>$.check(XX()),$.normalize=(...X)=>$.check(UX(...X)),$.toLowerCase=()=>$.check(wX()),$.toUpperCase=()=>$.check(YX())}),HX=k("ZodString",($,T)=>{dT.init($,T),cH.init($,T),$.email=(W)=>$.check(RY(uH,W)),$.url=(W)=>$.check(qY(pH,W)),$.jwt=(W)=>$.check(pY(XF,W)),$.emoji=(W)=>$.check(CY(dH,W)),$.guid=(W)=>$.check(nU(tY,W)),$.uuid=(W)=>$.check(_Y(E0,W)),$.uuidv4=(W)=>$.check(kY(E0,W)),$.uuidv6=(W)=>$.check(vY(E0,W)),$.uuidv7=(W)=>$.check(PY(E0,W)),$.nanoid=(W)=>$.check(SY(oH,W)),$.guid=(W)=>$.check(nU(tY,W)),$.cuid=(W)=>$.check(jY(lH,W)),$.cuid2=(W)=>$.check(IY(rH,W)),$.ulid=(W)=>$.check(BY(nH,W)),$.base64=(W)=>$.check(mY(TF,W)),$.base64url=(W)=>$.check(cY(WF,W)),$.xid=(W)=>$.check(xY(iH,W)),$.ksuid=(W)=>$.check(fY(tH,W)),$.ipv4=(W)=>$.check(bY(aH,W)),$.ipv6=(W)=>$.check(yY(sH,W)),$.cidrv4=(W)=>$.check(hY(eH,W)),$.cidrv6=(W)=>$.check(gY($F,W)),$.e164=(W)=>$.check(uY(UF,W)),$.datetime=(W)=>$.check(jH(W)),$.date=(W)=>$.check(IH(W)),$.time=(W)=>$.check(BH(W)),$.duration=(W)=>$.check(xH(W))});function gH($){return p3(HX,$)}var W4=k("ZodStringFormat",($,T)=>{r$.init($,T),cH.init($,T)}),uH=k("ZodEmail",($,T)=>{w7.init($,T),W4.init($,T)});function UC($){return RY(uH,$)}var tY=k("ZodGUID",($,T)=>{U7.init($,T),W4.init($,T)});function XC($){return nU(tY,$)}var E0=k("ZodUUID",($,T)=>{X7.init($,T),W4.init($,T)});function wC($){return _Y(E0,$)}function YC($){return kY(E0,$)}function GC($){return vY(E0,$)}function zC($){return PY(E0,$)}var pH=k("ZodURL",($,T)=>{Y7.init($,T),W4.init($,T)});function HC($){return qY(pH,$)}var dH=k("ZodEmoji",($,T)=>{G7.init($,T),W4.init($,T)});function FC($){return CY(dH,$)}var oH=k("ZodNanoID",($,T)=>{z7.init($,T),W4.init($,T)});function OC($){return SY(oH,$)}var lH=k("ZodCUID",($,T)=>{H7.init($,T),W4.init($,T)});function QC($){return jY(lH,$)}var rH=k("ZodCUID2",($,T)=>{F7.init($,T),W4.init($,T)});function ZC($){return IY(rH,$)}var nH=k("ZodULID",($,T)=>{O7.init($,T),W4.init($,T)});function VC($){return BY(nH,$)}var iH=k("ZodXID",($,T)=>{Q7.init($,T),W4.init($,T)});function KC($){return xY(iH,$)}var tH=k("ZodKSUID",($,T)=>{Z7.init($,T),W4.init($,T)});function AC($){return fY(tH,$)}var aH=k("ZodIPv4",($,T)=>{M7.init($,T),W4.init($,T)});function EC($){return bY(aH,$)}var sH=k("ZodIPv6",($,T)=>{D7.init($,T),W4.init($,T)});function MC($){return yY(sH,$)}var eH=k("ZodCIDRv4",($,T)=>{N7.init($,T),W4.init($,T)});function DC($){return hY(eH,$)}var $F=k("ZodCIDRv6",($,T)=>{L7.init($,T),W4.init($,T)});function NC($){return gY($F,$)}var TF=k("ZodBase64",($,T)=>{R7.init($,T),W4.init($,T)});function LC($){return mY(TF,$)}var WF=k("ZodBase64URL",($,T)=>{_7.init($,T),W4.init($,T)});function JC($){return cY(WF,$)}var UF=k("ZodE164",($,T)=>{k7.init($,T),W4.init($,T)});function RC($){return uY(UF,$)}var XF=k("ZodJWT",($,T)=>{v7.init($,T),W4.init($,T)});function _C($){return pY(XF,$)}var FX=k("ZodNumber",($,T)=>{DY.init($,T),k$.init($,T),$.gt=(X,U)=>$.check(V0(X,U)),$.gte=(X,U)=>$.check(B6(X,U)),$.min=(X,U)=>$.check(B6(X,U)),$.lt=(X,U)=>$.check(Z0(X,U)),$.lte=(X,U)=>$.check(V1(X,U)),$.max=(X,U)=>$.check(V1(X,U)),$.int=(X)=>$.check(mH(X)),$.safe=(X)=>$.check(mH(X)),$.positive=(X)=>$.check(V0(0,X)),$.nonnegative=(X)=>$.check(B6(0,X)),$.negative=(X)=>$.check(Z0(0,X)),$.nonpositive=(X)=>$.check(V1(0,X)),$.multipleOf=(X,U)=>$.check(lT(X,U)),$.step=(X,U)=>$.check(lT(X,U)),$.finite=()=>$;let W=$._zod.bag;$.minValue=Math.max(W.minimum??Number.NEGATIVE_INFINITY,W.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(W.maximum??Number.POSITIVE_INFINITY,W.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(W.format??"").includes("int")||Number.isSafeInteger(W.multipleOf??0.5),$.isFinite=!0,$.format=W.format??null});function KK($){return t3(FX,$)}var sW=k("ZodNumberFormat",($,T)=>{P7.init($,T),FX.init($,T)});function mH($){return s3(sW,$)}function kC($){return e3(sW,$)}function vC($){return $H(sW,$)}function PC($){return TH(sW,$)}function qC($){return WH(sW,$)}var OX=k("ZodBoolean",($,T)=>{cU.init($,T),k$.init($,T)});function AK($){return UH(OX,$)}var QX=k("ZodBigInt",($,T)=>{NY.init($,T),k$.init($,T),$.gte=(X,U)=>$.check(B6(X,U)),$.min=(X,U)=>$.check(B6(X,U)),$.gt=(X,U)=>$.check(V0(X,U)),$.gte=(X,U)=>$.check(B6(X,U)),$.min=(X,U)=>$.check(B6(X,U)),$.lt=(X,U)=>$.check(Z0(X,U)),$.lte=(X,U)=>$.check(V1(X,U)),$.max=(X,U)=>$.check(V1(X,U)),$.positive=(X)=>$.check(V0(BigInt(0),X)),$.negative=(X)=>$.check(Z0(BigInt(0),X)),$.nonpositive=(X)=>$.check(V1(BigInt(0),X)),$.nonnegative=(X)=>$.check(B6(BigInt(0),X)),$.multipleOf=(X,U)=>$.check(lT(X,U));let W=$._zod.bag;$.minValue=W.minimum??null,$.maxValue=W.maximum??null,$.format=W.format??null});function CC($){return wH(QX,$)}var wF=k("ZodBigIntFormat",($,T)=>{q7.init($,T),QX.init($,T)});function SC($){return GH(wF,$)}function jC($){return zH(wF,$)}var EK=k("ZodSymbol",($,T)=>{C7.init($,T),k$.init($,T)});function IC($){return HH(EK,$)}var MK=k("ZodUndefined",($,T)=>{S7.init($,T),k$.init($,T)});function BC($){return FH(MK,$)}var DK=k("ZodNull",($,T)=>{j7.init($,T),k$.init($,T)});function NK($){return OH(DK,$)}var LK=k("ZodAny",($,T)=>{I7.init($,T),k$.init($,T)});function xC(){return QH(LK)}var JK=k("ZodUnknown",($,T)=>{lW.init($,T),k$.init($,T)});function aY(){return rW(JK)}var RK=k("ZodNever",($,T)=>{B7.init($,T),k$.init($,T)});function TG($){return ZH(RK,$)}var _K=k("ZodVoid",($,T)=>{x7.init($,T),k$.init($,T)});function fC($){return VH(_K,$)}var WG=k("ZodDate",($,T)=>{f7.init($,T),k$.init($,T),$.min=(X,U)=>$.check(B6(X,U)),$.max=(X,U)=>$.check(V1(X,U));let W=$._zod.bag;$.minDate=W.minimum?new Date(W.minimum):null,$.maxDate=W.maximum?new Date(W.maximum):null});function bC($){return KH(WG,$)}var kK=k("ZodArray",($,T)=>{uU.init($,T),k$.init($,T),$.element=T.element,$.min=(W,X)=>$.check(YT(W,X)),$.nonempty=(W)=>$.check(YT(1,W)),$.max=(W,X)=>$.check(iW(W,X)),$.length=(W,X)=>$.check(tW(W,X)),$.unwrap=()=>$.element});function YF($,T){return GX(kK,$,T)}function yC($){let T=$._zod.def.shape;return fK(Object.keys(T))}var UG=k("ZodObject",($,T)=>{b7.init($,T),k$.init($,T),o.defineLazy($,"shape",()=>{return Object.fromEntries(Object.entries($._zod.def.shape))}),$.keyof=()=>BK(Object.keys($._zod.def.shape)),$.catchall=(W)=>$.clone({...$._zod.def,catchall:W}),$.passthrough=()=>$.clone({...$._zod.def,catchall:aY()}),$.loose=()=>$.clone({...$._zod.def,catchall:aY()}),$.strict=()=>$.clone({...$._zod.def,catchall:TG()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(W)=>{return o.extend($,W)},$.merge=(W)=>o.merge($,W),$.pick=(W)=>o.pick($,W),$.omit=(W)=>o.omit($,W),$.partial=(...W)=>o.partial(OF,$,W[0]),$.required=(...W)=>o.required(QF,$,W[0])});function hC($,T){let W={type:"object",get shape(){return o.assignProp(this,"shape",{...$}),this.shape},...o.normalizeParams(T)};return new UG(W)}function gC($,T){return new UG({type:"object",get shape(){return o.assignProp(this,"shape",{...$}),this.shape},catchall:TG(),...o.normalizeParams(T)})}function mC($,T){return new UG({type:"object",get shape(){return o.assignProp(this,"shape",{...$}),this.shape},catchall:aY(),...o.normalizeParams(T)})}var GF=k("ZodUnion",($,T)=>{LY.init($,T),k$.init($,T),$.options=T.options});function XG($,T){return new GF({type:"union",options:$,...o.normalizeParams(T)})}var vK=k("ZodDiscriminatedUnion",($,T)=>{GF.init($,T),y7.init($,T)});function cC($,T,W){return new vK({type:"union",options:T,discriminator:$,...o.normalizeParams(W)})}var PK=k("ZodIntersection",($,T)=>{h7.init($,T),k$.init($,T)});function qK($,T){return new PK({type:"intersection",left:$,right:T})}var CK=k("ZodTuple",($,T)=>{oT.init($,T),k$.init($,T),$.rest=(W)=>$.clone({...$._zod.def,rest:W})});function uC($,T,W){let X=T instanceof K$,U=X?W:T;return new CK({type:"tuple",items:$,rest:X?T:null,...o.normalizeParams(U)})}var zF=k("ZodRecord",($,T)=>{g7.init($,T),k$.init($,T),$.keyType=T.keyType,$.valueType=T.valueType});function SK($,T,W){return new zF({type:"record",keyType:$,valueType:T,...o.normalizeParams(W)})}function pC($,T,W){return new zF({type:"record",keyType:XG([$,TG()]),valueType:T,...o.normalizeParams(W)})}var jK=k("ZodMap",($,T)=>{m7.init($,T),k$.init($,T),$.keyType=T.keyType,$.valueType=T.valueType});function dC($,T,W){return new jK({type:"map",keyType:$,valueType:T,...o.normalizeParams(W)})}var IK=k("ZodSet",($,T)=>{c7.init($,T),k$.init($,T),$.min=(...W)=>$.check(rT(...W)),$.nonempty=(W)=>$.check(rT(1,W)),$.max=(...W)=>$.check(nW(...W)),$.size=(...W)=>$.check(iU(...W))});function oC($,T){return new IK({type:"set",valueType:$,...o.normalizeParams(T)})}var zX=k("ZodEnum",($,T)=>{u7.init($,T),k$.init($,T),$.enum=T.entries,$.options=Object.values(T.entries);let W=new Set(Object.keys(T.entries));$.extract=(X,U)=>{let w={};for(let Y of X)if(W.has(Y))w[Y]=T.entries[Y];else throw new Error(`Key ${Y} not found in enum`);return new zX({...T,checks:[],...o.normalizeParams(U),entries:w})},$.exclude=(X,U)=>{let w={...T.entries};for(let Y of X)if(W.has(Y))delete w[Y];else throw new Error(`Key ${Y} not found in enum`);return new zX({...T,checks:[],...o.normalizeParams(U),entries:w})}});function BK($,T){let W=Array.isArray($)?Object.fromEntries($.map((X)=>[X,X])):$;return new zX({type:"enum",entries:W,...o.normalizeParams(T)})}function lC($,T){return new zX({type:"enum",entries:$,...o.normalizeParams(T)})}var xK=k("ZodLiteral",($,T)=>{p7.init($,T),k$.init($,T),$.values=new Set(T.values),Object.defineProperty($,"value",{get(){if(T.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return T.values[0]}})});function fK($,T){return new xK({type:"literal",values:Array.isArray($)?$:[$],...o.normalizeParams(T)})}var bK=k("ZodFile",($,T)=>{d7.init($,T),k$.init($,T),$.min=(W,X)=>$.check(rT(W,X)),$.max=(W,X)=>$.check(nW(W,X)),$.mime=(W,X)=>$.check(WX(Array.isArray(W)?W:[W],X))});function rC($){return _H(bK,$)}var HF=k("ZodTransform",($,T)=>{pU.init($,T),k$.init($,T),$._zod.parse=(W,X)=>{W.addIssue=(w)=>{if(typeof w==="string")W.issues.push(o.issue(w,W.value,T));else{let Y=w;if(Y.fatal)Y.continue=!1;Y.code??(Y.code="custom"),Y.input??(Y.input=W.value),Y.inst??(Y.inst=$),Y.continue??(Y.continue=!0),W.issues.push(o.issue(Y))}};let U=T.transform(W.value,W);if(U instanceof Promise)return U.then((w)=>{return W.value=w,W});return W.value=U,W}});function FF($){return new HF({type:"transform",transform:$})}var OF=k("ZodOptional",($,T)=>{o7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function sY($){return new OF({type:"optional",innerType:$})}var yK=k("ZodNullable",($,T)=>{l7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function eY($){return new yK({type:"nullable",innerType:$})}function nC($){return sY(eY($))}var hK=k("ZodDefault",($,T)=>{r7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function gK($,T){return new hK({type:"default",innerType:$,get defaultValue(){return typeof T==="function"?T():T}})}var mK=k("ZodPrefault",($,T)=>{n7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function cK($,T){return new mK({type:"prefault",innerType:$,get defaultValue(){return typeof T==="function"?T():T}})}var QF=k("ZodNonOptional",($,T)=>{i7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function uK($,T){return new QF({type:"nonoptional",innerType:$,...o.normalizeParams(T)})}var pK=k("ZodSuccess",($,T)=>{t7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function iC($){return new pK({type:"success",innerType:$})}var dK=k("ZodCatch",($,T)=>{a7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function oK($,T){return new dK({type:"catch",innerType:$,catchValue:typeof T==="function"?T:()=>T})}var lK=k("ZodNaN",($,T)=>{s7.init($,T),k$.init($,T)});function tC($){return EH(lK,$)}var ZF=k("ZodPipe",($,T)=>{dU.init($,T),k$.init($,T),$.in=T.in,$.out=T.out});function $G($,T){return new ZF({type:"pipe",in:$,out:T})}var rK=k("ZodReadonly",($,T)=>{e7.init($,T),k$.init($,T)});function nK($){return new rK({type:"readonly",innerType:$})}var iK=k("ZodTemplateLiteral",($,T)=>{$3.init($,T),k$.init($,T)});function aC($,T){return new iK({type:"template_literal",parts:$,...o.normalizeParams(T)})}var tK=k("ZodLazy",($,T)=>{W3.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.getter()});function aK($){return new tK({type:"lazy",getter:$})}var sK=k("ZodPromise",($,T)=>{T3.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function sC($){return new sK({type:"promise",innerType:$})}var wG=k("ZodCustom",($,T)=>{U3.init($,T),k$.init($,T)});function eK($,T){let W=new z4({check:"custom",...o.normalizeParams(T)});return W._zod.check=$,W}function eC($,T){return kH(wG,$??(()=>!0),T)}function $A($,T={}){return vH(wG,$,T)}function TA($,T){let W=eK((X)=>{return X.addIssue=(U)=>{if(typeof U==="string")X.issues.push(o.issue(U,X.value,W._zod.def));else{let w=U;if(w.fatal)w.continue=!1;w.code??(w.code="custom"),w.input??(w.input=X.value),w.inst??(w.inst=W),w.continue??(w.continue=!W._zod.def.abort),X.issues.push(o.issue(w))}},$(X.value,X)},T);return W}function $S($,T={error:`Input not instance of ${$.name}`}){let W=new wG({type:"custom",check:"custom",fn:(X)=>X instanceof $,abort:!0,...o.normalizeParams(T)});return W._zod.bag.Class=$,W}var TS=(...$)=>PH({Pipe:ZF,Boolean:OX,String:HX,Transform:HF},...$);function WS($){let T=aK(()=>{return XG([gH($),KK(),AK(),NK(),YF(T),SK(gH(),T)])});return T}function US($,T){return $G(FF($),T)}var XS={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"},wS=Object.freeze({status:"aborted"}),YS=wS;function GS($){N4({customError:$})}function zS(){return N4().customError}var VF={};e0(VF,{string:()=>HS,number:()=>FS,date:()=>ZS,boolean:()=>OS,bigint:()=>QS});function HS($){return d3(HX,$)}function FS($){return a3(FX,$)}function OS($){return XH(OX,$)}function QS($){return YH(QX,$)}function ZS($){return AH(WG,$)}N4(oU());function WA($,T){return function W({schema:X,fallback:U,toJsonSchema:w=YG.toJSONSchema}){let Y=w(X);return async function G(H,z=3){let F,O=[];while(O.length<z){F=await $(H,Y,U,O);let Q=await X["~standard"].validate(F);if("value"in Q)return Q.value;T?.warn(`safegen failed to generate well-formed data.
|
|
33
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);else if(W.cycles==="ref")w(z);continue}if(F.count>1){if(W.reused==="ref"){w(z);continue}}}let Y=(z,F)=>{let O=this.seen.get(z),Q=O.def??O.schema,Z={...Q};if(O.ref===null)return;let V=O.ref;if(O.ref=null,V){Y(V,F);let A=this.seen.get(V).schema;if(A.$ref&&F.target==="draft-7")Q.allOf=Q.allOf??[],Q.allOf.push(A);else Object.assign(Q,A),Object.assign(Q,Z)}if(!O.isParent)this.override({zodSchema:z,jsonSchema:Q})};for(let z of[...this.seen.entries()].reverse())Y(z[0],{target:this.target});let G={};if(this.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")G.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);Object.assign(G,U.def);let H=W.external?.defs??{};for(let z of this.seen.entries()){let F=z[1];if(F.def&&F.defId)H[F.defId]=F.def}if(!W.external&&Object.keys(H).length>0)if(this.target==="draft-2020-12")G.$defs=H;else G.definitions=H;try{return JSON.parse(JSON.stringify(G))}catch(z){throw new Error("Error converting schema to JSON.")}}}function BH($,T){if($ instanceof rX){let U=new uY(T),X={};for(let G of $._idmap.entries()){let[H,z]=G;U.process(z)}let w={},Y={registry:$,uri:T?.uri||((G)=>G),defs:X};for(let G of $._idmap.entries()){let[H,z]=G;w[H]=U.emit(z,{...T,external:Y})}if(Object.keys(X).length>0){let G=U.target==="draft-2020-12"?"$defs":"definitions";w.__shared={[G]:X}}return{schemas:w}}let W=new uY(T);return W.process($),W.emit($,T)}function v4($,T){let W=T??{seen:new Set};if(W.seen.has($))return!1;W.seen.add($);let X=$._zod.def;switch(X.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 v4(X.element,W);case"object":{for(let w in X.shape)if(v4(X.shape[w],W))return!0;return!1}case"union":{for(let w of X.options)if(v4(w,W))return!0;return!1}case"intersection":return v4(X.left,W)||v4(X.right,W);case"tuple":{for(let w of X.items)if(v4(w,W))return!0;if(X.rest&&v4(X.rest,W))return!0;return!1}case"record":return v4(X.keyType,W)||v4(X.valueType,W);case"map":return v4(X.keyType,W)||v4(X.valueType,W);case"set":return v4(X.valueType,W);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return v4(X.innerType,W);case"lazy":return v4(X.getter(),W);case"default":return v4(X.innerType,W);case"prefault":return v4(X.innerType,W);case"custom":return!1;case"transform":return!0;case"pipe":return v4(X.in,W)||v4(X.out,W);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${X.type}`)}var EK={};var rY={};e0(rY,{time:()=>fH,duration:()=>bH,datetime:()=>IH,date:()=>xH,ZodISOTime:()=>oY,ZodISODuration:()=>lY,ZodISODateTime:()=>pY,ZodISODate:()=>dY});var pY=k("ZodISODateTime",($,T)=>{A7.init($,T),W4.init($,T)});function IH($){return n3(pY,$)}var dY=k("ZodISODate",($,T)=>{E7.init($,T),W4.init($,T)});function xH($){return i3(dY,$)}var oY=k("ZodISOTime",($,T)=>{M7.init($,T),W4.init($,T)});function fH($){return t3(oY,$)}var lY=k("ZodISODuration",($,T)=>{D7.init($,T),W4.init($,T)});function bH($){return a3(lY,$)}var DK=($,T)=>{hX.init($,T),$.name="ZodError",Object.defineProperties($,{format:{value:(W)=>mX($,W)},flatten:{value:(W)=>gX($,W)},addIssue:{value:(W)=>$.issues.push(W)},addIssues:{value:(W)=>$.issues.push(...W)},isEmpty:{get(){return $.issues.length===0}}})},OC=k("ZodError",DK),aW=k("ZodError",DK,{Parent:Error});var yH=wY(aW),hH=GY(aW),gH=HY(aW),mH=FY(aW);var k$=k("ZodType",($,T)=>{return K$.init($,T),$.def=T,Object.defineProperty($,"_def",{value:T}),$.check=(...W)=>{return $.clone({...T,checks:[...T.checks??[],...W.map((U)=>typeof U==="function"?{_zod:{check:U,def:{check:"custom"},onattach:[]}}:U)]})},$.clone=(W,U)=>s6($,W,U),$.brand=()=>$,$.register=(W,U)=>{return W.add($,U),$},$.parse=(W,U)=>yH($,W,U,{callee:$.parse}),$.safeParse=(W,U)=>gH($,W,U),$.parseAsync=async(W,U)=>hH($,W,U,{callee:$.parseAsync}),$.safeParseAsync=async(W,U)=>mH($,W,U),$.spa=$.safeParseAsync,$.refine=(W,U)=>$.check(wA(W,U)),$.superRefine=(W)=>$.check(YA(W)),$.overwrite=(W)=>$.check(K0(W)),$.optional=()=>tY($),$.nullable=()=>aY($),$.nullish=()=>tY(aY($)),$.nonoptional=(W)=>rK($,W),$.array=()=>zF($),$.or=(W)=>WG([$,W]),$.and=(W)=>IK($,W),$.transform=(W)=>sY($,QF(W)),$.default=(W)=>dK($,W),$.prefault=(W)=>lK($,W),$.catch=(W)=>tK($,W),$.pipe=(W)=>sY($,W),$.readonly=()=>eK($),$.describe=(W)=>{let U=$.clone();return l1.add(U,{description:W}),U},Object.defineProperty($,"description",{get(){return l1.get($)?.description},configurable:!0}),$.meta=(...W)=>{if(W.length===0)return l1.get($);let U=$.clone();return l1.add(U,W[0]),U},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$}),pH=k("_ZodString",($,T)=>{dT.init($,T),k$.init($,T);let W=$._zod.bag;$.format=W.format??null,$.minLength=W.minimum??null,$.maxLength=W.maximum??null,$.regex=(...U)=>$.check(tX(...U)),$.includes=(...U)=>$.check(eX(...U)),$.startsWith=(...U)=>$.check($8(...U)),$.endsWith=(...U)=>$.check(T8(...U)),$.min=(...U)=>$.check(YT(...U)),$.max=(...U)=>$.check(iW(...U)),$.length=(...U)=>$.check(tW(...U)),$.nonempty=(...U)=>$.check(YT(1,...U)),$.lowercase=(U)=>$.check(aX(U)),$.uppercase=(U)=>$.check(sX(U)),$.trim=()=>$.check(U8()),$.normalize=(...U)=>$.check(X8(...U)),$.toLowerCase=()=>$.check(w8()),$.toUpperCase=()=>$.check(Y8())}),H8=k("ZodString",($,T)=>{dT.init($,T),pH.init($,T),$.email=(W)=>$.check(JY(dH,W)),$.url=(W)=>$.check(vY(oH,W)),$.jwt=(W)=>$.check(cY(YF,W)),$.emoji=(W)=>$.check(PY(lH,W)),$.guid=(W)=>$.check(nX(nY,W)),$.uuid=(W)=>$.check(LY(E0,W)),$.uuidv4=(W)=>$.check(RY(E0,W)),$.uuidv6=(W)=>$.check(_Y(E0,W)),$.uuidv7=(W)=>$.check(kY(E0,W)),$.nanoid=(W)=>$.check(qY(rH,W)),$.guid=(W)=>$.check(nX(nY,W)),$.cuid=(W)=>$.check(CY(nH,W)),$.cuid2=(W)=>$.check(SY(iH,W)),$.ulid=(W)=>$.check(jY(tH,W)),$.base64=(W)=>$.check(hY(XF,W)),$.base64url=(W)=>$.check(gY(UF,W)),$.xid=(W)=>$.check(BY(aH,W)),$.ksuid=(W)=>$.check(IY(sH,W)),$.ipv4=(W)=>$.check(xY(eH,W)),$.ipv6=(W)=>$.check(fY($F,W)),$.cidrv4=(W)=>$.check(bY(TF,W)),$.cidrv6=(W)=>$.check(yY(WF,W)),$.e164=(W)=>$.check(mY(wF,W)),$.datetime=(W)=>$.check(IH(W)),$.date=(W)=>$.check(xH(W)),$.time=(W)=>$.check(fH(W)),$.duration=(W)=>$.check(bH(W))});function cH($){return o3(H8,$)}var W4=k("ZodStringFormat",($,T)=>{r$.init($,T),pH.init($,T)}),dH=k("ZodEmail",($,T)=>{G7.init($,T),W4.init($,T)});function ZC($){return JY(dH,$)}var nY=k("ZodGUID",($,T)=>{w7.init($,T),W4.init($,T)});function VC($){return nX(nY,$)}var E0=k("ZodUUID",($,T)=>{Y7.init($,T),W4.init($,T)});function KC($){return LY(E0,$)}function AC($){return RY(E0,$)}function EC($){return _Y(E0,$)}function MC($){return kY(E0,$)}var oH=k("ZodURL",($,T)=>{z7.init($,T),W4.init($,T)});function DC($){return vY(oH,$)}var lH=k("ZodEmoji",($,T)=>{H7.init($,T),W4.init($,T)});function NC($){return PY(lH,$)}var rH=k("ZodNanoID",($,T)=>{F7.init($,T),W4.init($,T)});function JC($){return qY(rH,$)}var nH=k("ZodCUID",($,T)=>{O7.init($,T),W4.init($,T)});function LC($){return CY(nH,$)}var iH=k("ZodCUID2",($,T)=>{Q7.init($,T),W4.init($,T)});function RC($){return SY(iH,$)}var tH=k("ZodULID",($,T)=>{Z7.init($,T),W4.init($,T)});function _C($){return jY(tH,$)}var aH=k("ZodXID",($,T)=>{V7.init($,T),W4.init($,T)});function kC($){return BY(aH,$)}var sH=k("ZodKSUID",($,T)=>{K7.init($,T),W4.init($,T)});function vC($){return IY(sH,$)}var eH=k("ZodIPv4",($,T)=>{N7.init($,T),W4.init($,T)});function PC($){return xY(eH,$)}var $F=k("ZodIPv6",($,T)=>{J7.init($,T),W4.init($,T)});function qC($){return fY($F,$)}var TF=k("ZodCIDRv4",($,T)=>{L7.init($,T),W4.init($,T)});function CC($){return bY(TF,$)}var WF=k("ZodCIDRv6",($,T)=>{R7.init($,T),W4.init($,T)});function SC($){return yY(WF,$)}var XF=k("ZodBase64",($,T)=>{k7.init($,T),W4.init($,T)});function jC($){return hY(XF,$)}var UF=k("ZodBase64URL",($,T)=>{v7.init($,T),W4.init($,T)});function BC($){return gY(UF,$)}var wF=k("ZodE164",($,T)=>{P7.init($,T),W4.init($,T)});function IC($){return mY(wF,$)}var YF=k("ZodJWT",($,T)=>{q7.init($,T),W4.init($,T)});function xC($){return cY(YF,$)}var F8=k("ZodNumber",($,T)=>{EY.init($,T),k$.init($,T),$.gt=(U,X)=>$.check(V0(U,X)),$.gte=(U,X)=>$.check(x6(U,X)),$.min=(U,X)=>$.check(x6(U,X)),$.lt=(U,X)=>$.check(Z0(U,X)),$.lte=(U,X)=>$.check(K1(U,X)),$.max=(U,X)=>$.check(K1(U,X)),$.int=(U)=>$.check(uH(U)),$.safe=(U)=>$.check(uH(U)),$.positive=(U)=>$.check(V0(0,U)),$.nonnegative=(U)=>$.check(x6(0,U)),$.negative=(U)=>$.check(Z0(0,U)),$.nonpositive=(U)=>$.check(K1(0,U)),$.multipleOf=(U,X)=>$.check(lT(U,X)),$.step=(U,X)=>$.check(lT(U,X)),$.finite=()=>$;let W=$._zod.bag;$.minValue=Math.max(W.minimum??Number.NEGATIVE_INFINITY,W.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(W.maximum??Number.POSITIVE_INFINITY,W.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(W.format??"").includes("int")||Number.isSafeInteger(W.multipleOf??0.5),$.isFinite=!0,$.format=W.format??null});function NK($){return s3(F8,$)}var sW=k("ZodNumberFormat",($,T)=>{C7.init($,T),F8.init($,T)});function uH($){return $H(sW,$)}function fC($){return TH(sW,$)}function bC($){return WH(sW,$)}function yC($){return XH(sW,$)}function hC($){return UH(sW,$)}var O8=k("ZodBoolean",($,T)=>{cX.init($,T),k$.init($,T)});function JK($){return wH(O8,$)}var Q8=k("ZodBigInt",($,T)=>{MY.init($,T),k$.init($,T),$.gte=(U,X)=>$.check(x6(U,X)),$.min=(U,X)=>$.check(x6(U,X)),$.gt=(U,X)=>$.check(V0(U,X)),$.gte=(U,X)=>$.check(x6(U,X)),$.min=(U,X)=>$.check(x6(U,X)),$.lt=(U,X)=>$.check(Z0(U,X)),$.lte=(U,X)=>$.check(K1(U,X)),$.max=(U,X)=>$.check(K1(U,X)),$.positive=(U)=>$.check(V0(BigInt(0),U)),$.negative=(U)=>$.check(Z0(BigInt(0),U)),$.nonpositive=(U)=>$.check(K1(BigInt(0),U)),$.nonnegative=(U)=>$.check(x6(BigInt(0),U)),$.multipleOf=(U,X)=>$.check(lT(U,X));let W=$._zod.bag;$.minValue=W.minimum??null,$.maxValue=W.maximum??null,$.format=W.format??null});function gC($){return GH(Q8,$)}var GF=k("ZodBigIntFormat",($,T)=>{S7.init($,T),Q8.init($,T)});function mC($){return HH(GF,$)}function cC($){return FH(GF,$)}var LK=k("ZodSymbol",($,T)=>{j7.init($,T),k$.init($,T)});function uC($){return OH(LK,$)}var RK=k("ZodUndefined",($,T)=>{B7.init($,T),k$.init($,T)});function pC($){return QH(RK,$)}var _K=k("ZodNull",($,T)=>{I7.init($,T),k$.init($,T)});function kK($){return ZH(_K,$)}var vK=k("ZodAny",($,T)=>{x7.init($,T),k$.init($,T)});function dC(){return VH(vK)}var PK=k("ZodUnknown",($,T)=>{lW.init($,T),k$.init($,T)});function iY(){return rW(PK)}var qK=k("ZodNever",($,T)=>{f7.init($,T),k$.init($,T)});function eY($){return KH(qK,$)}var CK=k("ZodVoid",($,T)=>{b7.init($,T),k$.init($,T)});function oC($){return AH(CK,$)}var $G=k("ZodDate",($,T)=>{y7.init($,T),k$.init($,T),$.min=(U,X)=>$.check(x6(U,X)),$.max=(U,X)=>$.check(K1(U,X));let W=$._zod.bag;$.minDate=W.minimum?new Date(W.minimum):null,$.maxDate=W.maximum?new Date(W.maximum):null});function lC($){return EH($G,$)}var SK=k("ZodArray",($,T)=>{uX.init($,T),k$.init($,T),$.element=T.element,$.min=(W,U)=>$.check(YT(W,U)),$.nonempty=(W)=>$.check(YT(1,W)),$.max=(W,U)=>$.check(iW(W,U)),$.length=(W,U)=>$.check(tW(W,U)),$.unwrap=()=>$.element});function zF($,T){return G8(SK,$,T)}function rC($){let T=$._zod.def.shape;return mK(Object.keys(T))}var TG=k("ZodObject",($,T)=>{h7.init($,T),k$.init($,T),o.defineLazy($,"shape",()=>T.shape),$.keyof=()=>hK(Object.keys($._zod.def.shape)),$.catchall=(W)=>$.clone({...$._zod.def,catchall:W}),$.passthrough=()=>$.clone({...$._zod.def,catchall:iY()}),$.loose=()=>$.clone({...$._zod.def,catchall:iY()}),$.strict=()=>$.clone({...$._zod.def,catchall:eY()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(W)=>{return o.extend($,W)},$.merge=(W)=>o.merge($,W),$.pick=(W)=>o.pick($,W),$.omit=(W)=>o.omit($,W),$.partial=(...W)=>o.partial(ZF,$,W[0]),$.required=(...W)=>o.required(VF,$,W[0])});function nC($,T){let W={type:"object",get shape(){return o.assignProp(this,"shape",{...$}),this.shape},...o.normalizeParams(T)};return new TG(W)}function iC($,T){return new TG({type:"object",get shape(){return o.assignProp(this,"shape",{...$}),this.shape},catchall:eY(),...o.normalizeParams(T)})}function tC($,T){return new TG({type:"object",get shape(){return o.assignProp(this,"shape",{...$}),this.shape},catchall:iY(),...o.normalizeParams(T)})}var HF=k("ZodUnion",($,T)=>{DY.init($,T),k$.init($,T),$.options=T.options});function WG($,T){return new HF({type:"union",options:$,...o.normalizeParams(T)})}var jK=k("ZodDiscriminatedUnion",($,T)=>{HF.init($,T),g7.init($,T)});function aC($,T,W){return new jK({type:"union",options:T,discriminator:$,...o.normalizeParams(W)})}var BK=k("ZodIntersection",($,T)=>{m7.init($,T),k$.init($,T)});function IK($,T){return new BK({type:"intersection",left:$,right:T})}var xK=k("ZodTuple",($,T)=>{oT.init($,T),k$.init($,T),$.rest=(W)=>$.clone({...$._zod.def,rest:W})});function sC($,T,W){let U=T instanceof K$,X=U?W:T;return new xK({type:"tuple",items:$,rest:U?T:null,...o.normalizeParams(X)})}var FF=k("ZodRecord",($,T)=>{c7.init($,T),k$.init($,T),$.keyType=T.keyType,$.valueType=T.valueType});function fK($,T,W){return new FF({type:"record",keyType:$,valueType:T,...o.normalizeParams(W)})}function eC($,T,W){return new FF({type:"record",keyType:WG([$,eY()]),valueType:T,...o.normalizeParams(W)})}var bK=k("ZodMap",($,T)=>{u7.init($,T),k$.init($,T),$.keyType=T.keyType,$.valueType=T.valueType});function $S($,T,W){return new bK({type:"map",keyType:$,valueType:T,...o.normalizeParams(W)})}var yK=k("ZodSet",($,T)=>{p7.init($,T),k$.init($,T),$.min=(...W)=>$.check(rT(...W)),$.nonempty=(W)=>$.check(rT(1,W)),$.max=(...W)=>$.check(nW(...W)),$.size=(...W)=>$.check(iX(...W))});function TS($,T){return new yK({type:"set",valueType:$,...o.normalizeParams(T)})}var z8=k("ZodEnum",($,T)=>{d7.init($,T),k$.init($,T),$.enum=T.entries,$.options=Object.values(T.entries);let W=new Set(Object.keys(T.entries));$.extract=(U,X)=>{let w={};for(let Y of U)if(W.has(Y))w[Y]=T.entries[Y];else throw new Error(`Key ${Y} not found in enum`);return new z8({...T,checks:[],...o.normalizeParams(X),entries:w})},$.exclude=(U,X)=>{let w={...T.entries};for(let Y of U)if(W.has(Y))delete w[Y];else throw new Error(`Key ${Y} not found in enum`);return new z8({...T,checks:[],...o.normalizeParams(X),entries:w})}});function hK($,T){let W=Array.isArray($)?Object.fromEntries($.map((U)=>[U,U])):$;return new z8({type:"enum",entries:W,...o.normalizeParams(T)})}function WS($,T){return new z8({type:"enum",entries:$,...o.normalizeParams(T)})}var gK=k("ZodLiteral",($,T)=>{o7.init($,T),k$.init($,T),$.values=new Set(T.values),Object.defineProperty($,"value",{get(){if(T.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return T.values[0]}})});function mK($,T){return new gK({type:"literal",values:Array.isArray($)?$:[$],...o.normalizeParams(T)})}var cK=k("ZodFile",($,T)=>{l7.init($,T),k$.init($,T),$.min=(W,U)=>$.check(rT(W,U)),$.max=(W,U)=>$.check(nW(W,U)),$.mime=(W,U)=>$.check(W8(Array.isArray(W)?W:[W],U))});function XS($){return vH(cK,$)}var OF=k("ZodTransform",($,T)=>{pX.init($,T),k$.init($,T),$._zod.parse=(W,U)=>{W.addIssue=(w)=>{if(typeof w==="string")W.issues.push(o.issue(w,W.value,T));else{let Y=w;if(Y.fatal)Y.continue=!1;Y.code??(Y.code="custom"),Y.input??(Y.input=W.value),Y.inst??(Y.inst=$),Y.continue??(Y.continue=!0),W.issues.push(o.issue(Y))}};let X=T.transform(W.value,W);if(X instanceof Promise)return X.then((w)=>{return W.value=w,W});return W.value=X,W}});function QF($){return new OF({type:"transform",transform:$})}var ZF=k("ZodOptional",($,T)=>{r7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function tY($){return new ZF({type:"optional",innerType:$})}var uK=k("ZodNullable",($,T)=>{n7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function aY($){return new uK({type:"nullable",innerType:$})}function US($){return tY(aY($))}var pK=k("ZodDefault",($,T)=>{i7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function dK($,T){return new pK({type:"default",innerType:$,get defaultValue(){return typeof T==="function"?T():T}})}var oK=k("ZodPrefault",($,T)=>{t7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function lK($,T){return new oK({type:"prefault",innerType:$,get defaultValue(){return typeof T==="function"?T():T}})}var VF=k("ZodNonOptional",($,T)=>{a7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function rK($,T){return new VF({type:"nonoptional",innerType:$,...o.normalizeParams(T)})}var nK=k("ZodSuccess",($,T)=>{s7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function wS($){return new nK({type:"success",innerType:$})}var iK=k("ZodCatch",($,T)=>{e7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function tK($,T){return new iK({type:"catch",innerType:$,catchValue:typeof T==="function"?T:()=>T})}var aK=k("ZodNaN",($,T)=>{$3.init($,T),k$.init($,T)});function YS($){return DH(aK,$)}var KF=k("ZodPipe",($,T)=>{dX.init($,T),k$.init($,T),$.in=T.in,$.out=T.out});function sY($,T){return new KF({type:"pipe",in:$,out:T})}var sK=k("ZodReadonly",($,T)=>{T3.init($,T),k$.init($,T)});function eK($){return new sK({type:"readonly",innerType:$})}var $A=k("ZodTemplateLiteral",($,T)=>{W3.init($,T),k$.init($,T)});function GS($,T){return new $A({type:"template_literal",parts:$,...o.normalizeParams(T)})}var TA=k("ZodLazy",($,T)=>{U3.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.getter()});function WA($){return new TA({type:"lazy",getter:$})}var XA=k("ZodPromise",($,T)=>{X3.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function zS($){return new XA({type:"promise",innerType:$})}var XG=k("ZodCustom",($,T)=>{w3.init($,T),k$.init($,T)});function UA($,T){let W=new z4({check:"custom",...o.normalizeParams(T)});return W._zod.check=$,W}function HS($,T){return PH(XG,$??(()=>!0),T)}function wA($,T={}){return qH(XG,$,T)}function YA($,T){let W=UA((U)=>{return U.addIssue=(X)=>{if(typeof X==="string")U.issues.push(o.issue(X,U.value,W._zod.def));else{let w=X;if(w.fatal)w.continue=!1;w.code??(w.code="custom"),w.input??(w.input=U.value),w.inst??(w.inst=W),w.continue??(w.continue=!W._zod.def.abort),U.issues.push(o.issue(w))}},$(U.value,U)},T);return W}function FS($,T={error:`Input not instance of ${$.name}`}){let W=new XG({type:"custom",check:"custom",fn:(U)=>U instanceof $,abort:!0,...o.normalizeParams(T)});return W._zod.bag.Class=$,W}var OS=(...$)=>CH({Pipe:KF,Boolean:O8,String:H8,Transform:OF},...$);function QS($){let T=WA(()=>{return WG([cH($),NK(),JK(),kK(),zF(T),fK(cH(),T)])});return T}function ZS($,T){return sY(QF($),T)}var VS={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"},KS=Object.freeze({status:"aborted"}),AS=KS;function ES($){N4({customError:$})}function MS(){return N4().customError}var AF={};e0(AF,{string:()=>DS,number:()=>NS,date:()=>RS,boolean:()=>JS,bigint:()=>LS});function DS($){return l3(H8,$)}function NS($){return e3(F8,$)}function JS($){return YH(O8,$)}function LS($){return zH(Q8,$)}function RS($){return MH($G,$)}N4(oX());function GA($,T){return function W({schema:U,fallback:X,toJsonSchema:w=UG.toJSONSchema}){let Y=w(U);return async function G(H,z=3){let F,O=[];while(O.length<z){F=await $(H,Y,X,O);let Q=await U["~standard"].validate(F);if("value"in Q)return Q.value;T?.warn(`safegen failed to generate well-formed data.
|
|
34
34
|
`,`Here's what was returned last time:
|
|
35
35
|
`,JSON.stringify(F,null,"\t"),`
|
|
36
36
|
`,`Here are the issues returned from our validation:
|
|
37
|
-
`,JSON.stringify(Q.issues,null,"\t")),O.push({response:F,error:Q})}return T?.error(`safegen was unable to generate well-formed data after ${z} failed attempts.`),
|
|
38
|
-
`)}
|
|
37
|
+
`,JSON.stringify(Q.issues,null,"\t")),O.push({response:F,error:Q})}return T?.error(`safegen was unable to generate well-formed data after ${z} failed attempts.`),X}}}function zA($){return["Please generate a response in JSON that conforms to the following JSON Schema:",JSON.stringify($,null,2)].join(`
|
|
38
|
+
`)}function wG($,T,W,U){let X=["SafeGen saw that invalid data was produced for the prompt:",` ${$}`,"The actual data is:",` ${JSON.stringify(T,null,2)}`,"The issue that makes it invalid is:",` ${W}`];if(U)X.push("The consequence of this issue is:",` ${U}`);return X.join(`
|
|
39
|
+
`)}async function HA($,T){let W=`${$} [respond either 'y' or 'n' only]/n/nAnswer: `,U=`boolean-${$}`,X=await T(W,U),w=X.toLowerCase();if(w==="y")return!0;if(w==="n")return!1;return new Error(wG($,X,"Expected 'y' or 'n'","Cannot be parsed as a boolean."))}async function FA($,T,W,U){if(T>W)return new Error(`For prompt "${$}", a minimum number ${T} was specified, but a maximum number ${W} was specified. This is unachievable.`);let X=`Q: ${$} [answer with only a number from ${T} to ${W}]
|
|
40
|
+
A: `,w=`number-${$}-${T}-${W}`,Y=await U(X,w),G=Number.parseInt(Y,10);if(Number.isNaN(G))return new Error(wG($,Y,"Expected a number."));return G}async function OA($,T,W,U,X,w){let Y=W===1&&U===1;if(T.length===0){if(Y)return new Error(`For prompt "${$}", exactly one option was required to be chosen, but no options were provided.`)}if(T.length===1)return w.warn(`For prompt: ${$}, options has only one option: "${T[0]}". Returning it.`),[T[0]];if(W>U)return new Error(`For prompt "${$}", a minimum of ${W} options must be chosen, but a maximum of ${U} options was specified. This is unachievable.`);if(U===0)return w.warn(`For prompt "${$}", a maximum of 0 options was specified; returning an empty array.`),[];let H=T.map((V)=>`- ${String(V)}`).join(`
|
|
41
|
+
`),z;if(W===0&&U===1)H+=`
|
|
42
|
+
\respond with the best option given.`,H+=`
|
|
43
|
+
|
|
44
|
+
if none of the options are good, respond with just the phase "$NONE".`,z=12;else if(W===1&&U===1)H+=`
|
|
45
|
+
|
|
46
|
+
respond with only the best option given`,H+=`
|
|
47
|
+
|
|
48
|
+
if none of the options are good, just say the one that fits best`,z=12;else{if(H+=`
|
|
49
|
+
|
|
50
|
+
`,W===0)H+='if none of the options apply, respond "$NONE". otherwise, ';if(H+="format your response as a numbered list, like this:",H+=`
|
|
51
|
+
`,H+=Array.from({length:U},(V,A)=>`${A+1}. choice ${A+1}`).join(`
|
|
52
|
+
`),W===U)H+=`
|
|
53
|
+
|
|
54
|
+
choose exactly ${W} options`;else H+=`
|
|
55
|
+
|
|
56
|
+
choose as few as ${W} options, or as many as ${U} options`;z=12*U}H+=`
|
|
57
|
+
|
|
58
|
+
RESPONSE:
|
|
59
|
+
`;let F=await X(`${$}
|
|
60
|
+
|
|
61
|
+
${H}`,`choose-${$}-FROM-${T.join("-")}`,z);if(Y){if(T.includes(F))return F;let V=F.toLowerCase();if(T.includes(V))return V;let A=Number(F);if(T.includes(A))return A;return new Error(wG($,F,`"${F}" is not found among [${T.join(", ")}]`))}if(F.toLowerCase()==="$none")return[];let Q=F.split(`
|
|
62
|
+
`).filter((V)=>V.match(/^\d+\. /)),Z=[];for(let V of Q){let A=V.trim().split(". ")[1];if(T.includes(A))Z.push(A);else if(T.includes(A.toLowerCase()))Z.push(A.toLowerCase());else if(T.includes(Number(A)))Z.push(Number(A));else if(A==="$none");else wG($,A,`"${A}" is not found among [${T.join(", ")}]`,"This element will not be included in the final result.")}if(Z.length<W)return new Error(`For prompt "${$}", at least ${W} options must be chosen, but ${Z.length} options were chosen.`);if(Z.length>U)return w.warn(`For prompt "${$}", at most ${U} options must be chosen, but ${Z.length} options were chosen.`),Z.slice(0,U);return Z}var NA=RP(VA(),1);import*as f6 from"fs";import*as eW from"path";import{resolve as CS}from"path";import{createHash as SS}from"crypto";import{copyFile as jS}from"fs/promises";import{existsSync as EF,mkdirSync as KA,readFileSync as PS,readdirSync as AA,rmSync as EA,statSync as MA,writeFileSync as qS}from"fs";import{resolve as MF}from"path";var DA=class{rootDir;get initialized(){return EF(this.rootDir)}initialize(){if(!this.initialized)KA(this.rootDir,{recursive:!0})}constructor($){if(this.rootDir=$.path,$.eagerInit)this.initialize()}getItem($){let T=MF(this.rootDir,$);if(EF(T))return PS(T,"utf-8");return null}setItem($,T){this.initialize();let W=MF(this.rootDir,$);qS(W,T)}removeItem($){let T=MF(this.rootDir,$);if(EF(T))this.initialize(),EA(T)}key($){return AA(this.rootDir).sort((U,X)=>{let w=MA(U);return MA(X).ctimeMs-w.ctimeMs})[$]??null}clear(){EA(this.rootDir,{recursive:!0}),KA(this.rootDir,{recursive:!0})}get length(){return AA(this.rootDir).length}};var JA=/[^a-zA-Z0-9\-._]/g;function A8($,T=64){if(T%2===1)T+=1;let W=$.replace(JA,"-");if(W.length<=T)return W;let U=SS("sha256").update($).digest("base64").slice(0,8).replaceAll("/","_"),X=W;if(X.length>T){let w=X.slice(0,T/2),Y=X.slice(-T/2);X=w+"_"+Y}return X+"+"+U}var BS=NA.default("varmint"),K8=A8(process.cwd(),150),DF=CS(BS,K8),P4="_-$-_-$-_",LA=`file${P4}`,RA=`list${P4}`,_A=`root${P4}`,IS=`unmatched${P4}`,n$={storage:new DA({path:DF,eagerInit:!1}),startGlobalTracking(){if(console.log(`\uD83D\uDC3F\uFE0F Starting global tracking of varmint files using project identifier "${K8}"`),n$.storage.initialized)console.error(`\uD83D\uDCA5 The global cache for the project "${K8}" was found already initialized. Clearing it and starting fresh.`),n$.storage.clear();n$.storage.initialize()},async prepareUploads($){console.log(`\uD83D\uDC3F\uFE0F Moving unmatched inputs to /tmp/varmint-uploads using project identifier "${K8}"`);let T=[];for(let W of f6.readdirSync(n$.storage.rootDir))if(YG(`unmatched${P4}`,W))T.push(W);if(T.length===0){console.log("\uD83D\uDC3F\uFE0F ","No unmatched input files found.");return}if(console.log("\uD83D\uDC3F\uFE0F ","Found the following unmatched files:",`
|
|
39
63
|
- ${T.join(`
|
|
40
64
|
`)}
|
|
41
65
|
`,`in root folder:
|
|
42
|
-
`,
|
|
66
|
+
`,DF),process.env[$])f6.mkdirSync("/tmp/varmint-uploads",{recursive:!0}),await Promise.all(T.map(async(W)=>{let U=eW.join(DF,W),X=eW.join("/tmp/varmint-uploads",W);await jS(U,X)}));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 "${K8}" and starting cleanup of untouched files.`),!n$.storage.initialized){console.error("\uD83D\uDCA5 called flushGlobal, but the global cache wasn't initialized with startGlobalTracking");return}let $=f6.readdirSync(n$.storage.rootDir),T=new Map,W=[],U=[],X=[];for(let Y of $)if(YG(`root${P4}`,Y))W.push(Y);else if(YG(`list${P4}`,Y))U.push(Y);else if(YG(`file${P4}`,Y))X.push(Y);if(n$.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 Y=new Map;for(let G of W){let H=G.replace(_A,"");Y.set(H,new Map);let z=n$.storage.getItem(G);if(z)T.set(H,z);else console.error(`\uD83D\uDCA5 Could not find folder ${z} referenced in the global cache`)}for(let G of U){let H=G.replace(RA,""),[z,F]=H.split(P4),O=Y.get(z);if(O)O.set(F,new Set);else console.error(`\uD83D\uDCA5 Could not find root ${z} for list ${F}`)}for(let G of X){let H=G.replace(LA,""),[z,F,O]=H.split(P4),Q=Y.get(z);if(Q){let Z=Q.get(F);if(Z)Z.add(O);else console.error(`\uD83D\uDCA5 Could not find list ${F} for file ${H}`)}else console.error(`\uD83D\uDCA5 Could not find root ${z} for file ${H}`)}console.log("\uD83D\uDC3F\uFE0F ",Y);for(let[G,H]of Y.entries()){let z=T.get(G);if(!z){console.error(`\uD83D\uDCA5 Could not find root ${G}`);continue}if(!f6.existsSync(z)){console.warn(`\uD83D\uDCA5 Root folder ${z}, identified as being used during tracking, no longer exists during cleanup.`);continue}let O=f6.readdirSync(z);for(let Q of O)if(Q!==".ferret"&&!H.has(Q)){let Z=eW.join(z,Q);console.log(`\uD83E\uDDF9 globalFlush: removing directory ${Z}`),f6.rmSync(Z,{recursive:!0})}for(let[Q,Z]of H.entries()){let V=eW.join(z,Q);if(!f6.existsSync(V)){console.warn(`\uD83D\uDCA5 List folder ${V}, identified as being used during tracking, no longer exists.`);continue}let D=f6.readdirSync(V);for(let J of D){let L=J.replace(".input.json","").replace(".output.json","").replace(".stream.txt","");if(!Z.has(L)){let _=eW.join(V,J);console.log(`\uD83E\uDDF9 globalFlush: removing file ${_}`),f6.rmSync(_)}}}}}f6.rmSync(n$.storage.rootDir,{recursive:!0})}};function YG($,T){return T.startsWith($)}import*as K4 from"fs";import*as S1 from"path";import{inspect as kA}from"util";var vA=class{filenameCache=new Map;filesTouched=new Map;mode;baseDir;rootName;constructor($="off",T=S1.join(process.cwd(),".varmint")){if(this.mode=$,this.baseDir=T,this.rootName=A8(this.baseDir),n$.storage.initialized&&!n$.storage.getItem(`root${P4}${this.rootName}`))n$.storage.setItem(`root${P4}${this.rootName}`,this.baseDir)}read($,T,W){let U=S1.join(this.baseDir,$),X=`${T}.input.json`,w=S1.join(U,X);if(!K4.existsSync(w)){if(!K4.existsSync(U)){if(n$.storage.initialized&&this.mode==="read")n$.storage.setItem("DID_CACHE_MISS","true");throw new Error(`Squirrel: input file for key "${$}" with "${T}" was not found. Directory "${U}" does not exist.`)}let O=K4.readdirSync(U).map((V)=>[V,K4.readFileSync(S1.join(U,V),"utf-8")]).filter(([V])=>V.endsWith(".input.json")),Q=[];for(let[V,A]of O){let D=` ${V}`,J=` ${kA(JSON.parse(A),{depth:Number.POSITIVE_INFINITY,colors:!0}).split(`
|
|
43
67
|
`).join(`
|
|
44
|
-
`)}`;Q.push(D,
|
|
45
|
-
${
|
|
68
|
+
`)}`;Q.push(D,J)}let Z=` ${X}
|
|
69
|
+
${kA(W,{depth:Number.POSITIVE_INFINITY,colors:!0}).split(`
|
|
46
70
|
`).join(`
|
|
47
|
-
`)}`;if(n$.storage.initialized&&this.mode==="read")n$.storage.setItem(`unmatched${P4}${
|
|
71
|
+
`)}`;if(n$.storage.initialized&&this.mode==="read")n$.storage.setItem(`unmatched${P4}${X}`,JSON.stringify(W,null,"\t")),n$.storage.setItem("DID_CACHE_MISS","true");throw new Error(`Squirrel: input file for key "${$}" with subKey "${T}" (${w}) was not found. Directory "${U}" exists, but the file does not. Below is a list of CACHED INPUT FILES from that directory and their contents, followed by YOUR INPUT DATA.
|
|
48
72
|
|
|
49
73
|
CACHED INPUT FILES:
|
|
50
74
|
${Q.join(`
|
|
@@ -58,18 +82,18 @@ Provided:
|
|
|
58
82
|
${G}
|
|
59
83
|
|
|
60
84
|
Cached:
|
|
61
|
-
${Y}`)}let H=C1.join(this.baseDir,`${$}/${T}.output.json`);return JSON.parse(K4.readFileSync(H,"utf-8"))}async write($,T,W,X){let U=C1.join(this.baseDir,$),w=C1.join(U,`${T}.input.json`),Y=C1.join(U,`${T}.output.json`),G=JSON.stringify(W,null,"\t");if(!K4.existsSync(this.baseDir))K4.mkdirSync(this.baseDir,{recursive:!0});if(!K4.existsSync(U))K4.mkdirSync(U);if(K4.writeFileSync(w,G),K4.existsSync(Y))K4.unlinkSync(Y);let H=await X(...W),z=JSON.stringify(H,null,"\t");return K4.writeFileSync(Y,z),H}add($,T){let W=`${this.rootName}${P4}${AX($)}`;return{flush:()=>{this.flush($)},for:(X)=>{if(this.mode!=="off"){if(this.filesTouched.set($,new Set),n$.storage.initialized&&!n$.storage.getItem(`list${P4}${W}`))n$.storage.setItem(`list${P4}${W}`,"true")}return{get:async(...U)=>{let w=X;if(this.mode!=="off"){let Y=this.filenameCache.get(X);if(!Y)Y=AX(X),this.filenameCache.set(X,Y);w=Y,this.filesTouched.get($)?.add(w);let G=`${W}${P4}${w}`,H=`file${P4}${G}`;if(n$.storage.initialized&&!n$.storage.getItem(H))n$.storage.setItem(H,"true")}switch(this.mode){case"off":return T(...U);case"read":return this.read($,w,U);case"write":return this.write($,w,U,T);case"read-write":try{return this.read($,w,U)}catch(Y){if(Y instanceof Error)return this.write($,w,U,T);throw Y}}}}}}}flush(...$){console.log(this.filesTouched);for(let[T,W]of this.filesTouched.entries())if($.length===0||$.includes(T)){let X=C1.join(this.baseDir,T),U=K4.readdirSync(X);for(let w of U){let Y=w.replace(".input.json","").replace(".output.json","");if(!W.has(Y))console.info(`\uD83E\uDDF9 Flushing ${Y}`),K4.unlinkSync(C1.join(X,w))}}}};function X$($,T,W,X,U){if(X==="m")throw new TypeError("Private method is not writable");if(X==="a"&&!U)throw new TypeError("Private accessor was defined without a setter");if(typeof T==="function"?$!==T||!U:!T.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return X==="a"?U.call($,W):U?U.value=W:T.set($,W),W}function v($,T,W,X){if(W==="a"&&!X)throw new TypeError("Private accessor was defined without a getter");if(typeof T==="function"?$!==T||!X:!T.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return W==="m"?X:W==="a"?X.call($):X?X.value:T.get($)}var MF=function(){let{crypto:$}=globalThis;if($?.randomUUID)return MF=$.randomUUID.bind($),$.randomUUID();let T=new Uint8Array(1),W=$?()=>$.getRandomValues(T)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(X)=>(+X^W()&15>>+X/4).toString(16))};function EX($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var MX=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let T=new Error($.message,$.cause?{cause:$.cause}:{});if($.stack)T.stack=$.stack;if($.cause&&!T.cause)T.cause=$.cause;if($.name)T.name=$.name;return T}}catch{}try{return new Error(JSON.stringify($))}catch{}}return new Error($)};class $$ extends Error{}class L4 extends $${constructor($,T,W,X){super(`${L4.makeMessage($,T,W)}`);this.status=$,this.headers=X,this.requestID=X?.get("x-request-id"),this.error=T;let U=T;this.code=U?.code,this.param=U?.param,this.type=U?.type}static makeMessage($,T,W){let X=T?.message?typeof T.message==="string"?T.message:JSON.stringify(T.message):T?JSON.stringify(T):W;if($&&X)return`${$} ${X}`;if($)return`${$} status code (no body)`;if(X)return X;return"(no status code or body)"}static generate($,T,W,X){if(!$||!X)return new nT({message:W,cause:MX(T)});let U=T?.error;if($===400)return new DX($,U,W,X);if($===401)return new NX($,U,W,X);if($===403)return new LX($,U,W,X);if($===404)return new JX($,U,W,X);if($===409)return new RX($,U,W,X);if($===422)return new _X($,U,W,X);if($===429)return new kX($,U,W,X);if($>=500)return new vX($,U,W,X);return new L4($,U,W,X)}}class q4 extends L4{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class nT extends L4{constructor({message:$,cause:T}){super(void 0,void 0,$||"Connection error.",void 0);if(T)this.cause=T}}class iT extends nT{constructor({message:$}={}){super({message:$??"Request timed out."})}}class DX extends L4{}class NX extends L4{}class LX extends L4{}class JX extends L4{}class RX extends L4{}class _X extends L4{}class kX extends L4{}class vX extends L4{}class PX extends $${constructor(){super("Could not parse response content as the length limit was reached")}}class qX extends $${constructor(){super("Could not parse response content as the request was rejected by the content filter")}}var kS=/^[a-z][a-z0-9+.-]*:/i,DA=($)=>{return kS.test($)};function NA($){if(typeof $!=="object")return{};return $??{}}function LA($){if(!$)return!0;for(let T in $)return!1;return!0}function JA($,T){return Object.prototype.hasOwnProperty.call($,T)}function CX($){return $!=null&&typeof $==="object"&&!Array.isArray($)}var RA=($,T)=>{if(typeof T!=="number"||!Number.isInteger(T))throw new $$(`${$} must be an integer`);if(T<0)throw new $$(`${$} must be a positive integer`);return T};var _A=($)=>{try{return JSON.parse($)}catch(T){return}};var l1=($)=>new Promise((T)=>setTimeout(T,$));var HG={off:0,error:200,warn:300,info:400,debug:500},DF=($,T,W)=>{if(!$)return;if(JA(HG,$))return $;C4(W).warn(`${T} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(HG))}`);return};function SX(){}function zG($,T,W){if(!T||HG[$]>HG[W])return SX;else return T[$].bind(T)}var vS={error:SX,warn:SX,info:SX,debug:SX},kA=new WeakMap;function C4($){let T=$.logger,W=$.logLevel??"off";if(!T)return vS;let X=kA.get(T);if(X&&X[0]===W)return X[1];let U={error:zG("error",T,W),warn:zG("warn",T,W),info:zG("info",T,W),debug:zG("debug",T,W)};return kA.set(T,[W,U]),U}var M0=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([T,W])=>[T,T.toLowerCase()==="authorization"||T.toLowerCase()==="cookie"||T.toLowerCase()==="set-cookie"?"***":W]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var GT="5.3.0";var CA=()=>{return typeof window!=="undefined"&&typeof window.document!=="undefined"&&typeof navigator!=="undefined"};function PS(){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 qS=()=>{let $=PS();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":GT,"X-Stainless-OS":PA(Deno.build.os),"X-Stainless-Arch":vA(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":GT,"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":GT,"X-Stainless-OS":PA(globalThis.process.platform??"unknown"),"X-Stainless-Arch":vA(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let T=CS();if(T)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":GT,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${T.browser}`,"X-Stainless-Runtime-Version":T.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":GT,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function CS(){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:T,pattern:W}of $){let X=W.exec(navigator.userAgent);if(X){let U=X[1]||0,w=X[2]||0,Y=X[3]||0;return{browser:T,version:`${U}.${w}.${Y}`}}}return null}var vA=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},PA=($)=>{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"},qA,SA=()=>{return qA??(qA=qS())};function jA(){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 NF(...$){let T=globalThis.ReadableStream;if(typeof T==="undefined")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new T(...$)}function FG($){let T=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return NF({start(){},async pull(W){let{done:X,value:U}=await T.next();if(X)W.close();else W.enqueue(U)},async cancel(){await T.return?.()}})}function LF($){if($[Symbol.asyncIterator])return $;let T=$.getReader();return{async next(){try{let W=await T.read();if(W?.done)T.releaseLock();return W}catch(W){throw T.releaseLock(),W}},async return(){let W=T.cancel();return T.releaseLock(),await W,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function IA($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let T=$.getReader(),W=T.cancel();T.releaseLock(),await W}var BA=({headers:$,body:T})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(T)}};var jX="RFC3986",IX={RFC1738:($)=>String($).replace(/%20/g,"+"),RFC3986:($)=>String($)},JF="RFC1738";var IS=Array.isArray,r1=(()=>{let $=[];for(let T=0;T<256;++T)$.push("%"+((T<16?"0":"")+T.toString(16)).toUpperCase());return $})();var RF=1024,xA=($,T,W,X,U)=>{if($.length===0)return $;let w=$;if(typeof $==="symbol")w=Symbol.prototype.toString.call($);else if(typeof $!=="string")w=String($);if(W==="iso-8859-1")return escape(w).replace(/%u[0-9a-f]{4}/gi,function(G){return"%26%23"+parseInt(G.slice(2),16)+"%3B"});let Y="";for(let G=0;G<w.length;G+=RF){let H=w.length>=RF?w.slice(G,G+RF):w,z=[];for(let F=0;F<H.length;++F){let O=H.charCodeAt(F);if(O===45||O===46||O===95||O===126||O>=48&&O<=57||O>=65&&O<=90||O>=97&&O<=122||U===JF&&(O===40||O===41)){z[z.length]=H.charAt(F);continue}if(O<128){z[z.length]=r1[O];continue}if(O<2048){z[z.length]=r1[192|O>>6]+r1[128|O&63];continue}if(O<55296||O>=57344){z[z.length]=r1[224|O>>12]+r1[128|O>>6&63]+r1[128|O&63];continue}F+=1,O=65536+((O&1023)<<10|H.charCodeAt(F)&1023),z[z.length]=r1[240|O>>18]+r1[128|O>>12&63]+r1[128|O>>6&63]+r1[128|O&63]}Y+=z.join("")}return Y};function fA($){if(!$||typeof $!=="object")return!1;return!!($.constructor&&$.constructor.isBuffer&&$.constructor.isBuffer($))}function _F($,T){if(IS($)){let W=[];for(let X=0;X<$.length;X+=1)W.push(T($[X]));return W}return T($)}var BS=Object.prototype.hasOwnProperty,bA={brackets($){return String($)+"[]"},comma:"comma",indices($,T){return String($)+"["+T+"]"},repeat($){return String($)}},n1=Array.isArray,xS=Array.prototype.push,yA=function($,T){xS.apply($,n1(T)?T:[T])},fS=Date.prototype.toISOString,S4={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:xA,encodeValuesOnly:!1,format:jX,formatter:IX[jX],indices:!1,serializeDate($){return fS.call($)},skipNulls:!1,strictNullHandling:!1};function bS($){return typeof $==="string"||typeof $==="number"||typeof $==="boolean"||typeof $==="symbol"||typeof $==="bigint"}var kF={};function hA($,T,W,X,U,w,Y,G,H,z,F,O,Q,Z,K,A,D,L){let J=$,_=L,C=0,f=!1;while((_=_.get(kF))!==void 0&&!f){let j=_.get($);if(C+=1,typeof j!=="undefined")if(j===C)throw new RangeError("Cyclic object value");else f=!0;if(typeof _.get(kF)==="undefined")C=0}if(typeof z==="function")J=z(T,J);else if(J instanceof Date)J=Q?.(J);else if(W==="comma"&&n1(J))J=_F(J,function(j){if(j instanceof Date)return Q?.(j);return j});if(J===null){if(w)return H&&!A?H(T,S4.encoder,D,"key",Z):T;J=""}if(bS(J)||fA(J)){if(H){let j=A?T:H(T,S4.encoder,D,"key",Z);return[K?.(j)+"="+K?.(H(J,S4.encoder,D,"value",Z))]}return[K?.(T)+"="+K?.(String(J))]}let b=[];if(typeof J==="undefined")return b;let g;if(W==="comma"&&n1(J)){if(A&&H)J=_F(J,H);g=[{value:J.length>0?J.join(",")||null:void 0}]}else if(n1(z))g=z;else{let j=Object.keys(J);g=F?j.sort(F):j}let T$=G?String(T).replace(/\./g,"%2E"):String(T),N$=X&&n1(J)&&J.length===1?T$+"[]":T$;if(U&&n1(J)&&J.length===0)return N$+"[]";for(let j=0;j<g.length;++j){let w$=g[j],t=typeof w$==="object"&&typeof w$.value!=="undefined"?w$.value:J[w$];if(Y&&t===null)continue;let z$=O&&G?w$.replace(/\./g,"%2E"):w$,B$=n1(J)?typeof W==="function"?W(N$,z$):N$:N$+(O?"."+z$:"["+z$+"]");L.set($,C);let e$=new WeakMap;e$.set(kF,L),yA(b,hA(t,B$,W,X,U,w,Y,G,W==="comma"&&A&&n1(J)?null:H,z,F,O,Q,Z,K,A,D,e$))}return b}function yS($=S4){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 T=$.charset||S4.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 W=jX;if(typeof $.format!=="undefined"){if(!BS.call(IX,$.format))throw new TypeError("Unknown format option provided.");W=$.format}let X=IX[W],U=S4.filter;if(typeof $.filter==="function"||n1($.filter))U=$.filter;let w;if($.arrayFormat&&$.arrayFormat in bA)w=$.arrayFormat;else if("indices"in $)w=$.indices?"indices":"repeat";else w=S4.arrayFormat;if("commaRoundTrip"in $&&typeof $.commaRoundTrip!=="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let Y=typeof $.allowDots==="undefined"?!!$.encodeDotInKeys===!0?!0:S4.allowDots:!!$.allowDots;return{addQueryPrefix:typeof $.addQueryPrefix==="boolean"?$.addQueryPrefix:S4.addQueryPrefix,allowDots:Y,allowEmptyArrays:typeof $.allowEmptyArrays==="boolean"?!!$.allowEmptyArrays:S4.allowEmptyArrays,arrayFormat:w,charset:T,charsetSentinel:typeof $.charsetSentinel==="boolean"?$.charsetSentinel:S4.charsetSentinel,commaRoundTrip:!!$.commaRoundTrip,delimiter:typeof $.delimiter==="undefined"?S4.delimiter:$.delimiter,encode:typeof $.encode==="boolean"?$.encode:S4.encode,encodeDotInKeys:typeof $.encodeDotInKeys==="boolean"?$.encodeDotInKeys:S4.encodeDotInKeys,encoder:typeof $.encoder==="function"?$.encoder:S4.encoder,encodeValuesOnly:typeof $.encodeValuesOnly==="boolean"?$.encodeValuesOnly:S4.encodeValuesOnly,filter:U,format:W,formatter:X,serializeDate:typeof $.serializeDate==="function"?$.serializeDate:S4.serializeDate,skipNulls:typeof $.skipNulls==="boolean"?$.skipNulls:S4.skipNulls,sort:typeof $.sort==="function"?$.sort:null,strictNullHandling:typeof $.strictNullHandling==="boolean"?$.strictNullHandling:S4.strictNullHandling}}function vF($,T={}){let W=$,X=yS(T),U,w;if(typeof X.filter==="function")w=X.filter,W=w("",W);else if(n1(X.filter))w=X.filter,U=w;let Y=[];if(typeof W!=="object"||W===null)return"";let G=bA[X.arrayFormat],H=G==="comma"&&X.commaRoundTrip;if(!U)U=Object.keys(W);if(X.sort)U.sort(X.sort);let z=new WeakMap;for(let Q=0;Q<U.length;++Q){let Z=U[Q];if(X.skipNulls&&W[Z]===null)continue;yA(Y,hA(W[Z],Z,G,H,X.allowEmptyArrays,X.strictNullHandling,X.skipNulls,X.encodeDotInKeys,X.encode?X.encoder:null,X.filter,X.sort,X.allowDots,X.serializeDate,X.format,X.formatter,X.encodeValuesOnly,X.charset,z))}let F=Y.join(X.delimiter),O=X.addQueryPrefix===!0?"?":"";if(X.charsetSentinel)if(X.charset==="iso-8859-1")O+="utf8=%26%2310003%3B&";else O+="utf8=%E2%9C%93&";return F.length>0?O+F:""}function cA($){let T=0;for(let U of $)T+=U.length;let W=new Uint8Array(T),X=0;for(let U of $)W.set(U,X),X+=U.length;return W}var gA;function $2($){let T;return(gA??(T=new globalThis.TextEncoder,gA=T.encode.bind(T)))($)}var mA;function PF($){let T;return(mA??(T=new globalThis.TextDecoder,mA=T.decode.bind(T)))($)}var e6,$1;class T2{constructor(){e6.set(this,void 0),$1.set(this,void 0),X$(this,e6,new Uint8Array,"f"),X$(this,$1,null,"f")}decode($){if($==null)return[];let T=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?$2($):$;X$(this,e6,cA([v(this,e6,"f"),T]),"f");let W=[],X;while((X=gS(v(this,e6,"f"),v(this,$1,"f")))!=null){if(X.carriage&&v(this,$1,"f")==null){X$(this,$1,X.index,"f");continue}if(v(this,$1,"f")!=null&&(X.index!==v(this,$1,"f")+1||X.carriage)){W.push(PF(v(this,e6,"f").subarray(0,v(this,$1,"f")-1))),X$(this,e6,v(this,e6,"f").subarray(v(this,$1,"f")),"f"),X$(this,$1,null,"f");continue}let U=v(this,$1,"f")!==null?X.preceding-1:X.preceding,w=PF(v(this,e6,"f").subarray(0,U));W.push(w),X$(this,e6,v(this,e6,"f").subarray(X.index),"f"),X$(this,$1,null,"f")}return W}flush(){if(!v(this,e6,"f").length)return[];return this.decode(`
|
|
62
|
-
`)}}
|
|
63
|
-
`,"\r"]);T2.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function
|
|
64
|
-
`);W.enqueue(w)}catch(
|
|
65
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],
|
|
85
|
+
${Y}`)}let H=S1.join(this.baseDir,`${$}/${T}.output.json`);return JSON.parse(K4.readFileSync(H,"utf-8"))}async write($,T,W,U){let X=S1.join(this.baseDir,$),w=S1.join(X,`${T}.input.json`),Y=S1.join(X,`${T}.output.json`),G=JSON.stringify(W,null,"\t");if(!K4.existsSync(this.baseDir))K4.mkdirSync(this.baseDir,{recursive:!0});if(!K4.existsSync(X))K4.mkdirSync(X);if(K4.writeFileSync(w,G),K4.existsSync(Y))K4.unlinkSync(Y);let H=await U(...W),z=JSON.stringify(H,null,"\t");return K4.writeFileSync(Y,z),H}add($,T){let W=`${this.rootName}${P4}${A8($)}`;return{flush:()=>{this.flush($)},for:(U)=>{if(this.mode!=="off"){if(this.filesTouched.set($,new Set),n$.storage.initialized&&!n$.storage.getItem(`list${P4}${W}`))n$.storage.setItem(`list${P4}${W}`,"true")}return{get:async(...X)=>{let w=U;if(this.mode!=="off"){let Y=this.filenameCache.get(U);if(!Y)Y=A8(U),this.filenameCache.set(U,Y);w=Y,this.filesTouched.get($)?.add(w);let G=`${W}${P4}${w}`,H=`file${P4}${G}`;if(n$.storage.initialized&&!n$.storage.getItem(H))n$.storage.setItem(H,"true")}switch(this.mode){case"off":return T(...X);case"read":return this.read($,w,X);case"write":return this.write($,w,X,T);case"read-write":try{return this.read($,w,X)}catch(Y){if(Y instanceof Error)return this.write($,w,X,T);throw Y}}}}}}}flush(...$){console.log(this.filesTouched);for(let[T,W]of this.filesTouched.entries())if($.length===0||$.includes(T)){let U=S1.join(this.baseDir,T),X=K4.readdirSync(U);for(let w of X){let Y=w.replace(".input.json","").replace(".output.json","");if(!W.has(Y))console.info(`\uD83E\uDDF9 Flushing ${Y}`),K4.unlinkSync(S1.join(U,w))}}}};function U$($,T,W,U,X){if(U==="m")throw new TypeError("Private method is not writable");if(U==="a"&&!X)throw new TypeError("Private accessor was defined without a setter");if(typeof T==="function"?$!==T||!X:!T.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return U==="a"?X.call($,W):X?X.value=W:T.set($,W),W}function v($,T,W,U){if(W==="a"&&!U)throw new TypeError("Private accessor was defined without a getter");if(typeof T==="function"?$!==T||!U:!T.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return W==="m"?U:W==="a"?U.call($):U?U.value:T.get($)}var NF=function(){let{crypto:$}=globalThis;if($?.randomUUID)return NF=$.randomUUID.bind($),$.randomUUID();let T=new Uint8Array(1),W=$?()=>$.getRandomValues(T)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(U)=>(+U^W()&15>>+U/4).toString(16))};function E8($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var M8=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let T=new Error($.message,$.cause?{cause:$.cause}:{});if($.stack)T.stack=$.stack;if($.cause&&!T.cause)T.cause=$.cause;if($.name)T.name=$.name;return T}}catch{}try{return new Error(JSON.stringify($))}catch{}}return new Error($)};class $$ extends Error{}class J4 extends $${constructor($,T,W,U){super(`${J4.makeMessage($,T,W)}`);this.status=$,this.headers=U,this.requestID=U?.get("x-request-id"),this.error=T;let X=T;this.code=X?.code,this.param=X?.param,this.type=X?.type}static makeMessage($,T,W){let U=T?.message?typeof T.message==="string"?T.message:JSON.stringify(T.message):T?JSON.stringify(T):W;if($&&U)return`${$} ${U}`;if($)return`${$} status code (no body)`;if(U)return U;return"(no status code or body)"}static generate($,T,W,U){if(!$||!U)return new nT({message:W,cause:M8(T)});let X=T?.error;if($===400)return new D8($,X,W,U);if($===401)return new N8($,X,W,U);if($===403)return new J8($,X,W,U);if($===404)return new L8($,X,W,U);if($===409)return new R8($,X,W,U);if($===422)return new _8($,X,W,U);if($===429)return new k8($,X,W,U);if($>=500)return new v8($,X,W,U);return new J4($,X,W,U)}}class q4 extends J4{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class nT extends J4{constructor({message:$,cause:T}){super(void 0,void 0,$||"Connection error.",void 0);if(T)this.cause=T}}class iT extends nT{constructor({message:$}={}){super({message:$??"Request timed out."})}}class D8 extends J4{}class N8 extends J4{}class J8 extends J4{}class L8 extends J4{}class R8 extends J4{}class _8 extends J4{}class k8 extends J4{}class v8 extends J4{}class P8 extends $${constructor(){super("Could not parse response content as the length limit was reached")}}class q8 extends $${constructor(){super("Could not parse response content as the request was rejected by the content filter")}}var fS=/^[a-z][a-z0-9+.-]*:/i,PA=($)=>{return fS.test($)},e4=($)=>(e4=Array.isArray,e4($)),JF=e4;function qA($){if(typeof $!=="object")return{};return $??{}}function CA($){if(!$)return!0;for(let T in $)return!1;return!0}function SA($,T){return Object.prototype.hasOwnProperty.call($,T)}function C8($){return $!=null&&typeof $==="object"&&!Array.isArray($)}var jA=($,T)=>{if(typeof T!=="number"||!Number.isInteger(T))throw new $$(`${$} must be an integer`);if(T<0)throw new $$(`${$} must be a positive integer`);return T};var BA=($)=>{try{return JSON.parse($)}catch(T){return}};var r1=($)=>new Promise((T)=>setTimeout(T,$));var GT="5.7.0";var bA=()=>{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 yS=()=>{let $=bS();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":GT,"X-Stainless-OS":xA(Deno.build.os),"X-Stainless-Arch":IA(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":GT,"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":GT,"X-Stainless-OS":xA(globalThis.process.platform??"unknown"),"X-Stainless-Arch":IA(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let T=hS();if(T)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":GT,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${T.browser}`,"X-Stainless-Runtime-Version":T.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":GT,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function hS(){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:T,pattern:W}of $){let U=W.exec(navigator.userAgent);if(U){let X=U[1]||0,w=U[2]||0,Y=U[3]||0;return{browser:T,version:`${X}.${w}.${Y}`}}}return null}var IA=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},xA=($)=>{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"},fA,yA=()=>{return fA??(fA=yS())};function hA(){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 LF(...$){let T=globalThis.ReadableStream;if(typeof T==="undefined")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new T(...$)}function GG($){let T=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return LF({start(){},async pull(W){let{done:U,value:X}=await T.next();if(U)W.close();else W.enqueue(X)},async cancel(){await T.return?.()}})}function RF($){if($[Symbol.asyncIterator])return $;let T=$.getReader();return{async next(){try{let W=await T.read();if(W?.done)T.releaseLock();return W}catch(W){throw T.releaseLock(),W}},async return(){let W=T.cancel();return T.releaseLock(),await W,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function gA($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let T=$.getReader(),W=T.cancel();T.releaseLock(),await W}var mA=({headers:$,body:T})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(T)}};var zG="RFC3986",_F=($)=>String($),HG={RFC1738:($)=>String($).replace(/%20/g,"+"),RFC3986:_F},kF="RFC1738";var FG=($,T)=>(FG=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),FG($,T)),n1=(()=>{let $=[];for(let T=0;T<256;++T)$.push("%"+((T<16?"0":"")+T.toString(16)).toUpperCase());return $})();var vF=1024,cA=($,T,W,U,X)=>{if($.length===0)return $;let w=$;if(typeof $==="symbol")w=Symbol.prototype.toString.call($);else if(typeof $!=="string")w=String($);if(W==="iso-8859-1")return escape(w).replace(/%u[0-9a-f]{4}/gi,function(G){return"%26%23"+parseInt(G.slice(2),16)+"%3B"});let Y="";for(let G=0;G<w.length;G+=vF){let H=w.length>=vF?w.slice(G,G+vF):w,z=[];for(let F=0;F<H.length;++F){let O=H.charCodeAt(F);if(O===45||O===46||O===95||O===126||O>=48&&O<=57||O>=65&&O<=90||O>=97&&O<=122||X===kF&&(O===40||O===41)){z[z.length]=H.charAt(F);continue}if(O<128){z[z.length]=n1[O];continue}if(O<2048){z[z.length]=n1[192|O>>6]+n1[128|O&63];continue}if(O<55296||O>=57344){z[z.length]=n1[224|O>>12]+n1[128|O>>6&63]+n1[128|O&63];continue}F+=1,O=65536+((O&1023)<<10|H.charCodeAt(F)&1023),z[z.length]=n1[240|O>>18]+n1[128|O>>12&63]+n1[128|O>>6&63]+n1[128|O&63]}Y+=z.join("")}return Y};function uA($){if(!$||typeof $!=="object")return!1;return!!($.constructor&&$.constructor.isBuffer&&$.constructor.isBuffer($))}function PF($,T){if(e4($)){let W=[];for(let U=0;U<$.length;U+=1)W.push(T($[U]));return W}return T($)}var dA={brackets($){return String($)+"[]"},comma:"comma",indices($,T){return String($)+"["+T+"]"},repeat($){return String($)}},oA=function($,T){Array.prototype.push.apply($,e4(T)?T:[T])},pA,C4={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:cA,encodeValuesOnly:!1,format:zG,formatter:_F,indices:!1,serializeDate($){return(pA??(pA=Function.prototype.call.bind(Date.prototype.toISOString)))($)},skipNulls:!1,strictNullHandling:!1};function cS($){return typeof $==="string"||typeof $==="number"||typeof $==="boolean"||typeof $==="symbol"||typeof $==="bigint"}var qF={};function lA($,T,W,U,X,w,Y,G,H,z,F,O,Q,Z,V,A,D,J){let L=$,_=J,C=0,f=!1;while((_=_.get(qF))!==void 0&&!f){let j=_.get($);if(C+=1,typeof j!=="undefined")if(j===C)throw new RangeError("Cyclic object value");else f=!0;if(typeof _.get(qF)==="undefined")C=0}if(typeof z==="function")L=z(T,L);else if(L instanceof Date)L=Q?.(L);else if(W==="comma"&&e4(L))L=PF(L,function(j){if(j instanceof Date)return Q?.(j);return j});if(L===null){if(w)return H&&!A?H(T,C4.encoder,D,"key",Z):T;L=""}if(cS(L)||uA(L)){if(H){let j=A?T:H(T,C4.encoder,D,"key",Z);return[V?.(j)+"="+V?.(H(L,C4.encoder,D,"value",Z))]}return[V?.(T)+"="+V?.(String(L))]}let b=[];if(typeof L==="undefined")return b;let g;if(W==="comma"&&e4(L)){if(A&&H)L=PF(L,H);g=[{value:L.length>0?L.join(",")||null:void 0}]}else if(e4(z))g=z;else{let j=Object.keys(L);g=F?j.sort(F):j}let T$=G?String(T).replace(/\./g,"%2E"):String(T),N$=U&&e4(L)&&L.length===1?T$+"[]":T$;if(X&&e4(L)&&L.length===0)return N$+"[]";for(let j=0;j<g.length;++j){let w$=g[j],t=typeof w$==="object"&&typeof w$.value!=="undefined"?w$.value:L[w$];if(Y&&t===null)continue;let z$=O&&G?w$.replace(/\./g,"%2E"):w$,I$=e4(L)?typeof W==="function"?W(N$,z$):N$:N$+(O?"."+z$:"["+z$+"]");J.set($,C);let e$=new WeakMap;e$.set(qF,J),oA(b,lA(t,I$,W,U,X,w,Y,G,W==="comma"&&A&&e4(L)?null:H,z,F,O,Q,Z,V,A,D,e$))}return b}function uS($=C4){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 T=$.charset||C4.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 W=zG;if(typeof $.format!=="undefined"){if(!FG(HG,$.format))throw new TypeError("Unknown format option provided.");W=$.format}let U=HG[W],X=C4.filter;if(typeof $.filter==="function"||e4($.filter))X=$.filter;let w;if($.arrayFormat&&$.arrayFormat in dA)w=$.arrayFormat;else if("indices"in $)w=$.indices?"indices":"repeat";else w=C4.arrayFormat;if("commaRoundTrip"in $&&typeof $.commaRoundTrip!=="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let Y=typeof $.allowDots==="undefined"?!!$.encodeDotInKeys===!0?!0:C4.allowDots:!!$.allowDots;return{addQueryPrefix:typeof $.addQueryPrefix==="boolean"?$.addQueryPrefix:C4.addQueryPrefix,allowDots:Y,allowEmptyArrays:typeof $.allowEmptyArrays==="boolean"?!!$.allowEmptyArrays:C4.allowEmptyArrays,arrayFormat:w,charset:T,charsetSentinel:typeof $.charsetSentinel==="boolean"?$.charsetSentinel:C4.charsetSentinel,commaRoundTrip:!!$.commaRoundTrip,delimiter:typeof $.delimiter==="undefined"?C4.delimiter:$.delimiter,encode:typeof $.encode==="boolean"?$.encode:C4.encode,encodeDotInKeys:typeof $.encodeDotInKeys==="boolean"?$.encodeDotInKeys:C4.encodeDotInKeys,encoder:typeof $.encoder==="function"?$.encoder:C4.encoder,encodeValuesOnly:typeof $.encodeValuesOnly==="boolean"?$.encodeValuesOnly:C4.encodeValuesOnly,filter:X,format:W,formatter:U,serializeDate:typeof $.serializeDate==="function"?$.serializeDate:C4.serializeDate,skipNulls:typeof $.skipNulls==="boolean"?$.skipNulls:C4.skipNulls,sort:typeof $.sort==="function"?$.sort:null,strictNullHandling:typeof $.strictNullHandling==="boolean"?$.strictNullHandling:C4.strictNullHandling}}function CF($,T={}){let W=$,U=uS(T),X,w;if(typeof U.filter==="function")w=U.filter,W=w("",W);else if(e4(U.filter))w=U.filter,X=w;let Y=[];if(typeof W!=="object"||W===null)return"";let G=dA[U.arrayFormat],H=G==="comma"&&U.commaRoundTrip;if(!X)X=Object.keys(W);if(U.sort)X.sort(U.sort);let z=new WeakMap;for(let Q=0;Q<X.length;++Q){let Z=X[Q];if(U.skipNulls&&W[Z]===null)continue;oA(Y,lA(W[Z],Z,G,H,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,z))}let F=Y.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 F.length>0?O+F:""}function iA($){let T=0;for(let X of $)T+=X.length;let W=new Uint8Array(T),U=0;for(let X of $)W.set(X,U),U+=X.length;return W}var rA;function $2($){let T;return(rA??(T=new globalThis.TextEncoder,rA=T.encode.bind(T)))($)}var nA;function SF($){let T;return(nA??(T=new globalThis.TextDecoder,nA=T.decode.bind(T)))($)}var $1,T1;class T2{constructor(){$1.set(this,void 0),T1.set(this,void 0),U$(this,$1,new Uint8Array,"f"),U$(this,T1,null,"f")}decode($){if($==null)return[];let T=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?$2($):$;U$(this,$1,iA([v(this,$1,"f"),T]),"f");let W=[],U;while((U=dS(v(this,$1,"f"),v(this,T1,"f")))!=null){if(U.carriage&&v(this,T1,"f")==null){U$(this,T1,U.index,"f");continue}if(v(this,T1,"f")!=null&&(U.index!==v(this,T1,"f")+1||U.carriage)){W.push(SF(v(this,$1,"f").subarray(0,v(this,T1,"f")-1))),U$(this,$1,v(this,$1,"f").subarray(v(this,T1,"f")),"f"),U$(this,T1,null,"f");continue}let X=v(this,T1,"f")!==null?U.preceding-1:U.preceding,w=SF(v(this,$1,"f").subarray(0,X));W.push(w),U$(this,$1,v(this,$1,"f").subarray(U.index),"f"),U$(this,T1,null,"f")}return W}flush(){if(!v(this,$1,"f").length)return[];return this.decode(`
|
|
86
|
+
`)}}$1=new WeakMap,T1=new WeakMap;T2.NEWLINE_CHARS=new Set([`
|
|
87
|
+
`,"\r"]);T2.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function dS($,T){for(let X=T??0;X<$.length;X++){if($[X]===10)return{preceding:X,index:X+1,carriage:!1};if($[X]===13)return{preceding:X,index:X+1,carriage:!0}}return null}function tA($){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}class W1{constructor($,T){this.iterator=$,this.controller=T}static fromSSEResponse($,T){let W=!1;async function*U(){if(W)throw new $$("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");W=!0;let X=!1;try{for await(let w of oS($,T)){if(X)continue;if(w.data.startsWith("[DONE]")){X=!0;continue}if(w.event===null||w.event.startsWith("response.")||w.event.startsWith("transcript.")){let Y;try{Y=JSON.parse(w.data)}catch(G){throw console.error("Could not parse message into JSON:",w.data),console.error("From chunk:",w.raw),G}if(Y&&Y.error)throw new J4(void 0,Y.error,void 0,$.headers);yield Y}else{let Y;try{Y=JSON.parse(w.data)}catch(G){throw console.error("Could not parse message into JSON:",w.data),console.error("From chunk:",w.raw),G}if(w.event=="error")throw new J4(void 0,Y.error,Y.message,void 0);yield{event:w.event,data:Y}}}X=!0}catch(w){if(E8(w))return;throw w}finally{if(!X)T.abort()}}return new W1(U,T)}static fromReadableStream($,T){let W=!1;async function*U(){let w=new T2,Y=RF($);for await(let G of Y)for(let H of w.decode(G))yield H;for(let G of w.flush())yield G}async function*X(){if(W)throw new $$("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");W=!0;let w=!1;try{for await(let Y of U()){if(w)continue;if(Y)yield JSON.parse(Y)}w=!0}catch(Y){if(E8(Y))return;throw Y}finally{if(!w)T.abort()}}return new W1(X,T)}[Symbol.asyncIterator](){return this.iterator()}tee(){let $=[],T=[],W=this.iterator(),U=(X)=>{return{next:()=>{if(X.length===0){let w=W.next();$.push(w),T.push(w)}return X.shift()}}};return[new W1(()=>U($),this.controller),new W1(()=>U(T),this.controller)]}toReadableStream(){let $=this,T;return LF({async start(){T=$[Symbol.asyncIterator]()},async pull(W){try{let{value:U,done:X}=await T.next();if(X)return W.close();let w=$2(JSON.stringify(U)+`
|
|
88
|
+
`);W.enqueue(w)}catch(U){W.error(U)}},async cancel(){await T.return?.()}})}}async function*oS($,T){if(!$.body){if(T.abort(),typeof globalThis.navigator!=="undefined"&&globalThis.navigator.product==="ReactNative")throw new $$("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 $$("Attempted to iterate over a response with no body")}let W=new aA,U=new T2,X=RF($.body);for await(let w of lS(X))for(let Y of U.decode(w)){let G=W.decode(Y);if(G)yield G}for(let w of U.flush()){let Y=W.decode(w);if(Y)yield Y}}async function*lS($){let T=new Uint8Array;for await(let W of $){if(W==null)continue;let U=W instanceof ArrayBuffer?new Uint8Array(W):typeof W==="string"?$2(W):W,X=new Uint8Array(T.length+U.length);X.set(T),X.set(U,T.length),T=X;let w;while((w=tA(T))!==-1)yield T.slice(0,w),T=T.slice(w)}if(T.length>0)yield T}class aA{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 X={event:this.event,data:this.data.join(`
|
|
89
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],X}if(this.chunks.push($),$.startsWith(":"))return null;let[T,W,U]=rS($,":");if(U.startsWith(" "))U=U.substring(1);if(T==="event")this.event=U;else if(T==="data")this.data.push(U);return null}}function rS($,T){let W=$.indexOf(T);if(W!==-1)return[$.substring(0,W),T,$.substring(W+T.length)];return[$,"",""]}var QG={off:0,error:200,warn:300,info:400,debug:500},jF=($,T,W)=>{if(!$)return;if(SA(QG,$))return $;S4(W).warn(`${T} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(QG))}`);return};function S8(){}function OG($,T,W){if(!T||QG[$]>QG[W])return S8;else return T[$].bind(T)}var nS={error:S8,warn:S8,info:S8,debug:S8},sA=new WeakMap;function S4($){let T=$.logger,W=$.logLevel??"off";if(!T)return nS;let U=sA.get(T);if(U&&U[0]===W)return U[1];let X={error:OG("error",T,W),warn:OG("warn",T,W),info:OG("info",T,W),debug:OG("debug",T,W)};return sA.set(T,[W,X]),X}var M0=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([T,W])=>[T,T.toLowerCase()==="authorization"||T.toLowerCase()==="cookie"||T.toLowerCase()==="set-cookie"?"***":W]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};async function ZG($,T){let{response:W,requestLogID:U,retryOfRequestLogID:X,startTime:w}=T,Y=await(async()=>{if(T.options.stream){if(S4($).debug("response",W.status,W.url,W.headers,W.body),T.options.__streamClass)return T.options.__streamClass.fromSSEResponse(W,T.controller);return W1.fromSSEResponse(W,T.controller)}if(W.status===204)return null;if(T.options.__binaryResponse)return W;let H=W.headers.get("content-type")?.split(";")[0]?.trim();if(H?.includes("application/json")||H?.endsWith("+json")){let O=await W.json();return BF(O,W)}return await W.text()})();return S4($).debug(`[${U}] response parsed`,M0({retryOfRequestLogID:X,url:W.url,status:W.status,body:Y,durationMs:Date.now()-w})),Y}function BF($,T){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:T.headers.get("x-request-id"),enumerable:!1})}var j8;class tT extends Promise{constructor($,T,W=ZG){super((U)=>{U(null)});this.responsePromise=T,this.parseResponse=W,j8.set(this,void 0),U$(this,j8,$,"f")}_thenUnwrap($){return new tT(v(this,j8,"f"),this.responsePromise,async(T,W)=>BF($(await this.parseResponse(T,W),W),W.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,T]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:T,request_id:T.headers.get("x-request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(v(this,j8,"f"),$));return this.parsedPromise}then($,T){return this.parse().then($,T)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}}j8=new WeakMap;var VG;class IF{constructor($,T,W,U){VG.set(this,void 0),U$(this,VG,$,"f"),this.options=U,this.response=T,this.body=W}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new $$("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await v(this,VG,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(VG=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let T of $.getPaginatedItems())yield T}}class KG extends tT{constructor($,T,W){super($,T,async(U,X)=>new W(U,X.response,await ZG(U,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let T of $)yield T}}class D0 extends IF{constructor($,T,W,U){super($,T,W,U);this.data=W.data||[],this.object=W.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}}class L$ extends IF{constructor($,T,W,U){super($,T,W,U);this.data=W.data||[],this.has_more=W.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let $=this.getPaginatedItems(),T=$[$.length-1]?.id;if(!T)return null;return{...this.options,query:{...qA(this.options.query),after:T}}}}var fF=()=>{if(typeof File==="undefined"){let{process:$}=globalThis,T=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."+(T?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function W2($,T,W){return fF(),new File($,T??"unknown_file",W)}function B8($){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 bF=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function";var X1=async($,T)=>{return{...$,body:await aS($.body,T)}},eA=new WeakMap;function tS($){let T=typeof $==="function"?$:$.fetch,W=eA.get(T);if(W)return W;let U=(async()=>{try{let X="Response"in T?T.Response:(await T("data:,")).constructor,w=new FormData;if(w.toString()===await new X(w).text())return!1;return!0}catch{return!0}})();return eA.set(T,U),U}var aS=async($,T)=>{if(!await tS(T))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let W=new FormData;return await Promise.all(Object.entries($||{}).map(([U,X])=>xF(W,U,X))),W},sS=($)=>$ instanceof Blob&&("name"in $);var xF=async($,T,W)=>{if(W===void 0)return;if(W==null)throw new TypeError(`Received null for "${T}"; to pass null in FormData, you must use the string 'null'`);if(typeof W==="string"||typeof W==="number"||typeof W==="boolean")$.append(T,String(W));else if(W instanceof Response)$.append(T,W2([await W.blob()],B8(W)));else if(bF(W))$.append(T,W2([await new Response(GG(W)).blob()],B8(W)));else if(sS(W))$.append(T,W,B8(W));else if(Array.isArray(W))await Promise.all(W.map((U)=>xF($,T+"[]",U)));else if(typeof W==="object")await Promise.all(Object.entries(W).map(([U,X])=>xF($,`${T}[${U}]`,X)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${W} instead`)};var $E=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",eS=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&$E($),$j=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";async function AG($,T,W){if(fF(),$=await $,eS($)){if($ instanceof File)return $;return W2([await $.arrayBuffer()],$.name)}if($j($)){let X=await $.blob();return T||(T=new URL($.url).pathname.split(/[\\/]/).pop()),W2(await yF(X),T,W)}let U=await yF($);if(T||(T=B8($)),!W?.type){let X=U.find((w)=>typeof w==="object"&&("type"in w)&&w.type);if(typeof X==="string")W={...W,type:X}}return W2(U,T,W)}async function yF($){let T=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)T.push($);else if($E($))T.push($ instanceof Blob?$:await $.arrayBuffer());else if(bF($))for await(let W of $)T.push(...await yF(W));else{let W=$?.constructor?.name;throw new Error(`Unexpected data type: ${typeof $}${W?`; constructor: ${W}`:""}${Tj($)}`)}return T}function Tj($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((W)=>`"${W}"`).join(", ")}]`}class m{constructor($){this._client=$}}function TE($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Xj=($=TE)=>function T(W,...U){if(W.length===1)return W[0];let X=!1,w=W.reduce((F,O,Q)=>{if(/[?#]/.test(O))X=!0;return F+O+(Q===U.length?"":(X?encodeURIComponent:$)(String(U[Q])))},""),Y=w.split(/[?#]/,1)[0],G=[],H=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,z;while((z=H.exec(Y))!==null)G.push({start:z.index,length:z[0].length});if(G.length>0){let F=0,O=G.reduce((Q,Z)=>{let V=" ".repeat(Z.start-F),A="^".repeat(Z.length);return F=Z.start+Z.length,Q+V+A},"");throw new $$(`Path parameters result in path with invalid segments:
|
|
66
90
|
${w}
|
|
67
|
-
${O}`)}return w},h=aS(lA);class U2 extends m{list($,T={},W){return this._client.getAPIList(h`/chat/completions/${$}/messages`,J$,{query:T,...W})}}function rA($){return typeof $.parse==="function"}var X2=($)=>{return $?.role==="assistant"},xF=($)=>{return $?.role==="tool"};var fF,KG,AG,fX,bX,EG,yX,N0,hX,MG,DG,w2,nA;class aT{constructor(){fF.add(this),this.controller=new AbortController,KG.set(this,void 0),AG.set(this,()=>{}),fX.set(this,()=>{}),bX.set(this,void 0),EG.set(this,()=>{}),yX.set(this,()=>{}),N0.set(this,{}),hX.set(this,!1),MG.set(this,!1),DG.set(this,!1),w2.set(this,!1),X$(this,KG,new Promise(($,T)=>{X$(this,AG,$,"f"),X$(this,fX,T,"f")}),"f"),X$(this,bX,new Promise(($,T)=>{X$(this,EG,$,"f"),X$(this,yX,T,"f")}),"f"),v(this,KG,"f").catch(()=>{}),v(this,bX,"f").catch(()=>{})}_run($){setTimeout(()=>{$().then(()=>{this._emitFinal(),this._emit("end")},v(this,fF,"m",nA).bind(this))},0)}_connected(){if(this.ended)return;v(this,AG,"f").call(this),this._emit("connect")}get ended(){return v(this,hX,"f")}get errored(){return v(this,MG,"f")}get aborted(){return v(this,DG,"f")}abort(){this.controller.abort()}on($,T){return(v(this,N0,"f")[$]||(v(this,N0,"f")[$]=[])).push({listener:T}),this}off($,T){let W=v(this,N0,"f")[$];if(!W)return this;let X=W.findIndex((U)=>U.listener===T);if(X>=0)W.splice(X,1);return this}once($,T){return(v(this,N0,"f")[$]||(v(this,N0,"f")[$]=[])).push({listener:T,once:!0}),this}emitted($){return new Promise((T,W)=>{if(X$(this,w2,!0,"f"),$!=="error")this.once("error",W);this.once($,T)})}async done(){X$(this,w2,!0,"f"),await v(this,bX,"f")}_emit($,...T){if(v(this,hX,"f"))return;if($==="end")X$(this,hX,!0,"f"),v(this,EG,"f").call(this);let W=v(this,N0,"f")[$];if(W)v(this,N0,"f")[$]=W.filter((X)=>!X.once),W.forEach(({listener:X})=>X(...T));if($==="abort"){let X=T[0];if(!v(this,w2,"f")&&!W?.length)Promise.reject(X);v(this,fX,"f").call(this,X),v(this,yX,"f").call(this,X),this._emit("end");return}if($==="error"){let X=T[0];if(!v(this,w2,"f")&&!W?.length)Promise.reject(X);v(this,fX,"f").call(this,X),v(this,yX,"f").call(this,X),this._emit("end")}}_emitFinal(){}}KG=new WeakMap,AG=new WeakMap,fX=new WeakMap,bX=new WeakMap,EG=new WeakMap,yX=new WeakMap,N0=new WeakMap,hX=new WeakMap,MG=new WeakMap,DG=new WeakMap,w2=new WeakMap,fF=new WeakSet,nA=function $(T){if(X$(this,MG,!0,"f"),T instanceof Error&&T.name==="AbortError")T=new q4;if(T instanceof q4)return X$(this,DG,!0,"f"),this._emit("abort",T);if(T instanceof $$)return this._emit("error",T);if(T instanceof Error){let W=new $$(T.message);return W.cause=T,this._emit("error",W)}return this._emit("error",new $$(String(T)))};function gX($){return $?.$brand==="auto-parseable-response-format"}function sT($){return $?.$brand==="auto-parseable-tool"}function iA($,T){if(!T||!bF(T))return{...$,choices:$.choices.map((W)=>({...W,message:{...W.message,parsed:null,...W.message.tool_calls?{tool_calls:W.message.tool_calls}:void 0}}))};return mX($,T)}function mX($,T){let W=$.choices.map((X)=>{if(X.finish_reason==="length")throw new PX;if(X.finish_reason==="content_filter")throw new qX;return{...X,message:{...X.message,...X.message.tool_calls?{tool_calls:X.message.tool_calls?.map((U)=>Tj(T,U))??void 0}:void 0,parsed:X.message.content&&!X.message.refusal?$j(T,X.message.content):null}}});return{...$,choices:W}}function $j($,T){if($.response_format?.type!=="json_schema")return null;if($.response_format?.type==="json_schema"){if("$parseRaw"in $.response_format)return $.response_format.$parseRaw(T);return JSON.parse(T)}return null}function Tj($,T){let W=$.tools?.find((X)=>X.function?.name===T.function.name);return{...T,function:{...T.function,parsed_arguments:sT(W)?W.$parseRaw(T.function.arguments):W?.function.strict?JSON.parse(T.function.arguments):null}}}function tA($,T){if(!$)return!1;let W=$.tools?.find((X)=>X.function?.name===T.function.name);return sT(W)||W?.function.strict||!1}function bF($){if(gX($.response_format))return!0;return $.tools?.some((T)=>sT(T)||T.type==="function"&&T.function.strict===!0)??!1}function aA($){for(let T of $??[]){if(T.type!=="function")throw new $$(`Currently only \`function\` tool types support auto-parsing; Received \`${T.type}\``);if(T.function.strict!==!0)throw new $$(`The \`${T.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var H6,yF,NG,hF,gF,mF,sA,eA,Wj=10;class cX extends aT{constructor(){super(...arguments);H6.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion($){this._chatCompletions.push($),this._emit("chatCompletion",$);let T=$.choices[0]?.message;if(T)this._addMessage(T);return $}_addMessage($,T=!0){if(!("content"in $))$.content=null;if(this.messages.push($),T){if(this._emit("message",$),xF($)&&$.content)this._emit("functionToolCallResult",$.content);else if(X2($)&&$.tool_calls){for(let W of $.tool_calls)if(W.type==="function")this._emit("functionToolCall",W.function)}}}async finalChatCompletion(){await this.done();let $=this._chatCompletions[this._chatCompletions.length-1];if(!$)throw new $$("stream ended without producing a ChatCompletion");return $}async finalContent(){return await this.done(),v(this,H6,"m",yF).call(this)}async finalMessage(){return await this.done(),v(this,H6,"m",NG).call(this)}async finalFunctionToolCall(){return await this.done(),v(this,H6,"m",hF).call(this)}async finalFunctionToolCallResult(){return await this.done(),v(this,H6,"m",gF).call(this)}async totalUsage(){return await this.done(),v(this,H6,"m",mF).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let $=this._chatCompletions[this._chatCompletions.length-1];if($)this._emit("finalChatCompletion",$);let T=v(this,H6,"m",NG).call(this);if(T)this._emit("finalMessage",T);let W=v(this,H6,"m",yF).call(this);if(W)this._emit("finalContent",W);let X=v(this,H6,"m",hF).call(this);if(X)this._emit("finalFunctionToolCall",X);let U=v(this,H6,"m",gF).call(this);if(U!=null)this._emit("finalFunctionToolCallResult",U);if(this._chatCompletions.some((w)=>w.usage))this._emit("totalUsage",v(this,H6,"m",mF).call(this))}async _createChatCompletion($,T,W){let X=W?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}v(this,H6,"m",sA).call(this,T);let U=await $.chat.completions.create({...T,stream:!1},{...W,signal:this.controller.signal});return this._connected(),this._addChatCompletion(mX(U,T))}async _runChatCompletion($,T,W){for(let X of T.messages)this._addMessage(X,!1);return await this._createChatCompletion($,T,W)}async _runTools($,T,W){let{tool_choice:U="auto",stream:w,...Y}=T,G=typeof U!=="string"&&U?.function?.name,{maxChatCompletions:H=Wj}=W||{},z=T.tools.map((Q)=>{if(sT(Q)){if(!Q.$callback)throw new $$("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:Q.$callback,name:Q.function.name,description:Q.function.description||"",parameters:Q.function.parameters,parse:Q.$parseRaw,strict:!0}}}return Q}),F={};for(let Q of z)if(Q.type==="function")F[Q.function.name||Q.function.function.name]=Q.function;let O="tools"in T?z.map((Q)=>Q.type==="function"?{type:"function",function:{name:Q.function.name||Q.function.function.name,parameters:Q.function.parameters,description:Q.function.description,strict:Q.function.strict}}:Q):void 0;for(let Q of T.messages)this._addMessage(Q,!1);for(let Q=0;Q<H;++Q){let K=(await this._createChatCompletion($,{...Y,tool_choice:U,tools:O,messages:[...this.messages]},W)).choices[0]?.message;if(!K)throw new $$("missing message in ChatCompletion response");if(!K.tool_calls?.length)return;for(let A of K.tool_calls){if(A.type!=="function")continue;let D=A.id,{name:L,arguments:J}=A.function,_=F[L];if(!_){let g=`Invalid tool_call: ${JSON.stringify(L)}. Available options are: ${Object.keys(F).map((T$)=>JSON.stringify(T$)).join(", ")}. Please try again`;this._addMessage({role:"tool",tool_call_id:D,content:g});continue}else if(G&&G!==L){let g=`Invalid tool_call: ${JSON.stringify(L)}. ${JSON.stringify(G)} requested. Please try again`;this._addMessage({role:"tool",tool_call_id:D,content:g});continue}let C;try{C=rA(_)?await _.parse(J):J}catch(g){let T$=g instanceof Error?g.message:String(g);this._addMessage({role:"tool",tool_call_id:D,content:T$});continue}let f=await _.function(C,this),b=v(this,H6,"m",eA).call(this,f);if(this._addMessage({role:"tool",tool_call_id:D,content:b}),G)return}}return}}H6=new WeakSet,yF=function $(){return v(this,H6,"m",NG).call(this).content??null},NG=function $(){let T=this.messages.length;while(T-- >0){let W=this.messages[T];if(X2(W))return{...W,content:W.content??null,refusal:W.refusal??null}}throw new $$("stream ended without producing a ChatCompletionMessage with role=assistant")},hF=function $(){for(let T=this.messages.length-1;T>=0;T--){let W=this.messages[T];if(X2(W)&&W?.tool_calls?.length)return W.tool_calls.at(-1)?.function}return},gF=function $(){for(let T=this.messages.length-1;T>=0;T--){let W=this.messages[T];if(xF(W)&&W.content!=null&&typeof W.content==="string"&&this.messages.some((X)=>X.role==="assistant"&&X.tool_calls?.some((U)=>U.type==="function"&&U.id===W.tool_call_id)))return W.content}return},mF=function $(){let T={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:W}of this._chatCompletions)if(W)T.completion_tokens+=W.completion_tokens,T.prompt_tokens+=W.prompt_tokens,T.total_tokens+=W.total_tokens;return T},sA=function $(T){if(T.n!=null&&T.n>1)throw new $$("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},eA=function $(T){return typeof T==="string"?T:T===void 0?"undefined":JSON.stringify(T)};class uX extends cX{static runTools($,T,W){let X=new uX,U={...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"runTools"}};return X._run(()=>X._runTools($,T,U)),X}_addMessage($,T=!0){if(super._addMessage($,T),X2($)&&$.content)this._emit("content",$.content)}}var g4={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 $E extends Error{}class TE extends Error{}function Uj($,T=g4.ALL){if(typeof $!=="string")throw new TypeError(`expecting str, got ${typeof $}`);if(!$.trim())throw new Error(`${$} is empty`);return Xj($.trim(),T)}var Xj=($,T)=>{let W=$.length,X=0,U=(Q)=>{throw new $E(`${Q} at position ${X}`)},w=(Q)=>{throw new TE(`${Q} at position ${X}`)},Y=()=>{if(O(),X>=W)U("Unexpected end of input");if($[X]==='"')return G();if($[X]==="{")return H();if($[X]==="[")return z();if($.substring(X,X+4)==="null"||g4.NULL&T&&W-X<4&&"null".startsWith($.substring(X)))return X+=4,null;if($.substring(X,X+4)==="true"||g4.BOOL&T&&W-X<4&&"true".startsWith($.substring(X)))return X+=4,!0;if($.substring(X,X+5)==="false"||g4.BOOL&T&&W-X<5&&"false".startsWith($.substring(X)))return X+=5,!1;if($.substring(X,X+8)==="Infinity"||g4.INFINITY&T&&W-X<8&&"Infinity".startsWith($.substring(X)))return X+=8,1/0;if($.substring(X,X+9)==="-Infinity"||g4.MINUS_INFINITY&T&&1<W-X&&W-X<9&&"-Infinity".startsWith($.substring(X)))return X+=9,-1/0;if($.substring(X,X+3)==="NaN"||g4.NAN&T&&W-X<3&&"NaN".startsWith($.substring(X)))return X+=3,NaN;return F()},G=()=>{let Q=X,Z=!1;X++;while(X<W&&($[X]!=='"'||Z&&$[X-1]==="\\"))Z=$[X]==="\\"?!Z:!1,X++;if($.charAt(X)=='"')try{return JSON.parse($.substring(Q,++X-Number(Z)))}catch(K){w(String(K))}else if(g4.STR&T)try{return JSON.parse($.substring(Q,X-Number(Z))+'"')}catch(K){return JSON.parse($.substring(Q,$.lastIndexOf("\\"))+'"')}U("Unterminated string literal")},H=()=>{X++,O();let Q={};try{while($[X]!=="}"){if(O(),X>=W&&g4.OBJ&T)return Q;let Z=G();O(),X++;try{let K=Y();Object.defineProperty(Q,Z,{value:K,writable:!0,enumerable:!0,configurable:!0})}catch(K){if(g4.OBJ&T)return Q;else throw K}if(O(),$[X]===",")X++}}catch(Z){if(g4.OBJ&T)return Q;else U("Expected '}' at end of object")}return X++,Q},z=()=>{X++;let Q=[];try{while($[X]!=="]")if(Q.push(Y()),O(),$[X]===",")X++}catch(Z){if(g4.ARR&T)return Q;U("Expected ']' at end of array")}return X++,Q},F=()=>{if(X===0){if($==="-"&&g4.NUM&T)U("Not sure what '-' is");try{return JSON.parse($)}catch(Z){if(g4.NUM&T)try{if($[$.length-1]===".")return JSON.parse($.substring(0,$.lastIndexOf(".")));return JSON.parse($.substring(0,$.lastIndexOf("e")))}catch(K){}w(String(Z))}}let Q=X;if($[X]==="-")X++;while($[X]&&!",]}".includes($[X]))X++;if(X==W&&!(g4.NUM&T))U("Unterminated number literal");try{return JSON.parse($.substring(Q,X))}catch(Z){if($.substring(Q,X)==="-"&&g4.NUM&T)U("Not sure what '-' is");try{return JSON.parse($.substring(Q,$.lastIndexOf("e")))}catch(K){w(String(K))}}},O=()=>{while(X<W&&`
|
|
68
|
-
\r `.includes($[
|
|
69
|
-
${
|
|
70
|
-
${
|
|
71
|
-
${
|
|
72
|
-
${RG($)}`);return{...T$,id:g,type:b,function:{...w$,name:j,arguments:N$}}})}};return{...Z,message:{...L,content:K,role:J,refusal:z.refusal??null},finish_reason:F,index:O,logprobs:Q}}),created:U,model:w,object:"chat.completion",...Y?{system_fingerprint:Y}:{}};return iA(H,T)}function RG($){return JSON.stringify($)}function UE($){return}function XE($){}class G2 extends HT{static fromReadableStream($){let T=new G2(null);return T._run(()=>T._fromReadableStream($)),T}static runTools($,T,W){let X=new G2(T),U={...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"runTools"}};return X._run(()=>X._runTools($,T,U)),X}}class FT extends m{constructor(){super(...arguments);this.messages=new U2(this._client)}create($,T){return this._client.post("/chat/completions",{body:$,...T,stream:$.stream??!1})}retrieve($,T){return this._client.get(h`/chat/completions/${$}`,T)}update($,T,W){return this._client.post(h`/chat/completions/${$}`,{body:T,...W})}list($={},T){return this._client.getAPIList("/chat/completions",J$,{query:$,...T})}delete($,T){return this._client.delete(h`/chat/completions/${$}`,T)}parse($,T){return aA($.tools),this._client.chat.completions.create($,{...T,headers:{...T?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap((W)=>mX(W,$))}runTools($,T){if($.stream)return G2.runTools(this._client,$,T);return uX.runTools(this._client,$,T)}stream($,T){return HT.createChatCompletion(this._client,$,T)}}FT.Messages=U2;class eT extends m{constructor(){super(...arguments);this.completions=new FT(this._client)}}eT.Completions=FT;var YE=Symbol("brand.privateNullableHeaders"),wE=Array.isArray;function*Gj($){if(!$)return;if(YE in $){let{values:X,nulls:U}=$;yield*X.entries();for(let w of U)yield[w,null];return}let T=!1,W;if($ instanceof Headers)W=$.entries();else if(wE($))W=$;else T=!0,W=Object.entries($??{});for(let X of W){let U=X[0];if(typeof U!=="string")throw new TypeError("expected header name to be a string");let w=wE(X[1])?X[1]:[X[1]],Y=!1;for(let G of w){if(G===void 0)continue;if(T&&!Y)Y=!0,yield[U,null];yield[U,G]}}}var s=($)=>{let T=new Headers,W=new Set;for(let X of $){let U=new Set;for(let[w,Y]of Gj(X)){let G=w.toLowerCase();if(!U.has(G))T.delete(w),U.add(G);if(Y===null)T.delete(w),W.add(G);else T.append(w,Y),W.delete(G)}}return{[YE]:!0,values:T,nulls:W}};class pX extends m{create($,T){return this._client.post("/audio/speech",{body:$,...T,headers:s([{Accept:"application/octet-stream"},T?.headers]),__binaryResponse:!0})}}class dX extends m{create($,T){return this._client.post("/audio/transcriptions",W1({body:$,...T,stream:$.stream??!1,__metadata:{model:$.model}},this._client))}}class oX extends m{create($,T){return this._client.post("/audio/translations",W1({body:$,...T,__metadata:{model:$.model}},this._client))}}class J0 extends m{constructor(){super(...arguments);this.transcriptions=new dX(this._client),this.translations=new oX(this._client),this.speech=new pX(this._client)}}J0.Transcriptions=dX;J0.Translations=oX;J0.Speech=pX;class z2 extends m{create($,T){return this._client.post("/batches",{body:$,...T})}retrieve($,T){return this._client.get(h`/batches/${$}`,T)}list($={},T){return this._client.getAPIList("/batches",J$,{query:$,...T})}cancel($,T){return this._client.post(h`/batches/${$}/cancel`,T)}}class lX extends m{create($,T){return this._client.post("/assistants",{body:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}retrieve($,T){return this._client.get(h`/assistants/${$}`,{...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}update($,T,W){return this._client.post(h`/assistants/${$}`,{body:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($={},T){return this._client.getAPIList("/assistants",J$,{query:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}delete($,T){return this._client.delete(h`/assistants/${$}`,{...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}}class rX extends m{create($,T){return this._client.post("/realtime/sessions",{body:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}}class nX extends m{create($,T){return this._client.post("/realtime/transcription_sessions",{body:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}}class $W extends m{constructor(){super(...arguments);this.sessions=new rX(this._client),this.transcriptionSessions=new nX(this._client)}}$W.Sessions=rX;$W.TranscriptionSessions=nX;class iX extends m{create($,T,W){return this._client.post(h`/threads/${$}/messages`,{body:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}retrieve($,T,W){let{thread_id:X}=T;return this._client.get(h`/threads/${X}/messages/${$}`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}update($,T,W){let{thread_id:X,...U}=T;return this._client.post(h`/threads/${X}/messages/${$}`,{body:U,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($,T={},W){return this._client.getAPIList(h`/threads/${$}/messages`,J$,{query:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}delete($,T,W){let{thread_id:X}=T;return this._client.delete(h`/threads/${X}/messages/${$}`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}}class tX extends m{retrieve($,T,W){let{thread_id:X,run_id:U,...w}=T;return this._client.get(h`/threads/${X}/runs/${U}/steps/${$}`,{query:w,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($,T,W){let{thread_id:X,...U}=T;return this._client.getAPIList(h`/threads/${X}/runs/${$}/steps`,J$,{query:U,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}}var GE=($)=>{if(typeof Buffer!=="undefined"){let T=Buffer.from($,"base64");return Array.from(new Float32Array(T.buffer,T.byteOffset,T.length/Float32Array.BYTES_PER_ELEMENT))}else{let T=atob($),W=T.length,X=new Uint8Array(W);for(let U=0;U<W;U++)X[U]=T.charCodeAt(U);return Array.from(new Float32Array(X.buffer))}};var TW=($)=>{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 o4,UW,rF,i1,_G,S1,XW,H2,WW,PG,U1,kG,vG,eX,aX,sX,zE,HE,FE,OE,QE,ZE,VE;class OT extends aT{constructor(){super(...arguments);o4.add(this),rF.set(this,[]),i1.set(this,{}),_G.set(this,{}),S1.set(this,void 0),XW.set(this,void 0),H2.set(this,void 0),WW.set(this,void 0),PG.set(this,void 0),U1.set(this,void 0),kG.set(this,void 0),vG.set(this,void 0),eX.set(this,void 0)}[(rF=new WeakMap,i1=new WeakMap,_G=new WeakMap,S1=new WeakMap,XW=new WeakMap,H2=new WeakMap,WW=new WeakMap,PG=new WeakMap,U1=new WeakMap,kG=new WeakMap,vG=new WeakMap,eX=new WeakMap,o4=new WeakSet,Symbol.asyncIterator)](){let $=[],T=[],W=!1;return this.on("event",(X)=>{let U=T.shift();if(U)U.resolve(X);else $.push(X)}),this.on("end",()=>{W=!0;for(let X of T)X.resolve(void 0);T.length=0}),this.on("abort",(X)=>{W=!0;for(let U of T)U.reject(X);T.length=0}),this.on("error",(X)=>{W=!0;for(let U of T)U.reject(X);T.length=0}),{next:async()=>{if(!$.length){if(W)return{value:void 0,done:!0};return new Promise((U,w)=>T.push({resolve:U,reject:w})).then((U)=>U?{value:U,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 T=new UW;return T._run(()=>T._fromReadableStream($)),T}async _fromReadableStream($,T){let W=T?.signal;if(W){if(W.aborted)this.controller.abort();W.addEventListener("abort",()=>this.controller.abort())}this._connected();let X=T1.fromReadableStream($,this.controller);for await(let U of X)v(this,o4,"m",aX).call(this,U);if(X.controller.signal?.aborted)throw new q4;return this._addRun(v(this,o4,"m",sX).call(this))}toReadableStream(){return new T1(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream($,T,W,X){let U=new UW;return U._run(()=>U._runToolAssistantStream($,T,W,{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),U}async _createToolAssistantStream($,T,W,X){let U=X?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}let w={...W,stream:!0},Y=await $.submitToolOutputs(T,w,{...X,signal:this.controller.signal});this._connected();for await(let G of Y)v(this,o4,"m",aX).call(this,G);if(Y.controller.signal?.aborted)throw new q4;return this._addRun(v(this,o4,"m",sX).call(this))}static createThreadAssistantStream($,T,W){let X=new UW;return X._run(()=>X._threadAssistantStream($,T,{...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"stream"}})),X}static createAssistantStream($,T,W,X){let U=new UW;return U._run(()=>U._runAssistantStream($,T,W,{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),U}currentEvent(){return v(this,kG,"f")}currentRun(){return v(this,vG,"f")}currentMessageSnapshot(){return v(this,S1,"f")}currentRunStepSnapshot(){return v(this,eX,"f")}async finalRunSteps(){return await this.done(),Object.values(v(this,i1,"f"))}async finalMessages(){return await this.done(),Object.values(v(this,_G,"f"))}async finalRun(){if(await this.done(),!v(this,XW,"f"))throw Error("Final run was not received.");return v(this,XW,"f")}async _createThreadAssistantStream($,T,W){let X=W?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}let U={...T,stream:!0},w=await $.createAndRun(U,{...W,signal:this.controller.signal});this._connected();for await(let Y of w)v(this,o4,"m",aX).call(this,Y);if(w.controller.signal?.aborted)throw new q4;return this._addRun(v(this,o4,"m",sX).call(this))}async _createAssistantStream($,T,W,X){let U=X?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}let w={...W,stream:!0},Y=await $.create(T,w,{...X,signal:this.controller.signal});this._connected();for await(let G of Y)v(this,o4,"m",aX).call(this,G);if(Y.controller.signal?.aborted)throw new q4;return this._addRun(v(this,o4,"m",sX).call(this))}static accumulateDelta($,T){for(let[W,X]of Object.entries(T)){if(!$.hasOwnProperty(W)){$[W]=X;continue}let U=$[W];if(U===null||U===void 0){$[W]=X;continue}if(W==="index"||W==="type"){$[W]=X;continue}if(typeof U==="string"&&typeof X==="string")U+=X;else if(typeof U==="number"&&typeof X==="number")U+=X;else if(CX(U)&&CX(X))U=this.accumulateDelta(U,X);else if(Array.isArray(U)&&Array.isArray(X)){if(U.every((w)=>typeof w==="string"||typeof w==="number")){U.push(...X);continue}for(let w of X){if(!CX(w))throw new Error(`Expected array delta entry to be an object but got: ${w}`);let Y=w.index;if(Y==null)throw console.error(w),new Error("Expected array delta entry to have an `index` property");if(typeof Y!=="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${Y}`);let G=U[Y];if(G==null)U.push(w);else U[Y]=this.accumulateDelta(G,w)}continue}else throw Error(`Unhandled record type: ${W}, deltaValue: ${X}, accValue: ${U}`);$[W]=U}return $}_addRun($){return $}async _threadAssistantStream($,T,W){return await this._createThreadAssistantStream(T,$,W)}async _runAssistantStream($,T,W,X){return await this._createAssistantStream(T,$,W,X)}async _runToolAssistantStream($,T,W,X){return await this._createToolAssistantStream(T,$,W,X)}}UW=OT,aX=function $(T){if(this.ended)return;switch(X$(this,kG,T,"f"),v(this,o4,"m",FE).call(this,T),T.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":v(this,o4,"m",VE).call(this,T);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":v(this,o4,"m",HE).call(this,T);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":v(this,o4,"m",zE).call(this,T);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:Ej(T)}},sX=function $(){if(this.ended)throw new $$("stream has ended, this shouldn't happen");if(!v(this,XW,"f"))throw Error("Final run has not been received");return v(this,XW,"f")},zE=function $(T){let[W,X]=v(this,o4,"m",QE).call(this,T,v(this,S1,"f"));X$(this,S1,W,"f"),v(this,_G,"f")[W.id]=W;for(let U of X){let w=W.content[U.index];if(w?.type=="text")this._emit("textCreated",w.text)}switch(T.event){case"thread.message.created":this._emit("messageCreated",T.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",T.data.delta,W),T.data.delta.content)for(let U of T.data.delta.content){if(U.type=="text"&&U.text){let w=U.text,Y=W.content[U.index];if(Y&&Y.type=="text")this._emit("textDelta",w,Y.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(U.index!=v(this,H2,"f")){if(v(this,WW,"f"))switch(v(this,WW,"f").type){case"text":this._emit("textDone",v(this,WW,"f").text,v(this,S1,"f"));break;case"image_file":this._emit("imageFileDone",v(this,WW,"f").image_file,v(this,S1,"f"));break}X$(this,H2,U.index,"f")}X$(this,WW,W.content[U.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(v(this,H2,"f")!==void 0){let U=T.data.content[v(this,H2,"f")];if(U)switch(U.type){case"image_file":this._emit("imageFileDone",U.image_file,v(this,S1,"f"));break;case"text":this._emit("textDone",U.text,v(this,S1,"f"));break}}if(v(this,S1,"f"))this._emit("messageDone",T.data);X$(this,S1,void 0,"f")}},HE=function $(T){let W=v(this,o4,"m",OE).call(this,T);switch(X$(this,eX,W,"f"),T.event){case"thread.run.step.created":this._emit("runStepCreated",T.data);break;case"thread.run.step.delta":let X=T.data.delta;if(X.step_details&&X.step_details.type=="tool_calls"&&X.step_details.tool_calls&&W.step_details.type=="tool_calls")for(let w of X.step_details.tool_calls)if(w.index==v(this,PG,"f"))this._emit("toolCallDelta",w,W.step_details.tool_calls[w.index]);else{if(v(this,U1,"f"))this._emit("toolCallDone",v(this,U1,"f"));if(X$(this,PG,w.index,"f"),X$(this,U1,W.step_details.tool_calls[w.index],"f"),v(this,U1,"f"))this._emit("toolCallCreated",v(this,U1,"f"))}this._emit("runStepDelta",T.data.delta,W);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":if(X$(this,eX,void 0,"f"),T.data.step_details.type=="tool_calls"){if(v(this,U1,"f"))this._emit("toolCallDone",v(this,U1,"f")),X$(this,U1,void 0,"f")}this._emit("runStepDone",T.data,W);break;case"thread.run.step.in_progress":break}},FE=function $(T){v(this,rF,"f").push(T),this._emit("event",T)},OE=function $(T){switch(T.event){case"thread.run.step.created":return v(this,i1,"f")[T.data.id]=T.data,T.data;case"thread.run.step.delta":let W=v(this,i1,"f")[T.data.id];if(!W)throw Error("Received a RunStepDelta before creation of a snapshot");let X=T.data;if(X.delta){let U=UW.accumulateDelta(W,X.delta);v(this,i1,"f")[T.data.id]=U}return v(this,i1,"f")[T.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":v(this,i1,"f")[T.data.id]=T.data;break}if(v(this,i1,"f")[T.data.id])return v(this,i1,"f")[T.data.id];throw new Error("No snapshot available")},QE=function $(T,W){let X=[];switch(T.event){case"thread.message.created":return[T.data,X];case"thread.message.delta":if(!W)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let U=T.data;if(U.delta.content)for(let w of U.delta.content)if(w.index in W.content){let Y=W.content[w.index];W.content[w.index]=v(this,o4,"m",ZE).call(this,w,Y)}else W.content[w.index]=w,X.push(w);return[W,X];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(W)return[W,X];else throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},ZE=function $(T,W){return UW.accumulateDelta(W,T)},VE=function $(T){switch(X$(this,vG,T.data,"f"),T.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(X$(this,XW,T.data,"f"),v(this,U1,"f"))this._emit("toolCallDone",v(this,U1,"f")),X$(this,U1,void 0,"f");break;case"thread.run.cancelling":break}};function Ej($){}class F2 extends m{constructor(){super(...arguments);this.steps=new tX(this._client)}create($,T,W){let{include:X,...U}=T;return this._client.post(h`/threads/${$}/runs`,{query:{include:X},body:U,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers]),stream:T.stream??!1})}retrieve($,T,W){let{thread_id:X}=T;return this._client.get(h`/threads/${X}/runs/${$}`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}update($,T,W){let{thread_id:X,...U}=T;return this._client.post(h`/threads/${X}/runs/${$}`,{body:U,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($,T={},W){return this._client.getAPIList(h`/threads/${$}/runs`,J$,{query:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}cancel($,T,W){let{thread_id:X}=T;return this._client.post(h`/threads/${X}/runs/${$}/cancel`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}async createAndPoll($,T,W){let X=await this.create($,T,W);return await this.poll(X.id,{thread_id:$},W)}createAndStream($,T,W){return OT.createAssistantStream($,this._client.beta.threads.runs,T,W)}async poll($,T,W){let X=s([W?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":W?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:U,response:w}=await this.retrieve($,T,{...W,headers:{...W?.headers,...X}}).withResponse();switch(U.status){case"queued":case"in_progress":case"cancelling":let Y=5000;if(W?.pollIntervalMs)Y=W.pollIntervalMs;else{let G=w.headers.get("openai-poll-after-ms");if(G){let H=parseInt(G);if(!isNaN(H))Y=H}}await l1(Y);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return U}}}stream($,T,W){return OT.createAssistantStream($,this._client.beta.threads.runs,T,W)}submitToolOutputs($,T,W){let{thread_id:X,...U}=T;return this._client.post(h`/threads/${X}/runs/${$}/submit_tool_outputs`,{body:U,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers]),stream:T.stream??!1})}async submitToolOutputsAndPoll($,T,W){let X=await this.submitToolOutputs($,T,W);return await this.poll(X.id,T,W)}submitToolOutputsStream($,T,W){return OT.createToolAssistantStream($,this._client.beta.threads.runs,T,W)}}F2.Steps=tX;class wW extends m{constructor(){super(...arguments);this.runs=new F2(this._client),this.messages=new iX(this._client)}create($={},T){return this._client.post("/threads",{body:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}retrieve($,T){return this._client.get(h`/threads/${$}`,{...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}update($,T,W){return this._client.post(h`/threads/${$}`,{body:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}delete($,T){return this._client.delete(h`/threads/${$}`,{...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}createAndRun($,T){return this._client.post("/threads/runs",{body:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers]),stream:$.stream??!1})}async createAndRunPoll($,T){let W=await this.createAndRun($,T);return await this.runs.poll(W.id,{thread_id:W.thread_id},T)}createAndRunStream($,T){return OT.createThreadAssistantStream($,this._client.beta.threads,T)}}wW.Runs=F2;wW.Messages=iX;class R0 extends m{constructor(){super(...arguments);this.realtime=new $W(this._client),this.assistants=new lX(this._client),this.threads=new wW(this._client)}}R0.Realtime=$W;R0.Assistants=lX;R0.Threads=wW;class O2 extends m{create($,T){return this._client.post("/completions",{body:$,...T,stream:$.stream??!1})}}class $w extends m{retrieve($,T,W){let{container_id:X}=T;return this._client.get(h`/containers/${X}/files/${$}/content`,{...W,headers:s([{Accept:"application/binary"},W?.headers]),__binaryResponse:!0})}}class Q2 extends m{constructor(){super(...arguments);this.content=new $w(this._client)}create($,T,W){return this._client.post(h`/containers/${$}/files`,W1({body:T,...W},this._client))}retrieve($,T,W){let{container_id:X}=T;return this._client.get(h`/containers/${X}/files/${$}`,W)}list($,T={},W){return this._client.getAPIList(h`/containers/${$}/files`,J$,{query:T,...W})}delete($,T,W){let{container_id:X}=T;return this._client.delete(h`/containers/${X}/files/${$}`,{...W,headers:s([{Accept:"*/*"},W?.headers])})}}Q2.Content=$w;class YW extends m{constructor(){super(...arguments);this.files=new Q2(this._client)}create($,T){return this._client.post("/containers",{body:$,...T})}retrieve($,T){return this._client.get(h`/containers/${$}`,T)}list($={},T){return this._client.getAPIList("/containers",J$,{query:$,...T})}delete($,T){return this._client.delete(h`/containers/${$}`,{...T,headers:s([{Accept:"*/*"},T?.headers])})}}YW.Files=Q2;class Z2 extends m{create($,T){let W=!!$.encoding_format,X=W?$.encoding_format:"base64";if(W)C4(this._client).debug("embeddings/user defined encoding_format:",$.encoding_format);let U=this._client.post("/embeddings",{body:{...$,encoding_format:X},...T});if(W)return U;return C4(this._client).debug("embeddings/decoding base64 embeddings from base64"),U._thenUnwrap((w)=>{if(w&&w.data)w.data.forEach((Y)=>{let G=Y.embedding;Y.embedding=GE(G)});return w})}}class Tw extends m{retrieve($,T,W){let{eval_id:X,run_id:U}=T;return this._client.get(h`/evals/${X}/runs/${U}/output_items/${$}`,W)}list($,T,W){let{eval_id:X,...U}=T;return this._client.getAPIList(h`/evals/${X}/runs/${$}/output_items`,J$,{query:U,...W})}}class V2 extends m{constructor(){super(...arguments);this.outputItems=new Tw(this._client)}create($,T,W){return this._client.post(h`/evals/${$}/runs`,{body:T,...W})}retrieve($,T,W){let{eval_id:X}=T;return this._client.get(h`/evals/${X}/runs/${$}`,W)}list($,T={},W){return this._client.getAPIList(h`/evals/${$}/runs`,J$,{query:T,...W})}delete($,T,W){let{eval_id:X}=T;return this._client.delete(h`/evals/${X}/runs/${$}`,W)}cancel($,T,W){let{eval_id:X}=T;return this._client.post(h`/evals/${X}/runs/${$}`,W)}}V2.OutputItems=Tw;class GW extends m{constructor(){super(...arguments);this.runs=new V2(this._client)}create($,T){return this._client.post("/evals",{body:$,...T})}retrieve($,T){return this._client.get(h`/evals/${$}`,T)}update($,T,W){return this._client.post(h`/evals/${$}`,{body:T,...W})}list($={},T){return this._client.getAPIList("/evals",J$,{query:$,...T})}delete($,T){return this._client.delete(h`/evals/${$}`,T)}}GW.Runs=V2;class K2 extends m{create($,T){return this._client.post("/files",W1({body:$,...T},this._client))}retrieve($,T){return this._client.get(h`/files/${$}`,T)}list($={},T){return this._client.getAPIList("/files",J$,{query:$,...T})}delete($,T){return this._client.delete(h`/files/${$}`,T)}content($,T){return this._client.get(h`/files/${$}/content`,{...T,headers:s([{Accept:"application/binary"},T?.headers]),__binaryResponse:!0})}async waitForProcessing($,{pollInterval:T=5000,maxWait:W=1800000}={}){let X=new Set(["processed","error","deleted"]),U=Date.now(),w=await this.retrieve($);while(!w.status||!X.has(w.status))if(await l1(T),w=await this.retrieve($),Date.now()-U>W)throw new iT({message:`Giving up on waiting for file ${$} to finish processing after ${W} milliseconds.`});return w}}class Ww extends m{}class Uw extends m{run($,T){return this._client.post("/fine_tuning/alpha/graders/run",{body:$,...T})}validate($,T){return this._client.post("/fine_tuning/alpha/graders/validate",{body:$,...T})}}class A2 extends m{constructor(){super(...arguments);this.graders=new Uw(this._client)}}A2.Graders=Uw;class Xw extends m{create($,T,W){return this._client.getAPIList(h`/fine_tuning/checkpoints/${$}/permissions`,D0,{body:T,method:"post",...W})}retrieve($,T={},W){return this._client.get(h`/fine_tuning/checkpoints/${$}/permissions`,{query:T,...W})}delete($,T,W){let{fine_tuned_model_checkpoint:X}=T;return this._client.delete(h`/fine_tuning/checkpoints/${X}/permissions/${$}`,W)}}class E2 extends m{constructor(){super(...arguments);this.permissions=new Xw(this._client)}}E2.Permissions=Xw;class ww extends m{list($,T={},W){return this._client.getAPIList(h`/fine_tuning/jobs/${$}/checkpoints`,J$,{query:T,...W})}}class M2 extends m{constructor(){super(...arguments);this.checkpoints=new ww(this._client)}create($,T){return this._client.post("/fine_tuning/jobs",{body:$,...T})}retrieve($,T){return this._client.get(h`/fine_tuning/jobs/${$}`,T)}list($={},T){return this._client.getAPIList("/fine_tuning/jobs",J$,{query:$,...T})}cancel($,T){return this._client.post(h`/fine_tuning/jobs/${$}/cancel`,T)}listEvents($,T={},W){return this._client.getAPIList(h`/fine_tuning/jobs/${$}/events`,J$,{query:T,...W})}pause($,T){return this._client.post(h`/fine_tuning/jobs/${$}/pause`,T)}resume($,T){return this._client.post(h`/fine_tuning/jobs/${$}/resume`,T)}}M2.Checkpoints=ww;class t1 extends m{constructor(){super(...arguments);this.methods=new Ww(this._client),this.jobs=new M2(this._client),this.checkpoints=new E2(this._client),this.alpha=new A2(this._client)}}t1.Methods=Ww;t1.Jobs=M2;t1.Checkpoints=E2;t1.Alpha=A2;class Yw extends m{}class zW extends m{constructor(){super(...arguments);this.graderModels=new Yw(this._client)}}zW.GraderModels=Yw;class D2 extends m{createVariation($,T){return this._client.post("/images/variations",W1({body:$,...T},this._client))}edit($,T){return this._client.post("/images/edits",W1({body:$,...T},this._client))}generate($,T){return this._client.post("/images/generations",{body:$,...T})}}class N2 extends m{retrieve($,T){return this._client.get(h`/models/${$}`,T)}list($){return this._client.getAPIList("/models",D0,$)}delete($,T){return this._client.delete(h`/models/${$}`,T)}}class L2 extends m{create($,T){return this._client.post("/moderations",{body:$,...T})}}function KE($,T){if(!T||!Bj(T))return{...$,output_parsed:null,output:$.output.map((W)=>{if(W.type==="function_call")return{...W,parsed_arguments:null};if(W.type==="message")return{...W,content:W.content.map((X)=>({...X,parsed:null}))};else return W})};return nF($,T)}function nF($,T){let W=$.output.map((U)=>{if(U.type==="function_call")return{...U,parsed_arguments:bj(T,U)};if(U.type==="message"){let w=U.content.map((Y)=>{if(Y.type==="output_text")return{...Y,parsed:Ij(T,Y.text)};return Y});return{...U,content:w}}return U}),X=Object.assign({},$,{output:W});if(!Object.getOwnPropertyDescriptor($,"output_text"))iF(X);return Object.defineProperty(X,"output_parsed",{enumerable:!0,get(){for(let U of X.output){if(U.type!=="message")continue;for(let w of U.content)if(w.type==="output_text"&&w.parsed!==null)return w.parsed}return null}}),X}function Ij($,T){if($.text?.format?.type!=="json_schema")return null;if("$parseRaw"in $.text?.format)return($.text?.format).$parseRaw(T);return JSON.parse(T)}function Bj($){if(gX($.text?.format))return!0;return!1}function xj($){return $?.$brand==="auto-parseable-tool"}function fj($,T){return $.find((W)=>W.type==="function"&&W.name===T)}function bj($,T){let W=fj($.tools??[],T.name);return{...T,...T,parsed_arguments:xj(W)?W.$parseRaw(T.arguments):W?.strict?JSON.parse(T.arguments):null}}function iF($){let T=[];for(let W of $.output){if(W.type!=="message")continue;for(let X of W.content)if(X.type==="output_text")T.push(X.text)}$.output_text=T.join("")}var J2,qG,QT,CG,AE,EE,ME,DE;class SG extends aT{constructor($){super();J2.add(this),qG.set(this,void 0),QT.set(this,void 0),CG.set(this,void 0),X$(this,qG,$,"f")}static createResponse($,T,W){let X=new SG(T);return X._run(()=>X._createOrRetrieveResponse($,T,{...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"stream"}})),X}async _createOrRetrieveResponse($,T,W){let X=W?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}v(this,J2,"m",AE).call(this);let U,w=null;if("response_id"in T)U=await $.responses.retrieve(T.response_id,{stream:!0},{...W,signal:this.controller.signal,stream:!0}),w=T.starting_after??null;else U=await $.responses.create({...T,stream:!0},{...W,signal:this.controller.signal});this._connected();for await(let Y of U)v(this,J2,"m",EE).call(this,Y,w);if(U.controller.signal?.aborted)throw new q4;return v(this,J2,"m",ME).call(this)}[(qG=new WeakMap,QT=new WeakMap,CG=new WeakMap,J2=new WeakSet,AE=function $(){if(this.ended)return;X$(this,QT,void 0,"f")},EE=function $(T,W){if(this.ended)return;let X=(w,Y)=>{if(W==null||Y.sequence_number>W)this._emit(w,Y)},U=v(this,J2,"m",DE).call(this,T);switch(X("event",T),T.type){case"response.output_text.delta":{let w=U.output[T.output_index];if(!w)throw new $$(`missing output at index ${T.output_index}`);if(w.type==="message"){let Y=w.content[T.content_index];if(!Y)throw new $$(`missing content at index ${T.content_index}`);if(Y.type!=="output_text")throw new $$(`expected content to be 'output_text', got ${Y.type}`);X("response.output_text.delta",{...T,snapshot:Y.text})}break}case"response.function_call_arguments.delta":{let w=U.output[T.output_index];if(!w)throw new $$(`missing output at index ${T.output_index}`);if(w.type==="function_call")X("response.function_call_arguments.delta",{...T,snapshot:w.arguments});break}default:X(T.type,T);break}},ME=function $(){if(this.ended)throw new $$("stream has ended, this shouldn't happen");let T=v(this,QT,"f");if(!T)throw new $$("request ended without sending any events");X$(this,QT,void 0,"f");let W=yj(T,v(this,qG,"f"));return X$(this,CG,W,"f"),W},DE=function $(T){let W=v(this,QT,"f");if(!W){if(T.type!=="response.created")throw new $$(`When snapshot hasn't been set yet, expected 'response.created' event, got ${T.type}`);return W=X$(this,QT,T.response,"f"),W}switch(T.type){case"response.output_item.added":{W.output.push(T.item);break}case"response.content_part.added":{let X=W.output[T.output_index];if(!X)throw new $$(`missing output at index ${T.output_index}`);if(X.type==="message")X.content.push(T.part);break}case"response.output_text.delta":{let X=W.output[T.output_index];if(!X)throw new $$(`missing output at index ${T.output_index}`);if(X.type==="message"){let U=X.content[T.content_index];if(!U)throw new $$(`missing content at index ${T.content_index}`);if(U.type!=="output_text")throw new $$(`expected content to be 'output_text', got ${U.type}`);U.text+=T.delta}break}case"response.function_call_arguments.delta":{let X=W.output[T.output_index];if(!X)throw new $$(`missing output at index ${T.output_index}`);if(X.type==="function_call")X.arguments+=T.delta;break}case"response.completed":{X$(this,QT,T.response,"f");break}}return W},Symbol.asyncIterator)](){let $=[],T=[],W=!1;return this.on("event",(X)=>{let U=T.shift();if(U)U.resolve(X);else $.push(X)}),this.on("end",()=>{W=!0;for(let X of T)X.resolve(void 0);T.length=0}),this.on("abort",(X)=>{W=!0;for(let U of T)U.reject(X);T.length=0}),this.on("error",(X)=>{W=!0;for(let U of T)U.reject(X);T.length=0}),{next:async()=>{if(!$.length){if(W)return{value:void 0,done:!0};return new Promise((U,w)=>T.push({resolve:U,reject:w})).then((U)=>U?{value:U,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 $=v(this,CG,"f");if(!$)throw new $$("stream ended without producing a ChatCompletion");return $}}function yj($,T){return KE($,T)}class Gw extends m{list($,T={},W){return this._client.getAPIList(h`/responses/${$}/input_items`,J$,{query:T,...W})}}class HW extends m{constructor(){super(...arguments);this.inputItems=new Gw(this._client)}create($,T){return this._client.post("/responses",{body:$,...T,stream:$.stream??!1})._thenUnwrap((W)=>{if("object"in W&&W.object==="response")iF(W);return W})}retrieve($,T={},W){return this._client.get(h`/responses/${$}`,{query:T,...W,stream:T?.stream??!1})}delete($,T){return this._client.delete(h`/responses/${$}`,{...T,headers:s([{Accept:"*/*"},T?.headers])})}parse($,T){return this._client.responses.create($,T)._thenUnwrap((W)=>nF(W,$))}stream($,T){return SG.createResponse(this._client,$,T)}cancel($,T){return this._client.post(h`/responses/${$}/cancel`,T)}}HW.InputItems=Gw;class zw extends m{create($,T,W){return this._client.post(h`/uploads/${$}/parts`,W1({body:T,...W},this._client))}}class FW extends m{constructor(){super(...arguments);this.parts=new zw(this._client)}create($,T){return this._client.post("/uploads",{body:$,...T})}cancel($,T){return this._client.post(h`/uploads/${$}/cancel`,T)}complete($,T,W){return this._client.post(h`/uploads/${$}/complete`,{body:T,...W})}}FW.Parts=zw;var NE=async($)=>{let T=await Promise.allSettled($),W=T.filter((U)=>U.status==="rejected");if(W.length){for(let U of W)console.error(U.reason);throw new Error(`${W.length} promise(s) failed - see the above errors`)}let X=[];for(let U of T)if(U.status==="fulfilled")X.push(U.value);return X};class Hw extends m{create($,T,W){return this._client.post(h`/vector_stores/${$}/file_batches`,{body:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}retrieve($,T,W){let{vector_store_id:X}=T;return this._client.get(h`/vector_stores/${X}/file_batches/${$}`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}cancel($,T,W){let{vector_store_id:X}=T;return this._client.post(h`/vector_stores/${X}/file_batches/${$}/cancel`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}async createAndPoll($,T,W){let X=await this.create($,T);return await this.poll($,X.id,W)}listFiles($,T,W){let{vector_store_id:X,...U}=T;return this._client.getAPIList(h`/vector_stores/${X}/file_batches/${$}/files`,J$,{query:U,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}async poll($,T,W){let X=s([W?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":W?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:U,response:w}=await this.retrieve(T,{vector_store_id:$},{...W,headers:X}).withResponse();switch(U.status){case"in_progress":let Y=5000;if(W?.pollIntervalMs)Y=W.pollIntervalMs;else{let G=w.headers.get("openai-poll-after-ms");if(G){let H=parseInt(G);if(!isNaN(H))Y=H}}await l1(Y);break;case"failed":case"cancelled":case"completed":return U}}}async uploadAndPoll($,{files:T,fileIds:W=[]},X){if(T==null||T.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let U=X?.maxConcurrency??5,w=Math.min(U,T.length),Y=this._client,G=T.values(),H=[...W];async function z(O){for(let Q of O){let Z=await Y.files.create({file:Q,purpose:"assistants"},X);H.push(Z.id)}}let F=Array(w).fill(G).map(z);return await NE(F),await this.createAndPoll($,{file_ids:H})}}class Fw extends m{create($,T,W){return this._client.post(h`/vector_stores/${$}/files`,{body:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}retrieve($,T,W){let{vector_store_id:X}=T;return this._client.get(h`/vector_stores/${X}/files/${$}`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}update($,T,W){let{vector_store_id:X,...U}=T;return this._client.post(h`/vector_stores/${X}/files/${$}`,{body:U,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($,T={},W){return this._client.getAPIList(h`/vector_stores/${$}/files`,J$,{query:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}delete($,T,W){let{vector_store_id:X}=T;return this._client.delete(h`/vector_stores/${X}/files/${$}`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}async createAndPoll($,T,W){let X=await this.create($,T,W);return await this.poll($,X.id,W)}async poll($,T,W){let X=s([W?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":W?.pollIntervalMs?.toString()??void 0}]);while(!0){let U=await this.retrieve(T,{vector_store_id:$},{...W,headers:X}).withResponse(),w=U.data;switch(w.status){case"in_progress":let Y=5000;if(W?.pollIntervalMs)Y=W.pollIntervalMs;else{let G=U.response.headers.get("openai-poll-after-ms");if(G){let H=parseInt(G);if(!isNaN(H))Y=H}}await l1(Y);break;case"failed":case"completed":return w}}}async upload($,T,W){let X=await this._client.files.create({file:T,purpose:"assistants"},W);return this.create($,{file_id:X.id},W)}async uploadAndPoll($,T,W){let X=await this.upload($,T,W);return await this.poll($,X.id,W)}content($,T,W){let{vector_store_id:X}=T;return this._client.getAPIList(h`/vector_stores/${X}/files/${$}/content`,D0,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}}class ZT extends m{constructor(){super(...arguments);this.files=new Fw(this._client),this.fileBatches=new Hw(this._client)}create($,T){return this._client.post("/vector_stores",{body:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}retrieve($,T){return this._client.get(h`/vector_stores/${$}`,{...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}update($,T,W){return this._client.post(h`/vector_stores/${$}`,{body:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($={},T){return this._client.getAPIList("/vector_stores",J$,{query:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}delete($,T){return this._client.delete(h`/vector_stores/${$}`,{...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}search($,T,W){return this._client.getAPIList(h`/vector_stores/${$}/search`,D0,{body:T,method:"post",...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}}ZT.Files=Fw;ZT.FileBatches=Hw;var tF,jG;class R${constructor({baseURL:$=TW("OPENAI_BASE_URL"),apiKey:T=TW("OPENAI_API_KEY"),organization:W=TW("OPENAI_ORG_ID")??null,project:X=TW("OPENAI_PROJECT_ID")??null,...U}={}){if(jG.set(this,void 0),this.completions=new O2(this),this.chat=new eT(this),this.embeddings=new Z2(this),this.files=new K2(this),this.images=new D2(this),this.audio=new J0(this),this.moderations=new L2(this),this.models=new N2(this),this.fineTuning=new t1(this),this.graders=new zW(this),this.vectorStores=new ZT(this),this.beta=new R0(this),this.batches=new z2(this),this.uploads=new FW(this),this.responses=new HW(this),this.evals=new GW(this),this.containers=new YW(this),T===void 0)throw new $$("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:T,organization:W,project:X,...U,baseURL:$||"https://api.openai.com/v1"};if(!w.dangerouslyAllowBrowser&&CA())throw new $$(`It looks like you're running in a browser-like environment.
|
|
91
|
+
${O}`)}return w},h=Xj(TE);class X2 extends m{list($,T={},W){return this._client.getAPIList(h`/chat/completions/${$}/messages`,L$,{query:T,...W})}}function WE($){return typeof $.parse==="function"}var U2=($)=>{return $?.role==="assistant"},hF=($)=>{return $?.role==="tool"};var gF,EG,MG,I8,x8,DG,f8,N0,b8,NG,JG,w2,XE;class aT{constructor(){gF.add(this),this.controller=new AbortController,EG.set(this,void 0),MG.set(this,()=>{}),I8.set(this,()=>{}),x8.set(this,void 0),DG.set(this,()=>{}),f8.set(this,()=>{}),N0.set(this,{}),b8.set(this,!1),NG.set(this,!1),JG.set(this,!1),w2.set(this,!1),U$(this,EG,new Promise(($,T)=>{U$(this,MG,$,"f"),U$(this,I8,T,"f")}),"f"),U$(this,x8,new Promise(($,T)=>{U$(this,DG,$,"f"),U$(this,f8,T,"f")}),"f"),v(this,EG,"f").catch(()=>{}),v(this,x8,"f").catch(()=>{})}_run($){setTimeout(()=>{$().then(()=>{this._emitFinal(),this._emit("end")},v(this,gF,"m",XE).bind(this))},0)}_connected(){if(this.ended)return;v(this,MG,"f").call(this),this._emit("connect")}get ended(){return v(this,b8,"f")}get errored(){return v(this,NG,"f")}get aborted(){return v(this,JG,"f")}abort(){this.controller.abort()}on($,T){return(v(this,N0,"f")[$]||(v(this,N0,"f")[$]=[])).push({listener:T}),this}off($,T){let W=v(this,N0,"f")[$];if(!W)return this;let U=W.findIndex((X)=>X.listener===T);if(U>=0)W.splice(U,1);return this}once($,T){return(v(this,N0,"f")[$]||(v(this,N0,"f")[$]=[])).push({listener:T,once:!0}),this}emitted($){return new Promise((T,W)=>{if(U$(this,w2,!0,"f"),$!=="error")this.once("error",W);this.once($,T)})}async done(){U$(this,w2,!0,"f"),await v(this,x8,"f")}_emit($,...T){if(v(this,b8,"f"))return;if($==="end")U$(this,b8,!0,"f"),v(this,DG,"f").call(this);let W=v(this,N0,"f")[$];if(W)v(this,N0,"f")[$]=W.filter((U)=>!U.once),W.forEach(({listener:U})=>U(...T));if($==="abort"){let U=T[0];if(!v(this,w2,"f")&&!W?.length)Promise.reject(U);v(this,I8,"f").call(this,U),v(this,f8,"f").call(this,U),this._emit("end");return}if($==="error"){let U=T[0];if(!v(this,w2,"f")&&!W?.length)Promise.reject(U);v(this,I8,"f").call(this,U),v(this,f8,"f").call(this,U),this._emit("end")}}_emitFinal(){}}EG=new WeakMap,MG=new WeakMap,I8=new WeakMap,x8=new WeakMap,DG=new WeakMap,f8=new WeakMap,N0=new WeakMap,b8=new WeakMap,NG=new WeakMap,JG=new WeakMap,w2=new WeakMap,gF=new WeakSet,XE=function $(T){if(U$(this,NG,!0,"f"),T instanceof Error&&T.name==="AbortError")T=new q4;if(T instanceof q4)return U$(this,JG,!0,"f"),this._emit("abort",T);if(T instanceof $$)return this._emit("error",T);if(T instanceof Error){let W=new $$(T.message);return W.cause=T,this._emit("error",W)}return this._emit("error",new $$(String(T)))};function y8($){return $?.$brand==="auto-parseable-response-format"}function sT($){return $?.$brand==="auto-parseable-tool"}function UE($,T){if(!T||!mF(T))return{...$,choices:$.choices.map((W)=>({...W,message:{...W.message,parsed:null,...W.message.tool_calls?{tool_calls:W.message.tool_calls}:void 0}}))};return h8($,T)}function h8($,T){let W=$.choices.map((U)=>{if(U.finish_reason==="length")throw new P8;if(U.finish_reason==="content_filter")throw new q8;return{...U,message:{...U.message,...U.message.tool_calls?{tool_calls:U.message.tool_calls?.map((X)=>Gj(T,X))??void 0}:void 0,parsed:U.message.content&&!U.message.refusal?Yj(T,U.message.content):null}}});return{...$,choices:W}}function Yj($,T){if($.response_format?.type!=="json_schema")return null;if($.response_format?.type==="json_schema"){if("$parseRaw"in $.response_format)return $.response_format.$parseRaw(T);return JSON.parse(T)}return null}function Gj($,T){let W=$.tools?.find((U)=>U.function?.name===T.function.name);return{...T,function:{...T.function,parsed_arguments:sT(W)?W.$parseRaw(T.function.arguments):W?.function.strict?JSON.parse(T.function.arguments):null}}}function wE($,T){if(!$)return!1;let W=$.tools?.find((U)=>U.function?.name===T.function.name);return sT(W)||W?.function.strict||!1}function mF($){if(y8($.response_format))return!0;return $.tools?.some((T)=>sT(T)||T.type==="function"&&T.function.strict===!0)??!1}function YE($){for(let T of $??[]){if(T.type!=="function")throw new $$(`Currently only \`function\` tool types support auto-parsing; Received \`${T.type}\``);if(T.function.strict!==!0)throw new $$(`The \`${T.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var F6,cF,LG,uF,pF,dF,GE,zE,zj=10;class g8 extends aT{constructor(){super(...arguments);F6.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion($){this._chatCompletions.push($),this._emit("chatCompletion",$);let T=$.choices[0]?.message;if(T)this._addMessage(T);return $}_addMessage($,T=!0){if(!("content"in $))$.content=null;if(this.messages.push($),T){if(this._emit("message",$),hF($)&&$.content)this._emit("functionToolCallResult",$.content);else if(U2($)&&$.tool_calls){for(let W of $.tool_calls)if(W.type==="function")this._emit("functionToolCall",W.function)}}}async finalChatCompletion(){await this.done();let $=this._chatCompletions[this._chatCompletions.length-1];if(!$)throw new $$("stream ended without producing a ChatCompletion");return $}async finalContent(){return await this.done(),v(this,F6,"m",cF).call(this)}async finalMessage(){return await this.done(),v(this,F6,"m",LG).call(this)}async finalFunctionToolCall(){return await this.done(),v(this,F6,"m",uF).call(this)}async finalFunctionToolCallResult(){return await this.done(),v(this,F6,"m",pF).call(this)}async totalUsage(){return await this.done(),v(this,F6,"m",dF).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let $=this._chatCompletions[this._chatCompletions.length-1];if($)this._emit("finalChatCompletion",$);let T=v(this,F6,"m",LG).call(this);if(T)this._emit("finalMessage",T);let W=v(this,F6,"m",cF).call(this);if(W)this._emit("finalContent",W);let U=v(this,F6,"m",uF).call(this);if(U)this._emit("finalFunctionToolCall",U);let X=v(this,F6,"m",pF).call(this);if(X!=null)this._emit("finalFunctionToolCallResult",X);if(this._chatCompletions.some((w)=>w.usage))this._emit("totalUsage",v(this,F6,"m",dF).call(this))}async _createChatCompletion($,T,W){let U=W?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}v(this,F6,"m",GE).call(this,T);let X=await $.chat.completions.create({...T,stream:!1},{...W,signal:this.controller.signal});return this._connected(),this._addChatCompletion(h8(X,T))}async _runChatCompletion($,T,W){for(let U of T.messages)this._addMessage(U,!1);return await this._createChatCompletion($,T,W)}async _runTools($,T,W){let{tool_choice:X="auto",stream:w,...Y}=T,G=typeof X!=="string"&&X?.function?.name,{maxChatCompletions:H=zj}=W||{},z=T.tools.map((Q)=>{if(sT(Q)){if(!Q.$callback)throw new $$("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:Q.$callback,name:Q.function.name,description:Q.function.description||"",parameters:Q.function.parameters,parse:Q.$parseRaw,strict:!0}}}return Q}),F={};for(let Q of z)if(Q.type==="function")F[Q.function.name||Q.function.function.name]=Q.function;let O="tools"in T?z.map((Q)=>Q.type==="function"?{type:"function",function:{name:Q.function.name||Q.function.function.name,parameters:Q.function.parameters,description:Q.function.description,strict:Q.function.strict}}:Q):void 0;for(let Q of T.messages)this._addMessage(Q,!1);for(let Q=0;Q<H;++Q){let V=(await this._createChatCompletion($,{...Y,tool_choice:X,tools:O,messages:[...this.messages]},W)).choices[0]?.message;if(!V)throw new $$("missing message in ChatCompletion response");if(!V.tool_calls?.length)return;for(let A of V.tool_calls){if(A.type!=="function")continue;let D=A.id,{name:J,arguments:L}=A.function,_=F[J];if(!_){let g=`Invalid tool_call: ${JSON.stringify(J)}. Available options are: ${Object.keys(F).map((T$)=>JSON.stringify(T$)).join(", ")}. Please try again`;this._addMessage({role:"tool",tool_call_id:D,content:g});continue}else if(G&&G!==J){let g=`Invalid tool_call: ${JSON.stringify(J)}. ${JSON.stringify(G)} requested. Please try again`;this._addMessage({role:"tool",tool_call_id:D,content:g});continue}let C;try{C=WE(_)?await _.parse(L):L}catch(g){let T$=g instanceof Error?g.message:String(g);this._addMessage({role:"tool",tool_call_id:D,content:T$});continue}let f=await _.function(C,this),b=v(this,F6,"m",zE).call(this,f);if(this._addMessage({role:"tool",tool_call_id:D,content:b}),G)return}}return}}F6=new WeakSet,cF=function $(){return v(this,F6,"m",LG).call(this).content??null},LG=function $(){let T=this.messages.length;while(T-- >0){let W=this.messages[T];if(U2(W))return{...W,content:W.content??null,refusal:W.refusal??null}}throw new $$("stream ended without producing a ChatCompletionMessage with role=assistant")},uF=function $(){for(let T=this.messages.length-1;T>=0;T--){let W=this.messages[T];if(U2(W)&&W?.tool_calls?.length)return W.tool_calls.at(-1)?.function}return},pF=function $(){for(let T=this.messages.length-1;T>=0;T--){let W=this.messages[T];if(hF(W)&&W.content!=null&&typeof W.content==="string"&&this.messages.some((U)=>U.role==="assistant"&&U.tool_calls?.some((X)=>X.type==="function"&&X.id===W.tool_call_id)))return W.content}return},dF=function $(){let T={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:W}of this._chatCompletions)if(W)T.completion_tokens+=W.completion_tokens,T.prompt_tokens+=W.prompt_tokens,T.total_tokens+=W.total_tokens;return T},GE=function $(T){if(T.n!=null&&T.n>1)throw new $$("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},zE=function $(T){return typeof T==="string"?T:T===void 0?"undefined":JSON.stringify(T)};class m8 extends g8{static runTools($,T,W){let U=new m8,X={...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"runTools"}};return U._run(()=>U._runTools($,T,X)),U}_addMessage($,T=!0){if(super._addMessage($,T),U2($)&&$.content)this._emit("content",$.content)}}var g4={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 HE extends Error{}class FE extends Error{}function Hj($,T=g4.ALL){if(typeof $!=="string")throw new TypeError(`expecting str, got ${typeof $}`);if(!$.trim())throw new Error(`${$} is empty`);return Fj($.trim(),T)}var Fj=($,T)=>{let W=$.length,U=0,X=(Q)=>{throw new HE(`${Q} at position ${U}`)},w=(Q)=>{throw new FE(`${Q} at position ${U}`)},Y=()=>{if(O(),U>=W)X("Unexpected end of input");if($[U]==='"')return G();if($[U]==="{")return H();if($[U]==="[")return z();if($.substring(U,U+4)==="null"||g4.NULL&T&&W-U<4&&"null".startsWith($.substring(U)))return U+=4,null;if($.substring(U,U+4)==="true"||g4.BOOL&T&&W-U<4&&"true".startsWith($.substring(U)))return U+=4,!0;if($.substring(U,U+5)==="false"||g4.BOOL&T&&W-U<5&&"false".startsWith($.substring(U)))return U+=5,!1;if($.substring(U,U+8)==="Infinity"||g4.INFINITY&T&&W-U<8&&"Infinity".startsWith($.substring(U)))return U+=8,1/0;if($.substring(U,U+9)==="-Infinity"||g4.MINUS_INFINITY&T&&1<W-U&&W-U<9&&"-Infinity".startsWith($.substring(U)))return U+=9,-1/0;if($.substring(U,U+3)==="NaN"||g4.NAN&T&&W-U<3&&"NaN".startsWith($.substring(U)))return U+=3,NaN;return F()},G=()=>{let Q=U,Z=!1;U++;while(U<W&&($[U]!=='"'||Z&&$[U-1]==="\\"))Z=$[U]==="\\"?!Z:!1,U++;if($.charAt(U)=='"')try{return JSON.parse($.substring(Q,++U-Number(Z)))}catch(V){w(String(V))}else if(g4.STR&T)try{return JSON.parse($.substring(Q,U-Number(Z))+'"')}catch(V){return JSON.parse($.substring(Q,$.lastIndexOf("\\"))+'"')}X("Unterminated string literal")},H=()=>{U++,O();let Q={};try{while($[U]!=="}"){if(O(),U>=W&&g4.OBJ&T)return Q;let Z=G();O(),U++;try{let V=Y();Object.defineProperty(Q,Z,{value:V,writable:!0,enumerable:!0,configurable:!0})}catch(V){if(g4.OBJ&T)return Q;else throw V}if(O(),$[U]===",")U++}}catch(Z){if(g4.OBJ&T)return Q;else X("Expected '}' at end of object")}return U++,Q},z=()=>{U++;let Q=[];try{while($[U]!=="]")if(Q.push(Y()),O(),$[U]===",")U++}catch(Z){if(g4.ARR&T)return Q;X("Expected ']' at end of array")}return U++,Q},F=()=>{if(U===0){if($==="-"&&g4.NUM&T)X("Not sure what '-' is");try{return JSON.parse($)}catch(Z){if(g4.NUM&T)try{if($[$.length-1]===".")return JSON.parse($.substring(0,$.lastIndexOf(".")));return JSON.parse($.substring(0,$.lastIndexOf("e")))}catch(V){}w(String(Z))}}let Q=U;if($[U]==="-")U++;while($[U]&&!",]}".includes($[U]))U++;if(U==W&&!(g4.NUM&T))X("Unterminated number literal");try{return JSON.parse($.substring(Q,U))}catch(Z){if($.substring(Q,U)==="-"&&g4.NUM&T)X("Not sure what '-' is");try{return JSON.parse($.substring(Q,$.lastIndexOf("e")))}catch(V){w(String(V))}}},O=()=>{while(U<W&&`
|
|
92
|
+
\r `.includes($[U]))U++};return Y()},oF=($)=>Hj($,g4.ALL^g4.NUM);var j4,J0,Y2,zT,lF,RG,rF,nF,iF,_G,tF,OE;class HT extends g8{constructor($){super();j4.add(this),J0.set(this,void 0),Y2.set(this,void 0),zT.set(this,void 0),U$(this,J0,$,"f"),U$(this,Y2,[],"f")}get currentChatCompletionSnapshot(){return v(this,zT,"f")}static fromReadableStream($){let T=new HT(null);return T._run(()=>T._fromReadableStream($)),T}static createChatCompletion($,T,W){let U=new HT(T);return U._run(()=>U._runChatCompletion($,{...T,stream:!0},{...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"stream"}})),U}async _createChatCompletion($,T,W){super._createChatCompletion;let U=W?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}v(this,j4,"m",lF).call(this);let X=await $.chat.completions.create({...T,stream:!0},{...W,signal:this.controller.signal});this._connected();for await(let w of X)v(this,j4,"m",rF).call(this,w);if(X.controller.signal?.aborted)throw new q4;return this._addChatCompletion(v(this,j4,"m",_G).call(this))}async _fromReadableStream($,T){let W=T?.signal;if(W){if(W.aborted)this.controller.abort();W.addEventListener("abort",()=>this.controller.abort())}v(this,j4,"m",lF).call(this),this._connected();let U=W1.fromReadableStream($,this.controller),X;for await(let w of U){if(X&&X!==w.id)this._addChatCompletion(v(this,j4,"m",_G).call(this));v(this,j4,"m",rF).call(this,w),X=w.id}if(U.controller.signal?.aborted)throw new q4;return this._addChatCompletion(v(this,j4,"m",_G).call(this))}[(J0=new WeakMap,Y2=new WeakMap,zT=new WeakMap,j4=new WeakSet,lF=function $(){if(this.ended)return;U$(this,zT,void 0,"f")},RG=function $(T){let W=v(this,Y2,"f")[T.index];if(W)return W;return W={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},v(this,Y2,"f")[T.index]=W,W},rF=function $(T){if(this.ended)return;let W=v(this,j4,"m",OE).call(this,T);this._emit("chunk",T,W);for(let U of T.choices){let X=W.choices[U.index];if(U.delta.content!=null&&X.message?.role==="assistant"&&X.message?.content)this._emit("content",U.delta.content,X.message.content),this._emit("content.delta",{delta:U.delta.content,snapshot:X.message.content,parsed:X.message.parsed});if(U.delta.refusal!=null&&X.message?.role==="assistant"&&X.message?.refusal)this._emit("refusal.delta",{delta:U.delta.refusal,snapshot:X.message.refusal});if(U.logprobs?.content!=null&&X.message?.role==="assistant")this._emit("logprobs.content.delta",{content:U.logprobs?.content,snapshot:X.logprobs?.content??[]});if(U.logprobs?.refusal!=null&&X.message?.role==="assistant")this._emit("logprobs.refusal.delta",{refusal:U.logprobs?.refusal,snapshot:X.logprobs?.refusal??[]});let w=v(this,j4,"m",RG).call(this,X);if(X.finish_reason){if(v(this,j4,"m",iF).call(this,X),w.current_tool_call_index!=null)v(this,j4,"m",nF).call(this,X,w.current_tool_call_index)}for(let Y of U.delta.tool_calls??[]){if(w.current_tool_call_index!==Y.index){if(v(this,j4,"m",iF).call(this,X),w.current_tool_call_index!=null)v(this,j4,"m",nF).call(this,X,w.current_tool_call_index)}w.current_tool_call_index=Y.index}for(let Y of U.delta.tool_calls??[]){let G=X.message.tool_calls?.[Y.index];if(!G?.type)continue;if(G?.type==="function")this._emit("tool_calls.function.arguments.delta",{name:G.function?.name,index:Y.index,arguments:G.function.arguments,parsed_arguments:G.function.parsed_arguments,arguments_delta:Y.function?.arguments??""});else ZE(G?.type)}}},nF=function $(T,W){if(v(this,j4,"m",RG).call(this,T).done_tool_calls.has(W))return;let X=T.message.tool_calls?.[W];if(!X)throw new Error("no tool call snapshot");if(!X.type)throw new Error("tool call snapshot missing `type`");if(X.type==="function"){let w=v(this,J0,"f")?.tools?.find((Y)=>Y.type==="function"&&Y.function.name===X.function.name);this._emit("tool_calls.function.arguments.done",{name:X.function.name,index:W,arguments:X.function.arguments,parsed_arguments:sT(w)?w.$parseRaw(X.function.arguments):w?.function.strict?JSON.parse(X.function.arguments):null})}else ZE(X.type)},iF=function $(T){let W=v(this,j4,"m",RG).call(this,T);if(T.message.content&&!W.content_done){W.content_done=!0;let U=v(this,j4,"m",tF).call(this);this._emit("content.done",{content:T.message.content,parsed:U?U.$parseRaw(T.message.content):null})}if(T.message.refusal&&!W.refusal_done)W.refusal_done=!0,this._emit("refusal.done",{refusal:T.message.refusal});if(T.logprobs?.content&&!W.logprobs_content_done)W.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:T.logprobs.content});if(T.logprobs?.refusal&&!W.logprobs_refusal_done)W.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:T.logprobs.refusal})},_G=function $(){if(this.ended)throw new $$("stream has ended, this shouldn't happen");let T=v(this,zT,"f");if(!T)throw new $$("request ended without sending any chunks");return U$(this,zT,void 0,"f"),U$(this,Y2,[],"f"),Oj(T,v(this,J0,"f"))},tF=function $(){let T=v(this,J0,"f")?.response_format;if(y8(T))return T;return null},OE=function $(T){var W,U,X,w;let Y=v(this,zT,"f"),{choices:G,...H}=T;if(!Y)Y=U$(this,zT,{...H,choices:[]},"f");else Object.assign(Y,H);for(let{delta:z,finish_reason:F,index:O,logprobs:Q=null,...Z}of T.choices){let V=Y.choices[O];if(!V)V=Y.choices[O]={finish_reason:F,index:O,message:{},logprobs:Q,...Z};if(Q)if(!V.logprobs)V.logprobs=Object.assign({},Q);else{let{content:f,refusal:b,...g}=Q;if(QE(g),Object.assign(V.logprobs,g),f)(W=V.logprobs).content??(W.content=[]),V.logprobs.content.push(...f);if(b)(U=V.logprobs).refusal??(U.refusal=[]),V.logprobs.refusal.push(...b)}if(F){if(V.finish_reason=F,v(this,J0,"f")&&mF(v(this,J0,"f"))){if(F==="length")throw new P8;if(F==="content_filter")throw new q8}}if(Object.assign(V,Z),!z)continue;let{content:A,refusal:D,function_call:J,role:L,tool_calls:_,...C}=z;if(QE(C),Object.assign(V.message,C),D)V.message.refusal=(V.message.refusal||"")+D;if(L)V.message.role=L;if(J)if(!V.message.function_call)V.message.function_call=J;else{if(J.name)V.message.function_call.name=J.name;if(J.arguments)(X=V.message.function_call).arguments??(X.arguments=""),V.message.function_call.arguments+=J.arguments}if(A){if(V.message.content=(V.message.content||"")+A,!V.message.refusal&&v(this,j4,"m",tF).call(this))V.message.parsed=oF(V.message.content)}if(_){if(!V.message.tool_calls)V.message.tool_calls=[];for(let{index:f,id:b,type:g,function:T$,...N$}of _){let j=(w=V.message.tool_calls)[f]??(w[f]={});if(Object.assign(j,N$),b)j.id=b;if(g)j.type=g;if(T$)j.function??(j.function={name:T$.name??"",arguments:""});if(T$?.name)j.function.name=T$.name;if(T$?.arguments){if(j.function.arguments+=T$.arguments,wE(v(this,J0,"f"),j))j.function.parsed_arguments=oF(j.function.arguments)}}}}return Y},Symbol.asyncIterator)](){let $=[],T=[],W=!1;return this.on("chunk",(U)=>{let X=T.shift();if(X)X.resolve(U);else $.push(U)}),this.on("end",()=>{W=!0;for(let U of T)U.resolve(void 0);T.length=0}),this.on("abort",(U)=>{W=!0;for(let X of T)X.reject(U);T.length=0}),this.on("error",(U)=>{W=!0;for(let X of T)X.reject(U);T.length=0}),{next:async()=>{if(!$.length){if(W)return{value:void 0,done:!0};return new Promise((X,w)=>T.push({resolve:X,reject:w})).then((X)=>X?{value:X,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 Oj($,T){let{id:W,choices:U,created:X,model:w,system_fingerprint:Y,...G}=$,H={...G,id:W,choices:U.map(({message:z,finish_reason:F,index:O,logprobs:Q,...Z})=>{if(!F)throw new $$(`missing finish_reason for choice ${O}`);let{content:V=null,function_call:A,tool_calls:D,...J}=z,L=z.role;if(!L)throw new $$(`missing role for choice ${O}`);if(A){let{arguments:_,name:C}=A;if(_==null)throw new $$(`missing function_call.arguments for choice ${O}`);if(!C)throw new $$(`missing function_call.name for choice ${O}`);return{...Z,message:{content:V,function_call:{arguments:_,name:C},role:L,refusal:z.refusal??null},finish_reason:F,index:O,logprobs:Q}}if(D)return{...Z,index:O,finish_reason:F,logprobs:Q,message:{...J,role:L,content:V,refusal:z.refusal??null,tool_calls:D.map((_,C)=>{let{function:f,type:b,id:g,...T$}=_,{arguments:N$,name:j,...w$}=f||{};if(g==null)throw new $$(`missing choices[${O}].tool_calls[${C}].id
|
|
93
|
+
${kG($)}`);if(b==null)throw new $$(`missing choices[${O}].tool_calls[${C}].type
|
|
94
|
+
${kG($)}`);if(j==null)throw new $$(`missing choices[${O}].tool_calls[${C}].function.name
|
|
95
|
+
${kG($)}`);if(N$==null)throw new $$(`missing choices[${O}].tool_calls[${C}].function.arguments
|
|
96
|
+
${kG($)}`);return{...T$,id:g,type:b,function:{...w$,name:j,arguments:N$}}})}};return{...Z,message:{...J,content:V,role:L,refusal:z.refusal??null},finish_reason:F,index:O,logprobs:Q}}),created:X,model:w,object:"chat.completion",...Y?{system_fingerprint:Y}:{}};return UE(H,T)}function kG($){return JSON.stringify($)}function QE($){return}function ZE($){}class G2 extends HT{static fromReadableStream($){let T=new G2(null);return T._run(()=>T._fromReadableStream($)),T}static runTools($,T,W){let U=new G2(T),X={...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"runTools"}};return U._run(()=>U._runTools($,T,X)),U}}class FT extends m{constructor(){super(...arguments);this.messages=new X2(this._client)}create($,T){return this._client.post("/chat/completions",{body:$,...T,stream:$.stream??!1})}retrieve($,T){return this._client.get(h`/chat/completions/${$}`,T)}update($,T,W){return this._client.post(h`/chat/completions/${$}`,{body:T,...W})}list($={},T){return this._client.getAPIList("/chat/completions",L$,{query:$,...T})}delete($,T){return this._client.delete(h`/chat/completions/${$}`,T)}parse($,T){return YE($.tools),this._client.chat.completions.create($,{...T,headers:{...T?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap((W)=>h8(W,$))}runTools($,T){if($.stream)return G2.runTools(this._client,$,T);return m8.runTools(this._client,$,T)}stream($,T){return HT.createChatCompletion(this._client,$,T)}}FT.Messages=X2;class eT extends m{constructor(){super(...arguments);this.completions=new FT(this._client)}}eT.Completions=FT;var VE=Symbol("brand.privateNullableHeaders");function*Zj($){if(!$)return;if(VE in $){let{values:U,nulls:X}=$;yield*U.entries();for(let w of X)yield[w,null];return}let T=!1,W;if($ instanceof Headers)W=$.entries();else if(JF($))W=$;else T=!0,W=Object.entries($??{});for(let U of W){let X=U[0];if(typeof X!=="string")throw new TypeError("expected header name to be a string");let w=JF(U[1])?U[1]:[U[1]],Y=!1;for(let G of w){if(G===void 0)continue;if(T&&!Y)Y=!0,yield[X,null];yield[X,G]}}}var s=($)=>{let T=new Headers,W=new Set;for(let U of $){let X=new Set;for(let[w,Y]of Zj(U)){let G=w.toLowerCase();if(!X.has(G))T.delete(w),X.add(G);if(Y===null)T.delete(w),W.add(G);else T.append(w,Y),W.delete(G)}}return{[VE]:!0,values:T,nulls:W}};class c8 extends m{create($,T){return this._client.post("/audio/speech",{body:$,...T,headers:s([{Accept:"application/octet-stream"},T?.headers]),__binaryResponse:!0})}}class u8 extends m{create($,T){return this._client.post("/audio/transcriptions",X1({body:$,...T,stream:$.stream??!1,__metadata:{model:$.model}},this._client))}}class p8 extends m{create($,T){return this._client.post("/audio/translations",X1({body:$,...T,__metadata:{model:$.model}},this._client))}}class L0 extends m{constructor(){super(...arguments);this.transcriptions=new u8(this._client),this.translations=new p8(this._client),this.speech=new c8(this._client)}}L0.Transcriptions=u8;L0.Translations=p8;L0.Speech=c8;class z2 extends m{create($,T){return this._client.post("/batches",{body:$,...T})}retrieve($,T){return this._client.get(h`/batches/${$}`,T)}list($={},T){return this._client.getAPIList("/batches",L$,{query:$,...T})}cancel($,T){return this._client.post(h`/batches/${$}/cancel`,T)}}class d8 extends m{create($,T){return this._client.post("/assistants",{body:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}retrieve($,T){return this._client.get(h`/assistants/${$}`,{...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}update($,T,W){return this._client.post(h`/assistants/${$}`,{body:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($={},T){return this._client.getAPIList("/assistants",L$,{query:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}delete($,T){return this._client.delete(h`/assistants/${$}`,{...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}}class o8 extends m{create($,T){return this._client.post("/realtime/sessions",{body:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}}class l8 extends m{create($,T){return this._client.post("/realtime/transcription_sessions",{body:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}}class $W extends m{constructor(){super(...arguments);this.sessions=new o8(this._client),this.transcriptionSessions=new l8(this._client)}}$W.Sessions=o8;$W.TranscriptionSessions=l8;class r8 extends m{create($,T,W){return this._client.post(h`/threads/${$}/messages`,{body:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}retrieve($,T,W){let{thread_id:U}=T;return this._client.get(h`/threads/${U}/messages/${$}`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}update($,T,W){let{thread_id:U,...X}=T;return this._client.post(h`/threads/${U}/messages/${$}`,{body:X,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($,T={},W){return this._client.getAPIList(h`/threads/${$}/messages`,L$,{query:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}delete($,T,W){let{thread_id:U}=T;return this._client.delete(h`/threads/${U}/messages/${$}`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}}class n8 extends m{retrieve($,T,W){let{thread_id:U,run_id:X,...w}=T;return this._client.get(h`/threads/${U}/runs/${X}/steps/${$}`,{query:w,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($,T,W){let{thread_id:U,...X}=T;return this._client.getAPIList(h`/threads/${U}/runs/${$}/steps`,L$,{query:X,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}}var KE=($)=>{if(typeof Buffer!=="undefined"){let T=Buffer.from($,"base64");return Array.from(new Float32Array(T.buffer,T.byteOffset,T.length/Float32Array.BYTES_PER_ELEMENT))}else{let T=atob($),W=T.length,U=new Uint8Array(W);for(let X=0;X<W;X++)U[X]=T.charCodeAt(X);return Array.from(new Float32Array(U.buffer))}};var TW=($)=>{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 o4,XW,aF,i1,vG,j1,UW,H2,WW,CG,U1,PG,qG,a8,i8,t8,AE,EE,ME,DE,NE,JE,LE;class OT extends aT{constructor(){super(...arguments);o4.add(this),aF.set(this,[]),i1.set(this,{}),vG.set(this,{}),j1.set(this,void 0),UW.set(this,void 0),H2.set(this,void 0),WW.set(this,void 0),CG.set(this,void 0),U1.set(this,void 0),PG.set(this,void 0),qG.set(this,void 0),a8.set(this,void 0)}[(aF=new WeakMap,i1=new WeakMap,vG=new WeakMap,j1=new WeakMap,UW=new WeakMap,H2=new WeakMap,WW=new WeakMap,CG=new WeakMap,U1=new WeakMap,PG=new WeakMap,qG=new WeakMap,a8=new WeakMap,o4=new WeakSet,Symbol.asyncIterator)](){let $=[],T=[],W=!1;return this.on("event",(U)=>{let X=T.shift();if(X)X.resolve(U);else $.push(U)}),this.on("end",()=>{W=!0;for(let U of T)U.resolve(void 0);T.length=0}),this.on("abort",(U)=>{W=!0;for(let X of T)X.reject(U);T.length=0}),this.on("error",(U)=>{W=!0;for(let X of T)X.reject(U);T.length=0}),{next:async()=>{if(!$.length){if(W)return{value:void 0,done:!0};return new Promise((X,w)=>T.push({resolve:X,reject:w})).then((X)=>X?{value:X,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 T=new XW;return T._run(()=>T._fromReadableStream($)),T}async _fromReadableStream($,T){let W=T?.signal;if(W){if(W.aborted)this.controller.abort();W.addEventListener("abort",()=>this.controller.abort())}this._connected();let U=W1.fromReadableStream($,this.controller);for await(let X of U)v(this,o4,"m",i8).call(this,X);if(U.controller.signal?.aborted)throw new q4;return this._addRun(v(this,o4,"m",t8).call(this))}toReadableStream(){return new W1(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream($,T,W,U){let X=new XW;return X._run(()=>X._runToolAssistantStream($,T,W,{...U,headers:{...U?.headers,"X-Stainless-Helper-Method":"stream"}})),X}async _createToolAssistantStream($,T,W,U){let X=U?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}let w={...W,stream:!0},Y=await $.submitToolOutputs(T,w,{...U,signal:this.controller.signal});this._connected();for await(let G of Y)v(this,o4,"m",i8).call(this,G);if(Y.controller.signal?.aborted)throw new q4;return this._addRun(v(this,o4,"m",t8).call(this))}static createThreadAssistantStream($,T,W){let U=new XW;return U._run(()=>U._threadAssistantStream($,T,{...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"stream"}})),U}static createAssistantStream($,T,W,U){let X=new XW;return X._run(()=>X._runAssistantStream($,T,W,{...U,headers:{...U?.headers,"X-Stainless-Helper-Method":"stream"}})),X}currentEvent(){return v(this,PG,"f")}currentRun(){return v(this,qG,"f")}currentMessageSnapshot(){return v(this,j1,"f")}currentRunStepSnapshot(){return v(this,a8,"f")}async finalRunSteps(){return await this.done(),Object.values(v(this,i1,"f"))}async finalMessages(){return await this.done(),Object.values(v(this,vG,"f"))}async finalRun(){if(await this.done(),!v(this,UW,"f"))throw Error("Final run was not received.");return v(this,UW,"f")}async _createThreadAssistantStream($,T,W){let U=W?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}let X={...T,stream:!0},w=await $.createAndRun(X,{...W,signal:this.controller.signal});this._connected();for await(let Y of w)v(this,o4,"m",i8).call(this,Y);if(w.controller.signal?.aborted)throw new q4;return this._addRun(v(this,o4,"m",t8).call(this))}async _createAssistantStream($,T,W,U){let X=U?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}let w={...W,stream:!0},Y=await $.create(T,w,{...U,signal:this.controller.signal});this._connected();for await(let G of Y)v(this,o4,"m",i8).call(this,G);if(Y.controller.signal?.aborted)throw new q4;return this._addRun(v(this,o4,"m",t8).call(this))}static accumulateDelta($,T){for(let[W,U]of Object.entries(T)){if(!$.hasOwnProperty(W)){$[W]=U;continue}let X=$[W];if(X===null||X===void 0){$[W]=U;continue}if(W==="index"||W==="type"){$[W]=U;continue}if(typeof X==="string"&&typeof U==="string")X+=U;else if(typeof X==="number"&&typeof U==="number")X+=U;else if(C8(X)&&C8(U))X=this.accumulateDelta(X,U);else if(Array.isArray(X)&&Array.isArray(U)){if(X.every((w)=>typeof w==="string"||typeof w==="number")){X.push(...U);continue}for(let w of U){if(!C8(w))throw new Error(`Expected array delta entry to be an object but got: ${w}`);let Y=w.index;if(Y==null)throw console.error(w),new Error("Expected array delta entry to have an `index` property");if(typeof Y!=="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${Y}`);let G=X[Y];if(G==null)X.push(w);else X[Y]=this.accumulateDelta(G,w)}continue}else throw Error(`Unhandled record type: ${W}, deltaValue: ${U}, accValue: ${X}`);$[W]=X}return $}_addRun($){return $}async _threadAssistantStream($,T,W){return await this._createThreadAssistantStream(T,$,W)}async _runAssistantStream($,T,W,U){return await this._createAssistantStream(T,$,W,U)}async _runToolAssistantStream($,T,W,U){return await this._createToolAssistantStream(T,$,W,U)}}XW=OT,i8=function $(T){if(this.ended)return;switch(U$(this,PG,T,"f"),v(this,o4,"m",ME).call(this,T),T.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":v(this,o4,"m",LE).call(this,T);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":v(this,o4,"m",EE).call(this,T);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":v(this,o4,"m",AE).call(this,T);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:Rj(T)}},t8=function $(){if(this.ended)throw new $$("stream has ended, this shouldn't happen");if(!v(this,UW,"f"))throw Error("Final run has not been received");return v(this,UW,"f")},AE=function $(T){let[W,U]=v(this,o4,"m",NE).call(this,T,v(this,j1,"f"));U$(this,j1,W,"f"),v(this,vG,"f")[W.id]=W;for(let X of U){let w=W.content[X.index];if(w?.type=="text")this._emit("textCreated",w.text)}switch(T.event){case"thread.message.created":this._emit("messageCreated",T.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",T.data.delta,W),T.data.delta.content)for(let X of T.data.delta.content){if(X.type=="text"&&X.text){let w=X.text,Y=W.content[X.index];if(Y&&Y.type=="text")this._emit("textDelta",w,Y.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(X.index!=v(this,H2,"f")){if(v(this,WW,"f"))switch(v(this,WW,"f").type){case"text":this._emit("textDone",v(this,WW,"f").text,v(this,j1,"f"));break;case"image_file":this._emit("imageFileDone",v(this,WW,"f").image_file,v(this,j1,"f"));break}U$(this,H2,X.index,"f")}U$(this,WW,W.content[X.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(v(this,H2,"f")!==void 0){let X=T.data.content[v(this,H2,"f")];if(X)switch(X.type){case"image_file":this._emit("imageFileDone",X.image_file,v(this,j1,"f"));break;case"text":this._emit("textDone",X.text,v(this,j1,"f"));break}}if(v(this,j1,"f"))this._emit("messageDone",T.data);U$(this,j1,void 0,"f")}},EE=function $(T){let W=v(this,o4,"m",DE).call(this,T);switch(U$(this,a8,W,"f"),T.event){case"thread.run.step.created":this._emit("runStepCreated",T.data);break;case"thread.run.step.delta":let U=T.data.delta;if(U.step_details&&U.step_details.type=="tool_calls"&&U.step_details.tool_calls&&W.step_details.type=="tool_calls")for(let w of U.step_details.tool_calls)if(w.index==v(this,CG,"f"))this._emit("toolCallDelta",w,W.step_details.tool_calls[w.index]);else{if(v(this,U1,"f"))this._emit("toolCallDone",v(this,U1,"f"));if(U$(this,CG,w.index,"f"),U$(this,U1,W.step_details.tool_calls[w.index],"f"),v(this,U1,"f"))this._emit("toolCallCreated",v(this,U1,"f"))}this._emit("runStepDelta",T.data.delta,W);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":if(U$(this,a8,void 0,"f"),T.data.step_details.type=="tool_calls"){if(v(this,U1,"f"))this._emit("toolCallDone",v(this,U1,"f")),U$(this,U1,void 0,"f")}this._emit("runStepDone",T.data,W);break;case"thread.run.step.in_progress":break}},ME=function $(T){v(this,aF,"f").push(T),this._emit("event",T)},DE=function $(T){switch(T.event){case"thread.run.step.created":return v(this,i1,"f")[T.data.id]=T.data,T.data;case"thread.run.step.delta":let W=v(this,i1,"f")[T.data.id];if(!W)throw Error("Received a RunStepDelta before creation of a snapshot");let U=T.data;if(U.delta){let X=XW.accumulateDelta(W,U.delta);v(this,i1,"f")[T.data.id]=X}return v(this,i1,"f")[T.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":v(this,i1,"f")[T.data.id]=T.data;break}if(v(this,i1,"f")[T.data.id])return v(this,i1,"f")[T.data.id];throw new Error("No snapshot available")},NE=function $(T,W){let U=[];switch(T.event){case"thread.message.created":return[T.data,U];case"thread.message.delta":if(!W)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let X=T.data;if(X.delta.content)for(let w of X.delta.content)if(w.index in W.content){let Y=W.content[w.index];W.content[w.index]=v(this,o4,"m",JE).call(this,w,Y)}else W.content[w.index]=w,U.push(w);return[W,U];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(W)return[W,U];else throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},JE=function $(T,W){return XW.accumulateDelta(W,T)},LE=function $(T){switch(U$(this,qG,T.data,"f"),T.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(U$(this,UW,T.data,"f"),v(this,U1,"f"))this._emit("toolCallDone",v(this,U1,"f")),U$(this,U1,void 0,"f");break;case"thread.run.cancelling":break}};function Rj($){}class F2 extends m{constructor(){super(...arguments);this.steps=new n8(this._client)}create($,T,W){let{include:U,...X}=T;return this._client.post(h`/threads/${$}/runs`,{query:{include:U},body:X,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers]),stream:T.stream??!1})}retrieve($,T,W){let{thread_id:U}=T;return this._client.get(h`/threads/${U}/runs/${$}`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}update($,T,W){let{thread_id:U,...X}=T;return this._client.post(h`/threads/${U}/runs/${$}`,{body:X,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($,T={},W){return this._client.getAPIList(h`/threads/${$}/runs`,L$,{query:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}cancel($,T,W){let{thread_id:U}=T;return this._client.post(h`/threads/${U}/runs/${$}/cancel`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}async createAndPoll($,T,W){let U=await this.create($,T,W);return await this.poll(U.id,{thread_id:$},W)}createAndStream($,T,W){return OT.createAssistantStream($,this._client.beta.threads.runs,T,W)}async poll($,T,W){let U=s([W?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":W?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:X,response:w}=await this.retrieve($,T,{...W,headers:{...W?.headers,...U}}).withResponse();switch(X.status){case"queued":case"in_progress":case"cancelling":let Y=5000;if(W?.pollIntervalMs)Y=W.pollIntervalMs;else{let G=w.headers.get("openai-poll-after-ms");if(G){let H=parseInt(G);if(!isNaN(H))Y=H}}await r1(Y);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return X}}}stream($,T,W){return OT.createAssistantStream($,this._client.beta.threads.runs,T,W)}submitToolOutputs($,T,W){let{thread_id:U,...X}=T;return this._client.post(h`/threads/${U}/runs/${$}/submit_tool_outputs`,{body:X,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers]),stream:T.stream??!1})}async submitToolOutputsAndPoll($,T,W){let U=await this.submitToolOutputs($,T,W);return await this.poll(U.id,T,W)}submitToolOutputsStream($,T,W){return OT.createToolAssistantStream($,this._client.beta.threads.runs,T,W)}}F2.Steps=n8;class wW extends m{constructor(){super(...arguments);this.runs=new F2(this._client),this.messages=new r8(this._client)}create($={},T){return this._client.post("/threads",{body:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}retrieve($,T){return this._client.get(h`/threads/${$}`,{...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}update($,T,W){return this._client.post(h`/threads/${$}`,{body:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}delete($,T){return this._client.delete(h`/threads/${$}`,{...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}createAndRun($,T){return this._client.post("/threads/runs",{body:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers]),stream:$.stream??!1})}async createAndRunPoll($,T){let W=await this.createAndRun($,T);return await this.runs.poll(W.id,{thread_id:W.thread_id},T)}createAndRunStream($,T){return OT.createThreadAssistantStream($,this._client.beta.threads,T)}}wW.Runs=F2;wW.Messages=r8;class R0 extends m{constructor(){super(...arguments);this.realtime=new $W(this._client),this.assistants=new d8(this._client),this.threads=new wW(this._client)}}R0.Realtime=$W;R0.Assistants=d8;R0.Threads=wW;class O2 extends m{create($,T){return this._client.post("/completions",{body:$,...T,stream:$.stream??!1})}}class s8 extends m{retrieve($,T,W){let{container_id:U}=T;return this._client.get(h`/containers/${U}/files/${$}/content`,{...W,headers:s([{Accept:"application/binary"},W?.headers]),__binaryResponse:!0})}}class Q2 extends m{constructor(){super(...arguments);this.content=new s8(this._client)}create($,T,W){return this._client.post(h`/containers/${$}/files`,X1({body:T,...W},this._client))}retrieve($,T,W){let{container_id:U}=T;return this._client.get(h`/containers/${U}/files/${$}`,W)}list($,T={},W){return this._client.getAPIList(h`/containers/${$}/files`,L$,{query:T,...W})}delete($,T,W){let{container_id:U}=T;return this._client.delete(h`/containers/${U}/files/${$}`,{...W,headers:s([{Accept:"*/*"},W?.headers])})}}Q2.Content=s8;class YW extends m{constructor(){super(...arguments);this.files=new Q2(this._client)}create($,T){return this._client.post("/containers",{body:$,...T})}retrieve($,T){return this._client.get(h`/containers/${$}`,T)}list($={},T){return this._client.getAPIList("/containers",L$,{query:$,...T})}delete($,T){return this._client.delete(h`/containers/${$}`,{...T,headers:s([{Accept:"*/*"},T?.headers])})}}YW.Files=Q2;class Z2 extends m{create($,T){let W=!!$.encoding_format,U=W?$.encoding_format:"base64";if(W)S4(this._client).debug("embeddings/user defined encoding_format:",$.encoding_format);let X=this._client.post("/embeddings",{body:{...$,encoding_format:U},...T});if(W)return X;return S4(this._client).debug("embeddings/decoding base64 embeddings from base64"),X._thenUnwrap((w)=>{if(w&&w.data)w.data.forEach((Y)=>{let G=Y.embedding;Y.embedding=KE(G)});return w})}}class e8 extends m{retrieve($,T,W){let{eval_id:U,run_id:X}=T;return this._client.get(h`/evals/${U}/runs/${X}/output_items/${$}`,W)}list($,T,W){let{eval_id:U,...X}=T;return this._client.getAPIList(h`/evals/${U}/runs/${$}/output_items`,L$,{query:X,...W})}}class V2 extends m{constructor(){super(...arguments);this.outputItems=new e8(this._client)}create($,T,W){return this._client.post(h`/evals/${$}/runs`,{body:T,...W})}retrieve($,T,W){let{eval_id:U}=T;return this._client.get(h`/evals/${U}/runs/${$}`,W)}list($,T={},W){return this._client.getAPIList(h`/evals/${$}/runs`,L$,{query:T,...W})}delete($,T,W){let{eval_id:U}=T;return this._client.delete(h`/evals/${U}/runs/${$}`,W)}cancel($,T,W){let{eval_id:U}=T;return this._client.post(h`/evals/${U}/runs/${$}`,W)}}V2.OutputItems=e8;class GW extends m{constructor(){super(...arguments);this.runs=new V2(this._client)}create($,T){return this._client.post("/evals",{body:$,...T})}retrieve($,T){return this._client.get(h`/evals/${$}`,T)}update($,T,W){return this._client.post(h`/evals/${$}`,{body:T,...W})}list($={},T){return this._client.getAPIList("/evals",L$,{query:$,...T})}delete($,T){return this._client.delete(h`/evals/${$}`,T)}}GW.Runs=V2;class K2 extends m{create($,T){return this._client.post("/files",X1({body:$,...T},this._client))}retrieve($,T){return this._client.get(h`/files/${$}`,T)}list($={},T){return this._client.getAPIList("/files",L$,{query:$,...T})}delete($,T){return this._client.delete(h`/files/${$}`,T)}content($,T){return this._client.get(h`/files/${$}/content`,{...T,headers:s([{Accept:"application/binary"},T?.headers]),__binaryResponse:!0})}async waitForProcessing($,{pollInterval:T=5000,maxWait:W=1800000}={}){let U=new Set(["processed","error","deleted"]),X=Date.now(),w=await this.retrieve($);while(!w.status||!U.has(w.status))if(await r1(T),w=await this.retrieve($),Date.now()-X>W)throw new iT({message:`Giving up on waiting for file ${$} to finish processing after ${W} milliseconds.`});return w}}class $U extends m{}class TU extends m{run($,T){return this._client.post("/fine_tuning/alpha/graders/run",{body:$,...T})}validate($,T){return this._client.post("/fine_tuning/alpha/graders/validate",{body:$,...T})}}class A2 extends m{constructor(){super(...arguments);this.graders=new TU(this._client)}}A2.Graders=TU;class WU extends m{create($,T,W){return this._client.getAPIList(h`/fine_tuning/checkpoints/${$}/permissions`,D0,{body:T,method:"post",...W})}retrieve($,T={},W){return this._client.get(h`/fine_tuning/checkpoints/${$}/permissions`,{query:T,...W})}delete($,T,W){let{fine_tuned_model_checkpoint:U}=T;return this._client.delete(h`/fine_tuning/checkpoints/${U}/permissions/${$}`,W)}}class E2 extends m{constructor(){super(...arguments);this.permissions=new WU(this._client)}}E2.Permissions=WU;class XU extends m{list($,T={},W){return this._client.getAPIList(h`/fine_tuning/jobs/${$}/checkpoints`,L$,{query:T,...W})}}class M2 extends m{constructor(){super(...arguments);this.checkpoints=new XU(this._client)}create($,T){return this._client.post("/fine_tuning/jobs",{body:$,...T})}retrieve($,T){return this._client.get(h`/fine_tuning/jobs/${$}`,T)}list($={},T){return this._client.getAPIList("/fine_tuning/jobs",L$,{query:$,...T})}cancel($,T){return this._client.post(h`/fine_tuning/jobs/${$}/cancel`,T)}listEvents($,T={},W){return this._client.getAPIList(h`/fine_tuning/jobs/${$}/events`,L$,{query:T,...W})}pause($,T){return this._client.post(h`/fine_tuning/jobs/${$}/pause`,T)}resume($,T){return this._client.post(h`/fine_tuning/jobs/${$}/resume`,T)}}M2.Checkpoints=XU;class t1 extends m{constructor(){super(...arguments);this.methods=new $U(this._client),this.jobs=new M2(this._client),this.checkpoints=new E2(this._client),this.alpha=new A2(this._client)}}t1.Methods=$U;t1.Jobs=M2;t1.Checkpoints=E2;t1.Alpha=A2;class UU extends m{}class zW extends m{constructor(){super(...arguments);this.graderModels=new UU(this._client)}}zW.GraderModels=UU;class D2 extends m{createVariation($,T){return this._client.post("/images/variations",X1({body:$,...T},this._client))}edit($,T){return this._client.post("/images/edits",X1({body:$,...T},this._client))}generate($,T){return this._client.post("/images/generations",{body:$,...T})}}class N2 extends m{retrieve($,T){return this._client.get(h`/models/${$}`,T)}list($){return this._client.getAPIList("/models",D0,$)}delete($,T){return this._client.delete(h`/models/${$}`,T)}}class J2 extends m{create($,T){return this._client.post("/moderations",{body:$,...T})}}function RE($,T){if(!T||!gj(T))return{...$,output_parsed:null,output:$.output.map((W)=>{if(W.type==="function_call")return{...W,parsed_arguments:null};if(W.type==="message")return{...W,content:W.content.map((U)=>({...U,parsed:null}))};else return W})};return sF($,T)}function sF($,T){let W=$.output.map((X)=>{if(X.type==="function_call")return{...X,parsed_arguments:uj(T,X)};if(X.type==="message"){let w=X.content.map((Y)=>{if(Y.type==="output_text")return{...Y,parsed:hj(T,Y.text)};return Y});return{...X,content:w}}return X}),U=Object.assign({},$,{output:W});if(!Object.getOwnPropertyDescriptor($,"output_text"))eF(U);return Object.defineProperty(U,"output_parsed",{enumerable:!0,get(){for(let X of U.output){if(X.type!=="message")continue;for(let w of X.content)if(w.type==="output_text"&&w.parsed!==null)return w.parsed}return null}}),U}function hj($,T){if($.text?.format?.type!=="json_schema")return null;if("$parseRaw"in $.text?.format)return($.text?.format).$parseRaw(T);return JSON.parse(T)}function gj($){if(y8($.text?.format))return!0;return!1}function mj($){return $?.$brand==="auto-parseable-tool"}function cj($,T){return $.find((W)=>W.type==="function"&&W.name===T)}function uj($,T){let W=cj($.tools??[],T.name);return{...T,...T,parsed_arguments:mj(W)?W.$parseRaw(T.arguments):W?.strict?JSON.parse(T.arguments):null}}function eF($){let T=[];for(let W of $.output){if(W.type!=="message")continue;for(let U of W.content)if(U.type==="output_text")T.push(U.text)}$.output_text=T.join("")}var L2,SG,QT,jG,_E,kE,vE,PE;class BG extends aT{constructor($){super();L2.add(this),SG.set(this,void 0),QT.set(this,void 0),jG.set(this,void 0),U$(this,SG,$,"f")}static createResponse($,T,W){let U=new BG(T);return U._run(()=>U._createOrRetrieveResponse($,T,{...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"stream"}})),U}async _createOrRetrieveResponse($,T,W){let U=W?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}v(this,L2,"m",_E).call(this);let X,w=null;if("response_id"in T)X=await $.responses.retrieve(T.response_id,{stream:!0},{...W,signal:this.controller.signal,stream:!0}),w=T.starting_after??null;else X=await $.responses.create({...T,stream:!0},{...W,signal:this.controller.signal});this._connected();for await(let Y of X)v(this,L2,"m",kE).call(this,Y,w);if(X.controller.signal?.aborted)throw new q4;return v(this,L2,"m",vE).call(this)}[(SG=new WeakMap,QT=new WeakMap,jG=new WeakMap,L2=new WeakSet,_E=function $(){if(this.ended)return;U$(this,QT,void 0,"f")},kE=function $(T,W){if(this.ended)return;let U=(w,Y)=>{if(W==null||Y.sequence_number>W)this._emit(w,Y)},X=v(this,L2,"m",PE).call(this,T);switch(U("event",T),T.type){case"response.output_text.delta":{let w=X.output[T.output_index];if(!w)throw new $$(`missing output at index ${T.output_index}`);if(w.type==="message"){let Y=w.content[T.content_index];if(!Y)throw new $$(`missing content at index ${T.content_index}`);if(Y.type!=="output_text")throw new $$(`expected content to be 'output_text', got ${Y.type}`);U("response.output_text.delta",{...T,snapshot:Y.text})}break}case"response.function_call_arguments.delta":{let w=X.output[T.output_index];if(!w)throw new $$(`missing output at index ${T.output_index}`);if(w.type==="function_call")U("response.function_call_arguments.delta",{...T,snapshot:w.arguments});break}default:U(T.type,T);break}},vE=function $(){if(this.ended)throw new $$("stream has ended, this shouldn't happen");let T=v(this,QT,"f");if(!T)throw new $$("request ended without sending any events");U$(this,QT,void 0,"f");let W=pj(T,v(this,SG,"f"));return U$(this,jG,W,"f"),W},PE=function $(T){let W=v(this,QT,"f");if(!W){if(T.type!=="response.created")throw new $$(`When snapshot hasn't been set yet, expected 'response.created' event, got ${T.type}`);return W=U$(this,QT,T.response,"f"),W}switch(T.type){case"response.output_item.added":{W.output.push(T.item);break}case"response.content_part.added":{let U=W.output[T.output_index];if(!U)throw new $$(`missing output at index ${T.output_index}`);if(U.type==="message")U.content.push(T.part);break}case"response.output_text.delta":{let U=W.output[T.output_index];if(!U)throw new $$(`missing output at index ${T.output_index}`);if(U.type==="message"){let X=U.content[T.content_index];if(!X)throw new $$(`missing content at index ${T.content_index}`);if(X.type!=="output_text")throw new $$(`expected content to be 'output_text', got ${X.type}`);X.text+=T.delta}break}case"response.function_call_arguments.delta":{let U=W.output[T.output_index];if(!U)throw new $$(`missing output at index ${T.output_index}`);if(U.type==="function_call")U.arguments+=T.delta;break}case"response.completed":{U$(this,QT,T.response,"f");break}}return W},Symbol.asyncIterator)](){let $=[],T=[],W=!1;return this.on("event",(U)=>{let X=T.shift();if(X)X.resolve(U);else $.push(U)}),this.on("end",()=>{W=!0;for(let U of T)U.resolve(void 0);T.length=0}),this.on("abort",(U)=>{W=!0;for(let X of T)X.reject(U);T.length=0}),this.on("error",(U)=>{W=!0;for(let X of T)X.reject(U);T.length=0}),{next:async()=>{if(!$.length){if(W)return{value:void 0,done:!0};return new Promise((X,w)=>T.push({resolve:X,reject:w})).then((X)=>X?{value:X,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 $=v(this,jG,"f");if(!$)throw new $$("stream ended without producing a ChatCompletion");return $}}function pj($,T){return RE($,T)}class wU extends m{list($,T={},W){return this._client.getAPIList(h`/responses/${$}/input_items`,L$,{query:T,...W})}}class HW extends m{constructor(){super(...arguments);this.inputItems=new wU(this._client)}create($,T){return this._client.post("/responses",{body:$,...T,stream:$.stream??!1})._thenUnwrap((W)=>{if("object"in W&&W.object==="response")eF(W);return W})}retrieve($,T={},W){return this._client.get(h`/responses/${$}`,{query:T,...W,stream:T?.stream??!1})}delete($,T){return this._client.delete(h`/responses/${$}`,{...T,headers:s([{Accept:"*/*"},T?.headers])})}parse($,T){return this._client.responses.create($,T)._thenUnwrap((W)=>sF(W,$))}stream($,T){return BG.createResponse(this._client,$,T)}cancel($,T){return this._client.post(h`/responses/${$}/cancel`,T)}}HW.InputItems=wU;class YU extends m{create($,T,W){return this._client.post(h`/uploads/${$}/parts`,X1({body:T,...W},this._client))}}class FW extends m{constructor(){super(...arguments);this.parts=new YU(this._client)}create($,T){return this._client.post("/uploads",{body:$,...T})}cancel($,T){return this._client.post(h`/uploads/${$}/cancel`,T)}complete($,T,W){return this._client.post(h`/uploads/${$}/complete`,{body:T,...W})}}FW.Parts=YU;var qE=async($)=>{let T=await Promise.allSettled($),W=T.filter((X)=>X.status==="rejected");if(W.length){for(let X of W)console.error(X.reason);throw new Error(`${W.length} promise(s) failed - see the above errors`)}let U=[];for(let X of T)if(X.status==="fulfilled")U.push(X.value);return U};class GU extends m{create($,T,W){return this._client.post(h`/vector_stores/${$}/file_batches`,{body:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}retrieve($,T,W){let{vector_store_id:U}=T;return this._client.get(h`/vector_stores/${U}/file_batches/${$}`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}cancel($,T,W){let{vector_store_id:U}=T;return this._client.post(h`/vector_stores/${U}/file_batches/${$}/cancel`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}async createAndPoll($,T,W){let U=await this.create($,T);return await this.poll($,U.id,W)}listFiles($,T,W){let{vector_store_id:U,...X}=T;return this._client.getAPIList(h`/vector_stores/${U}/file_batches/${$}/files`,L$,{query:X,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}async poll($,T,W){let U=s([W?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":W?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:X,response:w}=await this.retrieve(T,{vector_store_id:$},{...W,headers:U}).withResponse();switch(X.status){case"in_progress":let Y=5000;if(W?.pollIntervalMs)Y=W.pollIntervalMs;else{let G=w.headers.get("openai-poll-after-ms");if(G){let H=parseInt(G);if(!isNaN(H))Y=H}}await r1(Y);break;case"failed":case"cancelled":case"completed":return X}}}async uploadAndPoll($,{files:T,fileIds:W=[]},U){if(T==null||T.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let X=U?.maxConcurrency??5,w=Math.min(X,T.length),Y=this._client,G=T.values(),H=[...W];async function z(O){for(let Q of O){let Z=await Y.files.create({file:Q,purpose:"assistants"},U);H.push(Z.id)}}let F=Array(w).fill(G).map(z);return await qE(F),await this.createAndPoll($,{file_ids:H})}}class zU extends m{create($,T,W){return this._client.post(h`/vector_stores/${$}/files`,{body:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}retrieve($,T,W){let{vector_store_id:U}=T;return this._client.get(h`/vector_stores/${U}/files/${$}`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}update($,T,W){let{vector_store_id:U,...X}=T;return this._client.post(h`/vector_stores/${U}/files/${$}`,{body:X,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($,T={},W){return this._client.getAPIList(h`/vector_stores/${$}/files`,L$,{query:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}delete($,T,W){let{vector_store_id:U}=T;return this._client.delete(h`/vector_stores/${U}/files/${$}`,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}async createAndPoll($,T,W){let U=await this.create($,T,W);return await this.poll($,U.id,W)}async poll($,T,W){let U=s([W?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":W?.pollIntervalMs?.toString()??void 0}]);while(!0){let X=await this.retrieve(T,{vector_store_id:$},{...W,headers:U}).withResponse(),w=X.data;switch(w.status){case"in_progress":let Y=5000;if(W?.pollIntervalMs)Y=W.pollIntervalMs;else{let G=X.response.headers.get("openai-poll-after-ms");if(G){let H=parseInt(G);if(!isNaN(H))Y=H}}await r1(Y);break;case"failed":case"completed":return w}}}async upload($,T,W){let U=await this._client.files.create({file:T,purpose:"assistants"},W);return this.create($,{file_id:U.id},W)}async uploadAndPoll($,T,W){let U=await this.upload($,T,W);return await this.poll($,U.id,W)}content($,T,W){let{vector_store_id:U}=T;return this._client.getAPIList(h`/vector_stores/${U}/files/${$}/content`,D0,{...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}}class ZT extends m{constructor(){super(...arguments);this.files=new zU(this._client),this.fileBatches=new GU(this._client)}create($,T){return this._client.post("/vector_stores",{body:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}retrieve($,T){return this._client.get(h`/vector_stores/${$}`,{...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}update($,T,W){return this._client.post(h`/vector_stores/${$}`,{body:T,...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($={},T){return this._client.getAPIList("/vector_stores",L$,{query:$,...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}delete($,T){return this._client.delete(h`/vector_stores/${$}`,{...T,headers:s([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}search($,T,W){return this._client.getAPIList(h`/vector_stores/${$}/search`,D0,{body:T,method:"post",...W,headers:s([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}}ZT.Files=zU;ZT.FileBatches=GU;var $O,TO,IG,CE;class R${constructor({baseURL:$=TW("OPENAI_BASE_URL"),apiKey:T=TW("OPENAI_API_KEY"),organization:W=TW("OPENAI_ORG_ID")??null,project:U=TW("OPENAI_PROJECT_ID")??null,...X}={}){if($O.add(this),IG.set(this,void 0),this.completions=new O2(this),this.chat=new eT(this),this.embeddings=new Z2(this),this.files=new K2(this),this.images=new D2(this),this.audio=new L0(this),this.moderations=new J2(this),this.models=new N2(this),this.fineTuning=new t1(this),this.graders=new zW(this),this.vectorStores=new ZT(this),this.beta=new R0(this),this.batches=new z2(this),this.uploads=new FW(this),this.responses=new HW(this),this.evals=new GW(this),this.containers=new YW(this),T===void 0)throw new $$("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:T,organization:W,project:U,...X,baseURL:$||"https://api.openai.com/v1"};if(!w.dangerouslyAllowBrowser&&bA())throw new $$(`It looks like you're running in a browser-like environment.
|
|
73
97
|
|
|
74
98
|
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
75
99
|
If you understand the risks and have appropriate mitigations in place,
|
|
@@ -78,19 +102,19 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
|
78
102
|
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
|
|
79
103
|
|
|
80
104
|
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
81
|
-
`);this.baseURL=w.baseURL,this.timeout=w.timeout??
|
|
82
|
-
`)});return{model:$,messages:Y}}var O$=1e6,LE={"gpt-4.1":{promptPricePerToken:2/O$,promptPricePerTokenCached:0.5/O$,completionPricePerToken:8/O$},"gpt-4.1-mini":{promptPricePerToken:0.4/O$,promptPricePerTokenCached:0.1/O$,completionPricePerToken:1.6/O$},"gpt-4.1-nano":{promptPricePerToken:0.1/O$,promptPricePerTokenCached:0.025/O$,completionPricePerToken:0.4/O$},"gpt-4o":{promptPricePerToken:2.5/O$,promptPricePerTokenCached:1.25/O$,completionPricePerToken:10/O$},"gpt-4o-mini":{promptPricePerToken:0.15/O$,promptPricePerTokenCached:0.075/O$,completionPricePerToken:0.6/O$},o1:{promptPricePerToken:15/O$,promptPricePerTokenCached:7.5/O$,completionPricePerToken:60/O$},"o1-mini":{promptPricePerToken:1.1/O$,promptPricePerTokenCached:0.55/O$,completionPricePerToken:4.4/O$},o3:{promptPricePerToken:10/O$,promptPricePerTokenCached:2.5/O$,completionPricePerToken:40/O$},"o3-mini":{promptPricePerToken:1.1/O$,promptPricePerTokenCached:0.55/O$,completionPricePerToken:4.4/O$},"o4-mini":{promptPricePerToken:1.1/O$,promptPricePerTokenCached:0.275/O$,completionPricePerToken:4.4/O$},"codex-mini-latest":{promptPricePerToken:1.5/O$,promptPricePerTokenCached:0.375/O$,completionPricePerToken:6/O$},"chatgpt-4o-latest":{promptPricePerToken:5/O$,promptPricePerTokenCached:5/O$,completionPricePerToken:15/O$},"gpt-4":{promptPricePerToken:30/O$,promptPricePerTokenCached:30/O$,completionPricePerToken:60/O$},"gpt-4-turbo":{promptPricePerToken:10/O$,promptPricePerTokenCached:10/O$,completionPricePerToken:30/O$},"gpt-3.5-turbo":{promptPricePerToken:0.5/O$,promptPricePerTokenCached:0.5/O$,completionPricePerToken:1.5/O$},"gpt-4-32k":{promptPricePerToken:60/O$,promptPricePerTokenCached:60/O$,completionPricePerToken:120/O$},"gpt-3.5-turbo-16k":{promptPricePerToken:3/O$,promptPricePerTokenCached:3/O$,completionPricePerToken:4/O$}};function dj($){let W=Object.keys(LE).filter((X)=>$.startsWith(X)).sort((X,U)=>U.length-X.length)[0];if(!W)return;return LE[W]}function oj($){return async function T(W,X){if(!$)throw new Error("This is a bug in safegen. OpenAI client not available to the json generator.");let U=await $.chat.completions.create({...W,stream:!1,response_format:{type:"json_object"}},X),w=U.choices[0].message?.content,{usage:Y}=U;if(w&&Y){let G=Y.prompt_tokens,H=Y.prompt_tokens_details?.cached_tokens??0,z=G-H,F=Y.completion_tokens,O=dj(W.model),Q=0;if(O)Q=G*O.promptPricePerToken+z*(O.promptPricePerTokenCached??0)+F*O.completionPricePerToken;else console.warn(`No pricing facts found for model ${W.model}. Giving a price of 0.`);return{data:JSON.parse(w),usage:Y,usdPrice:Q}}if(!w&&!Y)throw new Error("No content or usage found in completion");if(!w)throw new Error("No content found in completion");throw new Error("No usage found in completion")}}var JE=new Map,RE=class{usdBudget;usdMinimum;getUnknownJsonFromOpenAi;getUnknownJsonFromOpenAiSquirreled;squirrel;client;lastUsage;constructor({model:$,usdBudget:T,usdMinimum:W,apiKey:X,cachingMode:U,cacheKey:w="openai-safegen",logger:Y}){this.usdBudget=T,this.usdMinimum=W,this.squirrel=new MA(U);let G=JE.get(X);if(U!=="read"){if(!G)G=new R$({apiKey:X,dangerouslyAllowBrowser:!1}),JE.set(X,G);this.client=G}this.getUnknownJsonFromOpenAi=oj(this.client),this.getUnknownJsonFromOpenAiSquirreled=this.squirrel.add(w,this.getUnknownJsonFromOpenAi),this.from=WA(async(...H)=>{if(this.usdBudget<this.usdMinimum)return Y?.warn("SafeGen budget exhausted"),H[2];let z=pj($,...H),F=H[0],O=H[3],{data:Q,usage:Z,usdPrice:K}=await this.getUnknownJsonFromOpenAiSquirreled.for(`${F.replace(/[^a-zA-Z0-9-_. ]/g,"_")}-${O.length}`).get(z);return this.lastUsage=Z,this.usdBudget-=K,Q},Y)}from};import{exec as my}from"child_process";class E extends Array{constructor($,T){if(super($),this.sign=T,Object.setPrototypeOf(this,E.prototype),$>E.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded")}static BigInt($){var T=Math.floor,W=Number.isFinite;if(typeof $=="number"){if($===0)return E.__zero();if(E.__isOneDigitInt($))return 0>$?E.__oneDigit(-$,!0):E.__oneDigit($,!1);if(!W($)||T($)!==$)throw new RangeError("The number "+$+" cannot be converted to BigInt because it is not an integer");return E.__fromDouble($)}if(typeof $=="string"){let X=E.__fromString($);if(X===null)throw new SyntaxError("Cannot convert "+$+" to a BigInt");return X}if(typeof $=="boolean")return $===!0?E.__oneDigit(1,!1):E.__zero();if(typeof $=="object"){if($.constructor===E)return $;let X=E.__toPrimitive($);return E.BigInt(X)}throw new TypeError("Cannot convert "+$+" to a BigInt")}toDebugString(){let $=["BigInt["];for(let T of this)$.push((T?(T>>>0).toString(16):T)+", ");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?E.__toStringBasePowerOfTwo(this,$):E.__toStringGeneric(this,$,!1)}valueOf(){throw new Error("Convert JSBI instances to native numbers using `toNumber`.")}static toNumber($){let T=$.length;if(T===0)return 0;if(T===1){let A=$.__unsignedDigit(0);return $.sign?-A:A}let W=$.__digit(T-1),X=E.__clz30(W),U=30*T-X;if(1024<U)return $.sign?-1/0:1/0;let w=U-1,Y=W,G=T-1,H=X+3,z=H===32?0:Y<<H;z>>>=12;let F=H-12,O=12<=H?0:Y<<20+H,Q=20+H;for(0<F&&0<G&&(G--,Y=$.__digit(G),z|=Y>>>30-F,O=Y<<F+2,Q=F+2);0<Q&&0<G;)G--,Y=$.__digit(G),O|=30<=Q?Y<<Q-30:Y>>>30-Q,Q-=30;let Z=E.__decideRounding($,Q,G,Y);if((Z===1||Z===0&&(1&O)==1)&&(O=O+1>>>0,O===0&&(z++,z>>>20!=0&&(z=0,w++,1023<w))))return $.sign?-1/0:1/0;let K=$.sign?-2147483648:0;return w=w+1023<<20,E.__kBitConversionInts[E.__kBitConversionIntHigh]=K|w|z,E.__kBitConversionInts[E.__kBitConversionIntLow]=O,E.__kBitConversionDouble[0]}static unaryMinus($){if($.length===0)return $;let T=$.__copy();return T.sign=!$.sign,T}static bitwiseNot($){return $.sign?E.__absoluteSubOne($).__trim():E.__absoluteAddOne($,!0)}static exponentiate($,T){if(T.sign)throw new RangeError("Exponent must be positive");if(T.length===0)return E.__oneDigit(1,!1);if($.length===0)return $;if($.length===1&&$.__digit(0)===1)return $.sign&&(1&T.__digit(0))==0?E.unaryMinus($):$;if(1<T.length)throw new RangeError("BigInt too big");let W=T.__unsignedDigit(0);if(W===1)return $;if(W>=E.__kMaxLengthBits)throw new RangeError("BigInt too big");if($.length===1&&$.__digit(0)===2){let w=1+(0|W/30),Y=$.sign&&(1&W)!=0,G=new E(w,Y);G.__initializeDigits();let H=1<<W%30;return G.__setDigit(w-1,H),G}let X=null,U=$;for((1&W)!=0&&(X=$),W>>=1;W!==0;W>>=1)U=E.multiply(U,U),(1&W)!=0&&(X===null?X=U:X=E.multiply(X,U));return X}static multiply($,T){if($.length===0)return $;if(T.length===0)return T;let W=$.length+T.length;30<=$.__clzmsd()+T.__clzmsd()&&W--;let X=new E(W,$.sign!==T.sign);X.__initializeDigits();for(let U=0;U<$.length;U++)E.__multiplyAccumulate(T,$.__digit(U),X,U);return X.__trim()}static divide($,T){if(T.length===0)throw new RangeError("Division by zero");if(0>E.__absoluteCompare($,T))return E.__zero();let W=$.sign!==T.sign,X=T.__unsignedDigit(0),U;if(T.length===1&&32767>=X){if(X===1)return W===$.sign?$:E.unaryMinus($);U=E.__absoluteDivSmall($,X,null)}else U=E.__absoluteDivLarge($,T,!0,!1);return U.sign=W,U.__trim()}static remainder($,T){if(T.length===0)throw new RangeError("Division by zero");if(0>E.__absoluteCompare($,T))return $;let W=T.__unsignedDigit(0);if(T.length===1&&32767>=W){if(W===1)return E.__zero();let U=E.__absoluteModSmall($,W);return U===0?E.__zero():E.__oneDigit(U,$.sign)}let X=E.__absoluteDivLarge($,T,!1,!0);return X.sign=$.sign,X.__trim()}static add($,T){let W=$.sign;return W===T.sign?E.__absoluteAdd($,T,W):0<=E.__absoluteCompare($,T)?E.__absoluteSub($,T,W):E.__absoluteSub(T,$,!W)}static subtract($,T){let W=$.sign;return W===T.sign?0<=E.__absoluteCompare($,T)?E.__absoluteSub($,T,W):E.__absoluteSub(T,$,!W):E.__absoluteAdd($,T,W)}static leftShift($,T){return T.length===0||$.length===0?$:T.sign?E.__rightShiftByAbsolute($,T):E.__leftShiftByAbsolute($,T)}static signedRightShift($,T){return T.length===0||$.length===0?$:T.sign?E.__leftShiftByAbsolute($,T):E.__rightShiftByAbsolute($,T)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan($,T){return 0>E.__compareToBigInt($,T)}static lessThanOrEqual($,T){return 0>=E.__compareToBigInt($,T)}static greaterThan($,T){return 0<E.__compareToBigInt($,T)}static greaterThanOrEqual($,T){return 0<=E.__compareToBigInt($,T)}static equal($,T){if($.sign!==T.sign)return!1;if($.length!==T.length)return!1;for(let W=0;W<$.length;W++)if($.__digit(W)!==T.__digit(W))return!1;return!0}static notEqual($,T){return!E.equal($,T)}static bitwiseAnd($,T){var W=Math.max;if(!$.sign&&!T.sign)return E.__absoluteAnd($,T).__trim();if($.sign&&T.sign){let X=W($.length,T.length)+1,U=E.__absoluteSubOne($,X),w=E.__absoluteSubOne(T);return U=E.__absoluteOr(U,w,U),E.__absoluteAddOne(U,!0,U).__trim()}return $.sign&&([$,T]=[T,$]),E.__absoluteAndNot($,E.__absoluteSubOne(T)).__trim()}static bitwiseXor($,T){var W=Math.max;if(!$.sign&&!T.sign)return E.__absoluteXor($,T).__trim();if($.sign&&T.sign){let w=W($.length,T.length),Y=E.__absoluteSubOne($,w),G=E.__absoluteSubOne(T);return E.__absoluteXor(Y,G,Y).__trim()}let X=W($.length,T.length)+1;$.sign&&([$,T]=[T,$]);let U=E.__absoluteSubOne(T,X);return U=E.__absoluteXor(U,$,U),E.__absoluteAddOne(U,!0,U).__trim()}static bitwiseOr($,T){var W=Math.max;let X=W($.length,T.length);if(!$.sign&&!T.sign)return E.__absoluteOr($,T).__trim();if($.sign&&T.sign){let w=E.__absoluteSubOne($,X),Y=E.__absoluteSubOne(T);return w=E.__absoluteAnd(w,Y,w),E.__absoluteAddOne(w,!0,w).__trim()}$.sign&&([$,T]=[T,$]);let U=E.__absoluteSubOne(T,X);return U=E.__absoluteAndNot(U,$,U),E.__absoluteAddOne(U,!0,U).__trim()}static asIntN($,T){var W=Math.floor;if(T.length===0)return T;if($=W($),0>$)throw new RangeError("Invalid value: not (convertible to) a safe integer");if($===0)return E.__zero();if($>=E.__kMaxLengthBits)return T;let X=0|($+29)/30;if(T.length<X)return T;let U=T.__unsignedDigit(X-1),w=1<<($-1)%30;if(T.length===X&&U<w)return T;if((U&w)!==w)return E.__truncateToNBits($,T);if(!T.sign)return E.__truncateAndSubFromPowerOfTwo($,T,!0);if((U&w-1)==0){for(let Y=X-2;0<=Y;Y--)if(T.__digit(Y)!==0)return E.__truncateAndSubFromPowerOfTwo($,T,!1);return T.length===X&&U===w?T:E.__truncateToNBits($,T)}return E.__truncateAndSubFromPowerOfTwo($,T,!1)}static asUintN($,T){var W=Math.floor;if(T.length===0)return T;if($=W($),0>$)throw new RangeError("Invalid value: not (convertible to) a safe integer");if($===0)return E.__zero();if(T.sign){if($>E.__kMaxLengthBits)throw new RangeError("BigInt too big");return E.__truncateAndSubFromPowerOfTwo($,T,!1)}if($>=E.__kMaxLengthBits)return T;let X=0|($+29)/30;if(T.length<X)return T;let U=$%30;if(T.length==X){if(U===0)return T;if(T.__digit(X-1)>>>U==0)return T}return E.__truncateToNBits($,T)}static ADD($,T){if($=E.__toPrimitive($),T=E.__toPrimitive(T),typeof $=="string")return typeof T!="string"&&(T=T.toString()),$+T;if(typeof T=="string")return $.toString()+T;if($=E.__toNumeric($),T=E.__toNumeric(T),E.__isBigInt($)&&E.__isBigInt(T))return E.add($,T);if(typeof $=="number"&&typeof T=="number")return $+T;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT($,T){return E.__compare($,T,0)}static LE($,T){return E.__compare($,T,1)}static GT($,T){return E.__compare($,T,2)}static GE($,T){return E.__compare($,T,3)}static EQ($,T){for(;;){if(E.__isBigInt($))return E.__isBigInt(T)?E.equal($,T):E.EQ(T,$);if(typeof $=="number"){if(E.__isBigInt(T))return E.__equalToNumber(T,$);if(typeof T!="object")return $==T;T=E.__toPrimitive(T)}else if(typeof $=="string"){if(E.__isBigInt(T))return $=E.__fromString($),$!==null&&E.equal($,T);if(typeof T!="object")return $==T;T=E.__toPrimitive(T)}else if(typeof $=="boolean"){if(E.__isBigInt(T))return E.__equalToNumber(T,+$);if(typeof T!="object")return $==T;T=E.__toPrimitive(T)}else if(typeof $=="symbol"){if(E.__isBigInt(T))return!1;if(typeof T!="object")return $==T;T=E.__toPrimitive(T)}else if(typeof $=="object"){if(typeof T=="object"&&T.constructor!==E)return $==T;$=E.__toPrimitive($)}else return $==T}}static NE($,T){return!E.EQ($,T)}static DataViewGetBigInt64($,T,W=!1){return E.asIntN(64,E.DataViewGetBigUint64($,T,W))}static DataViewGetBigUint64($,T,W=!1){let[X,U]=W?[4,0]:[0,4],w=$.getUint32(T+X,W),Y=$.getUint32(T+U,W),G=new E(3,!1);return G.__setDigit(0,1073741823&Y),G.__setDigit(1,(268435455&w)<<2|Y>>>30),G.__setDigit(2,w>>>28),G.__trim()}static DataViewSetBigInt64($,T,W,X=!1){E.DataViewSetBigUint64($,T,W,X)}static DataViewSetBigUint64($,T,W,X=!1){W=E.asUintN(64,W);let U=0,w=0;if(0<W.length&&(w=W.__digit(0),1<W.length)){let H=W.__digit(1);w|=H<<30,U=H>>>2,2<W.length&&(U|=W.__digit(2)<<28)}let[Y,G]=X?[4,0]:[0,4];$.setUint32(T+Y,U,X),$.setUint32(T+G,w,X)}static __zero(){return new E(0,!1)}static __oneDigit($,T){let W=new E(1,T);return W.__setDigit(0,$),W}__copy(){let $=new E(this.length,this.sign);for(let T=0;T<this.length;T++)$[T]=this[T];return $}__trim(){let $=this.length,T=this[$-1];for(;T===0;)$--,T=this[$-1],this.pop();return $===0&&(this.sign=!1),this}__initializeDigits(){for(let $=0;$<this.length;$++)this[$]=0}static __decideRounding($,T,W,X){if(0<T)return-1;let U;if(0>T)U=-T-1;else{if(W===0)return-1;W--,X=$.__digit(W),U=29}let w=1<<U;if((X&w)==0)return-1;if(w-=1,(X&w)!=0)return 1;for(;0<W;)if(W--,$.__digit(W)!==0)return 1;return 0}static __fromDouble($){E.__kBitConversionDouble[0]=$;let T=2047&E.__kBitConversionInts[E.__kBitConversionIntHigh]>>>20,W=T-1023,X=(0|W/30)+1,U=new E(X,0>$),w=1048575&E.__kBitConversionInts[E.__kBitConversionIntHigh]|1048576,Y=E.__kBitConversionInts[E.__kBitConversionIntLow],G=20,H=W%30,z,F=0;if(H<20){let O=G-H;F=O+32,z=w>>>O,w=w<<32-O|Y>>>O,Y<<=32-O}else if(H===20)F=32,z=w,w=Y,Y=0;else{let O=H-G;F=32-O,z=w<<O|Y>>>32-O,w=Y<<O,Y=0}U.__setDigit(X-1,z);for(let O=X-2;0<=O;O--)0<F?(F-=30,z=w>>>2,w=w<<30|Y>>>2,Y<<=30):z=0,U.__setDigit(O,z);return U.__trim()}static __isWhitespace($){return 13>=$&&9<=$||(159>=$?$==32:131071>=$?$==160||$==5760:196607>=$?($&=131071,10>=$||$==40||$==41||$==47||$==95||$==4096):$==65279)}static __fromString($,T=0){let W=0,X=$.length,U=0;if(U===X)return E.__zero();let w=$.charCodeAt(U);for(;E.__isWhitespace(w);){if(++U===X)return E.__zero();w=$.charCodeAt(U)}if(w===43){if(++U===X)return null;w=$.charCodeAt(U),W=1}else if(w===45){if(++U===X)return null;w=$.charCodeAt(U),W=-1}if(T===0){if(T=10,w===48){if(++U===X)return E.__zero();if(w=$.charCodeAt(U),w===88||w===120){if(T=16,++U===X)return null;w=$.charCodeAt(U)}else if(w===79||w===111){if(T=8,++U===X)return null;w=$.charCodeAt(U)}else if(w===66||w===98){if(T=2,++U===X)return null;w=$.charCodeAt(U)}}}else if(T===16&&w===48){if(++U===X)return E.__zero();if(w=$.charCodeAt(U),w===88||w===120){if(++U===X)return null;w=$.charCodeAt(U)}}if(W!=0&&T!==10)return null;for(;w===48;){if(++U===X)return E.__zero();w=$.charCodeAt(U)}let Y=X-U,G=E.__kMaxBitsPerChar[T],H=E.__kBitsPerCharTableMultiplier-1;if(Y>1073741824/G)return null;let z=G*Y+H>>>E.__kBitsPerCharTableShift,F=new E(0|(z+29)/30,!1),O=10>T?T:10,Q=10<T?T-10:0;if((T&T-1)==0){G>>=E.__kBitsPerCharTableShift;let Z=[],K=[],A=!1;do{let D=0,L=0;for(;;){let J;if(w-48>>>0<O)J=w-48;else if((32|w)-97>>>0<Q)J=(32|w)-87;else{A=!0;break}if(L+=G,D=D<<G|J,++U===X){A=!0;break}if(w=$.charCodeAt(U),30<L+G)break}Z.push(D),K.push(L)}while(!A);E.__fillFromParts(F,Z,K)}else{F.__initializeDigits();let Z=!1,K=0;do{let A=0,D=1;for(;;){let J;if(w-48>>>0<O)J=w-48;else if((32|w)-97>>>0<Q)J=(32|w)-87;else{Z=!0;break}let _=D*T;if(1073741823<_)break;if(D=_,A=A*T+J,K++,++U===X){Z=!0;break}w=$.charCodeAt(U)}H=30*E.__kBitsPerCharTableMultiplier-1;let L=0|(G*K+H>>>E.__kBitsPerCharTableShift)/30;F.__inplaceMultiplyAdd(D,A,L)}while(!Z)}if(U!==X){if(!E.__isWhitespace(w))return null;for(U++;U<X;U++)if(w=$.charCodeAt(U),!E.__isWhitespace(w))return null}return F.sign=W==-1,F.__trim()}static __fillFromParts($,T,W){let X=0,U=0,w=0;for(let Y=T.length-1;0<=Y;Y--){let G=T[Y],H=W[Y];U|=G<<w,w+=H,w===30?($.__setDigit(X++,U),w=0,U=0):30<w&&($.__setDigit(X++,1073741823&U),w-=30,U=G>>>H-w)}if(U!==0){if(X>=$.length)throw new Error("implementation bug");$.__setDigit(X++,U)}for(;X<$.length;X++)$.__setDigit(X,0)}static __toStringBasePowerOfTwo($,T){let W=$.length,X=T-1;X=(85&X>>>1)+(85&X),X=(51&X>>>2)+(51&X),X=(15&X>>>4)+(15&X);let U=X,w=T-1,Y=$.__digit(W-1),G=E.__clz30(Y),H=0|(30*W-G+U-1)/U;if($.sign&&H++,268435456<H)throw new Error("string too long");let z=Array(H),F=H-1,O=0,Q=0;for(let K=0;K<W-1;K++){let A=$.__digit(K),D=(O|A<<Q)&w;z[F--]=E.__kConversionChars[D];let L=U-Q;for(O=A>>>L,Q=30-L;Q>=U;)z[F--]=E.__kConversionChars[O&w],O>>>=U,Q-=U}let Z=(O|Y<<Q)&w;for(z[F--]=E.__kConversionChars[Z],O=Y>>>U-Q;O!==0;)z[F--]=E.__kConversionChars[O&w],O>>>=U;if($.sign&&(z[F--]="-"),F!=-1)throw new Error("implementation bug");return z.join("")}static __toStringGeneric($,T,W){let X=$.length;if(X===0)return"";if(X===1){let K=$.__unsignedDigit(0).toString(T);return W===!1&&$.sign&&(K="-"+K),K}let U=30*X-E.__clz30($.__digit(X-1)),w=E.__kMaxBitsPerChar[T],Y=w-1,G=U*E.__kBitsPerCharTableMultiplier;G+=Y-1,G=0|G/Y;let H=G+1>>1,z=E.exponentiate(E.__oneDigit(T,!1),E.__oneDigit(H,!1)),F,O,Q=z.__unsignedDigit(0);if(z.length===1&&32767>=Q){F=new E($.length,!1),F.__initializeDigits();let K=0;for(let A=2*$.length-1;0<=A;A--){let D=K<<15|$.__halfDigit(A);F.__setHalfDigit(A,0|D/Q),K=0|D%Q}O=K.toString(T)}else{let K=E.__absoluteDivLarge($,z,!0,!0);F=K.quotient;let A=K.remainder.__trim();O=E.__toStringGeneric(A,T,!0)}F.__trim();let Z=E.__toStringGeneric(F,T,!0);for(;O.length<H;)O="0"+O;return W===!1&&$.sign&&(Z="-"+Z),Z+O}static __unequalSign($){return $?-1:1}static __absoluteGreater($){return $?-1:1}static __absoluteLess($){return $?1:-1}static __compareToBigInt($,T){let W=$.sign;if(W!==T.sign)return E.__unequalSign(W);let X=E.__absoluteCompare($,T);return 0<X?E.__absoluteGreater(W):0>X?E.__absoluteLess(W):0}static __compareToNumber($,T){if(E.__isOneDigitInt(T)){let W=$.sign,X=0>T;if(W!==X)return E.__unequalSign(W);if($.length===0){if(X)throw new Error("implementation bug");return T===0?0:-1}if(1<$.length)return E.__absoluteGreater(W);let U=Math.abs(T),w=$.__unsignedDigit(0);return w>U?E.__absoluteGreater(W):w<U?E.__absoluteLess(W):0}return E.__compareToDouble($,T)}static __compareToDouble($,T){if(T!==T)return T;if(T===1/0)return-1;if(T===-1/0)return 1;let W=$.sign;if(W!==0>T)return E.__unequalSign(W);if(T===0)throw new Error("implementation bug: should be handled elsewhere");if($.length===0)return-1;E.__kBitConversionDouble[0]=T;let X=2047&E.__kBitConversionInts[E.__kBitConversionIntHigh]>>>20;if(X==2047)throw new Error("implementation bug: handled elsewhere");let U=X-1023;if(0>U)return E.__absoluteGreater(W);let w=$.length,Y=$.__digit(w-1),G=E.__clz30(Y),H=30*w-G,z=U+1;if(H<z)return E.__absoluteLess(W);if(H>z)return E.__absoluteGreater(W);let F=1048576|1048575&E.__kBitConversionInts[E.__kBitConversionIntHigh],O=E.__kBitConversionInts[E.__kBitConversionIntLow],Q=20,Z=29-G;if(Z!==(0|(H-1)%30))throw new Error("implementation bug");let K,A=0;if(20>Z){let D=Q-Z;A=D+32,K=F>>>D,F=F<<32-D|O>>>D,O<<=32-D}else if(Z===20)A=32,K=F,F=O,O=0;else{let D=Z-Q;A=32-D,K=F<<D|O>>>32-D,F=O<<D,O=0}if(Y>>>=0,K>>>=0,Y>K)return E.__absoluteGreater(W);if(Y<K)return E.__absoluteLess(W);for(let D=w-2;0<=D;D--){0<A?(A-=30,K=F>>>2,F=F<<30|O>>>2,O<<=30):K=0;let L=$.__unsignedDigit(D);if(L>K)return E.__absoluteGreater(W);if(L<K)return E.__absoluteLess(W)}if(F!==0||O!==0){if(A===0)throw new Error("implementation bug");return E.__absoluteLess(W)}return 0}static __equalToNumber($,T){var W=Math.abs;return E.__isOneDigitInt(T)?T===0?$.length===0:$.length===1&&$.sign===0>T&&$.__unsignedDigit(0)===W(T):E.__compareToDouble($,T)===0}static __comparisonResultToBool($,T){return T===0?0>$:T===1?0>=$:T===2?0<$:T===3?0<=$:void 0}static __compare($,T,W){if($=E.__toPrimitive($),T=E.__toPrimitive(T),typeof $=="string"&&typeof T=="string")switch(W){case 0:return $<T;case 1:return $<=T;case 2:return $>T;case 3:return $>=T}if(E.__isBigInt($)&&typeof T=="string")return T=E.__fromString(T),T!==null&&E.__comparisonResultToBool(E.__compareToBigInt($,T),W);if(typeof $=="string"&&E.__isBigInt(T))return $=E.__fromString($),$!==null&&E.__comparisonResultToBool(E.__compareToBigInt($,T),W);if($=E.__toNumeric($),T=E.__toNumeric(T),E.__isBigInt($)){if(E.__isBigInt(T))return E.__comparisonResultToBool(E.__compareToBigInt($,T),W);if(typeof T!="number")throw new Error("implementation bug");return E.__comparisonResultToBool(E.__compareToNumber($,T),W)}if(typeof $!="number")throw new Error("implementation bug");if(E.__isBigInt(T))return E.__comparisonResultToBool(E.__compareToNumber(T,$),2^W);if(typeof T!="number")throw new Error("implementation bug");return W===0?$<T:W===1?$<=T:W===2?$>T:W===3?$>=T:void 0}__clzmsd(){return E.__clz30(this.__digit(this.length-1))}static __absoluteAdd($,T,W){if($.length<T.length)return E.__absoluteAdd(T,$,W);if($.length===0)return $;if(T.length===0)return $.sign===W?$:E.unaryMinus($);let X=$.length;($.__clzmsd()===0||T.length===$.length&&T.__clzmsd()===0)&&X++;let U=new E(X,W),w=0,Y=0;for(;Y<T.length;Y++){let G=$.__digit(Y)+T.__digit(Y)+w;w=G>>>30,U.__setDigit(Y,1073741823&G)}for(;Y<$.length;Y++){let G=$.__digit(Y)+w;w=G>>>30,U.__setDigit(Y,1073741823&G)}return Y<U.length&&U.__setDigit(Y,w),U.__trim()}static __absoluteSub($,T,W){if($.length===0)return $;if(T.length===0)return $.sign===W?$:E.unaryMinus($);let X=new E($.length,W),U=0,w=0;for(;w<T.length;w++){let Y=$.__digit(w)-T.__digit(w)-U;U=1&Y>>>30,X.__setDigit(w,1073741823&Y)}for(;w<$.length;w++){let Y=$.__digit(w)-U;U=1&Y>>>30,X.__setDigit(w,1073741823&Y)}return X.__trim()}static __absoluteAddOne($,T,W=null){let X=$.length;W===null?W=new E(X,T):W.sign=T;let U=1;for(let w=0;w<X;w++){let Y=$.__digit(w)+U;U=Y>>>30,W.__setDigit(w,1073741823&Y)}return U!=0&&W.__setDigitGrow(X,1),W}static __absoluteSubOne($,T){let W=$.length;T=T||W;let X=new E(T,!1),U=1;for(let w=0;w<W;w++){let Y=$.__digit(w)-U;U=1&Y>>>30,X.__setDigit(w,1073741823&Y)}if(U!=0)throw new Error("implementation bug");for(let w=W;w<T;w++)X.__setDigit(w,0);return X}static __absoluteAnd($,T,W=null){let X=$.length,U=T.length,w=U;if(X<U){w=X;let H=$,z=X;$=T,X=U,T=H,U=z}let Y=w;W===null?W=new E(Y,!1):Y=W.length;let G=0;for(;G<w;G++)W.__setDigit(G,$.__digit(G)&T.__digit(G));for(;G<Y;G++)W.__setDigit(G,0);return W}static __absoluteAndNot($,T,W=null){let X=$.length,U=T.length,w=U;X<U&&(w=X);let Y=X;W===null?W=new E(Y,!1):Y=W.length;let G=0;for(;G<w;G++)W.__setDigit(G,$.__digit(G)&~T.__digit(G));for(;G<X;G++)W.__setDigit(G,$.__digit(G));for(;G<Y;G++)W.__setDigit(G,0);return W}static __absoluteOr($,T,W=null){let X=$.length,U=T.length,w=U;if(X<U){w=X;let H=$,z=X;$=T,X=U,T=H,U=z}let Y=X;W===null?W=new E(Y,!1):Y=W.length;let G=0;for(;G<w;G++)W.__setDigit(G,$.__digit(G)|T.__digit(G));for(;G<X;G++)W.__setDigit(G,$.__digit(G));for(;G<Y;G++)W.__setDigit(G,0);return W}static __absoluteXor($,T,W=null){let X=$.length,U=T.length,w=U;if(X<U){w=X;let H=$,z=X;$=T,X=U,T=H,U=z}let Y=X;W===null?W=new E(Y,!1):Y=W.length;let G=0;for(;G<w;G++)W.__setDigit(G,$.__digit(G)^T.__digit(G));for(;G<X;G++)W.__setDigit(G,$.__digit(G));for(;G<Y;G++)W.__setDigit(G,0);return W}static __absoluteCompare($,T){let W=$.length-T.length;if(W!=0)return W;let X=$.length-1;for(;0<=X&&$.__digit(X)===T.__digit(X);)X--;return 0>X?0:$.__unsignedDigit(X)>T.__unsignedDigit(X)?1:-1}static __multiplyAccumulate($,T,W,X){if(T===0)return;let U=32767&T,w=T>>>15,Y=0,G=0;for(let H,z=0;z<$.length;z++,X++){H=W.__digit(X);let F=$.__digit(z),O=32767&F,Q=F>>>15,Z=E.__imul(O,U),K=E.__imul(O,w),A=E.__imul(Q,U),D=E.__imul(Q,w);H+=G+Z+Y,Y=H>>>30,H&=1073741823,H+=((32767&K)<<15)+((32767&A)<<15),Y+=H>>>30,G=D+(K>>>15)+(A>>>15),W.__setDigit(X,1073741823&H)}for(;Y!=0||G!==0;X++){let H=W.__digit(X);H+=Y+G,G=0,Y=H>>>30,W.__setDigit(X,1073741823&H)}}static __internalMultiplyAdd($,T,W,X,U){let w=W,Y=0;for(let G=0;G<X;G++){let H=$.__digit(G),z=E.__imul(32767&H,T),F=E.__imul(H>>>15,T),O=z+((32767&F)<<15)+Y+w;w=O>>>30,Y=F>>>15,U.__setDigit(G,1073741823&O)}if(U.length>X)for(U.__setDigit(X++,w+Y);X<U.length;)U.__setDigit(X++,0);else if(w+Y!==0)throw new Error("implementation bug")}__inplaceMultiplyAdd($,T,W){W>this.length&&(W=this.length);let X=32767&$,U=$>>>15,w=0,Y=T;for(let G=0;G<W;G++){let H=this.__digit(G),z=32767&H,F=H>>>15,O=E.__imul(z,X),Q=E.__imul(z,U),Z=E.__imul(F,X),K=E.__imul(F,U),A=Y+O+w;w=A>>>30,A&=1073741823,A+=((32767&Q)<<15)+((32767&Z)<<15),w+=A>>>30,Y=K+(Q>>>15)+(Z>>>15),this.__setDigit(G,1073741823&A)}if(w!=0||Y!==0)throw new Error("implementation bug")}static __absoluteDivSmall($,T,W=null){W===null&&(W=new E($.length,!1));let X=0;for(let U,w=2*$.length-1;0<=w;w-=2){U=(X<<15|$.__halfDigit(w))>>>0;let Y=0|U/T;X=0|U%T,U=(X<<15|$.__halfDigit(w-1))>>>0;let G=0|U/T;X=0|U%T,W.__setDigit(w>>>1,Y<<15|G)}return W}static __absoluteModSmall($,T){let W=0;for(let X=2*$.length-1;0<=X;X--)W=0|((W<<15|$.__halfDigit(X))>>>0)%T;return W}static __absoluteDivLarge($,T,W,X){let U=T.__halfDigitLength(),w=T.length,Y=$.__halfDigitLength()-U,G=null;W&&(G=new E(Y+2>>>1,!1),G.__initializeDigits());let H=new E(U+2>>>1,!1);H.__initializeDigits();let z=E.__clz15(T.__halfDigit(U-1));0<z&&(T=E.__specialLeftShift(T,z,0));let F=E.__specialLeftShift($,z,1),O=T.__halfDigit(U-1),Q=0;for(let Z,K=Y;0<=K;K--){Z=32767;let A=F.__halfDigit(K+U);if(A!==O){let L=(A<<15|F.__halfDigit(K+U-1))>>>0;Z=0|L/O;let J=0|L%O,_=T.__halfDigit(U-2),C=F.__halfDigit(K+U-2);for(;E.__imul(Z,_)>>>0>(J<<16|C)>>>0&&(Z--,J+=O,!(32767<J)););}E.__internalMultiplyAdd(T,Z,0,w,H);let D=F.__inplaceSub(H,K,U+1);D!==0&&(D=F.__inplaceAdd(T,K,U),F.__setHalfDigit(K+U,32767&F.__halfDigit(K+U)+D),Z--),W&&(1&K?Q=Z<<15:G.__setDigit(K>>>1,Q|Z))}if(X)return F.__inplaceRightShift(z),W?{quotient:G,remainder:F}:F;if(W)return G;throw new Error("unreachable")}static __clz15($){return E.__clz30($)-15}__inplaceAdd($,T,W){let X=0;for(let U=0;U<W;U++){let w=this.__halfDigit(T+U)+$.__halfDigit(U)+X;X=w>>>15,this.__setHalfDigit(T+U,32767&w)}return X}__inplaceSub($,T,W){let X=0;if(1&T){T>>=1;let U=this.__digit(T),w=32767&U,Y=0;for(;Y<W-1>>>1;Y++){let z=$.__digit(Y),F=(U>>>15)-(32767&z)-X;X=1&F>>>15,this.__setDigit(T+Y,(32767&F)<<15|32767&w),U=this.__digit(T+Y+1),w=(32767&U)-(z>>>15)-X,X=1&w>>>15}let G=$.__digit(Y),H=(U>>>15)-(32767&G)-X;if(X=1&H>>>15,this.__setDigit(T+Y,(32767&H)<<15|32767&w),T+Y+1>=this.length)throw new RangeError("out of bounds");(1&W)==0&&(U=this.__digit(T+Y+1),w=(32767&U)-(G>>>15)-X,X=1&w>>>15,this.__setDigit(T+$.length,1073709056&U|32767&w))}else{T>>=1;let U=0;for(;U<$.length-1;U++){let z=this.__digit(T+U),F=$.__digit(U),O=(32767&z)-(32767&F)-X;X=1&O>>>15;let Q=(z>>>15)-(F>>>15)-X;X=1&Q>>>15,this.__setDigit(T+U,(32767&Q)<<15|32767&O)}let w=this.__digit(T+U),Y=$.__digit(U),G=(32767&w)-(32767&Y)-X;X=1&G>>>15;let H=0;(1&W)==0&&(H=(w>>>15)-(Y>>>15)-X,X=1&H>>>15),this.__setDigit(T+U,(32767&H)<<15|32767&G)}return X}__inplaceRightShift($){if($===0)return;let T=this.__digit(0)>>>$,W=this.length-1;for(let X=0;X<W;X++){let U=this.__digit(X+1);this.__setDigit(X,1073741823&U<<30-$|T),T=U>>>$}this.__setDigit(W,T)}static __specialLeftShift($,T,W){let X=$.length,U=new E(X+W,!1);if(T===0){for(let Y=0;Y<X;Y++)U.__setDigit(Y,$.__digit(Y));return 0<W&&U.__setDigit(X,0),U}let w=0;for(let Y=0;Y<X;Y++){let G=$.__digit(Y);U.__setDigit(Y,1073741823&G<<T|w),w=G>>>30-T}return 0<W&&U.__setDigit(X,w),U}static __leftShiftByAbsolute($,T){let W=E.__toShiftAmount(T);if(0>W)throw new RangeError("BigInt too big");let X=0|W/30,U=W%30,w=$.length,Y=U!==0&&$.__digit(w-1)>>>30-U!=0,G=w+X+(Y?1:0),H=new E(G,$.sign);if(U===0){let z=0;for(;z<X;z++)H.__setDigit(z,0);for(;z<G;z++)H.__setDigit(z,$.__digit(z-X))}else{let z=0;for(let F=0;F<X;F++)H.__setDigit(F,0);for(let F=0;F<w;F++){let O=$.__digit(F);H.__setDigit(F+X,1073741823&O<<U|z),z=O>>>30-U}if(Y)H.__setDigit(w+X,z);else if(z!==0)throw new Error("implementation bug")}return H.__trim()}static __rightShiftByAbsolute($,T){let{length:W,sign:X}=$,U=E.__toShiftAmount(T);if(0>U)return E.__rightShiftByMaximum(X);let w=0|U/30,Y=U%30,G=W-w;if(0>=G)return E.__rightShiftByMaximum(X);let H=!1;if(X){if(($.__digit(w)&(1<<Y)-1)!=0)H=!0;else for(let F=0;F<w;F++)if($.__digit(F)!==0){H=!0;break}}if(H&&Y===0)~$.__digit(W-1)==0&&G++;let z=new E(G,X);if(Y===0){z.__setDigit(G-1,0);for(let F=w;F<W;F++)z.__setDigit(F-w,$.__digit(F))}else{let F=$.__digit(w)>>>Y,O=W-w-1;for(let Q=0;Q<O;Q++){let Z=$.__digit(Q+w+1);z.__setDigit(Q,1073741823&Z<<30-Y|F),F=Z>>>Y}z.__setDigit(O,F)}return H&&(z=E.__absoluteAddOne(z,!0,z)),z.__trim()}static __rightShiftByMaximum($){return $?E.__oneDigit(1,!0):E.__zero()}static __toShiftAmount($){if(1<$.length)return-1;let T=$.__unsignedDigit(0);return T>E.__kMaxLengthBits?-1:T}static __toPrimitive($,T="default"){if(typeof $!="object")return $;if($.constructor===E)return $;if(typeof Symbol!="undefined"&&typeof Symbol.toPrimitive=="symbol"&&$[Symbol.toPrimitive]){let U=$[Symbol.toPrimitive](T);if(typeof U!="object")return U;throw new TypeError("Cannot convert object to primitive value")}let W=$.valueOf;if(W){let U=W.call($);if(typeof U!="object")return U}let X=$.toString;if(X){let U=X.call($);if(typeof U!="object")return U}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric($){return E.__isBigInt($)?$:+$}static __isBigInt($){return typeof $=="object"&&$!==null&&$.constructor===E}static __truncateToNBits($,T){let W=0|($+29)/30,X=new E(W,T.sign),U=W-1;for(let Y=0;Y<U;Y++)X.__setDigit(Y,T.__digit(Y));let w=T.__digit(U);if($%30!=0){let Y=32-$%30;w=w<<Y>>>Y}return X.__setDigit(U,w),X.__trim()}static __truncateAndSubFromPowerOfTwo($,T,W){var X=Math.min;let U=0|($+29)/30,w=new E(U,W),Y=0,G=U-1,H=0;for(let Q=X(G,T.length);Y<Q;Y++){let Z=0-T.__digit(Y)-H;H=1&Z>>>30,w.__setDigit(Y,1073741823&Z)}for(;Y<G;Y++)w.__setDigit(Y,0|1073741823&-H);let z=G<T.length?T.__digit(G):0,F=$%30,O;if(F==0)O=0-z-H,O&=1073741823;else{let Q=32-F;z=z<<Q>>>Q;let Z=1<<32-Q;O=Z-z-H,O&=Z-1}return w.__setDigit(G,O),w.__trim()}__digit($){return this[$]}__unsignedDigit($){return this[$]>>>0}__setDigit($,T){this[$]=0|T}__setDigitGrow($,T){this[$]=0|T}__halfDigitLength(){let $=this.length;return 32767>=this.__unsignedDigit($-1)?2*$-1:2*$}__halfDigit($){return 32767&this[$>>>1]>>>15*(1&$)}__setHalfDigit($,T){let W=$>>>1,X=this.__digit(W),U=1&$?32767&X|T<<15:1073709056&X|32767&T;this.__setDigit(W,U)}static __digitPow($,T){let W=1;for(;0<T;)1&T&&(W*=$),T>>>=1,$*=$;return W}static __detectBigEndian(){return E.__kBitConversionDouble[0]=-0,E.__kBitConversionInts[0]!==0}static __isOneDigitInt($){return(1073741823&$)===$}}E.__kMaxLength=33554432,E.__kMaxLengthBits=E.__kMaxLength<<5,E.__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],E.__kBitsPerCharTableShift=5,E.__kBitsPerCharTableMultiplier=1<<E.__kBitsPerCharTableShift,E.__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"],E.__kBitConversionBuffer=new ArrayBuffer(8),E.__kBitConversionDouble=new Float64Array(E.__kBitConversionBuffer),E.__kBitConversionInts=new Int32Array(E.__kBitConversionBuffer),E.__kBitConversionIntHigh=E.__detectBigEndian()?0:1,E.__kBitConversionIntLow=E.__detectBigEndian()?1:0,E.__clz30=Math.clz32?function($){return Math.clz32($)-2}:function($){return $===0?30:0|29-(0|Math.log($>>>0)/Math.LN2)},E.__imul=Math.imul||function($,T){return 0|$*T};var q=E;var w1=q.BigInt(0),qw=q.BigInt(1),JO=q.BigInt(2),lj=q.BigInt(10),rj=q.BigInt(24),nj=q.BigInt(60),ij=q.BigInt(1000),yw=q.BigInt(1e6),Jw=q.BigInt(1e9),XM=q.multiply(q.BigInt(3600),Jw),tj=q.multiply(nj,Jw),DT=q.multiply(XM,rj);function k0($){return typeof $=="bigint"?q.BigInt($.toString(10)):$}function wM($){return q.equal(q.remainder($,JO),w1)}function OW($){return q.lessThan($,w1)?q.unaryMinus($):$}function xG($,T){return q.lessThan($,T)?-1:q.greaterThan($,T)?1:0}function Vw($,T){return{quotient:q.divide($,T),remainder:q.remainder($,T)}}var _E,kE,Z$="slot-epochNanoSeconds",V$="slot-iso-date",U4="slot-iso-date-time",O4="slot-time",u="slot-calendar",YM="slot-date-brand",GM="slot-year-month-brand",zM="slot-month-day-brand",y$="slot-time-zone",Z6="slot-years",V6="slot-months",f6="slot-weeks",K6="slot-days",A6="slot-hours",E6="slot-minutes",M6="slot-seconds",D6="slot-milliseconds",N6="slot-microseconds",b6="slot-nanoseconds",HM="date",FM="ym",OM="md",QM="time",ZM="datetime",VM="instant",LW="original",v2="timezone-canonical",WO="timezone-original",Kw="calendar-id",KM="locale",UO="options",AM=new WeakMap,XO=Symbol.for("@@Temporal__GetSlots");(_E=globalThis)[XO]||(_E[XO]=function($){return AM.get($)});var lG=globalThis[XO],wO=Symbol.for("@@Temporal__CreateSlots");(kE=globalThis)[wO]||(kE[wO]=function($){AM.set($,Object.create(null))});var f0=globalThis[wO];function k6($,...T){if(!$||typeof $!="object")return!1;let W=lG($);return!!W&&T.every((X)=>(X in W))}function V($,T){let W=lG($)?.[T];if(W===void 0)throw new TypeError(`Missing internal slot ${T}`);return W}function _$($,T,W){let X=lG($);if(X===void 0)throw new TypeError("Missing slots for the given container");if(X[T])throw new TypeError(`${T} already has set`);X[T]=W}var YO={};function b0($,T){Object.defineProperty($.prototype,Symbol.toStringTag,{value:T,writable:!1,enumerable:!1,configurable:!0});let W=Object.getOwnPropertyNames($);for(let U=0;U<W.length;U++){let w=W[U],Y=Object.getOwnPropertyDescriptor($,w);Y.configurable&&Y.enumerable&&(Y.enumerable=!1,Object.defineProperty($,w,Y))}let X=Object.getOwnPropertyNames($.prototype);for(let U=0;U<X.length;U++){let w=X[U],Y=Object.getOwnPropertyDescriptor($.prototype,w);Y.configurable&&Y.enumerable&&(Y.enumerable=!1,Object.defineProperty($.prototype,w,Y))}GO(T,$),GO(`${T}.prototype`,$.prototype)}function GO($,T){let W=`%${$}%`;if(YO[W]!==void 0)throw new Error(`intrinsic ${$} already exists`);YO[W]=T}function i4($){return YO[$]}function q2($,T){let W=$;if(W===0)return{div:W,mod:W};let X=Math.sign(W);W=Math.abs(W);let U=Math.trunc(1+Math.log10(W));if(T>=U)return{div:0*X,mod:X*W};if(T===0)return{div:X*W,mod:0*X};let w=W.toPrecision(U);return{div:X*Number.parseInt(w.slice(0,U-T),10),mod:X*Number.parseInt(w.slice(U-T),10)}}function aF($,T,W){let X=$,U=W;if(X===0)return U;let w=Math.sign(X)||Math.sign(U);X=Math.abs(X),U=Math.abs(U);let Y=X.toPrecision(Math.trunc(1+Math.log10(X)));if(U===0)return w*Number.parseInt(Y+"0".repeat(T),10);let G=Y+U.toPrecision(Math.trunc(1+Math.log10(U))).padStart(T,"0");return w*Number.parseInt(G,10)}function rG($,T){let W=T==="negative";switch($){case"ceil":return W?"zero":"infinity";case"floor":return W?"infinity":"zero";case"expand":return"infinity";case"trunc":return"zero";case"halfCeil":return W?"half-zero":"half-infinity";case"halfFloor":return W?"half-infinity":"half-zero";case"halfExpand":return"half-infinity";case"halfTrunc":return"half-zero";case"halfEven":return"half-even"}}function nG($,T,W,X,U){return U==="zero"?$:U==="infinity"?T:W<0?$:W>0?T:U==="half-zero"?$:U==="half-infinity"?T:X?$:T}class P${constructor($){this.totalNs=k0($),this.sec=q.toNumber(q.divide(this.totalNs,Jw)),this.subsec=q.toNumber(q.remainder(this.totalNs,Jw))}static validateNew($,T){if(q.greaterThan(OW($),P$.MAX))throw new RangeError(`${T} of duration time units cannot exceed ${P$.MAX} s`);return new P$($)}static fromEpochNsDiff($,T){let W=q.subtract(k0($),k0(T));return new P$(W)}static fromComponents($,T,W,X,U,w){let Y=q.add(q.add(q.add(q.add(q.add(q.BigInt(w),q.multiply(q.BigInt(U),ij)),q.multiply(q.BigInt(X),yw)),q.multiply(q.BigInt(W),Jw)),q.multiply(q.BigInt(T),tj)),q.multiply(q.BigInt($),XM));return P$.validateNew(Y,"total")}abs(){return new P$(OW(this.totalNs))}add($){return P$.validateNew(q.add(this.totalNs,$.totalNs),"sum")}add24HourDays($){return P$.validateNew(q.add(this.totalNs,q.multiply(q.BigInt($),DT)),"sum")}addToEpochNs($){return q.add(k0($),this.totalNs)}cmp($){return xG(this.totalNs,$.totalNs)}divmod($){let{quotient:T,remainder:W}=Vw(this.totalNs,q.BigInt($));return{quotient:q.toNumber(T),remainder:new P$(W)}}fdiv($){let T=k0($),W=q.BigInt(T),{quotient:X,remainder:U}=Vw(this.totalNs,W),w=[],Y,G=(q.lessThan(this.totalNs,w1)?-1:1)*Math.sign(q.toNumber(T));for(;!q.equal(U,w1)&&w.length<50;)U=q.multiply(U,lj),{quotient:Y,remainder:U}=Vw(U,W),w.push(Math.abs(q.toNumber(Y)));return G*Number(OW(X).toString()+"."+w.join(""))}isZero(){return q.equal(this.totalNs,w1)}round($,T){let W=k0($);if(q.equal(W,qw))return this;let{quotient:X,remainder:U}=Vw(this.totalNs,W),w=q.lessThan(this.totalNs,w1)?"negative":"positive",Y=q.multiply(OW(X),W),G=q.add(Y,W),H=xG(OW(q.multiply(U,JO)),W),z=rG(T,w),F=q.equal(OW(this.totalNs),Y)?Y:nG(Y,G,H,wM(X),z),O=w==="positive"?F:q.unaryMinus(F);return P$.validateNew(O,"rounding")}sign(){return this.cmp(new P$(w1))}subtract($){return P$.validateNew(q.subtract(this.totalNs,$.totalNs),"difference")}}P$.MAX=q.BigInt("9007199254740991999999999"),P$.ZERO=new P$(w1);var vE=/[A-Za-z._][A-Za-z._0-9+-]*/,hw=new RegExp(`(?:${/(?:[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)/.source}|(?:${vE.source})(?:\\/(?:${vE.source}))*)`),EM=/(?:[+-]\d{6}|\d{4})/,fG=/(?:0[1-9]|1[0-2])/,zO=/(?:0[1-9]|[12]\d|3[01])/,aj=new RegExp(`(${EM.source})(?:-(${fG.source})-(${zO.source})|(${fG.source})(${zO.source}))`),MM=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,DM=/((?:[+-])(?:[01][0-9]|2[0-3])(?::?(?:[0-5][0-9])(?::?(?:[0-5][0-9])(?:[.,](?:\d{1,9}))?)?)?)/,NM=new RegExp(`([zZ])|${DM.source}?`),I2=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,sj=new RegExp([`^${aj.source}`,`(?:(?:[tT]|\\s+)${MM.source}(?:${NM.source})?)?`,`(?:\\[!?(${hw.source})\\])?`,`((?:${I2.source})*)$`].join("")),ej=new RegExp([`^[tT]?${MM.source}`,`(?:${NM.source})?`,`(?:\\[!?${hw.source}\\])?`,`((?:${I2.source})*)$`].join("")),$I=new RegExp(`^(${EM.source})-?(${fG.source})(?:\\[!?${hw.source}\\])?((?:${I2.source})*)$`),TI=new RegExp(`^(?:--)?(${fG.source})-?(${zO.source})(?:\\[!?${hw.source}\\])?((?:${I2.source})*)$`),sF=/(\d+)(?:[.,](\d{1,9}))?/,WI=new RegExp(`(?:${sF.source}H)?(?:${sF.source}M)?(?:${sF.source}S)?`),UI=new RegExp(`^([+-])?P${/(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/.source}(?:T(?!$)${WI.source})?$`,"i"),NT=86400000,bG=1e6*NT,XI=60000000000,LM=1e8*NT,B2=B1(LM),Cw=q.unaryMinus(B2),wI=q.add(q.subtract(Cw,DT),qw),YI=q.subtract(q.add(B2,DT),qw),GI=146097*NT,PE=-271821,qE=275760,Rw=Date.UTC(1847,0,1),zI=["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"],HI=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 Q4($){return typeof $=="object"&&$!==null||typeof $=="function"}function iG($){if(typeof $=="bigint")throw new TypeError("Cannot convert BigInt to number");return Number($)}function tG($){if(typeof $=="symbol")throw new TypeError("Cannot convert a Symbol value to a String");return String($)}function A$($){let T=iG($);if(T===0)return 0;if(Number.isNaN(T)||T===1/0||T===-1/0)throw new RangeError("invalid number value");let W=Math.trunc(T);return W===0?0:W}function CE($,T){let W=A$($);if(W<=0){if(T!==void 0)throw new RangeError(`property '${T}' cannot be a a number less than one`);throw new RangeError("Cannot convert a number less than one to a positive integer")}return W}function j1($){let T=iG($);if(Number.isNaN(T))throw new RangeError("not a number");if(T===1/0||T===-1/0)throw new RangeError("infinity is out of range");if(!function(W){if(typeof W!="number"||Number.isNaN(W)||W===1/0||W===-1/0)return!1;let X=Math.abs(W);return Math.floor(X)===X}(T))throw new RangeError(`unsupported fractional value ${$}`);return T===0?0:T}function Sw($,T){return String($).padStart(T,"0")}function I4($){if(typeof $!="string")throw new TypeError(`expected a string, not ${String($)}`);return $}function HO($,T){if(Q4($)){let W=$?.toString();if(typeof W=="string"||typeof W=="number")return W;throw new TypeError("Cannot convert object to primitive value")}return $}var FO=["era","eraYear","year","month","monthCode","day","hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],FI={era:tG,eraYear:A$,year:A$,month:CE,monthCode:function($){let T=I4(HO($));if(T.length<3||T.length>4||T[0]!=="M"||"0123456789".indexOf(T[1])===-1||"0123456789".indexOf(T[2])===-1||T[1]+T[2]==="00"&&T[3]!=="L"||T[3]!=="L"&&T[3]!==void 0)throw new RangeError(`bad month code ${T}; must match M01-M99 or M00L-M99L`);return T},day:CE,hour:A$,minute:A$,second:A$,millisecond:A$,microsecond:A$,nanosecond:A$,offset:function($){let T=I4(HO($));return d2(T),T},timeZone:R6},OI={hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},x2=[["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"]],SE=Object.fromEntries(x2.map(($)=>[$[0],$[1]])),QI=Object.fromEntries(x2.map(([$,T])=>[T,$])),_w=x2.map(([,$])=>$),f2={day:bG,hour:3600000000000,minute:60000000000,second:1e9,millisecond:1e6,microsecond:1000,nanosecond:1},yG=["days","hours","microseconds","milliseconds","minutes","months","nanoseconds","seconds","weeks","years"],ZI=Intl.DateTimeFormat,jE=new Map;function JM($){let T=fw($),W=jE.get(T);return W===void 0&&(W=new ZI("en-us",{timeZone:T,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),jE.set(T,W)),W}function l4($){return k6($,Z$)&&!k6($,y$,u)}function H4($){return k6($,Z6,V6,K6,A6,E6,M6,D6,N6,b6)}function F4($){return k6($,YM)}function A4($){return k6($,O4)}function i$($){return k6($,U4)}function r4($){return k6($,GM)}function X1($){return k6($,zM)}function v$($){return k6($,Z$,y$,u)}function S($,T){if(!T($))throw new TypeError("invalid receiver: method called with the wrong type of this-object")}function c2($){if(k6($,u)||k6($,y$))throw new TypeError("with() does not support a calendar or timeZone property");if(A4($))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 gw($,T){return T==="never"||T==="auto"&&$==="iso8601"?"":`[${T==="critical"?"!":""}u-ca=${$}]`}function aG($){let T,W,X=!1;for(I2.lastIndex=0;W=I2.exec($);){let{1:U,2:w,3:Y}=W;if(w==="u-ca"){if(T===void 0)T=Y,X=U==="!";else if(U==="!"||X)throw new RangeError(`Invalid annotations in ${$}: more than one u-ca present with critical flag`)}else if(U==="!")throw new RangeError(`Unrecognized annotation: !${w}=${Y}`)}return T}function w0($){let T=sj.exec($);if(!T)throw new RangeError(`invalid RFC 9557 string: ${$}`);let W=aG(T[16]),X=T[1];if(X==="-000000")throw new RangeError(`invalid RFC 9557 string: ${$}`);let U=+X,w=+(T[2]??T[4]??1),Y=+(T[3]??T[5]??1),G=T[6]!==void 0,H=+(T[6]??0),z=+(T[7]??T[10]??0),F=+(T[8]??T[11]??0);F===60&&(F=59);let O=(T[9]??T[12]??"")+"000000000",Q=+O.slice(0,3),Z=+O.slice(3,6),K=+O.slice(6,9),A,D=!1;T[13]?(A=void 0,D=!0):T[14]&&(A=T[14]);let L=T[15];return qO(U,w,Y,H,z,F,Q,Z,K),{year:U,month:w,day:Y,time:G?{hour:H,minute:z,second:F,millisecond:Q,microsecond:Z,nanosecond:K}:"start-of-day",tzAnnotation:L,offset:A,z:D,calendar:W}}function RM($){let T=ej.exec($),W,X,U,w,Y,G,H;if(T){H=aG(T[10]),W=+(T[1]??0),X=+(T[2]??T[5]??0),U=+(T[3]??T[6]??0),U===60&&(U=59);let z=(T[4]??T[7]??"")+"000000000";if(w=+z.slice(0,3),Y=+z.slice(3,6),G=+z.slice(6,9),T[8])throw new RangeError("Z designator not supported for PlainTime")}else{let z,F;if({time:z,z:F,calendar:H}=w0($),z==="start-of-day")throw new RangeError(`time is missing in string: ${$}`);if(F)throw new RangeError("Z designator not supported for PlainTime");({hour:W,minute:X,second:U,millisecond:w,microsecond:Y,nanosecond:G}=z)}if(Tz(W,X,U,w,Y,G),/[tT ][0-9][0-9]/.test($))return{hour:W,minute:X,second:U,millisecond:w,microsecond:Y,nanosecond:G,calendar:H};try{let{month:z,day:F}=_O($);AW(1972,z,F)}catch{try{let{year:z,month:F}=RO($);AW(z,F,1)}catch{return{hour:W,minute:X,second:U,millisecond:w,microsecond:Y,nanosecond:G,calendar:H}}}throw new RangeError(`invalid RFC 9557 time-only string ${$}; may need a T prefix`)}function RO($){let T=$I.exec($),W,X,U,w;if(T){U=aG(T[3]);let Y=T[1];if(Y==="-000000")throw new RangeError(`invalid RFC 9557 string: ${$}`);if(W=+Y,X=+T[2],w=1,U!==void 0&&U!=="iso8601")throw new RangeError("YYYY-MM format is only valid with iso8601 calendar")}else{let Y;if({year:W,month:X,calendar:U,day:w,z:Y}=w0($),Y)throw new RangeError("Z designator not supported for PlainYearMonth")}return{year:W,month:X,calendar:U,referenceISODay:w}}function _O($){let T=TI.exec($),W,X,U,w;if(T){if(U=aG(T[3]),W=+T[1],X=+T[2],U!==void 0&&U!=="iso8601")throw new RangeError("MM-DD format is only valid with iso8601 calendar")}else{let Y;if({month:W,day:X,calendar:U,year:w,z:Y}=w0($),Y)throw new RangeError("Z designator not supported for PlainMonthDay")}return{month:W,day:X,calendar:U,referenceISOYear:w}}var _M=new RegExp(`^${hw.source}$`,"i"),kM=new RegExp(`^${/([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])?)?/.source}$`);function vM($){let T=KI.test($)?"Seconds not allowed in offset time zone":"Invalid time zone";throw new RangeError(`${T}: ${$}`)}function MT($){return _M.test($)||vM($),kM.test($)?{offsetMinutes:d2($)/60000000000}:{tzName:$}}function kw($,T,W,X){let U=$,w=T,Y=W;switch(X){case"reject":AW(U,w,Y);break;case"constrain":({year:U,month:w,day:Y}=pM(U,w,Y))}return{year:U,month:w,day:Y}}function sG($,T,W,X,U,w,Y){let G=$,H=T,z=W,F=X,O=U,Q=w;switch(Y){case"reject":Tz(G,H,z,F,O,Q);break;case"constrain":G=L6(G,0,23),H=L6(H,0,59),z=L6(z,0,59),F=L6(F,0,999),O=L6(O,0,999),Q=L6(Q,0,999)}return{hour:G,minute:H,second:z,millisecond:F,microsecond:O,nanosecond:Q}}function PM($){if(!Q4($))throw new TypeError("invalid duration-like");let T={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},W=!1;for(let X=0;X<yG.length;X++){let U=yG[X],w=$[U];w!==void 0&&(W=!0,T[U]=j1(w))}if(!W)throw new TypeError("invalid duration-like");return T}function $6({years:$,months:T,weeks:W,days:X},U,w,Y){return{years:$,months:Y??T,weeks:w??W,days:U??X}}function x$($,T){return{isoDate:$,time:T}}function j$($){return I0($,"overflow",["constrain","reject"],"constrain")}function vw($){return I0($,"disambiguation",["compatible","earlier","later","reject"],"compatible")}function x1($,T){return I0($,"roundingMode",["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"],T)}function BG($,T){return I0($,"offset",["prefer","use","ignore","reject"],T)}function mw($){return I0($,"calendarName",["auto","always","never","critical"],"auto")}function u2($){let T=$.roundingIncrement;if(T===void 0)return 1;let W=A$(T);if(W<1||W>1e9)throw new RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${T}`);return W}function p2($,T,W){let X=W?T:T-1;if($>X)throw new RangeError(`roundingIncrement must be at least 1 and less than ${X}, not ${$}`);if(T%$!=0)throw new RangeError(`Rounding increment must divide evenly into ${T}`)}function cw($){let T=$.fractionalSecondDigits;if(T===void 0)return"auto";if(typeof T!="number"){if(tG(T)!=="auto")throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${T}`);return"auto"}let W=Math.floor(T);if(!Number.isFinite(W)||W<0||W>9)throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${T}`);return W}function uw($,T){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(T){case"auto":return{precision:T,unit:"nanosecond",increment:1};case 0:return{precision:T,unit:"second",increment:1};case 1:case 2:case 3:return{precision:T,unit:"millisecond",increment:10**(3-T)};case 4:case 5:case 6:return{precision:T,unit:"microsecond",increment:10**(6-T)};case 7:case 8:case 9:return{precision:T,unit:"nanosecond",increment:10**(9-T)};default:throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${T}`)}}var x0=Symbol("~required~");function h6($,T,W,X,U=[]){let w=[];for(let z=0;z<x2.length;z++){let F=x2[z],O=F[1],Q=F[2];W!=="datetime"&&W!==Q||w.push(O)}w=w.concat(U);let Y=X;Y===x0?Y=void 0:Y!==void 0&&w.push(Y);let G=[];G=G.concat(w);for(let z=0;z<w.length;z++){let F=w[z],O=QI[F];O!==void 0&&G.push(O)}let H=I0($,T,G,Y);if(H===void 0&&X===x0)throw new RangeError(`${T} is required`);return H&&H in SE?SE[H]:H}function eF($){let T=$.relativeTo;if(T===void 0)return{};let W,X,U,w,Y,G="option",H=!1;if(Q4(T)){if(v$(T))return{zonedRelativeTo:T};if(F4(T))return{plainRelativeTo:T};if(i$(T))return{plainRelativeTo:J6(V(T,U4).isoDate,V(T,u))};U=rw(T);let z=H1(U,T,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],[]);({isoDate:W,time:X}=dw(U,z,"constrain")),{offset:Y,timeZone:w}=z,Y===void 0&&(G="wall")}else{let z,F,O,Q,Z;if({year:O,month:Q,day:Z,time:X,calendar:U,tzAnnotation:z,offset:Y,z:F}=w0(I4(T)),z)w=R6(z),F?G="exact":Y||(G="wall"),H=!0;else if(F)throw new RangeError("Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone");U||(U="iso8601"),U=v6(U),W={year:O,month:Q,day:Z}}return w===void 0?{plainRelativeTo:J6(W,U)}:{zonedRelativeTo:e4(hG(W,X,G,G==="option"?d2(Y):0,w,"compatible","reject",H),w,U)}}function v0($){return V($,Z6)!==0?"year":V($,V6)!==0?"month":V($,f6)!==0?"week":V($,K6)!==0?"day":V($,A6)!==0?"hour":V($,E6)!==0?"minute":V($,M6)!==0?"second":V($,D6)!==0?"millisecond":V($,N6)!==0?"microsecond":"nanosecond"}function S0($,T){return _w.indexOf($)>_w.indexOf(T)?T:$}function s1($){return $==="year"||$==="month"||$==="week"}function P0($){return s1($)||$==="day"?"date":"time"}function JT($){return i4("%calendarImpl%")($)}function pw($){return i4("%calendarImpl%")(V($,u))}function _6($,T,W="date"){let X=Object.create(null),U=JT($).isoToDate(T,{year:!0,monthCode:!0,day:!0});return X.monthCode=U.monthCode,W!=="month-day"&&W!=="date"||(X.day=U.day),W!=="year-month"&&W!=="date"||(X.year=U.year),X}function H1($,T,W,X,U){let w=JT($).extraFields(W),Y=W.concat(X,w),G=Object.create(null),H=!1;Y.sort();for(let z=0;z<Y.length;z++){let F=Y[z],O=T[F];if(O!==void 0)H=!0,G[F]=FI[F](O);else if(U!=="partial"){if(U.includes(F))throw new TypeError(`required property '${F}' missing or undefined`);G[F]=OI[F]}}if(U==="partial"&&!H)throw new TypeError("no supported properties found");return G}function OO($,T="complete"){let W=["hour","microsecond","millisecond","minute","nanosecond","second"],X=!1,U=Object.create(null);for(let w=0;w<W.length;w++){let Y=W[w],G=$[Y];G!==void 0?(U[Y]=A$(G),X=!0):T==="complete"&&(U[Y]=0)}if(!X)throw new TypeError("invalid time-like");return U}function Aw($,T){if(Q4($)){if(F4($))return j$(U$(T)),J6(V($,V$),V($,u));if(v$($)){let H=M1(V($,y$),V($,Z$));return j$(U$(T)),J6(H.isoDate,V($,u))}if(i$($))return j$(U$(T)),J6(V($,U4).isoDate,V($,u));let G=rw($);return J6(LT(G,H1(G,$,["year","month","monthCode","day"],[],[]),j$(U$(T))),G)}let{year:W,month:X,day:U,calendar:w,z:Y}=w0(I4($));if(Y)throw new RangeError("Z designator not supported for PlainDate");return w||(w="iso8601"),w=v6(w),j$(U$(T)),J6({year:W,month:X,day:U},w)}function dw($,T,W){return x$(LT($,T,W),sG(T.hour,T.minute,T.second,T.millisecond,T.microsecond,T.nanosecond,W))}function Ew($,T){let W,X,U;if(Q4($)){if(i$($))return j$(U$(T)),K1(V($,U4),V($,u));if(v$($)){let G=M1(V($,y$),V($,Z$));return j$(U$(T)),K1(G,V($,u))}if(F4($))return j$(U$(T)),K1(x$(V($,V$),{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),V($,u));U=rw($);let w=H1(U,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond"],[]),Y=j$(U$(T));({isoDate:W,time:X}=dw(U,w,Y))}else{let w,Y,G,H;if({year:Y,month:G,day:H,time:X,calendar:U,z:w}=w0(I4($)),w)throw new RangeError("Z designator not supported for PlainDateTime");X==="start-of-day"&&(X={deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),qO(Y,G,H,X.hour,X.minute,X.second,X.millisecond,X.microsecond,X.nanosecond),U||(U="iso8601"),U=v6(U),j$(U$(T)),W={year:Y,month:G,day:H}}return K1(x$(W,X),U)}function E1($){let T=i4("%Temporal.Duration%");if(H4($))return new T(V($,Z6),V($,V6),V($,f6),V($,K6),V($,A6),V($,E6),V($,M6),V($,D6),V($,N6),V($,b6));if(!Q4($))return function(U){let{years:w,months:Y,weeks:G,days:H,hours:z,minutes:F,seconds:O,milliseconds:Q,microseconds:Z,nanoseconds:K}=function(A){let D=UI.exec(A);if(!D)throw new RangeError(`invalid duration: ${A}`);if(D.every((c,F$)=>F$<2||c===void 0))throw new RangeError(`invalid duration: ${A}`);let L=D[1]==="-"?-1:1,J=D[2]===void 0?0:A$(D[2])*L,_=D[3]===void 0?0:A$(D[3])*L,C=D[4]===void 0?0:A$(D[4])*L,f=D[5]===void 0?0:A$(D[5])*L,b=D[6]===void 0?0:A$(D[6])*L,g=D[7],T$=D[8],N$=D[9],j=D[10],w$=D[11],t=0,z$=0,B$=0;if(g!==void 0){if(T$??N$??j??w$)throw new RangeError("only the smallest unit can be fractional");B$=3600*A$((g+"000000000").slice(0,9))*L}else if(t=T$===void 0?0:A$(T$)*L,N$!==void 0){if(j??w$)throw new RangeError("only the smallest unit can be fractional");B$=60*A$((N$+"000000000").slice(0,9))*L}else z$=j===void 0?0:A$(j)*L,w$!==void 0&&(B$=A$((w$+"000000000").slice(0,9))*L);let e$=B$%1000,h4=Math.trunc(B$/1000)%1000,n6=Math.trunc(B$/1e6)%1000;return z$+=Math.trunc(B$/1e9)%60,t+=Math.trunc(B$/60000000000),Wz(J,_,C,f,b,t,z$,n6,h4,e$),{years:J,months:_,weeks:C,days:f,hours:b,minutes:t,seconds:z$,milliseconds:n6,microseconds:h4,nanoseconds:e$}}(U);return new(i4("%Temporal.Duration%"))(w,Y,G,H,z,F,O,Q,Z,K)}(I4($));let W={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},X=PM($);for(let U=0;U<yG.length;U++){let w=yG[U],Y=X[w];Y!==void 0&&(W[w]=Y)}return new T(W.years,W.months,W.weeks,W.days,W.hours,W.minutes,W.seconds,W.milliseconds,W.microseconds,W.nanoseconds)}function Mw($){let T;if(Q4($)){if(l4($)||v$($))return I1(V($,Z$));T=HO($)}else T=$;let{year:W,month:X,day:U,time:w,offset:Y,z:G}=function(A){let D=w0(A);if(!D.z&&!D.offset)throw new RangeError("Temporal.Instant requires a time zone offset");return D}(I4(T)),{hour:H=0,minute:z=0,second:F=0,millisecond:O=0,microsecond:Q=0,nanosecond:Z=0}=w==="start-of-day"?{}:w,K=xw(W,X,U,H,z,F,O,Q,Z-(G?0:d2(Y)));return j2(K.isoDate),I1(n4(K))}function IE($,T){if(Q4($)){if(X1($))return j$(U$(T)),C2(V($,V$),V($,u));let G;return k6($,u)?G=V($,u):(G=$.calendar,G===void 0&&(G="iso8601"),G=lw(G)),C2(gG(G,H1(G,$,["year","month","monthCode","day"],[],[]),j$(U$(T))),G)}let{month:W,day:X,referenceISOYear:U,calendar:w}=_O(I4($));if(w===void 0&&(w="iso8601"),w=v6(w),j$(U$(T)),w==="iso8601")return C2({year:1972,month:W,day:X},w);let Y={year:U,month:W,day:X};return JW(Y),Y=gG(w,_6(w,Y,"month-day"),"constrain"),C2(Y,w)}function AT($,T){let W;if(Q4($)){if(A4($))return j$(U$(T)),q0(V($,O4));if(i$($))return j$(U$(T)),q0(V($,U4).time);if(v$($)){let z=M1(V($,y$),V($,Z$));return j$(U$(T)),q0(z.time)}let{hour:X,minute:U,second:w,millisecond:Y,microsecond:G,nanosecond:H}=OO($);W=sG(X,U,w,Y,G,H,j$(U$(T)))}else W=RM(I4($)),j$(U$(T));return q0(W)}function qM($){return $===void 0?{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}:V(AT($),O4)}function Dw($,T){if(Q4($)){if(r4($))return j$(U$(T)),S2(V($,V$),V($,u));let G=rw($);return S2(jw(G,H1(G,$,["year","month","monthCode"],[],[]),j$(U$(T))),G)}let{year:W,month:X,referenceISODay:U,calendar:w}=RO(I4($));w===void 0&&(w="iso8601"),w=v6(w),j$(U$(T));let Y={year:W,month:X,day:U};return CO(Y),Y=jw(w,_6(w,Y,"year-month"),"constrain"),S2(Y,w)}function hG($,T,W,X,U,w,Y,G){if(T==="start-of-day")return VT(U,$);let H=x$($,T);if(W==="wall"||Y==="ignore")return T6(U,H,w);if(W==="exact"||Y==="use"){let O=xw($.year,$.month,$.day,T.hour,T.minute,T.second,T.millisecond,T.microsecond,T.nanosecond-X);j2(O.isoDate);let Q=n4(O);return U0(Q),Q}j2($);let z=n4(H),F=Iw(U,H);for(let O=0;O<F.length;O++){let Q=F[O],Z=q.toNumber(q.subtract(z,Q)),K=ET(Z,60000000000,"halfExpand");if(Z===X||G&&K===X)return Q}if(Y==="reject"){let O=QO(X),Q=Bw(H,"iso8601","auto");throw new RangeError(`Offset ${O} is invalid for ${Q} in ${U}`)}return yM(F,U,H,w)}function Nw($,T){let W,X,U,w,Y,G,H,z=!1,F="option";if(Q4($)){if(v$($)){let A=U$(T);return vw(A),BG(A,"reject"),j$(A),e4(V($,Z$),V($,y$),V($,u))}Y=rw($);let Q=H1(Y,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],["timeZone"]);({offset:w,timeZone:U}=Q),w===void 0&&(F="wall");let Z=U$(T);G=vw(Z),H=BG(Z,"reject");let K=j$(Z);({isoDate:W,time:X}=dw(Y,Q,K))}else{let Q,Z,K,A,D;({year:K,month:A,day:D,time:X,tzAnnotation:Q,offset:w,z:Z,calendar:Y}=function(J){let _=w0(J);if(!_.tzAnnotation)throw new RangeError("Temporal.ZonedDateTime requires a time zone ID in brackets");return _}(I4($))),U=R6(Q),Z?F="exact":w||(F="wall"),Y||(Y="iso8601"),Y=v6(Y),z=!0;let L=U$(T);G=vw(L),H=BG(L,"reject"),j$(L),W={year:K,month:A,day:D}}let O=0;return F==="option"&&(O=d2(w)),e4(hG(W,X,F,O,U,G,H,z),U,Y)}function CM($,T,W){JW(T),f0($),_$($,V$,T),_$($,u,W),_$($,YM,!0)}function J6($,T){let W=i4("%Temporal.PlainDate%"),X=Object.create(W.prototype);return CM(X,$,T),X}function SM($,T,W){EW(T),f0($),_$($,U4,T),_$($,u,W)}function K1($,T){let W=i4("%Temporal.PlainDateTime%"),X=Object.create(W.prototype);return SM(X,$,T),X}function jM($,T,W){JW(T),f0($),_$($,V$,T),_$($,u,W),_$($,zM,!0)}function C2($,T){let W=i4("%Temporal.PlainMonthDay%"),X=Object.create(W.prototype);return jM(X,$,T),X}function IM($,T){f0($),_$($,O4,T)}function q0($){let T=i4("%Temporal.PlainTime%"),W=Object.create(T.prototype);return IM(W,$),W}function BM($,T,W){CO(T),f0($),_$($,V$,T),_$($,u,W),_$($,GM,!0)}function S2($,T){let W=i4("%Temporal.PlainYearMonth%"),X=Object.create(W.prototype);return BM(X,$,T),X}function xM($,T){U0(T),f0($),_$($,Z$,T)}function I1($){let T=i4("%Temporal.Instant%"),W=Object.create(T.prototype);return xM(W,$),W}function fM($,T,W,X){U0(T),f0($),_$($,Z$,T),_$($,y$,W),_$($,u,X)}function e4($,T,W="iso8601"){let X=i4("%Temporal.ZonedDateTime%"),U=Object.create(X.prototype);return fM(U,$,T,W),U}function BE($){return FO.filter((T)=>$[T]!==void 0)}function KW($,T,W){let X=BE(W),U=JT($).fieldKeysToIgnore(X),w=Object.create(null),Y=BE(T);for(let G=0;G<FO.length;G++){let H,z=FO[G];Y.includes(z)&&!U.includes(z)&&(H=T[z]),X.includes(z)&&(H=W[z]),H!==void 0&&(w[z]=H)}return w}function G1($,T,W,X){let U=JT($).dateAdd(T,W,X);return JW(U),U}function ow($,T,W,X){return JT($).dateUntil(T,W,X)}function lw($){if(Q4($)&&k6($,u))return V($,u);let T=I4($);try{return v6(T)}catch{}let W;try{({calendar:W}=w0(T))}catch{try{({calendar:W}=RM(T))}catch{try{({calendar:W}=RO(T))}catch{({calendar:W}=_O(T))}}}return W||(W="iso8601"),v6(W)}function rw($){if(k6($,u))return V($,u);let{calendar:T}=$;return T===void 0?"iso8601":lw(T)}function W0($,T){return v6($)===v6(T)}function LT($,T,W){let X=JT($);X.resolveFields(T,"date");let U=X.dateToISO(T,W);return JW(U),U}function jw($,T,W){let X=JT($);X.resolveFields(T,"year-month"),T.day=1;let U=X.dateToISO(T,W);return CO(U),U}function gG($,T,W){let X=JT($);X.resolveFields(T,"month-day");let U=X.monthDayToISOReferenceDate(T,W);return JW(U),U}function R6($){if(Q4($)&&v$($))return V($,y$);let T=I4($);if(T==="UTC")return"UTC";let{tzName:W,offsetMinutes:X}=function(w){let{tzAnnotation:Y,offset:G,z:H}=function(z){if(_M.test(z))return{tzAnnotation:z,offset:void 0,z:!1};try{let{tzAnnotation:F,offset:O,z:Q}=w0(z);if(Q||F||O)return{tzAnnotation:F,offset:O,z:Q}}catch{}vM(z)}(w);return Y?MT(Y):H?MT("UTC"):G?MT(G):void 0}(T);if(X!==void 0)return kO(X);let U=mG(W);if(!U)throw new RangeError(`Unrecognized time zone ${W}`);return U.identifier}function bM($,T){if($===T)return!0;let W=MT($).offsetMinutes,X=MT(T).offsetMinutes;if(W===void 0&&X===void 0){let U=mG(T);if(!U)return!1;let w=mG($);return!!w&&w.primaryIdentifier===U.primaryIdentifier}return W===X}function C0($,T){let W=MT($).offsetMinutes;return W!==void 0?60000000000*W:ZO($,T)}function QO($){let T=$<0?"-":"+",W=Math.abs($),X=Math.floor(W/3600000000000),U=Math.floor(W/60000000000)%60,w=Math.floor(W/1e9)%60,Y=W%1e9;return`${T}${eG(X,U,w,Y,w===0&&Y===0?"minute":"auto")}`}function M1($,T){let W=C0($,T),{isoDate:{year:X,month:U,day:w},time:{hour:Y,minute:G,second:H,millisecond:z,microsecond:F,nanosecond:O}}=mM(T);return xw(X,U,w,Y,G,H,z,F,O+W)}function T6($,T,W){return yM(Iw($,T),$,T,W)}function yM($,T,W,X){let U=$.length;if(U===1)return $[0];if(U)switch(X){case"compatible":case"earlier":return $[0];case"later":return $[U-1];case"reject":throw new RangeError("multiple instants found")}if(X==="reject")throw new RangeError("multiple instants found");let w=n4(W),Y=q.subtract(w,DT);U0(Y);let G=C0(T,Y),H=q.add(w,DT);U0(H);let z=C0(T,H)-G;switch(X){case"earlier":{let F=P$.fromComponents(0,0,0,0,0,-z),O=b2(W.time,F);return Iw(T,x$(g6(W.isoDate.year,W.isoDate.month,W.isoDate.day+O.deltaDays),O))[0]}case"compatible":case"later":{let F=P$.fromComponents(0,0,0,0,0,z),O=b2(W.time,F),Q=Iw(T,x$(g6(W.isoDate.year,W.isoDate.month,W.isoDate.day+O.deltaDays),O));return Q[Q.length-1]}}}function Iw($,T){if($==="UTC")return j2(T.isoDate),[n4(T)];let W=MT($).offsetMinutes;if(W!==void 0){let X=xw(T.isoDate.year,T.isoDate.month,T.isoDate.day,T.time.hour,T.time.minute-W,T.time.second,T.time.millisecond,T.time.microsecond,T.time.nanosecond);j2(X.isoDate);let U=n4(X);return U0(U),[U]}return j2(T.isoDate),function(X,U){let w=n4(U),Y=q.subtract(w,DT);q.lessThan(Y,Cw)&&(Y=w);let G=q.add(w,DT);q.greaterThan(G,B2)&&(G=w);let H=ZO(X,Y),z=ZO(X,G);return(H===z?[H]:[H,z]).map((O)=>{let Q=q.subtract(w,q.BigInt(O)),Z=function(K,A){let{epochMilliseconds:D,time:{millisecond:L,microsecond:J,nanosecond:_}}=mM(A),{year:C,month:f,day:b,hour:g,minute:T$,second:N$}=cM(K,D);return xw(C,f,b,g,T$,N$,L,J,_)}(X,Q);if(y2(U,Z)===0)return U0(Q),Q}).filter((O)=>O!==void 0)}($,T)}function VT($,T){let W=x$(T,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),X=Iw($,W);if(X.length)return X[0];let U=n4(W),w=q.subtract(U,DT);return U0(w),PO($,w)}function nw($){let T;return T=$<0||$>9999?($<0?"-":"+")+Sw(Math.abs($),6):Sw($,4),T}function z1($){return Sw($,2)}function hM($,T){let W;if(T==="auto"){if($===0)return"";W=Sw($,9).replace(/0+$/,"")}else{if(T===0)return"";W=Sw($,9).slice(0,T)}return`.${W}`}function eG($,T,W,X,U){let w=`${z1($)}:${z1(T)}`;return U==="minute"||(w+=`:${z1(W)}`,w+=hM(X,U)),w}function xE($,T,W){let X=T;X===void 0&&(X="UTC");let U=V($,Z$),w=Bw(M1(X,U),"iso8601",W,"never"),Y="Z";return T!==void 0&&(Y=gM(C0(X,U))),`${w}${Y}`}function IG($,T){let W=V($,Z6),X=V($,V6),U=V($,f6),w=V($,K6),Y=V($,A6),G=V($,E6),H=uG($),z="";W!==0&&(z+=`${Math.abs(W)}Y`),X!==0&&(z+=`${Math.abs(X)}M`),U!==0&&(z+=`${Math.abs(U)}W`),w!==0&&(z+=`${Math.abs(w)}D`);let F="";Y!==0&&(F+=`${Math.abs(Y)}H`),G!==0&&(F+=`${Math.abs(G)}M`);let O=P$.fromComponents(0,0,V($,M6),V($,D6),V($,N6),V($,b6));O.isZero()&&!["second","millisecond","microsecond","nanosecond"].includes(v0($))&&T==="auto"||(F+=`${Math.abs(O.sec)}${hM(Math.abs(O.subsec),T)}S`);let Q=`${H<0?"-":""}P${z}`;return F&&(Q=`${Q}T${F}`),Q}function fE($,T="auto"){let{year:W,month:X,day:U}=V($,V$);return`${nw(W)}-${z1(X)}-${z1(U)}${gw(V($,u),T)}`}function bE({hour:$,minute:T,second:W,millisecond:X,microsecond:U,nanosecond:w},Y){return eG($,T,W,1e6*X+1000*U+w,Y)}function Bw($,T,W,X="auto"){let{isoDate:{year:U,month:w,day:Y},time:{hour:G,minute:H,second:z,millisecond:F,microsecond:O,nanosecond:Q}}=$;return`${nw(U)}-${z1(w)}-${z1(Y)}T${eG(G,H,z,1e6*F+1000*O+Q,W)}${gw(T,X)}`}function yE($,T="auto"){let{year:W,month:X,day:U}=V($,V$),w=`${z1(X)}-${z1(U)}`,Y=V($,u);T!=="always"&&T!=="critical"&&Y==="iso8601"||(w=`${nw(W)}-${w}`);let G=gw(Y,T);return G&&(w+=G),w}function hE($,T="auto"){let{year:W,month:X,day:U}=V($,V$),w=`${nw(W)}-${z1(X)}`,Y=V($,u);T!=="always"&&T!=="critical"&&Y==="iso8601"||(w+=`-${z1(U)}`);let G=gw(Y,T);return G&&(w+=G),w}function gE($,T,W="auto",X="auto",U="auto",w=void 0){let Y=V($,Z$);if(w){let{unit:F,increment:O,roundingMode:Q}=w;Y=EO(Y,O,F,Q)}let G=V($,y$),H=C0(G,Y),z=Bw(M1(G,Y),"iso8601",T,"never");return U!=="never"&&(z+=gM(H)),X!=="never"&&(z+=`[${X==="critical"?"!":""}${G}]`),z+=gw(V($,u),W),z}function mE($){return kM.test($)}function d2($){let T=AI.exec($);if(!T)throw new RangeError(`invalid time zone offset: ${$}; must match \xB1HH:MM[:SS.SSSSSSSSS]`);return(T[1]==="-"?-1:1)*(1e9*(60*(60*+T[2]+ +(T[3]||0))+ +(T[4]||0))+ +((T[5]||0)+"000000000").slice(0,9))}var Ow,VI=Object.assign(Object.create(null),{"/":!0,"-":!0,_:!0});function mG($){if(Ow===void 0){let w=Intl.supportedValuesOf?.("timeZone");if(w){Ow=new Map;for(let Y=0;Y<w.length;Y++){let G=w[Y];Ow.set(fw(G),G)}}else Ow=null}let T=fw($),W=Ow?.get(T);if(W)return{identifier:W,primaryIdentifier:W};try{W=JM($).resolvedOptions().timeZone}catch{return}if(T==="antarctica/south_pole"&&(W="Antarctica/McMurdo"),HI.has($))throw new RangeError(`${$} is a legacy time zone identifier from ICU. Use ${W} instead`);let X=[...T].map((w,Y)=>Y===0||VI[T[Y-1]]?w.toUpperCase():w).join("").split("/");if(X.length===1)return T==="gb-eire"?{identifier:"GB-Eire",primaryIdentifier:W}:{identifier:T.length<=3||/[-0-9]/.test(T)?T.toUpperCase():X[0],primaryIdentifier:W};if(X[0]==="Etc")return{identifier:`Etc/${["Zulu","Greenwich","Universal"].includes(X[1])?X[1]:X[1].toUpperCase()}`,primaryIdentifier:W};if(X[0]==="Us")return{identifier:`US/${X[1]}`,primaryIdentifier:W};let U=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 X[1]=U.get(X[1])??X[1],X.length>2&&(X[2]=U.get(X[2])??X[2]),{identifier:X.join("/"),primaryIdentifier:W}}function ZW($,T){let{year:W,month:X,day:U,hour:w,minute:Y,second:G}=cM($,T),H=T%1000;return H<0&&(H+=1000),1e6*(vO({isoDate:{year:W,month:X,day:U},time:{hour:w,minute:Y,second:G,millisecond:H}})-T)}function ZO($,T){return ZW($,D1(T,"floor"))}function kO($){let T=$<0?"-":"+",W=Math.abs($);return`${T}${eG(Math.floor(W/60),W%60,0,0,"minute")}`}function gM($){return kO(ET($,XI,"halfExpand")/60000000000)}function vO({isoDate:{year:$,month:T,day:W},time:{hour:X,minute:U,second:w,millisecond:Y}}){let G=$%400,H=($-G)/400,z=new Date;return z.setUTCHours(X,U,w,Y),z.setUTCFullYear(G,T-1,W),z.getTime()+GI*H}function n4($){let T=vO($),W=1000*$.time.microsecond+$.time.nanosecond;return q.add(B1(T),q.BigInt(W))}function mM($){let T=D1($,"trunc"),W=q.toNumber(q.remainder($,yw));W<0&&(W+=1e6,T-=1);let X=Math.floor(W/1000)%1000,U=W%1000,w=new Date(T);return{epochMilliseconds:T,isoDate:{year:w.getUTCFullYear(),month:w.getUTCMonth()+1,day:w.getUTCDate()},time:{hour:w.getUTCHours(),minute:w.getUTCMinutes(),second:w.getUTCSeconds(),millisecond:w.getUTCMilliseconds(),microsecond:X,nanosecond:U}}}function PO($,T){if($==="UTC")return null;let W=D1(T,"floor");if(W<Rw)return PO($,B1(Rw));let X=Date.now(),U=Math.max(W,X)+366*NT*3,w=W,Y=ZW($,w),G=w,H=Y;for(;Y===H&&w<U;){if(G=w+2*NT*7,G>LM)return null;H=ZW($,G),Y===H&&(w=G)}return Y===H?null:B1(aM((z)=>ZW($,z),w,G,Y,H))}function VO($,T){if($==="UTC")return null;let W=D1(T,"ceil"),X=Date.now(),U=X+366*NT*3;if(W>U){let z=VO($,B1(U));if(z===null||q.lessThan(z,B1(X)))return z}if($==="Africa/Casablanca"||$==="Africa/El_Aaiun"){let z=Date.UTC(2088,0,1);if(z<W)return VO($,B1(z))}let w=W-1;if(w<Rw)return null;let Y=ZW($,w),G=w,H=Y;for(;Y===H&&w>Rw;){if(G=w-2*NT*7,G<Rw)return null;H=ZW($,G),Y===H&&(w=G)}return Y===H?null:B1(aM((z)=>ZW($,z),G,w,H,Y))}function cM($,T){return function(W){let X=W.split(/[^\w]+/);if(X.length!==7)throw new RangeError(`expected 7 parts in "${W}`);let U=+X[0],w=+X[1],Y=+X[2],G=X[3];if(G[0]==="b"||G[0]==="B")Y=1-Y;else if(G[0]!=="a"&&G[0]!=="A")throw new RangeError(`Unknown era ${G} in "${W}`);let H=X[4]==="24"?0:+X[4],z=+X[5],F=+X[6];if(!(Number.isFinite(Y)&&Number.isFinite(U)&&Number.isFinite(w)&&Number.isFinite(H)&&Number.isFinite(z)&&Number.isFinite(F)))throw new RangeError(`Invalid number in "${W}`);return{year:Y,month:U,day:w,hour:H,minute:z,second:F}}(JM($).format(T))}function cG($){return $!==void 0&&!($%4!=0||$%100==0&&$%400!=0)}function VW($,T){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]}[cG($)?"leapyear":"standard"][T-1]}function uG($){let T=[V($,Z6),V($,V6),V($,f6),V($,K6),V($,A6),V($,E6),V($,M6),V($,D6),V($,N6),V($,b6)];for(let W=0;W<T.length;W++){let X=T[W];if(X!==0)return X<0?-1:1}return 0}function $z($){let T=["years","months","weeks","days"];for(let W=0;W<T.length;W++){let X=$[T[W]];if(X!==0)return X<0?-1:1}return 0}function uM($){let T=$z($.date);return T!==0?T:$.time.sign()}function QW($,T){let W=$,X=T;if(!Number.isFinite(W)||!Number.isFinite(X))throw new RangeError("infinity is out of range");return X-=1,W+=Math.floor(X/12),X%=12,X<0&&(X+=12),X+=1,{year:W,month:X}}function g6($,T,W){let X=$,U=T,w=W;if(!Number.isFinite(w))throw new RangeError("infinity is out of range");({year:X,month:U}=QW(X,U));let Y=146097;if(Math.abs(w)>Y){let z=Math.trunc(w/Y);X+=400*z,w-=z*Y}let G=0,H=U>2?X:X-1;for(;G=cG(H)?366:365,w<-G;)X-=1,H-=1,w+=G;for(H+=1;G=cG(H)?366:365,w>G;)X+=1,H+=1,w-=G;for(;w<1;)({year:X,month:U}=QW(X,U-1)),w+=VW(X,U);for(;w>VW(X,U);)w-=VW(X,U),{year:X,month:U}=QW(X,U+1);return{year:X,month:U,day:w}}function xw($,T,W,X,U,w,Y,G,H){let z=KT(X,U,w,Y,G,H);return x$(g6($,T,W+z.deltaDays),z)}function KT($,T,W,X,U,w){let Y,G=$,H=T,z=W,F=X,O=U,Q=w;({div:Y,mod:Q}=q2(Q,3)),O+=Y,Q<0&&(O-=1,Q+=1000),{div:Y,mod:O}=q2(O,3),F+=Y,O<0&&(F-=1,O+=1000),z+=Math.trunc(F/1000),F%=1000,F<0&&(z-=1,F+=1000),H+=Math.trunc(z/60),z%=60,z<0&&(H-=1,z+=60),G+=Math.trunc(H/60),H%=60,H<0&&(G-=1,H+=60);let Z=Math.trunc(G/24);return G%=24,G<0&&(Z-=1,G+=24),Z+=0,G+=0,H+=0,z+=0,F+=0,O+=0,Q+=0,{deltaDays:Z,hour:G,minute:H,second:z,millisecond:F,microsecond:O,nanosecond:Q}}function cE($,T){let W=$6($,0);if($z(W)===0)return $.days;let X=V(T,V$),U=G1(V(T,u),X,W,"constrain"),w=MW(X.year,X.month-1,X.day),Y=MW(U.year,U.month-1,U.day)-w;return $.days+Y}function m6($){return new(i4("%Temporal.Duration%"))(-V($,Z6),-V($,V6),-V($,f6),-V($,K6),-V($,A6),-V($,E6),-V($,M6),-V($,D6),-V($,N6),-V($,b6))}function L6($,T,W){return Math.min(W,Math.max(T,$))}function pM($,T,W){let X=L6(T,1,12);return{year:$,month:X,day:L6(W,1,VW($,X))}}function c4($,T,W){if($<T||$>W)throw new RangeError(`value out of range: ${T} <= ${$} <= ${W}`)}function AW($,T,W){c4(T,1,12),c4(W,1,VW($,T))}function JW($){EW(x$($,{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}))}function Tz($,T,W,X,U,w){c4($,0,23),c4(T,0,59),c4(W,0,59),c4(X,0,999),c4(U,0,999),c4(w,0,999)}function qO($,T,W,X,U,w,Y,G,H){AW($,T,W),Tz(X,U,w,Y,G,H)}function EW($){let T=n4($);(q.lessThan(T,wI)||q.greaterThan(T,YI))&&U0(T)}function KO($){n4($)}function U0($){if(q.lessThan($,Cw)||q.greaterThan($,B2))throw new RangeError("date/time value is outside of supported range")}function CO({year:$,month:T}){c4($,PE,qE),$===PE?c4(T,4,12):$===qE&&c4(T,1,9)}function Wz($,T,W,X,U,w,Y,G,H,z){let F=0,O=[$,T,W,X,U,w,Y,G,H,z];for(let L=0;L<O.length;L++){let J=O[L];if(J===1/0||J===-1/0)throw new RangeError("infinite values not allowed as duration fields");if(J!==0){let _=J<0?-1:1;if(F!==0&&_!==F)throw new RangeError("mixed-sign values not allowed as duration fields");F=_}}if(Math.abs($)>=4294967296||Math.abs(T)>=4294967296||Math.abs(W)>=4294967296)throw new RangeError("years, months, and weeks must be < 2\xB3\xB2");let Q=q2(G,3),Z=q2(H,6),K=q2(z,9),A=q2(1e6*Q.mod+1000*Z.mod+K.mod,9).div,D=86400*X+3600*U+60*w+Y+Q.div+Z.div+K.div+A;if(!Number.isSafeInteger(D))throw new RangeError("total of duration time units cannot exceed 9007199254740991.999999999 s")}function P2($){return{date:{years:V($,Z6),months:V($,V6),weeks:V($,f6),days:V($,K6)},time:P$.fromComponents(V($,A6),V($,E6),V($,M6),V($,D6),V($,N6),V($,b6))}}function $0($){let T=P$.fromComponents(V($,A6),V($,E6),V($,M6),V($,D6),V($,N6),V($,b6)).add24HourDays(V($,K6));return{date:{years:V($,Z6),months:V($,V6),weeks:V($,f6),days:0},time:T}}function dM($){let T=$0($),W=Math.trunc(T.time.sec/86400);return Wz(T.date.years,T.date.months,T.date.weeks,W,0,0,0,0,0,0),{...T.date,days:W}}function A1($,T){let W=$.time.sign(),X=$.time.abs().subsec,U=0,w=0,Y=$.time.abs().sec,G=0,H=0,z=0;switch(T){case"year":case"month":case"week":case"day":U=Math.trunc(X/1000),X%=1000,w=Math.trunc(U/1000),U%=1000,Y+=Math.trunc(w/1000),w%=1000,G=Math.trunc(Y/60),Y%=60,H=Math.trunc(G/60),G%=60,z=Math.trunc(H/24),H%=24;break;case"hour":U=Math.trunc(X/1000),X%=1000,w=Math.trunc(U/1000),U%=1000,Y+=Math.trunc(w/1000),w%=1000,G=Math.trunc(Y/60),Y%=60,H=Math.trunc(G/60),G%=60;break;case"minute":U=Math.trunc(X/1000),X%=1000,w=Math.trunc(U/1000),U%=1000,Y+=Math.trunc(w/1000),w%=1000,G=Math.trunc(Y/60),Y%=60;break;case"second":U=Math.trunc(X/1000),X%=1000,w=Math.trunc(U/1000),U%=1000,Y+=Math.trunc(w/1000),w%=1000;break;case"millisecond":U=Math.trunc(X/1000),X%=1000,w=aF(Y,3,Math.trunc(U/1000)),U%=1000,Y=0;break;case"microsecond":U=aF(Y,6,Math.trunc(X/1000)),X%=1000,Y=0;break;case"nanosecond":X=aF(Y,9,X),Y=0}return new(i4("%Temporal.Duration%"))($.date.years,$.date.months,$.date.weeks,$.date.days+W*z,W*H,W*G,W*Y,W*w,W*U,W*X)}function j0($,T){return $z($),T.sign(),{date:$,time:T}}function MW($,T,W){return vO({isoDate:{year:$,month:T+1,day:W},time:{hour:0,minute:0,second:0,millisecond:0}})/NT}function j2({year:$,month:T,day:W}){if(Math.abs(MW($,T-1,W))>1e8)throw new RangeError("date/time value is outside the supported range")}function SO($,T){let W=T.hour-$.hour,X=T.minute-$.minute,U=T.second-$.second,w=T.millisecond-$.millisecond,Y=T.microsecond-$.microsecond,G=T.nanosecond-$.nanosecond;return P$.fromComponents(W,X,U,w,Y,G)}function jO($,T,W,X,U){let w=P$.fromEpochNsDiff(T,$);return w=pG(w,W,X,U),j0({years:0,months:0,weeks:0,days:0},w)}function oM($,T,W,X){KO($),KO(T);let U=SO($.time,T.time),w=U.sign(),Y=X0($.isoDate,T.isoDate),G=T.isoDate;Y===w&&(G=g6(G.year,G.month,G.day+w),U=U.add24HourDays(-w));let H=S0("day",X),z=ow(W,$.isoDate,G,H);return X!==H&&(U=U.add24HourDays(z.days),z.days=0),j0(z,U)}function lM($,T,W,X,U){let w=q.subtract(T,$);if(q.equal(w,w1))return{date:{years:0,months:0,weeks:0,days:0},time:P$.ZERO};let Y=q.lessThan(w,w1)?-1:1,G=M1(W,$),H=M1(W,T),z,F=0,O=Y===1?2:1,Q=SO(G.time,H.time);for(Q.sign()===-Y&&F++;F<=O;F++){z=x$(g6(H.isoDate.year,H.isoDate.month,H.isoDate.day-F*Y),G.time);let K=T6(W,z,"compatible");if(Q=P$.fromEpochNsDiff(T,K),Q.sign()!==-Y)break}let Z=S0("day",U);return j0(ow(X,G.isoDate,z.isoDate,Z),Q)}function rM($,T,W,X,U,w,Y,G,H){let z,F,O,Q,Z=T;switch(G){case"year":{let t=ET(Z.date.years,Y,"trunc");z=t,F=t+Y*$,O={years:z,months:0,weeks:0,days:0},Q={...O,years:F};break}case"month":{let t=ET(Z.date.months,Y,"trunc");z=t,F=t+Y*$,O=$6(Z.date,0,0,z),Q=$6(Z.date,0,0,F);break}case"week":{let t=$6(Z.date,0,0),z$=G1(w,X.isoDate,t,"constrain"),B$=ow(w,z$,g6(z$.year,z$.month,z$.day+Z.date.days),"week"),e$=ET(Z.date.weeks+B$.weeks,Y,"trunc");z=e$,F=e$+Y*$,O=$6(Z.date,0,z),Q=$6(Z.date,0,F);break}case"day":{let t=ET(Z.date.days,Y,"trunc");z=t,F=t+Y*$,O=$6(Z.date,z),Q=$6(Z.date,F);break}}let K=G1(w,X.isoDate,O,"constrain"),A=G1(w,X.isoDate,Q,"constrain"),D,L,J=x$(K,X.time),_=x$(A,X.time);U?(D=T6(U,J,"compatible"),L=T6(U,_,"compatible")):(D=n4(J),L=n4(_));let C=P$.fromEpochNsDiff(W,D),f=P$.fromEpochNsDiff(L,D),b=rG(H,$<0?"negative":"positive"),g=C.add(C).abs().subtract(f.abs()).sign(),T$=Math.abs(z)/Y%2==0,N$=C.isZero()?Math.abs(z):C.cmp(f)?nG(Math.abs(z),Math.abs(F),g,T$,b):Math.abs(F),j=new P$(q.add(q.multiply(f.totalNs,q.BigInt(z)),q.multiply(C.totalNs,q.BigInt(Y*$)))).fdiv(f.totalNs),w$=N$===Math.abs(F);return Z={date:w$?Q:O,time:P$.ZERO},{nudgeResult:{duration:Z,nudgedEpochNs:w$?L:D,didExpandCalendarUnit:w$},total:j}}function Uz($,T,W,X,U,w,Y,G,H){let z=$,F=s1(G)||X&&G==="day",O=uM(z)<0?-1:1,Q;return F?{nudgeResult:Q}=rM(O,z,T,W,X,U,Y,G,H):Q=X?function(Z,K,A,D,L,J,_,C){let f=K,b=G1(L,A.isoDate,f.date,"constrain"),g=x$(b,A.time),T$=x$(g6(b.year,b.month,b.day+Z),A.time),N$=T6(D,g,"compatible"),j=T6(D,T$,"compatible"),w$=P$.fromEpochNsDiff(j,N$);if(w$.sign()!==Z)throw new RangeError("time zone returned inconsistent Instants");let t=q.BigInt(f2[_]*J),z$=f.time.round(t,C),B$=z$.subtract(w$),e$=B$.sign()!==-Z,h4,n6;return e$?(h4=Z,z$=B$.round(t,C),n6=z$.addToEpochNs(j)):(h4=0,n6=z$.addToEpochNs(N$)),{duration:j0($6(f.date,f.date.days+h4),z$),nudgedEpochNs:n6,didExpandCalendarUnit:e$}}(O,z,W,X,U,Y,G,H):function(Z,K,A,D,L,J){let _=Z,C=_.time.add24HourDays(_.date.days),f=C.round(q.BigInt(D*f2[L]),J),b=f.subtract(C),{quotient:g}=C.divmod(bG),{quotient:T$}=f.divmod(bG),N$=Math.sign(T$-g)===C.sign(),j=b.addToEpochNs(K),w$=0,t=f;return P0(A)==="date"&&(w$=T$,t=f.add(P$.fromComponents(24*-T$,0,0,0,0,0))),{duration:{date:$6(_.date,w$),time:t},nudgedEpochNs:j,didExpandCalendarUnit:N$}}(z,T,w,Y,G,H),z=Q.duration,Q.didExpandCalendarUnit&&G!=="week"&&(z=function(Z,K,A,D,L,J,_,C){let f=K;if(C===_)return f;let b=_w.indexOf(_);for(let g=_w.indexOf(C)-1;g>=b;g--){let T$=_w[g];if(T$==="week"&&_!=="week")continue;let N$;switch(T$){case"year":N$={years:f.date.years+Z,months:0,weeks:0,days:0};break;case"month":{let t=f.date.months+Z;N$=$6(f.date,0,0,t);break}case"week":{let t=f.date.weeks+Z;N$=$6(f.date,0,t);break}}let j=x$(G1(J,D.isoDate,N$,"constrain"),D.time),w$;if(w$=L?T6(L,j,"compatible"):n4(j),xG(A,w$)===-Z)break;f={date:N$,time:P$.ZERO}}return f}(O,z,Q.nudgedEpochNs,W,X,U,w,S0(G,"day"))),z}function uE($,T,W,X,U,w){return s1(w)||X&&w==="day"?rM(uM($)<0?-1:1,$,T,W,X,U,1,w,"trunc").total:Pw($.time.add24HourDays($.date.days),w)}function nM($,T,W,X,U,w,Y){if(y2($,T)==0)return{date:{years:0,months:0,weeks:0,days:0},time:P$.ZERO};EW($),EW(T);let G=oM($,T,W,X);return w==="nanosecond"&&U===1?G:Uz(G,n4(T),$,null,W,X,U,w,Y)}function iM($,T,W,X,U,w,Y,G){if(P0(U)==="time")return jO($,T,w,Y,G);let H=lM($,T,W,X,U);return Y==="nanosecond"&&w===1?H:Uz(H,T,M1(W,$),W,X,U,w,Y,G)}function o2($,T,W,X,U,w){let Y=x2.reduce((Z,K)=>{let A=K[0],D=K[1],L=K[2];return W!=="datetime"&&L!==W||X.includes(D)||Z.push(D,A),Z},[]),G=h6(T,"largestUnit",W,"auto");if(X.includes(G))throw new RangeError(`largestUnit must be one of ${Y.join(", ")}, not ${G}`);let H=u2(T),z=x1(T,"trunc");$==="since"&&(z=function(Z){switch(Z){case"ceil":return"floor";case"floor":return"ceil";case"halfCeil":return"halfFloor";case"halfFloor":return"halfCeil";default:return Z}}(z));let F=h6(T,"smallestUnit",W,U);if(X.includes(F))throw new RangeError(`smallestUnit must be one of ${Y.join(", ")}, not ${F}`);let O=S0(w,F);if(G==="auto"&&(G=O),S0(G,F)!==G)throw new RangeError(`largestUnit ${G} cannot be smaller than smallestUnit ${F}`);let Q={hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[F];return Q!==void 0&&p2(H,Q,!1),{largestUnit:G,roundingIncrement:H,roundingMode:z,smallestUnit:F}}function pE($,T,W,X){let U=Mw(W),w=o2($,U$(X),"time",[],"nanosecond","second"),Y=A1(jO(V(T,Z$),V(U,Z$),w.roundingIncrement,w.smallestUnit,w.roundingMode),w.largestUnit);return $==="since"&&(Y=m6(Y)),Y}function dE($,T,W,X){let U=Aw(W),w=V(T,u),Y=V(U,u);if(!W0(w,Y))throw new RangeError(`cannot compute difference between dates of ${w} and ${Y} calendars`);let G=o2($,U$(X),"date",[],"day","day"),H=i4("%Temporal.Duration%"),z=V(T,V$),F=V(U,V$);if(X0(z,F)===0)return new H;let O={date:ow(w,z,F,G.largestUnit),time:P$.ZERO};if(G.smallestUnit!=="day"||G.roundingIncrement!==1){let Z=x$(z,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});O=Uz(O,n4(x$(F,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),Z,null,w,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode)}let Q=A1(O,"day");return $==="since"&&(Q=m6(Q)),Q}function oE($,T,W,X){let U=Ew(W),w=V(T,u),Y=V(U,u);if(!W0(w,Y))throw new RangeError(`cannot compute difference between dates of ${w} and ${Y} calendars`);let G=o2($,U$(X),"datetime",[],"nanosecond","day"),H=i4("%Temporal.Duration%"),z=V(T,U4),F=V(U,U4);if(y2(z,F)===0)return new H;let O=A1(nM(z,F,w,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode),G.largestUnit);return $==="since"&&(O=m6(O)),O}function lE($,T,W,X){let U=AT(W),w=o2($,U$(X),"time",[],"nanosecond","hour"),Y=SO(V(T,O4),V(U,O4));Y=pG(Y,w.roundingIncrement,w.smallestUnit,w.roundingMode);let G=A1(j0({years:0,months:0,weeks:0,days:0},Y),w.largestUnit);return $==="since"&&(G=m6(G)),G}function rE($,T,W,X){let U=Dw(W),w=V(T,u),Y=V(U,u);if(!W0(w,Y))throw new RangeError(`cannot compute difference between months of ${w} and ${Y} calendars`);let G=o2($,U$(X),"date",["week","day"],"month","year"),H=i4("%Temporal.Duration%");if(X0(V(T,V$),V(U,V$))==0)return new H;let z=_6(w,V(T,V$),"year-month");z.day=1;let F=LT(w,z,"constrain"),O=_6(w,V(U,V$),"year-month");O.day=1;let Q=LT(w,O,"constrain"),Z={date:$6(ow(w,F,Q,G.largestUnit),0,0),time:P$.ZERO};if(G.smallestUnit!=="month"||G.roundingIncrement!==1){let A=x$(F,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});Z=Uz(Z,n4(x$(Q,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),A,null,w,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode)}let K=A1(Z,"day");return $==="since"&&(K=m6(K)),K}function nE($,T,W,X){let U=Nw(W),w=V(T,u),Y=V(U,u);if(!W0(w,Y))throw new RangeError(`cannot compute difference between dates of ${w} and ${Y} calendars`);let G=o2($,U$(X),"datetime",[],"nanosecond","hour"),H=V(T,Z$),z=V(U,Z$),F=i4("%Temporal.Duration%"),O;if(P0(G.largestUnit)!=="date")O=A1(jO(H,z,G.roundingIncrement,G.smallestUnit,G.roundingMode),G.largestUnit);else{let Q=V(T,y$);if(!bM(Q,V(U,y$)))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(q.equal(H,z))return new F;O=A1(iM(H,z,Q,w,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode),"hour")}return $==="since"&&(O=m6(O)),O}function b2({hour:$,minute:T,second:W,millisecond:X,microsecond:U,nanosecond:w},Y){let G=W,H=w;return G+=Y.sec,H+=Y.subsec,KT($,T,G,X,U,H)}function AO($,T){let W=T.addToEpochNs($);return U0(W),W}function Lw($,T,W,X,U="constrain"){if($z(X.date)===0)return AO($,X.time);let w=M1(T,$);return AO(T6(T,x$(G1(W,w.isoDate,X.date,U),w.time),"compatible"),X.time)}function iE($,T,W){let X=E1(W);$==="subtract"&&(X=m6(X));let U=S0(v0(T),v0(X));if(s1(U))throw new RangeError("For years, months, or weeks arithmetic, use date arithmetic relative to a starting point");let w=$0(T),Y=$0(X);return A1(j0({years:0,months:0,weeks:0,days:0},w.time.add(Y.time)),U)}function tE($,T,W){let X=E1(W);$==="subtract"&&(X=m6(X));let U=v0(X);if(P0(U)==="date")throw new RangeError(`Duration field ${U} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);let w=$0(X);return I1(AO(V(T,Z$),w.time))}function aE($,T,W,X){let U=V(T,u),w=E1(W);$==="subtract"&&(w=m6(w));let Y=dM(w),G=j$(U$(X));return J6(G1(U,V(T,V$),Y,G),U)}function sE($,T,W,X){let U=E1(W);$==="subtract"&&(U=m6(U));let w=j$(U$(X)),Y=V(T,u),G=$0(U),H=V(T,U4),z=b2(H.time,G.time),F=$6(G.date,z.deltaDays);return Wz(F.years,F.months,F.weeks,F.days,0,0,0,0,0,0),K1(x$(G1(Y,H.isoDate,F,w),z),Y)}function eE($,T,W){let X=E1(W);$==="subtract"&&(X=m6(X));let U=$0(X),{hour:w,minute:Y,second:G,millisecond:H,microsecond:z,nanosecond:F}=b2(V(T,O4),U.time);return q0(sG(w,Y,G,H,z,F,"reject"))}function $M($,T,W,X){let U=E1(W);$==="subtract"&&(U=m6(U));let w=j$(U$(X)),Y=uG(U),G=V(T,u),H=_6(G,V(T,V$),"year-month");H.day=1;let z=LT(G,H,"constrain");if(Y<0){let O=G1(G,z,{months:1},"constrain");z=g6(O.year,O.month,O.day-1)}let F=dM(U);return JW(z),S2(jw(G,_6(G,G1(G,z,F,w),"year-month"),w),G)}function TM($,T,W,X){let U=E1(W);$==="subtract"&&(U=m6(U));let w=j$(U$(X)),Y=V(T,y$),G=V(T,u),H=P2(U);return e4(Lw(V(T,Z$),Y,G,H,w),Y,G)}function ET($,T,W){let X=Math.trunc($/T),U=$%T,w=$<0?"negative":"positive",Y=Math.abs(X),G=Y+1,H=y6(Math.abs(2*U)-T),z=Y%2==0,F=rG(W,w),O=U===0?Y:nG(Y,G,H,z,F);return T*(w==="positive"?O:-O)}function EO($,T,W,X){let U=f2[W]*T;return function(w,Y,G){let H=k0(w),z=k0(Y),F=q.divide(H,z),O=q.remainder(H,z),Q=rG(G,"positive"),Z,K;q.lessThan(H,w1)?(Z=q.subtract(F,qw),K=F):(Z=F,K=q.add(F,qw));let A=xG(OW(q.multiply(O,JO)),z)*(q.lessThan(H,w1)?-1:1)+0,D=q.equal(O,w1)?F:nG(Z,K,A,wM(Z),Q);return q.multiply(D,z)}($,q.BigInt(U),X)}function MO($,T,W,X){KO($);let{year:U,month:w,day:Y}=$.isoDate,G=DO($.time,T,W,X);return x$(g6(U,w,Y+G.deltaDays),G)}function DO({hour:$,minute:T,second:W,millisecond:X,microsecond:U,nanosecond:w},Y,G,H){let z;switch(G){case"day":case"hour":z=1000*(1000*(1000*(60*(60*$+T)+W)+X)+U)+w;break;case"minute":z=1000*(1000*(1000*(60*T+W)+X)+U)+w;break;case"second":z=1000*(1000*(1000*W+X)+U)+w;break;case"millisecond":z=1000*(1000*X+U)+w;break;case"microsecond":z=1000*U+w;break;case"nanosecond":z=w}let F=f2[G],O=ET(z,F*Y,H)/F;switch(G){case"day":return{deltaDays:O,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case"hour":return KT(O,0,0,0,0,0);case"minute":return KT($,O,0,0,0,0);case"second":return KT($,T,O,0,0,0);case"millisecond":return KT($,T,W,O,0,0);case"microsecond":return KT($,T,W,X,O,0);case"nanosecond":return KT($,T,W,X,U,O);default:throw new Error(`Invalid unit ${G}`)}}function pG($,T,W,X){let U=f2[W];return $.round(q.BigInt(U*T),X)}function Pw($,T){let W=f2[T];return $.fdiv(q.BigInt(W))}function X0($,T){return $.year!==T.year?y6($.year-T.year):$.month!==T.month?y6($.month-T.month):$.day!==T.day?y6($.day-T.day):0}function NO($,T){return $.hour!==T.hour?y6($.hour-T.hour):$.minute!==T.minute?y6($.minute-T.minute):$.second!==T.second?y6($.second-T.second):$.millisecond!==T.millisecond?y6($.millisecond-T.millisecond):$.microsecond!==T.microsecond?y6($.microsecond-T.microsecond):$.nanosecond!==T.nanosecond?y6($.nanosecond-T.nanosecond):0}function y2($,T){let W=X0($.isoDate,T.isoDate);return W!==0?W:NO($.time,T.time)}function tM($){let T=dG($);return globalThis.BigInt!==void 0?globalThis.BigInt(T.toString(10)):T}function D1($,T){let W=k0($),{quotient:X,remainder:U}=Vw(W,yw),w=q.toNumber(X);return T==="floor"&&q.toNumber(U)<0&&(w-=1),T==="ceil"&&q.toNumber(U)>0&&(w+=1),w}function B1($){if(!Number.isInteger($))throw new RangeError("epoch milliseconds must be an integer");return q.multiply(q.BigInt($),yw)}function dG($){let T=$;if(typeof $=="object"){let W=$[Symbol.toPrimitive];W&&typeof W=="function"&&(T=W.call($,"number"))}if(typeof T=="number")throw new TypeError("cannot convert number to bigint");return typeof T=="bigint"?q.BigInt(T.toString(10)):q.BigInt(T)}var LO=(()=>{let $=q.BigInt(Date.now()%1e6);return()=>{let T=Date.now(),W=q.BigInt(T),X=q.add(B1(T),$);return $=q.remainder(W,yw),q.greaterThan(X,B2)?B2:q.lessThan(X,Cw)?Cw:X}})();function Qw(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}function y6($){return $<0?-1:$>0?1:$}function U$($){if($===void 0)return Object.create(null);if(Q4($)&&$!==null)return $;throw new TypeError("Options parameter must be an object, not "+($===null?"null":typeof $))}function DW($,T){let W=Object.create(null);return W[$]=T,W}function I0($,T,W,X){let U=$[T];if(U!==void 0){if(U=tG(U),!W.includes(U))throw new RangeError(`${T} must be one of ${W.join(", ")}, not ${U}`);return U}if(X===x0)throw new RangeError(`${T} option is required`);return X}function v6($){let T=fw($);if(!zI.includes(fw(T)))throw new RangeError(`invalid calendar identifier ${T}`);switch(T){case"ethiopic-amete-alem":return"ethioaa";case"islamicc":return"islamic-civil"}return T}function fw($){let T="";for(let W=0;W<$.length;W++){let X=$.charCodeAt(W);T+=X>=65&&X<=90?String.fromCharCode(X+32):String.fromCharCode(X)}return T}function RT($){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 KI=new RegExp(`^${DM.source}$`),AI=new RegExp(`^${/([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?/.source}$`);function aM($,T,W,X=$(T),U=$(W)){let w=T,Y=W,G=X,H=U;for(;Y-w>1;){let z=Math.trunc((w+Y)/2),F=$(z);F===G?(w=z,G=F):F===H&&(Y=z,H=F)}return Y}function sM($){return[...$]}function eM($,T){if($!=="gregory"&&$!=="iso8601")return;let W=iw[$],X=T.year,{dayOfWeek:U,dayOfYear:w,daysInYear:Y}=W.isoToDate(T,{dayOfWeek:!0,dayOfYear:!0,daysInYear:!0}),G=W.getFirstDayOfWeek(),H=W.getMinimalDaysInFirstWeek(),z=(U+7-G)%7,F=(U-w+7001-G)%7,O=Math.floor((w-1+F)/7);if(7-F>=H&&++O,O==0)O=function(Q,Z,K,A){let D=(A-Q-K+1)%7;D<0&&(D+=7);let L=Math.floor((K+D-1)/7);return 7-D>=Z&&++L,L}(G,H,w+W.isoToDate(W.dateAdd(T,{years:-1},"constrain"),{daysInYear:!0}).daysInYear,U),X--;else if(w>=Y-5){let Q=(z+Y-w)%7;Q<0&&(Q+=7),6-Q>=H&&w+7-z>Y&&(O=1,X++)}return{week:O,year:X}}function WM($,T,W,X,U){if(T!==U.year){if($*(T-U.year)>0)return!0}else if(W!==U.month){if($*(W-U.month)>0)return!0}else if(X!==U.day&&$*(X-U.day)>0)return!0;return!1}var iw={};function NW($){if(!$.startsWith("M"))throw new RangeError(`Invalid month code: ${$}. Month codes must start with M.`);let T=+$.slice(1);if(Number.isNaN(T))throw new RangeError(`Invalid month code: ${$}`);return T}function T0($,T=!1){return`M${`${$}`.padStart(2,"0")}${T?"L":""}`}function IO($,T=void 0,W=12){let{month:X,monthCode:U}=$;if(U===void 0){if(X===void 0)throw new TypeError("Either month or monthCode are required");T==="reject"&&c4(X,1,W),T==="constrain"&&(X=L6(X,1,W)),U=T0(X)}else{let w=NW(U);if(U!==T0(w))throw new RangeError(`Invalid month code: ${U}`);if(X!==void 0&&X!==w)throw new RangeError(`monthCode ${U} and month ${X} must match if both are present`);if(X=w,X<1||X>W)throw new RangeError(`Invalid monthCode: ${U}`)}return{...$,month:X,monthCode:U}}iw.iso8601={resolveFields($,T){if((T==="date"||T==="year-month")&&$.year===void 0)throw new TypeError("year is required");if((T==="date"||T==="month-day")&&$.day===void 0)throw new TypeError("day is required");Object.assign($,IO($))},dateToISO:($,T)=>kw($.year,$.month,$.day,T),monthDayToISOReferenceDate($,T){let{month:W,day:X}=kw($.year??1972,$.month,$.day,T);return{month:W,day:X,year:1972}},extraFields:()=>[],fieldKeysToIgnore($){let T=new Set;for(let W=0;W<$.length;W++){let X=$[W];T.add(X),X==="month"?T.add("monthCode"):X==="monthCode"&&T.add("month")}return sM(T)},dateAdd($,{years:T=0,months:W=0,weeks:X=0,days:U=0},w){let{year:Y,month:G,day:H}=$;return Y+=T,G+=W,{year:Y,month:G}=QW(Y,G),{year:Y,month:G,day:H}=kw(Y,G,H,w),H+=U+7*X,g6(Y,G,H)},dateUntil($,T,W){let X=-X0($,T);if(X===0)return{years:0,months:0,weeks:0,days:0};let U,w=0,Y=0;if(W==="year"||W==="month"){let F=T.year-$.year;for(F!==0&&(F-=X);!WM(X,$.year+F,$.month,$.day,T);)w=F,F+=X;let O=X;for(U=QW($.year+w,$.month+O);!WM(X,U.year,U.month,$.day,T);)Y=O,O+=X,U=QW(U.year,U.month+X);W==="month"&&(Y+=12*w,w=0)}U=QW($.year+w,$.month+Y);let G=pM(U.year,U.month,$.day),H=0,z=MW(T.year,T.month-1,T.day)-MW(G.year,G.month-1,G.day);return W==="week"&&(H=Math.trunc(z/7),z%=7),{years:w,months:Y,weeks:H,days:z}},isoToDate({year:$,month:T,day:W},X){let U={era:void 0,eraYear:void 0,year:$,month:T,day:W,daysInWeek:7,monthsInYear:12};if(X.monthCode&&(U.monthCode=T0(T)),X.dayOfWeek){let w=T+(T<3?10:-2),Y=$-(T<3?1:0),G=Math.floor(Y/100),H=Y-100*G,z=(W+Math.floor(2.6*w-0.2)+(H+Math.floor(H/4))+(Math.floor(G/4)-2*G))%7;U.dayOfWeek=z+(z<=0?7:0)}if(X.dayOfYear){let w=W;for(let Y=T-1;Y>0;Y--)w+=VW($,Y);U.dayOfYear=w}return X.weekOfYear&&(U.weekOfYear=eM("iso8601",{year:$,month:T,day:W})),X.daysInMonth&&(U.daysInMonth=VW($,T)),(X.daysInYear||X.inLeapYear)&&(U.inLeapYear=cG($),U.daysInYear=U.inLeapYear?366:365),U},getFirstDayOfWeek:()=>1,getMinimalDaysInFirstWeek:()=>4};class m4{constructor($){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,$!==void 0){let T=0;for(let W of $.map.entries()){if(++T>m4.MAX_CACHE_ENTRIES)break;this.map.set(...W)}}}get($){let T=this.map.get($);return T&&(this.hits++,this.report()),this.calls++,T}set($,T){this.map.set($,T),this.misses++,this.report()}report(){}setObject($){if(m4.objectMap.get($))throw new RangeError("object already cached");m4.objectMap.set($,this),this.report()}static getCacheForObject($){let T=m4.objectMap.get($);return T||(T=new m4,m4.objectMap.set($,T)),T}}function $D({isoYear:$,isoMonth:T,isoDay:W}){return`${nw($)}-${z1(T)}-${z1(W)}T00:00Z`}function $O($,T){return{years:$.year-T.year,months:$.month-T.month,days:$.day-T.day}}m4.objectMap=new WeakMap,m4.MAX_CACHE_ENTRIES=1000;class _T{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 T=this.getFormatter(),W=new Date($);if($==="-271821-04-19T00:00Z"){let X=T.resolvedOptions();T=new Intl.DateTimeFormat(X.locale,{...X,timeZone:"Etc/GMT+1"}),W=new Date("-271821-04-20T00:00Z")}try{return T.formatToParts(W)}catch(X){throw new RangeError(`Invalid ISO date: ${$}`)}}isoToCalendarDate($,T){let{year:W,month:X,day:U}=$,w=JSON.stringify({func:"isoToCalendarDate",isoYear:W,isoMonth:X,isoDay:U,id:this.id}),Y=T.get(w);if(Y)return Y;let G=$D({isoYear:W,isoMonth:X,isoDay:U}),H=this.getCalendarParts(G),z={};for(let O=0;O<H.length;O++){let{type:Q,value:Z}=H[O];if(Q!=="year"&&Q!=="relatedYear"||(this.hasEra?z.eraYear=+Z:z.year=+Z),Q==="month"){let K=/^([0-9]*)(.*?)$/.exec(Z);if(!K||K.length!=3||!K[1]&&!K[2])throw new RangeError(`Unexpected month: ${Z}`);if(z.month=K[1]?+K[1]:1,z.month<1)throw new RangeError(`Invalid month ${Z} from ${G}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(z.month>13)throw new RangeError(`Invalid month ${Z} from ${G}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);K[2]&&(z.monthExtra=K[2])}Q==="day"&&(z.day=+Z),this.hasEra&&Q==="era"&&Z!=null&&Z!==""&&(z.era=Z.split(" (")[0].normalize("NFD").replace(/[^-0-9 \p{L}]/gu,"").replace(/ /g,"-").toLowerCase())}if(this.hasEra&&z.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((Q)=>z.era===Q.genericName);O&&(z.era=O.code)}if(this.reviseIntlEra){let{era:O,eraYear:Q}=this.reviseIntlEra(z,$);z.era=O,z.eraYear=Q}this.checkIcuBugs&&this.checkIcuBugs($);let F=this.adjustCalendarDate(z,T,"constrain",!0);if(F.year===void 0)throw new RangeError(`Missing year converting ${JSON.stringify($)}`);if(F.month===void 0)throw new RangeError(`Missing month converting ${JSON.stringify($)}`);if(F.day===void 0)throw new RangeError(`Missing day converting ${JSON.stringify($)}`);return T.set(w,F),["constrain","reject"].forEach((O)=>{let Q=JSON.stringify({func:"calendarToIsoDate",year:F.year,month:F.month,day:F.day,overflow:O,id:this.id});T.set(Q,$)}),F}validateCalendarDate($){let{month:T,year:W,day:X,eraYear:U,monthCode:w,monthExtra:Y}=$;if(Y!==void 0)throw new RangeError("Unexpected `monthExtra` value");if(W===void 0&&U===void 0)throw new TypeError("year or eraYear is required");if(T===void 0&&w===void 0)throw new TypeError("month or monthCode is required");if(X===void 0)throw new RangeError("Missing day");if(w!==void 0){if(typeof w!="string")throw new RangeError("monthCode must be a string, not "+typeof w);if(!/^M([01]?\d)(L?)$/.test(w))throw new RangeError(`Invalid monthCode: ${w}`)}if(this.hasEra&&$.era===void 0!=($.eraYear===void 0))throw new TypeError("properties era and eraYear must be provided together")}adjustCalendarDate($,T=void 0,W="constrain",X=!1){if(this.calendarType==="lunisolar")throw new RangeError("Override required for lunisolar calendars");let U=$;this.validateCalendarDate(U);let w=this.monthsInYear(U,T),{month:Y,monthCode:G}=U;return{month:Y,monthCode:G}=IO(U,W,w),{...U,month:Y,monthCode:G}}regulateMonthDayNaive($,T,W){let X=this.monthsInYear($,W),{month:U,day:w}=$;return T==="reject"?(c4(U,1,X),c4(w,1,this.maximumMonthLength($))):(U=L6(U,1,X),w=L6(w,1,this.maximumMonthLength({...$,month:U}))),{...$,month:U,day:w}}calendarToIsoDate($,T="constrain",W){let X=$,U=this.adjustCalendarDate($,W,T,!1);U=this.regulateMonthDayNaive(U,T,W);let{year:w,month:Y,day:G}=U,H=JSON.stringify({func:"calendarToIsoDate",year:w,month:Y,day:G,overflow:T,id:this.id}),z,F=W.get(H);if(F)return F;if(X.year!==void 0&&X.month!==void 0&&X.day!==void 0&&(X.year!==U.year||X.month!==U.month||X.day!==U.day)&&(z=JSON.stringify({func:"calendarToIsoDate",year:X.year,month:X.month,day:X.day,overflow:T,id:this.id}),F=W.get(z),F))return F;let O=this.estimateIsoDate({year:w,month:Y,day:G}),Q=(L)=>{let J=this.addDaysIso(O,L);if(U.day>this.minimumMonthLength(U)){let _=this.isoToCalendarDate(J,W);for(;_.month!==Y||_.year!==w;){if(T==="reject")throw new RangeError(`day ${G} does not exist in month ${Y} of year ${w}`);J=this.addDaysIso(J,-1),_=this.isoToCalendarDate(J,W)}}return J},Z=0,K=this.isoToCalendarDate(O,W),A=$O(U,K);if(A.years!==0||A.months!==0||A.days!==0){let L=365*A.years+30*A.months+A.days;O=this.addDaysIso(O,L),K=this.isoToCalendarDate(O,W),A=$O(U,K),A.years===0&&A.months===0?O=Q(A.days):Z=this.compareCalendarDates(U,K)}let D=8;for(;Z;){O=this.addDaysIso(O,Z*D);let L=K;K=this.isoToCalendarDate(O,W);let J=Z;if(Z=this.compareCalendarDates(U,K),Z){if(A=$O(U,K),A.years===0&&A.months===0)O=Q(A.days),Z=0;else if(J&&Z!==J)if(D>1)D/=2;else{if(T==="reject")throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...X})}`);this.compareCalendarDates(K,L)>0&&(O=this.addDaysIso(O,-1)),Z=0}}}if(W.set(H,O),z&&W.set(z,O),U.year===void 0||U.month===void 0||U.day===void 0||U.monthCode===void 0||this.hasEra&&(U.era===void 0||U.eraYear===void 0))throw new RangeError("Unexpected missing property");return O}compareCalendarDates($,T){return $.year!==T.year?y6($.year-T.year):$.month!==T.month?y6($.month-T.month):$.day!==T.day?y6($.day-T.day):0}regulateDate($,T="constrain",W){let X=this.calendarToIsoDate($,T,W);return this.isoToCalendarDate(X,W)}addDaysIso($,T){return g6($.year,$.month,$.day+T)}addDaysCalendar($,T,W){let X=this.calendarToIsoDate($,"constrain",W),U=this.addDaysIso(X,T);return this.isoToCalendarDate(U,W)}addMonthsCalendar($,T,W,X){let U=$,{day:w}=U;for(let Y=0,G=Math.abs(T);Y<G;Y++){let{month:H}=U,z=U,F=T<0?-Math.max(w,this.daysInPreviousMonth(U,X)):this.daysInMonth(U,X),O=this.calendarToIsoDate(U,"constrain",X),Q=this.addDaysIso(O,F);if(U=this.isoToCalendarDate(Q,X),T>0){let Z=this.monthsInYear(z,X);for(;U.month-1!=H%Z;)Q=this.addDaysIso(Q,-1),U=this.isoToCalendarDate(Q,X)}U.day!==w&&(U=this.regulateDate({...U,day:w},"constrain",X))}if(W==="reject"&&U.day!==w)throw new RangeError(`Day ${w} does not exist in resulting calendar month`);return U}addCalendar($,{years:T=0,months:W=0,weeks:X=0,days:U=0},w,Y){let{year:G,day:H,monthCode:z}=$,F=this.adjustCalendarDate({year:G+T,monthCode:z,day:H},Y),O=this.addMonthsCalendar(F,W,w,Y),Q=U+7*X;return this.addDaysCalendar(O,Q,Y)}untilCalendar($,T,W,X){let U=0,w=0,Y=0,G=0;switch(W){case"day":U=this.calendarDaysUntil($,T,X);break;case"week":{let H=this.calendarDaysUntil($,T,X);U=H%7,w=(H-U)/7;break}case"month":case"year":{let H=this.compareCalendarDates(T,$);if(!H)return{years:0,months:0,weeks:0,days:0};let z=T.year-$.year,F=T.day-$.day;if(W==="year"&&z){let Z=0;T.monthCode>$.monthCode&&(Z=1),T.monthCode<$.monthCode&&(Z=-1),Z||(Z=Math.sign(F)),G=Z*H<0?z-H:z}let O,Q=G?this.addCalendar($,{years:G},"constrain",X):$;do Y+=H,O=Q,Q=this.addMonthsCalendar(O,H,"constrain",X),Q.day!==$.day&&(Q=this.regulateDate({...Q,day:$.day},"constrain",X));while(this.compareCalendarDates(T,Q)*H>=0);Y-=H,U=this.calendarDaysUntil(O,T,X);break}}return{years:G,months:Y,weeks:w,days:U}}daysInMonth($,T){let{day:W}=$,X=this.maximumMonthLength($),U=this.minimumMonthLength($);if(U===X)return U;let w=W<=X-U?X:U,Y=this.calendarToIsoDate($,"constrain",T),G=this.addDaysIso(Y,w),H=this.isoToCalendarDate(G,T),z=this.addDaysIso(G,-H.day);return this.isoToCalendarDate(z,T).day}daysInPreviousMonth($,T){let{day:W,month:X,year:U}=$,w={year:X>1?U:U-1,month:X,day:1},Y=X>1?X-1:this.monthsInYear(w,T);w={...w,month:Y};let G=this.minimumMonthLength(w),H=this.maximumMonthLength(w);if(G===H)return H;let z=this.calendarToIsoDate($,"constrain",T),F=this.addDaysIso(z,-W);return this.isoToCalendarDate(F,T).day}startOfCalendarYear($){return{year:$.year,month:1,monthCode:"M01",day:1}}startOfCalendarMonth($){return{year:$.year,month:$.month,day:1}}calendarDaysUntil($,T,W){let X=this.calendarToIsoDate($,"constrain",W),U=this.calendarToIsoDate(T,"constrain",W);return MW(U.year,U.month-1,U.day)-MW(X.year,X.month-1,X.day)}monthDaySearchStartYear($,T){return 1972}monthDayFromFields($,T,W){let X,U,w,Y,G,{era:H,eraYear:z,year:F,month:O,monthCode:Q,day:Z}=$;if(O!==void 0&&F===void 0&&(!this.hasEra||H===void 0||z===void 0))throw new TypeError("when month is present, year (or era and eraYear) are required");(Q===void 0||F!==void 0||this.hasEra&&z!==void 0)&&({monthCode:Q,day:Z}=this.isoToCalendarDate(this.calendarToIsoDate($,T,W),W));let K={year:this.monthDaySearchStartYear(Q,Z),month:12,day:31},A=this.isoToCalendarDate(K,W),D=A.monthCode>Q||A.monthCode===Q&&A.day>=Z?A.year:A.year-1;for(let L=0;L<20;L++){let J=this.adjustCalendarDate({day:Z,monthCode:Q,year:D-L},W),_=this.calendarToIsoDate(J,"constrain",W),C=this.isoToCalendarDate(_,W);if({year:X,month:U,day:w}=_,C.monthCode===Q&&C.day===Z)return{month:U,day:w,year:X};if(T==="constrain"){let f=this.maxLengthOfMonthCodeInAnyYear(C.monthCode);if(C.monthCode===Q&&C.day===f&&Z>f)return{month:U,day:w,year:X};(Y===void 0||C.monthCode===Y.monthCode&&C.day>Y.day)&&(Y=C,G=_)}}if(T==="constrain"&&G!==void 0)return G;throw new RangeError(`No recent ${this.id} year with monthCode ${Q} and day ${Z}`)}getFirstDayOfWeek(){}getMinimalDaysInFirstWeek(){}}class TD extends _T{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:T}=$;return(7*T+1)%19<7}monthsInYear($){return this.inLeapYear($)?13:12}minimumMonthLength($){return this.minMaxMonthLength($,"min")}maximumMonthLength($){return this.minMaxMonthLength($,"max")}minMaxMonthLength($,T){let{month:W,year:X}=$,U=this.getMonthCode(X,W),w=Object.entries(this.months).find((G)=>G[1].monthCode===U);if(w===void 0)throw new RangeError(`unmatched Hebrew month: ${W}`);let Y=w[1].days;return typeof Y=="number"?Y:Y[T]}maxLengthOfMonthCodeInAnyYear($){return["M04","M06","M08","M10","M12"].includes($)?29:30}estimateIsoDate($){let{year:T}=$;return{year:T-3760,month:1,day:1}}getMonthCode($,T){return this.inLeapYear({year:$})?T===6?T0(5,!0):T0(T<6?T:T-1):T0(T)}adjustCalendarDate($,T,W="constrain",X=!1){let{year:U,month:w,monthCode:Y,day:G,monthExtra:H}=$;if(U===void 0)throw new TypeError("Missing property: year");if(X){if(H){let z=this.months[H];if(!z)throw new RangeError(`Unrecognized month from formatToParts: ${H}`);w=this.inLeapYear({year:U})?z.leap:z.regular}return Y=this.getMonthCode(U,w),{year:U,month:w,day:G,monthCode:Y}}if(this.validateCalendarDate($),w===void 0)if(Y.endsWith("L")){if(Y!=="M05L")throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${Y}`);if(w=6,!this.inLeapYear({year:U})){if(W==="reject")throw new RangeError(`Hebrew monthCode M05L is invalid in year ${U} which is not a leap year`);w=6,Y="M06"}}else{w=NW(Y),this.inLeapYear({year:U})&&w>=6&&w++;let z=this.monthsInYear({year:U});if(w<1||w>z)throw new RangeError(`Invalid monthCode: ${Y}`)}else if(W==="reject"?(c4(w,1,this.monthsInYear({year:U})),c4(G,1,this.maximumMonthLength({year:U,month:w}))):(w=L6(w,1,this.monthsInYear({year:U})),G=L6(G,1,this.maximumMonthLength({year:U,month:w}))),Y===void 0)Y=this.getMonthCode(U,w);else if(this.getMonthCode(U,w)!==Y)throw new RangeError(`monthCode ${Y} doesn't correspond to month ${w} in Hebrew year ${U}`);return{...$,day:G,month:w,monthCode:Y,year:U}}}class RW extends _T{constructor(){super(...arguments),this.calendarType="lunar",this.DAYS_PER_ISLAMIC_YEAR=354.3666666666667,this.DAYS_PER_ISO_YEAR=365.2425}inLeapYear($,T){let W={year:$.year,month:1,monthCode:"M01",day:1},X={year:$.year+1,month:1,monthCode:"M01",day:1};return this.calendarDaysUntil(W,X,T)===355}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear(){return 30}estimateIsoDate($){let{year:T}=this.adjustCalendarDate($);return{year:Math.floor(T*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}}class WD extends RW{constructor(){super(...arguments),this.id="islamic"}}class UD extends RW{constructor(){super(...arguments),this.id="islamic-umalqura"}}class XD extends RW{constructor(){super(...arguments),this.id="islamic-tbla"}}class wD extends RW{constructor(){super(...arguments),this.id="islamic-civil"}}class YD extends RW{constructor(){super(...arguments),this.id="islamic-rgsa"}}class GD extends RW{constructor(){super(...arguments),this.id="islamicc"}}class zD extends _T{constructor(){super(...arguments),this.id="persian",this.calendarType="solar"}inLeapYear($,T){return this.daysInMonth({year:$.year,month:12,day:1},T)===30}monthsInYear(){return 12}minimumMonthLength($){let{month:T}=$;return T===12?29:T<=6?31:30}maximumMonthLength($){let{month:T}=$;return T===12?30:T<=6?31:30}maxLengthOfMonthCodeInAnyYear($){return NW($)<=6?31:30}estimateIsoDate($){let{year:T}=this.adjustCalendarDate($);return{year:T+621,month:1,day:1}}}class HD extends _T{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 BO($.year+78)}monthsInYear(){return 12}minimumMonthLength($){return this.getMonthInfo($).length}maximumMonthLength($){return this.getMonthInfo($).length}maxLengthOfMonthCodeInAnyYear($){let T=NW($),W=this.months[T];return W=W.leap??W,W.length}getMonthInfo($){let{month:T}=$,W=this.months[T];if(W===void 0)throw new RangeError(`Invalid month: ${T}`);return this.inLeapYear($)&&W.leap&&(W=W.leap),W}estimateIsoDate($){let T=this.adjustCalendarDate($),W=this.getMonthInfo(T);return g6(T.year+78+(W.nextYear?1:0),W.month,W.day+T.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 BO($){return $%4==0&&($%100!=0||$%400==0)}class xO extends _T{constructor($,T){super(),this.calendarType="solar",this.id=$,this.isoEpoch=T}inLeapYear($){let{year:T}=this.estimateIsoDate({month:1,day:1,year:$.year});return BO(T)}monthsInYear(){return 12}minimumMonthLength($){let{month:T}=$;return T===2?this.inLeapYear($)?29:28:[4,6,9,11].indexOf(T)>=0?30:31}maximumMonthLength($){return this.minimumMonthLength($)}maxLengthOfMonthCodeInAnyYear($){return[31,29,31,30,31,30,31,31,30,31,30,31][NW($)-1]}estimateIsoDate($){let T=this.adjustCalendarDate($);return kw(T.year+this.isoEpoch.year,T.month+this.isoEpoch.month,T.day+this.isoEpoch.day,"constrain")}}class fO extends _T{constructor($,T){super(),this.hasEra=!0,this.calendarType="solar",this.id=$;let{eras:W,anchorEra:X}=function(U){let w,Y=U;if(Y.length===0)throw new RangeError("Invalid era data: eras are required");if(Y.length===1&&Y[0].reverseOf)throw new RangeError("Invalid era data: anchor era cannot count years backwards");if(Y.length===1&&!Y[0].code)throw new RangeError("Invalid era data: at least one named era is required");if(Y.filter((H)=>H.reverseOf!=null).length>1)throw new RangeError("Invalid era data: only one era can count years backwards");Y.forEach((H)=>{if(H.isAnchor||!H.anchorEpoch&&!H.reverseOf){if(w)throw new RangeError("Invalid era data: cannot have multiple anchor eras");w=H,H.anchorEpoch={year:H.hasYearZero?0:1}}else if(!H.code)throw new RangeError("If era name is blank, it must be the anchor era")}),Y=Y.filter((H)=>H.code),Y.forEach((H)=>{let{reverseOf:z}=H;if(z){let F=Y.find((O)=>O.code===z);if(F===void 0)throw new RangeError(`Invalid era data: unmatched reverseOf era: ${z}`);H.reverseOf=F,H.anchorEpoch=F.anchorEpoch,H.isoEpoch=F.isoEpoch}H.anchorEpoch.month===void 0&&(H.anchorEpoch.month=1),H.anchorEpoch.day===void 0&&(H.anchorEpoch.day=1)}),Y.sort((H,z)=>{if(H.reverseOf)return 1;if(z.reverseOf)return-1;if(!H.isoEpoch||!z.isoEpoch)throw new RangeError("Invalid era data: missing ISO epoch");return z.isoEpoch.year-H.isoEpoch.year});let G=Y[Y.length-1].reverseOf;if(G&&G!==Y[Y.length-2])throw new RangeError("Invalid era data: invalid reverse-sign era");return Y.forEach((H,z)=>{H.genericName="era"+(Y.length-1-z)}),{eras:Y,anchorEra:w||Y[0]}}(T);this.anchorEra=X,this.eras=W}inLeapYear($){let{year:T}=this.estimateIsoDate({month:1,day:1,year:$.year});return BO(T)}monthsInYear(){return 12}minimumMonthLength($){let{month:T}=$;return T===2?this.inLeapYear($)?29:28:[4,6,9,11].indexOf(T)>=0?30:31}maximumMonthLength($){return this.minimumMonthLength($)}maxLengthOfMonthCodeInAnyYear($){return[31,29,31,30,31,30,31,31,30,31,30,31][NW($)-1]}completeEraYear($){let T=(Y,G,H)=>{let z=$[Y];if(z!=null&&z!=G&&!(H||[]).includes(z)){let F=H?.[0];throw new RangeError(`Input ${Y} ${z} doesn't match calculated value ${F?`${G} (also called ${F})`:G}`)}},W=(Y)=>{let G,H={...$,year:Y},z=this.eras.find((F,O)=>{if(O===this.eras.length-1){if(F.reverseOf){if(Y>0)throw new RangeError(`Signed year ${Y} is invalid for era ${F.code}`);return G=F.anchorEpoch.year-Y,!0}return G=Y-F.anchorEpoch.year+(F.hasYearZero?0:1),!0}return this.compareCalendarDates(H,F.anchorEpoch)>=0&&(G=Y-F.anchorEpoch.year+(F.hasYearZero?0:1),!0)});if(!z)throw new RangeError(`Year ${Y} was not matched by any era`);return{eraYear:G,era:z.code,eraNames:z.names}},{year:X,eraYear:U,era:w}=$;if(X!=null){let Y=W(X);({eraYear:U,era:w}=Y),T("era",w,Y?.eraNames),T("eraYear",U)}else{if(U==null)throw new RangeError("Either year or eraYear and era are required");{if(w===void 0)throw new RangeError("era and eraYear must be provided together");let Y=this.eras.find(({code:G,names:H=[]})=>G===w||H.includes(w));if(!Y)throw new RangeError(`Era ${w} (ISO year ${U}) was not matched by any era`);X=Y.reverseOf?Y.anchorEpoch.year-U:U+Y.anchorEpoch.year-(Y.hasYearZero?0:1),T("year",X),{eraYear:U,era:w}=W(X)}}return{...$,year:X,eraYear:U,era:w}}adjustCalendarDate($,T,W="constrain"){let X=$,{month:U,monthCode:w}=X;return U===void 0&&(X={...X,month:NW(w)}),this.validateCalendarDate(X),X=this.completeEraYear(X),super.adjustCalendarDate(X,T,W)}estimateIsoDate($){let T=this.adjustCalendarDate($),{year:W,month:X,day:U}=T,{anchorEra:w}=this;return kw(W+w.isoEpoch.year-(w.hasYearZero?0:1),X,U,"constrain")}}class Xz extends fO{constructor($,T){super($,T)}isoToCalendarDate($){let{year:T,month:W,day:X}=$,U=T0(W),w=T-this.anchorEra.isoEpoch.year+1;return this.completeEraYear({year:w,month:W,monthCode:U,day:X})}}var e1={inLeapYear($){let{year:T}=$;return(T+1)%4==0},monthsInYear:()=>13,minimumMonthLength($){let{month:T}=$;return T===13?this.inLeapYear($)?6:5:30},maximumMonthLength($){return this.minimumMonthLength($)},maxLengthOfMonthCodeInAnyYear:($)=>$==="M13"?6:30};class FD extends xO{constructor($,T){super($,T),this.inLeapYear=e1.inLeapYear,this.monthsInYear=e1.monthsInYear,this.minimumMonthLength=e1.minimumMonthLength,this.maximumMonthLength=e1.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=e1.maxLengthOfMonthCodeInAnyYear}}class bO extends fO{constructor($,T){super($,T),this.inLeapYear=e1.inLeapYear,this.monthsInYear=e1.monthsInYear,this.minimumMonthLength=e1.minimumMonthLength,this.maximumMonthLength=e1.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=e1.maxLengthOfMonthCodeInAnyYear}}class OD extends FD{constructor(){super("ethioaa",{year:-5492,month:7,day:17})}}class QD extends bO{constructor(){super("coptic",[{code:"coptic",isoEpoch:{year:284,month:8,day:29}},{code:"coptic-inverse",reverseOf:"coptic"}])}}class ZD extends bO{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 VD extends Xz{constructor(){super("roc",[{code:"roc",names:["minguo"],isoEpoch:{year:1912,month:1,day:1}},{code:"roc-inverse",names:["before-roc"],reverseOf:"roc"}])}}class KD extends xO{constructor(){super("buddhist",{year:-543,month:1,day:1})}}class AD extends Xz{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:T,eraYear:W}=$;return T==="b"&&(T="gregory-inverse"),T==="a"&&(T="gregory"),{era:T,eraYear:W}}getFirstDayOfWeek(){return 1}getMinimalDaysInFirstWeek(){return 1}}class ED extends Xz{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($,T){let{era:W,eraYear:X}=$,{year:U}=T;return this.eras.find((w)=>w.code===W)?{era:W,eraYear:X}:U<1?{era:"japanese-inverse",eraYear:1-U}:{era:"japanese",eraYear:U}}}class yO extends _T{constructor(){super(...arguments),this.calendarType="lunisolar"}inLeapYear($,T){let W=this.getMonthList($.year,T);return Object.entries(W).length===13}monthsInYear($,T){return this.inLeapYear($,T)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear($){return["M01L","M09L","M10L","M11L","M12L"].includes($)?29:30}monthDaySearchStartYear($,T){let W={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 T<30?W[0]:W[1]}getMonthList($,T){if($===void 0)throw new TypeError("Missing year");let W=JSON.stringify({func:"getMonthList",calendarYear:$,id:this.id}),X=T.get(W);if(X)return X;let U=this.getFormatter(),w=(A,D)=>{let L=$D({isoYear:A,isoMonth:2,isoDay:1}),J=new Date(L);J.setUTCDate(D+1);let _=U.formatToParts(J),C=_.find((T$)=>T$.type==="month").value,f=+_.find((T$)=>T$.type==="day").value,b=_.find((T$)=>T$.type==="relatedYear"),g;if(b===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return g=+b.value,{calendarMonthString:C,calendarDay:f,calendarYearToVerify:g}},Y=17,{calendarMonthString:G,calendarDay:H,calendarYearToVerify:z}=w($,Y);G!=="1"&&(Y+=29,{calendarMonthString:G,calendarDay:H}=w($,Y)),Y-=H-5;let F={},O,Q,Z=1,K=!1;do({calendarMonthString:G,calendarDay:H,calendarYearToVerify:z}=w($,Y)),O&&(F[Q].daysInMonth=O+30-H),z!==$?K=!0:(F[G]={monthIndex:Z++},Y+=30),O=H,Q=G;while(!K);return F[Q].daysInMonth=O+30-H,T.set(W,F),F}estimateIsoDate($){let{year:T,month:W}=$;return{year:T,month:W>=12?12:W+1,day:1}}adjustCalendarDate($,T,W="constrain",X=!1){let{year:U,month:w,monthExtra:Y,day:G,monthCode:H}=$;if(U===void 0)throw new TypeError("Missing property: year");if(X){if(Y&&Y!=="bis")throw new RangeError(`Unexpected leap month suffix: ${Y}`);let z=T0(w,Y!==void 0),F=`${w}${Y||""}`,O=this.getMonthList(U,T)[F];if(O===void 0)throw new RangeError(`Unmatched month ${F} in Chinese year ${U}`);return w=O.monthIndex,{year:U,month:w,day:G,monthCode:z}}if(this.validateCalendarDate($),w===void 0){let z=this.getMonthList(U,T),F=H.replace(/^M|L$/g,(Q)=>Q==="L"?"bis":"");F[0]==="0"&&(F=F.slice(1));let O=z[F];if(w=O&&O.monthIndex,w===void 0&&H.endsWith("L")&&H!="M13L"&&W==="constrain"){let Q=+H.replace(/^M0?|L$/g,"");O=z[Q],O&&(w=O.monthIndex,H=T0(Q))}if(w===void 0)throw new RangeError(`Unmatched month ${H} in Chinese year ${U}`)}else if(H===void 0){let z=this.getMonthList(U,T),F=Object.entries(z),O=F.length;W==="reject"?(c4(w,1,O),c4(G,1,this.maximumMonthLength())):(w=L6(w,1,O),G=L6(G,1,this.maximumMonthLength()));let Q=F.find((Z)=>Z[1].monthIndex===w);if(Q===void 0)throw new RangeError(`Invalid month ${w} in Chinese year ${U}`);H=T0(+Q[0].replace("bis",""),Q[0].indexOf("bis")!==-1)}else{let z=this.getMonthList(U,T),F=H.replace(/^M|L$/g,(Q)=>Q==="L"?"bis":"");F[0]==="0"&&(F=F.slice(1));let O=z[F];if(!O)throw new RangeError(`Unmatched monthCode ${H} in Chinese year ${U}`);if(w!==O.monthIndex)throw new RangeError(`monthCode ${H} doesn't correspond to month ${w} in Chinese year ${U}`)}return{...$,year:U,month:w,monthCode:H,day:G}}}class MD extends yO{constructor(){super(...arguments),this.id="chinese"}}class DD extends yO{constructor(){super(...arguments),this.id="dangi"}}class ND{constructor($){this.helper=$}extraFields($){return this.helper.hasEra&&$.includes("year")?["era","eraYear"]:[]}resolveFields($){if(this.helper.calendarType!=="lunisolar"){let T=new m4;IO($,void 0,this.helper.monthsInYear({year:$.year??1972},T))}}dateToISO($,T){let W=new m4,X=this.helper.calendarToIsoDate($,T,W);return W.setObject(X),X}monthDayToISOReferenceDate($,T){let W=new m4,X=this.helper.monthDayFromFields($,T,W);return W.setObject(X),X}fieldKeysToIgnore($){let T=new Set;for(let W=0;W<$.length;W++){let X=$[W];switch(T.add(X),X){case"era":T.add("eraYear"),T.add("year");break;case"eraYear":T.add("era"),T.add("year");break;case"year":T.add("era"),T.add("eraYear");break;case"month":T.add("monthCode"),this.helper.erasBeginMidYear&&(T.add("era"),T.add("eraYear"));break;case"monthCode":T.add("month"),this.helper.erasBeginMidYear&&(T.add("era"),T.add("eraYear"));break;case"day":this.helper.erasBeginMidYear&&(T.add("era"),T.add("eraYear"))}}return sM(T)}dateAdd($,{years:T,months:W,weeks:X,days:U},w){let Y=m4.getCacheForObject($),G=this.helper.isoToCalendarDate($,Y),H=this.helper.addCalendar(G,{years:T,months:W,weeks:X,days:U},w,Y),z=this.helper.calendarToIsoDate(H,"constrain",Y);return m4.getCacheForObject(z)||new m4(Y).setObject(z),z}dateUntil($,T,W){let X=m4.getCacheForObject($),U=m4.getCacheForObject(T),w=this.helper.isoToCalendarDate($,X),Y=this.helper.isoToCalendarDate(T,U);return this.helper.untilCalendar(w,Y,W,X)}isoToDate($,T){let W=m4.getCacheForObject($),X=this.helper.isoToCalendarDate($,W);if(T.dayOfWeek&&(X.dayOfWeek=iw.iso8601.isoToDate($,{dayOfWeek:!0}).dayOfWeek),T.dayOfYear){let U=this.helper.startOfCalendarYear(X),w=this.helper.calendarDaysUntil(U,X,W);X.dayOfYear=w+1}if(T.weekOfYear&&(X.weekOfYear=eM(this.helper.id,$)),X.daysInWeek=7,T.daysInMonth&&(X.daysInMonth=this.helper.daysInMonth(X,W)),T.daysInYear){let U=this.helper.startOfCalendarYear(X),w=this.helper.addCalendar(U,{years:1},"constrain",W);X.daysInYear=this.helper.calendarDaysUntil(U,w,W)}return T.monthsInYear&&(X.monthsInYear=this.helper.monthsInYear(X,W)),T.inLeapYear&&(X.inLeapYear=this.helper.inLeapYear(X,W)),X}getFirstDayOfWeek(){return this.helper.getFirstDayOfWeek()}getMinimalDaysInFirstWeek(){return this.helper.getMinimalDaysInFirstWeek()}}for(let $ of[TD,zD,ZD,OD,QD,MD,DD,VD,HD,KD,AD,ED,WD,UD,XD,wD,YD,GD]){let T=new $;iw[T.id]=new ND(T)}GO("calendarImpl",function($){return iw[$]});var bw=Intl.DateTimeFormat;function R2($,T){let W=V($,T);return typeof W=="function"&&(W=new bw(V($,KM),W(V($,UO))),function(X,U,w){let Y=lG(X);if(Y===void 0)throw new TypeError("Missing slots for the given container");if(Y[U]===void 0)throw new TypeError(`tried to reset ${U} which was not set`);Y[U]=w}($,T,W)),W}function Zw($){return k6($,LW)}class h2{constructor($=void 0,T=void 0){(function(W,X,U){let w=U!==void 0,Y;if(w){let F=["localeMatcher","calendar","numberingSystem","hour12","hourCycle","timeZone","weekday","era","year","month","day","dayPeriod","hour","minute","second","fractionalSecondDigits","timeZoneName","formatMatcher","dateStyle","timeStyle"];Y=function(Q){if(Q==null)throw new TypeError(`Expected object not ${Q}`);return Object(Q)}(U);let O=Object.create(null);for(let Q=0;Q<F.length;Q++){let Z=F[Q];Object.prototype.hasOwnProperty.call(Y,Z)&&(O[Z]=Y[Z])}Y=O}else Y=Object.create(null);let G=new bw(X,Y),H=G.resolvedOptions();if(f0(W),w){let F=Object.assign(Object.create(null),H);for(let O in F)Object.prototype.hasOwnProperty.call(Y,O)||delete F[O];F.hour12=Y.hour12,F.hourCycle=Y.hourCycle,_$(W,UO,F)}else _$(W,UO,Y);_$(W,KM,H.locale),_$(W,LW,G),_$(W,v2,H.timeZone),_$(W,Kw,H.calendar),_$(W,HM,kI),_$(W,FM,RI),_$(W,OM,_I),_$(W,QM,JI),_$(W,ZM,vI),_$(W,VM,PI);let z=w?Y.timeZone:void 0;if(z===void 0)_$(W,WO,H.timeZone);else{let F=tG(z);if(F.startsWith("\u2212"))throw new RangeError("Unicode minus (U+2212) is not supported in time zone offsets");_$(W,WO,R6(F))}})(this,$,T)}get format(){S(this,Zw);let $=MI.bind(this);return Object.defineProperties($,{length:{value:1,enumerable:!1,writable:!1,configurable:!0},name:{value:"",enumerable:!1,writable:!1,configurable:!0}}),$}formatRange($,T){return S(this,Zw),NI.call(this,$,T)}formatToParts($,...T){return S(this,Zw),DI.call(this,$,...T)}formatRangeToParts($,T){return S(this,Zw),LI.call(this,$,T)}resolvedOptions(){return S(this,Zw),EI.call(this)}}"formatToParts"in bw.prototype||delete h2.prototype.formatToParts,"formatRangeToParts"in bw.prototype||delete h2.prototype.formatRangeToParts;var Y1=function($=void 0,T=void 0){return new h2($,T)};function EI(){let $=V(this,LW).resolvedOptions();return $.timeZone=V(this,WO),$}function MI($,...T){let W,X,U=g2($,this);return U.formatter?(W=U.formatter,X=[D1(U.epochNs,"floor")]):(W=V(this,LW),X=[$,...T]),W.format(...X)}function DI($,...T){let W,X,U=g2($,this);return U.formatter?(W=U.formatter,X=[D1(U.epochNs,"floor")]):(W=V(this,LW),X=[$,...T]),W.formatToParts(...X)}function NI($,T){if($===void 0||T===void 0)throw new TypeError("Intl.DateTimeFormat.formatRange requires two values");let W=oG($),X=oG(T),U,w=[W,X];if(B0(W)!==B0(X))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");if(B0(W)){if(!LD(W,X))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");let{epochNs:Y,formatter:G}=g2(W,this),{epochNs:H,formatter:z}=g2(X,this);G&&(U=G,w=[D1(Y,"floor"),D1(H,"floor")])}return U||(U=V(this,LW)),U.formatRange(...w)}function LI($,T){if($===void 0||T===void 0)throw new TypeError("Intl.DateTimeFormat.formatRange requires two values");let W=oG($),X=oG(T),U,w=[W,X];if(B0(W)!==B0(X))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");if(B0(W)){if(!LD(W,X))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");let{epochNs:Y,formatter:G}=g2(W,this),{epochNs:H,formatter:z}=g2(X,this);G&&(U=G,w=[D1(Y,"floor"),D1(H,"floor")])}return U||(U=V(this,LW)),U.formatRangeToParts(...w)}function tw($={},T={}){let W=Object.assign({},$),X=["year","month","day","hour","minute","second","weekday","dayPeriod","timeZoneName","dateStyle","timeStyle"];for(let U=0;U<X.length;U++){let w=X[U];W[w]=w in T?T[w]:W[w],W[w]!==!1&&W[w]!==void 0||delete W[w]}return W}function JI($){let T=tw($,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});if(T.timeStyle!=="long"&&T.timeStyle!=="full"||(delete T.timeStyle,Object.assign(T,{hour:"numeric",minute:"2-digit",second:"2-digit"})),!Yz(T)){if(aw($))throw new TypeError(`cannot format Temporal.PlainTime with options [${Object.keys($)}]`);Object.assign(T,{hour:"numeric",minute:"numeric",second:"numeric"})}return T}function RI($){let T={short:{year:"2-digit",month:"numeric"},medium:{year:"numeric",month:"short"},long:{year:"numeric",month:"long"},full:{year:"numeric",month:"long"}},W=tw($,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if("dateStyle"in W&&W.dateStyle){let X=W.dateStyle;delete W.dateStyle,Object.assign(W,T[X])}if(!(("year"in W)||("month"in W)||("era"in W))){if(aw($))throw new TypeError(`cannot format PlainYearMonth with options [${Object.keys($)}]`);Object.assign(W,{year:"numeric",month:"numeric"})}return W}function _I($){let T={short:{month:"numeric",day:"numeric"},medium:{month:"short",day:"numeric"},long:{month:"long",day:"numeric"},full:{month:"long",day:"numeric"}},W=tw($,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if("dateStyle"in W&&W.dateStyle){let X=W.dateStyle;delete W.dateStyle,Object.assign(W,T[X])}if(!("month"in W)&&!("day"in W)){if(aw($))throw new TypeError(`cannot format PlainMonthDay with options [${Object.keys($)}]`);Object.assign(W,{month:"numeric",day:"numeric"})}return W}function kI($){let T=tw($,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(!wz(T)){if(aw($))throw new TypeError(`cannot format PlainDate with options [${Object.keys($)}]`);Object.assign(T,{year:"numeric",month:"numeric",day:"numeric"})}return T}function vI($){let T=tw($,{timeZoneName:!1});if((T.timeStyle==="long"||T.timeStyle==="full")&&(delete T.timeStyle,Object.assign(T,{hour:"numeric",minute:"2-digit",second:"2-digit"}),T.dateStyle))Object.assign(T,{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"}}[T.dateStyle]),delete T.dateStyle;if(!Yz(T)&&!wz(T)){if(aw($))throw new TypeError(`cannot format PlainDateTime with options [${Object.keys($)}]`);Object.assign(T,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}return T}function PI($){let T=$;return Yz(T)||wz(T)||(T=Object.assign({},T,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),T}function wz($){return"year"in $||"month"in $||"day"in $||"weekday"in $||"dateStyle"in $||"era"in $}function Yz($){return"hour"in $||"minute"in $||"second"in $||"timeStyle"in $||"dayPeriod"in $||"fractionalSecondDigits"in $}function aw($){return wz($)||Yz($)||"dateStyle"in $||"timeStyle"in $||"timeZoneName"in $}function B0($){return F4($)||A4($)||i$($)||v$($)||r4($)||X1($)||l4($)}function oG($){return B0($)?$:iG($)}function LD($,T){return!(!B0($)||!B0(T)||A4($)&&!A4(T)||F4($)&&!F4(T)||i$($)&&!i$(T)||v$($)&&!v$(T)||r4($)&&!r4(T)||X1($)&&!X1(T)||l4($)&&!l4(T))}function g2($,T){if(A4($)){let W={isoDate:{year:1970,month:1,day:1},time:V($,O4)};return{epochNs:T6(V(T,v2),W,"compatible"),formatter:R2(T,QM)}}if(r4($)){let W=V($,u),X=V(T,Kw);if(W!==X)throw new RangeError(`cannot format PlainYearMonth with calendar ${W} in locale with calendar ${X}`);let U=x$(V($,V$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:T6(V(T,v2),U,"compatible"),formatter:R2(T,FM)}}if(X1($)){let W=V($,u),X=V(T,Kw);if(W!==X)throw new RangeError(`cannot format PlainMonthDay with calendar ${W} in locale with calendar ${X}`);let U=x$(V($,V$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:T6(V(T,v2),U,"compatible"),formatter:R2(T,OM)}}if(F4($)){let W=V($,u),X=V(T,Kw);if(W!=="iso8601"&&W!==X)throw new RangeError(`cannot format PlainDate with calendar ${W} in locale with calendar ${X}`);let U=x$(V($,V$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:T6(V(T,v2),U,"compatible"),formatter:R2(T,HM)}}if(i$($)){let W=V($,u),X=V(T,Kw);if(W!=="iso8601"&&W!==X)throw new RangeError(`cannot format PlainDateTime with calendar ${W} in locale with calendar ${X}`);let U=V($,U4);return{epochNs:T6(V(T,v2),U,"compatible"),formatter:R2(T,ZM)}}if(v$($))throw new TypeError("Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.");return l4($)?{epochNs:V($,Z$),formatter:R2(T,VM)}:{}}function JD($){let T=Object.create(null);return T.years=V($,Z6),T.months=V($,V6),T.weeks=V($,f6),T.days=V($,K6),T.hours=V($,A6),T.minutes=V($,E6),T.seconds=V($,M6),T.milliseconds=V($,D6),T.microseconds=V($,N6),T.nanoseconds=V($,b6),T}h2.prototype.constructor=Y1,Object.defineProperty(Y1,"prototype",{value:h2.prototype,writable:!1,enumerable:!1,configurable:!1}),Y1.supportedLocalesOf=bw.supportedLocalesOf,b0(Y1,"Intl.DateTimeFormat");var{format:qI,formatToParts:CI}=Intl.DurationFormat?.prototype??Object.create(null);function hO($){Intl.DurationFormat.prototype.resolvedOptions.call(this);let T=JD(E1($));return qI.call(this,T)}Intl.DurationFormat?.prototype&&(Intl.DurationFormat.prototype.format=hO,Intl.DurationFormat.prototype.formatToParts=function($){Intl.DurationFormat.prototype.resolvedOptions.call(this);let T=JD(E1($));return CI.call(this,T)});var ut=Object.freeze({__proto__:null,DateTimeFormat:Y1,ModifiedIntlDurationFormatPrototypeFormat:hO});class Gz{constructor($){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");xM(this,dG($))}get epochMilliseconds(){return S(this,l4),D1(V(this,Z$),"floor")}get epochNanoseconds(){return S(this,l4),tM(q.BigInt(V(this,Z$)))}add($){return S(this,l4),tE("add",this,$)}subtract($){return S(this,l4),tE("subtract",this,$)}until($,T=void 0){return S(this,l4),pE("until",this,$,T)}since($,T=void 0){return S(this,l4),pE("since",this,$,T)}round($){if(S(this,l4),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?DW("smallestUnit",$):U$($),W=u2(T),X=x1(T,"halfExpand"),U=h6(T,"smallestUnit","time",x0);return p2(W,{hour:24,minute:1440,second:86400,millisecond:86400000,microsecond:86400000000,nanosecond:86400000000000}[U],!0),I1(EO(V(this,Z$),W,U,X))}equals($){S(this,l4);let T=Mw($),W=V(this,Z$),X=V(T,Z$);return q.equal(q.BigInt(W),q.BigInt(X))}toString($=void 0){S(this,l4);let T=U$($),W=cw(T),X=x1(T,"trunc"),U=h6(T,"smallestUnit","time",void 0);if(U==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let w=T.timeZone;w!==void 0&&(w=R6(w));let{precision:Y,unit:G,increment:H}=uw(U,W);return xE(I1(EO(V(this,Z$),H,G,X)),w,Y)}toJSON(){return S(this,l4),xE(this,void 0,"auto")}toLocaleString($=void 0,T=void 0){return S(this,l4),new Y1($,T).format(this)}valueOf(){RT("Instant")}toZonedDateTimeISO($){S(this,l4);let T=R6($);return e4(V(this,Z$),T,"iso8601")}static fromEpochMilliseconds($){return I1(B1(iG($)))}static fromEpochNanoseconds($){return I1(dG($))}static from($){return Mw($)}static compare($,T){let W=Mw($),X=Mw(T),U=V(W,Z$),w=V(X,Z$);return q.lessThan(U,w)?-1:q.greaterThan(U,w)?1:0}}b0(Gz,"Temporal.Instant");class zz{constructor($,T,W,X="iso8601"){let U=A$($),w=A$(T),Y=A$(W),G=v6(X===void 0?"iso8601":I4(X));AW(U,w,Y),CM(this,{year:U,month:w,day:Y},G)}get calendarId(){return S(this,F4),V(this,u)}get era(){return F6(this,"era")}get eraYear(){return F6(this,"eraYear")}get year(){return F6(this,"year")}get month(){return F6(this,"month")}get monthCode(){return F6(this,"monthCode")}get day(){return F6(this,"day")}get dayOfWeek(){return F6(this,"dayOfWeek")}get dayOfYear(){return F6(this,"dayOfYear")}get weekOfYear(){return F6(this,"weekOfYear")?.week}get yearOfWeek(){return F6(this,"weekOfYear")?.year}get daysInWeek(){return F6(this,"daysInWeek")}get daysInMonth(){return F6(this,"daysInMonth")}get daysInYear(){return F6(this,"daysInYear")}get monthsInYear(){return F6(this,"monthsInYear")}get inLeapYear(){return F6(this,"inLeapYear")}with($,T=void 0){if(S(this,F4),!Q4($))throw new TypeError("invalid argument");c2($);let W=V(this,u),X=_6(W,V(this,V$));return X=KW(W,X,H1(W,$,["year","month","monthCode","day"],[],"partial")),J6(LT(W,X,j$(U$(T))),W)}withCalendar($){S(this,F4);let T=lw($);return J6(V(this,V$),T)}add($,T=void 0){return S(this,F4),aE("add",this,$,T)}subtract($,T=void 0){return S(this,F4),aE("subtract",this,$,T)}until($,T=void 0){return S(this,F4),dE("until",this,$,T)}since($,T=void 0){return S(this,F4),dE("since",this,$,T)}equals($){S(this,F4);let T=Aw($);return X0(V(this,V$),V(T,V$))===0&&W0(V(this,u),V(T,u))}toString($=void 0){return S(this,F4),fE(this,mw(U$($)))}toJSON(){return S(this,F4),fE(this)}toLocaleString($=void 0,T=void 0){return S(this,F4),new Y1($,T).format(this)}valueOf(){RT("PlainDate")}toPlainDateTime($=void 0){S(this,F4);let T=qM($);return K1(x$(V(this,V$),T),V(this,u))}toZonedDateTime($){let T,W;if(S(this,F4),Q4($)){let w=$.timeZone;w===void 0?T=R6($):(T=R6(w),W=$.plainTime)}else T=R6($);let X=V(this,V$),U;return W===void 0?U=VT(T,X):(W=AT(W),U=T6(T,x$(X,V(W,O4)),"compatible")),e4(U,T,V(this,u))}toPlainYearMonth(){S(this,F4);let $=V(this,u);return S2(jw($,_6($,V(this,V$)),"constrain"),$)}toPlainMonthDay(){S(this,F4);let $=V(this,u);return C2(gG($,_6($,V(this,V$)),"constrain"),$)}static from($,T=void 0){return Aw($,T)}static compare($,T){let W=Aw($),X=Aw(T);return X0(V(W,V$),V(X,V$))}}function F6($,T){S($,F4);let W=V($,V$);return pw($).isoToDate(W,{[T]:!0})[T]}b0(zz,"Temporal.PlainDate");class Hz{constructor($,T,W,X=0,U=0,w=0,Y=0,G=0,H=0,z="iso8601"){let F=A$($),O=A$(T),Q=A$(W),Z=X===void 0?0:A$(X),K=U===void 0?0:A$(U),A=w===void 0?0:A$(w),D=Y===void 0?0:A$(Y),L=G===void 0?0:A$(G),J=H===void 0?0:A$(H),_=v6(z===void 0?"iso8601":I4(z));qO(F,O,Q,Z,K,A,D,L,J),SM(this,{isoDate:{year:F,month:O,day:Q},time:{hour:Z,minute:K,second:A,millisecond:D,microsecond:L,nanosecond:J}},_)}get calendarId(){return S(this,i$),V(this,u)}get year(){return O6(this,"year")}get month(){return O6(this,"month")}get monthCode(){return O6(this,"monthCode")}get day(){return O6(this,"day")}get hour(){return _2(this,"hour")}get minute(){return _2(this,"minute")}get second(){return _2(this,"second")}get millisecond(){return _2(this,"millisecond")}get microsecond(){return _2(this,"microsecond")}get nanosecond(){return _2(this,"nanosecond")}get era(){return O6(this,"era")}get eraYear(){return O6(this,"eraYear")}get dayOfWeek(){return O6(this,"dayOfWeek")}get dayOfYear(){return O6(this,"dayOfYear")}get weekOfYear(){return O6(this,"weekOfYear")?.week}get yearOfWeek(){return O6(this,"weekOfYear")?.year}get daysInWeek(){return O6(this,"daysInWeek")}get daysInYear(){return O6(this,"daysInYear")}get daysInMonth(){return O6(this,"daysInMonth")}get monthsInYear(){return O6(this,"monthsInYear")}get inLeapYear(){return O6(this,"inLeapYear")}with($,T=void 0){if(S(this,i$),!Q4($))throw new TypeError("invalid argument");c2($);let W=V(this,u),X=V(this,U4),U={..._6(W,X.isoDate),...X.time};return U=KW(W,U,H1(W,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond"],"partial")),K1(dw(W,U,j$(U$(T))),W)}withPlainTime($=void 0){S(this,i$);let T=qM($);return K1(x$(V(this,U4).isoDate,T),V(this,u))}withCalendar($){S(this,i$);let T=lw($);return K1(V(this,U4),T)}add($,T=void 0){return S(this,i$),sE("add",this,$,T)}subtract($,T=void 0){return S(this,i$),sE("subtract",this,$,T)}until($,T=void 0){return S(this,i$),oE("until",this,$,T)}since($,T=void 0){return S(this,i$),oE("since",this,$,T)}round($){if(S(this,i$),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?DW("smallestUnit",$):U$($),W=u2(T),X=x1(T,"halfExpand"),U=h6(T,"smallestUnit","time",x0,["day"]),w={day:1,hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[U];p2(W,w,w===1);let Y=V(this,U4);return K1(W===1&&U==="nanosecond"?Y:MO(Y,W,U,X),V(this,u))}equals($){S(this,i$);let T=Ew($);return y2(V(this,U4),V(T,U4))===0&&W0(V(this,u),V(T,u))}toString($=void 0){S(this,i$);let T=U$($),W=mw(T),X=cw(T),U=x1(T,"trunc"),w=h6(T,"smallestUnit","time",void 0);if(w==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:Y,unit:G,increment:H}=uw(w,X),z=MO(V(this,U4),H,G,U);return EW(z),Bw(z,V(this,u),Y,W)}toJSON(){return S(this,i$),Bw(V(this,U4),V(this,u),"auto")}toLocaleString($=void 0,T=void 0){return S(this,i$),new Y1($,T).format(this)}valueOf(){RT("PlainDateTime")}toZonedDateTime($,T=void 0){S(this,i$);let W=R6($),X=vw(U$(T));return e4(T6(W,V(this,U4),X),W,V(this,u))}toPlainDate(){return S(this,i$),J6(V(this,U4).isoDate,V(this,u))}toPlainTime(){return S(this,i$),q0(V(this,U4).time)}static from($,T=void 0){return Ew($,T)}static compare($,T){let W=Ew($),X=Ew(T);return y2(V(W,U4),V(X,U4))}}function O6($,T){S($,i$);let W=V($,U4).isoDate;return pw($).isoToDate(W,{[T]:!0})[T]}function _2($,T){return S($,i$),V($,U4).time[T]}b0(Hz,"Temporal.PlainDateTime");class m2{constructor($=0,T=0,W=0,X=0,U=0,w=0,Y=0,G=0,H=0,z=0){let F=$===void 0?0:j1($),O=T===void 0?0:j1(T),Q=W===void 0?0:j1(W),Z=X===void 0?0:j1(X),K=U===void 0?0:j1(U),A=w===void 0?0:j1(w),D=Y===void 0?0:j1(Y),L=G===void 0?0:j1(G),J=H===void 0?0:j1(H),_=z===void 0?0:j1(z);Wz(F,O,Q,Z,K,A,D,L,J,_),f0(this),_$(this,Z6,F),_$(this,V6,O),_$(this,f6,Q),_$(this,K6,Z),_$(this,A6,K),_$(this,E6,A),_$(this,M6,D),_$(this,D6,L),_$(this,N6,J),_$(this,b6,_)}get years(){return S(this,H4),V(this,Z6)}get months(){return S(this,H4),V(this,V6)}get weeks(){return S(this,H4),V(this,f6)}get days(){return S(this,H4),V(this,K6)}get hours(){return S(this,H4),V(this,A6)}get minutes(){return S(this,H4),V(this,E6)}get seconds(){return S(this,H4),V(this,M6)}get milliseconds(){return S(this,H4),V(this,D6)}get microseconds(){return S(this,H4),V(this,N6)}get nanoseconds(){return S(this,H4),V(this,b6)}get sign(){return S(this,H4),uG(this)}get blank(){return S(this,H4),uG(this)===0}with($){S(this,H4);let T=PM($),{years:W=V(this,Z6),months:X=V(this,V6),weeks:U=V(this,f6),days:w=V(this,K6),hours:Y=V(this,A6),minutes:G=V(this,E6),seconds:H=V(this,M6),milliseconds:z=V(this,D6),microseconds:F=V(this,N6),nanoseconds:O=V(this,b6)}=T;return new m2(W,X,U,w,Y,G,H,z,F,O)}negated(){return S(this,H4),m6(this)}abs(){return S(this,H4),new m2(Math.abs(V(this,Z6)),Math.abs(V(this,V6)),Math.abs(V(this,f6)),Math.abs(V(this,K6)),Math.abs(V(this,A6)),Math.abs(V(this,E6)),Math.abs(V(this,M6)),Math.abs(V(this,D6)),Math.abs(V(this,N6)),Math.abs(V(this,b6)))}add($){return S(this,H4),iE("add",this,$)}subtract($){return S(this,H4),iE("subtract",this,$)}round($){if(S(this,H4),$===void 0)throw new TypeError("options parameter is required");let T=v0(this),W=typeof $=="string"?DW("smallestUnit",$):U$($),X=h6(W,"largestUnit","datetime",void 0,["auto"]),{plainRelativeTo:U,zonedRelativeTo:w}=eF(W),Y=u2(W),G=x1(W,"halfExpand"),H=h6(W,"smallestUnit","datetime",void 0),z=!0;H||(z=!1,H="nanosecond");let F=S0(T,H),O=!0;if(X||(O=!1,X=F),X==="auto"&&(X=F),!z&&!O)throw new RangeError("at least one of smallestUnit or largestUnit is required");if(S0(X,H)!==X)throw new RangeError(`largestUnit ${X} cannot be smaller than smallestUnit ${H}`);let Q={hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[H];if(Q!==void 0&&p2(Y,Q,!1),Y>1&&P0(H)==="date"&&X!==H)throw new RangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit");if(w){let K=P2(this),A=V(w,y$),D=V(w,u),L=V(w,Z$);return K=iM(L,Lw(L,A,D,K),A,D,X,Y,H,G),P0(X)==="date"&&(X="hour"),A1(K,X)}if(U){let K=$0(this),A=b2({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},K.time),D=V(U,V$),L=V(U,u),J=G1(L,D,$6(K.date,A.deltaDays),"constrain");return K=nM(x$(D,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),x$(J,A),L,X,Y,H,G),A1(K,X)}if(s1(T))throw new RangeError(`a starting point is required for ${T}s balancing`);if(s1(X))throw new RangeError(`a starting point is required for ${X}s balancing`);let Z=$0(this);if(H==="day"){let{quotient:K,remainder:A}=Z.time.divmod(bG),D=Z.date.days+K+Pw(A,"day");D=ET(D,Y,G),Z=j0({years:0,months:0,weeks:0,days:D},P$.ZERO)}else Z=j0({years:0,months:0,weeks:0,days:0},pG(Z.time,Y,H,G));return A1(Z,X)}total($){if(S(this,H4),$===void 0)throw new TypeError("options argument is required");let T=typeof $=="string"?DW("unit",$):U$($),{plainRelativeTo:W,zonedRelativeTo:X}=eF(T),U=h6(T,"unit","datetime",x0);if(X){let Y=P2(this),G=V(X,y$),H=V(X,u),z=V(X,Z$);return function(F,O,Q,Z,K){return P0(K)==="time"?Pw(P$.fromEpochNsDiff(O,F),K):uE(lM(F,O,Q,Z,K),O,M1(Q,F),Q,Z,K)}(z,Lw(z,G,H,Y),G,H,U)}if(W){let Y=$0(this),G=b2({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},Y.time),H=V(W,V$),z=V(W,u),F=G1(z,H,$6(Y.date,G.deltaDays),"constrain");return function(O,Q,Z,K){if(y2(O,Q)==0)return 0;EW(O),EW(Q);let A=oM(O,Q,Z,K);return K==="nanosecond"?q.toNumber(A.time.totalNs):uE(A,n4(Q),O,null,Z,K)}(x$(H,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),x$(F,G),z,U)}let w=v0(this);if(s1(w))throw new RangeError(`a starting point is required for ${w}s total`);if(s1(U))throw new RangeError(`a starting point is required for ${U}s total`);return Pw($0(this).time,U)}toString($=void 0){S(this,H4);let T=U$($),W=cw(T),X=x1(T,"trunc"),U=h6(T,"smallestUnit","time",void 0);if(U==="hour"||U==="minute")throw new RangeError('smallestUnit must be a time unit other than "hours" or "minutes"');let{precision:w,unit:Y,increment:G}=uw(U,W);if(Y==="nanosecond"&&G===1)return IG(this,w);let H=v0(this),z=P2(this),F=pG(z.time,G,Y,X);return z=j0(z.date,F),IG(A1(z,S0(H,"second")),w)}toJSON(){return S(this,H4),IG(this,"auto")}toLocaleString($=void 0,T=void 0){if(S(this,H4),typeof Intl.DurationFormat=="function"){let W=new Intl.DurationFormat($,T);return hO.call(W,this)}return console.warn("Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat."),IG(this,"auto")}valueOf(){RT("Duration")}static from($){return E1($)}static compare($,T,W=void 0){let X=E1($),U=E1(T),w=U$(W),{plainRelativeTo:Y,zonedRelativeTo:G}=eF(w);if(V(X,Z6)===V(U,Z6)&&V(X,V6)===V(U,V6)&&V(X,f6)===V(U,f6)&&V(X,K6)===V(U,K6)&&V(X,A6)===V(U,A6)&&V(X,E6)===V(U,E6)&&V(X,M6)===V(U,M6)&&V(X,D6)===V(U,D6)&&V(X,N6)===V(U,N6)&&V(X,b6)===V(U,b6))return 0;let H=v0(X),z=v0(U),F=P2(X),O=P2(U);if(G&&(P0(H)==="date"||P0(z)==="date")){let D=V(G,y$),L=V(G,u),J=V(G,Z$),_=Lw(J,D,L,F),C=Lw(J,D,L,O);return y6(q.toNumber(q.subtract(_,C)))}let Q=F.date.days,Z=O.date.days;if(s1(H)||s1(z)){if(!Y)throw new RangeError("A starting point is required for years, months, or weeks comparison");Q=cE(F.date,Y),Z=cE(O.date,Y)}let K=F.time.add24HourDays(Q),A=O.time.add24HourDays(Z);return K.cmp(A)}}b0(m2,"Temporal.Duration");class Fz{constructor($,T,W="iso8601",X=1972){let U=A$($),w=A$(T),Y=v6(W===void 0?"iso8601":I4(W)),G=A$(X);AW(G,U,w),jM(this,{year:G,month:U,day:w},Y)}get monthCode(){return UM(this,"monthCode")}get day(){return UM(this,"day")}get calendarId(){return S(this,X1),V(this,u)}with($,T=void 0){if(S(this,X1),!Q4($))throw new TypeError("invalid argument");c2($);let W=V(this,u),X=_6(W,V(this,V$),"month-day");return X=KW(W,X,H1(W,$,["year","month","monthCode","day"],[],"partial")),C2(gG(W,X,j$(U$(T))),W)}equals($){S(this,X1);let T=IE($);return X0(V(this,V$),V(T,V$))===0&&W0(V(this,u),V(T,u))}toString($=void 0){return S(this,X1),yE(this,mw(U$($)))}toJSON(){return S(this,X1),yE(this)}toLocaleString($=void 0,T=void 0){return S(this,X1),new Y1($,T).format(this)}valueOf(){RT("PlainMonthDay")}toPlainDate($){if(S(this,X1),!Q4($))throw new TypeError("argument should be an object");let T=V(this,u);return J6(LT(T,KW(T,_6(T,V(this,V$),"month-day"),H1(T,$,["year"],[],[])),"constrain"),T)}static from($,T=void 0){return IE($,T)}}function UM($,T){S($,X1);let W=V($,V$);return pw($).isoToDate(W,{[T]:!0})[T]}function TO($){return M1($,LO())}b0(Fz,"Temporal.PlainMonthDay");var RD={instant:()=>I1(LO()),plainDateTimeISO:($=Qw())=>K1(TO(R6($)),"iso8601"),plainDateISO:($=Qw())=>J6(TO(R6($)).isoDate,"iso8601"),plainTimeISO:($=Qw())=>q0(TO(R6($)).time),timeZoneId:()=>Qw(),zonedDateTimeISO:($=Qw())=>{let T=R6($);return e4(LO(),T,"iso8601")},[Symbol.toStringTag]:"Temporal.Now"};Object.defineProperty(RD,Symbol.toStringTag,{value:"Temporal.Now",writable:!1,enumerable:!1,configurable:!0});class sw{constructor($=0,T=0,W=0,X=0,U=0,w=0){let Y=$===void 0?0:A$($),G=T===void 0?0:A$(T),H=W===void 0?0:A$(W),z=X===void 0?0:A$(X),F=U===void 0?0:A$(U),O=w===void 0?0:A$(w);Tz(Y,G,H,z,F,O),IM(this,{hour:Y,minute:G,second:H,millisecond:z,microsecond:F,nanosecond:O})}get hour(){return S(this,A4),V(this,O4).hour}get minute(){return S(this,A4),V(this,O4).minute}get second(){return S(this,A4),V(this,O4).second}get millisecond(){return S(this,A4),V(this,O4).millisecond}get microsecond(){return S(this,A4),V(this,O4).microsecond}get nanosecond(){return S(this,A4),V(this,O4).nanosecond}with($,T=void 0){if(S(this,A4),!Q4($))throw new TypeError("invalid argument");c2($);let W=OO($,"partial"),X=OO(this),{hour:U,minute:w,second:Y,millisecond:G,microsecond:H,nanosecond:z}=Object.assign(X,W),F=j$(U$(T));return{hour:U,minute:w,second:Y,millisecond:G,microsecond:H,nanosecond:z}=sG(U,w,Y,G,H,z,F),new sw(U,w,Y,G,H,z)}add($){return S(this,A4),eE("add",this,$)}subtract($){return S(this,A4),eE("subtract",this,$)}until($,T=void 0){return S(this,A4),lE("until",this,$,T)}since($,T=void 0){return S(this,A4),lE("since",this,$,T)}round($){if(S(this,A4),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?DW("smallestUnit",$):U$($),W=u2(T),X=x1(T,"halfExpand"),U=h6(T,"smallestUnit","time",x0);return p2(W,{hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[U],!1),q0(DO(V(this,O4),W,U,X))}equals($){S(this,A4);let T=AT($);return NO(V(this,O4),V(T,O4))===0}toString($=void 0){S(this,A4);let T=U$($),W=cw(T),X=x1(T,"trunc"),U=h6(T,"smallestUnit","time",void 0);if(U==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:w,unit:Y,increment:G}=uw(U,W);return bE(DO(V(this,O4),G,Y,X),w)}toJSON(){return S(this,A4),bE(V(this,O4),"auto")}toLocaleString($=void 0,T=void 0){return S(this,A4),new Y1($,T).format(this)}valueOf(){RT("PlainTime")}static from($,T=void 0){return AT($,T)}static compare($,T){let W=AT($),X=AT(T);return NO(V(W,O4),V(X,O4))}}b0(sw,"Temporal.PlainTime");class Oz{constructor($,T,W="iso8601",X=1){let U=A$($),w=A$(T),Y=v6(W===void 0?"iso8601":I4(W)),G=A$(X);AW(U,w,G),BM(this,{year:U,month:w,day:G},Y)}get year(){return _0(this,"year")}get month(){return _0(this,"month")}get monthCode(){return _0(this,"monthCode")}get calendarId(){return S(this,r4),V(this,u)}get era(){return _0(this,"era")}get eraYear(){return _0(this,"eraYear")}get daysInMonth(){return _0(this,"daysInMonth")}get daysInYear(){return _0(this,"daysInYear")}get monthsInYear(){return _0(this,"monthsInYear")}get inLeapYear(){return _0(this,"inLeapYear")}with($,T=void 0){if(S(this,r4),!Q4($))throw new TypeError("invalid argument");c2($);let W=V(this,u),X=_6(W,V(this,V$),"year-month");return X=KW(W,X,H1(W,$,["year","month","monthCode"],[],"partial")),S2(jw(W,X,j$(U$(T))),W)}add($,T=void 0){return S(this,r4),$M("add",this,$,T)}subtract($,T=void 0){return S(this,r4),$M("subtract",this,$,T)}until($,T=void 0){return S(this,r4),rE("until",this,$,T)}since($,T=void 0){return S(this,r4),rE("since",this,$,T)}equals($){S(this,r4);let T=Dw($);return X0(V(this,V$),V(T,V$))===0&&W0(V(this,u),V(T,u))}toString($=void 0){return S(this,r4),hE(this,mw(U$($)))}toJSON(){return S(this,r4),hE(this)}toLocaleString($=void 0,T=void 0){return S(this,r4),new Y1($,T).format(this)}valueOf(){RT("PlainYearMonth")}toPlainDate($){if(S(this,r4),!Q4($))throw new TypeError("argument should be an object");let T=V(this,u);return J6(LT(T,KW(T,_6(T,V(this,V$),"year-month"),H1(T,$,["day"],[],[])),"constrain"),T)}static from($,T=void 0){return Dw($,T)}static compare($,T){let W=Dw($),X=Dw(T);return X0(V(W,V$),V(X,V$))}}function _0($,T){S($,r4);let W=V($,V$);return pw($).isoToDate(W,{[T]:!0})[T]}b0(Oz,"Temporal.PlainYearMonth");var SI=Y1.prototype.resolvedOptions;class Qz{constructor($,T,W="iso8601"){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");let X=dG($),U=I4(T),{tzName:w,offsetMinutes:Y}=MT(U);if(Y===void 0){let G=mG(w);if(!G)throw new RangeError(`unknown time zone ${w}`);U=G.identifier}else U=kO(Y);fM(this,X,U,v6(W===void 0?"iso8601":I4(W)))}get calendarId(){return S(this,v$),V(this,u)}get timeZoneId(){return S(this,v$),V(this,y$)}get year(){return Q6(this,"year")}get month(){return Q6(this,"month")}get monthCode(){return Q6(this,"monthCode")}get day(){return Q6(this,"day")}get hour(){return k2(this,"hour")}get minute(){return k2(this,"minute")}get second(){return k2(this,"second")}get millisecond(){return k2(this,"millisecond")}get microsecond(){return k2(this,"microsecond")}get nanosecond(){return k2(this,"nanosecond")}get era(){return Q6(this,"era")}get eraYear(){return Q6(this,"eraYear")}get epochMilliseconds(){return S(this,v$),D1(V(this,Z$),"floor")}get epochNanoseconds(){return S(this,v$),tM(V(this,Z$))}get dayOfWeek(){return Q6(this,"dayOfWeek")}get dayOfYear(){return Q6(this,"dayOfYear")}get weekOfYear(){return Q6(this,"weekOfYear")?.week}get yearOfWeek(){return Q6(this,"weekOfYear")?.year}get hoursInDay(){S(this,v$);let $=V(this,y$),T=a1(this).isoDate,W=g6(T.year,T.month,T.day+1),X=VT($,T),U=VT($,W);return Pw(P$.fromEpochNsDiff(U,X),"hour")}get daysInWeek(){return Q6(this,"daysInWeek")}get daysInMonth(){return Q6(this,"daysInMonth")}get daysInYear(){return Q6(this,"daysInYear")}get monthsInYear(){return Q6(this,"monthsInYear")}get inLeapYear(){return Q6(this,"inLeapYear")}get offset(){return S(this,v$),QO(C0(V(this,y$),V(this,Z$)))}get offsetNanoseconds(){return S(this,v$),C0(V(this,y$),V(this,Z$))}with($,T=void 0){if(S(this,v$),!Q4($))throw new TypeError("invalid zoned-date-time-like");c2($);let W=V(this,u),X=V(this,y$),U=C0(X,V(this,Z$)),w=a1(this),Y={..._6(W,w.isoDate),...w.time,offset:QO(U)};Y=KW(W,Y,H1(W,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset"],"partial"));let G=U$(T),H=vw(G),z=BG(G,"prefer"),F=dw(W,Y,j$(G)),O=d2(Y.offset);return e4(hG(F.isoDate,F.time,"option",O,X,H,z,!1),X,W)}withPlainTime($=void 0){S(this,v$);let T=V(this,y$),W=V(this,u),X=a1(this).isoDate,U;return U=$===void 0?VT(T,X):T6(T,x$(X,V(AT($),O4)),"compatible"),e4(U,T,W)}withTimeZone($){S(this,v$);let T=R6($);return e4(V(this,Z$),T,V(this,u))}withCalendar($){S(this,v$);let T=lw($);return e4(V(this,Z$),V(this,y$),T)}add($,T=void 0){return S(this,v$),TM("add",this,$,T)}subtract($,T=void 0){return S(this,v$),TM("subtract",this,$,T)}until($,T=void 0){return S(this,v$),nE("until",this,$,T)}since($,T=void 0){return S(this,v$),nE("since",this,$,T)}round($){if(S(this,v$),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?DW("smallestUnit",$):U$($),W=u2(T),X=x1(T,"halfExpand"),U=h6(T,"smallestUnit","time",x0,["day"]),w={day:1,hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[U];if(p2(W,w,w===1),U==="nanosecond"&&W===1)return e4(V(this,Z$),V(this,y$),V(this,u));let Y=V(this,y$),G=V(this,Z$),H=a1(this),z;if(U==="day"){let F=H.isoDate,O=g6(F.year,F.month,F.day+1),Q=VT(Y,F),Z=VT(Y,O),K=q.subtract(Z,Q);z=P$.fromEpochNsDiff(G,Q).round(K,X).addToEpochNs(Q)}else{let F=MO(H,W,U,X),O=C0(Y,G);z=hG(F.isoDate,F.time,"option",O,Y,"compatible","prefer",!1)}return e4(z,Y,V(this,u))}equals($){S(this,v$);let T=Nw($),W=V(this,Z$),X=V(T,Z$);return!!q.equal(q.BigInt(W),q.BigInt(X))&&!!bM(V(this,y$),V(T,y$))&&W0(V(this,u),V(T,u))}toString($=void 0){S(this,v$);let T=U$($),W=mw(T),X=cw(T),U=function(O){return I0(O,"offset",["auto","never"],"auto")}(T),w=x1(T,"trunc"),Y=h6(T,"smallestUnit","time",void 0);if(Y==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let G=function(O){return I0(O,"timeZoneName",["auto","never","critical"],"auto")}(T),{precision:H,unit:z,increment:F}=uw(Y,X);return gE(this,H,W,G,U,{unit:z,increment:F,roundingMode:w})}toLocaleString($=void 0,T=void 0){S(this,v$);let W=U$(T),X=Object.create(null);if(function(G,H,z,F){if(H==null)return;let O=Reflect.ownKeys(H);for(let Q=0;Q<O.length;Q++){let Z=O[Q];if(!z.some((K)=>Object.is(K,Z))&&Object.prototype.propertyIsEnumerable.call(H,Z)){let K=H[Z];G[Z]=K}}}(X,W,["timeZone"]),W.timeZone!==void 0)throw new TypeError("ZonedDateTime toLocaleString does not accept a timeZone option");if(X.year===void 0&&X.month===void 0&&X.day===void 0&&X.era===void 0&&X.weekday===void 0&&X.dateStyle===void 0&&X.hour===void 0&&X.minute===void 0&&X.second===void 0&&X.fractionalSecondDigits===void 0&&X.timeStyle===void 0&&X.dayPeriod===void 0&&X.timeZoneName===void 0&&(X.timeZoneName="short"),X.timeZone=V(this,y$),mE(X.timeZone))throw new RangeError("toLocaleString does not currently support offset time zones");let U=new Y1($,X),w=SI.call(U).calendar,Y=V(this,u);if(Y!=="iso8601"&&w!=="iso8601"&&!W0(w,Y))throw new RangeError(`cannot format ZonedDateTime with calendar ${Y} in locale with calendar ${w}`);return U.format(I1(V(this,Z$)))}toJSON(){return S(this,v$),gE(this,"auto")}valueOf(){RT("ZonedDateTime")}startOfDay(){S(this,v$);let $=V(this,y$);return e4(VT($,a1(this).isoDate),$,V(this,u))}getTimeZoneTransition($){S(this,v$);let T=V(this,y$);if($===void 0)throw new TypeError("options parameter is required");let W=I0(typeof $=="string"?DW("direction",$):U$($),"direction",["next","previous"],x0);if(W===void 0)throw new TypeError("direction option is required");if(mE(T)||T==="UTC")return null;let X=V(this,Z$),U=W==="next"?PO(T,X):VO(T,X);return U===null?null:e4(U,T,V(this,u))}toInstant(){return S(this,v$),I1(V(this,Z$))}toPlainDate(){return S(this,v$),J6(a1(this).isoDate,V(this,u))}toPlainTime(){return S(this,v$),q0(a1(this).time)}toPlainDateTime(){return S(this,v$),K1(a1(this),V(this,u))}static from($,T=void 0){return Nw($,T)}static compare($,T){let W=Nw($),X=Nw(T),U=V(W,Z$),w=V(X,Z$);return q.lessThan(q.BigInt(U),q.BigInt(w))?-1:q.greaterThan(q.BigInt(U),q.BigInt(w))?1:0}}function a1($){return M1(V($,y$),V($,Z$))}function Q6($,T){S($,v$);let W=a1($).isoDate;return pw($).isoToDate(W,{[T]:!0})[T]}function k2($,T){return S($,v$),a1($).time[T]}b0(Qz,"Temporal.ZonedDateTime");var Zz=Object.freeze({__proto__:null,Duration:m2,Instant:Gz,Now:RD,PlainDate:zz,PlainDateTime:Hz,PlainMonthDay:Fz,PlainTime:sw,PlainYearMonth:Oz,ZonedDateTime:Qz}),pt=class ${toTemporalInstant(){return I1(B1(Date.prototype.valueOf.call(this)))}}.prototype.toTemporalInstant,jI=[Gz,zz,Hz,m2,Fz,sw,Oz,Qz];for(let $ of jI){let T=Object.getOwnPropertyDescriptor($,"prototype");(T.configurable||T.enumerable||T.writable)&&(T.configurable=!1,T.enumerable=!1,T.writable=!1,Object.defineProperty($,"prototype",T))}class Vz{supported;constructor($){this.supported=$}refine($){for(let[T,W]of Object.entries(this.supported))try{if(W($)===!0&&W!==Boolean)return{type:T,data:$}}catch(X){try{if($ instanceof W)return{type:T,data:$}}catch(U){}}return null}}var II=new Vz({number:($)=>typeof $==="number",string:($)=>typeof $==="string",boolean:($)=>typeof $==="boolean",null:($)=>$===null});function BI($){if(!$)return!1;return Object.getPrototypeOf($)===Object.prototype}var xI=new Vz({object:BI,array:($)=>Array.isArray($)}),fI=new Vz({...II.supported,...xI.supported}),_D=($)=>{if($===void 0)return"undefined";let T=fI.refine($);if(T)return T.type;return Object.getPrototypeOf($).constructor.name};var N=Symbol.for("drizzle:entityKind"),lt=Symbol.for("drizzle:hasOwnEntityKind");function I($,T){if(!$||typeof $!=="object")return!1;if($ instanceof T)return!0;if(!Object.prototype.hasOwnProperty.call(T,N))throw new Error(`Class "${T.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 W=Object.getPrototypeOf($).constructor;if(W)while(W){if(N in W&&W[N]===T[N])return!0;W=Object.getPrototypeOf(W)}return!1}class p${constructor($,T){this.table=$,this.config=T,this.name=T.name,this.keyAsName=T.keyAsName,this.notNull=T.notNull,this.default=T.default,this.defaultFn=T.defaultFn,this.onUpdateFn=T.onUpdateFn,this.hasDefault=T.hasDefault,this.primary=T.primaryKey,this.isUnique=T.isUnique,this.uniqueName=T.uniqueName,this.uniqueType=T.uniqueType,this.dataType=T.dataType,this.columnType=T.columnType,this.generated=T.generated,this.generatedIdentity=T.generatedIdentity}static[N]="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 gO{static[N]="ColumnBuilder";config;constructor($,T,W){this.config={name:$,keyAsName:$==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:T,columnType:W,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 f1=Symbol.for("drizzle:Name");class mO{static[N]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor($,T){if(this.reference=()=>{let{name:W,columns:X,foreignColumns:U}=$();return{name:W,columns:X,foreignTable:U[0].table,foreignColumns:U}},T)this._onUpdate=T.onUpdate,this._onDelete=T.onDelete}onUpdate($){return this._onUpdate=$===void 0?"no action":$,this}onDelete($){return this._onDelete=$===void 0?"no action":$,this}build($){return new kD($,this)}}class kD{constructor($,T){this.table=$,this.reference=T.reference,this.onUpdate=T._onUpdate,this.onDelete=T._onDelete}static[N]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:$,columns:T,foreignColumns:W}=this.reference(),X=T.map((Y)=>Y.name),U=W.map((Y)=>Y.name),w=[this.table[f1],...X,W[0].table[f1],...U];return $??`${w.join("_")}_fk`}}function Kz($,...T){return $(...T)}function vD($,T){return`${$[f1]}_${T.join("_")}_unique`}function PD($,T,W){for(let X=T;X<$.length;X++){let U=$[X];if(U==="\\"){X++;continue}if(U==='"')return[$.slice(T,X).replace(/\\/g,""),X+1];if(W)continue;if(U===","||U==="}")return[$.slice(T,X).replace(/\\/g,""),X]}return[$.slice(T).replace(/\\/g,""),$.length]}function qD($,T=0){let W=[],X=T,U=!1;while(X<$.length){let w=$[X];if(w===","){if(U||X===T)W.push("");U=!0,X++;continue}if(U=!1,w==="\\"){X+=2;continue}if(w==='"'){let[H,z]=PD($,X+1,!0);W.push(H),X=z;continue}if(w==="}")return[W,X+1];if(w==="{"){let[H,z]=qD($,X+1);W.push(H),X=z;continue}let[Y,G]=PD($,X,!1);W.push(Y),X=G}return[W,X]}function CD($){let[T]=qD($,1);return T}function cO($){return`{${$.map((T)=>{if(Array.isArray(T))return cO(T);if(typeof T==="string")return`"${T.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${T}`}).join(",")}}`}class e extends gO{foreignKeyConfigs=[];static[N]="PgColumnBuilder";array($){return new jD(this.config.name,this,$)}references($,T={}){return this.foreignKeyConfigs.push({ref:$,actions:T}),this}unique($,T){return this.config.isUnique=!0,this.config.uniqueName=$,this.config.uniqueType=T?.nulls,this}generatedAlwaysAs($){return this.config.generated={as:$,type:"always",mode:"stored"},this}buildForeignKeys($,T){return this.foreignKeyConfigs.map(({ref:W,actions:X})=>{return Kz((U,w)=>{let Y=new mO(()=>{let G=U();return{columns:[$],foreignColumns:[G]}});if(w.onUpdate)Y.onUpdate(w.onUpdate);if(w.onDelete)Y.onDelete(w.onDelete);return Y.build(T)},W,X)})}buildExtraConfigColumn($){return new SD($,this.config)}}class d extends p${constructor($,T){if(!T.uniqueName)T.uniqueName=vD($,[T.name]);super($,T);this.table=$}static[N]="PgColumn"}class SD extends d{static[N]="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 ew{static[N]="IndexedColumn";constructor($,T,W,X){this.name=$,this.keyAsName=T,this.type=W,this.indexConfig=X}name;keyAsName;type;indexConfig}class jD extends e{static[N]="PgArrayBuilder";constructor($,T,W){super($,"array","PgArray");this.config.baseBuilder=T,this.config.size=W}build($){let T=this.config.baseBuilder.build($);return new uO($,this.config,T)}}class uO extends d{constructor($,T,W,X){super($,T);this.baseColumn=W,this.range=X,this.size=T.size}size;static[N]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==="number"?this.size:""}]`}mapFromDriverValue($){if(typeof $==="string")$=CD($);return $.map((T)=>this.baseColumn.mapFromDriverValue(T))}mapToDriverValue($,T=!1){let W=$.map((X)=>X===null?null:I(this.baseColumn,uO)?this.baseColumn.mapToDriverValue(X,!0):this.baseColumn.mapToDriverValue(X));if(T)return W;return cO(W)}}class ID extends e{static[N]="PgEnumObjectColumnBuilder";constructor($,T){super($,"string","PgEnumObjectColumn");this.config.enum=T}build($){return new BD($,this.config)}}class BD extends d{static[N]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor($,T){super($,T);this.enum=T.enum}getSQLType(){return this.enum.enumName}}var Az=Symbol.for("drizzle:isPgEnum");function xD($){return!!$&&typeof $==="function"&&Az in $&&$[Az]===!0}class fD extends e{static[N]="PgEnumColumnBuilder";constructor($,T){super($,"string","PgEnumColumn");this.config.enum=T}build($){return new bD($,this.config)}}class bD extends d{static[N]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor($,T){super($,T);this.enum=T.enum}getSQLType(){return this.enum.enumName}}function $8($,T){return Array.isArray(T)?bI($,[...T],void 0):yI($,T,void 0)}function bI($,T,W){let X=Object.assign((U)=>new fD(U??"",X),{enumName:$,enumValues:T,schema:W,[Az]:!0});return X}function yI($,T,W){let X=Object.assign((U)=>new ID(U??"",X),{enumName:$,enumValues:Object.values(T),schema:W,[Az]:!0});return X}class M4{static[N]="Subquery";constructor($,T,W,X=!1,U=[]){this._={brand:"Subquery",sql:$,selectedFields:T,alias:W,isWith:X,usedTables:U}}}class T8 extends M4{static[N]="WithSubquery"}var yD="0.44.2";var pO,dO,d$={startActiveSpan($,T){if(!pO)return T();if(!dO)dO=pO.trace.getTracer("drizzle-orm",yD);return Kz((W,X)=>X.startActiveSpan($,(U)=>{try{return T(U)}catch(w){throw U.setStatus({code:W.SpanStatusCode.ERROR,message:w instanceof Error?w.message:"Unknown error"}),w}finally{U.end()}}),pO,dO)}};var t$=Symbol.for("drizzle:ViewBaseConfig");var _W=Symbol.for("drizzle:Schema"),Ez=Symbol.for("drizzle:Columns"),hD=Symbol.for("drizzle:ExtraConfigColumns"),oO=Symbol.for("drizzle:OriginalName"),lO=Symbol.for("drizzle:BaseName"),W8=Symbol.for("drizzle:IsAlias"),gD=Symbol.for("drizzle:ExtraConfigBuilder"),hI=Symbol.for("drizzle:IsDrizzleTable");class l{static[N]="Table";static Symbol={Name:f1,Schema:_W,OriginalName:oO,Columns:Ez,ExtraConfigColumns:hD,BaseName:lO,IsAlias:W8,ExtraConfigBuilder:gD};[f1];[oO];[_W];[Ez];[hD];[lO];[W8]=!1;[hI]=!0;[gD]=void 0;constructor($,T,W){this[f1]=this[oO]=$,this[_W]=T,this[lO]=W}}function u4($){return $[f1]}function kW($){return`${$[_W]??"public"}.${$[f1]}`}function rO($){return $!==null&&$!==void 0&&typeof $.getSQL==="function"}function gI($){let T={sql:"",params:[]};for(let W of $)if(T.sql+=W.sql,T.params.push(...W.params),W.typings?.length){if(!T.typings)T.typings=[];T.typings.push(...W.typings)}return T}class B4{static[N]="StringChunk";value;constructor($){this.value=Array.isArray($)?$:[$]}getSQL(){return new a([this])}}class a{constructor($){this.queryChunks=$;for(let T of $)if(I(T,l)){let W=T[l.Symbol.Schema];this.usedTables.push(W===void 0?T[l.Symbol.Name]:W+"."+T[l.Symbol.Name])}}static[N]="SQL";decoder=cD;shouldInlineParams=!1;usedTables=[];append($){return this.queryChunks.push(...$.queryChunks),this}toQuery($){return d$.startActiveSpan("drizzle.buildSQL",(T)=>{let W=this.buildQueryFromSourceParams(this.queryChunks,$);return T?.setAttributes({"drizzle.query.text":W.sql,"drizzle.query.params":JSON.stringify(W.params)}),W})}buildQueryFromSourceParams($,T){let W=Object.assign({},T,{inlineParams:T.inlineParams||this.shouldInlineParams,paramStartIndex:T.paramStartIndex||{value:0}}),{casing:X,escapeName:U,escapeParam:w,prepareTyping:Y,inlineParams:G,paramStartIndex:H}=W;return gI($.map((z)=>{if(I(z,B4))return{sql:z.value.join(""),params:[]};if(I(z,Mz))return{sql:U(z.value),params:[]};if(z===void 0)return{sql:"",params:[]};if(Array.isArray(z)){let F=[new B4("(")];for(let[O,Q]of z.entries())if(F.push(Q),O<z.length-1)F.push(new B4(", "));return F.push(new B4(")")),this.buildQueryFromSourceParams(F,W)}if(I(z,a))return this.buildQueryFromSourceParams(z.queryChunks,{...W,inlineParams:G||z.shouldInlineParams});if(I(z,l)){let F=z[l.Symbol.Schema],O=z[l.Symbol.Name];return{sql:F===void 0||z[W8]?U(O):U(F)+"."+U(O),params:[]}}if(I(z,p$)){let F=X.getColumnCasing(z);if(T.invokeSource==="indexes")return{sql:U(F),params:[]};let O=z.table[l.Symbol.Schema];return{sql:z.table[W8]||O===void 0?U(z.table[l.Symbol.Name])+"."+U(F):U(O)+"."+U(z.table[l.Symbol.Name])+"."+U(F),params:[]}}if(I(z,c6)){let F=z[t$].schema,O=z[t$].name;return{sql:F===void 0||z[t$].isAlias?U(O):U(F)+"."+U(O),params:[]}}if(I(z,F1)){if(I(z.value,kT))return{sql:w(H.value++,z),params:[z],typings:["none"]};let F=z.value===null?null:z.encoder.mapToDriverValue(z.value);if(I(F,a))return this.buildQueryFromSourceParams([F],W);if(G)return{sql:this.mapInlineParam(F,W),params:[]};let O=["none"];if(Y)O=[Y(z.encoder)];return{sql:w(H.value++,F),params:[F],typings:O}}if(I(z,kT))return{sql:w(H.value++,z),params:[z],typings:["none"]};if(I(z,a.Aliased)&&z.fieldAlias!==void 0)return{sql:U(z.fieldAlias),params:[]};if(I(z,M4)){if(z._.isWith)return{sql:U(z._.alias),params:[]};return this.buildQueryFromSourceParams([new B4("("),z._.sql,new B4(") "),new Mz(z._.alias)],W)}if(xD(z)){if(z.schema)return{sql:U(z.schema)+"."+U(z.enumName),params:[]};return{sql:U(z.enumName),params:[]}}if(rO(z)){if(z.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([z.getSQL()],W);return this.buildQueryFromSourceParams([new B4("("),z.getSQL(),new B4(")")],W)}if(G)return{sql:this.mapInlineParam(z,W),params:[]};return{sql:w(H.value++,z),params:[z],typings:["none"]}}))}mapInlineParam($,{escapeString:T}){if($===null)return"null";if(typeof $==="number"||typeof $==="boolean")return $.toString();if(typeof $==="string")return T($);if(typeof $==="object"){let W=$.toString();if(W==="[object Object]")return T(JSON.stringify($));return T(W)}throw new Error("Unexpected param value: "+$)}getSQL(){return this}as($){if($===void 0)return this;return new a.Aliased(this,$)}mapWith($){return this.decoder=typeof $==="function"?{mapFromDriverValue:$}:$,this}inlineParams(){return this.shouldInlineParams=!0,this}if($){return $?this:void 0}}class Mz{constructor($){this.value=$}static[N]="Name";brand;getSQL(){return new a([this])}}function mD($){return typeof $==="object"&&$!==null&&"mapToDriverValue"in $&&typeof $.mapToDriverValue==="function"}var cD={mapFromDriverValue:($)=>$},uD={mapToDriverValue:($)=>$},xa={...cD,...uD};class F1{constructor($,T=uD){this.value=$,this.encoder=T}static[N]="Param";brand;getSQL(){return new a([this])}}function R($,...T){let W=[];if(T.length>0||$.length>0&&$[0]!=="")W.push(new B4($[0]));for(let[X,U]of T.entries())W.push(U,new B4($[X+1]));return new a(W)}(($)=>{function T(){return new a([])}$.empty=T;function W(H){return new a(H)}$.fromList=W;function X(H){return new a([new B4(H)])}$.raw=X;function U(H,z){let F=[];for(let[O,Q]of H.entries()){if(O>0&&z!==void 0)F.push(z);F.push(Q)}return new a(F)}$.join=U;function w(H){return new Mz(H)}$.identifier=w;function Y(H){return new kT(H)}$.placeholder=Y;function G(H,z){return new F1(H,z)}$.param=G})(R||(R={}));(($)=>{class T{constructor(W,X){this.sql=W,this.fieldAlias=X}static[N]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new T(this.sql,this.fieldAlias)}}$.Aliased=T})(a||(a={}));class kT{constructor($){this.name=$}static[N]="Placeholder";getSQL(){return new a([this])}}function nO($,T){return $.map((W)=>{if(I(W,kT)){if(!(W.name in T))throw new Error(`No value for placeholder "${W.name}" was provided`);return T[W.name]}if(I(W,F1)&&I(W.value,kT)){if(!(W.value.name in T))throw new Error(`No value for placeholder "${W.value.name}" was provided`);return W.encoder.mapToDriverValue(T[W.value.name])}return W})}var mI=Symbol.for("drizzle:IsDrizzleView");class c6{static[N]="View";[t$];[mI]=!0;constructor({name:$,schema:T,selectedFields:W,query:X}){this[t$]={name:$,originalName:$,schema:T,selectedFields:W,query:X,isExisting:!X,isAlias:!1}}getSQL(){return new a([this])}}p$.prototype.getSQL=function(){return new a([this])};l.prototype.getSQL=function(){return new a([this])};M4.prototype.getSQL=function(){return new a([this])};class l2{constructor($){this.table=$}static[N]="ColumnAliasProxyHandler";get($,T){if(T==="table")return this.table;return $[T]}}class U8{constructor($,T){this.alias=$,this.replaceOriginalName=T}static[N]="TableAliasProxyHandler";get($,T){if(T===l.Symbol.IsAlias)return!0;if(T===l.Symbol.Name)return this.alias;if(this.replaceOriginalName&&T===l.Symbol.OriginalName)return this.alias;if(T===t$)return{...$[t$],name:this.alias,isAlias:!0};if(T===l.Symbol.Columns){let X=$[l.Symbol.Columns];if(!X)return X;let U={};return Object.keys(X).map((w)=>{U[w]=new Proxy(X[w],new l2(new Proxy($,this)))}),U}let W=$[T];if(I(W,p$))return new Proxy(W,new l2(new Proxy($,this)));return W}}function Dz($,T){return new Proxy($,new U8(T,!1))}function Y0($,T){return new Proxy($,new l2(new Proxy($.table,new U8(T,!1))))}function iO($,T){return new a.Aliased(X8($.sql,T),$.fieldAlias)}function X8($,T){return R.join($.queryChunks.map((W)=>{if(I(W,p$))return Y0(W,T);if(I(W,a))return X8(W,T);if(I(W,a.Aliased))return iO(W,T);return W}))}class Nz extends Error{static[N]="DrizzleError";constructor({message:$,cause:T}){super($);this.name="DrizzleError",this.cause=T}}class tO extends Nz{static[N]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class pD{static[N]="ConsoleLogWriter";write($){console.log($)}}class aO{static[N]="DefaultLogger";writer;constructor($){this.writer=$?.writer??new pD}logQuery($,T){let W=T.map((U)=>{try{return JSON.stringify(U)}catch{return String(U)}}),X=W.length?` -- params: [${W.join(", ")}]`:"";this.writer.write(`Query: ${$}${X}`)}}class sO{static[N]="NoopLogger";logQuery(){}}class P6{static[N]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch($){return this.then(void 0,$)}finally($){return this.then((T)=>{return $?.(),T},(T)=>{throw $?.(),T})}then($,T){return this.execute().then($,T)}}function dD($,T,W){let X={},U=$.reduce((w,{path:Y,field:G},H)=>{let z;if(I(G,p$))z=G;else if(I(G,a))z=G.decoder;else z=G.sql.decoder;let F=w;for(let[O,Q]of Y.entries())if(O<Y.length-1){if(!(Q in F))F[Q]={};F=F[Q]}else{let Z=T[H],K=F[Q]=Z===null?null:z.mapFromDriverValue(Z);if(W&&I(G,p$)&&Y.length===2){let A=Y[0];if(!(A in X))X[A]=K===null?u4(G.table):!1;else if(typeof X[A]==="string"&&X[A]!==u4(G.table))X[A]=!1}}return w},{});if(W&&Object.keys(X).length>0){for(let[w,Y]of Object.entries(X))if(typeof Y==="string"&&!W[Y])U[w]=null}return U}function N1($,T){return Object.entries($).reduce((W,[X,U])=>{if(typeof X!=="string")return W;let w=T?[...T,X]:[X];if(I(U,p$)||I(U,a)||I(U,a.Aliased))W.push({path:w,field:U});else if(I(U,l))W.push(...N1(U[l.Symbol.Columns],w));else W.push(...N1(U,w));return W},[])}function w8($,T){let W=Object.keys($),X=Object.keys(T);if(W.length!==X.length)return!1;for(let[U,w]of W.entries())if(w!==X[U])return!1;return!0}function Lz($,T){let W=Object.entries(T).filter(([,X])=>X!==void 0).map(([X,U])=>{if(I(U,a)||I(U,p$))return[X,U];else return[X,new F1(U,$[l.Symbol.Columns][X])]});if(W.length===0)throw new Error("No values to set");return Object.fromEntries(W)}function oD($,T){for(let W of T)for(let X of Object.getOwnPropertyNames(W.prototype)){if(X==="constructor")continue;Object.defineProperty($.prototype,X,Object.getOwnPropertyDescriptor(W.prototype,X)||Object.create(null))}}function lD($){return $[l.Symbol.Columns]}function y0($){return I($,M4)?$._.alias:I($,c6)?$[t$].name:I($,a)?void 0:$[l.Symbol.IsAlias]?$[l.Symbol.Name]:$[l.Symbol.BaseName]}function S$($,T){return{name:typeof $==="string"&&$.length>0?$:"",config:typeof $==="object"?$:T}}function rD($){if(typeof $!=="object"||$===null)return!1;if($.constructor.name!=="Object")return!1;if("logger"in $){let T=typeof $.logger;if(T!=="boolean"&&(T!=="object"||typeof $.logger.logQuery!=="function")&&T!=="undefined")return!1;return!0}if("schema"in $){let T=typeof $.schema;if(T!=="object"&&T!=="undefined")return!1;return!0}if("casing"in $){let T=typeof $.casing;if(T!=="string"&&T!=="undefined")return!1;return!0}if("mode"in $){if($.mode!=="default"||$.mode!=="planetscale"||$.mode!==void 0)return!1;return!0}if("connection"in $){let T=typeof $.connection;if(T!=="string"&&T!=="object"&&T!=="undefined")return!1;return!0}if("client"in $){let T=typeof $.client;if(T!=="object"&&T!=="function"&&T!=="undefined")return!1;return!0}if(Object.keys($).length===0)return!0;return!1}class vT extends e{static[N]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity($){if($){let{name:T,...W}=$;this.config.generatedIdentity={type:"always",sequenceName:T,sequenceOptions:W}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity($){if($){let{name:T,...W}=$;this.config.generatedIdentity={type:"byDefault",sequenceName:T,sequenceOptions:W}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class nD extends vT{static[N]="PgBigInt53Builder";constructor($){super($,"number","PgBigInt53")}build($){return new iD($,this.config)}}class iD extends d{static[N]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}}class tD extends vT{static[N]="PgBigInt64Builder";constructor($){super($,"bigint","PgBigInt64")}build($){return new aD($,this.config)}}class aD extends d{static[N]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue($){return BigInt($)}}function sD($,T){let{name:W,config:X}=S$($,T);if(X.mode==="number")return new nD(W);return new tD(W)}class eD extends e{static[N]="PgBigSerial53Builder";constructor($){super($,"number","PgBigSerial53");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new $N($,this.config)}}class $N extends d{static[N]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}}class TN extends e{static[N]="PgBigSerial64Builder";constructor($){super($,"bigint","PgBigSerial64");this.config.hasDefault=!0}build($){return new WN($,this.config)}}class WN extends d{static[N]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue($){return BigInt($)}}function UN($,T){let{name:W,config:X}=S$($,T);if(X.mode==="number")return new eD(W);return new TN(W)}class XN extends e{static[N]="PgBooleanBuilder";constructor($){super($,"boolean","PgBoolean")}build($){return new wN($,this.config)}}class wN extends d{static[N]="PgBoolean";getSQLType(){return"boolean"}}function Y8($){return new XN($??"")}class YN extends e{static[N]="PgCharBuilder";constructor($,T){super($,"string","PgChar");this.config.length=T.length,this.config.enumValues=T.enum}build($){return new GN($,this.config)}}class GN extends d{static[N]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}function zN($,T={}){let{name:W,config:X}=S$($,T);return new YN(W,X)}class HN extends e{static[N]="PgCidrBuilder";constructor($){super($,"string","PgCidr")}build($){return new FN($,this.config)}}class FN extends d{static[N]="PgCidr";getSQLType(){return"cidr"}}function ON($){return new HN($??"")}class QN extends e{static[N]="PgCustomColumnBuilder";constructor($,T,W){super($,"custom","PgCustomColumn");this.config.fieldConfig=T,this.config.customTypeParams=W}build($){return new ZN($,this.config)}}class ZN extends d{static[N]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor($,T){super($,T);this.sqlName=T.customTypeParams.dataType(T.fieldConfig),this.mapTo=T.customTypeParams.toDriver,this.mapFrom=T.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue($){return typeof this.mapFrom==="function"?this.mapFrom($):$}mapToDriverValue($){return typeof this.mapTo==="function"?this.mapTo($):$}}function VN($){return(T,W)=>{let{name:X,config:U}=S$(T,W);return new QN(X,U,$)}}class h0 extends e{static[N]="PgDateColumnBaseBuilder";defaultNow(){return this.default(R`now()`)}}class KN extends h0{static[N]="PgDateBuilder";constructor($){super($,"date","PgDate")}build($){return new Jz($,this.config)}}class Jz extends d{static[N]="PgDate";getSQLType(){return"date"}mapFromDriverValue($){return new Date($)}mapToDriverValue($){return $.toISOString()}}class AN extends h0{static[N]="PgDateStringBuilder";constructor($){super($,"string","PgDateString")}build($){return new Rz($,this.config)}}class Rz extends d{static[N]="PgDateString";getSQLType(){return"date"}}function EN($,T){let{name:W,config:X}=S$($,T);if(X?.mode==="date")return new KN(W);return new AN(W)}class MN extends e{static[N]="PgDoublePrecisionBuilder";constructor($){super($,"number","PgDoublePrecision")}build($){return new DN($,this.config)}}class DN extends d{static[N]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue($){if(typeof $==="string")return Number.parseFloat($);return $}}function NN($){return new MN($??"")}class LN extends e{static[N]="PgInetBuilder";constructor($){super($,"string","PgInet")}build($){return new JN($,this.config)}}class JN extends d{static[N]="PgInet";getSQLType(){return"inet"}}function RN($){return new LN($??"")}class _N extends vT{static[N]="PgIntegerBuilder";constructor($){super($,"number","PgInteger")}build($){return new kN($,this.config)}}class kN extends d{static[N]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue($){if(typeof $==="string")return Number.parseInt($);return $}}function G8($){return new _N($??"")}class vN extends e{static[N]="PgIntervalBuilder";constructor($,T){super($,"string","PgInterval");this.config.intervalConfig=T}build($){return new PN($,this.config)}}class PN extends d{static[N]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let $=this.fields?` ${this.fields}`:"",T=this.precision?`(${this.precision})`:"";return`interval${$}${T}`}}function qN($,T={}){let{name:W,config:X}=S$($,T);return new vN(W,X)}class CN extends e{static[N]="PgJsonBuilder";constructor($){super($,"json","PgJson")}build($){return new _z($,this.config)}}class _z extends d{static[N]="PgJson";constructor($,T){super($,T)}getSQLType(){return"json"}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){if(typeof $==="string")try{return JSON.parse($)}catch{return $}return $}}function SN($){return new CN($??"")}class jN extends e{static[N]="PgJsonbBuilder";constructor($){super($,"json","PgJsonb")}build($){return new kz($,this.config)}}class kz extends d{static[N]="PgJsonb";constructor($,T){super($,T)}getSQLType(){return"jsonb"}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){if(typeof $==="string")try{return JSON.parse($)}catch{return $}return $}}function IN($){return new jN($??"")}class BN extends e{static[N]="PgLineBuilder";constructor($){super($,"array","PgLine")}build($){return new xN($,this.config)}}class xN extends d{static[N]="PgLine";getSQLType(){return"line"}mapFromDriverValue($){let[T,W,X]=$.slice(1,-1).split(",");return[Number.parseFloat(T),Number.parseFloat(W),Number.parseFloat(X)]}mapToDriverValue($){return`{${$[0]},${$[1]},${$[2]}}`}}class fN extends e{static[N]="PgLineABCBuilder";constructor($){super($,"json","PgLineABC")}build($){return new bN($,this.config)}}class bN extends d{static[N]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue($){let[T,W,X]=$.slice(1,-1).split(",");return{a:Number.parseFloat(T),b:Number.parseFloat(W),c:Number.parseFloat(X)}}mapToDriverValue($){return`{${$.a},${$.b},${$.c}}`}}function yN($,T){let{name:W,config:X}=S$($,T);if(!X?.mode||X.mode==="tuple")return new BN(W);return new fN(W)}class hN extends e{static[N]="PgMacaddrBuilder";constructor($){super($,"string","PgMacaddr")}build($){return new gN($,this.config)}}class gN extends d{static[N]="PgMacaddr";getSQLType(){return"macaddr"}}function mN($){return new hN($??"")}class cN extends e{static[N]="PgMacaddr8Builder";constructor($){super($,"string","PgMacaddr8")}build($){return new uN($,this.config)}}class uN extends d{static[N]="PgMacaddr8";getSQLType(){return"macaddr8"}}function pN($){return new cN($??"")}class dN extends e{static[N]="PgNumericBuilder";constructor($,T,W){super($,"string","PgNumeric");this.config.precision=T,this.config.scale=W}build($){return new vz($,this.config)}}class vz extends d{static[N]="PgNumeric";precision;scale;constructor($,T){super($,T);this.precision=T.precision,this.scale=T.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 oN extends e{static[N]="PgNumericNumberBuilder";constructor($,T,W){super($,"number","PgNumericNumber");this.config.precision=T,this.config.scale=W}build($){return new lN($,this.config)}}class lN extends d{static[N]="PgNumericNumber";precision;scale;constructor($,T){super($,T);this.precision=T.precision,this.scale=T.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 rN extends e{static[N]="PgNumericBigIntBuilder";constructor($,T,W){super($,"bigint","PgNumericBigInt");this.config.precision=T,this.config.scale=W}build($){return new nN($,this.config)}}class nN extends d{static[N]="PgNumericBigInt";precision;scale;constructor($,T){super($,T);this.precision=T.precision,this.scale=T.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 iN($,T){let{name:W,config:X}=S$($,T),U=X?.mode;return U==="number"?new oN(W,X?.precision,X?.scale):U==="bigint"?new rN(W,X?.precision,X?.scale):new dN(W,X?.precision,X?.scale)}class tN extends e{static[N]="PgPointTupleBuilder";constructor($){super($,"array","PgPointTuple")}build($){return new aN($,this.config)}}class aN extends d{static[N]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue($){if(typeof $==="string"){let[T,W]=$.slice(1,-1).split(",");return[Number.parseFloat(T),Number.parseFloat(W)]}return[$.x,$.y]}mapToDriverValue($){return`(${$[0]},${$[1]})`}}class sN extends e{static[N]="PgPointObjectBuilder";constructor($){super($,"json","PgPointObject")}build($){return new eN($,this.config)}}class eN extends d{static[N]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue($){if(typeof $==="string"){let[T,W]=$.slice(1,-1).split(",");return{x:Number.parseFloat(T),y:Number.parseFloat(W)}}return $}mapToDriverValue($){return`(${$.x},${$.y})`}}function $L($,T){let{name:W,config:X}=S$($,T);if(!X?.mode||X.mode==="tuple")return new tN(W);return new sN(W)}function cI($){let T=[];for(let W=0;W<$.length;W+=2)T.push(Number.parseInt($.slice(W,W+2),16));return new Uint8Array(T)}function TL($,T){let W=new ArrayBuffer(8),X=new DataView(W);for(let U=0;U<8;U++)X.setUint8(U,$[T+U]);return X.getFloat64(0,!0)}function eO($){let T=cI($),W=0,X=T[W];W+=1;let U=new DataView(T.buffer),w=U.getUint32(W,X===1);W+=4;let Y;if(w&536870912)Y=U.getUint32(W,X===1),W+=4;if((w&65535)===1){let G=TL(T,W);W+=8;let H=TL(T,W);return W+=8,[G,H]}throw new Error("Unsupported geometry type")}class WL extends e{static[N]="PgGeometryBuilder";constructor($){super($,"array","PgGeometry")}build($){return new UL($,this.config)}}class UL extends d{static[N]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue($){return eO($)}mapToDriverValue($){return`point(${$[0]} ${$[1]})`}}class XL extends e{static[N]="PgGeometryObjectBuilder";constructor($){super($,"json","PgGeometryObject")}build($){return new wL($,this.config)}}class wL extends d{static[N]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue($){let T=eO($);return{x:T[0],y:T[1]}}mapToDriverValue($){return`point(${$.x} ${$.y})`}}function YL($,T){let{name:W,config:X}=S$($,T);if(!X?.mode||X.mode==="tuple")return new WL(W);return new XL(W)}class GL extends e{static[N]="PgRealBuilder";constructor($,T){super($,"number","PgReal");this.config.length=T}build($){return new zL($,this.config)}}class zL extends d{static[N]="PgReal";constructor($,T){super($,T)}getSQLType(){return"real"}mapFromDriverValue=($)=>{if(typeof $==="string")return Number.parseFloat($);return $}}function HL($){return new GL($??"")}class FL extends e{static[N]="PgSerialBuilder";constructor($){super($,"number","PgSerial");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new OL($,this.config)}}class OL extends d{static[N]="PgSerial";getSQLType(){return"serial"}}function QL($){return new FL($??"")}class ZL extends vT{static[N]="PgSmallIntBuilder";constructor($){super($,"number","PgSmallInt")}build($){return new VL($,this.config)}}class VL extends d{static[N]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=($)=>{if(typeof $==="string")return Number($);return $}}function KL($){return new ZL($??"")}class AL extends e{static[N]="PgSmallSerialBuilder";constructor($){super($,"number","PgSmallSerial");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new EL($,this.config)}}class EL extends d{static[N]="PgSmallSerial";getSQLType(){return"smallserial"}}function ML($){return new AL($??"")}class DL extends e{static[N]="PgTextBuilder";constructor($,T){super($,"string","PgText");this.config.enumValues=T.enum}build($){return new NL($,this.config)}}class NL extends d{static[N]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function LL($,T={}){let{name:W,config:X}=S$($,T);return new DL(W,X)}class JL extends h0{constructor($,T,W){super($,"string","PgTime");this.withTimezone=T,this.precision=W,this.config.withTimezone=T,this.config.precision=W}static[N]="PgTimeBuilder";build($){return new Pz($,this.config)}}class Pz extends d{static[N]="PgTime";withTimezone;precision;constructor($,T){super($,T);this.withTimezone=T.withTimezone,this.precision=T.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function RL($,T={}){let{name:W,config:X}=S$($,T);return new JL(W,X.withTimezone??!1,X.precision)}class _L extends h0{static[N]="PgTimestampBuilder";constructor($,T,W){super($,"date","PgTimestamp");this.config.withTimezone=T,this.config.precision=W}build($){return new qz($,this.config)}}class qz extends d{static[N]="PgTimestamp";withTimezone;precision;constructor($,T){super($,T);this.withTimezone=T.withTimezone,this.precision=T.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 kL extends h0{static[N]="PgTimestampStringBuilder";constructor($,T,W){super($,"string","PgTimestampString");this.config.withTimezone=T,this.config.precision=W}build($){return new Cz($,this.config)}}class Cz extends d{static[N]="PgTimestampString";withTimezone;precision;constructor($,T){super($,T);this.withTimezone=T.withTimezone,this.precision=T.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function vL($,T={}){let{name:W,config:X}=S$($,T);if(X?.mode==="string")return new kL(W,X.withTimezone??!1,X.precision);return new _L(W,X?.withTimezone??!1,X?.precision)}class PL extends e{static[N]="PgUUIDBuilder";constructor($){super($,"string","PgUUID")}defaultRandom(){return this.default(R`gen_random_uuid()`)}build($){return new Sz($,this.config)}}class Sz extends d{static[N]="PgUUID";getSQLType(){return"uuid"}}function L1($){return new PL($??"")}class qL extends e{static[N]="PgVarcharBuilder";constructor($,T){super($,"string","PgVarchar");this.config.length=T.length,this.config.enumValues=T.enum}build($){return new CL($,this.config)}}class CL extends d{static[N]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function W6($,T={}){let{name:W,config:X}=S$($,T);return new qL(W,X)}class SL extends e{static[N]="PgBinaryVectorBuilder";constructor($,T){super($,"string","PgBinaryVector");this.config.dimensions=T.dimensions}build($){return new jL($,this.config)}}class jL extends d{static[N]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function IL($,T){let{name:W,config:X}=S$($,T);return new SL(W,X)}class BL extends e{static[N]="PgHalfVectorBuilder";constructor($,T){super($,"array","PgHalfVector");this.config.dimensions=T.dimensions}build($){return new xL($,this.config)}}class xL extends d{static[N]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){return $.slice(1,-1).split(",").map((T)=>Number.parseFloat(T))}}function fL($,T){let{name:W,config:X}=S$($,T);return new BL(W,X)}class bL extends e{static[N]="PgSparseVectorBuilder";constructor($,T){super($,"string","PgSparseVector");this.config.dimensions=T.dimensions}build($){return new yL($,this.config)}}class yL extends d{static[N]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}function hL($,T){let{name:W,config:X}=S$($,T);return new bL(W,X)}class gL extends e{static[N]="PgVectorBuilder";constructor($,T){super($,"array","PgVector");this.config.dimensions=T.dimensions}build($){return new mL($,this.config)}}class mL extends d{static[N]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){return $.slice(1,-1).split(",").map((T)=>Number.parseFloat(T))}}function cL($,T){let{name:W,config:X}=S$($,T);return new gL(W,X)}function uL(){return{bigint:sD,bigserial:UN,boolean:Y8,char:zN,cidr:ON,customType:VN,date:EN,doublePrecision:NN,inet:RN,integer:G8,interval:qN,json:SN,jsonb:IN,line:yN,macaddr:mN,macaddr8:pN,numeric:iN,point:$L,geometry:YL,real:HL,serial:QL,smallint:KL,smallserial:ML,text:LL,time:RL,timestamp:vL,uuid:L1,varchar:W6,bit:IL,halfvec:fL,sparsevec:hL,vector:cL}}var $Q=Symbol.for("drizzle:PgInlineForeignKeys"),pL=Symbol.for("drizzle:EnableRLS");class x4 extends l{static[N]="PgTable";static Symbol=Object.assign({},l.Symbol,{InlineForeignKeys:$Q,EnableRLS:pL});[$Q]=[];[pL]=!1;[l.Symbol.ExtraConfigBuilder]=void 0;[l.Symbol.ExtraConfigColumns]={}}function uI($,T,W,X,U=$){let w=new x4($,X,U),Y=typeof T==="function"?T(uL()):T,G=Object.fromEntries(Object.entries(Y).map(([F,O])=>{let Q=O;Q.setName(F);let Z=Q.build(w);return w[$Q].push(...Q.buildForeignKeys(Z,w)),[F,Z]})),H=Object.fromEntries(Object.entries(Y).map(([F,O])=>{let Q=O;Q.setName(F);let Z=Q.buildExtraConfigColumn(w);return[F,Z]})),z=Object.assign(w,G);if(z[l.Symbol.Columns]=G,z[l.Symbol.ExtraConfigColumns]=H,W)z[x4.Symbol.ExtraConfigBuilder]=W;return Object.assign(z,{enableRLS:()=>{return z[x4.Symbol.EnableRLS]=!0,z}})}var PT=($,T,W)=>{return uI($,T,W,void 0)};function dL(...$){if($[0].columns)return new z8($[0].columns,$[0].name);return new z8($)}class z8{static[N]="PgPrimaryKeyBuilder";columns;name;constructor($,T){this.columns=$,this.name=T}build($){return new oL($,this.columns,this.name)}}class oL{constructor($,T,W){this.table=$,this.columns=T,this.name=W}static[N]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[x4.Symbol.Name]}_${this.columns.map(($)=>$.name).join("_")}_pk`}}function u6($,T){if(mD(T)&&!rO($)&&!I($,F1)&&!I($,kT)&&!I($,p$)&&!I($,l)&&!I($,c6))return new F1($,T);return $}var jz=($,T)=>{return R`${$} = ${u6(T,$)}`},lL=($,T)=>{return R`${$} <> ${u6(T,$)}`};function H8(...$){let T=$.filter((W)=>W!==void 0);if(T.length===0)return;if(T.length===1)return new a(T);return new a([new B4("("),R.join(T,new B4(" and ")),new B4(")")])}function rL(...$){let T=$.filter((W)=>W!==void 0);if(T.length===0)return;if(T.length===1)return new a(T);return new a([new B4("("),R.join(T,new B4(" or ")),new B4(")")])}function nL($){return R`not ${$}`}var Iz=($,T)=>{return R`${$} > ${u6(T,$)}`},iL=($,T)=>{return R`${$} >= ${u6(T,$)}`},tL=($,T)=>{return R`${$} < ${u6(T,$)}`},aL=($,T)=>{return R`${$} <= ${u6(T,$)}`};function sL($,T){if(Array.isArray(T)){if(T.length===0)return R`false`;return R`${$} in ${T.map((W)=>u6(W,$))}`}return R`${$} in ${u6(T,$)}`}function eL($,T){if(Array.isArray(T)){if(T.length===0)return R`true`;return R`${$} not in ${T.map((W)=>u6(W,$))}`}return R`${$} not in ${u6(T,$)}`}function $J($){return R`${$} is null`}function TJ($){return R`${$} is not null`}function WJ($){return R`exists ${$}`}function UJ($){return R`not exists ${$}`}function XJ($,T,W){return R`${$} between ${u6(T,$)} and ${u6(W,$)}`}function wJ($,T,W){return R`${$} not between ${u6(T,$)} and ${u6(W,$)}`}function YJ($,T){return R`${$} like ${T}`}function GJ($,T){return R`${$} not like ${T}`}function zJ($,T){return R`${$} ilike ${T}`}function HJ($,T){return R`${$} not ilike ${T}`}function FJ($){return R`${$} asc`}function OJ($){return R`${$} desc`}class TQ{constructor($,T,W){this.sourceTable=$,this.referencedTable=T,this.relationName=W,this.referencedTableName=T[l.Symbol.Name]}static[N]="Relation";referencedTableName;fieldName}class QJ{constructor($,T){this.table=$,this.config=T}static[N]="Relations"}class qT extends TQ{constructor($,T,W,X){super($,T,W?.relationName);this.config=W,this.isNullable=X}static[N]="One";withFieldName($){let T=new qT(this.sourceTable,this.referencedTable,this.config,this.isNullable);return T.fieldName=$,T}}class F8 extends TQ{constructor($,T,W){super($,T,W?.relationName);this.config=W}static[N]="Many";withFieldName($){let T=new F8(this.sourceTable,this.referencedTable,this.config);return T.fieldName=$,T}}function ZJ(){return{and:H8,between:XJ,eq:jz,exists:WJ,gt:Iz,gte:iL,ilike:zJ,inArray:sL,isNull:$J,isNotNull:TJ,like:YJ,lt:tL,lte:aL,ne:lL,not:nL,notBetween:wJ,notExists:UJ,notLike:GJ,notIlike:HJ,notInArray:eL,or:rL,sql:R}}function VJ(){return{sql:R,asc:FJ,desc:OJ}}function KJ($,T){if(Object.keys($).length===1&&"default"in $&&!I($.default,l))$=$.default;let W={},X={},U={};for(let[w,Y]of Object.entries($))if(I(Y,l)){let G=kW(Y),H=X[G];W[G]=w,U[w]={tsName:w,dbName:Y[l.Symbol.Name],schema:Y[l.Symbol.Schema],columns:Y[l.Symbol.Columns],relations:H?.relations??{},primaryKey:H?.primaryKey??[]};for(let F of Object.values(Y[l.Symbol.Columns]))if(F.primary)U[w].primaryKey.push(F);let z=Y[l.Symbol.ExtraConfigBuilder]?.(Y[l.Symbol.ExtraConfigColumns]);if(z){for(let F of Object.values(z))if(I(F,z8))U[w].primaryKey.push(...F.columns)}}else if(I(Y,QJ)){let G=kW(Y.table),H=W[G],z=Y.config(T(Y.table)),F;for(let[O,Q]of Object.entries(z))if(H){let Z=U[H];if(Z.relations[O]=Q,F)Z.primaryKey.push(...F)}else{if(!(G in X))X[G]={relations:{},primaryKey:F};X[G].relations[O]=Q}}return{tables:U,tableNamesMap:W}}function pI($){return function T(W,X){return new qT($,W,X,X?.fields.reduce((U,w)=>U&&w.notNull,!0)??!1)}}function dI($){return function T(W,X){return new F8($,W,X)}}function AJ($,T,W){if(I(W,qT)&&W.config)return{fields:W.config.fields,references:W.config.references};let X=T[kW(W.referencedTable)];if(!X)throw new Error(`Table "${W.referencedTable[l.Symbol.Name]}" not found in schema`);let U=$[X];if(!U)throw new Error(`Table "${X}" not found in schema`);let w=W.sourceTable,Y=T[kW(w)];if(!Y)throw new Error(`Table "${w[l.Symbol.Name]}" not found in schema`);let G=[];for(let H of Object.values(U.relations))if(W.relationName&&W!==H&&H.relationName===W.relationName||!W.relationName&&H.referencedTable===W.sourceTable)G.push(H);if(G.length>1)throw W.relationName?new Error(`There are multiple relations with name "${W.relationName}" in table "${X}"`):new Error(`There are multiple relations between "${X}" and "${W.sourceTable[l.Symbol.Name]}". Please specify relation name`);if(G[0]&&I(G[0],qT)&&G[0].config)return{fields:G[0].config.references,references:G[0].config.fields};throw new Error(`There is not enough information to infer relation "${Y}.${W.fieldName}"`)}function EJ($){return{one:pI($),many:dI($)}}function Bz($,T,W,X,U=(w)=>w){let w={};for(let[Y,G]of X.entries())if(G.isJson){let H=T.relations[G.tsKey],z=W[Y],F=typeof z==="string"?JSON.parse(z):z;w[G.tsKey]=I(H,qT)?F&&Bz($,$[G.relationTableTsKey],F,G.selection,U):F.map((O)=>Bz($,$[G.relationTableTsKey],O,G.selection,U))}else{let H=U(W[Y]),z=G.field,F;if(I(z,p$))F=z;else if(I(z,a))F=z.decoder;else F=z.sql.decoder;w[G.tsKey]=H===null?null:F.mapFromDriverValue(H)}return w}import xy from"path";import VB from"os";import KB from"fs";var xz=new Map,WQ=new Map,UQ=Symbol("OriginError"),r2={};class J1 extends Promise{constructor($,T,W,X,U={}){let w,Y;super((G,H)=>{w=G,Y=H});this.tagged=Array.isArray($.raw),this.strings=$,this.args=T,this.handler=W,this.canceller=X,this.options=U,this.state=null,this.statement=null,this.resolve=(G)=>(this.active=!1,w(G)),this.reject=(G)=>(this.active=!1,Y(G)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[UQ]=this.handler.debug?new Error:this.tagged&&oI(this.strings)}get origin(){return(this.handler.debug?this[UQ].stack:this.tagged&&WQ.has(this.strings)?WQ.get(this.strings):WQ.set(this.strings,this[UQ].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,T){if(this.options.simple=!1,typeof $==="function")T=$,$=1;if(this.cursorRows=$,typeof T==="function")return this.cursorFn=T,this;let W;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};W&&W();let X=new Promise((U,w)=>{this.cursorFn=(Y)=>{return U({value:Y,done:!1}),new Promise((G)=>W=G)},this.resolve=()=>(this.active=!1,U({done:!0})),this.reject=(Y)=>(this.active=!1,w(Y))});return this.execute(),X},return(){return W&&W(r2),{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 oI($){if(xz.has($))return xz.get($);let T=Error.stackTraceLimit;return Error.stackTraceLimit=4,xz.set($,new Error),Error.stackTraceLimit=T,xz.get($)}class n2 extends Error{constructor($){super($.message);this.name=this.constructor.name,Object.assign(this,$)}}var J4={connection:MJ,postgres:DJ,generic:NJ,notSupported:LJ};function MJ($,T,W){let{host:X,port:U}=W||T,w=Object.assign(new Error("write "+$+" "+(T.path||X+":"+U)),{code:$,errno:$,address:T.path||X},T.path?{}:{port:U});return Error.captureStackTrace(w,MJ),w}function DJ($){let T=new n2($);return Error.captureStackTrace(T,DJ),T}function NJ($,T){let W=Object.assign(new Error($+": "+T),{code:$});return Error.captureStackTrace(W,NJ),W}function LJ($){let T=Object.assign(new Error($+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:$});return Error.captureStackTrace(T,LJ),T}var lI={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 yz{then(){XQ()}catch(){XQ()}finally(){XQ()}}class V8 extends yz{constructor($){super();this.value=mz($)}}class G0 extends yz{constructor($,T,W){super();this.value=$,this.type=T,this.array=W}}class hz extends yz{constructor($,T){super();this.first=$,this.rest=T}build($,T,W,X){let U=rI.map(([w,Y])=>({fn:Y,i:$.search(w)})).sort((w,Y)=>w.i-Y.i).pop();return U.i===-1?HQ(this.first,X):U.fn(this.first,this.rest,T,W,X)}}function gz($,T,W,X){let U=$ instanceof G0?$.value:$;if(U===void 0){if($ instanceof G0?$.value=X.transform.undefined:U=$=X.transform.undefined,U===void 0)throw J4.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+W.push($ instanceof G0?(T.push($.value),$.array?$.array[$.type||bz($.value)]||$.type||kJ($.value):$.type):(T.push($),bz($)))}var RJ=PJ(lI);function GQ($,T,W,X,U,w){for(let Y=1;Y<$.strings.length;Y++)T+=zQ(T,W,X,U,w)+$.strings[Y],W=$.args[Y];return T}function zQ($,T,W,X,U){return T instanceof hz?T.build($,W,X,U):T instanceof J1?YQ(T,W,X,U):T instanceof V8?T.value:T&&T[0]instanceof J1?T.reduce((w,Y)=>w+" "+YQ(Y,W,X,U),""):gz(T,W,X,U)}function YQ($,T,W,X){return $.fragment=!0,GQ($,$.strings[0],$.args[0],T,W,X)}function _J($,T,W,X,U){return $.map((w)=>"("+X.map((Y)=>zQ("values",w[Y],T,W,U)).join(",")+")").join(",")}function JJ($,T,W,X,U){let w=Array.isArray($[0]),Y=T.length?T.flat():Object.keys(w?$[0]:$);return _J(w?$:[$],W,X,Y,U)}function fz($,T,W,X,U){if(typeof $==="string"&&($=[$].concat(T)),Array.isArray($))return HQ($,U);let w;return(T.length?T.flat():Object.keys($)).map((G)=>{return w=$[G],(w instanceof J1?YQ(w,W,X,U):w instanceof V8?w.value:gz(w,W,X,U))+" as "+mz(U.transform.column.to?U.transform.column.to(G):G)}).join(",")}var rI=Object.entries({values:JJ,in:(...$)=>{let T=JJ(...$);return T==="()"?"(null)":T},select:fz,as:fz,returning:fz,"\\(":fz,update($,T,W,X,U){return(T.length?T.flat():Object.keys($)).map((w)=>mz(U.transform.column.to?U.transform.column.to(w):w)+"="+zQ("values",$[w],W,X,U))},insert($,T,W,X,U){let w=T.length?T.flat():Object.keys(Array.isArray($)?$[0]:$);return"("+HQ(w,U)+")values"+_J(Array.isArray($)?$:[$],W,X,w,U)}}).map(([$,T])=>[new RegExp("((?:^|[\\s(])"+$+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),T]);function XQ(){throw J4.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:nI,parsers:iI}=RJ;function kJ($){if(Array.isArray($))return kJ($[0]);return typeof $==="string"?1009:0}var vJ=function($){let T=PJ($||{});return{serializers:Object.assign({},nI,T.serializers),parsers:Object.assign({},iI,T.parsers)}};function PJ($){return Object.keys($).reduce((T,W)=>{if($[W].from&&[].concat($[W].from).forEach((X)=>T.parsers[X]=$[W].parse),$[W].serialize)T.serializers[$[W].to]=$[W].serialize,$[W].from&&[].concat($[W].from).forEach((X)=>T.serializers[X]=$[W].serialize);return T},{parsers:{},serializers:{}})}function HQ($,{transform:{column:T}}){return $.map((W)=>mz(T.to?T.to(W):W)).join(",")}var mz=function $(T){return'"'+T.replace(/"/g,'""').replace(/\./g,'"."')+'"'},bz=function $(T){return T instanceof G0?T.type:T instanceof Date?1184:T instanceof Uint8Array?17:T===!0||T===!1?16:typeof T==="bigint"?20:Array.isArray(T)?$(T[0]):0},tI=/\\/g,aI=/"/g;function sI($){return $.replace(tI,"\\\\").replace(aI,"\\\"")}var qJ=function $(T,W,X,U){if(Array.isArray(T)===!1)return T;if(!T.length)return"{}";let w=T[0],Y=U===1020?";":",";if(Array.isArray(w)&&!w.type)return"{"+T.map((G)=>$(G,W,X,U)).join(Y)+"}";return"{"+T.map((G)=>{if(G===void 0){if(G=X.transform.undefined,G===void 0)throw J4.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return G===null?"null":'"'+sI(W?W(G.type?G.value:G):""+G)+'"'}).join(Y)+"}"},wQ={i:0,char:null,str:"",quoted:!1,last:0},CJ=function $(T,W,X){return wQ.i=wQ.last=0,SJ(wQ,T,W,X)};function SJ($,T,W,X){let U=[],w=X===1020?";":",";for(;$.i<T.length;$.i++){if($.char=T[$.i],$.quoted)if($.char==="\\")$.str+=T[++$.i];else if($.char==='"')U.push(W?W($.str):$.str),$.str="",$.quoted=T[$.i+1]==='"',$.last=$.i+2;else $.str+=$.char;else if($.char==='"')$.quoted=!0;else if($.char==="{")$.last=++$.i,U.push(SJ($,T,W,X));else if($.char==="}"){$.quoted=!1,$.last<$.i&&U.push(W?W(T.slice($.last,$.i)):T.slice($.last,$.i)),$.last=$.i+1;break}else if($.char===w&&$.p!=="}"&&$.p!=='"')U.push(W?W(T.slice($.last,$.i)):T.slice($.last,$.i)),$.last=$.i+1;$.p=$.char}return $.last<$.i&&U.push(W?W(T.slice($.last,$.i+1)):T.slice($.last,$.i+1)),U}var vW=($)=>{let T=$[0];for(let W=1;W<$.length;W++)T+=$[W]==="_"?$[++W].toUpperCase():$[W];return T},PW=($)=>{let T=$[0].toUpperCase();for(let W=1;W<$.length;W++)T+=$[W]==="_"?$[++W].toUpperCase():$[W];return T},qW=($)=>$.replace(/_/g,"-"),O8=($)=>$.replace(/([A-Z])/g,"_$1").toLowerCase(),Q8=($)=>($.slice(0,1)+$.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),Z8=($)=>$.replace(/-/g,"_");function FQ($){return function T(W,X){return typeof W==="object"&&W!==null&&(X.type===114||X.type===3802)?Array.isArray(W)?W.map((U)=>T(U,X)):Object.entries(W).reduce((U,[w,Y])=>Object.assign(U,{[$(w)]:T(Y,X)}),{}):W}}vW.column={from:vW};vW.value={from:FQ(vW)};O8.column={to:O8};var OQ={...vW};OQ.column.to=O8;PW.column={from:PW};PW.value={from:FQ(PW)};Q8.column={to:Q8};var QQ={...PW};QQ.column.to=Q8;qW.column={from:qW};qW.value={from:FQ(qW)};Z8.column={to:Z8};var ZQ={...qW};ZQ.column.to=Z8;import jJ from"net";import WB from"tls";import K8 from"crypto";import VQ from"stream";import{performance as IJ}from"perf_hooks";class CW 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 O1=eI;function eI($=[]){let T=$.slice(),W=0;return{get length(){return T.length-W},remove:(X)=>{let U=T.indexOf(X);return U===-1?null:(T.splice(U,1),X)},push:(X)=>(T.push(X),X),shift:()=>{let X=T[W++];if(W===T.length)W=0,T=[];else T[W-1]=void 0;return X}}}var U6=Buffer.allocUnsafe(256),$B="BCcDdEFfHPpQSX".split("").reduce(($,T)=>{let W=T.charCodeAt(0);return $[T]=()=>{return U6[0]=W,u$.i=5,u$},$},{}),u$=Object.assign(TB,$B,{N:String.fromCharCode(0),i:0,inc($){return u$.i+=$,u$},str($){let T=Buffer.byteLength($);return cz(T),u$.i+=U6.write($,u$.i,T,"utf8"),u$},i16($){return cz(2),U6.writeUInt16BE($,u$.i),u$.i+=2,u$},i32($,T){if(T||T===0)return U6.writeUInt32BE($,T),u$;return cz(4),U6.writeUInt32BE($,u$.i),u$.i+=4,u$},z($){return cz($),U6.fill(0,u$.i,u$.i+$),u$.i+=$,u$},raw($){return U6=Buffer.concat([U6.subarray(0,u$.i),$]),u$.i=U6.length,u$},end($=1){U6.writeUInt32BE(u$.i-$,$);let T=U6.subarray(0,u$.i);return u$.i=0,U6=Buffer.allocUnsafe(256),T}}),Y$=u$;function cz($){if(U6.length-u$.i<$){let T=U6,W=T.length;U6=Buffer.allocUnsafe(W+(W>>1)+$),T.copy(U6)}}function TB(){return u$.i=0,u$}var EQ=fJ,UB=1,CT=Y$().S().end(),BJ=Y$().H().end(),XB=Y$().i32(8).i32(80877103).end(8),wB=Buffer.concat([Y$().E().str(Y$.N).i32(0).end(),CT]),YB=Y$().D().str("S").str(Y$.N).end(),i2=()=>{},GB=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),zB={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 fJ($,T={},{onopen:W=i2,onend:X=i2,onclose:U=i2}={}){let{ssl:w,max:Y,user:G,host:H,port:z,database:F,parsers:O,transform:Q,onnotice:Z,onnotify:K,onparameter:A,max_pipeline:D,keep_alive:L,backoff:J,target_session_attrs:_}=$,C=O1(),f=UB++,b={pid:null,secret:null},g=AQ(j9,$.idle_timeout),T$=AQ(j9,$.max_lifetime),N$=AQ(Jv,$.connect_timeout),j=null,w$,t=new CW,z$=Buffer.alloc(0),B$=$.fetch_types,e$={},h4={},n6=Math.random().toString(36).slice(2),c=1,F$=0,m$=0,Y4=0,_4=0,L$=0,c$=0,D4=0,G4=null,$4=null,t4=!1,l$=null,P1=null,p4=null,a0=null,k4=null,T4=null,q1=null,u1=null,i=null,MU=null,a4={queue:T.closed,idleTimer:g,connect(M){p4=M,HV()},terminate:NU,execute:DU,cancel:Mv,end:j9,count:0,id:f};return T.closed&&T.closed.push(a4),a4;async function Ev(){let M;try{M=$.socket?await Promise.resolve($.socket($)):new jJ.Socket}catch(P){gW(P);return}return M.on("error",gW),M.on("close",FV),M.on("drain",GV),M}async function Mv({pid:M,secret:P},H$,f$){try{w$=Y$().i32(16).i32(80877102).i32(M).i32(P).end(16),await zV(),j.once("error",f$),j.once("close",H$)}catch(V4){f$(V4)}}function DU(M){if(t4)return s8(M,J4.connection("CONNECTION_DESTROYED",$));if(M.cancelled)return;try{return M.state=b,i?C.push(M):(i=M,i.active=!0),Lv(M),d4(Dv(M))&&!M.describeFirst&&!M.cursorFn&&C.length<D&&(!M.options.onexecute||M.options.onexecute(a4))}catch(P){return C.length===0&&d4(CT),p1(P),!0}}function Dv(M){if(M.parameters.length>=65534)throw J4.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return M.options.simple?Y$().Q().str(M.statement.string+Y$.N).end():M.describeFirst?Buffer.concat([XV(M),BJ]):M.prepare?M.prepared?a8(M):Buffer.concat([XV(M),a8(M)]):Nv(M)}function XV(M){return Buffer.concat([QV(M.statement.string,M.parameters,M.statement.types,M.statement.name),YP("S",M.statement.name)])}function a8(M){return Buffer.concat([wP(M.parameters,M.statement.types,M.statement.name,M.cursorName),M.cursorFn?ZV("",M.cursorRows):wB])}function Nv(M){return Buffer.concat([QV(M.statement.string,M.parameters,M.statement.types),YB,a8(M)])}function Lv(M){let P=[],H$=[],f$=GQ(M,M.strings[0],M.args[0],P,H$,$);!M.tagged&&M.args.forEach((V4)=>gz(V4,P,H$,$)),M.prepare=$.prepare&&("prepare"in M.options?M.options.prepare:!0),M.string=f$,M.signature=M.prepare&&H$+f$,M.onlyDescribe&&delete h4[M.signature],M.parameters=M.parameters||P,M.prepared=M.prepare&&M.signature in h4,M.describeFirst=M.onlyDescribe||P.length&&!M.prepared,M.statement=M.prepared?h4[M.signature]:{string:f$,types:H$,name:M.prepare?n6+c++:""},typeof $.debug==="function"&&$.debug(f,f$,P,H$)}function d4(M,P){if(T4=T4?Buffer.concat([T4,M]):Buffer.from(M),P||T4.length>=1024)return wV(P);return $4===null&&($4=setImmediate(wV)),!0}function wV(M){let P=j.write(T4,M);return $4!==null&&clearImmediate($4),T4=$4=null,P}function Jv(){p1(J4.connection("CONNECT_TIMEOUT",$,j)),j.destroy()}async function YV(){if(d4(XB),!await new Promise((P)=>j.once("data",(H$)=>P(H$[0]===83)))&&w==="prefer")return hW();j.removeAllListeners(),j=WB.connect({socket:j,servername:jJ.isIP(j.host)?void 0:j.host,...w==="require"||w==="allow"||w==="prefer"?{rejectUnauthorized:!1}:w==="verify-full"?{}:typeof w==="object"?w:{}}),j.on("secureConnect",hW),j.on("error",gW),j.on("close",FV),j.on("drain",GV)}function GV(){!i&&W(a4)}function S9(M){if(l$){if(l$.push(M),m$-=M.length,m$>0)return}z$=l$?Buffer.concat(l$,L$-m$):z$.length===0?M:Buffer.concat([z$,M],z$.length+M.length);while(z$.length>4){if(L$=z$.readUInt32BE(1),L$>=z$.length){m$=L$-z$.length,l$=[z$];break}try{Rv(z$.subarray(0,L$+1))}catch(P){i&&(i.cursorFn||i.describeFirst)&&d4(CT),p1(P)}z$=z$.subarray(L$+1),m$=0,l$=null}}async function zV(){if(t4=!1,e$={},j||(j=await Ev()),!j)return;if(N$.start(),$.socket)return w?YV():hW();if(j.on("connect",w?YV:hW),$.path)return j.connect($.path);j.ssl=w,j.connect(z[Y4],H[Y4]),j.host=H[Y4],j.port=z[Y4],Y4=(Y4+1)%z.length}function HV(){setTimeout(zV,F$?F$+c$-IJ.now():0)}function hW(){try{h4={},B$=$.fetch_types,n6=Math.random().toString(36).slice(2),c=1,T$.start(),j.on("data",S9),L&&j.setKeepAlive&&j.setKeepAlive(!0,1000*L);let M=zP();d4(M)}catch(M){gW(M)}}function gW(M){if(a4.queue===T.connecting&&$.host[_4+1])return;p1(M);while(C.length)s8(C.shift(),M)}function p1(M){k4&&(k4.destroy(M),k4=null),i&&s8(i,M),p4&&(s8(p4,M),p4=null)}function s8(M,P){if(M.reserve)return M.reject(P);if(!P||typeof P!=="object")P=new Error(P);"query"in P||"parameters"in P||Object.defineProperties(P,{stack:{value:P.stack+M.origin.replace(/.*\n/,`
|
|
83
|
-
`),enumerable:$.debug},query:{value:M.string,enumerable:$.debug},parameters:{value:M.parameters,enumerable:$.debug},args:{value:M.args,enumerable:$.debug},types:{value:M.statement&&M.statement.types,enumerable:$.debug}}),M.reject(P)}function
|
|
105
|
+
`);this.baseURL=w.baseURL,this.timeout=w.timeout??TO.DEFAULT_TIMEOUT,this.logger=w.logger??console;let Y="warn";this.logLevel=Y,this.logLevel=jF(w.logLevel,"ClientOptions.logLevel",this)??jF(TW("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??Y,this.fetchOptions=w.fetchOptions,this.maxRetries=w.maxRetries??2,this.fetch=w.fetch??hA(),U$(this,IG,mA,"f"),this._options=w,this.apiKey=T,this.organization=W,this.project=U}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,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:T}){return}authHeaders($){return s([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery($){return CF($,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${GT}`}defaultIdempotencyKey(){return`stainless-node-retry-${NF()}`}makeStatusError($,T,W,U){return J4.generate($,T,W,U)}buildURL($,T,W){let U=!v(this,$O,"m",CE).call(this)&&W||this.baseURL,X=PA($)?new URL($):new URL(U+(U.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),w=this.defaultQuery();if(!CA(w))T={...w,...T};if(typeof T==="object"&&T&&!Array.isArray(T))X.search=this.stringifyQuery(T);return X.toString()}async prepareOptions($){}async prepareRequest($,{url:T,options:W}){}get($,T){return this.methodRequest("get",$,T)}post($,T){return this.methodRequest("post",$,T)}patch($,T){return this.methodRequest("patch",$,T)}put($,T){return this.methodRequest("put",$,T)}delete($,T){return this.methodRequest("delete",$,T)}methodRequest($,T,W){return this.request(Promise.resolve(W).then((U)=>{return{method:$,path:T,...U}}))}request($,T=null){return new tT(this,this.makeRequest($,T,void 0))}async makeRequest($,T,W){let U=await $,X=U.maxRetries??this.maxRetries;if(T==null)T=X;await this.prepareOptions(U);let{req:w,url:Y,timeout:G}=this.buildRequest(U,{retryCount:X-T});await this.prepareRequest(w,{url:Y,options:U});let H="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),z=W===void 0?"":`, retryOf: ${W}`,F=Date.now();if(S4(this).debug(`[${H}] sending request`,M0({retryOfRequestLogID:W,method:U.method,url:Y,options:U,headers:w.headers})),U.signal?.aborted)throw new q4;let O=new AbortController,Q=await this.fetchWithTimeout(Y,w,G,O).catch(M8),Z=Date.now();if(Q instanceof Error){let D=`retrying, ${T} attempts remaining`;if(U.signal?.aborted)throw new q4;let J=E8(Q)||/timed? ?out/i.test(String(Q)+("cause"in Q?String(Q.cause):""));if(T)return S4(this).info(`[${H}] connection ${J?"timed out":"failed"} - ${D}`),S4(this).debug(`[${H}] connection ${J?"timed out":"failed"} (${D})`,M0({retryOfRequestLogID:W,url:Y,durationMs:Z-F,message:Q.message})),this.retryRequest(U,T,W??H);if(S4(this).info(`[${H}] connection ${J?"timed out":"failed"} - error; no more retries left`),S4(this).debug(`[${H}] connection ${J?"timed out":"failed"} (error; no more retries left)`,M0({retryOfRequestLogID:W,url:Y,durationMs:Z-F,message:Q.message})),J)throw new iT;throw new nT({cause:Q})}let V=[...Q.headers.entries()].filter(([D])=>D==="x-request-id").map(([D,J])=>", "+D+": "+JSON.stringify(J)).join(""),A=`[${H}${z}${V}] ${w.method} ${Y} ${Q.ok?"succeeded":"failed"} with status ${Q.status} in ${Z-F}ms`;if(!Q.ok){let D=this.shouldRetry(Q);if(T&&D){let b=`retrying, ${T} attempts remaining`;return await gA(Q.body),S4(this).info(`${A} - ${b}`),S4(this).debug(`[${H}] response error (${b})`,M0({retryOfRequestLogID:W,url:Q.url,status:Q.status,headers:Q.headers,durationMs:Z-F})),this.retryRequest(U,T,W??H,Q.headers)}let J=D?"error; no more retries left":"error; not retryable";S4(this).info(`${A} - ${J}`);let L=await Q.text().catch((b)=>M8(b).message),_=BA(L),C=_?void 0:L;throw S4(this).debug(`[${H}] response error (${J})`,M0({retryOfRequestLogID:W,url:Q.url,status:Q.status,headers:Q.headers,message:C,durationMs:Date.now()-F})),this.makeStatusError(Q.status,_,C,Q.headers)}return S4(this).info(A),S4(this).debug(`[${H}] response start`,M0({retryOfRequestLogID:W,url:Q.url,status:Q.status,headers:Q.headers,durationMs:Z-F})),{response:Q,options:U,controller:O,requestLogID:H,retryOfRequestLogID:W,startTime:F}}getAPIList($,T,W){return this.requestAPIList(T,{method:"get",path:$,...W})}requestAPIList($,T){let W=this.makeRequest(T,null,void 0);return new KG(this,W,$)}async fetchWithTimeout($,T,W,U){let{signal:X,method:w,...Y}=T||{};if(X)X.addEventListener("abort",()=>U.abort());let G=setTimeout(()=>U.abort(),W),H=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,z={signal:U.signal,...H?{duplex:"half"}:{},method:"GET",...Y};if(w)z.method=w.toUpperCase();try{return await this.fetch.call(void 0,$,z)}finally{clearTimeout(G)}}shouldRetry($){let T=$.headers.get("x-should-retry");if(T==="true")return!0;if(T==="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($,T,W,U){let X,w=U?.get("retry-after-ms");if(w){let G=parseFloat(w);if(!Number.isNaN(G))X=G}let Y=U?.get("retry-after");if(Y&&!X){let G=parseFloat(Y);if(!Number.isNaN(G))X=G*1000;else X=Date.parse(Y)-Date.now()}if(!(X&&0<=X&&X<60000)){let G=$.maxRetries??this.maxRetries;X=this.calculateDefaultRetryTimeoutMillis(T,G)}return await r1(X),this.makeRequest($,T-1,W)}calculateDefaultRetryTimeoutMillis($,T){let X=T-$,w=Math.min(0.5*Math.pow(2,X),8),Y=1-Math.random()*0.25;return w*Y*1000}buildRequest($,{retryCount:T=0}={}){let W={...$},{method:U,path:X,query:w,defaultBaseURL:Y}=W,G=this.buildURL(X,w,Y);if("timeout"in W)jA("timeout",W.timeout);W.timeout=W.timeout??this.timeout;let{bodyHeaders:H,body:z}=this.buildBody({options:W}),F=this.buildHeaders({options:$,method:U,bodyHeaders:H,retryCount:T});return{req:{method:U,headers:F,...W.signal&&{signal:W.signal},...globalThis.ReadableStream&&z instanceof globalThis.ReadableStream&&{duplex:"half"},...z&&{body:z},...this.fetchOptions??{},...W.fetchOptions??{}},url:G,timeout:W.timeout}}buildHeaders({options:$,method:T,bodyHeaders:W,retryCount:U}){let X={};if(this.idempotencyHeader&&T!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=$.idempotencyKey}let w=s([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(U),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...yA(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},this.authHeaders($),this._options.defaultHeaders,W,$.headers]);return this.validateHeaders(w),w.values}buildBody({options:{body:$,headers:T}}){if(!$)return{bodyHeaders:void 0,body:void 0};let W=s([T]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&W.values.has("content-type")||$ instanceof 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:GG($)};else return v(this,IG,"f").call(this,{body:$,headers:W})}}TO=R$,IG=new WeakMap,$O=new WeakSet,CE=function $(){return this.baseURL!=="https://api.openai.com/v1"};R$.OpenAI=TO;R$.DEFAULT_TIMEOUT=600000;R$.OpenAIError=$$;R$.APIError=J4;R$.APIConnectionError=nT;R$.APIConnectionTimeoutError=iT;R$.APIUserAbortError=q4;R$.NotFoundError=L8;R$.ConflictError=R8;R$.RateLimitError=k8;R$.BadRequestError=D8;R$.AuthenticationError=N8;R$.InternalServerError=v8;R$.PermissionDeniedError=J8;R$.UnprocessableEntityError=_8;R$.toFile=AG;R$.Completions=O2;R$.Chat=eT;R$.Embeddings=Z2;R$.Files=K2;R$.Images=D2;R$.Audio=L0;R$.Moderations=J2;R$.Models=N2;R$.FineTuning=t1;R$.Graders=zW;R$.VectorStores=ZT;R$.Beta=R0;R$.Batches=z2;R$.Uploads=FW;R$.Responses=HW;R$.Evals=GW;R$.Containers=YW;function ij($,...T){let[W,U,X,w]=T,Y=[{role:"user",content:zA(U)},{role:"user",content:W}],G=w.at(-1);if(G)Y.push({role:"user",content:["Oops! That didn't work. Here's what was returned last time:",JSON.stringify(G.response,null,2),"Here's the error message:",JSON.stringify(G.error.issues,null,2)].join(`
|
|
106
|
+
`)});return{model:$,messages:Y}}var O$=1e6,SE={"gpt-4.1":{promptPricePerToken:2/O$,promptPricePerTokenCached:0.5/O$,completionPricePerToken:8/O$},"gpt-4.1-mini":{promptPricePerToken:0.4/O$,promptPricePerTokenCached:0.1/O$,completionPricePerToken:1.6/O$},"gpt-4.1-nano":{promptPricePerToken:0.1/O$,promptPricePerTokenCached:0.025/O$,completionPricePerToken:0.4/O$},"gpt-4o":{promptPricePerToken:2.5/O$,promptPricePerTokenCached:1.25/O$,completionPricePerToken:10/O$},"gpt-4o-mini":{promptPricePerToken:0.15/O$,promptPricePerTokenCached:0.075/O$,completionPricePerToken:0.6/O$},o1:{promptPricePerToken:15/O$,promptPricePerTokenCached:7.5/O$,completionPricePerToken:60/O$},"o1-mini":{promptPricePerToken:1.1/O$,promptPricePerTokenCached:0.55/O$,completionPricePerToken:4.4/O$},o3:{promptPricePerToken:10/O$,promptPricePerTokenCached:2.5/O$,completionPricePerToken:40/O$},"o3-mini":{promptPricePerToken:1.1/O$,promptPricePerTokenCached:0.55/O$,completionPricePerToken:4.4/O$},"o4-mini":{promptPricePerToken:1.1/O$,promptPricePerTokenCached:0.275/O$,completionPricePerToken:4.4/O$},"codex-mini-latest":{promptPricePerToken:1.5/O$,promptPricePerTokenCached:0.375/O$,completionPricePerToken:6/O$},"chatgpt-4o-latest":{promptPricePerToken:5/O$,promptPricePerTokenCached:5/O$,completionPricePerToken:15/O$},"gpt-4":{promptPricePerToken:30/O$,promptPricePerTokenCached:30/O$,completionPricePerToken:60/O$},"gpt-4-turbo":{promptPricePerToken:10/O$,promptPricePerTokenCached:10/O$,completionPricePerToken:30/O$},"gpt-3.5-turbo":{promptPricePerToken:0.5/O$,promptPricePerTokenCached:0.5/O$,completionPricePerToken:1.5/O$},"gpt-4-32k":{promptPricePerToken:60/O$,promptPricePerTokenCached:60/O$,completionPricePerToken:120/O$},"gpt-3.5-turbo-16k":{promptPricePerToken:3/O$,promptPricePerTokenCached:3/O$,completionPricePerToken:4/O$}};function tj($){let W=Object.keys(SE).filter((U)=>$.startsWith(U)).sort((U,X)=>X.length-U.length)[0];if(!W)return;return SE[W]}function BE($,T){let W=$.prompt_tokens,U=$.prompt_tokens_details?.cached_tokens??0,X=W-U,w=$.completion_tokens,Y=tj(T),G=0;if(Y)G=W*Y.promptPricePerToken+X*(Y.promptPricePerTokenCached??0)+w*Y.completionPricePerToken;else console.warn(`No pricing facts found for model ${T}. Giving a price of 0.`);return G}function aj($){return async function T(W,U){let X=await $.chat.completions.create({...W,stream:!1,response_format:{type:"json_object"}},U),w=X.choices[0].message?.content,{usage:Y}=X;if(w&&Y){let G=BE(Y,W.model);return{data:JSON.parse(w),usage:Y,usdPrice:G}}if(!w&&!Y)throw new Error("No content or usage found in completion");if(!w)throw new Error("No content found in completion");throw new Error("No usage found in completion")}}var jE=new Map,IE=class{usdBudget;usdMinimum;getCompletionSquirreled;getUnknownJsonFromOpenAi;getUnknownJsonFromOpenAiSquirreled;squirrel;model;client;lastUsage;logger;constructor({model:$,usdBudget:T,usdMinimum:W,apiKey:U,cachingMode:X,cacheKey:w="openai-safegen",logger:Y=console}){this.usdBudget=T,this.usdMinimum=W,this.model=$,this.squirrel=new vA(X),this.logger=Y;let G=jE.get(U);if(!G)G=new R$({apiKey:U,dangerouslyAllowBrowser:!1}),jE.set(U,G);this.client=G,this.getCompletionSquirreled=this.squirrel.add("openai-safegen",this.client.completions.create.bind(this.client.completions)),this.getUnknownJsonFromOpenAi=aj(this.client),this.getUnknownJsonFromOpenAiSquirreled=this.squirrel.add(w,this.getUnknownJsonFromOpenAi),this.from=GA(async(...H)=>{if(this.usdBudget<this.usdMinimum)return Y?.warn("SafeGen budget exhausted"),H[2];let z=ij($,...H),F=H[0],O=H[3],{data:Q,usage:Z,usdPrice:V}=await this.getUnknownJsonFromOpenAiSquirreled.for(`${F.replace(/[^a-zA-Z0-9-_. ]/g,"_")}-${O.length}`).get(z);return this.lastUsage=Z,this.usdBudget-=V,Q},Y),this.object=this.from}getCompletion=async($,T)=>{if(this.usdBudget<this.usdMinimum)return this.logger.warn("SafeGen budget exhausted"),"";let W=await this.getCompletionSquirreled.for($).get(T),{usage:U}=W;if(U){let X=BE(U,T.model);this.usdBudget-=X}return W.choices[0].text.trim()};from;object;boolean($){return HA($,async(T,W)=>{return(await this.getCompletion(W,{model:this.model,prompt:T,max_tokens:1})).toLowerCase()})}number($,T,W){return FA($,T,W,async(U,X)=>this.getCompletion(X,{model:this.model,prompt:U,max_tokens:6}))}choose($,T,W=1,U=W){return OA($,T,W,U,async(X,w,Y)=>this.getCompletion(w,{model:this.model,prompt:X,max_tokens:Y}),this.logger)}};import{exec as ly}from"child_process";class E extends Array{constructor($,T){if(super($),this.sign=T,Object.setPrototypeOf(this,E.prototype),$>E.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded")}static BigInt($){var T=Math.floor,W=Number.isFinite;if(typeof $=="number"){if($===0)return E.__zero();if(E.__isOneDigitInt($))return 0>$?E.__oneDigit(-$,!0):E.__oneDigit($,!1);if(!W($)||T($)!==$)throw new RangeError("The number "+$+" cannot be converted to BigInt because it is not an integer");return E.__fromDouble($)}if(typeof $=="string"){let U=E.__fromString($);if(U===null)throw new SyntaxError("Cannot convert "+$+" to a BigInt");return U}if(typeof $=="boolean")return $===!0?E.__oneDigit(1,!1):E.__zero();if(typeof $=="object"){if($.constructor===E)return $;let U=E.__toPrimitive($);return E.BigInt(U)}throw new TypeError("Cannot convert "+$+" to a BigInt")}toDebugString(){let $=["BigInt["];for(let T of this)$.push((T?(T>>>0).toString(16):T)+", ");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?E.__toStringBasePowerOfTwo(this,$):E.__toStringGeneric(this,$,!1)}valueOf(){throw new Error("Convert JSBI instances to native numbers using `toNumber`.")}static toNumber($){let T=$.length;if(T===0)return 0;if(T===1){let A=$.__unsignedDigit(0);return $.sign?-A:A}let W=$.__digit(T-1),U=E.__clz30(W),X=30*T-U;if(1024<X)return $.sign?-1/0:1/0;let w=X-1,Y=W,G=T-1,H=U+3,z=H===32?0:Y<<H;z>>>=12;let F=H-12,O=12<=H?0:Y<<20+H,Q=20+H;for(0<F&&0<G&&(G--,Y=$.__digit(G),z|=Y>>>30-F,O=Y<<F+2,Q=F+2);0<Q&&0<G;)G--,Y=$.__digit(G),O|=30<=Q?Y<<Q-30:Y>>>30-Q,Q-=30;let Z=E.__decideRounding($,Q,G,Y);if((Z===1||Z===0&&(1&O)==1)&&(O=O+1>>>0,O===0&&(z++,z>>>20!=0&&(z=0,w++,1023<w))))return $.sign?-1/0:1/0;let V=$.sign?-2147483648:0;return w=w+1023<<20,E.__kBitConversionInts[E.__kBitConversionIntHigh]=V|w|z,E.__kBitConversionInts[E.__kBitConversionIntLow]=O,E.__kBitConversionDouble[0]}static unaryMinus($){if($.length===0)return $;let T=$.__copy();return T.sign=!$.sign,T}static bitwiseNot($){return $.sign?E.__absoluteSubOne($).__trim():E.__absoluteAddOne($,!0)}static exponentiate($,T){if(T.sign)throw new RangeError("Exponent must be positive");if(T.length===0)return E.__oneDigit(1,!1);if($.length===0)return $;if($.length===1&&$.__digit(0)===1)return $.sign&&(1&T.__digit(0))==0?E.unaryMinus($):$;if(1<T.length)throw new RangeError("BigInt too big");let W=T.__unsignedDigit(0);if(W===1)return $;if(W>=E.__kMaxLengthBits)throw new RangeError("BigInt too big");if($.length===1&&$.__digit(0)===2){let w=1+(0|W/30),Y=$.sign&&(1&W)!=0,G=new E(w,Y);G.__initializeDigits();let H=1<<W%30;return G.__setDigit(w-1,H),G}let U=null,X=$;for((1&W)!=0&&(U=$),W>>=1;W!==0;W>>=1)X=E.multiply(X,X),(1&W)!=0&&(U===null?U=X:U=E.multiply(U,X));return U}static multiply($,T){if($.length===0)return $;if(T.length===0)return T;let W=$.length+T.length;30<=$.__clzmsd()+T.__clzmsd()&&W--;let U=new E(W,$.sign!==T.sign);U.__initializeDigits();for(let X=0;X<$.length;X++)E.__multiplyAccumulate(T,$.__digit(X),U,X);return U.__trim()}static divide($,T){if(T.length===0)throw new RangeError("Division by zero");if(0>E.__absoluteCompare($,T))return E.__zero();let W=$.sign!==T.sign,U=T.__unsignedDigit(0),X;if(T.length===1&&32767>=U){if(U===1)return W===$.sign?$:E.unaryMinus($);X=E.__absoluteDivSmall($,U,null)}else X=E.__absoluteDivLarge($,T,!0,!1);return X.sign=W,X.__trim()}static remainder($,T){if(T.length===0)throw new RangeError("Division by zero");if(0>E.__absoluteCompare($,T))return $;let W=T.__unsignedDigit(0);if(T.length===1&&32767>=W){if(W===1)return E.__zero();let X=E.__absoluteModSmall($,W);return X===0?E.__zero():E.__oneDigit(X,$.sign)}let U=E.__absoluteDivLarge($,T,!1,!0);return U.sign=$.sign,U.__trim()}static add($,T){let W=$.sign;return W===T.sign?E.__absoluteAdd($,T,W):0<=E.__absoluteCompare($,T)?E.__absoluteSub($,T,W):E.__absoluteSub(T,$,!W)}static subtract($,T){let W=$.sign;return W===T.sign?0<=E.__absoluteCompare($,T)?E.__absoluteSub($,T,W):E.__absoluteSub(T,$,!W):E.__absoluteAdd($,T,W)}static leftShift($,T){return T.length===0||$.length===0?$:T.sign?E.__rightShiftByAbsolute($,T):E.__leftShiftByAbsolute($,T)}static signedRightShift($,T){return T.length===0||$.length===0?$:T.sign?E.__leftShiftByAbsolute($,T):E.__rightShiftByAbsolute($,T)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan($,T){return 0>E.__compareToBigInt($,T)}static lessThanOrEqual($,T){return 0>=E.__compareToBigInt($,T)}static greaterThan($,T){return 0<E.__compareToBigInt($,T)}static greaterThanOrEqual($,T){return 0<=E.__compareToBigInt($,T)}static equal($,T){if($.sign!==T.sign)return!1;if($.length!==T.length)return!1;for(let W=0;W<$.length;W++)if($.__digit(W)!==T.__digit(W))return!1;return!0}static notEqual($,T){return!E.equal($,T)}static bitwiseAnd($,T){var W=Math.max;if(!$.sign&&!T.sign)return E.__absoluteAnd($,T).__trim();if($.sign&&T.sign){let U=W($.length,T.length)+1,X=E.__absoluteSubOne($,U),w=E.__absoluteSubOne(T);return X=E.__absoluteOr(X,w,X),E.__absoluteAddOne(X,!0,X).__trim()}return $.sign&&([$,T]=[T,$]),E.__absoluteAndNot($,E.__absoluteSubOne(T)).__trim()}static bitwiseXor($,T){var W=Math.max;if(!$.sign&&!T.sign)return E.__absoluteXor($,T).__trim();if($.sign&&T.sign){let w=W($.length,T.length),Y=E.__absoluteSubOne($,w),G=E.__absoluteSubOne(T);return E.__absoluteXor(Y,G,Y).__trim()}let U=W($.length,T.length)+1;$.sign&&([$,T]=[T,$]);let X=E.__absoluteSubOne(T,U);return X=E.__absoluteXor(X,$,X),E.__absoluteAddOne(X,!0,X).__trim()}static bitwiseOr($,T){var W=Math.max;let U=W($.length,T.length);if(!$.sign&&!T.sign)return E.__absoluteOr($,T).__trim();if($.sign&&T.sign){let w=E.__absoluteSubOne($,U),Y=E.__absoluteSubOne(T);return w=E.__absoluteAnd(w,Y,w),E.__absoluteAddOne(w,!0,w).__trim()}$.sign&&([$,T]=[T,$]);let X=E.__absoluteSubOne(T,U);return X=E.__absoluteAndNot(X,$,X),E.__absoluteAddOne(X,!0,X).__trim()}static asIntN($,T){var W=Math.floor;if(T.length===0)return T;if($=W($),0>$)throw new RangeError("Invalid value: not (convertible to) a safe integer");if($===0)return E.__zero();if($>=E.__kMaxLengthBits)return T;let U=0|($+29)/30;if(T.length<U)return T;let X=T.__unsignedDigit(U-1),w=1<<($-1)%30;if(T.length===U&&X<w)return T;if((X&w)!==w)return E.__truncateToNBits($,T);if(!T.sign)return E.__truncateAndSubFromPowerOfTwo($,T,!0);if((X&w-1)==0){for(let Y=U-2;0<=Y;Y--)if(T.__digit(Y)!==0)return E.__truncateAndSubFromPowerOfTwo($,T,!1);return T.length===U&&X===w?T:E.__truncateToNBits($,T)}return E.__truncateAndSubFromPowerOfTwo($,T,!1)}static asUintN($,T){var W=Math.floor;if(T.length===0)return T;if($=W($),0>$)throw new RangeError("Invalid value: not (convertible to) a safe integer");if($===0)return E.__zero();if(T.sign){if($>E.__kMaxLengthBits)throw new RangeError("BigInt too big");return E.__truncateAndSubFromPowerOfTwo($,T,!1)}if($>=E.__kMaxLengthBits)return T;let U=0|($+29)/30;if(T.length<U)return T;let X=$%30;if(T.length==U){if(X===0)return T;if(T.__digit(U-1)>>>X==0)return T}return E.__truncateToNBits($,T)}static ADD($,T){if($=E.__toPrimitive($),T=E.__toPrimitive(T),typeof $=="string")return typeof T!="string"&&(T=T.toString()),$+T;if(typeof T=="string")return $.toString()+T;if($=E.__toNumeric($),T=E.__toNumeric(T),E.__isBigInt($)&&E.__isBigInt(T))return E.add($,T);if(typeof $=="number"&&typeof T=="number")return $+T;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT($,T){return E.__compare($,T,0)}static LE($,T){return E.__compare($,T,1)}static GT($,T){return E.__compare($,T,2)}static GE($,T){return E.__compare($,T,3)}static EQ($,T){for(;;){if(E.__isBigInt($))return E.__isBigInt(T)?E.equal($,T):E.EQ(T,$);if(typeof $=="number"){if(E.__isBigInt(T))return E.__equalToNumber(T,$);if(typeof T!="object")return $==T;T=E.__toPrimitive(T)}else if(typeof $=="string"){if(E.__isBigInt(T))return $=E.__fromString($),$!==null&&E.equal($,T);if(typeof T!="object")return $==T;T=E.__toPrimitive(T)}else if(typeof $=="boolean"){if(E.__isBigInt(T))return E.__equalToNumber(T,+$);if(typeof T!="object")return $==T;T=E.__toPrimitive(T)}else if(typeof $=="symbol"){if(E.__isBigInt(T))return!1;if(typeof T!="object")return $==T;T=E.__toPrimitive(T)}else if(typeof $=="object"){if(typeof T=="object"&&T.constructor!==E)return $==T;$=E.__toPrimitive($)}else return $==T}}static NE($,T){return!E.EQ($,T)}static DataViewGetBigInt64($,T,W=!1){return E.asIntN(64,E.DataViewGetBigUint64($,T,W))}static DataViewGetBigUint64($,T,W=!1){let[U,X]=W?[4,0]:[0,4],w=$.getUint32(T+U,W),Y=$.getUint32(T+X,W),G=new E(3,!1);return G.__setDigit(0,1073741823&Y),G.__setDigit(1,(268435455&w)<<2|Y>>>30),G.__setDigit(2,w>>>28),G.__trim()}static DataViewSetBigInt64($,T,W,U=!1){E.DataViewSetBigUint64($,T,W,U)}static DataViewSetBigUint64($,T,W,U=!1){W=E.asUintN(64,W);let X=0,w=0;if(0<W.length&&(w=W.__digit(0),1<W.length)){let H=W.__digit(1);w|=H<<30,X=H>>>2,2<W.length&&(X|=W.__digit(2)<<28)}let[Y,G]=U?[4,0]:[0,4];$.setUint32(T+Y,X,U),$.setUint32(T+G,w,U)}static __zero(){return new E(0,!1)}static __oneDigit($,T){let W=new E(1,T);return W.__setDigit(0,$),W}__copy(){let $=new E(this.length,this.sign);for(let T=0;T<this.length;T++)$[T]=this[T];return $}__trim(){let $=this.length,T=this[$-1];for(;T===0;)$--,T=this[$-1],this.pop();return $===0&&(this.sign=!1),this}__initializeDigits(){for(let $=0;$<this.length;$++)this[$]=0}static __decideRounding($,T,W,U){if(0<T)return-1;let X;if(0>T)X=-T-1;else{if(W===0)return-1;W--,U=$.__digit(W),X=29}let w=1<<X;if((U&w)==0)return-1;if(w-=1,(U&w)!=0)return 1;for(;0<W;)if(W--,$.__digit(W)!==0)return 1;return 0}static __fromDouble($){E.__kBitConversionDouble[0]=$;let T=2047&E.__kBitConversionInts[E.__kBitConversionIntHigh]>>>20,W=T-1023,U=(0|W/30)+1,X=new E(U,0>$),w=1048575&E.__kBitConversionInts[E.__kBitConversionIntHigh]|1048576,Y=E.__kBitConversionInts[E.__kBitConversionIntLow],G=20,H=W%30,z,F=0;if(H<20){let O=G-H;F=O+32,z=w>>>O,w=w<<32-O|Y>>>O,Y<<=32-O}else if(H===20)F=32,z=w,w=Y,Y=0;else{let O=H-G;F=32-O,z=w<<O|Y>>>32-O,w=Y<<O,Y=0}X.__setDigit(U-1,z);for(let O=U-2;0<=O;O--)0<F?(F-=30,z=w>>>2,w=w<<30|Y>>>2,Y<<=30):z=0,X.__setDigit(O,z);return X.__trim()}static __isWhitespace($){return 13>=$&&9<=$||(159>=$?$==32:131071>=$?$==160||$==5760:196607>=$?($&=131071,10>=$||$==40||$==41||$==47||$==95||$==4096):$==65279)}static __fromString($,T=0){let W=0,U=$.length,X=0;if(X===U)return E.__zero();let w=$.charCodeAt(X);for(;E.__isWhitespace(w);){if(++X===U)return E.__zero();w=$.charCodeAt(X)}if(w===43){if(++X===U)return null;w=$.charCodeAt(X),W=1}else if(w===45){if(++X===U)return null;w=$.charCodeAt(X),W=-1}if(T===0){if(T=10,w===48){if(++X===U)return E.__zero();if(w=$.charCodeAt(X),w===88||w===120){if(T=16,++X===U)return null;w=$.charCodeAt(X)}else if(w===79||w===111){if(T=8,++X===U)return null;w=$.charCodeAt(X)}else if(w===66||w===98){if(T=2,++X===U)return null;w=$.charCodeAt(X)}}}else if(T===16&&w===48){if(++X===U)return E.__zero();if(w=$.charCodeAt(X),w===88||w===120){if(++X===U)return null;w=$.charCodeAt(X)}}if(W!=0&&T!==10)return null;for(;w===48;){if(++X===U)return E.__zero();w=$.charCodeAt(X)}let Y=U-X,G=E.__kMaxBitsPerChar[T],H=E.__kBitsPerCharTableMultiplier-1;if(Y>1073741824/G)return null;let z=G*Y+H>>>E.__kBitsPerCharTableShift,F=new E(0|(z+29)/30,!1),O=10>T?T:10,Q=10<T?T-10:0;if((T&T-1)==0){G>>=E.__kBitsPerCharTableShift;let Z=[],V=[],A=!1;do{let D=0,J=0;for(;;){let L;if(w-48>>>0<O)L=w-48;else if((32|w)-97>>>0<Q)L=(32|w)-87;else{A=!0;break}if(J+=G,D=D<<G|L,++X===U){A=!0;break}if(w=$.charCodeAt(X),30<J+G)break}Z.push(D),V.push(J)}while(!A);E.__fillFromParts(F,Z,V)}else{F.__initializeDigits();let Z=!1,V=0;do{let A=0,D=1;for(;;){let L;if(w-48>>>0<O)L=w-48;else if((32|w)-97>>>0<Q)L=(32|w)-87;else{Z=!0;break}let _=D*T;if(1073741823<_)break;if(D=_,A=A*T+L,V++,++X===U){Z=!0;break}w=$.charCodeAt(X)}H=30*E.__kBitsPerCharTableMultiplier-1;let J=0|(G*V+H>>>E.__kBitsPerCharTableShift)/30;F.__inplaceMultiplyAdd(D,A,J)}while(!Z)}if(X!==U){if(!E.__isWhitespace(w))return null;for(X++;X<U;X++)if(w=$.charCodeAt(X),!E.__isWhitespace(w))return null}return F.sign=W==-1,F.__trim()}static __fillFromParts($,T,W){let U=0,X=0,w=0;for(let Y=T.length-1;0<=Y;Y--){let G=T[Y],H=W[Y];X|=G<<w,w+=H,w===30?($.__setDigit(U++,X),w=0,X=0):30<w&&($.__setDigit(U++,1073741823&X),w-=30,X=G>>>H-w)}if(X!==0){if(U>=$.length)throw new Error("implementation bug");$.__setDigit(U++,X)}for(;U<$.length;U++)$.__setDigit(U,0)}static __toStringBasePowerOfTwo($,T){let W=$.length,U=T-1;U=(85&U>>>1)+(85&U),U=(51&U>>>2)+(51&U),U=(15&U>>>4)+(15&U);let X=U,w=T-1,Y=$.__digit(W-1),G=E.__clz30(Y),H=0|(30*W-G+X-1)/X;if($.sign&&H++,268435456<H)throw new Error("string too long");let z=Array(H),F=H-1,O=0,Q=0;for(let V=0;V<W-1;V++){let A=$.__digit(V),D=(O|A<<Q)&w;z[F--]=E.__kConversionChars[D];let J=X-Q;for(O=A>>>J,Q=30-J;Q>=X;)z[F--]=E.__kConversionChars[O&w],O>>>=X,Q-=X}let Z=(O|Y<<Q)&w;for(z[F--]=E.__kConversionChars[Z],O=Y>>>X-Q;O!==0;)z[F--]=E.__kConversionChars[O&w],O>>>=X;if($.sign&&(z[F--]="-"),F!=-1)throw new Error("implementation bug");return z.join("")}static __toStringGeneric($,T,W){let U=$.length;if(U===0)return"";if(U===1){let V=$.__unsignedDigit(0).toString(T);return W===!1&&$.sign&&(V="-"+V),V}let X=30*U-E.__clz30($.__digit(U-1)),w=E.__kMaxBitsPerChar[T],Y=w-1,G=X*E.__kBitsPerCharTableMultiplier;G+=Y-1,G=0|G/Y;let H=G+1>>1,z=E.exponentiate(E.__oneDigit(T,!1),E.__oneDigit(H,!1)),F,O,Q=z.__unsignedDigit(0);if(z.length===1&&32767>=Q){F=new E($.length,!1),F.__initializeDigits();let V=0;for(let A=2*$.length-1;0<=A;A--){let D=V<<15|$.__halfDigit(A);F.__setHalfDigit(A,0|D/Q),V=0|D%Q}O=V.toString(T)}else{let V=E.__absoluteDivLarge($,z,!0,!0);F=V.quotient;let A=V.remainder.__trim();O=E.__toStringGeneric(A,T,!0)}F.__trim();let Z=E.__toStringGeneric(F,T,!0);for(;O.length<H;)O="0"+O;return W===!1&&$.sign&&(Z="-"+Z),Z+O}static __unequalSign($){return $?-1:1}static __absoluteGreater($){return $?-1:1}static __absoluteLess($){return $?1:-1}static __compareToBigInt($,T){let W=$.sign;if(W!==T.sign)return E.__unequalSign(W);let U=E.__absoluteCompare($,T);return 0<U?E.__absoluteGreater(W):0>U?E.__absoluteLess(W):0}static __compareToNumber($,T){if(E.__isOneDigitInt(T)){let W=$.sign,U=0>T;if(W!==U)return E.__unequalSign(W);if($.length===0){if(U)throw new Error("implementation bug");return T===0?0:-1}if(1<$.length)return E.__absoluteGreater(W);let X=Math.abs(T),w=$.__unsignedDigit(0);return w>X?E.__absoluteGreater(W):w<X?E.__absoluteLess(W):0}return E.__compareToDouble($,T)}static __compareToDouble($,T){if(T!==T)return T;if(T===1/0)return-1;if(T===-1/0)return 1;let W=$.sign;if(W!==0>T)return E.__unequalSign(W);if(T===0)throw new Error("implementation bug: should be handled elsewhere");if($.length===0)return-1;E.__kBitConversionDouble[0]=T;let U=2047&E.__kBitConversionInts[E.__kBitConversionIntHigh]>>>20;if(U==2047)throw new Error("implementation bug: handled elsewhere");let X=U-1023;if(0>X)return E.__absoluteGreater(W);let w=$.length,Y=$.__digit(w-1),G=E.__clz30(Y),H=30*w-G,z=X+1;if(H<z)return E.__absoluteLess(W);if(H>z)return E.__absoluteGreater(W);let F=1048576|1048575&E.__kBitConversionInts[E.__kBitConversionIntHigh],O=E.__kBitConversionInts[E.__kBitConversionIntLow],Q=20,Z=29-G;if(Z!==(0|(H-1)%30))throw new Error("implementation bug");let V,A=0;if(20>Z){let D=Q-Z;A=D+32,V=F>>>D,F=F<<32-D|O>>>D,O<<=32-D}else if(Z===20)A=32,V=F,F=O,O=0;else{let D=Z-Q;A=32-D,V=F<<D|O>>>32-D,F=O<<D,O=0}if(Y>>>=0,V>>>=0,Y>V)return E.__absoluteGreater(W);if(Y<V)return E.__absoluteLess(W);for(let D=w-2;0<=D;D--){0<A?(A-=30,V=F>>>2,F=F<<30|O>>>2,O<<=30):V=0;let J=$.__unsignedDigit(D);if(J>V)return E.__absoluteGreater(W);if(J<V)return E.__absoluteLess(W)}if(F!==0||O!==0){if(A===0)throw new Error("implementation bug");return E.__absoluteLess(W)}return 0}static __equalToNumber($,T){var W=Math.abs;return E.__isOneDigitInt(T)?T===0?$.length===0:$.length===1&&$.sign===0>T&&$.__unsignedDigit(0)===W(T):E.__compareToDouble($,T)===0}static __comparisonResultToBool($,T){return T===0?0>$:T===1?0>=$:T===2?0<$:T===3?0<=$:void 0}static __compare($,T,W){if($=E.__toPrimitive($),T=E.__toPrimitive(T),typeof $=="string"&&typeof T=="string")switch(W){case 0:return $<T;case 1:return $<=T;case 2:return $>T;case 3:return $>=T}if(E.__isBigInt($)&&typeof T=="string")return T=E.__fromString(T),T!==null&&E.__comparisonResultToBool(E.__compareToBigInt($,T),W);if(typeof $=="string"&&E.__isBigInt(T))return $=E.__fromString($),$!==null&&E.__comparisonResultToBool(E.__compareToBigInt($,T),W);if($=E.__toNumeric($),T=E.__toNumeric(T),E.__isBigInt($)){if(E.__isBigInt(T))return E.__comparisonResultToBool(E.__compareToBigInt($,T),W);if(typeof T!="number")throw new Error("implementation bug");return E.__comparisonResultToBool(E.__compareToNumber($,T),W)}if(typeof $!="number")throw new Error("implementation bug");if(E.__isBigInt(T))return E.__comparisonResultToBool(E.__compareToNumber(T,$),2^W);if(typeof T!="number")throw new Error("implementation bug");return W===0?$<T:W===1?$<=T:W===2?$>T:W===3?$>=T:void 0}__clzmsd(){return E.__clz30(this.__digit(this.length-1))}static __absoluteAdd($,T,W){if($.length<T.length)return E.__absoluteAdd(T,$,W);if($.length===0)return $;if(T.length===0)return $.sign===W?$:E.unaryMinus($);let U=$.length;($.__clzmsd()===0||T.length===$.length&&T.__clzmsd()===0)&&U++;let X=new E(U,W),w=0,Y=0;for(;Y<T.length;Y++){let G=$.__digit(Y)+T.__digit(Y)+w;w=G>>>30,X.__setDigit(Y,1073741823&G)}for(;Y<$.length;Y++){let G=$.__digit(Y)+w;w=G>>>30,X.__setDigit(Y,1073741823&G)}return Y<X.length&&X.__setDigit(Y,w),X.__trim()}static __absoluteSub($,T,W){if($.length===0)return $;if(T.length===0)return $.sign===W?$:E.unaryMinus($);let U=new E($.length,W),X=0,w=0;for(;w<T.length;w++){let Y=$.__digit(w)-T.__digit(w)-X;X=1&Y>>>30,U.__setDigit(w,1073741823&Y)}for(;w<$.length;w++){let Y=$.__digit(w)-X;X=1&Y>>>30,U.__setDigit(w,1073741823&Y)}return U.__trim()}static __absoluteAddOne($,T,W=null){let U=$.length;W===null?W=new E(U,T):W.sign=T;let X=1;for(let w=0;w<U;w++){let Y=$.__digit(w)+X;X=Y>>>30,W.__setDigit(w,1073741823&Y)}return X!=0&&W.__setDigitGrow(U,1),W}static __absoluteSubOne($,T){let W=$.length;T=T||W;let U=new E(T,!1),X=1;for(let w=0;w<W;w++){let Y=$.__digit(w)-X;X=1&Y>>>30,U.__setDigit(w,1073741823&Y)}if(X!=0)throw new Error("implementation bug");for(let w=W;w<T;w++)U.__setDigit(w,0);return U}static __absoluteAnd($,T,W=null){let U=$.length,X=T.length,w=X;if(U<X){w=U;let H=$,z=U;$=T,U=X,T=H,X=z}let Y=w;W===null?W=new E(Y,!1):Y=W.length;let G=0;for(;G<w;G++)W.__setDigit(G,$.__digit(G)&T.__digit(G));for(;G<Y;G++)W.__setDigit(G,0);return W}static __absoluteAndNot($,T,W=null){let U=$.length,X=T.length,w=X;U<X&&(w=U);let Y=U;W===null?W=new E(Y,!1):Y=W.length;let G=0;for(;G<w;G++)W.__setDigit(G,$.__digit(G)&~T.__digit(G));for(;G<U;G++)W.__setDigit(G,$.__digit(G));for(;G<Y;G++)W.__setDigit(G,0);return W}static __absoluteOr($,T,W=null){let U=$.length,X=T.length,w=X;if(U<X){w=U;let H=$,z=U;$=T,U=X,T=H,X=z}let Y=U;W===null?W=new E(Y,!1):Y=W.length;let G=0;for(;G<w;G++)W.__setDigit(G,$.__digit(G)|T.__digit(G));for(;G<U;G++)W.__setDigit(G,$.__digit(G));for(;G<Y;G++)W.__setDigit(G,0);return W}static __absoluteXor($,T,W=null){let U=$.length,X=T.length,w=X;if(U<X){w=U;let H=$,z=U;$=T,U=X,T=H,X=z}let Y=U;W===null?W=new E(Y,!1):Y=W.length;let G=0;for(;G<w;G++)W.__setDigit(G,$.__digit(G)^T.__digit(G));for(;G<U;G++)W.__setDigit(G,$.__digit(G));for(;G<Y;G++)W.__setDigit(G,0);return W}static __absoluteCompare($,T){let W=$.length-T.length;if(W!=0)return W;let U=$.length-1;for(;0<=U&&$.__digit(U)===T.__digit(U);)U--;return 0>U?0:$.__unsignedDigit(U)>T.__unsignedDigit(U)?1:-1}static __multiplyAccumulate($,T,W,U){if(T===0)return;let X=32767&T,w=T>>>15,Y=0,G=0;for(let H,z=0;z<$.length;z++,U++){H=W.__digit(U);let F=$.__digit(z),O=32767&F,Q=F>>>15,Z=E.__imul(O,X),V=E.__imul(O,w),A=E.__imul(Q,X),D=E.__imul(Q,w);H+=G+Z+Y,Y=H>>>30,H&=1073741823,H+=((32767&V)<<15)+((32767&A)<<15),Y+=H>>>30,G=D+(V>>>15)+(A>>>15),W.__setDigit(U,1073741823&H)}for(;Y!=0||G!==0;U++){let H=W.__digit(U);H+=Y+G,G=0,Y=H>>>30,W.__setDigit(U,1073741823&H)}}static __internalMultiplyAdd($,T,W,U,X){let w=W,Y=0;for(let G=0;G<U;G++){let H=$.__digit(G),z=E.__imul(32767&H,T),F=E.__imul(H>>>15,T),O=z+((32767&F)<<15)+Y+w;w=O>>>30,Y=F>>>15,X.__setDigit(G,1073741823&O)}if(X.length>U)for(X.__setDigit(U++,w+Y);U<X.length;)X.__setDigit(U++,0);else if(w+Y!==0)throw new Error("implementation bug")}__inplaceMultiplyAdd($,T,W){W>this.length&&(W=this.length);let U=32767&$,X=$>>>15,w=0,Y=T;for(let G=0;G<W;G++){let H=this.__digit(G),z=32767&H,F=H>>>15,O=E.__imul(z,U),Q=E.__imul(z,X),Z=E.__imul(F,U),V=E.__imul(F,X),A=Y+O+w;w=A>>>30,A&=1073741823,A+=((32767&Q)<<15)+((32767&Z)<<15),w+=A>>>30,Y=V+(Q>>>15)+(Z>>>15),this.__setDigit(G,1073741823&A)}if(w!=0||Y!==0)throw new Error("implementation bug")}static __absoluteDivSmall($,T,W=null){W===null&&(W=new E($.length,!1));let U=0;for(let X,w=2*$.length-1;0<=w;w-=2){X=(U<<15|$.__halfDigit(w))>>>0;let Y=0|X/T;U=0|X%T,X=(U<<15|$.__halfDigit(w-1))>>>0;let G=0|X/T;U=0|X%T,W.__setDigit(w>>>1,Y<<15|G)}return W}static __absoluteModSmall($,T){let W=0;for(let U=2*$.length-1;0<=U;U--)W=0|((W<<15|$.__halfDigit(U))>>>0)%T;return W}static __absoluteDivLarge($,T,W,U){let X=T.__halfDigitLength(),w=T.length,Y=$.__halfDigitLength()-X,G=null;W&&(G=new E(Y+2>>>1,!1),G.__initializeDigits());let H=new E(X+2>>>1,!1);H.__initializeDigits();let z=E.__clz15(T.__halfDigit(X-1));0<z&&(T=E.__specialLeftShift(T,z,0));let F=E.__specialLeftShift($,z,1),O=T.__halfDigit(X-1),Q=0;for(let Z,V=Y;0<=V;V--){Z=32767;let A=F.__halfDigit(V+X);if(A!==O){let J=(A<<15|F.__halfDigit(V+X-1))>>>0;Z=0|J/O;let L=0|J%O,_=T.__halfDigit(X-2),C=F.__halfDigit(V+X-2);for(;E.__imul(Z,_)>>>0>(L<<16|C)>>>0&&(Z--,L+=O,!(32767<L)););}E.__internalMultiplyAdd(T,Z,0,w,H);let D=F.__inplaceSub(H,V,X+1);D!==0&&(D=F.__inplaceAdd(T,V,X),F.__setHalfDigit(V+X,32767&F.__halfDigit(V+X)+D),Z--),W&&(1&V?Q=Z<<15:G.__setDigit(V>>>1,Q|Z))}if(U)return F.__inplaceRightShift(z),W?{quotient:G,remainder:F}:F;if(W)return G;throw new Error("unreachable")}static __clz15($){return E.__clz30($)-15}__inplaceAdd($,T,W){let U=0;for(let X=0;X<W;X++){let w=this.__halfDigit(T+X)+$.__halfDigit(X)+U;U=w>>>15,this.__setHalfDigit(T+X,32767&w)}return U}__inplaceSub($,T,W){let U=0;if(1&T){T>>=1;let X=this.__digit(T),w=32767&X,Y=0;for(;Y<W-1>>>1;Y++){let z=$.__digit(Y),F=(X>>>15)-(32767&z)-U;U=1&F>>>15,this.__setDigit(T+Y,(32767&F)<<15|32767&w),X=this.__digit(T+Y+1),w=(32767&X)-(z>>>15)-U,U=1&w>>>15}let G=$.__digit(Y),H=(X>>>15)-(32767&G)-U;if(U=1&H>>>15,this.__setDigit(T+Y,(32767&H)<<15|32767&w),T+Y+1>=this.length)throw new RangeError("out of bounds");(1&W)==0&&(X=this.__digit(T+Y+1),w=(32767&X)-(G>>>15)-U,U=1&w>>>15,this.__setDigit(T+$.length,1073709056&X|32767&w))}else{T>>=1;let X=0;for(;X<$.length-1;X++){let z=this.__digit(T+X),F=$.__digit(X),O=(32767&z)-(32767&F)-U;U=1&O>>>15;let Q=(z>>>15)-(F>>>15)-U;U=1&Q>>>15,this.__setDigit(T+X,(32767&Q)<<15|32767&O)}let w=this.__digit(T+X),Y=$.__digit(X),G=(32767&w)-(32767&Y)-U;U=1&G>>>15;let H=0;(1&W)==0&&(H=(w>>>15)-(Y>>>15)-U,U=1&H>>>15),this.__setDigit(T+X,(32767&H)<<15|32767&G)}return U}__inplaceRightShift($){if($===0)return;let T=this.__digit(0)>>>$,W=this.length-1;for(let U=0;U<W;U++){let X=this.__digit(U+1);this.__setDigit(U,1073741823&X<<30-$|T),T=X>>>$}this.__setDigit(W,T)}static __specialLeftShift($,T,W){let U=$.length,X=new E(U+W,!1);if(T===0){for(let Y=0;Y<U;Y++)X.__setDigit(Y,$.__digit(Y));return 0<W&&X.__setDigit(U,0),X}let w=0;for(let Y=0;Y<U;Y++){let G=$.__digit(Y);X.__setDigit(Y,1073741823&G<<T|w),w=G>>>30-T}return 0<W&&X.__setDigit(U,w),X}static __leftShiftByAbsolute($,T){let W=E.__toShiftAmount(T);if(0>W)throw new RangeError("BigInt too big");let U=0|W/30,X=W%30,w=$.length,Y=X!==0&&$.__digit(w-1)>>>30-X!=0,G=w+U+(Y?1:0),H=new E(G,$.sign);if(X===0){let z=0;for(;z<U;z++)H.__setDigit(z,0);for(;z<G;z++)H.__setDigit(z,$.__digit(z-U))}else{let z=0;for(let F=0;F<U;F++)H.__setDigit(F,0);for(let F=0;F<w;F++){let O=$.__digit(F);H.__setDigit(F+U,1073741823&O<<X|z),z=O>>>30-X}if(Y)H.__setDigit(w+U,z);else if(z!==0)throw new Error("implementation bug")}return H.__trim()}static __rightShiftByAbsolute($,T){let{length:W,sign:U}=$,X=E.__toShiftAmount(T);if(0>X)return E.__rightShiftByMaximum(U);let w=0|X/30,Y=X%30,G=W-w;if(0>=G)return E.__rightShiftByMaximum(U);let H=!1;if(U){if(($.__digit(w)&(1<<Y)-1)!=0)H=!0;else for(let F=0;F<w;F++)if($.__digit(F)!==0){H=!0;break}}if(H&&Y===0)~$.__digit(W-1)==0&&G++;let z=new E(G,U);if(Y===0){z.__setDigit(G-1,0);for(let F=w;F<W;F++)z.__setDigit(F-w,$.__digit(F))}else{let F=$.__digit(w)>>>Y,O=W-w-1;for(let Q=0;Q<O;Q++){let Z=$.__digit(Q+w+1);z.__setDigit(Q,1073741823&Z<<30-Y|F),F=Z>>>Y}z.__setDigit(O,F)}return H&&(z=E.__absoluteAddOne(z,!0,z)),z.__trim()}static __rightShiftByMaximum($){return $?E.__oneDigit(1,!0):E.__zero()}static __toShiftAmount($){if(1<$.length)return-1;let T=$.__unsignedDigit(0);return T>E.__kMaxLengthBits?-1:T}static __toPrimitive($,T="default"){if(typeof $!="object")return $;if($.constructor===E)return $;if(typeof Symbol!="undefined"&&typeof Symbol.toPrimitive=="symbol"&&$[Symbol.toPrimitive]){let X=$[Symbol.toPrimitive](T);if(typeof X!="object")return X;throw new TypeError("Cannot convert object to primitive value")}let W=$.valueOf;if(W){let X=W.call($);if(typeof X!="object")return X}let U=$.toString;if(U){let X=U.call($);if(typeof X!="object")return X}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric($){return E.__isBigInt($)?$:+$}static __isBigInt($){return typeof $=="object"&&$!==null&&$.constructor===E}static __truncateToNBits($,T){let W=0|($+29)/30,U=new E(W,T.sign),X=W-1;for(let Y=0;Y<X;Y++)U.__setDigit(Y,T.__digit(Y));let w=T.__digit(X);if($%30!=0){let Y=32-$%30;w=w<<Y>>>Y}return U.__setDigit(X,w),U.__trim()}static __truncateAndSubFromPowerOfTwo($,T,W){var U=Math.min;let X=0|($+29)/30,w=new E(X,W),Y=0,G=X-1,H=0;for(let Q=U(G,T.length);Y<Q;Y++){let Z=0-T.__digit(Y)-H;H=1&Z>>>30,w.__setDigit(Y,1073741823&Z)}for(;Y<G;Y++)w.__setDigit(Y,0|1073741823&-H);let z=G<T.length?T.__digit(G):0,F=$%30,O;if(F==0)O=0-z-H,O&=1073741823;else{let Q=32-F;z=z<<Q>>>Q;let Z=1<<32-Q;O=Z-z-H,O&=Z-1}return w.__setDigit(G,O),w.__trim()}__digit($){return this[$]}__unsignedDigit($){return this[$]>>>0}__setDigit($,T){this[$]=0|T}__setDigitGrow($,T){this[$]=0|T}__halfDigitLength(){let $=this.length;return 32767>=this.__unsignedDigit($-1)?2*$-1:2*$}__halfDigit($){return 32767&this[$>>>1]>>>15*(1&$)}__setHalfDigit($,T){let W=$>>>1,U=this.__digit(W),X=1&$?32767&U|T<<15:1073709056&U|32767&T;this.__setDigit(W,X)}static __digitPow($,T){let W=1;for(;0<T;)1&T&&(W*=$),T>>>=1,$*=$;return W}static __detectBigEndian(){return E.__kBitConversionDouble[0]=-0,E.__kBitConversionInts[0]!==0}static __isOneDigitInt($){return(1073741823&$)===$}}E.__kMaxLength=33554432,E.__kMaxLengthBits=E.__kMaxLength<<5,E.__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],E.__kBitsPerCharTableShift=5,E.__kBitsPerCharTableMultiplier=1<<E.__kBitsPerCharTableShift,E.__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"],E.__kBitConversionBuffer=new ArrayBuffer(8),E.__kBitConversionDouble=new Float64Array(E.__kBitConversionBuffer),E.__kBitConversionInts=new Int32Array(E.__kBitConversionBuffer),E.__kBitConversionIntHigh=E.__detectBigEndian()?0:1,E.__kBitConversionIntLow=E.__detectBigEndian()?1:0,E.__clz30=Math.clz32?function($){return Math.clz32($)-2}:function($){return $===0?30:0|29-(0|Math.log($>>>0)/Math.LN2)},E.__imul=Math.imul||function($,T){return 0|$*T};var q=E;var Y1=q.BigInt(0),vU=q.BigInt(1),PO=q.BigInt(2),sj=q.BigInt(10),ej=q.BigInt(24),$B=q.BigInt(60),TB=q.BigInt(1000),fU=q.BigInt(1e6),NU=q.BigInt(1e9),VM=q.multiply(q.BigInt(3600),NU),WB=q.multiply($B,NU),DT=q.multiply(VM,ej);function k0($){return typeof $=="bigint"?q.BigInt($.toString(10)):$}function KM($){return q.equal(q.remainder($,PO),Y1)}function OW($){return q.lessThan($,Y1)?q.unaryMinus($):$}function bG($,T){return q.lessThan($,T)?-1:q.greaterThan($,T)?1:0}function QU($,T){return{quotient:q.divide($,T),remainder:q.remainder($,T)}}var xE,fE,Z$="slot-epochNanoSeconds",V$="slot-iso-date",X4="slot-iso-date-time",O4="slot-time",u="slot-calendar",AM="slot-date-brand",EM="slot-year-month-brand",MM="slot-month-day-brand",y$="slot-time-zone",V6="slot-years",K6="slot-months",b6="slot-weeks",A6="slot-days",E6="slot-hours",M6="slot-minutes",D6="slot-seconds",N6="slot-milliseconds",J6="slot-microseconds",y6="slot-nanoseconds",DM="date",NM="ym",JM="md",LM="time",RM="datetime",_M="instant",JW="original",v2="timezone-canonical",GO="timezone-original",ZU="calendar-id",kM="locale",zO="options",vM=new WeakMap,HO=Symbol.for("@@Temporal__GetSlots");(xE=globalThis)[HO]||(xE[HO]=function($){return vM.get($)});var nG=globalThis[HO],FO=Symbol.for("@@Temporal__CreateSlots");(fE=globalThis)[FO]||(fE[FO]=function($){vM.set($,Object.create(null))});var f0=globalThis[FO];function v6($,...T){if(!$||typeof $!="object")return!1;let W=nG($);return!!W&&T.every((U)=>(U in W))}function K($,T){let W=nG($)?.[T];if(W===void 0)throw new TypeError(`Missing internal slot ${T}`);return W}function _$($,T,W){let U=nG($);if(U===void 0)throw new TypeError("Missing slots for the given container");if(U[T])throw new TypeError(`${T} already has set`);U[T]=W}var OO={};function b0($,T){Object.defineProperty($.prototype,Symbol.toStringTag,{value:T,writable:!1,enumerable:!1,configurable:!0});let W=Object.getOwnPropertyNames($);for(let X=0;X<W.length;X++){let w=W[X],Y=Object.getOwnPropertyDescriptor($,w);Y.configurable&&Y.enumerable&&(Y.enumerable=!1,Object.defineProperty($,w,Y))}let U=Object.getOwnPropertyNames($.prototype);for(let X=0;X<U.length;X++){let w=U[X],Y=Object.getOwnPropertyDescriptor($.prototype,w);Y.configurable&&Y.enumerable&&(Y.enumerable=!1,Object.defineProperty($.prototype,w,Y))}QO(T,$),QO(`${T}.prototype`,$.prototype)}function QO($,T){let W=`%${$}%`;if(OO[W]!==void 0)throw new Error(`intrinsic ${$} already exists`);OO[W]=T}function i4($){return OO[$]}function q2($,T){let W=$;if(W===0)return{div:W,mod:W};let U=Math.sign(W);W=Math.abs(W);let X=Math.trunc(1+Math.log10(W));if(T>=X)return{div:0*U,mod:U*W};if(T===0)return{div:U*W,mod:0*U};let w=W.toPrecision(X);return{div:U*Number.parseInt(w.slice(0,X-T),10),mod:U*Number.parseInt(w.slice(X-T),10)}}function WO($,T,W){let U=$,X=W;if(U===0)return X;let w=Math.sign(U)||Math.sign(X);U=Math.abs(U),X=Math.abs(X);let Y=U.toPrecision(Math.trunc(1+Math.log10(U)));if(X===0)return w*Number.parseInt(Y+"0".repeat(T),10);let G=Y+X.toPrecision(Math.trunc(1+Math.log10(X))).padStart(T,"0");return w*Number.parseInt(G,10)}function iG($,T){let W=T==="negative";switch($){case"ceil":return W?"zero":"infinity";case"floor":return W?"infinity":"zero";case"expand":return"infinity";case"trunc":return"zero";case"halfCeil":return W?"half-zero":"half-infinity";case"halfFloor":return W?"half-infinity":"half-zero";case"halfExpand":return"half-infinity";case"halfTrunc":return"half-zero";case"halfEven":return"half-even"}}function tG($,T,W,U,X){return X==="zero"?$:X==="infinity"?T:W<0?$:W>0?T:X==="half-zero"?$:X==="half-infinity"?T:U?$:T}class P${constructor($){this.totalNs=k0($),this.sec=q.toNumber(q.divide(this.totalNs,NU)),this.subsec=q.toNumber(q.remainder(this.totalNs,NU))}static validateNew($,T){if(q.greaterThan(OW($),P$.MAX))throw new RangeError(`${T} of duration time units cannot exceed ${P$.MAX} s`);return new P$($)}static fromEpochNsDiff($,T){let W=q.subtract(k0($),k0(T));return new P$(W)}static fromComponents($,T,W,U,X,w){let Y=q.add(q.add(q.add(q.add(q.add(q.BigInt(w),q.multiply(q.BigInt(X),TB)),q.multiply(q.BigInt(U),fU)),q.multiply(q.BigInt(W),NU)),q.multiply(q.BigInt(T),WB)),q.multiply(q.BigInt($),VM));return P$.validateNew(Y,"total")}abs(){return new P$(OW(this.totalNs))}add($){return P$.validateNew(q.add(this.totalNs,$.totalNs),"sum")}add24HourDays($){return P$.validateNew(q.add(this.totalNs,q.multiply(q.BigInt($),DT)),"sum")}addToEpochNs($){return q.add(k0($),this.totalNs)}cmp($){return bG(this.totalNs,$.totalNs)}divmod($){let{quotient:T,remainder:W}=QU(this.totalNs,q.BigInt($));return{quotient:q.toNumber(T),remainder:new P$(W)}}fdiv($){let T=k0($),W=q.BigInt(T),{quotient:U,remainder:X}=QU(this.totalNs,W),w=[],Y,G=(q.lessThan(this.totalNs,Y1)?-1:1)*Math.sign(q.toNumber(T));for(;!q.equal(X,Y1)&&w.length<50;)X=q.multiply(X,sj),{quotient:Y,remainder:X}=QU(X,W),w.push(Math.abs(q.toNumber(Y)));return G*Number(OW(U).toString()+"."+w.join(""))}isZero(){return q.equal(this.totalNs,Y1)}round($,T){let W=k0($);if(q.equal(W,vU))return this;let{quotient:U,remainder:X}=QU(this.totalNs,W),w=q.lessThan(this.totalNs,Y1)?"negative":"positive",Y=q.multiply(OW(U),W),G=q.add(Y,W),H=bG(OW(q.multiply(X,PO)),W),z=iG(T,w),F=q.equal(OW(this.totalNs),Y)?Y:tG(Y,G,H,KM(U),z),O=w==="positive"?F:q.unaryMinus(F);return P$.validateNew(O,"rounding")}sign(){return this.cmp(new P$(Y1))}subtract($){return P$.validateNew(q.subtract(this.totalNs,$.totalNs),"difference")}}P$.MAX=q.BigInt("9007199254740991999999999"),P$.ZERO=new P$(Y1);var bE=/[A-Za-z._][A-Za-z._0-9+-]*/,bU=new RegExp(`(?:${/(?:[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)/.source}|(?:${bE.source})(?:\\/(?:${bE.source}))*)`),PM=/(?:[+-]\d{6}|\d{4})/,yG=/(?:0[1-9]|1[0-2])/,ZO=/(?:0[1-9]|[12]\d|3[01])/,XB=new RegExp(`(${PM.source})(?:-(${yG.source})-(${ZO.source})|(${yG.source})(${ZO.source}))`),qM=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,CM=/((?:[+-])(?:[01][0-9]|2[0-3])(?::?(?:[0-5][0-9])(?::?(?:[0-5][0-9])(?:[.,](?:\d{1,9}))?)?)?)/,SM=new RegExp(`([zZ])|${CM.source}?`),B2=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,UB=new RegExp([`^${XB.source}`,`(?:(?:[tT]|\\s+)${qM.source}(?:${SM.source})?)?`,`(?:\\[!?(${bU.source})\\])?`,`((?:${B2.source})*)$`].join("")),wB=new RegExp([`^[tT]?${qM.source}`,`(?:${SM.source})?`,`(?:\\[!?${bU.source}\\])?`,`((?:${B2.source})*)$`].join("")),YB=new RegExp(`^(${PM.source})-?(${yG.source})(?:\\[!?${bU.source}\\])?((?:${B2.source})*)$`),GB=new RegExp(`^(?:--)?(${yG.source})-?(${ZO.source})(?:\\[!?${bU.source}\\])?((?:${B2.source})*)$`),XO=/(\d+)(?:[.,](\d{1,9}))?/,zB=new RegExp(`(?:${XO.source}H)?(?:${XO.source}M)?(?:${XO.source}S)?`),HB=new RegExp(`^([+-])?P${/(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/.source}(?:T(?!$)${zB.source})?$`,"i"),NT=86400000,hG=1e6*NT,FB=60000000000,jM=1e8*NT,I2=x1(jM),PU=q.unaryMinus(I2),OB=q.add(q.subtract(PU,DT),vU),QB=q.subtract(q.add(I2,DT),vU),ZB=146097*NT,yE=-271821,hE=275760,JU=Date.UTC(1847,0,1),VB=["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"],KB=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 Q4($){return typeof $=="object"&&$!==null||typeof $=="function"}function aG($){if(typeof $=="bigint")throw new TypeError("Cannot convert BigInt to number");return Number($)}function sG($){if(typeof $=="symbol")throw new TypeError("Cannot convert a Symbol value to a String");return String($)}function A$($){let T=aG($);if(T===0)return 0;if(Number.isNaN(T)||T===1/0||T===-1/0)throw new RangeError("invalid number value");let W=Math.trunc(T);return W===0?0:W}function gE($,T){let W=A$($);if(W<=0){if(T!==void 0)throw new RangeError(`property '${T}' cannot be a a number less than one`);throw new RangeError("Cannot convert a number less than one to a positive integer")}return W}function B1($){let T=aG($);if(Number.isNaN(T))throw new RangeError("not a number");if(T===1/0||T===-1/0)throw new RangeError("infinity is out of range");if(!function(W){if(typeof W!="number"||Number.isNaN(W)||W===1/0||W===-1/0)return!1;let U=Math.abs(W);return Math.floor(U)===U}(T))throw new RangeError(`unsupported fractional value ${$}`);return T===0?0:T}function qU($,T){return String($).padStart(T,"0")}function B4($){if(typeof $!="string")throw new TypeError(`expected a string, not ${String($)}`);return $}function VO($,T){if(Q4($)){let W=$?.toString();if(typeof W=="string"||typeof W=="number")return W;throw new TypeError("Cannot convert object to primitive value")}return $}var KO=["era","eraYear","year","month","monthCode","day","hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],AB={era:sG,eraYear:A$,year:A$,month:gE,monthCode:function($){let T=B4(VO($));if(T.length<3||T.length>4||T[0]!=="M"||"0123456789".indexOf(T[1])===-1||"0123456789".indexOf(T[2])===-1||T[1]+T[2]==="00"&&T[3]!=="L"||T[3]!=="L"&&T[3]!==void 0)throw new RangeError(`bad month code ${T}; must match M01-M99 or M00L-M99L`);return T},day:gE,hour:A$,minute:A$,second:A$,millisecond:A$,microsecond:A$,nanosecond:A$,offset:function($){let T=B4(VO($));return d2(T),T},timeZone:_6},EB={hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},x2=[["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"]],mE=Object.fromEntries(x2.map(($)=>[$[0],$[1]])),MB=Object.fromEntries(x2.map(([$,T])=>[T,$])),LU=x2.map(([,$])=>$),f2={day:hG,hour:3600000000000,minute:60000000000,second:1e9,millisecond:1e6,microsecond:1000,nanosecond:1},gG=["days","hours","microseconds","milliseconds","minutes","months","nanoseconds","seconds","weeks","years"],DB=Intl.DateTimeFormat,cE=new Map;function BM($){let T=IU($),W=cE.get(T);return W===void 0&&(W=new DB("en-us",{timeZone:T,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),cE.set(T,W)),W}function l4($){return v6($,Z$)&&!v6($,y$,u)}function H4($){return v6($,V6,K6,A6,E6,M6,D6,N6,J6,y6)}function F4($){return v6($,AM)}function A4($){return v6($,O4)}function i$($){return v6($,X4)}function r4($){return v6($,EM)}function w1($){return v6($,MM)}function v$($){return v6($,Z$,y$,u)}function S($,T){if(!T($))throw new TypeError("invalid receiver: method called with the wrong type of this-object")}function c2($){if(v6($,u)||v6($,y$))throw new TypeError("with() does not support a calendar or timeZone property");if(A4($))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 yU($,T){return T==="never"||T==="auto"&&$==="iso8601"?"":`[${T==="critical"?"!":""}u-ca=${$}]`}function eG($){let T,W,U=!1;for(B2.lastIndex=0;W=B2.exec($);){let{1:X,2:w,3:Y}=W;if(w==="u-ca"){if(T===void 0)T=Y,U=X==="!";else if(X==="!"||U)throw new RangeError(`Invalid annotations in ${$}: more than one u-ca present with critical flag`)}else if(X==="!")throw new RangeError(`Unrecognized annotation: !${w}=${Y}`)}return T}function w0($){let T=UB.exec($);if(!T)throw new RangeError(`invalid RFC 9557 string: ${$}`);let W=eG(T[16]),U=T[1];if(U==="-000000")throw new RangeError(`invalid RFC 9557 string: ${$}`);let X=+U,w=+(T[2]??T[4]??1),Y=+(T[3]??T[5]??1),G=T[6]!==void 0,H=+(T[6]??0),z=+(T[7]??T[10]??0),F=+(T[8]??T[11]??0);F===60&&(F=59);let O=(T[9]??T[12]??"")+"000000000",Q=+O.slice(0,3),Z=+O.slice(3,6),V=+O.slice(6,9),A,D=!1;T[13]?(A=void 0,D=!0):T[14]&&(A=T[14]);let J=T[15];return IO(X,w,Y,H,z,F,Q,Z,V),{year:X,month:w,day:Y,time:G?{hour:H,minute:z,second:F,millisecond:Q,microsecond:Z,nanosecond:V}:"start-of-day",tzAnnotation:J,offset:A,z:D,calendar:W}}function IM($){let T=wB.exec($),W,U,X,w,Y,G,H;if(T){H=eG(T[10]),W=+(T[1]??0),U=+(T[2]??T[5]??0),X=+(T[3]??T[6]??0),X===60&&(X=59);let z=(T[4]??T[7]??"")+"000000000";if(w=+z.slice(0,3),Y=+z.slice(3,6),G=+z.slice(6,9),T[8])throw new RangeError("Z designator not supported for PlainTime")}else{let z,F;if({time:z,z:F,calendar:H}=w0($),z==="start-of-day")throw new RangeError(`time is missing in string: ${$}`);if(F)throw new RangeError("Z designator not supported for PlainTime");({hour:W,minute:U,second:X,millisecond:w,microsecond:Y,nanosecond:G}=z)}if(Xz(W,U,X,w,Y,G),/[tT ][0-9][0-9]/.test($))return{hour:W,minute:U,second:X,millisecond:w,microsecond:Y,nanosecond:G,calendar:H};try{let{month:z,day:F}=CO($);AW(1972,z,F)}catch{try{let{year:z,month:F}=qO($);AW(z,F,1)}catch{return{hour:W,minute:U,second:X,millisecond:w,microsecond:Y,nanosecond:G,calendar:H}}}throw new RangeError(`invalid RFC 9557 time-only string ${$}; may need a T prefix`)}function qO($){let T=YB.exec($),W,U,X,w;if(T){X=eG(T[3]);let Y=T[1];if(Y==="-000000")throw new RangeError(`invalid RFC 9557 string: ${$}`);if(W=+Y,U=+T[2],w=1,X!==void 0&&X!=="iso8601")throw new RangeError("YYYY-MM format is only valid with iso8601 calendar")}else{let Y;if({year:W,month:U,calendar:X,day:w,z:Y}=w0($),Y)throw new RangeError("Z designator not supported for PlainYearMonth")}return{year:W,month:U,calendar:X,referenceISODay:w}}function CO($){let T=GB.exec($),W,U,X,w;if(T){if(X=eG(T[3]),W=+T[1],U=+T[2],X!==void 0&&X!=="iso8601")throw new RangeError("MM-DD format is only valid with iso8601 calendar")}else{let Y;if({month:W,day:U,calendar:X,year:w,z:Y}=w0($),Y)throw new RangeError("Z designator not supported for PlainMonthDay")}return{month:W,day:U,calendar:X,referenceISOYear:w}}var xM=new RegExp(`^${bU.source}$`,"i"),fM=new RegExp(`^${/([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])?)?/.source}$`);function bM($){let T=JB.test($)?"Seconds not allowed in offset time zone":"Invalid time zone";throw new RangeError(`${T}: ${$}`)}function MT($){return xM.test($)||bM($),fM.test($)?{offsetMinutes:d2($)/60000000000}:{tzName:$}}function RU($,T,W,U){let X=$,w=T,Y=W;switch(U){case"reject":AW(X,w,Y);break;case"constrain":({year:X,month:w,day:Y}=eM(X,w,Y))}return{year:X,month:w,day:Y}}function $z($,T,W,U,X,w,Y){let G=$,H=T,z=W,F=U,O=X,Q=w;switch(Y){case"reject":Xz(G,H,z,F,O,Q);break;case"constrain":G=L6(G,0,23),H=L6(H,0,59),z=L6(z,0,59),F=L6(F,0,999),O=L6(O,0,999),Q=L6(Q,0,999)}return{hour:G,minute:H,second:z,millisecond:F,microsecond:O,nanosecond:Q}}function yM($){if(!Q4($))throw new TypeError("invalid duration-like");let T={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},W=!1;for(let U=0;U<gG.length;U++){let X=gG[U],w=$[X];w!==void 0&&(W=!0,T[X]=B1(w))}if(!W)throw new TypeError("invalid duration-like");return T}function T6({years:$,months:T,weeks:W,days:U},X,w,Y){return{years:$,months:Y??T,weeks:w??W,days:X??U}}function x$($,T){return{isoDate:$,time:T}}function j$($){return B0($,"overflow",["constrain","reject"],"constrain")}function _U($){return B0($,"disambiguation",["compatible","earlier","later","reject"],"compatible")}function f1($,T){return B0($,"roundingMode",["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"],T)}function fG($,T){return B0($,"offset",["prefer","use","ignore","reject"],T)}function hU($){return B0($,"calendarName",["auto","always","never","critical"],"auto")}function u2($){let T=$.roundingIncrement;if(T===void 0)return 1;let W=A$(T);if(W<1||W>1e9)throw new RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${T}`);return W}function p2($,T,W){let U=W?T:T-1;if($>U)throw new RangeError(`roundingIncrement must be at least 1 and less than ${U}, not ${$}`);if(T%$!=0)throw new RangeError(`Rounding increment must divide evenly into ${T}`)}function gU($){let T=$.fractionalSecondDigits;if(T===void 0)return"auto";if(typeof T!="number"){if(sG(T)!=="auto")throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${T}`);return"auto"}let W=Math.floor(T);if(!Number.isFinite(W)||W<0||W>9)throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${T}`);return W}function mU($,T){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(T){case"auto":return{precision:T,unit:"nanosecond",increment:1};case 0:return{precision:T,unit:"second",increment:1};case 1:case 2:case 3:return{precision:T,unit:"millisecond",increment:10**(3-T)};case 4:case 5:case 6:return{precision:T,unit:"microsecond",increment:10**(6-T)};case 7:case 8:case 9:return{precision:T,unit:"nanosecond",increment:10**(9-T)};default:throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${T}`)}}var x0=Symbol("~required~");function g6($,T,W,U,X=[]){let w=[];for(let z=0;z<x2.length;z++){let F=x2[z],O=F[1],Q=F[2];W!=="datetime"&&W!==Q||w.push(O)}w=w.concat(X);let Y=U;Y===x0?Y=void 0:Y!==void 0&&w.push(Y);let G=[];G=G.concat(w);for(let z=0;z<w.length;z++){let F=w[z],O=MB[F];O!==void 0&&G.push(O)}let H=B0($,T,G,Y);if(H===void 0&&U===x0)throw new RangeError(`${T} is required`);return H&&H in mE?mE[H]:H}function UO($){let T=$.relativeTo;if(T===void 0)return{};let W,U,X,w,Y,G="option",H=!1;if(Q4(T)){if(v$(T))return{zonedRelativeTo:T};if(F4(T))return{plainRelativeTo:T};if(i$(T))return{plainRelativeTo:R6(K(T,X4).isoDate,K(T,u))};X=oU(T);let z=F1(X,T,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],[]);({isoDate:W,time:U}=uU(X,z,"constrain")),{offset:Y,timeZone:w}=z,Y===void 0&&(G="wall")}else{let z,F,O,Q,Z;if({year:O,month:Q,day:Z,time:U,calendar:X,tzAnnotation:z,offset:Y,z:F}=w0(B4(T)),z)w=_6(z),F?G="exact":Y||(G="wall"),H=!0;else if(F)throw new RangeError("Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone");X||(X="iso8601"),X=P6(X),W={year:O,month:Q,day:Z}}return w===void 0?{plainRelativeTo:R6(W,X)}:{zonedRelativeTo:$6(mG(W,U,G,G==="option"?d2(Y):0,w,"compatible","reject",H),w,X)}}function v0($){return K($,V6)!==0?"year":K($,K6)!==0?"month":K($,b6)!==0?"week":K($,A6)!==0?"day":K($,E6)!==0?"hour":K($,M6)!==0?"minute":K($,D6)!==0?"second":K($,N6)!==0?"millisecond":K($,J6)!==0?"microsecond":"nanosecond"}function S0($,T){return LU.indexOf($)>LU.indexOf(T)?T:$}function s1($){return $==="year"||$==="month"||$==="week"}function P0($){return s1($)||$==="day"?"date":"time"}function LT($){return i4("%calendarImpl%")($)}function cU($){return i4("%calendarImpl%")(K($,u))}function k6($,T,W="date"){let U=Object.create(null),X=LT($).isoToDate(T,{year:!0,monthCode:!0,day:!0});return U.monthCode=X.monthCode,W!=="month-day"&&W!=="date"||(U.day=X.day),W!=="year-month"&&W!=="date"||(U.year=X.year),U}function F1($,T,W,U,X){let w=LT($).extraFields(W),Y=W.concat(U,w),G=Object.create(null),H=!1;Y.sort();for(let z=0;z<Y.length;z++){let F=Y[z],O=T[F];if(O!==void 0)H=!0,G[F]=AB[F](O);else if(X!=="partial"){if(X.includes(F))throw new TypeError(`required property '${F}' missing or undefined`);G[F]=EB[F]}}if(X==="partial"&&!H)throw new TypeError("no supported properties found");return G}function AO($,T="complete"){let W=["hour","microsecond","millisecond","minute","nanosecond","second"],U=!1,X=Object.create(null);for(let w=0;w<W.length;w++){let Y=W[w],G=$[Y];G!==void 0?(X[Y]=A$(G),U=!0):T==="complete"&&(X[Y]=0)}if(!U)throw new TypeError("invalid time-like");return X}function VU($,T){if(Q4($)){if(F4($))return j$(X$(T)),R6(K($,V$),K($,u));if(v$($)){let H=D1(K($,y$),K($,Z$));return j$(X$(T)),R6(H.isoDate,K($,u))}if(i$($))return j$(X$(T)),R6(K($,X4).isoDate,K($,u));let G=oU($);return R6(JT(G,F1(G,$,["year","month","monthCode","day"],[],[]),j$(X$(T))),G)}let{year:W,month:U,day:X,calendar:w,z:Y}=w0(B4($));if(Y)throw new RangeError("Z designator not supported for PlainDate");return w||(w="iso8601"),w=P6(w),j$(X$(T)),R6({year:W,month:U,day:X},w)}function uU($,T,W){return x$(JT($,T,W),$z(T.hour,T.minute,T.second,T.millisecond,T.microsecond,T.nanosecond,W))}function KU($,T){let W,U,X;if(Q4($)){if(i$($))return j$(X$(T)),A1(K($,X4),K($,u));if(v$($)){let G=D1(K($,y$),K($,Z$));return j$(X$(T)),A1(G,K($,u))}if(F4($))return j$(X$(T)),A1(x$(K($,V$),{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),K($,u));X=oU($);let w=F1(X,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond"],[]),Y=j$(X$(T));({isoDate:W,time:U}=uU(X,w,Y))}else{let w,Y,G,H;if({year:Y,month:G,day:H,time:U,calendar:X,z:w}=w0(B4($)),w)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}),IO(Y,G,H,U.hour,U.minute,U.second,U.millisecond,U.microsecond,U.nanosecond),X||(X="iso8601"),X=P6(X),j$(X$(T)),W={year:Y,month:G,day:H}}return A1(x$(W,U),X)}function M1($){let T=i4("%Temporal.Duration%");if(H4($))return new T(K($,V6),K($,K6),K($,b6),K($,A6),K($,E6),K($,M6),K($,D6),K($,N6),K($,J6),K($,y6));if(!Q4($))return function(X){let{years:w,months:Y,weeks:G,days:H,hours:z,minutes:F,seconds:O,milliseconds:Q,microseconds:Z,nanoseconds:V}=function(A){let D=HB.exec(A);if(!D)throw new RangeError(`invalid duration: ${A}`);if(D.every((c,F$)=>F$<2||c===void 0))throw new RangeError(`invalid duration: ${A}`);let J=D[1]==="-"?-1:1,L=D[2]===void 0?0:A$(D[2])*J,_=D[3]===void 0?0:A$(D[3])*J,C=D[4]===void 0?0:A$(D[4])*J,f=D[5]===void 0?0:A$(D[5])*J,b=D[6]===void 0?0:A$(D[6])*J,g=D[7],T$=D[8],N$=D[9],j=D[10],w$=D[11],t=0,z$=0,I$=0;if(g!==void 0){if(T$??N$??j??w$)throw new RangeError("only the smallest unit can be fractional");I$=3600*A$((g+"000000000").slice(0,9))*J}else if(t=T$===void 0?0:A$(T$)*J,N$!==void 0){if(j??w$)throw new RangeError("only the smallest unit can be fractional");I$=60*A$((N$+"000000000").slice(0,9))*J}else z$=j===void 0?0:A$(j)*J,w$!==void 0&&(I$=A$((w$+"000000000").slice(0,9))*J);let e$=I$%1000,h4=Math.trunc(I$/1000)%1000,i6=Math.trunc(I$/1e6)%1000;return z$+=Math.trunc(I$/1e9)%60,t+=Math.trunc(I$/60000000000),Uz(L,_,C,f,b,t,z$,i6,h4,e$),{years:L,months:_,weeks:C,days:f,hours:b,minutes:t,seconds:z$,milliseconds:i6,microseconds:h4,nanoseconds:e$}}(X);return new(i4("%Temporal.Duration%"))(w,Y,G,H,z,F,O,Q,Z,V)}(B4($));let W={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},U=yM($);for(let X=0;X<gG.length;X++){let w=gG[X],Y=U[w];Y!==void 0&&(W[w]=Y)}return new T(W.years,W.months,W.weeks,W.days,W.hours,W.minutes,W.seconds,W.milliseconds,W.microseconds,W.nanoseconds)}function AU($){let T;if(Q4($)){if(l4($)||v$($))return I1(K($,Z$));T=VO($)}else T=$;let{year:W,month:U,day:X,time:w,offset:Y,z:G}=function(A){let D=w0(A);if(!D.z&&!D.offset)throw new RangeError("Temporal.Instant requires a time zone offset");return D}(B4(T)),{hour:H=0,minute:z=0,second:F=0,millisecond:O=0,microsecond:Q=0,nanosecond:Z=0}=w==="start-of-day"?{}:w,V=BU(W,U,X,H,z,F,O,Q,Z-(G?0:d2(Y)));return j2(V.isoDate),I1(n4(V))}function uE($,T){if(Q4($)){if(w1($))return j$(X$(T)),C2(K($,V$),K($,u));let G;return v6($,u)?G=K($,u):(G=$.calendar,G===void 0&&(G="iso8601"),G=dU(G)),C2(cG(G,F1(G,$,["year","month","monthCode","day"],[],[]),j$(X$(T))),G)}let{month:W,day:U,referenceISOYear:X,calendar:w}=CO(B4($));if(w===void 0&&(w="iso8601"),w=P6(w),j$(X$(T)),w==="iso8601")return C2({year:1972,month:W,day:U},w);let Y={year:X,month:W,day:U};return LW(Y),Y=cG(w,k6(w,Y,"month-day"),"constrain"),C2(Y,w)}function AT($,T){let W;if(Q4($)){if(A4($))return j$(X$(T)),q0(K($,O4));if(i$($))return j$(X$(T)),q0(K($,X4).time);if(v$($)){let z=D1(K($,y$),K($,Z$));return j$(X$(T)),q0(z.time)}let{hour:U,minute:X,second:w,millisecond:Y,microsecond:G,nanosecond:H}=AO($);W=$z(U,X,w,Y,G,H,j$(X$(T)))}else W=IM(B4($)),j$(X$(T));return q0(W)}function hM($){return $===void 0?{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}:K(AT($),O4)}function EU($,T){if(Q4($)){if(r4($))return j$(X$(T)),S2(K($,V$),K($,u));let G=oU($);return S2(CU(G,F1(G,$,["year","month","monthCode"],[],[]),j$(X$(T))),G)}let{year:W,month:U,referenceISODay:X,calendar:w}=qO(B4($));w===void 0&&(w="iso8601"),w=P6(w),j$(X$(T));let Y={year:W,month:U,day:X};return xO(Y),Y=CU(w,k6(w,Y,"year-month"),"constrain"),S2(Y,w)}function mG($,T,W,U,X,w,Y,G){if(T==="start-of-day")return VT(X,$);let H=x$($,T);if(W==="wall"||Y==="ignore")return W6(X,H,w);if(W==="exact"||Y==="use"){let O=BU($.year,$.month,$.day,T.hour,T.minute,T.second,T.millisecond,T.microsecond,T.nanosecond-U);j2(O.isoDate);let Q=n4(O);return X0(Q),Q}j2($);let z=n4(H),F=SU(X,H);for(let O=0;O<F.length;O++){let Q=F[O],Z=q.toNumber(q.subtract(z,Q)),V=ET(Z,60000000000,"halfExpand");if(Z===U||G&&V===U)return Q}if(Y==="reject"){let O=EO(U),Q=jU(H,"iso8601","auto");throw new RangeError(`Offset ${O} is invalid for ${Q} in ${X}`)}return rM(F,X,H,w)}function MU($,T){let W,U,X,w,Y,G,H,z=!1,F="option";if(Q4($)){if(v$($)){let A=X$(T);return _U(A),fG(A,"reject"),j$(A),$6(K($,Z$),K($,y$),K($,u))}Y=oU($);let Q=F1(Y,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],["timeZone"]);({offset:w,timeZone:X}=Q),w===void 0&&(F="wall");let Z=X$(T);G=_U(Z),H=fG(Z,"reject");let V=j$(Z);({isoDate:W,time:U}=uU(Y,Q,V))}else{let Q,Z,V,A,D;({year:V,month:A,day:D,time:U,tzAnnotation:Q,offset:w,z:Z,calendar:Y}=function(L){let _=w0(L);if(!_.tzAnnotation)throw new RangeError("Temporal.ZonedDateTime requires a time zone ID in brackets");return _}(B4($))),X=_6(Q),Z?F="exact":w||(F="wall"),Y||(Y="iso8601"),Y=P6(Y),z=!0;let J=X$(T);G=_U(J),H=fG(J,"reject"),j$(J),W={year:V,month:A,day:D}}let O=0;return F==="option"&&(O=d2(w)),$6(mG(W,U,F,O,X,G,H,z),X,Y)}function gM($,T,W){LW(T),f0($),_$($,V$,T),_$($,u,W),_$($,AM,!0)}function R6($,T){let W=i4("%Temporal.PlainDate%"),U=Object.create(W.prototype);return gM(U,$,T),U}function mM($,T,W){EW(T),f0($),_$($,X4,T),_$($,u,W)}function A1($,T){let W=i4("%Temporal.PlainDateTime%"),U=Object.create(W.prototype);return mM(U,$,T),U}function cM($,T,W){LW(T),f0($),_$($,V$,T),_$($,u,W),_$($,MM,!0)}function C2($,T){let W=i4("%Temporal.PlainMonthDay%"),U=Object.create(W.prototype);return cM(U,$,T),U}function uM($,T){f0($),_$($,O4,T)}function q0($){let T=i4("%Temporal.PlainTime%"),W=Object.create(T.prototype);return uM(W,$),W}function pM($,T,W){xO(T),f0($),_$($,V$,T),_$($,u,W),_$($,EM,!0)}function S2($,T){let W=i4("%Temporal.PlainYearMonth%"),U=Object.create(W.prototype);return pM(U,$,T),U}function dM($,T){X0(T),f0($),_$($,Z$,T)}function I1($){let T=i4("%Temporal.Instant%"),W=Object.create(T.prototype);return dM(W,$),W}function oM($,T,W,U){X0(T),f0($),_$($,Z$,T),_$($,y$,W),_$($,u,U)}function $6($,T,W="iso8601"){let U=i4("%Temporal.ZonedDateTime%"),X=Object.create(U.prototype);return oM(X,$,T,W),X}function pE($){return KO.filter((T)=>$[T]!==void 0)}function KW($,T,W){let U=pE(W),X=LT($).fieldKeysToIgnore(U),w=Object.create(null),Y=pE(T);for(let G=0;G<KO.length;G++){let H,z=KO[G];Y.includes(z)&&!X.includes(z)&&(H=T[z]),U.includes(z)&&(H=W[z]),H!==void 0&&(w[z]=H)}return w}function z1($,T,W,U){let X=LT($).dateAdd(T,W,U);return LW(X),X}function pU($,T,W,U){return LT($).dateUntil(T,W,U)}function dU($){if(Q4($)&&v6($,u))return K($,u);let T=B4($);try{return P6(T)}catch{}let W;try{({calendar:W}=w0(T))}catch{try{({calendar:W}=IM(T))}catch{try{({calendar:W}=qO(T))}catch{({calendar:W}=CO(T))}}}return W||(W="iso8601"),P6(W)}function oU($){if(v6($,u))return K($,u);let{calendar:T}=$;return T===void 0?"iso8601":dU(T)}function W0($,T){return P6($)===P6(T)}function JT($,T,W){let U=LT($);U.resolveFields(T,"date");let X=U.dateToISO(T,W);return LW(X),X}function CU($,T,W){let U=LT($);U.resolveFields(T,"year-month"),T.day=1;let X=U.dateToISO(T,W);return xO(X),X}function cG($,T,W){let U=LT($);U.resolveFields(T,"month-day");let X=U.monthDayToISOReferenceDate(T,W);return LW(X),X}function _6($){if(Q4($)&&v$($))return K($,y$);let T=B4($);if(T==="UTC")return"UTC";let{tzName:W,offsetMinutes:U}=function(w){let{tzAnnotation:Y,offset:G,z:H}=function(z){if(xM.test(z))return{tzAnnotation:z,offset:void 0,z:!1};try{let{tzAnnotation:F,offset:O,z:Q}=w0(z);if(Q||F||O)return{tzAnnotation:F,offset:O,z:Q}}catch{}bM(z)}(w);return Y?MT(Y):H?MT("UTC"):G?MT(G):void 0}(T);if(U!==void 0)return SO(U);let X=uG(W);if(!X)throw new RangeError(`Unrecognized time zone ${W}`);return X.identifier}function lM($,T){if($===T)return!0;let W=MT($).offsetMinutes,U=MT(T).offsetMinutes;if(W===void 0&&U===void 0){let X=uG(T);if(!X)return!1;let w=uG($);return!!w&&w.primaryIdentifier===X.primaryIdentifier}return W===U}function C0($,T){let W=MT($).offsetMinutes;return W!==void 0?60000000000*W:MO($,T)}function EO($){let T=$<0?"-":"+",W=Math.abs($),U=Math.floor(W/3600000000000),X=Math.floor(W/60000000000)%60,w=Math.floor(W/1e9)%60,Y=W%1e9;return`${T}${Tz(U,X,w,Y,w===0&&Y===0?"minute":"auto")}`}function D1($,T){let W=C0($,T),{isoDate:{year:U,month:X,day:w},time:{hour:Y,minute:G,second:H,millisecond:z,microsecond:F,nanosecond:O}}=tM(T);return BU(U,X,w,Y,G,H,z,F,O+W)}function W6($,T,W){return rM(SU($,T),$,T,W)}function rM($,T,W,U){let X=$.length;if(X===1)return $[0];if(X)switch(U){case"compatible":case"earlier":return $[0];case"later":return $[X-1];case"reject":throw new RangeError("multiple instants found")}if(U==="reject")throw new RangeError("multiple instants found");let w=n4(W),Y=q.subtract(w,DT);X0(Y);let G=C0(T,Y),H=q.add(w,DT);X0(H);let z=C0(T,H)-G;switch(U){case"earlier":{let F=P$.fromComponents(0,0,0,0,0,-z),O=b2(W.time,F);return SU(T,x$(m6(W.isoDate.year,W.isoDate.month,W.isoDate.day+O.deltaDays),O))[0]}case"compatible":case"later":{let F=P$.fromComponents(0,0,0,0,0,z),O=b2(W.time,F),Q=SU(T,x$(m6(W.isoDate.year,W.isoDate.month,W.isoDate.day+O.deltaDays),O));return Q[Q.length-1]}}}function SU($,T){if($==="UTC")return j2(T.isoDate),[n4(T)];let W=MT($).offsetMinutes;if(W!==void 0){let U=BU(T.isoDate.year,T.isoDate.month,T.isoDate.day,T.time.hour,T.time.minute-W,T.time.second,T.time.millisecond,T.time.microsecond,T.time.nanosecond);j2(U.isoDate);let X=n4(U);return X0(X),[X]}return j2(T.isoDate),function(U,X){let w=n4(X),Y=q.subtract(w,DT);q.lessThan(Y,PU)&&(Y=w);let G=q.add(w,DT);q.greaterThan(G,I2)&&(G=w);let H=MO(U,Y),z=MO(U,G);return(H===z?[H]:[H,z]).map((O)=>{let Q=q.subtract(w,q.BigInt(O)),Z=function(V,A){let{epochMilliseconds:D,time:{millisecond:J,microsecond:L,nanosecond:_}}=tM(A),{year:C,month:f,day:b,hour:g,minute:T$,second:N$}=aM(V,D);return BU(C,f,b,g,T$,N$,J,L,_)}(U,Q);if(y2(X,Z)===0)return X0(Q),Q}).filter((O)=>O!==void 0)}($,T)}function VT($,T){let W=x$(T,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),U=SU($,W);if(U.length)return U[0];let X=n4(W),w=q.subtract(X,DT);return X0(w),BO($,w)}function lU($){let T;return T=$<0||$>9999?($<0?"-":"+")+qU(Math.abs($),6):qU($,4),T}function H1($){return qU($,2)}function nM($,T){let W;if(T==="auto"){if($===0)return"";W=qU($,9).replace(/0+$/,"")}else{if(T===0)return"";W=qU($,9).slice(0,T)}return`.${W}`}function Tz($,T,W,U,X){let w=`${H1($)}:${H1(T)}`;return X==="minute"||(w+=`:${H1(W)}`,w+=nM(U,X)),w}function dE($,T,W){let U=T;U===void 0&&(U="UTC");let X=K($,Z$),w=jU(D1(U,X),"iso8601",W,"never"),Y="Z";return T!==void 0&&(Y=iM(C0(U,X))),`${w}${Y}`}function xG($,T){let W=K($,V6),U=K($,K6),X=K($,b6),w=K($,A6),Y=K($,E6),G=K($,M6),H=dG($),z="";W!==0&&(z+=`${Math.abs(W)}Y`),U!==0&&(z+=`${Math.abs(U)}M`),X!==0&&(z+=`${Math.abs(X)}W`),w!==0&&(z+=`${Math.abs(w)}D`);let F="";Y!==0&&(F+=`${Math.abs(Y)}H`),G!==0&&(F+=`${Math.abs(G)}M`);let O=P$.fromComponents(0,0,K($,D6),K($,N6),K($,J6),K($,y6));O.isZero()&&!["second","millisecond","microsecond","nanosecond"].includes(v0($))&&T==="auto"||(F+=`${Math.abs(O.sec)}${nM(Math.abs(O.subsec),T)}S`);let Q=`${H<0?"-":""}P${z}`;return F&&(Q=`${Q}T${F}`),Q}function oE($,T="auto"){let{year:W,month:U,day:X}=K($,V$);return`${lU(W)}-${H1(U)}-${H1(X)}${yU(K($,u),T)}`}function lE({hour:$,minute:T,second:W,millisecond:U,microsecond:X,nanosecond:w},Y){return Tz($,T,W,1e6*U+1000*X+w,Y)}function jU($,T,W,U="auto"){let{isoDate:{year:X,month:w,day:Y},time:{hour:G,minute:H,second:z,millisecond:F,microsecond:O,nanosecond:Q}}=$;return`${lU(X)}-${H1(w)}-${H1(Y)}T${Tz(G,H,z,1e6*F+1000*O+Q,W)}${yU(T,U)}`}function rE($,T="auto"){let{year:W,month:U,day:X}=K($,V$),w=`${H1(U)}-${H1(X)}`,Y=K($,u);T!=="always"&&T!=="critical"&&Y==="iso8601"||(w=`${lU(W)}-${w}`);let G=yU(Y,T);return G&&(w+=G),w}function nE($,T="auto"){let{year:W,month:U,day:X}=K($,V$),w=`${lU(W)}-${H1(U)}`,Y=K($,u);T!=="always"&&T!=="critical"&&Y==="iso8601"||(w+=`-${H1(X)}`);let G=yU(Y,T);return G&&(w+=G),w}function iE($,T,W="auto",U="auto",X="auto",w=void 0){let Y=K($,Z$);if(w){let{unit:F,increment:O,roundingMode:Q}=w;Y=LO(Y,O,F,Q)}let G=K($,y$),H=C0(G,Y),z=jU(D1(G,Y),"iso8601",T,"never");return X!=="never"&&(z+=iM(H)),U!=="never"&&(z+=`[${U==="critical"?"!":""}${G}]`),z+=yU(K($,u),W),z}function tE($){return fM.test($)}function d2($){let T=LB.exec($);if(!T)throw new RangeError(`invalid time zone offset: ${$}; must match \xB1HH:MM[:SS.SSSSSSSSS]`);return(T[1]==="-"?-1:1)*(1e9*(60*(60*+T[2]+ +(T[3]||0))+ +(T[4]||0))+ +((T[5]||0)+"000000000").slice(0,9))}var HU,NB=Object.assign(Object.create(null),{"/":!0,"-":!0,_:!0});function uG($){if(HU===void 0){let w=Intl.supportedValuesOf?.("timeZone");if(w){HU=new Map;for(let Y=0;Y<w.length;Y++){let G=w[Y];HU.set(IU(G),G)}}else HU=null}let T=IU($),W=HU?.get(T);if(W)return{identifier:W,primaryIdentifier:W};try{W=BM($).resolvedOptions().timeZone}catch{return}if(T==="antarctica/south_pole"&&(W="Antarctica/McMurdo"),KB.has($))throw new RangeError(`${$} is a legacy time zone identifier from ICU. Use ${W} instead`);let U=[...T].map((w,Y)=>Y===0||NB[T[Y-1]]?w.toUpperCase():w).join("").split("/");if(U.length===1)return T==="gb-eire"?{identifier:"GB-Eire",primaryIdentifier:W}:{identifier:T.length<=3||/[-0-9]/.test(T)?T.toUpperCase():U[0],primaryIdentifier:W};if(U[0]==="Etc")return{identifier:`Etc/${["Zulu","Greenwich","Universal"].includes(U[1])?U[1]:U[1].toUpperCase()}`,primaryIdentifier:W};if(U[0]==="Us")return{identifier:`US/${U[1]}`,primaryIdentifier:W};let X=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]=X.get(U[1])??U[1],U.length>2&&(U[2]=X.get(U[2])??U[2]),{identifier:U.join("/"),primaryIdentifier:W}}function ZW($,T){let{year:W,month:U,day:X,hour:w,minute:Y,second:G}=aM($,T),H=T%1000;return H<0&&(H+=1000),1e6*(jO({isoDate:{year:W,month:U,day:X},time:{hour:w,minute:Y,second:G,millisecond:H}})-T)}function MO($,T){return ZW($,N1(T,"floor"))}function SO($){let T=$<0?"-":"+",W=Math.abs($);return`${T}${Tz(Math.floor(W/60),W%60,0,0,"minute")}`}function iM($){return SO(ET($,FB,"halfExpand")/60000000000)}function jO({isoDate:{year:$,month:T,day:W},time:{hour:U,minute:X,second:w,millisecond:Y}}){let G=$%400,H=($-G)/400,z=new Date;return z.setUTCHours(U,X,w,Y),z.setUTCFullYear(G,T-1,W),z.getTime()+ZB*H}function n4($){let T=jO($),W=1000*$.time.microsecond+$.time.nanosecond;return q.add(x1(T),q.BigInt(W))}function tM($){let T=N1($,"trunc"),W=q.toNumber(q.remainder($,fU));W<0&&(W+=1e6,T-=1);let U=Math.floor(W/1000)%1000,X=W%1000,w=new Date(T);return{epochMilliseconds:T,isoDate:{year:w.getUTCFullYear(),month:w.getUTCMonth()+1,day:w.getUTCDate()},time:{hour:w.getUTCHours(),minute:w.getUTCMinutes(),second:w.getUTCSeconds(),millisecond:w.getUTCMilliseconds(),microsecond:U,nanosecond:X}}}function BO($,T){if($==="UTC")return null;let W=N1(T,"floor");if(W<JU)return BO($,x1(JU));let U=Date.now(),X=Math.max(W,U)+366*NT*3,w=W,Y=ZW($,w),G=w,H=Y;for(;Y===H&&w<X;){if(G=w+2*NT*7,G>jM)return null;H=ZW($,G),Y===H&&(w=G)}return Y===H?null:x1(GD((z)=>ZW($,z),w,G,Y,H))}function DO($,T){if($==="UTC")return null;let W=N1(T,"ceil"),U=Date.now(),X=U+366*NT*3;if(W>X){let z=DO($,x1(X));if(z===null||q.lessThan(z,x1(U)))return z}if($==="Africa/Casablanca"||$==="Africa/El_Aaiun"){let z=Date.UTC(2088,0,1);if(z<W)return DO($,x1(z))}let w=W-1;if(w<JU)return null;let Y=ZW($,w),G=w,H=Y;for(;Y===H&&w>JU;){if(G=w-2*NT*7,G<JU)return null;H=ZW($,G),Y===H&&(w=G)}return Y===H?null:x1(GD((z)=>ZW($,z),G,w,H,Y))}function aM($,T){return function(W){let U=W.split(/[^\w]+/);if(U.length!==7)throw new RangeError(`expected 7 parts in "${W}`);let X=+U[0],w=+U[1],Y=+U[2],G=U[3];if(G[0]==="b"||G[0]==="B")Y=1-Y;else if(G[0]!=="a"&&G[0]!=="A")throw new RangeError(`Unknown era ${G} in "${W}`);let H=U[4]==="24"?0:+U[4],z=+U[5],F=+U[6];if(!(Number.isFinite(Y)&&Number.isFinite(X)&&Number.isFinite(w)&&Number.isFinite(H)&&Number.isFinite(z)&&Number.isFinite(F)))throw new RangeError(`Invalid number in "${W}`);return{year:Y,month:X,day:w,hour:H,minute:z,second:F}}(BM($).format(T))}function pG($){return $!==void 0&&!($%4!=0||$%100==0&&$%400!=0)}function VW($,T){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]}[pG($)?"leapyear":"standard"][T-1]}function dG($){let T=[K($,V6),K($,K6),K($,b6),K($,A6),K($,E6),K($,M6),K($,D6),K($,N6),K($,J6),K($,y6)];for(let W=0;W<T.length;W++){let U=T[W];if(U!==0)return U<0?-1:1}return 0}function Wz($){let T=["years","months","weeks","days"];for(let W=0;W<T.length;W++){let U=$[T[W]];if(U!==0)return U<0?-1:1}return 0}function sM($){let T=Wz($.date);return T!==0?T:$.time.sign()}function QW($,T){let W=$,U=T;if(!Number.isFinite(W)||!Number.isFinite(U))throw new RangeError("infinity is out of range");return U-=1,W+=Math.floor(U/12),U%=12,U<0&&(U+=12),U+=1,{year:W,month:U}}function m6($,T,W){let U=$,X=T,w=W;if(!Number.isFinite(w))throw new RangeError("infinity is out of range");({year:U,month:X}=QW(U,X));let Y=146097;if(Math.abs(w)>Y){let z=Math.trunc(w/Y);U+=400*z,w-=z*Y}let G=0,H=X>2?U:U-1;for(;G=pG(H)?366:365,w<-G;)U-=1,H-=1,w+=G;for(H+=1;G=pG(H)?366:365,w>G;)U+=1,H+=1,w-=G;for(;w<1;)({year:U,month:X}=QW(U,X-1)),w+=VW(U,X);for(;w>VW(U,X);)w-=VW(U,X),{year:U,month:X}=QW(U,X+1);return{year:U,month:X,day:w}}function BU($,T,W,U,X,w,Y,G,H){let z=KT(U,X,w,Y,G,H);return x$(m6($,T,W+z.deltaDays),z)}function KT($,T,W,U,X,w){let Y,G=$,H=T,z=W,F=U,O=X,Q=w;({div:Y,mod:Q}=q2(Q,3)),O+=Y,Q<0&&(O-=1,Q+=1000),{div:Y,mod:O}=q2(O,3),F+=Y,O<0&&(F-=1,O+=1000),z+=Math.trunc(F/1000),F%=1000,F<0&&(z-=1,F+=1000),H+=Math.trunc(z/60),z%=60,z<0&&(H-=1,z+=60),G+=Math.trunc(H/60),H%=60,H<0&&(G-=1,H+=60);let Z=Math.trunc(G/24);return G%=24,G<0&&(Z-=1,G+=24),Z+=0,G+=0,H+=0,z+=0,F+=0,O+=0,Q+=0,{deltaDays:Z,hour:G,minute:H,second:z,millisecond:F,microsecond:O,nanosecond:Q}}function aE($,T){let W=T6($,0);if(Wz(W)===0)return $.days;let U=K(T,V$),X=z1(K(T,u),U,W,"constrain"),w=MW(U.year,U.month-1,U.day),Y=MW(X.year,X.month-1,X.day)-w;return $.days+Y}function c6($){return new(i4("%Temporal.Duration%"))(-K($,V6),-K($,K6),-K($,b6),-K($,A6),-K($,E6),-K($,M6),-K($,D6),-K($,N6),-K($,J6),-K($,y6))}function L6($,T,W){return Math.min(W,Math.max(T,$))}function eM($,T,W){let U=L6(T,1,12);return{year:$,month:U,day:L6(W,1,VW($,U))}}function c4($,T,W){if($<T||$>W)throw new RangeError(`value out of range: ${T} <= ${$} <= ${W}`)}function AW($,T,W){c4(T,1,12),c4(W,1,VW($,T))}function LW($){EW(x$($,{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}))}function Xz($,T,W,U,X,w){c4($,0,23),c4(T,0,59),c4(W,0,59),c4(U,0,999),c4(X,0,999),c4(w,0,999)}function IO($,T,W,U,X,w,Y,G,H){AW($,T,W),Xz(U,X,w,Y,G,H)}function EW($){let T=n4($);(q.lessThan(T,OB)||q.greaterThan(T,QB))&&X0(T)}function NO($){n4($)}function X0($){if(q.lessThan($,PU)||q.greaterThan($,I2))throw new RangeError("date/time value is outside of supported range")}function xO({year:$,month:T}){c4($,yE,hE),$===yE?c4(T,4,12):$===hE&&c4(T,1,9)}function Uz($,T,W,U,X,w,Y,G,H,z){let F=0,O=[$,T,W,U,X,w,Y,G,H,z];for(let J=0;J<O.length;J++){let L=O[J];if(L===1/0||L===-1/0)throw new RangeError("infinite values not allowed as duration fields");if(L!==0){let _=L<0?-1:1;if(F!==0&&_!==F)throw new RangeError("mixed-sign values not allowed as duration fields");F=_}}if(Math.abs($)>=4294967296||Math.abs(T)>=4294967296||Math.abs(W)>=4294967296)throw new RangeError("years, months, and weeks must be < 2\xB3\xB2");let Q=q2(G,3),Z=q2(H,6),V=q2(z,9),A=q2(1e6*Q.mod+1000*Z.mod+V.mod,9).div,D=86400*U+3600*X+60*w+Y+Q.div+Z.div+V.div+A;if(!Number.isSafeInteger(D))throw new RangeError("total of duration time units cannot exceed 9007199254740991.999999999 s")}function P2($){return{date:{years:K($,V6),months:K($,K6),weeks:K($,b6),days:K($,A6)},time:P$.fromComponents(K($,E6),K($,M6),K($,D6),K($,N6),K($,J6),K($,y6))}}function $0($){let T=P$.fromComponents(K($,E6),K($,M6),K($,D6),K($,N6),K($,J6),K($,y6)).add24HourDays(K($,A6));return{date:{years:K($,V6),months:K($,K6),weeks:K($,b6),days:0},time:T}}function $D($){let T=$0($),W=Math.trunc(T.time.sec/86400);return Uz(T.date.years,T.date.months,T.date.weeks,W,0,0,0,0,0,0),{...T.date,days:W}}function E1($,T){let W=$.time.sign(),U=$.time.abs().subsec,X=0,w=0,Y=$.time.abs().sec,G=0,H=0,z=0;switch(T){case"year":case"month":case"week":case"day":X=Math.trunc(U/1000),U%=1000,w=Math.trunc(X/1000),X%=1000,Y+=Math.trunc(w/1000),w%=1000,G=Math.trunc(Y/60),Y%=60,H=Math.trunc(G/60),G%=60,z=Math.trunc(H/24),H%=24;break;case"hour":X=Math.trunc(U/1000),U%=1000,w=Math.trunc(X/1000),X%=1000,Y+=Math.trunc(w/1000),w%=1000,G=Math.trunc(Y/60),Y%=60,H=Math.trunc(G/60),G%=60;break;case"minute":X=Math.trunc(U/1000),U%=1000,w=Math.trunc(X/1000),X%=1000,Y+=Math.trunc(w/1000),w%=1000,G=Math.trunc(Y/60),Y%=60;break;case"second":X=Math.trunc(U/1000),U%=1000,w=Math.trunc(X/1000),X%=1000,Y+=Math.trunc(w/1000),w%=1000;break;case"millisecond":X=Math.trunc(U/1000),U%=1000,w=WO(Y,3,Math.trunc(X/1000)),X%=1000,Y=0;break;case"microsecond":X=WO(Y,6,Math.trunc(U/1000)),U%=1000,Y=0;break;case"nanosecond":U=WO(Y,9,U),Y=0}return new(i4("%Temporal.Duration%"))($.date.years,$.date.months,$.date.weeks,$.date.days+W*z,W*H,W*G,W*Y,W*w,W*X,W*U)}function j0($,T){return Wz($),T.sign(),{date:$,time:T}}function MW($,T,W){return jO({isoDate:{year:$,month:T+1,day:W},time:{hour:0,minute:0,second:0,millisecond:0}})/NT}function j2({year:$,month:T,day:W}){if(Math.abs(MW($,T-1,W))>1e8)throw new RangeError("date/time value is outside the supported range")}function fO($,T){let W=T.hour-$.hour,U=T.minute-$.minute,X=T.second-$.second,w=T.millisecond-$.millisecond,Y=T.microsecond-$.microsecond,G=T.nanosecond-$.nanosecond;return P$.fromComponents(W,U,X,w,Y,G)}function bO($,T,W,U,X){let w=P$.fromEpochNsDiff(T,$);return w=oG(w,W,U,X),j0({years:0,months:0,weeks:0,days:0},w)}function TD($,T,W,U){NO($),NO(T);let X=fO($.time,T.time),w=X.sign(),Y=U0($.isoDate,T.isoDate),G=T.isoDate;Y===w&&(G=m6(G.year,G.month,G.day+w),X=X.add24HourDays(-w));let H=S0("day",U),z=pU(W,$.isoDate,G,H);return U!==H&&(X=X.add24HourDays(z.days),z.days=0),j0(z,X)}function WD($,T,W,U,X){let w=q.subtract(T,$);if(q.equal(w,Y1))return{date:{years:0,months:0,weeks:0,days:0},time:P$.ZERO};let Y=q.lessThan(w,Y1)?-1:1,G=D1(W,$),H=D1(W,T),z,F=0,O=Y===1?2:1,Q=fO(G.time,H.time);for(Q.sign()===-Y&&F++;F<=O;F++){z=x$(m6(H.isoDate.year,H.isoDate.month,H.isoDate.day-F*Y),G.time);let V=W6(W,z,"compatible");if(Q=P$.fromEpochNsDiff(T,V),Q.sign()!==-Y)break}let Z=S0("day",X);return j0(pU(U,G.isoDate,z.isoDate,Z),Q)}function XD($,T,W,U,X,w,Y,G,H){let z,F,O,Q,Z=T;switch(G){case"year":{let t=ET(Z.date.years,Y,"trunc");z=t,F=t+Y*$,O={years:z,months:0,weeks:0,days:0},Q={...O,years:F};break}case"month":{let t=ET(Z.date.months,Y,"trunc");z=t,F=t+Y*$,O=T6(Z.date,0,0,z),Q=T6(Z.date,0,0,F);break}case"week":{let t=T6(Z.date,0,0),z$=z1(w,U.isoDate,t,"constrain"),I$=pU(w,z$,m6(z$.year,z$.month,z$.day+Z.date.days),"week"),e$=ET(Z.date.weeks+I$.weeks,Y,"trunc");z=e$,F=e$+Y*$,O=T6(Z.date,0,z),Q=T6(Z.date,0,F);break}case"day":{let t=ET(Z.date.days,Y,"trunc");z=t,F=t+Y*$,O=T6(Z.date,z),Q=T6(Z.date,F);break}}let V=z1(w,U.isoDate,O,"constrain"),A=z1(w,U.isoDate,Q,"constrain"),D,J,L=x$(V,U.time),_=x$(A,U.time);X?(D=W6(X,L,"compatible"),J=W6(X,_,"compatible")):(D=n4(L),J=n4(_));let C=P$.fromEpochNsDiff(W,D),f=P$.fromEpochNsDiff(J,D),b=iG(H,$<0?"negative":"positive"),g=C.add(C).abs().subtract(f.abs()).sign(),T$=Math.abs(z)/Y%2==0,N$=C.isZero()?Math.abs(z):C.cmp(f)?tG(Math.abs(z),Math.abs(F),g,T$,b):Math.abs(F),j=new P$(q.add(q.multiply(f.totalNs,q.BigInt(z)),q.multiply(C.totalNs,q.BigInt(Y*$)))).fdiv(f.totalNs),w$=N$===Math.abs(F);return Z={date:w$?Q:O,time:P$.ZERO},{nudgeResult:{duration:Z,nudgedEpochNs:w$?J:D,didExpandCalendarUnit:w$},total:j}}function wz($,T,W,U,X,w,Y,G,H){let z=$,F=s1(G)||U&&G==="day",O=sM(z)<0?-1:1,Q;return F?{nudgeResult:Q}=XD(O,z,T,W,U,X,Y,G,H):Q=U?function(Z,V,A,D,J,L,_,C){let f=V,b=z1(J,A.isoDate,f.date,"constrain"),g=x$(b,A.time),T$=x$(m6(b.year,b.month,b.day+Z),A.time),N$=W6(D,g,"compatible"),j=W6(D,T$,"compatible"),w$=P$.fromEpochNsDiff(j,N$);if(w$.sign()!==Z)throw new RangeError("time zone returned inconsistent Instants");let t=q.BigInt(f2[_]*L),z$=f.time.round(t,C),I$=z$.subtract(w$),e$=I$.sign()!==-Z,h4,i6;return e$?(h4=Z,z$=I$.round(t,C),i6=z$.addToEpochNs(j)):(h4=0,i6=z$.addToEpochNs(N$)),{duration:j0(T6(f.date,f.date.days+h4),z$),nudgedEpochNs:i6,didExpandCalendarUnit:e$}}(O,z,W,U,X,Y,G,H):function(Z,V,A,D,J,L){let _=Z,C=_.time.add24HourDays(_.date.days),f=C.round(q.BigInt(D*f2[J]),L),b=f.subtract(C),{quotient:g}=C.divmod(hG),{quotient:T$}=f.divmod(hG),N$=Math.sign(T$-g)===C.sign(),j=b.addToEpochNs(V),w$=0,t=f;return P0(A)==="date"&&(w$=T$,t=f.add(P$.fromComponents(24*-T$,0,0,0,0,0))),{duration:{date:T6(_.date,w$),time:t},nudgedEpochNs:j,didExpandCalendarUnit:N$}}(z,T,w,Y,G,H),z=Q.duration,Q.didExpandCalendarUnit&&G!=="week"&&(z=function(Z,V,A,D,J,L,_,C){let f=V;if(C===_)return f;let b=LU.indexOf(_);for(let g=LU.indexOf(C)-1;g>=b;g--){let T$=LU[g];if(T$==="week"&&_!=="week")continue;let N$;switch(T$){case"year":N$={years:f.date.years+Z,months:0,weeks:0,days:0};break;case"month":{let t=f.date.months+Z;N$=T6(f.date,0,0,t);break}case"week":{let t=f.date.weeks+Z;N$=T6(f.date,0,t);break}}let j=x$(z1(L,D.isoDate,N$,"constrain"),D.time),w$;if(w$=J?W6(J,j,"compatible"):n4(j),bG(A,w$)===-Z)break;f={date:N$,time:P$.ZERO}}return f}(O,z,Q.nudgedEpochNs,W,U,X,w,S0(G,"day"))),z}function sE($,T,W,U,X,w){return s1(w)||U&&w==="day"?XD(sM($)<0?-1:1,$,T,W,U,X,1,w,"trunc").total:kU($.time.add24HourDays($.date.days),w)}function UD($,T,W,U,X,w,Y){if(y2($,T)==0)return{date:{years:0,months:0,weeks:0,days:0},time:P$.ZERO};EW($),EW(T);let G=TD($,T,W,U);return w==="nanosecond"&&X===1?G:wz(G,n4(T),$,null,W,U,X,w,Y)}function wD($,T,W,U,X,w,Y,G){if(P0(X)==="time")return bO($,T,w,Y,G);let H=WD($,T,W,U,X);return Y==="nanosecond"&&w===1?H:wz(H,T,D1(W,$),W,U,X,w,Y,G)}function o2($,T,W,U,X,w){let Y=x2.reduce((Z,V)=>{let A=V[0],D=V[1],J=V[2];return W!=="datetime"&&J!==W||U.includes(D)||Z.push(D,A),Z},[]),G=g6(T,"largestUnit",W,"auto");if(U.includes(G))throw new RangeError(`largestUnit must be one of ${Y.join(", ")}, not ${G}`);let H=u2(T),z=f1(T,"trunc");$==="since"&&(z=function(Z){switch(Z){case"ceil":return"floor";case"floor":return"ceil";case"halfCeil":return"halfFloor";case"halfFloor":return"halfCeil";default:return Z}}(z));let F=g6(T,"smallestUnit",W,X);if(U.includes(F))throw new RangeError(`smallestUnit must be one of ${Y.join(", ")}, not ${F}`);let O=S0(w,F);if(G==="auto"&&(G=O),S0(G,F)!==G)throw new RangeError(`largestUnit ${G} cannot be smaller than smallestUnit ${F}`);let Q={hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[F];return Q!==void 0&&p2(H,Q,!1),{largestUnit:G,roundingIncrement:H,roundingMode:z,smallestUnit:F}}function eE($,T,W,U){let X=AU(W),w=o2($,X$(U),"time",[],"nanosecond","second"),Y=E1(bO(K(T,Z$),K(X,Z$),w.roundingIncrement,w.smallestUnit,w.roundingMode),w.largestUnit);return $==="since"&&(Y=c6(Y)),Y}function $M($,T,W,U){let X=VU(W),w=K(T,u),Y=K(X,u);if(!W0(w,Y))throw new RangeError(`cannot compute difference between dates of ${w} and ${Y} calendars`);let G=o2($,X$(U),"date",[],"day","day"),H=i4("%Temporal.Duration%"),z=K(T,V$),F=K(X,V$);if(U0(z,F)===0)return new H;let O={date:pU(w,z,F,G.largestUnit),time:P$.ZERO};if(G.smallestUnit!=="day"||G.roundingIncrement!==1){let Z=x$(z,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});O=wz(O,n4(x$(F,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),Z,null,w,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode)}let Q=E1(O,"day");return $==="since"&&(Q=c6(Q)),Q}function TM($,T,W,U){let X=KU(W),w=K(T,u),Y=K(X,u);if(!W0(w,Y))throw new RangeError(`cannot compute difference between dates of ${w} and ${Y} calendars`);let G=o2($,X$(U),"datetime",[],"nanosecond","day"),H=i4("%Temporal.Duration%"),z=K(T,X4),F=K(X,X4);if(y2(z,F)===0)return new H;let O=E1(UD(z,F,w,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode),G.largestUnit);return $==="since"&&(O=c6(O)),O}function WM($,T,W,U){let X=AT(W),w=o2($,X$(U),"time",[],"nanosecond","hour"),Y=fO(K(T,O4),K(X,O4));Y=oG(Y,w.roundingIncrement,w.smallestUnit,w.roundingMode);let G=E1(j0({years:0,months:0,weeks:0,days:0},Y),w.largestUnit);return $==="since"&&(G=c6(G)),G}function XM($,T,W,U){let X=EU(W),w=K(T,u),Y=K(X,u);if(!W0(w,Y))throw new RangeError(`cannot compute difference between months of ${w} and ${Y} calendars`);let G=o2($,X$(U),"date",["week","day"],"month","year"),H=i4("%Temporal.Duration%");if(U0(K(T,V$),K(X,V$))==0)return new H;let z=k6(w,K(T,V$),"year-month");z.day=1;let F=JT(w,z,"constrain"),O=k6(w,K(X,V$),"year-month");O.day=1;let Q=JT(w,O,"constrain"),Z={date:T6(pU(w,F,Q,G.largestUnit),0,0),time:P$.ZERO};if(G.smallestUnit!=="month"||G.roundingIncrement!==1){let A=x$(F,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});Z=wz(Z,n4(x$(Q,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),A,null,w,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode)}let V=E1(Z,"day");return $==="since"&&(V=c6(V)),V}function UM($,T,W,U){let X=MU(W),w=K(T,u),Y=K(X,u);if(!W0(w,Y))throw new RangeError(`cannot compute difference between dates of ${w} and ${Y} calendars`);let G=o2($,X$(U),"datetime",[],"nanosecond","hour"),H=K(T,Z$),z=K(X,Z$),F=i4("%Temporal.Duration%"),O;if(P0(G.largestUnit)!=="date")O=E1(bO(H,z,G.roundingIncrement,G.smallestUnit,G.roundingMode),G.largestUnit);else{let Q=K(T,y$);if(!lM(Q,K(X,y$)))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(q.equal(H,z))return new F;O=E1(wD(H,z,Q,w,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode),"hour")}return $==="since"&&(O=c6(O)),O}function b2({hour:$,minute:T,second:W,millisecond:U,microsecond:X,nanosecond:w},Y){let G=W,H=w;return G+=Y.sec,H+=Y.subsec,KT($,T,G,U,X,H)}function JO($,T){let W=T.addToEpochNs($);return X0(W),W}function DU($,T,W,U,X="constrain"){if(Wz(U.date)===0)return JO($,U.time);let w=D1(T,$);return JO(W6(T,x$(z1(W,w.isoDate,U.date,X),w.time),"compatible"),U.time)}function wM($,T,W){let U=M1(W);$==="subtract"&&(U=c6(U));let X=S0(v0(T),v0(U));if(s1(X))throw new RangeError("For years, months, or weeks arithmetic, use date arithmetic relative to a starting point");let w=$0(T),Y=$0(U);return E1(j0({years:0,months:0,weeks:0,days:0},w.time.add(Y.time)),X)}function YM($,T,W){let U=M1(W);$==="subtract"&&(U=c6(U));let X=v0(U);if(P0(X)==="date")throw new RangeError(`Duration field ${X} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);let w=$0(U);return I1(JO(K(T,Z$),w.time))}function GM($,T,W,U){let X=K(T,u),w=M1(W);$==="subtract"&&(w=c6(w));let Y=$D(w),G=j$(X$(U));return R6(z1(X,K(T,V$),Y,G),X)}function zM($,T,W,U){let X=M1(W);$==="subtract"&&(X=c6(X));let w=j$(X$(U)),Y=K(T,u),G=$0(X),H=K(T,X4),z=b2(H.time,G.time),F=T6(G.date,z.deltaDays);return Uz(F.years,F.months,F.weeks,F.days,0,0,0,0,0,0),A1(x$(z1(Y,H.isoDate,F,w),z),Y)}function HM($,T,W){let U=M1(W);$==="subtract"&&(U=c6(U));let X=$0(U),{hour:w,minute:Y,second:G,millisecond:H,microsecond:z,nanosecond:F}=b2(K(T,O4),X.time);return q0($z(w,Y,G,H,z,F,"reject"))}function FM($,T,W,U){let X=M1(W);$==="subtract"&&(X=c6(X));let w=j$(X$(U)),Y=dG(X),G=K(T,u),H=k6(G,K(T,V$),"year-month");H.day=1;let z=JT(G,H,"constrain");if(Y<0){let O=z1(G,z,{months:1},"constrain");z=m6(O.year,O.month,O.day-1)}let F=$D(X);return LW(z),S2(CU(G,k6(G,z1(G,z,F,w),"year-month"),w),G)}function OM($,T,W,U){let X=M1(W);$==="subtract"&&(X=c6(X));let w=j$(X$(U)),Y=K(T,y$),G=K(T,u),H=P2(X);return $6(DU(K(T,Z$),Y,G,H,w),Y,G)}function ET($,T,W){let U=Math.trunc($/T),X=$%T,w=$<0?"negative":"positive",Y=Math.abs(U),G=Y+1,H=h6(Math.abs(2*X)-T),z=Y%2==0,F=iG(W,w),O=X===0?Y:tG(Y,G,H,z,F);return T*(w==="positive"?O:-O)}function LO($,T,W,U){let X=f2[W]*T;return function(w,Y,G){let H=k0(w),z=k0(Y),F=q.divide(H,z),O=q.remainder(H,z),Q=iG(G,"positive"),Z,V;q.lessThan(H,Y1)?(Z=q.subtract(F,vU),V=F):(Z=F,V=q.add(F,vU));let A=bG(OW(q.multiply(O,PO)),z)*(q.lessThan(H,Y1)?-1:1)+0,D=q.equal(O,Y1)?F:tG(Z,V,A,KM(Z),Q);return q.multiply(D,z)}($,q.BigInt(X),U)}function RO($,T,W,U){NO($);let{year:X,month:w,day:Y}=$.isoDate,G=_O($.time,T,W,U);return x$(m6(X,w,Y+G.deltaDays),G)}function _O({hour:$,minute:T,second:W,millisecond:U,microsecond:X,nanosecond:w},Y,G,H){let z;switch(G){case"day":case"hour":z=1000*(1000*(1000*(60*(60*$+T)+W)+U)+X)+w;break;case"minute":z=1000*(1000*(1000*(60*T+W)+U)+X)+w;break;case"second":z=1000*(1000*(1000*W+U)+X)+w;break;case"millisecond":z=1000*(1000*U+X)+w;break;case"microsecond":z=1000*X+w;break;case"nanosecond":z=w}let F=f2[G],O=ET(z,F*Y,H)/F;switch(G){case"day":return{deltaDays:O,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case"hour":return KT(O,0,0,0,0,0);case"minute":return KT($,O,0,0,0,0);case"second":return KT($,T,O,0,0,0);case"millisecond":return KT($,T,W,O,0,0);case"microsecond":return KT($,T,W,U,O,0);case"nanosecond":return KT($,T,W,U,X,O);default:throw new Error(`Invalid unit ${G}`)}}function oG($,T,W,U){let X=f2[W];return $.round(q.BigInt(X*T),U)}function kU($,T){let W=f2[T];return $.fdiv(q.BigInt(W))}function U0($,T){return $.year!==T.year?h6($.year-T.year):$.month!==T.month?h6($.month-T.month):$.day!==T.day?h6($.day-T.day):0}function kO($,T){return $.hour!==T.hour?h6($.hour-T.hour):$.minute!==T.minute?h6($.minute-T.minute):$.second!==T.second?h6($.second-T.second):$.millisecond!==T.millisecond?h6($.millisecond-T.millisecond):$.microsecond!==T.microsecond?h6($.microsecond-T.microsecond):$.nanosecond!==T.nanosecond?h6($.nanosecond-T.nanosecond):0}function y2($,T){let W=U0($.isoDate,T.isoDate);return W!==0?W:kO($.time,T.time)}function YD($){let T=lG($);return globalThis.BigInt!==void 0?globalThis.BigInt(T.toString(10)):T}function N1($,T){let W=k0($),{quotient:U,remainder:X}=QU(W,fU),w=q.toNumber(U);return T==="floor"&&q.toNumber(X)<0&&(w-=1),T==="ceil"&&q.toNumber(X)>0&&(w+=1),w}function x1($){if(!Number.isInteger($))throw new RangeError("epoch milliseconds must be an integer");return q.multiply(q.BigInt($),fU)}function lG($){let T=$;if(typeof $=="object"){let W=$[Symbol.toPrimitive];W&&typeof W=="function"&&(T=W.call($,"number"))}if(typeof T=="number")throw new TypeError("cannot convert number to bigint");return typeof T=="bigint"?q.BigInt(T.toString(10)):q.BigInt(T)}var vO=(()=>{let $=q.BigInt(Date.now()%1e6);return()=>{let T=Date.now(),W=q.BigInt(T),U=q.add(x1(T),$);return $=q.remainder(W,fU),q.greaterThan(U,I2)?I2:q.lessThan(U,PU)?PU:U}})();function FU(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}function h6($){return $<0?-1:$>0?1:$}function X$($){if($===void 0)return Object.create(null);if(Q4($)&&$!==null)return $;throw new TypeError("Options parameter must be an object, not "+($===null?"null":typeof $))}function DW($,T){let W=Object.create(null);return W[$]=T,W}function B0($,T,W,U){let X=$[T];if(X!==void 0){if(X=sG(X),!W.includes(X))throw new RangeError(`${T} must be one of ${W.join(", ")}, not ${X}`);return X}if(U===x0)throw new RangeError(`${T} option is required`);return U}function P6($){let T=IU($);if(!VB.includes(IU(T)))throw new RangeError(`invalid calendar identifier ${T}`);switch(T){case"ethiopic-amete-alem":return"ethioaa";case"islamicc":return"islamic-civil"}return T}function IU($){let T="";for(let W=0;W<$.length;W++){let U=$.charCodeAt(W);T+=U>=65&&U<=90?String.fromCharCode(U+32):String.fromCharCode(U)}return T}function RT($){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 JB=new RegExp(`^${CM.source}$`),LB=new RegExp(`^${/([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?/.source}$`);function GD($,T,W,U=$(T),X=$(W)){let w=T,Y=W,G=U,H=X;for(;Y-w>1;){let z=Math.trunc((w+Y)/2),F=$(z);F===G?(w=z,G=F):F===H&&(Y=z,H=F)}return Y}function zD($){return[...$]}function HD($,T){if($!=="gregory"&&$!=="iso8601")return;let W=rU[$],U=T.year,{dayOfWeek:X,dayOfYear:w,daysInYear:Y}=W.isoToDate(T,{dayOfWeek:!0,dayOfYear:!0,daysInYear:!0}),G=W.getFirstDayOfWeek(),H=W.getMinimalDaysInFirstWeek(),z=(X+7-G)%7,F=(X-w+7001-G)%7,O=Math.floor((w-1+F)/7);if(7-F>=H&&++O,O==0)O=function(Q,Z,V,A){let D=(A-Q-V+1)%7;D<0&&(D+=7);let J=Math.floor((V+D-1)/7);return 7-D>=Z&&++J,J}(G,H,w+W.isoToDate(W.dateAdd(T,{years:-1},"constrain"),{daysInYear:!0}).daysInYear,X),U--;else if(w>=Y-5){let Q=(z+Y-w)%7;Q<0&&(Q+=7),6-Q>=H&&w+7-z>Y&&(O=1,U++)}return{week:O,year:U}}function QM($,T,W,U,X){if(T!==X.year){if($*(T-X.year)>0)return!0}else if(W!==X.month){if($*(W-X.month)>0)return!0}else if(U!==X.day&&$*(U-X.day)>0)return!0;return!1}var rU={};function NW($){if(!$.startsWith("M"))throw new RangeError(`Invalid month code: ${$}. Month codes must start with M.`);let T=+$.slice(1);if(Number.isNaN(T))throw new RangeError(`Invalid month code: ${$}`);return T}function T0($,T=!1){return`M${`${$}`.padStart(2,"0")}${T?"L":""}`}function yO($,T=void 0,W=12){let{month:U,monthCode:X}=$;if(X===void 0){if(U===void 0)throw new TypeError("Either month or monthCode are required");T==="reject"&&c4(U,1,W),T==="constrain"&&(U=L6(U,1,W)),X=T0(U)}else{let w=NW(X);if(X!==T0(w))throw new RangeError(`Invalid month code: ${X}`);if(U!==void 0&&U!==w)throw new RangeError(`monthCode ${X} and month ${U} must match if both are present`);if(U=w,U<1||U>W)throw new RangeError(`Invalid monthCode: ${X}`)}return{...$,month:U,monthCode:X}}rU.iso8601={resolveFields($,T){if((T==="date"||T==="year-month")&&$.year===void 0)throw new TypeError("year is required");if((T==="date"||T==="month-day")&&$.day===void 0)throw new TypeError("day is required");Object.assign($,yO($))},dateToISO:($,T)=>RU($.year,$.month,$.day,T),monthDayToISOReferenceDate($,T){let{month:W,day:U}=RU($.year??1972,$.month,$.day,T);return{month:W,day:U,year:1972}},extraFields:()=>[],fieldKeysToIgnore($){let T=new Set;for(let W=0;W<$.length;W++){let U=$[W];T.add(U),U==="month"?T.add("monthCode"):U==="monthCode"&&T.add("month")}return zD(T)},dateAdd($,{years:T=0,months:W=0,weeks:U=0,days:X=0},w){let{year:Y,month:G,day:H}=$;return Y+=T,G+=W,{year:Y,month:G}=QW(Y,G),{year:Y,month:G,day:H}=RU(Y,G,H,w),H+=X+7*U,m6(Y,G,H)},dateUntil($,T,W){let U=-U0($,T);if(U===0)return{years:0,months:0,weeks:0,days:0};let X,w=0,Y=0;if(W==="year"||W==="month"){let F=T.year-$.year;for(F!==0&&(F-=U);!QM(U,$.year+F,$.month,$.day,T);)w=F,F+=U;let O=U;for(X=QW($.year+w,$.month+O);!QM(U,X.year,X.month,$.day,T);)Y=O,O+=U,X=QW(X.year,X.month+U);W==="month"&&(Y+=12*w,w=0)}X=QW($.year+w,$.month+Y);let G=eM(X.year,X.month,$.day),H=0,z=MW(T.year,T.month-1,T.day)-MW(G.year,G.month-1,G.day);return W==="week"&&(H=Math.trunc(z/7),z%=7),{years:w,months:Y,weeks:H,days:z}},isoToDate({year:$,month:T,day:W},U){let X={era:void 0,eraYear:void 0,year:$,month:T,day:W,daysInWeek:7,monthsInYear:12};if(U.monthCode&&(X.monthCode=T0(T)),U.dayOfWeek){let w=T+(T<3?10:-2),Y=$-(T<3?1:0),G=Math.floor(Y/100),H=Y-100*G,z=(W+Math.floor(2.6*w-0.2)+(H+Math.floor(H/4))+(Math.floor(G/4)-2*G))%7;X.dayOfWeek=z+(z<=0?7:0)}if(U.dayOfYear){let w=W;for(let Y=T-1;Y>0;Y--)w+=VW($,Y);X.dayOfYear=w}return U.weekOfYear&&(X.weekOfYear=HD("iso8601",{year:$,month:T,day:W})),U.daysInMonth&&(X.daysInMonth=VW($,T)),(U.daysInYear||U.inLeapYear)&&(X.inLeapYear=pG($),X.daysInYear=X.inLeapYear?366:365),X},getFirstDayOfWeek:()=>1,getMinimalDaysInFirstWeek:()=>4};class m4{constructor($){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,$!==void 0){let T=0;for(let W of $.map.entries()){if(++T>m4.MAX_CACHE_ENTRIES)break;this.map.set(...W)}}}get($){let T=this.map.get($);return T&&(this.hits++,this.report()),this.calls++,T}set($,T){this.map.set($,T),this.misses++,this.report()}report(){}setObject($){if(m4.objectMap.get($))throw new RangeError("object already cached");m4.objectMap.set($,this),this.report()}static getCacheForObject($){let T=m4.objectMap.get($);return T||(T=new m4,m4.objectMap.set($,T)),T}}function FD({isoYear:$,isoMonth:T,isoDay:W}){return`${lU($)}-${H1(T)}-${H1(W)}T00:00Z`}function wO($,T){return{years:$.year-T.year,months:$.month-T.month,days:$.day-T.day}}m4.objectMap=new WeakMap,m4.MAX_CACHE_ENTRIES=1000;class _T{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 T=this.getFormatter(),W=new Date($);if($==="-271821-04-19T00:00Z"){let U=T.resolvedOptions();T=new Intl.DateTimeFormat(U.locale,{...U,timeZone:"Etc/GMT+1"}),W=new Date("-271821-04-20T00:00Z")}try{return T.formatToParts(W)}catch(U){throw new RangeError(`Invalid ISO date: ${$}`)}}isoToCalendarDate($,T){let{year:W,month:U,day:X}=$,w=JSON.stringify({func:"isoToCalendarDate",isoYear:W,isoMonth:U,isoDay:X,id:this.id}),Y=T.get(w);if(Y)return Y;let G=FD({isoYear:W,isoMonth:U,isoDay:X}),H=this.getCalendarParts(G),z={};for(let O=0;O<H.length;O++){let{type:Q,value:Z}=H[O];if(Q!=="year"&&Q!=="relatedYear"||(this.hasEra?z.eraYear=+Z:z.year=+Z),Q==="month"){let V=/^([0-9]*)(.*?)$/.exec(Z);if(!V||V.length!=3||!V[1]&&!V[2])throw new RangeError(`Unexpected month: ${Z}`);if(z.month=V[1]?+V[1]:1,z.month<1)throw new RangeError(`Invalid month ${Z} from ${G}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(z.month>13)throw new RangeError(`Invalid month ${Z} from ${G}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);V[2]&&(z.monthExtra=V[2])}Q==="day"&&(z.day=+Z),this.hasEra&&Q==="era"&&Z!=null&&Z!==""&&(z.era=Z.split(" (")[0].normalize("NFD").replace(/[^-0-9 \p{L}]/gu,"").replace(/ /g,"-").toLowerCase())}if(this.hasEra&&z.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((Q)=>z.era===Q.genericName);O&&(z.era=O.code)}if(this.reviseIntlEra){let{era:O,eraYear:Q}=this.reviseIntlEra(z,$);z.era=O,z.eraYear=Q}this.checkIcuBugs&&this.checkIcuBugs($);let F=this.adjustCalendarDate(z,T,"constrain",!0);if(F.year===void 0)throw new RangeError(`Missing year converting ${JSON.stringify($)}`);if(F.month===void 0)throw new RangeError(`Missing month converting ${JSON.stringify($)}`);if(F.day===void 0)throw new RangeError(`Missing day converting ${JSON.stringify($)}`);return T.set(w,F),["constrain","reject"].forEach((O)=>{let Q=JSON.stringify({func:"calendarToIsoDate",year:F.year,month:F.month,day:F.day,overflow:O,id:this.id});T.set(Q,$)}),F}validateCalendarDate($){let{month:T,year:W,day:U,eraYear:X,monthCode:w,monthExtra:Y}=$;if(Y!==void 0)throw new RangeError("Unexpected `monthExtra` value");if(W===void 0&&X===void 0)throw new TypeError("year or eraYear is required");if(T===void 0&&w===void 0)throw new TypeError("month or monthCode is required");if(U===void 0)throw new RangeError("Missing day");if(w!==void 0){if(typeof w!="string")throw new RangeError("monthCode must be a string, not "+typeof w);if(!/^M([01]?\d)(L?)$/.test(w))throw new RangeError(`Invalid monthCode: ${w}`)}if(this.hasEra&&$.era===void 0!=($.eraYear===void 0))throw new TypeError("properties era and eraYear must be provided together")}adjustCalendarDate($,T=void 0,W="constrain",U=!1){if(this.calendarType==="lunisolar")throw new RangeError("Override required for lunisolar calendars");let X=$;this.validateCalendarDate(X);let w=this.monthsInYear(X,T),{month:Y,monthCode:G}=X;return{month:Y,monthCode:G}=yO(X,W,w),{...X,month:Y,monthCode:G}}regulateMonthDayNaive($,T,W){let U=this.monthsInYear($,W),{month:X,day:w}=$;return T==="reject"?(c4(X,1,U),c4(w,1,this.maximumMonthLength($))):(X=L6(X,1,U),w=L6(w,1,this.maximumMonthLength({...$,month:X}))),{...$,month:X,day:w}}calendarToIsoDate($,T="constrain",W){let U=$,X=this.adjustCalendarDate($,W,T,!1);X=this.regulateMonthDayNaive(X,T,W);let{year:w,month:Y,day:G}=X,H=JSON.stringify({func:"calendarToIsoDate",year:w,month:Y,day:G,overflow:T,id:this.id}),z,F=W.get(H);if(F)return F;if(U.year!==void 0&&U.month!==void 0&&U.day!==void 0&&(U.year!==X.year||U.month!==X.month||U.day!==X.day)&&(z=JSON.stringify({func:"calendarToIsoDate",year:U.year,month:U.month,day:U.day,overflow:T,id:this.id}),F=W.get(z),F))return F;let O=this.estimateIsoDate({year:w,month:Y,day:G}),Q=(J)=>{let L=this.addDaysIso(O,J);if(X.day>this.minimumMonthLength(X)){let _=this.isoToCalendarDate(L,W);for(;_.month!==Y||_.year!==w;){if(T==="reject")throw new RangeError(`day ${G} does not exist in month ${Y} of year ${w}`);L=this.addDaysIso(L,-1),_=this.isoToCalendarDate(L,W)}}return L},Z=0,V=this.isoToCalendarDate(O,W),A=wO(X,V);if(A.years!==0||A.months!==0||A.days!==0){let J=365*A.years+30*A.months+A.days;O=this.addDaysIso(O,J),V=this.isoToCalendarDate(O,W),A=wO(X,V),A.years===0&&A.months===0?O=Q(A.days):Z=this.compareCalendarDates(X,V)}let D=8;for(;Z;){O=this.addDaysIso(O,Z*D);let J=V;V=this.isoToCalendarDate(O,W);let L=Z;if(Z=this.compareCalendarDates(X,V),Z){if(A=wO(X,V),A.years===0&&A.months===0)O=Q(A.days),Z=0;else if(L&&Z!==L)if(D>1)D/=2;else{if(T==="reject")throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...U})}`);this.compareCalendarDates(V,J)>0&&(O=this.addDaysIso(O,-1)),Z=0}}}if(W.set(H,O),z&&W.set(z,O),X.year===void 0||X.month===void 0||X.day===void 0||X.monthCode===void 0||this.hasEra&&(X.era===void 0||X.eraYear===void 0))throw new RangeError("Unexpected missing property");return O}compareCalendarDates($,T){return $.year!==T.year?h6($.year-T.year):$.month!==T.month?h6($.month-T.month):$.day!==T.day?h6($.day-T.day):0}regulateDate($,T="constrain",W){let U=this.calendarToIsoDate($,T,W);return this.isoToCalendarDate(U,W)}addDaysIso($,T){return m6($.year,$.month,$.day+T)}addDaysCalendar($,T,W){let U=this.calendarToIsoDate($,"constrain",W),X=this.addDaysIso(U,T);return this.isoToCalendarDate(X,W)}addMonthsCalendar($,T,W,U){let X=$,{day:w}=X;for(let Y=0,G=Math.abs(T);Y<G;Y++){let{month:H}=X,z=X,F=T<0?-Math.max(w,this.daysInPreviousMonth(X,U)):this.daysInMonth(X,U),O=this.calendarToIsoDate(X,"constrain",U),Q=this.addDaysIso(O,F);if(X=this.isoToCalendarDate(Q,U),T>0){let Z=this.monthsInYear(z,U);for(;X.month-1!=H%Z;)Q=this.addDaysIso(Q,-1),X=this.isoToCalendarDate(Q,U)}X.day!==w&&(X=this.regulateDate({...X,day:w},"constrain",U))}if(W==="reject"&&X.day!==w)throw new RangeError(`Day ${w} does not exist in resulting calendar month`);return X}addCalendar($,{years:T=0,months:W=0,weeks:U=0,days:X=0},w,Y){let{year:G,day:H,monthCode:z}=$,F=this.adjustCalendarDate({year:G+T,monthCode:z,day:H},Y),O=this.addMonthsCalendar(F,W,w,Y),Q=X+7*U;return this.addDaysCalendar(O,Q,Y)}untilCalendar($,T,W,U){let X=0,w=0,Y=0,G=0;switch(W){case"day":X=this.calendarDaysUntil($,T,U);break;case"week":{let H=this.calendarDaysUntil($,T,U);X=H%7,w=(H-X)/7;break}case"month":case"year":{let H=this.compareCalendarDates(T,$);if(!H)return{years:0,months:0,weeks:0,days:0};let z=T.year-$.year,F=T.day-$.day;if(W==="year"&&z){let Z=0;T.monthCode>$.monthCode&&(Z=1),T.monthCode<$.monthCode&&(Z=-1),Z||(Z=Math.sign(F)),G=Z*H<0?z-H:z}let O,Q=G?this.addCalendar($,{years:G},"constrain",U):$;do Y+=H,O=Q,Q=this.addMonthsCalendar(O,H,"constrain",U),Q.day!==$.day&&(Q=this.regulateDate({...Q,day:$.day},"constrain",U));while(this.compareCalendarDates(T,Q)*H>=0);Y-=H,X=this.calendarDaysUntil(O,T,U);break}}return{years:G,months:Y,weeks:w,days:X}}daysInMonth($,T){let{day:W}=$,U=this.maximumMonthLength($),X=this.minimumMonthLength($);if(X===U)return X;let w=W<=U-X?U:X,Y=this.calendarToIsoDate($,"constrain",T),G=this.addDaysIso(Y,w),H=this.isoToCalendarDate(G,T),z=this.addDaysIso(G,-H.day);return this.isoToCalendarDate(z,T).day}daysInPreviousMonth($,T){let{day:W,month:U,year:X}=$,w={year:U>1?X:X-1,month:U,day:1},Y=U>1?U-1:this.monthsInYear(w,T);w={...w,month:Y};let G=this.minimumMonthLength(w),H=this.maximumMonthLength(w);if(G===H)return H;let z=this.calendarToIsoDate($,"constrain",T),F=this.addDaysIso(z,-W);return this.isoToCalendarDate(F,T).day}startOfCalendarYear($){return{year:$.year,month:1,monthCode:"M01",day:1}}startOfCalendarMonth($){return{year:$.year,month:$.month,day:1}}calendarDaysUntil($,T,W){let U=this.calendarToIsoDate($,"constrain",W),X=this.calendarToIsoDate(T,"constrain",W);return MW(X.year,X.month-1,X.day)-MW(U.year,U.month-1,U.day)}monthDaySearchStartYear($,T){return 1972}monthDayFromFields($,T,W){let U,X,w,Y,G,{era:H,eraYear:z,year:F,month:O,monthCode:Q,day:Z}=$;if(O!==void 0&&F===void 0&&(!this.hasEra||H===void 0||z===void 0))throw new TypeError("when month is present, year (or era and eraYear) are required");(Q===void 0||F!==void 0||this.hasEra&&z!==void 0)&&({monthCode:Q,day:Z}=this.isoToCalendarDate(this.calendarToIsoDate($,T,W),W));let V={year:this.monthDaySearchStartYear(Q,Z),month:12,day:31},A=this.isoToCalendarDate(V,W),D=A.monthCode>Q||A.monthCode===Q&&A.day>=Z?A.year:A.year-1;for(let J=0;J<20;J++){let L=this.adjustCalendarDate({day:Z,monthCode:Q,year:D-J},W),_=this.calendarToIsoDate(L,"constrain",W),C=this.isoToCalendarDate(_,W);if({year:U,month:X,day:w}=_,C.monthCode===Q&&C.day===Z)return{month:X,day:w,year:U};if(T==="constrain"){let f=this.maxLengthOfMonthCodeInAnyYear(C.monthCode);if(C.monthCode===Q&&C.day===f&&Z>f)return{month:X,day:w,year:U};(Y===void 0||C.monthCode===Y.monthCode&&C.day>Y.day)&&(Y=C,G=_)}}if(T==="constrain"&&G!==void 0)return G;throw new RangeError(`No recent ${this.id} year with monthCode ${Q} and day ${Z}`)}getFirstDayOfWeek(){}getMinimalDaysInFirstWeek(){}}class OD extends _T{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:T}=$;return(7*T+1)%19<7}monthsInYear($){return this.inLeapYear($)?13:12}minimumMonthLength($){return this.minMaxMonthLength($,"min")}maximumMonthLength($){return this.minMaxMonthLength($,"max")}minMaxMonthLength($,T){let{month:W,year:U}=$,X=this.getMonthCode(U,W),w=Object.entries(this.months).find((G)=>G[1].monthCode===X);if(w===void 0)throw new RangeError(`unmatched Hebrew month: ${W}`);let Y=w[1].days;return typeof Y=="number"?Y:Y[T]}maxLengthOfMonthCodeInAnyYear($){return["M04","M06","M08","M10","M12"].includes($)?29:30}estimateIsoDate($){let{year:T}=$;return{year:T-3760,month:1,day:1}}getMonthCode($,T){return this.inLeapYear({year:$})?T===6?T0(5,!0):T0(T<6?T:T-1):T0(T)}adjustCalendarDate($,T,W="constrain",U=!1){let{year:X,month:w,monthCode:Y,day:G,monthExtra:H}=$;if(X===void 0)throw new TypeError("Missing property: year");if(U){if(H){let z=this.months[H];if(!z)throw new RangeError(`Unrecognized month from formatToParts: ${H}`);w=this.inLeapYear({year:X})?z.leap:z.regular}return Y=this.getMonthCode(X,w),{year:X,month:w,day:G,monthCode:Y}}if(this.validateCalendarDate($),w===void 0)if(Y.endsWith("L")){if(Y!=="M05L")throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${Y}`);if(w=6,!this.inLeapYear({year:X})){if(W==="reject")throw new RangeError(`Hebrew monthCode M05L is invalid in year ${X} which is not a leap year`);w=6,Y="M06"}}else{w=NW(Y),this.inLeapYear({year:X})&&w>=6&&w++;let z=this.monthsInYear({year:X});if(w<1||w>z)throw new RangeError(`Invalid monthCode: ${Y}`)}else if(W==="reject"?(c4(w,1,this.monthsInYear({year:X})),c4(G,1,this.maximumMonthLength({year:X,month:w}))):(w=L6(w,1,this.monthsInYear({year:X})),G=L6(G,1,this.maximumMonthLength({year:X,month:w}))),Y===void 0)Y=this.getMonthCode(X,w);else if(this.getMonthCode(X,w)!==Y)throw new RangeError(`monthCode ${Y} doesn't correspond to month ${w} in Hebrew year ${X}`);return{...$,day:G,month:w,monthCode:Y,year:X}}}class RW extends _T{constructor(){super(...arguments),this.calendarType="lunar",this.DAYS_PER_ISLAMIC_YEAR=354.3666666666667,this.DAYS_PER_ISO_YEAR=365.2425}inLeapYear($,T){let W={year:$.year,month:1,monthCode:"M01",day:1},U={year:$.year+1,month:1,monthCode:"M01",day:1};return this.calendarDaysUntil(W,U,T)===355}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear(){return 30}estimateIsoDate($){let{year:T}=this.adjustCalendarDate($);return{year:Math.floor(T*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}}class QD extends RW{constructor(){super(...arguments),this.id="islamic"}}class ZD extends RW{constructor(){super(...arguments),this.id="islamic-umalqura"}}class VD extends RW{constructor(){super(...arguments),this.id="islamic-tbla"}}class KD extends RW{constructor(){super(...arguments),this.id="islamic-civil"}}class AD extends RW{constructor(){super(...arguments),this.id="islamic-rgsa"}}class ED extends RW{constructor(){super(...arguments),this.id="islamicc"}}class MD extends _T{constructor(){super(...arguments),this.id="persian",this.calendarType="solar"}inLeapYear($,T){return this.daysInMonth({year:$.year,month:12,day:1},T)===30}monthsInYear(){return 12}minimumMonthLength($){let{month:T}=$;return T===12?29:T<=6?31:30}maximumMonthLength($){let{month:T}=$;return T===12?30:T<=6?31:30}maxLengthOfMonthCodeInAnyYear($){return NW($)<=6?31:30}estimateIsoDate($){let{year:T}=this.adjustCalendarDate($);return{year:T+621,month:1,day:1}}}class DD extends _T{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 hO($.year+78)}monthsInYear(){return 12}minimumMonthLength($){return this.getMonthInfo($).length}maximumMonthLength($){return this.getMonthInfo($).length}maxLengthOfMonthCodeInAnyYear($){let T=NW($),W=this.months[T];return W=W.leap??W,W.length}getMonthInfo($){let{month:T}=$,W=this.months[T];if(W===void 0)throw new RangeError(`Invalid month: ${T}`);return this.inLeapYear($)&&W.leap&&(W=W.leap),W}estimateIsoDate($){let T=this.adjustCalendarDate($),W=this.getMonthInfo(T);return m6(T.year+78+(W.nextYear?1:0),W.month,W.day+T.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 hO($){return $%4==0&&($%100!=0||$%400==0)}class gO extends _T{constructor($,T){super(),this.calendarType="solar",this.id=$,this.isoEpoch=T}inLeapYear($){let{year:T}=this.estimateIsoDate({month:1,day:1,year:$.year});return hO(T)}monthsInYear(){return 12}minimumMonthLength($){let{month:T}=$;return T===2?this.inLeapYear($)?29:28:[4,6,9,11].indexOf(T)>=0?30:31}maximumMonthLength($){return this.minimumMonthLength($)}maxLengthOfMonthCodeInAnyYear($){return[31,29,31,30,31,30,31,31,30,31,30,31][NW($)-1]}estimateIsoDate($){let T=this.adjustCalendarDate($);return RU(T.year+this.isoEpoch.year,T.month+this.isoEpoch.month,T.day+this.isoEpoch.day,"constrain")}}class mO extends _T{constructor($,T){super(),this.hasEra=!0,this.calendarType="solar",this.id=$;let{eras:W,anchorEra:U}=function(X){let w,Y=X;if(Y.length===0)throw new RangeError("Invalid era data: eras are required");if(Y.length===1&&Y[0].reverseOf)throw new RangeError("Invalid era data: anchor era cannot count years backwards");if(Y.length===1&&!Y[0].code)throw new RangeError("Invalid era data: at least one named era is required");if(Y.filter((H)=>H.reverseOf!=null).length>1)throw new RangeError("Invalid era data: only one era can count years backwards");Y.forEach((H)=>{if(H.isAnchor||!H.anchorEpoch&&!H.reverseOf){if(w)throw new RangeError("Invalid era data: cannot have multiple anchor eras");w=H,H.anchorEpoch={year:H.hasYearZero?0:1}}else if(!H.code)throw new RangeError("If era name is blank, it must be the anchor era")}),Y=Y.filter((H)=>H.code),Y.forEach((H)=>{let{reverseOf:z}=H;if(z){let F=Y.find((O)=>O.code===z);if(F===void 0)throw new RangeError(`Invalid era data: unmatched reverseOf era: ${z}`);H.reverseOf=F,H.anchorEpoch=F.anchorEpoch,H.isoEpoch=F.isoEpoch}H.anchorEpoch.month===void 0&&(H.anchorEpoch.month=1),H.anchorEpoch.day===void 0&&(H.anchorEpoch.day=1)}),Y.sort((H,z)=>{if(H.reverseOf)return 1;if(z.reverseOf)return-1;if(!H.isoEpoch||!z.isoEpoch)throw new RangeError("Invalid era data: missing ISO epoch");return z.isoEpoch.year-H.isoEpoch.year});let G=Y[Y.length-1].reverseOf;if(G&&G!==Y[Y.length-2])throw new RangeError("Invalid era data: invalid reverse-sign era");return Y.forEach((H,z)=>{H.genericName="era"+(Y.length-1-z)}),{eras:Y,anchorEra:w||Y[0]}}(T);this.anchorEra=U,this.eras=W}inLeapYear($){let{year:T}=this.estimateIsoDate({month:1,day:1,year:$.year});return hO(T)}monthsInYear(){return 12}minimumMonthLength($){let{month:T}=$;return T===2?this.inLeapYear($)?29:28:[4,6,9,11].indexOf(T)>=0?30:31}maximumMonthLength($){return this.minimumMonthLength($)}maxLengthOfMonthCodeInAnyYear($){return[31,29,31,30,31,30,31,31,30,31,30,31][NW($)-1]}completeEraYear($){let T=(Y,G,H)=>{let z=$[Y];if(z!=null&&z!=G&&!(H||[]).includes(z)){let F=H?.[0];throw new RangeError(`Input ${Y} ${z} doesn't match calculated value ${F?`${G} (also called ${F})`:G}`)}},W=(Y)=>{let G,H={...$,year:Y},z=this.eras.find((F,O)=>{if(O===this.eras.length-1){if(F.reverseOf){if(Y>0)throw new RangeError(`Signed year ${Y} is invalid for era ${F.code}`);return G=F.anchorEpoch.year-Y,!0}return G=Y-F.anchorEpoch.year+(F.hasYearZero?0:1),!0}return this.compareCalendarDates(H,F.anchorEpoch)>=0&&(G=Y-F.anchorEpoch.year+(F.hasYearZero?0:1),!0)});if(!z)throw new RangeError(`Year ${Y} was not matched by any era`);return{eraYear:G,era:z.code,eraNames:z.names}},{year:U,eraYear:X,era:w}=$;if(U!=null){let Y=W(U);({eraYear:X,era:w}=Y),T("era",w,Y?.eraNames),T("eraYear",X)}else{if(X==null)throw new RangeError("Either year or eraYear and era are required");{if(w===void 0)throw new RangeError("era and eraYear must be provided together");let Y=this.eras.find(({code:G,names:H=[]})=>G===w||H.includes(w));if(!Y)throw new RangeError(`Era ${w} (ISO year ${X}) was not matched by any era`);U=Y.reverseOf?Y.anchorEpoch.year-X:X+Y.anchorEpoch.year-(Y.hasYearZero?0:1),T("year",U),{eraYear:X,era:w}=W(U)}}return{...$,year:U,eraYear:X,era:w}}adjustCalendarDate($,T,W="constrain"){let U=$,{month:X,monthCode:w}=U;return X===void 0&&(U={...U,month:NW(w)}),this.validateCalendarDate(U),U=this.completeEraYear(U),super.adjustCalendarDate(U,T,W)}estimateIsoDate($){let T=this.adjustCalendarDate($),{year:W,month:U,day:X}=T,{anchorEra:w}=this;return RU(W+w.isoEpoch.year-(w.hasYearZero?0:1),U,X,"constrain")}}class Yz extends mO{constructor($,T){super($,T)}isoToCalendarDate($){let{year:T,month:W,day:U}=$,X=T0(W),w=T-this.anchorEra.isoEpoch.year+1;return this.completeEraYear({year:w,month:W,monthCode:X,day:U})}}var e1={inLeapYear($){let{year:T}=$;return(T+1)%4==0},monthsInYear:()=>13,minimumMonthLength($){let{month:T}=$;return T===13?this.inLeapYear($)?6:5:30},maximumMonthLength($){return this.minimumMonthLength($)},maxLengthOfMonthCodeInAnyYear:($)=>$==="M13"?6:30};class ND extends gO{constructor($,T){super($,T),this.inLeapYear=e1.inLeapYear,this.monthsInYear=e1.monthsInYear,this.minimumMonthLength=e1.minimumMonthLength,this.maximumMonthLength=e1.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=e1.maxLengthOfMonthCodeInAnyYear}}class cO extends mO{constructor($,T){super($,T),this.inLeapYear=e1.inLeapYear,this.monthsInYear=e1.monthsInYear,this.minimumMonthLength=e1.minimumMonthLength,this.maximumMonthLength=e1.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=e1.maxLengthOfMonthCodeInAnyYear}}class JD extends ND{constructor(){super("ethioaa",{year:-5492,month:7,day:17})}}class LD extends cO{constructor(){super("coptic",[{code:"coptic",isoEpoch:{year:284,month:8,day:29}},{code:"coptic-inverse",reverseOf:"coptic"}])}}class RD extends cO{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 _D extends Yz{constructor(){super("roc",[{code:"roc",names:["minguo"],isoEpoch:{year:1912,month:1,day:1}},{code:"roc-inverse",names:["before-roc"],reverseOf:"roc"}])}}class kD extends gO{constructor(){super("buddhist",{year:-543,month:1,day:1})}}class vD extends Yz{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:T,eraYear:W}=$;return T==="b"&&(T="gregory-inverse"),T==="a"&&(T="gregory"),{era:T,eraYear:W}}getFirstDayOfWeek(){return 1}getMinimalDaysInFirstWeek(){return 1}}class PD extends Yz{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($,T){let{era:W,eraYear:U}=$,{year:X}=T;return this.eras.find((w)=>w.code===W)?{era:W,eraYear:U}:X<1?{era:"japanese-inverse",eraYear:1-X}:{era:"japanese",eraYear:X}}}class uO extends _T{constructor(){super(...arguments),this.calendarType="lunisolar"}inLeapYear($,T){let W=this.getMonthList($.year,T);return Object.entries(W).length===13}monthsInYear($,T){return this.inLeapYear($,T)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear($){return["M01L","M09L","M10L","M11L","M12L"].includes($)?29:30}monthDaySearchStartYear($,T){let W={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 T<30?W[0]:W[1]}getMonthList($,T){if($===void 0)throw new TypeError("Missing year");let W=JSON.stringify({func:"getMonthList",calendarYear:$,id:this.id}),U=T.get(W);if(U)return U;let X=this.getFormatter(),w=(A,D)=>{let J=FD({isoYear:A,isoMonth:2,isoDay:1}),L=new Date(J);L.setUTCDate(D+1);let _=X.formatToParts(L),C=_.find((T$)=>T$.type==="month").value,f=+_.find((T$)=>T$.type==="day").value,b=_.find((T$)=>T$.type==="relatedYear"),g;if(b===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return g=+b.value,{calendarMonthString:C,calendarDay:f,calendarYearToVerify:g}},Y=17,{calendarMonthString:G,calendarDay:H,calendarYearToVerify:z}=w($,Y);G!=="1"&&(Y+=29,{calendarMonthString:G,calendarDay:H}=w($,Y)),Y-=H-5;let F={},O,Q,Z=1,V=!1;do({calendarMonthString:G,calendarDay:H,calendarYearToVerify:z}=w($,Y)),O&&(F[Q].daysInMonth=O+30-H),z!==$?V=!0:(F[G]={monthIndex:Z++},Y+=30),O=H,Q=G;while(!V);return F[Q].daysInMonth=O+30-H,T.set(W,F),F}estimateIsoDate($){let{year:T,month:W}=$;return{year:T,month:W>=12?12:W+1,day:1}}adjustCalendarDate($,T,W="constrain",U=!1){let{year:X,month:w,monthExtra:Y,day:G,monthCode:H}=$;if(X===void 0)throw new TypeError("Missing property: year");if(U){if(Y&&Y!=="bis")throw new RangeError(`Unexpected leap month suffix: ${Y}`);let z=T0(w,Y!==void 0),F=`${w}${Y||""}`,O=this.getMonthList(X,T)[F];if(O===void 0)throw new RangeError(`Unmatched month ${F} in Chinese year ${X}`);return w=O.monthIndex,{year:X,month:w,day:G,monthCode:z}}if(this.validateCalendarDate($),w===void 0){let z=this.getMonthList(X,T),F=H.replace(/^M|L$/g,(Q)=>Q==="L"?"bis":"");F[0]==="0"&&(F=F.slice(1));let O=z[F];if(w=O&&O.monthIndex,w===void 0&&H.endsWith("L")&&H!="M13L"&&W==="constrain"){let Q=+H.replace(/^M0?|L$/g,"");O=z[Q],O&&(w=O.monthIndex,H=T0(Q))}if(w===void 0)throw new RangeError(`Unmatched month ${H} in Chinese year ${X}`)}else if(H===void 0){let z=this.getMonthList(X,T),F=Object.entries(z),O=F.length;W==="reject"?(c4(w,1,O),c4(G,1,this.maximumMonthLength())):(w=L6(w,1,O),G=L6(G,1,this.maximumMonthLength()));let Q=F.find((Z)=>Z[1].monthIndex===w);if(Q===void 0)throw new RangeError(`Invalid month ${w} in Chinese year ${X}`);H=T0(+Q[0].replace("bis",""),Q[0].indexOf("bis")!==-1)}else{let z=this.getMonthList(X,T),F=H.replace(/^M|L$/g,(Q)=>Q==="L"?"bis":"");F[0]==="0"&&(F=F.slice(1));let O=z[F];if(!O)throw new RangeError(`Unmatched monthCode ${H} in Chinese year ${X}`);if(w!==O.monthIndex)throw new RangeError(`monthCode ${H} doesn't correspond to month ${w} in Chinese year ${X}`)}return{...$,year:X,month:w,monthCode:H,day:G}}}class qD extends uO{constructor(){super(...arguments),this.id="chinese"}}class CD extends uO{constructor(){super(...arguments),this.id="dangi"}}class SD{constructor($){this.helper=$}extraFields($){return this.helper.hasEra&&$.includes("year")?["era","eraYear"]:[]}resolveFields($){if(this.helper.calendarType!=="lunisolar"){let T=new m4;yO($,void 0,this.helper.monthsInYear({year:$.year??1972},T))}}dateToISO($,T){let W=new m4,U=this.helper.calendarToIsoDate($,T,W);return W.setObject(U),U}monthDayToISOReferenceDate($,T){let W=new m4,U=this.helper.monthDayFromFields($,T,W);return W.setObject(U),U}fieldKeysToIgnore($){let T=new Set;for(let W=0;W<$.length;W++){let U=$[W];switch(T.add(U),U){case"era":T.add("eraYear"),T.add("year");break;case"eraYear":T.add("era"),T.add("year");break;case"year":T.add("era"),T.add("eraYear");break;case"month":T.add("monthCode"),this.helper.erasBeginMidYear&&(T.add("era"),T.add("eraYear"));break;case"monthCode":T.add("month"),this.helper.erasBeginMidYear&&(T.add("era"),T.add("eraYear"));break;case"day":this.helper.erasBeginMidYear&&(T.add("era"),T.add("eraYear"))}}return zD(T)}dateAdd($,{years:T,months:W,weeks:U,days:X},w){let Y=m4.getCacheForObject($),G=this.helper.isoToCalendarDate($,Y),H=this.helper.addCalendar(G,{years:T,months:W,weeks:U,days:X},w,Y),z=this.helper.calendarToIsoDate(H,"constrain",Y);return m4.getCacheForObject(z)||new m4(Y).setObject(z),z}dateUntil($,T,W){let U=m4.getCacheForObject($),X=m4.getCacheForObject(T),w=this.helper.isoToCalendarDate($,U),Y=this.helper.isoToCalendarDate(T,X);return this.helper.untilCalendar(w,Y,W,U)}isoToDate($,T){let W=m4.getCacheForObject($),U=this.helper.isoToCalendarDate($,W);if(T.dayOfWeek&&(U.dayOfWeek=rU.iso8601.isoToDate($,{dayOfWeek:!0}).dayOfWeek),T.dayOfYear){let X=this.helper.startOfCalendarYear(U),w=this.helper.calendarDaysUntil(X,U,W);U.dayOfYear=w+1}if(T.weekOfYear&&(U.weekOfYear=HD(this.helper.id,$)),U.daysInWeek=7,T.daysInMonth&&(U.daysInMonth=this.helper.daysInMonth(U,W)),T.daysInYear){let X=this.helper.startOfCalendarYear(U),w=this.helper.addCalendar(X,{years:1},"constrain",W);U.daysInYear=this.helper.calendarDaysUntil(X,w,W)}return T.monthsInYear&&(U.monthsInYear=this.helper.monthsInYear(U,W)),T.inLeapYear&&(U.inLeapYear=this.helper.inLeapYear(U,W)),U}getFirstDayOfWeek(){return this.helper.getFirstDayOfWeek()}getMinimalDaysInFirstWeek(){return this.helper.getMinimalDaysInFirstWeek()}}for(let $ of[OD,MD,RD,JD,LD,qD,CD,_D,DD,kD,vD,PD,QD,ZD,VD,KD,AD,ED]){let T=new $;rU[T.id]=new SD(T)}QO("calendarImpl",function($){return rU[$]});var xU=Intl.DateTimeFormat;function R2($,T){let W=K($,T);return typeof W=="function"&&(W=new xU(K($,kM),W(K($,zO))),function(U,X,w){let Y=nG(U);if(Y===void 0)throw new TypeError("Missing slots for the given container");if(Y[X]===void 0)throw new TypeError(`tried to reset ${X} which was not set`);Y[X]=w}($,T,W)),W}function OU($){return v6($,JW)}class h2{constructor($=void 0,T=void 0){(function(W,U,X){let w=X!==void 0,Y;if(w){let F=["localeMatcher","calendar","numberingSystem","hour12","hourCycle","timeZone","weekday","era","year","month","day","dayPeriod","hour","minute","second","fractionalSecondDigits","timeZoneName","formatMatcher","dateStyle","timeStyle"];Y=function(Q){if(Q==null)throw new TypeError(`Expected object not ${Q}`);return Object(Q)}(X);let O=Object.create(null);for(let Q=0;Q<F.length;Q++){let Z=F[Q];Object.prototype.hasOwnProperty.call(Y,Z)&&(O[Z]=Y[Z])}Y=O}else Y=Object.create(null);let G=new xU(U,Y),H=G.resolvedOptions();if(f0(W),w){let F=Object.assign(Object.create(null),H);for(let O in F)Object.prototype.hasOwnProperty.call(Y,O)||delete F[O];F.hour12=Y.hour12,F.hourCycle=Y.hourCycle,_$(W,zO,F)}else _$(W,zO,Y);_$(W,kM,H.locale),_$(W,JW,G),_$(W,v2,H.timeZone),_$(W,ZU,H.calendar),_$(W,DM,jB),_$(W,NM,CB),_$(W,JM,SB),_$(W,LM,qB),_$(W,RM,BB),_$(W,_M,IB);let z=w?Y.timeZone:void 0;if(z===void 0)_$(W,GO,H.timeZone);else{let F=sG(z);if(F.startsWith("\u2212"))throw new RangeError("Unicode minus (U+2212) is not supported in time zone offsets");_$(W,GO,_6(F))}})(this,$,T)}get format(){S(this,OU);let $=_B.bind(this);return Object.defineProperties($,{length:{value:1,enumerable:!1,writable:!1,configurable:!0},name:{value:"",enumerable:!1,writable:!1,configurable:!0}}),$}formatRange($,T){return S(this,OU),vB.call(this,$,T)}formatToParts($,...T){return S(this,OU),kB.call(this,$,...T)}formatRangeToParts($,T){return S(this,OU),PB.call(this,$,T)}resolvedOptions(){return S(this,OU),RB.call(this)}}"formatToParts"in xU.prototype||delete h2.prototype.formatToParts,"formatRangeToParts"in xU.prototype||delete h2.prototype.formatRangeToParts;var G1=function($=void 0,T=void 0){return new h2($,T)};function RB(){let $=K(this,JW).resolvedOptions();return $.timeZone=K(this,GO),$}function _B($,...T){let W,U,X=g2($,this);return X.formatter?(W=X.formatter,U=[N1(X.epochNs,"floor")]):(W=K(this,JW),U=[$,...T]),W.format(...U)}function kB($,...T){let W,U,X=g2($,this);return X.formatter?(W=X.formatter,U=[N1(X.epochNs,"floor")]):(W=K(this,JW),U=[$,...T]),W.formatToParts(...U)}function vB($,T){if($===void 0||T===void 0)throw new TypeError("Intl.DateTimeFormat.formatRange requires two values");let W=rG($),U=rG(T),X,w=[W,U];if(I0(W)!==I0(U))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");if(I0(W)){if(!jD(W,U))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");let{epochNs:Y,formatter:G}=g2(W,this),{epochNs:H,formatter:z}=g2(U,this);G&&(X=G,w=[N1(Y,"floor"),N1(H,"floor")])}return X||(X=K(this,JW)),X.formatRange(...w)}function PB($,T){if($===void 0||T===void 0)throw new TypeError("Intl.DateTimeFormat.formatRange requires two values");let W=rG($),U=rG(T),X,w=[W,U];if(I0(W)!==I0(U))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");if(I0(W)){if(!jD(W,U))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");let{epochNs:Y,formatter:G}=g2(W,this),{epochNs:H,formatter:z}=g2(U,this);G&&(X=G,w=[N1(Y,"floor"),N1(H,"floor")])}return X||(X=K(this,JW)),X.formatRangeToParts(...w)}function nU($={},T={}){let W=Object.assign({},$),U=["year","month","day","hour","minute","second","weekday","dayPeriod","timeZoneName","dateStyle","timeStyle"];for(let X=0;X<U.length;X++){let w=U[X];W[w]=w in T?T[w]:W[w],W[w]!==!1&&W[w]!==void 0||delete W[w]}return W}function qB($){let T=nU($,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});if(T.timeStyle!=="long"&&T.timeStyle!=="full"||(delete T.timeStyle,Object.assign(T,{hour:"numeric",minute:"2-digit",second:"2-digit"})),!zz(T)){if(iU($))throw new TypeError(`cannot format Temporal.PlainTime with options [${Object.keys($)}]`);Object.assign(T,{hour:"numeric",minute:"numeric",second:"numeric"})}return T}function CB($){let T={short:{year:"2-digit",month:"numeric"},medium:{year:"numeric",month:"short"},long:{year:"numeric",month:"long"},full:{year:"numeric",month:"long"}},W=nU($,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if("dateStyle"in W&&W.dateStyle){let U=W.dateStyle;delete W.dateStyle,Object.assign(W,T[U])}if(!(("year"in W)||("month"in W)||("era"in W))){if(iU($))throw new TypeError(`cannot format PlainYearMonth with options [${Object.keys($)}]`);Object.assign(W,{year:"numeric",month:"numeric"})}return W}function SB($){let T={short:{month:"numeric",day:"numeric"},medium:{month:"short",day:"numeric"},long:{month:"long",day:"numeric"},full:{month:"long",day:"numeric"}},W=nU($,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if("dateStyle"in W&&W.dateStyle){let U=W.dateStyle;delete W.dateStyle,Object.assign(W,T[U])}if(!("month"in W)&&!("day"in W)){if(iU($))throw new TypeError(`cannot format PlainMonthDay with options [${Object.keys($)}]`);Object.assign(W,{month:"numeric",day:"numeric"})}return W}function jB($){let T=nU($,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(!Gz(T)){if(iU($))throw new TypeError(`cannot format PlainDate with options [${Object.keys($)}]`);Object.assign(T,{year:"numeric",month:"numeric",day:"numeric"})}return T}function BB($){let T=nU($,{timeZoneName:!1});if((T.timeStyle==="long"||T.timeStyle==="full")&&(delete T.timeStyle,Object.assign(T,{hour:"numeric",minute:"2-digit",second:"2-digit"}),T.dateStyle))Object.assign(T,{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"}}[T.dateStyle]),delete T.dateStyle;if(!zz(T)&&!Gz(T)){if(iU($))throw new TypeError(`cannot format PlainDateTime with options [${Object.keys($)}]`);Object.assign(T,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}return T}function IB($){let T=$;return zz(T)||Gz(T)||(T=Object.assign({},T,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),T}function Gz($){return"year"in $||"month"in $||"day"in $||"weekday"in $||"dateStyle"in $||"era"in $}function zz($){return"hour"in $||"minute"in $||"second"in $||"timeStyle"in $||"dayPeriod"in $||"fractionalSecondDigits"in $}function iU($){return Gz($)||zz($)||"dateStyle"in $||"timeStyle"in $||"timeZoneName"in $}function I0($){return F4($)||A4($)||i$($)||v$($)||r4($)||w1($)||l4($)}function rG($){return I0($)?$:aG($)}function jD($,T){return!(!I0($)||!I0(T)||A4($)&&!A4(T)||F4($)&&!F4(T)||i$($)&&!i$(T)||v$($)&&!v$(T)||r4($)&&!r4(T)||w1($)&&!w1(T)||l4($)&&!l4(T))}function g2($,T){if(A4($)){let W={isoDate:{year:1970,month:1,day:1},time:K($,O4)};return{epochNs:W6(K(T,v2),W,"compatible"),formatter:R2(T,LM)}}if(r4($)){let W=K($,u),U=K(T,ZU);if(W!==U)throw new RangeError(`cannot format PlainYearMonth with calendar ${W} in locale with calendar ${U}`);let X=x$(K($,V$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:W6(K(T,v2),X,"compatible"),formatter:R2(T,NM)}}if(w1($)){let W=K($,u),U=K(T,ZU);if(W!==U)throw new RangeError(`cannot format PlainMonthDay with calendar ${W} in locale with calendar ${U}`);let X=x$(K($,V$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:W6(K(T,v2),X,"compatible"),formatter:R2(T,JM)}}if(F4($)){let W=K($,u),U=K(T,ZU);if(W!=="iso8601"&&W!==U)throw new RangeError(`cannot format PlainDate with calendar ${W} in locale with calendar ${U}`);let X=x$(K($,V$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:W6(K(T,v2),X,"compatible"),formatter:R2(T,DM)}}if(i$($)){let W=K($,u),U=K(T,ZU);if(W!=="iso8601"&&W!==U)throw new RangeError(`cannot format PlainDateTime with calendar ${W} in locale with calendar ${U}`);let X=K($,X4);return{epochNs:W6(K(T,v2),X,"compatible"),formatter:R2(T,RM)}}if(v$($))throw new TypeError("Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.");return l4($)?{epochNs:K($,Z$),formatter:R2(T,_M)}:{}}function BD($){let T=Object.create(null);return T.years=K($,V6),T.months=K($,K6),T.weeks=K($,b6),T.days=K($,A6),T.hours=K($,E6),T.minutes=K($,M6),T.seconds=K($,D6),T.milliseconds=K($,N6),T.microseconds=K($,J6),T.nanoseconds=K($,y6),T}h2.prototype.constructor=G1,Object.defineProperty(G1,"prototype",{value:h2.prototype,writable:!1,enumerable:!1,configurable:!1}),G1.supportedLocalesOf=xU.supportedLocalesOf,b0(G1,"Intl.DateTimeFormat");var{format:xB,formatToParts:fB}=Intl.DurationFormat?.prototype??Object.create(null);function pO($){Intl.DurationFormat.prototype.resolvedOptions.call(this);let T=BD(M1($));return xB.call(this,T)}Intl.DurationFormat?.prototype&&(Intl.DurationFormat.prototype.format=pO,Intl.DurationFormat.prototype.formatToParts=function($){Intl.DurationFormat.prototype.resolvedOptions.call(this);let T=BD(M1($));return fB.call(this,T)});var tt=Object.freeze({__proto__:null,DateTimeFormat:G1,ModifiedIntlDurationFormatPrototypeFormat:pO});class Hz{constructor($){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");dM(this,lG($))}get epochMilliseconds(){return S(this,l4),N1(K(this,Z$),"floor")}get epochNanoseconds(){return S(this,l4),YD(q.BigInt(K(this,Z$)))}add($){return S(this,l4),YM("add",this,$)}subtract($){return S(this,l4),YM("subtract",this,$)}until($,T=void 0){return S(this,l4),eE("until",this,$,T)}since($,T=void 0){return S(this,l4),eE("since",this,$,T)}round($){if(S(this,l4),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?DW("smallestUnit",$):X$($),W=u2(T),U=f1(T,"halfExpand"),X=g6(T,"smallestUnit","time",x0);return p2(W,{hour:24,minute:1440,second:86400,millisecond:86400000,microsecond:86400000000,nanosecond:86400000000000}[X],!0),I1(LO(K(this,Z$),W,X,U))}equals($){S(this,l4);let T=AU($),W=K(this,Z$),U=K(T,Z$);return q.equal(q.BigInt(W),q.BigInt(U))}toString($=void 0){S(this,l4);let T=X$($),W=gU(T),U=f1(T,"trunc"),X=g6(T,"smallestUnit","time",void 0);if(X==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let w=T.timeZone;w!==void 0&&(w=_6(w));let{precision:Y,unit:G,increment:H}=mU(X,W);return dE(I1(LO(K(this,Z$),H,G,U)),w,Y)}toJSON(){return S(this,l4),dE(this,void 0,"auto")}toLocaleString($=void 0,T=void 0){return S(this,l4),new G1($,T).format(this)}valueOf(){RT("Instant")}toZonedDateTimeISO($){S(this,l4);let T=_6($);return $6(K(this,Z$),T,"iso8601")}static fromEpochMilliseconds($){return I1(x1(aG($)))}static fromEpochNanoseconds($){return I1(lG($))}static from($){return AU($)}static compare($,T){let W=AU($),U=AU(T),X=K(W,Z$),w=K(U,Z$);return q.lessThan(X,w)?-1:q.greaterThan(X,w)?1:0}}b0(Hz,"Temporal.Instant");class Fz{constructor($,T,W,U="iso8601"){let X=A$($),w=A$(T),Y=A$(W),G=P6(U===void 0?"iso8601":B4(U));AW(X,w,Y),gM(this,{year:X,month:w,day:Y},G)}get calendarId(){return S(this,F4),K(this,u)}get era(){return O6(this,"era")}get eraYear(){return O6(this,"eraYear")}get year(){return O6(this,"year")}get month(){return O6(this,"month")}get monthCode(){return O6(this,"monthCode")}get day(){return O6(this,"day")}get dayOfWeek(){return O6(this,"dayOfWeek")}get dayOfYear(){return O6(this,"dayOfYear")}get weekOfYear(){return O6(this,"weekOfYear")?.week}get yearOfWeek(){return O6(this,"weekOfYear")?.year}get daysInWeek(){return O6(this,"daysInWeek")}get daysInMonth(){return O6(this,"daysInMonth")}get daysInYear(){return O6(this,"daysInYear")}get monthsInYear(){return O6(this,"monthsInYear")}get inLeapYear(){return O6(this,"inLeapYear")}with($,T=void 0){if(S(this,F4),!Q4($))throw new TypeError("invalid argument");c2($);let W=K(this,u),U=k6(W,K(this,V$));return U=KW(W,U,F1(W,$,["year","month","monthCode","day"],[],"partial")),R6(JT(W,U,j$(X$(T))),W)}withCalendar($){S(this,F4);let T=dU($);return R6(K(this,V$),T)}add($,T=void 0){return S(this,F4),GM("add",this,$,T)}subtract($,T=void 0){return S(this,F4),GM("subtract",this,$,T)}until($,T=void 0){return S(this,F4),$M("until",this,$,T)}since($,T=void 0){return S(this,F4),$M("since",this,$,T)}equals($){S(this,F4);let T=VU($);return U0(K(this,V$),K(T,V$))===0&&W0(K(this,u),K(T,u))}toString($=void 0){return S(this,F4),oE(this,hU(X$($)))}toJSON(){return S(this,F4),oE(this)}toLocaleString($=void 0,T=void 0){return S(this,F4),new G1($,T).format(this)}valueOf(){RT("PlainDate")}toPlainDateTime($=void 0){S(this,F4);let T=hM($);return A1(x$(K(this,V$),T),K(this,u))}toZonedDateTime($){let T,W;if(S(this,F4),Q4($)){let w=$.timeZone;w===void 0?T=_6($):(T=_6(w),W=$.plainTime)}else T=_6($);let U=K(this,V$),X;return W===void 0?X=VT(T,U):(W=AT(W),X=W6(T,x$(U,K(W,O4)),"compatible")),$6(X,T,K(this,u))}toPlainYearMonth(){S(this,F4);let $=K(this,u);return S2(CU($,k6($,K(this,V$)),"constrain"),$)}toPlainMonthDay(){S(this,F4);let $=K(this,u);return C2(cG($,k6($,K(this,V$)),"constrain"),$)}static from($,T=void 0){return VU($,T)}static compare($,T){let W=VU($),U=VU(T);return U0(K(W,V$),K(U,V$))}}function O6($,T){S($,F4);let W=K($,V$);return cU($).isoToDate(W,{[T]:!0})[T]}b0(Fz,"Temporal.PlainDate");class Oz{constructor($,T,W,U=0,X=0,w=0,Y=0,G=0,H=0,z="iso8601"){let F=A$($),O=A$(T),Q=A$(W),Z=U===void 0?0:A$(U),V=X===void 0?0:A$(X),A=w===void 0?0:A$(w),D=Y===void 0?0:A$(Y),J=G===void 0?0:A$(G),L=H===void 0?0:A$(H),_=P6(z===void 0?"iso8601":B4(z));IO(F,O,Q,Z,V,A,D,J,L),mM(this,{isoDate:{year:F,month:O,day:Q},time:{hour:Z,minute:V,second:A,millisecond:D,microsecond:J,nanosecond:L}},_)}get calendarId(){return S(this,i$),K(this,u)}get year(){return Q6(this,"year")}get month(){return Q6(this,"month")}get monthCode(){return Q6(this,"monthCode")}get day(){return Q6(this,"day")}get hour(){return _2(this,"hour")}get minute(){return _2(this,"minute")}get second(){return _2(this,"second")}get millisecond(){return _2(this,"millisecond")}get microsecond(){return _2(this,"microsecond")}get nanosecond(){return _2(this,"nanosecond")}get era(){return Q6(this,"era")}get eraYear(){return Q6(this,"eraYear")}get dayOfWeek(){return Q6(this,"dayOfWeek")}get dayOfYear(){return Q6(this,"dayOfYear")}get weekOfYear(){return Q6(this,"weekOfYear")?.week}get yearOfWeek(){return Q6(this,"weekOfYear")?.year}get daysInWeek(){return Q6(this,"daysInWeek")}get daysInYear(){return Q6(this,"daysInYear")}get daysInMonth(){return Q6(this,"daysInMonth")}get monthsInYear(){return Q6(this,"monthsInYear")}get inLeapYear(){return Q6(this,"inLeapYear")}with($,T=void 0){if(S(this,i$),!Q4($))throw new TypeError("invalid argument");c2($);let W=K(this,u),U=K(this,X4),X={...k6(W,U.isoDate),...U.time};return X=KW(W,X,F1(W,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond"],"partial")),A1(uU(W,X,j$(X$(T))),W)}withPlainTime($=void 0){S(this,i$);let T=hM($);return A1(x$(K(this,X4).isoDate,T),K(this,u))}withCalendar($){S(this,i$);let T=dU($);return A1(K(this,X4),T)}add($,T=void 0){return S(this,i$),zM("add",this,$,T)}subtract($,T=void 0){return S(this,i$),zM("subtract",this,$,T)}until($,T=void 0){return S(this,i$),TM("until",this,$,T)}since($,T=void 0){return S(this,i$),TM("since",this,$,T)}round($){if(S(this,i$),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?DW("smallestUnit",$):X$($),W=u2(T),U=f1(T,"halfExpand"),X=g6(T,"smallestUnit","time",x0,["day"]),w={day:1,hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[X];p2(W,w,w===1);let Y=K(this,X4);return A1(W===1&&X==="nanosecond"?Y:RO(Y,W,X,U),K(this,u))}equals($){S(this,i$);let T=KU($);return y2(K(this,X4),K(T,X4))===0&&W0(K(this,u),K(T,u))}toString($=void 0){S(this,i$);let T=X$($),W=hU(T),U=gU(T),X=f1(T,"trunc"),w=g6(T,"smallestUnit","time",void 0);if(w==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:Y,unit:G,increment:H}=mU(w,U),z=RO(K(this,X4),H,G,X);return EW(z),jU(z,K(this,u),Y,W)}toJSON(){return S(this,i$),jU(K(this,X4),K(this,u),"auto")}toLocaleString($=void 0,T=void 0){return S(this,i$),new G1($,T).format(this)}valueOf(){RT("PlainDateTime")}toZonedDateTime($,T=void 0){S(this,i$);let W=_6($),U=_U(X$(T));return $6(W6(W,K(this,X4),U),W,K(this,u))}toPlainDate(){return S(this,i$),R6(K(this,X4).isoDate,K(this,u))}toPlainTime(){return S(this,i$),q0(K(this,X4).time)}static from($,T=void 0){return KU($,T)}static compare($,T){let W=KU($),U=KU(T);return y2(K(W,X4),K(U,X4))}}function Q6($,T){S($,i$);let W=K($,X4).isoDate;return cU($).isoToDate(W,{[T]:!0})[T]}function _2($,T){return S($,i$),K($,X4).time[T]}b0(Oz,"Temporal.PlainDateTime");class m2{constructor($=0,T=0,W=0,U=0,X=0,w=0,Y=0,G=0,H=0,z=0){let F=$===void 0?0:B1($),O=T===void 0?0:B1(T),Q=W===void 0?0:B1(W),Z=U===void 0?0:B1(U),V=X===void 0?0:B1(X),A=w===void 0?0:B1(w),D=Y===void 0?0:B1(Y),J=G===void 0?0:B1(G),L=H===void 0?0:B1(H),_=z===void 0?0:B1(z);Uz(F,O,Q,Z,V,A,D,J,L,_),f0(this),_$(this,V6,F),_$(this,K6,O),_$(this,b6,Q),_$(this,A6,Z),_$(this,E6,V),_$(this,M6,A),_$(this,D6,D),_$(this,N6,J),_$(this,J6,L),_$(this,y6,_)}get years(){return S(this,H4),K(this,V6)}get months(){return S(this,H4),K(this,K6)}get weeks(){return S(this,H4),K(this,b6)}get days(){return S(this,H4),K(this,A6)}get hours(){return S(this,H4),K(this,E6)}get minutes(){return S(this,H4),K(this,M6)}get seconds(){return S(this,H4),K(this,D6)}get milliseconds(){return S(this,H4),K(this,N6)}get microseconds(){return S(this,H4),K(this,J6)}get nanoseconds(){return S(this,H4),K(this,y6)}get sign(){return S(this,H4),dG(this)}get blank(){return S(this,H4),dG(this)===0}with($){S(this,H4);let T=yM($),{years:W=K(this,V6),months:U=K(this,K6),weeks:X=K(this,b6),days:w=K(this,A6),hours:Y=K(this,E6),minutes:G=K(this,M6),seconds:H=K(this,D6),milliseconds:z=K(this,N6),microseconds:F=K(this,J6),nanoseconds:O=K(this,y6)}=T;return new m2(W,U,X,w,Y,G,H,z,F,O)}negated(){return S(this,H4),c6(this)}abs(){return S(this,H4),new m2(Math.abs(K(this,V6)),Math.abs(K(this,K6)),Math.abs(K(this,b6)),Math.abs(K(this,A6)),Math.abs(K(this,E6)),Math.abs(K(this,M6)),Math.abs(K(this,D6)),Math.abs(K(this,N6)),Math.abs(K(this,J6)),Math.abs(K(this,y6)))}add($){return S(this,H4),wM("add",this,$)}subtract($){return S(this,H4),wM("subtract",this,$)}round($){if(S(this,H4),$===void 0)throw new TypeError("options parameter is required");let T=v0(this),W=typeof $=="string"?DW("smallestUnit",$):X$($),U=g6(W,"largestUnit","datetime",void 0,["auto"]),{plainRelativeTo:X,zonedRelativeTo:w}=UO(W),Y=u2(W),G=f1(W,"halfExpand"),H=g6(W,"smallestUnit","datetime",void 0),z=!0;H||(z=!1,H="nanosecond");let F=S0(T,H),O=!0;if(U||(O=!1,U=F),U==="auto"&&(U=F),!z&&!O)throw new RangeError("at least one of smallestUnit or largestUnit is required");if(S0(U,H)!==U)throw new RangeError(`largestUnit ${U} cannot be smaller than smallestUnit ${H}`);let Q={hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[H];if(Q!==void 0&&p2(Y,Q,!1),Y>1&&P0(H)==="date"&&U!==H)throw new RangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit");if(w){let V=P2(this),A=K(w,y$),D=K(w,u),J=K(w,Z$);return V=wD(J,DU(J,A,D,V),A,D,U,Y,H,G),P0(U)==="date"&&(U="hour"),E1(V,U)}if(X){let V=$0(this),A=b2({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},V.time),D=K(X,V$),J=K(X,u),L=z1(J,D,T6(V.date,A.deltaDays),"constrain");return V=UD(x$(D,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),x$(L,A),J,U,Y,H,G),E1(V,U)}if(s1(T))throw new RangeError(`a starting point is required for ${T}s balancing`);if(s1(U))throw new RangeError(`a starting point is required for ${U}s balancing`);let Z=$0(this);if(H==="day"){let{quotient:V,remainder:A}=Z.time.divmod(hG),D=Z.date.days+V+kU(A,"day");D=ET(D,Y,G),Z=j0({years:0,months:0,weeks:0,days:D},P$.ZERO)}else Z=j0({years:0,months:0,weeks:0,days:0},oG(Z.time,Y,H,G));return E1(Z,U)}total($){if(S(this,H4),$===void 0)throw new TypeError("options argument is required");let T=typeof $=="string"?DW("unit",$):X$($),{plainRelativeTo:W,zonedRelativeTo:U}=UO(T),X=g6(T,"unit","datetime",x0);if(U){let Y=P2(this),G=K(U,y$),H=K(U,u),z=K(U,Z$);return function(F,O,Q,Z,V){return P0(V)==="time"?kU(P$.fromEpochNsDiff(O,F),V):sE(WD(F,O,Q,Z,V),O,D1(Q,F),Q,Z,V)}(z,DU(z,G,H,Y),G,H,X)}if(W){let Y=$0(this),G=b2({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},Y.time),H=K(W,V$),z=K(W,u),F=z1(z,H,T6(Y.date,G.deltaDays),"constrain");return function(O,Q,Z,V){if(y2(O,Q)==0)return 0;EW(O),EW(Q);let A=TD(O,Q,Z,V);return V==="nanosecond"?q.toNumber(A.time.totalNs):sE(A,n4(Q),O,null,Z,V)}(x$(H,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),x$(F,G),z,X)}let w=v0(this);if(s1(w))throw new RangeError(`a starting point is required for ${w}s total`);if(s1(X))throw new RangeError(`a starting point is required for ${X}s total`);return kU($0(this).time,X)}toString($=void 0){S(this,H4);let T=X$($),W=gU(T),U=f1(T,"trunc"),X=g6(T,"smallestUnit","time",void 0);if(X==="hour"||X==="minute")throw new RangeError('smallestUnit must be a time unit other than "hours" or "minutes"');let{precision:w,unit:Y,increment:G}=mU(X,W);if(Y==="nanosecond"&&G===1)return xG(this,w);let H=v0(this),z=P2(this),F=oG(z.time,G,Y,U);return z=j0(z.date,F),xG(E1(z,S0(H,"second")),w)}toJSON(){return S(this,H4),xG(this,"auto")}toLocaleString($=void 0,T=void 0){if(S(this,H4),typeof Intl.DurationFormat=="function"){let W=new Intl.DurationFormat($,T);return pO.call(W,this)}return console.warn("Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat."),xG(this,"auto")}valueOf(){RT("Duration")}static from($){return M1($)}static compare($,T,W=void 0){let U=M1($),X=M1(T),w=X$(W),{plainRelativeTo:Y,zonedRelativeTo:G}=UO(w);if(K(U,V6)===K(X,V6)&&K(U,K6)===K(X,K6)&&K(U,b6)===K(X,b6)&&K(U,A6)===K(X,A6)&&K(U,E6)===K(X,E6)&&K(U,M6)===K(X,M6)&&K(U,D6)===K(X,D6)&&K(U,N6)===K(X,N6)&&K(U,J6)===K(X,J6)&&K(U,y6)===K(X,y6))return 0;let H=v0(U),z=v0(X),F=P2(U),O=P2(X);if(G&&(P0(H)==="date"||P0(z)==="date")){let D=K(G,y$),J=K(G,u),L=K(G,Z$),_=DU(L,D,J,F),C=DU(L,D,J,O);return h6(q.toNumber(q.subtract(_,C)))}let Q=F.date.days,Z=O.date.days;if(s1(H)||s1(z)){if(!Y)throw new RangeError("A starting point is required for years, months, or weeks comparison");Q=aE(F.date,Y),Z=aE(O.date,Y)}let V=F.time.add24HourDays(Q),A=O.time.add24HourDays(Z);return V.cmp(A)}}b0(m2,"Temporal.Duration");class Qz{constructor($,T,W="iso8601",U=1972){let X=A$($),w=A$(T),Y=P6(W===void 0?"iso8601":B4(W)),G=A$(U);AW(G,X,w),cM(this,{year:G,month:X,day:w},Y)}get monthCode(){return ZM(this,"monthCode")}get day(){return ZM(this,"day")}get calendarId(){return S(this,w1),K(this,u)}with($,T=void 0){if(S(this,w1),!Q4($))throw new TypeError("invalid argument");c2($);let W=K(this,u),U=k6(W,K(this,V$),"month-day");return U=KW(W,U,F1(W,$,["year","month","monthCode","day"],[],"partial")),C2(cG(W,U,j$(X$(T))),W)}equals($){S(this,w1);let T=uE($);return U0(K(this,V$),K(T,V$))===0&&W0(K(this,u),K(T,u))}toString($=void 0){return S(this,w1),rE(this,hU(X$($)))}toJSON(){return S(this,w1),rE(this)}toLocaleString($=void 0,T=void 0){return S(this,w1),new G1($,T).format(this)}valueOf(){RT("PlainMonthDay")}toPlainDate($){if(S(this,w1),!Q4($))throw new TypeError("argument should be an object");let T=K(this,u);return R6(JT(T,KW(T,k6(T,K(this,V$),"month-day"),F1(T,$,["year"],[],[])),"constrain"),T)}static from($,T=void 0){return uE($,T)}}function ZM($,T){S($,w1);let W=K($,V$);return cU($).isoToDate(W,{[T]:!0})[T]}function YO($){return D1($,vO())}b0(Qz,"Temporal.PlainMonthDay");var ID={instant:()=>I1(vO()),plainDateTimeISO:($=FU())=>A1(YO(_6($)),"iso8601"),plainDateISO:($=FU())=>R6(YO(_6($)).isoDate,"iso8601"),plainTimeISO:($=FU())=>q0(YO(_6($)).time),timeZoneId:()=>FU(),zonedDateTimeISO:($=FU())=>{let T=_6($);return $6(vO(),T,"iso8601")},[Symbol.toStringTag]:"Temporal.Now"};Object.defineProperty(ID,Symbol.toStringTag,{value:"Temporal.Now",writable:!1,enumerable:!1,configurable:!0});class tU{constructor($=0,T=0,W=0,U=0,X=0,w=0){let Y=$===void 0?0:A$($),G=T===void 0?0:A$(T),H=W===void 0?0:A$(W),z=U===void 0?0:A$(U),F=X===void 0?0:A$(X),O=w===void 0?0:A$(w);Xz(Y,G,H,z,F,O),uM(this,{hour:Y,minute:G,second:H,millisecond:z,microsecond:F,nanosecond:O})}get hour(){return S(this,A4),K(this,O4).hour}get minute(){return S(this,A4),K(this,O4).minute}get second(){return S(this,A4),K(this,O4).second}get millisecond(){return S(this,A4),K(this,O4).millisecond}get microsecond(){return S(this,A4),K(this,O4).microsecond}get nanosecond(){return S(this,A4),K(this,O4).nanosecond}with($,T=void 0){if(S(this,A4),!Q4($))throw new TypeError("invalid argument");c2($);let W=AO($,"partial"),U=AO(this),{hour:X,minute:w,second:Y,millisecond:G,microsecond:H,nanosecond:z}=Object.assign(U,W),F=j$(X$(T));return{hour:X,minute:w,second:Y,millisecond:G,microsecond:H,nanosecond:z}=$z(X,w,Y,G,H,z,F),new tU(X,w,Y,G,H,z)}add($){return S(this,A4),HM("add",this,$)}subtract($){return S(this,A4),HM("subtract",this,$)}until($,T=void 0){return S(this,A4),WM("until",this,$,T)}since($,T=void 0){return S(this,A4),WM("since",this,$,T)}round($){if(S(this,A4),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?DW("smallestUnit",$):X$($),W=u2(T),U=f1(T,"halfExpand"),X=g6(T,"smallestUnit","time",x0);return p2(W,{hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[X],!1),q0(_O(K(this,O4),W,X,U))}equals($){S(this,A4);let T=AT($);return kO(K(this,O4),K(T,O4))===0}toString($=void 0){S(this,A4);let T=X$($),W=gU(T),U=f1(T,"trunc"),X=g6(T,"smallestUnit","time",void 0);if(X==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:w,unit:Y,increment:G}=mU(X,W);return lE(_O(K(this,O4),G,Y,U),w)}toJSON(){return S(this,A4),lE(K(this,O4),"auto")}toLocaleString($=void 0,T=void 0){return S(this,A4),new G1($,T).format(this)}valueOf(){RT("PlainTime")}static from($,T=void 0){return AT($,T)}static compare($,T){let W=AT($),U=AT(T);return kO(K(W,O4),K(U,O4))}}b0(tU,"Temporal.PlainTime");class Zz{constructor($,T,W="iso8601",U=1){let X=A$($),w=A$(T),Y=P6(W===void 0?"iso8601":B4(W)),G=A$(U);AW(X,w,G),pM(this,{year:X,month:w,day:G},Y)}get year(){return _0(this,"year")}get month(){return _0(this,"month")}get monthCode(){return _0(this,"monthCode")}get calendarId(){return S(this,r4),K(this,u)}get era(){return _0(this,"era")}get eraYear(){return _0(this,"eraYear")}get daysInMonth(){return _0(this,"daysInMonth")}get daysInYear(){return _0(this,"daysInYear")}get monthsInYear(){return _0(this,"monthsInYear")}get inLeapYear(){return _0(this,"inLeapYear")}with($,T=void 0){if(S(this,r4),!Q4($))throw new TypeError("invalid argument");c2($);let W=K(this,u),U=k6(W,K(this,V$),"year-month");return U=KW(W,U,F1(W,$,["year","month","monthCode"],[],"partial")),S2(CU(W,U,j$(X$(T))),W)}add($,T=void 0){return S(this,r4),FM("add",this,$,T)}subtract($,T=void 0){return S(this,r4),FM("subtract",this,$,T)}until($,T=void 0){return S(this,r4),XM("until",this,$,T)}since($,T=void 0){return S(this,r4),XM("since",this,$,T)}equals($){S(this,r4);let T=EU($);return U0(K(this,V$),K(T,V$))===0&&W0(K(this,u),K(T,u))}toString($=void 0){return S(this,r4),nE(this,hU(X$($)))}toJSON(){return S(this,r4),nE(this)}toLocaleString($=void 0,T=void 0){return S(this,r4),new G1($,T).format(this)}valueOf(){RT("PlainYearMonth")}toPlainDate($){if(S(this,r4),!Q4($))throw new TypeError("argument should be an object");let T=K(this,u);return R6(JT(T,KW(T,k6(T,K(this,V$),"year-month"),F1(T,$,["day"],[],[])),"constrain"),T)}static from($,T=void 0){return EU($,T)}static compare($,T){let W=EU($),U=EU(T);return U0(K(W,V$),K(U,V$))}}function _0($,T){S($,r4);let W=K($,V$);return cU($).isoToDate(W,{[T]:!0})[T]}b0(Zz,"Temporal.PlainYearMonth");var bB=G1.prototype.resolvedOptions;class Vz{constructor($,T,W="iso8601"){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");let U=lG($),X=B4(T),{tzName:w,offsetMinutes:Y}=MT(X);if(Y===void 0){let G=uG(w);if(!G)throw new RangeError(`unknown time zone ${w}`);X=G.identifier}else X=SO(Y);oM(this,U,X,P6(W===void 0?"iso8601":B4(W)))}get calendarId(){return S(this,v$),K(this,u)}get timeZoneId(){return S(this,v$),K(this,y$)}get year(){return Z6(this,"year")}get month(){return Z6(this,"month")}get monthCode(){return Z6(this,"monthCode")}get day(){return Z6(this,"day")}get hour(){return k2(this,"hour")}get minute(){return k2(this,"minute")}get second(){return k2(this,"second")}get millisecond(){return k2(this,"millisecond")}get microsecond(){return k2(this,"microsecond")}get nanosecond(){return k2(this,"nanosecond")}get era(){return Z6(this,"era")}get eraYear(){return Z6(this,"eraYear")}get epochMilliseconds(){return S(this,v$),N1(K(this,Z$),"floor")}get epochNanoseconds(){return S(this,v$),YD(K(this,Z$))}get dayOfWeek(){return Z6(this,"dayOfWeek")}get dayOfYear(){return Z6(this,"dayOfYear")}get weekOfYear(){return Z6(this,"weekOfYear")?.week}get yearOfWeek(){return Z6(this,"weekOfYear")?.year}get hoursInDay(){S(this,v$);let $=K(this,y$),T=a1(this).isoDate,W=m6(T.year,T.month,T.day+1),U=VT($,T),X=VT($,W);return kU(P$.fromEpochNsDiff(X,U),"hour")}get daysInWeek(){return Z6(this,"daysInWeek")}get daysInMonth(){return Z6(this,"daysInMonth")}get daysInYear(){return Z6(this,"daysInYear")}get monthsInYear(){return Z6(this,"monthsInYear")}get inLeapYear(){return Z6(this,"inLeapYear")}get offset(){return S(this,v$),EO(C0(K(this,y$),K(this,Z$)))}get offsetNanoseconds(){return S(this,v$),C0(K(this,y$),K(this,Z$))}with($,T=void 0){if(S(this,v$),!Q4($))throw new TypeError("invalid zoned-date-time-like");c2($);let W=K(this,u),U=K(this,y$),X=C0(U,K(this,Z$)),w=a1(this),Y={...k6(W,w.isoDate),...w.time,offset:EO(X)};Y=KW(W,Y,F1(W,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset"],"partial"));let G=X$(T),H=_U(G),z=fG(G,"prefer"),F=uU(W,Y,j$(G)),O=d2(Y.offset);return $6(mG(F.isoDate,F.time,"option",O,U,H,z,!1),U,W)}withPlainTime($=void 0){S(this,v$);let T=K(this,y$),W=K(this,u),U=a1(this).isoDate,X;return X=$===void 0?VT(T,U):W6(T,x$(U,K(AT($),O4)),"compatible"),$6(X,T,W)}withTimeZone($){S(this,v$);let T=_6($);return $6(K(this,Z$),T,K(this,u))}withCalendar($){S(this,v$);let T=dU($);return $6(K(this,Z$),K(this,y$),T)}add($,T=void 0){return S(this,v$),OM("add",this,$,T)}subtract($,T=void 0){return S(this,v$),OM("subtract",this,$,T)}until($,T=void 0){return S(this,v$),UM("until",this,$,T)}since($,T=void 0){return S(this,v$),UM("since",this,$,T)}round($){if(S(this,v$),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?DW("smallestUnit",$):X$($),W=u2(T),U=f1(T,"halfExpand"),X=g6(T,"smallestUnit","time",x0,["day"]),w={day:1,hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[X];if(p2(W,w,w===1),X==="nanosecond"&&W===1)return $6(K(this,Z$),K(this,y$),K(this,u));let Y=K(this,y$),G=K(this,Z$),H=a1(this),z;if(X==="day"){let F=H.isoDate,O=m6(F.year,F.month,F.day+1),Q=VT(Y,F),Z=VT(Y,O),V=q.subtract(Z,Q);z=P$.fromEpochNsDiff(G,Q).round(V,U).addToEpochNs(Q)}else{let F=RO(H,W,X,U),O=C0(Y,G);z=mG(F.isoDate,F.time,"option",O,Y,"compatible","prefer",!1)}return $6(z,Y,K(this,u))}equals($){S(this,v$);let T=MU($),W=K(this,Z$),U=K(T,Z$);return!!q.equal(q.BigInt(W),q.BigInt(U))&&!!lM(K(this,y$),K(T,y$))&&W0(K(this,u),K(T,u))}toString($=void 0){S(this,v$);let T=X$($),W=hU(T),U=gU(T),X=function(O){return B0(O,"offset",["auto","never"],"auto")}(T),w=f1(T,"trunc"),Y=g6(T,"smallestUnit","time",void 0);if(Y==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let G=function(O){return B0(O,"timeZoneName",["auto","never","critical"],"auto")}(T),{precision:H,unit:z,increment:F}=mU(Y,U);return iE(this,H,W,G,X,{unit:z,increment:F,roundingMode:w})}toLocaleString($=void 0,T=void 0){S(this,v$);let W=X$(T),U=Object.create(null);if(function(G,H,z,F){if(H==null)return;let O=Reflect.ownKeys(H);for(let Q=0;Q<O.length;Q++){let Z=O[Q];if(!z.some((V)=>Object.is(V,Z))&&Object.prototype.propertyIsEnumerable.call(H,Z)){let V=H[Z];G[Z]=V}}}(U,W,["timeZone"]),W.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=K(this,y$),tE(U.timeZone))throw new RangeError("toLocaleString does not currently support offset time zones");let X=new G1($,U),w=bB.call(X).calendar,Y=K(this,u);if(Y!=="iso8601"&&w!=="iso8601"&&!W0(w,Y))throw new RangeError(`cannot format ZonedDateTime with calendar ${Y} in locale with calendar ${w}`);return X.format(I1(K(this,Z$)))}toJSON(){return S(this,v$),iE(this,"auto")}valueOf(){RT("ZonedDateTime")}startOfDay(){S(this,v$);let $=K(this,y$);return $6(VT($,a1(this).isoDate),$,K(this,u))}getTimeZoneTransition($){S(this,v$);let T=K(this,y$);if($===void 0)throw new TypeError("options parameter is required");let W=B0(typeof $=="string"?DW("direction",$):X$($),"direction",["next","previous"],x0);if(W===void 0)throw new TypeError("direction option is required");if(tE(T)||T==="UTC")return null;let U=K(this,Z$),X=W==="next"?BO(T,U):DO(T,U);return X===null?null:$6(X,T,K(this,u))}toInstant(){return S(this,v$),I1(K(this,Z$))}toPlainDate(){return S(this,v$),R6(a1(this).isoDate,K(this,u))}toPlainTime(){return S(this,v$),q0(a1(this).time)}toPlainDateTime(){return S(this,v$),A1(a1(this),K(this,u))}static from($,T=void 0){return MU($,T)}static compare($,T){let W=MU($),U=MU(T),X=K(W,Z$),w=K(U,Z$);return q.lessThan(q.BigInt(X),q.BigInt(w))?-1:q.greaterThan(q.BigInt(X),q.BigInt(w))?1:0}}function a1($){return D1(K($,y$),K($,Z$))}function Z6($,T){S($,v$);let W=a1($).isoDate;return cU($).isoToDate(W,{[T]:!0})[T]}function k2($,T){return S($,v$),a1($).time[T]}b0(Vz,"Temporal.ZonedDateTime");var Kz=Object.freeze({__proto__:null,Duration:m2,Instant:Hz,Now:ID,PlainDate:Fz,PlainDateTime:Oz,PlainMonthDay:Qz,PlainTime:tU,PlainYearMonth:Zz,ZonedDateTime:Vz}),at=class ${toTemporalInstant(){return I1(x1(Date.prototype.valueOf.call(this)))}}.prototype.toTemporalInstant,yB=[Hz,Fz,Oz,m2,Qz,tU,Zz,Vz];for(let $ of yB){let T=Object.getOwnPropertyDescriptor($,"prototype");(T.configurable||T.enumerable||T.writable)&&(T.configurable=!1,T.enumerable=!1,T.writable=!1,Object.defineProperty($,"prototype",T))}class Az{supported;constructor($){this.supported=$}refine($){for(let[T,W]of Object.entries(this.supported))try{if(W($)===!0&&W!==Boolean)return{type:T,data:$}}catch(U){try{if($ instanceof W)return{type:T,data:$}}catch(X){}}return null}}var hB=new Az({number:($)=>typeof $==="number",string:($)=>typeof $==="string",boolean:($)=>typeof $==="boolean",null:($)=>$===null});function gB($){if(!$)return!1;return Object.getPrototypeOf($)===Object.prototype}var mB=new Az({object:gB,array:($)=>Array.isArray($)}),cB=new Az({...hB.supported,...mB.supported}),xD=($)=>{if($===void 0)return"undefined";let T=cB.refine($);if(T)return T.type;return Object.getPrototypeOf($).constructor.name};var N=Symbol.for("drizzle:entityKind"),$a=Symbol.for("drizzle:hasOwnEntityKind");function B($,T){if(!$||typeof $!=="object")return!1;if($ instanceof T)return!0;if(!Object.prototype.hasOwnProperty.call(T,N))throw new Error(`Class "${T.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 W=Object.getPrototypeOf($).constructor;if(W)while(W){if(N in W&&W[N]===T[N])return!0;W=Object.getPrototypeOf(W)}return!1}class p${constructor($,T){this.table=$,this.config=T,this.name=T.name,this.keyAsName=T.keyAsName,this.notNull=T.notNull,this.default=T.default,this.defaultFn=T.defaultFn,this.onUpdateFn=T.onUpdateFn,this.hasDefault=T.hasDefault,this.primary=T.primaryKey,this.isUnique=T.isUnique,this.uniqueName=T.uniqueName,this.uniqueType=T.uniqueType,this.dataType=T.dataType,this.columnType=T.columnType,this.generated=T.generated,this.generatedIdentity=T.generatedIdentity}static[N]="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 dO{static[N]="ColumnBuilder";config;constructor($,T,W){this.config={name:$,keyAsName:$==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:T,columnType:W,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 b1=Symbol.for("drizzle:Name");class oO{static[N]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor($,T){if(this.reference=()=>{let{name:W,columns:U,foreignColumns:X}=$();return{name:W,columns:U,foreignTable:X[0].table,foreignColumns:X}},T)this._onUpdate=T.onUpdate,this._onDelete=T.onDelete}onUpdate($){return this._onUpdate=$===void 0?"no action":$,this}onDelete($){return this._onDelete=$===void 0?"no action":$,this}build($){return new fD($,this)}}class fD{constructor($,T){this.table=$,this.reference=T.reference,this.onUpdate=T._onUpdate,this.onDelete=T._onDelete}static[N]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:$,columns:T,foreignColumns:W}=this.reference(),U=T.map((Y)=>Y.name),X=W.map((Y)=>Y.name),w=[this.table[b1],...U,W[0].table[b1],...X];return $??`${w.join("_")}_fk`}}function Ez($,...T){return $(...T)}function bD($,T){return`${$[b1]}_${T.join("_")}_unique`}function yD($,T,W){for(let U=T;U<$.length;U++){let X=$[U];if(X==="\\"){U++;continue}if(X==='"')return[$.slice(T,U).replace(/\\/g,""),U+1];if(W)continue;if(X===","||X==="}")return[$.slice(T,U).replace(/\\/g,""),U]}return[$.slice(T).replace(/\\/g,""),$.length]}function hD($,T=0){let W=[],U=T,X=!1;while(U<$.length){let w=$[U];if(w===","){if(X||U===T)W.push("");X=!0,U++;continue}if(X=!1,w==="\\"){U+=2;continue}if(w==='"'){let[H,z]=yD($,U+1,!0);W.push(H),U=z;continue}if(w==="}")return[W,U+1];if(w==="{"){let[H,z]=hD($,U+1);W.push(H),U=z;continue}let[Y,G]=yD($,U,!1);W.push(Y),U=G}return[W,U]}function gD($){let[T]=hD($,1);return T}function lO($){return`{${$.map((T)=>{if(Array.isArray(T))return lO(T);if(typeof T==="string")return`"${T.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${T}`}).join(",")}}`}class e extends dO{foreignKeyConfigs=[];static[N]="PgColumnBuilder";array($){return new cD(this.config.name,this,$)}references($,T={}){return this.foreignKeyConfigs.push({ref:$,actions:T}),this}unique($,T){return this.config.isUnique=!0,this.config.uniqueName=$,this.config.uniqueType=T?.nulls,this}generatedAlwaysAs($){return this.config.generated={as:$,type:"always",mode:"stored"},this}buildForeignKeys($,T){return this.foreignKeyConfigs.map(({ref:W,actions:U})=>{return Ez((X,w)=>{let Y=new oO(()=>{let G=X();return{columns:[$],foreignColumns:[G]}});if(w.onUpdate)Y.onUpdate(w.onUpdate);if(w.onDelete)Y.onDelete(w.onDelete);return Y.build(T)},W,U)})}buildExtraConfigColumn($){return new mD($,this.config)}}class d extends p${constructor($,T){if(!T.uniqueName)T.uniqueName=bD($,[T.name]);super($,T);this.table=$}static[N]="PgColumn"}class mD extends d{static[N]="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 aU{static[N]="IndexedColumn";constructor($,T,W,U){this.name=$,this.keyAsName=T,this.type=W,this.indexConfig=U}name;keyAsName;type;indexConfig}class cD extends e{static[N]="PgArrayBuilder";constructor($,T,W){super($,"array","PgArray");this.config.baseBuilder=T,this.config.size=W}build($){let T=this.config.baseBuilder.build($);return new rO($,this.config,T)}}class rO extends d{constructor($,T,W,U){super($,T);this.baseColumn=W,this.range=U,this.size=T.size}size;static[N]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==="number"?this.size:""}]`}mapFromDriverValue($){if(typeof $==="string")$=gD($);return $.map((T)=>this.baseColumn.mapFromDriverValue(T))}mapToDriverValue($,T=!1){let W=$.map((U)=>U===null?null:B(this.baseColumn,rO)?this.baseColumn.mapToDriverValue(U,!0):this.baseColumn.mapToDriverValue(U));if(T)return W;return lO(W)}}class uD extends e{static[N]="PgEnumObjectColumnBuilder";constructor($,T){super($,"string","PgEnumObjectColumn");this.config.enum=T}build($){return new pD($,this.config)}}class pD extends d{static[N]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor($,T){super($,T);this.enum=T.enum}getSQLType(){return this.enum.enumName}}var Mz=Symbol.for("drizzle:isPgEnum");function dD($){return!!$&&typeof $==="function"&&Mz in $&&$[Mz]===!0}class oD extends e{static[N]="PgEnumColumnBuilder";constructor($,T){super($,"string","PgEnumColumn");this.config.enum=T}build($){return new lD($,this.config)}}class lD extends d{static[N]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor($,T){super($,T);this.enum=T.enum}getSQLType(){return this.enum.enumName}}function sU($,T){return Array.isArray(T)?uB($,[...T],void 0):pB($,T,void 0)}function uB($,T,W){let U=Object.assign((X)=>new oD(X??"",U),{enumName:$,enumValues:T,schema:W,[Mz]:!0});return U}function pB($,T,W){let U=Object.assign((X)=>new uD(X??"",U),{enumName:$,enumValues:Object.values(T),schema:W,[Mz]:!0});return U}class M4{static[N]="Subquery";constructor($,T,W,U=!1,X=[]){this._={brand:"Subquery",sql:$,selectedFields:T,alias:W,isWith:U,usedTables:X}}}class eU extends M4{static[N]="WithSubquery"}var rD="0.44.2";var nO,iO,d$={startActiveSpan($,T){if(!nO)return T();if(!iO)iO=nO.trace.getTracer("drizzle-orm",rD);return Ez((W,U)=>U.startActiveSpan($,(X)=>{try{return T(X)}catch(w){throw X.setStatus({code:W.SpanStatusCode.ERROR,message:w instanceof Error?w.message:"Unknown error"}),w}finally{X.end()}}),nO,iO)}};var t$=Symbol.for("drizzle:ViewBaseConfig");var _W=Symbol.for("drizzle:Schema"),Dz=Symbol.for("drizzle:Columns"),nD=Symbol.for("drizzle:ExtraConfigColumns"),tO=Symbol.for("drizzle:OriginalName"),aO=Symbol.for("drizzle:BaseName"),$w=Symbol.for("drizzle:IsAlias"),iD=Symbol.for("drizzle:ExtraConfigBuilder"),dB=Symbol.for("drizzle:IsDrizzleTable");class l{static[N]="Table";static Symbol={Name:b1,Schema:_W,OriginalName:tO,Columns:Dz,ExtraConfigColumns:nD,BaseName:aO,IsAlias:$w,ExtraConfigBuilder:iD};[b1];[tO];[_W];[Dz];[nD];[aO];[$w]=!1;[dB]=!0;[iD]=void 0;constructor($,T,W){this[b1]=this[tO]=$,this[_W]=T,this[aO]=W}}function u4($){return $[b1]}function kW($){return`${$[_W]??"public"}.${$[b1]}`}function sO($){return $!==null&&$!==void 0&&typeof $.getSQL==="function"}function oB($){let T={sql:"",params:[]};for(let W of $)if(T.sql+=W.sql,T.params.push(...W.params),W.typings?.length){if(!T.typings)T.typings=[];T.typings.push(...W.typings)}return T}class I4{static[N]="StringChunk";value;constructor($){this.value=Array.isArray($)?$:[$]}getSQL(){return new a([this])}}class a{constructor($){this.queryChunks=$;for(let T of $)if(B(T,l)){let W=T[l.Symbol.Schema];this.usedTables.push(W===void 0?T[l.Symbol.Name]:W+"."+T[l.Symbol.Name])}}static[N]="SQL";decoder=aD;shouldInlineParams=!1;usedTables=[];append($){return this.queryChunks.push(...$.queryChunks),this}toQuery($){return d$.startActiveSpan("drizzle.buildSQL",(T)=>{let W=this.buildQueryFromSourceParams(this.queryChunks,$);return T?.setAttributes({"drizzle.query.text":W.sql,"drizzle.query.params":JSON.stringify(W.params)}),W})}buildQueryFromSourceParams($,T){let W=Object.assign({},T,{inlineParams:T.inlineParams||this.shouldInlineParams,paramStartIndex:T.paramStartIndex||{value:0}}),{casing:U,escapeName:X,escapeParam:w,prepareTyping:Y,inlineParams:G,paramStartIndex:H}=W;return oB($.map((z)=>{if(B(z,I4))return{sql:z.value.join(""),params:[]};if(B(z,Nz))return{sql:X(z.value),params:[]};if(z===void 0)return{sql:"",params:[]};if(Array.isArray(z)){let F=[new I4("(")];for(let[O,Q]of z.entries())if(F.push(Q),O<z.length-1)F.push(new I4(", "));return F.push(new I4(")")),this.buildQueryFromSourceParams(F,W)}if(B(z,a))return this.buildQueryFromSourceParams(z.queryChunks,{...W,inlineParams:G||z.shouldInlineParams});if(B(z,l)){let F=z[l.Symbol.Schema],O=z[l.Symbol.Name];return{sql:F===void 0||z[$w]?X(O):X(F)+"."+X(O),params:[]}}if(B(z,p$)){let F=U.getColumnCasing(z);if(T.invokeSource==="indexes")return{sql:X(F),params:[]};let O=z.table[l.Symbol.Schema];return{sql:z.table[$w]||O===void 0?X(z.table[l.Symbol.Name])+"."+X(F):X(O)+"."+X(z.table[l.Symbol.Name])+"."+X(F),params:[]}}if(B(z,u6)){let F=z[t$].schema,O=z[t$].name;return{sql:F===void 0||z[t$].isAlias?X(O):X(F)+"."+X(O),params:[]}}if(B(z,O1)){if(B(z.value,kT))return{sql:w(H.value++,z),params:[z],typings:["none"]};let F=z.value===null?null:z.encoder.mapToDriverValue(z.value);if(B(F,a))return this.buildQueryFromSourceParams([F],W);if(G)return{sql:this.mapInlineParam(F,W),params:[]};let O=["none"];if(Y)O=[Y(z.encoder)];return{sql:w(H.value++,F),params:[F],typings:O}}if(B(z,kT))return{sql:w(H.value++,z),params:[z],typings:["none"]};if(B(z,a.Aliased)&&z.fieldAlias!==void 0)return{sql:X(z.fieldAlias),params:[]};if(B(z,M4)){if(z._.isWith)return{sql:X(z._.alias),params:[]};return this.buildQueryFromSourceParams([new I4("("),z._.sql,new I4(") "),new Nz(z._.alias)],W)}if(dD(z)){if(z.schema)return{sql:X(z.schema)+"."+X(z.enumName),params:[]};return{sql:X(z.enumName),params:[]}}if(sO(z)){if(z.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([z.getSQL()],W);return this.buildQueryFromSourceParams([new I4("("),z.getSQL(),new I4(")")],W)}if(G)return{sql:this.mapInlineParam(z,W),params:[]};return{sql:w(H.value++,z),params:[z],typings:["none"]}}))}mapInlineParam($,{escapeString:T}){if($===null)return"null";if(typeof $==="number"||typeof $==="boolean")return $.toString();if(typeof $==="string")return T($);if(typeof $==="object"){let W=$.toString();if(W==="[object Object]")return T(JSON.stringify($));return T(W)}throw new Error("Unexpected param value: "+$)}getSQL(){return this}as($){if($===void 0)return this;return new a.Aliased(this,$)}mapWith($){return this.decoder=typeof $==="function"?{mapFromDriverValue:$}:$,this}inlineParams(){return this.shouldInlineParams=!0,this}if($){return $?this:void 0}}class Nz{constructor($){this.value=$}static[N]="Name";brand;getSQL(){return new a([this])}}function tD($){return typeof $==="object"&&$!==null&&"mapToDriverValue"in $&&typeof $.mapToDriverValue==="function"}var aD={mapFromDriverValue:($)=>$},sD={mapToDriverValue:($)=>$},ua={...aD,...sD};class O1{constructor($,T=sD){this.value=$,this.encoder=T}static[N]="Param";brand;getSQL(){return new a([this])}}function R($,...T){let W=[];if(T.length>0||$.length>0&&$[0]!=="")W.push(new I4($[0]));for(let[U,X]of T.entries())W.push(X,new I4($[U+1]));return new a(W)}(($)=>{function T(){return new a([])}$.empty=T;function W(H){return new a(H)}$.fromList=W;function U(H){return new a([new I4(H)])}$.raw=U;function X(H,z){let F=[];for(let[O,Q]of H.entries()){if(O>0&&z!==void 0)F.push(z);F.push(Q)}return new a(F)}$.join=X;function w(H){return new Nz(H)}$.identifier=w;function Y(H){return new kT(H)}$.placeholder=Y;function G(H,z){return new O1(H,z)}$.param=G})(R||(R={}));(($)=>{class T{constructor(W,U){this.sql=W,this.fieldAlias=U}static[N]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new T(this.sql,this.fieldAlias)}}$.Aliased=T})(a||(a={}));class kT{constructor($){this.name=$}static[N]="Placeholder";getSQL(){return new a([this])}}function eO($,T){return $.map((W)=>{if(B(W,kT)){if(!(W.name in T))throw new Error(`No value for placeholder "${W.name}" was provided`);return T[W.name]}if(B(W,O1)&&B(W.value,kT)){if(!(W.value.name in T))throw new Error(`No value for placeholder "${W.value.name}" was provided`);return W.encoder.mapToDriverValue(T[W.value.name])}return W})}var lB=Symbol.for("drizzle:IsDrizzleView");class u6{static[N]="View";[t$];[lB]=!0;constructor({name:$,schema:T,selectedFields:W,query:U}){this[t$]={name:$,originalName:$,schema:T,selectedFields:W,query:U,isExisting:!U,isAlias:!1}}getSQL(){return new a([this])}}p$.prototype.getSQL=function(){return new a([this])};l.prototype.getSQL=function(){return new a([this])};M4.prototype.getSQL=function(){return new a([this])};class l2{constructor($){this.table=$}static[N]="ColumnAliasProxyHandler";get($,T){if(T==="table")return this.table;return $[T]}}class Tw{constructor($,T){this.alias=$,this.replaceOriginalName=T}static[N]="TableAliasProxyHandler";get($,T){if(T===l.Symbol.IsAlias)return!0;if(T===l.Symbol.Name)return this.alias;if(this.replaceOriginalName&&T===l.Symbol.OriginalName)return this.alias;if(T===t$)return{...$[t$],name:this.alias,isAlias:!0};if(T===l.Symbol.Columns){let U=$[l.Symbol.Columns];if(!U)return U;let X={};return Object.keys(U).map((w)=>{X[w]=new Proxy(U[w],new l2(new Proxy($,this)))}),X}let W=$[T];if(B(W,p$))return new Proxy(W,new l2(new Proxy($,this)));return W}}function Jz($,T){return new Proxy($,new Tw(T,!1))}function Y0($,T){return new Proxy($,new l2(new Proxy($.table,new Tw(T,!1))))}function $Q($,T){return new a.Aliased(Ww($.sql,T),$.fieldAlias)}function Ww($,T){return R.join($.queryChunks.map((W)=>{if(B(W,p$))return Y0(W,T);if(B(W,a))return Ww(W,T);if(B(W,a.Aliased))return $Q(W,T);return W}))}class Lz extends Error{static[N]="DrizzleError";constructor({message:$,cause:T}){super($);this.name="DrizzleError",this.cause=T}}class TQ extends Lz{static[N]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class eD{static[N]="ConsoleLogWriter";write($){console.log($)}}class WQ{static[N]="DefaultLogger";writer;constructor($){this.writer=$?.writer??new eD}logQuery($,T){let W=T.map((X)=>{try{return JSON.stringify(X)}catch{return String(X)}}),U=W.length?` -- params: [${W.join(", ")}]`:"";this.writer.write(`Query: ${$}${U}`)}}class XQ{static[N]="NoopLogger";logQuery(){}}class q6{static[N]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch($){return this.then(void 0,$)}finally($){return this.then((T)=>{return $?.(),T},(T)=>{throw $?.(),T})}then($,T){return this.execute().then($,T)}}function $N($,T,W){let U={},X=$.reduce((w,{path:Y,field:G},H)=>{let z;if(B(G,p$))z=G;else if(B(G,a))z=G.decoder;else z=G.sql.decoder;let F=w;for(let[O,Q]of Y.entries())if(O<Y.length-1){if(!(Q in F))F[Q]={};F=F[Q]}else{let Z=T[H],V=F[Q]=Z===null?null:z.mapFromDriverValue(Z);if(W&&B(G,p$)&&Y.length===2){let A=Y[0];if(!(A in U))U[A]=V===null?u4(G.table):!1;else if(typeof U[A]==="string"&&U[A]!==u4(G.table))U[A]=!1}}return w},{});if(W&&Object.keys(U).length>0){for(let[w,Y]of Object.entries(U))if(typeof Y==="string"&&!W[Y])X[w]=null}return X}function J1($,T){return Object.entries($).reduce((W,[U,X])=>{if(typeof U!=="string")return W;let w=T?[...T,U]:[U];if(B(X,p$)||B(X,a)||B(X,a.Aliased))W.push({path:w,field:X});else if(B(X,l))W.push(...J1(X[l.Symbol.Columns],w));else W.push(...J1(X,w));return W},[])}function Xw($,T){let W=Object.keys($),U=Object.keys(T);if(W.length!==U.length)return!1;for(let[X,w]of W.entries())if(w!==U[X])return!1;return!0}function Rz($,T){let W=Object.entries(T).filter(([,U])=>U!==void 0).map(([U,X])=>{if(B(X,a)||B(X,p$))return[U,X];else return[U,new O1(X,$[l.Symbol.Columns][U])]});if(W.length===0)throw new Error("No values to set");return Object.fromEntries(W)}function TN($,T){for(let W of T)for(let U of Object.getOwnPropertyNames(W.prototype)){if(U==="constructor")continue;Object.defineProperty($.prototype,U,Object.getOwnPropertyDescriptor(W.prototype,U)||Object.create(null))}}function WN($){return $[l.Symbol.Columns]}function y0($){return B($,M4)?$._.alias:B($,u6)?$[t$].name:B($,a)?void 0:$[l.Symbol.IsAlias]?$[l.Symbol.Name]:$[l.Symbol.BaseName]}function S$($,T){return{name:typeof $==="string"&&$.length>0?$:"",config:typeof $==="object"?$:T}}function XN($){if(typeof $!=="object"||$===null)return!1;if($.constructor.name!=="Object")return!1;if("logger"in $){let T=typeof $.logger;if(T!=="boolean"&&(T!=="object"||typeof $.logger.logQuery!=="function")&&T!=="undefined")return!1;return!0}if("schema"in $){let T=typeof $.schema;if(T!=="object"&&T!=="undefined")return!1;return!0}if("casing"in $){let T=typeof $.casing;if(T!=="string"&&T!=="undefined")return!1;return!0}if("mode"in $){if($.mode!=="default"||$.mode!=="planetscale"||$.mode!==void 0)return!1;return!0}if("connection"in $){let T=typeof $.connection;if(T!=="string"&&T!=="object"&&T!=="undefined")return!1;return!0}if("client"in $){let T=typeof $.client;if(T!=="object"&&T!=="function"&&T!=="undefined")return!1;return!0}if(Object.keys($).length===0)return!0;return!1}class vT extends e{static[N]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity($){if($){let{name:T,...W}=$;this.config.generatedIdentity={type:"always",sequenceName:T,sequenceOptions:W}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity($){if($){let{name:T,...W}=$;this.config.generatedIdentity={type:"byDefault",sequenceName:T,sequenceOptions:W}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class UN extends vT{static[N]="PgBigInt53Builder";constructor($){super($,"number","PgBigInt53")}build($){return new wN($,this.config)}}class wN extends d{static[N]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}}class YN extends vT{static[N]="PgBigInt64Builder";constructor($){super($,"bigint","PgBigInt64")}build($){return new GN($,this.config)}}class GN extends d{static[N]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue($){return BigInt($)}}function zN($,T){let{name:W,config:U}=S$($,T);if(U.mode==="number")return new UN(W);return new YN(W)}class HN extends e{static[N]="PgBigSerial53Builder";constructor($){super($,"number","PgBigSerial53");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new FN($,this.config)}}class FN extends d{static[N]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}}class ON extends e{static[N]="PgBigSerial64Builder";constructor($){super($,"bigint","PgBigSerial64");this.config.hasDefault=!0}build($){return new QN($,this.config)}}class QN extends d{static[N]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue($){return BigInt($)}}function ZN($,T){let{name:W,config:U}=S$($,T);if(U.mode==="number")return new HN(W);return new ON(W)}class VN extends e{static[N]="PgBooleanBuilder";constructor($){super($,"boolean","PgBoolean")}build($){return new KN($,this.config)}}class KN extends d{static[N]="PgBoolean";getSQLType(){return"boolean"}}function Uw($){return new VN($??"")}class AN extends e{static[N]="PgCharBuilder";constructor($,T){super($,"string","PgChar");this.config.length=T.length,this.config.enumValues=T.enum}build($){return new EN($,this.config)}}class EN extends d{static[N]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}function MN($,T={}){let{name:W,config:U}=S$($,T);return new AN(W,U)}class DN extends e{static[N]="PgCidrBuilder";constructor($){super($,"string","PgCidr")}build($){return new NN($,this.config)}}class NN extends d{static[N]="PgCidr";getSQLType(){return"cidr"}}function JN($){return new DN($??"")}class LN extends e{static[N]="PgCustomColumnBuilder";constructor($,T,W){super($,"custom","PgCustomColumn");this.config.fieldConfig=T,this.config.customTypeParams=W}build($){return new RN($,this.config)}}class RN extends d{static[N]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor($,T){super($,T);this.sqlName=T.customTypeParams.dataType(T.fieldConfig),this.mapTo=T.customTypeParams.toDriver,this.mapFrom=T.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue($){return typeof this.mapFrom==="function"?this.mapFrom($):$}mapToDriverValue($){return typeof this.mapTo==="function"?this.mapTo($):$}}function _N($){return(T,W)=>{let{name:U,config:X}=S$(T,W);return new LN(U,X,$)}}class h0 extends e{static[N]="PgDateColumnBaseBuilder";defaultNow(){return this.default(R`now()`)}}class kN extends h0{static[N]="PgDateBuilder";constructor($){super($,"date","PgDate")}build($){return new _z($,this.config)}}class _z extends d{static[N]="PgDate";getSQLType(){return"date"}mapFromDriverValue($){return new Date($)}mapToDriverValue($){return $.toISOString()}}class vN extends h0{static[N]="PgDateStringBuilder";constructor($){super($,"string","PgDateString")}build($){return new kz($,this.config)}}class kz extends d{static[N]="PgDateString";getSQLType(){return"date"}}function PN($,T){let{name:W,config:U}=S$($,T);if(U?.mode==="date")return new kN(W);return new vN(W)}class qN extends e{static[N]="PgDoublePrecisionBuilder";constructor($){super($,"number","PgDoublePrecision")}build($){return new CN($,this.config)}}class CN extends d{static[N]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue($){if(typeof $==="string")return Number.parseFloat($);return $}}function SN($){return new qN($??"")}class jN extends e{static[N]="PgInetBuilder";constructor($){super($,"string","PgInet")}build($){return new BN($,this.config)}}class BN extends d{static[N]="PgInet";getSQLType(){return"inet"}}function IN($){return new jN($??"")}class xN extends vT{static[N]="PgIntegerBuilder";constructor($){super($,"number","PgInteger")}build($){return new fN($,this.config)}}class fN extends d{static[N]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue($){if(typeof $==="string")return Number.parseInt($);return $}}function ww($){return new xN($??"")}class bN extends e{static[N]="PgIntervalBuilder";constructor($,T){super($,"string","PgInterval");this.config.intervalConfig=T}build($){return new yN($,this.config)}}class yN extends d{static[N]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let $=this.fields?` ${this.fields}`:"",T=this.precision?`(${this.precision})`:"";return`interval${$}${T}`}}function hN($,T={}){let{name:W,config:U}=S$($,T);return new bN(W,U)}class gN extends e{static[N]="PgJsonBuilder";constructor($){super($,"json","PgJson")}build($){return new vz($,this.config)}}class vz extends d{static[N]="PgJson";constructor($,T){super($,T)}getSQLType(){return"json"}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){if(typeof $==="string")try{return JSON.parse($)}catch{return $}return $}}function mN($){return new gN($??"")}class cN extends e{static[N]="PgJsonbBuilder";constructor($){super($,"json","PgJsonb")}build($){return new Pz($,this.config)}}class Pz extends d{static[N]="PgJsonb";constructor($,T){super($,T)}getSQLType(){return"jsonb"}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){if(typeof $==="string")try{return JSON.parse($)}catch{return $}return $}}function uN($){return new cN($??"")}class pN extends e{static[N]="PgLineBuilder";constructor($){super($,"array","PgLine")}build($){return new dN($,this.config)}}class dN extends d{static[N]="PgLine";getSQLType(){return"line"}mapFromDriverValue($){let[T,W,U]=$.slice(1,-1).split(",");return[Number.parseFloat(T),Number.parseFloat(W),Number.parseFloat(U)]}mapToDriverValue($){return`{${$[0]},${$[1]},${$[2]}}`}}class oN extends e{static[N]="PgLineABCBuilder";constructor($){super($,"json","PgLineABC")}build($){return new lN($,this.config)}}class lN extends d{static[N]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue($){let[T,W,U]=$.slice(1,-1).split(",");return{a:Number.parseFloat(T),b:Number.parseFloat(W),c:Number.parseFloat(U)}}mapToDriverValue($){return`{${$.a},${$.b},${$.c}}`}}function rN($,T){let{name:W,config:U}=S$($,T);if(!U?.mode||U.mode==="tuple")return new pN(W);return new oN(W)}class nN extends e{static[N]="PgMacaddrBuilder";constructor($){super($,"string","PgMacaddr")}build($){return new iN($,this.config)}}class iN extends d{static[N]="PgMacaddr";getSQLType(){return"macaddr"}}function tN($){return new nN($??"")}class aN extends e{static[N]="PgMacaddr8Builder";constructor($){super($,"string","PgMacaddr8")}build($){return new sN($,this.config)}}class sN extends d{static[N]="PgMacaddr8";getSQLType(){return"macaddr8"}}function eN($){return new aN($??"")}class $J extends e{static[N]="PgNumericBuilder";constructor($,T,W){super($,"string","PgNumeric");this.config.precision=T,this.config.scale=W}build($){return new qz($,this.config)}}class qz extends d{static[N]="PgNumeric";precision;scale;constructor($,T){super($,T);this.precision=T.precision,this.scale=T.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 TJ extends e{static[N]="PgNumericNumberBuilder";constructor($,T,W){super($,"number","PgNumericNumber");this.config.precision=T,this.config.scale=W}build($){return new WJ($,this.config)}}class WJ extends d{static[N]="PgNumericNumber";precision;scale;constructor($,T){super($,T);this.precision=T.precision,this.scale=T.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 XJ extends e{static[N]="PgNumericBigIntBuilder";constructor($,T,W){super($,"bigint","PgNumericBigInt");this.config.precision=T,this.config.scale=W}build($){return new UJ($,this.config)}}class UJ extends d{static[N]="PgNumericBigInt";precision;scale;constructor($,T){super($,T);this.precision=T.precision,this.scale=T.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 wJ($,T){let{name:W,config:U}=S$($,T),X=U?.mode;return X==="number"?new TJ(W,U?.precision,U?.scale):X==="bigint"?new XJ(W,U?.precision,U?.scale):new $J(W,U?.precision,U?.scale)}class YJ extends e{static[N]="PgPointTupleBuilder";constructor($){super($,"array","PgPointTuple")}build($){return new GJ($,this.config)}}class GJ extends d{static[N]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue($){if(typeof $==="string"){let[T,W]=$.slice(1,-1).split(",");return[Number.parseFloat(T),Number.parseFloat(W)]}return[$.x,$.y]}mapToDriverValue($){return`(${$[0]},${$[1]})`}}class zJ extends e{static[N]="PgPointObjectBuilder";constructor($){super($,"json","PgPointObject")}build($){return new HJ($,this.config)}}class HJ extends d{static[N]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue($){if(typeof $==="string"){let[T,W]=$.slice(1,-1).split(",");return{x:Number.parseFloat(T),y:Number.parseFloat(W)}}return $}mapToDriverValue($){return`(${$.x},${$.y})`}}function FJ($,T){let{name:W,config:U}=S$($,T);if(!U?.mode||U.mode==="tuple")return new YJ(W);return new zJ(W)}function rB($){let T=[];for(let W=0;W<$.length;W+=2)T.push(Number.parseInt($.slice(W,W+2),16));return new Uint8Array(T)}function OJ($,T){let W=new ArrayBuffer(8),U=new DataView(W);for(let X=0;X<8;X++)U.setUint8(X,$[T+X]);return U.getFloat64(0,!0)}function UQ($){let T=rB($),W=0,U=T[W];W+=1;let X=new DataView(T.buffer),w=X.getUint32(W,U===1);W+=4;let Y;if(w&536870912)Y=X.getUint32(W,U===1),W+=4;if((w&65535)===1){let G=OJ(T,W);W+=8;let H=OJ(T,W);return W+=8,[G,H]}throw new Error("Unsupported geometry type")}class QJ extends e{static[N]="PgGeometryBuilder";constructor($){super($,"array","PgGeometry")}build($){return new ZJ($,this.config)}}class ZJ extends d{static[N]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue($){return UQ($)}mapToDriverValue($){return`point(${$[0]} ${$[1]})`}}class VJ extends e{static[N]="PgGeometryObjectBuilder";constructor($){super($,"json","PgGeometryObject")}build($){return new KJ($,this.config)}}class KJ extends d{static[N]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue($){let T=UQ($);return{x:T[0],y:T[1]}}mapToDriverValue($){return`point(${$.x} ${$.y})`}}function AJ($,T){let{name:W,config:U}=S$($,T);if(!U?.mode||U.mode==="tuple")return new QJ(W);return new VJ(W)}class EJ extends e{static[N]="PgRealBuilder";constructor($,T){super($,"number","PgReal");this.config.length=T}build($){return new MJ($,this.config)}}class MJ extends d{static[N]="PgReal";constructor($,T){super($,T)}getSQLType(){return"real"}mapFromDriverValue=($)=>{if(typeof $==="string")return Number.parseFloat($);return $}}function DJ($){return new EJ($??"")}class NJ extends e{static[N]="PgSerialBuilder";constructor($){super($,"number","PgSerial");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new JJ($,this.config)}}class JJ extends d{static[N]="PgSerial";getSQLType(){return"serial"}}function LJ($){return new NJ($??"")}class RJ extends vT{static[N]="PgSmallIntBuilder";constructor($){super($,"number","PgSmallInt")}build($){return new _J($,this.config)}}class _J extends d{static[N]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=($)=>{if(typeof $==="string")return Number($);return $}}function kJ($){return new RJ($??"")}class vJ extends e{static[N]="PgSmallSerialBuilder";constructor($){super($,"number","PgSmallSerial");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new PJ($,this.config)}}class PJ extends d{static[N]="PgSmallSerial";getSQLType(){return"smallserial"}}function qJ($){return new vJ($??"")}class CJ extends e{static[N]="PgTextBuilder";constructor($,T){super($,"string","PgText");this.config.enumValues=T.enum}build($){return new SJ($,this.config)}}class SJ extends d{static[N]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function jJ($,T={}){let{name:W,config:U}=S$($,T);return new CJ(W,U)}class BJ extends h0{constructor($,T,W){super($,"string","PgTime");this.withTimezone=T,this.precision=W,this.config.withTimezone=T,this.config.precision=W}static[N]="PgTimeBuilder";build($){return new Cz($,this.config)}}class Cz extends d{static[N]="PgTime";withTimezone;precision;constructor($,T){super($,T);this.withTimezone=T.withTimezone,this.precision=T.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function IJ($,T={}){let{name:W,config:U}=S$($,T);return new BJ(W,U.withTimezone??!1,U.precision)}class xJ extends h0{static[N]="PgTimestampBuilder";constructor($,T,W){super($,"date","PgTimestamp");this.config.withTimezone=T,this.config.precision=W}build($){return new Sz($,this.config)}}class Sz extends d{static[N]="PgTimestamp";withTimezone;precision;constructor($,T){super($,T);this.withTimezone=T.withTimezone,this.precision=T.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 fJ extends h0{static[N]="PgTimestampStringBuilder";constructor($,T,W){super($,"string","PgTimestampString");this.config.withTimezone=T,this.config.precision=W}build($){return new jz($,this.config)}}class jz extends d{static[N]="PgTimestampString";withTimezone;precision;constructor($,T){super($,T);this.withTimezone=T.withTimezone,this.precision=T.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function bJ($,T={}){let{name:W,config:U}=S$($,T);if(U?.mode==="string")return new fJ(W,U.withTimezone??!1,U.precision);return new xJ(W,U?.withTimezone??!1,U?.precision)}class yJ extends e{static[N]="PgUUIDBuilder";constructor($){super($,"string","PgUUID")}defaultRandom(){return this.default(R`gen_random_uuid()`)}build($){return new Bz($,this.config)}}class Bz extends d{static[N]="PgUUID";getSQLType(){return"uuid"}}function L1($){return new yJ($??"")}class hJ extends e{static[N]="PgVarcharBuilder";constructor($,T){super($,"string","PgVarchar");this.config.length=T.length,this.config.enumValues=T.enum}build($){return new gJ($,this.config)}}class gJ extends d{static[N]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function X6($,T={}){let{name:W,config:U}=S$($,T);return new hJ(W,U)}class mJ extends e{static[N]="PgBinaryVectorBuilder";constructor($,T){super($,"string","PgBinaryVector");this.config.dimensions=T.dimensions}build($){return new cJ($,this.config)}}class cJ extends d{static[N]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function uJ($,T){let{name:W,config:U}=S$($,T);return new mJ(W,U)}class pJ extends e{static[N]="PgHalfVectorBuilder";constructor($,T){super($,"array","PgHalfVector");this.config.dimensions=T.dimensions}build($){return new dJ($,this.config)}}class dJ extends d{static[N]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){return $.slice(1,-1).split(",").map((T)=>Number.parseFloat(T))}}function oJ($,T){let{name:W,config:U}=S$($,T);return new pJ(W,U)}class lJ extends e{static[N]="PgSparseVectorBuilder";constructor($,T){super($,"string","PgSparseVector");this.config.dimensions=T.dimensions}build($){return new rJ($,this.config)}}class rJ extends d{static[N]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}function nJ($,T){let{name:W,config:U}=S$($,T);return new lJ(W,U)}class iJ extends e{static[N]="PgVectorBuilder";constructor($,T){super($,"array","PgVector");this.config.dimensions=T.dimensions}build($){return new tJ($,this.config)}}class tJ extends d{static[N]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){return $.slice(1,-1).split(",").map((T)=>Number.parseFloat(T))}}function aJ($,T){let{name:W,config:U}=S$($,T);return new iJ(W,U)}function sJ(){return{bigint:zN,bigserial:ZN,boolean:Uw,char:MN,cidr:JN,customType:_N,date:PN,doublePrecision:SN,inet:IN,integer:ww,interval:hN,json:mN,jsonb:uN,line:rN,macaddr:tN,macaddr8:eN,numeric:wJ,point:FJ,geometry:AJ,real:DJ,serial:LJ,smallint:kJ,smallserial:qJ,text:jJ,time:IJ,timestamp:bJ,uuid:L1,varchar:X6,bit:uJ,halfvec:oJ,sparsevec:nJ,vector:aJ}}var wQ=Symbol.for("drizzle:PgInlineForeignKeys"),eJ=Symbol.for("drizzle:EnableRLS");class x4 extends l{static[N]="PgTable";static Symbol=Object.assign({},l.Symbol,{InlineForeignKeys:wQ,EnableRLS:eJ});[wQ]=[];[eJ]=!1;[l.Symbol.ExtraConfigBuilder]=void 0;[l.Symbol.ExtraConfigColumns]={}}function nB($,T,W,U,X=$){let w=new x4($,U,X),Y=typeof T==="function"?T(sJ()):T,G=Object.fromEntries(Object.entries(Y).map(([F,O])=>{let Q=O;Q.setName(F);let Z=Q.build(w);return w[wQ].push(...Q.buildForeignKeys(Z,w)),[F,Z]})),H=Object.fromEntries(Object.entries(Y).map(([F,O])=>{let Q=O;Q.setName(F);let Z=Q.buildExtraConfigColumn(w);return[F,Z]})),z=Object.assign(w,G);if(z[l.Symbol.Columns]=G,z[l.Symbol.ExtraConfigColumns]=H,W)z[x4.Symbol.ExtraConfigBuilder]=W;return Object.assign(z,{enableRLS:()=>{return z[x4.Symbol.EnableRLS]=!0,z}})}var PT=($,T,W)=>{return nB($,T,W,void 0)};function $L(...$){if($[0].columns)return new Yw($[0].columns,$[0].name);return new Yw($)}class Yw{static[N]="PgPrimaryKeyBuilder";columns;name;constructor($,T){this.columns=$,this.name=T}build($){return new TL($,this.columns,this.name)}}class TL{constructor($,T,W){this.table=$,this.columns=T,this.name=W}static[N]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[x4.Symbol.Name]}_${this.columns.map(($)=>$.name).join("_")}_pk`}}function p6($,T){if(tD(T)&&!sO($)&&!B($,O1)&&!B($,kT)&&!B($,p$)&&!B($,l)&&!B($,u6))return new O1($,T);return $}var Iz=($,T)=>{return R`${$} = ${p6(T,$)}`},WL=($,T)=>{return R`${$} <> ${p6(T,$)}`};function Gw(...$){let T=$.filter((W)=>W!==void 0);if(T.length===0)return;if(T.length===1)return new a(T);return new a([new I4("("),R.join(T,new I4(" and ")),new I4(")")])}function XL(...$){let T=$.filter((W)=>W!==void 0);if(T.length===0)return;if(T.length===1)return new a(T);return new a([new I4("("),R.join(T,new I4(" or ")),new I4(")")])}function UL($){return R`not ${$}`}var xz=($,T)=>{return R`${$} > ${p6(T,$)}`},wL=($,T)=>{return R`${$} >= ${p6(T,$)}`},YL=($,T)=>{return R`${$} < ${p6(T,$)}`},GL=($,T)=>{return R`${$} <= ${p6(T,$)}`};function zL($,T){if(Array.isArray(T)){if(T.length===0)return R`false`;return R`${$} in ${T.map((W)=>p6(W,$))}`}return R`${$} in ${p6(T,$)}`}function HL($,T){if(Array.isArray(T)){if(T.length===0)return R`true`;return R`${$} not in ${T.map((W)=>p6(W,$))}`}return R`${$} not in ${p6(T,$)}`}function FL($){return R`${$} is null`}function OL($){return R`${$} is not null`}function QL($){return R`exists ${$}`}function ZL($){return R`not exists ${$}`}function VL($,T,W){return R`${$} between ${p6(T,$)} and ${p6(W,$)}`}function KL($,T,W){return R`${$} not between ${p6(T,$)} and ${p6(W,$)}`}function AL($,T){return R`${$} like ${T}`}function EL($,T){return R`${$} not like ${T}`}function ML($,T){return R`${$} ilike ${T}`}function DL($,T){return R`${$} not ilike ${T}`}function NL($){return R`${$} asc`}function JL($){return R`${$} desc`}class YQ{constructor($,T,W){this.sourceTable=$,this.referencedTable=T,this.relationName=W,this.referencedTableName=T[l.Symbol.Name]}static[N]="Relation";referencedTableName;fieldName}class LL{constructor($,T){this.table=$,this.config=T}static[N]="Relations"}class qT extends YQ{constructor($,T,W,U){super($,T,W?.relationName);this.config=W,this.isNullable=U}static[N]="One";withFieldName($){let T=new qT(this.sourceTable,this.referencedTable,this.config,this.isNullable);return T.fieldName=$,T}}class zw extends YQ{constructor($,T,W){super($,T,W?.relationName);this.config=W}static[N]="Many";withFieldName($){let T=new zw(this.sourceTable,this.referencedTable,this.config);return T.fieldName=$,T}}function RL(){return{and:Gw,between:VL,eq:Iz,exists:QL,gt:xz,gte:wL,ilike:ML,inArray:zL,isNull:FL,isNotNull:OL,like:AL,lt:YL,lte:GL,ne:WL,not:UL,notBetween:KL,notExists:ZL,notLike:EL,notIlike:DL,notInArray:HL,or:XL,sql:R}}function _L(){return{sql:R,asc:NL,desc:JL}}function kL($,T){if(Object.keys($).length===1&&"default"in $&&!B($.default,l))$=$.default;let W={},U={},X={};for(let[w,Y]of Object.entries($))if(B(Y,l)){let G=kW(Y),H=U[G];W[G]=w,X[w]={tsName:w,dbName:Y[l.Symbol.Name],schema:Y[l.Symbol.Schema],columns:Y[l.Symbol.Columns],relations:H?.relations??{},primaryKey:H?.primaryKey??[]};for(let F of Object.values(Y[l.Symbol.Columns]))if(F.primary)X[w].primaryKey.push(F);let z=Y[l.Symbol.ExtraConfigBuilder]?.(Y[l.Symbol.ExtraConfigColumns]);if(z){for(let F of Object.values(z))if(B(F,Yw))X[w].primaryKey.push(...F.columns)}}else if(B(Y,LL)){let G=kW(Y.table),H=W[G],z=Y.config(T(Y.table)),F;for(let[O,Q]of Object.entries(z))if(H){let Z=X[H];if(Z.relations[O]=Q,F)Z.primaryKey.push(...F)}else{if(!(G in U))U[G]={relations:{},primaryKey:F};U[G].relations[O]=Q}}return{tables:X,tableNamesMap:W}}function iB($){return function T(W,U){return new qT($,W,U,U?.fields.reduce((X,w)=>X&&w.notNull,!0)??!1)}}function tB($){return function T(W,U){return new zw($,W,U)}}function vL($,T,W){if(B(W,qT)&&W.config)return{fields:W.config.fields,references:W.config.references};let U=T[kW(W.referencedTable)];if(!U)throw new Error(`Table "${W.referencedTable[l.Symbol.Name]}" not found in schema`);let X=$[U];if(!X)throw new Error(`Table "${U}" not found in schema`);let w=W.sourceTable,Y=T[kW(w)];if(!Y)throw new Error(`Table "${w[l.Symbol.Name]}" not found in schema`);let G=[];for(let H of Object.values(X.relations))if(W.relationName&&W!==H&&H.relationName===W.relationName||!W.relationName&&H.referencedTable===W.sourceTable)G.push(H);if(G.length>1)throw W.relationName?new Error(`There are multiple relations with name "${W.relationName}" in table "${U}"`):new Error(`There are multiple relations between "${U}" and "${W.sourceTable[l.Symbol.Name]}". Please specify relation name`);if(G[0]&&B(G[0],qT)&&G[0].config)return{fields:G[0].config.references,references:G[0].config.fields};throw new Error(`There is not enough information to infer relation "${Y}.${W.fieldName}"`)}function PL($){return{one:iB($),many:tB($)}}function fz($,T,W,U,X=(w)=>w){let w={};for(let[Y,G]of U.entries())if(G.isJson){let H=T.relations[G.tsKey],z=W[Y],F=typeof z==="string"?JSON.parse(z):z;w[G.tsKey]=B(H,qT)?F&&fz($,$[G.relationTableTsKey],F,G.selection,X):F.map((O)=>fz($,$[G.relationTableTsKey],O,G.selection,X))}else{let H=X(W[Y]),z=G.field,F;if(B(z,p$))F=z;else if(B(z,a))F=z.decoder;else F=z.sql.decoder;w[G.tsKey]=H===null?null:F.mapFromDriverValue(H)}return w}import my from"path";import NI from"os";import JI from"fs";var bz=new Map,GQ=new Map,zQ=Symbol("OriginError"),r2={};class R1 extends Promise{constructor($,T,W,U,X={}){let w,Y;super((G,H)=>{w=G,Y=H});this.tagged=Array.isArray($.raw),this.strings=$,this.args=T,this.handler=W,this.canceller=U,this.options=X,this.state=null,this.statement=null,this.resolve=(G)=>(this.active=!1,w(G)),this.reject=(G)=>(this.active=!1,Y(G)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[zQ]=this.handler.debug?new Error:this.tagged&&aB(this.strings)}get origin(){return(this.handler.debug?this[zQ].stack:this.tagged&&GQ.has(this.strings)?GQ.get(this.strings):GQ.set(this.strings,this[zQ].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,T){if(this.options.simple=!1,typeof $==="function")T=$,$=1;if(this.cursorRows=$,typeof T==="function")return this.cursorFn=T,this;let W;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};W&&W();let U=new Promise((X,w)=>{this.cursorFn=(Y)=>{return X({value:Y,done:!1}),new Promise((G)=>W=G)},this.resolve=()=>(this.active=!1,X({done:!0})),this.reject=(Y)=>(this.active=!1,w(Y))});return this.execute(),U},return(){return W&&W(r2),{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 aB($){if(bz.has($))return bz.get($);let T=Error.stackTraceLimit;return Error.stackTraceLimit=4,bz.set($,new Error),Error.stackTraceLimit=T,bz.get($)}class n2 extends Error{constructor($){super($.message);this.name=this.constructor.name,Object.assign(this,$)}}var L4={connection:qL,postgres:CL,generic:SL,notSupported:jL};function qL($,T,W){let{host:U,port:X}=W||T,w=Object.assign(new Error("write "+$+" "+(T.path||U+":"+X)),{code:$,errno:$,address:T.path||U},T.path?{}:{port:X});return Error.captureStackTrace(w,qL),w}function CL($){let T=new n2($);return Error.captureStackTrace(T,CL),T}function SL($,T){let W=Object.assign(new Error($+": "+T),{code:$});return Error.captureStackTrace(W,SL),W}function jL($){let T=Object.assign(new Error($+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:$});return Error.captureStackTrace(T,jL),T}var sB={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 gz{then(){HQ()}catch(){HQ()}finally(){HQ()}}class Qw extends gz{constructor($){super();this.value=uz($)}}class G0 extends gz{constructor($,T,W){super();this.value=$,this.type=T,this.array=W}}class mz extends gz{constructor($,T){super();this.first=$,this.rest=T}build($,T,W,U){let X=eB.map(([w,Y])=>({fn:Y,i:$.search(w)})).sort((w,Y)=>w.i-Y.i).pop();return X.i===-1?VQ(this.first,U):X.fn(this.first,this.rest,T,W,U)}}function cz($,T,W,U){let X=$ instanceof G0?$.value:$;if(X===void 0){if($ instanceof G0?$.value=U.transform.undefined:X=$=U.transform.undefined,X===void 0)throw L4.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+W.push($ instanceof G0?(T.push($.value),$.array?$.array[$.type||hz($.value)]||$.type||fL($.value):$.type):(T.push($),hz($)))}var IL=yL(sB);function QQ($,T,W,U,X,w){for(let Y=1;Y<$.strings.length;Y++)T+=ZQ(T,W,U,X,w)+$.strings[Y],W=$.args[Y];return T}function ZQ($,T,W,U,X){return T instanceof mz?T.build($,W,U,X):T instanceof R1?OQ(T,W,U,X):T instanceof Qw?T.value:T&&T[0]instanceof R1?T.reduce((w,Y)=>w+" "+OQ(Y,W,U,X),""):cz(T,W,U,X)}function OQ($,T,W,U){return $.fragment=!0,QQ($,$.strings[0],$.args[0],T,W,U)}function xL($,T,W,U,X){return $.map((w)=>"("+U.map((Y)=>ZQ("values",w[Y],T,W,X)).join(",")+")").join(",")}function BL($,T,W,U,X){let w=Array.isArray($[0]),Y=T.length?T.flat():Object.keys(w?$[0]:$);return xL(w?$:[$],W,U,Y,X)}function yz($,T,W,U,X){if(typeof $==="string"&&($=[$].concat(T)),Array.isArray($))return VQ($,X);let w;return(T.length?T.flat():Object.keys($)).map((G)=>{return w=$[G],(w instanceof R1?OQ(w,W,U,X):w instanceof Qw?w.value:cz(w,W,U,X))+" as "+uz(X.transform.column.to?X.transform.column.to(G):G)}).join(",")}var eB=Object.entries({values:BL,in:(...$)=>{let T=BL(...$);return T==="()"?"(null)":T},select:yz,as:yz,returning:yz,"\\(":yz,update($,T,W,U,X){return(T.length?T.flat():Object.keys($)).map((w)=>uz(X.transform.column.to?X.transform.column.to(w):w)+"="+ZQ("values",$[w],W,U,X))},insert($,T,W,U,X){let w=T.length?T.flat():Object.keys(Array.isArray($)?$[0]:$);return"("+VQ(w,X)+")values"+xL(Array.isArray($)?$:[$],W,U,w,X)}}).map(([$,T])=>[new RegExp("((?:^|[\\s(])"+$+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),T]);function HQ(){throw L4.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:$I,parsers:TI}=IL;function fL($){if(Array.isArray($))return fL($[0]);return typeof $==="string"?1009:0}var bL=function($){let T=yL($||{});return{serializers:Object.assign({},$I,T.serializers),parsers:Object.assign({},TI,T.parsers)}};function yL($){return Object.keys($).reduce((T,W)=>{if($[W].from&&[].concat($[W].from).forEach((U)=>T.parsers[U]=$[W].parse),$[W].serialize)T.serializers[$[W].to]=$[W].serialize,$[W].from&&[].concat($[W].from).forEach((U)=>T.serializers[U]=$[W].serialize);return T},{parsers:{},serializers:{}})}function VQ($,{transform:{column:T}}){return $.map((W)=>uz(T.to?T.to(W):W)).join(",")}var uz=function $(T){return'"'+T.replace(/"/g,'""').replace(/\./g,'"."')+'"'},hz=function $(T){return T instanceof G0?T.type:T instanceof Date?1184:T instanceof Uint8Array?17:T===!0||T===!1?16:typeof T==="bigint"?20:Array.isArray(T)?$(T[0]):0},WI=/\\/g,XI=/"/g;function UI($){return $.replace(WI,"\\\\").replace(XI,"\\\"")}var hL=function $(T,W,U,X){if(Array.isArray(T)===!1)return T;if(!T.length)return"{}";let w=T[0],Y=X===1020?";":",";if(Array.isArray(w)&&!w.type)return"{"+T.map((G)=>$(G,W,U,X)).join(Y)+"}";return"{"+T.map((G)=>{if(G===void 0){if(G=U.transform.undefined,G===void 0)throw L4.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return G===null?"null":'"'+UI(W?W(G.type?G.value:G):""+G)+'"'}).join(Y)+"}"},FQ={i:0,char:null,str:"",quoted:!1,last:0},gL=function $(T,W,U){return FQ.i=FQ.last=0,mL(FQ,T,W,U)};function mL($,T,W,U){let X=[],w=U===1020?";":",";for(;$.i<T.length;$.i++){if($.char=T[$.i],$.quoted)if($.char==="\\")$.str+=T[++$.i];else if($.char==='"')X.push(W?W($.str):$.str),$.str="",$.quoted=T[$.i+1]==='"',$.last=$.i+2;else $.str+=$.char;else if($.char==='"')$.quoted=!0;else if($.char==="{")$.last=++$.i,X.push(mL($,T,W,U));else if($.char==="}"){$.quoted=!1,$.last<$.i&&X.push(W?W(T.slice($.last,$.i)):T.slice($.last,$.i)),$.last=$.i+1;break}else if($.char===w&&$.p!=="}"&&$.p!=='"')X.push(W?W(T.slice($.last,$.i)):T.slice($.last,$.i)),$.last=$.i+1;$.p=$.char}return $.last<$.i&&X.push(W?W(T.slice($.last,$.i+1)):T.slice($.last,$.i+1)),X}var vW=($)=>{let T=$[0];for(let W=1;W<$.length;W++)T+=$[W]==="_"?$[++W].toUpperCase():$[W];return T},PW=($)=>{let T=$[0].toUpperCase();for(let W=1;W<$.length;W++)T+=$[W]==="_"?$[++W].toUpperCase():$[W];return T},qW=($)=>$.replace(/_/g,"-"),Hw=($)=>$.replace(/([A-Z])/g,"_$1").toLowerCase(),Fw=($)=>($.slice(0,1)+$.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),Ow=($)=>$.replace(/-/g,"_");function KQ($){return function T(W,U){return typeof W==="object"&&W!==null&&(U.type===114||U.type===3802)?Array.isArray(W)?W.map((X)=>T(X,U)):Object.entries(W).reduce((X,[w,Y])=>Object.assign(X,{[$(w)]:T(Y,U)}),{}):W}}vW.column={from:vW};vW.value={from:KQ(vW)};Hw.column={to:Hw};var AQ={...vW};AQ.column.to=Hw;PW.column={from:PW};PW.value={from:KQ(PW)};Fw.column={to:Fw};var EQ={...PW};EQ.column.to=Fw;qW.column={from:qW};qW.value={from:KQ(qW)};Ow.column={to:Ow};var MQ={...qW};MQ.column.to=Ow;import cL from"net";import zI from"tls";import Zw from"crypto";import DQ from"stream";import{performance as uL}from"perf_hooks";class CW 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 Q1=wI;function wI($=[]){let T=$.slice(),W=0;return{get length(){return T.length-W},remove:(U)=>{let X=T.indexOf(U);return X===-1?null:(T.splice(X,1),U)},push:(U)=>(T.push(U),U),shift:()=>{let U=T[W++];if(W===T.length)W=0,T=[];else T[W-1]=void 0;return U}}}var U6=Buffer.allocUnsafe(256),YI="BCcDdEFfHPpQSX".split("").reduce(($,T)=>{let W=T.charCodeAt(0);return $[T]=()=>{return U6[0]=W,u$.i=5,u$},$},{}),u$=Object.assign(GI,YI,{N:String.fromCharCode(0),i:0,inc($){return u$.i+=$,u$},str($){let T=Buffer.byteLength($);return pz(T),u$.i+=U6.write($,u$.i,T,"utf8"),u$},i16($){return pz(2),U6.writeUInt16BE($,u$.i),u$.i+=2,u$},i32($,T){if(T||T===0)return U6.writeUInt32BE($,T),u$;return pz(4),U6.writeUInt32BE($,u$.i),u$.i+=4,u$},z($){return pz($),U6.fill(0,u$.i,u$.i+$),u$.i+=$,u$},raw($){return U6=Buffer.concat([U6.subarray(0,u$.i),$]),u$.i=U6.length,u$},end($=1){U6.writeUInt32BE(u$.i-$,$);let T=U6.subarray(0,u$.i);return u$.i=0,U6=Buffer.allocUnsafe(256),T}}),Y$=u$;function pz($){if(U6.length-u$.i<$){let T=U6,W=T.length;U6=Buffer.allocUnsafe(W+(W>>1)+$),T.copy(U6)}}function GI(){return u$.i=0,u$}var LQ=oL,HI=1,CT=Y$().S().end(),pL=Y$().H().end(),FI=Y$().i32(8).i32(80877103).end(8),OI=Buffer.concat([Y$().E().str(Y$.N).i32(0).end(),CT]),QI=Y$().D().str("S").str(Y$.N).end(),i2=()=>{},ZI=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),VI={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 oL($,T={},{onopen:W=i2,onend:U=i2,onclose:X=i2}={}){let{ssl:w,max:Y,user:G,host:H,port:z,database:F,parsers:O,transform:Q,onnotice:Z,onnotify:V,onparameter:A,max_pipeline:D,keep_alive:J,backoff:L,target_session_attrs:_}=$,C=Q1(),f=HI++,b={pid:null,secret:null},g=JQ(I9,$.idle_timeout),T$=JQ(I9,$.max_lifetime),N$=JQ(Bv,$.connect_timeout),j=null,w$,t=new CW,z$=Buffer.alloc(0),I$=$.fetch_types,e$={},h4={},i6=Math.random().toString(36).slice(2),c=1,F$=0,m$=0,Y4=0,_4=0,J$=0,c$=0,D4=0,G4=null,$4=null,t4=!1,l$=null,q1=null,p4=null,a0=null,k4=null,T4=null,C1=null,p1=null,i=null,MX=null,a4={queue:T.closed,idleTimer:g,connect(M){p4=M,VV()},terminate:NX,execute:DX,cancel:qv,end:I9,count:0,id:f};return T.closed&&T.closed.push(a4),a4;async function Pv(){let M;try{M=$.socket?await Promise.resolve($.socket($)):new cL.Socket}catch(P){gW(P);return}return M.on("error",gW),M.on("close",KV),M.on("drain",QV),M}async function qv({pid:M,secret:P},H$,f$){try{w$=Y$().i32(16).i32(80877102).i32(M).i32(P).end(16),await ZV(),j.once("error",f$),j.once("close",H$)}catch(V4){f$(V4)}}function DX(M){if(t4)return tw(M,L4.connection("CONNECTION_DESTROYED",$));if(M.cancelled)return;try{return M.state=b,i?C.push(M):(i=M,i.active=!0),jv(M),d4(Cv(M))&&!M.describeFirst&&!M.cursorFn&&C.length<D&&(!M.options.onexecute||M.options.onexecute(a4))}catch(P){return C.length===0&&d4(CT),d1(P),!0}}function Cv(M){if(M.parameters.length>=65534)throw L4.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return M.options.simple?Y$().Q().str(M.statement.string+Y$.N).end():M.describeFirst?Buffer.concat([HV(M),pL]):M.prepare?M.prepared?iw(M):Buffer.concat([HV(M),iw(M)]):Sv(M)}function HV(M){return Buffer.concat([EV(M.statement.string,M.parameters,M.statement.types,M.statement.name),AP("S",M.statement.name)])}function iw(M){return Buffer.concat([KP(M.parameters,M.statement.types,M.statement.name,M.cursorName),M.cursorFn?MV("",M.cursorRows):OI])}function Sv(M){return Buffer.concat([EV(M.statement.string,M.parameters,M.statement.types),QI,iw(M)])}function jv(M){let P=[],H$=[],f$=QQ(M,M.strings[0],M.args[0],P,H$,$);!M.tagged&&M.args.forEach((V4)=>cz(V4,P,H$,$)),M.prepare=$.prepare&&("prepare"in M.options?M.options.prepare:!0),M.string=f$,M.signature=M.prepare&&H$+f$,M.onlyDescribe&&delete h4[M.signature],M.parameters=M.parameters||P,M.prepared=M.prepare&&M.signature in h4,M.describeFirst=M.onlyDescribe||P.length&&!M.prepared,M.statement=M.prepared?h4[M.signature]:{string:f$,types:H$,name:M.prepare?i6+c++:""},typeof $.debug==="function"&&$.debug(f,f$,P,H$)}function d4(M,P){if(T4=T4?Buffer.concat([T4,M]):Buffer.from(M),P||T4.length>=1024)return FV(P);return $4===null&&($4=setImmediate(FV)),!0}function FV(M){let P=j.write(T4,M);return $4!==null&&clearImmediate($4),T4=$4=null,P}function Bv(){d1(L4.connection("CONNECT_TIMEOUT",$,j)),j.destroy()}async function OV(){if(d4(FI),!await new Promise((P)=>j.once("data",(H$)=>P(H$[0]===83)))&&w==="prefer")return hW();j.removeAllListeners(),j=zI.connect({socket:j,servername:cL.isIP(j.host)?void 0:j.host,...w==="require"||w==="allow"||w==="prefer"?{rejectUnauthorized:!1}:w==="verify-full"?{}:typeof w==="object"?w:{}}),j.on("secureConnect",hW),j.on("error",gW),j.on("close",KV),j.on("drain",QV)}function QV(){!i&&W(a4)}function B9(M){if(l$){if(l$.push(M),m$-=M.length,m$>0)return}z$=l$?Buffer.concat(l$,J$-m$):z$.length===0?M:Buffer.concat([z$,M],z$.length+M.length);while(z$.length>4){if(J$=z$.readUInt32BE(1),J$>=z$.length){m$=J$-z$.length,l$=[z$];break}try{Iv(z$.subarray(0,J$+1))}catch(P){i&&(i.cursorFn||i.describeFirst)&&d4(CT),d1(P)}z$=z$.subarray(J$+1),m$=0,l$=null}}async function ZV(){if(t4=!1,e$={},j||(j=await Pv()),!j)return;if(N$.start(),$.socket)return w?OV():hW();if(j.on("connect",w?OV:hW),$.path)return j.connect($.path);j.ssl=w,j.connect(z[Y4],H[Y4]),j.host=H[Y4],j.port=z[Y4],Y4=(Y4+1)%z.length}function VV(){setTimeout(ZV,F$?F$+c$-uL.now():0)}function hW(){try{h4={},I$=$.fetch_types,i6=Math.random().toString(36).slice(2),c=1,T$.start(),j.on("data",B9),J&&j.setKeepAlive&&j.setKeepAlive(!0,1000*J);let M=MP();d4(M)}catch(M){gW(M)}}function gW(M){if(a4.queue===T.connecting&&$.host[_4+1])return;d1(M);while(C.length)tw(C.shift(),M)}function d1(M){k4&&(k4.destroy(M),k4=null),i&&tw(i,M),p4&&(tw(p4,M),p4=null)}function tw(M,P){if(M.reserve)return M.reject(P);if(!P||typeof P!=="object")P=new Error(P);"query"in P||"parameters"in P||Object.defineProperties(P,{stack:{value:P.stack+M.origin.replace(/.*\n/,`
|
|
107
|
+
`),enumerable:$.debug},query:{value:M.string,enumerable:$.debug},parameters:{value:M.parameters,enumerable:$.debug},args:{value:M.args,enumerable:$.debug},types:{value:M.statement&&M.statement.types,enumerable:$.debug}}),M.reject(P)}function I9(){return a0||(!a4.reserved&&U(a4),!a4.reserved&&!p4&&!i&&C.length===0?(NX(),new Promise((M)=>j&&j.readyState!=="closed"?j.once("close",M):M())):a0=new Promise((M)=>C1=M))}function NX(){if(t4=!0,k4||i||p4||C.length)gW(L4.connection("CONNECTION_DESTROYED",$));if(clearImmediate($4),j)j.removeListener("data",B9),j.removeListener("connect",hW),j.readyState==="open"&&j.end(Y$().X().end());C1&&(C1(),a0=C1=null)}async function KV(M){if(z$=Buffer.alloc(0),m$=0,l$=null,clearImmediate($4),j.removeListener("data",B9),j.removeListener("connect",hW),g.cancel(),T$.cancel(),N$.cancel(),j.removeAllListeners(),j=null,p4)return VV();!M&&(i||C.length)&&gW(L4.connection("CONNECTION_CLOSED",$,j)),F$=uL.now(),M&&$.shared.retries++,c$=(typeof L==="function"?L($.shared.retries):L)*1000,X(a4,L4.connection("CONNECTION_CLOSED",$,j))}function Iv(M,P=M[0]){(P===68?xv:P===100?GP:P===65?TP:P===83?fv:P===90?bv:P===67?yv:P===50?AV:P===49?hv:P===116?gv:P===84?mv:P===82?cv:P===110?rv:P===75?nv:P===69?ev:P===115?WP:P===51?XP:P===71?UP:P===78?HP:P===72?wP:P===99?zP:P===73?FP:P===86?OP:P===118?QP:P===87?YP:ZP)(M)}function xv(M){let P=7,H$,f$,V4,s4=i.isRaw?new Array(i.statement.columns.length):{};for(let G6=0;G6<i.statement.columns.length;G6++)f$=i.statement.columns[G6],H$=M.readInt32BE(P),P+=4,V4=H$===-1?null:i.isRaw===!0?M.subarray(P,P+=H$):f$.parser===void 0?M.toString("utf8",P,P+=H$):f$.parser.array===!0?f$.parser(M.toString("utf8",P+1,P+=H$)):f$.parser(M.toString("utf8",P,P+=H$)),i.isRaw?s4[G6]=i.isRaw===!0?V4:Q.value.from?Q.value.from(V4,f$):V4:s4[f$.name]=Q.value.from?Q.value.from(V4,f$):V4;i.forEachFn?i.forEachFn(Q.row.from?Q.row.from(s4):s4,t):t[D4++]=Q.row.from?Q.row.from(s4):s4}function fv(M){let[P,H$]=M.toString("utf8",5,M.length-1).split(Y$.N);if(e$[P]=H$,$.parameters[P]!==H$)$.parameters[P]=H$,A&&A(P,H$)}function bv(M){if(i&&i.options.simple&&i.resolve(q1||t),i=q1=null,t=new CW,N$.cancel(),p4){if(_){if(!e$.in_hot_standby||!e$.default_transaction_read_only)return sv();else if(av(_,e$))return NX()}if(I$)return p4.reserve&&(p4=null),iv();p4&&!p4.reserve&&DX(p4),$.shared.retries=_4=0,p4=null;return}while(C.length&&(i=C.shift())&&(i.active=!0,i.cancelled))oL($).cancel(i.state,i.cancelled.resolve,i.cancelled.reject);if(i)return;a4.reserved?!a4.reserved.release&&M[5]===73?a0?NX():(a4.reserved=null,W(a4)):a4.reserved():a0?NX():W(a4)}function yv(M){D4=0;for(let P=M.length-1;P>0;P--){if(M[P]===32&&M[P+1]<58&&t.count===null)t.count=+M.toString("utf8",P+1,M.length-1);if(M[P-1]>=65){t.command=M.toString("utf8",5,P),t.state=b;break}}if(MX&&(MX(),MX=null),t.command==="BEGIN"&&Y!==1&&!a4.reserved)return d1(L4.generic("UNSAFE_TRANSACTION","Only use sql.begin, sql.reserved or max: 1"));if(i.options.simple)return AV();if(i.cursorFn)t.count&&i.cursorFn(t),d4(CT);i.resolve(t)}function hv(){i.parsing=!1}function AV(){!t.statement&&(t.statement=i.statement),t.columns=i.statement.columns}function gv(M){let P=M.readUInt16BE(5);for(let H$=0;H$<P;++H$)!i.statement.types[H$]&&(i.statement.types[H$]=M.readUInt32BE(7+H$*4));i.prepare&&(h4[i.signature]=i.statement),i.describeFirst&&!i.onlyDescribe&&(d4(iw(i)),i.describeFirst=!1)}function mv(M){if(t.command)q1=q1||[t],q1.push(t=new CW),t.count=null,i.statement.columns=null;let P=M.readUInt16BE(5),H$=7,f$;i.statement.columns=Array(P);for(let V4=0;V4<P;++V4){f$=H$;while(M[H$++]!==0);let s4=M.readUInt32BE(H$),G6=M.readUInt16BE(H$+4),s0=M.readUInt32BE(H$+6);i.statement.columns[V4]={name:Q.column.from?Q.column.from(M.toString("utf8",f$,H$-1)):M.toString("utf8",f$,H$-1),parser:O[s0],table:s4,number:G6,type:s0},H$+=18}if(t.statement=i.statement,i.onlyDescribe)return i.resolve(i.statement),d4(CT)}async function cv(M,P=M.readUInt32BE(5)){(P===3?uv:P===5?pv:P===10?dv:P===11?ov:P===12?lv:P!==0?VP:i2)(M,P)}async function uv(){let M=await x9();d4(Y$().p().str(M).z(1).end())}async function pv(M){let P="md5"+await dL(Buffer.concat([Buffer.from(await dL(await x9()+G)),M.subarray(9)]));d4(Y$().p().str(P).z(1).end())}async function dv(){p1=(await Zw.randomBytes(18)).toString("base64"),Y$().p().str("SCRAM-SHA-256"+Y$.N);let M=Y$.i;d4(Y$.inc(4).str("n,,n=*,r="+p1).i32(Y$.i-M-4,M).end())}async function ov(M){let P=M.toString("utf8",9).split(",").reduce((G6,s0)=>(G6[s0[0]]=s0.slice(2),G6),{}),H$=await Zw.pbkdf2Sync(await x9(),Buffer.from(P.s,"base64"),parseInt(P.i),32,"sha256"),f$=await dz(H$,"Client Key"),V4="n=*,r="+p1+",r="+P.r+",s="+P.s+",i="+P.i+",c=biws,r="+P.r;G4=(await dz(await dz(H$,"Server Key"),V4)).toString("base64");let s4="c=biws,r="+P.r+",p="+AI(f$,Buffer.from(await dz(await KI(f$),V4))).toString("base64");d4(Y$().p().str(s4).end())}function lv(M){if(M.toString("utf8",9).split(Y$.N,1)[0].slice(2)===G4)return;d1(L4.generic("SASL_SIGNATURE_MISMATCH","The server did not return the correct signature")),j.destroy()}function x9(){return Promise.resolve(typeof $.pass==="function"?$.pass():$.pass)}function rv(){if(t.statement=i.statement,t.statement.columns=[],i.onlyDescribe)return i.resolve(i.statement),d4(CT)}function nv(M){b.pid=M.readUInt32BE(5),b.secret=M.readUInt32BE(9)}async function iv(){I$=!1,(await new R1([`
|
|
84
108
|
select b.oid, b.typarray
|
|
85
109
|
from pg_catalog.pg_type a
|
|
86
110
|
left join pg_catalog.pg_type b on b.oid = a.typelem
|
|
87
111
|
where a.typcategory = 'A'
|
|
88
112
|
group by b.oid, b.typarray
|
|
89
113
|
order by b.oid
|
|
90
|
-
`],[],
|
|
114
|
+
`],[],DX)).forEach(({oid:P,typarray:H$})=>tv(P,H$))}function tv(M,P){if(!!$.parsers[P]&&!!$.serializers[P])return;let H$=$.parsers[M];$.shared.typeArrayMap[M]=P,$.parsers[P]=(f$)=>gL(f$,H$,P),$.parsers[P].array=!0,$.serializers[P]=(f$)=>hL(f$,$.serializers[M],$,P)}function av(M,P){return M==="read-write"&&P.default_transaction_read_only==="on"||M==="read-only"&&P.default_transaction_read_only==="off"||M==="primary"&&P.in_hot_standby==="on"||M==="standby"&&P.in_hot_standby==="off"||M==="prefer-standby"&&P.in_hot_standby==="off"&&$.host[_4]}function sv(){let M=new R1([`
|
|
91
115
|
show transaction_read_only;
|
|
92
116
|
select pg_catalog.pg_is_in_recovery()
|
|
93
|
-
`],[],
|
|
117
|
+
`],[],DX,null,{simple:!0});M.resolve=([[P],[H$]])=>{e$.default_transaction_read_only=P.transaction_read_only,e$.in_hot_standby=H$.pg_is_in_recovery?"on":"off"},M.execute()}function ev(M){i&&(i.cursorFn||i.describeFirst)&&d4(CT);let P=L4.postgres(NQ(M));i&&i.retried?d1(i.retried):i&&i.prepared&&ZI.has(P.routine)?$P(i,P):d1(P)}function $P(M,P){delete h4[M.signature],M.retried=P,DX(M)}function TP(M){if(!V)return;let P=9;while(M[P++]!==0);V(M.toString("utf8",9,P-1),M.toString("utf8",P,M.length-1))}async function WP(){try{let M=await Promise.resolve(i.cursorFn(t));D4=0,M===r2?d4(EP(i.portal)):(t=new CW,d4(MV("",i.cursorRows)))}catch(M){d4(CT),i.reject(M)}}function XP(){t.count&&i.cursorFn(t),i.resolve(t)}function UP(){k4=new DQ.Writable({autoDestroy:!0,write(M,P,H$){j.write(Y$().d().raw(M).end(),H$)},destroy(M,P){P(M),j.write(Y$().f().str(M+Y$.N).end()),k4=null},final(M){j.write(Y$().c().end()),MX=M}}),i.resolve(k4)}function wP(){k4=new DQ.Readable({read(){j.resume()}}),i.resolve(k4)}function YP(){k4=new DQ.Duplex({autoDestroy:!0,read(){j.resume()},write(M,P,H$){j.write(Y$().d().raw(M).end(),H$)},destroy(M,P){P(M),j.write(Y$().f().str(M+Y$.N).end()),k4=null},final(M){j.write(Y$().c().end()),MX=M}}),i.resolve(k4)}function GP(M){k4&&(k4.push(M.subarray(5))||j.pause())}function zP(){k4&&k4.push(null),k4=null}function HP(M){Z?Z(NQ(M)):console.log(NQ(M))}function FP(){}function OP(){d1(L4.notSupported("FunctionCallResponse"))}function QP(){d1(L4.notSupported("NegotiateProtocolVersion"))}function ZP(M){console.error("Postgres.js : Unknown Message:",M[0])}function VP(M,P){console.error("Postgres.js : Unknown Auth:",P)}function KP(M,P,H$="",f$=""){let V4,s4;return Y$().B().str(f$+Y$.N).str(H$+Y$.N).i16(0).i16(M.length),M.forEach((G6,s0)=>{if(G6===null)return Y$.i32(4294967295);s4=P[s0],M[s0]=G6=s4 in $.serializers?$.serializers[s4](G6):""+G6,V4=Y$.i,Y$.inc(4).str(G6).i32(Y$.i-V4-4,V4)}),Y$.i16(0),Y$.end()}function EV(M,P,H$,f$=""){return Y$().P().str(f$+Y$.N).str(M+Y$.N).i16(P.length),P.forEach((V4,s4)=>Y$.i32(H$[s4]||0)),Y$.end()}function AP(M,P=""){return Y$().D().str(M).str(P+Y$.N).end()}function MV(M="",P=0){return Buffer.concat([Y$().E().str(M+Y$.N).i32(P).end(),pL])}function EP(M=""){return Buffer.concat([Y$().C().str("P").str(M+Y$.N).end(),Y$().S().end()])}function MP(){return w$||Y$().inc(4).i16(3).z(2).str(Object.entries(Object.assign({user:G,database:F,client_encoding:"UTF8"},$.connection)).filter(([,M])=>M).map(([M,P])=>M+Y$.N+P).join(Y$.N)).z(2).end(0)}}function NQ($){let T={},W=5;for(let U=5;U<$.length-1;U++)if($[U]===0)T[VI[$[W]]]=$.toString("utf8",W+1,U),W=U+1;return T}function dL($){return Zw.createHash("md5").update($).digest("hex")}function dz($,T){return Zw.createHmac("sha256",$).update(T).digest()}function KI($){return Zw.createHash("sha256").update($).digest()}function AI($,T){let W=Math.max($.length,T.length),U=Buffer.allocUnsafe(W);for(let X=0;X<W;X++)U[X]=$[X]^T[X];return U}function JQ($,T){if(T=typeof T==="function"?T():T,!T)return{cancel:i2,start:i2};let W;return{cancel(){W&&(clearTimeout(W),W=null)},start(){W&&clearTimeout(W),W=setTimeout(U,T*1000,arguments)}};function U(X){$.apply(null,X),W=null}}var lL=()=>{};function RQ($,T){let W=new Map,U="postgresjs_"+Math.random().toString(36).slice(2),X={},w,Y,G=!1,H=O.sql=$({...T,transform:{column:{},value:{},row:{}},max:1,fetch_types:!1,idle_timeout:null,max_lifetime:null,connection:{...T.connection,replication:"database"},onclose:async function(){if(G)return;Y=null,X.pid=X.secret=void 0,Q(await Z(H,U,T.publications)),W.forEach((A)=>A.forEach(({onsubscribe:D})=>D()))},no_subscribe:!0}),z=H.end,F=H.close;return H.end=async()=>{return G=!0,Y&&await new Promise((A)=>(Y.once("close",A),Y.end())),z()},H.close=async()=>{return Y&&await new Promise((A)=>(Y.once("close",A),Y.end())),F()},O;async function O(A,D,J=lL,L=lL){if(A=DI(A),!w)w=Z(H,U,T.publications);let _={fn:D,onsubscribe:J},C=W.has(A)?W.get(A).add(_):W.set(A,new Set([_])).get(A),f=()=>{C.delete(_),C.size===0&&W.delete(A)};return w.then((b)=>{return Q(b),J(),Y&&Y.on("error",L),{unsubscribe:f,state:X,sql:H}})}function Q(A){Y=A.stream,X.pid=A.state.pid,X.secret=A.state.secret}async function Z(A,D,J){if(!J)throw new Error("Missing publication names");let L=await A.unsafe(`CREATE_REPLICATION_SLOT ${D} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`),[_]=L,C=await A.unsafe(`START_REPLICATION SLOT ${D} LOGICAL ${_.consistent_point} (proto_version '1', publication_names '${J}')`).writable(),f={lsn:Buffer.concat(_.consistent_point.split("/").map((j)=>Buffer.from(("00000000"+j).slice(-8),"hex")))};return C.on("data",g),C.on("error",b),C.on("close",A.close),{stream:C,state:L.state};function b(j){console.error("Unexpected error during logical streaming - reconnecting",j)}function g(j){if(j[0]===119)MI(j.subarray(25),f,A.options.parsers,T$,T.transform);else if(j[0]===107&&j[17])f.lsn=j.subarray(1,9),N$()}function T$(j,w$){let t=w$.relation.schema+"."+w$.relation.table;V("*",j,w$),V("*:"+t,j,w$),w$.relation.keys.length&&V("*:"+t+"="+w$.relation.keys.map((z$)=>j[z$.name]),j,w$),V(w$.command,j,w$),V(w$.command+":"+t,j,w$),w$.relation.keys.length&&V(w$.command+":"+t+"="+w$.relation.keys.map((z$)=>j[z$.name]),j,w$)}function N$(){let j=Buffer.alloc(34);j[0]=114,j.fill(f.lsn,1),j.writeBigInt64BE(BigInt(Date.now()-Date.UTC(2000,0,1))*BigInt(1000),25),C.write(j)}}function V(A,D,J){W.has(A)&&W.get(A).forEach(({fn:L})=>L(D,J,A))}}function EI($){return new Date(Date.UTC(2000,0,1)+Number($/BigInt(1000)))}function MI($,T,W,U,X){let w=(Y,[G,H])=>(Y[G.charCodeAt(0)]=H,Y);Object.entries({R:(Y)=>{let G=1,H=T[Y.readUInt32BE(G)]={schema:Y.toString("utf8",G+=4,G=Y.indexOf(0,G))||"pg_catalog",table:Y.toString("utf8",G+1,G=Y.indexOf(0,G+1)),columns:Array(Y.readUInt16BE(G+=2)),keys:[]};G+=2;let z=0,F;while(G<Y.length)F=H.columns[z++]={key:Y[G++],name:X.column.from?X.column.from(Y.toString("utf8",G,G=Y.indexOf(0,G))):Y.toString("utf8",G,G=Y.indexOf(0,G)),type:Y.readUInt32BE(G+=1),parser:W[Y.readUInt32BE(G)],atttypmod:Y.readUInt32BE(G+=4)},F.key&&H.keys.push(F),G+=4},Y:()=>{},O:()=>{},B:(Y)=>{T.date=EI(Y.readBigInt64BE(9)),T.lsn=Y.subarray(1,9)},I:(Y)=>{let G=1,H=T[Y.readUInt32BE(G)],{row:z}=oz(Y,H.columns,G+=7,X);U(z,{command:"insert",relation:H})},D:(Y)=>{let G=1,H=T[Y.readUInt32BE(G)];G+=4;let z=Y[G]===75;U(z||Y[G]===79?oz(Y,H.columns,G+=3,X).row:null,{command:"delete",relation:H,key:z})},U:(Y)=>{let G=1,H=T[Y.readUInt32BE(G)];G+=4;let z=Y[G]===75,F=z||Y[G]===79?oz(Y,H.columns,G+=3,X):null;F&&(G=F.i);let{row:O}=oz(Y,H.columns,G+3,X);U(O,{command:"update",relation:H,key:z,old:F&&F.row})},T:()=>{},C:()=>{}}).reduce(w,{})[$[0]]($)}function oz($,T,W,U){let X,w,Y,G=U.raw?new Array(T.length):{};for(let H=0;H<T.length;H++)X=$[W++],w=T[H],Y=X===110?null:X===117?void 0:w.parser===void 0?$.toString("utf8",W+4,W+=4+$.readUInt32BE(W)):w.parser.array===!0?w.parser($.toString("utf8",W+5,W+=4+$.readUInt32BE(W))):w.parser($.toString("utf8",W+4,W+=4+$.readUInt32BE(W))),U.raw?G[H]=U.raw===!0?Y:U.value.from?U.value.from(Y,w):Y:G[w.name]=U.value.from?U.value.from(Y,w):Y;return{i:W,row:U.row.from?U.row.from(G):G}}function DI($){let T=$.match(/^(\*|insert|update|delete)?:?([^.]+?\.?[^=]+)?=?(.+)?/i)||[];if(!T)throw new Error("Malformed subscribe pattern: "+$);let[,W,U,X]=T;return(W||"*")+(U?":"+(U.indexOf(".")===-1?"public."+U:U):"")+(X?"="+X:"")}import rL from"stream";function _Q($,T,W=393216){return new Promise(async(U,X)=>{await $.begin(async(w)=>{let Y;!T&&([{oid:T}]=await w`select lo_creat(-1) as oid`);let[{fd:G}]=await w`select lo_open(${T}, ${W}) as fd`,H={writable:F,readable:z,close:()=>w`select lo_close(${G})`.then(Y),tell:()=>w`select lo_tell64(${G})`,read:(O)=>w`select loread(${G}, ${O}) as data`,write:(O)=>w`select lowrite(${G}, ${O})`,truncate:(O)=>w`select lo_truncate64(${G}, ${O})`,seek:(O,Q=0)=>w`select lo_lseek64(${G}, ${O}, ${Q})`,size:()=>w`
|
|
94
118
|
select
|
|
95
119
|
lo_lseek64(${G}, location, 0) as position,
|
|
96
120
|
seek.size
|
|
@@ -100,63 +124,63 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
100
124
|
tell.location
|
|
101
125
|
from (select lo_tell64($1) as location) tell
|
|
102
126
|
) seek
|
|
103
|
-
`};return X(H),new Promise(async(O)=>Y=O);async function z({highWaterMark:O=16384,start:Q=0,end:Z=1/0}={}){let K=Z-Q;return Q&&await H.seek(Q),new yJ.Readable({highWaterMark:O,async read(A){let D=A>K?A-K:A;K-=A;let[{data:L}]=await H.read(D);if(this.push(L),L.length<A)this.push(null)}})}async function F({highWaterMark:O=16384,start:Q=0}={}){return Q&&await H.seek(Q),new yJ.Writable({highWaterMark:O,write(Z,K,A){H.write(Z).then(()=>A(),A)}})}}).catch(U)})}Object.assign(dz,{PostgresError:n2,toPascal:PW,pascal:QQ,toCamel:vW,camel:OQ,toKebab:qW,kebab:ZQ,fromPascal:Q8,fromCamel:O8,fromKebab:Z8,BigInt:{to:20,from:[20],parse:($)=>BigInt($),serialize:($)=>$.toString()}});var t2=dz;function dz($,T){let W=AB($,T),X=W.no_subscribe||MQ(dz,{...W}),U=!1,w=O1(),Y=O1(),G=O1(),H=O1(),z=O1(),F=O1(),O=O1(),Q=O1(),Z={connecting:Y,reserved:G,closed:H,ended:z,open:F,busy:O,full:Q},K=[...Array(W.max)].map(()=>EQ(W,Z,{onopen:h4,onend:e$,onclose:n6})),A=D(T$);return Object.assign(A,{get parameters(){return W.parameters},largeObject:DQ.bind(null,A),subscribe:X,CLOSE:r2,END:r2,PostgresError:n2,options:W,reserve:_,listen:L,begin:C,close:t,end:w$}),A;function D(c){return c.debug=W.debug,Object.entries(W.types).reduce((L$,[c$,D4])=>{return L$[c$]=(G4)=>new G0(G4,D4.to),L$},F$),Object.assign(m$,{types:F$,typed:F$,unsafe:Y4,notify:J,array:g,json:b,file:_4}),m$;function F$(L$,c$){return new G0(L$,c$)}function m$(L$,...c$){return L$&&Array.isArray(L$.raw)?new J1(L$,c$,c,j):typeof L$==="string"&&!c$.length?new V8(W.transform.column.to?W.transform.column.to(L$):L$):new hz(L$,c$)}function Y4(L$,c$=[],D4={}){return arguments.length===2&&!Array.isArray(c$)&&(D4=c$,c$=[]),new J1([L$],c$,c,j,{prepare:!1,...D4,simple:"simple"in D4?D4.simple:c$.length===0})}function _4(L$,c$=[],D4={}){return arguments.length===2&&!Array.isArray(c$)&&(D4=c$,c$=[]),new J1([],c$,($4)=>{KB.readFile(L$,"utf8",(t4,l$)=>{if(t4)return $4.reject(t4);$4.strings=[l$],c($4)})},j,{...D4,simple:"simple"in D4?D4.simple:c$.length===0})}}async function L(c,F$,m$){let Y4={fn:F$,onlisten:m$},_4=L.sql||(L.sql=dz({...W,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(L.channels).forEach(([$4,{listeners:t4}])=>{delete L.channels[$4],Promise.all(t4.map((l$)=>L($4,l$.fn,l$.onlisten).catch(()=>{})))})},onnotify($4,t4){$4 in L.channels&&L.channels[$4].listeners.forEach((l$)=>l$.fn(t4))}})),L$=L.channels||(L.channels={});if(c in L$){L$[c].listeners.push(Y4);let $4=await L$[c].result;return Y4.onlisten&&Y4.onlisten(),{state:$4.state,unlisten:G4}}L$[c]={result:_4`listen ${_4.unsafe('"'+c.replace(/"/g,'""')+'"')}`,listeners:[Y4]};let D4=await L$[c].result;return Y4.onlisten&&Y4.onlisten(),{state:D4.state,unlisten:G4};async function G4(){if(c in L$===!1)return;if(L$[c].listeners=L$[c].listeners.filter(($4)=>$4!==Y4),L$[c].listeners.length)return;return delete L$[c],_4`unlisten ${_4.unsafe('"'+c.replace(/"/g,'""')+'"')}`}}async function J(c,F$){return await A`select pg_notify(${c}, ${""+F$})`}async function _(){let c=O1(),F$=F.length?F.shift():await new Promise((_4,L$)=>{let c$={reserve:_4,reject:L$};w.push(c$),H.length&&B$(H.shift(),c$)});f(F$,G),F$.reserved=()=>c.length?F$.execute(c.shift()):f(F$,G),F$.reserved.release=!0;let m$=D(Y4);return m$.release=()=>{F$.reserved=null,h4(F$)},m$;function Y4(_4){F$.queue===Q?c.push(_4):F$.execute(_4)||f(F$,Q)}}async function C(c,F$){!F$&&(F$=c,c="");let m$=O1(),Y4=0,_4,L$=null;try{return await A.unsafe("begin "+c.replace(/[^a-z ]/ig,""),[],{onexecute:D4}).execute(),await Promise.race([c$(_4,F$),new Promise((G4,$4)=>_4.onclose=$4)])}catch(G4){throw G4}async function c$(G4,$4,t4){let l$=D(k4);l$.savepoint=a0,l$.prepare=(T4)=>L$=T4.replace(/[^a-z0-9$-_. ]/gi);let P1,p4;t4&&await l$`savepoint ${l$(t4)}`;try{if(p4=await new Promise((T4,q1)=>{let u1=$4(l$);Promise.resolve(Array.isArray(u1)?Promise.all(u1):u1).then(T4,q1)}),P1)throw P1}catch(T4){throw await(t4?l$`rollback to ${l$(t4)}`:l$`rollback`),T4 instanceof n2&&T4.code==="25P02"&&P1||T4}if(!t4)L$?await l$`prepare transaction '${l$.unsafe(L$)}'`:await l$`commit`;return p4;function a0(T4,q1){if(T4&&Array.isArray(T4.raw))return a0((u1)=>u1.apply(u1,arguments));return arguments.length===1&&(q1=T4,T4=null),c$(G4,q1,"s"+Y4+++(T4?"_"+T4:""))}function k4(T4){T4.catch((q1)=>P1||(P1=q1)),G4.queue===Q?m$.push(T4):G4.execute(T4)||f(G4,Q)}}function D4(G4){_4=G4,f(G4,G),G4.reserved=()=>m$.length?G4.execute(m$.shift()):f(G4,G)}}function f(c,F$){return c.queue.remove(c),F$.push(c),c.queue=F$,F$===F?c.idleTimer.start():c.idleTimer.cancel(),c}function b(c){return new G0(c,3802)}function g(c,F$){if(!Array.isArray(c))return g(Array.from(arguments));return new G0(c,F$||(c.length?bz(c)||25:0),W.shared.typeArrayMap)}function T$(c){if(U)return c.reject(J4.connection("CONNECTION_ENDED",W,W));if(F.length)return N$(F.shift(),c);if(H.length)return B$(H.shift(),c);O.length?N$(O.shift(),c):w.push(c)}function N$(c,F$){return c.execute(F$)?f(c,O):f(c,Q)}function j(c){return new Promise((F$,m$)=>{c.state?c.active?EQ(W).cancel(c.state,F$,m$):c.cancelled={resolve:F$,reject:m$}:(w.remove(c),c.cancelled=!0,c.reject(J4.generic("57014","canceling statement due to user request")),F$())})}async function w$({timeout:c=null}={}){if(U)return U;await 1;let F$;return U=Promise.race([new Promise((m$)=>c!==null&&(F$=setTimeout(z$,c*1000,m$))),Promise.all(K.map((m$)=>m$.end()).concat(L.sql?L.sql.end({timeout:0}):[],X.sql?X.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(F$))}async function t(){await Promise.all(K.map((c)=>c.end()))}async function z$(c){await Promise.all(K.map((F$)=>F$.terminate()));while(w.length)w.shift().reject(J4.connection("CONNECTION_DESTROYED",W));c()}function B$(c,F$){return f(c,Y),c.connect(F$),c}function e$(c){f(c,z)}function h4(c){if(w.length===0)return f(c,F);let F$=Math.ceil(w.length/(Y.length+1)),m$=!0;while(m$&&w.length&&F$-- >0){let Y4=w.shift();if(Y4.reserve)return Y4.reserve(c);m$=c.execute(Y4)}m$?f(c,O):f(c,Q)}function n6(c,F$){f(c,H),c.reserved=null,c.onclose&&(c.onclose(F$),c.onclose=null),W.onclose&&W.onclose(c.id),w.length&&B$(c,w.shift())}}function AB($,T){if($&&$.shared)return $;let W=process.env,X=(!$||typeof $==="string"?T:$)||{},{url:U,multihost:w}=LB($),Y=[...U.searchParams].reduce((Q,[Z,K])=>(Q[Z]=K,Q),{}),G=X.hostname||X.host||w||U.hostname||W.PGHOST||"localhost",H=X.port||U.port||W.PGPORT||5432,z=X.user||X.username||U.username||W.PGUSERNAME||W.PGUSER||JB();X.no_prepare&&(X.prepare=!1),Y.sslmode&&(Y.ssl=Y.sslmode,delete Y.sslmode),"timeout"in X&&(console.log("The timeout option is deprecated, use idle_timeout instead"),X.idle_timeout=X.timeout),Y.sslrootcert==="system"&&(Y.ssl="verify-full");let F=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],O={max:10,ssl:!1,idle_timeout:null,connect_timeout:30,max_lifetime:DB,max_pipeline:100,backoff:MB,keep_alive:60,prepare:!0,debug:!1,fetch_types:!0,publications:"alltables",target_session_attrs:null};return{host:Array.isArray(G)?G:G.split(",").map((Q)=>Q.split(":")[0]),port:Array.isArray(H)?H:G.split(",").map((Q)=>parseInt(Q.split(":")[1]||H)),path:X.path||G.indexOf("/")>-1&&G+"/.s.PGSQL."+H,database:X.database||X.db||(U.pathname||"").slice(1)||W.PGDATABASE||z,user:z,pass:X.pass||X.password||U.password||W.PGPASSWORD||"",...Object.entries(O).reduce((Q,[Z,K])=>{let A=Z in X?X[Z]:(Z in Y)?Y[Z]==="disable"||Y[Z]==="false"?!1:Y[Z]:W["PG"+Z.toUpperCase()]||K;return Q[Z]=typeof A==="string"&&F.includes(Z)?+A:A,Q},{}),connection:{application_name:W.PGAPPNAME||"postgres.js",...X.connection,...Object.entries(Y).reduce((Q,[Z,K])=>((Z in O)||(Q[Z]=K),Q),{})},types:X.types||{},target_session_attrs:EB(X,U,W),onnotice:X.onnotice,onnotify:X.onnotify,onclose:X.onclose,onparameter:X.onparameter,socket:X.socket,transform:NB(X.transform||{undefined:void 0}),parameters:{},shared:{retries:0,typeArrayMap:{}},...vJ(X.types)}}function EB($,T,W){let X=$.target_session_attrs||T.searchParams.get("target_session_attrs")||W.PGTARGETSESSIONATTRS;if(!X||["read-write","read-only","primary","standby","prefer-standby"].includes(X))return X;throw new Error("target_session_attrs "+X+" is not supported")}function MB($){return(0.5+Math.random()/2)*Math.min(3**$/100,20)}function DB(){return 60*(30+Math.random()*30)}function NB($){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 LB($){if(!$||typeof $!=="string")return{url:{searchParams:new Map}};let T=$;T=T.slice(T.indexOf("://")+3).split(/[?/]/)[0],T=decodeURIComponent(T.slice(T.indexOf("@")+1));let W=new URL($.replace(T,T.split(",")[0]));return{url:{username:decodeURIComponent(W.username),password:decodeURIComponent(W.password),host:W.host,hostname:W.hostname,port:W.port,pathname:W.pathname,searchParams:W.searchParams},multihost:T.indexOf(",")>-1&&T}}function JB(){try{return VB.userInfo().username}catch($){return process.env.USERNAME||process.env.USER||process.env.LOGNAME}}class E4{static[N]="SelectionProxyHandler";config;constructor($){this.config={...$}}get($,T){if(T==="_")return{...$._,selectedFields:new Proxy($._.selectedFields,this)};if(T===t$)return{...$[t$],selectedFields:new Proxy($[t$].selectedFields,this)};if(typeof T==="symbol")return $[T];let X=(I($,M4)?$._.selectedFields:I($,c6)?$[t$].selectedFields:$)[T];if(I(X,a.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!X.isSelectionField)return X.sql;let U=X.clone();return U.isSelectionField=!0,U}if(I(X,a)){if(this.config.sqlBehavior==="sql")return X;throw new Error(`You tried to reference "${T}" 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(I(X,p$)){if(this.config.alias)return new Proxy(X,new l2(new Proxy(X.table,new U8(this.config.alias,this.config.replaceOriginalName??!1))));return X}if(typeof X!=="object"||X===null)return X;return new Proxy(X,new E4(this.config))}}class hJ{constructor($,T){this.unique=$,this.name=T}static[N]="PgIndexBuilderOn";on(...$){return new oz($.map((T)=>{if(I(T,a))return T;T=T;let W=new ew(T.name,!!T.keyAsName,T.columnType,T.indexConfig);return T.indexConfig=JSON.parse(JSON.stringify(T.defaultConfig)),W}),this.unique,!1,this.name)}onOnly(...$){return new oz($.map((T)=>{if(I(T,a))return T;T=T;let W=new ew(T.name,!!T.keyAsName,T.columnType,T.indexConfig);return T.indexConfig=T.defaultConfig,W}),this.unique,!0,this.name)}using($,...T){return new oz(T.map((W)=>{if(I(W,a))return W;W=W;let X=new ew(W.name,!!W.keyAsName,W.columnType,W.indexConfig);return W.indexConfig=JSON.parse(JSON.stringify(W.defaultConfig)),X}),this.unique,!0,this.name,$)}}class oz{static[N]="PgIndexBuilder";config;constructor($,T,W,X,U="btree"){this.config={name:X,columns:$,unique:T,only:W,method:U}}concurrently(){return this.config.concurrently=!0,this}with($){return this.config.with=$,this}where($){return this.config.where=$,this}build($){return new gJ(this.config,$)}}class gJ{static[N]="PgIndex";config;constructor($,T){this.config={...$,table:T}}}function NQ($){return new hJ(!0,$)}function RB($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((W)=>W.toLowerCase()).join("_")}function _B($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((W,X,U)=>{let w=U===0?X.toLowerCase():`${X[0].toUpperCase()}${X.slice(1)}`;return W+w},"")}function kB($){return $}class LQ{static[N]="CasingCache";cache={};cachedTables={};convert;constructor($){this.convert=$==="snake_case"?RB:$==="camelCase"?_B:kB}getColumnCasing($){if(!$.keyAsName)return $.name;let T=$.table[l.Symbol.Schema]??"public",W=$.table[l.Symbol.OriginalName],X=`${T}.${W}.${$.name}`;if(!this.cache[X])this.cacheTable($.table);return this.cache[X]}cacheTable($){let T=$[l.Symbol.Schema]??"public",W=$[l.Symbol.OriginalName],X=`${T}.${W}`;if(!this.cachedTables[X]){for(let U of Object.values($[l.Symbol.Columns])){let w=`${X}.${U.name}`;this.cache[w]=this.convert(U.name)}this.cachedTables[X]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class A8 extends c6{static[N]="PgViewBase"}class SW{static[N]="PgDialect";casing;constructor($){this.casing=new LQ($?.casing)}async migrate($,T,W){let X=typeof W==="string"?"__drizzle_migrations":W.migrationsTable??"__drizzle_migrations",U=typeof W==="string"?"drizzle":W.migrationsSchema??"drizzle",w=R`
|
|
104
|
-
CREATE TABLE IF NOT EXISTS ${R.identifier(
|
|
127
|
+
`};return U(H),new Promise(async(O)=>Y=O);async function z({highWaterMark:O=16384,start:Q=0,end:Z=1/0}={}){let V=Z-Q;return Q&&await H.seek(Q),new rL.Readable({highWaterMark:O,async read(A){let D=A>V?A-V:A;V-=A;let[{data:J}]=await H.read(D);if(this.push(J),J.length<A)this.push(null)}})}async function F({highWaterMark:O=16384,start:Q=0}={}){return Q&&await H.seek(Q),new rL.Writable({highWaterMark:O,write(Z,V,A){H.write(Z).then(()=>A(),A)}})}}).catch(X)})}Object.assign(lz,{PostgresError:n2,toPascal:PW,pascal:EQ,toCamel:vW,camel:AQ,toKebab:qW,kebab:MQ,fromPascal:Fw,fromCamel:Hw,fromKebab:Ow,BigInt:{to:20,from:[20],parse:($)=>BigInt($),serialize:($)=>$.toString()}});var t2=lz;function lz($,T){let W=LI($,T),U=W.no_subscribe||RQ(lz,{...W}),X=!1,w=Q1(),Y=Q1(),G=Q1(),H=Q1(),z=Q1(),F=Q1(),O=Q1(),Q=Q1(),Z={connecting:Y,reserved:G,closed:H,ended:z,open:F,busy:O,full:Q},V=[...Array(W.max)].map(()=>LQ(W,Z,{onopen:h4,onend:e$,onclose:i6})),A=D(T$);return Object.assign(A,{get parameters(){return W.parameters},largeObject:_Q.bind(null,A),subscribe:U,CLOSE:r2,END:r2,PostgresError:n2,options:W,reserve:_,listen:J,begin:C,close:t,end:w$}),A;function D(c){return c.debug=W.debug,Object.entries(W.types).reduce((J$,[c$,D4])=>{return J$[c$]=(G4)=>new G0(G4,D4.to),J$},F$),Object.assign(m$,{types:F$,typed:F$,unsafe:Y4,notify:L,array:g,json:b,file:_4}),m$;function F$(J$,c$){return new G0(J$,c$)}function m$(J$,...c$){return J$&&Array.isArray(J$.raw)?new R1(J$,c$,c,j):typeof J$==="string"&&!c$.length?new Qw(W.transform.column.to?W.transform.column.to(J$):J$):new mz(J$,c$)}function Y4(J$,c$=[],D4={}){return arguments.length===2&&!Array.isArray(c$)&&(D4=c$,c$=[]),new R1([J$],c$,c,j,{prepare:!1,...D4,simple:"simple"in D4?D4.simple:c$.length===0})}function _4(J$,c$=[],D4={}){return arguments.length===2&&!Array.isArray(c$)&&(D4=c$,c$=[]),new R1([],c$,($4)=>{JI.readFile(J$,"utf8",(t4,l$)=>{if(t4)return $4.reject(t4);$4.strings=[l$],c($4)})},j,{...D4,simple:"simple"in D4?D4.simple:c$.length===0})}}async function J(c,F$,m$){let Y4={fn:F$,onlisten:m$},_4=J.sql||(J.sql=lz({...W,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(J.channels).forEach(([$4,{listeners:t4}])=>{delete J.channels[$4],Promise.all(t4.map((l$)=>J($4,l$.fn,l$.onlisten).catch(()=>{})))})},onnotify($4,t4){$4 in J.channels&&J.channels[$4].listeners.forEach((l$)=>l$.fn(t4))}})),J$=J.channels||(J.channels={});if(c in J$){J$[c].listeners.push(Y4);let $4=await J$[c].result;return Y4.onlisten&&Y4.onlisten(),{state:$4.state,unlisten:G4}}J$[c]={result:_4`listen ${_4.unsafe('"'+c.replace(/"/g,'""')+'"')}`,listeners:[Y4]};let D4=await J$[c].result;return Y4.onlisten&&Y4.onlisten(),{state:D4.state,unlisten:G4};async function G4(){if(c in J$===!1)return;if(J$[c].listeners=J$[c].listeners.filter(($4)=>$4!==Y4),J$[c].listeners.length)return;return delete J$[c],_4`unlisten ${_4.unsafe('"'+c.replace(/"/g,'""')+'"')}`}}async function L(c,F$){return await A`select pg_notify(${c}, ${""+F$})`}async function _(){let c=Q1(),F$=F.length?F.shift():await new Promise((_4,J$)=>{let c$={reserve:_4,reject:J$};w.push(c$),H.length&&I$(H.shift(),c$)});f(F$,G),F$.reserved=()=>c.length?F$.execute(c.shift()):f(F$,G),F$.reserved.release=!0;let m$=D(Y4);return m$.release=()=>{F$.reserved=null,h4(F$)},m$;function Y4(_4){F$.queue===Q?c.push(_4):F$.execute(_4)||f(F$,Q)}}async function C(c,F$){!F$&&(F$=c,c="");let m$=Q1(),Y4=0,_4,J$=null;try{return await A.unsafe("begin "+c.replace(/[^a-z ]/ig,""),[],{onexecute:D4}).execute(),await Promise.race([c$(_4,F$),new Promise((G4,$4)=>_4.onclose=$4)])}catch(G4){throw G4}async function c$(G4,$4,t4){let l$=D(k4);l$.savepoint=a0,l$.prepare=(T4)=>J$=T4.replace(/[^a-z0-9$-_. ]/gi);let q1,p4;t4&&await l$`savepoint ${l$(t4)}`;try{if(p4=await new Promise((T4,C1)=>{let p1=$4(l$);Promise.resolve(Array.isArray(p1)?Promise.all(p1):p1).then(T4,C1)}),q1)throw q1}catch(T4){throw await(t4?l$`rollback to ${l$(t4)}`:l$`rollback`),T4 instanceof n2&&T4.code==="25P02"&&q1||T4}if(!t4)J$?await l$`prepare transaction '${l$.unsafe(J$)}'`:await l$`commit`;return p4;function a0(T4,C1){if(T4&&Array.isArray(T4.raw))return a0((p1)=>p1.apply(p1,arguments));return arguments.length===1&&(C1=T4,T4=null),c$(G4,C1,"s"+Y4+++(T4?"_"+T4:""))}function k4(T4){T4.catch((C1)=>q1||(q1=C1)),G4.queue===Q?m$.push(T4):G4.execute(T4)||f(G4,Q)}}function D4(G4){_4=G4,f(G4,G),G4.reserved=()=>m$.length?G4.execute(m$.shift()):f(G4,G)}}function f(c,F$){return c.queue.remove(c),F$.push(c),c.queue=F$,F$===F?c.idleTimer.start():c.idleTimer.cancel(),c}function b(c){return new G0(c,3802)}function g(c,F$){if(!Array.isArray(c))return g(Array.from(arguments));return new G0(c,F$||(c.length?hz(c)||25:0),W.shared.typeArrayMap)}function T$(c){if(X)return c.reject(L4.connection("CONNECTION_ENDED",W,W));if(F.length)return N$(F.shift(),c);if(H.length)return I$(H.shift(),c);O.length?N$(O.shift(),c):w.push(c)}function N$(c,F$){return c.execute(F$)?f(c,O):f(c,Q)}function j(c){return new Promise((F$,m$)=>{c.state?c.active?LQ(W).cancel(c.state,F$,m$):c.cancelled={resolve:F$,reject:m$}:(w.remove(c),c.cancelled=!0,c.reject(L4.generic("57014","canceling statement due to user request")),F$())})}async function w$({timeout:c=null}={}){if(X)return X;await 1;let F$;return X=Promise.race([new Promise((m$)=>c!==null&&(F$=setTimeout(z$,c*1000,m$))),Promise.all(V.map((m$)=>m$.end()).concat(J.sql?J.sql.end({timeout:0}):[],U.sql?U.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(F$))}async function t(){await Promise.all(V.map((c)=>c.end()))}async function z$(c){await Promise.all(V.map((F$)=>F$.terminate()));while(w.length)w.shift().reject(L4.connection("CONNECTION_DESTROYED",W));c()}function I$(c,F$){return f(c,Y),c.connect(F$),c}function e$(c){f(c,z)}function h4(c){if(w.length===0)return f(c,F);let F$=Math.ceil(w.length/(Y.length+1)),m$=!0;while(m$&&w.length&&F$-- >0){let Y4=w.shift();if(Y4.reserve)return Y4.reserve(c);m$=c.execute(Y4)}m$?f(c,O):f(c,Q)}function i6(c,F$){f(c,H),c.reserved=null,c.onclose&&(c.onclose(F$),c.onclose=null),W.onclose&&W.onclose(c.id),w.length&&I$(c,w.shift())}}function LI($,T){if($&&$.shared)return $;let W=process.env,U=(!$||typeof $==="string"?T:$)||{},{url:X,multihost:w}=PI($),Y=[...X.searchParams].reduce((Q,[Z,V])=>(Q[Z]=V,Q),{}),G=U.hostname||U.host||w||X.hostname||W.PGHOST||"localhost",H=U.port||X.port||W.PGPORT||5432,z=U.user||U.username||X.username||W.PGUSERNAME||W.PGUSER||qI();U.no_prepare&&(U.prepare=!1),Y.sslmode&&(Y.ssl=Y.sslmode,delete Y.sslmode),"timeout"in U&&(console.log("The timeout option is deprecated, use idle_timeout instead"),U.idle_timeout=U.timeout),Y.sslrootcert==="system"&&(Y.ssl="verify-full");let F=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],O={max:10,ssl:!1,idle_timeout:null,connect_timeout:30,max_lifetime:kI,max_pipeline:100,backoff:_I,keep_alive:60,prepare:!0,debug:!1,fetch_types:!0,publications:"alltables",target_session_attrs:null};return{host:Array.isArray(G)?G:G.split(",").map((Q)=>Q.split(":")[0]),port:Array.isArray(H)?H:G.split(",").map((Q)=>parseInt(Q.split(":")[1]||H)),path:U.path||G.indexOf("/")>-1&&G+"/.s.PGSQL."+H,database:U.database||U.db||(X.pathname||"").slice(1)||W.PGDATABASE||z,user:z,pass:U.pass||U.password||X.password||W.PGPASSWORD||"",...Object.entries(O).reduce((Q,[Z,V])=>{let A=Z in U?U[Z]:(Z in Y)?Y[Z]==="disable"||Y[Z]==="false"?!1:Y[Z]:W["PG"+Z.toUpperCase()]||V;return Q[Z]=typeof A==="string"&&F.includes(Z)?+A:A,Q},{}),connection:{application_name:W.PGAPPNAME||"postgres.js",...U.connection,...Object.entries(Y).reduce((Q,[Z,V])=>((Z in O)||(Q[Z]=V),Q),{})},types:U.types||{},target_session_attrs:RI(U,X,W),onnotice:U.onnotice,onnotify:U.onnotify,onclose:U.onclose,onparameter:U.onparameter,socket:U.socket,transform:vI(U.transform||{undefined:void 0}),parameters:{},shared:{retries:0,typeArrayMap:{}},...bL(U.types)}}function RI($,T,W){let U=$.target_session_attrs||T.searchParams.get("target_session_attrs")||W.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 _I($){return(0.5+Math.random()/2)*Math.min(3**$/100,20)}function kI(){return 60*(30+Math.random()*30)}function vI($){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 PI($){if(!$||typeof $!=="string")return{url:{searchParams:new Map}};let T=$;T=T.slice(T.indexOf("://")+3).split(/[?/]/)[0],T=decodeURIComponent(T.slice(T.indexOf("@")+1));let W=new URL($.replace(T,T.split(",")[0]));return{url:{username:decodeURIComponent(W.username),password:decodeURIComponent(W.password),host:W.host,hostname:W.hostname,port:W.port,pathname:W.pathname,searchParams:W.searchParams},multihost:T.indexOf(",")>-1&&T}}function qI(){try{return NI.userInfo().username}catch($){return process.env.USERNAME||process.env.USER||process.env.LOGNAME}}class E4{static[N]="SelectionProxyHandler";config;constructor($){this.config={...$}}get($,T){if(T==="_")return{...$._,selectedFields:new Proxy($._.selectedFields,this)};if(T===t$)return{...$[t$],selectedFields:new Proxy($[t$].selectedFields,this)};if(typeof T==="symbol")return $[T];let U=(B($,M4)?$._.selectedFields:B($,u6)?$[t$].selectedFields:$)[T];if(B(U,a.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!U.isSelectionField)return U.sql;let X=U.clone();return X.isSelectionField=!0,X}if(B(U,a)){if(this.config.sqlBehavior==="sql")return U;throw new Error(`You tried to reference "${T}" 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,p$)){if(this.config.alias)return new Proxy(U,new l2(new Proxy(U.table,new Tw(this.config.alias,this.config.replaceOriginalName??!1))));return U}if(typeof U!=="object"||U===null)return U;return new Proxy(U,new E4(this.config))}}class nL{constructor($,T){this.unique=$,this.name=T}static[N]="PgIndexBuilderOn";on(...$){return new rz($.map((T)=>{if(B(T,a))return T;T=T;let W=new aU(T.name,!!T.keyAsName,T.columnType,T.indexConfig);return T.indexConfig=JSON.parse(JSON.stringify(T.defaultConfig)),W}),this.unique,!1,this.name)}onOnly(...$){return new rz($.map((T)=>{if(B(T,a))return T;T=T;let W=new aU(T.name,!!T.keyAsName,T.columnType,T.indexConfig);return T.indexConfig=T.defaultConfig,W}),this.unique,!0,this.name)}using($,...T){return new rz(T.map((W)=>{if(B(W,a))return W;W=W;let U=new aU(W.name,!!W.keyAsName,W.columnType,W.indexConfig);return W.indexConfig=JSON.parse(JSON.stringify(W.defaultConfig)),U}),this.unique,!0,this.name,$)}}class rz{static[N]="PgIndexBuilder";config;constructor($,T,W,U,X="btree"){this.config={name:U,columns:$,unique:T,only:W,method:X}}concurrently(){return this.config.concurrently=!0,this}with($){return this.config.with=$,this}where($){return this.config.where=$,this}build($){return new iL(this.config,$)}}class iL{static[N]="PgIndex";config;constructor($,T){this.config={...$,table:T}}}function kQ($){return new nL(!0,$)}function CI($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((W)=>W.toLowerCase()).join("_")}function SI($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((W,U,X)=>{let w=X===0?U.toLowerCase():`${U[0].toUpperCase()}${U.slice(1)}`;return W+w},"")}function jI($){return $}class vQ{static[N]="CasingCache";cache={};cachedTables={};convert;constructor($){this.convert=$==="snake_case"?CI:$==="camelCase"?SI:jI}getColumnCasing($){if(!$.keyAsName)return $.name;let T=$.table[l.Symbol.Schema]??"public",W=$.table[l.Symbol.OriginalName],U=`${T}.${W}.${$.name}`;if(!this.cache[U])this.cacheTable($.table);return this.cache[U]}cacheTable($){let T=$[l.Symbol.Schema]??"public",W=$[l.Symbol.OriginalName],U=`${T}.${W}`;if(!this.cachedTables[U]){for(let X of Object.values($[l.Symbol.Columns])){let w=`${U}.${X.name}`;this.cache[w]=this.convert(X.name)}this.cachedTables[U]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class Vw extends u6{static[N]="PgViewBase"}class SW{static[N]="PgDialect";casing;constructor($){this.casing=new vQ($?.casing)}async migrate($,T,W){let U=typeof W==="string"?"__drizzle_migrations":W.migrationsTable??"__drizzle_migrations",X=typeof W==="string"?"drizzle":W.migrationsSchema??"drizzle",w=R`
|
|
128
|
+
CREATE TABLE IF NOT EXISTS ${R.identifier(X)}.${R.identifier(U)} (
|
|
105
129
|
id SERIAL PRIMARY KEY,
|
|
106
130
|
hash text NOT NULL,
|
|
107
131
|
created_at bigint
|
|
108
132
|
)
|
|
109
|
-
`;await T.execute(R`CREATE SCHEMA IF NOT EXISTS ${R.identifier(U)}`),await T.execute(w);let G=(await T.all(R`select id, hash, created_at from ${R.identifier(U)}.${R.identifier(X)} order by created_at desc limit 1`))[0];await T.transaction(async(H)=>{for await(let z of $)if(!G||Number(G.created_at)<z.folderMillis){for(let F of z.sql)await H.execute(R.raw(F));await H.execute(R`insert into ${R.identifier(U)}.${R.identifier(X)} ("hash", "created_at") values(${z.hash}, ${z.folderMillis})`)}})}escapeName($){return`"${$}"`}escapeParam($){return`$${$+1}`}escapeString($){return`'${$.replace(/'/g,"''")}'`}buildWithCTE($){if(!$?.length)return;let T=[R`with `];for(let[W,X]of $.entries())if(T.push(R`${R.identifier(X._.alias)} as (${X._.sql})`),W<$.length-1)T.push(R`, `);return T.push(R` `),R.join(T)}buildDeleteQuery({table:$,where:T,returning:W,withList:X}){let U=this.buildWithCTE(X),w=W?R` returning ${this.buildSelection(W,{isSingleTable:!0})}`:void 0,Y=T?R` where ${T}`:void 0;return R`${U}delete from ${$}${Y}${w}`}buildUpdateSet($,T){let W=$[l.Symbol.Columns],X=Object.keys(W).filter((w)=>T[w]!==void 0||W[w]?.onUpdateFn!==void 0),U=X.length;return R.join(X.flatMap((w,Y)=>{let G=W[w],H=T[w]??R.param(G.onUpdateFn(),G),z=R`${R.identifier(this.casing.getColumnCasing(G))} = ${H}`;if(Y<U-1)return[z,R.raw(", ")];return[z]}))}buildUpdateQuery({table:$,set:T,where:W,returning:X,withList:U,from:w,joins:Y}){let G=this.buildWithCTE(U),H=$[x4.Symbol.Name],z=$[x4.Symbol.Schema],F=$[x4.Symbol.OriginalName],O=H===F?void 0:H,Q=R`${z?R`${R.identifier(z)}.`:void 0}${R.identifier(F)}${O&&R` ${R.identifier(O)}`}`,Z=this.buildUpdateSet($,T),K=w&&R.join([R.raw(" from "),this.buildFromTable(w)]),A=this.buildJoins(Y),D=X?R` returning ${this.buildSelection(X,{isSingleTable:!w})}`:void 0,L=W?R` where ${W}`:void 0;return R`${G}update ${Q} set ${Z}${K}${A}${L}${D}`}buildSelection($,{isSingleTable:T=!1}={}){let W=$.length,X=$.flatMap(({field:U},w)=>{let Y=[];if(I(U,a.Aliased)&&U.isSelectionField)Y.push(R.identifier(U.fieldAlias));else if(I(U,a.Aliased)||I(U,a)){let G=I(U,a.Aliased)?U.sql:U;if(T)Y.push(new a(G.queryChunks.map((H)=>{if(I(H,d))return R.identifier(this.casing.getColumnCasing(H));return H})));else Y.push(G);if(I(U,a.Aliased))Y.push(R` as ${R.identifier(U.fieldAlias)}`)}else if(I(U,p$))if(T)Y.push(R.identifier(this.casing.getColumnCasing(U)));else Y.push(U);if(w<W-1)Y.push(R`, `);return Y});return R.join(X)}buildJoins($){if(!$||$.length===0)return;let T=[];for(let[W,X]of $.entries()){if(W===0)T.push(R` `);let U=X.table,w=X.lateral?R` lateral`:void 0,Y=X.on?R` on ${X.on}`:void 0;if(I(U,x4)){let G=U[x4.Symbol.Name],H=U[x4.Symbol.Schema],z=U[x4.Symbol.OriginalName],F=G===z?void 0:X.alias;T.push(R`${R.raw(X.joinType)} join${w} ${H?R`${R.identifier(H)}.`:void 0}${R.identifier(z)}${F&&R` ${R.identifier(F)}`}${Y}`)}else if(I(U,c6)){let G=U[t$].name,H=U[t$].schema,z=U[t$].originalName,F=G===z?void 0:X.alias;T.push(R`${R.raw(X.joinType)} join${w} ${H?R`${R.identifier(H)}.`:void 0}${R.identifier(z)}${F&&R` ${R.identifier(F)}`}${Y}`)}else T.push(R`${R.raw(X.joinType)} join${w} ${U}${Y}`);if(W<$.length-1)T.push(R` `)}return R.join(T)}buildFromTable($){if(I($,l)&&$[l.Symbol.IsAlias]){let T=R`${R.identifier($[l.Symbol.OriginalName])}`;if($[l.Symbol.Schema])T=R`${R.identifier($[l.Symbol.Schema])}.${T}`;return R`${T} ${R.identifier($[l.Symbol.Name])}`}return $}buildSelectQuery({withList:$,fields:T,fieldsFlat:W,where:X,having:U,table:w,joins:Y,orderBy:G,groupBy:H,limit:z,offset:F,lockingClause:O,distinct:Q,setOperators:Z}){let K=W??N1(T);for(let z$ of K)if(I(z$.field,p$)&&u4(z$.field.table)!==(I(w,M4)?w._.alias:I(w,A8)?w[t$].name:I(w,a)?void 0:u4(w))&&!((B$)=>Y?.some(({alias:e$})=>e$===(B$[l.Symbol.IsAlias]?u4(B$):B$[l.Symbol.BaseName])))(z$.field.table)){let B$=u4(z$.field.table);throw new Error(`Your "${z$.path.join("->")}" field references a column "${B$}"."${z$.field.name}", but the table "${B$}" is not part of the query! Did you forget to join it?`)}let A=!Y||Y.length===0,D=this.buildWithCTE($),L;if(Q)L=Q===!0?R` distinct`:R` distinct on (${R.join(Q.on,R`, `)})`;let J=this.buildSelection(K,{isSingleTable:A}),_=this.buildFromTable(w),C=this.buildJoins(Y),f=X?R` where ${X}`:void 0,b=U?R` having ${U}`:void 0,g;if(G&&G.length>0)g=R` order by ${R.join(G,R`, `)}`;let T$;if(H&&H.length>0)T$=R` group by ${R.join(H,R`, `)}`;let N$=typeof z==="object"||typeof z==="number"&&z>=0?R` limit ${z}`:void 0,j=F?R` offset ${F}`:void 0,w$=R.empty();if(O){let z$=R` for ${R.raw(O.strength)}`;if(O.config.of)z$.append(R` of ${R.join(Array.isArray(O.config.of)?O.config.of:[O.config.of],R`, `)}`);if(O.config.noWait)z$.append(R` nowait`);else if(O.config.skipLocked)z$.append(R` skip locked`);w$.append(z$)}let t=R`${D}select${L} ${J} from ${_}${C}${f}${T$}${b}${g}${N$}${j}${w$}`;if(Z.length>0)return this.buildSetOperations(t,Z);return t}buildSetOperations($,T){let[W,...X]=T;if(!W)throw new Error("Cannot pass undefined values to any set operator");if(X.length===0)return this.buildSetOperationQuery({leftSelect:$,setOperator:W});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:$,setOperator:W}),X)}buildSetOperationQuery({leftSelect:$,setOperator:{type:T,isAll:W,rightSelect:X,limit:U,orderBy:w,offset:Y}}){let G=R`(${$.getSQL()}) `,H=R`(${X.getSQL()})`,z;if(w&&w.length>0){let Z=[];for(let K of w)if(I(K,d))Z.push(R.identifier(K.name));else if(I(K,a)){for(let A=0;A<K.queryChunks.length;A++){let D=K.queryChunks[A];if(I(D,d))K.queryChunks[A]=R.identifier(D.name)}Z.push(R`${K}`)}else Z.push(R`${K}`);z=R` order by ${R.join(Z,R`, `)} `}let F=typeof U==="object"||typeof U==="number"&&U>=0?R` limit ${U}`:void 0,O=R.raw(`${T} ${W?"all ":""}`),Q=Y?R` offset ${Y}`:void 0;return R`${G}${O}${H}${z}${F}${Q}`}buildInsertQuery({table:$,values:T,onConflict:W,returning:X,withList:U,select:w,overridingSystemValue_:Y}){let G=[],H=$[l.Symbol.Columns],z=Object.entries(H).filter(([D,L])=>!L.shouldDisableInsert()),F=z.map(([,D])=>R.identifier(this.casing.getColumnCasing(D)));if(w){let D=T;if(I(D,a))G.push(D);else G.push(D.getSQL())}else{let D=T;G.push(R.raw("values "));for(let[L,J]of D.entries()){let _=[];for(let[C,f]of z){let b=J[C];if(b===void 0||I(b,F1)&&b.value===void 0)if(f.defaultFn!==void 0){let g=f.defaultFn(),T$=I(g,a)?g:R.param(g,f);_.push(T$)}else if(!f.default&&f.onUpdateFn!==void 0){let g=f.onUpdateFn(),T$=I(g,a)?g:R.param(g,f);_.push(T$)}else _.push(R`default`);else _.push(b)}if(G.push(_),L<D.length-1)G.push(R`, `)}}let O=this.buildWithCTE(U),Q=R.join(G),Z=X?R` returning ${this.buildSelection(X,{isSingleTable:!0})}`:void 0,K=W?R` on conflict ${W}`:void 0,A=Y===!0?R`overriding system value `:void 0;return R`${O}insert into ${$} ${F} ${A}${Q}${K}${Z}`}buildRefreshMaterializedViewQuery({view:$,concurrently:T,withNoData:W}){let X=T?R` concurrently`:void 0,U=W?R` with no data`:void 0;return R`refresh materialized view${X} ${$}${U}`}prepareTyping($){if(I($,kz)||I($,_z))return"json";else if(I($,vz))return"decimal";else if(I($,Pz))return"time";else if(I($,qz)||I($,Cz))return"timestamp";else if(I($,Jz)||I($,Rz))return"date";else if(I($,Sz))return"uuid";else return"none"}sqlToQuery($,T){return $.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:T})}buildRelationalQueryWithoutPK({fullSchema:$,schema:T,tableNamesMap:W,table:X,tableConfig:U,queryConfig:w,tableAlias:Y,nestedQueryRelation:G,joinOn:H}){let z=[],F,O,Q=[],Z,K=[];if(w===!0)z=Object.entries(U.columns).map(([L,J])=>({dbKey:J.name,tsKey:L,field:Y0(J,Y),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let D=Object.fromEntries(Object.entries(U.columns).map(([b,g])=>[b,Y0(g,Y)]));if(w.where){let b=typeof w.where==="function"?w.where(D,ZJ()):w.where;Z=b&&X8(b,Y)}let L=[],J=[];if(w.columns){let b=!1;for(let[g,T$]of Object.entries(w.columns)){if(T$===void 0)continue;if(g in U.columns){if(!b&&T$===!0)b=!0;J.push(g)}}if(J.length>0)J=b?J.filter((g)=>w.columns?.[g]===!0):Object.keys(U.columns).filter((g)=>!J.includes(g))}else J=Object.keys(U.columns);for(let b of J){let g=U.columns[b];L.push({tsKey:b,value:g})}let _=[];if(w.with)_=Object.entries(w.with).filter((b)=>!!b[1]).map(([b,g])=>({tsKey:b,queryConfig:g,relation:U.relations[b]}));let C;if(w.extras){C=typeof w.extras==="function"?w.extras(D,{sql:R}):w.extras;for(let[b,g]of Object.entries(C))L.push({tsKey:b,value:iO(g,Y)})}for(let{tsKey:b,value:g}of L)z.push({dbKey:I(g,a.Aliased)?g.fieldAlias:U.columns[b].name,tsKey:b,field:I(g,p$)?Y0(g,Y):g,relationTableTsKey:void 0,isJson:!1,selection:[]});let f=typeof w.orderBy==="function"?w.orderBy(D,VJ()):w.orderBy??[];if(!Array.isArray(f))f=[f];Q=f.map((b)=>{if(I(b,p$))return Y0(b,Y);return X8(b,Y)}),F=w.limit,O=w.offset;for(let{tsKey:b,queryConfig:g,relation:T$}of _){let N$=AJ(T,W,T$),j=kW(T$.referencedTable),w$=W[j],t=`${Y}_${b}`,z$=H8(...N$.fields.map((h4,n6)=>jz(Y0(N$.references[n6],t),Y0(h4,Y)))),B$=this.buildRelationalQueryWithoutPK({fullSchema:$,schema:T,tableNamesMap:W,table:$[w$],tableConfig:T[w$],queryConfig:I(T$,qT)?g===!0?{limit:1}:{...g,limit:1}:g,tableAlias:t,joinOn:z$,nestedQueryRelation:T$}),e$=R`${R.identifier(t)}.${R.identifier("data")}`.as(b);K.push({on:R`true`,table:new M4(B$.sql,{},t),alias:t,joinType:"left",lateral:!0}),z.push({dbKey:b,tsKey:b,field:e$,relationTableTsKey:w$,isJson:!0,selection:B$.selection})}}if(z.length===0)throw new Nz({message:`No fields selected for table "${U.tsName}" ("${Y}")`});let A;if(Z=H8(H,Z),G){let D=R`json_build_array(${R.join(z.map(({field:_,tsKey:C,isJson:f})=>f?R`${R.identifier(`${Y}_${C}`)}.${R.identifier("data")}`:I(_,a.Aliased)?_.sql:_),R`, `)})`;if(I(G,F8))D=R`coalesce(json_agg(${D}${Q.length>0?R` order by ${R.join(Q,R`, `)}`:void 0}), '[]'::json)`;let L=[{dbKey:"data",tsKey:"data",field:D.as("data"),isJson:!0,relationTableTsKey:U.tsName,selection:z}];if(F!==void 0||O!==void 0||Q.length>0)A=this.buildSelectQuery({table:Dz(X,Y),fields:{},fieldsFlat:[{path:[],field:R.raw("*")}],where:Z,limit:F,offset:O,orderBy:Q,setOperators:[]}),Z=void 0,F=void 0,O=void 0,Q=[];else A=Dz(X,Y);A=this.buildSelectQuery({table:I(A,x4)?A:new M4(A,{},Y),fields:{},fieldsFlat:L.map(({field:_})=>({path:[],field:I(_,p$)?Y0(_,Y):_})),joins:K,where:Z,limit:F,offset:O,orderBy:Q,setOperators:[]})}else A=this.buildSelectQuery({table:Dz(X,Y),fields:{},fieldsFlat:z.map(({field:D})=>({path:[],field:I(D,p$)?Y0(D,Y):D})),joins:K,where:Z,limit:F,offset:O,orderBy:Q,setOperators:[]});return{tableTsKey:U.tsName,sql:A,selection:z}}}class JQ{static[N]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class q6{static[N]="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 T=!!this.fields,W=$,X;if(this.fields)X=this.fields;else if(I(W,M4))X=Object.fromEntries(Object.keys(W._.selectedFields).map((U)=>[U,W[U]]));else if(I(W,A8))X=W[t$].selectedFields;else if(I(W,a))X={};else X=lD(W);return new RQ({table:W,fields:X,isPartialSelect:T,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}class mJ extends JQ{static[N]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:$,fields:T,isPartialSelect:W,session:X,dialect:U,withList:w,distinct:Y}){super();this.config={withList:w,table:$,fields:{...T},distinct:Y,setOperators:[]},this.isPartialSelect=W,this.session=X,this.dialect=U,this._={selectedFields:T,config:this.config},this.tableName=y0($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let G of b1($))this.usedTables.add(G)}getUsedTables(){return[...this.usedTables]}createJoin($,T){return(W,X)=>{let U=this.tableName,w=y0(W);for(let Y of b1(W))this.usedTables.add(Y);if(typeof w==="string"&&this.config.joins?.some((Y)=>Y.alias===w))throw new Error(`Alias "${w}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof U==="string")this.config.fields={[U]:this.config.fields};if(typeof w==="string"&&!I(W,a)){let Y=I(W,M4)?W._.selectedFields:I(W,c6)?W[t$].selectedFields:W[l.Symbol.Columns];this.config.fields[w]=Y}}if(typeof X==="function")X=X(new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:X,table:W,joinType:$,alias:w,lateral:T}),typeof w==="string")switch($){case"left":{this.joinsNotNullableMap[w]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([Y])=>[Y,!1])),this.joinsNotNullableMap[w]=!0;break}case"cross":case"inner":{this.joinsNotNullableMap[w]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([Y])=>[Y,!1])),this.joinsNotNullableMap[w]=!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($,T){return(W)=>{let X=typeof W==="function"?W(vB()):W;if(!w8(this.getSelectedFields(),X.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:T,rightSelect:X}),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 E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=$,this}having($){if(typeof $==="function")$=$(new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=$,this}groupBy(...$){if(typeof $[0]==="function"){let T=$[0](new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(T)?T:[T]}else this.config.groupBy=$;return this}orderBy(...$){if(typeof $[0]==="function"){let T=$[0](new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),W=Array.isArray(T)?T:[T];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=W;else this.config.orderBy=W}else{let T=$;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=T;else this.config.orderBy=T}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($,T={}){return this.config.lockingClause={strength:$,config:T},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}as($){let T=[];if(T.push(...b1(this.config.table)),this.config.joins)for(let W of this.config.joins)T.push(...b1(W.table));return new Proxy(new M4(this.getSQL(),this.config.fields,$,!1,[...new Set(T)]),new E4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new E4({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 RQ extends mJ{static[N]="PgSelect";_prepare($){let{session:T,config:W,dialect:X,joinsNotNullableMap:U,authToken:w,cacheConfig:Y,usedTables:G}=this;if(!T)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");let{fields:H}=W;return d$.startActiveSpan("drizzle.prepareQuery",()=>{let z=N1(H),F=T.prepareQuery(X.sqlToQuery(this.getSQL()),z,$,!0,void 0,{type:"select",tables:[...G]},Y);return F.joinsNotNullableMap=U,F.setToken(w)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})}}oD(RQ,[P6]);function a2($,T){return(W,X,...U)=>{let w=[X,...U].map((Y)=>({type:$,isAll:T,rightSelect:Y}));for(let Y of w)if(!w8(W.getSelectedFields(),Y.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return W.addSetOperators(w)}}var vB=()=>({union:PB,unionAll:qB,intersect:CB,intersectAll:SB,except:jB,exceptAll:IB}),PB=a2("union",!1),qB=a2("union",!0),CB=a2("intersect",!1),SB=a2("intersect",!0),jB=a2("except",!1),IB=a2("except",!0);class E8{static[N]="PgQueryBuilder";dialect;dialectConfig;constructor($){this.dialect=I($,SW)?$:void 0,this.dialectConfig=I($,SW)?void 0:$}$with=($,T)=>{let W=this;return{as:(U)=>{if(typeof U==="function")U=U(W);return new Proxy(new T8(U.getSQL(),T??("getSelectedFields"in U?U.getSelectedFields()??{}:{}),$,!0),new E4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...$){let T=this;function W(w){return new q6({fields:w??void 0,session:void 0,dialect:T.getDialect(),withList:$})}function X(w){return new q6({fields:w??void 0,session:void 0,dialect:T.getDialect(),distinct:!0})}function U(w,Y){return new q6({fields:Y??void 0,session:void 0,dialect:T.getDialect(),distinct:{on:w}})}return{select:W,selectDistinct:X,selectDistinctOn:U}}select($){return new q6({fields:$??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct($){return new q6({fields:$??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn($,T){return new q6({fields:T??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:$}})}getDialect(){if(!this.dialect)this.dialect=new SW(this.dialectConfig);return this.dialect}}function b1($){if(I($,x4))return[$[_W]?`${$[_W]}.${$[l.Symbol.BaseName]}`:$[l.Symbol.BaseName]];if(I($,M4))return $._.usedTables??[];if(I($,a))return $.usedTables??[];return[]}class lz extends P6{constructor($,T,W,X){super();this.session=T,this.dialect=W,this.config={table:$,withList:X}}static[N]="PgDelete";config;cacheConfig;where($){return this.config.where=$,this}returning($=this.config.table[l.Symbol.Columns]){return this.config.returningFields=$,this.config.returning=N1($),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){return d$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"delete",tables:b1(this.config.table)},this.cacheConfig)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new E4({alias:u4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class rz{constructor($,T,W,X,U){this.table=$,this.session=T,this.dialect=W,this.withList=X,this.overridingSystemValue_=U}static[N]="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 T=$.map((W)=>{let X={},U=this.table[l.Symbol.Columns];for(let w of Object.keys(W)){let Y=W[w];X[w]=I(Y,a)?Y:new F1(Y,U[w])}return X});return new _Q(this.table,T,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select($){let T=typeof $==="function"?$(new E8):$;if(!I(T,a)&&!w8(this.table[Ez],T._.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 _Q(this.table,T,this.session,this.dialect,this.withList,!0)}}class _Q extends P6{constructor($,T,W,X,U,w,Y){super();this.session=W,this.dialect=X,this.config={table:$,values:T,withList:U,select:w,overridingSystemValue_:Y}}static[N]="PgInsert";config;cacheConfig;returning($=this.config.table[l.Symbol.Columns]){return this.config.returningFields=$,this.config.returning=N1($),this}onConflictDoNothing($={}){if($.target===void 0)this.config.onConflict=R`do nothing`;else{let T="";T=Array.isArray($.target)?$.target.map((X)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(X))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing($.target));let W=$.where?R` where ${$.where}`:void 0;this.config.onConflict=R`(${R.raw(T)})${W} 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 T=$.where?R` where ${$.where}`:void 0,W=$.targetWhere?R` where ${$.targetWhere}`:void 0,X=$.setWhere?R` where ${$.setWhere}`:void 0,U=this.dialect.buildUpdateSet(this.config.table,Lz(this.config.table,$.set)),w="";return w=Array.isArray($.target)?$.target.map((Y)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(Y))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing($.target)),this.config.onConflict=R`(${R.raw(w)})${W} do update set ${U}${T}${X}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){return d$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"insert",tables:b1(this.config.table)},this.cacheConfig)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new E4({alias:u4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class kQ extends P6{constructor($,T,W){super();this.session=T,this.dialect=W,this.config={view:$}}static[N]="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:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){return d$.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 d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})}}class nz{constructor($,T,W,X){this.table=$,this.session=T,this.dialect=W,this.withList=X}static[N]="PgUpdateBuilder";authToken;setToken($){return this.authToken=$,this}set($){return new cJ(this.table,Lz(this.table,$),this.session,this.dialect,this.withList).setToken(this.authToken)}}class cJ extends P6{constructor($,T,W,X,U){super();this.session=W,this.dialect=X,this.config={set:T,table:$,withList:U,joins:[]},this.tableName=y0($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{}}static[N]="PgUpdate";config;tableName;joinsNotNullableMap;cacheConfig;from($){let T=$,W=y0(T);if(typeof W==="string")this.joinsNotNullableMap[W]=!0;return this.config.from=T,this}getTableLikeFields($){if(I($,x4))return $[l.Symbol.Columns];else if(I($,M4))return $._.selectedFields;return $[t$].selectedFields}createJoin($){return(T,W)=>{let X=y0(T);if(typeof X==="string"&&this.config.joins.some((U)=>U.alias===X))throw new Error(`Alias "${X}" is already used in this query`);if(typeof W==="function"){let U=this.config.from&&!I(this.config.from,a)?this.getTableLikeFields(this.config.from):void 0;W=W(new Proxy(this.config.table[l.Symbol.Columns],new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),U&&new Proxy(U,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}if(this.config.joins.push({on:W,table:T,joinType:$,alias:X}),typeof X==="string")switch($){case"left":{this.joinsNotNullableMap[X]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([U])=>[U,!1])),this.joinsNotNullableMap[X]=!0;break}case"inner":{this.joinsNotNullableMap[X]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([U])=>[U,!1])),this.joinsNotNullableMap[X]=!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[l.Symbol.Columns]),this.config.from){let T=y0(this.config.from);if(typeof T==="string"&&this.config.from&&!I(this.config.from,a)){let W=this.getTableLikeFields(this.config.from);$[T]=W}for(let W of this.config.joins){let X=y0(W.table);if(typeof X==="string"&&!I(W.table,a)){let U=this.getTableLikeFields(W.table);$[X]=U}}}}return this.config.returningFields=$,this.config.returning=N1($),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){let T=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"insert",tables:b1(this.config.table)},this.cacheConfig);return T.joinsNotNullableMap=this.joinsNotNullableMap,T}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 E4({alias:u4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class M8 extends a{constructor($){super(M8.buildEmbeddedCount($.source,$.filters).queryChunks);this.params=$,this.mapWith(Number),this.session=$.session,this.sql=M8.buildCount($.source,$.filters)}sql;token;static[N]="PgCountBuilder";[Symbol.toStringTag]="PgCountBuilder";session;static buildEmbeddedCount($,T){return R`(select count(*) from ${$}${R.raw(" where ").if(T)}${T})`}static buildCount($,T){return R`select count(*) as count from ${$}${R.raw(" where ").if(T)}${T};`}setToken($){return this.token=$,this}then($,T){return Promise.resolve(this.session.count(this.sql,this.token)).then($,T)}catch($){return this.then(void 0,$)}finally($){return this.then((T)=>{return $?.(),T},(T)=>{throw $?.(),T})}}class PQ{constructor($,T,W,X,U,w,Y){this.fullSchema=$,this.schema=T,this.tableNamesMap=W,this.table=X,this.tableConfig=U,this.dialect=w,this.session=Y}static[N]="PgRelationalQueryBuilder";findMany($){return new vQ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?$:{},"many")}findFirst($){return new vQ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?{...$,limit:1}:{limit:1},"first")}}class vQ extends P6{constructor($,T,W,X,U,w,Y,G,H){super();this.fullSchema=$,this.schema=T,this.tableNamesMap=W,this.table=X,this.tableConfig=U,this.dialect=w,this.session=Y,this.config=G,this.mode=H}static[N]="PgRelationalQuery";_prepare($){return d$.startActiveSpan("drizzle.prepareQuery",()=>{let{query:T,builtQuery:W}=this._toSQL();return this.session.prepareQuery(W,void 0,$,!0,(X,U)=>{let w=X.map((Y)=>Bz(this.schema,this.tableConfig,Y,T.selection,U));if(this.mode==="first")return w[0];return w})})}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(),T=this.dialect.sqlToQuery($.sql);return{query:$,builtQuery:T}}toSQL(){return this._toSQL().builtQuery}authToken;setToken($){return this.authToken=$,this}execute(){return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(void 0,this.authToken)})}}class qQ extends P6{constructor($,T,W,X){super();this.execute=$,this.sql=T,this.query=W,this.mapBatchResult=X}static[N]="PgRaw";getSQL(){return this.sql}getQuery(){return this.query}mapResult($,T){return T?this.mapBatchResult($):$}_prepare(){return this}isResponseInArrayMode(){return!1}}class D8{constructor($,T,W){if(this.dialect=$,this.session=T,this._=W?{schema:W.schema,fullSchema:W.fullSchema,tableNamesMap:W.tableNamesMap,session:T}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:T},this.query={},this._.schema)for(let[X,U]of Object.entries(this._.schema))this.query[X]=new PQ(W.fullSchema,this._.schema,this._.tableNamesMap,W.fullSchema[X],U,$,T);this.$cache={invalidate:async(X)=>{}}}static[N]="PgDatabase";query;$with=($,T)=>{let W=this;return{as:(U)=>{if(typeof U==="function")U=U(new E8(W.dialect));return new Proxy(new T8(U.getSQL(),T??("getSelectedFields"in U?U.getSelectedFields()??{}:{}),$,!0),new E4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count($,T){return new M8({source:$,filters:T,session:this.session})}$cache;with(...$){let T=this;function W(H){return new q6({fields:H??void 0,session:T.session,dialect:T.dialect,withList:$})}function X(H){return new q6({fields:H??void 0,session:T.session,dialect:T.dialect,withList:$,distinct:!0})}function U(H,z){return new q6({fields:z??void 0,session:T.session,dialect:T.dialect,withList:$,distinct:{on:H}})}function w(H){return new nz(H,T.session,T.dialect,$)}function Y(H){return new rz(H,T.session,T.dialect,$)}function G(H){return new lz(H,T.session,T.dialect,$)}return{select:W,selectDistinct:X,selectDistinctOn:U,update:w,insert:Y,delete:G}}select($){return new q6({fields:$??void 0,session:this.session,dialect:this.dialect})}selectDistinct($){return new q6({fields:$??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn($,T){return new q6({fields:T??void 0,session:this.session,dialect:this.dialect,distinct:{on:$}})}update($){return new nz($,this.session,this.dialect)}insert($){return new rz($,this.session,this.dialect)}delete($){return new lz($,this.session,this.dialect)}refreshMaterializedView($){return new kQ($,this.session,this.dialect)}authToken;execute($){let T=typeof $==="string"?R.raw($):$.getSQL(),W=this.dialect.sqlToQuery(T),X=this.session.prepareQuery(W,void 0,void 0,!1);return new qQ(()=>X.execute(void 0,this.authToken),T,W,(U)=>X.mapResult(U,!0))}transaction($,T){return this.session.transaction($,T)}}class uJ{static[N]="Cache"}class N8 extends uJ{strategy(){return"all"}static[N]="NoopCache";async get($){return}async put($,T,W,X){}async onMutate($){}}async function CQ($,T){let W=`${$}-${JSON.stringify(T)}`,U=new TextEncoder().encode(W),w=await crypto.subtle.digest("SHA-256",U);return[...new Uint8Array(w)].map((H)=>H.toString(16).padStart(2,"0")).join("")}class g0 extends Error{constructor($,T,W){super(`Failed query: ${$}
|
|
110
|
-
params: ${T}`);if(this.query=$,this.params=T,this.cause=W,Error.captureStackTrace(this,g0),W)this.cause=W}}class SQ{constructor($,T,W,X){if(this.query=$,this.cache=T,this.queryMetadata=W,this.cacheConfig=X,T&&T.strategy()==="all"&&X===void 0)this.cacheConfig={enable:!0,autoInvalidate:!0};if(!this.cacheConfig?.enable)this.cacheConfig=void 0}authToken;getQuery(){return this.query}mapResult($,T){return $}setToken($){return this.authToken=$,this}static[N]="PgPreparedQuery";joinsNotNullableMap;async queryWithCache($,T,W){if(this.cache===void 0||I(this.cache,N8)||this.queryMetadata===void 0)try{return await W()}catch(X){throw new g0($,T,X)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await W()}catch(X){throw new g0($,T,X)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[X]=await Promise.all([W(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return X}catch(X){throw new g0($,T,X)}if(!this.cacheConfig)try{return await W()}catch(X){throw new g0($,T,X)}if(this.queryMetadata.type==="select"){let X=await this.cache.get(this.cacheConfig.tag??await CQ($,T),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(X===void 0){let U;try{U=await W()}catch(w){throw new g0($,T,w)}return await this.cache.put(this.cacheConfig.tag??await CQ($,T),U,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),U}return X}try{return await W()}catch(X){throw new g0($,T,X)}}}class jQ{constructor($){this.dialect=$}static[N]="PgSession";execute($,T){return d$.startActiveSpan("drizzle.operation",()=>{return d$.startActiveSpan("drizzle.prepareQuery",()=>{return this.prepareQuery(this.dialect.sqlToQuery($),void 0,void 0,!1)}).setToken(T).execute(void 0,T)})}all($){return this.prepareQuery(this.dialect.sqlToQuery($),void 0,void 0,!1).all()}async count($,T){let W=await this.execute($,T);return Number(W[0].count)}}class IQ extends D8{constructor($,T,W,X=0){super($,T,W);this.schema=W,this.nestedIndex=X}static[N]="PgTransaction";rollback(){throw new tO}getTransactionConfigSQL($){let T=[];if($.isolationLevel)T.push(`isolation level ${$.isolationLevel}`);if($.accessMode)T.push($.accessMode);if(typeof $.deferrable==="boolean")T.push($.deferrable?"deferrable":"not deferrable");return R.raw(T.join(" "))}setTransaction($){return this.session.execute(R`set transaction ${this.getTransactionConfigSQL($)}`)}}class pJ extends SQ{constructor($,T,W,X,U,w,Y,G,H,z){super({sql:T,params:W},U,w,Y);this.client=$,this.queryString=T,this.params=W,this.logger=X,this.fields=G,this._isResponseInArrayMode=H,this.customResultMapper=z}static[N]="PostgresJsPreparedQuery";async execute($={}){return d$.startActiveSpan("drizzle.execute",async(T)=>{let W=nO(this.params,$);T?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(W)}),this.logger.logQuery(this.queryString,W);let{fields:X,queryString:U,client:w,joinsNotNullableMap:Y,customResultMapper:G}=this;if(!X&&!G)return d$.startActiveSpan("drizzle.driver.execute",()=>{return this.queryWithCache(U,W,async()=>{return await w.unsafe(U,W)})});let H=await d$.startActiveSpan("drizzle.driver.execute",()=>{return T?.setAttributes({"drizzle.query.text":U,"drizzle.query.params":JSON.stringify(W)}),this.queryWithCache(U,W,async()=>{return await w.unsafe(U,W).values()})});return d$.startActiveSpan("drizzle.mapResponse",()=>{return G?G(H):H.map((z)=>dD(X,z,Y))})})}all($={}){return d$.startActiveSpan("drizzle.execute",async(T)=>{let W=nO(this.params,$);return T?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(W)}),this.logger.logQuery(this.queryString,W),d$.startActiveSpan("drizzle.driver.execute",()=>{return T?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(W)}),this.queryWithCache(this.queryString,W,async()=>{return this.client.unsafe(this.queryString,W)})})})}isResponseInArrayMode(){return this._isResponseInArrayMode}}class L8 extends jQ{constructor($,T,W,X={}){super(T);this.client=$,this.schema=W,this.options=X,this.logger=X.logger??new sO,this.cache=X.cache??new N8}static[N]="PostgresJsSession";logger;cache;prepareQuery($,T,W,X,U,w,Y){return new pJ(this.client,$.sql,$.params,this.logger,this.cache,w,Y,T,X,U)}query($,T){return this.logger.logQuery($,T),this.client.unsafe($,T).values()}queryObjects($,T){return this.client.unsafe($,T)}transaction($,T){return this.client.begin(async(W)=>{let X=new L8(W,this.dialect,this.schema,this.options),U=new BQ(this.dialect,X,this.schema);if(T)await U.setTransaction(T);return $(U)})}}class BQ extends IQ{constructor($,T,W,X=0){super($,T,W,X);this.session=T}static[N]="PostgresJsTransaction";transaction($){return this.session.client.savepoint((T)=>{let W=new L8(T,this.dialect,this.schema,this.session.options),X=new BQ(this.dialect,W,this.schema);return $(X)})}}class dJ extends D8{static[N]="PostgresJsDatabase"}function s2($,T={}){let W=(H)=>H;for(let H of["1184","1082","1083","1114","1182","1185","1115","1231"])$.options.parsers[H]=W,$.options.serializers[H]=W;$.options.serializers["114"]=W,$.options.serializers["3802"]=W;let X=new SW({casing:T.casing}),U;if(T.logger===!0)U=new aO;else if(T.logger!==!1)U=T.logger;let w;if(T.schema){let H=KJ(T.schema,EJ);w={fullSchema:T.schema,schema:H.tables,tableNamesMap:H.tableNamesMap}}let Y=new L8($,X,w,{logger:U,cache:T.cache}),G=new dJ(X,Y,w);if(G.$client=$,G.$cache=T.cache,G.$cache)G.$cache.invalidate=T.cache?.onMutate;return G}function iz(...$){if(typeof $[0]==="string"){let T=t2($[0]);return s2(T,$[1])}if(rD($[0])){let{connection:T,client:W,...X}=$[0];if(W)return s2(W,X);if(typeof T==="object"&&T.url!==void 0){let{url:w,...Y}=T,G=t2(w,Y);return s2(G,X)}let U=t2(T);return s2(U,X)}return s2($[0],$[1])}(($)=>{function T(W){return s2({options:{parsers:{},serializers:{}}},W)}$.mock=T})(iz||(iz={}));function oJ($,T){if($ instanceof Promise)throw new Error(T)}function BB($,T){let W={},X=[];for(let U in $){let w=$[U]["~standard"].validate(T[U]);if(oJ(w,`Validation must be synchronous, but ${U} returned a Promise.`),w.issues){X.push(...w.issues.map((Y)=>({...Y,message:Y.message,path:[U,...Y.path??[]]})));continue}W[U]=w.value}if(X.length)return{issues:X};return{value:W}}function xQ($){let T=$.runtimeEnvStrict??$.runtimeEnv??process.env;if($.emptyStringAsUndefined??!1){for(let[J,_]of Object.entries(T))if(_==="")delete T[J]}if(!!$.skipValidation)return T;let U=typeof $.client==="object"?$.client:{},w=typeof $.server==="object"?$.server:{},Y=typeof $.shared==="object"?$.shared:{},G=$.isServer??(typeof window==="undefined"||("Deno"in window)),H=G?{...w,...Y,...U}:{...U,...Y},z=$.createFinalSchema?.(H,G)["~standard"].validate(T)??BB(H,T);oJ(z,"Validation must be synchronous");let F=$.onValidationError??((J)=>{throw console.error("\u274C Invalid environment variables:",J),new Error("Invalid environment variables")}),O=$.onInvalidAccess??(()=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(z.issues)return F(z.issues);let Q=(J)=>{if(!$.clientPrefix)return!0;return!J.startsWith($.clientPrefix)&&!(J in Y)},Z=(J)=>{return G||!Q(J)},K=(J)=>{return J==="__esModule"||J==="$$typeof"},A=($.extends??[]).reduce((J,_)=>{return Object.assign(J,_)},{}),D=Object.assign(A,z.value);return new Proxy(D,{get(J,_){if(typeof _!=="string")return;if(K(_))return;if(!Z(_))return O(_);return Reflect.get(J,_)}})}var ST=($)=>Array.isArray($)?$:[$],lJ=($,T)=>{let W=[[],[]];for(let X of $)if(T(X))W[0].push(X);else W[1].push(X);return W},tz=Array,m0=($,T)=>$.includes(T),rJ=($,T=0)=>[...new Array($)].map((W,X)=>X+T),C$=($,T,W)=>{if($===void 0)return T===void 0?[]:Array.isArray(T)?T:[T];if(W?.prepend)if(Array.isArray(T))$.unshift(...T);else $.unshift(T);else if(Array.isArray(T))$.push(...T);else $.push(T);return $},c0=($,T)=>{if(T===void 0||T===null)return $??[];if($===void 0||$===null)return ST(T);return $.concat(T)},nJ=(...$)=>$.reduce(c0,[]),z0=($,T,W)=>{if($===void 0)return Array.isArray(T)?T:[T];let X=W?.isEqual??((U,w)=>U===w);for(let U of ST(T))if(!$.some((w)=>X(w,U)))$.push(U);return $},iJ=($,T)=>$.reduce((W,X)=>{let U=X[T];return W[U]=C$(W[U],X),W},{}),u0=($,T,W)=>$.length===T.length&&$.every(W?.isEqual?(X,U)=>W.isEqual(X,T[U]):(X,U)=>X===T[U]);var p6=($,T)=>f4($)===T,f4=($)=>{let T=typeof $;return T==="object"?$===null?"null":"object":T==="function"?"object":T},d6={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},tJ={...d6,function:"a function"};class aJ extends Error{}var I$=($)=>jW($,aJ),jW=($,T=Error)=>{throw new T($)};class J8 extends Error{name="ParseError"}var B=($)=>jW($,J8),y1=($)=>` ${$}`;var E$=($,T)=>{let W={},X=Array.isArray($),U=!1;for(let[w,Y]of Object.entries($).entries()){let G=X?T(w,Y[1]):T(...Y,w);U||=typeof G[0]==="number";let H=Array.isArray(G[0])||G.length===0?G:[G];for(let[z,F]of H)if(typeof z==="object")W[z.group]=C$(W[z.group],F);else W[z]=F}return U?Object.values(W):W};var fQ=Object.entries;var b4=($,T)=>($ in T),e2=($,T)=>(T in $);class bQ{constructor($){Object.assign(this,$)}}var sJ=class{};class R8 extends sJ{}var xB=($,T)=>{let W={},X={},U;for(U in $)if(U in T)W[U]=$[U];else X[U]=$[U];return[W,X]};var eJ=($,T)=>xB($,T)[1],H0=($)=>Object.keys($).length===0,IW=($)=>[...Object.entries($),...Object.getOwnPropertySymbols($).map((T)=>[T,$[T]])],$R=($,T)=>Object.defineProperties($,Object.getOwnPropertyDescriptors(T)),TR=($)=>{let T=Object.keys($).sort(),W={};for(let X=0;X<T.length;X++)W[T[X]]=$[T[X]];return W};var Q1=y1("represents an uninitialized value"),WR=($)=>Object.values($).filter((T)=>{if(typeof T==="number")return!0;return typeof $[T]!=="number"});var yQ={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},hQ=globalThis.File??Blob,gQ={ArrayBuffer,Blob,File:hQ,FormData,Headers,Request,Response,URL},fB={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},BW={...yQ,...gQ,...fB,String,Number,Boolean},_8=($)=>{let T=Object.getPrototypeOf($);while(T?.constructor&&(!b4(T.constructor.name,BW)||!($ instanceof BW[T.constructor.name])))T=Object.getPrototypeOf(T);let W=T?.constructor?.name;if(W===void 0||W==="Object")return;return W},k8=($)=>typeof $==="object"&&$!==null?_8($)??"object":f4($);var o$=Array.isArray,bB={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"},yB={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"},hB={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"},UR={...bB,...yB,...hB},v8=($)=>{let T=Object($).name??null;return T&&b4(T,BW)&&BW[T]===$?T:null};var mQ=($,T)=>{let W=$.prototype;while(W!==null){if(W===T.prototype)return!0;W=Object.getPrototypeOf(W)}return!1};var XR=($)=>wR($,new Map),wR=($,T)=>{if(typeof $!=="object"||$===null)return $;if(T?.has($))return T.get($);let W=v8($.constructor);if(W==="Date")return new Date($.getTime());if(W&&W!=="Array")return $;let X=Array.isArray($)?$.slice():Object.create(Object.getPrototypeOf($)),U=Object.getOwnPropertyDescriptors($);if(T){T.set($,X);for(let w in U){let Y=U[w];if("get"in Y||"set"in Y)continue;Y.value=wR(Y.value,T)}}return Object.defineProperties(X,U),X};var gB=($)=>{let T=Q1;return()=>T===Q1?T=$():T},jT=($)=>typeof $==="function"&&$.length===0;var YR=class extends Function{constructor(...$){let T=$.slice(0,-1),W=$.at(-1);try{super(...T,W)}catch(X){return I$(`Encountered an unexpected error while compiling your definition:
|
|
111
|
-
Message: ${
|
|
133
|
+
`;await T.execute(R`CREATE SCHEMA IF NOT EXISTS ${R.identifier(X)}`),await T.execute(w);let G=(await T.all(R`select id, hash, created_at from ${R.identifier(X)}.${R.identifier(U)} order by created_at desc limit 1`))[0];await T.transaction(async(H)=>{for await(let z of $)if(!G||Number(G.created_at)<z.folderMillis){for(let F of z.sql)await H.execute(R.raw(F));await H.execute(R`insert into ${R.identifier(X)}.${R.identifier(U)} ("hash", "created_at") values(${z.hash}, ${z.folderMillis})`)}})}escapeName($){return`"${$}"`}escapeParam($){return`$${$+1}`}escapeString($){return`'${$.replace(/'/g,"''")}'`}buildWithCTE($){if(!$?.length)return;let T=[R`with `];for(let[W,U]of $.entries())if(T.push(R`${R.identifier(U._.alias)} as (${U._.sql})`),W<$.length-1)T.push(R`, `);return T.push(R` `),R.join(T)}buildDeleteQuery({table:$,where:T,returning:W,withList:U}){let X=this.buildWithCTE(U),w=W?R` returning ${this.buildSelection(W,{isSingleTable:!0})}`:void 0,Y=T?R` where ${T}`:void 0;return R`${X}delete from ${$}${Y}${w}`}buildUpdateSet($,T){let W=$[l.Symbol.Columns],U=Object.keys(W).filter((w)=>T[w]!==void 0||W[w]?.onUpdateFn!==void 0),X=U.length;return R.join(U.flatMap((w,Y)=>{let G=W[w],H=T[w]??R.param(G.onUpdateFn(),G),z=R`${R.identifier(this.casing.getColumnCasing(G))} = ${H}`;if(Y<X-1)return[z,R.raw(", ")];return[z]}))}buildUpdateQuery({table:$,set:T,where:W,returning:U,withList:X,from:w,joins:Y}){let G=this.buildWithCTE(X),H=$[x4.Symbol.Name],z=$[x4.Symbol.Schema],F=$[x4.Symbol.OriginalName],O=H===F?void 0:H,Q=R`${z?R`${R.identifier(z)}.`:void 0}${R.identifier(F)}${O&&R` ${R.identifier(O)}`}`,Z=this.buildUpdateSet($,T),V=w&&R.join([R.raw(" from "),this.buildFromTable(w)]),A=this.buildJoins(Y),D=U?R` returning ${this.buildSelection(U,{isSingleTable:!w})}`:void 0,J=W?R` where ${W}`:void 0;return R`${G}update ${Q} set ${Z}${V}${A}${J}${D}`}buildSelection($,{isSingleTable:T=!1}={}){let W=$.length,U=$.flatMap(({field:X},w)=>{let Y=[];if(B(X,a.Aliased)&&X.isSelectionField)Y.push(R.identifier(X.fieldAlias));else if(B(X,a.Aliased)||B(X,a)){let G=B(X,a.Aliased)?X.sql:X;if(T)Y.push(new a(G.queryChunks.map((H)=>{if(B(H,d))return R.identifier(this.casing.getColumnCasing(H));return H})));else Y.push(G);if(B(X,a.Aliased))Y.push(R` as ${R.identifier(X.fieldAlias)}`)}else if(B(X,p$))if(T)Y.push(R.identifier(this.casing.getColumnCasing(X)));else Y.push(X);if(w<W-1)Y.push(R`, `);return Y});return R.join(U)}buildJoins($){if(!$||$.length===0)return;let T=[];for(let[W,U]of $.entries()){if(W===0)T.push(R` `);let X=U.table,w=U.lateral?R` lateral`:void 0,Y=U.on?R` on ${U.on}`:void 0;if(B(X,x4)){let G=X[x4.Symbol.Name],H=X[x4.Symbol.Schema],z=X[x4.Symbol.OriginalName],F=G===z?void 0:U.alias;T.push(R`${R.raw(U.joinType)} join${w} ${H?R`${R.identifier(H)}.`:void 0}${R.identifier(z)}${F&&R` ${R.identifier(F)}`}${Y}`)}else if(B(X,u6)){let G=X[t$].name,H=X[t$].schema,z=X[t$].originalName,F=G===z?void 0:U.alias;T.push(R`${R.raw(U.joinType)} join${w} ${H?R`${R.identifier(H)}.`:void 0}${R.identifier(z)}${F&&R` ${R.identifier(F)}`}${Y}`)}else T.push(R`${R.raw(U.joinType)} join${w} ${X}${Y}`);if(W<$.length-1)T.push(R` `)}return R.join(T)}buildFromTable($){if(B($,l)&&$[l.Symbol.IsAlias]){let T=R`${R.identifier($[l.Symbol.OriginalName])}`;if($[l.Symbol.Schema])T=R`${R.identifier($[l.Symbol.Schema])}.${T}`;return R`${T} ${R.identifier($[l.Symbol.Name])}`}return $}buildSelectQuery({withList:$,fields:T,fieldsFlat:W,where:U,having:X,table:w,joins:Y,orderBy:G,groupBy:H,limit:z,offset:F,lockingClause:O,distinct:Q,setOperators:Z}){let V=W??J1(T);for(let z$ of V)if(B(z$.field,p$)&&u4(z$.field.table)!==(B(w,M4)?w._.alias:B(w,Vw)?w[t$].name:B(w,a)?void 0:u4(w))&&!((I$)=>Y?.some(({alias:e$})=>e$===(I$[l.Symbol.IsAlias]?u4(I$):I$[l.Symbol.BaseName])))(z$.field.table)){let I$=u4(z$.field.table);throw new Error(`Your "${z$.path.join("->")}" field references a column "${I$}"."${z$.field.name}", but the table "${I$}" is not part of the query! Did you forget to join it?`)}let A=!Y||Y.length===0,D=this.buildWithCTE($),J;if(Q)J=Q===!0?R` distinct`:R` distinct on (${R.join(Q.on,R`, `)})`;let L=this.buildSelection(V,{isSingleTable:A}),_=this.buildFromTable(w),C=this.buildJoins(Y),f=U?R` where ${U}`:void 0,b=X?R` having ${X}`:void 0,g;if(G&&G.length>0)g=R` order by ${R.join(G,R`, `)}`;let T$;if(H&&H.length>0)T$=R` group by ${R.join(H,R`, `)}`;let N$=typeof z==="object"||typeof z==="number"&&z>=0?R` limit ${z}`:void 0,j=F?R` offset ${F}`:void 0,w$=R.empty();if(O){let z$=R` for ${R.raw(O.strength)}`;if(O.config.of)z$.append(R` of ${R.join(Array.isArray(O.config.of)?O.config.of:[O.config.of],R`, `)}`);if(O.config.noWait)z$.append(R` nowait`);else if(O.config.skipLocked)z$.append(R` skip locked`);w$.append(z$)}let t=R`${D}select${J} ${L} from ${_}${C}${f}${T$}${b}${g}${N$}${j}${w$}`;if(Z.length>0)return this.buildSetOperations(t,Z);return t}buildSetOperations($,T){let[W,...U]=T;if(!W)throw new Error("Cannot pass undefined values to any set operator");if(U.length===0)return this.buildSetOperationQuery({leftSelect:$,setOperator:W});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:$,setOperator:W}),U)}buildSetOperationQuery({leftSelect:$,setOperator:{type:T,isAll:W,rightSelect:U,limit:X,orderBy:w,offset:Y}}){let G=R`(${$.getSQL()}) `,H=R`(${U.getSQL()})`,z;if(w&&w.length>0){let Z=[];for(let V of w)if(B(V,d))Z.push(R.identifier(V.name));else if(B(V,a)){for(let A=0;A<V.queryChunks.length;A++){let D=V.queryChunks[A];if(B(D,d))V.queryChunks[A]=R.identifier(D.name)}Z.push(R`${V}`)}else Z.push(R`${V}`);z=R` order by ${R.join(Z,R`, `)} `}let F=typeof X==="object"||typeof X==="number"&&X>=0?R` limit ${X}`:void 0,O=R.raw(`${T} ${W?"all ":""}`),Q=Y?R` offset ${Y}`:void 0;return R`${G}${O}${H}${z}${F}${Q}`}buildInsertQuery({table:$,values:T,onConflict:W,returning:U,withList:X,select:w,overridingSystemValue_:Y}){let G=[],H=$[l.Symbol.Columns],z=Object.entries(H).filter(([D,J])=>!J.shouldDisableInsert()),F=z.map(([,D])=>R.identifier(this.casing.getColumnCasing(D)));if(w){let D=T;if(B(D,a))G.push(D);else G.push(D.getSQL())}else{let D=T;G.push(R.raw("values "));for(let[J,L]of D.entries()){let _=[];for(let[C,f]of z){let b=L[C];if(b===void 0||B(b,O1)&&b.value===void 0)if(f.defaultFn!==void 0){let g=f.defaultFn(),T$=B(g,a)?g:R.param(g,f);_.push(T$)}else if(!f.default&&f.onUpdateFn!==void 0){let g=f.onUpdateFn(),T$=B(g,a)?g:R.param(g,f);_.push(T$)}else _.push(R`default`);else _.push(b)}if(G.push(_),J<D.length-1)G.push(R`, `)}}let O=this.buildWithCTE(X),Q=R.join(G),Z=U?R` returning ${this.buildSelection(U,{isSingleTable:!0})}`:void 0,V=W?R` on conflict ${W}`:void 0,A=Y===!0?R`overriding system value `:void 0;return R`${O}insert into ${$} ${F} ${A}${Q}${V}${Z}`}buildRefreshMaterializedViewQuery({view:$,concurrently:T,withNoData:W}){let U=T?R` concurrently`:void 0,X=W?R` with no data`:void 0;return R`refresh materialized view${U} ${$}${X}`}prepareTyping($){if(B($,Pz)||B($,vz))return"json";else if(B($,qz))return"decimal";else if(B($,Cz))return"time";else if(B($,Sz)||B($,jz))return"timestamp";else if(B($,_z)||B($,kz))return"date";else if(B($,Bz))return"uuid";else return"none"}sqlToQuery($,T){return $.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:T})}buildRelationalQueryWithoutPK({fullSchema:$,schema:T,tableNamesMap:W,table:U,tableConfig:X,queryConfig:w,tableAlias:Y,nestedQueryRelation:G,joinOn:H}){let z=[],F,O,Q=[],Z,V=[];if(w===!0)z=Object.entries(X.columns).map(([J,L])=>({dbKey:L.name,tsKey:J,field:Y0(L,Y),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let D=Object.fromEntries(Object.entries(X.columns).map(([b,g])=>[b,Y0(g,Y)]));if(w.where){let b=typeof w.where==="function"?w.where(D,RL()):w.where;Z=b&&Ww(b,Y)}let J=[],L=[];if(w.columns){let b=!1;for(let[g,T$]of Object.entries(w.columns)){if(T$===void 0)continue;if(g in X.columns){if(!b&&T$===!0)b=!0;L.push(g)}}if(L.length>0)L=b?L.filter((g)=>w.columns?.[g]===!0):Object.keys(X.columns).filter((g)=>!L.includes(g))}else L=Object.keys(X.columns);for(let b of L){let g=X.columns[b];J.push({tsKey:b,value:g})}let _=[];if(w.with)_=Object.entries(w.with).filter((b)=>!!b[1]).map(([b,g])=>({tsKey:b,queryConfig:g,relation:X.relations[b]}));let C;if(w.extras){C=typeof w.extras==="function"?w.extras(D,{sql:R}):w.extras;for(let[b,g]of Object.entries(C))J.push({tsKey:b,value:$Q(g,Y)})}for(let{tsKey:b,value:g}of J)z.push({dbKey:B(g,a.Aliased)?g.fieldAlias:X.columns[b].name,tsKey:b,field:B(g,p$)?Y0(g,Y):g,relationTableTsKey:void 0,isJson:!1,selection:[]});let f=typeof w.orderBy==="function"?w.orderBy(D,_L()):w.orderBy??[];if(!Array.isArray(f))f=[f];Q=f.map((b)=>{if(B(b,p$))return Y0(b,Y);return Ww(b,Y)}),F=w.limit,O=w.offset;for(let{tsKey:b,queryConfig:g,relation:T$}of _){let N$=vL(T,W,T$),j=kW(T$.referencedTable),w$=W[j],t=`${Y}_${b}`,z$=Gw(...N$.fields.map((h4,i6)=>Iz(Y0(N$.references[i6],t),Y0(h4,Y)))),I$=this.buildRelationalQueryWithoutPK({fullSchema:$,schema:T,tableNamesMap:W,table:$[w$],tableConfig:T[w$],queryConfig:B(T$,qT)?g===!0?{limit:1}:{...g,limit:1}:g,tableAlias:t,joinOn:z$,nestedQueryRelation:T$}),e$=R`${R.identifier(t)}.${R.identifier("data")}`.as(b);V.push({on:R`true`,table:new M4(I$.sql,{},t),alias:t,joinType:"left",lateral:!0}),z.push({dbKey:b,tsKey:b,field:e$,relationTableTsKey:w$,isJson:!0,selection:I$.selection})}}if(z.length===0)throw new Lz({message:`No fields selected for table "${X.tsName}" ("${Y}")`});let A;if(Z=Gw(H,Z),G){let D=R`json_build_array(${R.join(z.map(({field:_,tsKey:C,isJson:f})=>f?R`${R.identifier(`${Y}_${C}`)}.${R.identifier("data")}`:B(_,a.Aliased)?_.sql:_),R`, `)})`;if(B(G,zw))D=R`coalesce(json_agg(${D}${Q.length>0?R` order by ${R.join(Q,R`, `)}`:void 0}), '[]'::json)`;let J=[{dbKey:"data",tsKey:"data",field:D.as("data"),isJson:!0,relationTableTsKey:X.tsName,selection:z}];if(F!==void 0||O!==void 0||Q.length>0)A=this.buildSelectQuery({table:Jz(U,Y),fields:{},fieldsFlat:[{path:[],field:R.raw("*")}],where:Z,limit:F,offset:O,orderBy:Q,setOperators:[]}),Z=void 0,F=void 0,O=void 0,Q=[];else A=Jz(U,Y);A=this.buildSelectQuery({table:B(A,x4)?A:new M4(A,{},Y),fields:{},fieldsFlat:J.map(({field:_})=>({path:[],field:B(_,p$)?Y0(_,Y):_})),joins:V,where:Z,limit:F,offset:O,orderBy:Q,setOperators:[]})}else A=this.buildSelectQuery({table:Jz(U,Y),fields:{},fieldsFlat:z.map(({field:D})=>({path:[],field:B(D,p$)?Y0(D,Y):D})),joins:V,where:Z,limit:F,offset:O,orderBy:Q,setOperators:[]});return{tableTsKey:X.tsName,sql:A,selection:z}}}class PQ{static[N]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class C6{static[N]="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 T=!!this.fields,W=$,U;if(this.fields)U=this.fields;else if(B(W,M4))U=Object.fromEntries(Object.keys(W._.selectedFields).map((X)=>[X,W[X]]));else if(B(W,Vw))U=W[t$].selectedFields;else if(B(W,a))U={};else U=WN(W);return new qQ({table:W,fields:U,isPartialSelect:T,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}class tL extends PQ{static[N]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:$,fields:T,isPartialSelect:W,session:U,dialect:X,withList:w,distinct:Y}){super();this.config={withList:w,table:$,fields:{...T},distinct:Y,setOperators:[]},this.isPartialSelect=W,this.session=U,this.dialect=X,this._={selectedFields:T,config:this.config},this.tableName=y0($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let G of y1($))this.usedTables.add(G)}getUsedTables(){return[...this.usedTables]}createJoin($,T){return(W,U)=>{let X=this.tableName,w=y0(W);for(let Y of y1(W))this.usedTables.add(Y);if(typeof w==="string"&&this.config.joins?.some((Y)=>Y.alias===w))throw new Error(`Alias "${w}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof X==="string")this.config.fields={[X]:this.config.fields};if(typeof w==="string"&&!B(W,a)){let Y=B(W,M4)?W._.selectedFields:B(W,u6)?W[t$].selectedFields:W[l.Symbol.Columns];this.config.fields[w]=Y}}if(typeof U==="function")U=U(new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:U,table:W,joinType:$,alias:w,lateral:T}),typeof w==="string")switch($){case"left":{this.joinsNotNullableMap[w]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([Y])=>[Y,!1])),this.joinsNotNullableMap[w]=!0;break}case"cross":case"inner":{this.joinsNotNullableMap[w]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([Y])=>[Y,!1])),this.joinsNotNullableMap[w]=!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($,T){return(W)=>{let U=typeof W==="function"?W(BI()):W;if(!Xw(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:T,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 E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=$,this}having($){if(typeof $==="function")$=$(new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=$,this}groupBy(...$){if(typeof $[0]==="function"){let T=$[0](new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(T)?T:[T]}else this.config.groupBy=$;return this}orderBy(...$){if(typeof $[0]==="function"){let T=$[0](new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),W=Array.isArray(T)?T:[T];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=W;else this.config.orderBy=W}else{let T=$;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=T;else this.config.orderBy=T}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($,T={}){return this.config.lockingClause={strength:$,config:T},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}as($){let T=[];if(T.push(...y1(this.config.table)),this.config.joins)for(let W of this.config.joins)T.push(...y1(W.table));return new Proxy(new M4(this.getSQL(),this.config.fields,$,!1,[...new Set(T)]),new E4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new E4({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 qQ extends tL{static[N]="PgSelect";_prepare($){let{session:T,config:W,dialect:U,joinsNotNullableMap:X,authToken:w,cacheConfig:Y,usedTables:G}=this;if(!T)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");let{fields:H}=W;return d$.startActiveSpan("drizzle.prepareQuery",()=>{let z=J1(H),F=T.prepareQuery(U.sqlToQuery(this.getSQL()),z,$,!0,void 0,{type:"select",tables:[...G]},Y);return F.joinsNotNullableMap=X,F.setToken(w)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})}}TN(qQ,[q6]);function a2($,T){return(W,U,...X)=>{let w=[U,...X].map((Y)=>({type:$,isAll:T,rightSelect:Y}));for(let Y of w)if(!Xw(W.getSelectedFields(),Y.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return W.addSetOperators(w)}}var BI=()=>({union:II,unionAll:xI,intersect:fI,intersectAll:bI,except:yI,exceptAll:hI}),II=a2("union",!1),xI=a2("union",!0),fI=a2("intersect",!1),bI=a2("intersect",!0),yI=a2("except",!1),hI=a2("except",!0);class Kw{static[N]="PgQueryBuilder";dialect;dialectConfig;constructor($){this.dialect=B($,SW)?$:void 0,this.dialectConfig=B($,SW)?void 0:$}$with=($,T)=>{let W=this;return{as:(X)=>{if(typeof X==="function")X=X(W);return new Proxy(new eU(X.getSQL(),T??("getSelectedFields"in X?X.getSelectedFields()??{}:{}),$,!0),new E4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...$){let T=this;function W(w){return new C6({fields:w??void 0,session:void 0,dialect:T.getDialect(),withList:$})}function U(w){return new C6({fields:w??void 0,session:void 0,dialect:T.getDialect(),distinct:!0})}function X(w,Y){return new C6({fields:Y??void 0,session:void 0,dialect:T.getDialect(),distinct:{on:w}})}return{select:W,selectDistinct:U,selectDistinctOn:X}}select($){return new C6({fields:$??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct($){return new C6({fields:$??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn($,T){return new C6({fields:T??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:$}})}getDialect(){if(!this.dialect)this.dialect=new SW(this.dialectConfig);return this.dialect}}function y1($){if(B($,x4))return[$[_W]?`${$[_W]}.${$[l.Symbol.BaseName]}`:$[l.Symbol.BaseName]];if(B($,M4))return $._.usedTables??[];if(B($,a))return $.usedTables??[];return[]}class nz extends q6{constructor($,T,W,U){super();this.session=T,this.dialect=W,this.config={table:$,withList:U}}static[N]="PgDelete";config;cacheConfig;where($){return this.config.where=$,this}returning($=this.config.table[l.Symbol.Columns]){return this.config.returningFields=$,this.config.returning=J1($),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){return d$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"delete",tables:y1(this.config.table)},this.cacheConfig)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new E4({alias:u4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class iz{constructor($,T,W,U,X){this.table=$,this.session=T,this.dialect=W,this.withList=U,this.overridingSystemValue_=X}static[N]="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 T=$.map((W)=>{let U={},X=this.table[l.Symbol.Columns];for(let w of Object.keys(W)){let Y=W[w];U[w]=B(Y,a)?Y:new O1(Y,X[w])}return U});return new CQ(this.table,T,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select($){let T=typeof $==="function"?$(new Kw):$;if(!B(T,a)&&!Xw(this.table[Dz],T._.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 CQ(this.table,T,this.session,this.dialect,this.withList,!0)}}class CQ extends q6{constructor($,T,W,U,X,w,Y){super();this.session=W,this.dialect=U,this.config={table:$,values:T,withList:X,select:w,overridingSystemValue_:Y}}static[N]="PgInsert";config;cacheConfig;returning($=this.config.table[l.Symbol.Columns]){return this.config.returningFields=$,this.config.returning=J1($),this}onConflictDoNothing($={}){if($.target===void 0)this.config.onConflict=R`do nothing`;else{let T="";T=Array.isArray($.target)?$.target.map((U)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(U))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing($.target));let W=$.where?R` where ${$.where}`:void 0;this.config.onConflict=R`(${R.raw(T)})${W} 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 T=$.where?R` where ${$.where}`:void 0,W=$.targetWhere?R` where ${$.targetWhere}`:void 0,U=$.setWhere?R` where ${$.setWhere}`:void 0,X=this.dialect.buildUpdateSet(this.config.table,Rz(this.config.table,$.set)),w="";return w=Array.isArray($.target)?$.target.map((Y)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(Y))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing($.target)),this.config.onConflict=R`(${R.raw(w)})${W} do update set ${X}${T}${U}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){return d$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"insert",tables:y1(this.config.table)},this.cacheConfig)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new E4({alias:u4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class SQ extends q6{constructor($,T,W){super();this.session=T,this.dialect=W,this.config={view:$}}static[N]="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:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){return d$.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 d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})}}class tz{constructor($,T,W,U){this.table=$,this.session=T,this.dialect=W,this.withList=U}static[N]="PgUpdateBuilder";authToken;setToken($){return this.authToken=$,this}set($){return new aL(this.table,Rz(this.table,$),this.session,this.dialect,this.withList).setToken(this.authToken)}}class aL extends q6{constructor($,T,W,U,X){super();this.session=W,this.dialect=U,this.config={set:T,table:$,withList:X,joins:[]},this.tableName=y0($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{}}static[N]="PgUpdate";config;tableName;joinsNotNullableMap;cacheConfig;from($){let T=$,W=y0(T);if(typeof W==="string")this.joinsNotNullableMap[W]=!0;return this.config.from=T,this}getTableLikeFields($){if(B($,x4))return $[l.Symbol.Columns];else if(B($,M4))return $._.selectedFields;return $[t$].selectedFields}createJoin($){return(T,W)=>{let U=y0(T);if(typeof U==="string"&&this.config.joins.some((X)=>X.alias===U))throw new Error(`Alias "${U}" is already used in this query`);if(typeof W==="function"){let X=this.config.from&&!B(this.config.from,a)?this.getTableLikeFields(this.config.from):void 0;W=W(new Proxy(this.config.table[l.Symbol.Columns],new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),X&&new Proxy(X,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}if(this.config.joins.push({on:W,table:T,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(([X])=>[X,!1])),this.joinsNotNullableMap[U]=!0;break}case"inner":{this.joinsNotNullableMap[U]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([X])=>[X,!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[l.Symbol.Columns]),this.config.from){let T=y0(this.config.from);if(typeof T==="string"&&this.config.from&&!B(this.config.from,a)){let W=this.getTableLikeFields(this.config.from);$[T]=W}for(let W of this.config.joins){let U=y0(W.table);if(typeof U==="string"&&!B(W.table,a)){let X=this.getTableLikeFields(W.table);$[U]=X}}}}return this.config.returningFields=$,this.config.returning=J1($),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){let T=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"insert",tables:y1(this.config.table)},this.cacheConfig);return T.joinsNotNullableMap=this.joinsNotNullableMap,T}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 E4({alias:u4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class Aw extends a{constructor($){super(Aw.buildEmbeddedCount($.source,$.filters).queryChunks);this.params=$,this.mapWith(Number),this.session=$.session,this.sql=Aw.buildCount($.source,$.filters)}sql;token;static[N]="PgCountBuilder";[Symbol.toStringTag]="PgCountBuilder";session;static buildEmbeddedCount($,T){return R`(select count(*) from ${$}${R.raw(" where ").if(T)}${T})`}static buildCount($,T){return R`select count(*) as count from ${$}${R.raw(" where ").if(T)}${T};`}setToken($){return this.token=$,this}then($,T){return Promise.resolve(this.session.count(this.sql,this.token)).then($,T)}catch($){return this.then(void 0,$)}finally($){return this.then((T)=>{return $?.(),T},(T)=>{throw $?.(),T})}}class BQ{constructor($,T,W,U,X,w,Y){this.fullSchema=$,this.schema=T,this.tableNamesMap=W,this.table=U,this.tableConfig=X,this.dialect=w,this.session=Y}static[N]="PgRelationalQueryBuilder";findMany($){return new jQ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?$:{},"many")}findFirst($){return new jQ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?{...$,limit:1}:{limit:1},"first")}}class jQ extends q6{constructor($,T,W,U,X,w,Y,G,H){super();this.fullSchema=$,this.schema=T,this.tableNamesMap=W,this.table=U,this.tableConfig=X,this.dialect=w,this.session=Y,this.config=G,this.mode=H}static[N]="PgRelationalQuery";_prepare($){return d$.startActiveSpan("drizzle.prepareQuery",()=>{let{query:T,builtQuery:W}=this._toSQL();return this.session.prepareQuery(W,void 0,$,!0,(U,X)=>{let w=U.map((Y)=>fz(this.schema,this.tableConfig,Y,T.selection,X));if(this.mode==="first")return w[0];return w})})}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(),T=this.dialect.sqlToQuery($.sql);return{query:$,builtQuery:T}}toSQL(){return this._toSQL().builtQuery}authToken;setToken($){return this.authToken=$,this}execute(){return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(void 0,this.authToken)})}}class IQ extends q6{constructor($,T,W,U){super();this.execute=$,this.sql=T,this.query=W,this.mapBatchResult=U}static[N]="PgRaw";getSQL(){return this.sql}getQuery(){return this.query}mapResult($,T){return T?this.mapBatchResult($):$}_prepare(){return this}isResponseInArrayMode(){return!1}}class Ew{constructor($,T,W){if(this.dialect=$,this.session=T,this._=W?{schema:W.schema,fullSchema:W.fullSchema,tableNamesMap:W.tableNamesMap,session:T}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:T},this.query={},this._.schema)for(let[U,X]of Object.entries(this._.schema))this.query[U]=new BQ(W.fullSchema,this._.schema,this._.tableNamesMap,W.fullSchema[U],X,$,T);this.$cache={invalidate:async(U)=>{}}}static[N]="PgDatabase";query;$with=($,T)=>{let W=this;return{as:(X)=>{if(typeof X==="function")X=X(new Kw(W.dialect));return new Proxy(new eU(X.getSQL(),T??("getSelectedFields"in X?X.getSelectedFields()??{}:{}),$,!0),new E4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count($,T){return new Aw({source:$,filters:T,session:this.session})}$cache;with(...$){let T=this;function W(H){return new C6({fields:H??void 0,session:T.session,dialect:T.dialect,withList:$})}function U(H){return new C6({fields:H??void 0,session:T.session,dialect:T.dialect,withList:$,distinct:!0})}function X(H,z){return new C6({fields:z??void 0,session:T.session,dialect:T.dialect,withList:$,distinct:{on:H}})}function w(H){return new tz(H,T.session,T.dialect,$)}function Y(H){return new iz(H,T.session,T.dialect,$)}function G(H){return new nz(H,T.session,T.dialect,$)}return{select:W,selectDistinct:U,selectDistinctOn:X,update:w,insert:Y,delete:G}}select($){return new C6({fields:$??void 0,session:this.session,dialect:this.dialect})}selectDistinct($){return new C6({fields:$??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn($,T){return new C6({fields:T??void 0,session:this.session,dialect:this.dialect,distinct:{on:$}})}update($){return new tz($,this.session,this.dialect)}insert($){return new iz($,this.session,this.dialect)}delete($){return new nz($,this.session,this.dialect)}refreshMaterializedView($){return new SQ($,this.session,this.dialect)}authToken;execute($){let T=typeof $==="string"?R.raw($):$.getSQL(),W=this.dialect.sqlToQuery(T),U=this.session.prepareQuery(W,void 0,void 0,!1);return new IQ(()=>U.execute(void 0,this.authToken),T,W,(X)=>U.mapResult(X,!0))}transaction($,T){return this.session.transaction($,T)}}class sL{static[N]="Cache"}class Mw extends sL{strategy(){return"all"}static[N]="NoopCache";async get($){return}async put($,T,W,U){}async onMutate($){}}async function xQ($,T){let W=`${$}-${JSON.stringify(T)}`,X=new TextEncoder().encode(W),w=await crypto.subtle.digest("SHA-256",X);return[...new Uint8Array(w)].map((H)=>H.toString(16).padStart(2,"0")).join("")}class g0 extends Error{constructor($,T,W){super(`Failed query: ${$}
|
|
134
|
+
params: ${T}`);if(this.query=$,this.params=T,this.cause=W,Error.captureStackTrace(this,g0),W)this.cause=W}}class fQ{constructor($,T,W,U){if(this.query=$,this.cache=T,this.queryMetadata=W,this.cacheConfig=U,T&&T.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($,T){return $}setToken($){return this.authToken=$,this}static[N]="PgPreparedQuery";joinsNotNullableMap;async queryWithCache($,T,W){if(this.cache===void 0||B(this.cache,Mw)||this.queryMetadata===void 0)try{return await W()}catch(U){throw new g0($,T,U)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await W()}catch(U){throw new g0($,T,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([W(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return U}catch(U){throw new g0($,T,U)}if(!this.cacheConfig)try{return await W()}catch(U){throw new g0($,T,U)}if(this.queryMetadata.type==="select"){let U=await this.cache.get(this.cacheConfig.tag??await xQ($,T),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(U===void 0){let X;try{X=await W()}catch(w){throw new g0($,T,w)}return await this.cache.put(this.cacheConfig.tag??await xQ($,T),X,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),X}return U}try{return await W()}catch(U){throw new g0($,T,U)}}}class bQ{constructor($){this.dialect=$}static[N]="PgSession";execute($,T){return d$.startActiveSpan("drizzle.operation",()=>{return d$.startActiveSpan("drizzle.prepareQuery",()=>{return this.prepareQuery(this.dialect.sqlToQuery($),void 0,void 0,!1)}).setToken(T).execute(void 0,T)})}all($){return this.prepareQuery(this.dialect.sqlToQuery($),void 0,void 0,!1).all()}async count($,T){let W=await this.execute($,T);return Number(W[0].count)}}class yQ extends Ew{constructor($,T,W,U=0){super($,T,W);this.schema=W,this.nestedIndex=U}static[N]="PgTransaction";rollback(){throw new TQ}getTransactionConfigSQL($){let T=[];if($.isolationLevel)T.push(`isolation level ${$.isolationLevel}`);if($.accessMode)T.push($.accessMode);if(typeof $.deferrable==="boolean")T.push($.deferrable?"deferrable":"not deferrable");return R.raw(T.join(" "))}setTransaction($){return this.session.execute(R`set transaction ${this.getTransactionConfigSQL($)}`)}}class eL extends fQ{constructor($,T,W,U,X,w,Y,G,H,z){super({sql:T,params:W},X,w,Y);this.client=$,this.queryString=T,this.params=W,this.logger=U,this.fields=G,this._isResponseInArrayMode=H,this.customResultMapper=z}static[N]="PostgresJsPreparedQuery";async execute($={}){return d$.startActiveSpan("drizzle.execute",async(T)=>{let W=eO(this.params,$);T?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(W)}),this.logger.logQuery(this.queryString,W);let{fields:U,queryString:X,client:w,joinsNotNullableMap:Y,customResultMapper:G}=this;if(!U&&!G)return d$.startActiveSpan("drizzle.driver.execute",()=>{return this.queryWithCache(X,W,async()=>{return await w.unsafe(X,W)})});let H=await d$.startActiveSpan("drizzle.driver.execute",()=>{return T?.setAttributes({"drizzle.query.text":X,"drizzle.query.params":JSON.stringify(W)}),this.queryWithCache(X,W,async()=>{return await w.unsafe(X,W).values()})});return d$.startActiveSpan("drizzle.mapResponse",()=>{return G?G(H):H.map((z)=>$N(U,z,Y))})})}all($={}){return d$.startActiveSpan("drizzle.execute",async(T)=>{let W=eO(this.params,$);return T?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(W)}),this.logger.logQuery(this.queryString,W),d$.startActiveSpan("drizzle.driver.execute",()=>{return T?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(W)}),this.queryWithCache(this.queryString,W,async()=>{return this.client.unsafe(this.queryString,W)})})})}isResponseInArrayMode(){return this._isResponseInArrayMode}}class Dw extends bQ{constructor($,T,W,U={}){super(T);this.client=$,this.schema=W,this.options=U,this.logger=U.logger??new XQ,this.cache=U.cache??new Mw}static[N]="PostgresJsSession";logger;cache;prepareQuery($,T,W,U,X,w,Y){return new eL(this.client,$.sql,$.params,this.logger,this.cache,w,Y,T,U,X)}query($,T){return this.logger.logQuery($,T),this.client.unsafe($,T).values()}queryObjects($,T){return this.client.unsafe($,T)}transaction($,T){return this.client.begin(async(W)=>{let U=new Dw(W,this.dialect,this.schema,this.options),X=new hQ(this.dialect,U,this.schema);if(T)await X.setTransaction(T);return $(X)})}}class hQ extends yQ{constructor($,T,W,U=0){super($,T,W,U);this.session=T}static[N]="PostgresJsTransaction";transaction($){return this.session.client.savepoint((T)=>{let W=new Dw(T,this.dialect,this.schema,this.session.options),U=new hQ(this.dialect,W,this.schema);return $(U)})}}class $R extends Ew{static[N]="PostgresJsDatabase"}function s2($,T={}){let W=(H)=>H;for(let H of["1184","1082","1083","1114","1182","1185","1115","1231"])$.options.parsers[H]=W,$.options.serializers[H]=W;$.options.serializers["114"]=W,$.options.serializers["3802"]=W;let U=new SW({casing:T.casing}),X;if(T.logger===!0)X=new WQ;else if(T.logger!==!1)X=T.logger;let w;if(T.schema){let H=kL(T.schema,PL);w={fullSchema:T.schema,schema:H.tables,tableNamesMap:H.tableNamesMap}}let Y=new Dw($,U,w,{logger:X,cache:T.cache}),G=new $R(U,Y,w);if(G.$client=$,G.$cache=T.cache,G.$cache)G.$cache.invalidate=T.cache?.onMutate;return G}function az(...$){if(typeof $[0]==="string"){let T=t2($[0]);return s2(T,$[1])}if(XN($[0])){let{connection:T,client:W,...U}=$[0];if(W)return s2(W,U);if(typeof T==="object"&&T.url!==void 0){let{url:w,...Y}=T,G=t2(w,Y);return s2(G,U)}let X=t2(T);return s2(X,U)}return s2($[0],$[1])}(($)=>{function T(W){return s2({options:{parsers:{},serializers:{}}},W)}$.mock=T})(az||(az={}));function TR($,T){if($ instanceof Promise)throw new Error(T)}function gI($,T){let W={},U=[];for(let X in $){let w=$[X]["~standard"].validate(T[X]);if(TR(w,`Validation must be synchronous, but ${X} returned a Promise.`),w.issues){U.push(...w.issues.map((Y)=>({...Y,message:Y.message,path:[X,...Y.path??[]]})));continue}W[X]=w.value}if(U.length)return{issues:U};return{value:W}}function gQ($){let T=$.runtimeEnvStrict??$.runtimeEnv??process.env;if($.emptyStringAsUndefined??!1){for(let[L,_]of Object.entries(T))if(_==="")delete T[L]}if(!!$.skipValidation)return T;let X=typeof $.client==="object"?$.client:{},w=typeof $.server==="object"?$.server:{},Y=typeof $.shared==="object"?$.shared:{},G=$.isServer??(typeof window==="undefined"||("Deno"in window)),H=G?{...w,...Y,...X}:{...X,...Y},z=$.createFinalSchema?.(H,G)["~standard"].validate(T)??gI(H,T);TR(z,"Validation must be synchronous");let F=$.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(z.issues)return F(z.issues);let Q=(L)=>{if(!$.clientPrefix)return!0;return!L.startsWith($.clientPrefix)&&!(L in Y)},Z=(L)=>{return G||!Q(L)},V=(L)=>{return L==="__esModule"||L==="$$typeof"},A=($.extends??[]).reduce((L,_)=>{return Object.assign(L,_)},{}),D=Object.assign(A,z.value);return new Proxy(D,{get(L,_){if(typeof _!=="string")return;if(V(_))return;if(!Z(_))return O(_);return Reflect.get(L,_)}})}var ST=($)=>Array.isArray($)?$:[$],WR=($,T)=>{let W=[[],[]];for(let U of $)if(T(U))W[0].push(U);else W[1].push(U);return W},sz=Array,m0=($,T)=>$.includes(T),XR=($,T=0)=>[...new Array($)].map((W,U)=>U+T),C$=($,T,W)=>{if($===void 0)return T===void 0?[]:Array.isArray(T)?T:[T];if(W?.prepend)if(Array.isArray(T))$.unshift(...T);else $.unshift(T);else if(Array.isArray(T))$.push(...T);else $.push(T);return $},c0=($,T)=>{if(T===void 0||T===null)return $??[];if($===void 0||$===null)return ST(T);return $.concat(T)},UR=(...$)=>$.reduce(c0,[]),z0=($,T,W)=>{if($===void 0)return Array.isArray(T)?T:[T];let U=W?.isEqual??((X,w)=>X===w);for(let X of ST(T))if(!$.some((w)=>U(w,X)))$.push(X);return $},wR=($,T)=>$.reduce((W,U)=>{let X=U[T];return W[X]=C$(W[X],U),W},{}),u0=($,T,W)=>$.length===T.length&&$.every(W?.isEqual?(U,X)=>W.isEqual(U,T[X]):(U,X)=>U===T[X]);var d6=($,T)=>f4($)===T,f4=($)=>{let T=typeof $;return T==="object"?$===null?"null":"object":T==="function"?"object":T},o6={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},YR={...o6,function:"a function"};class GR extends Error{}var B$=($)=>jW($,GR),jW=($,T=Error)=>{throw new T($)};class Nw extends Error{name="ParseError"}var I=($)=>jW($,Nw),h1=($)=>` ${$}`;var E$=($,T)=>{let W={},U=Array.isArray($),X=!1;for(let[w,Y]of Object.entries($).entries()){let G=U?T(w,Y[1]):T(...Y,w);X||=typeof G[0]==="number";let H=Array.isArray(G[0])||G.length===0?G:[G];for(let[z,F]of H)if(typeof z==="object")W[z.group]=C$(W[z.group],F);else W[z]=F}return X?Object.values(W):W};var mQ=Object.entries;var b4=($,T)=>($ in T),e2=($,T)=>(T in $);class cQ{constructor($){Object.assign(this,$)}}var zR=class{};class Jw extends zR{}var mI=($,T)=>{let W={},U={},X;for(X in $)if(X in T)W[X]=$[X];else U[X]=$[X];return[W,U]};var HR=($,T)=>mI($,T)[1],H0=($)=>Object.keys($).length===0,BW=($)=>[...Object.entries($),...Object.getOwnPropertySymbols($).map((T)=>[T,$[T]])],FR=($,T)=>Object.defineProperties($,Object.getOwnPropertyDescriptors(T)),OR=($)=>{let T=Object.keys($).sort(),W={};for(let U=0;U<T.length;U++)W[T[U]]=$[T[U]];return W};var Z1=h1("represents an uninitialized value"),QR=($)=>Object.values($).filter((T)=>{if(typeof T==="number")return!0;return typeof $[T]!=="number"});var uQ={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},pQ=globalThis.File??Blob,dQ={ArrayBuffer,Blob,File:pQ,FormData,Headers,Request,Response,URL},cI={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},IW={...uQ,...dQ,...cI,String,Number,Boolean},Lw=($)=>{let T=Object.getPrototypeOf($);while(T?.constructor&&(!b4(T.constructor.name,IW)||!($ instanceof IW[T.constructor.name])))T=Object.getPrototypeOf(T);let W=T?.constructor?.name;if(W===void 0||W==="Object")return;return W},Rw=($)=>typeof $==="object"&&$!==null?Lw($)??"object":f4($);var o$=Array.isArray,uI={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"},pI={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"},dI={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"},ZR={...uI,...pI,...dI},_w=($)=>{let T=Object($).name??null;return T&&b4(T,IW)&&IW[T]===$?T:null};var oQ=($,T)=>{let W=$.prototype;while(W!==null){if(W===T.prototype)return!0;W=Object.getPrototypeOf(W)}return!1};var VR=($)=>KR($,new Map),KR=($,T)=>{if(typeof $!=="object"||$===null)return $;if(T?.has($))return T.get($);let W=_w($.constructor);if(W==="Date")return new Date($.getTime());if(W&&W!=="Array")return $;let U=Array.isArray($)?$.slice():Object.create(Object.getPrototypeOf($)),X=Object.getOwnPropertyDescriptors($);if(T){T.set($,U);for(let w in X){let Y=X[w];if("get"in Y||"set"in Y)continue;Y.value=KR(Y.value,T)}}return Object.defineProperties(U,X),U};var oI=($)=>{let T=Z1;return()=>T===Z1?T=$():T},jT=($)=>typeof $==="function"&&$.length===0;var AR=class extends Function{constructor(...$){let T=$.slice(0,-1),W=$.at(-1);try{super(...T,W)}catch(U){return B$(`Encountered an unexpected error while compiling your definition:
|
|
135
|
+
Message: ${U}
|
|
112
136
|
Source: (${$.slice(0,-1)}) => {
|
|
113
137
|
${$.at(-1)}
|
|
114
|
-
}`)}}};class
|
|
115
|
-
`)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},
|
|
116
|
-
`+
|
|
117
|
-
${
|
|
118
|
-
${W}]`:`[${w}]`}let
|
|
138
|
+
}`)}}};class g1{constructor($,...[T]){return Object.assign(Object.setPrototypeOf($.bind(T?.bind??this),this.constructor.prototype),T?.attach)}}var ER=oI(()=>{try{return new Function("return false")()}catch{return!0}});var VT$=h1("brand");var MR=h1("arkInferred");var ET$=h1("args");class w6{constructor(){}}var lI=()=>{try{return((new Error().stack?.split(`
|
|
139
|
+
`)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},rI=globalThis.process?.env??{},DR={fileName:lI,env:rI};var NR=($)=>$[0].toUpperCase()+$.slice(1);var lQ=($)=>new RegExp(nI($),typeof $==="string"?"":$.flags);var nI=($)=>{return`^(?:${typeof $==="string"?$:$.source})$`};var p0={negativeLookahead:($)=>`(?!${$})`,nonCapturingGroup:($)=>`(?:${$})`},kw="\\",BT={" ":1,"\n":1,"\t":1};var iI=/^-0\.?0*$/.source,LR=/[1-9]\d*/.source,tI=/\.\d+/.source,aI=/\.\d*[1-9]/.source,RR=($)=>lQ(p0.negativeLookahead(iI)+p0.nonCapturingGroup("-?"+p0.nonCapturingGroup(p0.nonCapturingGroup("0|"+LR)+p0.nonCapturingGroup($.decimalPattern)+"?")+($.allowDecimalOnly?"|"+$.decimalPattern:"")+"?")),JR=RR({decimalPattern:aI,allowDecimalOnly:!1}),sI=JR.test.bind(JR),ez=RR({decimalPattern:tI,allowDecimalOnly:!0}),_T$=ez.test.bind(ez),eI=/^-?\d*\.?\d*$/,$x=($)=>$.length!==0&&eI.test($),vw=lQ(p0.negativeLookahead("^-0$")+"-?"+p0.nonCapturingGroup(p0.nonCapturingGroup("0|"+LR))),Tx=vw.test.bind(vw),rQ=/^-?\d+$/,Wx=rQ.test.bind(rQ),_R={number:"a number",bigint:"a bigint",integer:"an integer"},kR=($,T)=>`'${$}' was parsed as ${_R[T]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,Xx=($,T)=>T==="number"?sI($):Tx($),Ux=($,T)=>T==="number"?Number($):Number.parseInt($),wx=($,T)=>T==="number"?$x($):Wx($),vR=($,T)=>nQ($,"number",T),PR=($,T)=>nQ($,"number",{...T,strict:!0}),qR=($,T)=>nQ($,"integer",T),nQ=($,T,W)=>{let U=Ux($,T);if(!Number.isNaN(U)){if(wx($,T)){if(W?.strict)return Xx($,T)?U:I(kR($,T));return U}}return W?.errorOnFail?I(W?.errorOnFail===!0?`Failed to parse ${_R[T]} from '${$}'`:W?.errorOnFail):void 0},CR=($)=>{if($[$.length-1]!=="n")return;let T=$.slice(0,-1),W;try{W=BigInt(T)}catch{return}if(vw.test(T))return W;if(rQ.test(T))return I(kR($,"bigint"))};var Yx="0.46.0",Gx={version:Yx,filename:DR.fileName(),FileConstructor:pQ},xW=Gx,SR=new Map,iQ=Object.create(null),Pw=($)=>{let T=SR.get($);if(T)return T;let W=zx($);if(iQ[W])W=`${W}${iQ[W]++}`;else iQ[W]=1;return xW[W]=$,SR.set($,W),W},IT=($)=>/^[$A-Z_a-z][\w$]*$/.test($),zx=($)=>{switch(typeof $){case"object":{if($===null)break;let T=Lw($)??"object";return T[0].toLowerCase()+T.slice(1)}case"function":return IT($.name)?$.name:"fn";case"symbol":return $.description&&IT($.description)?$.description:"symbol"}return B$(`Unexpected attempt to register serializable value of type ${f4($)}`)};var qw=($)=>typeof $==="string"?JSON.stringify($):typeof $==="bigint"?`${$}n`:`${$}`;var jR=($,T={})=>Cw($,{onUndefined:"$ark.undefined",onBigInt:(W)=>`$ark.bigint-${W}`,...T},[]);var M$=($,T)=>{switch(f4($)){case"object":let W=$,U=W.constructor.name;return U==="Object"||U==="Array"?T?.quoteKeys===!1?$9(W,T?.indent??0,""):JSON.stringify(Cw(W,$X,[]),null,T?.indent):$9(W,T?.indent??0,"");case"symbol":return $X.onSymbol($);default:return qw($)}},$9=($,T,W)=>{if(typeof $==="function")return $X.onFunction($);if(typeof $!=="object"||$===null)return qw($);let U=W+" ".repeat(T);if(Array.isArray($)){if($.length===0)return"[]";let w=$.map((Y)=>$9(Y,T,U)).join(`,
|
|
140
|
+
`+U);return T?`[
|
|
141
|
+
${U}${w}
|
|
142
|
+
${W}]`:`[${w}]`}let X=$.constructor.name;if(X==="Object"){let w=BW($).map(([Y,G])=>{let H=typeof Y==="symbol"?$X.onSymbol(Y):IT(Y)?Y:JSON.stringify(Y),z=$9(G,T,U);return`${U}${H}: ${z}`});if(w.length===0)return"{}";return T?`{
|
|
119
143
|
${w.join(`,
|
|
120
144
|
`)}
|
|
121
|
-
${W}}`:`{${w.join(", ")}}`}if($ instanceof Date)return fW($);if("expression"in $&&typeof $.expression==="string")return $.expression;return
|
|
145
|
+
${W}}`:`{${w.join(", ")}}`}if($ instanceof Date)return fW($);if("expression"in $&&typeof $.expression==="string")return $.expression;return X},$X={onCycle:()=>"(cycle)",onSymbol:($)=>`Symbol(${Pw($)})`,onFunction:($)=>`Function(${Pw($)})`},Cw=($,T,W)=>{switch(f4($)){case"object":{let U=$;if("toJSON"in U&&typeof U.toJSON==="function")return U.toJSON();if(typeof U==="function")return $X.onFunction(U);if(W.includes(U))return"(cycle)";let X=[...W,U];if(Array.isArray(U))return U.map((Y)=>Cw(Y,T,X));if(U instanceof Date)return U.toDateString();let w={};for(let Y in U)w[Y]=Cw(U[Y],T,X);for(let Y of Object.getOwnPropertySymbols(U))w[T.onSymbol?.(Y)??Y.toString()]=Cw(U[Y],T,X);return w}case"symbol":return $X.onSymbol($);case"bigint":return T.onBigInt?.($)??`${$}n`;case"undefined":return T.onUndefined??"undefined";case"string":return $.replaceAll("\\","\\\\");default:return $}},fW=($)=>{let T=$.getFullYear(),W=$.getMonth(),U=$.getDate(),X=$.getHours(),w=$.getMinutes(),Y=$.getSeconds(),G=$.getMilliseconds();if(W===0&&U===1&&X===0&&w===0&&Y===0&&G===0)return`${T}`;let H=`${Hx[W]} ${U}, ${T}`;if(X===0&&w===0&&Y===0&&G===0)return H;let z=$.toLocaleTimeString(),F=z.endsWith(" AM")||z.endsWith(" PM")?z.slice(-3):"";if(F)z=z.slice(0,-F.length);if(G)z+=`.${Ox(G,3)}`;else if(Fx.test(z))z=z.slice(0,-3);return`${z+F}, ${H}`},Hx=["January","February","March","April","May","June","July","August","September","October","November","December"],Fx=/:\d\d:00$/,Ox=($,T)=>String($).padStart(T,"0");var BR=($,T,...[W])=>{let U=W?.stringifySymbol??M$,X=$;switch(typeof T){case"string":X=IT(T)?$===""?T:`${$}.${T}`:`${$}[${JSON.stringify(T)}]`;break;case"number":X=`${$}[${T}]`;break;case"symbol":X=`${$}[${U(T)}]`;break;default:if(W?.stringifyNonKey)X=`${$}[${W.stringifyNonKey(T)}]`;else I(`${M$(T)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return X},d0=($,...T)=>$.reduce((W,U)=>BR(W,U,...T),"");class Sw extends sz{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"?M$(this[$]):this[$]);return this.cache.json}stringify(){if(this.cache.stringify)return this.cache.stringify;return this.cache.stringify=d0(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let $="",T=[$];for(let W of this)$=BR($,W),T.push($);return this.cache.stringifyAncestors=T}}class tQ{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 T="";while(this.lookahead){if($(this,T))if(T[T.length-1]===kw)T=T.slice(0,-1);else break;T+=this.shift()}return T}shiftUntilLookahead($){return typeof $==="string"?this.shiftUntil((T)=>T.lookahead===$):this.shiftUntil((T)=>(T.lookahead in $))}shiftUntilNonWhitespace(){return this.shiftUntil(()=>!(this.lookahead in BT))}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($,T){return this.chars.slice($,T).join("")}lookaheadIs($){return this.lookahead===$}lookaheadIsIn($){return this.lookahead in $}}var iT$=h1("implementedTraits");var aQ="$ark",Qx=2;while(aQ in globalThis)aQ=`$ark${Qx++}`;var IR=aQ;globalThis[IR]=xW;var y=xW,Zx=($)=>`${IR}.${$}`,Z4=($)=>Zx(Pw($));class T9 extends Jw{argNames;body="";constructor(...$){super();this.argNames=$;for(let T of $){if(T in this)throw new Error(`Arg name '${T}' would overwrite an existing property on FunctionBody`);this[T]=T}}indentation=0;indent(){return this.indentation+=4,this}dedent(){return this.indentation-=4,this}prop($,T=!1){return sQ($,T)}index($,T=!1){return xR(`${$}`,T)}line($){return this.body+=`${" ".repeat(this.indentation)}${$}
|
|
122
146
|
`,this}const($,T){return this.line(`const ${$} = ${T}`),this}let($,T){return this.line(`let ${$} = ${T}`)}set($,T){return this.line(`${$} = ${T}`)}if($,T){return this.block(`if (${$})`,T)}elseIf($,T){return this.block(`else if (${$})`,T)}else($){return this.block("else",$)}for($,T,W=0){return this.block(`for (let i = ${W}; ${$}; i++)`,T)}forIn($,T){return this.block(`for (const k in ${$})`,T)}block($,T,W=""){return this.line(`${$} {`),this.indent(),T(this),this.dedent(),this.line(`}${W}`)}return($=""){return this.line(`return ${$}`)}write($="anonymous",T=0){return`${$}(${this.argNames.join(", ")}) { ${T?this.body.split(`
|
|
123
147
|
`).map((W)=>" ".repeat(T)+`${W}`).join(`
|
|
124
|
-
`):this.body} }`}compile(){return new
|
|
125
|
-
`)}_add($){let T=this.byPath[$.propString];if(T){if(T.hasCode("union")&&T.errors.length===0)return;let W=$.hasCode("union")&&$.errors.length===0?$:new fT({code:"intersection",errors:T.hasCode("intersection")?[...T.errors,$]:[T,$]},this.ctx),
|
|
126
|
-
`+$.map((T)=>` \u2022 ${
|
|
127
|
-
`));Object.defineProperty(this,"arkErrors",{value:$,enumerable:!1})}}var
|
|
148
|
+
`):this.body} }`}compile(){return new AR(...this.argNames,this.body)}}var o0=($)=>d6($,"object")||typeof $==="symbol"?Z4($):qw($),sQ=($,T=!1)=>{if(typeof $==="string"&&IT($))return`${T?"?":""}.${$}`;return xR(Vx($),T)},Vx=($)=>typeof $==="symbol"?Z4($):JSON.stringify($),xR=($,T=!1)=>`${T?"?.":""}[${$}]`;class jw extends T9{traversalKind;optimistic;constructor($){super("data","ctx");this.traversalKind=$.kind,this.optimistic=$.optimistic===!0}invoke($,T){let W=T?.arg??this.data,U=typeof $==="string"?!0:this.requiresContextFor($),X=typeof $==="string"?$:$.id;if(U)return`${this.referenceToId(X,T)}(${W}, ${this.ctx})`;return`${this.referenceToId(X,T)}(${W})`}referenceToId($,T){let W=T?.kind??this.traversalKind,U=`this.${$}${W}`;return T?.bind?`${U}.bind(${T?.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($,T,W){let U=this.requiresContextFor(W);if(U)this.line(`${this.ctx}.path.push(${$})`);if(this.check(W,{arg:T}),U)this.line(`${this.ctx}.path.pop()`);return this}check($,T){return this.traversalKind==="Allows"?this.if(`!${this.invoke($,T)}`,()=>this.return(!1)):this.line(this.invoke($,T))}}var W9=($)=>E$($,(T,W)=>[T,o$(W)?[...W]:W]),S6=h1("arkKind"),W$=($,T)=>$?.[S6]===T,a$=($)=>W$($,"root")||W$($,"constraint");var fR=["unit","proto","domain"],TX=["required","optional","index","sequence"],eQ=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],X9=[...eQ,...TX,"structure","predicate"],WX=["alias","union","morph","unit","intersection","proto","domain"],Kx=[...WX,...X9],U9=E$(X9,($,T)=>[T,1]),bR=E$([...TX,"undeclared"],($,T)=>[T,1]),yR=E$(Kx,($,T)=>[T,$]),XX=($)=>typeof $==="string"&&($ in yR);var UX=($)=>yR[$],w9=($)=>WX.slice(UX($)+1),BW$=[...w9("union"),"alias"],IW$=[...w9("morph"),"alias"],_1=($)=>{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 o0($)},xT=($)=>{let T="{ ";for(let[W,U]of Object.entries($))T+=`${W}: ${o0(U)}, `;return T+" }"},D$=($)=>{let T=$;if(T.hasAssociatedError)T.defaults.expected??=(W)=>("description"in W)?W.description:T.defaults.description(W),T.defaults.actual??=(W)=>M$(W),T.defaults.problem??=(W)=>`must be ${W.expected}${W.actual?` (was ${W.actual})`:""}`,T.defaults.message??=(W)=>{if(W.path.length===0)return W.problem;let U=`${W.propString} ${W.problem}`;if(U[0]==="[")return`value at ${U}`;return U};return T};class hR extends Error{name="ToJsonSchemaError";code;context;constructor($,T){super(M$(T,{quoteKeys:!1,indent:4}));this.code=$,this.context=T}hasCode($){return this.code===$}}var Ax={dialect:"https://json-schema.org/draft/2020-12/schema",useRefs:!1,fallback:{arrayObject:($)=>U4.throw("arrayObject",$),arrayPostfix:($)=>U4.throw("arrayPostfix",$),defaultValue:($)=>U4.throw("defaultValue",$),domain:($)=>U4.throw("domain",$),morph:($)=>U4.throw("morph",$),patternIntersection:($)=>U4.throw("patternIntersection",$),predicate:($)=>U4.throw("predicate",$),proto:($)=>U4.throw("proto",$),symbolKey:($)=>U4.throw("symbolKey",$),unit:($)=>U4.throw("unit",$),date:($)=>U4.throw("date",$)}},U4={Error:hR,throw:(...$)=>{throw new U4.Error(...$)},throwInternalOperandError:($,T)=>B$(`Unexpected JSON Schema input for ${$}: ${M$(T)}`),defaultConfig:Ax};y.config??={};var Bw=($,T)=>{if(!T)return $;let W={...$},U;for(U in T){let X={...$.keywords};if(U==="keywords"){for(let w in T[U]){let Y=T.keywords[w];if(Y===void 0)continue;X[w]=typeof Y==="string"?{description:Y}:Y}W.keywords=X}else if(U==="toJsonSchema")W[U]=$Z($.toJsonSchema,T.toJsonSchema);else if(XX(U))W[U]={...$[U],...T[U]};else W[U]=T[U]}return W},$Z=($,T)=>{if(!$)return T??{};if(!T)return $;let W={...$},U;for(U in T)if(U==="fallback")W.fallback=Ex($.fallback,T.fallback);else W[U]=T[U];return W},Ex=($,T)=>{$=gR($),T=gR(T);let W={},U;for(U in U4.defaultConfig.fallback)W[U]=T[U]??T.default??$[U]??$.default??U4.defaultConfig.fallback[U];return W},gR=($)=>typeof $==="function"?{default:$}:$??{};class fT extends Jw{[S6]="error";path;data;nodeConfig;input;ctx;constructor({prefixPath:$,relativePath:T,...W},U){super();this.input=W,this.ctx=U,FR(this,W);let X=U.data;if(W.code==="union")W.errors=W.errors.flatMap((Y)=>{let G=Y.hasCode("union")?Y.errors:[Y];if(!$&&!T)return G;return G.map((H)=>H.transform((z)=>({...z,path:UR($,z.path,T)})))});this.nodeConfig=U.config[this.code];let w=[...W.path??U.path];if(T)w.push(...T);if($)w.unshift(...$);this.path=new Sw(...w),this.data="data"in W?W.data:X}transform($){return new fT($({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode($){return this.code===$}get propString(){return d0(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 l6 extends sz{[S6]="errors";ctx;constructor($){super();this.ctx=$}byPath=Object.create(null);get flatByPath(){return E$(this.byPath,($,T)=>[$,T.flat])}get flatProblemsByPath(){return E$(this.byPath,($,T)=>[$,T.flat.map((W)=>W.problem)])}byAncestorPath=Object.create(null);count=0;mutable=this;throw(){throw this.toTraversalError()}toTraversalError(){return new TZ(this)}add($){if(this.includes($))return;this._add($)}transform($){let T=new l6(this.ctx);for(let W of this)T.add($(W));return T}merge($){for(let T of $){if(this.includes(T))continue;this._add(new fT({...T,path:[...this.ctx.path,...T.path]},this.ctx))}}affectsPath($){if(this.length===0)return!1;return $.stringifyAncestors().some((T)=>(T 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(`
|
|
149
|
+
`)}_add($){let T=this.byPath[$.propString];if(T){if(T.hasCode("union")&&T.errors.length===0)return;let W=$.hasCode("union")&&$.errors.length===0?$:new fT({code:"intersection",errors:T.hasCode("intersection")?[...T.errors,$]:[T,$]},this.ctx),U=this.indexOf(T);this.mutable[U===-1?this.length:U]=W,this.byPath[$.propString]=W,this.addAncestorPaths($)}else this.byPath[$.propString]=$,this.addAncestorPaths($),this.mutable.push($);this.count++}addAncestorPaths($){for(let T of $.path.stringifyAncestors())this.byAncestorPath[T]=C$(this.byAncestorPath[T],$)}}class TZ extends Error{name="TraversalError";constructor($){if($.length===1)super($.summary);else super(`
|
|
150
|
+
`+$.map((T)=>` \u2022 ${Mx(T)}`).join(`
|
|
151
|
+
`));Object.defineProperty(this,"arkErrors",{value:$,enumerable:!1})}}var Mx=($)=>$.toString().split(`
|
|
128
152
|
`).join(`
|
|
129
|
-
`);class g1{path=[];errors=new o6(this);root;config;queuedMorphs=[];branches=[];seen={};constructor($,T){this.root=$,this.config=T}get data(){let $=this.root;for(let T of this.path)$=$?.[T];return $}get propString(){return d0(this.path)}reject($){return this.error($),!1}mustBe($){return this.error($),!1}error($){let T=typeof $==="object"?$.code?$:{...$,code:"predicate"}:{code:"predicate",expected:$};return this.errorFromContext(T)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches.at(-1)}queueMorphs($){let T={path:new I8(...this.path),morphs:$};if(this.currentBranch)this.currentBranch.queuedMorphs.push(T);else this.queuedMorphs.push(T)}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 T=new fT($,this);if(this.currentBranch)this.currentBranch.error=T;else this.errors.add(T);return T}applyQueuedMorphs(){while(this.queuedMorphs.length){let $=this.queuedMorphs;this.queuedMorphs=[];for(let{path:T,morphs:W}of $){if(this.errors.affectsPath(T))continue;this.applyMorphsAtPath(T,W)}}}applyMorphsAtPath($,T){let W=$.at(-1),X;if(W!==void 0){X=this.root;for(let U=0;U<$.length-1;U++)X=X[$[U]]}this.path=[...$];for(let U of T){let w=a$(U),Y=U(X===void 0?this.root:X[W],this);if(Y instanceof fT){this.errors.add(Y);break}if(Y instanceof o6){if(!w)this.errors.merge(Y);break}if(X===void 0)this.root=Y;else X[W]=Y;this.applyQueuedMorphs()}}}var l6=($,T,W)=>{if(!W)return T();W.path.push($);let X=T();return W.path.pop(),X};class b8 extends h1{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor($,T){super((X,U,w=this.onFail)=>{if(U)return this.traverseApply(X,U),U.hasError()?U.errors:U.data;return this.rootApply(X,w)},{attach:$});this.attachments=$,this.$=T,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((X,U)=>Ax(X,U.shallowReferences),[this]);let W=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let X=0;X<this.children.length;X++){if(this.includesTransform||=this.children[X].includesTransform,this.includesContextualPredicate||=this.children[X].includesContextualPredicate,this.isCyclic||=this.children[X].isCyclic,!W){let U=this.children[X].flatRefs;for(let w=0;w<U.length;w++){let Y=U[w];if(!this.flatRefs.some((G)=>jR(G,Y))){this.flatRefs.push(Y);for(let G of Y.node.branches)if(G.hasKind("morph")||G.hasKind("intersection")&&G.structure?.structuralMorph!==void 0)this.flatMorphs.push({path:Y.path,propString:Y.propString,node:G})}}}Object.assign(this.referencesById,this.children[X].referencesById)}this.flatRefs.sort((X,U)=>X.path.length>U.path.length?1:X.path.length<U.path.length?-1:X.propString>U.propString?1:X.propString<U.propString?-1:X.node.expression<U.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((X)=>X.length===1||X.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some((X)=>X.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?(X)=>this.traverseAllows(X,new g1(X,this.$.resolvedConfig)):(X)=>this.traverseAllows(X)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(T,W)=>{if(this.allows(T))return T;let X=new g1(T,this.$.resolvedConfig);return this.traverseApply(T,X),X.finalize(W)};case"contextual":return(T,W)=>{let X=new g1(T,this.$.resolvedConfig);return this.traverseApply(T,X),X.finalize(W)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];let $=this.$.resolvedConfig.clone;return(T,W)=>{if(this.allows(T))return this.contextFreeMorph($&&(typeof T==="object"&&T!==null||typeof T==="function")?$(T):T);let X=new g1(T,this.$.resolvedConfig);return this.traverseApply(T,X),X.finalize(W)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,I$(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=Kx(this.metaJson);cacheGetter($,T){return Object.defineProperty(this,$,{value:T}),T}get description(){return this.cacheGetter("description",this.meta?.description??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}precedence=XU(this.kind);precompilation;assert=($,T)=>this($,T,(W)=>W.throw());traverse($,T){return this($,T,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 T={};for(let[W,X]of this.innerEntries){let U=this.impl.keys[W];if(U.reduceIo)U.reduceIo($,T,X);else if(U.child){let w=X;T[W]=o$(w)?w.map((Y)=>Y[$]):w[$]}else T[W]=X}return this.$.node(this.kind,T)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals($){let T=a$($)?$:this.$.parseDefinition($);return this.innerHash===T.innerHash}ifEquals($){return this.equals($)?this:void 0}hasKind($){return this.kind===$}assertHasKind($){if(this.kind!==$)jW(`${this.kind} node was not of asserted kind ${$}`);return this}hasKindIn(...$){return $.includes(this.kind)}assertHasKindIn(...$){if(!m0($,this.kind))jW(`${this.kind} node was not one of asserted kinds ${$}`);return this}isBasis(){return m0(kR,this.kind)}isConstraint(){return m0(T9,this.kind)}isStructural(){return m0(TU,this.kind)}isRefinement(){return m0(nQ,this.kind)}isRoot(){return m0(WU,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 T=f8.normalize($);return this._select(T)}_select($){let T=f8.applyBoundary[$.boundary??"references"](this);if($.kind)T=T.filter((W)=>W.kind===$.kind);if($.where)T=T.filter($.where);return f8.applyMethod[$.method??"filter"](T,this,$)}transform($,T){return this._transform($,this._createTransformContext(T))}_createTransformContext($){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:$?.prereduced??!1},undeclaredKeyHandling:void 0,...$}}_transform($,T){let W=T.bindScope??this.$;if(T.seen[this.id])return this.$.lazilyResolve(T.seen[this.id]);if(T.shouldTransform?.(this,T)===!1)return this;let X;if(T.seen[this.id]=()=>X,this.hasKind("structure")&&this.undeclared!==T.undeclaredKeyHandling)T={...T,undeclaredKeyHandling:this.undeclared};let U=E$(this.inner,(z,F)=>{if(!this.impl.keys[z].child)return[z,F];let O=F;if(!o$(O)){let Z=O._transform($,T);return Z?[z,Z]:[]}if(O.length===0)return[z,F];let Q=O.flatMap((Z)=>{return Z._transform($,T)??[]});return Q.length?[z,Q]:[]});delete T.seen[this.id];let w=Object.assign(U,{meta:this.meta}),Y=T.selected&&!T.selected.includes(this)?w:$(this.kind,w,T);if(Y===null)return null;if(a$(Y))return X=Y;let G=Object.keys(Y);if((G.length===0||G.length===1&&G[0]==="meta")&&!H0(this.inner))return null;if((this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in Y))return T.undeclaredKeyHandling?{...Y,value:y.intrinsic.unknown}:null;if(this.kind==="morph")Y.in??=y.intrinsic.unknown;return X=W.node(this.kind,Y,T.parseOptions)}configureReferences($,T="references"){let W=f8.normalize(T),X=typeof $==="string"?(G,H)=>({...H,meta:{...H.meta,description:$}}):typeof $==="function"?(G,H)=>({...H,meta:$(H.meta)}):(G,H)=>({...H,meta:{...H.meta,...$}});if(W.boundary==="self")return this.$.node(this.kind,X(this.kind,{...this.inner,meta:this.meta}));let U=this._select(W),w=U&&ST(U),Y=W.boundary==="child"?(G,H)=>H.root.children.includes(G):W.boundary==="shallow"?(G)=>G.kind!=="structure":()=>!0;return this.$.finalize(this.transform(X,{shouldTransform:Y,selected:w}))}}var f8={applyBoundary:{self:($)=>[$],child:($)=>[...$.children],shallow:($)=>[...$.shallowReferences],references:($)=>[...$.references]},applyMethod:{filter:($)=>$,assertFilter:($,T,W)=>{if($.length===0)jW(SR(T,W));return $},find:($)=>$[0],assertFind:($,T,W)=>{if($.length===0)jW(SR(T,W));return $[0]}},normalize:($)=>typeof $==="function"?{boundary:"references",method:"filter",where:$}:typeof $==="string"?b4($,f8.applyBoundary)?{method:"filter",boundary:$}:{boundary:"references",method:"filter",kind:$}:{boundary:"references",method:"filter",...$}},SR=($,T)=>`${$} had no references matching ${M$(T)}.`,Zx=($)=>d0($,{stringifyNonKey:(T)=>T.expression}),Vx=/"(\$ark\.[^"]+)"/g,Kx=($)=>JSON.stringify($).replaceAll(Vx,"$1"),m1=($,T)=>({path:$,node:T,propString:Zx($)}),jR=($,T)=>$.propString===T.propString&&$.node.equals(T.node),aQ=($,T)=>z0($,T,{isEqual:jR}),Ax=($,T)=>z0($,T,{isEqual:(W,X)=>W.equals(X)});class r extends Array{static init($,T,W,X){return new r({kind:$,l:T,r:W,path:X?.path??[],optional:X?.optional??!1})}add($,T,W,X){return this.push({kind:$,l:T,r:W,path:X?.path??[],optional:X?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){let{path:$,l:T,r:W}=this[0],X=d0($);return eQ(`Intersection${X&&` at ${X}`} of ${IR(T,W)}`)}return`The following intersections result in unsatisfiable types:
|
|
130
|
-
\u2022 ${this.map(({path:$,l:T,r:W})=>`${$}: ${
|
|
131
|
-
\u2022 `)}`}throw(){return B(this.describeReasons())}invert(){let $=this.map((T)=>({...T,l:T.r,r:T.l}));if(!($ instanceof r))return new r(...$);return $}withPrefixKey($,T){return this.map((W)=>({...W,path:[$,...W.path],optional:W.optional||T==="optional"}))}toNeverIfDisjoint(){return y.intrinsic.never}}var IR=($,T)=>`${sQ($)} and ${sQ(T)}`,sQ=($)=>a$($)?$.expression:o$($)?$.map(sQ).join(" | ")||"never":String($),eQ=($)=>`${$} results in an unsatisfiable type`;var wU={},r6=($,T,W)=>s$($,T,{$:W,invert:!1,pipe:!1}),y8=($,T,W)=>s$($,T,{$:W,invert:!1,pipe:!0}),s$=($,T,W)=>{let X=W.pipe?"|>":"&",U=`${$.hash}${X}${T.hash}`;if(wU[U]!==void 0)return wU[U];if(!W.pipe){let G=`${T.hash}${X}${$.hash}`;if(wU[G]!==void 0){let H=wU[G],z=H instanceof r?H.invert():H;return wU[U]=z,z}}let w=!W.pipe||!$.includesTransform&&!T.includesTransform;if(w&&$.equals(T))return $;let Y=w?$Z($,T,W):$.hasKindIn(...WU)?Ex($,T,W):$Z($,T,W);if(a$(Y)){if($.equals(Y))Y=$;else if(T.equals(Y))Y=T}return wU[U]=Y,Y},$Z=($,T,W)=>{let X=$.precedence<T.precedence?$.kind:T.kind,U=$.impl.intersections[T.kind]??T.impl.intersections[$.kind];if(U===void 0)return null;else if(X===$.kind)return U($,T,W);else{let w=U(T,$,{...W,invert:!W.invert});if(w instanceof r)w=w.invert();return w}},Ex=($,T,W)=>$.includesTransform||T.includesTransform?W.invert?BR(T,$,W):BR($,T,W):$Z($,T,W),BR=($,T,W)=>$.distribute((X)=>Mx(X,T,W),(X)=>{let U=X.filter(a$);if(U.length===0)return r.init("union",$.branches,T.branches);if(U.length<$.branches.length||!$.branches.every((G,H)=>G.in.equals(U[H].in)))return W.$.parseSchema(U);let w;if(U.length===1){let G=U[0];if(!w)return G;return W.$.node("morph",{...G.inner,in:G.in.configure(w,"self")})}let Y={branches:U};if(w)Y.meta=w;return W.$.parseSchema(Y)}),Mx=($,T,W)=>{if($.hasKind("morph")){let U=[...$.morphs];if($.lastMorphIfNode){let w=s$($.lastMorphIfNode,T,W);if(w instanceof r)return w;U[U.length-1]=w}else U.push(T);return W.$.node("morph",{morphs:U,in:$.inner.in})}if(T.hasKind("morph")){let U=s$($,T.in,W);if(U instanceof r)return U;return W.$.node("morph",{morphs:[T],in:U})}return W.$.node("morph",{morphs:[T],in:$})};class _1 extends b8{constructor($,T){super($,T);Object.defineProperty(this,C6,{value:"constraint",enumerable:!1})}impliedSiblings;intersect($){return r6(this,$,this.$)}}class l0 extends _1{traverseApply=($,T)=>{if(!this.traverseAllows($,T))T.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 xT(this.errorContext)}}var w6=($)=>(T,W)=>{if(o$(T)){if(T.length===0)return;let U=T.map((w)=>W.$.node($,w));if($==="predicate")return U;return U.sort((w,Y)=>w.hash<Y.hash?-1:1)}let X=W.$.node($,T);return X.hasOpenIntersection()?[X]:X},YU=($)=>{let T=$.r.shift();if(!T){let X=$.l.length===0&&$.kind==="structure"?y.intrinsic.unknown.internal:$.ctx.$.node($.kind,Object.assign($.baseInner,Dx($.l)),{prereduced:!0});for(let U of $.roots){if(X instanceof r)return X;X=s$(U,X,$.ctx)}return X}let W=!1;for(let X=0;X<$.l.length;X++){let U=s$($.l[X],T,$.ctx);if(U===null)continue;if(U instanceof r)return U;if(!W){if(U.isRoot())return $.roots.push(U),$.l.splice(X),YU($);$.l[X]=U,W=!0}else if(!$.l.includes(U))return I$(`Unexpectedly encountered multiple distinct intersection results for refinement ${U}`)}if(!W)$.l.push(T);if($.kind==="intersection"){if(T.impliedSiblings)for(let X of T.impliedSiblings)z0($.r,X)}return YU($)},GU=($)=>{return Object.entries($).flatMap(([W,X])=>(W in W9)?X:[]).sort((W,X)=>W.precedence<X.precedence?-1:W.precedence>X.precedence?1:W.kind==="predicate"&&X.kind==="predicate"?0:W.hash<X.hash?-1:1)},Dx=($)=>{let T={};for(let W of $)if(W.hasOpenIntersection())T[W.kind]=C$(T[W.kind],W);else{if(T[W.kind])return I$(`Unexpected intersection of closed refinements of kind ${W.kind}`);T[W.kind]=W}return T},xR=(...$)=>B(fR(...$)),fR=($,T,W)=>{let X=W.hasKind("morph")?"a morph":W.isUnknown()?"unknown":W.exclude(T).defaultShortDescription;return`${FR($)} operand must be ${T.description} (was ${X})`};var bR=($,T,W)=>new bT($,T,W,W,null);class X9 extends h1{}class bT extends h1{[C6]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor($,T,W,X,U){super((...w)=>{let Y=E$(this.names,(G,H)=>{let z=this.arg$.parse(w[G]);if(!z.extends(this.constraints[G]))B(Nx(H,this.constraints[G].expression,z.expression));return[H,z]});if(this.defIsLazy()){let G=this.bodyDef(Y);return this.$.parse(G)}return this.$.parse(T,{args:Y})});this.paramDefs=$,this.bodyDef=T,this.$=W,this.arg$=X,this.hkt=U,this.description=U?new U().description??`a generic type for ${U.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof X9}cacheGetter($,T){return Object.defineProperty(this,$,{value:T}),T}get json(){return this.cacheGetter("json",{params:this.params.map(($)=>$[1].isUnknown()?$[0]:[$[0],$[1].json]),body:LR(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(($)=>typeof $==="string"?[$,y.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 Nx=($,T,W)=>`${$} must be assignable to ${T} (was ${W})`;var Lx=D$({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 yR extends _1{serializedPredicate=Z4(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=xT(this.errorContext);traverseApply=($,T)=>{if(!this.predicate($,T.external)&&!T.hasError())T.errorFromNodeContext(this.errorContext)};compile($){if($.traversalKind==="Allows"){$.return(this.compiledCondition);return}$.if(`${this.compiledNegation} && !ctx.hasError()`,()=>$.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema($,T){return T.fallback.predicate({code:"predicate",base:$,predicate:this.predicate})}}var TZ={implementation:Lx,Node:yR};var Jx=D$({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:($)=>Number.isInteger($)?$:B(Rx($))}},normalize:($)=>typeof $==="number"?{rule:$}:$,hasAssociatedError:!0,defaults:{description:($)=>$.rule===1?"an integer":$.rule===2?"even":`a multiple of ${$.rule}`},intersections:{divisor:($,T,W)=>W.$.node("divisor",{rule:Math.abs($.rule*T.rule/_x($.rule,T.rule))})},obviatesBasisDescription:!0});class hR extends l0{traverseAllows=($)=>$%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=y.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema($){if($.type="integer",this.rule===1)return $;return $.multipleOf=this.rule,$}}var WZ={implementation:Jx,Node:hR};var Rx=($)=>`divisor must be an integer (was ${$})`,_x=($,T)=>{let W,X=$,U=T;while(U!==0)W=U,U=X%U,X=W;return X};class Z1 extends l0{boundOperandKind=qx[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=Cx(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${kx[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?Sx(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 kx={"<":">=","<=":">",">":"<=",">=":"<"},vx={min:"max",minLength:"maxLength",after:"before"},w9={parse:($)=>$||void 0},Y9=($)=>(T)=>{if(typeof T==="number")return{rule:T};let{exclusive:W,...X}=T;return W?{...X,rule:$==="minLength"?X.rule+1:X.rule-1}:X},G9=($)=>(T)=>{if(typeof T==="number"||typeof T==="string"||T instanceof Date)return{rule:T};let{exclusive:W,...X}=T;if(!W)return X;let U=typeof X.rule==="number"?X.rule:typeof X.rule==="string"?new Date(X.rule).valueOf():X.rule.valueOf();return W?{...X,rule:$==="after"?U+1:U-1}:X},z9=($)=>typeof $==="string"||typeof $==="number"?new Date($):$,Px=($,T)=>`${$} bound must be a positive integer (was ${T})`,zU=($)=>(T)=>{if(!Number.isInteger(T)||T<0)B(Px($,T));return T},qx={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},Cx=($,T)=>`${b4($,vx)?">":"<"}${T?"":"="}`,Sx=($)=>typeof $==="string"?$:new Date($).toLocaleString(),gR=($)=>`Bounded expression ${$} must be exactly one of number, string, Array, or Date`;var jx=D$({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:z9,serialize:($)=>$.toISOString()}},normalize:G9("after"),defaults:{description:($)=>`${$.collapsibleLimitString} or later`,actual:fW},intersections:{after:($,T)=>$.isStricterThan(T)?$:T}});class mR extends Z1{impliedBasis=y.intrinsic.Date.internal;collapsibleLimitString=fW(this.rule);traverseAllows=($)=>$>=this.rule;reduceJsonSchema($,T){return T.fallback.date({code:"date",base:$,after:this.rule})}}var UZ={implementation:jx,Node:mR};var Ix=D$({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:z9,serialize:($)=>$.toISOString()}},normalize:G9("before"),defaults:{description:($)=>`${$.collapsibleLimitString} or earlier`,actual:fW},intersections:{before:($,T)=>$.isStricterThan(T)?$:T,after:($,T,W)=>$.overlapsRange(T)?$.overlapIsUnit(T)?W.$.node("unit",{unit:$.rule}):null:r.init("range",$,T)}});class cR extends Z1{collapsibleLimitString=fW(this.rule);traverseAllows=($)=>$<=this.rule;impliedBasis=y.intrinsic.Date.internal;reduceJsonSchema($,T){return T.fallback.date({code:"date",base:$,before:this.rule})}}var XZ={implementation:Ix,Node:cR};var Bx=D$({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:zU("exactLength")}},normalize:($)=>typeof $==="number"?{rule:$}:$,hasAssociatedError:!0,defaults:{description:($)=>`exactly length ${$.rule}`,actual:($)=>`${$.length}`},intersections:{exactLength:($,T,W)=>r.init("unit",W.$.node("unit",{unit:$.rule}),W.$.node("unit",{unit:T.rule}),{path:["length"]}),minLength:($,T)=>$.rule>=T.rule?$:r.init("range",$,T),maxLength:($,T)=>$.rule<=T.rule?$:r.init("range",$,T)}});class uR extends l0{traverseAllows=($)=>$.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=y.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 X4.throwInternalOperandError("exactLength",$)}}}var wZ={implementation:Bx,Node:uR};var xx=D$({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:w9},normalize:($)=>typeof $==="number"?{rule:$}:$,defaults:{description:($)=>{if($.rule===0)return $.exclusive?"negative":"non-positive";return`${$.exclusive?"less than":"at most"} ${$.rule}`}},intersections:{max:($,T)=>$.isStricterThan(T)?$:T,min:($,T,W)=>$.overlapsRange(T)?$.overlapIsUnit(T)?W.$.node("unit",{unit:$.rule}):null:r.init("range",$,T)},obviatesBasisDescription:!0});class pR extends Z1{impliedBasis=y.intrinsic.number.internal;traverseAllows=this.exclusive?($)=>$<this.rule:($)=>$<=this.rule;reduceJsonSchema($){if(this.exclusive)$.exclusiveMaximum=this.rule;else $.maximum=this.rule;return $}}var YZ={implementation:xx,Node:pR};var fx=D$({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:zU("maxLength")}},reduce:($,T)=>$.rule===0?T.node("exactLength",$):void 0,normalize:Y9("maxLength"),defaults:{description:($)=>`at most length ${$.rule}`,actual:($)=>`${$.length}`},intersections:{maxLength:($,T)=>$.isStricterThan(T)?$:T,minLength:($,T,W)=>$.overlapsRange(T)?$.overlapIsUnit(T)?W.$.node("exactLength",{rule:$.rule}):null:r.init("range",$,T)}});class dR extends Z1{impliedBasis=y.intrinsic.lengthBoundable.internal;traverseAllows=($)=>$.length<=this.rule;reduceJsonSchema($){switch($.type){case"string":return $.maxLength=this.rule,$;case"array":return $.maxItems=this.rule,$;default:return X4.throwInternalOperandError("maxLength",$)}}}var GZ={implementation:fx,Node:dR};var bx=D$({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:w9},normalize:($)=>typeof $==="number"?{rule:$}:$,defaults:{description:($)=>{if($.rule===0)return $.exclusive?"positive":"non-negative";return`${$.exclusive?"more than":"at least"} ${$.rule}`}},intersections:{min:($,T)=>$.isStricterThan(T)?$:T},obviatesBasisDescription:!0});class oR extends Z1{impliedBasis=y.intrinsic.number.internal;traverseAllows=this.exclusive?($)=>$>this.rule:($)=>$>=this.rule;reduceJsonSchema($){if(this.exclusive)$.exclusiveMinimum=this.rule;else $.minimum=this.rule;return $}}var zZ={implementation:bx,Node:oR};var yx=D$({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:zU("minLength")}},reduce:($)=>$.rule===0?y.intrinsic.unknown:void 0,normalize:Y9("minLength"),defaults:{description:($)=>$.rule===1?"non-empty":`at least length ${$.rule}`,actual:($)=>$.length===0?"":`${$.length}`},intersections:{minLength:($,T)=>$.isStricterThan(T)?$:T}});class lR extends Z1{impliedBasis=y.intrinsic.lengthBoundable.internal;traverseAllows=($)=>$.length>=this.rule;reduceJsonSchema($){switch($.type){case"string":return $.minLength=this.rule,$;case"array":return $.minItems=this.rule,$;default:return X4.throwInternalOperandError("minLength",$)}}}var HZ={implementation:yx,Node:lR};var rR={min:zZ.implementation,max:YZ.implementation,minLength:HZ.implementation,maxLength:GZ.implementation,exactLength:wZ.implementation,after:UZ.implementation,before:XZ.implementation},nR={min:zZ.Node,max:YZ.Node,minLength:HZ.Node,maxLength:GZ.Node,exactLength:wZ.Node,after:UZ.Node,before:XZ.Node};var hx=D$({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 iR extends l0{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=y.intrinsic.string.internal;reduceJsonSchema($,T){if($.pattern)return T.fallback.patternIntersection({code:"patternIntersection",base:$,pattern:this.rule});return $.pattern=this.rule,$}}var FZ={implementation:hx,Node:iR};var h8=($,T)=>{let W=gx($);if(T&&!T.includes(W))return B(`Root of kind ${W} should be one of ${T}`);return W},gx=($)=>{if(W$($,"root"))return $.kind;if(typeof $==="string")return $[0]==="$"?"alias":($ in d6)?"domain":"proto";if(typeof $==="function")return"proto";if(typeof $!=="object"||$===null)return B(tR($));if("morphs"in $)return"morph";if("branches"in $||o$($))return"union";if("unit"in $)return"unit";if("reference"in $)return"alias";let T=Object.keys($);if(T.length===0||T.some((W)=>(W in W9)))return"intersection";if("proto"in $)return"proto";if("domain"in $)return"domain";return B(tR($))},tR=($)=>`${M$($)} is not a valid type schema`,aR={},mx=($)=>o$($)?$.map((T)=>T.collapsibleJson):$.collapsibleJson,S6={};y.nodesByRegisteredId=S6;var OZ=($)=>{return aR[$]??=0,`${$}${++aR[$]}`},QZ=($)=>{let T=HU[$.kind],W=T.applyConfig?.($.def,$.$.resolvedConfig)??$.def,X={},{meta:U,...w}=W,Y=U===void 0?{}:typeof U==="string"?{description:U}:U,G=fQ(w).sort(([z],[F])=>UU(z)?UU(F)?XU(z)-XU(F):1:UU(F)?-1:z<F?-1:1).filter(([z,F])=>{if(z.startsWith("meta.")){let O=z.slice(5);return Y[O]=F,!1}return!0});for(let z of G){let F=z[0],O=T.keys[F];if(!O)return B(`Key ${F} is not valid on ${$.kind} schema`);let Q=O.parse?O.parse(z[1],$):z[1];if(Q!==Q1&&(Q!==void 0||O.preserveUndefined))X[F]=Q}if(T.reduce&&!$.prereduced){let z=T.reduce(X,$.$);if(z){if(z instanceof r)return z.throw();return cx(z,Y)}}return ZZ({id:$.id,kind:$.kind,inner:X,meta:Y,$:$.$})},ZZ=({id:$,kind:T,inner:W,meta:X,$:U,ignoreCache:w})=>{let Y=HU[T],G=fQ(W),H=[],z={};for(let[L,J]of G){let _=Y.keys[L],C=_.serialize??(_.child?mx:R1);if(z[L]=C(J),_.child===!0){let f=J;if(o$(f))H.push(...f);else H.push(f)}else if(typeof _.child==="function")H.push(..._.child(J))}if(Y.finalizeInnerJson)z=Y.finalizeInnerJson(z);let F={...z},O={};if(!H0(X))O=E$(X,(L,J)=>[L,L==="examples"?J:R1(J)]),F.meta=H9(O,"description",!0);z=H9(z,Y.collapsibleKey,!1);let Q=JSON.stringify({kind:T,...z});F=H9(F,Y.collapsibleKey,!1);let Z=H9(F,Y.collapsibleKey,!0),K=JSON.stringify({kind:T,...F});if(U.nodesByHash[K]&&!w)return U.nodesByHash[K];let A={id:$,kind:T,impl:Y,inner:W,innerEntries:G,innerJson:z,innerHash:Q,meta:X,metaJson:O,json:F,hash:K,collapsibleJson:Z,children:H};if(T!=="intersection"){for(let L in W)if(L!=="in"&&L!=="out")A[L]=W[L]}let D=new eR[T](A,U);return U.nodesByHash[K]=D},sR=($,T)=>{if($.id===T)return $;if(a$(S6[T]))I$(`Unexpected attempt to overwrite node id ${T}`);return ZZ({id:T,kind:$.kind,inner:$.inner,meta:$.meta,$:$.$,ignoreCache:!0})},cx=($,T,W)=>{if(W&&a$(S6[W]))I$(`Unexpected attempt to overwrite node id ${W}`);return ZZ({id:W??OZ(T.alias??$.kind),kind:$.kind,inner:$.inner,meta:T,$:$.$})},H9=($,T,W)=>{let X=Object.keys($);if(X.length===1&&X[0]===T){let U=$[T];if(W)return U;if(p6(U,"object")&&(Object.keys(U).length===1||Array.isArray(U)))return U}return $};var g8=($,T,W)=>{if($.key!==T.key)return null;let X=$.key,U=s$($.value,T.value,W),w=$.required||T.required?"required":"optional";if(U instanceof r)if(w==="optional")U=y.intrinsic.never.internal;else return U.withPrefixKey($.key,$.required&&T.required?"required":"optional");if(w==="required")return W.$.node("required",{key:X,value:U});let Y=$.hasDefault()?T.hasDefault()?$.default===T.default?$.default:B(VZ($.default,T.default)):$.default:T.hasDefault()?T.default:Q1;return W.$.node("optional",{key:X,value:U,default:Y})};class m8 extends _1{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=y.intrinsic.object.internal;serializedKey=o0(this.key);compiledKey=typeof this.key==="string"?this.key:this.serializedKey;flatRefs=C$(this.value.flatRefs.map(($)=>m1([this.key,...$.path],$.node)),m1([this.key],this.value));_transform($,T){T.path.push(this.key);let W=super._transform($,T);return T.path.pop(),W}hasDefault(){return"default"in this.inner}traverseAllows=($,T)=>{if(this.key in $)return l6(this.key,()=>this.value.traverseAllows($[this.key],T),T);return this.optional};traverseApply=($,T)=>{if(this.key in $)l6(this.key,()=>this.value.traverseApply($[this.key],T),T);else if(this.hasKind("required"))T.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 VZ=($,T)=>`Invalid intersection of default values ${M$($)} & ${M$(T)}`;var ux=D$({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:($,T)=>T.$.parseSchema($)},default:{preserveUndefined:!0}},normalize:($)=>$,reduce:($,T)=>{if(T.resolvedConfig.exactOptionalPropertyTypes===!1){if(!$.value.allows(void 0))return T.node("optional",{...$,value:$.value.or(G$.undefined)},{prereduced:!0})}},defaults:{description:($)=>`${$.compiledKey}?: ${$.value.description}`},intersections:{optional:g8}});class $_ extends m8{constructor(...$){super(...$);if("default"in this.inner)u8(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;let{default:$,...T}=this.inner;return this.cacheGetter("outProp",this.$.node("required",T,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${M$(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=dx(this);defaultValueMorphRef=this.defaultValueMorph&&Z4(this.defaultValueMorph)}var c8={implementation:ux,Node:$_},px={},dx=($)=>{if(!$.hasDefault())return;let T=`{${$.compiledKey}: ${$.value.id} = ${R1($.default)}}`;return px[T]??=KZ($.key,$.value,$.default)},KZ=($,T,W)=>{if(typeof W==="function")return T.includesTransform?(U,w)=>{return l6($,()=>T(U[$]=W(),w),w),U}:(U)=>{return U[$]=W(),U};let X=T.includesTransform?T.assert(W):W;return p6(X,"object")?(U,w)=>{return l6($,()=>T(U[$]=W,w),w),U}:(U)=>{return U[$]=X,U}},u8=($,T,W)=>{let X=jT(T);if(p6(T,"object")&&!X)B(ox(W));let U=$.in(X?T():T);if(U instanceof o6){if(W===null)B(`Default ${U.summary}`);let w=U.transform((Y)=>Y.transform((G)=>({...G,prefixPath:[W]})));B(`Default for ${w.summary}`)}return T},ox=($)=>{return`Non-primitive default ${$===null?"":typeof $==="number"?`for value at [${$}] `:`for ${o0($)} `}must be specified as a function like () => ({my: 'object'})`};class k1 extends b8{constructor($,T){super($,T);Object.defineProperty(this,C6,{value:"root",enumerable:!1})}get internal(){return this}get "~standard"(){return{vendor:"arktype",version:1,validate:($)=>{let T=this($);if(T instanceof o6)return T;return{value:T}}}}as(){return this}brand($){if($==="")return B(lx);return this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute($,T){let W=this.branches.map($);return T?.(W)??W}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema($={}){let T=iQ(this.$.resolvedConfig.toJsonSchema,$);T.useRefs||=this.isCyclic;let W=typeof T.dialect==="string"?{$schema:T.dialect}:{};if(Object.assign(W,this.toJsonSchemaRecurse(T)),T.useRefs)W.$defs=E$(this.references,(X,U)=>U.isRoot()&&!U.alwaysExpandJsonSchema?[U.id,U.toResolvedJsonSchema(T)]:[]);return W}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 T=this.innerToJsonSchema($);return Object.assign(T,this.metaJson)}intersect($){let T=this.$.parseDefinition($),W=this.rawIntersect(T);if(W instanceof r)return W;return this.$.finalize(W)}rawIntersect($){return r6(this,$,this.$)}toNeverIfDisjoint(){return this}and($){let T=this.intersect($);return T instanceof r?T.throw():T}rawAnd($){let T=this.rawIntersect($);return T instanceof r?T.throw():T}or($){let T=this.$.parseDefinition($);return this.$.finalize(this.rawOr(T))}rawOr($){let T=[...this.branches,...$.branches];return this.$.node("union",T)}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((T,W)=>T.intersect(W).toNeverIfDisjoint(),y.intrinsic.unknown.internal);if($.branches.length===0)B(eQ(`keyof ${this.expression}`));return this._keyof=this.$.finalize($)}get props(){if(this.branches.length!==1)return B(rx(this.expression));return[...this.applyStructuralOperation("props",[])[0]]}merge($){let T=this.$.parseDefinition($);return this.$.schema(T.distribute((W)=>this.applyStructuralOperation("merge",[T_(W)??B(W_("merge",W.expression))])))}applyStructuralOperation($,T){return this.distribute((W)=>{if(W.equals(y.intrinsic.object)&&$!=="merge")return W;let X=T_(W);if(!X)B(W_($,W.expression));if($==="keyof")return X.keyof();if($==="get")return X.get(...T);if($==="props")return X.props;let U=$==="required"?"require":$==="partial"?"optionalize":$;return this.$.node("intersection",{...W.inner,structure:X[U](...T)})})}get(...$){if($[0]===void 0)return this;return this.$.schema(this.applyStructuralOperation("get",$))}extract($){let T=this.$.parseDefinition($);return this.$.schema(this.branches.filter((W)=>W.extends(T)))}exclude($){let T=this.$.parseDefinition($);return this.$.schema(this.branches.filter((W)=>!W.extends(T)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps($){return!(this.intersect($)instanceof r)}extends($){let T=this.intersect($);return!(T instanceof r)&&this.equals(T)}ifExtends($){return this.extends($)?this:void 0}subsumes($){return this.$.parseDefinition($).extends(this)}configure($,T="shallow"){return this.configureReferences($,T)}describe($,T="shallow"){return this.configure({description:$},T)}optional(){return[this,"?"]}default($){return u8(this,$,null),[this,"=",$]}from($){return this.assert($)}_pipe(...$){let T=$.reduce((W,X)=>W.rawPipeOnce(X),this);return this.$.finalize(T)}tryPipe(...$){let T=$.reduce((W,X)=>W.rawPipeOnce(W$(X,"root")?X:(U,w)=>{try{return X(U,w)}catch(Y){return w.error({code:"predicate",predicate:X,actual:`aborted due to error:
|
|
153
|
+
`);class m1{path=[];errors=new l6(this);root;config;queuedMorphs=[];branches=[];seen={};constructor($,T){this.root=$,this.config=T}get data(){let $=this.root;for(let T of this.path)$=$?.[T];return $}get propString(){return d0(this.path)}reject($){return this.error($),!1}mustBe($){return this.error($),!1}error($){let T=typeof $==="object"?$.code?$:{...$,code:"predicate"}:{code:"predicate",expected:$};return this.errorFromContext(T)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches.at(-1)}queueMorphs($){let T={path:new Sw(...this.path),morphs:$};if(this.currentBranch)this.currentBranch.queuedMorphs.push(T);else this.queuedMorphs.push(T)}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 T=new fT($,this);if(this.currentBranch)this.currentBranch.error=T;else this.errors.add(T);return T}applyQueuedMorphs(){while(this.queuedMorphs.length){let $=this.queuedMorphs;this.queuedMorphs=[];for(let{path:T,morphs:W}of $){if(this.errors.affectsPath(T))continue;this.applyMorphsAtPath(T,W)}}}applyMorphsAtPath($,T){let W=$.at(-1),U;if(W!==void 0){U=this.root;for(let X=0;X<$.length-1;X++)U=U[$[X]]}this.path=[...$];for(let X of T){let w=a$(X),Y=X(U===void 0?this.root:U[W],this);if(Y instanceof fT){this.errors.add(Y);break}if(Y instanceof l6){if(!w)this.errors.merge(Y);break}if(U===void 0)this.root=Y;else U[W]=Y;this.applyQueuedMorphs()}}}var r6=($,T,W)=>{if(!W)return T();W.path.push($);let U=T();return W.path.pop(),U};class xw extends g1{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor($,T){super((U,X,w=this.onFail)=>{if(X)return this.traverseApply(U,X),X.hasError()?X.errors:X.data;return this.rootApply(U,w)},{attach:$});this.attachments=$,this.$=T,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,X)=>Lx(U,X.shallowReferences),[this]);let W=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,!W){let X=this.children[U].flatRefs;for(let w=0;w<X.length;w++){let Y=X[w];if(!this.flatRefs.some((G)=>cR(G,Y))){this.flatRefs.push(Y);for(let G of Y.node.branches)if(G.hasKind("morph")||G.hasKind("intersection")&&G.structure?.structuralMorph!==void 0)this.flatMorphs.push({path:Y.path,propString:Y.propString,node:G})}}}Object.assign(this.referencesById,this.children[U].referencesById)}this.flatRefs.sort((U,X)=>U.path.length>X.path.length?1:U.path.length<X.path.length?-1:U.propString>X.propString?1:U.propString<X.propString?-1:U.node.expression<X.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 m1(U,this.$.resolvedConfig)):(U)=>this.traverseAllows(U)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(T,W)=>{if(this.allows(T))return T;let U=new m1(T,this.$.resolvedConfig);return this.traverseApply(T,U),U.finalize(W)};case"contextual":return(T,W)=>{let U=new m1(T,this.$.resolvedConfig);return this.traverseApply(T,U),U.finalize(W)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];let $=this.$.resolvedConfig.clone;return(T,W)=>{if(this.allows(T))return this.contextFreeMorph($&&(typeof T==="object"&&T!==null||typeof T==="function")?$(T):T);let U=new m1(T,this.$.resolvedConfig);return this.traverseApply(T,U),U.finalize(W)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,B$(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=Jx(this.metaJson);cacheGetter($,T){return Object.defineProperty(this,$,{value:T}),T}get description(){return this.cacheGetter("description",this.meta?.description??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}precedence=UX(this.kind);precompilation;assert=($,T)=>this($,T,(W)=>W.throw());traverse($,T){return this($,T,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 T={};for(let[W,U]of this.innerEntries){let X=this.impl.keys[W];if(X.reduceIo)X.reduceIo($,T,U);else if(X.child){let w=U;T[W]=o$(w)?w.map((Y)=>Y[$]):w[$]}else T[W]=U}return this.$.node(this.kind,T)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals($){let T=a$($)?$:this.$.parseDefinition($);return this.innerHash===T.innerHash}ifEquals($){return this.equals($)?this:void 0}hasKind($){return this.kind===$}assertHasKind($){if(this.kind!==$)jW(`${this.kind} node was not of asserted kind ${$}`);return this}hasKindIn(...$){return $.includes(this.kind)}assertHasKindIn(...$){if(!m0($,this.kind))jW(`${this.kind} node was not one of asserted kinds ${$}`);return this}isBasis(){return m0(fR,this.kind)}isConstraint(){return m0(X9,this.kind)}isStructural(){return m0(TX,this.kind)}isRefinement(){return m0(eQ,this.kind)}isRoot(){return m0(WX,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 T=Iw.normalize($);return this._select(T)}_select($){let T=Iw.applyBoundary[$.boundary??"references"](this);if($.kind)T=T.filter((W)=>W.kind===$.kind);if($.where)T=T.filter($.where);return Iw.applyMethod[$.method??"filter"](T,this,$)}transform($,T){return this._transform($,this._createTransformContext(T))}_createTransformContext($){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:$?.prereduced??!1},undeclaredKeyHandling:void 0,...$}}_transform($,T){let W=T.bindScope??this.$;if(T.seen[this.id])return this.$.lazilyResolve(T.seen[this.id]);if(T.shouldTransform?.(this,T)===!1)return this;let U;if(T.seen[this.id]=()=>U,this.hasKind("structure")&&this.undeclared!==T.undeclaredKeyHandling)T={...T,undeclaredKeyHandling:this.undeclared};let X=E$(this.inner,(z,F)=>{if(!this.impl.keys[z].child)return[z,F];let O=F;if(!o$(O)){let Z=O._transform($,T);return Z?[z,Z]:[]}if(O.length===0)return[z,F];let Q=O.flatMap((Z)=>{return Z._transform($,T)??[]});return Q.length?[z,Q]:[]});delete T.seen[this.id];let w=Object.assign(X,{meta:this.meta}),Y=T.selected&&!T.selected.includes(this)?w:$(this.kind,w,T);if(Y===null)return null;if(a$(Y))return U=Y;let G=Object.keys(Y);if((G.length===0||G.length===1&&G[0]==="meta")&&!H0(this.inner))return null;if((this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in Y))return T.undeclaredKeyHandling?{...Y,value:y.intrinsic.unknown}:null;if(this.kind==="morph")Y.in??=y.intrinsic.unknown;return U=W.node(this.kind,Y,T.parseOptions)}configureReferences($,T="references"){let W=Iw.normalize(T),U=typeof $==="string"?(G,H)=>({...H,meta:{...H.meta,description:$}}):typeof $==="function"?(G,H)=>({...H,meta:$(H.meta)}):(G,H)=>({...H,meta:{...H.meta,...$}});if(W.boundary==="self")return this.$.node(this.kind,U(this.kind,{...this.inner,meta:this.meta}));let X=this._select(W),w=X&&ST(X),Y=W.boundary==="child"?(G,H)=>H.root.children.includes(G):W.boundary==="shallow"?(G)=>G.kind!=="structure":()=>!0;return this.$.finalize(this.transform(U,{shouldTransform:Y,selected:w}))}}var Iw={applyBoundary:{self:($)=>[$],child:($)=>[...$.children],shallow:($)=>[...$.shallowReferences],references:($)=>[...$.references]},applyMethod:{filter:($)=>$,assertFilter:($,T,W)=>{if($.length===0)jW(mR(T,W));return $},find:($)=>$[0],assertFind:($,T,W)=>{if($.length===0)jW(mR(T,W));return $[0]}},normalize:($)=>typeof $==="function"?{boundary:"references",method:"filter",where:$}:typeof $==="string"?b4($,Iw.applyBoundary)?{method:"filter",boundary:$}:{boundary:"references",method:"filter",kind:$}:{boundary:"references",method:"filter",...$}},mR=($,T)=>`${$} had no references matching ${M$(T)}.`,Dx=($)=>d0($,{stringifyNonKey:(T)=>T.expression}),Nx=/"(\$ark\.[^"]+)"/g,Jx=($)=>JSON.stringify($).replaceAll(Nx,"$1"),c1=($,T)=>({path:$,node:T,propString:Dx($)}),cR=($,T)=>$.propString===T.propString&&$.node.equals(T.node),WZ=($,T)=>z0($,T,{isEqual:cR}),Lx=($,T)=>z0($,T,{isEqual:(W,U)=>W.equals(U)});class r extends Array{static init($,T,W,U){return new r({kind:$,l:T,r:W,path:U?.path??[],optional:U?.optional??!1})}add($,T,W,U){return this.push({kind:$,l:T,r:W,path:U?.path??[],optional:U?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){let{path:$,l:T,r:W}=this[0],U=d0($);return UZ(`Intersection${U&&` at ${U}`} of ${uR(T,W)}`)}return`The following intersections result in unsatisfiable types:
|
|
154
|
+
\u2022 ${this.map(({path:$,l:T,r:W})=>`${$}: ${uR(T,W)}`).join(`
|
|
155
|
+
\u2022 `)}`}throw(){return I(this.describeReasons())}invert(){let $=this.map((T)=>({...T,l:T.r,r:T.l}));if(!($ instanceof r))return new r(...$);return $}withPrefixKey($,T){return this.map((W)=>({...W,path:[$,...W.path],optional:W.optional||T==="optional"}))}toNeverIfDisjoint(){return y.intrinsic.never}}var uR=($,T)=>`${XZ($)} and ${XZ(T)}`,XZ=($)=>a$($)?$.expression:o$($)?$.map(XZ).join(" | ")||"never":String($),UZ=($)=>`${$} results in an unsatisfiable type`;var wX={},n6=($,T,W)=>s$($,T,{$:W,invert:!1,pipe:!1}),fw=($,T,W)=>s$($,T,{$:W,invert:!1,pipe:!0}),s$=($,T,W)=>{let U=W.pipe?"|>":"&",X=`${$.hash}${U}${T.hash}`;if(wX[X]!==void 0)return wX[X];if(!W.pipe){let G=`${T.hash}${U}${$.hash}`;if(wX[G]!==void 0){let H=wX[G],z=H instanceof r?H.invert():H;return wX[X]=z,z}}let w=!W.pipe||!$.includesTransform&&!T.includesTransform;if(w&&$.equals(T))return $;let Y=w?wZ($,T,W):$.hasKindIn(...WX)?Rx($,T,W):wZ($,T,W);if(a$(Y)){if($.equals(Y))Y=$;else if(T.equals(Y))Y=T}return wX[X]=Y,Y},wZ=($,T,W)=>{let U=$.precedence<T.precedence?$.kind:T.kind,X=$.impl.intersections[T.kind]??T.impl.intersections[$.kind];if(X===void 0)return null;else if(U===$.kind)return X($,T,W);else{let w=X(T,$,{...W,invert:!W.invert});if(w instanceof r)w=w.invert();return w}},Rx=($,T,W)=>$.includesTransform||T.includesTransform?W.invert?pR(T,$,W):pR($,T,W):wZ($,T,W),pR=($,T,W)=>$.distribute((U)=>_x(U,T,W),(U)=>{let X=U.filter(a$);if(X.length===0)return r.init("union",$.branches,T.branches);if(X.length<$.branches.length||!$.branches.every((G,H)=>G.in.equals(X[H].in)))return W.$.parseSchema(X);let w;if(X.length===1){let G=X[0];if(!w)return G;return W.$.node("morph",{...G.inner,in:G.in.configure(w,"self")})}let Y={branches:X};if(w)Y.meta=w;return W.$.parseSchema(Y)}),_x=($,T,W)=>{if($.hasKind("morph")){let X=[...$.morphs];if($.lastMorphIfNode){let w=s$($.lastMorphIfNode,T,W);if(w instanceof r)return w;X[X.length-1]=w}else X.push(T);return W.$.node("morph",{morphs:X,in:$.inner.in})}if(T.hasKind("morph")){let X=s$($,T.in,W);if(X instanceof r)return X;return W.$.node("morph",{morphs:[T],in:X})}return W.$.node("morph",{morphs:[T],in:$})};class k1 extends xw{constructor($,T){super($,T);Object.defineProperty(this,S6,{value:"constraint",enumerable:!1})}impliedSiblings;intersect($){return n6(this,$,this.$)}}class l0 extends k1{traverseApply=($,T)=>{if(!this.traverseAllows($,T))T.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 xT(this.errorContext)}}var Y6=($)=>(T,W)=>{if(o$(T)){if(T.length===0)return;let X=T.map((w)=>W.$.node($,w));if($==="predicate")return X;return X.sort((w,Y)=>w.hash<Y.hash?-1:1)}let U=W.$.node($,T);return U.hasOpenIntersection()?[U]:U},YX=($)=>{let T=$.r.shift();if(!T){let U=$.l.length===0&&$.kind==="structure"?y.intrinsic.unknown.internal:$.ctx.$.node($.kind,Object.assign($.baseInner,kx($.l)),{prereduced:!0});for(let X of $.roots){if(U instanceof r)return U;U=s$(X,U,$.ctx)}return U}let W=!1;for(let U=0;U<$.l.length;U++){let X=s$($.l[U],T,$.ctx);if(X===null)continue;if(X instanceof r)return X;if(!W){if(X.isRoot())return $.roots.push(X),$.l.splice(U),YX($);$.l[U]=X,W=!0}else if(!$.l.includes(X))return B$(`Unexpectedly encountered multiple distinct intersection results for refinement ${X}`)}if(!W)$.l.push(T);if($.kind==="intersection"){if(T.impliedSiblings)for(let U of T.impliedSiblings)z0($.r,U)}return YX($)},GX=($)=>{return Object.entries($).flatMap(([W,U])=>(W in U9)?U:[]).sort((W,U)=>W.precedence<U.precedence?-1:W.precedence>U.precedence?1:W.kind==="predicate"&&U.kind==="predicate"?0:W.hash<U.hash?-1:1)},kx=($)=>{let T={};for(let W of $)if(W.hasOpenIntersection())T[W.kind]=C$(T[W.kind],W);else{if(T[W.kind])return B$(`Unexpected intersection of closed refinements of kind ${W.kind}`);T[W.kind]=W}return T},dR=(...$)=>I(oR(...$)),oR=($,T,W)=>{let U=W.hasKind("morph")?"a morph":W.isUnknown()?"unknown":W.exclude(T).defaultShortDescription;return`${NR($)} operand must be ${T.description} (was ${U})`};var lR=($,T,W)=>new bT($,T,W,W,null);class Y9 extends g1{}class bT extends g1{[S6]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor($,T,W,U,X){super((...w)=>{let Y=E$(this.names,(G,H)=>{let z=this.arg$.parse(w[G]);if(!z.extends(this.constraints[G]))I(vx(H,this.constraints[G].expression,z.expression));return[H,z]});if(this.defIsLazy()){let G=this.bodyDef(Y);return this.$.parse(G)}return this.$.parse(T,{args:Y})});this.paramDefs=$,this.bodyDef=T,this.$=W,this.arg$=U,this.hkt=X,this.description=X?new X().description??`a generic type for ${X.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof Y9}cacheGetter($,T){return Object.defineProperty(this,$,{value:T}),T}get json(){return this.cacheGetter("json",{params:this.params.map(($)=>$[1].isUnknown()?$[0]:[$[0],$[1].json]),body:jR(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(($)=>typeof $==="string"?[$,y.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 vx=($,T,W)=>`${$} must be assignable to ${T} (was ${W})`;var Px=D$({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 rR extends k1{serializedPredicate=Z4(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=xT(this.errorContext);traverseApply=($,T)=>{if(!this.predicate($,T.external)&&!T.hasError())T.errorFromNodeContext(this.errorContext)};compile($){if($.traversalKind==="Allows"){$.return(this.compiledCondition);return}$.if(`${this.compiledNegation} && !ctx.hasError()`,()=>$.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema($,T){return T.fallback.predicate({code:"predicate",base:$,predicate:this.predicate})}}var YZ={implementation:Px,Node:rR};var qx=D$({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:($)=>Number.isInteger($)?$:I(Cx($))}},normalize:($)=>typeof $==="number"?{rule:$}:$,hasAssociatedError:!0,defaults:{description:($)=>$.rule===1?"an integer":$.rule===2?"even":`a multiple of ${$.rule}`},intersections:{divisor:($,T,W)=>W.$.node("divisor",{rule:Math.abs($.rule*T.rule/Sx($.rule,T.rule))})},obviatesBasisDescription:!0});class nR extends l0{traverseAllows=($)=>$%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=y.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema($){if($.type="integer",this.rule===1)return $;return $.multipleOf=this.rule,$}}var GZ={implementation:qx,Node:nR};var Cx=($)=>`divisor must be an integer (was ${$})`,Sx=($,T)=>{let W,U=$,X=T;while(X!==0)W=X,X=U%X,U=W;return U};class V1 extends l0{boundOperandKind=xx[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=fx(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${jx[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?bx(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 jx={"<":">=","<=":">",">":"<=",">=":"<"},Bx={min:"max",minLength:"maxLength",after:"before"},G9={parse:($)=>$||void 0},z9=($)=>(T)=>{if(typeof T==="number")return{rule:T};let{exclusive:W,...U}=T;return W?{...U,rule:$==="minLength"?U.rule+1:U.rule-1}:U},H9=($)=>(T)=>{if(typeof T==="number"||typeof T==="string"||T instanceof Date)return{rule:T};let{exclusive:W,...U}=T;if(!W)return U;let X=typeof U.rule==="number"?U.rule:typeof U.rule==="string"?new Date(U.rule).valueOf():U.rule.valueOf();return W?{...U,rule:$==="after"?X+1:X-1}:U},F9=($)=>typeof $==="string"||typeof $==="number"?new Date($):$,Ix=($,T)=>`${$} bound must be a positive integer (was ${T})`,zX=($)=>(T)=>{if(!Number.isInteger(T)||T<0)I(Ix($,T));return T},xx={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},fx=($,T)=>`${b4($,Bx)?">":"<"}${T?"":"="}`,bx=($)=>typeof $==="string"?$:new Date($).toLocaleString(),iR=($)=>`Bounded expression ${$} must be exactly one of number, string, Array, or Date`;var yx=D$({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:F9,serialize:($)=>$.toISOString()}},normalize:H9("after"),defaults:{description:($)=>`${$.collapsibleLimitString} or later`,actual:fW},intersections:{after:($,T)=>$.isStricterThan(T)?$:T}});class tR extends V1{impliedBasis=y.intrinsic.Date.internal;collapsibleLimitString=fW(this.rule);traverseAllows=($)=>$>=this.rule;reduceJsonSchema($,T){return T.fallback.date({code:"date",base:$,after:this.rule})}}var zZ={implementation:yx,Node:tR};var hx=D$({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:F9,serialize:($)=>$.toISOString()}},normalize:H9("before"),defaults:{description:($)=>`${$.collapsibleLimitString} or earlier`,actual:fW},intersections:{before:($,T)=>$.isStricterThan(T)?$:T,after:($,T,W)=>$.overlapsRange(T)?$.overlapIsUnit(T)?W.$.node("unit",{unit:$.rule}):null:r.init("range",$,T)}});class aR extends V1{collapsibleLimitString=fW(this.rule);traverseAllows=($)=>$<=this.rule;impliedBasis=y.intrinsic.Date.internal;reduceJsonSchema($,T){return T.fallback.date({code:"date",base:$,before:this.rule})}}var HZ={implementation:hx,Node:aR};var gx=D$({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:zX("exactLength")}},normalize:($)=>typeof $==="number"?{rule:$}:$,hasAssociatedError:!0,defaults:{description:($)=>`exactly length ${$.rule}`,actual:($)=>`${$.length}`},intersections:{exactLength:($,T,W)=>r.init("unit",W.$.node("unit",{unit:$.rule}),W.$.node("unit",{unit:T.rule}),{path:["length"]}),minLength:($,T)=>$.rule>=T.rule?$:r.init("range",$,T),maxLength:($,T)=>$.rule<=T.rule?$:r.init("range",$,T)}});class sR extends l0{traverseAllows=($)=>$.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=y.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 U4.throwInternalOperandError("exactLength",$)}}}var FZ={implementation:gx,Node:sR};var mx=D$({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:G9},normalize:($)=>typeof $==="number"?{rule:$}:$,defaults:{description:($)=>{if($.rule===0)return $.exclusive?"negative":"non-positive";return`${$.exclusive?"less than":"at most"} ${$.rule}`}},intersections:{max:($,T)=>$.isStricterThan(T)?$:T,min:($,T,W)=>$.overlapsRange(T)?$.overlapIsUnit(T)?W.$.node("unit",{unit:$.rule}):null:r.init("range",$,T)},obviatesBasisDescription:!0});class eR extends V1{impliedBasis=y.intrinsic.number.internal;traverseAllows=this.exclusive?($)=>$<this.rule:($)=>$<=this.rule;reduceJsonSchema($){if(this.exclusive)$.exclusiveMaximum=this.rule;else $.maximum=this.rule;return $}}var OZ={implementation:mx,Node:eR};var cx=D$({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:zX("maxLength")}},reduce:($,T)=>$.rule===0?T.node("exactLength",$):void 0,normalize:z9("maxLength"),defaults:{description:($)=>`at most length ${$.rule}`,actual:($)=>`${$.length}`},intersections:{maxLength:($,T)=>$.isStricterThan(T)?$:T,minLength:($,T,W)=>$.overlapsRange(T)?$.overlapIsUnit(T)?W.$.node("exactLength",{rule:$.rule}):null:r.init("range",$,T)}});class $_ extends V1{impliedBasis=y.intrinsic.lengthBoundable.internal;traverseAllows=($)=>$.length<=this.rule;reduceJsonSchema($){switch($.type){case"string":return $.maxLength=this.rule,$;case"array":return $.maxItems=this.rule,$;default:return U4.throwInternalOperandError("maxLength",$)}}}var QZ={implementation:cx,Node:$_};var ux=D$({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:G9},normalize:($)=>typeof $==="number"?{rule:$}:$,defaults:{description:($)=>{if($.rule===0)return $.exclusive?"positive":"non-negative";return`${$.exclusive?"more than":"at least"} ${$.rule}`}},intersections:{min:($,T)=>$.isStricterThan(T)?$:T},obviatesBasisDescription:!0});class T_ extends V1{impliedBasis=y.intrinsic.number.internal;traverseAllows=this.exclusive?($)=>$>this.rule:($)=>$>=this.rule;reduceJsonSchema($){if(this.exclusive)$.exclusiveMinimum=this.rule;else $.minimum=this.rule;return $}}var ZZ={implementation:ux,Node:T_};var px=D$({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:zX("minLength")}},reduce:($)=>$.rule===0?y.intrinsic.unknown:void 0,normalize:z9("minLength"),defaults:{description:($)=>$.rule===1?"non-empty":`at least length ${$.rule}`,actual:($)=>$.length===0?"":`${$.length}`},intersections:{minLength:($,T)=>$.isStricterThan(T)?$:T}});class W_ extends V1{impliedBasis=y.intrinsic.lengthBoundable.internal;traverseAllows=($)=>$.length>=this.rule;reduceJsonSchema($){switch($.type){case"string":return $.minLength=this.rule,$;case"array":return $.minItems=this.rule,$;default:return U4.throwInternalOperandError("minLength",$)}}}var VZ={implementation:px,Node:W_};var X_={min:ZZ.implementation,max:OZ.implementation,minLength:VZ.implementation,maxLength:QZ.implementation,exactLength:FZ.implementation,after:zZ.implementation,before:HZ.implementation},U_={min:ZZ.Node,max:OZ.Node,minLength:VZ.Node,maxLength:QZ.Node,exactLength:FZ.Node,after:zZ.Node,before:HZ.Node};var dx=D$({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 w_ extends l0{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=y.intrinsic.string.internal;reduceJsonSchema($,T){if($.pattern)return T.fallback.patternIntersection({code:"patternIntersection",base:$,pattern:this.rule});return $.pattern=this.rule,$}}var KZ={implementation:dx,Node:w_};var bw=($,T)=>{let W=ox($);if(T&&!T.includes(W))return I(`Root of kind ${W} should be one of ${T}`);return W},ox=($)=>{if(W$($,"root"))return $.kind;if(typeof $==="string")return $[0]==="$"?"alias":($ in o6)?"domain":"proto";if(typeof $==="function")return"proto";if(typeof $!=="object"||$===null)return I(Y_($));if("morphs"in $)return"morph";if("branches"in $||o$($))return"union";if("unit"in $)return"unit";if("reference"in $)return"alias";let T=Object.keys($);if(T.length===0||T.some((W)=>(W in U9)))return"intersection";if("proto"in $)return"proto";if("domain"in $)return"domain";return I(Y_($))},Y_=($)=>`${M$($)} is not a valid type schema`,G_={},lx=($)=>o$($)?$.map((T)=>T.collapsibleJson):$.collapsibleJson,j6={};y.nodesByRegisteredId=j6;var AZ=($)=>{return G_[$]??=0,`${$}${++G_[$]}`},EZ=($)=>{let T=HX[$.kind],W=T.applyConfig?.($.def,$.$.resolvedConfig)??$.def,U={},{meta:X,...w}=W,Y=X===void 0?{}:typeof X==="string"?{description:X}:X,G=mQ(w).sort(([z],[F])=>XX(z)?XX(F)?UX(z)-UX(F):1:XX(F)?-1:z<F?-1:1).filter(([z,F])=>{if(z.startsWith("meta.")){let O=z.slice(5);return Y[O]=F,!1}return!0});for(let z of G){let F=z[0],O=T.keys[F];if(!O)return I(`Key ${F} is not valid on ${$.kind} schema`);let Q=O.parse?O.parse(z[1],$):z[1];if(Q!==Z1&&(Q!==void 0||O.preserveUndefined))U[F]=Q}if(T.reduce&&!$.prereduced){let z=T.reduce(U,$.$);if(z){if(z instanceof r)return z.throw();return rx(z,Y)}}return MZ({id:$.id,kind:$.kind,inner:U,meta:Y,$:$.$})},MZ=({id:$,kind:T,inner:W,meta:U,$:X,ignoreCache:w})=>{let Y=HX[T],G=mQ(W),H=[],z={};for(let[J,L]of G){let _=Y.keys[J],C=_.serialize??(_.child?lx:_1);if(z[J]=C(L),_.child===!0){let f=L;if(o$(f))H.push(...f);else H.push(f)}else if(typeof _.child==="function")H.push(..._.child(L))}if(Y.finalizeInnerJson)z=Y.finalizeInnerJson(z);let F={...z},O={};if(!H0(U))O=E$(U,(J,L)=>[J,J==="examples"?L:_1(L)]),F.meta=O9(O,"description",!0);z=O9(z,Y.collapsibleKey,!1);let Q=JSON.stringify({kind:T,...z});F=O9(F,Y.collapsibleKey,!1);let Z=O9(F,Y.collapsibleKey,!0),V=JSON.stringify({kind:T,...F});if(X.nodesByHash[V]&&!w)return X.nodesByHash[V];let A={id:$,kind:T,impl:Y,inner:W,innerEntries:G,innerJson:z,innerHash:Q,meta:U,metaJson:O,json:F,hash:V,collapsibleJson:Z,children:H};if(T!=="intersection"){for(let J in W)if(J!=="in"&&J!=="out")A[J]=W[J]}let D=new H_[T](A,X);return X.nodesByHash[V]=D},z_=($,T)=>{if($.id===T)return $;if(a$(j6[T]))B$(`Unexpected attempt to overwrite node id ${T}`);return MZ({id:T,kind:$.kind,inner:$.inner,meta:$.meta,$:$.$,ignoreCache:!0})},rx=($,T,W)=>{if(W&&a$(j6[W]))B$(`Unexpected attempt to overwrite node id ${W}`);return MZ({id:W??AZ(T.alias??$.kind),kind:$.kind,inner:$.inner,meta:T,$:$.$})},O9=($,T,W)=>{let U=Object.keys($);if(U.length===1&&U[0]===T){let X=$[T];if(W)return X;if(d6(X,"object")&&(Object.keys(X).length===1||Array.isArray(X)))return X}return $};var yw=($,T,W)=>{if($.key!==T.key)return null;let U=$.key,X=s$($.value,T.value,W),w=$.required||T.required?"required":"optional";if(X instanceof r)if(w==="optional")X=y.intrinsic.never.internal;else return X.withPrefixKey($.key,$.required&&T.required?"required":"optional");if(w==="required")return W.$.node("required",{key:U,value:X});let Y=$.hasDefault()?T.hasDefault()?$.default===T.default?$.default:I(DZ($.default,T.default)):$.default:T.hasDefault()?T.default:Z1;return W.$.node("optional",{key:U,value:X,default:Y})};class hw extends k1{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=y.intrinsic.object.internal;serializedKey=o0(this.key);compiledKey=typeof this.key==="string"?this.key:this.serializedKey;flatRefs=C$(this.value.flatRefs.map(($)=>c1([this.key,...$.path],$.node)),c1([this.key],this.value));_transform($,T){T.path.push(this.key);let W=super._transform($,T);return T.path.pop(),W}hasDefault(){return"default"in this.inner}traverseAllows=($,T)=>{if(this.key in $)return r6(this.key,()=>this.value.traverseAllows($[this.key],T),T);return this.optional};traverseApply=($,T)=>{if(this.key in $)r6(this.key,()=>this.value.traverseApply($[this.key],T),T);else if(this.hasKind("required"))T.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 DZ=($,T)=>`Invalid intersection of default values ${M$($)} & ${M$(T)}`;var nx=D$({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:($,T)=>T.$.parseSchema($)},default:{preserveUndefined:!0}},normalize:($)=>$,reduce:($,T)=>{if(T.resolvedConfig.exactOptionalPropertyTypes===!1){if(!$.value.allows(void 0))return T.node("optional",{...$,value:$.value.or(G$.undefined)},{prereduced:!0})}},defaults:{description:($)=>`${$.compiledKey}?: ${$.value.description}`},intersections:{optional:yw}});class F_ extends hw{constructor(...$){super(...$);if("default"in this.inner)mw(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;let{default:$,...T}=this.inner;return this.cacheGetter("outProp",this.$.node("required",T,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${M$(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=tx(this);defaultValueMorphRef=this.defaultValueMorph&&Z4(this.defaultValueMorph)}var gw={implementation:nx,Node:F_},ix={},tx=($)=>{if(!$.hasDefault())return;let T=`{${$.compiledKey}: ${$.value.id} = ${_1($.default)}}`;return ix[T]??=NZ($.key,$.value,$.default)},NZ=($,T,W)=>{if(typeof W==="function")return T.includesTransform?(X,w)=>{return r6($,()=>T(X[$]=W(),w),w),X}:(X)=>{return X[$]=W(),X};let U=T.includesTransform?T.assert(W):W;return d6(U,"object")?(X,w)=>{return r6($,()=>T(X[$]=W,w),w),X}:(X)=>{return X[$]=U,X}},mw=($,T,W)=>{let U=jT(T);if(d6(T,"object")&&!U)I(ax(W));let X=$.in(U?T():T);if(X instanceof l6){if(W===null)I(`Default ${X.summary}`);let w=X.transform((Y)=>Y.transform((G)=>({...G,prefixPath:[W]})));I(`Default for ${w.summary}`)}return T},ax=($)=>{return`Non-primitive default ${$===null?"":typeof $==="number"?`for value at [${$}] `:`for ${o0($)} `}must be specified as a function like () => ({my: 'object'})`};class v1 extends xw{constructor($,T){super($,T);Object.defineProperty(this,S6,{value:"root",enumerable:!1})}get internal(){return this}get "~standard"(){return{vendor:"arktype",version:1,validate:($)=>{let T=this($);if(T instanceof l6)return T;return{value:T}}}}as(){return this}brand($){if($==="")return I(sx);return this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute($,T){let W=this.branches.map($);return T?.(W)??W}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema($={}){let T=$Z(this.$.resolvedConfig.toJsonSchema,$);T.useRefs||=this.isCyclic;let W=typeof T.dialect==="string"?{$schema:T.dialect}:{};if(Object.assign(W,this.toJsonSchemaRecurse(T)),T.useRefs)W.$defs=E$(this.references,(U,X)=>X.isRoot()&&!X.alwaysExpandJsonSchema?[X.id,X.toResolvedJsonSchema(T)]:[]);return W}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 T=this.innerToJsonSchema($);return Object.assign(T,this.metaJson)}intersect($){let T=this.$.parseDefinition($),W=this.rawIntersect(T);if(W instanceof r)return W;return this.$.finalize(W)}rawIntersect($){return n6(this,$,this.$)}toNeverIfDisjoint(){return this}and($){let T=this.intersect($);return T instanceof r?T.throw():T}rawAnd($){let T=this.rawIntersect($);return T instanceof r?T.throw():T}or($){let T=this.$.parseDefinition($);return this.$.finalize(this.rawOr(T))}rawOr($){let T=[...this.branches,...$.branches];return this.$.node("union",T)}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((T,W)=>T.intersect(W).toNeverIfDisjoint(),y.intrinsic.unknown.internal);if($.branches.length===0)I(UZ(`keyof ${this.expression}`));return this._keyof=this.$.finalize($)}get props(){if(this.branches.length!==1)return I(ex(this.expression));return[...this.applyStructuralOperation("props",[])[0]]}merge($){let T=this.$.parseDefinition($);return this.$.schema(T.distribute((W)=>this.applyStructuralOperation("merge",[O_(W)??I(Q_("merge",W.expression))])))}applyStructuralOperation($,T){return this.distribute((W)=>{if(W.equals(y.intrinsic.object)&&$!=="merge")return W;let U=O_(W);if(!U)I(Q_($,W.expression));if($==="keyof")return U.keyof();if($==="get")return U.get(...T);if($==="props")return U.props;let X=$==="required"?"require":$==="partial"?"optionalize":$;return this.$.node("intersection",{...W.inner,structure:U[X](...T)})})}get(...$){if($[0]===void 0)return this;return this.$.schema(this.applyStructuralOperation("get",$))}extract($){let T=this.$.parseDefinition($);return this.$.schema(this.branches.filter((W)=>W.extends(T)))}exclude($){let T=this.$.parseDefinition($);return this.$.schema(this.branches.filter((W)=>!W.extends(T)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps($){return!(this.intersect($)instanceof r)}extends($){let T=this.intersect($);return!(T instanceof r)&&this.equals(T)}ifExtends($){return this.extends($)?this:void 0}subsumes($){return this.$.parseDefinition($).extends(this)}configure($,T="shallow"){return this.configureReferences($,T)}describe($,T="shallow"){return this.configure({description:$},T)}optional(){return[this,"?"]}default($){return mw(this,$,null),[this,"=",$]}from($){return this.assert($)}_pipe(...$){let T=$.reduce((W,U)=>W.rawPipeOnce(U),this);return this.$.finalize(T)}tryPipe(...$){let T=$.reduce((W,U)=>W.rawPipeOnce(W$(U,"root")?U:(X,w)=>{try{return U(X,w)}catch(Y){return w.error({code:"predicate",predicate:U,actual:`aborted due to error:
|
|
132
156
|
${Y}
|
|
133
|
-
`})}}),this);return this.$.finalize(T)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to($){return this.$.finalize(this.toNode(this.$.parseDefinition($)))}toNode($){let T=
|
|
134
|
-
${$}`,
|
|
157
|
+
`})}}),this);return this.$.finalize(T)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to($){return this.$.finalize(this.toNode(this.$.parseDefinition($)))}toNode($){let T=fw(this,$,this.$);if(T instanceof r)return T.throw();return T}rawPipeOnce($){if(W$($,"root"))return this.toNode($);return this.distribute((T)=>T.hasKind("morph")?this.$.node("morph",{in:T.inner.in,morphs:[...T.morphs,$]}):this.$.node("morph",{in:T,morphs:[$]}),this.$.parseSchema)}narrow($){return this.constrainOut("predicate",$)}constrain($,T){return this._constrain("root",$,T)}constrainIn($,T){return this._constrain("in",$,T)}constrainOut($,T){return this._constrain("out",$,T)}_constrain($,T,W){let U=this.$.node(T,W);if(U.isRoot())return U.isUnknown()?this:B$(`Unexpected constraint node ${U}`);let X=$==="root"?this:this[$];if(X.hasKind("morph")||U.impliedBasis&&!X.extends(U.impliedBasis))return dR(T,U.impliedBasis,this);let w=this.$.node("intersection",{[U.kind]:U}),Y=$==="out"?fw(this,w,this.$):n6(this,w,this.$);if(Y instanceof r)Y.throw();return this.$.finalize(Y)}onUndeclaredKey($){let T=typeof $==="string"?$:$.rule,W=typeof $==="string"?!1:$.deep;return this.$.finalize(this.transform((U,X)=>U==="structure"?T==="ignore"?HR(X,{undeclared:1}):{...X,undeclared:T}:X,W?void 0:{shouldTransform:(U)=>!m0(TX,U.kind)}))}hasEqualMorphs($){if(!this.includesTransform&&!$.includesTransform)return!0;if(!u0(this.shallowMorphs,$.shallowMorphs))return!1;if(!u0(this.flatMorphs,$.flatMorphs,{isEqual:(T,W)=>T.propString===W.propString&&(T.node.hasKind("morph")&&W.node.hasKind("morph")?T.node.hasEqualMorphs(W.node):T.node.hasKind("intersection")&&W.node.hasKind("intersection")?T.node.structure?.structuralMorphRef===W.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",FX($))}lessThan($){return this.constrain("max",FX($))}atLeastLength($){return this.constrain("minLength",$)}atMostLength($){return this.constrain("maxLength",$)}moreThanLength($){return this.constrain("minLength",FX($))}lessThanLength($){return this.constrain("maxLength",FX($))}exactlyLength($){return this.constrain("exactLength",$)}atOrAfter($){return this.constrain("after",$)}atOrBefore($){return this.constrain("before",$)}laterThan($){return this.constrain("after",FX($))}earlierThan($){return this.constrain("before",FX($))}}var sx="Expected a non-empty brand name after #",FX=($)=>typeof $==="object"&&!($ instanceof Date)?{...$,exclusive:!0}:{rule:$,exclusive:!0},cw=($,T)=>W$(T,"root")?W$($,"root")?$.extends(T):T.allows($):W$($,"root")?$.hasUnit(T):T===$,O_=($)=>{if($.hasKind("morph"))return null;if($.hasKind("intersection"))return $.inner.structure??($.basis?.domain==="object"?$.$.bindReference(y.intrinsic.emptyStructure):null);if($.isBasis()&&$.domain==="object")return $.$.bindReference(y.intrinsic.emptyStructure);return null},ex=($)=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
|
|
158
|
+
${$}`,Q_=($,T)=>`${$} operand must be an object (was ${T})`;var F0=($,T)=>E$(w9($),(W,U)=>[U,T]);var $f=($)=>typeof $==="string"?{reference:$}:$,Z_=($)=>$ instanceof r?y.intrinsic.never.internal:$,Tf=D$({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:($)=>$.startsWith("$")?$:`$ark.${$}`},resolve:{}},normalize:$f,defaults:{description:($)=>$.reference},intersections:{alias:($,T,W)=>W.$.lazilyResolve(()=>Z_(s$($.resolution,T.resolution,W)),`${$.reference}${W.pipe?"=>":"&"}${T.reference}`),...F0("alias",($,T,W)=>{if(T.isUnknown())return $;if(T.isNever())return T;if(T.isBasis()&&!T.overlaps(y.intrinsic.object))return r.init("assignability",y.intrinsic.object,T);return W.$.lazilyResolve(()=>Z_(s$($.resolution,T,W)),`${$.reference}${W.pipe?"=>":"&"}${T.id}`)})}});class V_ extends v1{expression=this.reference;structure=void 0;get resolution(){let $=this._resolve();return j6[this.id]=$}_resolve(){if(this.resolve)return this.resolve();if(this.reference[0]==="$")return this.$.resolveRoot(this.reference.slice(1));let $=this.reference,T=j6[$],W=[];while(W$(T,"context")){if(W.includes(T.id))return I(Wf(T.id,W));W.push(T.id),T=j6[T.id]}if(!W$(T,"root"))return B$(`Unexpected resolution for reference ${this.reference}
|
|
135
159
|
Seen: [${W.join("->")}]
|
|
136
|
-
Resolution: ${M$(T)}`);return T}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),T=this.$.resolutions[$];if(typeof T==="string")return T;if(W$(T,"root"))return T.id;return
|
|
160
|
+
Resolution: ${M$(T)}`);return T}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),T=this.$.resolutions[$];if(typeof T==="string")return T;if(W$(T,"root"))return T.id;return B$(`Unexpected resolution for reference ${this.reference}: ${M$(T)}`)}get defaultShortDescription(){return o6.object}innerToJsonSchema($){return this.resolution.toJsonSchemaRecurse($)}traverseAllows=($,T)=>{let W=T.seen[this.reference];if(W?.includes($))return!0;return T.seen[this.reference]=C$(W,$),this.resolution.traverseAllows($,T)};traverseApply=($,T)=>{let W=T.seen[this.reference];if(W?.includes($))return;T.seen[this.reference]=C$(W,$),this.resolution.traverseApply($,T)};compile($){let T=this.resolutionId;$.if(`ctx.seen.${T} && ctx.seen.${T}.includes(data)`,()=>$.return(!0)),$.if(`!ctx.seen.${T}`,()=>$.line(`ctx.seen.${T} = []`)),$.line(`ctx.seen.${T}.push(data)`),$.return($.invoke(T))}}var Wf=($,T)=>`Alias '${$}' has a shallow resolution cycle: ${[...T,$].join("->")}`,uw={implementation:Tf,Node:V_};class bW extends v1{traverseApply=($,T)=>{if(!this.traverseAllows($,T))T.errorFromNodeContext(this.errorContext)};get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return xT(this.errorContext)}compile($){if($.traversalKind==="Allows")$.return(this.compiledCondition);else $.if(this.compiledNegation,()=>$.line(`${$.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}}var Xf=D$({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:($)=>typeof $==="string"?{domain:$}:e2($,"numberAllowsNaN")&&$.domain!=="number"?I(Q9.writeBadAllowNanMessage($.domain)):$,applyConfig:($,T)=>$.numberAllowsNaN===void 0&&$.domain==="number"&&T.numberAllowsNaN?{...$,numberAllowsNaN:!0}:$,defaults:{description:($)=>o6[$.domain],actual:($)=>Number.isNaN($)?"NaN":o6[f4($)]},intersections:{domain:($,T)=>$.domain==="number"&&T.domain==="number"?$.numberAllowsNaN?T:$:r.init("domain",$,T)}});class K_ extends bW{requiresNaNCheck=this.domain==="number"&&!this.numberAllowsNaN;traverseAllows=this.requiresNaNCheck?($)=>typeof $==="number"&&!Number.isNaN($):($)=>f4($)===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 o6[this.domain]}innerToJsonSchema($){if(this.domain==="bigint"||this.domain==="symbol")return $.fallback.domain({code:"domain",base:{},domain:this.domain});return{type:this.domain}}}var Q9={implementation:Xf,Node:K_,writeBadAllowNanMessage:($)=>`numberAllowsNaN may only be specified with domain "number" (was ${$})`};var Uf=D$({kind:"intersection",hasAssociatedError:!0,normalize:($)=>{if(a$($))return $;let{structure:T,...W}=$,U=!!T,X=T??{},w=E$(W,(Y,G)=>{if(b4(Y,bR)){if(U)I(`Flattened structure key ${Y} cannot be specified alongside a root 'structure' key.`);return X[Y]=G,[]}return[Y,G]});if(W$(X,"constraint")||!H0(X))w.structure=X;return w},finalizeInnerJson:({structure:$,...T})=>d6($,"object")?{...$,...T}:T,keys:{domain:{child:!0,parse:($,T)=>T.$.node("domain",$)},proto:{child:!0,parse:($,T)=>T.$.node("proto",$)},structure:{child:!0,parse:($,T)=>T.$.node("structure",$),serialize:($)=>{if(!$.sequence?.minLength)return $.collapsibleJson;let{sequence:T,...W}=$.collapsibleJson,{minVariadicLength:U,...X}=T,w=X.variadic&&Object.keys(X).length===1?X.variadic:X;return{...W,sequence:w}}},divisor:{child:!0,parse:Y6("divisor")},max:{child:!0,parse:Y6("max")},min:{child:!0,parse:Y6("min")},maxLength:{child:!0,parse:Y6("maxLength")},minLength:{child:!0,parse:Y6("minLength")},exactLength:{child:!0,parse:Y6("exactLength")},before:{child:!0,parse:Y6("before")},after:{child:!0,parse:Y6("after")},pattern:{child:!0,parse:Y6("pattern")},predicate:{child:!0,parse:Y6("predicate")}},reduce:($,T)=>A_({},$,{$:T,invert:!1,pipe:!1}),defaults:{description:($)=>{if($.children.length===0)return"unknown";if($.structure)return $.structure.description;let T=[];if($.basis&&!$.refinements.some((W)=>W.impl.obviatesBasisDescription))T.push($.basis.description);if($.refinements.length){let W=$.refinements.toSorted((U,X)=>U.kind==="min"&&X.kind==="max"?-1:0).map((U)=>U.description);T.push(...W)}if($.inner.predicate)T.push(...$.inner.predicate.map((W)=>W.description));return T.join(" and ")},expected:($)=>` \u25E6 ${$.errors.map((T)=>T.expected).join(`
|
|
137
161
|
\u25E6 `)}`,problem:($)=>`(${$.actual}) must be...
|
|
138
|
-
${$.expected}`},intersections:{intersection:($,T,W)=>
|
|
162
|
+
${$.expected}`},intersections:{intersection:($,T,W)=>A_($.inner,T.inner,W),...F0("intersection",($,T,W)=>{if($.children.length===0)return T;let{domain:U,proto:X,...w}=$.inner,Y=X??U,G=Y?s$(Y,T,W):T;return G instanceof r?G:$?.basis?.equals(G)?$:$.$.node("intersection",{...w,[G.kind]:G},{prereduced:!0})})}});class E_ extends v1{basis=this.inner.domain??this.inner.proto??null;refinements=this.children.filter(($)=>$.isRefinement());structure=this.inner.structure;expression=wf(this);get shallowMorphs(){return this.inner.structure?.structuralMorph?[this.inner.structure.structuralMorph]:[]}get defaultShortDescription(){return this.basis?.defaultShortDescription??"present"}innerToJsonSchema($){return this.children.reduce((T,W)=>W.isBasis()?W.toJsonSchemaRecurse($):W.reduceJsonSchema(T,$),{})}traverseAllows=($,T)=>this.children.every((W)=>W.traverseAllows($,T));traverseApply=($,T)=>{let W=T.currentErrorCount;if(this.basis){if(this.basis.traverseApply($,T),T.currentErrorCount>W)return}if(this.refinements.length){for(let U=0;U<this.refinements.length-1;U++)if(this.refinements[U].traverseApply($,T),T.failFast&&T.currentErrorCount>W)return;if(this.refinements.at(-1).traverseApply($,T),T.currentErrorCount>W)return}if(this.structure){if(this.structure.traverseApply($,T),T.currentErrorCount>W)return}if(this.inner.predicate){for(let U=0;U<this.inner.predicate.length-1;U++)if(this.inner.predicate[U].traverseApply($,T),T.failFast&&T.currentErrorCount>W)return;this.inner.predicate.at(-1).traverseApply($,T)}};compile($){if($.traversalKind==="Allows"){for(let T of this.children)$.check(T);$.return(!0);return}if($.initializeErrorCount(),this.basis){if($.check(this.basis),this.children.length>1)$.returnIfFail()}if(this.refinements.length){for(let T=0;T<this.refinements.length-1;T++)$.check(this.refinements[T]),$.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 T=0;T<this.inner.predicate.length-1;T++)$.check(this.inner.predicate[T]),$.returnIfFail();$.check(this.inner.predicate.at(-1))}}}var JZ={implementation:Uf,Node:E_},wf=($)=>{let T=$.structure?.expression||`${$.basis&&!$.refinements.some((W)=>W.impl.obviatesBasisExpression)?$.basis.nestableExpression+" ":""}${$.refinements.map((W)=>W.expression).join(" & ")}`||"unknown";if(T==="Array == 0")T="[]";return T},A_=($,T,W)=>{let U={},X=$.proto??$.domain,w=T.proto??T.domain,Y=X?w?s$(X,w,W):X:w;if(Y instanceof r)return Y;if(Y)U[Y.kind]=Y;return YX({kind:"intersection",baseInner:U,l:GX($),r:GX(T),roots:[],ctx:W})};var Yf=D$({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:($,T)=>T.$.parseSchema($)},morphs:{parse:ST,serialize:($)=>$.map((T)=>W$(T,"root")?T.json:Z4(T))},declaredIn:{child:!1,serialize:($)=>$.json},declaredOut:{child:!1,serialize:($)=>$.json}},normalize:($)=>$,defaults:{description:($)=>`a morph from ${$.in.description} to ${$.out?.description??"unknown"}`},intersections:{morph:($,T,W)=>{if(!$.hasEqualMorphs(T))return I(Gf($.expression,T.expression));let U=s$($.in,T.in,W);if(U instanceof r)return U;let X={morphs:$.morphs};if($.declaredIn||T.declaredIn){let w=s$($.in,T.in,W);if(w instanceof r)return w.throw();else X.declaredIn=w}if($.declaredOut||T.declaredOut){let w=s$($.out,T.out,W);if(w instanceof r)return w.throw();else X.declaredOut=w}return U.distribute((w)=>W.$.node("morph",{...X,in:w}),W.$.parseSchema)},...F0("morph",($,T,W)=>{let U=$.inner.in?s$($.inner.in,T,W):T;return U instanceof r?U:U.equals($.inner.in)?$:W.$.node("morph",{...$.inner,in:U})})}});class M_ extends v1{serializedMorphs=this.morphs.map(Z4);compiledMorphs=`[${this.serializedMorphs}]`;lastMorph=this.inner.morphs.at(-1);lastMorphIfNode=W$(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??y.intrinsic.unknown.internal}get out(){return this.declaredOut??this.introspectableOut??y.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=($,T)=>!this.introspectableIn||this.introspectableIn.traverseAllows($,T);traverseApply=($,T)=>{if(this.introspectableIn)this.introspectableIn.traverseApply($,T);T.queueMorphs(this.morphs)};hasEqualMorphs($){return u0(this.morphs,$.morphs,{isEqual:(T,W)=>T===W||W$(T,"root")&&W$(W,"root")&&T.equals(W)})}}var LZ={implementation:Yf,Node:M_},Gf=($,T)=>`The intersection of distinct morphs at a single path is indeterminate:
|
|
139
163
|
Left: ${$}
|
|
140
|
-
Right: ${T}`;var
|
|
164
|
+
Right: ${T}`;var zf=D$({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:($)=>_w($)??_1($)},dateAllowsInvalid:{}},normalize:($)=>{let T=typeof $==="string"?{proto:IW[$]}:typeof $==="function"?a$($)?$:{proto:$}:typeof $.proto==="string"?{...$,proto:IW[$.proto]}:$;if(typeof T.proto!=="function")I(pw.writeInvalidSchemaMessage(T.proto));if(e2(T,"dateAllowsInvalid")&&T.proto!==Date)I(pw.writeBadInvalidDateMessage(T.proto));return T},applyConfig:($,T)=>{if($.dateAllowsInvalid===void 0&&$.proto===Date&&T.dateAllowsInvalid)return{...$,dateAllowsInvalid:!0};return $},defaults:{description:($)=>$.builtinName?ZR[$.builtinName]:`an instance of ${$.proto.name}`,actual:($)=>$ instanceof Date&&$.toString()==="Invalid Date"?"an invalid Date":Rw($)},intersections:{proto:($,T)=>$.proto===Date&&T.proto===Date?$.dateAllowsInvalid?T:$:oQ($.proto,T.proto)?$:oQ(T.proto,$.proto)?T:r.init("proto",$,T),domain:($,T)=>T.domain==="object"?$:r.init("domain",y.intrinsic.object.internal,T)}});class D_ extends bW{builtinName=_w(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 pw={implementation:zf,Node:D_,writeBadInvalidDateMessage:($)=>`dateAllowsInvalid may only be specified with constructor Date (was ${$.name})`,writeInvalidSchemaMessage:($)=>`instanceOf operand must be a function (was ${f4($)})`};var Hf=D$({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:($,T)=>{let W=[];for(let U of $){let X=W$(U,"root")?U.branches:T.$.parseSchema(U).branches;for(let w of X)if(w.hasKind("morph")){let Y=W.findIndex((G)=>G.hasKind("morph")&&G.hasEqualMorphs(w));if(Y===-1)W.push(w);else{let G=W[Y];W[Y]=T.$.node("morph",{...G.inner,in:G.in.rawOr(w.in)})}}else W.push(w)}if(!T.def.ordered)W.sort((U,X)=>U.hash<X.hash?-1:1);return W}}},normalize:($)=>o$($)?{branches:$}:$,reduce:($,T)=>{let W=Df($);if(W.length===1)return W[0];if(W.length===$.branches.length)return;return T.node("union",{...$,branches:W},{prereduced:!0})},defaults:{description:($)=>$.distribute((T)=>T.description,OX),expected:($)=>{let T=wR($.errors,"propString"),W=Object.entries(T).map(([U,X])=>{let w=[];for(let H of X)z0(w,H.expected);let Y=OX(w),G=X.every((H)=>H.actual===X[0].actual)?X[0].actual:M$(X[0].data);return`${U&&`${U} `}must be ${Y}${G&&` (was ${G})`}`});return OX(W)},problem:($)=>$.expected,message:($)=>$.problem},intersections:{union:($,T,W)=>{if($.isNever!==T.isNever)return r.init("presence",$,T);let U;if($.ordered){if(T.ordered)I(Jf($.expression,T.expression));if(U=RZ(T.branches,$.branches,W),U instanceof r)U.invert()}else U=RZ($.branches,T.branches,W);if(U instanceof r)return U;return W.$.parseSchema($.ordered||T.ordered?{branches:U,ordered:!0}:{branches:U})},...F0("union",($,T,W)=>{let U=RZ($.branches,[T],W);if(U instanceof r)return U;if(U.length===1)return U[0];return W.$.parseSchema($.ordered?{branches:U,ordered:!0}:{branches:U})})}});class L_ extends v1{isBoolean=this.branches.length===2&&this.branches[0].hasUnit(!1)&&this.branches[1].hasUnit(!0);get branchGroups(){let $=[],T=-1;for(let W of this.branches){if(W.hasKind("unit")&&W.domain==="boolean"){if(T===-1)T=$.length,$.push(W);else $[T]=y.intrinsic.boolean;continue}$.push(W)}return $}unitBranches=this.branches.filter(($)=>$.in.hasKind("unit"));discriminant=this.discriminate();discriminantJson=this.discriminant?Af(this.discriminant):null;expression=this.distribute(($)=>$.nestableExpression,Mf);createBranchedOptimisticRootApply(){return($,T)=>{let W=this.traverseOptimistic($);if(W!==Z1)return W;let U=new m1($,this.$.resolvedConfig);return this.traverseApply($,U),U.finalize(T)}}get shallowMorphs(){return this.branches.reduce(($,T)=>z0($,T.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(($)=>$.defaultShortDescription,OX)}innerToJsonSchema($){if(this.branchGroups.length===1&&this.branchGroups[0].equals(y.intrinsic.boolean))return{type:"boolean"};let T=this.branchGroups.map((W)=>W.toJsonSchemaRecurse($));if(T.every((W)=>Object.keys(W).length===1&&e2(W,"const")))return{enum:T.map((W)=>W.const)};return{anyOf:T}}traverseAllows=($,T)=>this.branches.some((W)=>W.traverseAllows($,T));traverseApply=($,T)=>{let W=[];for(let U=0;U<this.branches.length;U++){if(T.pushBranch(),this.branches[U].traverseApply($,T),!T.hasError()){if(this.branches[U].includesTransform)return T.queuedMorphs.push(...T.popBranch().queuedMorphs);return T.popBranch()}W.push(T.popBranch().error)}T.errorFromNodeContext({code:"union",errors:W,meta:this.meta})};traverseOptimistic=($)=>{for(let T=0;T<this.branches.length;T++){let W=this.branches[T];if(W.traverseAllows($)){if(W.contextFreeMorph)return W.contextFreeMorph($);return $}}return Z1};compile($){if(!this.discriminant||this.unitBranches.length===this.branches.length&&this.branches.length===2)return this.compileIndiscriminable($);let T=this.discriminant.optionallyChainedPropString;if(this.discriminant.kind==="domain")T=`typeof ${T} === "object" ? ${T} === null ? "null" : "object" : typeof ${T} === "function" ? "object" : typeof ${T}`;let W=this.discriminant.cases,U=Object.keys(W),{optimistic:X}=$;if($.optimistic=!1,$.block(`switch(${T})`,()=>{for(let z in W){let F=W[z],O=z==="default"?z:`case ${z}`;$.line(`${O}: return ${F===!0?X?$.data:F:X?`${$.invoke(F)} ? ${F.contextFreeMorph?`${Z4(F.contextFreeMorph)}(${$.data})`:$.data} : "${Z1}"`:$.invoke(F)}`)}return $}),$.traversalKind==="Allows"){$.return(X?`"${Z1}"`:!1);return}let w=OX(this.discriminant.kind==="domain"?U.map((z)=>{let F=z.slice(1,-1);return F==="function"?o6.object:o6[F]}):U),Y=this.discriminant.path.map((z)=>typeof z==="symbol"?Z4(z):JSON.stringify(z)),G=JSON.stringify(w),H=this.discriminant.kind==="domain"?`${Vf}[${T}]`:`${Kf}(${T})`;$.line(`ctx.errorFromNodeContext({
|
|
141
165
|
code: "predicate",
|
|
142
166
|
expected: ${G},
|
|
143
167
|
actual: ${H},
|
|
144
168
|
relativePath: [${Y}],
|
|
145
169
|
meta: ${this.compiledMeta}
|
|
146
|
-
})`)}compileIndiscriminable($){if($.traversalKind==="Apply"){$.const("errors","[]");for(let T of this.branches)$.line("ctx.pushBranch()").line($.invoke(T)).if("!ctx.hasError()",()=>$.return(T.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:T}=$;$.optimistic=!1;for(let W of this.branches)$.if(`${$.invoke(W)}`,()=>$.return(T?W.contextFreeMorph?`${Z4(W.contextFreeMorph)}(${$.data})`:$.data:!0));$.return(T?`"${
|
|
170
|
+
})`)}compileIndiscriminable($){if($.traversalKind==="Apply"){$.const("errors","[]");for(let T of this.branches)$.line("ctx.pushBranch()").line($.invoke(T)).if("!ctx.hasError()",()=>$.return(T.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:T}=$;$.optimistic=!1;for(let W of this.branches)$.if(`${$.invoke(W)}`,()=>$.return(T?W.contextFreeMorph?`${Z4(W.contextFreeMorph)}(${$.data})`:$.data:!0));$.return(T?`"${Z1}"`:!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 X=E$(this.unitBranches,(w,Y)=>[`${Y.in.serializedValue}`,Y.hasKind("morph")?Y:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:X}}let $=[];for(let X=0;X<this.branches.length-1;X++){let w=this.branches[X];for(let Y=X+1;Y<this.branches.length;Y++){let G=this.branches[Y],H=n6(w.in,G.in,w.$);if(!(H instanceof r))continue;for(let z of H){if(!z.kind||z.optional)continue;let F,O;if(z.kind==="domain"){let{l:Z,r:V}=z;F=`"${typeof Z==="string"?Z:Z.domain}"`,O=`"${typeof V==="string"?V:V.domain}"`}else if(z.kind==="unit")F=z.l.serializedValue,O=z.r.serializedValue;else continue;let Q=$.find((Z)=>u0(Z.path,z.path)&&Z.kind===z.kind);if(!Q)$.push({kind:z.kind,cases:{[F]:{branchIndices:[X],condition:z.l},[O]:{branchIndices:[Y],condition:z.r}},path:z.path});else{if(Q.cases[F])Q.cases[F].branchIndices=z0(Q.cases[F].branchIndices,X);else Q.cases[F]??={branchIndices:[X],condition:z.l};if(Q.cases[O])Q.cases[O].branchIndices=z0(Q.cases[O].branchIndices,Y);else Q.cases[O]??={branchIndices:[Y],condition:z.r}}}}}let T=this.ordered?Qf($,this.branches):$;if(!T.length)return null;let W=Ff(T,this),U={};for(let X in W.best.cases){let w=Of(W,X);if(w===null){U[X]=!0;continue}if(w.length===this.branches.length)return null;if(this.ordered)w.sort((H,z)=>H.originalIndex-z.originalIndex);let Y=w.map((H)=>H.branch),G=Y.length===1?Y[0]:this.$.node("union",this.ordered?{branches:Y,ordered:!0}:Y);Object.assign(this.referencesById,G.referencesById),U[X]=G}if(W.defaultEntries.length){let X=W.defaultEntries.map((w)=>w.branch);U.default=this.$.node("union",this.ordered?{branches:X,ordered:!0}:X,{prereduced:!0}),Object.assign(this.referencesById,U.default.referencesById)}return Object.assign(W.location,{cases:U})}}var Ff=($,T)=>{let W=$.sort((w,Y)=>Object.keys(Y.cases).length-Object.keys(w.cases).length)[0],U={kind:W.kind,path:W.path,optionallyChainedPropString:R_(W.path)},X=T.branches.map((w,Y)=>({originalIndex:Y,branch:w}));return{best:W,location:U,defaultEntries:X,node:T}},Of=($,T)=>{let W=$.best.cases[T],U=Zf(W.condition,$.location.path,$.node.$),X=[],w=[];for(let Y=0;Y<$.defaultEntries.length;Y++){let G=$.defaultEntries[Y];if(W.branchIndices.includes(G.originalIndex)){let H=N_($.node.branches[G.originalIndex],$.location);if(H===null)X=null;else X?.push({originalIndex:G.originalIndex,branch:H})}else if(G.branch.hasKind("alias")&&U.hasKind("domain")&&U.domain==="object")X?.push(G);else{if(G.branch.in.overlaps(U)){let H=N_(G.branch,$.location);X?.push({originalIndex:G.originalIndex,branch:H})}w.push(G)}}return $.defaultEntries=w,X},Qf=($,T)=>{return $.filter((U)=>{let X=Object.values(U.cases).map((w)=>w.branchIndices);for(let w=0;w<X.length-1;w++){let Y=X[w];for(let G=w+1;G<X.length;G++){let H=X[G];for(let z of Y)for(let F of H)if(z>F){if(T[z].overlaps(T[F]))return!1}}}return!0})},Zf=($,T,W)=>{let U=$==="undefined"?W.node("unit",{unit:void 0}):$==="null"?W.node("unit",{unit:null}):$==="boolean"?W.units([!0,!1]):$;for(let X=T.length-1;X>=0;X--){let w=T[X];U=W.node("intersection",typeof w==="number"?{proto:"Array",sequence:[...XR(w).map((Y)=>({})),U]}:{domain:"object",required:[{key:w,value:U}]})}return U},R_=($)=>$.reduce((T,W)=>T+sQ(W,!0),"data"),Vf=Z4(YR),Kf=Z4(M$),_Z={implementation:Hf,Node:L_},Af=($)=>({kind:$.kind,path:$.path.map((T)=>typeof T==="string"?T:o0(T)),cases:E$($.cases,(T,W)=>[T,W===!0?W:W.hasKind("union")&&W.discriminantJson?W.discriminantJson:W.json])}),Ef={delimiter:" | ",finalDelimiter:" | "},Mf=($)=>OX($,Ef),OX=($,T)=>{let W=T?.delimiter??", ",U=T?.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 X={},w=$.filter((G)=>X[G]?!1:X[G]=!0),Y=w.pop();return`${w.join(W)}${w.length?U:""}${Y}`},RZ=($,T,W)=>{let U=T.map(()=>[]);for(let w=0;w<$.length;w++){let Y={};for(let G=0;G<T.length;G++){if(U[G]===null)continue;if($[w].equals(T[G])){U[G]=null,Y={};break}let H=s$($[w],T[G],W);if(H instanceof r)continue;if(H.equals($[w])){U[G].push($[w]),Y={};break}if(H.equals(T[G]))U[G]=null;else Y[G]=H}for(let G in Y)U[G][w]=Y[G]}let X=U.flatMap((w,Y)=>w?.flatMap((G)=>G.branches)??T[Y]);return X.length===0?r.init("union",$,T):X},Df=({branches:$,ordered:T})=>{if($.length<2)return $;let W=$.map(()=>!0);for(let U=0;U<$.length;U++)for(let X=U+1;X<$.length&&W[U]&&W[X];X++){if($[U].equals($[X])){W[X]=!1;continue}let w=n6($[U].in,$[X].in,$[0].$);if(w instanceof r)continue;if(!T)Nf($[U],$[X]);if(w.equals($[U].in))W[U]=!!T;else if(w.equals($[X].in))W[X]=!1}return $.filter((U,X)=>W[X])},Nf=($,T)=>{if(!$.includesTransform&&!T.includesTransform)return;if(!u0($.shallowMorphs,T.shallowMorphs))I(J_($.expression,T.expression));if(!u0($.flatMorphs,T.flatMorphs,{isEqual:(W,U)=>W.propString===U.propString&&(W.node.hasKind("morph")&&U.node.hasKind("morph")?W.node.hasEqualMorphs(U.node):W.node.hasKind("intersection")&&U.node.hasKind("intersection")?W.node.structure?.structuralMorphRef===U.node.structure?.structuralMorphRef:!1)}))I(J_($.expression,T.expression))},N_=($,T)=>$.transform((W,U)=>{if(W==="domain"||W==="unit")return null;return U},{shouldTransform:(W,U)=>{let X=R_(U.path);if(!T.optionallyChainedPropString.startsWith(X))return!1;if(W.hasKind("domain")&&W.domain==="object")return!0;if((W.hasKind("domain")||T.kind==="unit")&&X===T.optionallyChainedPropString)return!0;return W.children.length!==0&&W.kind!=="index"}}),J_=($,T)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
|
|
147
171
|
Left: ${$}
|
|
148
|
-
Right: ${T}`,
|
|
172
|
+
Right: ${T}`,Jf=($,T)=>`The intersection of two ordered unions is indeterminate:
|
|
149
173
|
Left: ${$}
|
|
150
|
-
Right: ${T}`;var Af=D$({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:($)=>$ instanceof Date?$.toISOString():R1($)}},normalize:($)=>$,defaults:{description:($)=>M$($.unit),problem:({expected:$,actual:T})=>`${$===T?`must be reference equal to ${$} (serialized to the same value)`:`must be ${$} (was ${T})`}`},intersections:{unit:($,T)=>r.init("unit",$,T),...F0("unit",($,T)=>{if(T.allows($.unit))return $;let W=T.hasKind("intersection")?T.basis:T;if(W){let X=W.hasKind("domain")?W:y.intrinsic.object;if($.domain!==X.domain){let U=$.domain==="undefined"||$.domain==="null"||$.domain==="boolean"?$.domain:y.intrinsic[$.domain];return r.init("domain",U,X)}}return r.init("assignability",$,T.hasKind("intersection")?T.children.find((X)=>!X.allows($.unit)):T)})}});class K_ extends bW{compiledValue=this.json.unit;serializedValue=typeof this.unit==="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=V_(this.unit,this.serializedValue);compiledNegation=V_(this.unit,this.serializedValue,"negated");expression=M$(this.unit);domain=f4(this.unit);get defaultShortDescription(){return this.domain==="object"?d6.object:this.description}innerToJsonSchema($){return this.unit===null?{type:"null"}:y.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 NZ={implementation:Af,Node:K_},V_=($,T,W)=>{if($ instanceof Date){let X=`data instanceof Date && data.toISOString() === ${T}`;return W?`!(${X})`:X}if(Number.isNaN($))return`${W?"!":""}Number.isNaN(data)`;return`data ${W?"!":"="}== ${T}`};var Ef=D$({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:($,T)=>{let W=T.$.parseSchema($);if(!W.extends(y.intrinsic.key))return B(Df(W.expression));let X=W.branches.filter((U)=>U.hasKind("unit"));if(X.length)return B(Mf(X.map((U)=>M$(U.unit))));return W}},value:{child:!0,parse:($,T)=>T.$.parseSchema($)}},normalize:($)=>$,defaults:{description:($)=>`[${$.signature.expression}]: ${$.value.description}`},intersections:{index:($,T,W)=>{if($.signature.equals(T.signature)){let X=s$($.value,T.value,W),U=X instanceof r?y.intrinsic.never.internal:X;return W.$.node("index",{signature:$.signature,value:U})}if($.signature.extends(T.signature)&&$.value.subsumes(T.value))return T;if(T.signature.extends($.signature)&&T.value.subsumes($.value))return $;return null}}});class A_ extends _1{impliedBasis=y.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=C$(this.value.flatRefs.map(($)=>m1([this.signature,...$.path],$.node)),m1([this.signature],this.value));traverseAllows=($,T)=>IW($).every((W)=>{if(this.signature.traverseAllows(W[0],T))return l6(W[0],()=>this.value.traverseAllows(W[1],T),T);return!0});traverseApply=($,T)=>{for(let W of IW($))if(this.signature.traverseAllows(W[0],T))l6(W[0],()=>this.value.traverseApply(W[1],T),T)};_transform($,T){T.path.push(this.signature);let W=super._transform($,T);return T.path.pop(),W}compile(){}}var LZ={implementation:Ef,Node:A_},Mf=($)=>`Index keys ${$.join(", ")} should be specified as named props.`,Df=($)=>`Indexed key definition '${$}' must be a string or symbol`;var Nf=D$({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:($,T)=>T.$.parseSchema($)}},normalize:($)=>$,defaults:{description:($)=>`${$.compiledKey}: ${$.value.description}`,expected:($)=>$.missingValueDescription,actual:()=>"missing"},intersections:{required:g8,optional:g8}});class E_ extends m8{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=xT(this.errorContext)}var JZ={implementation:Nf,Node:E_};var Lf=D$({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:($,T)=>{if($.length===0)return;return $.map((W)=>T.$.parseSchema(W))}},optionals:{child:!0,parse:($,T)=>{if($.length===0)return;return $.map((W)=>T.$.parseSchema(W))}},defaultables:{child:($)=>$.map((T)=>T[0]),parse:($,T)=>{if($.length===0)return;return $.map((W)=>{let X=T.$.parseSchema(W[0]);return u8(X,W[1],null),[X,W[1]]})},serialize:($)=>$.map((T)=>[T[0].collapsibleJson,R1(T[1])])},variadic:{child:!0,parse:($,T)=>T.$.parseSchema($,T)},minVariadicLength:{parse:($)=>$===0?void 0:$},postfix:{child:!0,parse:($,T)=>{if($.length===0)return;return $.map((W)=>T.$.parseSchema(W))}}},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 B(kf);if($.optionals?.length||$.defaultables?.length)return B(_Z)}if($.minVariadicLength&&!$.variadic)return B("minVariadicLength may not be specified without a variadic element");return $}return{variadic:$}},reduce:($,T)=>{let W=$.minVariadicLength??0,X=$.prefix?.slice()??[],U=$.defaultables?.slice()??[],w=$.optionals?.slice()??[],Y=$.postfix?.slice()??[];if($.variadic){while(w.at(-1)?.equals($.variadic))w.pop();if(w.length===0&&U.length===0)while(X.at(-1)?.equals($.variadic))X.pop(),W++;while(Y[0]?.equals($.variadic))Y.shift(),W++}else if(w.length===0&&U.length===0)X.push(...Y.splice(0));if(W!==$.minVariadicLength||$.prefix&&$.prefix.length!==X.length)return T.node("sequence",{...$,prefix:X,defaultables:U,optionals:w,postfix:Y,minVariadicLength:W},{prereduced:!0})},defaults:{description:($)=>{if($.isVariadicOnly)return`${$.variadic.nestableExpression}[]`;return`[${$.tuple.map((W)=>W.kind==="defaultables"?`${W.node.nestableExpression} = ${M$(W.default)}`:W.kind==="optionals"?`${W.node.nestableExpression}?`:W.kind==="variadic"?`...${W.node.nestableExpression}[]`:W.node.expression).join(", ")}]`}},intersections:{sequence:($,T,W)=>{let X=l8({l:$.tuple,r:T.tuple,disjoint:new r,result:[],fixedVariants:[],ctx:W}),U=X.disjoint.length===0?[X,...X.fixedVariants]:X.fixedVariants;return U.length===0?X.disjoint:U.length===1?W.$.node("sequence",M_(U[0].result)):W.$.node("union",U.map((w)=>({proto:Array,sequence:M_(w.result)})))}}});class D_ extends _1{impliedBasis=y.intrinsic.Array.internal;tuple=_f(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=c0(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return aQ(this.flatRefs,this.prevariadic.flatMap(($,T)=>C$($.node.flatRefs.map((W)=>m1([`${T}`,...W.path],W.node)),m1([`${T}`],$.node)))),aQ(this.flatRefs,this.variadicOrPostfix.flatMap(($)=>C$($.flatRefs.map((T)=>m1([y.intrinsic.nonNegativeIntegerString.internal,...T.path],T.node)),m1([y.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=Rf(this);defaultValueMorphsReference=this.defaultValueMorphs.length?Z4(this.defaultValueMorphs):void 0;elementAtIndex($,T){if(T<this.prevariadic.length)return this.tuple[T];let W=$.length-this.postfixLength;if(T>=W)return{kind:"postfix",node:this.postfix[T-W]};return{kind:"variadic",node:this.variadic??I$(`Unexpected attempt to access index ${T} on ${this}`)}}traverseAllows=($,T)=>{for(let W=0;W<$.length;W++)if(!this.elementAtIndex($,W).node.traverseAllows($[W],T))return!1;return!0};traverseApply=($,T)=>{let W=0;for(;W<$.length;W++)l6(W,()=>this.elementAtIndex($,W).node.traverseApply($[W],T),T)};get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile($){if(this.prefix)for(let[T,W]of this.prefix.entries())$.traverseKey(`${T}`,`data[${T}]`,W);for(let[T,W]of this.defaultablesAndOptionals.entries()){let X=`${T+this.prefixLength}`;$.if(`${X} >= ${$.data}.length`,()=>$.traversalKind==="Allows"?$.return(!0):$.return()),$.traverseKey(X,`data[${X}]`,W)}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[T,W]of this.postfix.entries()){let X=`firstPostfixIndex + ${T}`;$.traverseKey(X,`data[${X}]`,W)}}if($.traversalKind==="Allows")$.return(!0)}_transform($,T){T.path.push(y.intrinsic.nonNegativeIntegerString.internal);let W=super._transform($,T);return T.path.pop(),W}expression=this.description;reduceJsonSchema($,T){if(this.prevariadic.length)$.prefixItems=this.prevariadic.map((W)=>{let X=W.node.toJsonSchemaRecurse(T);if(W.kind==="defaultables"){let U=typeof W.default==="function"?W.default():W.default;X.default=y.intrinsic.jsonData.allows(U)?U:T.fallback.defaultValue({code:"defaultValue",base:X,value:U})}return X});if(this.minLength)$.minItems=this.minLength;if(this.variadic){let W=Object.assign($,{items:this.variadic.toJsonSchemaRecurse(T)});if(this.maxLength)W.maxItems=this.maxLength;if(this.postfix){let X=this.postfix.map((U)=>U.toJsonSchemaRecurse(T));$=T.fallback.arrayPostfix({code:"arrayPostfix",base:W,elements:X})}}else $.items=!1,delete $.maxItems;return $}}var Jf={},Rf=($)=>{if(!$.defaultables)return[];let T=[],W="[",X=$.prefixLength+$.defaultablesLength-1;for(let U=$.prefixLength;U<=X;U++){let[w,Y]=$.defaultables[U-$.prefixLength];T.push(KZ(U,w,Y)),W+=`${U}: ${w.id} = ${R1(Y)}, `}return W+="]",Jf[W]??=T},RZ={implementation:Lf,Node:D_},_f=($)=>{let T=[];if($.prefix)for(let W of $.prefix)T.push({kind:"prefix",node:W});if($.defaultables)for(let[W,X]of $.defaultables)T.push({kind:"defaultables",node:W,default:X});if($.optionals)for(let W of $.optionals)T.push({kind:"optionals",node:W});if($.variadic)T.push({kind:"variadic",node:$.variadic});if($.postfix)for(let W of $.postfix)T.push({kind:"postfix",node:W});return T},M_=($)=>$.reduce((T,W)=>{if(W.kind==="variadic")T.variadic=W.node;else if(W.kind==="defaultables")T.defaultables=C$(T.defaultables,[[W.node,W.default]]);else T[W.kind]=C$(T[W.kind],W.node);return T},{}),_Z="A postfix required element cannot follow an optional or defaultable element",kf="A postfix element requires a variadic element",l8=($)=>{let[T,...W]=$.l,[X,...U]=$.r;if(!T||!X)return $;let w=W.at(-1)?.kind==="postfix",Y=U.at(-1)?.kind==="postfix",G=T.kind==="prefix"||X.kind==="prefix"?"prefix":T.kind==="postfix"||X.kind==="postfix"?"postfix":T.kind==="variadic"&&X.kind==="variadic"?"variadic":w||Y?"prefix":T.kind==="defaultables"||X.kind==="defaultables"?"defaultables":"optionals";if(T.kind==="prefix"&&X.kind==="variadic"&&Y){let O=l8({...$,fixedVariants:[],r:U.map((Q)=>({...Q,kind:"prefix"}))});if(O.disjoint.length===0)$.fixedVariants.push(O)}else if(X.kind==="prefix"&&T.kind==="variadic"&&w){let O=l8({...$,fixedVariants:[],l:W.map((Q)=>({...Q,kind:"prefix"}))});if(O.disjoint.length===0)$.fixedVariants.push(O)}let H=s$(T.node,X.node,$.ctx);if(H instanceof r)if(G==="prefix"||G==="postfix")$.disjoint.push(...H.withPrefixKey(G==="prefix"?$.result.length:`-${W.length+1}`,"required")),$.result=[...$.result,{kind:G,node:y.intrinsic.never.internal}];else if(G==="optionals"||G==="defaultables")return $;else return l8({...$,fixedVariants:[],l:W.map((O)=>({...O,kind:"prefix"})),r:W.map((O)=>({...O,kind:"prefix"}))});else if(G==="defaultables"){if(T.kind==="defaultables"&&X.kind==="defaultables"&&T.default!==X.default)B(VZ(T.default,X.default));$.result=[...$.result,{kind:G,node:H,default:T.kind==="defaultables"?T.default:X.kind==="defaultables"?X.default:I$(`Unexpected defaultable intersection from ${T.kind} and ${X.kind} elements.`)}]}else $.result=[...$.result,{kind:G,node:H}];let z=$.l.length,F=$.r.length;if(T.kind!=="variadic"||z>=F&&(X.kind==="variadic"||F===1))$.l=W;if(X.kind!=="variadic"||F>=z&&(T.kind==="variadic"||z===1))$.r=U;return l8($)};var J_=($)=>(T)=>{if(T.props.length||T.index){let W=T.index?.map((U)=>U[$])??[];for(let U of T.props)W.push(U[$]);if(T.undeclared)W.push(`+ (undeclared): ${T.undeclared}`);let X=`{ ${W.join(", ")} }`;return T.sequence?`${X} & ${T.sequence.description}`:X}return T.sequence?.description??"{}"},vf=J_("description"),Pf=J_("expression"),N_=($,T,W)=>{let X=$.required?"required":"optional";if(!T.signature.allows($.key))return null;let U=r6($.value,T.value,W);if(U instanceof r)return X==="optional"?W.node("optional",{key:$.key,value:y.intrinsic.never.internal}):U.withPrefixKey($.key,$.kind);return null},qf=D$({kind:"structure",hasAssociatedError:!1,normalize:($)=>$,applyConfig:($,T)=>{if(!$.undeclared&&T.onUndeclaredKey!=="ignore")return{...$,undeclared:T.onUndeclaredKey};return $},keys:{required:{child:!0,parse:w6("required"),reduceIo:($,T,W)=>{T.required=C$(T.required,W.map((X)=>X[$]));return}},optional:{child:!0,parse:w6("optional"),reduceIo:($,T,W)=>{if($==="in"){T.optional=W.map((X)=>X.in);return}for(let X of W)T[X.outProp.kind]=C$(T[X.outProp.kind],X.outProp.out)}},index:{child:!0,parse:w6("index")},sequence:{child:!0,parse:w6("sequence")},undeclared:{parse:($)=>$==="ignore"?void 0:$,reduceIo:($,T,W)=>{if(W!=="delete")return;if($==="in")delete T.undeclared;else T.undeclared="reject"}}},defaults:{description:vf},intersections:{structure:($,T,W)=>{let X={...$.inner},U={...T.inner},w=new r;if($.undeclared){let H=$.keyof();for(let z of T.requiredKeys)if(!H.allows(z))w.add("presence",y.intrinsic.never.internal,T.propsByKey[z].value,{path:[z]});if(U.optional)U.optional=U.optional.filter((z)=>H.allows(z.key));if(U.index)U.index=U.index.flatMap((z)=>{if(z.signature.extends(H))return z;let F=r6(H,z.signature,W.$);if(F instanceof r)return[];let O=O9(F,z.value,W.$);if(O.required)U.required=c0(U.required,O.required);if(O.optional)U.optional=c0(U.optional,O.optional);return O.index??[]})}if(T.undeclared){let H=T.keyof();for(let z of $.requiredKeys)if(!H.allows(z))w.add("presence",$.propsByKey[z].value,y.intrinsic.never.internal,{path:[z]});if(X.optional)X.optional=X.optional.filter((z)=>H.allows(z.key));if(X.index)X.index=X.index.flatMap((z)=>{if(z.signature.extends(H))return z;let F=r6(H,z.signature,W.$);if(F instanceof r)return[];let O=O9(F,z.value,W.$);if(O.required)X.required=c0(X.required,O.required);if(O.optional)X.optional=c0(X.optional,O.optional);return O.index??[]})}let Y={};if($.undeclared||T.undeclared)Y.undeclared=$.undeclared==="reject"||T.undeclared==="reject"?"reject":"delete";let G=YU({kind:"structure",baseInner:Y,l:GU(X),r:GU(U),roots:[],ctx:W});if(G instanceof r)w.push(...G);if(w.length)return w;return G}},reduce:($,T)=>{if($.index){if(!($.required||$.optional))return;let W=!1,X=$.required??[],U=$.optional??[],w=[...U];for(let Y of $.index){for(let G of X){let H=N_(G,Y,T);if(H instanceof r)return H}for(let[G,H]of U.entries()){let z=N_(H,Y,T);if(z instanceof r)return z;if(z===null)continue;w[G]=z,W=!0}}if(W)return T.node("structure",{...$,optional:w},{prereduced:!0})}}});class R_ extends _1{impliedBasis=y.intrinsic.object.internal;impliedSiblings=this.children.flatMap(($)=>$.impliedSiblings??[]);props=c0(this.required,this.optional);propsByKey=E$(this.props,($,T)=>[T.key,T]);propsByKeyReference=Z4(this.propsByKey);expression=Pf(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:T}of this.index)$=$.concat(T.branches);return this._keyof=this.$.node("union",$)}map($){return this.$.node("structure",this.props.flatMap($).reduce((T,W)=>{let X=this.propsByKey[W.key];if(a$(W)){if(W.kind!=="required"&&W.kind!=="optional")return B(`Map result must have kind "required" or "optional" (was ${W.kind})`);return T[W.kind]=C$(T[W.kind],W),T}let U=W.kind??X?.kind??"required",w=E$(W,(Y,G)=>(Y in c8.implementation.keys)?[Y,G]:[]);return T[U]=C$(T[U],this.$.node(U,w)),T},{}))}assertHasKeys($){let T=$.filter((W)=>!p8(W,this.keyof()));if(T.length)return B(L_(this.expression,T))}get($,...T){let W,X=!1,U=If($);if((typeof U==="string"||typeof U==="symbol")&&this.propsByKey[U])W=this.propsByKey[U].value,X=this.propsByKey[U].required;if(this.index){for(let Y of this.index)if(p8(U,Y.signature))W=W?.and(Y.value)??Y.value}if(this.sequence&&p8(U,y.intrinsic.nonNegativeIntegerString))if(W$(U,"root")){if(this.sequence.variadic)W=W?.and(this.sequence.element)??this.sequence.element}else{let Y=Number.parseInt(U);if(Y<this.sequence.prevariadic.length){let G=this.sequence.prevariadic[Y].node;W=W?.and(G)??G,X||=Y<this.sequence.prefixLength}else if(this.sequence.variadic){let G=this.$.node("union",this.sequence.variadicOrPostfix);W=W?.and(G)??G}}if(!W){if(this.sequence?.variadic&&W$(U,"root")&&U.extends(y.intrinsic.number))return B(Bf(U.expression,this.sequence.expression));return B(L_(this.expression,[U]))}let w=W.get(...T);return X?w:w.or(y.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:$,...T}=this.inner;return this.$.node("structure",{...T,optional:this.props.map((W)=>W.hasKind("required")?this.$.node("optional",W.inner):W)})}require(){let{optional:$,...T}=this.inner;return this.$.node("structure",{...T,required:this.props.map((W)=>W.hasKind("optional")?{key:W.key,value:W.value}:W)})}merge($){let T=this.filterKeys("omit",[$.keyof()]);if($.required)T.required=C$(T.required,$.required);if($.optional)T.optional=C$(T.optional,$.optional);if($.index)T.index=C$(T.index,$.index);if($.sequence)T.sequence=$.sequence;if($.undeclared)T.undeclared=$.undeclared;else delete T.undeclared;return this.$.node("structure",T)}filterKeys($,T){let W=$9(this.inner),X=(U)=>{let w=T.some((Y)=>p8(U,Y));return $==="pick"?w:!w};if(W.required)W.required=W.required.filter((U)=>X(U.key));if(W.optional)W.optional=W.optional.filter((U)=>X(U.key));if(W.index)W.index=W.index.filter((U)=>X(U.signature));return W}traverseAllows=($,T)=>this._traverse("Allows",$,T);traverseApply=($,T)=>this._traverse("Apply",$,T);_traverse=($,T,W)=>{let X=W?.currentErrorCount??0;for(let U=0;U<this.props.length;U++)if($==="Allows"){if(!this.props[U].traverseAllows(T,W))return!1}else if(this.props[U].traverseApply(T,W),W.failFast&&W.currentErrorCount>X)return!1;if(this.sequence){if($==="Allows"){if(!this.sequence.traverseAllows(T,W))return!1}else if(this.sequence.traverseApply(T,W),W.failFast&&W.currentErrorCount>X)return!1}if(this.index||this.undeclared==="reject"){let U=Object.keys(T);U.push(...Object.getOwnPropertySymbols(T));for(let w=0;w<U.length;w++){let Y=U[w];if(this.index){for(let G of this.index)if(G.signature.traverseAllows(Y,W)){if($==="Allows"){if(!l6(Y,()=>G.value.traverseAllows(T[Y],W),W))return!1}else if(l6(Y,()=>G.value.traverseApply(T[Y],W),W),W.failFast&&W.currentErrorCount>X)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(Y)){if($==="Allows")return!1;if(W.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[Y],meta:this.meta}),W.failFast)return!1}}}if(this.structuralMorph&&W&&!W.hasError())W.queueMorphs([this.structuralMorph]);return!0};get defaultable(){return this.cacheGetter("defaultable",this.optional?.filter(($)=>$.hasDefault())??[])}declaresKey=($)=>($ in this.propsByKey)||this.index?.some((T)=>T.signature.allows($))||this.sequence!==void 0&&y.intrinsic.nonNegativeIntegerString.allows($);_compileDeclaresKey($){let T=[];if(this.props.length)T.push(`k in ${this.propsByKeyReference}`);if(this.index)for(let W of this.index)T.push($.invoke(W.signature,{kind:"Allows",arg:"k"}));if(this.sequence)T.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)");return T.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",Sf(this))}structuralMorphRef=this.structuralMorph&&Z4(this.structuralMorph);compile($){if($.traversalKind==="Apply")$.initializeErrorCount();for(let T of this.props)if($.check(T),$.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(["),jf($,this),$.line("])")})}compileExhaustiveEntry($){if($.const("k","keys[i]"),this.index)for(let T of this.index)$.if(`${$.invoke(T.signature,{arg:"k",kind:"Allows"})}`,()=>$.traverseKey("k","data[k]",T.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($,T){switch($.type){case"object":return this.reduceObjectJsonSchema($,T);case"array":let W=this.sequence?.reduceJsonSchema($,T)??$;if(this.props.length||this.index)return T.fallback.arrayObject({code:"arrayObject",base:W,object:this.reduceObjectJsonSchema({type:"object"},T)});return W;default:return X4.throwInternalOperandError("structure",$)}}reduceObjectJsonSchema($,T){if(this.props.length){$.properties={};for(let W of this.props){let X=W.value.toJsonSchemaRecurse(T);if(typeof W.key==="symbol"){T.fallback.symbolKey({code:"symbolKey",base:$,key:W.key,value:X,optional:W.optional});continue}if(W.hasDefault()){let U=typeof W.default==="function"?W.default():W.default;X.default=y.intrinsic.jsonData.allows(U)?U:T.fallback.defaultValue({code:"defaultValue",base:X,value:U})}$.properties[W.key]=X}if(this.requiredKeys.length&&$.properties)$.required=this.requiredKeys.filter((W)=>typeof W==="string"&&(W in $.properties))}if(this.index)for(let W of this.index){let X=W.value.toJsonSchemaRecurse(T);if(W.signature.equals(y.intrinsic.string)){$.additionalProperties=X;continue}for(let U of W.signature.branches){if(!U.extends(y.intrinsic.string)){$=T.fallback.symbolKey({code:"symbolKey",base:$,key:null,value:X,optional:!1});continue}let w={type:"string"};if(U.hasKind("morph"))w=T.fallback.morph({code:"morph",base:U.in.toJsonSchemaRecurse(T),out:U.out.toJsonSchemaRecurse(T)});if(!U.hasKind("intersection"))return I$(`Unexpected index branch kind ${U.kind}.`);let{pattern:Y}=U.inner;if(Y){let G=Object.assign(w,{pattern:Y[0].rule});for(let H=1;H<Y.length;H++)w=T.fallback.patternIntersection({code:"patternIntersection",base:G,pattern:Y[H].rule});$.patternProperties??={},$.patternProperties[G.pattern]=X}}}if(this.undeclared&&!$.additionalProperties)$.additionalProperties=!1;return $}}var kZ={},Cf=($)=>{let T="";for(let W=0;W<$.defaultable.length;W++)T+=$.defaultable[W].defaultValueMorphRef;if($.sequence?.defaultValueMorphsReference)T+=$.sequence?.defaultValueMorphsReference;if($.undeclared==="delete"){if(T+="delete !(",$.required)for(let W of $.required)T+=W.compiledKey+" | ";if($.optional)for(let W of $.optional)T+=W.compiledKey+" | ";if($.index)for(let W of $.index)T+=W.signature.id+" | ";if($.sequence)if($.sequence.maxLength===null)T+=G$.nonNegativeIntegerString.id;else for(let W=0;W<$.sequence.tuple.length;W++)T+=W+" | ";T+=")"}return T},Sf=($)=>{let T=Cf($);if(!T)return;if(kZ[T])return kZ[T];let W=(X,U)=>{for(let w=0;w<$.defaultable.length;w++)if(!($.defaultable[w].key in X))$.defaultable[w].defaultValueMorph(X,U);if($.sequence?.defaultables)for(let w=X.length-$.sequence.prefixLength;w<$.sequence.defaultables.length;w++)$.sequence.defaultValueMorphs[w](X,U);if($.undeclared==="delete"){for(let w in X)if(!$.declaresKey(w))delete X[w]}return X};return kZ[T]=W},jf=($,T)=>{let X=`(data${T.defaultable.some((U)=>U.defaultValueMorph.length===2)||T.sequence?.defaultValueMorphs.some((U)=>U.length===2)?", ctx":""})`;return $.block(`${X} => `,(U)=>{for(let w=0;w<T.defaultable.length;w++){let{serializedKey:Y,defaultValueMorphRef:G}=T.defaultable[w];U.if(`!(${Y} in data)`,(H)=>H.line(`${G}${X}`))}if(T.sequence?.defaultables)U.for(`i < ${T.sequence.defaultables.length}`,(w)=>w.set("data[i]",5),`data.length - ${T.sequence.prefixLength}`);if(T.undeclared==="delete")U.forIn("data",(w)=>w.if(`!(${T._compileDeclaresKey(w)})`,(Y)=>Y.line("delete data[k]")));return U.return("data")})},vZ={implementation:qf,Node:R_},If=($)=>{if(W$($,"root")&&$.hasKind("unit"))$=$.unit;if(typeof $==="number")$=`${$}`;return $},Bf=($,T)=>`${$} is not allowed as an array index on ${T}. Use the 'nonNegativeIntegerString' keyword instead.`,O9=($,T,W)=>{let[X,U]=lJ($.branches,(Y)=>Y.hasKind("unit"));if(!X.length)return{index:W.node("index",{signature:$,value:T})};let w={};for(let Y of X){let G=W.node("required",{key:Y.unit,value:T});w[G.kind]=C$(w[G.kind],G)}if(U.length)w.index=W.node("index",{signature:U,value:T});return w},xf=($)=>W$($,"root")?$.expression:M$($),L_=($,T)=>`Key${T.length===1?"":"s"} ${T.map(xf).join(", ")} ${T.length===1?"does":"do"} not exist on ${$}`;var HU={...rR,alias:d8.implementation,domain:F9.implementation,unit:NZ.implementation,proto:o8.implementation,union:DZ.implementation,morph:EZ.implementation,intersection:AZ.implementation,divisor:WZ.implementation,pattern:FZ.implementation,predicate:TZ.implementation,required:JZ.implementation,optional:c8.implementation,index:LZ.implementation,sequence:RZ.implementation,structure:vZ.implementation};y.defaultConfig=TR(Object.assign(E$(HU,($,T)=>[$,T.defaults]),{jitless:GR(),clone:XR,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:X4.defaultConfig}));y.resolvedConfig=x8(y.defaultConfig,y.config);var eR={...nR,alias:d8.Node,domain:F9.Node,unit:NZ.Node,proto:o8.Node,union:DZ.Node,morph:EZ.Node,intersection:AZ.Node,divisor:WZ.Node,pattern:FZ.Node,predicate:TZ.Node,required:JZ.Node,optional:c8.Node,index:LZ.Node,sequence:RZ.Node,structure:vZ.Node};class QU extends bQ{get[C6](){return"module"}}var PZ=($,T)=>new QU(E$($,(W,X)=>[W,W$(X,"module")?PZ(X,T):T.bindReference(X)]));var ff=($)=>o$($)?$:("branches"in $)&&o$($.branches)?$.branches:void 0,bf=($,T)=>B(`Node of kind ${T} is not valid as a ${$} definition`),__=($)=>`#${$} duplicates public alias ${$}`,qZ={};y.ambient??={};var k_,P_="function $",yf=($)=>q_($,C_($)),q_=($,T)=>{let W=T.write(P_,4),X=T.compile()();for(let U of $){if(U.precompilation)continue;if(U.traverseAllows=X[`${U.id}Allows`].bind(X),U.isRoot()&&!U.allowsRequiresContext)U.allows=U.traverseAllows;if(U.traverseApply=X[`${U.id}Apply`].bind(X),X[`${U.id}Optimistic`])U.traverseOptimistic=X[`${U.id}Optimistic`].bind(X);U.precompilation=W}},C_=($)=>new ez().return($.reduce((T,W)=>{let X=new B8({kind:"Allows"}).indent();W.compile(X);let U=X.write(`${W.id}Allows`),w=new B8({kind:"Apply"}).indent();W.compile(w);let Y=w.write(`${W.id}Apply`),G=`${T}${U},
|
|
174
|
+
Right: ${T}`;var Lf=D$({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:($)=>$ instanceof Date?$.toISOString():_1($)}},normalize:($)=>$,defaults:{description:($)=>M$($.unit),problem:({expected:$,actual:T})=>`${$===T?`must be reference equal to ${$} (serialized to the same value)`:`must be ${$} (was ${T})`}`},intersections:{unit:($,T)=>r.init("unit",$,T),...F0("unit",($,T)=>{if(T.allows($.unit))return $;let W=T.hasKind("intersection")?T.basis:T;if(W){let U=W.hasKind("domain")?W:y.intrinsic.object;if($.domain!==U.domain){let X=$.domain==="undefined"||$.domain==="null"||$.domain==="boolean"?$.domain:y.intrinsic[$.domain];return r.init("domain",X,U)}}return r.init("assignability",$,T.hasKind("intersection")?T.children.find((U)=>!U.allows($.unit)):T)})}});class k_ extends bW{compiledValue=this.json.unit;serializedValue=typeof this.unit==="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=__(this.unit,this.serializedValue);compiledNegation=__(this.unit,this.serializedValue,"negated");expression=M$(this.unit);domain=f4(this.unit);get defaultShortDescription(){return this.domain==="object"?o6.object:this.description}innerToJsonSchema($){return this.unit===null?{type:"null"}:y.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 kZ={implementation:Lf,Node:k_},__=($,T,W)=>{if($ instanceof Date){let U=`data instanceof Date && data.toISOString() === ${T}`;return W?`!(${U})`:U}if(Number.isNaN($))return`${W?"!":""}Number.isNaN(data)`;return`data ${W?"!":"="}== ${T}`};var Rf=D$({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:($,T)=>{let W=T.$.parseSchema($);if(!W.extends(y.intrinsic.key))return I(kf(W.expression));let U=W.branches.filter((X)=>X.hasKind("unit"));if(U.length)return I(_f(U.map((X)=>M$(X.unit))));return W}},value:{child:!0,parse:($,T)=>T.$.parseSchema($)}},normalize:($)=>$,defaults:{description:($)=>`[${$.signature.expression}]: ${$.value.description}`},intersections:{index:($,T,W)=>{if($.signature.equals(T.signature)){let U=s$($.value,T.value,W),X=U instanceof r?y.intrinsic.never.internal:U;return W.$.node("index",{signature:$.signature,value:X})}if($.signature.extends(T.signature)&&$.value.subsumes(T.value))return T;if(T.signature.extends($.signature)&&T.value.subsumes($.value))return $;return null}}});class v_ extends k1{impliedBasis=y.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=C$(this.value.flatRefs.map(($)=>c1([this.signature,...$.path],$.node)),c1([this.signature],this.value));traverseAllows=($,T)=>BW($).every((W)=>{if(this.signature.traverseAllows(W[0],T))return r6(W[0],()=>this.value.traverseAllows(W[1],T),T);return!0});traverseApply=($,T)=>{for(let W of BW($))if(this.signature.traverseAllows(W[0],T))r6(W[0],()=>this.value.traverseApply(W[1],T),T)};_transform($,T){T.path.push(this.signature);let W=super._transform($,T);return T.path.pop(),W}compile(){}}var vZ={implementation:Rf,Node:v_},_f=($)=>`Index keys ${$.join(", ")} should be specified as named props.`,kf=($)=>`Indexed key definition '${$}' must be a string or symbol`;var vf=D$({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:($,T)=>T.$.parseSchema($)}},normalize:($)=>$,defaults:{description:($)=>`${$.compiledKey}: ${$.value.description}`,expected:($)=>$.missingValueDescription,actual:()=>"missing"},intersections:{required:yw,optional:yw}});class P_ extends hw{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=xT(this.errorContext)}var PZ={implementation:vf,Node:P_};var Pf=D$({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:($,T)=>{if($.length===0)return;return $.map((W)=>T.$.parseSchema(W))}},optionals:{child:!0,parse:($,T)=>{if($.length===0)return;return $.map((W)=>T.$.parseSchema(W))}},defaultables:{child:($)=>$.map((T)=>T[0]),parse:($,T)=>{if($.length===0)return;return $.map((W)=>{let U=T.$.parseSchema(W[0]);return mw(U,W[1],null),[U,W[1]]})},serialize:($)=>$.map((T)=>[T[0].collapsibleJson,_1(T[1])])},variadic:{child:!0,parse:($,T)=>T.$.parseSchema($,T)},minVariadicLength:{parse:($)=>$===0?void 0:$},postfix:{child:!0,parse:($,T)=>{if($.length===0)return;return $.map((W)=>T.$.parseSchema(W))}}},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 I(jf);if($.optionals?.length||$.defaultables?.length)return I(CZ)}if($.minVariadicLength&&!$.variadic)return I("minVariadicLength may not be specified without a variadic element");return $}return{variadic:$}},reduce:($,T)=>{let W=$.minVariadicLength??0,U=$.prefix?.slice()??[],X=$.defaultables?.slice()??[],w=$.optionals?.slice()??[],Y=$.postfix?.slice()??[];if($.variadic){while(w.at(-1)?.equals($.variadic))w.pop();if(w.length===0&&X.length===0)while(U.at(-1)?.equals($.variadic))U.pop(),W++;while(Y[0]?.equals($.variadic))Y.shift(),W++}else if(w.length===0&&X.length===0)U.push(...Y.splice(0));if(W!==$.minVariadicLength||$.prefix&&$.prefix.length!==U.length)return T.node("sequence",{...$,prefix:U,defaultables:X,optionals:w,postfix:Y,minVariadicLength:W},{prereduced:!0})},defaults:{description:($)=>{if($.isVariadicOnly)return`${$.variadic.nestableExpression}[]`;return`[${$.tuple.map((W)=>W.kind==="defaultables"?`${W.node.nestableExpression} = ${M$(W.default)}`:W.kind==="optionals"?`${W.node.nestableExpression}?`:W.kind==="variadic"?`...${W.node.nestableExpression}[]`:W.node.expression).join(", ")}]`}},intersections:{sequence:($,T,W)=>{let U=dw({l:$.tuple,r:T.tuple,disjoint:new r,result:[],fixedVariants:[],ctx:W}),X=U.disjoint.length===0?[U,...U.fixedVariants]:U.fixedVariants;return X.length===0?U.disjoint:X.length===1?W.$.node("sequence",q_(X[0].result)):W.$.node("union",X.map((w)=>({proto:Array,sequence:q_(w.result)})))}}});class C_ extends k1{impliedBasis=y.intrinsic.Array.internal;tuple=Sf(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=c0(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return WZ(this.flatRefs,this.prevariadic.flatMap(($,T)=>C$($.node.flatRefs.map((W)=>c1([`${T}`,...W.path],W.node)),c1([`${T}`],$.node)))),WZ(this.flatRefs,this.variadicOrPostfix.flatMap(($)=>C$($.flatRefs.map((T)=>c1([y.intrinsic.nonNegativeIntegerString.internal,...T.path],T.node)),c1([y.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=Cf(this);defaultValueMorphsReference=this.defaultValueMorphs.length?Z4(this.defaultValueMorphs):void 0;elementAtIndex($,T){if(T<this.prevariadic.length)return this.tuple[T];let W=$.length-this.postfixLength;if(T>=W)return{kind:"postfix",node:this.postfix[T-W]};return{kind:"variadic",node:this.variadic??B$(`Unexpected attempt to access index ${T} on ${this}`)}}traverseAllows=($,T)=>{for(let W=0;W<$.length;W++)if(!this.elementAtIndex($,W).node.traverseAllows($[W],T))return!1;return!0};traverseApply=($,T)=>{let W=0;for(;W<$.length;W++)r6(W,()=>this.elementAtIndex($,W).node.traverseApply($[W],T),T)};get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile($){if(this.prefix)for(let[T,W]of this.prefix.entries())$.traverseKey(`${T}`,`data[${T}]`,W);for(let[T,W]of this.defaultablesAndOptionals.entries()){let U=`${T+this.prefixLength}`;$.if(`${U} >= ${$.data}.length`,()=>$.traversalKind==="Allows"?$.return(!0):$.return()),$.traverseKey(U,`data[${U}]`,W)}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[T,W]of this.postfix.entries()){let U=`firstPostfixIndex + ${T}`;$.traverseKey(U,`data[${U}]`,W)}}if($.traversalKind==="Allows")$.return(!0)}_transform($,T){T.path.push(y.intrinsic.nonNegativeIntegerString.internal);let W=super._transform($,T);return T.path.pop(),W}expression=this.description;reduceJsonSchema($,T){if(this.prevariadic.length)$.prefixItems=this.prevariadic.map((W)=>{let U=W.node.toJsonSchemaRecurse(T);if(W.kind==="defaultables"){let X=typeof W.default==="function"?W.default():W.default;U.default=y.intrinsic.jsonData.allows(X)?X:T.fallback.defaultValue({code:"defaultValue",base:U,value:X})}return U});if(this.minLength)$.minItems=this.minLength;if(this.variadic){let W=Object.assign($,{items:this.variadic.toJsonSchemaRecurse(T)});if(this.maxLength)W.maxItems=this.maxLength;if(this.postfix){let U=this.postfix.map((X)=>X.toJsonSchemaRecurse(T));$=T.fallback.arrayPostfix({code:"arrayPostfix",base:W,elements:U})}}else $.items=!1,delete $.maxItems;return $}}var qf={},Cf=($)=>{if(!$.defaultables)return[];let T=[],W="[",U=$.prefixLength+$.defaultablesLength-1;for(let X=$.prefixLength;X<=U;X++){let[w,Y]=$.defaultables[X-$.prefixLength];T.push(NZ(X,w,Y)),W+=`${X}: ${w.id} = ${_1(Y)}, `}return W+="]",qf[W]??=T},qZ={implementation:Pf,Node:C_},Sf=($)=>{let T=[];if($.prefix)for(let W of $.prefix)T.push({kind:"prefix",node:W});if($.defaultables)for(let[W,U]of $.defaultables)T.push({kind:"defaultables",node:W,default:U});if($.optionals)for(let W of $.optionals)T.push({kind:"optionals",node:W});if($.variadic)T.push({kind:"variadic",node:$.variadic});if($.postfix)for(let W of $.postfix)T.push({kind:"postfix",node:W});return T},q_=($)=>$.reduce((T,W)=>{if(W.kind==="variadic")T.variadic=W.node;else if(W.kind==="defaultables")T.defaultables=C$(T.defaultables,[[W.node,W.default]]);else T[W.kind]=C$(T[W.kind],W.node);return T},{}),CZ="A postfix required element cannot follow an optional or defaultable element",jf="A postfix element requires a variadic element",dw=($)=>{let[T,...W]=$.l,[U,...X]=$.r;if(!T||!U)return $;let w=W.at(-1)?.kind==="postfix",Y=X.at(-1)?.kind==="postfix",G=T.kind==="prefix"||U.kind==="prefix"?"prefix":T.kind==="postfix"||U.kind==="postfix"?"postfix":T.kind==="variadic"&&U.kind==="variadic"?"variadic":w||Y?"prefix":T.kind==="defaultables"||U.kind==="defaultables"?"defaultables":"optionals";if(T.kind==="prefix"&&U.kind==="variadic"&&Y){let O=dw({...$,fixedVariants:[],r:X.map((Q)=>({...Q,kind:"prefix"}))});if(O.disjoint.length===0)$.fixedVariants.push(O)}else if(U.kind==="prefix"&&T.kind==="variadic"&&w){let O=dw({...$,fixedVariants:[],l:W.map((Q)=>({...Q,kind:"prefix"}))});if(O.disjoint.length===0)$.fixedVariants.push(O)}let H=s$(T.node,U.node,$.ctx);if(H instanceof r)if(G==="prefix"||G==="postfix")$.disjoint.push(...H.withPrefixKey(G==="prefix"?$.result.length:`-${W.length+1}`,"required")),$.result=[...$.result,{kind:G,node:y.intrinsic.never.internal}];else if(G==="optionals"||G==="defaultables")return $;else return dw({...$,fixedVariants:[],l:W.map((O)=>({...O,kind:"prefix"})),r:W.map((O)=>({...O,kind:"prefix"}))});else if(G==="defaultables"){if(T.kind==="defaultables"&&U.kind==="defaultables"&&T.default!==U.default)I(DZ(T.default,U.default));$.result=[...$.result,{kind:G,node:H,default:T.kind==="defaultables"?T.default:U.kind==="defaultables"?U.default:B$(`Unexpected defaultable intersection from ${T.kind} and ${U.kind} elements.`)}]}else $.result=[...$.result,{kind:G,node:H}];let z=$.l.length,F=$.r.length;if(T.kind!=="variadic"||z>=F&&(U.kind==="variadic"||F===1))$.l=W;if(U.kind!=="variadic"||F>=z&&(T.kind==="variadic"||z===1))$.r=X;return dw($)};var B_=($)=>(T)=>{if(T.props.length||T.index){let W=T.index?.map((X)=>X[$])??[];for(let X of T.props)W.push(X[$]);if(T.undeclared)W.push(`+ (undeclared): ${T.undeclared}`);let U=`{ ${W.join(", ")} }`;return T.sequence?`${U} & ${T.sequence.description}`:U}return T.sequence?.description??"{}"},Bf=B_("description"),If=B_("expression"),S_=($,T,W)=>{let U=$.required?"required":"optional";if(!T.signature.allows($.key))return null;let X=n6($.value,T.value,W);if(X instanceof r)return U==="optional"?W.node("optional",{key:$.key,value:y.intrinsic.never.internal}):X.withPrefixKey($.key,$.kind);return null},xf=D$({kind:"structure",hasAssociatedError:!1,normalize:($)=>$,applyConfig:($,T)=>{if(!$.undeclared&&T.onUndeclaredKey!=="ignore")return{...$,undeclared:T.onUndeclaredKey};return $},keys:{required:{child:!0,parse:Y6("required"),reduceIo:($,T,W)=>{T.required=C$(T.required,W.map((U)=>U[$]));return}},optional:{child:!0,parse:Y6("optional"),reduceIo:($,T,W)=>{if($==="in"){T.optional=W.map((U)=>U.in);return}for(let U of W)T[U.outProp.kind]=C$(T[U.outProp.kind],U.outProp.out)}},index:{child:!0,parse:Y6("index")},sequence:{child:!0,parse:Y6("sequence")},undeclared:{parse:($)=>$==="ignore"?void 0:$,reduceIo:($,T,W)=>{if(W!=="delete")return;if($==="in")delete T.undeclared;else T.undeclared="reject"}}},defaults:{description:Bf},intersections:{structure:($,T,W)=>{let U={...$.inner},X={...T.inner},w=new r;if($.undeclared){let H=$.keyof();for(let z of T.requiredKeys)if(!H.allows(z))w.add("presence",y.intrinsic.never.internal,T.propsByKey[z].value,{path:[z]});if(X.optional)X.optional=X.optional.filter((z)=>H.allows(z.key));if(X.index)X.index=X.index.flatMap((z)=>{if(z.signature.extends(H))return z;let F=n6(H,z.signature,W.$);if(F instanceof r)return[];let O=Z9(F,z.value,W.$);if(O.required)X.required=c0(X.required,O.required);if(O.optional)X.optional=c0(X.optional,O.optional);return O.index??[]})}if(T.undeclared){let H=T.keyof();for(let z of $.requiredKeys)if(!H.allows(z))w.add("presence",$.propsByKey[z].value,y.intrinsic.never.internal,{path:[z]});if(U.optional)U.optional=U.optional.filter((z)=>H.allows(z.key));if(U.index)U.index=U.index.flatMap((z)=>{if(z.signature.extends(H))return z;let F=n6(H,z.signature,W.$);if(F instanceof r)return[];let O=Z9(F,z.value,W.$);if(O.required)U.required=c0(U.required,O.required);if(O.optional)U.optional=c0(U.optional,O.optional);return O.index??[]})}let Y={};if($.undeclared||T.undeclared)Y.undeclared=$.undeclared==="reject"||T.undeclared==="reject"?"reject":"delete";let G=YX({kind:"structure",baseInner:Y,l:GX(U),r:GX(X),roots:[],ctx:W});if(G instanceof r)w.push(...G);if(w.length)return w;return G}},reduce:($,T)=>{if($.index){if(!($.required||$.optional))return;let W=!1,U=$.required??[],X=$.optional??[],w=[...X];for(let Y of $.index){for(let G of U){let H=S_(G,Y,T);if(H instanceof r)return H}for(let[G,H]of X.entries()){let z=S_(H,Y,T);if(z instanceof r)return z;if(z===null)continue;w[G]=z,W=!0}}if(W)return T.node("structure",{...$,optional:w},{prereduced:!0})}}});class I_ extends k1{impliedBasis=y.intrinsic.object.internal;impliedSiblings=this.children.flatMap(($)=>$.impliedSiblings??[]);props=c0(this.required,this.optional);propsByKey=E$(this.props,($,T)=>[T.key,T]);propsByKeyReference=Z4(this.propsByKey);expression=If(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:T}of this.index)$=$.concat(T.branches);return this._keyof=this.$.node("union",$)}map($){return this.$.node("structure",this.props.flatMap($).reduce((T,W)=>{let U=this.propsByKey[W.key];if(a$(W)){if(W.kind!=="required"&&W.kind!=="optional")return I(`Map result must have kind "required" or "optional" (was ${W.kind})`);return T[W.kind]=C$(T[W.kind],W),T}let X=W.kind??U?.kind??"required",w=E$(W,(Y,G)=>(Y in gw.implementation.keys)?[Y,G]:[]);return T[X]=C$(T[X],this.$.node(X,w)),T},{}))}assertHasKeys($){let T=$.filter((W)=>!cw(W,this.keyof()));if(T.length)return I(j_(this.expression,T))}get($,...T){let W,U=!1,X=hf($);if((typeof X==="string"||typeof X==="symbol")&&this.propsByKey[X])W=this.propsByKey[X].value,U=this.propsByKey[X].required;if(this.index){for(let Y of this.index)if(cw(X,Y.signature))W=W?.and(Y.value)??Y.value}if(this.sequence&&cw(X,y.intrinsic.nonNegativeIntegerString))if(W$(X,"root")){if(this.sequence.variadic)W=W?.and(this.sequence.element)??this.sequence.element}else{let Y=Number.parseInt(X);if(Y<this.sequence.prevariadic.length){let G=this.sequence.prevariadic[Y].node;W=W?.and(G)??G,U||=Y<this.sequence.prefixLength}else if(this.sequence.variadic){let G=this.$.node("union",this.sequence.variadicOrPostfix);W=W?.and(G)??G}}if(!W){if(this.sequence?.variadic&&W$(X,"root")&&X.extends(y.intrinsic.number))return I(gf(X.expression,this.sequence.expression));return I(j_(this.expression,[X]))}let w=W.get(...T);return U?w:w.or(y.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:$,...T}=this.inner;return this.$.node("structure",{...T,optional:this.props.map((W)=>W.hasKind("required")?this.$.node("optional",W.inner):W)})}require(){let{optional:$,...T}=this.inner;return this.$.node("structure",{...T,required:this.props.map((W)=>W.hasKind("optional")?{key:W.key,value:W.value}:W)})}merge($){let T=this.filterKeys("omit",[$.keyof()]);if($.required)T.required=C$(T.required,$.required);if($.optional)T.optional=C$(T.optional,$.optional);if($.index)T.index=C$(T.index,$.index);if($.sequence)T.sequence=$.sequence;if($.undeclared)T.undeclared=$.undeclared;else delete T.undeclared;return this.$.node("structure",T)}filterKeys($,T){let W=W9(this.inner),U=(X)=>{let w=T.some((Y)=>cw(X,Y));return $==="pick"?w:!w};if(W.required)W.required=W.required.filter((X)=>U(X.key));if(W.optional)W.optional=W.optional.filter((X)=>U(X.key));if(W.index)W.index=W.index.filter((X)=>U(X.signature));return W}traverseAllows=($,T)=>this._traverse("Allows",$,T);traverseApply=($,T)=>this._traverse("Apply",$,T);_traverse=($,T,W)=>{let U=W?.currentErrorCount??0;for(let X=0;X<this.props.length;X++)if($==="Allows"){if(!this.props[X].traverseAllows(T,W))return!1}else if(this.props[X].traverseApply(T,W),W.failFast&&W.currentErrorCount>U)return!1;if(this.sequence){if($==="Allows"){if(!this.sequence.traverseAllows(T,W))return!1}else if(this.sequence.traverseApply(T,W),W.failFast&&W.currentErrorCount>U)return!1}if(this.index||this.undeclared==="reject"){let X=Object.keys(T);X.push(...Object.getOwnPropertySymbols(T));for(let w=0;w<X.length;w++){let Y=X[w];if(this.index){for(let G of this.index)if(G.signature.traverseAllows(Y,W)){if($==="Allows"){if(!r6(Y,()=>G.value.traverseAllows(T[Y],W),W))return!1}else if(r6(Y,()=>G.value.traverseApply(T[Y],W),W),W.failFast&&W.currentErrorCount>U)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(Y)){if($==="Allows")return!1;if(W.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[Y],meta:this.meta}),W.failFast)return!1}}}if(this.structuralMorph&&W&&!W.hasError())W.queueMorphs([this.structuralMorph]);return!0};get defaultable(){return this.cacheGetter("defaultable",this.optional?.filter(($)=>$.hasDefault())??[])}declaresKey=($)=>($ in this.propsByKey)||this.index?.some((T)=>T.signature.allows($))||this.sequence!==void 0&&y.intrinsic.nonNegativeIntegerString.allows($);_compileDeclaresKey($){let T=[];if(this.props.length)T.push(`k in ${this.propsByKeyReference}`);if(this.index)for(let W of this.index)T.push($.invoke(W.signature,{kind:"Allows",arg:"k"}));if(this.sequence)T.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)");return T.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",bf(this))}structuralMorphRef=this.structuralMorph&&Z4(this.structuralMorph);compile($){if($.traversalKind==="Apply")$.initializeErrorCount();for(let T of this.props)if($.check(T),$.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(["),yf($,this),$.line("])")})}compileExhaustiveEntry($){if($.const("k","keys[i]"),this.index)for(let T of this.index)$.if(`${$.invoke(T.signature,{arg:"k",kind:"Allows"})}`,()=>$.traverseKey("k","data[k]",T.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($,T){switch($.type){case"object":return this.reduceObjectJsonSchema($,T);case"array":let W=this.sequence?.reduceJsonSchema($,T)??$;if(this.props.length||this.index)return T.fallback.arrayObject({code:"arrayObject",base:W,object:this.reduceObjectJsonSchema({type:"object"},T)});return W;default:return U4.throwInternalOperandError("structure",$)}}reduceObjectJsonSchema($,T){if(this.props.length){$.properties={};for(let W of this.props){let U=W.value.toJsonSchemaRecurse(T);if(typeof W.key==="symbol"){T.fallback.symbolKey({code:"symbolKey",base:$,key:W.key,value:U,optional:W.optional});continue}if(W.hasDefault()){let X=typeof W.default==="function"?W.default():W.default;U.default=y.intrinsic.jsonData.allows(X)?X:T.fallback.defaultValue({code:"defaultValue",base:U,value:X})}$.properties[W.key]=U}if(this.requiredKeys.length&&$.properties)$.required=this.requiredKeys.filter((W)=>typeof W==="string"&&(W in $.properties))}if(this.index)for(let W of this.index){let U=W.value.toJsonSchemaRecurse(T);if(W.signature.equals(y.intrinsic.string)){$.additionalProperties=U;continue}for(let X of W.signature.branches){if(!X.extends(y.intrinsic.string)){$=T.fallback.symbolKey({code:"symbolKey",base:$,key:null,value:U,optional:!1});continue}let w={type:"string"};if(X.hasKind("morph"))w=T.fallback.morph({code:"morph",base:X.in.toJsonSchemaRecurse(T),out:X.out.toJsonSchemaRecurse(T)});if(!X.hasKind("intersection"))return B$(`Unexpected index branch kind ${X.kind}.`);let{pattern:Y}=X.inner;if(Y){let G=Object.assign(w,{pattern:Y[0].rule});for(let H=1;H<Y.length;H++)w=T.fallback.patternIntersection({code:"patternIntersection",base:G,pattern:Y[H].rule});$.patternProperties??={},$.patternProperties[G.pattern]=U}}}if(this.undeclared&&!$.additionalProperties)$.additionalProperties=!1;return $}}var SZ={},ff=($)=>{let T="";for(let W=0;W<$.defaultable.length;W++)T+=$.defaultable[W].defaultValueMorphRef;if($.sequence?.defaultValueMorphsReference)T+=$.sequence?.defaultValueMorphsReference;if($.undeclared==="delete"){if(T+="delete !(",$.required)for(let W of $.required)T+=W.compiledKey+" | ";if($.optional)for(let W of $.optional)T+=W.compiledKey+" | ";if($.index)for(let W of $.index)T+=W.signature.id+" | ";if($.sequence)if($.sequence.maxLength===null)T+=G$.nonNegativeIntegerString.id;else for(let W=0;W<$.sequence.tuple.length;W++)T+=W+" | ";T+=")"}return T},bf=($)=>{let T=ff($);if(!T)return;if(SZ[T])return SZ[T];let W=(U,X)=>{for(let w=0;w<$.defaultable.length;w++)if(!($.defaultable[w].key in U))$.defaultable[w].defaultValueMorph(U,X);if($.sequence?.defaultables)for(let w=U.length-$.sequence.prefixLength;w<$.sequence.defaultables.length;w++)$.sequence.defaultValueMorphs[w](U,X);if($.undeclared==="delete"){for(let w in U)if(!$.declaresKey(w))delete U[w]}return U};return SZ[T]=W},yf=($,T)=>{let U=`(data${T.defaultable.some((X)=>X.defaultValueMorph.length===2)||T.sequence?.defaultValueMorphs.some((X)=>X.length===2)?", ctx":""})`;return $.block(`${U} => `,(X)=>{for(let w=0;w<T.defaultable.length;w++){let{serializedKey:Y,defaultValueMorphRef:G}=T.defaultable[w];X.if(`!(${Y} in data)`,(H)=>H.line(`${G}${U}`))}if(T.sequence?.defaultables)X.for(`i < ${T.sequence.defaultables.length}`,(w)=>w.set("data[i]",5),`data.length - ${T.sequence.prefixLength}`);if(T.undeclared==="delete")X.forIn("data",(w)=>w.if(`!(${T._compileDeclaresKey(w)})`,(Y)=>Y.line("delete data[k]")));return X.return("data")})},jZ={implementation:xf,Node:I_},hf=($)=>{if(W$($,"root")&&$.hasKind("unit"))$=$.unit;if(typeof $==="number")$=`${$}`;return $},gf=($,T)=>`${$} is not allowed as an array index on ${T}. Use the 'nonNegativeIntegerString' keyword instead.`,Z9=($,T,W)=>{let[U,X]=WR($.branches,(Y)=>Y.hasKind("unit"));if(!U.length)return{index:W.node("index",{signature:$,value:T})};let w={};for(let Y of U){let G=W.node("required",{key:Y.unit,value:T});w[G.kind]=C$(w[G.kind],G)}if(X.length)w.index=W.node("index",{signature:X,value:T});return w},mf=($)=>W$($,"root")?$.expression:M$($),j_=($,T)=>`Key${T.length===1?"":"s"} ${T.map(mf).join(", ")} ${T.length===1?"does":"do"} not exist on ${$}`;var HX={...X_,alias:uw.implementation,domain:Q9.implementation,unit:kZ.implementation,proto:pw.implementation,union:_Z.implementation,morph:LZ.implementation,intersection:JZ.implementation,divisor:GZ.implementation,pattern:KZ.implementation,predicate:YZ.implementation,required:PZ.implementation,optional:gw.implementation,index:vZ.implementation,sequence:qZ.implementation,structure:jZ.implementation};y.defaultConfig=OR(Object.assign(E$(HX,($,T)=>[$,T.defaults]),{jitless:ER(),clone:VR,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:U4.defaultConfig}));y.resolvedConfig=Bw(y.defaultConfig,y.config);var H_={...U_,alias:uw.Node,domain:Q9.Node,unit:kZ.Node,proto:pw.Node,union:_Z.Node,morph:LZ.Node,intersection:JZ.Node,divisor:GZ.Node,pattern:KZ.Node,predicate:YZ.Node,required:PZ.Node,optional:gw.Node,index:vZ.Node,sequence:qZ.Node,structure:jZ.Node};class QX extends cQ{get[S6](){return"module"}}var BZ=($,T)=>new QX(E$($,(W,U)=>[W,W$(U,"module")?BZ(U,T):T.bindReference(U)]));var cf=($)=>o$($)?$:("branches"in $)&&o$($.branches)?$.branches:void 0,uf=($,T)=>I(`Node of kind ${T} is not valid as a ${$} definition`),x_=($)=>`#${$} duplicates public alias ${$}`,IZ={};y.ambient??={};var f_,y_="function $",pf=($)=>h_($,g_($)),h_=($,T)=>{let W=T.write(y_,4),U=T.compile()();for(let X of $){if(X.precompilation)continue;if(X.traverseAllows=U[`${X.id}Allows`].bind(U),X.isRoot()&&!X.allowsRequiresContext)X.allows=X.traverseAllows;if(X.traverseApply=U[`${X.id}Apply`].bind(U),U[`${X.id}Optimistic`])X.traverseOptimistic=U[`${X.id}Optimistic`].bind(U);X.precompilation=W}},g_=($)=>new T9().return($.reduce((T,W)=>{let U=new jw({kind:"Allows"}).indent();W.compile(U);let X=U.write(`${W.id}Allows`),w=new jw({kind:"Apply"}).indent();W.compile(w);let Y=w.write(`${W.id}Apply`),G=`${T}${X},
|
|
151
175
|
${Y},
|
|
152
|
-
`;if(!W.hasKind("union"))return G;let H=new
|
|
176
|
+
`;if(!W.hasKind("union"))return G;let H=new jw({kind:"Allows",optimistic:!0}).indent();W.compile(H);let z=H.write(`${W.id}Optimistic`);return`${G}${z},
|
|
153
177
|
`},`{
|
|
154
|
-
`)+"}");class Q9{config;resolvedConfig;name;get[C6](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor($,T){if(this.config=x8(y.config,T),this.resolvedConfig=x8(y.resolvedConfig,T),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(qZ).length}`,this.name in qZ)B(`A Scope already named ${this.name} already exists`);qZ[this.name]=this;let W=Object.entries($).map((X)=>this.preparseOwnAliasEntry(...X));for(let[X,U]of W){let w=X;if(X[0]==="#"){if(w=X.slice(1),w in this.aliases)B(__(w));this.aliases[w]=U}else{if(w in this.aliases)B(__(X));this.aliases[w]=U,this.exportedNames.push(w)}if(!W$(U,"module")&&!W$(U,"generic")&&!jT(U)){let Y=this.preparseOwnDefinitionFormat(U,{alias:w});this.resolutions[w]=W$(Y,"root")?this.bindReference(Y):this.createParseContext(Y).id}}k_??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[k_.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=y.intrinsic?E$(y.intrinsic,(X,U)=>X.startsWith("json")?[]:[X,this.bindReference(U)]):{}}cacheGetter($,T){return Object.defineProperty(this,$,{value:T}),T}get internal(){return this}_json;get json(){if(!this._json)this.export();return this._json}defineSchema($){return $}generic=(...$)=>{let T=this;return(W,X)=>new bT($,X?new X9(W):W,T,T,X??null)};units=($,T)=>{let W=[];for(let U of $)if(!W.includes(U))W.push(U);let X=W.map((U)=>this.node("unit",{unit:U},T));return this.node("union",X,{...T,prereduced:!0})};lazyResolutions=[];lazilyResolve($,T){let W=this.node("alias",{reference:T??"synthetic",resolve:$},{prereduced:!0});if(!this.resolved)this.lazyResolutions.push(W);return W}schema=($,T)=>this.finalize(this.parseSchema($,T));parseSchema=($,T)=>this.node(h8($),$,T);preparseNode($,T,W){let X=typeof $==="string"?$:h8(T,$);if(a$(T)&&T.kind===X)return T;if(X==="alias"&&!W?.prereduced){let{reference:Y}=d8.implementation.normalize(T,this);if(Y.startsWith("$")){let G=this.resolveRoot(Y.slice(1));T=G,X=G.kind}}else if(X==="union"&&p6(T,"object")){let Y=ff(T);if(Y?.length===1)T=Y[0],X=h8(T)}if(a$(T)&&T.kind===X)return T;let w=HU[X].normalize?.(T,this)??T;if(a$(w))return w.kind===X?w:bf(X,w.kind);return{...W,$:this,kind:X,def:w,prefix:W.alias??X}}bindReference($){let T;if(a$($))T=$.$===this?$:new $.constructor($.attachments,this);else T=$.$===this?$:new bT($.params,$.bodyDef,$.$,this,$.hkt);if(!this.resolved)Object.assign(this.referencesById,T.referencesById);return T}resolveRoot($){return this.maybeResolveRoot($)??B(jZ($))}maybeResolveRoot($){let T=this.maybeResolve($);if(W$(T,"generic"))return;return T}maybeResolveSubalias($){return CZ(this.aliases,$)??CZ(this.ambient,$)}get ambient(){return y.ambient}maybeResolve($){let T=this.resolutions[$];if(T){if(typeof T!=="string")return this.bindReference(T);let X=S6[T];if(W$(X,"root"))return this.resolutions[$]=X;if(W$(X,"context")){if(X.phase==="resolving")return this.node("alias",{reference:`$${$}`},{prereduced:!0});if(X.phase==="resolved")return I$(`Unexpected resolved context for was uncached by its scope: ${M$(X)}`);X.phase="resolving";let U=this.bindReference(this.parseOwnDefinitionFormat(X.def,X));return X.phase="resolved",S6[U.id]=U,S6[X.id]=U,this.resolutions[$]=U}return I$(`Unexpected nodesById entry for ${T}: ${M$(X)}`)}let W=this.aliases[$]??this.ambient?.[$];if(!W)return this.maybeResolveSubalias($);if(W=this.normalizeRootScopeValue(W),W$(W,"generic"))return this.resolutions[$]=this.bindReference(W);if(W$(W,"module")){if(!W.root)B(I_($));return this.resolutions[$]=this.bindReference(W.root)}return this.resolutions[$]=this.parse(W,{alias:$})}createParseContext($){let T=$.id??OZ($.prefix);return S6[T]=Object.assign($,{[C6]:"context",$:this,id:T,phase:"unresolved"})}traversal($){return new g1($,this.resolvedConfig)}import(...$){return new QU(E$(this.export(...$),(T,W)=>[`#${T}`,W]))}precompilation;_exportedResolutions;_exports;export(...$){if(!this._exports){this._exports={};for(let W of this.exportedNames){let X=this.aliases[W];this._exports[W]=W$(X,"module")?PZ(X,this):v_(this.maybeResolve(W))}for(let W of this.lazyResolutions)W.resolution;if(this._exportedResolutions=j_(this,this._exports),this._json=S_(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){let W=C_(this.references);this.precompilation=W.write(P_,4),q_(this.references,W)}this.resolved=!0}let T=$.length?$:this.exportedNames;return new QU(E$(T,(W,X)=>[X,this._exports[X]]))}resolve($){return this.export()[$]}node=($,T,W={})=>{let X=this.preparseNode($,T,W);if(a$(X))return this.bindReference(X);let U=this.createParseContext(X),w=QZ(U),Y=this.bindReference(w);return S6[U.id]=Y};parse=($,T={})=>this.finalize(this.parseDefinition($,T));parseDefinition($,T={}){if(W$($,"root"))return this.bindReference($);let W=this.preparseOwnDefinitionFormat($,T);if(W$(W,"root"))return this.bindReference(W);let X=this.createParseContext(W);S6[X.id]=X;let U=this.bindReference(this.parseOwnDefinitionFormat($,X));if(U.isCyclic)U=sR(U,X.id);return S6[X.id]=U,U}finalize($){if(v_($),!$.precompilation&&!this.resolvedConfig.jitless)yf($.references);return $}}class SZ extends Q9{parseOwnDefinitionFormat($,T){return QZ(T)}preparseOwnDefinitionFormat($,T){return this.preparseNode(h8($),$,T)}preparseOwnAliasEntry($,T){return[$,T]}normalizeRootScopeValue($){return $}}var v_=($)=>{let T=$.references.filter((W)=>W.hasKind("alias"));for(let W of T){Object.assign(W.referencesById,W.resolution.referencesById);for(let X of $.references)if(W.id in X.referencesById)Object.assign(X.referencesById,W.referencesById)}return $},S_=($)=>E$($,(T,W)=>[T,W$(W,"root")||W$(W,"generic")?W.json:W$(W,"module")?S_(W):I$(`Unexpected resolution ${M$(W)}`)]),CZ=($,T)=>{let W=T.indexOf(".");if(W===-1)return;let X=T.slice(0,W),U=$[X];if(U===void 0)return;if(!W$(U,"module"))return B(hf(X));let w=T.slice(W+1),Y=U[w];if(Y===void 0)return CZ(U,w);if(W$(Y,"root")||W$(Y,"generic"))return Y;if(W$(Y,"module"))return Y.root??B(I_(T));I$(`Unexpected resolution for alias '${T}': ${M$(Y)}`)},Z9=($,T)=>new SZ($,T),r8=new SZ({});var j_=($,T)=>{let W={};for(let X in T){let U=T[X];if(W$(U,"module")){let w=j_($,U),Y=E$(w,(G,H)=>[`${X}.${G}`,H]);Object.assign(W,Y)}else if(W$(U,"root")||W$(U,"generic"))W[X]=U;else I$(`Unexpected scope resolution ${M$(U)}`)}return W},jZ=($)=>`'${$}' is unresolvable`,hf=($)=>`'${$}' must reference a module to be accessed using dot syntax`,I_=($)=>`Reference to submodule '${$}' must specify an alias`;r8.export();var{schema:g$,node:ZU,defineSchema:S8$,generic:v1}=r8;var IZ="^(?:0|[1-9]\\d*)$",gf=new RegExp(IZ),B8$=Z4(gf);var B_=Z9({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();y.intrinsic={...B_};var x_=Z9({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:IZ}},{prereducedAliases:!0}).export();Object.assign(y.intrinsic,x_);var mf=Z9({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),G$={...B_,...x_,...mf,emptyStructure:ZU("structure",{},{prereduced:!0})};y.intrinsic={...G$};var b_=($)=>typeof $==="string"&&$[0]==="d"&&($[1]==="'"||$[1]==='"')&&$.at(-1)===$[1],f_=($)=>$.toString()!=="Invalid Date",y_=($)=>$.slice(2,-1),BZ=($)=>`'${$}' could not be parsed by the Date constructor`,h_=($,T)=>cf($,T),cf=($,T)=>{let W=new Date($);if(f_(W))return W;let X=AR($);if(X!==void 0){let U=new Date(X);if(f_(U))return U}return T?B(T===!0?BZ($):T):void 0};var xZ=($,T)=>{let W=$.scanner.shiftUntil(uf[m_[T]]);if($.scanner.lookahead==="")return $.error(df(W,T));if($.scanner.shift(),T==="/"){try{new RegExp(W)}catch(X){B(String(X))}$.root=$.ctx.$.node("intersection",{domain:"string",pattern:W},{prereduced:!0})}else if(b4(T,fZ))$.root=$.ctx.$.node("unit",{unit:W});else{let X=h_(W,BZ(W));$.root=$.ctx.$.node("unit",{meta:W,unit:X})}},fZ={"'":1,'"':1},g_={"/":1,"'":1,'"':1},m_={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},uf={"'":($)=>$.lookahead==="'",'"':($)=>$.lookahead==='"',"/":($)=>$.lookahead==="/"},pf={'"':"double-quote","'":"single-quote","/":"forward slash"},df=($,T)=>`${T}${$} requires a closing ${pf[m_[T]]}`;var c_=($)=>`Private type references should not include '#'. Use '${$}' instead.`,V9="Optional definitions like 'string?' are only valid as properties in an object or tuple",K9="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple";var u_={">":!0,">=":!0},p_={"<":!0,"<=":!0};var VU={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},d_=($)=>`Unmatched )${$===""?"":` before ${$}`}`,A9=($)=>`Missing ${$}`,o_=($,T)=>`Left bounds are only valid when paired with right bounds (try ...${T}${$})`,E9=($)=>`Left-bounded expressions must specify their limits using < or <= (was ${$})`,l_=($,T,W,X)=>`An expression may have at most one left bound (parsed ${$}${VU[T]}, ${W}${VU[X]})`;var r_=($,T,W)=>n_($,T,W,[]),n_=($,T,W,X)=>{let U=W.parseUntilFinalizer();if(X.push(U.root),U.finalizer===">"){if(X.length!==T.params.length)return W.error(bZ($,T.names,X.map((w)=>w.expression)));return X}if(U.finalizer===",")return n_($,T,W,X);return U.error(A9(">"))},bZ=($,T,W)=>`${$}<${T.join(", ")}> requires exactly ${T.length} args (got ${W.length}${W.length===0?"":`: ${W.join(", ")}`})`;var yZ=($)=>{let T=$.scanner.shiftUntilNextTerminator();if(T==="keyof")$.addPrefix("keyof");else $.root=lf($,T)},of=($,T,W)=>{if(W.scanner.shiftUntilNonWhitespace(),W.scanner.shift()!=="<")return W.error(bZ($,T.names,[]));let U=r_($,T,W);return T(...U)},lf=($,T)=>rf($,T)??nf($,T)??$.error(T===""?$.scanner.lookahead==="#"?c_($.shiftedByOne().scanner.shiftUntilNextTerminator()):hZ($):jZ(T)),rf=($,T)=>{if($.ctx.args?.[T]){let X=$.ctx.args[T];if(typeof X!=="string")return X;return $.ctx.$.node("alias",{reference:X},{prereduced:!0})}let W=$.ctx.$.maybeResolve(T);if(W$(W,"root"))return W;if(W===void 0)return;if(W$(W,"generic"))return of(T,W,$);return B(`Unexpected resolution ${M$(W)}`)},nf=($,T)=>{let W=ER(T);if(W!==void 0)return $.ctx.$.node("unit",{unit:W});let X=DR(T);if(X!==void 0)return $.ctx.$.node("unit",{unit:X})},hZ=($)=>{let T=$.previousOperator();return T?gZ(T,$.scanner.unscanned):tf($.scanner.unscanned)},gZ=($,T="")=>`Token '${$}' requires a right operand${T?` before '${T}'`:""}`,tf=($)=>`Expected an expression${$?` before '${$}'`:""}`;var mZ=($)=>$.scanner.lookahead===""?$.error(hZ($)):$.scanner.lookahead==="("?$.shiftedByOne().reduceGroupOpen():$.scanner.lookaheadIsIn(g_)?xZ($,$.scanner.shift()):$.scanner.lookaheadIsIn(IT)?mZ($.shiftedByOne()):$.scanner.lookahead==="d"?$.scanner.nextLookahead in fZ?xZ($,`${$.scanner.shift()}${$.scanner.shift()}`):yZ($):yZ($);class r0 extends oQ{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>(this.lookahead in r0.terminatingChars))}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...IT};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=($,T)=>$===">"?T[0]==="="?T[1]==="=":T.trimStart()===""||b4(T.trimStart()[0],r0.terminatingChars):$==="="?T[0]!=="=":$===","||$==="?"}var t_=($,T)=>{let W=af($,T);if($.root.hasKind("unit")){if(typeof $.root.unit==="number"){$.reduceLeftBound($.root.unit,W),$.unsetRoot();return}if($.root.unit instanceof Date){let X=`d'${$.root.description??$.root.unit.toISOString()}'`;$.unsetRoot(),$.reduceLeftBound(X,W);return}}return ef($,W)},a_={"<":1,">":1,"=":1},af=($,T)=>$.scanner.lookaheadIs("=")?`${T}${$.scanner.shift()}`:T;var i_=($,T,W,X)=>{if(W.extends(y.intrinsic.number)){if(typeof T!=="number")return B(cZ($,T,X));return $==="=="?["min","max"]:$[0]===">"?["min"]:["max"]}if(W.extends(y.intrinsic.lengthBoundable)){if(typeof T!=="number")return B(cZ($,T,X));return $==="=="?["exactLength"]:$[0]===">"?["minLength"]:["maxLength"]}if(W.extends(y.intrinsic.Date))return $==="=="?["after","before"]:$[0]===">"?["after"]:["before"];return B(gR(W.expression))},sf=($)=>({rule:b_($.limit)?y_($.limit):$.limit,exclusive:$.comparator.length===1}),ef=($,T)=>{let W=$.unsetRoot(),X=$.scanner.location;$.parseOperand();let U=$.unsetRoot(),w=$.scanner.sliceChars(X,$.scanner.location);if($.root=W,!U.hasKind("unit")||typeof U.unit!=="number"&&!(U.unit instanceof Date))return $.error(cZ(T,w,"right"));let Y=U.unit,G=T.length===1,H=i_(T,typeof Y==="number"?Y:w,W,"right");for(let F of H)$.constrainRoot(F,T==="=="?{rule:Y}:{rule:Y,exclusive:G});if(!$.branches.leftBound)return;if(!b4(T,p_))return $.error(E9(T));let z=i_($.branches.leftBound.comparator,$.branches.leftBound.limit,W,"left");$.constrainRoot(z[0],sf($.branches.leftBound)),$.branches.leftBound=null},cZ=($,T,W)=>`Comparator ${W==="left"?VU[$]:$} must be ${W==="left"?"preceded":"followed"} by a corresponding literal (was ${T})`;var s_=($)=>{$.scanner.shiftUntilNonWhitespace();let T=$.scanner.shiftUntilNextTerminator();$.root=$.root.brand(T)};var $k=($)=>{let T=$.scanner.shiftUntilNextTerminator(),W=MR(T,{errorOnFail:e_(T)});if(W===0)$.error(e_(0));$.root=$.root.constrain("divisor",W)},e_=($)=>`% operator must be followed by a non-zero integer literal (was ${$})`;var uZ=($)=>{let T=$.scanner.shift();return T===""?$.finalize(""):T==="["?$.scanner.shift()==="]"?$.setRoot($.root.array()):$.error($b):T==="|"?$.scanner.lookahead===">"?$.shiftedByOne().pushRootToBranch("|>"):$.pushRootToBranch(T):T==="&"?$.pushRootToBranch(T):T===")"?$.finalizeGroup():r0.lookaheadIsFinalizing(T,$.scanner.unscanned)?$.finalize(T):b4(T,a_)?t_($,T):T==="%"?$k($):T==="#"?s_($):(T in IT)?uZ($):$.error(M9(T))},M9=($,T="")=>`'${$}' is not allowed here${T&&` (should be ${T})`}`,$b="Missing expected ']'";var Tk=($)=>{let T=$.unsetRoot();$.parseOperand();let W=$.unsetRoot();if(!W.hasKind("unit"))return $.error(Tb(W.expression));let X=W.unit instanceof Date?()=>new Date(W.unit):W.unit;return[T,"=",X]},Tb=($)=>`Default value '${$}' must a literal value`;var pZ=($,T)=>{let W=T.$.maybeResolveRoot($);if(W)return W;if($.endsWith("[]")){let w=T.$.maybeResolveRoot($.slice(0,-2));if(w)return w.array()}let X=new KU(new r0($),T),U=Wb(X);if(X.finalizer===">")B(M9(">"));return U},Wb=($)=>{$.parseOperand();let T=n8($).root;if(!T)return I$(`Root was unexpectedly unset after parsing string '${$.scanner.scanned}'`);if($.finalizer==="=")T=Tk($);else if($.finalizer==="?")T=[T,"?"];if($.scanner.shiftUntilNonWhitespace(),$.scanner.lookahead)B(M9($.scanner.lookahead));return T},n8=($)=>{while($.finalizer===void 0)Ub($);return $},Ub=($)=>$.hasRoot()?$.parseOperator():$.parseOperand();class KU{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor($,T){this.scanner=$,this.ctx=T}error($){return B($)}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(A9(")"));this.finalizeBranches(),this.finalizer=$}reduceLeftBound($,T){let W=VU[T];if(!b4(W,u_))return this.error(E9(T));if(this.branches.leftBound)return this.error(l_(this.branches.leftBound.limit,this.branches.leftBound.comparator,$,W));this.branches.leftBound={comparator:W,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(d_(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():I$(`Unexpected prefix '${$}'`)}}pushRootToBranch($){this.assertRangeUnset(),this.applyPrefixes();let T=this.root;if(this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(T)??T,$==="&")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 n8(new KU(this.scanner,this.ctx))}parseOperator(){return uZ(this)}parseOperand(){return mZ(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(o_(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 Xb="An empty string is not a valid generic parameter name",D9=($,T,W)=>{$.shiftUntilNonWhitespace();let X=$.shiftUntilNextTerminator();if(X===""){if($.lookahead===""&&T.length)return T;return B(Xb)}return $.shiftUntilNonWhitespace(),wb($,X,T,W)},Wk="extends ",wb=($,T,W,X)=>{if($.shiftUntilNonWhitespace(),$.unscanned.startsWith(Wk))$.jumpForward(Wk.length);else{if($.lookahead===",")$.shift();return W.push(T),D9($,W,X)}let U=n8(new KU($,X));return W.push([T,U.root]),D9($,W,X)};class dZ extends h1{$;constructor($){super((...T)=>new i8($)(...T),{bind:$});this.$=$}in($){return new i8(this.$,$===void 0?void 0:this.$.parse($))}at($,T){return new i8(this.$).at($,T)}case($,T){return new i8(this.$).case($,T)}}class i8 extends h1{$;in;key;branches=[];constructor($,T){super((W)=>this.caseEntries(Object.entries(W).map(([X,U])=>X==="default"?[X,U]:[this.$.parse(X),U])));this.$=$,this.in=T}at($,T){if(this.key)B(Gb);if(this.branches.length)B(Yb);return this.key=$,T?this.match(T):this}case($,T){return this.caseEntry(this.$.parse($),T)}caseEntry($,T){let X=(this.key?this.$.parse({[this.key]:$}):$).pipe(T);return this.branches.push(X),this}match($){return this($)}strings($){return this.caseEntries(Object.entries($).map(([T,W])=>T==="default"?[T,W]:[this.$.node("unit",{unit:T}),W]))}caseEntries($){for(let T=0;T<$.length;T++){let[W,X]=$[T];if(W==="default"){if(T!==$.length-1)B("default may only be specified as the last key of a switch definition");return this.default(X)}if(typeof X!=="function")return B(`Value for case "${W}" must be a function (was ${f4(X)})`);this.caseEntry(W,X)}return this}default($){if(typeof $==="function")this.case(G$.unknown,$);let T={branches:this.branches,ordered:!0};if($==="never"||$==="assert")T.meta={onFail:Uk};let W=this.$.node("union",T);if(!this.in)return this.$.finalize(W);let X=this.in.pipe(W);if($==="never"||$==="assert")X=X.configureReferences({onFail:Uk},"self");return this.$.finalize(X)}}var Uk=($)=>$.throw(),Yb="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",Gb="At most one key matcher may be specified per expression";var N9=($,T)=>{if(o$($)){if($[1]==="=")return[T.$.parseOwnDefinitionFormat($[0],T),"=",$[2]];if($[1]==="?")return[T.$.parseOwnDefinitionFormat($[0],T),"?"]}return L9($,T)},Xk="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",wk="Only required keys may specify default values, e.g. { value: 'number = 0' }";var Yk=($,T)=>{let W,X={},U=IW($);for(let[Y,G]of U){let H=Fb(Y);if(H.kind==="spread"){if(!H0(X))return B(Hb);let Z=T.$.parseOwnDefinitionFormat(G,T);if(Z.equals(G$.object))continue;if(!Z.hasKind("intersection")||!Z.basis?.equals(G$.object))return B(Ob(Z.expression));W=Z.structure;continue}if(H.kind==="undeclared"){if(G!=="reject"&&G!=="delete"&&G!=="ignore")B(zb(G));X.undeclared=G;continue}let z=N9(G,T),F=H;if(H.kind==="required"){if(!o$(z))oZ(X,"required",{key:H.normalized,value:z},T);else oZ(X,"optional",z[1]==="="?{key:H.normalized,value:z[0],default:z[2]}:{key:H.normalized,value:z[0]},T);continue}if(o$(z)){if(z[1]==="?")B(Xk);if(z[1]==="=")B(wk)}if(H.kind==="optional"){oZ(X,"optional",{key:H.normalized,value:z},T);continue}let O=T.$.parseOwnDefinitionFormat(F.normalized,T),Q=O9(O,z,T.$);if(Q.index)X.index=C$(X.index,Q.index);if(Q.required)X.required=C$(X.required,Q.required)}let w=T.$.node("structure",X);return T.$.parseSchema({domain:"object",structure:W?.merge(w)??w})},oZ=($,T,W,X)=>{$[T]=C$($[T],X.$.node(T,W))},zb=($)=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${M$($)})`,Hb="Spread operator may only be used as the first key in an object",Fb=($)=>typeof $==="symbol"?{kind:"required",normalized:$}:$.at(-1)==="?"?$.at(-2)===P8?{kind:"required",normalized:`${$.slice(0,-2)}?`}:{kind:"optional",normalized:$.slice(0,-1)}:$[0]==="["&&$.at(-1)==="]"?{kind:"index",normalized:$.slice(1,-1)}:$[0]===P8&&$[1]==="["&&$.at(-1)==="]"?{kind:"required",normalized:$.slice(1)}:$==="..."?{kind:"spread"}:$==="+"?{kind:"undeclared"}:{kind:"required",normalized:$==="\\..."?"...":$==="\\+"?"+":$},Ob=($)=>`Spread operand must resolve to an object literal type (was ${$})`;var zk=($,T)=>Lb($)?Qk[$[0]]($,T):Db($)?Ok[$[1]]($,T):null,Qb=($,T)=>T.$.parseOwnDefinitionFormat($[1],T).keyof(),lZ=($,T)=>{if($[2]===void 0)return B(gZ($[1],""));let W=T.$.parseOwnDefinitionFormat($[0],T),X=T.$.parseOwnDefinitionFormat($[2],T);if($[1]==="|")return T.$.node("union",{branches:[W,X]});let U=$[1]==="&"?r6(W,X,T.$):y8(W,X,T.$);if(U instanceof r)return U.throw();return U},Zb=($,T)=>T.$.parseOwnDefinitionFormat($[0],T).array(),Vb=($,T)=>{if(typeof $[2]!=="function")return B(Hk("=>",$[2]));return T.$.parseOwnDefinitionFormat($[0],T).pipe($[2])},Hk=($,T)=>`${$===":"?"Narrow":"Morph"} expression requires a function following '${$}' (was ${typeof T})`,Kb=($,T)=>{if(typeof $[2]!=="function")return B(Hk(":",$[2]));return T.$.parseOwnDefinitionFormat($[0],T).constrain("predicate",$[2])},Ab=($,T)=>T.$.parseOwnDefinitionFormat($[0],T).configureReferences($[2],"shallow"),Fk=($)=>$,Eb=Fk({"[]":Zb,"?":()=>B(V9)}),Mb=Fk({"|":lZ,"&":lZ,":":Kb,"=>":Vb,"|>":lZ,"@":Ab,"=":()=>B(K9)}),Ok={...Eb,...Mb},Db=($)=>Ok[$[1]]!==void 0,Nb=($)=>$,Qk=Nb({keyof:Qb,instanceof:($,T)=>{if(typeof $[1]!=="function")return B(Gk(k8($[1])));let W=$.slice(1).map((X)=>typeof X==="function"?T.$.node("proto",{proto:X}):B(Gk(k8(X))));return W.length===1?W[0]:T.$.node("union",{branches:W})},"===":($,T)=>T.$.units($.slice(1))}),Lb=($)=>Qk[$[0]]!==void 0,Gk=($)=>`Expected a constructor following 'instanceof' operator (was ${$})`;var Kk=($,T)=>{let W=[{}],X=0;while(X<$.length){let U=!1;if($[X]==="..."&&X<$.length-1)U=!0,X++;let w=N9($[X],T),[Y,G,H]=!o$(w)?[w]:w;if(X++,U){if(!Y.extends(y.intrinsic.Array))return B(_b(Y.expression));W=W.flatMap((z)=>Y.distribute((F)=>Rb($9(z),F)))}else W=W.map((z)=>{if(G==="?")return Ak(z,Y);if(G==="=")return Jb(z,Y,H);return rZ(z,Y)})}return T.$.parseSchema(W.map((U)=>H0(U)?{proto:Array,exactLength:0}:{proto:Array,sequence:U}))},rZ=($,T)=>{if($.defaultables||$.optionals)return B($.variadic?_Z:kb);if($.variadic)$.postfix=C$($.postfix,T);else $.prefix=C$($.prefix,T);return $},Ak=($,T)=>{if($.variadic)return B(Ek);return $.optionals=C$($.optionals,T),$},Jb=($,T,W)=>{if($.variadic)return B(Ek);if($.optionals)return B(vb);return $.defaultables=C$($.defaultables,[[T,W]]),$},Zk=($,T)=>{if($.postfix)B(Vk);if($.variadic){if(!$.variadic.equals(T))B(Vk)}else $.variadic=T.internal;return $},Rb=($,T)=>{let W=T.select({method:"find",kind:"sequence"});if(!W)return Zk($,y.intrinsic.unknown);if(W.prefix)for(let X of W.prefix)rZ($,X);if(W.optionals)for(let X of W.optionals)Ak($,X);if(W.variadic)Zk($,W.variadic);if(W.postfix)for(let X of W.postfix)rZ($,X);return $},_b=($)=>`Spread element must be an array (was ${$})`,Vk="A tuple may have at most one variadic element",kb="A required element may not follow an optional element",Ek="An optional element may not follow a variadic element";var vb="A defaultable element may not follow an optional element without a default";var Pb={},L9=($,T)=>{if(typeof $==="string"){if(T.args&&Object.keys(T.args).some((X)=>$.includes(X)))return pZ($,T);let W=Pb[T.$.name]??={};return W[$]??=pZ($,T)}return p6($,"object")?qb($,T):B(nZ(f4($)))},qb=($,T)=>{let W=_8($);switch(W){case void 0:if(W$($,"root"))return $;return Yk($,T);case"Array":return Cb($,T);case"RegExp":return T.$.node("intersection",{domain:"string",pattern:$},{prereduced:!0});case"Function":{let X=jT($)?$():$;if(W$(X,"root"))return X;return B(nZ("Function"))}default:return B(nZ(W??M$($)))}},Cb=($,T)=>zk($,T)??Kk($,T),nZ=($)=>`Type definitions must be strings or objects (was ${$})`;class iZ extends h1{constructor($){let T=Object.assign({errors:o6,hkt:X6,$,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((...W)=>{if(W.length===1)return $.parse(W[0]);if(W.length===2&&typeof W[0]==="string"&&W[0][0]==="<"&&W[0].at(-1)===">"){let X=W[0].slice(1,-1),U=$.parseGenericParams(X,{});return new bT(U,W[1],$,$,null)}return $.parse(W)},{bind:$,attach:T})}}var AU=y;class J9 extends Q9{get ambientAttachments(){if(!AU.typeAttachments)return;return this.cacheGetter("ambientAttachments",E$(AU.typeAttachments,($,T)=>[$,this.bindReference(T)]))}preparseOwnAliasEntry($,T){let W=$.indexOf("<");if(W===-1){if(W$(T,"module")||W$(T,"generic"))return[$,T];let w=this.name==="ark"?$:$==="root"?this.name:`${this.name}.${$}`,Y=this.resolvedConfig.keywords?.[w];if(Y)T=[T,"@",Y];return[$,T]}if($.at(-1)!==">")B("'>' must be the last character of a generic declaration in a scope");let X=$.slice(0,W),U=$.slice(W+1,-1);return[X,()=>{let w=this.parseGenericParams(U,{alias:X});return bR(w,T,this)}]}parseGenericParams($,T){return D9(new r0($),[],this.createParseContext({...T,def:$,prefix:"generic"}))}normalizeRootScopeValue($){if(jT($)&&!W$($,"generic"))return $();return $}preparseOwnDefinitionFormat($,T){return{...T,def:$,prefix:T.alias??"type"}}parseOwnDefinitionFormat($,T){if(!(T.alias&&(T.alias in this.aliases))&&!T.args)T.args={this:T.id};let X=L9($,T);if(o$(X)){if(X[1]==="=")return B(K9);if(X[1]==="?")return B(V9)}return X}unit=($)=>this.units([$]);valueOf=($)=>this.units(WR($));enumerated=(...$)=>this.units($);instanceOf=($)=>this.node("proto",{proto:$},{prereduced:!0});or=(...$)=>this.schema($.map((T)=>this.parse(T)));and=(...$)=>$.reduce((T,W)=>T.and(this.parse(W)),this.intrinsic.unknown);merge=(...$)=>$.reduce((T,W)=>T.merge(this.parse(W)),this.intrinsic.object);pipe=(...$)=>this.intrinsic.unknown.pipe(...$);match=new dZ(this);declare=()=>({type:this.type});define($){return $}type=new iZ(this);static scope=($,T={})=>new J9($,T);static module=($,T={})=>this.scope($,T).export()}var tZ=Object.assign(J9.scope,{define:($)=>$}),q$=J9;class Mk extends X6{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}var Sb=v1(["base",G$.object],["props",G$.object])(($)=>$.base.merge($.props),Mk),Dk=q$.module({Key:G$.key,Merge:Sb});class Nk extends X6{}var jb=v1("element")(($)=>{let T=$.element.exclude(G$.Array),W=T.array();return T.rawOr(W).pipe(ST).distribute((X)=>X.assertHasKind("morph").declareOut(W),g$)},Nk),Lk=q$.module({root:G$.Array,readonly:"root",index:G$.nonNegativeIntegerString,liftFrom:jb},{name:"Array"});var aZ=g$(["string",xW.FileConstructor]),Ib=aZ.rawOr(aZ.array()),Jk=g$({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:Ib}}),Rk=q$.module({root:["instanceof",FormData],value:aZ,parsed:Jk,parse:g$({in:FormData,morphs:($)=>{let T={};for(let[W,X]of $)if(W in T){let U=T[W];if(typeof U==="string"||U instanceof xW.FileConstructor)T[W]=[U,X];else U.push(X)}else T[W]=X;return T},declaredOut:Jk})},{name:"FormData"});var _k=q$.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 Bb={Boolean:1,Number:1,String:1},kk=q$.module({...E$({...yQ,...gQ},($,T)=>($ in Bb)?[]:[$,["instanceof",T]]),Array:Lk,TypedArray:_k,FormData:Rk});var xb=g$({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"}),fb=g$({domain:"number",divisor:1}),R9=q$.module({root:G$.number,integer:fb,epoch:xb,safe:g$({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 w4=($,T,W)=>{let X={domain:"string",pattern:{rule:$.source,flags:$.flags,meta:T}};if(W)X.meta={format:W};return ZU("intersection",X)},vk=w4(q8,"a well-formed integer string"),hk=q$.module({root:vk,parse:g$({in:vk,morphs:($,T)=>{let W=Number.parseInt($);return Number.isSafeInteger(W)?W:T.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:G$.integer})},{name:"string.integer"}),bb=w4(/^[\dA-Fa-f]+$/,"hex characters only"),yb=q$.module({root:w4(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:w4(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),Pk=w4(/^[A-Z].*$/,"capitalized"),hb=q$.module({root:g$({in:"string",morphs:($)=>$.charAt(0).toUpperCase()+$.slice(1),declaredOut:Pk}),preformatted:Pk},{name:"string.capitalize"}),gb=($)=>{let T=$.replaceAll(/[ -]+/g,""),W=0,X,U,w=!1;for(let Y=T.length-1;Y>=0;Y--){if(X=T.substring(Y,Y+1),U=Number.parseInt(X,10),w)U*=2,W+=U>=10?U%10+1:U;else W+=U;w=!w}return!!(W%10===0?T:!1)},mb=/^(?: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}))$/,cb=g$({domain:"string",pattern:{meta:"a credit card number",rule:mb.source},predicate:{meta:"a credit card number",predicate:gb}});var ub=/^([+-]?\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 pb=($)=>!Number.isNaN(new Date($).valueOf()),qk=g$({domain:"string",predicate:{meta:"a parsable date",predicate:pb}}).assertHasKind("intersection"),Ck=hk.root.internal.narrow(($,T)=>{let W=Number.parseInt($),X=R9.epoch(W);if(X instanceof o6)return T.errors.merge(X),!1;return!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),db=q$.module({root:Ck,parse:g$({in:Ck,morphs:($)=>new Date($),declaredOut:G$.Date})},{name:"string.date.epoch"}),Sk=w4(ub,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),ob=q$.module({root:Sk,parse:g$({in:Sk,morphs:($)=>new Date($),declaredOut:G$.Date})},{name:"string.date.iso"}),lb=q$.module({root:qk,parse:g$({declaredIn:qk,in:"string",morphs:($,T)=>{let W=new Date($);if(Number.isNaN(W.valueOf()))return T.error("a parsable date");return W},declaredOut:G$.Date}),iso:ob,epoch:db},{name:"string.date"}),rb=w4(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),jk="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",yT=`(${jk}[.]){3}${jk}`,nb=new RegExp(`^${yT}$`),R4="(?:[0-9a-fA-F]{1,4})",ib=new RegExp(`^((?:${R4}:){7}(?:${R4}|:)|(?:${R4}:){6}(?:${yT}|:${R4}|:)|(?:${R4}:){5}(?::${yT}|(:${R4}){1,2}|:)|(?:${R4}:){4}(?:(:${R4}){0,1}:${yT}|(:${R4}){1,3}|:)|(?:${R4}:){3}(?:(:${R4}){0,2}:${yT}|(:${R4}){1,4}|:)|(?:${R4}:){2}(?:(:${R4}){0,3}:${yT}|(:${R4}){1,5}|:)|(?:${R4}:){1}(?:(:${R4}){0,4}:${yT}|(:${R4}){1,6}|:)|(?::((?::${R4}){0,5}:${yT}|(?::${R4}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),tb=q$.module({root:["v4 | v6","@","an IP address"],v4:w4(nb,"an IPv4 address","ipv4"),v6:w4(ib,"an IPv6 address","ipv6")},{name:"string.ip"}),EU="a JSON string",gk=($)=>{if(!($ instanceof SyntaxError))throw $;return`must be ${EU} (${$})`},ab=g$({meta:EU,domain:"string",predicate:{meta:EU,predicate:($,T)=>{try{return JSON.parse($),!0}catch(W){return T.reject({code:"predicate",expected:EU,problem:gk(W)})}}}}),sb=($,T)=>{if($.length===0)return T.error({code:"predicate",expected:EU,actual:"empty"});try{return JSON.parse($)}catch(W){return T.error({code:"predicate",expected:EU,problem:gk(W)})}},eb=q$.module({root:ab,parse:g$({meta:"safe JSON string parser",in:"string",morphs:sb,declaredOut:G$.jsonObject})},{name:"string.json"}),Ik=w4(/^[a-z]*$/,"only lowercase letters"),$y=q$.module({root:g$({in:"string",morphs:($)=>$.toLowerCase(),declaredOut:Ik}),preformatted:Ik},{name:"string.lower"}),mk=["NFC","NFD","NFKC","NFKD"],t8=E$(mk,($,T)=>[T,g$({domain:"string",predicate:(W)=>W.normalize(T)===W,meta:`${T}-normalized unicode`})]),_9=E$(mk,($,T)=>[T,g$({in:"string",morphs:(W)=>W.normalize(T),declaredOut:t8[T]})]),Ty=q$.module({root:_9.NFC,preformatted:t8.NFC},{name:"string.normalize.NFC"}),Wy=q$.module({root:_9.NFD,preformatted:t8.NFD},{name:"string.normalize.NFD"}),Uy=q$.module({root:_9.NFKC,preformatted:t8.NFKC},{name:"string.normalize.NFKC"}),Xy=q$.module({root:_9.NFKD,preformatted:t8.NFKD},{name:"string.normalize.NFKD"}),wy=q$.module({root:"NFC",NFC:Ty,NFD:Wy,NFKC:Uy,NFKD:Xy},{name:"string.normalize"}),Bk=w4(az,"a well-formed numeric string"),Yy=q$.module({root:Bk,parse:g$({in:Bk,morphs:($)=>Number.parseFloat($),declaredOut:G$.number})},{name:"string.numeric"}),xk="a regex pattern",Gy=g$({domain:"string",predicate:{meta:xk,predicate:($,T)=>{try{return new RegExp($),!0}catch(W){return T.reject({code:"predicate",expected:xk,problem:String(W)})}}},meta:{format:"regex"}}),zy=/^(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-]+)*))?$/,Hy=w4(zy,"a semantic version (see https://semver.org/)"),fk=w4(/^\S.*\S$|^\S?$/,"trimmed"),Fy=q$.module({root:g$({in:"string",morphs:($)=>$.trim(),declaredOut:fk}),preformatted:fk},{name:"string.trim"}),bk=w4(/^[A-Z]*$/,"only uppercase letters"),Oy=q$.module({root:g$({in:"string",morphs:($)=>$.toUpperCase(),declaredOut:bk}),preformatted:bk},{name:"string.upper"}),Qy=($)=>{if(URL.canParse)return URL.canParse($);try{return new URL($),!0}catch{return!1}},yk=g$({domain:"string",predicate:{meta:"a URL string",predicate:Qy},meta:{format:"uri"}}),Zy=q$.module({root:yk,parse:g$({declaredIn:yk,in:"string",morphs:($,T)=>{try{return new URL($)}catch{return T.error("a URL string")}},declaredOut:g$(URL)})},{name:"string.url"}),Vy=q$.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:w4(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:w4(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:w4(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:w4(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:w4(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:w4(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:w4(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:w4(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),ck=q$.module({root:G$.string,alpha:w4(/^[A-Za-z]*$/,"only letters"),alphanumeric:w4(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:bb,base64:yb,capitalize:hb,creditCard:cb,date:lb,digits:w4(/^\d*$/,"only digits 0-9"),email:rb,integer:hk,ip:tb,json:eb,lower:$y,normalize:wy,numeric:Yy,regex:Gy,semver:Hy,trim:Fy,upper:Oy,url:Zy,uuid:Vy},{name:"string"});var uk=q$.module({bigint:G$.bigint,boolean:G$.boolean,false:G$.false,never:G$.never,null:G$.null,number:G$.number,object:G$.object,string:G$.string,symbol:G$.symbol,true:G$.true,unknown:G$.unknown,undefined:G$.undefined}),pk=q$.module({root:G$.unknown,any:G$.unknown},{name:"unknown"}),Ky=q$.module({root:G$.jsonObject,stringify:ZU("morph",{in:G$.jsonObject,morphs:($)=>JSON.stringify($),declaredOut:G$.string})},{name:"object.json"}),dk=q$.module({root:G$.object,json:Ky},{name:"object"});class ok extends X6{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}var Ay=v1(["K",G$.key],"V")(($)=>({domain:"object",index:{signature:$.K,value:$.V}}),ok);class lk extends X6{description='pick a set of properties from an object like `Pick(User, "name | age")`'}var Ey=v1(["T",G$.object],["K",G$.key])(($)=>$.T.pick($.K),lk);class rk extends X6{description='omit a set of properties from an object like `Omit(User, "age")`'}var My=v1(["T",G$.object],["K",G$.key])(($)=>$.T.omit($.K),rk);class nk extends X6{description="make all named properties of an object optional like `Partial(User)`"}var Dy=v1(["T",G$.object])(($)=>$.T.partial(),nk);class ik extends X6{description="make all named properties of an object required like `Required(User)`"}var Ny=v1(["T",G$.object])(($)=>$.T.required(),ik);class tk extends X6{description='exclude branches of a union like `Exclude("boolean", "true")`'}var Ly=v1("T","U")(($)=>$.T.exclude($.U),tk);class ak extends X6{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}var Jy=v1("T","U")(($)=>$.T.extract($.U),ak),sk=q$.module({Exclude:Ly,Extract:Jy,Omit:My,Partial:Dy,Pick:Ey,Record:Ay,Required:Ny});var hT=tZ({...uk,...sk,...kk,...Dk,string:ck,number:R9,object:dk,unknown:pk},{prereducedAliases:!0,name:"ark"}),y4=hT.export();Object.assign(AU.ambient,y4);AU.typeAttachments={string:y4.string.root,number:y4.number.root,bigint:y4.bigint,boolean:y4.boolean,symbol:y4.symbol,undefined:y4.undefined,null:y4.null,object:y4.object.root,unknown:y4.unknown.root,false:y4.false,true:y4.true,never:y4.never,arrayIndex:y4.Array.index,Key:y4.Key,Record:y4.Record,Array:y4.Array.root,Date:y4.Date};var c1=Object.assign(hT.type,AU.typeAttachments),Ry=hT.match,_y=hT.generic,T9$=hT.schema,ky=hT.define,vy=hT.declare;var Py="__vite_start_time"in globalThis,qy=typeof window!=="undefined",D9$="vitest"in globalThis,n0=c1("string"),ek=c1('"true" | "false" | undefined'),i0=xQ({isServer:!Py&&!qy,server:{CI:c1("string | undefined").pipe(Boolean),POSTGRES_USER:n0,POSTGRES_PASSWORD:n0,POSTGRES_DATABASE:n0,POSTGRES_HOST:n0,POSTGRES_PORT:n0.pipe(($)=>Number.parseInt($,10)),BACKEND_PORT:n0.pipe(($)=>Number.parseInt($,10)),RUN_WORKERS_FROM_SOURCE:ek.pipe(($)=>$==="true"),FRONTEND_PORT:n0.pipe(($)=>Number.parseInt($,10)),FRONTEND_ORIGINS:n0.pipe.try(($)=>JSON.parse($),c1("string[]")),API_KEY_OPENAI:c1("string | undefined"),API_KEY_RESEND:c1("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:n0,VITE_DEV_FRONTEND_HOST:c1("string | undefined"),VITE_DEV_HTTPS:ek.pipe(($)=>$==="true")},runtimeEnv:import.meta.env,emptyStringAsUndefined:!0});var eZ={};e0(eZ,{users:()=>yW,untrackedUserColumnNames:()=>Cy,twoFactorMethod:()=>Xv,trackedUserColumnName:()=>Sy,trackableUserColumnNames:()=>Wv,signInHistory:()=>Iy,role:()=>Tv,players:()=>sZ,passwordResetAttempts:()=>By,games:()=>v9,banishedIps:()=>P9,accountActions:()=>jy,accountAction:()=>Uv});function gT(){return W6({length:24}).$type()}function $v($){return R`lower(${$})`}var k9=R`TO_CHAR(NOW() AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`,Tv=$8("role",["admin","user"]),yW=PT("users",{id:L1().primaryKey().defaultRandom(),username:W6({length:16}).notNull(),emailOffered:W6({length:254}).notNull(),emailVerified:W6({length:254}),password:W6({length:254}),createdAtIso:gT().notNull().default(k9),createdIp:W6({length:45}).notNull(),isActive:Y8().notNull().default(!1),verifiedAtIso:gT(),userRole:Tv().default("user")},($)=>[NQ("usernameUniqueIndex").on($v($.username)),NQ("emailVerifiedUniqueIndex").on($v($.emailVerified))]),Cy=["id","createdAtIso","createdIp","isActive","verifiedAtIso"],Wv=["username","emailOffered","emailVerified","password","userRole"],Sy=$8("trackedUserColumnName",Wv),Uv=$8("accountAction",["cooldown","confirmEmail","signIn","resetPassword"]),jy=PT("accountActions",{userId:L1().references(()=>yW.id).primaryKey(),action:Uv().notNull(),code:W6({length:254}).notNull(),wrongCodeCount:G8().notNull().default(0),expiresAtIso:gT().notNull()}),v9=PT("games",{id:L1().primaryKey().defaultRandom()}),sZ=PT("players",{userId:L1().notNull().references(()=>yW.id,{onDelete:"cascade"}),gameId:L1().notNull().references(()=>v9.id,{onDelete:"cascade"}),score:G8().notNull()},($)=>[dL({name:"players_userId_gameId_pk",columns:[$.userId,$.gameId]})]),Iy=PT("signInHistory",{id:L1().primaryKey().defaultRandom(),userId:L1().references(()=>yW.id,{onDelete:"cascade"}),signInTimeIso:gT().notNull().default(k9),ipAddress:W6({length:45}).notNull(),userAgent:W6({length:1024}),successful:Y8().notNull().default(!1)}),Xv=$8("twoFactorMethod",["email","phone"]),By=PT("passwordResetAttempts",{id:L1().primaryKey().defaultRandom(),userId:L1().notNull().references(()=>yW.id,{onDelete:"cascade"}),requestedIp:W6({length:45}).notNull(),requestedAtIso:gT().notNull().default(k9),succeededIp:W6({length:45}),succeededAtIso:gT(),verificationMethod:Xv().notNull()}),P9=PT("banishedIps",{ip:W6({length:45}).primaryKey(),reason:W6({length:2048}).notNull(),banishedAtIso:gT().notNull().default(k9),banishedUntilIso:gT()});var __dirname="/home/runner/work/wayforge/wayforge/apps/tempest.games/src/database";class $V{options;sql;drizzle;observers=new Map;async setupTriggersAndNotifications(){await this.sql.file(xy.resolve(__dirname,"notify_update.sql"));let $=[u4(yW),u4(v9),u4(sZ)];await this.sql`SELECT create_notify_triggers(${this.sql.array($)})`,await this.sql.listen("table_update",(T)=>{let W=T.split(","),X=W[0],U=W[1],w=`${X}("${U}")`;if(this.observers.has(w))this.observers.get(w).next(w)})}constructor($=!1,T={host:i0.POSTGRES_HOST,port:i0.POSTGRES_PORT,user:i0.POSTGRES_USER,password:i0.POSTGRES_PASSWORD,database:i0.POSTGRES_DATABASE}){this.options=T,this.sql=t2(T),this.drizzle=iz(this.sql,{schema:eZ,logger:$})}observe($,T){if(!this.observers.has($))this.observers.set($,new b$);this.observers.get($).subscribe("SINGLETON",T)}}import{resolve as yy}from"path";import{existsSync as TV,mkdirSync as wv,readFileSync as fy,readdirSync as Yv,rmSync as Gv,statSync as zv,writeFileSync as by}from"fs";import{resolve as WV}from"path";var Hv=class{rootDir;get initialized(){return TV(this.rootDir)}initialize(){if(!this.initialized)wv(this.rootDir,{recursive:!0})}constructor($){if(this.rootDir=$.path,$.eagerInit)this.initialize()}getItem($){let T=WV(this.rootDir,$);if(TV(T))return fy(T,"utf-8");return null}setItem($,T){this.initialize();let W=WV(this.rootDir,$);by(W,T)}removeItem($){let T=WV(this.rootDir,$);if(TV(T))this.initialize(),Gv(T)}key($){return Yv(this.rootDir).sort((X,U)=>{let w=zv(X);return zv(U).ctimeMs-w.ctimeMs})[$]??null}clear(){Gv(this.rootDir,{recursive:!0}),wv(this.rootDir,{recursive:!0})}get length(){return Yv(this.rootDir).length}};var UV=new Hv({path:yy(process.cwd(),"storage")});function Fv($){return $.toString({smallestUnit:"millisecond"})}function g9$($){return Zz.Instant.from($)}import*as q9 from"fs";import*as Ov from"readline";function hy($){let W=$.replace(":","T").replace(" ","").replace(/(\d{2})\/(\w{3})\/(\d{4})T(.+)/,(X,U,w,Y,G)=>{let z={Jan:"01",Feb:"02",Mar:"03",Apr:"04",May:"05",Jun:"06",Jul:"07",Aug:"08",Sep:"09",Oct:"10",Nov:"11",Dec:"12"}[w];return`${Y}-${z}-${U}T${G}`});return new Date(W)}async function Qv($,T="/var/log/nginx/access.log",W=new Date){let X=new Map;if(!q9.existsSync(T))return $.error(`Log file not found: ${T}`),X;let U=q9.createReadStream(T),w=Ov.createInterface({input:U,crlfDelay:Number.POSITIVE_INFINITY}),Y=new Date(W.getTime()-3600000);return w.on("line",(G)=>{let H=/^(?<ip>\S+) \S+ \S+ \[(?<dateTime>.*?)\]/,z=G.match(H);if(z?.groups){let F=z.groups.ip,O=z.groups.dateTime,Q=hy(O);if(!Number.isNaN(Q.getTime())){if(Q>=Y&&Q<=W){let Z=X.get(F);if(!Z)Z=[],X.set(F,Z);Z.push(G)}}else $.error(`Failed to parse date: ${O}`)}}),new Promise((G,H)=>{w.on("error",(z)=>{H(z)}),w.on("close",()=>{G(X)})})}function Zv($){return $.toJsonSchema()}var gy=["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(`
|
|
155
|
-
`);function
|
|
178
|
+
`)+"}");class V9{config;resolvedConfig;name;get[S6](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor($,T){if(this.config=Bw(y.config,T),this.resolvedConfig=Bw(y.resolvedConfig,T),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(IZ).length}`,this.name in IZ)I(`A Scope already named ${this.name} already exists`);IZ[this.name]=this;let W=Object.entries($).map((U)=>this.preparseOwnAliasEntry(...U));for(let[U,X]of W){let w=U;if(U[0]==="#"){if(w=U.slice(1),w in this.aliases)I(x_(w));this.aliases[w]=X}else{if(w in this.aliases)I(x_(U));this.aliases[w]=X,this.exportedNames.push(w)}if(!W$(X,"module")&&!W$(X,"generic")&&!jT(X)){let Y=this.preparseOwnDefinitionFormat(X,{alias:w});this.resolutions[w]=W$(Y,"root")?this.bindReference(Y):this.createParseContext(Y).id}}f_??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[f_.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=y.intrinsic?E$(y.intrinsic,(U,X)=>U.startsWith("json")?[]:[U,this.bindReference(X)]):{}}cacheGetter($,T){return Object.defineProperty(this,$,{value:T}),T}get internal(){return this}_json;get json(){if(!this._json)this.export();return this._json}defineSchema($){return $}generic=(...$)=>{let T=this;return(W,U)=>new bT($,U?new Y9(W):W,T,T,U??null)};units=($,T)=>{let W=[];for(let X of $)if(!W.includes(X))W.push(X);let U=W.map((X)=>this.node("unit",{unit:X},T));return this.node("union",U,{...T,prereduced:!0})};lazyResolutions=[];lazilyResolve($,T){let W=this.node("alias",{reference:T??"synthetic",resolve:$},{prereduced:!0});if(!this.resolved)this.lazyResolutions.push(W);return W}schema=($,T)=>this.finalize(this.parseSchema($,T));parseSchema=($,T)=>this.node(bw($),$,T);preparseNode($,T,W){let U=typeof $==="string"?$:bw(T,$);if(a$(T)&&T.kind===U)return T;if(U==="alias"&&!W?.prereduced){let{reference:Y}=uw.implementation.normalize(T,this);if(Y.startsWith("$")){let G=this.resolveRoot(Y.slice(1));T=G,U=G.kind}}else if(U==="union"&&d6(T,"object")){let Y=cf(T);if(Y?.length===1)T=Y[0],U=bw(T)}if(a$(T)&&T.kind===U)return T;let w=HX[U].normalize?.(T,this)??T;if(a$(w))return w.kind===U?w:uf(U,w.kind);return{...W,$:this,kind:U,def:w,prefix:W.alias??U}}bindReference($){let T;if(a$($))T=$.$===this?$:new $.constructor($.attachments,this);else T=$.$===this?$:new bT($.params,$.bodyDef,$.$,this,$.hkt);if(!this.resolved)Object.assign(this.referencesById,T.referencesById);return T}resolveRoot($){return this.maybeResolveRoot($)??I(bZ($))}maybeResolveRoot($){let T=this.maybeResolve($);if(W$(T,"generic"))return;return T}maybeResolveSubalias($){return xZ(this.aliases,$)??xZ(this.ambient,$)}get ambient(){return y.ambient}maybeResolve($){let T=this.resolutions[$];if(T){if(typeof T!=="string")return this.bindReference(T);let U=j6[T];if(W$(U,"root"))return this.resolutions[$]=U;if(W$(U,"context")){if(U.phase==="resolving")return this.node("alias",{reference:`$${$}`},{prereduced:!0});if(U.phase==="resolved")return B$(`Unexpected resolved context for was uncached by its scope: ${M$(U)}`);U.phase="resolving";let X=this.bindReference(this.parseOwnDefinitionFormat(U.def,U));return U.phase="resolved",j6[X.id]=X,j6[U.id]=X,this.resolutions[$]=X}return B$(`Unexpected nodesById entry for ${T}: ${M$(U)}`)}let W=this.aliases[$]??this.ambient?.[$];if(!W)return this.maybeResolveSubalias($);if(W=this.normalizeRootScopeValue(W),W$(W,"generic"))return this.resolutions[$]=this.bindReference(W);if(W$(W,"module")){if(!W.root)I(u_($));return this.resolutions[$]=this.bindReference(W.root)}return this.resolutions[$]=this.parse(W,{alias:$})}createParseContext($){let T=$.id??AZ($.prefix);return j6[T]=Object.assign($,{[S6]:"context",$:this,id:T,phase:"unresolved"})}traversal($){return new m1($,this.resolvedConfig)}import(...$){return new QX(E$(this.export(...$),(T,W)=>[`#${T}`,W]))}precompilation;_exportedResolutions;_exports;export(...$){if(!this._exports){this._exports={};for(let W of this.exportedNames){let U=this.aliases[W];this._exports[W]=W$(U,"module")?BZ(U,this):b_(this.maybeResolve(W))}for(let W of this.lazyResolutions)W.resolution;if(this._exportedResolutions=c_(this,this._exports),this._json=m_(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){let W=g_(this.references);this.precompilation=W.write(y_,4),h_(this.references,W)}this.resolved=!0}let T=$.length?$:this.exportedNames;return new QX(E$(T,(W,U)=>[U,this._exports[U]]))}resolve($){return this.export()[$]}node=($,T,W={})=>{let U=this.preparseNode($,T,W);if(a$(U))return this.bindReference(U);let X=this.createParseContext(U),w=EZ(X),Y=this.bindReference(w);return j6[X.id]=Y};parse=($,T={})=>this.finalize(this.parseDefinition($,T));parseDefinition($,T={}){if(W$($,"root"))return this.bindReference($);let W=this.preparseOwnDefinitionFormat($,T);if(W$(W,"root"))return this.bindReference(W);let U=this.createParseContext(W);j6[U.id]=U;let X=this.bindReference(this.parseOwnDefinitionFormat($,U));if(X.isCyclic)X=z_(X,U.id);return j6[U.id]=X,X}finalize($){if(b_($),!$.precompilation&&!this.resolvedConfig.jitless)pf($.references);return $}}class fZ extends V9{parseOwnDefinitionFormat($,T){return EZ(T)}preparseOwnDefinitionFormat($,T){return this.preparseNode(bw($),$,T)}preparseOwnAliasEntry($,T){return[$,T]}normalizeRootScopeValue($){return $}}var b_=($)=>{let T=$.references.filter((W)=>W.hasKind("alias"));for(let W of T){Object.assign(W.referencesById,W.resolution.referencesById);for(let U of $.references)if(W.id in U.referencesById)Object.assign(U.referencesById,W.referencesById)}return $},m_=($)=>E$($,(T,W)=>[T,W$(W,"root")||W$(W,"generic")?W.json:W$(W,"module")?m_(W):B$(`Unexpected resolution ${M$(W)}`)]),xZ=($,T)=>{let W=T.indexOf(".");if(W===-1)return;let U=T.slice(0,W),X=$[U];if(X===void 0)return;if(!W$(X,"module"))return I(df(U));let w=T.slice(W+1),Y=X[w];if(Y===void 0)return xZ(X,w);if(W$(Y,"root")||W$(Y,"generic"))return Y;if(W$(Y,"module"))return Y.root??I(u_(T));B$(`Unexpected resolution for alias '${T}': ${M$(Y)}`)},K9=($,T)=>new fZ($,T),ow=new fZ({});var c_=($,T)=>{let W={};for(let U in T){let X=T[U];if(W$(X,"module")){let w=c_($,X),Y=E$(w,(G,H)=>[`${U}.${G}`,H]);Object.assign(W,Y)}else if(W$(X,"root")||W$(X,"generic"))W[U]=X;else B$(`Unexpected scope resolution ${M$(X)}`)}return W},bZ=($)=>`'${$}' is unresolvable`,df=($)=>`'${$}' must reference a module to be accessed using dot syntax`,u_=($)=>`Reference to submodule '${$}' must specify an alias`;ow.export();var{schema:g$,node:ZX,defineSchema:hw$,generic:P1}=ow;var yZ="^(?:0|[1-9]\\d*)$",of=new RegExp(yZ),cw$=Z4(of);var p_=K9({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();y.intrinsic={...p_};var d_=K9({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:yZ}},{prereducedAliases:!0}).export();Object.assign(y.intrinsic,d_);var lf=K9({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),G$={...p_,...d_,...lf,emptyStructure:ZX("structure",{},{prereduced:!0})};y.intrinsic={...G$};var l_=($)=>typeof $==="string"&&$[0]==="d"&&($[1]==="'"||$[1]==='"')&&$.at(-1)===$[1],o_=($)=>$.toString()!=="Invalid Date",r_=($)=>$.slice(2,-1),hZ=($)=>`'${$}' could not be parsed by the Date constructor`,n_=($,T)=>rf($,T),rf=($,T)=>{let W=new Date($);if(o_(W))return W;let U=vR($);if(U!==void 0){let X=new Date(U);if(o_(X))return X}return T?I(T===!0?hZ($):T):void 0};var gZ=($,T)=>{let W=$.scanner.shiftUntil(nf[t_[T]]);if($.scanner.lookahead==="")return $.error(af(W,T));if($.scanner.shift(),T==="/"){try{new RegExp(W)}catch(U){I(String(U))}$.root=$.ctx.$.node("intersection",{domain:"string",pattern:W},{prereduced:!0})}else if(b4(T,mZ))$.root=$.ctx.$.node("unit",{unit:W});else{let U=n_(W,hZ(W));$.root=$.ctx.$.node("unit",{meta:W,unit:U})}},mZ={"'":1,'"':1},i_={"/":1,"'":1,'"':1},t_={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},nf={"'":($)=>$.lookahead==="'",'"':($)=>$.lookahead==='"',"/":($)=>$.lookahead==="/"},tf={'"':"double-quote","'":"single-quote","/":"forward slash"},af=($,T)=>`${T}${$} requires a closing ${tf[t_[T]]}`;var a_=($)=>`Private type references should not include '#'. Use '${$}' instead.`,A9="Optional definitions like 'string?' are only valid as properties in an object or tuple",E9="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple";var s_={">":!0,">=":!0},e_={"<":!0,"<=":!0};var VX={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},$k=($)=>`Unmatched )${$===""?"":` before ${$}`}`,M9=($)=>`Missing ${$}`,Tk=($,T)=>`Left bounds are only valid when paired with right bounds (try ...${T}${$})`,D9=($)=>`Left-bounded expressions must specify their limits using < or <= (was ${$})`,Wk=($,T,W,U)=>`An expression may have at most one left bound (parsed ${$}${VX[T]}, ${W}${VX[U]})`;var Xk=($,T,W)=>Uk($,T,W,[]),Uk=($,T,W,U)=>{let X=W.parseUntilFinalizer();if(U.push(X.root),X.finalizer===">"){if(U.length!==T.params.length)return W.error(cZ($,T.names,U.map((w)=>w.expression)));return U}if(X.finalizer===",")return Uk($,T,W,U);return X.error(M9(">"))},cZ=($,T,W)=>`${$}<${T.join(", ")}> requires exactly ${T.length} args (got ${W.length}${W.length===0?"":`: ${W.join(", ")}`})`;var uZ=($)=>{let T=$.scanner.shiftUntilNextTerminator();if(T==="keyof")$.addPrefix("keyof");else $.root=ef($,T)},sf=($,T,W)=>{if(W.scanner.shiftUntilNonWhitespace(),W.scanner.shift()!=="<")return W.error(cZ($,T.names,[]));let X=Xk($,T,W);return T(...X)},ef=($,T)=>$b($,T)??Tb($,T)??$.error(T===""?$.scanner.lookahead==="#"?a_($.shiftedByOne().scanner.shiftUntilNextTerminator()):pZ($):bZ(T)),$b=($,T)=>{if($.ctx.args?.[T]){let U=$.ctx.args[T];if(typeof U!=="string")return U;return $.ctx.$.node("alias",{reference:U},{prereduced:!0})}let W=$.ctx.$.maybeResolve(T);if(W$(W,"root"))return W;if(W===void 0)return;if(W$(W,"generic"))return sf(T,W,$);return I(`Unexpected resolution ${M$(W)}`)},Tb=($,T)=>{let W=PR(T);if(W!==void 0)return $.ctx.$.node("unit",{unit:W});let U=CR(T);if(U!==void 0)return $.ctx.$.node("unit",{unit:U})},pZ=($)=>{let T=$.previousOperator();return T?dZ(T,$.scanner.unscanned):Wb($.scanner.unscanned)},dZ=($,T="")=>`Token '${$}' requires a right operand${T?` before '${T}'`:""}`,Wb=($)=>`Expected an expression${$?` before '${$}'`:""}`;var oZ=($)=>$.scanner.lookahead===""?$.error(pZ($)):$.scanner.lookahead==="("?$.shiftedByOne().reduceGroupOpen():$.scanner.lookaheadIsIn(i_)?gZ($,$.scanner.shift()):$.scanner.lookaheadIsIn(BT)?oZ($.shiftedByOne()):$.scanner.lookahead==="d"?$.scanner.nextLookahead in mZ?gZ($,`${$.scanner.shift()}${$.scanner.shift()}`):uZ($):uZ($);class r0 extends tQ{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>(this.lookahead in r0.terminatingChars))}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...BT};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=($,T)=>$===">"?T[0]==="="?T[1]==="=":T.trimStart()===""||b4(T.trimStart()[0],r0.terminatingChars):$==="="?T[0]!=="=":$===","||$==="?"}var Yk=($,T)=>{let W=Xb($,T);if($.root.hasKind("unit")){if(typeof $.root.unit==="number"){$.reduceLeftBound($.root.unit,W),$.unsetRoot();return}if($.root.unit instanceof Date){let U=`d'${$.root.description??$.root.unit.toISOString()}'`;$.unsetRoot(),$.reduceLeftBound(U,W);return}}return wb($,W)},Gk={"<":1,">":1,"=":1},Xb=($,T)=>$.scanner.lookaheadIs("=")?`${T}${$.scanner.shift()}`:T;var wk=($,T,W,U)=>{if(W.extends(y.intrinsic.number)){if(typeof T!=="number")return I(lZ($,T,U));return $==="=="?["min","max"]:$[0]===">"?["min"]:["max"]}if(W.extends(y.intrinsic.lengthBoundable)){if(typeof T!=="number")return I(lZ($,T,U));return $==="=="?["exactLength"]:$[0]===">"?["minLength"]:["maxLength"]}if(W.extends(y.intrinsic.Date))return $==="=="?["after","before"]:$[0]===">"?["after"]:["before"];return I(iR(W.expression))},Ub=($)=>({rule:l_($.limit)?r_($.limit):$.limit,exclusive:$.comparator.length===1}),wb=($,T)=>{let W=$.unsetRoot(),U=$.scanner.location;$.parseOperand();let X=$.unsetRoot(),w=$.scanner.sliceChars(U,$.scanner.location);if($.root=W,!X.hasKind("unit")||typeof X.unit!=="number"&&!(X.unit instanceof Date))return $.error(lZ(T,w,"right"));let Y=X.unit,G=T.length===1,H=wk(T,typeof Y==="number"?Y:w,W,"right");for(let F of H)$.constrainRoot(F,T==="=="?{rule:Y}:{rule:Y,exclusive:G});if(!$.branches.leftBound)return;if(!b4(T,e_))return $.error(D9(T));let z=wk($.branches.leftBound.comparator,$.branches.leftBound.limit,W,"left");$.constrainRoot(z[0],Ub($.branches.leftBound)),$.branches.leftBound=null},lZ=($,T,W)=>`Comparator ${W==="left"?VX[$]:$} must be ${W==="left"?"preceded":"followed"} by a corresponding literal (was ${T})`;var zk=($)=>{$.scanner.shiftUntilNonWhitespace();let T=$.scanner.shiftUntilNextTerminator();$.root=$.root.brand(T)};var Fk=($)=>{let T=$.scanner.shiftUntilNextTerminator(),W=qR(T,{errorOnFail:Hk(T)});if(W===0)$.error(Hk(0));$.root=$.root.constrain("divisor",W)},Hk=($)=>`% operator must be followed by a non-zero integer literal (was ${$})`;var rZ=($)=>{let T=$.scanner.shift();return T===""?$.finalize(""):T==="["?$.scanner.shift()==="]"?$.setRoot($.root.array()):$.error(Yb):T==="|"?$.scanner.lookahead===">"?$.shiftedByOne().pushRootToBranch("|>"):$.pushRootToBranch(T):T==="&"?$.pushRootToBranch(T):T===")"?$.finalizeGroup():r0.lookaheadIsFinalizing(T,$.scanner.unscanned)?$.finalize(T):b4(T,Gk)?Yk($,T):T==="%"?Fk($):T==="#"?zk($):(T in BT)?rZ($):$.error(N9(T))},N9=($,T="")=>`'${$}' is not allowed here${T&&` (should be ${T})`}`,Yb="Missing expected ']'";var Ok=($)=>{let T=$.unsetRoot();$.parseOperand();let W=$.unsetRoot();if(!W.hasKind("unit"))return $.error(Gb(W.expression));let U=W.unit instanceof Date?()=>new Date(W.unit):W.unit;return[T,"=",U]},Gb=($)=>`Default value '${$}' must a literal value`;var nZ=($,T)=>{let W=T.$.maybeResolveRoot($);if(W)return W;if($.endsWith("[]")){let w=T.$.maybeResolveRoot($.slice(0,-2));if(w)return w.array()}let U=new KX(new r0($),T),X=zb(U);if(U.finalizer===">")I(N9(">"));return X},zb=($)=>{$.parseOperand();let T=lw($).root;if(!T)return B$(`Root was unexpectedly unset after parsing string '${$.scanner.scanned}'`);if($.finalizer==="=")T=Ok($);else if($.finalizer==="?")T=[T,"?"];if($.scanner.shiftUntilNonWhitespace(),$.scanner.lookahead)I(N9($.scanner.lookahead));return T},lw=($)=>{while($.finalizer===void 0)Hb($);return $},Hb=($)=>$.hasRoot()?$.parseOperator():$.parseOperand();class KX{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor($,T){this.scanner=$,this.ctx=T}error($){return I($)}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(M9(")"));this.finalizeBranches(),this.finalizer=$}reduceLeftBound($,T){let W=VX[T];if(!b4(W,s_))return this.error(D9(T));if(this.branches.leftBound)return this.error(Wk(this.branches.leftBound.limit,this.branches.leftBound.comparator,$,W));this.branches.leftBound={comparator:W,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($k(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():B$(`Unexpected prefix '${$}'`)}}pushRootToBranch($){this.assertRangeUnset(),this.applyPrefixes();let T=this.root;if(this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(T)??T,$==="&")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 lw(new KX(this.scanner,this.ctx))}parseOperator(){return rZ(this)}parseOperand(){return oZ(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(Tk(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 Fb="An empty string is not a valid generic parameter name",J9=($,T,W)=>{$.shiftUntilNonWhitespace();let U=$.shiftUntilNextTerminator();if(U===""){if($.lookahead===""&&T.length)return T;return I(Fb)}return $.shiftUntilNonWhitespace(),Ob($,U,T,W)},Qk="extends ",Ob=($,T,W,U)=>{if($.shiftUntilNonWhitespace(),$.unscanned.startsWith(Qk))$.jumpForward(Qk.length);else{if($.lookahead===",")$.shift();return W.push(T),J9($,W,U)}let X=lw(new KX($,U));return W.push([T,X.root]),J9($,W,U)};class iZ extends g1{$;constructor($){super((...T)=>new rw($)(...T),{bind:$});this.$=$}in($){return new rw(this.$,$===void 0?void 0:this.$.parse($))}at($,T){return new rw(this.$).at($,T)}case($,T){return new rw(this.$).case($,T)}}class rw extends g1{$;in;key;branches=[];constructor($,T){super((W)=>this.caseEntries(Object.entries(W).map(([U,X])=>U==="default"?[U,X]:[this.$.parse(U),X])));this.$=$,this.in=T}at($,T){if(this.key)I(Zb);if(this.branches.length)I(Qb);return this.key=$,T?this.match(T):this}case($,T){return this.caseEntry(this.$.parse($),T)}caseEntry($,T){let U=(this.key?this.$.parse({[this.key]:$}):$).pipe(T);return this.branches.push(U),this}match($){return this($)}strings($){return this.caseEntries(Object.entries($).map(([T,W])=>T==="default"?[T,W]:[this.$.node("unit",{unit:T}),W]))}caseEntries($){for(let T=0;T<$.length;T++){let[W,U]=$[T];if(W==="default"){if(T!==$.length-1)I("default may only be specified as the last key of a switch definition");return this.default(U)}if(typeof U!=="function")return I(`Value for case "${W}" must be a function (was ${f4(U)})`);this.caseEntry(W,U)}return this}default($){if(typeof $==="function")this.case(G$.unknown,$);let T={branches:this.branches,ordered:!0};if($==="never"||$==="assert")T.meta={onFail:Zk};let W=this.$.node("union",T);if(!this.in)return this.$.finalize(W);let U=this.in.pipe(W);if($==="never"||$==="assert")U=U.configureReferences({onFail:Zk},"self");return this.$.finalize(U)}}var Zk=($)=>$.throw(),Qb="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",Zb="At most one key matcher may be specified per expression";var L9=($,T)=>{if(o$($)){if($[1]==="=")return[T.$.parseOwnDefinitionFormat($[0],T),"=",$[2]];if($[1]==="?")return[T.$.parseOwnDefinitionFormat($[0],T),"?"]}return R9($,T)},Vk="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",Kk="Only required keys may specify default values, e.g. { value: 'number = 0' }";var Ak=($,T)=>{let W,U={},X=BW($);for(let[Y,G]of X){let H=Ab(Y);if(H.kind==="spread"){if(!H0(U))return I(Kb);let Z=T.$.parseOwnDefinitionFormat(G,T);if(Z.equals(G$.object))continue;if(!Z.hasKind("intersection")||!Z.basis?.equals(G$.object))return I(Eb(Z.expression));W=Z.structure;continue}if(H.kind==="undeclared"){if(G!=="reject"&&G!=="delete"&&G!=="ignore")I(Vb(G));U.undeclared=G;continue}let z=L9(G,T),F=H;if(H.kind==="required"){if(!o$(z))tZ(U,"required",{key:H.normalized,value:z},T);else tZ(U,"optional",z[1]==="="?{key:H.normalized,value:z[0],default:z[2]}:{key:H.normalized,value:z[0]},T);continue}if(o$(z)){if(z[1]==="?")I(Vk);if(z[1]==="=")I(Kk)}if(H.kind==="optional"){tZ(U,"optional",{key:H.normalized,value:z},T);continue}let O=T.$.parseOwnDefinitionFormat(F.normalized,T),Q=Z9(O,z,T.$);if(Q.index)U.index=C$(U.index,Q.index);if(Q.required)U.required=C$(U.required,Q.required)}let w=T.$.node("structure",U);return T.$.parseSchema({domain:"object",structure:W?.merge(w)??w})},tZ=($,T,W,U)=>{$[T]=C$($[T],U.$.node(T,W))},Vb=($)=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${M$($)})`,Kb="Spread operator may only be used as the first key in an object",Ab=($)=>typeof $==="symbol"?{kind:"required",normalized:$}:$.at(-1)==="?"?$.at(-2)===kw?{kind:"required",normalized:`${$.slice(0,-2)}?`}:{kind:"optional",normalized:$.slice(0,-1)}:$[0]==="["&&$.at(-1)==="]"?{kind:"index",normalized:$.slice(1,-1)}:$[0]===kw&&$[1]==="["&&$.at(-1)==="]"?{kind:"required",normalized:$.slice(1)}:$==="..."?{kind:"spread"}:$==="+"?{kind:"undeclared"}:{kind:"required",normalized:$==="\\..."?"...":$==="\\+"?"+":$},Eb=($)=>`Spread operand must resolve to an object literal type (was ${$})`;var Mk=($,T)=>Pb($)?Lk[$[0]]($,T):kb($)?Jk[$[1]]($,T):null,Mb=($,T)=>T.$.parseOwnDefinitionFormat($[1],T).keyof(),aZ=($,T)=>{if($[2]===void 0)return I(dZ($[1],""));let W=T.$.parseOwnDefinitionFormat($[0],T),U=T.$.parseOwnDefinitionFormat($[2],T);if($[1]==="|")return T.$.node("union",{branches:[W,U]});let X=$[1]==="&"?n6(W,U,T.$):fw(W,U,T.$);if(X instanceof r)return X.throw();return X},Db=($,T)=>T.$.parseOwnDefinitionFormat($[0],T).array(),Nb=($,T)=>{if(typeof $[2]!=="function")return I(Dk("=>",$[2]));return T.$.parseOwnDefinitionFormat($[0],T).pipe($[2])},Dk=($,T)=>`${$===":"?"Narrow":"Morph"} expression requires a function following '${$}' (was ${typeof T})`,Jb=($,T)=>{if(typeof $[2]!=="function")return I(Dk(":",$[2]));return T.$.parseOwnDefinitionFormat($[0],T).constrain("predicate",$[2])},Lb=($,T)=>T.$.parseOwnDefinitionFormat($[0],T).configureReferences($[2],"shallow"),Nk=($)=>$,Rb=Nk({"[]":Db,"?":()=>I(A9)}),_b=Nk({"|":aZ,"&":aZ,":":Jb,"=>":Nb,"|>":aZ,"@":Lb,"=":()=>I(E9)}),Jk={...Rb,..._b},kb=($)=>Jk[$[1]]!==void 0,vb=($)=>$,Lk=vb({keyof:Mb,instanceof:($,T)=>{if(typeof $[1]!=="function")return I(Ek(Rw($[1])));let W=$.slice(1).map((U)=>typeof U==="function"?T.$.node("proto",{proto:U}):I(Ek(Rw(U))));return W.length===1?W[0]:T.$.node("union",{branches:W})},"===":($,T)=>T.$.units($.slice(1))}),Pb=($)=>Lk[$[0]]!==void 0,Ek=($)=>`Expected a constructor following 'instanceof' operator (was ${$})`;var kk=($,T)=>{let W=[{}],U=0;while(U<$.length){let X=!1;if($[U]==="..."&&U<$.length-1)X=!0,U++;let w=L9($[U],T),[Y,G,H]=!o$(w)?[w]:w;if(U++,X){if(!Y.extends(y.intrinsic.Array))return I(Sb(Y.expression));W=W.flatMap((z)=>Y.distribute((F)=>Cb(W9(z),F)))}else W=W.map((z)=>{if(G==="?")return vk(z,Y);if(G==="=")return qb(z,Y,H);return sZ(z,Y)})}return T.$.parseSchema(W.map((X)=>H0(X)?{proto:Array,exactLength:0}:{proto:Array,sequence:X}))},sZ=($,T)=>{if($.defaultables||$.optionals)return I($.variadic?CZ:jb);if($.variadic)$.postfix=C$($.postfix,T);else $.prefix=C$($.prefix,T);return $},vk=($,T)=>{if($.variadic)return I(Pk);return $.optionals=C$($.optionals,T),$},qb=($,T,W)=>{if($.variadic)return I(Pk);if($.optionals)return I(Bb);return $.defaultables=C$($.defaultables,[[T,W]]),$},Rk=($,T)=>{if($.postfix)I(_k);if($.variadic){if(!$.variadic.equals(T))I(_k)}else $.variadic=T.internal;return $},Cb=($,T)=>{let W=T.select({method:"find",kind:"sequence"});if(!W)return Rk($,y.intrinsic.unknown);if(W.prefix)for(let U of W.prefix)sZ($,U);if(W.optionals)for(let U of W.optionals)vk($,U);if(W.variadic)Rk($,W.variadic);if(W.postfix)for(let U of W.postfix)sZ($,U);return $},Sb=($)=>`Spread element must be an array (was ${$})`,_k="A tuple may have at most one variadic element",jb="A required element may not follow an optional element",Pk="An optional element may not follow a variadic element";var Bb="A defaultable element may not follow an optional element without a default";var Ib={},R9=($,T)=>{if(typeof $==="string"){if(T.args&&Object.keys(T.args).some((U)=>$.includes(U)))return nZ($,T);let W=Ib[T.$.name]??={};return W[$]??=nZ($,T)}return d6($,"object")?xb($,T):I(eZ(f4($)))},xb=($,T)=>{let W=Lw($);switch(W){case void 0:if(W$($,"root"))return $;return Ak($,T);case"Array":return fb($,T);case"RegExp":return T.$.node("intersection",{domain:"string",pattern:$},{prereduced:!0});case"Function":{let U=jT($)?$():$;if(W$(U,"root"))return U;return I(eZ("Function"))}default:return I(eZ(W??M$($)))}},fb=($,T)=>Mk($,T)??kk($,T),eZ=($)=>`Type definitions must be strings or objects (was ${$})`;class $V extends g1{constructor($){let T=Object.assign({errors:l6,hkt:w6,$,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((...W)=>{if(W.length===1)return $.parse(W[0]);if(W.length===2&&typeof W[0]==="string"&&W[0][0]==="<"&&W[0].at(-1)===">"){let U=W[0].slice(1,-1),X=$.parseGenericParams(U,{});return new bT(X,W[1],$,$,null)}return $.parse(W)},{bind:$,attach:T})}}var AX=y;class _9 extends V9{get ambientAttachments(){if(!AX.typeAttachments)return;return this.cacheGetter("ambientAttachments",E$(AX.typeAttachments,($,T)=>[$,this.bindReference(T)]))}preparseOwnAliasEntry($,T){let W=$.indexOf("<");if(W===-1){if(W$(T,"module")||W$(T,"generic"))return[$,T];let w=this.name==="ark"?$:$==="root"?this.name:`${this.name}.${$}`,Y=this.resolvedConfig.keywords?.[w];if(Y)T=[T,"@",Y];return[$,T]}if($.at(-1)!==">")I("'>' must be the last character of a generic declaration in a scope");let U=$.slice(0,W),X=$.slice(W+1,-1);return[U,()=>{let w=this.parseGenericParams(X,{alias:U});return lR(w,T,this)}]}parseGenericParams($,T){return J9(new r0($),[],this.createParseContext({...T,def:$,prefix:"generic"}))}normalizeRootScopeValue($){if(jT($)&&!W$($,"generic"))return $();return $}preparseOwnDefinitionFormat($,T){return{...T,def:$,prefix:T.alias??"type"}}parseOwnDefinitionFormat($,T){if(!(T.alias&&(T.alias in this.aliases))&&!T.args)T.args={this:T.id};let U=R9($,T);if(o$(U)){if(U[1]==="=")return I(E9);if(U[1]==="?")return I(A9)}return U}unit=($)=>this.units([$]);valueOf=($)=>this.units(QR($));enumerated=(...$)=>this.units($);instanceOf=($)=>this.node("proto",{proto:$},{prereduced:!0});or=(...$)=>this.schema($.map((T)=>this.parse(T)));and=(...$)=>$.reduce((T,W)=>T.and(this.parse(W)),this.intrinsic.unknown);merge=(...$)=>$.reduce((T,W)=>T.merge(this.parse(W)),this.intrinsic.object);pipe=(...$)=>this.intrinsic.unknown.pipe(...$);match=new iZ(this);declare=()=>({type:this.type});define($){return $}type=new $V(this);static scope=($,T={})=>new _9($,T);static module=($,T={})=>this.scope($,T).export()}var TV=Object.assign(_9.scope,{define:($)=>$}),q$=_9;class qk extends w6{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}var bb=P1(["base",G$.object],["props",G$.object])(($)=>$.base.merge($.props),qk),Ck=q$.module({Key:G$.key,Merge:bb});class Sk extends w6{}var yb=P1("element")(($)=>{let T=$.element.exclude(G$.Array),W=T.array();return T.rawOr(W).pipe(ST).distribute((U)=>U.assertHasKind("morph").declareOut(W),g$)},Sk),jk=q$.module({root:G$.Array,readonly:"root",index:G$.nonNegativeIntegerString,liftFrom:yb},{name:"Array"});var WV=g$(["string",xW.FileConstructor]),hb=WV.rawOr(WV.array()),Bk=g$({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:hb}}),Ik=q$.module({root:["instanceof",FormData],value:WV,parsed:Bk,parse:g$({in:FormData,morphs:($)=>{let T={};for(let[W,U]of $)if(W in T){let X=T[W];if(typeof X==="string"||X instanceof xW.FileConstructor)T[W]=[X,U];else X.push(U)}else T[W]=U;return T},declaredOut:Bk})},{name:"FormData"});var xk=q$.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 gb={Boolean:1,Number:1,String:1},fk=q$.module({...E$({...uQ,...dQ},($,T)=>($ in gb)?[]:[$,["instanceof",T]]),Array:jk,TypedArray:xk,FormData:Ik});var mb=g$({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"}),cb=g$({domain:"number",divisor:1}),k9=q$.module({root:G$.number,integer:cb,epoch:mb,safe:g$({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 w4=($,T,W)=>{let U={domain:"string",pattern:{rule:$.source,flags:$.flags,meta:T}};if(W)U.meta={format:W};return ZX("intersection",U)},bk=w4(vw,"a well-formed integer string"),nk=q$.module({root:bk,parse:g$({in:bk,morphs:($,T)=>{let W=Number.parseInt($);return Number.isSafeInteger(W)?W:T.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:G$.integer})},{name:"string.integer"}),ub=w4(/^[\dA-Fa-f]+$/,"hex characters only"),pb=q$.module({root:w4(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:w4(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),yk=w4(/^[A-Z].*$/,"capitalized"),db=q$.module({root:g$({in:"string",morphs:($)=>$.charAt(0).toUpperCase()+$.slice(1),declaredOut:yk}),preformatted:yk},{name:"string.capitalize"}),ob=($)=>{let T=$.replaceAll(/[ -]+/g,""),W=0,U,X,w=!1;for(let Y=T.length-1;Y>=0;Y--){if(U=T.substring(Y,Y+1),X=Number.parseInt(U,10),w)X*=2,W+=X>=10?X%10+1:X;else W+=X;w=!w}return!!(W%10===0?T:!1)},lb=/^(?: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}))$/,rb=g$({domain:"string",pattern:{meta:"a credit card number",rule:lb.source},predicate:{meta:"a credit card number",predicate:ob}});var nb=/^([+-]?\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 ib=($)=>!Number.isNaN(new Date($).valueOf()),hk=g$({domain:"string",predicate:{meta:"a parsable date",predicate:ib}}).assertHasKind("intersection"),gk=nk.root.internal.narrow(($,T)=>{let W=Number.parseInt($),U=k9.epoch(W);if(U instanceof l6)return T.errors.merge(U),!1;return!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),tb=q$.module({root:gk,parse:g$({in:gk,morphs:($)=>new Date($),declaredOut:G$.Date})},{name:"string.date.epoch"}),mk=w4(nb,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),ab=q$.module({root:mk,parse:g$({in:mk,morphs:($)=>new Date($),declaredOut:G$.Date})},{name:"string.date.iso"}),sb=q$.module({root:hk,parse:g$({declaredIn:hk,in:"string",morphs:($,T)=>{let W=new Date($);if(Number.isNaN(W.valueOf()))return T.error("a parsable date");return W},declaredOut:G$.Date}),iso:ab,epoch:tb},{name:"string.date"}),eb=w4(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),ck="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",yT=`(${ck}[.]){3}${ck}`,$y=new RegExp(`^${yT}$`),R4="(?:[0-9a-fA-F]{1,4})",Ty=new RegExp(`^((?:${R4}:){7}(?:${R4}|:)|(?:${R4}:){6}(?:${yT}|:${R4}|:)|(?:${R4}:){5}(?::${yT}|(:${R4}){1,2}|:)|(?:${R4}:){4}(?:(:${R4}){0,1}:${yT}|(:${R4}){1,3}|:)|(?:${R4}:){3}(?:(:${R4}){0,2}:${yT}|(:${R4}){1,4}|:)|(?:${R4}:){2}(?:(:${R4}){0,3}:${yT}|(:${R4}){1,5}|:)|(?:${R4}:){1}(?:(:${R4}){0,4}:${yT}|(:${R4}){1,6}|:)|(?::((?::${R4}){0,5}:${yT}|(?::${R4}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),Wy=q$.module({root:["v4 | v6","@","an IP address"],v4:w4($y,"an IPv4 address","ipv4"),v6:w4(Ty,"an IPv6 address","ipv6")},{name:"string.ip"}),EX="a JSON string",ik=($)=>{if(!($ instanceof SyntaxError))throw $;return`must be ${EX} (${$})`},Xy=g$({meta:EX,domain:"string",predicate:{meta:EX,predicate:($,T)=>{try{return JSON.parse($),!0}catch(W){return T.reject({code:"predicate",expected:EX,problem:ik(W)})}}}}),Uy=($,T)=>{if($.length===0)return T.error({code:"predicate",expected:EX,actual:"empty"});try{return JSON.parse($)}catch(W){return T.error({code:"predicate",expected:EX,problem:ik(W)})}},wy=q$.module({root:Xy,parse:g$({meta:"safe JSON string parser",in:"string",morphs:Uy,declaredOut:G$.jsonObject})},{name:"string.json"}),uk=w4(/^[a-z]*$/,"only lowercase letters"),Yy=q$.module({root:g$({in:"string",morphs:($)=>$.toLowerCase(),declaredOut:uk}),preformatted:uk},{name:"string.lower"}),tk=["NFC","NFD","NFKC","NFKD"],nw=E$(tk,($,T)=>[T,g$({domain:"string",predicate:(W)=>W.normalize(T)===W,meta:`${T}-normalized unicode`})]),v9=E$(tk,($,T)=>[T,g$({in:"string",morphs:(W)=>W.normalize(T),declaredOut:nw[T]})]),Gy=q$.module({root:v9.NFC,preformatted:nw.NFC},{name:"string.normalize.NFC"}),zy=q$.module({root:v9.NFD,preformatted:nw.NFD},{name:"string.normalize.NFD"}),Hy=q$.module({root:v9.NFKC,preformatted:nw.NFKC},{name:"string.normalize.NFKC"}),Fy=q$.module({root:v9.NFKD,preformatted:nw.NFKD},{name:"string.normalize.NFKD"}),Oy=q$.module({root:"NFC",NFC:Gy,NFD:zy,NFKC:Hy,NFKD:Fy},{name:"string.normalize"}),pk=w4(ez,"a well-formed numeric string"),Qy=q$.module({root:pk,parse:g$({in:pk,morphs:($)=>Number.parseFloat($),declaredOut:G$.number})},{name:"string.numeric"}),dk="a regex pattern",Zy=g$({domain:"string",predicate:{meta:dk,predicate:($,T)=>{try{return new RegExp($),!0}catch(W){return T.reject({code:"predicate",expected:dk,problem:String(W)})}}},meta:{format:"regex"}}),Vy=/^(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-]+)*))?$/,Ky=w4(Vy,"a semantic version (see https://semver.org/)"),ok=w4(/^\S.*\S$|^\S?$/,"trimmed"),Ay=q$.module({root:g$({in:"string",morphs:($)=>$.trim(),declaredOut:ok}),preformatted:ok},{name:"string.trim"}),lk=w4(/^[A-Z]*$/,"only uppercase letters"),Ey=q$.module({root:g$({in:"string",morphs:($)=>$.toUpperCase(),declaredOut:lk}),preformatted:lk},{name:"string.upper"}),My=($)=>{if(URL.canParse)return URL.canParse($);try{return new URL($),!0}catch{return!1}},rk=g$({domain:"string",predicate:{meta:"a URL string",predicate:My},meta:{format:"uri"}}),Dy=q$.module({root:rk,parse:g$({declaredIn:rk,in:"string",morphs:($,T)=>{try{return new URL($)}catch{return T.error("a URL string")}},declaredOut:g$(URL)})},{name:"string.url"}),Ny=q$.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:w4(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:w4(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:w4(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:w4(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:w4(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:w4(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:w4(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:w4(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),ak=q$.module({root:G$.string,alpha:w4(/^[A-Za-z]*$/,"only letters"),alphanumeric:w4(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:ub,base64:pb,capitalize:db,creditCard:rb,date:sb,digits:w4(/^\d*$/,"only digits 0-9"),email:eb,integer:nk,ip:Wy,json:wy,lower:Yy,normalize:Oy,numeric:Qy,regex:Zy,semver:Ky,trim:Ay,upper:Ey,url:Dy,uuid:Ny},{name:"string"});var sk=q$.module({bigint:G$.bigint,boolean:G$.boolean,false:G$.false,never:G$.never,null:G$.null,number:G$.number,object:G$.object,string:G$.string,symbol:G$.symbol,true:G$.true,unknown:G$.unknown,undefined:G$.undefined}),ek=q$.module({root:G$.unknown,any:G$.unknown},{name:"unknown"}),Jy=q$.module({root:G$.jsonObject,stringify:ZX("morph",{in:G$.jsonObject,morphs:($)=>JSON.stringify($),declaredOut:G$.string})},{name:"object.json"}),$v=q$.module({root:G$.object,json:Jy},{name:"object"});class Tv extends w6{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}var Ly=P1(["K",G$.key],"V")(($)=>({domain:"object",index:{signature:$.K,value:$.V}}),Tv);class Wv extends w6{description='pick a set of properties from an object like `Pick(User, "name | age")`'}var Ry=P1(["T",G$.object],["K",G$.key])(($)=>$.T.pick($.K),Wv);class Xv extends w6{description='omit a set of properties from an object like `Omit(User, "age")`'}var _y=P1(["T",G$.object],["K",G$.key])(($)=>$.T.omit($.K),Xv);class Uv extends w6{description="make all named properties of an object optional like `Partial(User)`"}var ky=P1(["T",G$.object])(($)=>$.T.partial(),Uv);class wv extends w6{description="make all named properties of an object required like `Required(User)`"}var vy=P1(["T",G$.object])(($)=>$.T.required(),wv);class Yv extends w6{description='exclude branches of a union like `Exclude("boolean", "true")`'}var Py=P1("T","U")(($)=>$.T.exclude($.U),Yv);class Gv extends w6{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}var qy=P1("T","U")(($)=>$.T.extract($.U),Gv),zv=q$.module({Exclude:Py,Extract:qy,Omit:_y,Partial:ky,Pick:Ry,Record:Ly,Required:vy});var hT=TV({...sk,...zv,...fk,...Ck,string:ak,number:k9,object:$v,unknown:ek},{prereducedAliases:!0,name:"ark"}),y4=hT.export();Object.assign(AX.ambient,y4);AX.typeAttachments={string:y4.string.root,number:y4.number.root,bigint:y4.bigint,boolean:y4.boolean,symbol:y4.symbol,undefined:y4.undefined,null:y4.null,object:y4.object.root,unknown:y4.unknown.root,false:y4.false,true:y4.true,never:y4.never,arrayIndex:y4.Array.index,Key:y4.Key,Record:y4.Record,Array:y4.Array.root,Date:y4.Date};var u1=Object.assign(hT.type,AX.typeAttachments),Cy=hT.match,Sy=hT.generic,H9$=hT.schema,jy=hT.define,By=hT.declare;var Iy="__vite_start_time"in globalThis,xy=typeof window!=="undefined",P9$="vitest"in globalThis,n0=u1("string"),Hv=u1('"true" | "false" | undefined'),i0=gQ({isServer:!Iy&&!xy,server:{CI:u1("string | undefined").pipe(Boolean),POSTGRES_USER:n0,POSTGRES_PASSWORD:n0,POSTGRES_DATABASE:n0,POSTGRES_HOST:n0,POSTGRES_PORT:n0.pipe(($)=>Number.parseInt($,10)),BACKEND_PORT:n0.pipe(($)=>Number.parseInt($,10)),RUN_WORKERS_FROM_SOURCE:Hv.pipe(($)=>$==="true"),FRONTEND_PORT:n0.pipe(($)=>Number.parseInt($,10)),FRONTEND_ORIGINS:n0.pipe.try(($)=>JSON.parse($),u1("string[]")),API_KEY_OPENAI:u1("string | undefined"),API_KEY_RESEND:u1("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:n0,VITE_DEV_FRONTEND_HOST:u1("string | undefined"),VITE_DEV_HTTPS:Hv.pipe(($)=>$==="true")},runtimeEnv:import.meta.env,emptyStringAsUndefined:!0});var UV={};e0(UV,{users:()=>yW,untrackedUserColumnNames:()=>fy,twoFactorMethod:()=>Vv,trackedUserColumnName:()=>by,trackableUserColumnNames:()=>Qv,signInHistory:()=>hy,role:()=>Ov,players:()=>XV,passwordResetAttempts:()=>gy,games:()=>q9,banishedIps:()=>C9,accountActions:()=>yy,accountAction:()=>Zv});function gT(){return X6({length:24}).$type()}function Fv($){return R`lower(${$})`}var P9=R`TO_CHAR(NOW() AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`,Ov=sU("role",["admin","user"]),yW=PT("users",{id:L1().primaryKey().defaultRandom(),username:X6({length:16}).notNull(),emailOffered:X6({length:254}).notNull(),emailVerified:X6({length:254}),password:X6({length:254}),createdAtIso:gT().notNull().default(P9),createdIp:X6({length:45}).notNull(),isActive:Uw().notNull().default(!1),verifiedAtIso:gT(),userRole:Ov().default("user")},($)=>[kQ("usernameUniqueIndex").on(Fv($.username)),kQ("emailVerifiedUniqueIndex").on(Fv($.emailVerified))]),fy=["id","createdAtIso","createdIp","isActive","verifiedAtIso"],Qv=["username","emailOffered","emailVerified","password","userRole"],by=sU("trackedUserColumnName",Qv),Zv=sU("accountAction",["cooldown","confirmEmail","signIn","resetPassword"]),yy=PT("accountActions",{userId:L1().references(()=>yW.id).primaryKey(),action:Zv().notNull(),code:X6({length:254}).notNull(),wrongCodeCount:ww().notNull().default(0),expiresAtIso:gT().notNull()}),q9=PT("games",{id:L1().primaryKey().defaultRandom()}),XV=PT("players",{userId:L1().notNull().references(()=>yW.id,{onDelete:"cascade"}),gameId:L1().notNull().references(()=>q9.id,{onDelete:"cascade"}),score:ww().notNull()},($)=>[$L({name:"players_userId_gameId_pk",columns:[$.userId,$.gameId]})]),hy=PT("signInHistory",{id:L1().primaryKey().defaultRandom(),userId:L1().references(()=>yW.id,{onDelete:"cascade"}),signInTimeIso:gT().notNull().default(P9),ipAddress:X6({length:45}).notNull(),userAgent:X6({length:1024}),successful:Uw().notNull().default(!1)}),Vv=sU("twoFactorMethod",["email","phone"]),gy=PT("passwordResetAttempts",{id:L1().primaryKey().defaultRandom(),userId:L1().notNull().references(()=>yW.id,{onDelete:"cascade"}),requestedIp:X6({length:45}).notNull(),requestedAtIso:gT().notNull().default(P9),succeededIp:X6({length:45}),succeededAtIso:gT(),verificationMethod:Vv().notNull()}),C9=PT("banishedIps",{ip:X6({length:45}).primaryKey(),reason:X6({length:2048}).notNull(),banishedAtIso:gT().notNull().default(P9),banishedUntilIso:gT()});var __dirname="/home/runner/work/wayforge/wayforge/apps/tempest.games/src/database";class wV{options;sql;drizzle;observers=new Map;async setupTriggersAndNotifications(){await this.sql.file(my.resolve(__dirname,"notify_update.sql"));let $=[u4(yW),u4(q9),u4(XV)];await this.sql`SELECT create_notify_triggers(${this.sql.array($)})`,await this.sql.listen("table_update",(T)=>{let W=T.split(","),U=W[0],X=W[1],w=`${U}("${X}")`;if(this.observers.has(w))this.observers.get(w).next(w)})}constructor($=!1,T={host:i0.POSTGRES_HOST,port:i0.POSTGRES_PORT,user:i0.POSTGRES_USER,password:i0.POSTGRES_PASSWORD,database:i0.POSTGRES_DATABASE}){this.options=T,this.sql=t2(T),this.drizzle=az(this.sql,{schema:UV,logger:$})}observe($,T){if(!this.observers.has($))this.observers.set($,new b$);this.observers.get($).subscribe("SINGLETON",T)}}import{resolve as py}from"path";import{existsSync as YV,mkdirSync as Kv,readFileSync as cy,readdirSync as Av,rmSync as Ev,statSync as Mv,writeFileSync as uy}from"fs";import{resolve as GV}from"path";var Dv=class{rootDir;get initialized(){return YV(this.rootDir)}initialize(){if(!this.initialized)Kv(this.rootDir,{recursive:!0})}constructor($){if(this.rootDir=$.path,$.eagerInit)this.initialize()}getItem($){let T=GV(this.rootDir,$);if(YV(T))return cy(T,"utf-8");return null}setItem($,T){this.initialize();let W=GV(this.rootDir,$);uy(W,T)}removeItem($){let T=GV(this.rootDir,$);if(YV(T))this.initialize(),Ev(T)}key($){return Av(this.rootDir).sort((U,X)=>{let w=Mv(U);return Mv(X).ctimeMs-w.ctimeMs})[$]??null}clear(){Ev(this.rootDir,{recursive:!0}),Kv(this.rootDir,{recursive:!0})}get length(){return Av(this.rootDir).length}};var zV=new Dv({path:py(process.cwd(),"storage")});function Nv($){return $.toString({smallestUnit:"millisecond"})}function r9$($){return Kz.Instant.from($)}import*as S9 from"fs";import*as Jv from"readline";function dy($){let W=$.replace(":","T").replace(" ","").replace(/(\d{2})\/(\w{3})\/(\d{4})T(.+)/,(U,X,w,Y,G)=>{let z={Jan:"01",Feb:"02",Mar:"03",Apr:"04",May:"05",Jun:"06",Jul:"07",Aug:"08",Sep:"09",Oct:"10",Nov:"11",Dec:"12"}[w];return`${Y}-${z}-${X}T${G}`});return new Date(W)}async function Lv($,T="/var/log/nginx/access.log",W=new Date){let U=new Map;if(!S9.existsSync(T))return $.error(`Log file not found: ${T}`),U;let X=S9.createReadStream(T),w=Jv.createInterface({input:X,crlfDelay:Number.POSITIVE_INFINITY}),Y=new Date(W.getTime()-3600000);return w.on("line",(G)=>{let H=/^(?<ip>\S+) \S+ \S+ \[(?<dateTime>.*?)\]/,z=G.match(H);if(z?.groups){let F=z.groups.ip,O=z.groups.dateTime,Q=dy(O);if(!Number.isNaN(Q.getTime())){if(Q>=Y&&Q<=W){let Z=U.get(F);if(!Z)Z=[],U.set(F,Z);Z.push(G)}}else $.error(`Failed to parse date: ${O}`)}}),new Promise((G,H)=>{w.on("error",(z)=>{H(z)}),w.on("close",()=>{G(U)})})}function Rv($){return $.toJsonSchema()}var oy=["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(`
|
|
179
|
+
`);function _v($){return oy+$.join(`
|
|
156
180
|
|
|
157
|
-
`)}var
|
|
158
|
-
`));let f=!1;for(let b of
|
|
159
|
-
`),f=!0;break}if(f)continue;if($.usdBudget>$.usdMinimum){let b=
|
|
181
|
+
`)}var kv={schema:u1([{shouldBanIp:"false"},"|",{shouldBanIp:"true",veryConciseReason:"string"}]),toJsonSchema:Rv,fallback:{shouldBanIp:!1}};var ry=[".env","php"];async function vv({generator:$,logFilePath:T,logger:W,now:U=new Date}){let X=$.usdBudget,w=new wV({logQuery(_,C){W.info("\uD83D\uDCDD query",_,C)}}),Y=await Lv(W,T,U),G=[],H=$.object(kv),z=0,F=0;for(let[_,C]of Y){W.info(`\uD83D\uDD0D ruling on ${_}. logs:`),W.info(C.map((b)=>` ${b}`).join(`
|
|
182
|
+
`));let f=!1;for(let b of ry)if(C.some((g)=>g.includes(b))){G.push({ip:_,reason:`Always ban ${b}`}),W.info(` \uD83E\uDDD1\u200D\u2696\uFE0F banning ${_}--always ban ${b}
|
|
183
|
+
`),f=!0;break}if(f)continue;if($.usdBudget>$.usdMinimum){let b=_v(C),g=await H(b);if(g.shouldBanIp)G.push({ip:_,reason:g.veryConciseReason}),W.info(` \uD83E\uDDD1\u200D\u2696\uFE0F banning ${_}--${g.veryConciseReason}
|
|
160
184
|
`);else F++,W.info(` \uD83D\uDD4A\uFE0F not banning ${_}
|
|
161
185
|
`);z++}else{W.warn("\uD83D\uDCB0 insufficient funds to process all logs"),W.warn(`\uD83D\uDCB0 got through ${z}/${Y.size} ips
|
|
162
|
-
`);break}}let O=G.length;if(G.length>0)await w.drizzle.insert(
|
|
186
|
+
`);break}}let O=G.length;if(G.length>0)await w.drizzle.insert(C9).values(G).onConflictDoNothing();let Q=[],Z=zV.getItem("lastTribunalProcessedDate"),V=Nv(Kz.Instant.from(Z??"1970-01-01"));try{Q.push(...await w.drizzle.query.banishedIps.findMany({columns:{ip:!0},where:xz(C9.banishedAtIso,V)}))}catch(_){W.error(_)}try{if(process.env.EXPERIMENTAL_BAN_IPS)await Promise.all(Q.map((_)=>new Promise((C,f)=>ly(`iptables -D INPUT -s ${_.ip} -j DROP`).on("exit",(b)=>{if(b===0)W.info(`\uD83E\uDDD1\u200D\u2696\uFE0F banned ${_.ip}`),C();else f(new Error(`iptables exited with code ${b}`))}))));else W.info("\uD83E\uDDD1\u200D\u2696\uFE0F skipping iptables update")}catch(_){if(_ instanceof Error)W.error(_.message);else{let C=xD(_);W.error("iptables exited with error",C)}}zV.setItem("lastTribunalProcessedDate",U.toISOString()),W.info(`\u2728 banned ${O} ips, didn't ban ${F} ips`);let A=X-$.usdBudget,D=A.toLocaleString("en",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:6}),J=X.toLocaleString("en",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:6}),L=Math.round(A/X*100);W.info(`\uD83D\uDCB8 spent ${D}, ${L}% of ${J} budget`)}var t0=new n9;Object.assign(console,t0.logger,{log:t0.logger.info});process.on("SIGINT",()=>{t0.logger.info("\u2757 received SIGINT; exiting gracefully"),j9()});process.on("SIGTERM",()=>{t0.logger.info("\u2757 received SIGTERM; exiting gracefully"),j9()});process.on("exit",()=>{t0.logger.info("\u2757 received exit; exiting gracefully"),j9()});t0.logger.info("\uD83D\uDEEB tribunal worker ready");var ny=new IE({usdBudget:0.01,usdMinimum:0,model:"gpt-4o-mini",apiKey:i0.API_KEY_OPENAI,cachingMode:"off",logger:t0.logger});if(i0.API_KEY_OPENAI===void 0&&!("VITEST"in import.meta.env))throw new Error("OPENAI_API_KEY is not set and vitest is not running.");await vv({generator:ny,logFilePath:"/var/log/nginx/access.log",logger:t0.logger});j9();function j9(){t0.logger.info("\uD83D\uDEEC tribunal server exiting"),process.exit(0)}
|