@miketromba/ploof 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -4
- package/SPEC.md +220 -22
- package/dist/ploof.js +223 -216
- package/package.json +5 -2
- package/skills/asset-generation/SKILL.md +1 -1
package/dist/ploof.js
CHANGED
|
@@ -1,182 +1,186 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// @bun
|
|
3
|
-
import{createRequire as
|
|
4
|
-
`)}displayWidth($){return
|
|
5
|
-
`+" ".repeat(w+
|
|
6
|
-
${
|
|
7
|
-
`)}}function
|
|
3
|
+
import{createRequire as vB}from"node:module";var GB=Object.create;var{getPrototypeOf:zB,defineProperty:Zi,getOwnPropertyNames:iB}=Object;var XB=Object.prototype.hasOwnProperty;function NB($){return this[$]}var WB,IB,SY=($,w,J)=>{var V=$!=null&&typeof $==="object";if(V){var U=w?WB??=new WeakMap:IB??=new WeakMap,G=U.get($);if(G)return G}J=$!=null?GB(zB($)):{};let z=w||!$||!$.__esModule?Zi(J,"default",{value:$,enumerable:!0}):J;for(let i of iB($))if(!XB.call(z,i))Zi(z,i,{get:NB.bind($,i),enumerable:!0});if(V)U.set($,z);return z};var Z=($,w)=>()=>(w||$((w={exports:{}}).exports,w),w.exports);var gB=($)=>$;function YB($,w){this[$]=gB.bind(null,w)}var R4=($,w)=>{for(var J in w)Zi($,J,{get:w[J],enumerable:!0,configurable:!0,set:YB.bind(w,J)})};var b4=vB(import.meta.url);var JU=Z((QB)=>{class Ti extends Error{constructor($,w,J){super(J);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=w,this.exitCode=$,this.nestedError=void 0}}class _Y extends Ti{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}QB.CommanderError=Ti;QB.InvalidArgumentError=_Y});var l0=Z((BB)=>{var{InvalidArgumentError:KB}=JU();class kY{constructor($,w){switch(this.description=w||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue($,w){if(w===this.defaultValue||!Array.isArray(w))return[$];return w.concat($)}default($,w){return this.defaultValue=$,this.defaultValueDescription=w,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(w,J)=>{if(!this.argChoices.includes(w))throw new KB(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(w,J);return w},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function uB($){let w=$.name()+($.variadic===!0?"...":"");return $.required?"<"+w+">":"["+w+"]"}BB.Argument=kY;BB.humanReadableArgName=uB});var Di=Z((ZB)=>{var{humanReadableArgName:qB}=l0();class RY{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let w=$.commands.filter((V)=>!V._hidden),J=$._getHelpCommand();if(J&&!J._hidden)w.push(J);if(this.sortSubcommands)w.sort((V,U)=>{return V.name().localeCompare(U.name())});return w}compareOptions($,w){let J=(V)=>{return V.short?V.short.replace(/^-/,""):V.long.replace(/^--/,"")};return J($).localeCompare(J(w))}visibleOptions($){let w=$.options.filter((V)=>!V.hidden),J=$._getHelpOption();if(J&&!J.hidden){let V=J.short&&$._findOption(J.short),U=J.long&&$._findOption(J.long);if(!V&&!U)w.push(J);else if(J.long&&!U)w.push($.createOption(J.long,J.description));else if(J.short&&!V)w.push($.createOption(J.short,J.description))}if(this.sortOptions)w.sort(this.compareOptions);return w}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let w=[];for(let J=$.parent;J;J=J.parent){let V=J.options.filter((U)=>!U.hidden);w.push(...V)}if(this.sortOptions)w.sort(this.compareOptions);return w}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((w)=>{w.description=w.description||$._argsDescription[w.name()]||""});if($.registeredArguments.find((w)=>w.description))return $.registeredArguments;return[]}subcommandTerm($){let w=$.registeredArguments.map((J)=>qB(J)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(w?" "+w:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,w){return w.visibleCommands($).reduce((J,V)=>{return Math.max(J,this.displayWidth(w.styleSubcommandTerm(w.subcommandTerm(V))))},0)}longestOptionTermLength($,w){return w.visibleOptions($).reduce((J,V)=>{return Math.max(J,this.displayWidth(w.styleOptionTerm(w.optionTerm(V))))},0)}longestGlobalOptionTermLength($,w){return w.visibleGlobalOptions($).reduce((J,V)=>{return Math.max(J,this.displayWidth(w.styleOptionTerm(w.optionTerm(V))))},0)}longestArgumentTermLength($,w){return w.visibleArguments($).reduce((J,V)=>{return Math.max(J,this.displayWidth(w.styleArgumentTerm(w.argumentTerm(V))))},0)}commandUsage($){let w=$._name;if($._aliases[0])w=w+"|"+$._aliases[0];let J="";for(let V=$.parent;V;V=V.parent)J=V.name()+" "+J;return J+w+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let w=[];if($.argChoices)w.push(`choices: ${$.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")w.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)w.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)w.push(`env: ${$.envVar}`);if(w.length>0)return`${$.description} (${w.join(", ")})`;return $.description}argumentDescription($){let w=[];if($.argChoices)w.push(`choices: ${$.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if($.defaultValue!==void 0)w.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(w.length>0){let J=`(${w.join(", ")})`;if($.description)return`${$.description} ${J}`;return J}return $.description}formatHelp($,w){let J=w.padWidth($,w),V=w.helpWidth??80;function U(W,I){return w.formatItem(W,J,I,w)}let G=[`${w.styleTitle("Usage:")} ${w.styleUsage(w.commandUsage($))}`,""],z=w.commandDescription($);if(z.length>0)G=G.concat([w.boxWrap(w.styleCommandDescription(z),V),""]);let i=w.visibleArguments($).map((W)=>{return U(w.styleArgumentTerm(w.argumentTerm(W)),w.styleArgumentDescription(w.argumentDescription(W)))});if(i.length>0)G=G.concat([w.styleTitle("Arguments:"),...i,""]);let N=w.visibleOptions($).map((W)=>{return U(w.styleOptionTerm(w.optionTerm(W)),w.styleOptionDescription(w.optionDescription(W)))});if(N.length>0)G=G.concat([w.styleTitle("Options:"),...N,""]);if(w.showGlobalOptions){let W=w.visibleGlobalOptions($).map((I)=>{return U(w.styleOptionTerm(w.optionTerm(I)),w.styleOptionDescription(w.optionDescription(I)))});if(W.length>0)G=G.concat([w.styleTitle("Global Options:"),...W,""])}let X=w.visibleCommands($).map((W)=>{return U(w.styleSubcommandTerm(w.subcommandTerm(W)),w.styleSubcommandDescription(w.subcommandDescription(W)))});if(X.length>0)G=G.concat([w.styleTitle("Commands:"),...X,""]);return G.join(`
|
|
4
|
+
`)}displayWidth($){return bY($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((w)=>{if(w==="[options]")return this.styleOptionText(w);if(w==="[command]")return this.styleSubcommandText(w);if(w[0]==="["||w[0]==="<")return this.styleArgumentText(w);return this.styleCommandText(w)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((w)=>{if(w==="[options]")return this.styleOptionText(w);if(w[0]==="["||w[0]==="<")return this.styleArgumentText(w);return this.styleSubcommandText(w)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,w){return Math.max(w.longestOptionTermLength($,w),w.longestGlobalOptionTermLength($,w),w.longestSubcommandTermLength($,w),w.longestArgumentTermLength($,w))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,w,J,V){let G=" ".repeat(2);if(!J)return G+$;let z=$.padEnd(w+$.length-V.displayWidth($)),i=2,X=(this.helpWidth??80)-w-i-2,W;if(X<this.minWidthToWrap||V.preformatted(J))W=J;else W=V.boxWrap(J,X).replace(/\n/g,`
|
|
5
|
+
`+" ".repeat(w+i));return G+z+" ".repeat(i)+W.replace(/\n/g,`
|
|
6
|
+
${G}`)}boxWrap($,w){if(w<this.minWidthToWrap)return $;let J=$.split(/\r\n|\n/),V=/[\s]*[^\s]+/g,U=[];return J.forEach((G)=>{let z=G.match(V);if(z===null){U.push("");return}let i=[z.shift()],N=this.displayWidth(i[0]);z.forEach((X)=>{let W=this.displayWidth(X);if(N+W<=w){i.push(X),N+=W;return}U.push(i.join(""));let I=X.trimStart();i=[I],N=this.displayWidth(I)}),U.push(i.join(""))}),U.join(`
|
|
7
|
+
`)}}function bY($){let w=/\x1b\[\d*(;\d*)*m/g;return $.replace(w,"")}ZB.Help=RY;ZB.stripColor=bY});var Li=Z((MB)=>{var{InvalidArgumentError:LB}=JU();class CY{constructor($,w){this.flags=$,this.description=w||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let J=fB($);if(this.short=J.shortFlag,this.long=J.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default($,w){return this.defaultValue=$,this.defaultValueDescription=w,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let w=$;if(typeof $==="string")w={[$]:!0};return this.implied=Object.assign(this.implied||{},w),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_concatValue($,w){if(w===this.defaultValue||!Array.isArray(w))return[$];return w.concat($)}choices($){return this.argChoices=$.slice(),this.parseArg=(w,J)=>{if(!this.argChoices.includes(w))throw new LB(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(w,J);return w},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return EY(this.name().replace(/^no-/,""));return EY(this.name())}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class jY{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((w)=>{if(w.negate)this.negativeOptions.set(w.attributeName(),w);else this.positiveOptions.set(w.attributeName(),w)}),this.negativeOptions.forEach((w,J)=>{if(this.positiveOptions.has(J))this.dualOptions.add(J)})}valueFromOption($,w){let J=w.attributeName();if(!this.dualOptions.has(J))return!0;let V=this.negativeOptions.get(J).presetArg,U=V!==void 0?V:!1;return w.negate===(U===$)}}function EY($){return $.split("-").reduce((w,J)=>{return w+J[0].toUpperCase()+J.slice(1)})}function fB($){let w,J,V=/^-[^-]$/,U=/^--[^-]/,G=$.split(/[ |,]+/).concat("guard");if(V.test(G[0]))w=G.shift();if(U.test(G[0]))J=G.shift();if(!w&&V.test(G[0]))w=G.shift();if(!w&&U.test(G[0]))w=J,J=G.shift();if(G[0].startsWith("-")){let z=G[0],i=`option creation failed due to '${z}' in option flags '${$}'`;if(/^-[^-][^-]/.test(z))throw Error(`${i}
|
|
8
8
|
- a short flag is a single dash and a single character
|
|
9
9
|
- either use a single dash and a single character (for a short flag)
|
|
10
|
-
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(
|
|
11
|
-
- too many short flags`);if(
|
|
12
|
-
- too many long flags`);throw Error(`${
|
|
13
|
-
- unrecognised flag format`)}if(w===void 0&&
|
|
14
|
-
(Did you mean one of ${
|
|
15
|
-
(Did you mean ${
|
|
16
|
-
- specify the name in Command constructor or using .name()`);if(w=w||{},w.isDefault)this._defaultCommandName=$._name;if(w.noHelp||w.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,w){return new
|
|
17
|
-
Expecting one of '${
|
|
18
|
-
- already used by option '${w.flags}'`)}this.options.push($)}_registerCommand($){let w=(
|
|
19
|
-
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,w,
|
|
20
|
-
- if '${
|
|
10
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(V.test(z))throw Error(`${i}
|
|
11
|
+
- too many short flags`);if(U.test(z))throw Error(`${i}
|
|
12
|
+
- too many long flags`);throw Error(`${i}
|
|
13
|
+
- unrecognised flag format`)}if(w===void 0&&J===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:w,longFlag:J}}MB.Option=CY;MB.DualOptions=jY});var xY=Z((RB)=>{function _B($,w){if(Math.abs($.length-w.length)>3)return Math.max($.length,w.length);let J=[];for(let V=0;V<=$.length;V++)J[V]=[V];for(let V=0;V<=w.length;V++)J[0][V]=V;for(let V=1;V<=w.length;V++)for(let U=1;U<=$.length;U++){let G=1;if($[U-1]===w[V-1])G=0;else G=1;if(J[U][V]=Math.min(J[U-1][V]+1,J[U][V-1]+1,J[U-1][V-1]+G),U>1&&V>1&&$[U-1]===w[V-2]&&$[U-2]===w[V-1])J[U][V]=Math.min(J[U][V],J[U-2][V-2]+1)}return J[$.length][w.length]}function kB($,w){if(!w||w.length===0)return"";w=Array.from(new Set(w));let J=$.startsWith("--");if(J)$=$.slice(2),w=w.map((z)=>z.slice(2));let V=[],U=3,G=0.4;if(w.forEach((z)=>{if(z.length<=1)return;let i=_B($,z),N=Math.max($.length,z.length);if((N-i)/N>G){if(i<U)U=i,V=[z];else if(i===U)V.push(z)}}),V.sort((z,i)=>z.localeCompare(i)),J)V=V.map((z)=>`--${z}`);if(V.length>1)return`
|
|
14
|
+
(Did you mean one of ${V.join(", ")}?)`;if(V.length===1)return`
|
|
15
|
+
(Did you mean ${V[0]}?)`;return""}RB.suggestSimilar=kB});var mY=Z((dB)=>{var EB=b4("node:events").EventEmitter,fi=b4("node:child_process"),E4=b4("node:path"),t0=b4("node:fs"),a=b4("node:process"),{Argument:CB,humanReadableArgName:jB}=l0(),{CommanderError:Mi}=JU(),{Help:xB,stripColor:rB}=Di(),{Option:rY,DualOptions:nB}=Li(),{suggestSimilar:nY}=xY();class Si extends EB{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(w)=>a.stdout.write(w),writeErr:(w)=>a.stderr.write(w),outputError:(w,J)=>J(w),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,getOutHasColors:()=>Ai()??(a.stdout.isTTY&&a.stdout.hasColors?.()),getErrHasColors:()=>Ai()??(a.stderr.isTTY&&a.stderr.hasColors?.()),stripColor:(w)=>rB(w)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let w=this;w;w=w.parent)$.push(w);return $}command($,w,J){let V=w,U=J;if(typeof V==="object"&&V!==null)U=V,V=null;U=U||{};let[,G,z]=$.match(/([^ ]+) *(.*)/),i=this.createCommand(G);if(V)i.description(V),i._executableHandler=!0;if(U.isDefault)this._defaultCommandName=i._name;if(i._hidden=!!(U.noHelp||U.hidden),i._executableFile=U.executableFile||null,z)i.arguments(z);if(this._registerCommand(i),i.parent=this,i.copyInheritedSettings(this),V)return this;return i}createCommand($){return new Si($)}createHelp(){return Object.assign(new xB,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,$),this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,w){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
|
|
16
|
+
- specify the name in Command constructor or using .name()`);if(w=w||{},w.isDefault)this._defaultCommandName=$._name;if(w.noHelp||w.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,w){return new CB($,w)}argument($,w,J,V){let U=this.createArgument($,w);if(typeof J==="function")U.default(V).argParser(J);else U.default(J);return this.addArgument(U),this}arguments($){return $.trim().split(/ +/).forEach((w)=>{this.argument(w)}),this}addArgument($){let w=this.registeredArguments.slice(-1)[0];if(w&&w.variadic)throw Error(`only the last argument can be variadic '${w.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,w){if(typeof $==="boolean")return this._addImplicitHelpCommand=$,this;$=$??"help [command]";let[,J,V]=$.match(/([^ ]+) *(.*)/),U=w??"display help for command",G=this.createCommand(J);if(G.helpOption(!1),V)G.arguments(V);if(U)G.description(U);return this._addImplicitHelpCommand=!0,this._helpCommand=G,this}addHelpCommand($,w){if(typeof $!=="object")return this.helpCommand($,w),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook($,w){let J=["preSubcommand","preAction","postAction"];if(!J.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
|
|
17
|
+
Expecting one of '${J.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(w);else this._lifeCycleHooks[$]=[w];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(w)=>{if(w.code!=="commander.executeSubCommandAsync")throw w};return this}_exit($,w,J){if(this._exitCallback)this._exitCallback(new Mi($,w,J));a.exit($)}action($){let w=(J)=>{let V=this.registeredArguments.length,U=J.slice(0,V);if(this._storeOptionsAsProperties)U[V]=this;else U[V]=this.opts();return U.push(this),$.apply(this,U)};return this._actionHandler=w,this}createOption($,w){return new rY($,w)}_callParseArg($,w,J,V){try{return $.parseArg(w,J)}catch(U){if(U.code==="commander.invalidArgument"){let G=`${V} ${U.message}`;this.error(G,{exitCode:U.exitCode,code:U.code})}throw U}}_registerOption($){let w=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(w){let J=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${J}'
|
|
18
|
+
- already used by option '${w.flags}'`)}this.options.push($)}_registerCommand($){let w=(V)=>{return[V.name()].concat(V.aliases())},J=w($).find((V)=>this._findCommand(V));if(J){let V=w(this._findCommand(J)).join("|"),U=w($).join("|");throw Error(`cannot add command '${U}' as already have command '${V}'`)}this.commands.push($)}addOption($){this._registerOption($);let w=$.name(),J=$.attributeName();if($.negate){let U=$.long.replace(/^--no-/,"--");if(!this._findOption(U))this.setOptionValueWithSource(J,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(J,$.defaultValue,"default");let V=(U,G,z)=>{if(U==null&&$.presetArg!==void 0)U=$.presetArg;let i=this.getOptionValue(J);if(U!==null&&$.parseArg)U=this._callParseArg($,U,i,G);else if(U!==null&&$.variadic)U=$._concatValue(U,i);if(U==null)if($.negate)U=!1;else if($.isBoolean()||$.optional)U=!0;else U="";this.setOptionValueWithSource(J,U,z)};if(this.on("option:"+w,(U)=>{let G=`error: option '${$.flags}' argument '${U}' is invalid.`;V(U,G,"cli")}),$.envVar)this.on("optionEnv:"+w,(U)=>{let G=`error: option '${$.flags}' value '${U}' from env '${$.envVar}' is invalid.`;V(U,G,"env")});return this}_optionEx($,w,J,V,U){if(typeof w==="object"&&w instanceof rY)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let G=this.createOption(w,J);if(G.makeOptionMandatory(!!$.mandatory),typeof V==="function")G.default(U).argParser(V);else if(V instanceof RegExp){let z=V;V=(i,N)=>{let X=z.exec(i);return X?X[0]:N},G.default(U).argParser(V)}else G.default(V);return this.addOption(G)}option($,w,J,V){return this._optionEx({},$,w,J,V)}requiredOption($,w,J,V){return this._optionEx({mandatory:!0},$,w,J,V)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,w){return this.setOptionValueWithSource($,w,void 0)}setOptionValueWithSource($,w,J){if(this._storeOptionsAsProperties)this[$]=w;else this._optionValues[$]=w;return this._optionValueSources[$]=J,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let w;return this._getCommandAndAncestors().forEach((J)=>{if(J.getOptionValueSource($)!==void 0)w=J.getOptionValueSource($)}),w}_prepareUserArgs($,w){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(w=w||{},$===void 0&&w.from===void 0){if(a.versions?.electron)w.from="electron";let V=a.execArgv??[];if(V.includes("-e")||V.includes("--eval")||V.includes("-p")||V.includes("--print"))w.from="eval"}if($===void 0)$=a.argv;this.rawArgs=$.slice();let J;switch(w.from){case void 0:case"node":this._scriptPath=$[1],J=$.slice(2);break;case"electron":if(a.defaultApp)this._scriptPath=$[1],J=$.slice(2);else J=$.slice(1);break;case"user":J=$.slice(0);break;case"eval":J=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${w.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",J}parse($,w){this._prepareForParse();let J=this._prepareUserArgs($,w);return this._parseCommand([],J),this}async parseAsync($,w){this._prepareForParse();let J=this._prepareUserArgs($,w);return await this._parseCommand([],J),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
19
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,w,J){if(t0.existsSync($))return;let V=w?`searched for local subcommand relative to directory '${w}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",U=`'${$}' does not exist
|
|
20
|
+
- if '${J}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
21
21
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
22
|
-
- ${
|
|
22
|
+
- ${V}`;throw Error(U)}_executeSubCommand($,w){w=w.slice();let J=!1,V=[".js",".ts",".tsx",".mjs",".cjs"];function U(X,W){let I=E4.resolve(X,W);if(t0.existsSync(I))return I;if(V.includes(E4.extname(W)))return;let g=V.find((Y)=>t0.existsSync(`${I}${Y}`));if(g)return`${I}${g}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let G=$._executableFile||`${this._name}-${$._name}`,z=this._executableDir||"";if(this._scriptPath){let X;try{X=t0.realpathSync(this._scriptPath)}catch{X=this._scriptPath}z=E4.resolve(E4.dirname(X),z)}if(z){let X=U(z,G);if(!X&&!$._executableFile&&this._scriptPath){let W=E4.basename(this._scriptPath,E4.extname(this._scriptPath));if(W!==this._name)X=U(z,`${W}-${$._name}`)}G=X||G}J=V.includes(E4.extname(G));let i;if(a.platform!=="win32")if(J)w.unshift(G),w=dY(a.execArgv).concat(w),i=fi.spawn(a.argv[0],w,{stdio:"inherit"});else i=fi.spawn(G,w,{stdio:"inherit"});else this._checkForMissingExecutable(G,z,$._name),w.unshift(G),w=dY(a.execArgv).concat(w),i=fi.spawn(a.execPath,w,{stdio:"inherit"});if(!i.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((W)=>{a.on(W,()=>{if(i.killed===!1&&i.exitCode===null)i.kill(W)})});let N=this._exitCallback;i.on("close",(X)=>{if(X=X??1,!N)a.exit(X);else N(new Mi(X,"commander.executeSubCommandAsync","(close)"))}),i.on("error",(X)=>{if(X.code==="ENOENT")this._checkForMissingExecutable(G,z,$._name);else if(X.code==="EACCES")throw Error(`'${G}' not executable`);if(!N)a.exit(1);else{let W=new Mi(1,"commander.executeSubCommandAsync","(error)");W.nestedError=X,N(W)}}),this.runningCommand=i}_dispatchSubcommand($,w,J){let V=this._findCommand($);if(!V)this.help({error:!0});V._prepareForParse();let U;return U=this._chainOrCallSubCommandHook(U,V,"preSubcommand"),U=this._chainOrCall(U,()=>{if(V._executableHandler)this._executeSubCommand(V,w.concat(J));else return V._parseCommand(w,J)}),U}_dispatchHelpCommand($){if(!$)this.help();let w=this._findCommand($);if(w&&!w._executableHandler)w.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,w)=>{if($.required&&this.args[w]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(J,V,U)=>{let G=V;if(V!==null&&J.parseArg){let z=`error: command-argument value '${V}' is invalid for argument '${J.name()}'.`;G=this._callParseArg(J,V,U,z)}return G};this._checkNumberOfArguments();let w=[];this.registeredArguments.forEach((J,V)=>{let U=J.defaultValue;if(J.variadic){if(V<this.args.length){if(U=this.args.slice(V),J.parseArg)U=U.reduce((G,z)=>{return $(J,z,G)},J.defaultValue)}else if(U===void 0)U=[]}else if(V<this.args.length){if(U=this.args[V],J.parseArg)U=$(J,U,J.defaultValue)}w[V]=U}),this.processedArgs=w}_chainOrCall($,w){if($&&$.then&&typeof $.then==="function")return $.then(()=>w());return w()}_chainOrCallHooks($,w){let J=$,V=[];if(this._getCommandAndAncestors().reverse().filter((U)=>U._lifeCycleHooks[w]!==void 0).forEach((U)=>{U._lifeCycleHooks[w].forEach((G)=>{V.push({hookedCommand:U,callback:G})})}),w==="postAction")V.reverse();return V.forEach((U)=>{J=this._chainOrCall(J,()=>{return U.callback(U.hookedCommand,this)})}),J}_chainOrCallSubCommandHook($,w,J){let V=$;if(this._lifeCycleHooks[J]!==void 0)this._lifeCycleHooks[J].forEach((U)=>{V=this._chainOrCall(V,()=>{return U(this,w)})});return V}_parseCommand($,w){let J=this.parseOptions(w);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(J.operands),w=J.unknown,this.args=$.concat(w),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),w);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(w),this._dispatchSubcommand(this._defaultCommandName,$,w);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(J.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let V=()=>{if(J.unknown.length>0)this.unknownOption(J.unknown[0])},U=`command:${this.name()}`;if(this._actionHandler){V(),this._processArguments();let G;if(G=this._chainOrCallHooks(G,"preAction"),G=this._chainOrCall(G,()=>this._actionHandler(this.processedArgs)),this.parent)G=this._chainOrCall(G,()=>{this.parent.emit(U,$,w)});return G=this._chainOrCallHooks(G,"postAction"),G}if(this.parent&&this.parent.listenerCount(U))V(),this._processArguments(),this.parent.emit(U,$,w);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,w);if(this.listenerCount("command:*"))this.emit("command:*",$,w);else if(this.commands.length)this.unknownCommand();else V(),this._processArguments()}else if(this.commands.length)V(),this.help({error:!0});else V(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((w)=>w._name===$||w._aliases.includes($))}_findOption($){return this.options.find((w)=>w.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((w)=>{if(w.mandatory&&$.getOptionValue(w.attributeName())===void 0)$.missingMandatoryOptionValue(w)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((J)=>{let V=J.attributeName();if(this.getOptionValue(V)===void 0)return!1;return this.getOptionValueSource(V)!=="default"});$.filter((J)=>J.conflictsWith.length>0).forEach((J)=>{let V=$.find((U)=>J.conflictsWith.includes(U.attributeName()));if(V)this._conflictingOption(J,V)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let w=[],J=[],V=w,U=$.slice();function G(i){return i.length>1&&i[0]==="-"}let z=null;while(U.length){let i=U.shift();if(i==="--"){if(V===J)V.push(i);V.push(...U);break}if(z&&!G(i)){this.emit(`option:${z.name()}`,i);continue}if(z=null,G(i)){let N=this._findOption(i);if(N){if(N.required){let X=U.shift();if(X===void 0)this.optionMissingArgument(N);this.emit(`option:${N.name()}`,X)}else if(N.optional){let X=null;if(U.length>0&&!G(U[0]))X=U.shift();this.emit(`option:${N.name()}`,X)}else this.emit(`option:${N.name()}`);z=N.variadic?N:null;continue}}if(i.length>2&&i[0]==="-"&&i[1]!=="-"){let N=this._findOption(`-${i[1]}`);if(N){if(N.required||N.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${N.name()}`,i.slice(2));else this.emit(`option:${N.name()}`),U.unshift(`-${i.slice(2)}`);continue}}if(/^--[^=]+=/.test(i)){let N=i.indexOf("="),X=this._findOption(i.slice(0,N));if(X&&(X.required||X.optional)){this.emit(`option:${X.name()}`,i.slice(N+1));continue}}if(G(i))V=J;if((this._enablePositionalOptions||this._passThroughOptions)&&w.length===0&&J.length===0){if(this._findCommand(i)){if(w.push(i),U.length>0)J.push(...U);break}else if(this._getHelpCommand()&&i===this._getHelpCommand().name()){if(w.push(i),U.length>0)w.push(...U);break}else if(this._defaultCommandName){if(J.push(i),U.length>0)J.push(...U);break}}if(this._passThroughOptions){if(V.push(i),U.length>0)V.push(...U);break}V.push(i)}return{operands:w,unknown:J}}opts(){if(this._storeOptionsAsProperties){let $={},w=this.options.length;for(let J=0;J<w;J++){let V=this.options[J].attributeName();$[V]=V===this._versionOptionName?this._version:this[V]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,w)=>Object.assign($,w.opts()),{})}error($,w){if(this._outputConfiguration.outputError(`${$}
|
|
23
23
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
24
24
|
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
|
|
25
|
-
`),this.outputHelp({error:!0});let
|
|
26
|
-
`),this._exit(0,"commander.version",$)}),this}description($,w){if($===void 0&&w===void 0)return this._description;if(this._description=$,w)this._argsDescription=w;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let w=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)w=this.commands[this.commands.length-1];if($===w._name)throw Error("Command alias can't be the same as its name");let
|
|
27
|
-
Expecting one of '${
|
|
28
|
-
`)}),this}_outputHelpIfRequested($){let w=this._getHelpOption();if(w&&$.find((v)=>w.is(v)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function n8($){return $.map((w)=>{if(!w.startsWith("--inspect"))return w;let U,v="127.0.0.1",J="9229",z;if((z=w.match(/^(--inspect(-brk)?)$/))!==null)U=z[1];else if((z=w.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(U=z[1],/^\d+$/.test(z[3]))J=z[3];else v=z[3];else if((z=w.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)U=z[1],v=z[3],J=z[4];if(U&&J!=="0")return`${U}=${v}:${parseInt(J)+1}`;return w})}function O2(){if(o.env.NO_COLOR||o.env.FORCE_COLOR==="0"||o.env.FORCE_COLOR==="false")return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0;return}OP.Command=B2;OP.useColor=O2});var o8=E((uP)=>{var{Argument:c8}=sJ(),{Command:q2}=h8(),{CommanderError:LP,InvalidArgumentError:l8}=QU(),{Help:HP}=W2(),{Option:t8}=Y2();uP.program=new q2;uP.createCommand=($)=>new q2($);uP.createOption=($,w)=>new t8($,w);uP.createArgument=($,w)=>new c8($,w);uP.Command=q2;uP.Option=t8;uP.Argument=c8;uP.Help=HP;uP.CommanderError=LP;uP.InvalidArgumentError=l8;uP.InvalidOptionArgumentError=l8});var t=E((Ku)=>{var gN=Symbol.for("yaml.alias"),mY=Symbol.for("yaml.document"),Qz=Symbol.for("yaml.map"),nY=Symbol.for("yaml.pair"),VN=Symbol.for("yaml.scalar"),Pz=Symbol.for("yaml.seq"),b4=Symbol.for("yaml.node.type"),Pu=($)=>!!$&&typeof $==="object"&&$[b4]===gN,Ou=($)=>!!$&&typeof $==="object"&&$[b4]===mY,Bu=($)=>!!$&&typeof $==="object"&&$[b4]===Qz,qu=($)=>!!$&&typeof $==="object"&&$[b4]===nY,hY=($)=>!!$&&typeof $==="object"&&$[b4]===VN,Lu=($)=>!!$&&typeof $==="object"&&$[b4]===Pz;function cY($){if($&&typeof $==="object")switch($[b4]){case Qz:case Pz:return!0}return!1}function Hu($){if($&&typeof $==="object")switch($[b4]){case gN:case Qz:case VN:case Pz:return!0}return!1}var uu=($)=>(hY($)||cY($))&&!!$.anchor;Ku.ALIAS=gN;Ku.DOC=mY;Ku.MAP=Qz;Ku.NODE_TYPE=b4;Ku.PAIR=nY;Ku.SCALAR=VN;Ku.SEQ=Pz;Ku.hasAnchor=uu;Ku.isAlias=Pu;Ku.isCollection=cY;Ku.isDocument=Ou;Ku.isMap=Bu;Ku.isNode=Hu;Ku.isPair=qu;Ku.isScalar=hY;Ku.isSeq=Lu});var ZJ=E((ru)=>{var W$=t(),S$=Symbol("break visit"),lY=Symbol("skip children"),N4=Symbol("remove node");function Oz($,w){let U=tY(w);if(W$.isDocument($)){if(vU(null,$.contents,U,Object.freeze([$]))===N4)$.contents=null}else vU(null,$,U,Object.freeze([]))}Oz.BREAK=S$;Oz.SKIP=lY;Oz.REMOVE=N4;function vU($,w,U,v){let J=oY($,w,U,v);if(W$.isNode(J)||W$.isPair(J))return pY($,v,J),vU($,J,U,v);if(typeof J!=="symbol"){if(W$.isCollection(w)){v=Object.freeze(v.concat(w));for(let z=0;z<w.items.length;++z){let g=vU(z,w.items[z],U,v);if(typeof g==="number")z=g-1;else if(g===S$)return S$;else if(g===N4)w.items.splice(z,1),z-=1}}else if(W$.isPair(w)){v=Object.freeze(v.concat(w));let z=vU("key",w.key,U,v);if(z===S$)return S$;else if(z===N4)w.key=null;let g=vU("value",w.value,U,v);if(g===S$)return S$;else if(g===N4)w.value=null}}return J}async function Bz($,w){let U=tY(w);if(W$.isDocument($)){if(await zU(null,$.contents,U,Object.freeze([$]))===N4)$.contents=null}else await zU(null,$,U,Object.freeze([]))}Bz.BREAK=S$;Bz.SKIP=lY;Bz.REMOVE=N4;async function zU($,w,U,v){let J=await oY($,w,U,v);if(W$.isNode(J)||W$.isPair(J))return pY($,v,J),zU($,J,U,v);if(typeof J!=="symbol"){if(W$.isCollection(w)){v=Object.freeze(v.concat(w));for(let z=0;z<w.items.length;++z){let g=await zU(z,w.items[z],U,v);if(typeof g==="number")z=g-1;else if(g===S$)return S$;else if(g===N4)w.items.splice(z,1),z-=1}}else if(W$.isPair(w)){v=Object.freeze(v.concat(w));let z=await zU("key",w.key,U,v);if(z===S$)return S$;else if(z===N4)w.key=null;let g=await zU("value",w.value,U,v);if(g===S$)return S$;else if(g===N4)w.value=null}}return J}function tY($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function oY($,w,U,v){if(typeof U==="function")return U($,w,v);if(W$.isMap(w))return U.Map?.($,w,v);if(W$.isSeq(w))return U.Seq?.($,w,v);if(W$.isPair(w))return U.Pair?.($,w,v);if(W$.isScalar(w))return U.Scalar?.($,w,v);if(W$.isAlias(w))return U.Alias?.($,w,v);return}function pY($,w,U){let v=w[w.length-1];if(W$.isCollection(v))v.items[$]=U;else if(W$.isPair(v))if($==="key")v.key=U;else v.value=U;else if(W$.isDocument(v))v.contents=U;else{let J=W$.isAlias(v)?"alias":"scalar";throw Error(`Cannot replace node with ${J} parent`)}}ru.visit=Oz;ru.visitAsync=Bz});var GN=E((cu)=>{var aY=t(),mu=ZJ(),nu={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},hu=($)=>$.replace(/[!,[\]{}]/g,(w)=>nu[w]);class c${constructor($,w){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},c$.defaultYaml,$),this.tags=Object.assign({},c$.defaultTags,w)}clone(){let $=new c$(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new c$(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:c$.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},c$.defaultTags);break}return $}add($,w){if(this.atNextDocument)this.yaml={explicit:c$.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},c$.defaultTags),this.atNextDocument=!1;let U=$.trim().split(/[ \t]+/),v=U.shift();switch(v){case"%TAG":{if(U.length!==2){if(w(0,"%TAG directive should contain exactly two parts"),U.length<2)return!1}let[J,z]=U;return this.tags[J]=z,!0}case"%YAML":{if(this.yaml.explicit=!0,U.length!==1)return w(0,"%YAML directive should contain exactly one part"),!1;let[J]=U;if(J==="1.1"||J==="1.2")return this.yaml.version=J,!0;else{let z=/^\d+\.\d+$/.test(J);return w(6,`Unsupported YAML version ${J}`,z),!1}}default:return w(0,`Unknown directive ${v}`,!0),!1}}tagName($,w){if($==="!")return"!";if($[0]!=="!")return w(`Not a valid tag: ${$}`),null;if($[1]==="<"){let z=$.slice(2,-1);if(z==="!"||z==="!!")return w(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")w("Verbatim tags must end with a >");return z}let[,U,v]=$.match(/^(.*!)([^!]*)$/s);if(!v)w(`The ${$} tag has no suffix`);let J=this.tags[U];if(J)try{return J+decodeURIComponent(v)}catch(z){return w(String(z)),null}if(U==="!")return $;return w(`Could not resolve tag: ${$}`),null}tagString($){for(let[w,U]of Object.entries(this.tags))if($.startsWith(U))return w+hu($.substring(U.length));return $[0]==="!"?$:`!<${$}>`}toString($){let w=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],U=Object.entries(this.tags),v;if($&&U.length>0&&aY.isNode($.contents)){let J={};mu.visit($.contents,(z,g)=>{if(aY.isNode(g)&&g.tag)J[g.tag]=!0}),v=Object.keys(J)}else v=[];for(let[J,z]of U){if(J==="!!"&&z==="tag:yaml.org,2002:")continue;if(!$||v.some((g)=>g.startsWith(z)))w.push(`%TAG ${J} ${z}`)}return w.join(`
|
|
29
|
-
`)
|
|
30
|
-
`)
|
|
25
|
+
`),this.outputHelp({error:!0});let J=w||{},V=J.exitCode||1,U=J.code||"commander.error";this._exit(V,U,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in a.env){let w=$.attributeName();if(this.getOptionValue(w)===void 0||["default","config","env"].includes(this.getOptionValueSource(w)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,a.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new nB(this.options),w=(J)=>{return this.getOptionValue(J)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(J))};this.options.filter((J)=>J.implied!==void 0&&w(J.attributeName())&&$.valueFromOption(this.getOptionValue(J.attributeName()),J)).forEach((J)=>{Object.keys(J.implied).filter((V)=>!w(V)).forEach((V)=>{this.setOptionValueWithSource(V,J.implied[V],"implied")})})}missingArgument($){let w=`error: missing required argument '${$}'`;this.error(w,{code:"commander.missingArgument"})}optionMissingArgument($){let w=`error: option '${$.flags}' argument missing`;this.error(w,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let w=`error: required option '${$.flags}' not specified`;this.error(w,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,w){let J=(G)=>{let z=G.attributeName(),i=this.getOptionValue(z),N=this.options.find((W)=>W.negate&&z===W.attributeName()),X=this.options.find((W)=>!W.negate&&z===W.attributeName());if(N&&(N.presetArg===void 0&&i===!1||N.presetArg!==void 0&&i===N.presetArg))return N;return X||G},V=(G)=>{let z=J(G),i=z.attributeName();if(this.getOptionValueSource(i)==="env")return`environment variable '${z.envVar}'`;return`option '${z.flags}'`},U=`error: ${V($)} cannot be used with ${V(w)}`;this.error(U,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let w="";if($.startsWith("--")&&this._showSuggestionAfterError){let V=[],U=this;do{let G=U.createHelp().visibleOptions(U).filter((z)=>z.long).map((z)=>z.long);V=V.concat(G),U=U.parent}while(U&&!U._enablePositionalOptions);w=nY($,V)}let J=`error: unknown option '${$}'${w}`;this.error(J,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let w=this.registeredArguments.length,J=w===1?"":"s",U=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${w} argument${J} but got ${$.length}.`;this.error(U,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],w="";if(this._showSuggestionAfterError){let V=[];this.createHelp().visibleCommands(this).forEach((U)=>{if(V.push(U.name()),U.alias())V.push(U.alias())}),w=nY($,V)}let J=`error: unknown command '${$}'${w}`;this.error(J,{code:"commander.unknownCommand"})}version($,w,J){if($===void 0)return this._version;this._version=$,w=w||"-V, --version",J=J||"output the version number";let V=this.createOption(w,J);return this._versionOptionName=V.attributeName(),this._registerOption(V),this.on("option:"+V.name(),()=>{this._outputConfiguration.writeOut(`${$}
|
|
26
|
+
`),this._exit(0,"commander.version",$)}),this}description($,w){if($===void 0&&w===void 0)return this._description;if(this._description=$,w)this._argsDescription=w;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let w=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)w=this.commands[this.commands.length-1];if($===w._name)throw Error("Command alias can't be the same as its name");let J=this.parent?._findCommand($);if(J){let V=[J.name()].concat(J.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${V}'`)}return w._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((w)=>this.alias(w)),this}usage($){if($===void 0){if(this._usage)return this._usage;let w=this.registeredArguments.map((J)=>{return jB(J)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?w:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}nameFromFilename($){return this._name=E4.basename($,E4.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let w=this.createHelp(),J=this._getOutputContext($);w.prepareContext({error:J.error,helpWidth:J.helpWidth,outputHasColors:J.hasColors});let V=w.formatHelp(this,w);if(J.hasColors)return V;return this._outputConfiguration.stripColor(V)}_getOutputContext($){$=$||{};let w=!!$.error,J,V,U;if(w)J=(z)=>this._outputConfiguration.writeErr(z),V=this._outputConfiguration.getErrHasColors(),U=this._outputConfiguration.getErrHelpWidth();else J=(z)=>this._outputConfiguration.writeOut(z),V=this._outputConfiguration.getOutHasColors(),U=this._outputConfiguration.getOutHelpWidth();return{error:w,write:(z)=>{if(!V)z=this._outputConfiguration.stripColor(z);return J(z)},hasColors:V,helpWidth:U}}outputHelp($){let w;if(typeof $==="function")w=$,$=void 0;let J=this._getOutputContext($),V={error:J.error,write:J.write,command:this};this._getCommandAndAncestors().reverse().forEach((G)=>G.emit("beforeAllHelp",V)),this.emit("beforeHelp",V);let U=this.helpInformation({error:J.error});if(w){if(U=w(U),typeof U!=="string"&&!Buffer.isBuffer(U))throw Error("outputHelp callback must return a string or a Buffer")}if(J.write(U),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",V),this._getCommandAndAncestors().forEach((G)=>G.emit("afterAllHelp",V))}helpOption($,w){if(typeof $==="boolean"){if($)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return $=$??"-h, --help",w=w??"display help for command",this._helpOption=this.createOption($,w),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this}help($){this.outputHelp($);let w=Number(a.exitCode??0);if(w===0&&$&&typeof $!=="function"&&$.error)w=1;this._exit(w,"commander.help","(outputHelp)")}addHelpText($,w){let J=["beforeAll","before","after","afterAll"];if(!J.includes($))throw Error(`Unexpected value for position to addHelpText.
|
|
27
|
+
Expecting one of '${J.join("', '")}'`);let V=`${$}Help`;return this.on(V,(U)=>{let G;if(typeof w==="function")G=w({error:U.error,command:U.command});else G=w;if(G)U.write(`${G}
|
|
28
|
+
`)}),this}_outputHelpIfRequested($){let w=this._getHelpOption();if(w&&$.find((V)=>w.is(V)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function dY($){return $.map((w)=>{if(!w.startsWith("--inspect"))return w;let J,V="127.0.0.1",U="9229",G;if((G=w.match(/^(--inspect(-brk)?)$/))!==null)J=G[1];else if((G=w.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(J=G[1],/^\d+$/.test(G[3]))U=G[3];else V=G[3];else if((G=w.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)J=G[1],V=G[3],U=G[4];if(J&&U!=="0")return`${J}=${V}:${parseInt(U)+1}`;return w})}function Ai(){if(a.env.NO_COLOR||a.env.FORCE_COLOR==="0"||a.env.FORCE_COLOR==="false")return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0;return}dB.Command=Si;dB.useColor=Ai});var lY=Z((lB)=>{var{Argument:yY}=l0(),{Command:_i}=mY(),{CommanderError:hB,InvalidArgumentError:hY}=JU(),{Help:cB}=Di(),{Option:cY}=Li();lB.program=new _i;lB.createCommand=($)=>new _i($);lB.createOption=($,w)=>new cY($,w);lB.createArgument=($,w)=>new yY($,w);lB.Command=_i;lB.Option=cY;lB.Argument=yY;lB.Help=cB;lB.CommanderError=hB;lB.InvalidArgumentError=hY;lB.InvalidOptionArgumentError=hY});var O9=Z((M4)=>{var iD=M4&&M4.__awaiter||function($,w,J,V){function U(G){return G instanceof J?G:new J(function(z){z(G)})}return new(J||(J=Promise))(function(G,z){function i(W){try{X(V.next(W))}catch(I){z(I)}}function N(W){try{X(V.throw(W))}catch(I){z(I)}}function X(W){W.done?G(W.value):U(W.value).then(i,N)}X((V=V.apply($,w||[])).next())})};Object.defineProperty(M4,"__esModule",{value:!0});M4.TARGET_URL_HEADER=void 0;M4.withMiddleware=XD;M4.withProxy=WD;function XD(...$){let w=(J)=>typeof J==="function";return(J)=>iD(this,void 0,void 0,function*(){let V=Object.assign({},J);for(let U of $.filter(w))V=yield U(V);return V})}M4.TARGET_URL_HEADER="x-fal-target-url";function ND($){let w={isBrowser:typeof window<"u"&&typeof window.document<"u"};if(typeof $==="function")return $(w);if($==="always")return!0;return w.isBrowser}function WD($){return(w)=>{if(w.headers&&M4.TARGET_URL_HEADER in w.headers)return Promise.resolve(w);if(!ND($.when))return Promise.resolve(w);return Promise.resolve(Object.assign(Object.assign({},w),{url:$.targetUrl,headers:Object.assign(Object.assign({},w.headers||{}),{[M4.TARGET_URL_HEADER]:w.url})}))}}});var Vz=Z((ZQ)=>{Object.defineProperty(ZQ,"__esModule",{value:!0});ZQ.RUNNER_HINT_HEADER=ZQ.QUEUE_PRIORITY_HEADER=ZQ.REQUEST_TIMEOUT_TYPE_HEADER=ZQ.REQUEST_TIMEOUT_HEADER=ZQ.MIN_REQUEST_TIMEOUT_SECONDS=void 0;ZQ.validateTimeoutHeader=qQ;ZQ.buildTimeoutHeaders=ID;ZQ.MIN_REQUEST_TIMEOUT_SECONDS=1;ZQ.REQUEST_TIMEOUT_HEADER="x-fal-request-timeout";ZQ.REQUEST_TIMEOUT_TYPE_HEADER="x-fal-request-timeout-type";ZQ.QUEUE_PRIORITY_HEADER="x-fal-queue-priority";ZQ.RUNNER_HINT_HEADER="x-fal-runner-hint";function qQ($){if(typeof $!=="number"||isNaN($))throw Error(`Timeout must be a number, got ${$}`);if($<=ZQ.MIN_REQUEST_TIMEOUT_SECONDS)throw Error(`Timeout must be greater than ${ZQ.MIN_REQUEST_TIMEOUT_SECONDS} seconds`);return $.toString()}function ID($){if($===void 0)return{};return{[ZQ.REQUEST_TIMEOUT_HEADER]:qQ($)}}});var B6=Z((A4)=>{var LQ=A4&&A4.__awaiter||function($,w,J,V){function U(G){return G instanceof J?G:new J(function(z){z(G)})}return new(J||(J=Promise))(function(G,z){function i(W){try{X(V.next(W))}catch(I){z(I)}}function N(W){try{X(V.throw(W))}catch(I){z(I)}}function X(W){W.done?G(W.value):U(W.value).then(i,N)}X((V=V.apply($,w||[])).next())})};Object.defineProperty(A4,"__esModule",{value:!0});A4.ValidationError=A4.ApiError=void 0;A4.defaultResponseHandler=MQ;A4.resultResponseHandler=PD;var OD=Vz(),fQ="x-fal-request-id";class v0 extends Error{constructor({message:$,status:w,body:J,requestId:V,timeoutType:U}){super($);this.name="ApiError",this.status=w,this.body=J,this.requestId=V||"",this.timeoutType=U}get isUserTimeout(){return this.status===504&&this.timeoutType==="user"}}A4.ApiError=v0;class K9 extends v0{constructor($){super($);this.name="ValidationError"}get fieldErrors(){if(typeof this.body.detail==="string")return[{loc:["body"],msg:this.body.detail,type:"value_error"}];return this.body.detail||[]}getFieldErrors($){return this.fieldErrors.filter((w)=>w.loc[w.loc.length-1]===$)}}A4.ValidationError=K9;function MQ($){return LQ(this,void 0,void 0,function*(){var w;let{status:J,statusText:V}=$,U=(w=$.headers.get("Content-Type"))!==null&&w!==void 0?w:"",G=$.headers.get(fQ)||void 0,z=$.headers.get(OD.REQUEST_TIMEOUT_TYPE_HEADER)||void 0;if(!$.ok){if(U.includes("application/json")){let i=yield $.json();throw new(J===422?K9:v0)({message:i.message||V,status:J,body:i,requestId:G,timeoutType:z})}throw new v0({message:`HTTP ${J}: ${V}`,status:J,requestId:G,timeoutType:z})}if(U.includes("application/json"))return $.json();if(U.includes("text/html"))return $.text();if(U.includes("application/octet-stream"))return $.arrayBuffer();return $.text()})}function PD($){return LQ(this,void 0,void 0,function*(){return{data:yield MQ($),requestId:$.headers.get(fQ)||""}})}});var c4=Z((J4)=>{var KD=J4&&J4.__awaiter||function($,w,J,V){function U(G){return G instanceof J?G:new J(function(z){z(G)})}return new(J||(J=Promise))(function(G,z){function i(W){try{X(V.next(W))}catch(I){z(I)}}function N(W){try{X(V.throw(W))}catch(I){z(I)}}function X(W){W.done?G(W.value):U(W.value).then(i,N)}X((V=V.apply($,w||[])).next())})};Object.defineProperty(J4,"__esModule",{value:!0});J4.ensureEndpointIdFormat=AQ;J4.parseEndpointId=BD;J4.resolveEndpointPath=HD;J4.isValidUrl=FD;J4.throttle=qD;J4.isReact=ZD;J4.isPlainObject=TD;J4.sleep=DD;function AQ($){if($.split("/").length>1)return $;let[,J,V]=/^([0-9]+)-([a-zA-Z0-9-]+)$/.exec($)||[];if(J&&V)return`${J}/${V}`;throw Error(`Invalid app id: ${$}. Must be in the format <appOwner>/<appId>`)}var uD=["workflows","comfy"];function BD($){let J=AQ($).split("/");if(uD.includes(J[0]))return{owner:J[1],alias:J[2],path:J.slice(3).join("/")||void 0,namespace:J[0]};return{owner:J[0],alias:J[1],path:J.slice(2).join("/")||void 0}}function HD($,w,J){if(w)return`/${w.replace(/^\/+/,"")}`;if($.endsWith(J))return;return J}function FD($){try{let{host:w}=new URL($);return/(fal\.(ai|run))$/.test(w)}catch(w){return!1}}function qD($,w,J=!1){let V,U;return(...G)=>{if(!U&&J)$(...G),U=Date.now();else{if(V)clearTimeout(V);V=setTimeout(()=>{if(Date.now()-U>=w)$(...G),U=Date.now()},w-(Date.now()-U))}}}var u9;function ZD(){if(u9===void 0){let $=Error().stack;u9=!!$&&($.includes("node_modules/react-dom/")||$.includes("node_modules/next/"))}return u9}function TD($){return!!$&&Object.getPrototypeOf($)===Object.prototype}function DD($){return KD(this,void 0,void 0,function*(){return new Promise((w)=>setTimeout(w,$))})}});var Q0=Z((e$)=>{var LD=e$&&e$.__awaiter||function($,w,J,V){function U(G){return G instanceof J?G:new J(function(z){z(G)})}return new(J||(J=Promise))(function(G,z){function i(W){try{X(V.next(W))}catch(I){z(I)}}function N(W){try{X(V.throw(W))}catch(I){z(I)}}function X(W){W.done?G(W.value):U(W.value).then(i,N)}X((V=V.apply($,w||[])).next())})};Object.defineProperty(e$,"__esModule",{value:!0});e$.DEFAULT_RETRY_OPTIONS=e$.DEFAULT_RETRYABLE_STATUS_CODES=void 0;e$.isRetryableNetworkError=SQ;e$.isRetryableError=_Q;e$.calculateBackoffDelay=kQ;e$.executeWithRetry=SD;var fD=B6(),MD=c4();e$.DEFAULT_RETRYABLE_STATUS_CODES=[429,502,503,504];e$.DEFAULT_RETRY_OPTIONS={maxRetries:3,baseDelay:1000,maxDelay:30000,backoffMultiplier:2,retryableStatusCodes:e$.DEFAULT_RETRYABLE_STATUS_CODES,enableJitter:!0};var AD=new Set(["ECONNABORTED","ECONNREFUSED","ECONNRESET","EAI_AGAIN","EHOSTUNREACH","ENETUNREACH","ENOTFOUND","EPIPE","ETIMEDOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_SOCKET"]);function SQ($){if(!$||typeof $!=="object")return!1;let w=new Set,J=$,V=!1;while(J&&typeof J==="object"&&!w.has(J)){w.add(J);let U=J.name;if(U==="AbortError"||U==="TimeoutError")return!1;let G=J.code;if(typeof G==="string"&&AD.has(G))V=!0;J=J.cause}if(V)return!0;if($ instanceof TypeError&&typeof $.message==="string"&&/fetch failed/i.test($.message))return!0;return!1}function _Q($,w){if($ instanceof fD.ApiError){if($.isUserTimeout)return!1;return w.includes($.status)}return SQ($)}function kQ($,w,J,V,U){let G=Math.min(w*Math.pow(V,$),J);if(U){let z=0.25*G*(Math.random()*2-1);return Math.max(0,G+z)}return G}function SD($,w,J){return LD(this,void 0,void 0,function*(){let V={totalAttempts:0,totalDelay:0},U;for(let G=0;G<=w.maxRetries;G++){V.totalAttempts++;try{return{result:yield $(),metrics:V}}catch(z){if(U=z,V.lastError=z,G===w.maxRetries||!_Q(z,w.retryableStatusCodes))throw z;let i=kQ(G,w.baseDelay,w.maxDelay,w.backoffMultiplier,w.enableJitter);if(V.totalDelay+=i,J)J(G+1,z,i);yield(0,MD.sleep)(i)}}throw U})}});var RQ=Z((j4$,_D)=>{_D.exports={name:"@fal-ai/client",description:"The fal.ai client for JavaScript and TypeScript",version:"1.10.1",license:"MIT",repository:{type:"git",url:"https://github.com/fal-ai/fal-js.git",directory:"libs/client"},keywords:["fal","client","ai","ml","typescript"],exports:{".":"./src/index.js","./endpoints":"./src/types/endpoints.js"},typesVersions:{"*":{endpoints:["src/types/endpoints.d.ts"]}},main:"./src/index.js",types:"./src/index.d.ts",dependencies:{"@msgpack/msgpack":"^3.0.0-beta2","eventsource-parser":"^1.1.2",robot3:"^0.4.1"},engines:{node:">=18.0.0"},type:"commonjs"}});var zz=Z((bQ)=>{Object.defineProperty(bQ,"__esModule",{value:!0});bQ.isBrowser=kD;bQ.getUserAgent=RD;function kD(){return typeof window<"u"&&typeof window.document<"u"}var Gz=null;function RD(){if(Gz!==null)return Gz;let $=RQ();return Gz=`${$.name}/${$.version}`,Gz}});var iz=Z((xQ)=>{Object.defineProperty(xQ,"__esModule",{value:!0});xQ.credentialsFromEnv=void 0;xQ.resolveDefaultFetch=jQ;xQ.createConfig=dD;xQ.getRestApiUrl=mD;var EQ=O9(),CD=B6(),CQ=Q0(),jD=zz();function jQ(){if(typeof fetch>"u")throw Error("Your environment does not support fetch. Please provide your own fetch implementation.");return fetch}function xD(){return typeof process<"u"&&process.env&&(typeof process.env.FAL_KEY<"u"||typeof process.env.FAL_KEY_ID<"u"&&typeof process.env.FAL_KEY_SECRET<"u")}var rD=()=>{if(!xD())return;if(typeof process.env.FAL_KEY<"u")return process.env.FAL_KEY;return process.env.FAL_KEY_ID?`${process.env.FAL_KEY_ID}:${process.env.FAL_KEY_SECRET}`:void 0};xQ.credentialsFromEnv=rD;var nD={credentials:xQ.credentialsFromEnv,suppressLocalCredentialsWarning:!1,requestMiddleware:($)=>Promise.resolve($),responseHandler:CD.defaultResponseHandler,retry:CQ.DEFAULT_RETRY_OPTIONS};function dD($){var w;let J=Object.assign(Object.assign(Object.assign({},nD),$),{fetch:(w=$.fetch)!==null&&w!==void 0?w:jQ(),retry:Object.assign(Object.assign({},CQ.DEFAULT_RETRY_OPTIONS),$.retry||{})});if($.proxyUrl){let z=typeof $.proxyUrl==="string"?{url:$.proxyUrl}:$.proxyUrl;J=Object.assign(Object.assign({},J),{requestMiddleware:(0,EQ.withMiddleware)(J.requestMiddleware,(0,EQ.withProxy)({targetUrl:z.url,when:z.when}))})}let{credentials:V,suppressLocalCredentialsWarning:U}=J,G=typeof V==="function"?V():V;if((0,jD.isBrowser)()&&G&&!U)console.warn("The fal credentials are exposed in the browser's environment. That's not recommended for production use cases.");return J}function mD(){return"https://rest.fal.ai"}});var bJ=Z((H6)=>{var rQ=H6&&H6.__awaiter||function($,w,J,V){function U(G){return G instanceof J?G:new J(function(z){z(G)})}return new(J||(J=Promise))(function(G,z){function i(W){try{X(V.next(W))}catch(I){z(I)}}function N(W){try{X(V.throw(W))}catch(I){z(I)}}function X(W){W.done?G(W.value):U(W.value).then(i,N)}X((V=V.apply($,w||[])).next())})},lD=H6&&H6.__rest||function($,w){var J={};for(var V in $)if(Object.prototype.hasOwnProperty.call($,V)&&w.indexOf(V)<0)J[V]=$[V];if($!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var U=0,V=Object.getOwnPropertySymbols($);U<V.length;U++)if(w.indexOf(V[U])<0&&Object.prototype.propertyIsEnumerable.call($,V[U]))J[V[U]]=$[V[U]]}return J};Object.defineProperty(H6,"__esModule",{value:!0});H6.dispatchRequest=oD;H6.buildUrl=pD;var nQ=Q0(),dQ=zz(),H9=c4(),tD=typeof navigator<"u"&&(navigator===null||navigator===void 0?void 0:navigator.userAgent)==="Cloudflare-Workers";function oD($){return rQ(this,void 0,void 0,function*(){var w;let{targetUrl:J,input:V,config:U,options:G={}}=$,{credentials:z,requestMiddleware:i,responseHandler:N,fetch:X}=U,W=Object.assign(Object.assign({},U.retry),G.retry||{}),I=()=>rQ(this,void 0,void 0,function*(){var Y,v,O;let P=(0,dQ.isBrowser)()?{}:{"User-Agent":(0,dQ.getUserAgent)()},F=typeof z==="function"?z():z,{method:q,url:T,headers:L}=yield i({method:((v=(Y=$.method)!==null&&Y!==void 0?Y:G.method)!==null&&v!==void 0?v:"post").toUpperCase(),url:J,headers:$.headers}),k=F?{Authorization:`Key ${F}`}:{},b=Object.assign(Object.assign(Object.assign(Object.assign({},k),{Accept:"application/json","Content-Type":"application/json"}),P),L!==null&&L!==void 0?L:{}),{responseHandler:C,retry:_}=G,t=lD(G,["responseHandler","retry"]),y=yield X(T,Object.assign(Object.assign(Object.assign(Object.assign({},t),{method:q,headers:Object.assign(Object.assign({},b),(O=t.headers)!==null&&O!==void 0?O:{})}),!tD&&{mode:"cors"}),{signal:G.signal,body:q.toLowerCase()!=="get"&&V?JSON.stringify(V):void 0}));return yield(C!==null&&C!==void 0?C:N)(y)}),g;for(let Y=0;Y<=W.maxRetries;Y++)try{return yield I()}catch(v){if(g=v,Y===W.maxRetries||!(0,nQ.isRetryableError)(v,W.retryableStatusCodes)||((w=G.signal)===null||w===void 0?void 0:w.aborted))throw v;let P=(0,nQ.calculateBackoffDelay)(Y,W.baseDelay,W.maxDelay,W.backoffMultiplier,W.enableJitter);yield(0,H9.sleep)(P)}throw g})}function pD($,w={}){var J,V;let U=((J=w.method)!==null&&J!==void 0?J:"post").toLowerCase(),G=((V=w.path)!==null&&V!==void 0?V:"").replace(/^\//,"").replace(/\/{2,}/,"/"),z=w.input,i=Object.assign(Object.assign({},w.query||{}),U==="get"?z:{}),N=Object.keys(i).length>0?`?${new URLSearchParams(i).toString()}`:"";if((0,H9.isValidUrl)($))return`${$.endsWith("/")?$:`${$}/`}${G}${N}`;let X=(0,H9.ensureEndpointIdFormat)($);return`${`https://${w.subdomain?`${w.subdomain}.`:""}fal.run/${X}/${G}`.replace(/\/$/,"")}${N}`}});var q9=Z((S4)=>{var Yw=S4&&S4.__awaiter||function($,w,J,V){function U(G){return G instanceof J?G:new J(function(z){z(G)})}return new(J||(J=Promise))(function(G,z){function i(W){try{X(V.next(W))}catch(I){z(I)}}function N(W){try{X(V.throw(W))}catch(I){z(I)}}function X(W){W.done?G(W.value):U(W.value).then(i,N)}X((V=V.apply($,w||[])).next())})};Object.defineProperty(S4,"__esModule",{value:!0});S4.OBJECT_LIFECYCYLE_PREFERENCE_HEADER=void 0;S4.getExpirationDurationSeconds=hQ;S4.buildObjectLifecycleHeaders=sD;S4.createStorageClient=UL;var mQ=iz(),yQ=bJ(),aD=c4();S4.OBJECT_LIFECYCYLE_PREFERENCE_HEADER="x-fal-object-lifecycle-preference";var eD={never:void 0,immediate:60,"1h":3600,"1d":86400,"7d":604800,"30d":2592000,"1y":31536000};function hQ($){let{expiresIn:w}=$;if(w===void 0)return;return typeof w==="number"?w:eD[w]}function F9($){if(!$)return;let w=hQ($),J={};if(w!==void 0)J.expiration_duration_seconds=w;if($.initialAcl!==void 0)J.initial_acl=$.initialAcl;return Object.keys(J).length>0?J:void 0}function sD($){let w=F9($);if(!w)return{};return{[S4.OBJECT_LIFECYCYLE_PREFERENCE_HEADER]:JSON.stringify(w)}}function cQ($){var w;let[,J]=$.split("/");return(w=J.split(/[-;]/)[0])!==null&&w!==void 0?w:"bin"}function $L($,w,J,V){return Yw(this,void 0,void 0,function*(){let U=$.name||`${Date.now()}.${cQ(J)}`,G={},z=F9(V);if(z)G["X-Fal-Object-Lifecycle"]=JSON.stringify(z);return yield(0,yQ.dispatchRequest)({method:"POST",targetUrl:`${(0,mQ.getRestApiUrl)()}/storage/upload/initiate?storage_type=fal-cdn-v3`,input:{content_type:J,file_name:U},config:w,headers:G})})}function wL($,w,J,V){return Yw(this,void 0,void 0,function*(){let U=$.name||`${Date.now()}.${cQ(J)}`,G={},z=F9(V);if(z)G["X-Fal-Object-Lifecycle"]=JSON.stringify(z);return yield(0,yQ.dispatchRequest)({method:"POST",targetUrl:`${(0,mQ.getRestApiUrl)()}/storage/upload/initiate-multipart?storage_type=fal-cdn-v3`,input:{content_type:J,file_name:U},config:w,headers:G})})}function lQ($,w,J){return Yw(this,arguments,void 0,function*(V,U,G,z=3){if(z===0)throw Error("Part upload failed, retries exhausted");let{fetch:i,responseHandler:N}=G;try{let X=yield i(V,{method:"PUT",body:U});return yield N(X)}catch(X){return yield lQ(V,U,G,z-1)}})}function JL($,w,J){return Yw(this,void 0,void 0,function*(){let{fetch:V,responseHandler:U}=w,G=$.type||"application/octet-stream",{upload_url:z,file_url:i}=yield wL($,w,G,J),N=10485760,X=Math.ceil($.size/10485760),W=new URL(z),I=[];for(let v=0;v<X;v++){let O=v*10485760,P=Math.min(O+10485760,$.size),F=$.slice(O,P),q=v+1,T=`${W.origin}${W.pathname}/${q}${W.search}`;I.push(yield lQ(T,F,w))}let g=`${W.origin}${W.pathname}/complete${W.search}`,Y=yield V(g,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parts:I.map((v)=>({partNumber:v.partNumber,etag:v.etag}))})});return yield U(Y),i})}function UL({config:$}){let w={upload:(J,V)=>Yw(this,void 0,void 0,function*(){let U=V===null||V===void 0?void 0:V.lifecycle;if(J.size>94371840)return yield JL(J,$,U);let G=J.type||"application/octet-stream",{fetch:z,responseHandler:i}=$,{upload_url:N,file_url:X}=yield $L(J,$,G,U),W=yield z(N,{method:"PUT",body:J,headers:{"Content-Type":J.type||"application/octet-stream"}});return yield i(W),X}),transformInput:(J)=>Yw(this,void 0,void 0,function*(){if(Array.isArray(J))return Promise.all(J.map((V)=>w.transformInput(V)));else if(J instanceof Blob)return yield w.upload(J);else if((0,aD.isPlainObject)(J)){let U=Object.entries(J).map((z)=>Yw(this,[z],void 0,function*([i,N]){return[i,yield w.transformInput(N)]})),G=yield Promise.all(U);return Object.fromEntries(G)}return J})};return w}});var pQ=Z((oQ)=>{Object.defineProperty(oQ,"__esModule",{value:!0});function VL($){let w,J,V,U,G,z,i;return N(),{feed:X,reset:N};function N(){w=!0,J="",V=0,U=-1,G=void 0,z=void 0,i=""}function X(I){if(J=J?J+I:I,w&&GL(J))J=J.slice(tQ.length);w=!1;let g=J.length,Y=0,v=!1;while(Y<g){if(v){if(J[Y]===`
|
|
29
|
+
`)++Y;v=!1}let O=-1,P=U,F;for(let q=V;O<0&&q<g;++q)if(F=J[q],F===":"&&P<0)P=q-Y;else if(F==="\r")v=!0,O=q-Y;else if(F===`
|
|
30
|
+
`)O=q-Y;if(O<0){V=g-Y,U=P;break}else V=0,U=-1;W(J,Y,P,O),Y+=O+1}if(Y===g)J="";else if(Y>0)J=J.slice(Y)}function W(I,g,Y,v){if(v===0){if(i.length>0)$({type:"event",id:G,event:z||void 0,data:i.slice(0,-1)}),i="",G=void 0;z=void 0;return}let O=Y<0,P=I.slice(g,g+(O?v:Y)),F=0;if(O)F=v;else if(I[g+Y+1]===" ")F=Y+2;else F=Y+1;let q=g+F,T=v-F,L=I.slice(q,q+T).toString();if(P==="data")i+=L?"".concat(L,`
|
|
31
|
+
`):`
|
|
32
|
+
`;else if(P==="event")z=L;else if(P==="id"&&!L.includes("\x00"))G=L;else if(P==="retry"){let k=parseInt(L,10);if(!Number.isNaN(k))$({type:"reconnect-interval",value:k})}}}var tQ=[239,187,191];function GL($){return tQ.every((w,J)=>$.charCodeAt(J)===w)}oQ.createParser=VL});var Z9=Z((F6)=>{var iL=F6&&F6.__awaiter||function($,w,J,V){function U(G){return G instanceof J?G:new J(function(z){z(G)})}return new(J||(J=Promise))(function(G,z){function i(W){try{X(V.next(W))}catch(I){z(I)}}function N(W){try{X(V.throw(W))}catch(I){z(I)}}function X(W){W.done?G(W.value):U(W.value).then(i,N)}X((V=V.apply($,w||[])).next())})};Object.defineProperty(F6,"__esModule",{value:!0});F6.TOKEN_EXPIRATION_SECONDS=void 0;F6.getTemporaryAuthToken=IL;var XL=iz(),NL=bJ(),WL=c4();F6.TOKEN_EXPIRATION_SECONDS=120;function IL($,w){return iL(this,void 0,void 0,function*(){let J=(0,WL.parseEndpointId)($),V=yield(0,NL.dispatchRequest)({method:"POST",targetUrl:`${(0,XL.getRestApiUrl)()}/tokens/`,config:w,input:{allowed_apps:[J.alias],token_expiration:F6.TOKEN_EXPIRATION_SECONDS}});if(typeof V!=="string"&&V.detail)return V.detail;return V})}});var f9=Z((v4)=>{var CJ=v4&&v4.__awaiter||function($,w,J,V){function U(G){return G instanceof J?G:new J(function(z){z(G)})}return new(J||(J=Promise))(function(G,z){function i(W){try{X(V.next(W))}catch(I){z(I)}}function N(W){try{X(V.throw(W))}catch(I){z(I)}}function X(W){W.done?G(W.value):U(W.value).then(i,N)}X((V=V.apply($,w||[])).next())})},O0=v4&&v4.__await||function($){return this instanceof O0?(this.v=$,this):new O0($)},gL=v4&&v4.__asyncGenerator||function($,w,J){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var V=J.apply($,w||[]),U,G=[];return U={},i("next"),i("throw"),i("return",z),U[Symbol.asyncIterator]=function(){return this},U;function z(Y){return function(v){return Promise.resolve(v).then(Y,I)}}function i(Y,v){if(V[Y]){if(U[Y]=function(O){return new Promise(function(P,F){G.push([Y,O,P,F])>1||N(Y,O)})},v)U[Y]=v(U[Y])}}function N(Y,v){try{X(V[Y](v))}catch(O){g(G[0][3],O)}}function X(Y){Y.value instanceof O0?Promise.resolve(Y.value.v).then(W,I):g(G[0][2],Y)}function W(Y){N("next",Y)}function I(Y){N("throw",Y)}function g(Y,v){if(Y(v),G.shift(),G.length)N(G[0][0],G[0][1])}};Object.defineProperty(v4,"__esModule",{value:!0});v4.FalStream=void 0;v4.createStreamingClient=OL;var YL=pQ(),vL=Z9(),aQ=bJ(),EJ=B6(),T9=c4(),D9="text/event-stream",QL=15000;class L9{constructor($,w,J){var V;if(this.listeners=new Map,this.buffer=[],this.currentData=void 0,this.lastEventTimestamp=0,this.streamClosed=!1,this._requestId=null,this.abortController=new AbortController,this.start=()=>CJ(this,void 0,void 0,function*(){var U,G,z;let{endpointId:i,options:N}=this,{input:X,method:W="post",connectionMode:I="server",tokenProvider:g}=N;try{if(I==="client"){let Y=(0,T9.ensureEndpointIdFormat)(i),v=(U=(0,T9.resolveEndpointPath)(i,void 0,"/stream"))!==null&&U!==void 0?U:"",P=yield(g?()=>g(`${Y}${v}`):()=>{return console.warn('[fal.stream] Using the default token provider is deprecated. Please provide a `tokenProvider` function when using `connectionMode: "client"`. See https://docs.fal.ai/fal-client/authentication for more information.'),(0,vL.getTemporaryAuthToken)(i,this.config)})(),{fetch:F}=this.config,q=new URL(this.url);q.searchParams.set("fal_jwt_token",P);let T=yield F(q.toString(),{method:W.toUpperCase(),headers:{accept:(G=N.accept)!==null&&G!==void 0?G:D9,"content-type":"application/json"},body:X&&W!=="get"?JSON.stringify(X):void 0,signal:this.abortController.signal});return this._requestId=T.headers.get("x-fal-request-id"),yield this.handleResponse(T)}return yield(0,aQ.dispatchRequest)({method:W.toUpperCase(),targetUrl:this.url,input:X,config:this.config,options:{headers:{accept:(z=N.accept)!==null&&z!==void 0?z:D9},responseHandler:(Y)=>CJ(this,void 0,void 0,function*(){return this._requestId=Y.headers.get("x-fal-request-id"),yield this.handleResponse(Y)}),signal:this.abortController.signal}})}catch(Y){this.handleError(Y)}}),this.handleResponse=(U)=>CJ(this,void 0,void 0,function*(){var G,z;if(!U.ok){try{yield(0,EJ.defaultResponseHandler)(U)}catch(v){this.emit("error",v)}return}let i=U.body;if(!i){this.emit("error",new EJ.ApiError({message:"Response body is empty.",status:400,body:void 0,requestId:this._requestId||void 0}));return}if(!((G=U.headers.get("content-type"))!==null&&G!==void 0?G:"").startsWith(D9)){let v=i.getReader(),O=()=>{v.read().then(({done:P,value:F})=>{if(P){this.emit("done",this.currentData);return}this.buffer.push(F),this.currentData=F,this.emit("data",F),O()})};O();return}let X=new TextDecoder("utf-8"),W=U.body.getReader(),I=(0,YL.createParser)((v)=>{if(v.type==="event"){let O=v.data;try{let P=JSON.parse(O);this.buffer.push(P),this.currentData=P,this.emit("data",P),this.emit("message",P)}catch(P){this.emit("error",P)}}}),g=(z=this.options.timeout)!==null&&z!==void 0?z:QL,Y=()=>CJ(this,void 0,void 0,function*(){let{value:v,done:O}=yield W.read();if(this.lastEventTimestamp=Date.now(),I.feed(X.decode(v)),Date.now()-this.lastEventTimestamp>g)this.emit("error",new EJ.ApiError({message:`Event stream timed out after ${(g/1000).toFixed(0)} seconds with no messages.`,status:408,requestId:this._requestId||void 0}));if(!O)Y().catch(this.handleError);else this.emit("done",this.currentData)});Y().catch(this.handleError);return}),this.handleError=(U)=>{var G;if(U.name==="AbortError"||this.signal.aborted)return;let z=U instanceof EJ.ApiError?U:new EJ.ApiError({message:(G=U.message)!==null&&G!==void 0?G:"An unknown error occurred",status:500,requestId:this._requestId||void 0});this.emit("error",z);return},this.on=(U,G)=>{var z;if(!this.listeners.has(U))this.listeners.set(U,[]);(z=this.listeners.get(U))===null||z===void 0||z.push(G)},this.emit=(U,G)=>{let z=this.listeners.get(U)||[];for(let i of z)i(G)},this.done=()=>CJ(this,void 0,void 0,function*(){return this.donePromise}),this.abort=(U)=>{if(!this.streamClosed)this.abortController.abort(U)},this.endpointId=$,this.config=w,this.url=(V=J.url)!==null&&V!==void 0?V:(0,aQ.buildUrl)($,{path:(0,T9.resolveEndpointPath)($,void 0,"/stream"),query:J.queryParams}),this.options=J,this.donePromise=new Promise((U,G)=>{if(this.streamClosed)G(new EJ.ApiError({message:"Streaming connection is already closed.",status:400,body:void 0,requestId:this._requestId||void 0}));this.signal.addEventListener("abort",()=>{var z;U((z=this.currentData)!==null&&z!==void 0?z:{})}),this.on("done",(z)=>{this.streamClosed=!0,U(z)}),this.on("error",(z)=>{this.streamClosed=!0,G(z)})}),J.signal)J.signal.addEventListener("abort",()=>{this.abortController.abort()});this.start().catch(this.handleError)}[Symbol.asyncIterator](){return gL(this,arguments,function*(){let w=!0,J=()=>w=!1;this.on("error",J),this.on("done",J);while(w||this.buffer.length>0){let V=this.buffer.shift();if(V)yield yield O0(V);yield O0(new Promise((U)=>setTimeout(U,16)))}})}get signal(){return this.abortController.signal}get requestId(){return this._requestId}}v4.FalStream=L9;function OL({config:$,storage:w}){return{stream(J,V){return CJ(this,void 0,void 0,function*(){let U=V.input?yield w.transformInput(V.input):void 0;return new L9(J,$,Object.assign(Object.assign({},V),{input:U}))})}}}});var w7=Z((q6)=>{var vw=q6&&q6.__awaiter||function($,w,J,V){function U(G){return G instanceof J?G:new J(function(z){z(G)})}return new(J||(J=Promise))(function(G,z){function i(W){try{X(V.next(W))}catch(I){z(I)}}function N(W){try{X(V.throw(W))}catch(I){z(I)}}function X(W){W.done?G(W.value):U(W.value).then(i,N)}X((V=V.apply($,w||[])).next())})},PL=q6&&q6.__rest||function($,w){var J={};for(var V in $)if(Object.prototype.hasOwnProperty.call($,V)&&w.indexOf(V)<0)J[V]=$[V];if($!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var U=0,V=Object.getOwnPropertySymbols($);U<V.length;U++)if(w.indexOf(V[U])<0&&Object.prototype.propertyIsEnumerable.call($,V[U]))J[V[U]]=$[V[U]]}return J};Object.defineProperty(q6,"__esModule",{value:!0});q6.createQueueClient=void 0;var M9=Vz(),l4=bJ(),KL=B6(),$7=Q0(),uL=q9(),BL=f9(),Xz=c4(),eQ=500,sQ={maxRetries:3,baseDelay:1000,maxDelay:60000,retryableStatusCodes:$7.DEFAULT_RETRYABLE_STATUS_CODES},HL={maxRetries:5,baseDelay:1000,maxDelay:30000,retryableStatusCodes:[...$7.DEFAULT_RETRYABLE_STATUS_CODES,500]},FL=({config:$,storage:w})=>{let J={submit(V,U){return vw(this,void 0,void 0,function*(){let{webhookUrl:G,priority:z,hint:i,startTimeout:N,headers:X,storageSettings:W}=U,I=PL(U,["webhookUrl","priority","hint","startTimeout","headers","storageSettings"]),g=U.input?yield w.transformInput(U.input):void 0,Y=Object.fromEntries(Object.entries(X!==null&&X!==void 0?X:{}).map(([v,O])=>[v.toLowerCase(),O]));return(0,l4.dispatchRequest)({method:U.method,targetUrl:(0,l4.buildUrl)(V,Object.assign(Object.assign({},I),{subdomain:"queue",query:G?{fal_webhook:G}:void 0})),headers:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Y),(0,uL.buildObjectLifecycleHeaders)(W)),{[M9.QUEUE_PRIORITY_HEADER]:z!==null&&z!==void 0?z:"normal"}),i&&{[M9.RUNNER_HINT_HEADER]:i}),(0,M9.buildTimeoutHeaders)(N)),input:g,config:$,options:{signal:U.abortSignal,retry:sQ}})})},status(V,U){return vw(this,arguments,void 0,function*(G,{requestId:z,logs:i=!1,abortSignal:N}){let X=(0,Xz.parseEndpointId)(G),W=X.namespace?`${X.namespace}/`:"";return(0,l4.dispatchRequest)({method:"get",targetUrl:(0,l4.buildUrl)(`${W}${X.owner}/${X.alias}`,{subdomain:"queue",query:{logs:i?"1":"0"},path:`/requests/${z}/status`}),config:$,options:{signal:N,retry:HL}})})},streamStatus(V,U){return vw(this,arguments,void 0,function*(G,{requestId:z,logs:i=!1,connectionMode:N}){let X=(0,Xz.parseEndpointId)(G),W=X.namespace?`${X.namespace}/`:"",I={logs:i?"1":"0"},g=(0,l4.buildUrl)(`${W}${X.owner}/${X.alias}`,{subdomain:"queue",path:`/requests/${z}/status/stream`,query:I});return new BL.FalStream(G,$,{url:g,method:"get",connectionMode:N,queryParams:I})})},subscribeToStatus(V,U){return vw(this,void 0,void 0,function*(){let{requestId:G,timeout:z}=U,i=void 0,N=()=>{};if(U.mode==="streaming"){let X=yield J.streamStatus(V,{requestId:G,logs:U.logs,connectionMode:"connectionMode"in U?U.connectionMode:void 0}),W=[];if(z)i=setTimeout(()=>{throw X.abort(),J.cancel(V,{requestId:G}).catch(N),Error(`Client timed out waiting for the request to complete after ${z}ms`)},z);X.on("data",(g)=>{if(U.onQueueUpdate){if("logs"in g&&Array.isArray(g.logs)&&g.logs.length>0)W.push(...g.logs);U.onQueueUpdate("logs"in g?Object.assign(Object.assign({},g),{logs:W}):g)}});let I=yield X.done();if(i)clearTimeout(i);return I}return new Promise((X,W)=>{var I;let g,Y="pollInterval"in U&&typeof U.pollInterval==="number"?(I=U.pollInterval)!==null&&I!==void 0?I:eQ:eQ,v=()=>{if(i)clearTimeout(i);if(g)clearTimeout(g)};if(z)i=setTimeout(()=>{v(),J.cancel(V,{requestId:G}).catch(N),W(Error(`Client timed out waiting for the request to complete after ${z}ms`))},z);let O=()=>vw(this,void 0,void 0,function*(){var P;try{let F=yield J.status(V,{requestId:G,logs:(P=U.logs)!==null&&P!==void 0?P:!1,abortSignal:U.abortSignal});if(U.onQueueUpdate)U.onQueueUpdate(F);if(F.status==="COMPLETED"){v(),X(F);return}g=setTimeout(O,Y)}catch(F){v(),W(F)}});O().catch(W)})})},result(V,U){return vw(this,arguments,void 0,function*(G,{requestId:z,abortSignal:i}){let N=(0,Xz.parseEndpointId)(G),X=N.namespace?`${N.namespace}/`:"";return(0,l4.dispatchRequest)({method:"get",targetUrl:(0,l4.buildUrl)(`${X}${N.owner}/${N.alias}`,{subdomain:"queue",path:`/requests/${z}`}),config:Object.assign(Object.assign({},$),{responseHandler:KL.resultResponseHandler}),options:{signal:i,retry:sQ}})})},cancel(V,U){return vw(this,arguments,void 0,function*(G,{requestId:z,abortSignal:i}){let N=(0,Xz.parseEndpointId)(G),X=N.namespace?`${N.namespace}/`:"";yield(0,l4.dispatchRequest)({method:"put",targetUrl:(0,l4.buildUrl)(`${X}${N.owner}/${N.alias}`,{subdomain:"queue",path:`/requests/${z}/cancel`}),config:$,options:{signal:i}})})}};return J};q6.createQueueClient=FL});var Nz=Z((z7)=>{Object.defineProperty(z7,"__esModule",{value:!0});z7.utf8Count=qL;z7.utf8EncodeJs=J7;z7.utf8EncodeTE=U7;z7.utf8Encode=DL;z7.utf8DecodeJs=V7;z7.utf8DecodeTD=G7;z7.utf8Decode=AL;function qL($){let w=$.length,J=0,V=0;while(V<w){let U=$.charCodeAt(V++);if((U&4294967168)===0){J++;continue}else if((U&4294965248)===0)J+=2;else{if(U>=55296&&U<=56319){if(V<w){let G=$.charCodeAt(V);if((G&64512)===56320)++V,U=((U&1023)<<10)+(G&1023)+65536}}if((U&4294901760)===0)J+=3;else J+=4}}return J}function J7($,w,J){let V=$.length,U=J,G=0;while(G<V){let z=$.charCodeAt(G++);if((z&4294967168)===0){w[U++]=z;continue}else if((z&4294965248)===0)w[U++]=z>>6&31|192;else{if(z>=55296&&z<=56319){if(G<V){let i=$.charCodeAt(G);if((i&64512)===56320)++G,z=((z&1023)<<10)+(i&1023)+65536}}if((z&4294901760)===0)w[U++]=z>>12&15|224,w[U++]=z>>6&63|128;else w[U++]=z>>18&7|240,w[U++]=z>>12&63|128,w[U++]=z>>6&63|128}w[U++]=z&63|128}}var ZL=new TextEncoder,TL=50;function U7($,w,J){ZL.encodeInto($,w.subarray(J))}function DL($,w,J){if($.length>TL)U7($,w,J);else J7($,w,J)}var LL=4096;function V7($,w,J){let V=w,U=V+J,G=[],z="";while(V<U){let i=$[V++];if((i&128)===0)G.push(i);else if((i&224)===192){let N=$[V++]&63;G.push((i&31)<<6|N)}else if((i&240)===224){let N=$[V++]&63,X=$[V++]&63;G.push((i&31)<<12|N<<6|X)}else if((i&248)===240){let N=$[V++]&63,X=$[V++]&63,W=$[V++]&63,I=(i&7)<<18|N<<12|X<<6|W;if(I>65535)I-=65536,G.push(I>>>10&1023|55296),I=56320|I&1023;G.push(I)}else G.push(i);if(G.length>=LL)z+=String.fromCharCode(...G),G.length=0}if(G.length>0)z+=String.fromCharCode(...G);return z}var fL=new TextDecoder,ML=200;function G7($,w,J){let V=$.subarray(w,w+J);return fL.decode(V)}function AL($,w,J){if(J>ML)return G7($,w,J);else return V7($,w,J)}});var A9=Z((X7)=>{Object.defineProperty(X7,"__esModule",{value:!0});X7.ExtData=void 0;class i7{type;data;constructor($,w){this.type=$,this.data=w}}X7.ExtData=i7});var Iz=Z((W7)=>{Object.defineProperty(W7,"__esModule",{value:!0});W7.DecodeError=void 0;class Wz extends Error{constructor($){super($);let w=Object.create(Wz.prototype);Object.setPrototypeOf(this,w),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Wz.name})}}W7.DecodeError=Wz});var gz=Z((g7)=>{Object.defineProperty(g7,"__esModule",{value:!0});g7.UINT32_MAX=void 0;g7.setUint64=jL;g7.setInt64=xL;g7.getInt64=rL;g7.getUint64=nL;g7.UINT32_MAX=4294967295;function jL($,w,J){let V=J/4294967296,U=J;$.setUint32(w,V),$.setUint32(w+4,U)}function xL($,w,J){let V=Math.floor(J/4294967296),U=J;$.setUint32(w,V),$.setUint32(w+4,U)}function rL($,w){let J=$.getInt32(w),V=$.getUint32(w+4);return J*4294967296+V}function nL($,w){let J=$.getUint32(w),V=$.getUint32(w+4);return J*4294967296+V}});var S9=Z((B7)=>{Object.defineProperty(B7,"__esModule",{value:!0});B7.timestampExtension=B7.EXT_TIMESTAMP=void 0;B7.encodeTimeSpecToTimestamp=Q7;B7.encodeDateToTimeSpec=O7;B7.encodeTimestampExtension=P7;B7.decodeTimestampToTimeSpec=K7;B7.decodeTimestampExtension=u7;var cL=Iz(),v7=gz();B7.EXT_TIMESTAMP=-1;var lL=4294967295,tL=17179869183;function Q7({sec:$,nsec:w}){if($>=0&&w>=0&&$<=tL)if(w===0&&$<=lL){let J=new Uint8Array(4);return new DataView(J.buffer).setUint32(0,$),J}else{let J=$/4294967296,V=$&4294967295,U=new Uint8Array(8),G=new DataView(U.buffer);return G.setUint32(0,w<<2|J&3),G.setUint32(4,V),U}else{let J=new Uint8Array(12),V=new DataView(J.buffer);return V.setUint32(0,w),(0,v7.setInt64)(V,4,$),J}}function O7($){let w=$.getTime(),J=Math.floor(w/1000),V=(w-J*1000)*1e6,U=Math.floor(V/1e9);return{sec:J+U,nsec:V-U*1e9}}function P7($){if($ instanceof Date){let w=O7($);return Q7(w)}else return null}function K7($){let w=new DataView($.buffer,$.byteOffset,$.byteLength);switch($.byteLength){case 4:{let J=w.getUint32(0),V=0;return{sec:J,nsec:0}}case 8:{let J=w.getUint32(0),V=w.getUint32(4),U=(J&3)*4294967296+V,G=J>>>2;return{sec:U,nsec:G}}case 12:{let J=(0,v7.getInt64)(w,4),V=w.getUint32(0);return{sec:J,nsec:V}}default:throw new cL.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${$.length}`)}}function u7($){let w=K7($);return new Date(w.sec*1000+w.nsec/1e6)}B7.timestampExtension={type:B7.EXT_TIMESTAMP,encode:P7,decode:u7}});var vz=Z((q7)=>{Object.defineProperty(q7,"__esModule",{value:!0});q7.ExtensionCodec=void 0;var Yz=A9(),$f=S9();class _9{static defaultCodec=new _9;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register($f.timestampExtension)}register({type:$,encode:w,decode:J}){if($>=0)this.encoders[$]=w,this.decoders[$]=J;else{let V=-1-$;this.builtInEncoders[V]=w,this.builtInDecoders[V]=J}}tryToEncode($,w){for(let J=0;J<this.builtInEncoders.length;J++){let V=this.builtInEncoders[J];if(V!=null){let U=V($,w);if(U!=null){let G=-1-J;return new Yz.ExtData(G,U)}}}for(let J=0;J<this.encoders.length;J++){let V=this.encoders[J];if(V!=null){let U=V($,w);if(U!=null){let G=J;return new Yz.ExtData(G,U)}}}if($ instanceof Yz.ExtData)return $;return null}decode($,w,J){let V=w<0?this.builtInDecoders[-1-w]:this.decoders[w];if(V)return V($,w,J);else return new Yz.ExtData(w,$)}}q7.ExtensionCodec=_9});var k9=Z((T7)=>{Object.defineProperty(T7,"__esModule",{value:!0});T7.ensureUint8Array=Jf;function wf($){return $ instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&$ instanceof SharedArrayBuffer}function Jf($){if($ instanceof Uint8Array)return $;else if(ArrayBuffer.isView($))return new Uint8Array($.buffer,$.byteOffset,$.byteLength);else if(wf($))return new Uint8Array($);else return Uint8Array.from($)}});var b9=Z((f7)=>{Object.defineProperty(f7,"__esModule",{value:!0});f7.Encoder=f7.DEFAULT_INITIAL_BUFFER_SIZE=f7.DEFAULT_MAX_DEPTH=void 0;var D7=Nz(),Vf=vz(),L7=gz(),Gf=k9();f7.DEFAULT_MAX_DEPTH=100;f7.DEFAULT_INITIAL_BUFFER_SIZE=2048;class R9{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor($){this.extensionCodec=$?.extensionCodec??Vf.ExtensionCodec.defaultCodec,this.context=$?.context,this.useBigInt64=$?.useBigInt64??!1,this.maxDepth=$?.maxDepth??f7.DEFAULT_MAX_DEPTH,this.initialBufferSize=$?.initialBufferSize??f7.DEFAULT_INITIAL_BUFFER_SIZE,this.sortKeys=$?.sortKeys??!1,this.forceFloat32=$?.forceFloat32??!1,this.ignoreUndefined=$?.ignoreUndefined??!1,this.forceIntegerToFloat=$?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new R9({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef($){if(this.entered)return this.clone().encodeSharedRef($);try{return this.entered=!0,this.reinitializeState(),this.doEncode($,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode($){if(this.entered)return this.clone().encode($);try{return this.entered=!0,this.reinitializeState(),this.doEncode($,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode($,w){if(w>this.maxDepth)throw Error(`Too deep objects in depth ${w}`);if($==null)this.encodeNil();else if(typeof $==="boolean")this.encodeBoolean($);else if(typeof $==="number")if(!this.forceIntegerToFloat)this.encodeNumber($);else this.encodeNumberAsFloat($);else if(typeof $==="string")this.encodeString($);else if(this.useBigInt64&&typeof $==="bigint")this.encodeBigInt64($);else this.encodeObject($,w)}ensureBufferSizeToWrite($){let w=this.pos+$;if(this.view.byteLength<w)this.resizeBuffer(w*2)}resizeBuffer($){let w=new ArrayBuffer($),J=new Uint8Array(w),V=new DataView(w);J.set(this.bytes),this.view=V,this.bytes=J}encodeNil(){this.writeU8(192)}encodeBoolean($){if($===!1)this.writeU8(194);else this.writeU8(195)}encodeNumber($){if(!this.forceIntegerToFloat&&Number.isSafeInteger($))if($>=0)if($<128)this.writeU8($);else if($<256)this.writeU8(204),this.writeU8($);else if($<65536)this.writeU8(205),this.writeU16($);else if($<4294967296)this.writeU8(206),this.writeU32($);else if(!this.useBigInt64)this.writeU8(207),this.writeU64($);else this.encodeNumberAsFloat($);else if($>=-32)this.writeU8(224|$+32);else if($>=-128)this.writeU8(208),this.writeI8($);else if($>=-32768)this.writeU8(209),this.writeI16($);else if($>=-2147483648)this.writeU8(210),this.writeI32($);else if(!this.useBigInt64)this.writeU8(211),this.writeI64($);else this.encodeNumberAsFloat($);else this.encodeNumberAsFloat($)}encodeNumberAsFloat($){if(this.forceFloat32)this.writeU8(202),this.writeF32($);else this.writeU8(203),this.writeF64($)}encodeBigInt64($){if($>=BigInt(0))this.writeU8(207),this.writeBigUint64($);else this.writeU8(211),this.writeBigInt64($)}writeStringHeader($){if($<32)this.writeU8(160+$);else if($<256)this.writeU8(217),this.writeU8($);else if($<65536)this.writeU8(218),this.writeU16($);else if($<4294967296)this.writeU8(219),this.writeU32($);else throw Error(`Too long string: ${$} bytes in UTF-8`)}encodeString($){let J=(0,D7.utf8Count)($);this.ensureBufferSizeToWrite(5+J),this.writeStringHeader(J),(0,D7.utf8Encode)($,this.bytes,this.pos),this.pos+=J}encodeObject($,w){let J=this.extensionCodec.tryToEncode($,this.context);if(J!=null)this.encodeExtension(J);else if(Array.isArray($))this.encodeArray($,w);else if(ArrayBuffer.isView($))this.encodeBinary($);else if(typeof $==="object")this.encodeMap($,w);else throw Error(`Unrecognized object: ${Object.prototype.toString.apply($)}`)}encodeBinary($){let w=$.byteLength;if(w<256)this.writeU8(196),this.writeU8(w);else if(w<65536)this.writeU8(197),this.writeU16(w);else if(w<4294967296)this.writeU8(198),this.writeU32(w);else throw Error(`Too large binary: ${w}`);let J=(0,Gf.ensureUint8Array)($);this.writeU8a(J)}encodeArray($,w){let J=$.length;if(J<16)this.writeU8(144+J);else if(J<65536)this.writeU8(220),this.writeU16(J);else if(J<4294967296)this.writeU8(221),this.writeU32(J);else throw Error(`Too large array: ${J}`);for(let V of $)this.doEncode(V,w+1)}countWithoutUndefined($,w){let J=0;for(let V of w)if($[V]!==void 0)J++;return J}encodeMap($,w){let J=Object.keys($);if(this.sortKeys)J.sort();let V=this.ignoreUndefined?this.countWithoutUndefined($,J):J.length;if(V<16)this.writeU8(128+V);else if(V<65536)this.writeU8(222),this.writeU16(V);else if(V<4294967296)this.writeU8(223),this.writeU32(V);else throw Error(`Too large map object: ${V}`);for(let U of J){let G=$[U];if(!(this.ignoreUndefined&&G===void 0))this.encodeString(U),this.doEncode(G,w+1)}}encodeExtension($){if(typeof $.data==="function"){let J=$.data(this.pos+6),V=J.length;if(V>=4294967296)throw Error(`Too large extension object: ${V}`);this.writeU8(201),this.writeU32(V),this.writeI8($.type),this.writeU8a(J);return}let w=$.data.length;if(w===1)this.writeU8(212);else if(w===2)this.writeU8(213);else if(w===4)this.writeU8(214);else if(w===8)this.writeU8(215);else if(w===16)this.writeU8(216);else if(w<256)this.writeU8(199),this.writeU8(w);else if(w<65536)this.writeU8(200),this.writeU16(w);else if(w<4294967296)this.writeU8(201),this.writeU32(w);else throw Error(`Too large extension object: ${w}`);this.writeI8($.type),this.writeU8a($.data)}writeU8($){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,$),this.pos++}writeU8a($){let w=$.length;this.ensureBufferSizeToWrite(w),this.bytes.set($,this.pos),this.pos+=w}writeI8($){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,$),this.pos++}writeU16($){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,$),this.pos+=2}writeI16($){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,$),this.pos+=2}writeU32($){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,$),this.pos+=4}writeI32($){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,$),this.pos+=4}writeF32($){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,$),this.pos+=4}writeF64($){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,$),this.pos+=8}writeU64($){this.ensureBufferSizeToWrite(8),(0,L7.setUint64)(this.view,this.pos,$),this.pos+=8}writeI64($){this.ensureBufferSizeToWrite(8),(0,L7.setInt64)(this.view,this.pos,$),this.pos+=8}writeBigUint64($){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,$),this.pos+=8}writeBigInt64($){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,$),this.pos+=8}}f7.Encoder=R9});var k7=Z((_7)=>{Object.defineProperty(_7,"__esModule",{value:!0});_7.encode=Xf;var zf=b9();function Xf($,w){return new zf.Encoder(w).encodeSharedRef($)}});var b7=Z((R7)=>{Object.defineProperty(R7,"__esModule",{value:!0});R7.prettyByte=Wf;function Wf($){return`${$<0?"-":""}0x${Math.abs($).toString(16).padStart(2,"0")}`}});var x7=Z((C7)=>{Object.defineProperty(C7,"__esModule",{value:!0});C7.CachedKeyDecoder=void 0;var gf=Nz(),Yf=16,vf=16;class E7{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor($=Yf,w=vf){this.maxKeyLength=$,this.maxLengthPerKey=w,this.caches=[];for(let J=0;J<this.maxKeyLength;J++)this.caches.push([])}canBeCached($){return $>0&&$<=this.maxKeyLength}find($,w,J){let V=this.caches[J-1];$:for(let U of V){let G=U.bytes;for(let z=0;z<J;z++)if(G[z]!==$[w+z])continue $;return U.str}return null}store($,w){let J=this.caches[$.length-1],V={bytes:$,str:w};if(J.length>=this.maxLengthPerKey)J[Math.random()*J.length|0]=V;else J.push(V)}decode($,w,J){let V=this.find($,w,J);if(V!=null)return this.hit++,V;this.miss++;let U=(0,gf.utf8DecodeJs)($,w,J),G=Uint8Array.prototype.slice.call($,w,w+J);return this.store(G,U),U}}C7.CachedKeyDecoder=E7});var Qz=Z((y7)=>{Object.defineProperty(y7,"__esModule",{value:!0});y7.Decoder=void 0;var E9=b7(),Qf=vz(),Qw=gz(),Of=Nz(),r7=k9(),Pf=x7(),t4=Iz(),C9="array",K0="map_key",d7="map_value",Kf=($)=>{if(typeof $==="string"||typeof $==="number")return $;throw new t4.DecodeError("The type of key must be string or number but "+typeof $)};class m7{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState($){let w=this.getUninitializedStateFromPool();w.type=C9,w.position=0,w.size=$,w.array=Array($)}pushMapState($){let w=this.getUninitializedStateFromPool();w.type=K0,w.readCount=0,w.size=$,w.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let $={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push($)}return this.stack[this.stackHeadPosition]}release($){if(this.stack[this.stackHeadPosition]!==$)throw Error("Invalid stack state. Released state is not on top of the stack.");if($.type===C9){let J=$;J.size=0,J.array=void 0,J.position=0,J.type=void 0}if($.type===K0||$.type===d7){let J=$;J.size=0,J.map=void 0,J.readCount=0,J.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}var P0=-1,j9=new DataView(new ArrayBuffer(0)),uf=new Uint8Array(j9.buffer);try{j9.getInt8(0)}catch($){if(!($ instanceof RangeError))throw Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var n7=RangeError("Insufficient data"),Bf=new Pf.CachedKeyDecoder;class x9{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=j9;bytes=uf;headByte=P0;stack=new m7;entered=!1;constructor($){this.extensionCodec=$?.extensionCodec??Qf.ExtensionCodec.defaultCodec,this.context=$?.context,this.useBigInt64=$?.useBigInt64??!1,this.rawStrings=$?.rawStrings??!1,this.maxStrLength=$?.maxStrLength??Qw.UINT32_MAX,this.maxBinLength=$?.maxBinLength??Qw.UINT32_MAX,this.maxArrayLength=$?.maxArrayLength??Qw.UINT32_MAX,this.maxMapLength=$?.maxMapLength??Qw.UINT32_MAX,this.maxExtLength=$?.maxExtLength??Qw.UINT32_MAX,this.keyDecoder=$?.keyDecoder!==void 0?$.keyDecoder:Bf,this.mapKeyConverter=$?.mapKeyConverter??Kf}clone(){return new x9({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=P0,this.stack.reset()}setBuffer($){let w=(0,r7.ensureUint8Array)($);this.bytes=w,this.view=new DataView(w.buffer,w.byteOffset,w.byteLength),this.pos=0}appendBuffer($){if(this.headByte===P0&&!this.hasRemaining(1))this.setBuffer($);else{let w=this.bytes.subarray(this.pos),J=(0,r7.ensureUint8Array)($),V=new Uint8Array(w.length+J.length);V.set(w),V.set(J,w.length),this.setBuffer(V)}}hasRemaining($){return this.view.byteLength-this.pos>=$}createExtraByteError($){let{view:w,pos:J}=this;return RangeError(`Extra ${w.byteLength-J} of ${w.byteLength} byte(s) found at buffer[${$}]`)}decode($){if(this.entered)return this.clone().decode($);try{this.entered=!0,this.reinitializeState(),this.setBuffer($);let w=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return w}finally{this.entered=!1}}*decodeMulti($){if(this.entered){yield*this.clone().decodeMulti($);return}try{this.entered=!0,this.reinitializeState(),this.setBuffer($);while(this.hasRemaining(1))yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync($){if(this.entered)return this.clone().decodeAsync($);try{this.entered=!0;let w=!1,J;for await(let z of $){if(w)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(z);try{J=this.doDecodeSync(),w=!0}catch(i){if(!(i instanceof RangeError))throw i}this.totalPos+=this.pos}if(w){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return J}let{headByte:V,pos:U,totalPos:G}=this;throw RangeError(`Insufficient data in parsing ${(0,E9.prettyByte)(V)} at ${G} (${U} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream($){return this.decodeMultiAsync($,!0)}decodeStream($){return this.decodeMultiAsync($,!1)}async*decodeMultiAsync($,w){if(this.entered){yield*this.clone().decodeMultiAsync($,w);return}try{this.entered=!0;let J=w,V=-1;for await(let U of $){if(w&&V===0)throw this.createExtraByteError(this.totalPos);if(this.appendBuffer(U),J)V=this.readArraySize(),J=!1,this.complete();try{while(!0)if(yield this.doDecodeSync(),--V===0)break}catch(G){if(!(G instanceof RangeError))throw G}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){$:while(!0){let $=this.readHeadByte(),w;if($>=224)w=$-256;else if($<192)if($<128)w=$;else if($<144){let V=$-128;if(V!==0){this.pushMapState(V),this.complete();continue $}else w={}}else if($<160){let V=$-144;if(V!==0){this.pushArrayState(V),this.complete();continue $}else w=[]}else{let V=$-160;w=this.decodeString(V,0)}else if($===192)w=null;else if($===194)w=!1;else if($===195)w=!0;else if($===202)w=this.readF32();else if($===203)w=this.readF64();else if($===204)w=this.readU8();else if($===205)w=this.readU16();else if($===206)w=this.readU32();else if($===207)if(this.useBigInt64)w=this.readU64AsBigInt();else w=this.readU64();else if($===208)w=this.readI8();else if($===209)w=this.readI16();else if($===210)w=this.readI32();else if($===211)if(this.useBigInt64)w=this.readI64AsBigInt();else w=this.readI64();else if($===217){let V=this.lookU8();w=this.decodeString(V,1)}else if($===218){let V=this.lookU16();w=this.decodeString(V,2)}else if($===219){let V=this.lookU32();w=this.decodeString(V,4)}else if($===220){let V=this.readU16();if(V!==0){this.pushArrayState(V),this.complete();continue $}else w=[]}else if($===221){let V=this.readU32();if(V!==0){this.pushArrayState(V),this.complete();continue $}else w=[]}else if($===222){let V=this.readU16();if(V!==0){this.pushMapState(V),this.complete();continue $}else w={}}else if($===223){let V=this.readU32();if(V!==0){this.pushMapState(V),this.complete();continue $}else w={}}else if($===196){let V=this.lookU8();w=this.decodeBinary(V,1)}else if($===197){let V=this.lookU16();w=this.decodeBinary(V,2)}else if($===198){let V=this.lookU32();w=this.decodeBinary(V,4)}else if($===212)w=this.decodeExtension(1,0);else if($===213)w=this.decodeExtension(2,0);else if($===214)w=this.decodeExtension(4,0);else if($===215)w=this.decodeExtension(8,0);else if($===216)w=this.decodeExtension(16,0);else if($===199){let V=this.lookU8();w=this.decodeExtension(V,1)}else if($===200){let V=this.lookU16();w=this.decodeExtension(V,2)}else if($===201){let V=this.lookU32();w=this.decodeExtension(V,4)}else throw new t4.DecodeError(`Unrecognized type byte: ${(0,E9.prettyByte)($)}`);this.complete();let J=this.stack;while(J.length>0){let V=J.top();if(V.type===C9)if(V.array[V.position]=w,V.position++,V.position===V.size)w=V.array,J.release(V);else continue $;else if(V.type===K0){if(w==="__proto__")throw new t4.DecodeError("The key __proto__ is not allowed");V.key=this.mapKeyConverter(w),V.type=d7;continue $}else if(V.map[V.key]=w,V.readCount++,V.readCount===V.size)w=V.map,J.release(V);else{V.key=null,V.type=K0;continue $}}return w}}readHeadByte(){if(this.headByte===P0)this.headByte=this.readU8();return this.headByte}complete(){this.headByte=P0}readArraySize(){let $=this.readHeadByte();switch($){case 220:return this.readU16();case 221:return this.readU32();default:if($<160)return $-144;else throw new t4.DecodeError(`Unrecognized array type byte: ${(0,E9.prettyByte)($)}`)}}pushMapState($){if($>this.maxMapLength)throw new t4.DecodeError(`Max length exceeded: map length (${$}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState($)}pushArrayState($){if($>this.maxArrayLength)throw new t4.DecodeError(`Max length exceeded: array length (${$}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState($)}decodeString($,w){if(!this.rawStrings||this.stateIsMapKey())return this.decodeUtf8String($,w);return this.decodeBinary($,w)}decodeUtf8String($,w){if($>this.maxStrLength)throw new t4.DecodeError(`Max length exceeded: UTF-8 byte length (${$}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+w+$)throw n7;let J=this.pos+w,V;if(this.stateIsMapKey()&&this.keyDecoder?.canBeCached($))V=this.keyDecoder.decode(this.bytes,J,$);else V=(0,Of.utf8Decode)(this.bytes,J,$);return this.pos+=w+$,V}stateIsMapKey(){if(this.stack.length>0)return this.stack.top().type===K0;return!1}decodeBinary($,w){if($>this.maxBinLength)throw new t4.DecodeError(`Max length exceeded: bin length (${$}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining($+w))throw n7;let J=this.pos+w,V=this.bytes.subarray(J,J+$);return this.pos+=w+$,V}decodeExtension($,w){if($>this.maxExtLength)throw new t4.DecodeError(`Max length exceeded: ext length (${$}) > maxExtLength (${this.maxExtLength})`);let J=this.view.getInt8(this.pos+w),V=this.decodeBinary($,w+1);return this.extensionCodec.decode(V,J,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let $=this.view.getUint8(this.pos);return this.pos++,$}readI8(){let $=this.view.getInt8(this.pos);return this.pos++,$}readU16(){let $=this.view.getUint16(this.pos);return this.pos+=2,$}readI16(){let $=this.view.getInt16(this.pos);return this.pos+=2,$}readU32(){let $=this.view.getUint32(this.pos);return this.pos+=4,$}readI32(){let $=this.view.getInt32(this.pos);return this.pos+=4,$}readU64(){let $=(0,Qw.getUint64)(this.view,this.pos);return this.pos+=8,$}readI64(){let $=(0,Qw.getInt64)(this.view,this.pos);return this.pos+=8,$}readU64AsBigInt(){let $=this.view.getBigUint64(this.pos);return this.pos+=8,$}readI64AsBigInt(){let $=this.view.getBigInt64(this.pos);return this.pos+=8,$}readF32(){let $=this.view.getFloat32(this.pos);return this.pos+=4,$}readF64(){let $=this.view.getFloat64(this.pos);return this.pos+=8,$}}y7.Decoder=x9});var t7=Z((l7)=>{Object.defineProperty(l7,"__esModule",{value:!0});l7.decode=Hf;l7.decodeMulti=Ff;var c7=Qz();function Hf($,w){return new c7.Decoder(w).decode($)}function Ff($,w){return new c7.Decoder(w).decodeMulti($)}});var e7=Z((a7)=>{Object.defineProperty(a7,"__esModule",{value:!0});a7.isAsyncIterable=o7;a7.asyncIterableFromStream=p7;a7.ensureAsyncIterable=Tf;function o7($){return $[Symbol.asyncIterator]!=null}async function*p7($){let w=$.getReader();try{while(!0){let{done:J,value:V}=await w.read();if(J)return;yield V}}finally{w.releaseLock()}}function Tf($){if(o7($))return $;else return p7($)}});var $O=Z((s7)=>{Object.defineProperty(s7,"__esModule",{value:!0});s7.decodeAsync=Mf;s7.decodeArrayStream=Af;s7.decodeMultiStream=Sf;var r9=Qz(),n9=e7();async function Mf($,w){let J=(0,n9.ensureAsyncIterable)($);return new r9.Decoder(w).decodeAsync(J)}function Af($,w){let J=(0,n9.ensureAsyncIterable)($);return new r9.Decoder(w).decodeArrayStream(J)}function Sf($,w){let J=(0,n9.ensureAsyncIterable)($);return new r9.Decoder(w).decodeStream(J)}});var JO=Z((O$)=>{Object.defineProperty(O$,"__esModule",{value:!0});O$.decodeTimestampExtension=O$.encodeTimestampExtension=O$.decodeTimestampToTimeSpec=O$.encodeTimeSpecToTimestamp=O$.encodeDateToTimeSpec=O$.EXT_TIMESTAMP=O$.ExtData=O$.ExtensionCodec=O$.Encoder=O$.DecodeError=O$.Decoder=O$.decodeMultiStream=O$.decodeArrayStream=O$.decodeAsync=O$.decodeMulti=O$.decode=O$.encode=void 0;var bf=k7();Object.defineProperty(O$,"encode",{enumerable:!0,get:function(){return bf.encode}});var wO=t7();Object.defineProperty(O$,"decode",{enumerable:!0,get:function(){return wO.decode}});Object.defineProperty(O$,"decodeMulti",{enumerable:!0,get:function(){return wO.decodeMulti}});var d9=$O();Object.defineProperty(O$,"decodeAsync",{enumerable:!0,get:function(){return d9.decodeAsync}});Object.defineProperty(O$,"decodeArrayStream",{enumerable:!0,get:function(){return d9.decodeArrayStream}});Object.defineProperty(O$,"decodeMultiStream",{enumerable:!0,get:function(){return d9.decodeMultiStream}});var Ef=Qz();Object.defineProperty(O$,"Decoder",{enumerable:!0,get:function(){return Ef.Decoder}});var Cf=Iz();Object.defineProperty(O$,"DecodeError",{enumerable:!0,get:function(){return Cf.DecodeError}});var jf=b9();Object.defineProperty(O$,"Encoder",{enumerable:!0,get:function(){return jf.Encoder}});var xf=vz();Object.defineProperty(O$,"ExtensionCodec",{enumerable:!0,get:function(){return xf.ExtensionCodec}});var rf=A9();Object.defineProperty(O$,"ExtData",{enumerable:!0,get:function(){return rf.ExtData}});var jJ=S9();Object.defineProperty(O$,"EXT_TIMESTAMP",{enumerable:!0,get:function(){return jJ.EXT_TIMESTAMP}});Object.defineProperty(O$,"encodeDateToTimeSpec",{enumerable:!0,get:function(){return jJ.encodeDateToTimeSpec}});Object.defineProperty(O$,"encodeTimeSpecToTimestamp",{enumerable:!0,get:function(){return jJ.encodeTimeSpecToTimestamp}});Object.defineProperty(O$,"decodeTimestampToTimeSpec",{enumerable:!0,get:function(){return jJ.decodeTimestampToTimeSpec}});Object.defineProperty(O$,"encodeTimestampExtension",{enumerable:!0,get:function(){return jJ.encodeTimestampExtension}});Object.defineProperty(O$,"decodeTimestampExtension",{enumerable:!0,get:function(){return jJ.decodeTimestampExtension}})});var KO=Z((PO)=>{Object.defineProperty(PO,"__esModule",{value:!0});function P$($){return{enumerable:!0,value:$}}function UO($){return{enumerable:!0,writable:!0,value:$}}var Ow={},df=()=>!0,VO=()=>({}),zO=($)=>$,mf=($,w,J,V)=>$.apply(J,V)&&w.apply(J,V),yf=($,w,J,[V,U])=>w.call(J,$.call(J,V,U),U),Z6=($,w)=>Object.freeze(Object.create($,w));function GO($,w,J){return $.reduce((V,U)=>{return function(...G){return J(V,U,this,G)}},w)}function iO($){return Z6(this,{fn:P$($)})}var XO={},NO=iO.bind(XO),hf=($)=>NO((w,J)=>!!~$(w,J)&&w),WO={},cf=iO.bind(WO);function Oz($,w){return w.filter((J)=>$.isPrototypeOf(J))}function IO($,w,...J){let V=GO(Oz(WO,J).map((G)=>G.fn),df,mf),U=GO(Oz(XO,J).map((G)=>G.fn),zO,yf);return Z6(this,{from:P$($),to:P$(w),guards:P$(V),reducers:P$(U)})}var gO={},YO={},lf=IO.bind(gO),tf=IO.bind(YO,null);function of($,w,J){return y9(w,$,J,this.immediates)||$}function vO($){let w=new Map;for(let J of $){if(!w.has(J.from))w.set(J.from,[]);w.get(J.from).push(J)}return w}var pf={enter:zO};function af(...$){let w=Oz(gO,$),J=Oz(YO,$),V={final:P$($.length===0),transitions:P$(vO(w))};if(J.length)V.immediates=P$(J),V.enter=P$(of);return Z6(pf,V)}var ef={enter($,w,J){let V=this.fn.call(w,w.context,J);if(m9.isPrototypeOf(V))return Z6(QO,{machine:P$(V),transitions:P$(this.transitions)}).enter($,w,J);return V.then((U)=>w.send({type:"done",data:U})).catch((U)=>w.send({type:"error",error:U})),$}},QO={enter($,w,J){if(w.child=OO(this.machine,(V)=>{if(w.onChange(V),w.child==V&&V.machine.state.value.final)delete w.child,w.send({type:"done",data:V.context})},w.context,J),w.child.machine.state.value.final){let V=w.child.context;return delete w.child,y9(w,$,{type:"done",data:V},this.transitions.get("done"))}return $}};function sf($,...w){let J=P$(vO(w));return m9.isPrototypeOf($)?Z6(QO,{machine:P$($),transitions:J}):Z6(ef,{fn:P$($),transitions:J})}var m9={get state(){return{name:this.current,value:this.states[this.current]}}};function $M($,w,J=VO){if(typeof $!=="string")J=w||VO,w=$,$=Object.keys(w)[0];if(Ow._create)Ow._create($,w);return Z6(m9,{context:P$(J),current:P$($),states:P$(w)})}function y9($,w,J,V){let{context:U}=$;for(let{to:G,guards:z,reducers:i}of V)if(z(U,J)){$.context=i.call($,U,J);let N=w.original||w,X=Z6(N,{current:P$(G),original:{value:N}});if(Ow._onEnter)Ow._onEnter(w,G,$.context,U,J);return X.state.value.enter(X,$,J)}}function wM($,w){let J=w.type||w,{machine:V}=$,{value:U,name:G}=V.state;if(U.transitions.has(J))return y9($,V,w,U.transitions.get(J))||V;else if(Ow._send)Ow._send(J,G);return V}var JM={send($){this.machine=wM(this,$),this.onChange(this)}};function OO($,w,J,V){let U=Object.create(JM,{machine:UO($),context:UO($.context(J,V)),onChange:P$(w)});return U.send=U.send.bind(U),U.machine=U.machine.state.value.enter(U.machine,U,V),U}PO.action=hf;PO.createMachine=$M;PO.d=Ow;PO.guard=cf;PO.immediate=tf;PO.interpret=OO;PO.invoke=sf;PO.reduce=NO;PO.state=af;PO.transition=lf});var TO=Z((B0)=>{var uO=B0&&B0.__awaiter||function($,w,J,V){function U(G){return G instanceof J?G:new J(function(z){z(G)})}return new(J||(J=Promise))(function(G,z){function i(W){try{X(V.next(W))}catch(I){z(I)}}function N(W){try{X(V.throw(W))}catch(I){z(I)}}function X(W){W.done?G(W.value):U(W.value).then(i,N)}X((V=V.apply($,w||[])).next())})};Object.defineProperty(B0,"__esModule",{value:!0});B0.createRealtimeClient=MM;var u0=JO(),n=KO(),BO=Z9(),uz=B6(),HO=zz(),rJ=c4(),YM=()=>({enqueuedMessage:void 0});function vM($){return $.token!==void 0}function QM($){return!vM($)}function Pz($,w){return Object.assign(Object.assign({},$),{enqueuedMessage:w.message})}function T6($){if($.websocket&&$.websocket.readyState===WebSocket.OPEN)$.websocket.close();return Object.assign(Object.assign({},$),{websocket:void 0})}function OM($,w){if($.websocket&&$.websocket.readyState===WebSocket.OPEN){if(w.message instanceof Uint8Array)$.websocket.send(w.message);else if(typeof w.message==="string")$.websocket.send(w.message);else $.websocket.send((0,u0.encode)(w.message));return Object.assign(Object.assign({},$),{enqueuedMessage:void 0})}return Object.assign(Object.assign({},$),{enqueuedMessage:w.message})}function Kz($){return Object.assign(Object.assign({},$),{token:void 0})}function FO($,w){return Object.assign(Object.assign({},$),{token:w.token})}function PM($,w){return Object.assign(Object.assign({},$),{websocket:w.websocket})}var KM=(0,n.createMachine)("idle",{idle:(0,n.state)((0,n.transition)("send","connecting",(0,n.reduce)(Pz)),(0,n.transition)("close","idle",(0,n.reduce)(T6))),connecting:(0,n.state)((0,n.transition)("connecting","connecting"),(0,n.transition)("connected","active",(0,n.reduce)(PM)),(0,n.transition)("connectionClosed","idle",(0,n.reduce)(T6)),(0,n.transition)("send","connecting",(0,n.reduce)(Pz)),(0,n.transition)("close","idle",(0,n.reduce)(T6)),(0,n.immediate)("authRequired",(0,n.guard)(QM))),authRequired:(0,n.state)((0,n.transition)("initiateAuth","authInProgress"),(0,n.transition)("send","authRequired",(0,n.reduce)(Pz)),(0,n.transition)("close","idle",(0,n.reduce)(T6))),authInProgress:(0,n.state)((0,n.transition)("authenticated","connecting",(0,n.reduce)(FO)),(0,n.transition)("unauthorized","idle",(0,n.reduce)(Kz),(0,n.reduce)(T6)),(0,n.transition)("send","authInProgress",(0,n.reduce)(Pz)),(0,n.transition)("close","idle",(0,n.reduce)(T6))),active:(0,n.state)((0,n.transition)("send","active",(0,n.reduce)(OM)),(0,n.transition)("authenticated","active",(0,n.reduce)(FO)),(0,n.transition)("unauthorized","idle",(0,n.reduce)(Kz)),(0,n.transition)("connectionClosed","idle",(0,n.reduce)(Kz),(0,n.reduce)(T6)),(0,n.transition)("close","idle",(0,n.reduce)(Kz),(0,n.reduce)(T6)))},YM);function uM($,{token:w,maxBuffering:J,path:V}){var U;if(J!==void 0&&(J<1||J>60))throw Error("The `maxBuffering` must be between 1 and 60 (inclusive)");let G=new URLSearchParams({fal_jwt_token:w});if(J!==void 0)G.set("max_buffering",J.toFixed(0));let z=(0,rJ.ensureEndpointIdFormat)($),i=(U=(0,rJ.resolveEndpointPath)($,V,"/realtime"))!==null&&U!==void 0?U:"";return`wss://fal.run/${z}${i}?${G.toString()}`}var BM=128;function HM($){return $.status==="error"&&$.error==="Unauthorized"}var FM={NORMAL_CLOSURE:1000,GOING_AWAY:1001},h9=new Map,qO=new Map;function qM($,w,J){if(!h9.has($)){let V=(0,n.interpret)(KM,J);h9.set($,{service:V,throttledSend:w>0?(0,rJ.throttle)(V.send,w,!0):V.send})}return h9.get($)}var xJ=()=>{},ZM={send:xJ,close:xJ};function TM($){return $.status!=="error"&&$.type!=="x-fal-message"&&!ZO($)}function ZO($){return $.type==="x-fal-error"}function DM($){return uO(this,void 0,void 0,function*(){if(typeof $==="string")return JSON.parse($);let w=(J)=>uO(this,void 0,void 0,function*(){if(J instanceof Uint8Array)return J;if(J instanceof Blob)return new Uint8Array(yield J.arrayBuffer());return new Uint8Array(J)});if($ instanceof ArrayBuffer||$ instanceof Uint8Array)return(0,u0.decode)(yield w($));if($ instanceof Blob)return(0,u0.decode)(yield w($));return $})}function LM($){if($ instanceof Uint8Array)return $;if(typeof $==="string")return(0,u0.encode)($);return(0,u0.encode)($)}function fM({data:$,decodeMessage:w,onResult:J,onError:V,send:U}){let G=(z)=>{if(HM(z)){U({type:"unauthorized",error:Error("Unauthorized")});return}if(TM(z)){J(z);return}if(ZO(z)){if(z.error==="TIMEOUT")return;V(new uz.ApiError({message:`${z.error}: ${z.reason}`,status:400,body:z}));return}};Promise.resolve(w?w($):$).then(G).catch((z)=>{var i;V(new uz.ApiError({message:(i=z===null||z===void 0?void 0:z.message)!==null&&i!==void 0?i:"Failed to decode realtime message",status:400}))})}function MM({config:$}){return{connect(w,J){let{clientOnly:V=(0,rJ.isReact)()&&!(0,HO.isBrowser)(),connectionKey:U=crypto.randomUUID(),maxBuffering:G,path:z,throttleInterval:i=BM,encodeMessage:N,decodeMessage:X,tokenProvider:W,tokenExpirationSeconds:I}=J;if(V&&!(0,HO.isBrowser)())return ZM;let g=N!==null&&N!==void 0?N:(b)=>LM(b),Y=X!==null&&X!==void 0?X:(b)=>DM(b),v,O,P,F=0;qO.set(U,{decodeMessage:Y,onError:J.onError,onResult:J.onResult});let q=()=>qO.get(U),T=qM(U,i,({context:b,machine:C,send:_})=>{var t;let{enqueuedMessage:y,token:W$,websocket:U$}=b;if(O=y,C.current==="active"&&y&&(U$===null||U$===void 0?void 0:U$.readyState)===WebSocket.OPEN)_({type:"send",message:y});if(C.current==="authRequired"&&W$===void 0&&v!==C.current){_({type:"initiateAuth"}),F++;let H$=F,k$=(0,rJ.ensureEndpointIdFormat)(w),r$=(t=(0,rJ.resolveEndpointPath)(w,z,"/realtime"))!==null&&t!==void 0?t:"",E6=W?()=>W(`${k$}${r$}`):()=>{return console.warn("[fal.realtime] Using the default token provider is deprecated. Please provide a `tokenProvider` function to `fal.realtime.connect()`. See https://docs.fal.ai/model-apis/client#client-side-usage-with-token-provider for more information."),(0,BO.getTemporaryAuthToken)(w,$)},$U=W?I:BO.TOKEN_EXPIRATION_SECONDS,Fi=$U!==void 0?()=>{clearTimeout(P);let wU=Math.round($U*0.9*1000);P=setTimeout(()=>{if(H$!==F)return;E6().then((qi)=>{if(H$!==F)return;queueMicrotask(()=>{_({type:"authenticated",token:qi})}),Fi()}).catch(()=>{if(H$!==F)return;let qi=Math.round($U*0.05*1000);P=setTimeout(()=>{Fi()},qi)})},wU)}:xJ;E6().then((wU)=>{queueMicrotask(()=>{_({type:"authenticated",token:wU})}),Fi()}).catch((wU)=>{queueMicrotask(()=>{_({type:"unauthorized",error:wU})})})}if(C.current==="connecting"&&v!==C.current&&W$!==void 0){let H$=new WebSocket(uM(w,{token:W$,maxBuffering:G,path:z}));H$.onopen=()=>{var k$,r$;_({type:"connected",websocket:H$});let E6=(r$=(k$=T.service.context)===null||k$===void 0?void 0:k$.enqueuedMessage)!==null&&r$!==void 0?r$:O;if(E6)H$.send(g(E6)),T.service.context=Object.assign(Object.assign({},T.service.context),{enqueuedMessage:void 0})},H$.onclose=(k$)=>{if(k$.code!==FM.NORMAL_CLOSURE){let{onError:r$=xJ}=q();r$(new uz.ApiError({message:`Error closing the connection: ${k$.reason}`,status:k$.code}))}_({type:"connectionClosed",code:k$.code})},H$.onerror=(k$)=>{let{onError:r$=xJ}=q();r$(new uz.ApiError({message:"Unknown error",status:500}))},H$.onmessage=(k$)=>{let{decodeMessage:r$=Y,onResult:E6,onError:$U=xJ}=q();fM({data:k$.data,decodeMessage:r$,onResult:E6,onError:$U,send:_})}}if(v==="active"&&C.current!=="active")clearTimeout(P),P=void 0;v=C.current});return{send:(b)=>{T.throttledSend({type:"send",message:g(b)})},close:()=>{T.service.send({type:"close"})}}}}}});var c9=Z((H0)=>{var DO=H0&&H0.__awaiter||function($,w,J,V){function U(G){return G instanceof J?G:new J(function(z){z(G)})}return new(J||(J=Promise))(function(G,z){function i(W){try{X(V.next(W))}catch(I){z(I)}}function N(W){try{X(V.throw(W))}catch(I){z(I)}}function X(W){W.done?G(W.value):U(W.value).then(i,N)}X((V=V.apply($,w||[])).next())})};Object.defineProperty(H0,"__esModule",{value:!0});H0.createFalClient=EM;var AM=iz(),SM=Vz(),_M=w7(),kM=TO(),LO=bJ(),RM=B6(),fO=q9(),bM=f9();function EM($={}){let w=(0,AM.createConfig)($),J=(0,fO.createStorageClient)({config:w}),V=(0,_M.createQueueClient)({config:w,storage:J}),U=(0,bM.createStreamingClient)({config:w,storage:J}),G=(0,kM.createRealtimeClient)({config:w});return{queue:V,realtime:G,storage:J,streaming:U,stream:U.stream,run(z){return DO(this,arguments,void 0,function*(i,N={}){let X=N.input?yield J.transformInput(N.input):void 0;return(0,LO.dispatchRequest)({method:N.method,targetUrl:(0,LO.buildUrl)(i,N),input:X,headers:Object.assign(Object.assign({},(0,fO.buildObjectLifecycleHeaders)(N.storageSettings)),(0,SM.buildTimeoutHeaders)(N.startTimeout)),config:Object.assign(Object.assign({},w),{responseHandler:RM.resultResponseHandler}),options:{signal:N.abortSignal,retry:{maxRetries:3,baseDelay:500,maxDelay:15000}}})})},subscribe:(z,i)=>DO(this,void 0,void 0,function*(){let{request_id:N}=yield V.submit(z,i);if(i.onEnqueue)i.onEnqueue(N);return yield V.subscribeToStatus(z,Object.assign({requestId:N},i)),V.result(z,{requestId:N})})}}});var SO=Z((AO)=>{Object.defineProperty(AO,"__esModule",{value:!0});AO.isQueueStatus=MO;AO.isCompletedQueueStatus=CM;function MO($){return $&&$.status&&$.response_url}function CM($){return MO($)&&$.status==="COMPLETED"}});var bO=Z((i$)=>{var rM=i$&&i$.__createBinding||(Object.create?function($,w,J,V){if(V===void 0)V=J;var U=Object.getOwnPropertyDescriptor(w,J);if(!U||("get"in U?!w.__esModule:U.writable||U.configurable))U={enumerable:!0,get:function(){return w[J]}};Object.defineProperty($,V,U)}:function($,w,J,V){if(V===void 0)V=J;$[V]=w[J]}),nM=i$&&i$.__exportStar||function($,w){for(var J in $)if(J!=="default"&&!Object.prototype.hasOwnProperty.call(w,J))rM(w,$,J)};Object.defineProperty(i$,"__esModule",{value:!0});i$.fal=i$.parseEndpointId=i$.isRetryableError=i$.ValidationError=i$.ApiError=i$.withProxy=i$.withMiddleware=i$.createFalClient=void 0;var _O=c9(),dM=c9();Object.defineProperty(i$,"createFalClient",{enumerable:!0,get:function(){return dM.createFalClient}});var kO=O9();Object.defineProperty(i$,"withMiddleware",{enumerable:!0,get:function(){return kO.withMiddleware}});Object.defineProperty(i$,"withProxy",{enumerable:!0,get:function(){return kO.withProxy}});var RO=B6();Object.defineProperty(i$,"ApiError",{enumerable:!0,get:function(){return RO.ApiError}});Object.defineProperty(i$,"ValidationError",{enumerable:!0,get:function(){return RO.ValidationError}});var mM=Q0();Object.defineProperty(i$,"isRetryableError",{enumerable:!0,get:function(){return mM.isRetryableError}});nM(SO(),i$);var yM=c4();Object.defineProperty(i$,"parseEndpointId",{enumerable:!0,get:function(){return yM.parseEndpointId}});i$.fal=function(){let w=(0,_O.createFalClient)();return{config(J){w=(0,_O.createFalClient)(J)},get queue(){return w.queue},get realtime(){return w.realtime},get storage(){return w.storage},get streaming(){return w.streaming},run(J,V){return w.run(J,V)},subscribe(J,V){return w.subscribe(J,V)},stream(J,V){return w.stream(J,V)}}}()});var p=Z((eS)=>{var Qg=Symbol.for("yaml.alias"),DP=Symbol.for("yaml.document"),fz=Symbol.for("yaml.map"),LP=Symbol.for("yaml.pair"),Og=Symbol.for("yaml.scalar"),Mz=Symbol.for("yaml.seq"),a4=Symbol.for("yaml.node.type"),hS=($)=>!!$&&typeof $==="object"&&$[a4]===Qg,cS=($)=>!!$&&typeof $==="object"&&$[a4]===DP,lS=($)=>!!$&&typeof $==="object"&&$[a4]===fz,tS=($)=>!!$&&typeof $==="object"&&$[a4]===LP,fP=($)=>!!$&&typeof $==="object"&&$[a4]===Og,oS=($)=>!!$&&typeof $==="object"&&$[a4]===Mz;function MP($){if($&&typeof $==="object")switch($[a4]){case fz:case Mz:return!0}return!1}function pS($){if($&&typeof $==="object")switch($[a4]){case Qg:case fz:case Og:case Mz:return!0}return!1}var aS=($)=>(fP($)||MP($))&&!!$.anchor;eS.ALIAS=Qg;eS.DOC=DP;eS.MAP=fz;eS.NODE_TYPE=a4;eS.PAIR=LP;eS.SCALAR=Og;eS.SEQ=Mz;eS.hasAnchor=aS;eS.isAlias=hS;eS.isCollection=MP;eS.isDocument=cS;eS.isMap=lS;eS.isNode=pS;eS.isPair=tS;eS.isScalar=fP;eS.isSeq=oS});var Z0=Z((Q_)=>{var u$=p(),y$=Symbol("break visit"),AP=Symbol("skip children"),_4=Symbol("remove node");function Az($,w){let J=SP(w);if(u$.isDocument($)){if(mJ(null,$.contents,J,Object.freeze([$]))===_4)$.contents=null}else mJ(null,$,J,Object.freeze([]))}Az.BREAK=y$;Az.SKIP=AP;Az.REMOVE=_4;function mJ($,w,J,V){let U=_P($,w,J,V);if(u$.isNode(U)||u$.isPair(U))return kP($,V,U),mJ($,U,J,V);if(typeof U!=="symbol"){if(u$.isCollection(w)){V=Object.freeze(V.concat(w));for(let G=0;G<w.items.length;++G){let z=mJ(G,w.items[G],J,V);if(typeof z==="number")G=z-1;else if(z===y$)return y$;else if(z===_4)w.items.splice(G,1),G-=1}}else if(u$.isPair(w)){V=Object.freeze(V.concat(w));let G=mJ("key",w.key,J,V);if(G===y$)return y$;else if(G===_4)w.key=null;let z=mJ("value",w.value,J,V);if(z===y$)return y$;else if(z===_4)w.value=null}}return U}async function Sz($,w){let J=SP(w);if(u$.isDocument($)){if(await yJ(null,$.contents,J,Object.freeze([$]))===_4)$.contents=null}else await yJ(null,$,J,Object.freeze([]))}Sz.BREAK=y$;Sz.SKIP=AP;Sz.REMOVE=_4;async function yJ($,w,J,V){let U=await _P($,w,J,V);if(u$.isNode(U)||u$.isPair(U))return kP($,V,U),yJ($,U,J,V);if(typeof U!=="symbol"){if(u$.isCollection(w)){V=Object.freeze(V.concat(w));for(let G=0;G<w.items.length;++G){let z=await yJ(G,w.items[G],J,V);if(typeof z==="number")G=z-1;else if(z===y$)return y$;else if(z===_4)w.items.splice(G,1),G-=1}}else if(u$.isPair(w)){V=Object.freeze(V.concat(w));let G=await yJ("key",w.key,J,V);if(G===y$)return y$;else if(G===_4)w.key=null;let z=await yJ("value",w.value,J,V);if(z===y$)return y$;else if(z===_4)w.value=null}}return U}function SP($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function _P($,w,J,V){if(typeof J==="function")return J($,w,V);if(u$.isMap(w))return J.Map?.($,w,V);if(u$.isSeq(w))return J.Seq?.($,w,V);if(u$.isPair(w))return J.Pair?.($,w,V);if(u$.isScalar(w))return J.Scalar?.($,w,V);if(u$.isAlias(w))return J.Alias?.($,w,V);return}function kP($,w,J){let V=w[w.length-1];if(u$.isCollection(V))V.items[$]=J;else if(u$.isPair(V))if($==="key")V.key=J;else V.value=J;else if(u$.isDocument(V))V.contents=J;else{let U=u$.isAlias(V)?"alias":"scalar";throw Error(`Cannot replace node with ${U} parent`)}}Q_.visit=Az;Q_.visitAsync=Sz});var Pg=Z((H_)=>{var RP=p(),K_=Z0(),u_={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},B_=($)=>$.replace(/[!,[\]{}]/g,(w)=>u_[w]);class z4{constructor($,w){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},z4.defaultYaml,$),this.tags=Object.assign({},z4.defaultTags,w)}clone(){let $=new z4(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new z4(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:z4.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},z4.defaultTags);break}return $}add($,w){if(this.atNextDocument)this.yaml={explicit:z4.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},z4.defaultTags),this.atNextDocument=!1;let J=$.trim().split(/[ \t]+/),V=J.shift();switch(V){case"%TAG":{if(J.length!==2){if(w(0,"%TAG directive should contain exactly two parts"),J.length<2)return!1}let[U,G]=J;return this.tags[U]=G,!0}case"%YAML":{if(this.yaml.explicit=!0,J.length!==1)return w(0,"%YAML directive should contain exactly one part"),!1;let[U]=J;if(U==="1.1"||U==="1.2")return this.yaml.version=U,!0;else{let G=/^\d+\.\d+$/.test(U);return w(6,`Unsupported YAML version ${U}`,G),!1}}default:return w(0,`Unknown directive ${V}`,!0),!1}}tagName($,w){if($==="!")return"!";if($[0]!=="!")return w(`Not a valid tag: ${$}`),null;if($[1]==="<"){let G=$.slice(2,-1);if(G==="!"||G==="!!")return w(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")w("Verbatim tags must end with a >");return G}let[,J,V]=$.match(/^(.*!)([^!]*)$/s);if(!V)w(`The ${$} tag has no suffix`);let U=this.tags[J];if(U)try{return U+decodeURIComponent(V)}catch(G){return w(String(G)),null}if(J==="!")return $;return w(`Could not resolve tag: ${$}`),null}tagString($){for(let[w,J]of Object.entries(this.tags))if($.startsWith(J))return w+B_($.substring(J.length));return $[0]==="!"?$:`!<${$}>`}toString($){let w=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],J=Object.entries(this.tags),V;if($&&J.length>0&&RP.isNode($.contents)){let U={};K_.visit($.contents,(G,z)=>{if(RP.isNode(z)&&z.tag)U[z.tag]=!0}),V=Object.keys(U)}else V=[];for(let[U,G]of J){if(U==="!!"&&G==="tag:yaml.org,2002:")continue;if(!$||V.some((z)=>z.startsWith(G)))w.push(`%TAG ${U} ${G}`)}return w.join(`
|
|
33
|
+
`)}}z4.defaultYaml={explicit:!1,version:"1.2"};z4.defaultTags={"!!":"tag:yaml.org,2002:"};H_.Directives=z4});var _z=Z((D_)=>{var bP=p(),q_=Z0();function Z_($){if(/[\x00-\x19\s,[\]{}]/.test($)){let J=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(J)}return!0}function EP($){let w=new Set;return q_.visit($,{Value(J,V){if(V.anchor)w.add(V.anchor)}}),w}function CP($,w){for(let J=1;;++J){let V=`${$}${J}`;if(!w.has(V))return V}}function T_($,w){let J=[],V=new Map,U=null;return{onAnchor:(G)=>{J.push(G),U??(U=EP($));let z=CP(w,U);return U.add(z),z},setAnchors:()=>{for(let G of J){let z=V.get(G);if(typeof z==="object"&&z.anchor&&(bP.isScalar(z.node)||bP.isCollection(z.node)))z.node.anchor=z.anchor;else{let i=Error("Failed to resolve repeated object (this should not happen)");throw i.source=G,i}}},sourceObjects:V}}D_.anchorIsValid=Z_;D_.anchorNames=EP;D_.createNodeAnchors=T_;D_.findNewAnchor=CP});var Kg=Z((S_)=>{function T0($,w,J,V){if(V&&typeof V==="object")if(Array.isArray(V))for(let U=0,G=V.length;U<G;++U){let z=V[U],i=T0($,V,String(U),z);if(i===void 0)delete V[U];else if(i!==z)V[U]=i}else if(V instanceof Map)for(let U of Array.from(V.keys())){let G=V.get(U),z=T0($,V,U,G);if(z===void 0)V.delete(U);else if(z!==G)V.set(U,z)}else if(V instanceof Set)for(let U of Array.from(V)){let G=T0($,V,U,U);if(G===void 0)V.delete(U);else if(G!==U)V.delete(U),V.add(G)}else for(let[U,G]of Object.entries(V)){let z=T0($,V,U,G);if(z===void 0)delete V[U];else if(z!==G)V[U]=z}return $.call(w,J,V)}S_.applyReviver=T0});var L6=Z((R_)=>{var k_=p();function jP($,w,J){if(Array.isArray($))return $.map((V,U)=>jP(V,String(U),J));if($&&typeof $.toJSON==="function"){if(!J||!k_.hasAnchor($))return $.toJSON(w,J);let V={aliasCount:0,count:1,res:void 0};J.anchors.set($,V),J.onCreate=(G)=>{V.res=G,delete J.onCreate};let U=$.toJSON(w,J);if(J.onCreate)J.onCreate(U);return U}if(typeof $==="bigint"&&!J?.keep)return Number($);return $}R_.toJS=jP});var kz=Z((j_)=>{var E_=Kg(),xP=p(),C_=L6();class rP{constructor($){Object.defineProperty(this,xP.NODE_TYPE,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:w,maxAliasCount:J,onAnchor:V,reviver:U}={}){if(!xP.isDocument($))throw TypeError("A document argument is required");let G={anchors:new Map,doc:$,keep:!0,mapAsMap:w===!0,mapKeyWarned:!1,maxAliasCount:typeof J==="number"?J:100},z=C_.toJS(this,"",G);if(typeof V==="function")for(let{count:i,res:N}of G.anchors.values())V(N,i);return typeof U==="function"?E_.applyReviver(U,{"":z},"",z):z}}j_.NodeBase=rP});var D0=Z((y_)=>{var r_=_z(),n_=Z0(),hJ=p(),d_=kz(),m_=L6();class nP extends d_.NodeBase{constructor($){super(hJ.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,w){if(w?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let J;if(w?.aliasResolveCache)J=w.aliasResolveCache;else if(J=[],n_.visit($,{Node:(U,G)=>{if(hJ.isAlias(G)||hJ.hasAnchor(G))J.push(G)}}),w)w.aliasResolveCache=J;let V=void 0;for(let U of J){if(U===this)break;if(U.anchor===this.source)V=U}return V}toJSON($,w){if(!w)return{source:this.source};let{anchors:J,doc:V,maxAliasCount:U}=w,G=this.resolve(V,w);if(!G){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(i)}let z=J.get(G);if(!z)m_.toJS(G,null,w),z=J.get(G);if(z?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(U>=0){if(z.count+=1,z.aliasCount===0)z.aliasCount=Rz(V,G,J);if(z.count*z.aliasCount>U)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return z.res}toString($,w,J){let V=`*${this.source}`;if($){if(r_.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let U=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(U)}if($.implicitKey)return`${V} `}return V}}function Rz($,w,J){if(hJ.isAlias(w)){let V=w.resolve($),U=J&&V&&J.get(V);return U?U.count*U.aliasCount:0}else if(hJ.isCollection(w)){let V=0;for(let U of w.items){let G=Rz($,U,J);if(G>V)V=G}return V}else if(hJ.isPair(w)){let V=Rz($,w.key,J),U=Rz($,w.value,J);return Math.max(V,U)}return 1}y_.Alias=nP});var I$=Z((p_)=>{var c_=p(),l_=kz(),t_=L6(),o_=($)=>!$||typeof $!=="function"&&typeof $!=="object";class Kw extends l_.NodeBase{constructor($){super(c_.SCALAR);this.value=$}toJSON($,w){return w?.keep?this.value:t_.toJS(this.value,$,w)}toString(){return String(this.value)}}Kw.BLOCK_FOLDED="BLOCK_FOLDED";Kw.BLOCK_LITERAL="BLOCK_LITERAL";Kw.PLAIN="PLAIN";Kw.QUOTE_DOUBLE="QUOTE_DOUBLE";Kw.QUOTE_SINGLE="QUOTE_SINGLE";p_.Scalar=Kw;p_.isScalarValue=o_});var L0=Z((Uk)=>{var s_=D0(),uw=p(),dP=I$(),$k="tag:yaml.org,2002:";function wk($,w,J){if(w){let V=J.filter((G)=>G.tag===w),U=V.find((G)=>!G.format)??V[0];if(!U)throw Error(`Tag ${w} not found`);return U}return J.find((V)=>V.identify?.($)&&!V.format)}function Jk($,w,J){if(uw.isDocument($))$=$.contents;if(uw.isNode($))return $;if(uw.isPair($)){let I=J.schema[uw.MAP].createNode?.(J.schema,null,J);return I.items.push($),I}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:V,onAnchor:U,onTagObj:G,schema:z,sourceObjects:i}=J,N=void 0;if(V&&$&&typeof $==="object")if(N=i.get($),N)return N.anchor??(N.anchor=U($)),new s_.Alias(N.anchor);else N={anchor:null,node:null},i.set($,N);if(w?.startsWith("!!"))w=$k+w.slice(2);let X=wk($,w,z.tags);if(!X){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let I=new dP.Scalar($);if(N)N.node=I;return I}X=$ instanceof Map?z[uw.MAP]:(Symbol.iterator in Object($))?z[uw.SEQ]:z[uw.MAP]}if(G)G(X),delete J.onTagObj;let W=X?.createNode?X.createNode(J.schema,$,J):typeof X?.nodeClass?.from==="function"?X.nodeClass.from(J.schema,$,J):new dP.Scalar($);if(w)W.tag=w;else if(!X.default)W.tag=X.tag;if(N)N.node=W;return W}Uk.createNode=Jk});var bz=Z((ik)=>{var Gk=L0(),k4=p(),zk=kz();function ug($,w,J){let V=J;for(let U=w.length-1;U>=0;--U){let G=w[U];if(typeof G==="number"&&Number.isInteger(G)&&G>=0){let z=[];z[G]=V,V=z}else V=new Map([[G,V]])}return Gk.createNode(V,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var mP=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class yP extends zk.NodeBase{constructor($,w){super($);Object.defineProperty(this,"schema",{value:w,configurable:!0,enumerable:!1,writable:!0})}clone($){let w=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)w.schema=$;if(w.items=w.items.map((J)=>k4.isNode(J)||k4.isPair(J)?J.clone($):J),this.range)w.range=this.range.slice();return w}addIn($,w){if(mP($))this.add(w);else{let[J,...V]=$,U=this.get(J,!0);if(k4.isCollection(U))U.addIn(V,w);else if(U===void 0&&this.schema)this.set(J,ug(this.schema,V,w));else throw Error(`Expected YAML collection at ${J}. Remaining path: ${V}`)}}deleteIn($){let[w,...J]=$;if(J.length===0)return this.delete(w);let V=this.get(w,!0);if(k4.isCollection(V))return V.deleteIn(J);else throw Error(`Expected YAML collection at ${w}. Remaining path: ${J}`)}getIn($,w){let[J,...V]=$,U=this.get(J,!0);if(V.length===0)return!w&&k4.isScalar(U)?U.value:U;else return k4.isCollection(U)?U.getIn(V,w):void 0}hasAllNullValues($){return this.items.every((w)=>{if(!k4.isPair(w))return!1;let J=w.value;return J==null||$&&k4.isScalar(J)&&J.value==null&&!J.commentBefore&&!J.comment&&!J.tag})}hasIn($){let[w,...J]=$;if(J.length===0)return this.has(w);let V=this.get(w,!0);return k4.isCollection(V)?V.hasIn(J):!1}setIn($,w){let[J,...V]=$;if(V.length===0)this.set(J,w);else{let U=this.get(J,!0);if(k4.isCollection(U))U.setIn(V,w);else if(U===void 0&&this.schema)this.set(J,ug(this.schema,V,w));else throw Error(`Expected YAML collection at ${J}. Remaining path: ${V}`)}}}ik.Collection=yP;ik.collectionFromPath=ug;ik.isEmptyPath=mP});var f0=Z((Yk)=>{var Ik=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function Bg($,w){if(/^\n+$/.test($))return $.substring(1);return w?$.replace(/^(?! *$)/gm,w):$}var gk=($,w,J)=>$.endsWith(`
|
|
34
|
+
`)?Bg(J,w):J.includes(`
|
|
31
35
|
`)?`
|
|
32
|
-
`+
|
|
33
|
-
`){if(
|
|
34
|
-
`&&
|
|
35
|
-
`&&
|
|
36
|
-
${w}${$.slice(0,
|
|
37
|
-
${w}${$.slice(
|
|
38
|
-
`);
|
|
39
|
-
`){if(z
|
|
36
|
+
`+Bg(J,w):($.endsWith(" ")?"":" ")+J;Yk.indentComment=Bg;Yk.lineComment=gk;Yk.stringifyComment=Ik});var cP=Z((Kk)=>{function Pk($,w,J="flow",{indentAtStart:V,lineWidth:U=80,minContentWidth:G=20,onFold:z,onOverflow:i}={}){if(!U||U<0)return $;if(U<G)G=0;let N=Math.max(1+G,1+U-w.length);if($.length<=N)return $;let X=[],W={},I=U-w.length;if(typeof V==="number")if(V>U-Math.max(2,G))X.push(0);else I=U-V;let g=void 0,Y=void 0,v=!1,O=-1,P=-1,F=-1;if(J==="block"){if(O=hP($,O,w.length),O!==-1)I=O+N}for(let T;T=$[O+=1];){if(J==="quoted"&&T==="\\"){switch(P=O,$[O+1]){case"x":O+=3;break;case"u":O+=5;break;case"U":O+=9;break;default:O+=1}F=O}if(T===`
|
|
37
|
+
`){if(J==="block")O=hP($,O,w.length);I=O+w.length+N,g=void 0}else{if(T===" "&&Y&&Y!==" "&&Y!==`
|
|
38
|
+
`&&Y!=="\t"){let L=$[O+1];if(L&&L!==" "&&L!==`
|
|
39
|
+
`&&L!=="\t")g=O}if(O>=I)if(g)X.push(g),I=g+N,g=void 0;else if(J==="quoted"){while(Y===" "||Y==="\t")Y=T,T=$[O+=1],v=!0;let L=O>F+1?O-2:P-1;if(W[L])return $;X.push(L),W[L]=!0,I=L+N,g=void 0}else v=!0}Y=T}if(v&&i)i();if(X.length===0)return $;if(z)z();let q=$.slice(0,X[0]);for(let T=0;T<X.length;++T){let L=X[T],k=X[T+1]||$.length;if(L===0)q=`
|
|
40
|
+
${w}${$.slice(0,k)}`;else{if(J==="quoted"&&W[L])q+=`${$[L]}\\`;q+=`
|
|
41
|
+
${w}${$.slice(L+1,k)}`}}return q}function hP($,w,J){let V=w,U=w+1,G=$[U];while(G===" "||G==="\t")if(w<U+J)G=$[++w];else{do G=$[++w];while(G&&G!==`
|
|
42
|
+
`);V=w,U=w+1,G=$[U]}return V}Kk.FOLD_BLOCK="block";Kk.FOLD_FLOW="flow";Kk.FOLD_QUOTED="quoted";Kk.foldFlowLines=Pk});var A0=Z((Dk)=>{var O4=I$(),f6=cP(),Cz=($,w)=>({indentAtStart:w?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),jz=($)=>/^(%|---|\.\.\.)/m.test($);function qk($,w,J){if(!w||w<0)return!1;let V=w-J,U=$.length;if(U<=V)return!1;for(let G=0,z=0;G<U;++G)if($[G]===`
|
|
43
|
+
`){if(G-z>V)return!0;if(z=G+1,U-z<=V)return!1}return!0}function M0($,w){let J=JSON.stringify($);if(w.options.doubleQuotedAsJSON)return J;let{implicitKey:V}=w,U=w.options.doubleQuotedMinMultiLineLength,G=w.indent||(jz($)?" ":""),z="",i=0;for(let N=0,X=J[N];X;X=J[++N]){if(X===" "&&J[N+1]==="\\"&&J[N+2]==="n")z+=J.slice(i,N)+"\\ ",N+=1,i=N,X="\\";if(X==="\\")switch(J[N+1]){case"u":{z+=J.slice(i,N);let W=J.substr(N+2,4);switch(W){case"0000":z+="\\0";break;case"0007":z+="\\a";break;case"000b":z+="\\v";break;case"001b":z+="\\e";break;case"0085":z+="\\N";break;case"00a0":z+="\\_";break;case"2028":z+="\\L";break;case"2029":z+="\\P";break;default:if(W.substr(0,2)==="00")z+="\\x"+W.substr(2);else z+=J.substr(N,6)}N+=5,i=N+1}break;case"n":if(V||J[N+2]==='"'||J.length<U)N+=1;else{z+=J.slice(i,N)+`
|
|
40
44
|
|
|
41
|
-
`;while(
|
|
42
|
-
`,
|
|
43
|
-
`)||/[ \t]\n|\n[ \t]/.test($))return
|
|
44
|
-
${
|
|
45
|
+
`;while(J[N+2]==="\\"&&J[N+3]==="n"&&J[N+4]!=='"')z+=`
|
|
46
|
+
`,N+=2;if(z+=G,J[N+2]===" ")z+="\\";N+=1,i=N+1}break;default:N+=1}}return z=i?z+J.slice(i):J,V?z:f6.foldFlowLines(z,G,f6.FOLD_QUOTED,Cz(w,!1))}function Hg($,w){if(w.options.singleQuote===!1||w.implicitKey&&$.includes(`
|
|
47
|
+
`)||/[ \t]\n|\n[ \t]/.test($))return M0($,w);let J=w.indent||(jz($)?" ":""),V="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
48
|
+
${J}`)+"'";return w.implicitKey?V:f6.foldFlowLines(V,J,f6.FOLD_FLOW,Cz(w,!1))}function cJ($,w){let{singleQuote:J}=w.options,V;if(J===!1)V=M0;else{let U=$.includes('"'),G=$.includes("'");if(U&&!G)V=Hg;else if(G&&!U)V=M0;else V=J?Hg:M0}return V($,w)}var Fg;try{Fg=new RegExp(`(^|(?<!
|
|
45
49
|
))
|
|
46
50
|
+(?!
|
|
47
|
-
|$)`,"g")}catch{
|
|
51
|
+
|$)`,"g")}catch{Fg=/\n+(?!\n|$)/g}function Ez({comment:$,type:w,value:J},V,U,G){let{blockQuote:z,commentString:i,lineWidth:N}=V.options;if(!z||/\n[\t ]+$/.test(J))return cJ(J,V);let X=V.indent||(V.forceBlockIndent||jz(J)?" ":""),W=z==="literal"?!0:z==="folded"||w===O4.Scalar.BLOCK_FOLDED?!1:w===O4.Scalar.BLOCK_LITERAL?!0:!qk(J,N,X.length);if(!J)return W?`|
|
|
48
52
|
`:`>
|
|
49
|
-
`;let I,
|
|
50
|
-
`&&
|
|
51
|
-
`);if(
|
|
52
|
-
`)
|
|
53
|
-
`)
|
|
54
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${
|
|
55
|
-
${
|
|
56
|
-
${
|
|
57
|
-
`)||
|
|
58
|
-
`)?
|
|
59
|
-
`))return
|
|
60
|
-
${
|
|
61
|
-
${w.indent}${
|
|
62
|
-
${
|
|
63
|
-
`:"",
|
|
64
|
-
${
|
|
65
|
-
`&&b
|
|
53
|
+
`;let I,g;for(g=J.length;g>0;--g){let k=J[g-1];if(k!==`
|
|
54
|
+
`&&k!=="\t"&&k!==" ")break}let Y=J.substring(g),v=Y.indexOf(`
|
|
55
|
+
`);if(v===-1)I="-";else if(J===Y||v!==Y.length-1){if(I="+",G)G()}else I="";if(Y){if(J=J.slice(0,-Y.length),Y[Y.length-1]===`
|
|
56
|
+
`)Y=Y.slice(0,-1);Y=Y.replace(Fg,`$&${X}`)}let O=!1,P,F=-1;for(P=0;P<J.length;++P){let k=J[P];if(k===" ")O=!0;else if(k===`
|
|
57
|
+
`)F=P;else break}let q=J.substring(0,F<P?F+1:P);if(q)J=J.substring(q.length),q=q.replace(/\n+/g,`$&${X}`);let L=(O?X?"2":"1":"")+I;if($){if(L+=" "+i($.replace(/ ?[\r\n]+/g," ")),U)U()}if(!W){let k=J.replace(/\n+/g,`
|
|
58
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${X}`),b=!1,C=Cz(V,!0);if(z!=="folded"&&w!==O4.Scalar.BLOCK_FOLDED)C.onOverflow=()=>{b=!0};let _=f6.foldFlowLines(`${q}${k}${Y}`,X,f6.FOLD_BLOCK,C);if(!b)return`>${L}
|
|
59
|
+
${X}${_}`}return J=J.replace(/\n+/g,`$&${X}`),`|${L}
|
|
60
|
+
${X}${q}${J}${Y}`}function Zk($,w,J,V){let{type:U,value:G}=$,{actualString:z,implicitKey:i,indent:N,indentStep:X,inFlow:W}=w;if(i&&G.includes(`
|
|
61
|
+
`)||W&&/[[\]{},]/.test(G))return cJ(G,w);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(G))return i||W||!G.includes(`
|
|
62
|
+
`)?cJ(G,w):Ez($,w,J,V);if(!i&&!W&&U!==O4.Scalar.PLAIN&&G.includes(`
|
|
63
|
+
`))return Ez($,w,J,V);if(jz(G)){if(N==="")return w.forceBlockIndent=!0,Ez($,w,J,V);else if(i&&N===X)return cJ(G,w)}let I=G.replace(/\n+/g,`$&
|
|
64
|
+
${N}`);if(z){let g=(O)=>O.default&&O.tag!=="tag:yaml.org,2002:str"&&O.test?.test(I),{compat:Y,tags:v}=w.doc.schema;if(v.some(g)||Y?.some(g))return cJ(G,w)}return i?I:f6.foldFlowLines(I,N,f6.FOLD_FLOW,Cz(w,!1))}function Tk($,w,J,V){let{implicitKey:U,inFlow:G}=w,z=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:i}=$;if(i!==O4.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(z.value))i=O4.Scalar.QUOTE_DOUBLE}let N=(W)=>{switch(W){case O4.Scalar.BLOCK_FOLDED:case O4.Scalar.BLOCK_LITERAL:return U||G?cJ(z.value,w):Ez(z,w,J,V);case O4.Scalar.QUOTE_DOUBLE:return M0(z.value,w);case O4.Scalar.QUOTE_SINGLE:return Hg(z.value,w);case O4.Scalar.PLAIN:return Zk(z,w,J,V);default:return null}},X=N(i);if(X===null){let{defaultKeyType:W,defaultStringType:I}=w.options,g=U&&W||I;if(X=N(g),X===null)throw Error(`Unsupported default string type ${g}`)}return X}Dk.stringifyString=Tk});var S0=Z((bk)=>{var fk=_z(),M6=p(),Mk=f0(),Ak=A0();function Sk($,w){let J=Object.assign({blockQuote:!0,commentString:Mk.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},$.schema.toStringOptions,w),V;switch(J.collectionStyle){case"block":V=!1;break;case"flow":V=!0;break;default:V=null}return{anchors:new Set,doc:$,flowCollectionPadding:J.flowCollectionPadding?" ":"",indent:"",indentStep:typeof J.indent==="number"?" ".repeat(J.indent):" ",inFlow:V,options:J}}function _k($,w){if(w.tag){let U=$.filter((G)=>G.tag===w.tag);if(U.length>0)return U.find((G)=>G.format===w.format)??U[0]}let J=void 0,V;if(M6.isScalar(w)){V=w.value;let U=$.filter((G)=>G.identify?.(V));if(U.length>1){let G=U.filter((z)=>z.test);if(G.length>0)U=G}J=U.find((G)=>G.format===w.format)??U.find((G)=>!G.format)}else V=w,J=$.find((U)=>U.nodeClass&&V instanceof U.nodeClass);if(!J){let U=V?.constructor?.name??(V===null?"null":typeof V);throw Error(`Tag not resolved for ${U} value`)}return J}function kk($,w,{anchors:J,doc:V}){if(!V.directives)return"";let U=[],G=(M6.isScalar($)||M6.isCollection($))&&$.anchor;if(G&&fk.anchorIsValid(G))J.add(G),U.push(`&${G}`);let z=$.tag??(w.default?null:w.tag);if(z)U.push(V.directives.tagString(z));return U.join(" ")}function Rk($,w,J,V){if(M6.isPair($))return $.toString(w,J,V);if(M6.isAlias($)){if(w.doc.directives)return $.toString(w);if(w.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(w.resolvedAliases)w.resolvedAliases.add($);else w.resolvedAliases=new Set([$]);$=$.resolve(w.doc)}}let U=void 0,G=M6.isNode($)?$:w.doc.createNode($,{onTagObj:(N)=>U=N});U??(U=_k(w.doc.schema.tags,G));let z=kk(G,U,w);if(z.length>0)w.indentAtStart=(w.indentAtStart??0)+z.length+1;let i=typeof U.stringify==="function"?U.stringify(G,w,J,V):M6.isScalar(G)?Ak.stringifyString(G,w,J,V):G.toString(w,J,V);if(!z)return i;return M6.isScalar(G)||i[0]==="{"||i[0]==="["?`${z} ${i}`:`${z}
|
|
65
|
+
${w.indent}${i}`}bk.createStringifyContext=Sk;bk.stringify=Rk});var oP=Z((xk)=>{var e4=p(),lP=I$(),tP=S0(),_0=f0();function jk({key:$,value:w},J,V,U){let{allNullValues:G,doc:z,indent:i,indentStep:N,options:{commentString:X,indentSeq:W,simpleKeys:I}}=J,g=e4.isNode($)&&$.comment||null;if(I){if(g)throw Error("With simple keys, key nodes cannot have comments");if(e4.isCollection($)||!e4.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let Y=!I&&(!$||g&&w==null&&!J.inFlow||e4.isCollection($)||(e4.isScalar($)?$.type===lP.Scalar.BLOCK_FOLDED||$.type===lP.Scalar.BLOCK_LITERAL:typeof $==="object"));J=Object.assign({},J,{allNullValues:!1,implicitKey:!Y&&(I||!G),indent:i+N});let v=!1,O=!1,P=tP.stringify($,J,()=>v=!0,()=>O=!0);if(!Y&&!J.inFlow&&P.length>1024){if(I)throw Error("With simple keys, single line scalar must not span more than 1024 characters");Y=!0}if(J.inFlow){if(G||w==null){if(v&&V)V();return P===""?"?":Y?`? ${P}`:P}}else if(G&&!I||w==null&&Y){if(P=`? ${P}`,g&&!v)P+=_0.lineComment(P,J.indent,X(g));else if(O&&U)U();return P}if(v)g=null;if(Y){if(g)P+=_0.lineComment(P,J.indent,X(g));P=`? ${P}
|
|
66
|
+
${i}:`}else if(P=`${P}:`,g)P+=_0.lineComment(P,J.indent,X(g));let F,q,T;if(e4.isNode(w))F=!!w.spaceBefore,q=w.commentBefore,T=w.comment;else if(F=!1,q=null,T=null,w&&typeof w==="object")w=z.createNode(w);if(J.implicitKey=!1,!Y&&!g&&e4.isScalar(w))J.indentAtStart=P.length+1;if(O=!1,!W&&N.length>=2&&!J.inFlow&&!Y&&e4.isSeq(w)&&!w.flow&&!w.tag&&!w.anchor)J.indent=J.indent.substring(2);let L=!1,k=tP.stringify(w,J,()=>L=!0,()=>O=!0),b=" ";if(g||F||q){if(b=F?`
|
|
67
|
+
`:"",q){let C=X(q);b+=`
|
|
68
|
+
${_0.indentComment(C,J.indent)}`}if(k===""&&!J.inFlow){if(b===`
|
|
69
|
+
`&&T)b=`
|
|
66
70
|
|
|
67
|
-
`}else
|
|
68
|
-
${
|
|
69
|
-
`),
|
|
70
|
-
${
|
|
71
|
-
`)
|
|
72
|
-
${
|
|
73
|
-
`}}if($){if(
|
|
74
|
-
`+
|
|
75
|
-
`)),
|
|
76
|
-
${
|
|
77
|
-
`;return`${
|
|
78
|
-
${
|
|
79
|
-
`:" ")}return
|
|
80
|
-
${
|
|
81
|
-
${z.comment}`:v.comment}v=J}$.items[U]=rz.isPair(v)?v:new bN.Pair(v)}else w("Expected a sequence for this tag");return $}function AQ($,w,U){let{replacer:v}=U,J=new UT.YAMLSeq($);J.tag="tag:yaml.org,2002:pairs";let z=0;if(w&&Symbol.iterator in Object(w))for(let g of w){if(typeof v==="function")g=v.call(w,String(z++),g);let V,_;if(Array.isArray(g))if(g.length===2)V=g[0],_=g[1];else throw TypeError(`Expected [key, value] tuple: ${g}`);else if(g&&g instanceof Object){let G=Object.keys(g);if(G.length===1)V=G[0],_=g[V];else throw TypeError(`Expected tuple with one key, not ${G.length} keys`)}else V=g;J.items.push(bN.createPair(V,_,U))}return J}var JT={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:SQ,createNode:AQ};vT.createPairs=AQ;vT.pairs=JT;vT.resolvePairs=SQ});var MN=E((XT)=>{var RQ=t(),FN=p4(),xJ=w6(),GT=U6(),kQ=yz();class r6 extends GT.YAMLSeq{constructor(){super();this.add=xJ.YAMLMap.prototype.add.bind(this),this.delete=xJ.YAMLMap.prototype.delete.bind(this),this.get=xJ.YAMLMap.prototype.get.bind(this),this.has=xJ.YAMLMap.prototype.has.bind(this),this.set=xJ.YAMLMap.prototype.set.bind(this),this.tag=r6.tag}toJSON($,w){if(!w)return super.toJSON($);let U=new Map;if(w?.onCreate)w.onCreate(U);for(let v of this.items){let J,z;if(RQ.isPair(v))J=FN.toJS(v.key,"",w),z=FN.toJS(v.value,J,w);else J=FN.toJS(v,"",w);if(U.has(J))throw Error("Ordered maps must not include duplicate keys");U.set(J,z)}return U}static from($,w,U){let v=kQ.createPairs($,w,U),J=new this;return J.items=v.items,J}}r6.tag="tag:yaml.org,2002:omap";var _T={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:r6,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,w){let U=kQ.resolvePairs($,w),v=[];for(let{key:J}of U.items)if(RQ.isScalar(J))if(v.includes(J.value))w(`Ordered maps must not include duplicate keys: ${J.value}`);else v.push(J.value);return Object.assign(new r6,U)},createNode:($,w,U)=>r6.from($,w,U)};XT.YAMLOMap=r6;XT.omap=_T});var yQ=E((WT)=>{var CQ=G$();function jQ({value:$,source:w},U){if(w&&($?xQ:rQ).test.test(w))return w;return $?U.options.trueStr:U.options.falseStr}var xQ={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new CQ.Scalar(!0),stringify:jQ},rQ={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new CQ.Scalar(!1),stringify:jQ};WT.falseTag=rQ;WT.trueTag=xQ});var dQ=E((LT)=>{var PT=G$(),iN=XU(),OT={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:iN.stringifyNumber},BT={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let w=Number($.value);return isFinite(w)?w.toExponential():iN.stringifyNumber($)}},qT={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let w=new PT.Scalar(parseFloat($.replace(/_/g,""))),U=$.indexOf(".");if(U!==-1){let v=$.substring(U+1).replace(/_/g,"");if(v[v.length-1]==="0")w.minFractionDigits=v.length}return w},stringify:iN.stringifyNumber};LT.float=qT;LT.floatExp=BT;LT.floatNaN=OT});var nQ=E((bT)=>{var mQ=XU(),rJ=($)=>typeof $==="bigint"||Number.isInteger($);function dz($,w,U,{intAsBigInt:v}){let J=$[0];if(J==="-"||J==="+")w+=1;if($=$.substring(w).replace(/_/g,""),v){switch(U){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let g=BigInt($);return J==="-"?BigInt(-1)*g:g}let z=parseInt($,U);return J==="-"?-1*z:z}function EN($,w,U){let{value:v}=$;if(rJ(v)){let J=v.toString(w);return v<0?"-"+U+J.substr(1):U+J}return mQ.stringifyNumber($)}var DT={identify:rJ,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,w,U)=>dz($,2,2,U),stringify:($)=>EN($,2,"0b")},fT={identify:rJ,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,w,U)=>dz($,1,8,U),stringify:($)=>EN($,8,"0")},TT={identify:rJ,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,w,U)=>dz($,0,10,U),stringify:mQ.stringifyNumber},ZT={identify:rJ,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,w,U)=>dz($,2,16,U),stringify:($)=>EN($,16,"0x")};bT.int=TT;bT.intBin=DT;bT.intHex=ZT;bT.intOct=fT});var SN=E((AT)=>{var hz=t(),mz=s4(),nz=w6();class y6 extends nz.YAMLMap{constructor($){super($);this.tag=y6.tag}add($){let w;if(hz.isPair($))w=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)w=new mz.Pair($.key,null);else w=new mz.Pair($,null);if(!nz.findPair(this.items,w.key))this.items.push(w)}get($,w){let U=nz.findPair(this.items,$);return!w&&hz.isPair(U)?hz.isScalar(U.key)?U.key.value:U.key:U}set($,w){if(typeof w!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof w}`);let U=nz.findPair(this.items,$);if(U&&!w)this.items.splice(this.items.indexOf(U),1);else if(!U&&w)this.items.push(new mz.Pair($))}toJSON($,w){return super.toJSON($,w,Set)}toString($,w,U){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),w,U);else throw Error("Set items must all have null values")}static from($,w,U){let{replacer:v}=U,J=new this($);if(w&&Symbol.iterator in Object(w))for(let z of w){if(typeof v==="function")z=v.call(w,z,z);J.items.push(mz.createPair(z,null,U))}return J}}y6.tag="tag:yaml.org,2002:set";var ST={collection:"map",identify:($)=>$ instanceof Set,nodeClass:y6,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,w,U)=>y6.from($,w,U),resolve($,w){if(hz.isMap($))if($.hasAllNullValues(!0))return Object.assign(new y6,$);else w("Set items must all have null values");else w("Expected a mapping for this tag");return $}};AT.YAMLSet=y6;AT.set=ST});var RN=E((rT)=>{var CT=XU();function AN($,w){let U=$[0],v=U==="-"||U==="+"?$.substring(1):$,J=(g)=>w?BigInt(g):Number(g),z=v.replace(/_/g,"").split(":").reduce((g,V)=>g*J(60)+J(V),J(0));return U==="-"?J(-1)*z:z}function hQ($){let{value:w}=$,U=(g)=>g;if(typeof w==="bigint")U=(g)=>BigInt(g);else if(isNaN(w)||!isFinite(w))return CT.stringifyNumber($);let v="";if(w<0)v="-",w*=U(-1);let J=U(60),z=[w%J];if(w<60)z.unshift(0);else if(w=(w-z[0])/J,z.unshift(w%J),w>=60)w=(w-z[0])/J,z.unshift(w);return v+z.map((g)=>String(g).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var jT={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,w,{intAsBigInt:U})=>AN($,U),stringify:hQ},xT={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>AN($,!1),stringify:hQ},cQ={identify:($)=>$ instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve($){let w=$.match(cQ.test);if(!w)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,U,v,J,z,g,V]=w.map(Number),_=w[7]?Number((w[7]+"00").substr(1,3)):0,G=Date.UTC(U,v-1,J,z||0,g||0,V||0,_),X=w[8];if(X&&X!=="Z"){let I=AN(X,!1);if(Math.abs(I)<30)I*=60;G-=60000*I}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};rT.floatTime=xT;rT.intTime=jT;rT.timestamp=cQ});var tQ=E(($Z)=>{var nT=GU(),hT=Cz(),cT=_U(),lT=CJ(),tT=ZN(),lQ=yQ(),kN=dQ(),cz=nQ(),oT=Fz(),pT=MN(),aT=yz(),eT=SN(),CN=RN(),sT=[nT.map,cT.seq,lT.string,hT.nullTag,lQ.trueTag,lQ.falseTag,cz.intBin,cz.intOct,cz.int,cz.intHex,kN.floatNaN,kN.floatExp,kN.float,tT.binary,oT.merge,pT.omap,aT.pairs,eT.set,CN.intTime,CN.floatTime,CN.timestamp];$Z.schema=sT});var v5=E((_Z)=>{var eQ=GU(),UZ=Cz(),sQ=_U(),JZ=CJ(),vZ=qN(),jN=HN(),xN=KN(),zZ=MQ(),gZ=EQ(),$5=ZN(),yJ=Fz(),w5=MN(),U5=yz(),oQ=tQ(),J5=SN(),lz=RN(),pQ=new Map([["core",zZ.schema],["failsafe",[eQ.map,sQ.seq,JZ.string]],["json",gZ.schema],["yaml11",oQ.schema],["yaml-1.1",oQ.schema]]),aQ={binary:$5.binary,bool:vZ.boolTag,float:jN.float,floatExp:jN.floatExp,floatNaN:jN.floatNaN,floatTime:lz.floatTime,int:xN.int,intHex:xN.intHex,intOct:xN.intOct,intTime:lz.intTime,map:eQ.map,merge:yJ.merge,null:UZ.nullTag,omap:w5.omap,pairs:U5.pairs,seq:sQ.seq,set:J5.set,timestamp:lz.timestamp},VZ={"tag:yaml.org,2002:binary":$5.binary,"tag:yaml.org,2002:merge":yJ.merge,"tag:yaml.org,2002:omap":w5.omap,"tag:yaml.org,2002:pairs":U5.pairs,"tag:yaml.org,2002:set":J5.set,"tag:yaml.org,2002:timestamp":lz.timestamp};function GZ($,w,U){let v=pQ.get(w);if(v&&!$)return U&&!v.includes(yJ.merge)?v.concat(yJ.merge):v.slice();let J=v;if(!J)if(Array.isArray($))J=[];else{let z=Array.from(pQ.keys()).filter((g)=>g!=="yaml11").map((g)=>JSON.stringify(g)).join(", ");throw Error(`Unknown schema "${w}"; use one of ${z} or define customTags array`)}if(Array.isArray($))for(let z of $)J=J.concat(z);else if(typeof $==="function")J=$(J.slice());if(U)J=J.concat(yJ.merge);return J.reduce((z,g)=>{let V=typeof g==="string"?aQ[g]:g;if(!V){let _=JSON.stringify(g),G=Object.keys(aQ).map((X)=>JSON.stringify(X)).join(", ");throw Error(`Unknown custom tag ${_}; use one of ${G}`)}if(!z.includes(V))z.push(V);return z},[])}_Z.coreKnownTags=VZ;_Z.getTags=GZ});var dN=E((PZ)=>{var rN=t(),NZ=GU(),WZ=_U(),YZ=CJ(),tz=v5(),QZ=($,w)=>$.key<w.key?-1:$.key>w.key?1:0;class yN{constructor({compat:$,customTags:w,merge:U,resolveKnownTags:v,schema:J,sortMapEntries:z,toStringDefaults:g}){this.compat=Array.isArray($)?tz.getTags($,"compat"):$?tz.getTags(null,$):null,this.name=typeof J==="string"&&J||"core",this.knownTags=v?tz.coreKnownTags:{},this.tags=tz.getTags(w,this.name,U),this.toStringOptions=g??null,Object.defineProperty(this,rN.MAP,{value:NZ.map}),Object.defineProperty(this,rN.SCALAR,{value:YZ.string}),Object.defineProperty(this,rN.SEQ,{value:WZ.seq}),this.sortMapEntries=typeof z==="function"?z:z===!0?QZ:null}clone(){let $=Object.create(yN.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}PZ.Schema=yN});var z5=E((LZ)=>{var BZ=t(),mN=AJ(),dJ=iJ();function qZ($,w){let U=[],v=w.directives===!0;if(w.directives!==!1&&$.directives){let _=$.directives.toString($);if(_)U.push(_),v=!0;else if($.directives.docStart)v=!0}if(v)U.push("---");let J=mN.createStringifyContext($,w),{commentString:z}=J.options;if($.commentBefore){if(U.length!==1)U.unshift("");let _=z($.commentBefore);U.unshift(dJ.indentComment(_,""))}let g=!1,V=null;if($.contents){if(BZ.isNode($.contents)){if($.contents.spaceBefore&&v)U.push("");if($.contents.commentBefore){let X=z($.contents.commentBefore);U.push(dJ.indentComment(X,""))}J.forceBlockIndent=!!$.comment,V=$.contents.comment}let _=V?void 0:()=>g=!0,G=mN.stringify($.contents,J,()=>V=null,_);if(V)G+=dJ.lineComment(G,"",z(V));if((G[0]==="|"||G[0]===">")&&U[U.length-1]==="---")U[U.length-1]=`--- ${G}`;else U.push(G)}else U.push(mN.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let _=z($.comment);if(_.includes(`
|
|
82
|
-
`))
|
|
71
|
+
`}else b+=`
|
|
72
|
+
${J.indent}`}else if(!Y&&e4.isCollection(w)){let C=k[0],_=k.indexOf(`
|
|
73
|
+
`),t=_!==-1,y=J.inFlow??w.flow??w.items.length===0;if(t||!y){let W$=!1;if(t&&(C==="&"||C==="!")){let U$=k.indexOf(" ");if(C==="&"&&U$!==-1&&U$<_&&k[U$+1]==="!")U$=k.indexOf(" ",U$+1);if(U$===-1||_<U$)W$=!0}if(!W$)b=`
|
|
74
|
+
${J.indent}`}}else if(k===""||k[0]===`
|
|
75
|
+
`)b="";if(P+=b+k,J.inFlow){if(L&&V)V()}else if(T&&!L)P+=_0.lineComment(P,J.indent,X(T));else if(O&&U)U();return P}xk.stringifyPair=jk});var qg=Z((mk)=>{var pP=b4("process");function nk($,...w){if($==="debug")console.log(...w)}function dk($,w){if($==="debug"||$==="warn")if(typeof pP.emitWarning==="function")pP.emitWarning(w);else console.warn(w)}mk.debug=nk;mk.warn=dk});var dz=Z((lk)=>{var nz=p(),aP=I$(),xz="<<",rz={identify:($)=>$===xz||typeof $==="symbol"&&$.description===xz,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new aP.Scalar(Symbol(xz)),{addToJSMap:eP}),stringify:()=>xz},ck=($,w)=>(rz.identify(w)||nz.isScalar(w)&&(!w.type||w.type===aP.Scalar.PLAIN)&&rz.identify(w.value))&&$?.doc.schema.tags.some((J)=>J.tag===rz.tag&&J.default);function eP($,w,J){let V=sP($,J);if(nz.isSeq(V))for(let U of V.items)Zg($,w,U);else if(Array.isArray(V))for(let U of V)Zg($,w,U);else Zg($,w,V)}function Zg($,w,J){let V=sP($,J);if(!nz.isMap(V))throw Error("Merge sources must be maps or map aliases");let U=V.toJSON(null,$,Map);for(let[G,z]of U)if(w instanceof Map){if(!w.has(G))w.set(G,z)}else if(w instanceof Set)w.add(G);else if(!Object.prototype.hasOwnProperty.call(w,G))Object.defineProperty(w,G,{value:z,writable:!0,enumerable:!0,configurable:!0});return w}function sP($,w){return $&&nz.isAlias(w)?w.resolve($.doc,$):w}lk.addMergeToJSMap=eP;lk.isMergeKey=ck;lk.merge=rz});var Dg=Z((wR)=>{var ak=qg(),$K=dz(),ek=S0(),wK=p(),Tg=L6();function sk($,w,{key:J,value:V}){if(wK.isNode(J)&&J.addToJSMap)J.addToJSMap($,w,V);else if($K.isMergeKey($,J))$K.addMergeToJSMap($,w,V);else{let U=Tg.toJS(J,"",$);if(w instanceof Map)w.set(U,Tg.toJS(V,U,$));else if(w instanceof Set)w.add(U);else{let G=$R(J,U,$),z=Tg.toJS(V,G,$);if(G in w)Object.defineProperty(w,G,{value:z,writable:!0,enumerable:!0,configurable:!0});else w[G]=z}}return w}function $R($,w,J){if(w===null)return"";if(typeof w!=="object")return String(w);if(wK.isNode($)&&J?.doc){let V=ek.createStringifyContext(J.doc,{});V.anchors=new Set;for(let G of J.anchors.keys())V.anchors.add(G.anchor);V.inFlow=!0,V.inStringifyKey=!0;let U=$.toString(V);if(!J.mapKeyWarned){let G=JSON.stringify(U);if(G.length>40)G=G.substring(0,36)+'..."';ak.warn(J.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${G}. Set mapAsMap: true to use object keys.`),J.mapKeyWarned=!0}return U}return JSON.stringify(w)}wR.addPairToJSMap=sk});var A6=Z((zR)=>{var JK=L0(),UR=oP(),VR=Dg(),mz=p();function GR($,w,J){let V=JK.createNode($,void 0,J),U=JK.createNode(w,void 0,J);return new yz(V,U)}class yz{constructor($,w=null){Object.defineProperty(this,mz.NODE_TYPE,{value:mz.PAIR}),this.key=$,this.value=w}clone($){let{key:w,value:J}=this;if(mz.isNode(w))w=w.clone($);if(mz.isNode(J))J=J.clone($);return new yz(w,J)}toJSON($,w){let J=w?.mapAsMap?new Map:{};return VR.addPairToJSMap(w,J,this)}toString($,w,J){return $?.doc?UR.stringifyPair(this,$,w,J):JSON.stringify(this)}}zR.Pair=yz;zR.createPair=GR});var Lg=Z((gR)=>{var Bw=p(),UK=S0(),hz=f0();function NR($,w,J){return(w.inFlow??$.flow?IR:WR)($,w,J)}function WR({comment:$,items:w},J,{blockItemPrefix:V,flowChars:U,itemIndent:G,onChompKeep:z,onComment:i}){let{indent:N,options:{commentString:X}}=J,W=Object.assign({},J,{indent:G,type:null}),I=!1,g=[];for(let v=0;v<w.length;++v){let O=w[v],P=null;if(Bw.isNode(O)){if(!I&&O.spaceBefore)g.push("");if(cz(J,g,O.commentBefore,I),O.comment)P=O.comment}else if(Bw.isPair(O)){let q=Bw.isNode(O.key)?O.key:null;if(q){if(!I&&q.spaceBefore)g.push("");cz(J,g,q.commentBefore,I)}}I=!1;let F=UK.stringify(O,W,()=>P=null,()=>I=!0);if(P)F+=hz.lineComment(F,G,X(P));if(I&&P)I=!1;g.push(V+F)}let Y;if(g.length===0)Y=U.start+U.end;else{Y=g[0];for(let v=1;v<g.length;++v){let O=g[v];Y+=O?`
|
|
76
|
+
${N}${O}`:`
|
|
77
|
+
`}}if($){if(Y+=`
|
|
78
|
+
`+hz.indentComment(X($),N),i)i()}else if(I&&z)z();return Y}function IR({items:$},w,{flowChars:J,itemIndent:V}){let{indent:U,indentStep:G,flowCollectionPadding:z,options:{commentString:i}}=w;V+=G;let N=Object.assign({},w,{indent:V,inFlow:!0,type:null}),X=!1,W=0,I=[];for(let v=0;v<$.length;++v){let O=$[v],P=null;if(Bw.isNode(O)){if(O.spaceBefore)I.push("");if(cz(w,I,O.commentBefore,!1),O.comment)P=O.comment}else if(Bw.isPair(O)){let q=Bw.isNode(O.key)?O.key:null;if(q){if(q.spaceBefore)I.push("");if(cz(w,I,q.commentBefore,!1),q.comment)X=!0}let T=Bw.isNode(O.value)?O.value:null;if(T){if(T.comment)P=T.comment;if(T.commentBefore)X=!0}else if(O.value==null&&q?.comment)P=q.comment}if(P)X=!0;let F=UK.stringify(O,N,()=>P=null);if(X||(X=I.length>W||F.includes(`
|
|
79
|
+
`)),v<$.length-1)F+=",";else if(w.options.trailingComma){if(w.options.lineWidth>0)X||(X=I.reduce((q,T)=>q+T.length+2,2)+(F.length+2)>w.options.lineWidth);if(X)F+=","}if(P)F+=hz.lineComment(F,V,i(P));I.push(F),W=I.length}let{start:g,end:Y}=J;if(I.length===0)return g+Y;else{if(!X){let v=I.reduce((O,P)=>O+P.length+2,2);X=w.options.lineWidth>0&&v>w.options.lineWidth}if(X){let v=g;for(let O of I)v+=O?`
|
|
80
|
+
${G}${U}${O}`:`
|
|
81
|
+
`;return`${v}
|
|
82
|
+
${U}${Y}`}else return`${g}${z}${I.join(" ")}${z}${Y}`}}function cz({indent:$,options:{commentString:w}},J,V,U){if(V&&U)V=V.replace(/^\n+/,"");if(V){let G=hz.indentComment(w(V),$);J.push(G.trimStart())}}gR.stringifyCollection=NR});var _6=Z((KR)=>{var vR=Lg(),QR=Dg(),OR=bz(),S6=p(),lz=A6(),PR=I$();function k0($,w){let J=S6.isScalar(w)?w.value:w;for(let V of $)if(S6.isPair(V)){if(V.key===w||V.key===J)return V;if(S6.isScalar(V.key)&&V.key.value===J)return V}return}class VK extends OR.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(S6.MAP,$);this.items=[]}static from($,w,J){let{keepUndefined:V,replacer:U}=J,G=new this($),z=(i,N)=>{if(typeof U==="function")N=U.call(w,i,N);else if(Array.isArray(U)&&!U.includes(i))return;if(N!==void 0||V)G.items.push(lz.createPair(i,N,J))};if(w instanceof Map)for(let[i,N]of w)z(i,N);else if(w&&typeof w==="object")for(let i of Object.keys(w))z(i,w[i]);if(typeof $.sortMapEntries==="function")G.items.sort($.sortMapEntries);return G}add($,w){let J;if(S6.isPair($))J=$;else if(!$||typeof $!=="object"||!("key"in $))J=new lz.Pair($,$?.value);else J=new lz.Pair($.key,$.value);let V=k0(this.items,J.key),U=this.schema?.sortMapEntries;if(V){if(!w)throw Error(`Key ${J.key} already set`);if(S6.isScalar(V.value)&&PR.isScalarValue(J.value))V.value.value=J.value;else V.value=J.value}else if(U){let G=this.items.findIndex((z)=>U(J,z)<0);if(G===-1)this.items.push(J);else this.items.splice(G,0,J)}else this.items.push(J)}delete($){let w=k0(this.items,$);if(!w)return!1;return this.items.splice(this.items.indexOf(w),1).length>0}get($,w){let V=k0(this.items,$)?.value;return(!w&&S6.isScalar(V)?V.value:V)??void 0}has($){return!!k0(this.items,$)}set($,w){this.add(new lz.Pair($,w),!0)}toJSON($,w,J){let V=J?new J:w?.mapAsMap?new Map:{};if(w?.onCreate)w.onCreate(V);for(let U of this.items)QR.addPairToJSMap(w,V,U);return V}toString($,w,J){if(!$)return JSON.stringify(this);for(let V of this.items)if(!S6.isPair(V))throw Error(`Map items must all be pairs; found ${JSON.stringify(V)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return vR.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:J,onComment:w})}}KR.YAMLMap=VK;KR.findPair=k0});var lJ=Z((qR)=>{var HR=p(),GK=_6(),FR={collection:"map",default:!0,nodeClass:GK.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,w){if(!HR.isMap($))w("Expected a mapping for this tag");return $},createNode:($,w,J)=>GK.YAMLMap.from($,w,J)};qR.map=FR});var k6=Z((AR)=>{var TR=L0(),DR=Lg(),LR=bz(),oz=p(),fR=I$(),MR=L6();class zK extends LR.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(oz.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let w=tz($);if(typeof w!=="number")return!1;return this.items.splice(w,1).length>0}get($,w){let J=tz($);if(typeof J!=="number")return;let V=this.items[J];return!w&&oz.isScalar(V)?V.value:V}has($){let w=tz($);return typeof w==="number"&&w<this.items.length}set($,w){let J=tz($);if(typeof J!=="number")throw Error(`Expected a valid index, not ${$}.`);let V=this.items[J];if(oz.isScalar(V)&&fR.isScalarValue(w))V.value=w;else this.items[J]=w}toJSON($,w){let J=[];if(w?.onCreate)w.onCreate(J);let V=0;for(let U of this.items)J.push(MR.toJS(U,String(V++),w));return J}toString($,w,J){if(!$)return JSON.stringify(this);return DR.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:J,onComment:w})}static from($,w,J){let{replacer:V}=J,U=new this($);if(w&&Symbol.iterator in Object(w)){let G=0;for(let z of w){if(typeof V==="function"){let i=w instanceof Set?z:String(G++);z=V.call(w,i,z)}U.items.push(TR.createNode(z,void 0,J))}}return U}}function tz($){let w=oz.isScalar($)?$.value:$;if(w&&typeof w==="string")w=Number(w);return typeof w==="number"&&Number.isInteger(w)&&w>=0?w:null}AR.YAMLSeq=zK});var tJ=Z((RR)=>{var _R=p(),iK=k6(),kR={collection:"seq",default:!0,nodeClass:iK.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,w){if(!_R.isSeq($))w("Expected a sequence for this tag");return $},createNode:($,w,J)=>iK.YAMLSeq.from($,w,J)};RR.seq=kR});var R0=Z((jR)=>{var ER=A0(),CR={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,w,J,V){return w=Object.assign({actualString:!0},w),ER.stringifyString($,w,J,V)}};jR.string=CR});var pz=Z((rR)=>{var XK=I$(),NK={identify:($)=>$==null,createNode:()=>new XK.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new XK.Scalar(null),stringify:({source:$},w)=>typeof $==="string"&&NK.test.test($)?$:w.options.nullStr};rR.nullTag=NK});var fg=Z((mR)=>{var dR=I$(),WK={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new dR.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:w},J){if($&&WK.test.test($)){let V=$[0]==="t"||$[0]==="T";if(w===V)return $}return w?J.options.trueStr:J.options.falseStr}};mR.boolTag=WK});var oJ=Z((cR)=>{function hR({format:$,minFractionDigits:w,tag:J,value:V}){if(typeof V==="bigint")return String(V);let U=typeof V==="number"?V:Number(V);if(!isFinite(U))return isNaN(U)?".nan":U<0?"-.inf":".inf";let G=Object.is(V,-0)?"-0":JSON.stringify(V);if(!$&&w&&(!J||J==="tag:yaml.org,2002:float")&&/^-?\d/.test(G)&&!G.includes("e")){let z=G.indexOf(".");if(z<0)z=G.length,G+=".";let i=w-(G.length-z-1);while(i-- >0)G+="0"}return G}cR.stringifyNumber=hR});var Ag=Z((eR)=>{var tR=I$(),Mg=oJ(),oR={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Mg.stringifyNumber},pR={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($),stringify($){let w=Number($.value);return isFinite(w)?w.toExponential():Mg.stringifyNumber($)}},aR={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let w=new tR.Scalar(parseFloat($)),J=$.indexOf(".");if(J!==-1&&$[$.length-1]==="0")w.minFractionDigits=$.length-J-1;return w},stringify:Mg.stringifyNumber};eR.float=aR;eR.floatExp=pR;eR.floatNaN=oR});var _g=Z((Gb)=>{var IK=oJ(),az=($)=>typeof $==="bigint"||Number.isInteger($),Sg=($,w,J,{intAsBigInt:V})=>V?BigInt($):parseInt($.substring(w),J);function gK($,w,J){let{value:V}=$;if(az(V)&&V>=0)return J+V.toString(w);return IK.stringifyNumber($)}var Jb={identify:($)=>az($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,w,J)=>Sg($,2,8,J),stringify:($)=>gK($,8,"0o")},Ub={identify:az,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,w,J)=>Sg($,0,10,J),stringify:IK.stringifyNumber},Vb={identify:($)=>az($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,w,J)=>Sg($,2,16,J),stringify:($)=>gK($,16,"0x")};Gb.int=Ub;Gb.intHex=Vb;Gb.intOct=Jb});var YK=Z((Qb)=>{var Nb=lJ(),Wb=pz(),Ib=tJ(),gb=R0(),Yb=fg(),kg=Ag(),Rg=_g(),vb=[Nb.map,Ib.seq,gb.string,Wb.nullTag,Yb.boolTag,Rg.intOct,Rg.int,Rg.intHex,kg.floatNaN,kg.floatExp,kg.float];Qb.schema=vb});var QK=Z((qb)=>{var Pb=I$(),Kb=lJ(),ub=tJ();function vK($){return typeof $==="bigint"||Number.isInteger($)}var ez=({value:$})=>JSON.stringify($),Bb=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:ez},{identify:($)=>$==null,createNode:()=>new Pb.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:ez},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:ez},{identify:vK,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,w,{intAsBigInt:J})=>J?BigInt($):parseInt($,10),stringify:({value:$})=>vK($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:ez}],Hb={default:!0,tag:"",test:/^/,resolve($,w){return w(`Unresolved plain scalar ${JSON.stringify($)}`),$}},Fb=[Kb.map,ub.seq].concat(Bb,Hb);qb.schema=Fb});var Eg=Z((Lb)=>{var b0=b4("buffer"),bg=I$(),Tb=A0(),Db={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,w){if(typeof b0.Buffer==="function")return b0.Buffer.from($,"base64");else if(typeof atob==="function"){let J=atob($.replace(/[\n\r]/g,"")),V=new Uint8Array(J.length);for(let U=0;U<J.length;++U)V[U]=J.charCodeAt(U);return V}else return w("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:w,value:J},V,U,G){if(!J)return"";let z=J,i;if(typeof b0.Buffer==="function")i=z instanceof b0.Buffer?z.toString("base64"):b0.Buffer.from(z.buffer).toString("base64");else if(typeof btoa==="function"){let N="";for(let X=0;X<z.length;++X)N+=String.fromCharCode(z[X]);i=btoa(N)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(w??(w=bg.Scalar.BLOCK_LITERAL),w!==bg.Scalar.QUOTE_DOUBLE){let N=Math.max(V.options.lineWidth-V.indent.length,V.options.minContentWidth),X=Math.ceil(i.length/N),W=Array(X);for(let I=0,g=0;I<X;++I,g+=N)W[I]=i.substr(g,N);i=W.join(w===bg.Scalar.BLOCK_LITERAL?`
|
|
83
|
+
`:" ")}return Tb.stringifyString({comment:$,type:w,value:i},V,U,G)}};Lb.binary=Db});var $i=Z((_b)=>{var sz=p(),Cg=A6(),Mb=I$(),Ab=k6();function OK($,w){if(sz.isSeq($))for(let J=0;J<$.items.length;++J){let V=$.items[J];if(sz.isPair(V))continue;else if(sz.isMap(V)){if(V.items.length>1)w("Each pair must have its own sequence indicator");let U=V.items[0]||new Cg.Pair(new Mb.Scalar(null));if(V.commentBefore)U.key.commentBefore=U.key.commentBefore?`${V.commentBefore}
|
|
84
|
+
${U.key.commentBefore}`:V.commentBefore;if(V.comment){let G=U.value??U.key;G.comment=G.comment?`${V.comment}
|
|
85
|
+
${G.comment}`:V.comment}V=U}$.items[J]=sz.isPair(V)?V:new Cg.Pair(V)}else w("Expected a sequence for this tag");return $}function PK($,w,J){let{replacer:V}=J,U=new Ab.YAMLSeq($);U.tag="tag:yaml.org,2002:pairs";let G=0;if(w&&Symbol.iterator in Object(w))for(let z of w){if(typeof V==="function")z=V.call(w,String(G++),z);let i,N;if(Array.isArray(z))if(z.length===2)i=z[0],N=z[1];else throw TypeError(`Expected [key, value] tuple: ${z}`);else if(z&&z instanceof Object){let X=Object.keys(z);if(X.length===1)i=X[0],N=z[i];else throw TypeError(`Expected tuple with one key, not ${X.length} keys`)}else i=z;U.items.push(Cg.createPair(i,N,J))}return U}var Sb={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:OK,createNode:PK};_b.createPairs=PK;_b.pairs=Sb;_b.resolvePairs=OK});var xg=Z((jb)=>{var KK=p(),jg=L6(),E0=_6(),Eb=k6(),uK=$i();class Hw extends Eb.YAMLSeq{constructor(){super();this.add=E0.YAMLMap.prototype.add.bind(this),this.delete=E0.YAMLMap.prototype.delete.bind(this),this.get=E0.YAMLMap.prototype.get.bind(this),this.has=E0.YAMLMap.prototype.has.bind(this),this.set=E0.YAMLMap.prototype.set.bind(this),this.tag=Hw.tag}toJSON($,w){if(!w)return super.toJSON($);let J=new Map;if(w?.onCreate)w.onCreate(J);for(let V of this.items){let U,G;if(KK.isPair(V))U=jg.toJS(V.key,"",w),G=jg.toJS(V.value,U,w);else U=jg.toJS(V,"",w);if(J.has(U))throw Error("Ordered maps must not include duplicate keys");J.set(U,G)}return J}static from($,w,J){let V=uK.createPairs($,w,J),U=new this;return U.items=V.items,U}}Hw.tag="tag:yaml.org,2002:omap";var Cb={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:Hw,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,w){let J=uK.resolvePairs($,w),V=[];for(let{key:U}of J.items)if(KK.isScalar(U))if(V.includes(U.value))w(`Ordered maps must not include duplicate keys: ${U.value}`);else V.push(U.value);return Object.assign(new Hw,J)},createNode:($,w,J)=>Hw.from($,w,J)};jb.YAMLOMap=Hw;jb.omap=Cb});var ZK=Z((nb)=>{var BK=I$();function HK({value:$,source:w},J){if(w&&($?FK:qK).test.test(w))return w;return $?J.options.trueStr:J.options.falseStr}var FK={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new BK.Scalar(!0),stringify:HK},qK={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new BK.Scalar(!1),stringify:HK};nb.falseTag=qK;nb.trueTag=FK});var TK=Z((tb)=>{var yb=I$(),rg=oJ(),hb={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:rg.stringifyNumber},cb={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let w=Number($.value);return isFinite(w)?w.toExponential():rg.stringifyNumber($)}},lb={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let w=new yb.Scalar(parseFloat($.replace(/_/g,""))),J=$.indexOf(".");if(J!==-1){let V=$.substring(J+1).replace(/_/g,"");if(V[V.length-1]==="0")w.minFractionDigits=V.length}return w},stringify:rg.stringifyNumber};tb.float=lb;tb.floatExp=cb;tb.floatNaN=hb});var LK=Z((JE)=>{var DK=oJ(),C0=($)=>typeof $==="bigint"||Number.isInteger($);function wi($,w,J,{intAsBigInt:V}){let U=$[0];if(U==="-"||U==="+")w+=1;if($=$.substring(w).replace(/_/g,""),V){switch(J){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let z=BigInt($);return U==="-"?BigInt(-1)*z:z}let G=parseInt($,J);return U==="-"?-1*G:G}function ng($,w,J){let{value:V}=$;if(C0(V)){let U=V.toString(w);return V<0?"-"+J+U.substr(1):J+U}return DK.stringifyNumber($)}var eb={identify:C0,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,w,J)=>wi($,2,2,J),stringify:($)=>ng($,2,"0b")},sb={identify:C0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,w,J)=>wi($,1,8,J),stringify:($)=>ng($,8,"0")},$E={identify:C0,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,w,J)=>wi($,0,10,J),stringify:DK.stringifyNumber},wE={identify:C0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,w,J)=>wi($,2,16,J),stringify:($)=>ng($,16,"0x")};JE.int=$E;JE.intBin=eb;JE.intHex=wE;JE.intOct=sb});var dg=Z((XE)=>{var Vi=p(),Ji=A6(),Ui=_6();class Fw extends Ui.YAMLMap{constructor($){super($);this.tag=Fw.tag}add($){let w;if(Vi.isPair($))w=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)w=new Ji.Pair($.key,null);else w=new Ji.Pair($,null);if(!Ui.findPair(this.items,w.key))this.items.push(w)}get($,w){let J=Ui.findPair(this.items,$);return!w&&Vi.isPair(J)?Vi.isScalar(J.key)?J.key.value:J.key:J}set($,w){if(typeof w!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof w}`);let J=Ui.findPair(this.items,$);if(J&&!w)this.items.splice(this.items.indexOf(J),1);else if(!J&&w)this.items.push(new Ji.Pair($))}toJSON($,w){return super.toJSON($,w,Set)}toString($,w,J){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),w,J);else throw Error("Set items must all have null values")}static from($,w,J){let{replacer:V}=J,U=new this($);if(w&&Symbol.iterator in Object(w))for(let G of w){if(typeof V==="function")G=V.call(w,G,G);U.items.push(Ji.createPair(G,null,J))}return U}}Fw.tag="tag:yaml.org,2002:set";var iE={collection:"map",identify:($)=>$ instanceof Set,nodeClass:Fw,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,w,J)=>Fw.from($,w,J),resolve($,w){if(Vi.isMap($))if($.hasAllNullValues(!0))return Object.assign(new Fw,$);else w("Set items must all have null values");else w("Expected a mapping for this tag");return $}};XE.YAMLSet=Fw;XE.set=iE});var yg=Z((vE)=>{var IE=oJ();function mg($,w){let J=$[0],V=J==="-"||J==="+"?$.substring(1):$,U=(z)=>w?BigInt(z):Number(z),G=V.replace(/_/g,"").split(":").reduce((z,i)=>z*U(60)+U(i),U(0));return J==="-"?U(-1)*G:G}function fK($){let{value:w}=$,J=(z)=>z;if(typeof w==="bigint")J=(z)=>BigInt(z);else if(isNaN(w)||!isFinite(w))return IE.stringifyNumber($);let V="";if(w<0)V="-",w*=J(-1);let U=J(60),G=[w%U];if(w<60)G.unshift(0);else if(w=(w-G[0])/U,G.unshift(w%U),w>=60)w=(w-G[0])/U,G.unshift(w);return V+G.map((z)=>String(z).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var gE={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,w,{intAsBigInt:J})=>mg($,J),stringify:fK},YE={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>mg($,!1),stringify:fK},MK={identify:($)=>$ instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve($){let w=$.match(MK.test);if(!w)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,J,V,U,G,z,i]=w.map(Number),N=w[7]?Number((w[7]+"00").substr(1,3)):0,X=Date.UTC(J,V-1,U,G||0,z||0,i||0,N),W=w[8];if(W&&W!=="Z"){let I=mg(W,!1);if(Math.abs(I)<30)I*=60;X-=60000*I}return new Date(X)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};vE.floatTime=YE;vE.intTime=gE;vE.timestamp=MK});var SK=Z((fE)=>{var KE=lJ(),uE=pz(),BE=tJ(),HE=R0(),FE=Eg(),AK=ZK(),hg=TK(),Gi=LK(),qE=dz(),ZE=xg(),TE=$i(),DE=dg(),cg=yg(),LE=[KE.map,BE.seq,HE.string,uE.nullTag,AK.trueTag,AK.falseTag,Gi.intBin,Gi.intOct,Gi.int,Gi.intHex,hg.floatNaN,hg.floatExp,hg.float,FE.binary,qE.merge,ZE.omap,TE.pairs,DE.set,cg.intTime,cg.floatTime,cg.timestamp];fE.schema=LE});var nK=Z((CE)=>{var bK=lJ(),AE=pz(),EK=tJ(),SE=R0(),_E=fg(),lg=Ag(),tg=_g(),kE=YK(),RE=QK(),CK=Eg(),j0=dz(),jK=xg(),xK=$i(),_K=SK(),rK=dg(),zi=yg(),kK=new Map([["core",kE.schema],["failsafe",[bK.map,EK.seq,SE.string]],["json",RE.schema],["yaml11",_K.schema],["yaml-1.1",_K.schema]]),RK={binary:CK.binary,bool:_E.boolTag,float:lg.float,floatExp:lg.floatExp,floatNaN:lg.floatNaN,floatTime:zi.floatTime,int:tg.int,intHex:tg.intHex,intOct:tg.intOct,intTime:zi.intTime,map:bK.map,merge:j0.merge,null:AE.nullTag,omap:jK.omap,pairs:xK.pairs,seq:EK.seq,set:rK.set,timestamp:zi.timestamp},bE={"tag:yaml.org,2002:binary":CK.binary,"tag:yaml.org,2002:merge":j0.merge,"tag:yaml.org,2002:omap":jK.omap,"tag:yaml.org,2002:pairs":xK.pairs,"tag:yaml.org,2002:set":rK.set,"tag:yaml.org,2002:timestamp":zi.timestamp};function EE($,w,J){let V=kK.get(w);if(V&&!$)return J&&!V.includes(j0.merge)?V.concat(j0.merge):V.slice();let U=V;if(!U)if(Array.isArray($))U=[];else{let G=Array.from(kK.keys()).filter((z)=>z!=="yaml11").map((z)=>JSON.stringify(z)).join(", ");throw Error(`Unknown schema "${w}"; use one of ${G} or define customTags array`)}if(Array.isArray($))for(let G of $)U=U.concat(G);else if(typeof $==="function")U=$(U.slice());if(J)U=U.concat(j0.merge);return U.reduce((G,z)=>{let i=typeof z==="string"?RK[z]:z;if(!i){let N=JSON.stringify(z),X=Object.keys(RK).map((W)=>JSON.stringify(W)).join(", ");throw Error(`Unknown custom tag ${N}; use one of ${X}`)}if(!G.includes(i))G.push(i);return G},[])}CE.coreKnownTags=bE;CE.getTags=EE});var ag=Z((yE)=>{var og=p(),rE=lJ(),nE=tJ(),dE=R0(),ii=nK(),mE=($,w)=>$.key<w.key?-1:$.key>w.key?1:0;class pg{constructor({compat:$,customTags:w,merge:J,resolveKnownTags:V,schema:U,sortMapEntries:G,toStringDefaults:z}){this.compat=Array.isArray($)?ii.getTags($,"compat"):$?ii.getTags(null,$):null,this.name=typeof U==="string"&&U||"core",this.knownTags=V?ii.coreKnownTags:{},this.tags=ii.getTags(w,this.name,J),this.toStringOptions=z??null,Object.defineProperty(this,og.MAP,{value:rE.map}),Object.defineProperty(this,og.SCALAR,{value:dE.string}),Object.defineProperty(this,og.SEQ,{value:nE.seq}),this.sortMapEntries=typeof G==="function"?G:G===!0?mE:null}clone(){let $=Object.create(pg.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}yE.Schema=pg});var dK=Z((tE)=>{var cE=p(),eg=S0(),x0=f0();function lE($,w){let J=[],V=w.directives===!0;if(w.directives!==!1&&$.directives){let N=$.directives.toString($);if(N)J.push(N),V=!0;else if($.directives.docStart)V=!0}if(V)J.push("---");let U=eg.createStringifyContext($,w),{commentString:G}=U.options;if($.commentBefore){if(J.length!==1)J.unshift("");let N=G($.commentBefore);J.unshift(x0.indentComment(N,""))}let z=!1,i=null;if($.contents){if(cE.isNode($.contents)){if($.contents.spaceBefore&&V)J.push("");if($.contents.commentBefore){let W=G($.contents.commentBefore);J.push(x0.indentComment(W,""))}U.forceBlockIndent=!!$.comment,i=$.contents.comment}let N=i?void 0:()=>z=!0,X=eg.stringify($.contents,U,()=>i=null,N);if(i)X+=x0.lineComment(X,"",G(i));if((X[0]==="|"||X[0]===">")&&J[J.length-1]==="---")J[J.length-1]=`--- ${X}`;else J.push(X)}else J.push(eg.stringify($.contents,U));if($.directives?.docEnd)if($.comment){let N=G($.comment);if(N.includes(`
|
|
86
|
+
`))J.push("..."),J.push(x0.indentComment(N,""));else J.push(`... ${N}`)}else J.push("...");else{let N=$.comment;if(N&&z)N=N.replace(/^\n+/,"");if(N){if((!z||i)&&J[J.length-1]!=="")J.push("");J.push(x0.indentComment(G(N),""))}}return J.join(`
|
|
83
87
|
`)+`
|
|
84
|
-
`}
|
|
85
|
-
`;
|
|
88
|
+
`}tE.stringifyDocument=lE});var r0=Z((UC)=>{var pE=D0(),pJ=bz(),i4=p(),aE=A6(),eE=L6(),sE=ag(),$C=dK(),sg=_z(),wC=Kg(),JC=L0(),$Y=Pg();class wY{constructor($,w,J){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,i4.NODE_TYPE,{value:i4.DOC});let V=null;if(typeof w==="function"||Array.isArray(w))V=w;else if(J===void 0&&w)J=w,w=void 0;let U=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},J);this.options=U;let{version:G}=U;if(J?._directives){if(this.directives=J._directives.atDocument(),this.directives.yaml.explicit)G=this.directives.yaml.version}else this.directives=new $Y.Directives({version:G});this.setSchema(G,J),this.contents=$===void 0?null:this.createNode($,V,J)}clone(){let $=Object.create(wY.prototype,{[i4.NODE_TYPE]:{value:i4.DOC}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=i4.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(aJ(this.contents))this.contents.add($)}addIn($,w){if(aJ(this.contents))this.contents.addIn($,w)}createAlias($,w){if(!$.anchor){let J=sg.anchorNames(this);$.anchor=!w||J.has(w)?sg.findNewAnchor(w||"a",J):w}return new pE.Alias($.anchor)}createNode($,w,J){let V=void 0;if(typeof w==="function")$=w.call({"":$},"",$),V=w;else if(Array.isArray(w)){let O=(F)=>typeof F==="number"||F instanceof String||F instanceof Number,P=w.filter(O).map(String);if(P.length>0)w=w.concat(P);V=w}else if(J===void 0&&w)J=w,w=void 0;let{aliasDuplicateObjects:U,anchorPrefix:G,flow:z,keepUndefined:i,onTagObj:N,tag:X}=J??{},{onAnchor:W,setAnchors:I,sourceObjects:g}=sg.createNodeAnchors(this,G||"a"),Y={aliasDuplicateObjects:U??!0,keepUndefined:i??!1,onAnchor:W,onTagObj:N,replacer:V,schema:this.schema,sourceObjects:g},v=JC.createNode($,X,Y);if(z&&i4.isCollection(v))v.flow=!0;return I(),v}createPair($,w,J={}){let V=this.createNode($,null,J),U=this.createNode(w,null,J);return new aE.Pair(V,U)}delete($){return aJ(this.contents)?this.contents.delete($):!1}deleteIn($){if(pJ.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return aJ(this.contents)?this.contents.deleteIn($):!1}get($,w){return i4.isCollection(this.contents)?this.contents.get($,w):void 0}getIn($,w){if(pJ.isEmptyPath($))return!w&&i4.isScalar(this.contents)?this.contents.value:this.contents;return i4.isCollection(this.contents)?this.contents.getIn($,w):void 0}has($){return i4.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(pJ.isEmptyPath($))return this.contents!==void 0;return i4.isCollection(this.contents)?this.contents.hasIn($):!1}set($,w){if(this.contents==null)this.contents=pJ.collectionFromPath(this.schema,[$],w);else if(aJ(this.contents))this.contents.set($,w)}setIn($,w){if(pJ.isEmptyPath($))this.contents=w;else if(this.contents==null)this.contents=pJ.collectionFromPath(this.schema,Array.from($),w);else if(aJ(this.contents))this.contents.setIn($,w)}setSchema($,w={}){if(typeof $==="number")$=String($);let J;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new $Y.Directives({version:"1.1"});J={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new $Y.Directives({version:$});J={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;J=null;break;default:{let V=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${V}`)}}if(w.schema instanceof Object)this.schema=w.schema;else if(J)this.schema=new sE.Schema(Object.assign(J,w));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:w,mapAsMap:J,maxAliasCount:V,onAnchor:U,reviver:G}={}){let z={anchors:new Map,doc:this,keep:!$,mapAsMap:J===!0,mapKeyWarned:!1,maxAliasCount:typeof V==="number"?V:100},i=eE.toJS(this.contents,w??"",z);if(typeof U==="function")for(let{count:N,res:X}of z.anchors.values())U(X,N);return typeof G==="function"?wC.applyReviver(G,{"":i},"",i):i}toJSON($,w){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:w})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let w=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${w}`)}return $C.stringifyDocument(this,$)}}function aJ($){if(i4.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}UC.Document=wY});var n0=Z((zC)=>{class Xi extends Error{constructor($,w,J,V){super();this.name=$,this.code=J,this.message=V,this.pos=w}}class mK extends Xi{constructor($,w,J){super("YAMLParseError",$,w,J)}}class yK extends Xi{constructor($,w,J){super("YAMLWarning",$,w,J)}}var GC=($,w)=>(J)=>{if(J.pos[0]===-1)return;J.linePos=J.pos.map((i)=>w.linePos(i));let{line:V,col:U}=J.linePos[0];J.message+=` at line ${V}, column ${U}`;let G=U-1,z=$.substring(w.lineStarts[V-1],w.lineStarts[V]).replace(/[\n\r]+$/,"");if(G>=60&&z.length>80){let i=Math.min(G-39,z.length-79);z="…"+z.substring(i),G-=i-1}if(z.length>80)z=z.substring(0,79)+"…";if(V>1&&/^ *$/.test(z.substring(0,G))){let i=$.substring(w.lineStarts[V-2],w.lineStarts[V-1]);if(i.length>80)i=i.substring(0,79)+`…
|
|
89
|
+
`;z=i+z}if(/[^ ]/.test(z)){let i=1,N=J.linePos[1];if(N?.line===V&&N.col>U)i=Math.max(1,Math.min(N.col-U,80-G));let X=" ".repeat(G)+"^".repeat(i);J.message+=`:
|
|
86
90
|
|
|
87
|
-
${
|
|
88
|
-
${
|
|
89
|
-
`}};
|
|
90
|
-
`))return!0;if($.end){for(let w of $.end)if(w.type==="newline")return!0}return!1;case"flow-collection":for(let w of $.items){for(let
|
|
91
|
-
`+
|
|
92
|
-
`+
|
|
93
|
-
`+
|
|
94
|
-
`+
|
|
95
|
-
`+
|
|
96
|
-
`+
|
|
97
|
-
`.repeat(Math.max(1,
|
|
98
|
-
`;for(let
|
|
99
|
-
`;else if(
|
|
100
|
-
`;else if(!
|
|
101
|
-
`)
|
|
91
|
+
${z}
|
|
92
|
+
${X}
|
|
93
|
+
`}};zC.YAMLError=Xi;zC.YAMLParseError=mK;zC.YAMLWarning=yK;zC.prettifyError=GC});var d0=Z((gC)=>{function IC($,{flow:w,indicator:J,next:V,offset:U,onError:G,parentIndent:z,startOnNewline:i}){let N=!1,X=i,W=i,I="",g="",Y=!1,v=!1,O=null,P=null,F=null,q=null,T=null,L=null,k=null;for(let _ of $){if(v){if(_.type!=="space"&&_.type!=="newline"&&_.type!=="comma")G(_.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");v=!1}if(O){if(X&&_.type!=="comment"&&_.type!=="newline")G(O,"TAB_AS_INDENT","Tabs are not allowed as indentation");O=null}switch(_.type){case"space":if(!w&&(J!=="doc-start"||V?.type!=="flow-collection")&&_.source.includes("\t"))O=_;W=!0;break;case"comment":{if(!W)G(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let t=_.source.substring(1)||" ";if(!I)I=t;else I+=g+t;g="",X=!1;break}case"newline":if(X){if(I)I+=_.source;else if(!L||J!=="seq-item-ind")N=!0}else g+=_.source;if(X=!0,Y=!0,P||F)q=_;W=!0;break;case"anchor":if(P)G(_,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(_.source.endsWith(":"))G(_.offset+_.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);P=_,k??(k=_.offset),X=!1,W=!1,v=!0;break;case"tag":{if(F)G(_,"MULTIPLE_TAGS","A node can have at most one tag");F=_,k??(k=_.offset),X=!1,W=!1,v=!0;break}case J:if(P||F)G(_,"BAD_PROP_ORDER",`Anchors and tags must be after the ${_.source} indicator`);if(L)G(_,"UNEXPECTED_TOKEN",`Unexpected ${_.source} in ${w??"collection"}`);L=_,X=J==="seq-item-ind"||J==="explicit-key-ind",W=!1;break;case"comma":if(w){if(T)G(_,"UNEXPECTED_TOKEN",`Unexpected , in ${w}`);T=_,X=!1,W=!1;break}default:G(_,"UNEXPECTED_TOKEN",`Unexpected ${_.type} token`),X=!1,W=!1}}let b=$[$.length-1],C=b?b.offset+b.source.length:U;if(v&&V&&V.type!=="space"&&V.type!=="newline"&&V.type!=="comma"&&(V.type!=="scalar"||V.source!==""))G(V.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(O&&(X&&O.indent<=z||V?.type==="block-map"||V?.type==="block-seq"))G(O,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:T,found:L,spaceBefore:N,comment:I,hasNewline:Y,anchor:P,tag:F,newlineAfterProp:q,end:C,start:k??C}}gC.resolveProps=IC});var Ni=Z((vC)=>{function JY($){if(!$)return null;switch($.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if($.source.includes(`
|
|
94
|
+
`))return!0;if($.end){for(let w of $.end)if(w.type==="newline")return!0}return!1;case"flow-collection":for(let w of $.items){for(let J of w.start)if(J.type==="newline")return!0;if(w.sep){for(let J of w.sep)if(J.type==="newline")return!0}if(JY(w.key)||JY(w.value))return!0}return!1;default:return!0}}vC.containsNewline=JY});var UY=Z((KC)=>{var OC=Ni();function PC($,w,J){if(w?.type==="flow-collection"){let V=w.end[0];if(V.indent===$&&(V.source==="]"||V.source==="}")&&OC.containsNewline(w))J(V,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}KC.flowIndentCheck=PC});var VY=Z((HC)=>{var hK=p();function BC($,w,J){let{uniqueKeys:V}=$.options;if(V===!1)return!1;let U=typeof V==="function"?V:(G,z)=>G===z||hK.isScalar(G)&&hK.isScalar(z)&&G.value===z.value;return w.some((G)=>U(G.key,J))}HC.mapIncludes=BC});var pK=Z((LC)=>{var cK=A6(),qC=_6(),lK=d0(),ZC=Ni(),tK=UY(),TC=VY(),oK="All mapping items must start at the same column";function DC({composeNode:$,composeEmptyNode:w},J,V,U,G){let i=new(G?.nodeClass??qC.YAMLMap)(J.schema);if(J.atRoot)J.atRoot=!1;let N=V.offset,X=null;for(let W of V.items){let{start:I,key:g,sep:Y,value:v}=W,O=lK.resolveProps(I,{indicator:"explicit-key-ind",next:g??Y?.[0],offset:N,onError:U,parentIndent:V.indent,startOnNewline:!0}),P=!O.found;if(P){if(g){if(g.type==="block-seq")U(N,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in g&&g.indent!==V.indent)U(N,"BAD_INDENT",oK)}if(!O.anchor&&!O.tag&&!Y){if(X=O.end,O.comment)if(i.comment)i.comment+=`
|
|
95
|
+
`+O.comment;else i.comment=O.comment;continue}if(O.newlineAfterProp||ZC.containsNewline(g))U(g??I[I.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(O.found?.indent!==V.indent)U(N,"BAD_INDENT",oK);J.atKey=!0;let F=O.end,q=g?$(J,g,O,U):w(J,F,I,null,O,U);if(J.schema.compat)tK.flowIndentCheck(V.indent,g,U);if(J.atKey=!1,TC.mapIncludes(J,i.items,q))U(F,"DUPLICATE_KEY","Map keys must be unique");let T=lK.resolveProps(Y??[],{indicator:"map-value-ind",next:v,offset:q.range[2],onError:U,parentIndent:V.indent,startOnNewline:!g||g.type==="block-scalar"});if(N=T.end,T.found){if(P){if(v?.type==="block-map"&&!T.hasNewline)U(N,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(J.options.strict&&O.start<T.found.offset-1024)U(q.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let L=v?$(J,v,T,U):w(J,N,Y,null,T,U);if(J.schema.compat)tK.flowIndentCheck(V.indent,v,U);N=L.range[2];let k=new cK.Pair(q,L);if(J.options.keepSourceTokens)k.srcToken=W;i.items.push(k)}else{if(P)U(q.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(T.comment)if(q.comment)q.comment+=`
|
|
96
|
+
`+T.comment;else q.comment=T.comment;let L=new cK.Pair(q);if(J.options.keepSourceTokens)L.srcToken=W;i.items.push(L)}}if(X&&X<N)U(X,"IMPOSSIBLE","Map comment with trailing content");return i.range=[V.offset,N,X??N],i}LC.resolveBlockMap=DC});var aK=Z((kC)=>{var MC=k6(),AC=d0(),SC=UY();function _C({composeNode:$,composeEmptyNode:w},J,V,U,G){let i=new(G?.nodeClass??MC.YAMLSeq)(J.schema);if(J.atRoot)J.atRoot=!1;if(J.atKey)J.atKey=!1;let N=V.offset,X=null;for(let{start:W,value:I}of V.items){let g=AC.resolveProps(W,{indicator:"seq-item-ind",next:I,offset:N,onError:U,parentIndent:V.indent,startOnNewline:!0});if(!g.found)if(g.anchor||g.tag||I)if(I?.type==="block-seq")U(g.end,"BAD_INDENT","All sequence items must start at the same column");else U(N,"MISSING_CHAR","Sequence item without - indicator");else{if(X=g.end,g.comment)i.comment=g.comment;continue}let Y=I?$(J,I,g,U):w(J,g.end,W,null,g,U);if(J.schema.compat)SC.flowIndentCheck(V.indent,I,U);N=Y.range[2],i.items.push(Y)}return i.range=[V.offset,N,X??N],i}kC.resolveBlockSeq=_C});var eJ=Z((EC)=>{function bC($,w,J,V){let U="";if($){let G=!1,z="";for(let i of $){let{source:N,type:X}=i;switch(X){case"space":G=!0;break;case"comment":{if(J&&!G)V(i,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let W=N.substring(1)||" ";if(!U)U=W;else U+=z+W;z="";break}case"newline":if(U)z+=N;G=!0;break;default:V(i,"UNEXPECTED_TOKEN",`Unexpected ${X} at node end`)}w+=N.length}}return{comment:U,offset:w}}EC.resolveEnd=bC});var $u=Z((hC)=>{var jC=p(),xC=A6(),eK=_6(),rC=k6(),nC=eJ(),sK=d0(),dC=Ni(),mC=VY(),GY="Block collections are not allowed within flow collections",zY=($)=>$&&($.type==="block-map"||$.type==="block-seq");function yC({composeNode:$,composeEmptyNode:w},J,V,U,G){let z=V.start.source==="{",i=z?"flow map":"flow sequence",X=new(G?.nodeClass??(z?eK.YAMLMap:rC.YAMLSeq))(J.schema);X.flow=!0;let W=J.atRoot;if(W)J.atRoot=!1;if(J.atKey)J.atKey=!1;let I=V.offset+V.start.source.length;for(let P=0;P<V.items.length;++P){let F=V.items[P],{start:q,key:T,sep:L,value:k}=F,b=sK.resolveProps(q,{flow:i,indicator:"explicit-key-ind",next:T??L?.[0],offset:I,onError:U,parentIndent:V.indent,startOnNewline:!1});if(!b.found){if(!b.anchor&&!b.tag&&!L&&!k){if(P===0&&b.comma)U(b.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${i}`);else if(P<V.items.length-1)U(b.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${i}`);if(b.comment)if(X.comment)X.comment+=`
|
|
97
|
+
`+b.comment;else X.comment=b.comment;I=b.end;continue}if(!z&&J.options.strict&&dC.containsNewline(T))U(T,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(P===0){if(b.comma)U(b.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${i}`)}else{if(!b.comma)U(b.start,"MISSING_CHAR",`Missing , between ${i} items`);if(b.comment){let C="";$:for(let _ of q)switch(_.type){case"comma":case"space":break;case"comment":C=_.source.substring(1);break $;default:break $}if(C){let _=X.items[X.items.length-1];if(jC.isPair(_))_=_.value??_.key;if(_.comment)_.comment+=`
|
|
98
|
+
`+C;else _.comment=C;b.comment=b.comment.substring(C.length+1)}}}if(!z&&!L&&!b.found){let C=k?$(J,k,b,U):w(J,b.end,L,null,b,U);if(X.items.push(C),I=C.range[2],zY(k))U(C.range,"BLOCK_IN_FLOW",GY)}else{J.atKey=!0;let C=b.end,_=T?$(J,T,b,U):w(J,C,q,null,b,U);if(zY(T))U(_.range,"BLOCK_IN_FLOW",GY);J.atKey=!1;let t=sK.resolveProps(L??[],{flow:i,indicator:"map-value-ind",next:k,offset:_.range[2],onError:U,parentIndent:V.indent,startOnNewline:!1});if(t.found){if(!z&&!b.found&&J.options.strict){if(L)for(let U$ of L){if(U$===t.found)break;if(U$.type==="newline"){U(U$,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(b.start<t.found.offset-1024)U(t.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(k)if("source"in k&&k.source?.[0]===":")U(k,"MISSING_CHAR",`Missing space after : in ${i}`);else U(t.start,"MISSING_CHAR",`Missing , or : between ${i} items`);let y=k?$(J,k,t,U):t.found?w(J,t.end,L,null,t,U):null;if(y){if(zY(k))U(y.range,"BLOCK_IN_FLOW",GY)}else if(t.comment)if(_.comment)_.comment+=`
|
|
99
|
+
`+t.comment;else _.comment=t.comment;let W$=new xC.Pair(_,y);if(J.options.keepSourceTokens)W$.srcToken=F;if(z){let U$=X;if(mC.mapIncludes(J,U$.items,_))U(C,"DUPLICATE_KEY","Map keys must be unique");U$.items.push(W$)}else{let U$=new eK.YAMLMap(J.schema);U$.flow=!0,U$.items.push(W$);let H$=(y??_).range;U$.range=[_.range[0],H$[1],H$[2]],X.items.push(U$)}I=y?y.range[2]:t.end}}let g=z?"}":"]",[Y,...v]=V.end,O=I;if(Y?.source===g)O=Y.offset+Y.source.length;else{let P=i[0].toUpperCase()+i.substring(1),F=W?`${P} must end with a ${g}`:`${P} in block collection must be sufficiently indented and end with a ${g}`;if(U(I,W?"MISSING_CHAR":"BAD_INDENT",F),Y&&Y.source.length!==1)v.unshift(Y)}if(v.length>0){let P=nC.resolveEnd(v,O,J.options.strict,U);if(P.comment)if(X.comment)X.comment+=`
|
|
100
|
+
`+P.comment;else X.comment=P.comment;X.range=[V.offset,O,P.offset]}else X.range=[V.offset,O,O];return X}hC.resolveFlowCollection=yC});var wu=Z((wj)=>{var lC=p(),tC=I$(),oC=_6(),pC=k6(),aC=pK(),eC=aK(),sC=$u();function iY($,w,J,V,U,G){let z=J.type==="block-map"?aC.resolveBlockMap($,w,J,V,G):J.type==="block-seq"?eC.resolveBlockSeq($,w,J,V,G):sC.resolveFlowCollection($,w,J,V,G),i=z.constructor;if(U==="!"||U===i.tagName)return z.tag=i.tagName,z;if(U)z.tag=U;return z}function $j($,w,J,V,U){let G=V.tag,z=!G?null:w.directives.tagName(G.source,(g)=>U(G,"TAG_RESOLVE_FAILED",g));if(J.type==="block-seq"){let{anchor:g,newlineAfterProp:Y}=V,v=g&&G?g.offset>G.offset?g:G:g??G;if(v&&(!Y||Y.offset<v.offset))U(v,"MISSING_CHAR","Missing newline after block sequence props")}let i=J.type==="block-map"?"map":J.type==="block-seq"?"seq":J.start.source==="{"?"map":"seq";if(!G||!z||z==="!"||z===oC.YAMLMap.tagName&&i==="map"||z===pC.YAMLSeq.tagName&&i==="seq")return iY($,w,J,U,z);let N=w.schema.tags.find((g)=>g.tag===z&&g.collection===i);if(!N){let g=w.schema.knownTags[z];if(g?.collection===i)w.schema.tags.push(Object.assign({},g,{default:!1})),N=g;else{if(g)U(G,"BAD_COLLECTION_TYPE",`${g.tag} used for ${i} collection, but expects ${g.collection??"scalar"}`,!0);else U(G,"TAG_RESOLVE_FAILED",`Unresolved tag: ${z}`,!0);return iY($,w,J,U,z)}}let X=iY($,w,J,U,z,N),W=N.resolve?.(X,(g)=>U(G,"TAG_RESOLVE_FAILED",g),w.options)??X,I=lC.isNode(W)?W:new tC.Scalar(W);if(I.range=X.range,I.tag=z,N?.format)I.format=N.format;return I}wj.composeCollection=$j});var NY=Z((zj)=>{var XY=I$();function Uj($,w,J){let V=w.offset,U=Vj(w,$.options.strict,J);if(!U)return{value:"",type:null,comment:"",range:[V,V,V]};let G=U.mode===">"?XY.Scalar.BLOCK_FOLDED:XY.Scalar.BLOCK_LITERAL,z=w.source?Gj(w.source):[],i=z.length;for(let O=z.length-1;O>=0;--O){let P=z[O][1];if(P===""||P==="\r")i=O;else break}if(i===0){let O=U.chomp==="+"&&z.length>0?`
|
|
101
|
+
`.repeat(Math.max(1,z.length-1)):"",P=V+U.length;if(w.source)P+=w.source.length;return{value:O,type:G,comment:U.comment,range:[V,P,P]}}let N=w.indent+U.indent,X=w.offset+U.length,W=0;for(let O=0;O<i;++O){let[P,F]=z[O];if(F===""||F==="\r"){if(U.indent===0&&P.length>N)N=P.length}else{if(P.length<N)J(X+P.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(U.indent===0)N=P.length;if(W=O,N===0&&!$.atRoot)J(X,"BAD_INDENT","Block scalar values in collections must be indented");break}X+=P.length+F.length+1}for(let O=z.length-1;O>=i;--O)if(z[O][0].length>N)i=O+1;let I="",g="",Y=!1;for(let O=0;O<W;++O)I+=z[O][0].slice(N)+`
|
|
102
|
+
`;for(let O=W;O<i;++O){let[P,F]=z[O];X+=P.length+F.length+1;let q=F[F.length-1]==="\r";if(q)F=F.slice(0,-1);if(F&&P.length<N){let L=`Block scalar lines must not be less indented than their ${U.indent?"explicit indentation indicator":"first line"}`;J(X-F.length-(q?2:1),"BAD_INDENT",L),P=""}if(G===XY.Scalar.BLOCK_LITERAL)I+=g+P.slice(N)+F,g=`
|
|
103
|
+
`;else if(P.length>N||F[0]==="\t"){if(g===" ")g=`
|
|
104
|
+
`;else if(!Y&&g===`
|
|
105
|
+
`)g=`
|
|
102
106
|
|
|
103
|
-
`;I+=
|
|
104
|
-
`,
|
|
107
|
+
`;I+=g+P.slice(N)+F,g=`
|
|
108
|
+
`,Y=!0}else if(F==="")if(g===`
|
|
105
109
|
`)I+=`
|
|
106
|
-
`;else
|
|
107
|
-
`;else I+=
|
|
108
|
-
`+
|
|
110
|
+
`;else g=`
|
|
111
|
+
`;else I+=g+F,g=" ",Y=!1}switch(U.chomp){case"-":break;case"+":for(let O=i;O<z.length;++O)I+=`
|
|
112
|
+
`+z[O][0].slice(N);if(I[I.length-1]!==`
|
|
109
113
|
`)I+=`
|
|
110
114
|
`;break;default:I+=`
|
|
111
|
-
`}let
|
|
112
|
-
`,"sy"),
|
|
113
|
-
`,"sy")}catch{w=/(.*?)[ \t]*\r?\n/sy,
|
|
114
|
-
`)
|
|
115
|
-
`;else
|
|
116
|
-
`)continue;if(
|
|
117
|
-
`){let{fold:
|
|
118
|
-
`){
|
|
119
|
-
`){
|
|
120
|
-
`&&!(
|
|
121
|
-
`))
|
|
122
|
-
`||
|
|
123
|
-
`)break;if(
|
|
124
|
-
`)
|
|
125
|
-
`;w+=1,
|
|
126
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function
|
|
115
|
+
`}let v=V+U.length+w.source.length;return{value:I,type:G,comment:U.comment,range:[V,v,v]}}function Vj({offset:$,props:w},J,V){if(w[0].type!=="block-scalar-header")return V(w[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:U}=w[0],G=U[0],z=0,i="",N=-1;for(let g=1;g<U.length;++g){let Y=U[g];if(!i&&(Y==="-"||Y==="+"))i=Y;else{let v=Number(Y);if(!z&&v)z=v;else if(N===-1)N=$+g}}if(N!==-1)V(N,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${U}`);let X=!1,W="",I=U.length;for(let g=1;g<w.length;++g){let Y=w[g];switch(Y.type){case"space":X=!0;case"newline":I+=Y.source.length;break;case"comment":if(J&&!X)V(Y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");I+=Y.source.length,W=Y.source.substring(1);break;case"error":V(Y,"UNEXPECTED_TOKEN",Y.message),I+=Y.source.length;break;default:{let v=`Unexpected token in block scalar header: ${Y.type}`;V(Y,"UNEXPECTED_TOKEN",v);let O=Y.source;if(O&&typeof O==="string")I+=O.length}}}return{mode:G,indent:z,chomp:i,comment:W,length:I}}function Gj($){let w=$.split(/\n( *)/),J=w[0],V=J.match(/^( *)/),G=[V?.[1]?[V[1],J.slice(V[1].length)]:["",J]];for(let z=1;z<w.length;z+=2)G.push([w[z],w[z+1]]);return G}zj.resolveBlockScalar=Uj});var IY=Z((Oj)=>{var WY=I$(),Xj=eJ();function Nj($,w,J){let{offset:V,type:U,source:G,end:z}=$,i,N,X=(g,Y,v)=>J(V+g,Y,v);switch(U){case"scalar":i=WY.Scalar.PLAIN,N=Wj(G,X);break;case"single-quoted-scalar":i=WY.Scalar.QUOTE_SINGLE,N=Ij(G,X);break;case"double-quoted-scalar":i=WY.Scalar.QUOTE_DOUBLE,N=gj(G,X);break;default:return J($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${U}`),{value:"",type:null,comment:"",range:[V,V+G.length,V+G.length]}}let W=V+G.length,I=Xj.resolveEnd(z,W,w,J);return{value:N,type:i,comment:I.comment,range:[V,W,I.offset]}}function Wj($,w){let J="";switch($[0]){case"\t":J="a tab character";break;case",":J="flow indicator character ,";break;case"%":J="directive indicator character %";break;case"|":case">":{J=`block scalar indicator ${$[0]}`;break}case"@":case"`":{J=`reserved character ${$[0]}`;break}}if(J)w(0,"BAD_SCALAR_START",`Plain value cannot start with ${J}`);return Ju($)}function Ij($,w){if($[$.length-1]!=="'"||$.length===1)w($.length,"MISSING_CHAR","Missing closing 'quote");return Ju($.slice(1,-1)).replace(/''/g,"'")}function Ju($){let w,J;try{w=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
116
|
+
`,"sy"),J=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
117
|
+
`,"sy")}catch{w=/(.*?)[ \t]*\r?\n/sy,J=/[ \t]*(.*?)[ \t]*\r?\n/sy}let V=w.exec($);if(!V)return $;let U=V[1],G=" ",z=w.lastIndex;J.lastIndex=z;while(V=J.exec($)){if(V[1]==="")if(G===`
|
|
118
|
+
`)U+=G;else G=`
|
|
119
|
+
`;else U+=G+V[1],G=" ";z=J.lastIndex}let i=/[ \t]*(.*)/sy;return i.lastIndex=z,V=i.exec($),U+G+(V?.[1]??"")}function gj($,w){let J="";for(let V=1;V<$.length-1;++V){let U=$[V];if(U==="\r"&&$[V+1]===`
|
|
120
|
+
`)continue;if(U===`
|
|
121
|
+
`){let{fold:G,offset:z}=Yj($,V);J+=G,V=z}else if(U==="\\"){let G=$[++V],z=vj[G];if(z)J+=z;else if(G===`
|
|
122
|
+
`){G=$[V+1];while(G===" "||G==="\t")G=$[++V+1]}else if(G==="\r"&&$[V+1]===`
|
|
123
|
+
`){G=$[++V+1];while(G===" "||G==="\t")G=$[++V+1]}else if(G==="x"||G==="u"||G==="U"){let i=G==="x"?2:G==="u"?4:8;J+=Qj($,V+1,i,w),V+=i}else{let i=$.substr(V-1,2);w(V-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${i}`),J+=i}}else if(U===" "||U==="\t"){let G=V,z=$[V+1];while(z===" "||z==="\t")z=$[++V+1];if(z!==`
|
|
124
|
+
`&&!(z==="\r"&&$[V+2]===`
|
|
125
|
+
`))J+=V>G?$.slice(G,V+1):U}else J+=U}if($[$.length-1]!=='"'||$.length===1)w($.length,"MISSING_CHAR",'Missing closing "quote');return J}function Yj($,w){let J="",V=$[w+1];while(V===" "||V==="\t"||V===`
|
|
126
|
+
`||V==="\r"){if(V==="\r"&&$[w+2]!==`
|
|
127
|
+
`)break;if(V===`
|
|
128
|
+
`)J+=`
|
|
129
|
+
`;w+=1,V=$[w+1]}if(!J)J=" ";return{fold:J,offset:w}}var vj={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
130
|
+
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function Qj($,w,J,V){let U=$.substr(w,J),z=U.length===J&&/^[0-9a-fA-F]+$/.test(U)?parseInt(U,16):NaN;try{return String.fromCodePoint(z)}catch{let i=$.substr(w-2,J+2);return V(w-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${i}`),i}}Oj.resolveFlowScalar=Nj});var Vu=Z((qj)=>{var qw=p(),Uu=I$(),Kj=NY(),uj=IY();function Bj($,w,J,V){let{value:U,type:G,comment:z,range:i}=w.type==="block-scalar"?Kj.resolveBlockScalar($,w,V):uj.resolveFlowScalar(w,$.options.strict,V),N=J?$.directives.tagName(J.source,(I)=>V(J,"TAG_RESOLVE_FAILED",I)):null,X;if($.options.stringKeys&&$.atKey)X=$.schema[qw.SCALAR];else if(N)X=Hj($.schema,U,N,J,V);else if(w.type==="scalar")X=Fj($,U,w,V);else X=$.schema[qw.SCALAR];let W;try{let I=X.resolve(U,(g)=>V(J??w,"TAG_RESOLVE_FAILED",g),$.options);W=qw.isScalar(I)?I:new Uu.Scalar(I)}catch(I){let g=I instanceof Error?I.message:String(I);V(J??w,"TAG_RESOLVE_FAILED",g),W=new Uu.Scalar(U)}if(W.range=i,W.source=U,G)W.type=G;if(N)W.tag=N;if(X.format)W.format=X.format;if(z)W.comment=z;return W}function Hj($,w,J,V,U){if(J==="!")return $[qw.SCALAR];let G=[];for(let i of $.tags)if(!i.collection&&i.tag===J)if(i.default&&i.test)G.push(i);else return i;for(let i of G)if(i.test?.test(w))return i;let z=$.knownTags[J];if(z&&!z.collection)return $.tags.push(Object.assign({},z,{default:!1,test:void 0})),z;return U(V,"TAG_RESOLVE_FAILED",`Unresolved tag: ${J}`,J!=="tag:yaml.org,2002:str"),$[qw.SCALAR]}function Fj({atKey:$,directives:w,schema:J},V,U,G){let z=J.tags.find((i)=>(i.default===!0||$&&i.default==="key")&&i.test?.test(V))||J[qw.SCALAR];if(J.compat){let i=J.compat.find((N)=>N.default&&N.test?.test(V))??J[qw.SCALAR];if(z.tag!==i.tag){let N=w.tagString(z.tag),X=w.tagString(i.tag),W=`Value may be parsed as either ${N} or ${X}`;G(U,"TAG_RESOLVE_FAILED",W,!0)}}return z}qj.composeScalar=Bj});var Gu=Z((Dj)=>{function Tj($,w,J){if(w){J??(J=w.length);for(let V=J-1;V>=0;--V){let U=w[V];switch(U.type){case"space":case"comment":case"newline":$-=U.source.length;continue}U=w[++V];while(U?.type==="space")$+=U.source.length,U=w[++V];break}}return $}Dj.emptyScalarPosition=Tj});var Xu=Z((bj)=>{var fj=D0(),Mj=p(),Aj=wu(),zu=Vu(),Sj=eJ(),_j=Gu(),kj={composeNode:iu,composeEmptyNode:gY};function iu($,w,J,V){let U=$.atKey,{spaceBefore:G,comment:z,anchor:i,tag:N}=J,X,W=!0;switch(w.type){case"alias":if(X=Rj($,w,V),i||N)V(w,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(X=zu.composeScalar($,w,N,V),i)X.anchor=i.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(X=Aj.composeCollection(kj,$,w,J,V),i)X.anchor=i.source.substring(1)}catch(I){let g=I instanceof Error?I.message:String(I);V(w,"RESOURCE_EXHAUSTION",g)}break;default:{let I=w.type==="error"?w.message:`Unsupported token (type: ${w.type})`;V(w,"UNEXPECTED_TOKEN",I),W=!1}}if(X??(X=gY($,w.offset,void 0,null,J,V)),i&&X.anchor==="")V(i,"BAD_ALIAS","Anchor cannot be an empty string");if(U&&$.options.stringKeys&&(!Mj.isScalar(X)||typeof X.value!=="string"||X.tag&&X.tag!=="tag:yaml.org,2002:str"))V(N??w,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(G)X.spaceBefore=!0;if(z)if(w.type==="scalar"&&w.source==="")X.comment=z;else X.commentBefore=z;if($.options.keepSourceTokens&&W)X.srcToken=w;return X}function gY($,w,J,V,{spaceBefore:U,comment:G,anchor:z,tag:i,end:N},X){let W={type:"scalar",offset:_j.emptyScalarPosition(w,J,V),indent:-1,source:""},I=zu.composeScalar($,W,i,X);if(z){if(I.anchor=z.source.substring(1),I.anchor==="")X(z,"BAD_ALIAS","Anchor cannot be an empty string")}if(U)I.spaceBefore=!0;if(G)I.comment=G,I.range[2]=N;return I}function Rj({options:$},{offset:w,source:J,end:V},U){let G=new fj.Alias(J.substring(1));if(G.source==="")U(w,"BAD_ALIAS","Alias cannot be an empty string");if(G.source.endsWith(":"))U(w+J.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let z=w+J.length,i=Sj.resolveEnd(V,z,$.strict,U);if(G.range=[w,z,i.offset],i.comment)G.comment=i.comment;return G}bj.composeEmptyNode=gY;bj.composeNode=iu});var Wu=Z((dj)=>{var jj=r0(),Nu=Xu(),xj=eJ(),rj=d0();function nj($,w,{offset:J,start:V,value:U,end:G},z){let i=Object.assign({_directives:w},$),N=new jj.Document(void 0,i),X={atKey:!1,atRoot:!0,directives:N.directives,options:N.options,schema:N.schema},W=rj.resolveProps(V,{indicator:"doc-start",next:U??G?.[0],offset:J,onError:z,parentIndent:0,startOnNewline:!0});if(W.found){if(N.directives.docStart=!0,U&&(U.type==="block-map"||U.type==="block-seq")&&!W.hasNewline)z(W.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}N.contents=U?Nu.composeNode(X,U,W,z):Nu.composeEmptyNode(X,W.end,V,null,W,z);let I=N.contents.range[2],g=xj.resolveEnd(G,I,!1,z);if(g.comment)N.comment=g.comment;return N.range=[J,I,g.offset],N}dj.composeDoc=nj});var YY=Z((oj)=>{var yj=b4("process"),hj=Pg(),cj=r0(),m0=n0(),Iu=p(),lj=Wu(),tj=eJ();function y0($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:w,source:J}=$;return[w,w+(typeof J==="string"?J.length:1)]}function gu($){let w="",J=!1,V=!1;for(let U=0;U<$.length;++U){let G=$[U];switch(G[0]){case"#":w+=(w===""?"":V?`
|
|
127
131
|
|
|
128
132
|
`:`
|
|
129
|
-
`)+(
|
|
130
|
-
${
|
|
131
|
-
${
|
|
132
|
-
${
|
|
133
|
-
${w.comment}`:w.comment}this.doc.range[2]=w.offset;break}default:this.errors.push(new
|
|
134
|
-
`}];switch(
|
|
135
|
-
`),
|
|
136
|
-
`,
|
|
137
|
-
`});return{type:"block-scalar",offset:
|
|
138
|
-
`),
|
|
139
|
-
`;if($.type==="block-scalar"){let
|
|
140
|
-
`});for(let
|
|
141
|
-
`};delete $.items,Object.assign($,{type:
|
|
133
|
+
`)+(G.substring(1)||" "),J=!0,V=!1;break;case"%":if($[U+1]?.[0]!=="#")U+=1;J=!1;break;default:if(!J)V=!0;J=!1}}return{comment:w,afterEmptyLine:V}}class Yu{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(w,J,V,U)=>{let G=y0(w);if(U)this.warnings.push(new m0.YAMLWarning(G,J,V));else this.errors.push(new m0.YAMLParseError(G,J,V))},this.directives=new hj.Directives({version:$.version||"1.2"}),this.options=$}decorate($,w){let{comment:J,afterEmptyLine:V}=gu(this.prelude);if(J){let U=$.contents;if(w)$.comment=$.comment?`${$.comment}
|
|
134
|
+
${J}`:J;else if(V||$.directives.docStart||!U)$.commentBefore=J;else if(Iu.isCollection(U)&&!U.flow&&U.items.length>0){let G=U.items[0];if(Iu.isPair(G))G=G.key;let z=G.commentBefore;G.commentBefore=z?`${J}
|
|
135
|
+
${z}`:J}else{let G=U.commentBefore;U.commentBefore=G?`${J}
|
|
136
|
+
${G}`:J}}if(w){for(let U=0;U<this.errors.length;++U)$.errors.push(this.errors[U]);for(let U=0;U<this.warnings.length;++U)$.warnings.push(this.warnings[U])}else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:gu(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,w=!1,J=-1){for(let V of $)yield*this.next(V);yield*this.end(w,J)}*next($){if(yj.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(w,J,V)=>{let U=y0($);U[0]+=w,this.onError(U,"BAD_DIRECTIVE",J,V)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let w=lj.composeDoc(this.options,this.directives,$,this.onError);if(this.atDirectives&&!w.directives.docStart)this.onError($,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(w,!1),this.doc)yield this.doc;this.doc=w,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push($.source);break;case"error":{let w=$.source?`${$.message}: ${JSON.stringify($.source)}`:$.message,J=new m0.YAMLParseError(y0($),"UNEXPECTED_TOKEN",w);if(this.atDirectives||!this.doc)this.errors.push(J);else this.doc.errors.push(J);break}case"doc-end":{if(!this.doc){this.errors.push(new m0.YAMLParseError(y0($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let w=tj.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),w.comment){let J=this.doc.comment;this.doc.comment=J?`${J}
|
|
137
|
+
${w.comment}`:w.comment}this.doc.range[2]=w.offset;break}default:this.errors.push(new m0.YAMLParseError(y0($),"UNEXPECTED_TOKEN",`Unsupported token ${$.type}`))}}*end($=!1,w=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if($){let J=Object.assign({_directives:this.directives},this.options),V=new cj.Document(void 0,J);if(this.atDirectives)this.onError(w,"MISSING_CHAR","Missing directives-end indicator line");V.range=[0,w,w],this.decorate(V,!1),yield V}}}oj.Composer=Yu});var Ou=Z((Vx)=>{var aj=NY(),ej=IY(),sj=n0(),vu=A0();function $x($,w=!0,J){if($){let V=(U,G,z)=>{let i=typeof U==="number"?U:Array.isArray(U)?U[0]:U.offset;if(J)J(i,G,z);else throw new sj.YAMLParseError([i,i+1],G,z)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return ej.resolveFlowScalar($,w,V);case"block-scalar":return aj.resolveBlockScalar({options:{strict:w}},$,V)}}return null}function wx($,w){let{implicitKey:J=!1,indent:V,inFlow:U=!1,offset:G=-1,type:z="PLAIN"}=w,i=vu.stringifyString({type:z,value:$},{implicitKey:J,indent:V>0?" ".repeat(V):"",inFlow:U,options:{blockQuote:!0,lineWidth:-1}}),N=w.end??[{type:"newline",offset:-1,indent:V,source:`
|
|
138
|
+
`}];switch(i[0]){case"|":case">":{let X=i.indexOf(`
|
|
139
|
+
`),W=i.substring(0,X),I=i.substring(X+1)+`
|
|
140
|
+
`,g=[{type:"block-scalar-header",offset:G,indent:V,source:W}];if(!Qu(g,N))g.push({type:"newline",offset:-1,indent:V,source:`
|
|
141
|
+
`});return{type:"block-scalar",offset:G,indent:V,props:g,source:I}}case'"':return{type:"double-quoted-scalar",offset:G,indent:V,source:i,end:N};case"'":return{type:"single-quoted-scalar",offset:G,indent:V,source:i,end:N};default:return{type:"scalar",offset:G,indent:V,source:i,end:N}}}function Jx($,w,J={}){let{afterKey:V=!1,implicitKey:U=!1,inFlow:G=!1,type:z}=J,i="indent"in $?$.indent:null;if(V&&typeof i==="number")i+=2;if(!z)switch($.type){case"single-quoted-scalar":z="QUOTE_SINGLE";break;case"double-quoted-scalar":z="QUOTE_DOUBLE";break;case"block-scalar":{let X=$.props[0];if(X.type!=="block-scalar-header")throw Error("Invalid block scalar header");z=X.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:z="PLAIN"}let N=vu.stringifyString({type:z,value:w},{implicitKey:U||i===null,indent:i!==null&&i>0?" ".repeat(i):"",inFlow:G,options:{blockQuote:!0,lineWidth:-1}});switch(N[0]){case"|":case">":Ux($,N);break;case'"':vY($,N,"double-quoted-scalar");break;case"'":vY($,N,"single-quoted-scalar");break;default:vY($,N,"scalar")}}function Ux($,w){let J=w.indexOf(`
|
|
142
|
+
`),V=w.substring(0,J),U=w.substring(J+1)+`
|
|
143
|
+
`;if($.type==="block-scalar"){let G=$.props[0];if(G.type!=="block-scalar-header")throw Error("Invalid block scalar header");G.source=V,$.source=U}else{let{offset:G}=$,z="indent"in $?$.indent:-1,i=[{type:"block-scalar-header",offset:G,indent:z,source:V}];if(!Qu(i,"end"in $?$.end:void 0))i.push({type:"newline",offset:-1,indent:z,source:`
|
|
144
|
+
`});for(let N of Object.keys($))if(N!=="type"&&N!=="offset")delete $[N];Object.assign($,{type:"block-scalar",indent:z,props:i,source:U})}}function Qu($,w){if(w)for(let J of w)switch(J.type){case"space":case"comment":$.push(J);break;case"newline":return $.push(J),!0}return!1}function vY($,w,J){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=J,$.source=w;break;case"block-scalar":{let V=$.props.slice(1),U=w.length;if($.props[0].type==="block-scalar-header")U-=$.props[0].source.length;for(let G of V)G.offset+=U;delete $.props,Object.assign($,{type:J,source:w,end:V});break}case"block-map":case"block-seq":{let U={type:"newline",offset:$.offset+w.length,indent:$.indent,source:`
|
|
145
|
+
`};delete $.items,Object.assign($,{type:J,source:w,end:[U]});break}default:{let V="indent"in $?$.indent:-1,U="end"in $&&Array.isArray($.end)?$.end.filter((G)=>G.type==="space"||G.type==="comment"||G.type==="newline"):[];for(let G of Object.keys($))if(G!=="type"&&G!=="offset")delete $[G];Object.assign($,{type:J,indent:V,source:w,end:U})}}}Vx.createScalarToken=wx;Vx.resolveAsScalar=$x;Vx.setScalarValue=Jx});var Pu=Z((Nx)=>{var Xx=($)=>("type"in $)?Ii($):Wi($);function Ii($){switch($.type){case"block-scalar":{let w="";for(let J of $.props)w+=Ii(J);return w+$.source}case"block-map":case"block-seq":{let w="";for(let J of $.items)w+=Wi(J);return w}case"flow-collection":{let w=$.start.source;for(let J of $.items)w+=Wi(J);for(let J of $.end)w+=J.source;return w}case"document":{let w=Wi($);if($.end)for(let J of $.end)w+=J.source;return w}default:{let w=$.source;if("end"in $&&$.end)for(let J of $.end)w+=J.source;return w}}}function Wi({start:$,key:w,sep:J,value:V}){let U="";for(let G of $)U+=G.source;if(w)U+=Ii(w);if(J)for(let G of J)U+=G.source;if(V)U+=Ii(V);return U}Nx.stringify=Xx});var Bu=Z((gx)=>{var QY=Symbol("break visit"),Ix=Symbol("skip children"),Ku=Symbol("remove item");function Zw($,w){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};uu(Object.freeze([]),$,w)}Zw.BREAK=QY;Zw.SKIP=Ix;Zw.REMOVE=Ku;Zw.itemAtPath=($,w)=>{let J=$;for(let[V,U]of w){let G=J?.[V];if(G&&"items"in G)J=G.items[U];else return}return J};Zw.parentCollection=($,w)=>{let J=Zw.itemAtPath($,w.slice(0,-1)),V=w[w.length-1][0],U=J?.[V];if(U&&"items"in U)return U;throw Error("Parent collection not found")};function uu($,w,J){let V=J(w,$);if(typeof V==="symbol")return V;for(let U of["key","value"]){let G=w[U];if(G&&"items"in G){for(let z=0;z<G.items.length;++z){let i=uu(Object.freeze($.concat([[U,z]])),G.items[z],J);if(typeof i==="number")z=i-1;else if(i===QY)return QY;else if(i===Ku)G.items.splice(z,1),z-=1}if(typeof V==="function"&&U==="key")V=V(w,$)}}return typeof V==="function"?V(w,$):V}gx.visit=Zw});var gi=Z((Bx)=>{var OY=Ou(),vx=Pu(),Qx=Bu(),PY="\uFEFF",KY="\x02",uY="\x18",BY="\x1F",Ox=($)=>!!$&&("items"in $),Px=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function Kx($){switch($){case PY:return"<BOM>";case KY:return"<DOC>";case uY:return"<FLOW_END>";case BY:return"<SCALAR>";default:return JSON.stringify($)}}function ux($){switch($){case PY:return"byte-order-mark";case KY:return"doc-mode";case uY:return"flow-error-end";case BY:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
142
146
|
`:case`\r
|
|
143
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch($[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}
|
|
144
|
-
`:case"\r":case"\t":return!0;default:return!1}}var
|
|
145
|
-
\r `),
|
|
147
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch($[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Bx.createScalarToken=OY.createScalarToken;Bx.resolveAsScalar=OY.resolveAsScalar;Bx.setScalarValue=OY.setScalarValue;Bx.stringify=vx.stringify;Bx.visit=Qx.visit;Bx.BOM=PY;Bx.DOCUMENT=KY;Bx.FLOW_END=uY;Bx.SCALAR=BY;Bx.isCollection=Ox;Bx.isScalar=Px;Bx.prettyToken=Kx;Bx.tokenType=ux});var FY=Z((Ex)=>{var h0=gi();function P4($){switch($){case void 0:case" ":case`
|
|
148
|
+
`:case"\r":case"\t":return!0;default:return!1}}var Hu=new Set("0123456789ABCDEFabcdef"),Rx=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Yi=new Set(",[]{}"),bx=new Set(` ,[]{}
|
|
149
|
+
\r `),HY=($)=>!$||bx.has($);class Fu{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex($,w=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!w;let J=this.next??"stream";while(J&&(w||this.hasChars(1)))J=yield*this.parseNext(J)}atLineEnd(){let $=this.pos,w=this.buffer[$];while(w===" "||w==="\t")w=this.buffer[++$];if(!w||w==="#"||w===`
|
|
146
150
|
`)return!0;if(w==="\r")return this.buffer[$+1]===`
|
|
147
|
-
`;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let w=this.buffer[$];if(this.indentNext>0){let
|
|
148
|
-
`||!
|
|
149
|
-
`||
|
|
150
|
-
`,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let $=this.getLine();if($===null)return this.setNext("stream");if($[0]===
|
|
151
|
-
`,this.pos);if(
|
|
152
|
-
`,
|
|
153
|
-
`:$=
|
|
154
|
-
`)break}default:break $}if(!
|
|
155
|
-
`,
|
|
156
|
-
`)
|
|
157
|
-
`&&
|
|
158
|
-
`)
|
|
159
|
-
`,
|
|
160
|
-
`){let
|
|
151
|
+
`;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let w=this.buffer[$];if(this.indentNext>0){let J=0;while(w===" ")w=this.buffer[++J+$];if(w==="\r"){let V=this.buffer[J+$+1];if(V===`
|
|
152
|
+
`||!V&&!this.atEnd)return $+J+1}return w===`
|
|
153
|
+
`||J>=this.indentNext||!w&&!this.atEnd?$+J:-1}if(w==="-"||w==="."){let J=this.buffer.substr($,3);if((J==="---"||J==="...")&&P4(this.buffer[$+3]))return-1}return $}getLine(){let $=this.lineEndPos;if(typeof $!=="number"||$!==-1&&$<this.pos)$=this.buffer.indexOf(`
|
|
154
|
+
`,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let $=this.getLine();if($===null)return this.setNext("stream");if($[0]===h0.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let w=$.length,J=$.indexOf("#");while(J!==-1){let U=$[J-1];if(U===" "||U==="\t"){w=J-1;break}else J=$.indexOf("#",J+1)}while(!0){let U=$[w-1];if(U===" "||U==="\t")w-=1;else break}let V=(yield*this.pushCount(w))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-V),this.pushNewline(),"stream"}if(this.atLineEnd()){let w=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-w),yield*this.pushNewline(),"stream"}return yield h0.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let $=this.charAt(0);if(!$&&!this.atEnd)return this.setNext("line-start");if($==="-"||$==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let w=this.peek(3);if((w==="---"||w==="...")&&P4(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,w==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!P4(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[$,w]=this.peek(2);if(!w&&!this.atEnd)return this.setNext("block-start");if(($==="-"||$==="?"||$===":")&&P4(w)){let J=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=J,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let $=this.getLine();if($===null)return this.setNext("doc");let w=yield*this.pushIndicators();switch($[w]){case"#":yield*this.pushCount($.length-w);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(HY),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return w+=yield*this.parseBlockScalarHeader(),w+=yield*this.pushSpaces(!0),yield*this.pushCount($.length-w),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let $,w,J=-1;do{if($=yield*this.pushNewline(),$>0)w=yield*this.pushSpaces(!1),this.indentValue=J=w;else w=0;w+=yield*this.pushSpaces(!0)}while($+w>0);let V=this.getLine();if(V===null)return this.setNext("flow");if(J!==-1&&J<this.indentNext&&V[0]!=="#"||J===0&&(V.startsWith("---")||V.startsWith("..."))&&P4(V[3])){if(!(J===this.indentNext-1&&this.flowLevel===1&&(V[0]==="]"||V[0]==="}")))return this.flowLevel=0,yield h0.FLOW_END,yield*this.parseLineStart()}let U=0;while(V[U]===",")U+=yield*this.pushCount(1),U+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(U+=yield*this.pushIndicators(),V[U]){case void 0:return"flow";case"#":return yield*this.pushCount(V.length-U),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(HY),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let G=this.charAt(1);if(this.flowKey||P4(G)||G===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),w=this.buffer.indexOf($,this.pos+1);if($==="'")while(w!==-1&&this.buffer[w+1]==="'")w=this.buffer.indexOf("'",w+2);else while(w!==-1){let U=0;while(this.buffer[w-1-U]==="\\")U+=1;if(U%2===0)break;w=this.buffer.indexOf('"',w+1)}let J=this.buffer.substring(0,w),V=J.indexOf(`
|
|
155
|
+
`,this.pos);if(V!==-1){while(V!==-1){let U=this.continueScalar(V+1);if(U===-1)break;V=J.indexOf(`
|
|
156
|
+
`,U)}if(V!==-1)w=V-(J[V-1]==="\r"?2:1)}if(w===-1){if(!this.atEnd)return this.setNext("quoted-scalar");w=this.buffer.length}return yield*this.pushToIndex(w+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let w=this.buffer[++$];if(w==="+")this.blockScalarKeep=!0;else if(w>"0"&&w<="9")this.blockScalarIndent=Number(w)-1;else if(w!=="-")break}return yield*this.pushUntil((w)=>P4(w)||w==="#")}*parseBlockScalar(){let $=this.pos-1,w=0,J;$:for(let U=this.pos;J=this.buffer[U];++U)switch(J){case" ":w+=1;break;case`
|
|
157
|
+
`:$=U,w=0;break;case"\r":{let G=this.buffer[U+1];if(!G&&!this.atEnd)return this.setNext("block-scalar");if(G===`
|
|
158
|
+
`)break}default:break $}if(!J&&!this.atEnd)return this.setNext("block-scalar");if(w>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=w;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let U=this.continueScalar($+1);if(U===-1)break;$=this.buffer.indexOf(`
|
|
159
|
+
`,U)}while($!==-1);if($===-1){if(!this.atEnd)return this.setNext("block-scalar");$=this.buffer.length}}let V=$+1;J=this.buffer[V];while(J===" ")J=this.buffer[++V];if(J==="\t"){while(J==="\t"||J===" "||J==="\r"||J===`
|
|
160
|
+
`)J=this.buffer[++V];$=V-1}else if(!this.blockScalarKeep)do{let U=$-1,G=this.buffer[U];if(G==="\r")G=this.buffer[--U];let z=U;while(G===" ")G=this.buffer[--U];if(G===`
|
|
161
|
+
`&&U>=this.pos&&U+1+w>z)$=U;else break}while(!0);return yield h0.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,w=this.pos-1,J=this.pos-1,V;while(V=this.buffer[++J])if(V===":"){let U=this.buffer[J+1];if(P4(U)||$&&Yi.has(U))break;w=J}else if(P4(V)){let U=this.buffer[J+1];if(V==="\r")if(U===`
|
|
162
|
+
`)J+=1,V=`
|
|
163
|
+
`,U=this.buffer[J+1];else w=J;if(U==="#"||$&&Yi.has(U))break;if(V===`
|
|
164
|
+
`){let G=this.continueScalar(J+1);if(G===-1)break;J=Math.max(J,G-2)}}else{if($&&Yi.has(V))break;w=J}if(!V&&!this.atEnd)return this.setNext("plain-scalar");return yield h0.SCALAR,yield*this.pushToIndex(w+1,!0),$?"flow":"doc"}*pushCount($){if($>0)return yield this.buffer.substr(this.pos,$),this.pos+=$,$;return 0}*pushToIndex($,w){let J=this.buffer.slice(this.pos,$);if(J)return yield J,this.pos+=J.length,J.length;else if(w)yield"";return 0}*pushIndicators(){let $=0;$:while(!0){switch(this.charAt(0)){case"!":$+=yield*this.pushTag(),$+=yield*this.pushSpaces(!0);continue $;case"&":$+=yield*this.pushUntil(HY),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let w=this.flowLevel>0,J=this.charAt(1);if(P4(J)||w&&Yi.has(J)){if(!w)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;$+=yield*this.pushCount(1),$+=yield*this.pushSpaces(!0);continue $}}}break $}return $}*pushTag(){if(this.charAt(1)==="<"){let $=this.pos+2,w=this.buffer[$];while(!P4(w)&&w!==">")w=this.buffer[++$];return yield*this.pushToIndex(w===">"?$+1:$,!1)}else{let $=this.pos+1,w=this.buffer[$];while(w)if(Rx.has(w))w=this.buffer[++$];else if(w==="%"&&Hu.has(this.buffer[$+1])&&Hu.has(this.buffer[$+2]))w=this.buffer[$+=3];else break;return yield*this.pushToIndex($,!1)}}*pushNewline(){let $=this.buffer[this.pos];if($===`
|
|
161
165
|
`)return yield*this.pushCount(1);else if($==="\r"&&this.charAt(1)===`
|
|
162
|
-
`)return yield*this.pushCount(2);else return 0}*pushSpaces($){let w=this.pos-1,
|
|
166
|
+
`)return yield*this.pushCount(2);else return 0}*pushSpaces($){let w=this.pos-1,J;do J=this.buffer[++w];while(J===" "||$&&J==="\t");let V=w-this.pos;if(V>0)yield this.buffer.substr(this.pos,V),this.pos=w;return V}*pushUntil($){let w=this.pos,J=this.buffer[w];while(!$(J))J=this.buffer[++w];return yield*this.pushToIndex(w,!1)}}Ex.Lexer=Fu});var qY=Z((jx)=>{class qu{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let w=0,J=this.lineStarts.length;while(w<J){let U=w+J>>1;if(this.lineStarts[U]<$)w=U+1;else J=U}if(this.lineStarts[w]===$)return{line:w+1,col:1};if(w===0)return{line:0,col:$};let V=this.lineStarts[w-1];return{line:w,col:$-V+1}}}}jx.LineCounter=qu});var ZY=Z((dx)=>{var rx=b4("process"),Zu=gi(),nx=FY();function R6($,w){for(let J=0;J<$.length;++J)if($[J].type===w)return!0;return!1}function Tu($){for(let w=0;w<$.length;++w)switch($[w].type){case"space":case"comment":case"newline":break;default:return w}return-1}function Lu($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function vi($){switch($.type){case"document":return $.start;case"block-map":{let w=$.items[$.items.length-1];return w.sep??w.start}case"block-seq":return $.items[$.items.length-1].start;default:return[]}}function sJ($){if($.length===0)return[];let w=$.length;$:while(--w>=0)switch($[w].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break $}while($[++w]?.type==="space");return $.splice(w,$.length)}function Qi($,w){if(w.length<1e5)Array.prototype.push.apply($,w);else for(let J=0;J<w.length;++J)$.push(w[J])}function Du($){if($.start.type==="flow-seq-start"){for(let w of $.items)if(w.sep&&!w.value&&!R6(w.start,"explicit-key-ind")&&!R6(w.sep,"map-value-ind")){if(w.key)w.value=w.key;if(delete w.key,Lu(w.value))if(w.value.end)Qi(w.value.end,w.sep);else w.value.end=w.sep;else Qi(w.start,w.sep);delete w.sep}}}class fu{constructor($){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new nx.Lexer,this.onNewLine=$}*parse($,w=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let J of this.lexer.lex($,w))yield*this.next(J);if(!w)yield*this.end()}*next($){if(this.source=$,rx.env.LOG_TOKENS)console.log("|",Zu.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let w=Zu.tokenType($);if(!w){let J=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:J,source:$}),this.offset+=$.length}else if(w==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=w,yield*this.step(),w){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+$.length);break;case"space":if(this.atNewLine&&$[0]===" ")this.indent+=$.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=$.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=$.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let $=this.peek(1);if(this.type==="doc-end"&&$?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!$)return yield*this.stream();switch($.type){case"document":return yield*this.document($);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar($);case"block-scalar":return yield*this.blockScalar($);case"block-map":return yield*this.blockMap($);case"block-seq":return yield*this.blockSequence($);case"flow-collection":return yield*this.flowCollection($);case"doc-end":return yield*this.documentEnd($)}yield*this.pop()}peek($){return this.stack[this.stack.length-$]}*pop($){let w=$??this.stack.pop();if(!w)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield w;else{let J=this.peek(1);if(w.type==="block-scalar")w.indent="indent"in J?J.indent:0;else if(w.type==="flow-collection"&&J.type==="document")w.indent=0;if(w.type==="flow-collection")Du(w);switch(J.type){case"document":J.value=w;break;case"block-scalar":J.props.push(w);break;case"block-map":{let V=J.items[J.items.length-1];if(V.value){J.items.push({start:[],key:w,sep:[]}),this.onKeyLine=!0;return}else if(V.sep)V.value=w;else{Object.assign(V,{key:w,sep:[]}),this.onKeyLine=!V.explicitKey;return}break}case"block-seq":{let V=J.items[J.items.length-1];if(V.value)J.items.push({start:[],value:w});else V.value=w;break}case"flow-collection":{let V=J.items[J.items.length-1];if(!V||V.value)J.items.push({start:[],key:w,sep:[]});else if(V.sep)V.value=w;else Object.assign(V,{key:w,sep:[]});return}default:yield*this.pop(),yield*this.pop(w)}if((J.type==="document"||J.type==="block-map"||J.type==="block-seq")&&(w.type==="block-map"||w.type==="block-seq")){let V=w.items[w.items.length-1];if(V&&!V.sep&&!V.value&&V.start.length>0&&Tu(V.start)===-1&&(w.indent===0||V.start.every((U)=>U.type!=="comment"||U.indent<w.indent))){if(J.type==="document")J.end=V.start;else J.items.push({start:V.start});w.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let $={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")$.start.push(this.sourceToken);this.stack.push($);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document($){if($.value)return yield*this.lineEnd($);switch(this.type){case"doc-start":{if(Tu($.start)!==-1)yield*this.pop(),yield*this.step();else $.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":$.start.push(this.sourceToken);return}let w=this.startBlockValue($);if(w)this.stack.push(w);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar($){if(this.type==="map-value-ind"){let w=vi(this.peek(2)),J=sJ(w),V;if($.end)V=$.end,V.push(this.sourceToken),delete $.end;else V=[this.sourceToken];let U={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:J,key:$,sep:V}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=U}else yield*this.lineEnd($)}*blockScalar($){switch(this.type){case"space":case"comment":case"newline":$.props.push(this.sourceToken);return;case"scalar":if($.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let w=this.source.indexOf(`
|
|
163
167
|
`)+1;while(w!==0)this.onNewLine(this.offset+w),w=this.source.indexOf(`
|
|
164
|
-
`,w)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let w=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,w.value){let
|
|
168
|
+
`,w)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let w=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,w.value){let J="end"in w.value?w.value.end:void 0;if((Array.isArray(J)?J[J.length-1]:void 0)?.type==="comment")J?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(w.sep)w.sep.push(this.sourceToken);else w.start.push(this.sourceToken);return;case"space":case"comment":if(w.value)$.items.push({start:[this.sourceToken]});else if(w.sep)w.sep.push(this.sourceToken);else{if(this.atIndentedComment(w.start,$.indent)){let V=$.items[$.items.length-2]?.value?.end;if(Array.isArray(V)){Qi(V,w.start),V.push(this.sourceToken),$.items.pop();return}}w.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let J=!this.onKeyLine&&this.indent===$.indent,V=J&&(w.sep||w.explicitKey)&&this.type!=="seq-item-ind",U=[];if(V&&w.sep&&!w.value){let G=[];for(let z=0;z<w.sep.length;++z){let i=w.sep[z];switch(i.type){case"newline":G.push(z);break;case"space":break;case"comment":if(i.indent>$.indent)G.length=0;break;default:G.length=0}}if(G.length>=2)U=w.sep.splice(G[1])}switch(this.type){case"anchor":case"tag":if(V||w.value)U.push(this.sourceToken),$.items.push({start:U}),this.onKeyLine=!0;else if(w.sep)w.sep.push(this.sourceToken);else w.start.push(this.sourceToken);return;case"explicit-key-ind":if(!w.sep&&!w.explicitKey)w.start.push(this.sourceToken),w.explicitKey=!0;else if(V||w.value)U.push(this.sourceToken),$.items.push({start:U,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(w.explicitKey)if(!w.sep)if(R6(w.start,"newline"))Object.assign(w,{key:null,sep:[this.sourceToken]});else{let G=sJ(w.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:G,key:null,sep:[this.sourceToken]}]})}else if(w.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(R6(w.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:U,key:null,sep:[this.sourceToken]}]});else if(Lu(w.key)&&!R6(w.sep,"newline")){let G=sJ(w.start),z=w.key,i=w.sep;i.push(this.sourceToken),delete w.key,delete w.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:G,key:z,sep:i}]})}else if(U.length>0)w.sep=w.sep.concat(U,this.sourceToken);else w.sep.push(this.sourceToken);else if(!w.sep)Object.assign(w,{key:null,sep:[this.sourceToken]});else if(w.value||V)$.items.push({start:U,key:null,sep:[this.sourceToken]});else if(R6(w.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else w.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let G=this.flowScalar(this.type);if(V||w.value)$.items.push({start:U,key:G,sep:[]}),this.onKeyLine=!0;else if(w.sep)this.stack.push(G);else Object.assign(w,{key:G,sep:[]}),this.onKeyLine=!0;return}default:{let G=this.startBlockValue($);if(G){if(G.type==="block-seq"){if(!w.explicitKey&&w.sep&&!R6(w.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(J)$.items.push({start:U});this.stack.push(G);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let w=$.items[$.items.length-1];switch(this.type){case"newline":if(w.value){let J="end"in w.value?w.value.end:void 0;if((Array.isArray(J)?J[J.length-1]:void 0)?.type==="comment")J?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else w.start.push(this.sourceToken);return;case"space":case"comment":if(w.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(w.start,$.indent)){let V=$.items[$.items.length-2]?.value?.end;if(Array.isArray(V)){Qi(V,w.start),V.push(this.sourceToken),$.items.pop();return}}w.start.push(this.sourceToken)}return;case"anchor":case"tag":if(w.value||this.indent<=$.indent)break;w.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(w.value||R6(w.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else w.start.push(this.sourceToken);return}if(this.indent>$.indent){let J=this.startBlockValue($);if(J){this.stack.push(J);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let w=$.items[$.items.length-1];if(this.type==="flow-error-end"){let J;do yield*this.pop(),J=this.peek(1);while(J?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!w||w.sep)$.items.push({start:[this.sourceToken]});else w.start.push(this.sourceToken);return;case"map-value-ind":if(!w||w.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(w.sep)w.sep.push(this.sourceToken);else Object.assign(w,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!w||w.value)$.items.push({start:[this.sourceToken]});else if(w.sep)w.sep.push(this.sourceToken);else w.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let V=this.flowScalar(this.type);if(!w||w.value)$.items.push({start:[],key:V,sep:[]});else if(w.sep)this.stack.push(V);else Object.assign(w,{key:V,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let J=this.startBlockValue($);if(J)this.stack.push(J);else yield*this.pop(),yield*this.step()}else{let J=this.peek(2);if(J.type==="block-map"&&(this.type==="map-value-ind"&&J.indent===$.indent||this.type==="newline"&&!J.items[J.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&J.type!=="flow-collection"){let V=vi(J),U=sJ(V);Du($);let G=$.end.splice(1,$.end.length);G.push(this.sourceToken);let z={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:U,key:$,sep:G}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=z}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let w=this.source.indexOf(`
|
|
165
169
|
`)+1;while(w!==0)this.onNewLine(this.offset+w),w=this.source.indexOf(`
|
|
166
|
-
`,w)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let w=w2($),U=YU(w);return U.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:U,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let w=w2($),U=YU(w);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:U,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,w){if(this.type!=="comment")return!1;if(this.indent<=w)return!1;return $.every((U)=>U.type==="newline"||U.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}YM.Parser=h5});var p5=E((KM)=>{var c5=v8(),PM=mJ(),oJ=nJ(),OM=YN(),BM=t(),qM=Y8(),l5=Q8();function t5($){let w=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||w&&new qM.LineCounter||null,prettyErrors:w}}function LM($,w={}){let{lineCounter:U,prettyErrors:v}=t5(w),J=new l5.Parser(U?.addNewLine),z=new c5.Composer(w),g=Array.from(z.compose(J.parse($)));if(v&&U)for(let V of g)V.errors.forEach(oJ.prettifyError($,U)),V.warnings.forEach(oJ.prettifyError($,U));if(g.length>0)return g;return Object.assign([],{empty:!0},z.streamInfo())}function o5($,w={}){let{lineCounter:U,prettyErrors:v}=t5(w),J=new l5.Parser(U?.addNewLine),z=new c5.Composer(w),g=null;for(let V of z.compose(J.parse($),!0,$.length))if(!g)g=V;else if(g.options.logLevel!=="silent"){g.errors.push(new oJ.YAMLParseError(V.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(v&&U)g.errors.forEach(oJ.prettifyError($,U)),g.warnings.forEach(oJ.prettifyError($,U));return g}function HM($,w,U){let v=void 0;if(typeof w==="function")v=w;else if(U===void 0&&w&&typeof w==="object")U=w;let J=o5($,U);if(!J)return null;if(J.warnings.forEach((z)=>OM.warn(J.options.logLevel,z)),J.errors.length>0)if(J.options.logLevel!=="silent")throw J.errors[0];else J.errors=[];return J.toJS(Object.assign({reviver:v},U))}function uM($,w,U){let v=null;if(typeof w==="function"||Array.isArray(w))v=w;else if(U===void 0&&w)U=w;if(typeof U==="string")U=U.length;if(typeof U==="number"){let J=Math.round(U);U=J<1?void 0:J>8?{indent:8}:{indent:J}}if($===void 0){let{keepUndefined:J}=U??w??{};if(!J)return}if(BM.isDocument($)&&!v)return $.toString(U);return new PM.Document($,v,U).toString(U)}KM.parse=HM;KM.parseAllDocuments=LM;KM.parseDocument=o5;KM.stringify=uM});var p8=r7(o8(),1),{program:cE,createCommand:lE,createArgument:tE,createOption:oE,CommanderError:pE,InvalidArgumentError:aE,InvalidOptionArgumentError:eE,Command:a8,Argument:sE,Option:$S,Help:wS}=p8.default;import{existsSync as B3,statSync as RB}from"node:fs";import{mkdir as kB,readFile as CB,writeFile as q3}from"node:fs/promises";import{basename as P3,dirname as jB,extname as xB,join as Ug,parse as rB}from"node:path";function j($,w,U,v,J){if(v==="m")throw TypeError("Private method is not writable");if(v==="a"&&!J)throw TypeError("Private accessor was defined without a setter");if(typeof w==="function"?$!==w||!J:!w.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return v==="a"?J.call($,U):J?J.value=U:w.set($,U),U}function q($,w,U,v){if(U==="a"&&!v)throw TypeError("Private accessor was defined without a getter");if(typeof w==="function"?$!==w||!v:!w.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return U==="m"?v:U==="a"?v.call($):v?v.value:w.get($)}var L2=function(){let{crypto:$}=globalThis;if($?.randomUUID)return L2=$.randomUUID.bind($),$.randomUUID();let w=new Uint8Array(1),U=$?()=>$.getRandomValues(w)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(v)=>(+v^U()&15>>+v/4).toString(16))};function PU($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var OU=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let w=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)w.stack=$.stack;if($.cause&&!w.cause)w.cause=$.cause;if($.name)w.name=$.name;return w}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};class i extends Error{}class v$ extends i{constructor($,w,U,v){super(`${v$.makeMessage($,w,U)}`);this.status=$,this.headers=v,this.requestID=v?.get("x-request-id"),this.error=w;let J=w;this.code=J?.code,this.param=J?.param,this.type=J?.type}static makeMessage($,w,U){let v=w?.message?typeof w.message==="string"?w.message:JSON.stringify(w.message):w?JSON.stringify(w):U;if($&&v)return`${$} ${v}`;if($)return`${$} status code (no body)`;if(v)return v;return"(no status code or body)"}static generate($,w,U,v){if(!$||!v)return new g6({message:U,cause:OU(w)});let J=w?.error;if($===400)return new BU($,J,U,v);if($===401)return new qU($,J,U,v);if($===403)return new LU($,J,U,v);if($===404)return new HU($,J,U,v);if($===409)return new uU($,J,U,v);if($===422)return new KU($,J,U,v);if($===429)return new DU($,J,U,v);if($>=500)return new fU($,J,U,v);return new v$($,J,U,v)}}class _$ extends v${constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class g6 extends v${constructor({message:$,cause:w}){super(void 0,void 0,$||"Connection error.",void 0);if(w)this.cause=w}}class V6 extends g6{constructor({message:$}={}){super({message:$??"Request timed out."})}}class BU extends v${}class qU extends v${}class LU extends v${}class HU extends v${}class uU extends v${}class KU extends v${}class DU extends v${}class fU extends v${}class TU extends i{constructor(){super("Could not parse response content as the length limit was reached")}}class ZU extends i{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}class O4 extends Error{constructor($){super($)}}class l6 extends v${constructor($,w,U){let v="OAuth2 authentication error",J=void 0;if(w&&typeof w==="object"){let z=w;J=z.error;let g=z.error_description;if(g&&typeof g==="string")v=g;else if(J)v=J}super($,w,v,U);this.error_code=J}}class w0 extends i{constructor($,w,U){super($);this.provider=w,this.cause=U}}var RP=/^[a-z][a-z0-9+.-]*:/i,e8=($)=>{return RP.test($)},B$=($)=>(B$=Array.isArray,B$($)),H2=B$;function U0($){if(typeof $!=="object")return{};return $??{}}function u2($){if(!$)return!0;for(let w in $)return!1;return!0}function s8($,w){return Object.prototype.hasOwnProperty.call($,w)}function bU($){return $!=null&&typeof $==="object"&&!Array.isArray($)}var $W=($,w)=>{if(typeof w!=="number"||!Number.isInteger(w))throw new i(`${$} must be an integer`);if(w<0)throw new i(`${$} must be a positive integer`);return w};var wW=($)=>{try{return JSON.parse($)}catch(w){return}};var U4=($)=>new Promise((w)=>setTimeout(w,$));var i4="6.45.0";var zW=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"};function kP(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var CP=()=>{let $=kP();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i4,"X-Stainless-OS":JW(Deno.build.os),"X-Stainless-Arch":UW(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i4,"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":i4,"X-Stainless-OS":JW(globalThis.process.platform??"unknown"),"X-Stainless-Arch":UW(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let w=jP();if(w)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i4,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${w.browser}`,"X-Stainless-Runtime-Version":w.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i4,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function jP(){if(typeof navigator>"u"||!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:w,pattern:U}of $){let v=U.exec(navigator.userAgent);if(v){let J=v[1]||0,z=v[2]||0,g=v[3]||0;return{browser:w,version:`${J}.${z}.${g}`}}}return null}var UW=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},JW=($)=>{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"},vW,gW=()=>{return vW??(vW=CP())};function J0(){if(typeof fetch<"u")return fetch;throw 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 K2(...$){let w=globalThis.ReadableStream;if(typeof w>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new w(...$)}function v0($){let w=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return K2({start(){},async pull(U){let{done:v,value:J}=await w.next();if(v)U.close();else U.enqueue(J)},async cancel(){await w.return?.()}})}function D2($){if($[Symbol.asyncIterator])return $;let w=$.getReader();return{async next(){try{let U=await w.read();if(U?.done)w.releaseLock();return U}catch(U){throw w.releaseLock(),U}},async return(){let U=w.cancel();return w.releaseLock(),await U,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function f2($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let w=$.getReader(),U=w.cancel();w.releaseLock(),await U}var GW=({headers:$,body:w})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(w)}};var T2="RFC3986",Z2=($)=>String($),b2={RFC1738:($)=>String($).replace(/%20/g,"+"),RFC3986:Z2},_W="RFC1738";var z0=($,w)=>(z0=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),z0($,w)),J4=(()=>{let $=[];for(let w=0;w<256;++w)$.push("%"+((w<16?"0":"")+w.toString(16)).toUpperCase());return $})();var F2=1024,XW=($,w,U,v,J)=>{if($.length===0)return $;let z=$;if(typeof $==="symbol")z=Symbol.prototype.toString.call($);else if(typeof $!=="string")z=String($);if(U==="iso-8859-1")return escape(z).replace(/%u[0-9a-f]{4}/gi,function(V){return"%26%23"+parseInt(V.slice(2),16)+"%3B"});let g="";for(let V=0;V<z.length;V+=F2){let _=z.length>=F2?z.slice(V,V+F2):z,G=[];for(let X=0;X<_.length;++X){let I=_.charCodeAt(X);if(I===45||I===46||I===95||I===126||I>=48&&I<=57||I>=65&&I<=90||I>=97&&I<=122||J===_W&&(I===40||I===41)){G[G.length]=_.charAt(X);continue}if(I<128){G[G.length]=J4[I];continue}if(I<2048){G[G.length]=J4[192|I>>6]+J4[128|I&63];continue}if(I<55296||I>=57344){G[G.length]=J4[224|I>>12]+J4[128|I>>6&63]+J4[128|I&63];continue}X+=1,I=65536+((I&1023)<<10|_.charCodeAt(X)&1023),G[G.length]=J4[240|I>>18]+J4[128|I>>12&63]+J4[128|I>>6&63]+J4[128|I&63]}g+=G.join("")}return g};function IW($){if(!$||typeof $!=="object")return!1;return!!($.constructor&&$.constructor.isBuffer&&$.constructor.isBuffer($))}function M2($,w){if(B$($)){let U=[];for(let v=0;v<$.length;v+=1)U.push(w($[v]));return U}return w($)}var WW={brackets($){return String($)+"[]"},comma:"comma",indices($,w){return String($)+"["+w+"]"},repeat($){return String($)}},YW=function($,w){Array.prototype.push.apply($,B$(w)?w:[w])},NW,X$={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:XW,encodeValuesOnly:!1,format:T2,formatter:Z2,indices:!1,serializeDate($){return(NW??(NW=Function.prototype.call.bind(Date.prototype.toISOString)))($)},skipNulls:!1,strictNullHandling:!1};function rP($){return typeof $==="string"||typeof $==="number"||typeof $==="boolean"||typeof $==="symbol"||typeof $==="bigint"}var i2={};function QW($,w,U,v,J,z,g,V,_,G,X,I,N,W,P,Q,H,Z){let u=$,b=Z,M=0,S=!1;while((b=b.get(i2))!==void 0&&!S){let h=b.get($);if(M+=1,typeof h<"u")if(h===M)throw RangeError("Cyclic object value");else S=!0;if(typeof b.get(i2)>"u")M=0}if(typeof G==="function")u=G(w,u);else if(u instanceof Date)u=N?.(u);else if(U==="comma"&&B$(u))u=M2(u,function(h){if(h instanceof Date)return N?.(h);return h});if(u===null){if(z)return _&&!Q?_(w,X$.encoder,H,"key",W):w;u=""}if(rP(u)||IW(u)){if(_){let h=Q?w:_(w,X$.encoder,H,"key",W);return[P?.(h)+"="+P?.(_(u,X$.encoder,H,"value",W))]}return[P?.(w)+"="+P?.(String(u))]}let k=[];if(typeof u>"u")return k;let x;if(U==="comma"&&B$(u)){if(Q&&_)u=M2(u,_);x=[{value:u.length>0?u.join(",")||null:void 0}]}else if(B$(G))x=G;else{let h=Object.keys(u);x=X?h.sort(X):h}let A=V?String(w).replace(/\./g,"%2E"):String(w),a=v&&B$(u)&&u.length===1?A+"[]":A;if(J&&B$(u)&&u.length===0)return a+"[]";for(let h=0;h<x.length;++h){let K$=x[h],z$=typeof K$==="object"&&typeof K$.value<"u"?K$.value:u[K$];if(g&&z$===null)continue;let c6=I&&V?K$.replace(/\./g,"%2E"):K$,E7=B$(u)?typeof U==="function"?U(a,c6):a:a+(I?"."+c6:"["+c6+"]");Z.set($,M);let S8=new WeakMap;S8.set(i2,Z),YW(k,QW(z$,E7,U,v,J,z,g,V,U==="comma"&&Q&&B$(u)?null:_,G,X,I,N,W,P,Q,H,S8))}return k}function yP($=X$){if(typeof $.allowEmptyArrays<"u"&&typeof $.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof $.encodeDotInKeys<"u"&&typeof $.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if($.encoder!==null&&typeof $.encoder<"u"&&typeof $.encoder!=="function")throw TypeError("Encoder has to be a function.");let w=$.charset||X$.charset;if(typeof $.charset<"u"&&$.charset!=="utf-8"&&$.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let U=T2;if(typeof $.format<"u"){if(!z0(b2,$.format))throw TypeError("Unknown format option provided.");U=$.format}let v=b2[U],J=X$.filter;if(typeof $.filter==="function"||B$($.filter))J=$.filter;let z;if($.arrayFormat&&$.arrayFormat in WW)z=$.arrayFormat;else if("indices"in $)z=$.indices?"indices":"repeat";else z=X$.arrayFormat;if("commaRoundTrip"in $&&typeof $.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");let g=typeof $.allowDots>"u"?!!$.encodeDotInKeys===!0?!0:X$.allowDots:!!$.allowDots;return{addQueryPrefix:typeof $.addQueryPrefix==="boolean"?$.addQueryPrefix:X$.addQueryPrefix,allowDots:g,allowEmptyArrays:typeof $.allowEmptyArrays==="boolean"?!!$.allowEmptyArrays:X$.allowEmptyArrays,arrayFormat:z,charset:w,charsetSentinel:typeof $.charsetSentinel==="boolean"?$.charsetSentinel:X$.charsetSentinel,commaRoundTrip:!!$.commaRoundTrip,delimiter:typeof $.delimiter>"u"?X$.delimiter:$.delimiter,encode:typeof $.encode==="boolean"?$.encode:X$.encode,encodeDotInKeys:typeof $.encodeDotInKeys==="boolean"?$.encodeDotInKeys:X$.encodeDotInKeys,encoder:typeof $.encoder==="function"?$.encoder:X$.encoder,encodeValuesOnly:typeof $.encodeValuesOnly==="boolean"?$.encodeValuesOnly:X$.encodeValuesOnly,filter:J,format:U,formatter:v,serializeDate:typeof $.serializeDate==="function"?$.serializeDate:X$.serializeDate,skipNulls:typeof $.skipNulls==="boolean"?$.skipNulls:X$.skipNulls,sort:typeof $.sort==="function"?$.sort:null,strictNullHandling:typeof $.strictNullHandling==="boolean"?$.strictNullHandling:X$.strictNullHandling}}function PW($,w={}){let U=$,v=yP(w),J,z;if(typeof v.filter==="function")z=v.filter,U=z("",U);else if(B$(v.filter))z=v.filter,J=z;let g=[];if(typeof U!=="object"||U===null)return"";let V=WW[v.arrayFormat],_=V==="comma"&&v.commaRoundTrip;if(!J)J=Object.keys(U);if(v.sort)J.sort(v.sort);let G=new WeakMap;for(let N=0;N<J.length;++N){let W=J[N];if(v.skipNulls&&U[W]===null)continue;YW(g,QW(U[W],W,V,_,v.allowEmptyArrays,v.strictNullHandling,v.skipNulls,v.encodeDotInKeys,v.encode?v.encoder:null,v.filter,v.sort,v.allowDots,v.serializeDate,v.format,v.formatter,v.encodeValuesOnly,v.charset,G))}let X=g.join(v.delimiter),I=v.addQueryPrefix===!0?"?":"";if(v.charsetSentinel)if(v.charset==="iso-8859-1")I+="utf8=%26%2310003%3B&";else I+="utf8=%E2%9C%93&";return X.length>0?I+X:""}function OW($){return PW($,{arrayFormat:"brackets"})}function LW($){let w=0;for(let J of $)w+=J.length;let U=new Uint8Array(w),v=0;for(let J of $)U.set(J,v),v+=J.length;return U}var BW;function t6($){let w;return(BW??(w=new globalThis.TextEncoder,BW=w.encode.bind(w)))($)}var qW;function E2($){let w;return(qW??(w=new globalThis.TextDecoder,qW=w.decode.bind(w)))($)}var A$,R$;class o6{constructor(){A$.set(this,void 0),R$.set(this,void 0),j(this,A$,new Uint8Array,"f"),j(this,R$,null,"f")}decode($){if($==null)return[];let w=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?t6($):$;j(this,A$,LW([q(this,A$,"f"),w]),"f");let U=[],v;while((v=mP(q(this,A$,"f"),q(this,R$,"f")))!=null){if(v.carriage&&q(this,R$,"f")==null){j(this,R$,v.index,"f");continue}if(q(this,R$,"f")!=null&&(v.index!==q(this,R$,"f")+1||v.carriage)){U.push(E2(q(this,A$,"f").subarray(0,q(this,R$,"f")-1))),j(this,A$,q(this,A$,"f").subarray(q(this,R$,"f")),"f"),j(this,R$,null,"f");continue}let J=q(this,R$,"f")!==null?v.preceding-1:v.preceding,z=E2(q(this,A$,"f").subarray(0,J));U.push(z),j(this,A$,q(this,A$,"f").subarray(v.index),"f"),j(this,R$,null,"f")}return U}flush(){if(!q(this,A$,"f").length)return[];return this.decode(`
|
|
167
|
-
`)}}
|
|
168
|
-
`,"\r"]);
|
|
169
|
-
`);
|
|
170
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],J}if(this.chunks.push($),$.startsWith(":"))return null;let[w,U,v]=lP($,":");if(v.startsWith(" "))v=v.substring(1);if(w==="event")this.event=v;else if(w==="data")this.data.push(v);return null}}function lP($,w){let U=$.indexOf(w);if(U!==-1)return[$.substring(0,U),w,$.substring(U+w.length)];return[$,"",""]}async function G0($,w){let{response:U,requestLogID:v,retryOfRequestLogID:J,startTime:z}=w,g=await(async()=>{if(w.options.stream){if(V$($).debug("response",U.status,U.url,U.headers,U.body),w.options.__streamClass)return w.options.__streamClass.fromSSEResponse(U,w.controller,$,w.options.__synthesizeEventData);return k$.fromSSEResponse(U,w.controller,$,w.options.__synthesizeEventData)}if(U.status===204)return null;if(w.options.__binaryResponse)return U;let _=U.headers.get("content-type")?.split(";")[0]?.trim();if(_?.includes("application/json")||_?.endsWith("+json")){if(U.headers.get("content-length")==="0")return;let N=await U.json();return A2(N,U)}return await U.text()})();return V$($).debug(`[${v}] response parsed`,B4({retryOfRequestLogID:J,url:U.url,status:U.status,body:g,durationMs:Date.now()-z})),g}function A2($,w){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:w.headers.get("x-request-id"),enumerable:!1})}var iU;class G6 extends Promise{constructor($,w,U=G0){super((v)=>{v(null)});this.responsePromise=w,this.parseResponse=U,iU.set(this,void 0),j(this,iU,$,"f")}_thenUnwrap($){return new G6(q(this,iU,"f"),this.responsePromise,async(w,U)=>A2($(await this.parseResponse(w,U),U),U.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,w]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:w,request_id:w.headers.get("x-request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(q(this,iU,"f"),$));return this.parsedPromise}then($,w){return this.parse().then($,w)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}}iU=new WeakMap;var _0;class EU{constructor($,w,U,v){_0.set(this,void 0),j(this,_0,$,"f"),this.options=v,this.response=w,this.body=U}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new i("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await q(this,_0,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(_0=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let w of $.getPaginatedItems())yield w}}class X0 extends G6{constructor($,w,U){super($,w,async(v,J)=>new U(v,J.response,await G0(v,J),J.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let w of $)yield w}}class D$ extends EU{constructor($,w,U,v){super($,w,U,v);this.data=U.data||[],this.object=U.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}}class y extends EU{constructor($,w,U,v){super($,w,U,v);this.data=U.data||[],this.has_more=U.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let $=this.getPaginatedItems(),w=$[$.length-1]?.id;if(!w)return null;return{...this.options,query:{...U0(this.options.query),after:w}}}}class l extends EU{constructor($,w,U,v){super($,w,U,v);this.data=U.data||[],this.has_more=U.has_more||!1,this.last_id=U.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let $=this.last_id;if(!$)return null;return{...this.options,query:{...U0(this.options.query),after:$}}}}class I$ extends EU{constructor($,w,U,v){super($,w,U,v);this.data=U.data||[],this.has_more=U.has_more||!1,this.next=U.next||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let $=this.next;if(!$)return null;return{...this.options,query:{...U0(this.options.query),after:$}}}}var oP={jwt:"urn:ietf:params:oauth:token-type:jwt",id:"urn:ietf:params:oauth:token-type:id_token"},pP="urn:ietf:params:oauth:grant-type:token-exchange";class R2{constructor($,w){this.cachedToken=null,this.refreshPromise=null,this.tokenExchangeUrl="https://auth.openai.com/oauth/token",this.config=$,this.fetch=w??J0()}async getToken(){if(!this.cachedToken||this.isTokenExpired(this.cachedToken)){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.refreshToken();try{return await this.refreshPromise}finally{this.refreshPromise=null}}if(this.needsRefresh(this.cachedToken)&&!this.refreshPromise)this.refreshPromise=this.refreshToken().finally(()=>{this.refreshPromise=null});return this.cachedToken.token}async refreshToken(){let $=await this.config.provider.getToken(),w={grant_type:pP,subject_token:$,subject_token_type:oP[this.config.provider.tokenType],identity_provider_id:this.config.identityProviderId,service_account_id:this.config.serviceAccountId};if(this.config.clientId)w.client_id=this.config.clientId;let U=await this.fetch(this.tokenExchangeUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!U.ok){let V=await U.text(),_=void 0;try{_=JSON.parse(V)}catch{}if(U.status===400||U.status===401||U.status===403)throw new l6(U.status,_,U.headers);throw v$.generate(U.status,_,`Token exchange failed with status ${U.status}`,U.headers)}let v=await U.json();if(typeof v!=="object"||v===null||!("access_token"in v)||typeof v.access_token!=="string"||v.access_token.trim().length===0)throw new i("Token exchange response missing 'access_token' field");let J=v.access_token,z=v.expires_in??3600,g=Date.now()+z*1000;return this.cachedToken={token:J,expiresAt:g},J}isTokenExpired($){return Date.now()>=$.expiresAt}needsRefresh($){let U=(this.config.refreshBufferSeconds??1200)*1000;return Date.now()>=$.expiresAt-U}invalidateToken(){this.cachedToken=null,this.refreshPromise=null}}var j2=()=>{if(typeof File>"u"){let{process:$}=globalThis,w=typeof $?.versions?.node==="string"&&parseInt($.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(w?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function p6($,w,U){return j2(),new File($,w??"unknown_file",U)}function SU($){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 I0=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",E4=async($,w)=>{if(!k2($.body))return $;return{...$,body:await fW($.body,w)}},q$=async($,w)=>{return{...$,body:await fW($.body,w)}},DW=new WeakMap;function aP($){let w=typeof $==="function"?$:$.fetch,U=DW.get(w);if(U)return U;let v=(async()=>{try{let J="Response"in w?w.Response:(await w("data:,")).constructor,z=new FormData;if(z.toString()===await new J(z).text())return!1;return!0}catch{return!0}})();return DW.set(w,v),v}var fW=async($,w)=>{if(!await aP(w))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let U=new FormData;return await Promise.all(Object.entries($||{}).map(([v,J])=>C2(U,v,J))),U},TW=($)=>$ instanceof Blob&&("name"in $),eP=($)=>typeof $==="object"&&$!==null&&($ instanceof Response||I0($)||TW($)),k2=($)=>{if(eP($))return!0;if(Array.isArray($))return $.some(k2);if($&&typeof $==="object"){for(let w in $)if(k2($[w]))return!0}return!1},C2=async($,w,U)=>{if(U===void 0)return;if(U==null)throw TypeError(`Received null for "${w}"; to pass null in FormData, you must use the string 'null'`);if(typeof U==="string"||typeof U==="number"||typeof U==="boolean")$.append(w,String(U));else if(U instanceof Response)$.append(w,p6([await U.blob()],SU(U)));else if(I0(U))$.append(w,p6([await new Response(v0(U)).blob()],SU(U)));else if(TW(U))$.append(w,U,SU(U));else if(Array.isArray(U))await Promise.all(U.map((v)=>C2($,w+"[]",v)));else if(typeof U==="object")await Promise.all(Object.entries(U).map(([v,J])=>C2($,`${w}[${v}]`,J)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${U} instead`)};var ZW=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",sP=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&ZW($),$O=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";async function a6($,w,U){if(j2(),$=await $,sP($)){if($ instanceof File)return $;return p6([await $.arrayBuffer()],$.name)}if($O($)){let J=await $.blob();return w||(w=new URL($.url).pathname.split(/[\\/]/).pop()),p6(await x2(J),w,U)}let v=await x2($);if(w||(w=SU($)),!U?.type){let J=v.find((z)=>typeof z==="object"&&("type"in z)&&z.type);if(typeof J==="string")U={...U,type:J}}return p6(v,w,U)}async function x2($){let w=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)w.push($);else if(ZW($))w.push($ instanceof Blob?$:await $.arrayBuffer());else if(I0($))for await(let U of $)w.push(...await x2(U));else{let U=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${U?`; constructor: ${U}`:""}${wO($)}`)}return w}function wO($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((U)=>`"${U}"`).join(", ")}]`}class O{constructor($){this._client=$}}function FW($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var bW=Object.freeze(Object.create(null)),JO=($=FW)=>function(U,...v){if(U.length===1)return U[0];let J=!1,z=[],g=U.reduce((X,I,N)=>{if(/[?#]/.test(I))J=!0;let W=v[N],P=(J?encodeURIComponent:$)(""+W);if(N!==v.length&&(W==null||typeof W==="object"&&W.toString===Object.getPrototypeOf(Object.getPrototypeOf(W.hasOwnProperty??bW)??bW)?.toString))P=W+"",z.push({start:X.length+I.length,length:P.length,error:`Value of type ${Object.prototype.toString.call(W).slice(8,-1)} is not a valid path parameter`});return X+I+(N===v.length?"":P)},""),V=g.split(/[?#]/,1)[0],_=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,G;while((G=_.exec(V))!==null)z.push({start:G.index,length:G[0].length,error:`Value "${G[0]}" can't be safely passed as a path parameter`});if(z.sort((X,I)=>X.start-I.start),z.length>0){let X=0,I=z.reduce((N,W)=>{let P=" ".repeat(W.start-X),Q="^".repeat(W.length);return X=W.start+W.length,N+P+Q},"");throw new i(`Path parameters result in path with invalid segments:
|
|
171
|
-
${
|
|
170
|
+
`,w)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let w=vi($),J=sJ(w);return J.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let w=vi($),J=sJ(w);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,w){if(this.type!=="comment")return!1;if(this.indent<=w)return!1;return $.every((J)=>J.type==="newline"||J.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}dx.Parser=fu});var ku=Z((ax)=>{var Mu=YY(),yx=r0(),c0=n0(),hx=qg(),cx=p(),lx=qY(),Au=ZY();function Su($){let w=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||w&&new lx.LineCounter||null,prettyErrors:w}}function tx($,w={}){let{lineCounter:J,prettyErrors:V}=Su(w),U=new Au.Parser(J?.addNewLine),G=new Mu.Composer(w),z=Array.from(G.compose(U.parse($)));if(V&&J)for(let i of z)i.errors.forEach(c0.prettifyError($,J)),i.warnings.forEach(c0.prettifyError($,J));if(z.length>0)return z;return Object.assign([],{empty:!0},G.streamInfo())}function _u($,w={}){let{lineCounter:J,prettyErrors:V}=Su(w),U=new Au.Parser(J?.addNewLine),G=new Mu.Composer(w),z=null;for(let i of G.compose(U.parse($),!0,$.length))if(!z)z=i;else if(z.options.logLevel!=="silent"){z.errors.push(new c0.YAMLParseError(i.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(V&&J)z.errors.forEach(c0.prettifyError($,J)),z.warnings.forEach(c0.prettifyError($,J));return z}function ox($,w,J){let V=void 0;if(typeof w==="function")V=w;else if(J===void 0&&w&&typeof w==="object")J=w;let U=_u($,J);if(!U)return null;if(U.warnings.forEach((G)=>hx.warn(U.options.logLevel,G)),U.errors.length>0)if(U.options.logLevel!=="silent")throw U.errors[0];else U.errors=[];return U.toJS(Object.assign({reviver:V},J))}function px($,w,J){let V=null;if(typeof w==="function"||Array.isArray(w))V=w;else if(J===void 0&&w)J=w;if(typeof J==="string")J=J.length;if(typeof J==="number"){let U=Math.round(J);J=U<1?void 0:U>8?{indent:8}:{indent:U}}if($===void 0){let{keepUndefined:U}=J??w??{};if(!U)return}if(cx.isDocument($)&&!V)return $.toString(J);return new yx.Document($,V,J).toString(J)}ax.parse=ox;ax.parseAllDocuments=tx;ax.parseDocument=_u;ax.stringify=px});var tY=SY(lY(),1),{program:wd,createCommand:Jd,createArgument:Ud,createOption:Vd,CommanderError:Gd,InvalidArgumentError:zd,InvalidOptionArgumentError:id,Command:oY,Argument:Xd,Option:Nd,Help:Wd}=tY.default;import{existsSync as Ov,statSync as zq}from"node:fs";import{mkdir as iq,readFile as Xq,writeFile as Pv}from"node:fs/promises";import{basename as vv,dirname as Nq,extname as Wq,join as QX,parse as Iq}from"node:path";function x($,w,J,V,U){if(V==="m")throw TypeError("Private method is not writable");if(V==="a"&&!U)throw TypeError("Private accessor was defined without a setter");if(typeof w==="function"?$!==w||!U:!w.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return V==="a"?U.call($,J):U?U.value=J:w.set($,J),J}function B($,w,J,V){if(J==="a"&&!V)throw TypeError("Private accessor was defined without a getter");if(typeof w==="function"?$!==w||!V:!w.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return J==="m"?V:J==="a"?V.call($):V?V.value:w.get($)}var ki=function(){let{crypto:$}=globalThis;if($?.randomUUID)return ki=$.randomUUID.bind($),$.randomUUID();let w=new Uint8Array(1),J=$?()=>$.getRandomValues(w)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(V)=>(+V^J()&15>>+V/4).toString(16))};function UU($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var VU=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let w=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)w.stack=$.stack;if($.cause&&!w.cause)w.cause=$.cause;if($.name)w.name=$.name;return w}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};class R extends Error{}class z$ extends R{constructor($,w,J,V){super(`${z$.makeMessage($,w,J)}`);this.status=$,this.headers=V,this.requestID=V?.get("x-request-id"),this.error=w;let U=w;this.code=U?.code,this.param=U?.param,this.type=U?.type}static makeMessage($,w,J){let V=w?.message?typeof w.message==="string"?w.message:JSON.stringify(w.message):w?JSON.stringify(w):J;if($&&V)return`${$} ${V}`;if($)return`${$} status code (no body)`;if(V)return V;return"(no status code or body)"}static generate($,w,J,V){if(!$||!V)return new C6({message:J,cause:VU(w)});let U=w?.error;if($===400)return new GU($,U,J,V);if($===401)return new zU($,U,J,V);if($===403)return new iU($,U,J,V);if($===404)return new XU($,U,J,V);if($===409)return new NU($,U,J,V);if($===422)return new WU($,U,J,V);if($===429)return new IU($,U,J,V);if($>=500)return new gU($,U,J,V);return new z$($,U,J,V)}}class g$ extends z${constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class C6 extends z${constructor({message:$,cause:w}){super(void 0,void 0,$||"Connection error.",void 0);if(w)this.cause=w}}class j6 extends C6{constructor({message:$}={}){super({message:$??"Request timed out."})}}class GU extends z${}class zU extends z${}class iU extends z${}class XU extends z${}class NU extends z${}class WU extends z${}class IU extends z${}class gU extends z${}class YU extends R{constructor(){super("Could not parse response content as the length limit was reached")}}class vU extends R{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}class C4 extends Error{constructor($){super($)}}class Tw extends z${constructor($,w,J){let V="OAuth2 authentication error",U=void 0;if(w&&typeof w==="object"){let G=w;U=G.error;let z=G.error_description;if(z&&typeof z==="string")V=z;else if(U)V=U}super($,w,V,J);this.error_code=U}}class o0 extends R{constructor($,w,J){super($);this.provider=w,this.cause=J}}var zH=/^[a-z][a-z0-9+.-]*:/i,pY=($)=>{return zH.test($)},L$=($)=>(L$=Array.isArray,L$($)),Ri=L$;function p0($){if(typeof $!=="object")return{};return $??{}}function bi($){if(!$)return!0;for(let w in $)return!1;return!0}function aY($,w){return Object.prototype.hasOwnProperty.call($,w)}function QU($){return $!=null&&typeof $==="object"&&!Array.isArray($)}var eY=($,w)=>{if(typeof w!=="number"||!Number.isInteger(w))throw new R(`${$} must be an integer`);if(w<0)throw new R(`${$} must be a positive integer`);return w};var sY=($)=>{try{return JSON.parse($)}catch(w){return}};var u4=($)=>new Promise((w)=>setTimeout(w,$));var w6="6.45.0";var U2=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"};function iH(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var XH=()=>{let $=iH();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w6,"X-Stainless-OS":w2(Deno.build.os),"X-Stainless-Arch":$2(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w6,"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":w6,"X-Stainless-OS":w2(globalThis.process.platform??"unknown"),"X-Stainless-Arch":$2(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let w=NH();if(w)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${w.browser}`,"X-Stainless-Runtime-Version":w.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function NH(){if(typeof navigator>"u"||!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:w,pattern:J}of $){let V=J.exec(navigator.userAgent);if(V){let U=V[1]||0,G=V[2]||0,z=V[3]||0;return{browser:w,version:`${U}.${G}.${z}`}}}return null}var $2=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},w2=($)=>{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"},J2,V2=()=>{return J2??(J2=XH())};function a0(){if(typeof fetch<"u")return fetch;throw 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 Ei(...$){let w=globalThis.ReadableStream;if(typeof w>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new w(...$)}function e0($){let w=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return Ei({start(){},async pull(J){let{done:V,value:U}=await w.next();if(V)J.close();else J.enqueue(U)},async cancel(){await w.return?.()}})}function Ci($){if($[Symbol.asyncIterator])return $;let w=$.getReader();return{async next(){try{let J=await w.read();if(J?.done)w.releaseLock();return J}catch(J){throw w.releaseLock(),J}},async return(){let J=w.cancel();return w.releaseLock(),await J,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function ji($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let w=$.getReader(),J=w.cancel();w.releaseLock(),await J}var z2=({headers:$,body:w})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(w)}};var xi="RFC3986",ri=($)=>String($),ni={RFC1738:($)=>String($).replace(/%20/g,"+"),RFC3986:ri},i2="RFC1738";var s0=($,w)=>(s0=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),s0($,w)),B4=(()=>{let $=[];for(let w=0;w<256;++w)$.push("%"+((w<16?"0":"")+w.toString(16)).toUpperCase());return $})();var di=1024,X2=($,w,J,V,U)=>{if($.length===0)return $;let G=$;if(typeof $==="symbol")G=Symbol.prototype.toString.call($);else if(typeof $!=="string")G=String($);if(J==="iso-8859-1")return escape(G).replace(/%u[0-9a-f]{4}/gi,function(i){return"%26%23"+parseInt(i.slice(2),16)+"%3B"});let z="";for(let i=0;i<G.length;i+=di){let N=G.length>=di?G.slice(i,i+di):G,X=[];for(let W=0;W<N.length;++W){let I=N.charCodeAt(W);if(I===45||I===46||I===95||I===126||I>=48&&I<=57||I>=65&&I<=90||I>=97&&I<=122||U===i2&&(I===40||I===41)){X[X.length]=N.charAt(W);continue}if(I<128){X[X.length]=B4[I];continue}if(I<2048){X[X.length]=B4[192|I>>6]+B4[128|I&63];continue}if(I<55296||I>=57344){X[X.length]=B4[224|I>>12]+B4[128|I>>6&63]+B4[128|I&63];continue}W+=1,I=65536+((I&1023)<<10|N.charCodeAt(W)&1023),X[X.length]=B4[240|I>>18]+B4[128|I>>12&63]+B4[128|I>>6&63]+B4[128|I&63]}z+=X.join("")}return z};function N2($){if(!$||typeof $!=="object")return!1;return!!($.constructor&&$.constructor.isBuffer&&$.constructor.isBuffer($))}function mi($,w){if(L$($)){let J=[];for(let V=0;V<$.length;V+=1)J.push(w($[V]));return J}return w($)}var I2={brackets($){return String($)+"[]"},comma:"comma",indices($,w){return String($)+"["+w+"]"},repeat($){return String($)}},g2=function($,w){Array.prototype.push.apply($,L$(w)?w:[w])},W2,Y$={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:X2,encodeValuesOnly:!1,format:xi,formatter:ri,indices:!1,serializeDate($){return(W2??(W2=Function.prototype.call.bind(Date.prototype.toISOString)))($)},skipNulls:!1,strictNullHandling:!1};function IH($){return typeof $==="string"||typeof $==="number"||typeof $==="boolean"||typeof $==="symbol"||typeof $==="bigint"}var yi={};function Y2($,w,J,V,U,G,z,i,N,X,W,I,g,Y,v,O,P,F){let q=$,T=F,L=0,k=!1;while((T=T.get(yi))!==void 0&&!k){let y=T.get($);if(L+=1,typeof y<"u")if(y===L)throw RangeError("Cyclic object value");else k=!0;if(typeof T.get(yi)>"u")L=0}if(typeof X==="function")q=X(w,q);else if(q instanceof Date)q=g?.(q);else if(J==="comma"&&L$(q))q=mi(q,function(y){if(y instanceof Date)return g?.(y);return y});if(q===null){if(G)return N&&!O?N(w,Y$.encoder,P,"key",Y):w;q=""}if(IH(q)||N2(q)){if(N){let y=O?w:N(w,Y$.encoder,P,"key",Y);return[v?.(y)+"="+v?.(N(q,Y$.encoder,P,"value",Y))]}return[v?.(w)+"="+v?.(String(q))]}let b=[];if(typeof q>"u")return b;let C;if(J==="comma"&&L$(q)){if(O&&N)q=mi(q,N);C=[{value:q.length>0?q.join(",")||null:void 0}]}else if(L$(X))C=X;else{let y=Object.keys(q);C=W?y.sort(W):y}let _=i?String(w).replace(/\./g,"%2E"):String(w),t=V&&L$(q)&&q.length===1?_+"[]":_;if(U&&L$(q)&&q.length===0)return t+"[]";for(let y=0;y<C.length;++y){let W$=C[y],U$=typeof W$==="object"&&typeof W$.value<"u"?W$.value:q[W$];if(z&&U$===null)continue;let H$=I&&i?W$.replace(/\./g,"%2E"):W$,k$=L$(q)?typeof J==="function"?J(t,H$):t:t+(I?"."+H$:"["+H$+"]");F.set($,L);let r$=new WeakMap;r$.set(yi,F),g2(b,Y2(U$,k$,J,V,U,G,z,i,J==="comma"&&O&&L$(q)?null:N,X,W,I,g,Y,v,O,P,r$))}return b}function gH($=Y$){if(typeof $.allowEmptyArrays<"u"&&typeof $.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof $.encodeDotInKeys<"u"&&typeof $.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if($.encoder!==null&&typeof $.encoder<"u"&&typeof $.encoder!=="function")throw TypeError("Encoder has to be a function.");let w=$.charset||Y$.charset;if(typeof $.charset<"u"&&$.charset!=="utf-8"&&$.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let J=xi;if(typeof $.format<"u"){if(!s0(ni,$.format))throw TypeError("Unknown format option provided.");J=$.format}let V=ni[J],U=Y$.filter;if(typeof $.filter==="function"||L$($.filter))U=$.filter;let G;if($.arrayFormat&&$.arrayFormat in I2)G=$.arrayFormat;else if("indices"in $)G=$.indices?"indices":"repeat";else G=Y$.arrayFormat;if("commaRoundTrip"in $&&typeof $.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");let z=typeof $.allowDots>"u"?!!$.encodeDotInKeys===!0?!0:Y$.allowDots:!!$.allowDots;return{addQueryPrefix:typeof $.addQueryPrefix==="boolean"?$.addQueryPrefix:Y$.addQueryPrefix,allowDots:z,allowEmptyArrays:typeof $.allowEmptyArrays==="boolean"?!!$.allowEmptyArrays:Y$.allowEmptyArrays,arrayFormat:G,charset:w,charsetSentinel:typeof $.charsetSentinel==="boolean"?$.charsetSentinel:Y$.charsetSentinel,commaRoundTrip:!!$.commaRoundTrip,delimiter:typeof $.delimiter>"u"?Y$.delimiter:$.delimiter,encode:typeof $.encode==="boolean"?$.encode:Y$.encode,encodeDotInKeys:typeof $.encodeDotInKeys==="boolean"?$.encodeDotInKeys:Y$.encodeDotInKeys,encoder:typeof $.encoder==="function"?$.encoder:Y$.encoder,encodeValuesOnly:typeof $.encodeValuesOnly==="boolean"?$.encodeValuesOnly:Y$.encodeValuesOnly,filter:U,format:J,formatter:V,serializeDate:typeof $.serializeDate==="function"?$.serializeDate:Y$.serializeDate,skipNulls:typeof $.skipNulls==="boolean"?$.skipNulls:Y$.skipNulls,sort:typeof $.sort==="function"?$.sort:null,strictNullHandling:typeof $.strictNullHandling==="boolean"?$.strictNullHandling:Y$.strictNullHandling}}function v2($,w={}){let J=$,V=gH(w),U,G;if(typeof V.filter==="function")G=V.filter,J=G("",J);else if(L$(V.filter))G=V.filter,U=G;let z=[];if(typeof J!=="object"||J===null)return"";let i=I2[V.arrayFormat],N=i==="comma"&&V.commaRoundTrip;if(!U)U=Object.keys(J);if(V.sort)U.sort(V.sort);let X=new WeakMap;for(let g=0;g<U.length;++g){let Y=U[g];if(V.skipNulls&&J[Y]===null)continue;g2(z,Y2(J[Y],Y,i,N,V.allowEmptyArrays,V.strictNullHandling,V.skipNulls,V.encodeDotInKeys,V.encode?V.encoder:null,V.filter,V.sort,V.allowDots,V.serializeDate,V.format,V.formatter,V.encodeValuesOnly,V.charset,X))}let W=z.join(V.delimiter),I=V.addQueryPrefix===!0?"?":"";if(V.charsetSentinel)if(V.charset==="iso-8859-1")I+="utf8=%26%2310003%3B&";else I+="utf8=%E2%9C%93&";return W.length>0?I+W:""}function Q2($){return v2($,{arrayFormat:"brackets"})}function K2($){let w=0;for(let U of $)w+=U.length;let J=new Uint8Array(w),V=0;for(let U of $)J.set(U,V),V+=U.length;return J}var O2;function Dw($){let w;return(O2??(w=new globalThis.TextEncoder,O2=w.encode.bind(w)))($)}var P2;function hi($){let w;return(P2??(w=new globalThis.TextDecoder,P2=w.decode.bind(w)))($)}var h$,c$;class Lw{constructor(){h$.set(this,void 0),c$.set(this,void 0),x(this,h$,new Uint8Array,"f"),x(this,c$,null,"f")}decode($){if($==null)return[];let w=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?Dw($):$;x(this,h$,K2([B(this,h$,"f"),w]),"f");let J=[],V;while((V=vH(B(this,h$,"f"),B(this,c$,"f")))!=null){if(V.carriage&&B(this,c$,"f")==null){x(this,c$,V.index,"f");continue}if(B(this,c$,"f")!=null&&(V.index!==B(this,c$,"f")+1||V.carriage)){J.push(hi(B(this,h$,"f").subarray(0,B(this,c$,"f")-1))),x(this,h$,B(this,h$,"f").subarray(B(this,c$,"f")),"f"),x(this,c$,null,"f");continue}let U=B(this,c$,"f")!==null?V.preceding-1:V.preceding,G=hi(B(this,h$,"f").subarray(0,U));J.push(G),x(this,h$,B(this,h$,"f").subarray(V.index),"f"),x(this,c$,null,"f")}return J}flush(){if(!B(this,h$,"f").length)return[];return this.decode(`
|
|
171
|
+
`)}}h$=new WeakMap,c$=new WeakMap;Lw.NEWLINE_CHARS=new Set([`
|
|
172
|
+
`,"\r"]);Lw.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function vH($,w){for(let U=w??0;U<$.length;U++){if($[U]===10)return{preceding:U,index:U+1,carriage:!1};if($[U]===13)return{preceding:U,index:U+1,carriage:!0}}return null}function u2($){for(let V=0;V<$.length-1;V++){if($[V]===10&&$[V+1]===10)return V+2;if($[V]===13&&$[V+1]===13)return V+2;if($[V]===13&&$[V+1]===10&&V+3<$.length&&$[V+2]===13&&$[V+3]===10)return V+4}return-1}var wV={off:0,error:200,warn:300,info:400,debug:500},ci=($,w,J)=>{if(!$)return;if(aY(wV,$))return $;N$(J).warn(`${w} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(wV))}`);return};function OU(){}function $V($,w,J){if(!w||wV[$]>wV[J])return OU;else return w[$].bind(w)}var QH={error:OU,warn:OU,info:OU,debug:OU},B2=new WeakMap;function N$($){let w=$.logger,J=$.logLevel??"off";if(!w)return QH;let V=B2.get(w);if(V&&V[0]===J)return V[1];let U={error:$V("error",w,J),warn:$V("warn",w,J),info:$V("info",w,J),debug:$V("debug",w,J)};return B2.set(w,[J,U]),U}var j4=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([w,J])=>[w,w.toLowerCase()==="authorization"||w.toLowerCase()==="api-key"||w.toLowerCase()==="x-api-key"||w.toLowerCase()==="x-amz-security-token"||w.toLowerCase()==="cookie"||w.toLowerCase()==="set-cookie"?"***":J]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var PU;class l${constructor($,w,J){this.iterator=$,PU.set(this,void 0),this.controller=w,x(this,PU,J,"f")}static fromSSEResponse($,w,J,V){let U=!1,G=J?N$(J):console;async function*z(){if(U)throw new R("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");U=!0;let i=!1;try{for await(let N of OH($,w)){if(i)continue;if(N.data.startsWith("[DONE]")){i=!0;continue}if(N.event===null||!N.event.startsWith("thread.")){let X;try{X=JSON.parse(N.data)}catch(W){throw G.error("Could not parse message into JSON:",N.data),G.error("From chunk:",N.raw),W}if(X&&X.error)throw new z$(void 0,X.error,void 0,$.headers);yield V?{event:N.event,data:X}:X}else{let X;try{X=JSON.parse(N.data)}catch(W){throw console.error("Could not parse message into JSON:",N.data),console.error("From chunk:",N.raw),W}if(N.event=="error")throw new z$(void 0,X.error,X.message,void 0);yield{event:N.event,data:X}}}i=!0}catch(N){if(UU(N))return;throw N}finally{if(!i)w.abort()}}return new l$(z,w,J)}static fromReadableStream($,w,J){let V=!1;async function*U(){let z=new Lw,i=Ci($);for await(let N of i)for(let X of z.decode(N))yield X;for(let N of z.flush())yield N}async function*G(){if(V)throw new R("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");V=!0;let z=!1;try{for await(let i of U()){if(z)continue;if(i)yield JSON.parse(i)}z=!0}catch(i){if(UU(i))return;throw i}finally{if(!z)w.abort()}}return new l$(G,w,J)}[(PU=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],w=[],J=this.iterator(),V=(U)=>{return{next:()=>{if(U.length===0){let G=J.next();$.push(G),w.push(G)}return U.shift()}}};return[new l$(()=>V($),this.controller,B(this,PU,"f")),new l$(()=>V(w),this.controller,B(this,PU,"f"))]}toReadableStream(){let $=this,w;return Ei({async start(){w=$[Symbol.asyncIterator]()},async pull(J){try{let{value:V,done:U}=await w.next();if(U)return J.close();let G=Dw(JSON.stringify(V)+`
|
|
173
|
+
`);J.enqueue(G)}catch(V){J.error(V)}},async cancel(){await w.return?.()}})}}async function*OH($,w){if(!$.body){if(w.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new R("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 R("Attempted to iterate over a response with no body")}let J=new H2,V=new Lw,U=Ci($.body);for await(let G of PH(U))for(let z of V.decode(G)){let i=J.decode(z);if(i)yield i}for(let G of V.flush()){let z=J.decode(G);if(z)yield z}}async function*PH($){let w=new Uint8Array;for await(let J of $){if(J==null)continue;let V=J instanceof ArrayBuffer?new Uint8Array(J):typeof J==="string"?Dw(J):J,U=new Uint8Array(w.length+V.length);U.set(w),U.set(V,w.length),w=U;let G;while((G=u2(w))!==-1)yield w.slice(0,G),w=w.slice(G)}if(w.length>0)yield w}class H2{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 U={event:this.event,data:this.data.join(`
|
|
174
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],U}if(this.chunks.push($),$.startsWith(":"))return null;let[w,J,V]=KH($,":");if(V.startsWith(" "))V=V.substring(1);if(w==="event")this.event=V;else if(w==="data")this.data.push(V);return null}}function KH($,w){let J=$.indexOf(w);if(J!==-1)return[$.substring(0,J),w,$.substring(J+w.length)];return[$,"",""]}async function JV($,w){let{response:J,requestLogID:V,retryOfRequestLogID:U,startTime:G}=w,z=await(async()=>{if(w.options.stream){if(N$($).debug("response",J.status,J.url,J.headers,J.body),w.options.__streamClass)return w.options.__streamClass.fromSSEResponse(J,w.controller,$,w.options.__synthesizeEventData);return l$.fromSSEResponse(J,w.controller,$,w.options.__synthesizeEventData)}if(J.status===204)return null;if(w.options.__binaryResponse)return J;let N=J.headers.get("content-type")?.split(";")[0]?.trim();if(N?.includes("application/json")||N?.endsWith("+json")){if(J.headers.get("content-length")==="0")return;let g=await J.json();return li(g,J)}return await J.text()})();return N$($).debug(`[${V}] response parsed`,j4({retryOfRequestLogID:U,url:J.url,status:J.status,body:z,durationMs:Date.now()-G})),z}function li($,w){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:w.headers.get("x-request-id"),enumerable:!1})}var KU;class x6 extends Promise{constructor($,w,J=JV){super((V)=>{V(null)});this.responsePromise=w,this.parseResponse=J,KU.set(this,void 0),x(this,KU,$,"f")}_thenUnwrap($){return new x6(B(this,KU,"f"),this.responsePromise,async(w,J)=>li($(await this.parseResponse(w,J),J),J.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,w]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:w,request_id:w.headers.get("x-request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(B(this,KU,"f"),$));return this.parsedPromise}then($,w){return this.parse().then($,w)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}}KU=new WeakMap;var UV;class uU{constructor($,w,J,V){UV.set(this,void 0),x(this,UV,$,"f"),this.options=V,this.response=w,this.body=J}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new R("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await B(this,UV,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(UV=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let w of $.getPaginatedItems())yield w}}class VV extends x6{constructor($,w,J){super($,w,async(V,U)=>new J(V,U.response,await JV(V,U),U.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let w of $)yield w}}class R$ extends uU{constructor($,w,J,V){super($,w,J,V);this.data=J.data||[],this.object=J.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}}class d extends uU{constructor($,w,J,V){super($,w,J,V);this.data=J.data||[],this.has_more=J.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let $=this.getPaginatedItems(),w=$[$.length-1]?.id;if(!w)return null;return{...this.options,query:{...p0(this.options.query),after:w}}}}class o extends uU{constructor($,w,J,V){super($,w,J,V);this.data=J.data||[],this.has_more=J.has_more||!1,this.last_id=J.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let $=this.last_id;if(!$)return null;return{...this.options,query:{...p0(this.options.query),after:$}}}}class v$ extends uU{constructor($,w,J,V){super($,w,J,V);this.data=J.data||[],this.has_more=J.has_more||!1,this.next=J.next||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let $=this.next;if(!$)return null;return{...this.options,query:{...p0(this.options.query),after:$}}}}var BH={jwt:"urn:ietf:params:oauth:token-type:jwt",id:"urn:ietf:params:oauth:token-type:id_token"},HH="urn:ietf:params:oauth:grant-type:token-exchange";class ti{constructor($,w){this.cachedToken=null,this.refreshPromise=null,this.tokenExchangeUrl="https://auth.openai.com/oauth/token",this.config=$,this.fetch=w??a0()}async getToken(){if(!this.cachedToken||this.isTokenExpired(this.cachedToken)){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.refreshToken();try{return await this.refreshPromise}finally{this.refreshPromise=null}}if(this.needsRefresh(this.cachedToken)&&!this.refreshPromise)this.refreshPromise=this.refreshToken().finally(()=>{this.refreshPromise=null});return this.cachedToken.token}async refreshToken(){let $=await this.config.provider.getToken(),w={grant_type:HH,subject_token:$,subject_token_type:BH[this.config.provider.tokenType],identity_provider_id:this.config.identityProviderId,service_account_id:this.config.serviceAccountId};if(this.config.clientId)w.client_id=this.config.clientId;let J=await this.fetch(this.tokenExchangeUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!J.ok){let i=await J.text(),N=void 0;try{N=JSON.parse(i)}catch{}if(J.status===400||J.status===401||J.status===403)throw new Tw(J.status,N,J.headers);throw z$.generate(J.status,N,`Token exchange failed with status ${J.status}`,J.headers)}let V=await J.json();if(typeof V!=="object"||V===null||!("access_token"in V)||typeof V.access_token!=="string"||V.access_token.trim().length===0)throw new R("Token exchange response missing 'access_token' field");let U=V.access_token,G=V.expires_in??3600,z=Date.now()+G*1000;return this.cachedToken={token:U,expiresAt:z},U}isTokenExpired($){return Date.now()>=$.expiresAt}needsRefresh($){let J=(this.config.refreshBufferSeconds??1200)*1000;return Date.now()>=$.expiresAt-J}invalidateToken(){this.cachedToken=null,this.refreshPromise=null}}var ai=()=>{if(typeof File>"u"){let{process:$}=globalThis,w=typeof $?.versions?.node==="string"&&parseInt($.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(w?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function fw($,w,J){return ai(),new File($,w??"unknown_file",J)}function BU($){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 GV=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",J6=async($,w)=>{if(!oi($.body))return $;return{...$,body:await q2($.body,w)}},f$=async($,w)=>{return{...$,body:await q2($.body,w)}},F2=new WeakMap;function FH($){let w=typeof $==="function"?$:$.fetch,J=F2.get(w);if(J)return J;let V=(async()=>{try{let U="Response"in w?w.Response:(await w("data:,")).constructor,G=new FormData;if(G.toString()===await new U(G).text())return!1;return!0}catch{return!0}})();return F2.set(w,V),V}var q2=async($,w)=>{if(!await FH(w))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let J=new FormData;return await Promise.all(Object.entries($||{}).map(([V,U])=>pi(J,V,U))),J},Z2=($)=>$ instanceof Blob&&("name"in $),qH=($)=>typeof $==="object"&&$!==null&&($ instanceof Response||GV($)||Z2($)),oi=($)=>{if(qH($))return!0;if(Array.isArray($))return $.some(oi);if($&&typeof $==="object"){for(let w in $)if(oi($[w]))return!0}return!1},pi=async($,w,J)=>{if(J===void 0)return;if(J==null)throw TypeError(`Received null for "${w}"; to pass null in FormData, you must use the string 'null'`);if(typeof J==="string"||typeof J==="number"||typeof J==="boolean")$.append(w,String(J));else if(J instanceof Response)$.append(w,fw([await J.blob()],BU(J)));else if(GV(J))$.append(w,fw([await new Response(e0(J)).blob()],BU(J)));else if(Z2(J))$.append(w,J,BU(J));else if(Array.isArray(J))await Promise.all(J.map((V)=>pi($,w+"[]",V)));else if(typeof J==="object")await Promise.all(Object.entries(J).map(([V,U])=>pi($,`${w}[${V}]`,U)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${J} instead`)};var T2=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",ZH=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&T2($),TH=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";async function Mw($,w,J){if(ai(),$=await $,ZH($)){if($ instanceof File)return $;return fw([await $.arrayBuffer()],$.name)}if(TH($)){let U=await $.blob();return w||(w=new URL($.url).pathname.split(/[\\/]/).pop()),fw(await ei(U),w,J)}let V=await ei($);if(w||(w=BU($)),!J?.type){let U=V.find((G)=>typeof G==="object"&&("type"in G)&&G.type);if(typeof U==="string")J={...J,type:U}}return fw(V,w,J)}async function ei($){let w=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)w.push($);else if(T2($))w.push($ instanceof Blob?$:await $.arrayBuffer());else if(GV($))for await(let J of $)w.push(...await ei(J));else{let J=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${J?`; constructor: ${J}`:""}${DH($)}`)}return w}function DH($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((J)=>`"${J}"`).join(", ")}]`}class K{constructor($){this._client=$}}function L2($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var D2=Object.freeze(Object.create(null)),fH=($=L2)=>function(J,...V){if(J.length===1)return J[0];let U=!1,G=[],z=J.reduce((W,I,g)=>{if(/[?#]/.test(I))U=!0;let Y=V[g],v=(U?encodeURIComponent:$)(""+Y);if(g!==V.length&&(Y==null||typeof Y==="object"&&Y.toString===Object.getPrototypeOf(Object.getPrototypeOf(Y.hasOwnProperty??D2)??D2)?.toString))v=Y+"",G.push({start:W.length+I.length,length:v.length,error:`Value of type ${Object.prototype.toString.call(Y).slice(8,-1)} is not a valid path parameter`});return W+I+(g===V.length?"":v)},""),i=z.split(/[?#]/,1)[0],N=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,X;while((X=N.exec(i))!==null)G.push({start:X.index,length:X[0].length,error:`Value "${X[0]}" can't be safely passed as a path parameter`});if(G.sort((W,I)=>W.start-I.start),G.length>0){let W=0,I=G.reduce((g,Y)=>{let v=" ".repeat(Y.start-W),O="^".repeat(Y.length);return W=Y.start+Y.length,g+v+O},"");throw new R(`Path parameters result in path with invalid segments:
|
|
175
|
+
${G.map((g)=>g.error).join(`
|
|
172
176
|
`)}
|
|
173
|
-
${
|
|
174
|
-
${I}`)}return g},Y=JO(FW);class e6 extends O{list($,w={},U){return this._client.getAPIList(Y`/chat/completions/${$}/messages`,y,{query:w,...U,__security:{bearerAuth:!0}})}}function AU($){return $!==void 0&&"function"in $&&$.function!==void 0}function RU($){return $?.$brand==="auto-parseable-response-format"}function _6($){return $?.$brand==="auto-parseable-tool"}function iW($,w){if(!w||!r2(w))return{...$,choices:$.choices.map((U)=>{return SW(U.message.tool_calls),{...U,message:{...U.message,parsed:null,...U.message.tool_calls?{tool_calls:U.message.tool_calls}:void 0}}})};return kU($,w)}function kU($,w){let U=$.choices.map((v)=>{if(v.finish_reason==="length")throw new TU;if(v.finish_reason==="content_filter")throw new ZU;return SW(v.message.tool_calls),{...v,message:{...v.message,...v.message.tool_calls?{tool_calls:v.message.tool_calls?.map((J)=>gO(w,J))??void 0}:void 0,parsed:v.message.content&&!v.message.refusal?zO(w,v.message.content):null}}});return{...$,choices:U}}function zO($,w){if($.response_format?.type!=="json_schema")return null;if($.response_format?.type==="json_schema"){if("$parseRaw"in $.response_format)return $.response_format.$parseRaw(w);return JSON.parse(w)}return null}function gO($,w){let U=$.tools?.find((v)=>AU(v)&&v.function?.name===w.function.name);return{...w,function:{...w.function,parsed_arguments:_6(U)?U.$parseRaw(w.function.arguments):U?.function.strict?JSON.parse(w.function.arguments):null}}}function EW($,w){if(!$||!("tools"in $)||!$.tools)return!1;let U=$.tools?.find((v)=>AU(v)&&v.function?.name===w.function.name);return AU(U)&&(_6(U)||U?.function.strict||!1)}function r2($){if(RU($.response_format))return!0;return $.tools?.some((w)=>_6(w)||w.type==="function"&&w.function.strict===!0)??!1}function SW($){for(let w of $||[])if(w.type!=="function")throw new i(`Currently only \`function\` tool calls are supported; Received \`${w.type}\``)}function AW($){for(let w of $??[]){if(w.type!=="function")throw new i(`Currently only \`function\` tool types support auto-parsing; Received \`${w.type}\``);if(w.function.strict!==!0)throw new i(`The \`${w.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var s6=($)=>{return $?.role==="assistant"},y2=($)=>{return $?.role==="tool"};var N0,W0,Y0,CU,jU,Q0,xU,q4,P0,rU,O0,B0,$w,RW,kW;class X6{constructor(){N0.add(this),this.controller=new AbortController,W0.set(this,void 0),Y0.set(this,()=>{}),CU.set(this,()=>{}),jU.set(this,void 0),Q0.set(this,()=>{}),xU.set(this,()=>{}),q4.set(this,{}),P0.set(this,[]),rU.set(this,!1),O0.set(this,!1),B0.set(this,!1),$w.set(this,!1),j(this,W0,new Promise(($,w)=>{j(this,Y0,$,"f"),j(this,CU,w,"f")}),"f"),j(this,jU,new Promise(($,w)=>{j(this,Q0,$,"f"),j(this,xU,w,"f")}),"f"),q(this,W0,"f").catch(()=>{}),q(this,jU,"f").catch(()=>{})}_run($){setTimeout(()=>{$().then(()=>{this._emitFinal(),this._emit("end")},q(this,N0,"m",kW).bind(this))},0)}_connected(){if(this.ended)return;q(this,Y0,"f").call(this),this._emit("connect")}get ended(){return q(this,rU,"f")}get errored(){return q(this,O0,"f")}get aborted(){return q(this,B0,"f")}abort(){this.controller.abort()}_listenForAbort($){if(!$||this.ended)return;if($.aborted){this.controller.abort();return}let w=()=>this.controller.abort();$.addEventListener("abort",w,{once:!0}),q(this,P0,"f").push({signal:$,listener:w})}on($,w){return(q(this,q4,"f")[$]||(q(this,q4,"f")[$]=[])).push({listener:w}),this}off($,w){let U=q(this,q4,"f")[$];if(!U)return this;let v=U.findIndex((J)=>J.listener===w);if(v>=0)U.splice(v,1);return this}once($,w){return(q(this,q4,"f")[$]||(q(this,q4,"f")[$]=[])).push({listener:w,once:!0}),this}emitted($){return new Promise((w,U)=>{if(j(this,$w,!0,"f"),$!=="error")this.once("error",U);this.once($,w)})}async done(){j(this,$w,!0,"f"),await q(this,jU,"f")}_emit($,...w){if(q(this,rU,"f"))return;if($==="end")q(this,N0,"m",RW).call(this),j(this,rU,!0,"f"),q(this,Q0,"f").call(this);let U=q(this,q4,"f")[$];if(U)q(this,q4,"f")[$]=U.filter((v)=>!v.once),U.forEach(({listener:v})=>v(...w));if($==="abort"){let v=w[0];if(!q(this,$w,"f")&&!U?.length)Promise.reject(v);q(this,CU,"f").call(this,v),q(this,xU,"f").call(this,v),this._emit("end");return}if($==="error"){let v=w[0];if(!q(this,$w,"f")&&!U?.length)Promise.reject(v);q(this,CU,"f").call(this,v),q(this,xU,"f").call(this,v),this._emit("end")}}_emitFinal(){}}W0=new WeakMap,Y0=new WeakMap,CU=new WeakMap,jU=new WeakMap,Q0=new WeakMap,xU=new WeakMap,q4=new WeakMap,P0=new WeakMap,rU=new WeakMap,O0=new WeakMap,B0=new WeakMap,$w=new WeakMap,N0=new WeakSet,RW=function(){for(let{signal:w,listener:U}of q(this,P0,"f").splice(0))w.removeEventListener("abort",U)},kW=function(w){if(j(this,O0,!0,"f"),w instanceof Error&&w.name==="AbortError")w=new _$;if(w instanceof _$)return j(this,B0,!0,"f"),this._emit("abort",w);if(w instanceof i)return this._emit("error",w);if(w instanceof Error){let U=new i(w.message);return U.cause=w,this._emit("error",U)}return this._emit("error",new i(String(w)))};function CW($){return typeof $.parse==="function"}var f$,d2,q0,m2,n2,h2,jW,xW,VO=10;class yU extends X6{constructor(){super(...arguments);f$.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion($){this._chatCompletions.push($),this._emit("chatCompletion",$);let w=$.choices[0]?.message;if(w)this._addMessage(w);return $}_addMessage($,w=!0){if(!("content"in $))$.content=null;if(this.messages.push($),w){if(this._emit("message",$),y2($)&&$.content)this._emit("functionToolCallResult",$.content);else if(s6($)&&$.tool_calls){for(let U of $.tool_calls)if(U.type==="function")this._emit("functionToolCall",U.function)}}}async finalChatCompletion(){await this.done();let $=this._chatCompletions[this._chatCompletions.length-1];if(!$)throw new i("stream ended without producing a ChatCompletion");return $}async finalContent(){return await this.done(),q(this,f$,"m",d2).call(this)}async finalMessage(){return await this.done(),q(this,f$,"m",q0).call(this)}async finalFunctionToolCall(){return await this.done(),q(this,f$,"m",m2).call(this)}async finalFunctionToolCallResult(){return await this.done(),q(this,f$,"m",n2).call(this)}async totalUsage(){return await this.done(),q(this,f$,"m",h2).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let $=this._chatCompletions[this._chatCompletions.length-1];if($)this._emit("finalChatCompletion",$);let w=q(this,f$,"m",q0).call(this);if(w)this._emit("finalMessage",w);let U=q(this,f$,"m",d2).call(this);if(U)this._emit("finalContent",U);let v=q(this,f$,"m",m2).call(this);if(v)this._emit("finalFunctionToolCall",v);let J=q(this,f$,"m",n2).call(this);if(J!=null)this._emit("finalFunctionToolCallResult",J);if(this._chatCompletions.some((z)=>z.usage))this._emit("totalUsage",q(this,f$,"m",h2).call(this))}async _createChatCompletion($,w,U){this._listenForAbort(U?.signal),q(this,f$,"m",jW).call(this,w);let v=await $.chat.completions.create({...w,stream:!1},{...U,signal:this.controller.signal});return this._connected(),this._addChatCompletion(kU(v,w))}async _runChatCompletion($,w,U){for(let v of w.messages)this._addMessage(v,!1);return await this._createChatCompletion($,w,U)}async _runTools($,w,U,v){let{tool_choice:z="auto",stream:g,...V}=w,_=typeof z!=="string"&&z.type==="function"&&z?.function?.name,{maxChatCompletions:G=VO,afterCompletion:X}=v||{},I=w.tools.map((Q)=>{if(_6(Q)){if(!Q.$callback)throw new i("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}),N={};for(let Q of I)if(Q.type==="function")N[Q.function.name||Q.function.function.name]=Q.function;let W="tools"in w?I.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 w.messages)this._addMessage(Q,!1);let P=async(Q)=>{if(Q.type!=="function")return{message:void 0,functionCalled:!1};let H=Q.id,{name:Z,arguments:u}=Q.function,b=N[Z];if(!b){let k=`Invalid tool_call: ${JSON.stringify(Z)}. Available options are: ${Object.keys(N).map((x)=>JSON.stringify(x)).join(", ")}. Please try again`;return{message:{role:"tool",tool_call_id:H,content:k},functionCalled:!1}}if(_&&_!==Z){let k=`Invalid tool_call: ${JSON.stringify(Z)}. ${JSON.stringify(_)} requested. Please try again`;return{message:{role:"tool",tool_call_id:H,content:k},functionCalled:!1}}let M;if(CW(b)){let k;try{k=await b.parse(u)}catch(x){let A=x instanceof Error?x.message:String(x);return{message:{role:"tool",tool_call_id:H,content:A},functionCalled:!1}}M=await b.function(k,U)}else M=await b.function(u,U);let S=q(this,f$,"m",xW).call(this,M);return{message:{role:"tool",tool_call_id:H,content:S},functionCalled:!0}};for(let Q=0;Q<G;++Q){let H=await this._createChatCompletion($,{...V,tool_choice:z,tools:W,messages:[...this.messages]},v),Z=H.choices[0]?.message;if(!Z)throw new i("missing message in ChatCompletion response");if(!Z.tool_calls?.length){await X?.(H,U);return}if(_||w.parallel_tool_calls===!1)for(let u of Z.tool_calls){let b=await P(u);if(b.message)this._addMessage(b.message);if(_&&b.functionCalled){await X?.(H,U);return}}else{let u=await Promise.allSettled(Z.tool_calls.map(P));for(let b of u)if(b.status==="rejected")throw b.reason;for(let b of u)if(b.status==="fulfilled"&&b.value.message)this._addMessage(b.value.message)}await X?.(H,U)}return}}f$=new WeakSet,d2=function(){return q(this,f$,"m",q0).call(this).content??null},q0=function(){let w=this.messages.length;while(w-- >0){let U=this.messages[w];if(s6(U))return{...U,content:U.content??null,refusal:U.refusal??null}}throw new i("stream ended without producing a ChatCompletionMessage with role=assistant")},m2=function(){for(let w=this.messages.length-1;w>=0;w--){let U=this.messages[w];if(s6(U)&&U?.tool_calls?.length)for(let v=U.tool_calls.length-1;v>=0;v--){let J=U.tool_calls[v];if(J?.type==="function")return J.function}}return},n2=function(){for(let w=this.messages.length-1;w>=0;w--){let U=this.messages[w];if(y2(U)&&U.content!=null&&typeof U.content==="string"&&this.messages.some((v)=>v.role==="assistant"&&v.tool_calls?.some((J)=>J.type==="function"&&J.id===U.tool_call_id)))return U.content}return},h2=function(){let w={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:U}of this._chatCompletions)if(U)w.completion_tokens+=U.completion_tokens,w.prompt_tokens+=U.prompt_tokens,w.total_tokens+=U.total_tokens;return w},jW=function(w){if(w.n!=null&&w.n>1)throw new i("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},xW=function(w){return typeof w==="string"?w:w===void 0?"undefined":JSON.stringify(w)};class dU extends yU{static runTools($,w,U){let v=new dU,J={...U,headers:{...U?.headers,"X-Stainless-Helper-Method":"runTools"}};return v._run(()=>v._runTools($,w,v,J)),v}_addMessage($,w=!0){if(super._addMessage($,w),s6($)&&$.content)this._emit("content",$.content)}}var Y$={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 rW extends Error{}class yW extends Error{}function GO($,w=Y$.ALL){if(typeof $!=="string")throw TypeError(`expecting str, got ${typeof $}`);if(!$.trim())throw Error(`${$} is empty`);return _O($.trim(),w)}var _O=($,w)=>{let U=$.length,v=0,J=(N)=>{throw new rW(`${N} at position ${v}`)},z=(N)=>{throw new yW(`${N} at position ${v}`)},g=()=>{if(I(),v>=U)J("Unexpected end of input");if($[v]==='"')return V();if($[v]==="{")return _();if($[v]==="[")return G();if($.substring(v,v+4)==="null"||Y$.NULL&w&&U-v<4&&"null".startsWith($.substring(v)))return v+=4,null;if($.substring(v,v+4)==="true"||Y$.BOOL&w&&U-v<4&&"true".startsWith($.substring(v)))return v+=4,!0;if($.substring(v,v+5)==="false"||Y$.BOOL&w&&U-v<5&&"false".startsWith($.substring(v)))return v+=5,!1;if($.substring(v,v+8)==="Infinity"||Y$.INFINITY&w&&U-v<8&&"Infinity".startsWith($.substring(v)))return v+=8,1/0;if($.substring(v,v+9)==="-Infinity"||Y$.MINUS_INFINITY&w&&1<U-v&&U-v<9&&"-Infinity".startsWith($.substring(v)))return v+=9,-1/0;if($.substring(v,v+3)==="NaN"||Y$.NAN&w&&U-v<3&&"NaN".startsWith($.substring(v)))return v+=3,NaN;return X()},V=()=>{let N=v,W=!1;v++;while(v<U&&($[v]!=='"'||W&&$[v-1]==="\\"))W=$[v]==="\\"?!W:!1,v++;if($.charAt(v)=='"')try{return JSON.parse($.substring(N,++v-Number(W)))}catch(P){z(String(P))}else if(Y$.STR&w)try{return JSON.parse($.substring(N,v-Number(W))+'"')}catch(P){return JSON.parse($.substring(N,$.lastIndexOf("\\"))+'"')}J("Unterminated string literal")},_=()=>{v++,I();let N={};try{while($[v]!=="}"){if(I(),v>=U&&Y$.OBJ&w)return N;let W=V();I(),v++;try{let P=g();Object.defineProperty(N,W,{value:P,writable:!0,enumerable:!0,configurable:!0})}catch(P){if(Y$.OBJ&w)return N;else throw P}if(I(),$[v]===",")v++}}catch(W){if(Y$.OBJ&w)return N;else J("Expected '}' at end of object")}return v++,N},G=()=>{v++;let N=[];try{while($[v]!=="]")if(N.push(g()),I(),$[v]===",")v++}catch(W){if(Y$.ARR&w)return N;J("Expected ']' at end of array")}return v++,N},X=()=>{if(v===0){if($==="-"&&Y$.NUM&w)J("Not sure what '-' is");try{return JSON.parse($)}catch(W){if(Y$.NUM&w)try{if($[$.length-1]===".")return JSON.parse($.substring(0,$.lastIndexOf(".")));return JSON.parse($.substring(0,$.lastIndexOf("e")))}catch(P){}z(String(W))}}let N=v;if($[v]==="-")v++;while($[v]&&!",]}".includes($[v]))v++;if(v==U&&!(Y$.NUM&w))J("Unterminated number literal");try{return JSON.parse($.substring(N,v))}catch(W){if($.substring(N,v)==="-"&&Y$.NUM&w)J("Not sure what '-' is");try{return JSON.parse($.substring(N,$.lastIndexOf("e")))}catch(P){z(String(P))}}},I=()=>{while(v<U&&`
|
|
175
|
-
\r `.includes($[
|
|
176
|
-
${
|
|
177
|
-
${
|
|
178
|
-
${
|
|
179
|
-
${u0($)}`);return{...A,id:x,type:k,function:{...K$,name:h,arguments:a}}})}};return{...W,message:{...Z,content:P,role:u,refusal:G.refusal??null},finish_reason:X,index:I,logprobs:N}}),created:J,model:z,object:"chat.completion",...g?{system_fingerprint:g}:{}};return iW(_,w)}function u0($){return JSON.stringify($)}function mW($){return}function nW($){}class Uw extends A4{static fromReadableStream($){let w=new Uw(null);return w._run(()=>w._fromReadableStream($)),w}static runTools($,w,U){let v=new Uw(w),J={...U,headers:{...U?.headers,"X-Stainless-Helper-Method":"runTools"}};return v._run(()=>v._runTools($,w,v,J)),v}}class R4 extends O{constructor(){super(...arguments);this.messages=new e6(this._client)}create($,w){return this._client.post("/chat/completions",{body:$,...w,stream:$.stream??!1,__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Y`/chat/completions/${$}`,{...w,__security:{bearerAuth:!0}})}update($,w,U){return this._client.post(Y`/chat/completions/${$}`,{body:w,...U,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/chat/completions",y,{query:$,...w,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Y`/chat/completions/${$}`,{...w,__security:{bearerAuth:!0}})}parse($,w){return AW($.tools),this._client.chat.completions.create($,{...w,headers:{...w?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap((U)=>kU(U,$))}runTools($,w){if($.stream)return Uw.runTools(this._client,$,w);return dU.runTools(this._client,$,w)}stream($,w){return A4.createChatCompletion(this._client,$,w)}}R4.Messages=e6;class I6 extends O{constructor(){super(...arguments);this.completions=new R4(this._client)}}I6.Completions=R4;class mU extends O{create($,w){return this._client.post("/organization/admin_api_keys",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w){return this._client.get(Y`/organization/admin_api_keys/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/admin_api_keys",y,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Y`/organization/admin_api_keys/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}}class nU extends O{list($={},w){return this._client.getAPIList("/organization/audit_logs",l,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}}class hU extends O{create($,w){return this._client.post("/organization/certificates",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w={},U){return this._client.get(Y`/organization/certificates/${$}`,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}update($,w,U){return this._client.post(Y`/organization/certificates/${$}`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/certificates",l,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Y`/organization/certificates/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}activate($,w){return this._client.getAPIList("/organization/certificates/activate",D$,{body:$,method:"post",...w,__security:{adminAPIKeyAuth:!0}})}deactivate($,w){return this._client.getAPIList("/organization/certificates/deactivate",D$,{body:$,method:"post",...w,__security:{adminAPIKeyAuth:!0}})}}class cU extends O{retrieve($){return this._client.get("/organization/data_retention",{...$,__security:{adminAPIKeyAuth:!0}})}update($,w){return this._client.post("/organization/data_retention",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}}class lU extends O{create($,w){return this._client.post("/organization/invites",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w){return this._client.get(Y`/organization/invites/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/invites",l,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Y`/organization/invites/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}}class tU extends O{create($,w){return this._client.post("/organization/roles",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w){return this._client.get(Y`/organization/roles/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,U){return this._client.post(Y`/organization/roles/${$}`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/roles",I$,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Y`/organization/roles/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}}class oU extends O{create($,w){return this._client.post("/organization/spend_alerts",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w){return this._client.get(Y`/organization/spend_alerts/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,U){return this._client.post(Y`/organization/spend_alerts/${$}`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/spend_alerts",l,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Y`/organization/spend_alerts/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}}class pU extends O{audioSpeeches($,w){return this._client.get("/organization/usage/audio_speeches",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}audioTranscriptions($,w){return this._client.get("/organization/usage/audio_transcriptions",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}codeInterpreterSessions($,w){return this._client.get("/organization/usage/code_interpreter_sessions",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}completions($,w){return this._client.get("/organization/usage/completions",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}costs($,w){return this._client.get("/organization/costs",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}embeddings($,w){return this._client.get("/organization/usage/embeddings",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}fileSearchCalls($,w){return this._client.get("/organization/usage/file_search_calls",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}images($,w){return this._client.get("/organization/usage/images",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}moderations($,w){return this._client.get("/organization/usage/moderations",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}vectorStores($,w){return this._client.get("/organization/usage/vector_stores",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}webSearchCalls($,w){return this._client.get("/organization/usage/web_search_calls",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}}class aU extends O{create($,w,U){return this._client.post(Y`/organization/groups/${$}/roles`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,U){let{group_id:v}=w;return this._client.get(Y`/organization/groups/${v}/roles/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/organization/groups/${$}/roles`,I$,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w,U){let{group_id:v}=w;return this._client.delete(Y`/organization/groups/${v}/roles/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}}class eU extends O{create($,w,U){return this._client.post(Y`/organization/groups/${$}/users`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,U){let{group_id:v}=w;return this._client.get(Y`/organization/groups/${v}/users/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/organization/groups/${$}/users`,I$,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w,U){let{group_id:v}=w;return this._client.delete(Y`/organization/groups/${v}/users/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}}class N6 extends O{constructor(){super(...arguments);this.users=new eU(this._client),this.roles=new aU(this._client)}create($,w){return this._client.post("/organization/groups",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w){return this._client.get(Y`/organization/groups/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,U){return this._client.post(Y`/organization/groups/${$}`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/groups",I$,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Y`/organization/groups/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}}N6.Users=eU;N6.Roles=aU;class sU extends O{retrieve($,w,U){let{project_id:v}=w;return this._client.get(Y`/organization/projects/${v}/api_keys/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/organization/projects/${$}/api_keys`,l,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w,U){let{project_id:v}=w;return this._client.delete(Y`/organization/projects/${v}/api_keys/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}}class $1 extends O{list($,w={},U){return this._client.getAPIList(Y`/organization/projects/${$}/certificates`,l,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}activate($,w,U){return this._client.getAPIList(Y`/organization/projects/${$}/certificates/activate`,D$,{body:w,method:"post",...U,__security:{adminAPIKeyAuth:!0}})}deactivate($,w,U){return this._client.getAPIList(Y`/organization/projects/${$}/certificates/deactivate`,D$,{body:w,method:"post",...U,__security:{adminAPIKeyAuth:!0}})}}class w1 extends O{retrieve($,w){return this._client.get(Y`/organization/projects/${$}/data_retention`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,U){return this._client.post(Y`/organization/projects/${$}/data_retention`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}}class U1 extends O{retrieve($,w){return this._client.get(Y`/organization/projects/${$}/hosted_tool_permissions`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,U){return this._client.post(Y`/organization/projects/${$}/hosted_tool_permissions`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}}class J1 extends O{retrieve($,w){return this._client.get(Y`/organization/projects/${$}/model_permissions`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,U){return this._client.post(Y`/organization/projects/${$}/model_permissions`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Y`/organization/projects/${$}/model_permissions`,{...w,__security:{adminAPIKeyAuth:!0}})}}class v1 extends O{listRateLimits($,w={},U){return this._client.getAPIList(Y`/organization/projects/${$}/rate_limits`,l,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}updateRateLimit($,w,U){let{project_id:v,...J}=w;return this._client.post(Y`/organization/projects/${v}/rate_limits/${$}`,{body:J,...U,__security:{adminAPIKeyAuth:!0}})}}class z1 extends O{create($,w,U){return this._client.post(Y`/projects/${$}/roles`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,U){let{project_id:v}=w;return this._client.get(Y`/projects/${v}/roles/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}update($,w,U){let{project_id:v,...J}=w;return this._client.post(Y`/projects/${v}/roles/${$}`,{body:J,...U,__security:{adminAPIKeyAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/projects/${$}/roles`,I$,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w,U){let{project_id:v}=w;return this._client.delete(Y`/projects/${v}/roles/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}}class g1 extends O{create($,w,U){return this._client.post(Y`/organization/projects/${$}/service_accounts`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,U){let{project_id:v}=w;return this._client.get(Y`/organization/projects/${v}/service_accounts/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}update($,w,U){let{project_id:v,...J}=w;return this._client.post(Y`/organization/projects/${v}/service_accounts/${$}`,{body:J,...U,__security:{adminAPIKeyAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/organization/projects/${$}/service_accounts`,l,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w,U){let{project_id:v}=w;return this._client.delete(Y`/organization/projects/${v}/service_accounts/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}}class V1 extends O{create($,w,U){return this._client.post(Y`/organization/projects/${$}/spend_alerts`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,U){let{project_id:v}=w;return this._client.get(Y`/organization/projects/${v}/spend_alerts/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}update($,w,U){let{project_id:v,...J}=w;return this._client.post(Y`/organization/projects/${v}/spend_alerts/${$}`,{body:J,...U,__security:{adminAPIKeyAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/organization/projects/${$}/spend_alerts`,l,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w,U){let{project_id:v}=w;return this._client.delete(Y`/organization/projects/${v}/spend_alerts/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}}class G1 extends O{create($,w,U){let{project_id:v,...J}=w;return this._client.post(Y`/projects/${v}/groups/${$}/roles`,{body:J,...U,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,U){let{project_id:v,group_id:J}=w;return this._client.get(Y`/projects/${v}/groups/${J}/roles/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}list($,w,U){let{project_id:v,...J}=w;return this._client.getAPIList(Y`/projects/${v}/groups/${$}/roles`,I$,{query:J,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w,U){let{project_id:v,group_id:J}=w;return this._client.delete(Y`/projects/${v}/groups/${J}/roles/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}}class Jw extends O{constructor(){super(...arguments);this.roles=new G1(this._client)}create($,w,U){return this._client.post(Y`/organization/projects/${$}/groups`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,U){let{project_id:v,...J}=w;return this._client.get(Y`/organization/projects/${v}/groups/${$}`,{query:J,...U,__security:{adminAPIKeyAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/organization/projects/${$}/groups`,I$,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w,U){let{project_id:v}=w;return this._client.delete(Y`/organization/projects/${v}/groups/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}}Jw.Roles=G1;class _1 extends O{create($,w,U){let{project_id:v,...J}=w;return this._client.post(Y`/projects/${v}/users/${$}/roles`,{body:J,...U,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,U){let{project_id:v,user_id:J}=w;return this._client.get(Y`/projects/${v}/users/${J}/roles/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}list($,w,U){let{project_id:v,...J}=w;return this._client.getAPIList(Y`/projects/${v}/users/${$}/roles`,I$,{query:J,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w,U){let{project_id:v,user_id:J}=w;return this._client.delete(Y`/projects/${v}/users/${J}/roles/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}}class vw extends O{constructor(){super(...arguments);this.roles=new _1(this._client)}create($,w,U){return this._client.post(Y`/organization/projects/${$}/users`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,U){let{project_id:v}=w;return this._client.get(Y`/organization/projects/${v}/users/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}update($,w,U){let{project_id:v,...J}=w;return this._client.post(Y`/organization/projects/${v}/users/${$}`,{body:J,...U,__security:{adminAPIKeyAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/organization/projects/${$}/users`,l,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w,U){let{project_id:v}=w;return this._client.delete(Y`/organization/projects/${v}/users/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}}vw.Roles=_1;class L$ extends O{constructor(){super(...arguments);this.users=new vw(this._client),this.serviceAccounts=new g1(this._client),this.apiKeys=new sU(this._client),this.rateLimits=new v1(this._client),this.modelPermissions=new J1(this._client),this.hostedToolPermissions=new U1(this._client),this.groups=new Jw(this._client),this.roles=new z1(this._client),this.dataRetention=new w1(this._client),this.spendAlerts=new V1(this._client),this.certificates=new $1(this._client)}create($,w){return this._client.post("/organization/projects",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w){return this._client.get(Y`/organization/projects/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,U){return this._client.post(Y`/organization/projects/${$}`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/projects",l,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}archive($,w){return this._client.post(Y`/organization/projects/${$}/archive`,{...w,__security:{adminAPIKeyAuth:!0}})}}L$.Users=vw;L$.ServiceAccounts=g1;L$.APIKeys=sU;L$.RateLimits=v1;L$.ModelPermissions=J1;L$.HostedToolPermissions=U1;L$.Groups=Jw;L$.Roles=z1;L$.DataRetention=w1;L$.SpendAlerts=V1;L$.Certificates=$1;class X1 extends O{create($,w,U){return this._client.post(Y`/organization/users/${$}/roles`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,U){let{user_id:v}=w;return this._client.get(Y`/organization/users/${v}/roles/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/organization/users/${$}/roles`,I$,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w,U){let{user_id:v}=w;return this._client.delete(Y`/organization/users/${v}/roles/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}}class zw extends O{constructor(){super(...arguments);this.roles=new X1(this._client)}retrieve($,w){return this._client.get(Y`/organization/users/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,U){return this._client.post(Y`/organization/users/${$}`,{body:w,...U,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/users",l,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Y`/organization/users/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}}zw.Roles=X1;class H$ extends O{constructor(){super(...arguments);this.auditLogs=new nU(this._client),this.adminAPIKeys=new mU(this._client),this.usage=new pU(this._client),this.invites=new lU(this._client),this.users=new zw(this._client),this.groups=new N6(this._client),this.roles=new tU(this._client),this.dataRetention=new cU(this._client),this.spendAlerts=new oU(this._client),this.certificates=new hU(this._client),this.projects=new L$(this._client)}}H$.AuditLogs=nU;H$.AdminAPIKeys=mU;H$.Usage=pU;H$.Invites=lU;H$.Users=zw;H$.Groups=N6;H$.Roles=tU;H$.DataRetention=cU;H$.SpendAlerts=oU;H$.Certificates=hU;H$.Projects=L$;class W6 extends O{constructor(){super(...arguments);this.organization=new H$(this._client)}}W6.Organization=H$;var hW=Symbol("brand.privateNullableHeaders");function*rO($){if(!$)return;if(hW in $){let{values:v,nulls:J}=$;yield*v.entries();for(let z of J)yield[z,null];return}let w=!1,U;if($ instanceof Headers)U=$.entries();else if(H2($))U=$;else w=!0,U=Object.entries($??{});for(let v of U){let J=v[0];if(typeof J!=="string")throw TypeError("expected header name to be a string");let z=H2(v[1])?v[1]:[v[1]],g=!1;for(let V of z){if(V===void 0)continue;if(w&&!g)g=!0,yield[J,null];yield[J,V]}}}var f=($)=>{let w=new Headers,U=new Set;for(let v of $){let J=new Set;for(let[z,g]of rO(v)){let V=z.toLowerCase();if(!J.has(V))w.delete(z),J.add(V);if(g===null)w.delete(z),U.add(V);else w.append(z,g),U.delete(V)}}return{[hW]:!0,values:w,nulls:U}};class I1 extends O{create($,w){return this._client.post("/audio/speech",{body:$,...w,headers:f([{Accept:"application/octet-stream"},w?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}}class N1 extends O{create($,w){return this._client.post("/audio/transcriptions",q$({body:$,...w,stream:$.stream??!1,__metadata:{model:$.model},__security:{bearerAuth:!0}},this._client))}}class W1 extends O{create($,w){return this._client.post("/audio/translations",q$({body:$,...w,__metadata:{model:$.model},__security:{bearerAuth:!0}},this._client))}}class H4 extends O{constructor(){super(...arguments);this.transcriptions=new N1(this._client),this.translations=new W1(this._client),this.speech=new I1(this._client)}}H4.Transcriptions=N1;H4.Translations=W1;H4.Speech=I1;class gw extends O{create($,w){return this._client.post("/batches",{body:$,...w,__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Y`/batches/${$}`,{...w,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/batches",y,{query:$,...w,__security:{bearerAuth:!0}})}cancel($,w){return this._client.post(Y`/batches/${$}/cancel`,{...w,__security:{bearerAuth:!0}})}}class Y1 extends O{create($,w){return this._client.post("/assistants",{body:$,...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Y`/assistants/${$}`,{...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}update($,w,U){return this._client.post(Y`/assistants/${$}`,{body:w,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/assistants",y,{query:$,...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Y`/assistants/${$}`,{...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}}class Q1 extends O{create($,w){return this._client.post("/realtime/sessions",{body:$,...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}}class P1 extends O{create($,w){return this._client.post("/realtime/transcription_sessions",{body:$,...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}}class Y6 extends O{constructor(){super(...arguments);this.sessions=new Q1(this._client),this.transcriptionSessions=new P1(this._client)}}Y6.Sessions=Q1;Y6.TranscriptionSessions=P1;class O1 extends O{create($,w){return this._client.post("/chatkit/sessions",{body:$,...w,headers:f([{"OpenAI-Beta":"chatkit_beta=v1"},w?.headers]),__security:{bearerAuth:!0}})}cancel($,w){return this._client.post(Y`/chatkit/sessions/${$}/cancel`,{...w,headers:f([{"OpenAI-Beta":"chatkit_beta=v1"},w?.headers]),__security:{bearerAuth:!0}})}}class B1 extends O{retrieve($,w){return this._client.get(Y`/chatkit/threads/${$}`,{...w,headers:f([{"OpenAI-Beta":"chatkit_beta=v1"},w?.headers]),__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/chatkit/threads",l,{query:$,...w,headers:f([{"OpenAI-Beta":"chatkit_beta=v1"},w?.headers]),__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Y`/chatkit/threads/${$}`,{...w,headers:f([{"OpenAI-Beta":"chatkit_beta=v1"},w?.headers]),__security:{bearerAuth:!0}})}listItems($,w={},U){return this._client.getAPIList(Y`/chatkit/threads/${$}/items`,l,{query:w,...U,headers:f([{"OpenAI-Beta":"chatkit_beta=v1"},U?.headers]),__security:{bearerAuth:!0}})}}class Q6 extends O{constructor(){super(...arguments);this.sessions=new O1(this._client),this.threads=new B1(this._client)}}Q6.Sessions=O1;Q6.Threads=B1;class q1 extends O{create($,w,U){return this._client.post(Y`/threads/${$}/messages`,{body:w,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}retrieve($,w,U){let{thread_id:v}=w;return this._client.get(Y`/threads/${v}/messages/${$}`,{...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}update($,w,U){let{thread_id:v,...J}=w;return this._client.post(Y`/threads/${v}/messages/${$}`,{body:J,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/threads/${$}/messages`,y,{query:w,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}delete($,w,U){let{thread_id:v}=w;return this._client.delete(Y`/threads/${v}/messages/${$}`,{...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}}class L1 extends O{retrieve($,w,U){let{thread_id:v,run_id:J,...z}=w;return this._client.get(Y`/threads/${v}/runs/${J}/steps/${$}`,{query:z,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}list($,w,U){let{thread_id:v,...J}=w;return this._client.getAPIList(Y`/threads/${v}/runs/${$}/steps`,y,{query:J,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}}var cW=($)=>{if(typeof Buffer<"u"){let w=Buffer.from($,"base64");return Array.from(new Float32Array(w.buffer,w.byteOffset,w.length/Float32Array.BYTES_PER_ELEMENT))}else{let w=atob($),U=w.length,v=new Uint8Array(U);for(let J=0;J<U;J++)v[J]=w.charCodeAt(J);return Array.from(new Float32Array(v.buffer))}};var p$=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim()||void 0;return};var Q$,O6,e2,v4,K0,a$,B6,Vw,P6,T0,C$,D0,f0,K1,H1,u1,lW,tW,oW,pW,aW,eW,sW;class k4 extends X6{constructor(){super(...arguments);Q$.add(this),e2.set(this,[]),v4.set(this,{}),K0.set(this,{}),a$.set(this,void 0),B6.set(this,void 0),Vw.set(this,void 0),P6.set(this,void 0),T0.set(this,void 0),C$.set(this,void 0),D0.set(this,void 0),f0.set(this,void 0),K1.set(this,void 0)}[(e2=new WeakMap,v4=new WeakMap,K0=new WeakMap,a$=new WeakMap,B6=new WeakMap,Vw=new WeakMap,P6=new WeakMap,T0=new WeakMap,C$=new WeakMap,D0=new WeakMap,f0=new WeakMap,K1=new WeakMap,Q$=new WeakSet,Symbol.asyncIterator)](){let $=[],w=[],U=!1;return this.on("event",(v)=>{let J=w.shift();if(J)J.resolve(v);else $.push(v)}),this.on("end",()=>{U=!0;for(let v of w)v.resolve(void 0);w.length=0}),this.on("abort",(v)=>{U=!0;for(let J of w)J.reject(v);w.length=0}),this.on("error",(v)=>{U=!0;for(let J of w)J.reject(v);w.length=0}),{next:async()=>{if(!$.length){if(U)return{value:void 0,done:!0};return new Promise((J,z)=>w.push({resolve:J,reject:z})).then((J)=>J?{value:J,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 w=new O6;return w._run(()=>w._fromReadableStream($)),w}async _fromReadableStream($,w){this._listenForAbort(w?.signal),this._connected();let U=k$.fromReadableStream($,this.controller);for await(let v of U)q(this,Q$,"m",H1).call(this,v);if(U.controller.signal?.aborted)throw new _$;return this._addRun(q(this,Q$,"m",u1).call(this))}toReadableStream(){return new k$(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream($,w,U,v){let J=new O6;return J._run(()=>J._runToolAssistantStream($,w,U,{...v,headers:{...v?.headers,"X-Stainless-Helper-Method":"stream"}})),J}async _createToolAssistantStream($,w,U,v){this._listenForAbort(v?.signal);let J={...U,stream:!0},z=await $.submitToolOutputs(w,J,{...v,signal:this.controller.signal});this._connected();for await(let g of z)q(this,Q$,"m",H1).call(this,g);if(z.controller.signal?.aborted)throw new _$;return this._addRun(q(this,Q$,"m",u1).call(this))}static createThreadAssistantStream($,w,U){let v=new O6;return v._run(()=>v._threadAssistantStream($,w,{...U,headers:{...U?.headers,"X-Stainless-Helper-Method":"stream"}})),v}static createAssistantStream($,w,U,v){let J=new O6;return J._run(()=>J._runAssistantStream($,w,U,{...v,headers:{...v?.headers,"X-Stainless-Helper-Method":"stream"}})),J}currentEvent(){return q(this,D0,"f")}currentRun(){return q(this,f0,"f")}currentMessageSnapshot(){return q(this,a$,"f")}currentRunStepSnapshot(){return q(this,K1,"f")}async finalRunSteps(){return await this.done(),Object.values(q(this,v4,"f"))}async finalMessages(){return await this.done(),Object.values(q(this,K0,"f"))}async finalRun(){if(await this.done(),!q(this,B6,"f"))throw Error("Final run was not received.");return q(this,B6,"f")}async _createThreadAssistantStream($,w,U){this._listenForAbort(U?.signal);let v={...w,stream:!0},J=await $.createAndRun(v,{...U,signal:this.controller.signal});this._connected();for await(let z of J)q(this,Q$,"m",H1).call(this,z);if(J.controller.signal?.aborted)throw new _$;return this._addRun(q(this,Q$,"m",u1).call(this))}async _createAssistantStream($,w,U,v){this._listenForAbort(v?.signal);let J={...U,stream:!0},z=await $.create(w,J,{...v,signal:this.controller.signal});this._connected();for await(let g of z)q(this,Q$,"m",H1).call(this,g);if(z.controller.signal?.aborted)throw new _$;return this._addRun(q(this,Q$,"m",u1).call(this))}static accumulateDelta($,w){for(let[U,v]of Object.entries(w)){if(!$.hasOwnProperty(U)){$[U]=v;continue}let J=$[U];if(J===null||J===void 0){$[U]=v;continue}if(U==="index"||U==="type"){$[U]=v;continue}if(typeof J==="string"&&typeof v==="string")J+=v;else if(typeof J==="number"&&typeof v==="number")J+=v;else if(bU(J)&&bU(v))J=this.accumulateDelta(J,v);else if(Array.isArray(J)&&Array.isArray(v)){if(J.every((z)=>typeof z==="string"||typeof z==="number")){J.push(...v);continue}for(let z of v){if(!bU(z))throw Error(`Expected array delta entry to be an object but got: ${z}`);let g=z.index;if(g==null)throw console.error(z),Error("Expected array delta entry to have an `index` property");if(typeof g!=="number")throw Error(`Expected array delta entry \`index\` property to be a number but got ${g}`);let V=J[g];if(V==null)J.push(z);else J[g]=this.accumulateDelta(V,z)}continue}else throw Error(`Unhandled record type: ${U}, deltaValue: ${v}, accValue: ${J}`);$[U]=J}return $}_addRun($){return $}async _threadAssistantStream($,w,U){return await this._createThreadAssistantStream(w,$,U)}async _runAssistantStream($,w,U,v){return await this._createAssistantStream(w,$,U,v)}async _runToolAssistantStream($,w,U,v){return await this._createToolAssistantStream(w,$,U,v)}}O6=k4,H1=function(w){if(this.ended)return;switch(j(this,D0,w,"f"),q(this,Q$,"m",oW).call(this,w),w.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":q(this,Q$,"m",sW).call(this,w);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":q(this,Q$,"m",tW).call(this,w);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":q(this,Q$,"m",lW).call(this,w);break;case"error":throw Error("Encountered an error event in event processing - errors should be processed earlier");default:sO(w)}},u1=function(){if(this.ended)throw new i("stream has ended, this shouldn't happen");if(!q(this,B6,"f"))throw Error("Final run has not been received");return q(this,B6,"f")},lW=function(w){let[U,v]=q(this,Q$,"m",aW).call(this,w,q(this,a$,"f"));j(this,a$,U,"f"),q(this,K0,"f")[U.id]=U;for(let J of v){let z=U.content[J.index];if(z?.type=="text")this._emit("textCreated",z.text)}switch(w.event){case"thread.message.created":this._emit("messageCreated",w.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",w.data.delta,U),w.data.delta.content)for(let J of w.data.delta.content){if(J.type=="text"&&J.text){let z=J.text,g=U.content[J.index];if(g&&g.type=="text")this._emit("textDelta",z,g.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(J.index!=q(this,Vw,"f")){if(q(this,P6,"f"))switch(q(this,P6,"f").type){case"text":this._emit("textDone",q(this,P6,"f").text,q(this,a$,"f"));break;case"image_file":this._emit("imageFileDone",q(this,P6,"f").image_file,q(this,a$,"f"));break}j(this,Vw,J.index,"f")}j(this,P6,U.content[J.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(q(this,Vw,"f")!==void 0){let J=w.data.content[q(this,Vw,"f")];if(J)switch(J.type){case"image_file":this._emit("imageFileDone",J.image_file,q(this,a$,"f"));break;case"text":this._emit("textDone",J.text,q(this,a$,"f"));break}}if(q(this,a$,"f"))this._emit("messageDone",w.data);j(this,a$,void 0,"f")}},tW=function(w){let U=q(this,Q$,"m",pW).call(this,w);switch(j(this,K1,U,"f"),w.event){case"thread.run.step.created":this._emit("runStepCreated",w.data);break;case"thread.run.step.delta":let v=w.data.delta;if(v.step_details&&v.step_details.type=="tool_calls"&&v.step_details.tool_calls&&U.step_details.type=="tool_calls")for(let z of v.step_details.tool_calls)if(z.index==q(this,T0,"f"))this._emit("toolCallDelta",z,U.step_details.tool_calls[z.index]);else{if(q(this,C$,"f"))this._emit("toolCallDone",q(this,C$,"f"));if(j(this,T0,z.index,"f"),j(this,C$,U.step_details.tool_calls[z.index],"f"),q(this,C$,"f"))this._emit("toolCallCreated",q(this,C$,"f"))}this._emit("runStepDelta",w.data.delta,U);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":if(j(this,K1,void 0,"f"),w.data.step_details.type=="tool_calls"){if(q(this,C$,"f"))this._emit("toolCallDone",q(this,C$,"f")),j(this,C$,void 0,"f")}this._emit("runStepDone",w.data,U);break;case"thread.run.step.in_progress":break}},oW=function(w){q(this,e2,"f").push(w),this._emit("event",w)},pW=function(w){switch(w.event){case"thread.run.step.created":return q(this,v4,"f")[w.data.id]=w.data,w.data;case"thread.run.step.delta":let U=q(this,v4,"f")[w.data.id];if(!U)throw Error("Received a RunStepDelta before creation of a snapshot");let v=w.data;if(v.delta){let J=O6.accumulateDelta(U,v.delta);q(this,v4,"f")[w.data.id]=J}return q(this,v4,"f")[w.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":q(this,v4,"f")[w.data.id]=w.data;break}if(q(this,v4,"f")[w.data.id])return q(this,v4,"f")[w.data.id];throw Error("No snapshot available")},aW=function(w,U){let v=[];switch(w.event){case"thread.message.created":return[w.data,v];case"thread.message.delta":if(!U)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let J=w.data;if(J.delta.content)for(let z of J.delta.content)if(z.index in U.content){let g=U.content[z.index];U.content[z.index]=q(this,Q$,"m",eW).call(this,z,g)}else U.content[z.index]=z,v.push(z);return[U,v];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(U)return[U,v];else throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},eW=function(w,U){return O6.accumulateDelta(U,w)},sW=function(w){switch(j(this,f0,w.data,"f"),w.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(j(this,B6,w.data,"f"),q(this,C$,"f"))this._emit("toolCallDone",q(this,C$,"f")),j(this,C$,void 0,"f");break;case"thread.run.cancelling":break}};function sO($){}class Gw extends O{constructor(){super(...arguments);this.steps=new L1(this._client)}create($,w,U){let{include:v,...J}=w;return this._client.post(Y`/threads/${$}/runs`,{query:{include:v},body:J,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),stream:w.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}retrieve($,w,U){let{thread_id:v}=w;return this._client.get(Y`/threads/${v}/runs/${$}`,{...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}update($,w,U){let{thread_id:v,...J}=w;return this._client.post(Y`/threads/${v}/runs/${$}`,{body:J,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/threads/${$}/runs`,y,{query:w,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}cancel($,w,U){let{thread_id:v}=w;return this._client.post(Y`/threads/${v}/runs/${$}/cancel`,{...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}async createAndPoll($,w,U){let v=await this.create($,w,U);return await this.poll(v.id,{thread_id:$},U)}createAndStream($,w,U){return k4.createAssistantStream($,this._client.beta.threads.runs,w,U)}async poll($,w,U){let v=f([U?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":U?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:J,response:z}=await this.retrieve($,w,{...U,headers:{...U?.headers,...v}}).withResponse();switch(J.status){case"queued":case"in_progress":case"cancelling":let g=5000;if(U?.pollIntervalMs)g=U.pollIntervalMs;else{let V=z.headers.get("openai-poll-after-ms");if(V){let _=parseInt(V);if(!isNaN(_))g=_}}await U4(g);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return J}}}stream($,w,U){return k4.createAssistantStream($,this._client.beta.threads.runs,w,U)}submitToolOutputs($,w,U){let{thread_id:v,...J}=w;return this._client.post(Y`/threads/${v}/runs/${$}/submit_tool_outputs`,{body:J,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),stream:w.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}async submitToolOutputsAndPoll($,w,U){let v=await this.submitToolOutputs($,w,U);return await this.poll(v.id,w,U)}submitToolOutputsStream($,w,U){return k4.createToolAssistantStream($,this._client.beta.threads.runs,w,U)}}Gw.Steps=L1;class q6 extends O{constructor(){super(...arguments);this.runs=new Gw(this._client),this.messages=new q1(this._client)}create($={},w){return this._client.post("/threads",{body:$,...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Y`/threads/${$}`,{...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}update($,w,U){return this._client.post(Y`/threads/${$}`,{body:w,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Y`/threads/${$}`,{...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}createAndRun($,w){return this._client.post("/threads/runs",{body:$,...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),stream:$.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}async createAndRunPoll($,w){let U=await this.createAndRun($,w);return await this.runs.poll(U.id,{thread_id:U.thread_id},w)}createAndRunStream($,w){return k4.createThreadAssistantStream($,this._client.beta.threads,w)}}q6.Runs=Gw;q6.Messages=q1;class z4 extends O{constructor(){super(...arguments);this.realtime=new Y6(this._client),this.chatkit=new Q6(this._client),this.assistants=new Y1(this._client),this.threads=new q6(this._client)}}z4.Realtime=Y6;z4.ChatKit=Q6;z4.Assistants=Y1;z4.Threads=q6;class _w extends O{create($,w){return this._client.post("/completions",{body:$,...w,stream:$.stream??!1,__security:{bearerAuth:!0}})}}class D1 extends O{retrieve($,w,U){let{container_id:v}=w;return this._client.get(Y`/containers/${v}/files/${$}/content`,{...U,headers:f([{Accept:"application/binary"},U?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}}class Xw extends O{constructor(){super(...arguments);this.content=new D1(this._client)}create($,w,U){return this._client.post(Y`/containers/${$}/files`,E4({body:w,...U,__security:{bearerAuth:!0}},this._client))}retrieve($,w,U){let{container_id:v}=w;return this._client.get(Y`/containers/${v}/files/${$}`,{...U,__security:{bearerAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/containers/${$}/files`,y,{query:w,...U,__security:{bearerAuth:!0}})}delete($,w,U){let{container_id:v}=w;return this._client.delete(Y`/containers/${v}/files/${$}`,{...U,headers:f([{Accept:"*/*"},U?.headers]),__security:{bearerAuth:!0}})}}Xw.Content=D1;class L6 extends O{constructor(){super(...arguments);this.files=new Xw(this._client)}create($,w){return this._client.post("/containers",{body:$,...w,__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Y`/containers/${$}`,{...w,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/containers",y,{query:$,...w,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Y`/containers/${$}`,{...w,headers:f([{Accept:"*/*"},w?.headers]),__security:{bearerAuth:!0}})}}L6.Files=Xw;class f1 extends O{create($,w,U){let{include:v,...J}=w;return this._client.post(Y`/conversations/${$}/items`,{query:{include:v},body:J,...U,__security:{bearerAuth:!0}})}retrieve($,w,U){let{conversation_id:v,...J}=w;return this._client.get(Y`/conversations/${v}/items/${$}`,{query:J,...U,__security:{bearerAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/conversations/${$}/items`,l,{query:w,...U,__security:{bearerAuth:!0}})}delete($,w,U){let{conversation_id:v}=w;return this._client.delete(Y`/conversations/${v}/items/${$}`,{...U,__security:{bearerAuth:!0}})}}class H6 extends O{constructor(){super(...arguments);this.items=new f1(this._client)}create($={},w){return this._client.post("/conversations",{body:$,...w,__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Y`/conversations/${$}`,{...w,__security:{bearerAuth:!0}})}update($,w,U){return this._client.post(Y`/conversations/${$}`,{body:w,...U,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Y`/conversations/${$}`,{...w,__security:{bearerAuth:!0}})}}H6.Items=f1;class Iw extends O{create($,w){let U=!!$.encoding_format,v=U?$.encoding_format:"base64";if(U)V$(this._client).debug("embeddings/user defined encoding_format:",$.encoding_format);let J=this._client.post("/embeddings",{body:{...$,encoding_format:v},...w,__security:{bearerAuth:!0}});if(U)return J;return V$(this._client).debug("embeddings/decoding base64 embeddings from base64"),J._thenUnwrap((z)=>{if(z&&z.data)z.data.forEach((g)=>{let V=g.embedding;g.embedding=cW(V)});return z})}}class T1 extends O{retrieve($,w,U){let{eval_id:v,run_id:J}=w;return this._client.get(Y`/evals/${v}/runs/${J}/output_items/${$}`,{...U,__security:{bearerAuth:!0}})}list($,w,U){let{eval_id:v,...J}=w;return this._client.getAPIList(Y`/evals/${v}/runs/${$}/output_items`,y,{query:J,...U,__security:{bearerAuth:!0}})}}class Nw extends O{constructor(){super(...arguments);this.outputItems=new T1(this._client)}create($,w,U){return this._client.post(Y`/evals/${$}/runs`,{body:w,...U,__security:{bearerAuth:!0}})}retrieve($,w,U){let{eval_id:v}=w;return this._client.get(Y`/evals/${v}/runs/${$}`,{...U,__security:{bearerAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/evals/${$}/runs`,y,{query:w,...U,__security:{bearerAuth:!0}})}delete($,w,U){let{eval_id:v}=w;return this._client.delete(Y`/evals/${v}/runs/${$}`,{...U,__security:{bearerAuth:!0}})}cancel($,w,U){let{eval_id:v}=w;return this._client.post(Y`/evals/${v}/runs/${$}`,{...U,__security:{bearerAuth:!0}})}}Nw.OutputItems=T1;class u6 extends O{constructor(){super(...arguments);this.runs=new Nw(this._client)}create($,w){return this._client.post("/evals",{body:$,...w,__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Y`/evals/${$}`,{...w,__security:{bearerAuth:!0}})}update($,w,U){return this._client.post(Y`/evals/${$}`,{body:w,...U,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/evals",y,{query:$,...w,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Y`/evals/${$}`,{...w,__security:{bearerAuth:!0}})}}u6.Runs=Nw;class Ww extends O{create($,w){return this._client.post("/files",q$({body:$,...w,__security:{bearerAuth:!0}},this._client))}retrieve($,w){return this._client.get(Y`/files/${$}`,{...w,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/files",y,{query:$,...w,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Y`/files/${$}`,{...w,__security:{bearerAuth:!0}})}content($,w){return this._client.get(Y`/files/${$}/content`,{...w,headers:f([{Accept:"application/binary"},w?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}async waitForProcessing($,{pollInterval:w=5000,maxWait:U=1800000}={}){let v=new Set(["processed","error","deleted"]),J=Date.now(),z=await this.retrieve($);while(!z.status||!v.has(z.status))if(await U4(w),z=await this.retrieve($),Date.now()-J>U)throw new V6({message:`Giving up on waiting for file ${$} to finish processing after ${U} milliseconds.`});return z}}class Z1 extends O{}class b1 extends O{run($,w){return this._client.post("/fine_tuning/alpha/graders/run",{body:$,...w,__security:{bearerAuth:!0}})}validate($,w){return this._client.post("/fine_tuning/alpha/graders/validate",{body:$,...w,__security:{bearerAuth:!0}})}}class Yw extends O{constructor(){super(...arguments);this.graders=new b1(this._client)}}Yw.Graders=b1;class F1 extends O{create($,w,U){return this._client.getAPIList(Y`/fine_tuning/checkpoints/${$}/permissions`,D$,{body:w,method:"post",...U,__security:{adminAPIKeyAuth:!0}})}retrieve($,w={},U){return this._client.get(Y`/fine_tuning/checkpoints/${$}/permissions`,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/fine_tuning/checkpoints/${$}/permissions`,l,{query:w,...U,__security:{adminAPIKeyAuth:!0}})}delete($,w,U){let{fine_tuned_model_checkpoint:v}=w;return this._client.delete(Y`/fine_tuning/checkpoints/${v}/permissions/${$}`,{...U,__security:{adminAPIKeyAuth:!0}})}}class Qw extends O{constructor(){super(...arguments);this.permissions=new F1(this._client)}}Qw.Permissions=F1;class M1 extends O{list($,w={},U){return this._client.getAPIList(Y`/fine_tuning/jobs/${$}/checkpoints`,y,{query:w,...U,__security:{bearerAuth:!0}})}}class Pw extends O{constructor(){super(...arguments);this.checkpoints=new M1(this._client)}create($,w){return this._client.post("/fine_tuning/jobs",{body:$,...w,__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Y`/fine_tuning/jobs/${$}`,{...w,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/fine_tuning/jobs",y,{query:$,...w,__security:{bearerAuth:!0}})}cancel($,w){return this._client.post(Y`/fine_tuning/jobs/${$}/cancel`,{...w,__security:{bearerAuth:!0}})}listEvents($,w={},U){return this._client.getAPIList(Y`/fine_tuning/jobs/${$}/events`,y,{query:w,...U,__security:{bearerAuth:!0}})}pause($,w){return this._client.post(Y`/fine_tuning/jobs/${$}/pause`,{...w,__security:{bearerAuth:!0}})}resume($,w){return this._client.post(Y`/fine_tuning/jobs/${$}/resume`,{...w,__security:{bearerAuth:!0}})}}Pw.Checkpoints=M1;class g4 extends O{constructor(){super(...arguments);this.methods=new Z1(this._client),this.jobs=new Pw(this._client),this.checkpoints=new Qw(this._client),this.alpha=new Yw(this._client)}}g4.Methods=Z1;g4.Jobs=Pw;g4.Checkpoints=Qw;g4.Alpha=Yw;class i1 extends O{}class K6 extends O{constructor(){super(...arguments);this.graderModels=new i1(this._client)}}K6.GraderModels=i1;class Ow extends O{createVariation($,w){return this._client.post("/images/variations",q$({body:$,...w,__security:{bearerAuth:!0}},this._client))}edit($,w){return this._client.post("/images/edits",q$({body:$,...w,stream:$.stream??!1,__security:{bearerAuth:!0}},this._client))}generate($,w){return this._client.post("/images/generations",{body:$,...w,stream:$.stream??!1,__security:{bearerAuth:!0}})}}class Bw extends O{retrieve($,w){return this._client.get(Y`/models/${$}`,{...w,__security:{bearerAuth:!0}})}list($){return this._client.getAPIList("/models",D$,{...$,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Y`/models/${$}`,{...w,__security:{bearerAuth:!0}})}}class qw extends O{create($,w){return this._client.post("/moderations",{body:$,...w,__security:{bearerAuth:!0}})}}class E1 extends O{accept($,w,U){return this._client.post(Y`/realtime/calls/${$}/accept`,{body:w,...U,headers:f([{Accept:"*/*"},U?.headers]),__security:{bearerAuth:!0}})}hangup($,w){return this._client.post(Y`/realtime/calls/${$}/hangup`,{...w,headers:f([{Accept:"*/*"},w?.headers]),__security:{bearerAuth:!0}})}refer($,w,U){return this._client.post(Y`/realtime/calls/${$}/refer`,{body:w,...U,headers:f([{Accept:"*/*"},U?.headers]),__security:{bearerAuth:!0}})}reject($,w={},U){return this._client.post(Y`/realtime/calls/${$}/reject`,{body:w,...U,headers:f([{Accept:"*/*"},U?.headers]),__security:{bearerAuth:!0}})}}class S1 extends O{create($,w){return this._client.post("/realtime/client_secrets",{body:$,...w,__security:{bearerAuth:!0}})}}class C4 extends O{constructor(){super(...arguments);this.clientSecrets=new S1(this._client),this.calls=new E1(this._client)}}C4.ClientSecrets=S1;C4.Calls=E1;function $3($,w){if(!w||!BB(w)){let U={...$,output_parsed:null,output:$.output.map((v)=>{if(v.type==="function_call")return{...v,parsed_arguments:null};if(v.type==="message")return{...v,content:v.content.map((J)=>({...J,parsed:null}))};else return v})};if(w3($,U))j$(U);return U}return s2($,w)}function s2($,w){let U=!$.status||$.status==="completed",v=$.output.map((z)=>{if(z.type==="function_call")return{...z,parsed_arguments:U?HB(w,z):null};if(z.type==="message"){let g=z.content.map((V)=>{if(V.type==="output_text")return{...V,parsed:U?OB(w,V.text):null};return V});return{...z,content:g}}return z}),J=Object.assign({},$,{output:v});if(w3($,J))j$(J);return Object.defineProperty(J,"output_parsed",{enumerable:!0,get(){for(let z of J.output){if(z.type!=="message")continue;for(let g of z.content)if(g.type==="output_text"&&g.parsed!==null)return g.parsed}return null}}),J}function OB($,w){if($.text?.format?.type!=="json_schema")return null;if("$parseRaw"in $.text?.format)return($.text?.format).$parseRaw(w);return JSON.parse(w)}function BB($){if(RU($.text?.format))return!0;return!1}function qB($){return $?.$brand==="auto-parseable-tool"}function LB($,w){return $.find((U)=>U.type==="function"&&U.name===w)}function HB($,w){let U=LB($.tools??[],w.name);return{...w,...w,parsed_arguments:qB(U)?U.$parseRaw(w.arguments):U?.strict?JSON.parse(w.arguments):null}}function w3($,w){return!Object.getOwnPropertyDescriptor($,"output_text")||w.output_text==null}function j$($){let w=[];for(let U of $.output){if(U.type!=="message")continue;for(let v of U.content)if(v.type==="output_text")w.push(v.text)}$.output_text=w.join("")}function J3($,w){if(!w){if($.type!=="response.created")throw new i(`When snapshot hasn't been set yet, expected 'response.created' event, got ${$.type}`);return U3($.response)}switch($.type){case"response.output_item.added":{if(w.output.push(structuredClone($.item)),$.item.type==="message")j$(w);break}case"response.output_item.done":{if(c(w,$.output_index),w.output[$.output_index]=structuredClone($.item),$.item.type==="message")j$(w);break}case"response.content_part.added":{let U=c(w,$.output_index),v=U.type,J=$.part;if(v==="message"&&J.type!=="reasoning_text"){if(U.content.push(structuredClone(J)),J.type==="output_text")j$(w)}else if(v==="reasoning"&&J.type==="reasoning_text"){if(!U.content)U.content=[];U.content.push(structuredClone(J))}break}case"response.content_part.done":{let U=c(w,$.output_index),v=$.part;if(U.type==="message"&&v.type!=="reasoning_text"){if(m$(U.content,$.content_index),U.content[$.content_index]=structuredClone(v),v.type==="output_text")j$(w)}else if(U.type==="reasoning"&&v.type==="reasoning_text"){let J=U.content;if(!J)throw new i(`missing content at index ${$.content_index}`);m$(J,$.content_index),J[$.content_index]=structuredClone(v)}break}case"response.output_text.delta":{let U=c(w,$.output_index);if(U.type==="message"){let v=m$(U.content,$.content_index);if(v.type!=="output_text")throw new i(`expected content to be 'output_text', got ${v.type}`);v.text+=$.delta,w.output_text+=$.delta}break}case"response.output_text.done":{let U=c(w,$.output_index);if(U.type==="message"){let v=m$(U.content,$.content_index);if(v.type!=="output_text")throw new i(`expected content to be 'output_text', got ${v.type}`);v.text=$.text,j$(w)}break}case"response.output_text.annotation.added":{let U=c(w,$.output_index);if(U.type==="message"){let v=m$(U.content,$.content_index);if(v.type!=="output_text")throw new i(`expected content to be 'output_text', got ${v.type}`);v.annotations[$.annotation_index]=structuredClone($.annotation)}break}case"response.refusal.delta":{let U=c(w,$.output_index);if(U.type==="message"){let v=m$(U.content,$.content_index);if(v.type!=="refusal")throw new i(`expected content to be 'refusal', got ${v.type}`);v.refusal+=$.delta}break}case"response.refusal.done":{let U=c(w,$.output_index);if(U.type==="message"){let v=m$(U.content,$.content_index);if(v.type!=="refusal")throw new i(`expected content to be 'refusal', got ${v.type}`);v.refusal=$.refusal}break}case"response.function_call_arguments.delta":{let U=c(w,$.output_index);if(U.type==="function_call")U.arguments+=$.delta;break}case"response.function_call_arguments.done":{let U=c(w,$.output_index);if(U.type==="function_call")U.arguments=$.arguments;break}case"response.reasoning_text.delta":{let U=c(w,$.output_index);if(U.type==="reasoning"){if(!U.content)throw new i(`missing content at index ${$.content_index}`);let v=m$(U.content,$.content_index);if(v.type!=="reasoning_text")throw new i(`expected content to be 'reasoning_text', got ${v.type}`);v.text+=$.delta}break}case"response.reasoning_text.done":{let U=c(w,$.output_index);if(U.type==="reasoning"){if(!U.content)throw new i(`missing content at index ${$.content_index}`);let v=m$(U.content,$.content_index);if(v.type!=="reasoning_text")throw new i(`expected content to be 'reasoning_text', got ${v.type}`);v.text=$.text}break}case"response.reasoning_summary_part.added":{let U=c(w,$.output_index);if(U.type==="reasoning")U.summary.push(structuredClone($.part));break}case"response.reasoning_summary_part.done":{let U=c(w,$.output_index);if(U.type==="reasoning")m$(U.summary,$.summary_index),U.summary[$.summary_index]=structuredClone($.part);break}case"response.reasoning_summary_text.delta":{let U=c(w,$.output_index);if(U.type==="reasoning"){let v=m$(U.summary,$.summary_index);v.text+=$.delta}break}case"response.reasoning_summary_text.done":{let U=c(w,$.output_index);if(U.type==="reasoning"){let v=m$(U.summary,$.summary_index);v.text=$.text}break}case"response.custom_tool_call_input.delta":{let U=c(w,$.output_index);if(U.type==="custom_tool_call")U.input+=$.delta;break}case"response.custom_tool_call_input.done":{let U=c(w,$.output_index);if(U.type==="custom_tool_call")U.input=$.input;break}case"response.mcp_call_arguments.delta":{let U=c(w,$.output_index);if(U.type==="mcp_call")U.arguments+=$.delta;break}case"response.mcp_call_arguments.done":{let U=c(w,$.output_index);if(U.type==="mcp_call")U.arguments=$.arguments;break}case"response.code_interpreter_call_code.delta":{let U=c(w,$.output_index);if(U.type==="code_interpreter_call")U.code=(U.code??"")+$.delta;break}case"response.code_interpreter_call_code.done":{let U=c(w,$.output_index);if(U.type==="code_interpreter_call")U.code=$.code;break}case"response.code_interpreter_call.in_progress":{let U=c(w,$.output_index);if(U.type==="code_interpreter_call")U.status="in_progress";break}case"response.code_interpreter_call.interpreting":{let U=c(w,$.output_index);if(U.type==="code_interpreter_call")U.status="interpreting";break}case"response.code_interpreter_call.completed":{let U=c(w,$.output_index);if(U.type==="code_interpreter_call")U.status="completed";break}case"response.file_search_call.in_progress":{let U=c(w,$.output_index);if(U.type==="file_search_call")U.status="in_progress";break}case"response.file_search_call.searching":{let U=c(w,$.output_index);if(U.type==="file_search_call")U.status="searching";break}case"response.file_search_call.completed":{let U=c(w,$.output_index);if(U.type==="file_search_call")U.status="completed";break}case"response.web_search_call.in_progress":{let U=c(w,$.output_index);if(U.type==="web_search_call")U.status="in_progress";break}case"response.web_search_call.searching":{let U=c(w,$.output_index);if(U.type==="web_search_call")U.status="searching";break}case"response.web_search_call.completed":{let U=c(w,$.output_index);if(U.type==="web_search_call")U.status="completed";break}case"response.image_generation_call.in_progress":{let U=c(w,$.output_index);if(U.type==="image_generation_call")U.status="in_progress";break}case"response.image_generation_call.generating":{let U=c(w,$.output_index);if(U.type==="image_generation_call")U.status="generating";break}case"response.image_generation_call.completed":{let U=c(w,$.output_index);if(U.type==="image_generation_call")U.status="completed";break}case"response.mcp_call.in_progress":{let U=c(w,$.output_index);if(U.type==="mcp_call")U.status="in_progress";break}case"response.mcp_call.completed":{let U=c(w,$.output_index);if(U.type==="mcp_call")U.status="completed";break}case"response.mcp_call.failed":{let U=c(w,$.output_index);if(U.type==="mcp_call")U.status="failed";break}case"response.created":case"response.queued":case"response.in_progress":case"response.completed":case"response.failed":case"response.incomplete":{w=U3($.response);break}case"response.audio.delta":case"response.audio.done":case"response.audio.transcript.delta":case"response.audio.transcript.done":case"response.image_generation_call.partial_image":case"response.mcp_list_tools.in_progress":case"response.mcp_list_tools.completed":case"response.mcp_list_tools.failed":case"error":break;default:uB($)}return w}function U3($){let w=structuredClone($);if(!Object.getOwnPropertyDescriptor(w,"output_text")||w.output_text==null)j$(w);return w}function c($,w){let U=$.output[w];if(!U)throw new i(`missing output at index ${w}`);return U}function m$($,w){let U=$[w];if(!U)throw new i(`missing content at index ${w}`);return U}function uB($){throw new i(`Unhandled response stream event: ${JSON.stringify($)}`)}var A1,Z0,D6,b0,v3,z3,g3;class F0 extends X6{constructor($){super();A1.add(this),Z0.set(this,void 0),D6.set(this,void 0),b0.set(this,void 0),j(this,Z0,$,"f")}static createResponse($,w,U){let v=new F0(w);return v._run(()=>v._createOrRetrieveResponse($,w,{...U,headers:{...U?.headers,"X-Stainless-Helper-Method":"stream"}})),v}async _createOrRetrieveResponse($,w,U){this._listenForAbort(U?.signal),q(this,A1,"m",v3).call(this);let v,J=null;if("response_id"in w)v=await $.responses.retrieve(w.response_id,{stream:!0},{...U,signal:this.controller.signal,stream:!0}),J=w.starting_after??null;else v=await $.responses.create({...w,stream:!0},{...U,signal:this.controller.signal});this._connected();for await(let z of v)q(this,A1,"m",z3).call(this,z,J);if(v.controller.signal?.aborted)throw new _$;return q(this,A1,"m",g3).call(this)}[(Z0=new WeakMap,D6=new WeakMap,b0=new WeakMap,A1=new WeakSet,v3=function(){if(this.ended)return;j(this,D6,void 0,"f")},z3=function(w,U){if(this.ended)return;let v=(z,g)=>{if(U==null||g.sequence_number>U)this._emit(z,g)},J=J3(w,q(this,D6,"f"));switch(j(this,D6,J,"f"),v("event",w),w.type){case"response.output_text.delta":{let z=J.output[w.output_index];if(!z)throw new i(`missing output at index ${w.output_index}`);if(z.type==="message"){let g=z.content[w.content_index];if(!g)throw new i(`missing content at index ${w.content_index}`);if(g.type!=="output_text")throw new i(`expected content to be 'output_text', got ${g.type}`);v("response.output_text.delta",{...w,snapshot:g.text})}break}case"response.function_call_arguments.delta":{let z=J.output[w.output_index];if(!z)throw new i(`missing output at index ${w.output_index}`);if(z.type==="function_call")v("response.function_call_arguments.delta",{...w,snapshot:z.arguments});break}default:v(w.type,w);break}},g3=function(){if(this.ended)throw new i("stream has ended, this shouldn't happen");let w=q(this,D6,"f");if(!w)throw new i("request ended without sending any events");j(this,D6,void 0,"f");let U=KB(w,q(this,Z0,"f"));return j(this,b0,U,"f"),U},Symbol.asyncIterator)](){let $=[],w=[],U=!1;return this.on("event",(v)=>{let J=w.shift();if(J)J.resolve(v);else $.push(v)}),this.on("end",()=>{U=!0;for(let v of w)v.resolve(void 0);w.length=0}),this.on("abort",(v)=>{U=!0;for(let J of w)J.reject(v);w.length=0}),this.on("error",(v)=>{U=!0;for(let J of w)J.reject(v);w.length=0}),{next:async()=>{if(!$.length){if(U)return{value:void 0,done:!0};return new Promise((J,z)=>w.push({resolve:J,reject:z})).then((J)=>J?{value:J,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 $=q(this,b0,"f");if(!$)throw new i("stream ended without producing a ChatCompletion");return $}}function KB($,w){return $3($,w)}class R1 extends O{list($,w={},U){return this._client.getAPIList(Y`/responses/${$}/input_items`,y,{query:w,...U,__security:{bearerAuth:!0}})}}class k1 extends O{count($={},w){return this._client.post("/responses/input_tokens",{body:$,...w,__security:{bearerAuth:!0}})}}class u4 extends O{constructor(){super(...arguments);this.inputItems=new R1(this._client),this.inputTokens=new k1(this._client)}create($,w){return this._client.post("/responses",{body:$,...w,stream:$.stream??!1,__security:{bearerAuth:!0}})._thenUnwrap((U)=>{if("object"in U&&U.object==="response")j$(U);return U})}retrieve($,w={},U){return this._client.get(Y`/responses/${$}`,{query:w,...U,stream:w?.stream??!1,__security:{bearerAuth:!0}})._thenUnwrap((v)=>{if("object"in v&&v.object==="response")j$(v);return v})}delete($,w){return this._client.delete(Y`/responses/${$}`,{...w,headers:f([{Accept:"*/*"},w?.headers]),__security:{bearerAuth:!0}})}parse($,w){return this._client.responses.create($,w)._thenUnwrap((U)=>s2(U,$))}stream($,w){return F0.createResponse(this._client,$,w)}cancel($,w){return this._client.post(Y`/responses/${$}/cancel`,{...w,__security:{bearerAuth:!0}})}compact($,w){return this._client.post("/responses/compact",{body:$,...w,__security:{bearerAuth:!0}})}}u4.InputItems=R1;u4.InputTokens=k1;class C1 extends O{retrieve($,w){return this._client.get(Y`/skills/${$}/content`,{...w,headers:f([{Accept:"application/binary"},w?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}}class j1 extends O{retrieve($,w,U){let{skill_id:v}=w;return this._client.get(Y`/skills/${v}/versions/${$}/content`,{...U,headers:f([{Accept:"application/binary"},U?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}}class Lw extends O{constructor(){super(...arguments);this.content=new j1(this._client)}create($,w={},U){return this._client.post(Y`/skills/${$}/versions`,E4({body:w,...U,__security:{bearerAuth:!0}},this._client))}retrieve($,w,U){let{skill_id:v}=w;return this._client.get(Y`/skills/${v}/versions/${$}`,{...U,__security:{bearerAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/skills/${$}/versions`,y,{query:w,...U,__security:{bearerAuth:!0}})}delete($,w,U){let{skill_id:v}=w;return this._client.delete(Y`/skills/${v}/versions/${$}`,{...U,__security:{bearerAuth:!0}})}}Lw.Content=j1;class j4 extends O{constructor(){super(...arguments);this.content=new C1(this._client),this.versions=new Lw(this._client)}create($={},w){return this._client.post("/skills",E4({body:$,...w,__security:{bearerAuth:!0}},this._client))}retrieve($,w){return this._client.get(Y`/skills/${$}`,{...w,__security:{bearerAuth:!0}})}update($,w,U){return this._client.post(Y`/skills/${$}`,{body:w,...U,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/skills",y,{query:$,...w,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Y`/skills/${$}`,{...w,__security:{bearerAuth:!0}})}}j4.Content=C1;j4.Versions=Lw;class x1 extends O{create($,w,U){return this._client.post(Y`/uploads/${$}/parts`,q$({body:w,...U,__security:{bearerAuth:!0}},this._client))}}class f6 extends O{constructor(){super(...arguments);this.parts=new x1(this._client)}create($,w){return this._client.post("/uploads",{body:$,...w,__security:{bearerAuth:!0}})}cancel($,w){return this._client.post(Y`/uploads/${$}/cancel`,{...w,__security:{bearerAuth:!0}})}complete($,w,U){return this._client.post(Y`/uploads/${$}/complete`,{body:w,...U,__security:{bearerAuth:!0}})}}f6.Parts=x1;var V3=async($)=>{let w=await Promise.allSettled($),U=w.filter((J)=>J.status==="rejected");if(U.length){for(let J of U)console.error(J.reason);throw Error(`${U.length} promise(s) failed - see the above errors`)}let v=[];for(let J of w)if(J.status==="fulfilled")v.push(J.value);return v};class r1 extends O{create($,w,U){return this._client.post(Y`/vector_stores/${$}/file_batches`,{body:w,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}retrieve($,w,U){let{vector_store_id:v}=w;return this._client.get(Y`/vector_stores/${v}/file_batches/${$}`,{...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}cancel($,w,U){let{vector_store_id:v}=w;return this._client.post(Y`/vector_stores/${v}/file_batches/${$}/cancel`,{...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}async createAndPoll($,w,U){let v=await this.create($,w);return await this.poll($,v.id,U)}listFiles($,w,U){let{vector_store_id:v,...J}=w;return this._client.getAPIList(Y`/vector_stores/${v}/file_batches/${$}/files`,y,{query:J,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}async poll($,w,U){let v=f([U?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":U?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:J,response:z}=await this.retrieve(w,{vector_store_id:$},{...U,headers:v}).withResponse();switch(J.status){case"in_progress":let g=5000;if(U?.pollIntervalMs)g=U.pollIntervalMs;else{let V=z.headers.get("openai-poll-after-ms");if(V){let _=parseInt(V);if(!isNaN(_))g=_}}await U4(g);break;case"failed":case"cancelled":case"completed":return J}}}async uploadAndPoll($,{files:w,fileIds:U=[]},v){if(w==null||w.length==0)throw Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let J=v?.maxConcurrency??5,z=Math.min(J,w.length),g=this._client,V=w.values(),_=[...U];async function G(I){for(let N of I){let W=await g.files.create({file:N,purpose:"assistants"},v);_.push(W.id)}}let X=Array(z).fill(V).map(G);return await V3(X),await this.createAndPoll($,{file_ids:_})}}class y1 extends O{create($,w,U){return this._client.post(Y`/vector_stores/${$}/files`,{body:w,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}retrieve($,w,U){let{vector_store_id:v}=w;return this._client.get(Y`/vector_stores/${v}/files/${$}`,{...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}update($,w,U){let{vector_store_id:v,...J}=w;return this._client.post(Y`/vector_stores/${v}/files/${$}`,{body:J,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}list($,w={},U){return this._client.getAPIList(Y`/vector_stores/${$}/files`,y,{query:w,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}delete($,w,U){let{vector_store_id:v}=w;return this._client.delete(Y`/vector_stores/${v}/files/${$}`,{...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}async createAndPoll($,w,U){let v=await this.create($,w,U);return await this.poll($,v.id,U)}async poll($,w,U){let v=f([U?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":U?.pollIntervalMs?.toString()??void 0}]);while(!0){let J=await this.retrieve(w,{vector_store_id:$},{...U,headers:v}).withResponse(),z=J.data;switch(z.status){case"in_progress":let g=5000;if(U?.pollIntervalMs)g=U.pollIntervalMs;else{let V=J.response.headers.get("openai-poll-after-ms");if(V){let _=parseInt(V);if(!isNaN(_))g=_}}await U4(g);break;case"failed":case"completed":return z}}}async upload($,w,U){let v=await this._client.files.create({file:w,purpose:"assistants"},U);return this.create($,{file_id:v.id},U)}async uploadAndPoll($,w,U){let v=await this.upload($,w,U);return await this.poll($,v.id,U)}content($,w,U){let{vector_store_id:v}=w;return this._client.getAPIList(Y`/vector_stores/${v}/files/${$}/content`,D$,{...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}}class x4 extends O{constructor(){super(...arguments);this.files=new y1(this._client),this.fileBatches=new r1(this._client)}create($,w){return this._client.post("/vector_stores",{body:$,...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Y`/vector_stores/${$}`,{...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}update($,w,U){return this._client.post(Y`/vector_stores/${$}`,{body:w,...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/vector_stores",y,{query:$,...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Y`/vector_stores/${$}`,{...w,headers:f([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}search($,w,U){return this._client.getAPIList(Y`/vector_stores/${$}/search`,D$,{body:w,method:"post",...U,headers:f([{"OpenAI-Beta":"assistants=v2"},U?.headers]),__security:{bearerAuth:!0}})}}x4.Files=y1;x4.FileBatches=r1;class Hw extends O{create($,w){return this._client.post("/videos",q$({body:$,...w,__security:{bearerAuth:!0}},this._client))}retrieve($,w){return this._client.get(Y`/videos/${$}`,{...w,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/videos",l,{query:$,...w,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Y`/videos/${$}`,{...w,__security:{bearerAuth:!0}})}createCharacter($,w){return this._client.post("/videos/characters",q$({body:$,...w,__security:{bearerAuth:!0}},this._client))}downloadContent($,w={},U){return this._client.get(Y`/videos/${$}/content`,{query:w,...U,headers:f([{Accept:"application/binary"},U?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}edit($,w){return this._client.post("/videos/edits",q$({body:$,...w,__security:{bearerAuth:!0}},this._client))}extend($,w){return this._client.post("/videos/extensions",q$({body:$,...w,__security:{bearerAuth:!0}},this._client))}getCharacter($,w){return this._client.get(Y`/videos/characters/${$}`,{...w,__security:{bearerAuth:!0}})}remix($,w,U){return this._client.post(Y`/videos/${$}/remix`,E4({body:w,...U,__security:{bearerAuth:!0}},this._client))}}var uw,G3,M0;class Kw extends O{constructor(){super(...arguments);uw.add(this)}async unwrap($,w,U=this._client.webhookSecret,v=300){return await this.verifySignature($,w,U,v),JSON.parse($)}async verifySignature($,w,U=this._client.webhookSecret,v=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!=="function"||typeof crypto.subtle.verify!=="function")throw Error("Webhook signature verification is only supported when the `crypto` global is defined");q(this,uw,"m",G3).call(this,U);let J=f([w]).values,z=q(this,uw,"m",M0).call(this,J,"webhook-signature"),g=q(this,uw,"m",M0).call(this,J,"webhook-timestamp"),V=q(this,uw,"m",M0).call(this,J,"webhook-id"),_=parseInt(g,10);if(isNaN(_))throw new O4("Invalid webhook timestamp format");let G=Math.floor(Date.now()/1000);if(G-_>v)throw new O4("Webhook timestamp is too old");if(_>G+v)throw new O4("Webhook timestamp is too new");let X=z.split(" ").map((P)=>P.startsWith("v1,")?P.substring(3):P),I=U.startsWith("whsec_")?Buffer.from(U.replace("whsec_",""),"base64"):Buffer.from(U,"utf-8"),N=V?`${V}.${g}.${$}`:`${g}.${$}`,W=await crypto.subtle.importKey("raw",I,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let P of X)try{let Q=Buffer.from(P,"base64");if(await crypto.subtle.verify("HMAC",W,Q,new TextEncoder().encode(N)))return}catch{continue}throw new O4("The given webhook signature does not match the expected signature")}}uw=new WeakSet,G3=function(w){if(typeof w!=="string"||w.length===0)throw Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},M0=function(w,U){if(!w)throw Error("Headers are required");let v=w.get(U);if(v===null||v===void 0)throw Error(`Missing required header: ${U}`);return v};var X3=Symbol.for("openai.node.providerDefinitions.v1"),I3=globalThis,N3=I3[X3],W3=N3??new WeakMap;if(!N3)Object.defineProperty(I3,X3,{value:W3});function Y3($){let w=W3.get($);if(!w)throw Error("Invalid provider. Providers must be created with createProvider().");return w.configure()}var $g,wg,d1,Q3,EB="workload-identity-auth";class r{constructor($={}){$g.add(this),d1.set(this,void 0),this.completions=new _w(this),this.chat=new I6(this),this.embeddings=new Iw(this),this.files=new Ww(this),this.images=new Ow(this),this.audio=new H4(this),this.moderations=new qw(this),this.models=new Bw(this),this.fineTuning=new g4(this),this.graders=new K6(this),this.vectorStores=new x4(this),this.webhooks=new Kw(this),this.beta=new z4(this),this.batches=new gw(this),this.uploads=new f6(this),this.admin=new W6(this),this.responses=new u4(this),this.realtime=new C4(this),this.conversations=new H6(this),this.evals=new u6(this),this.containers=new L6(this),this.skills=new j4(this),this.videos=new Hw(this);let w=$.provider;if(w){let P=["apiKey","adminAPIKey","workloadIdentity","baseURL"].filter((Q)=>$[Q]!=null);if(P.length)throw new i(`The \`provider\` option cannot be used with ${P.map((Q)=>`\`${Q}\``).join(", ")}. Configure authentication and the base URL through the provider instead.`)}let{baseURL:U=w?null:p$("OPENAI_BASE_URL"),apiKey:v=w?null:p$("OPENAI_API_KEY")??null,adminAPIKey:J=w?null:p$("OPENAI_ADMIN_KEY")??null,organization:z=w?null:p$("OPENAI_ORG_ID")??null,project:g=w?null:p$("OPENAI_PROJECT_ID")??null,webhookSecret:V=p$("OPENAI_WEBHOOK_SECRET")??null,workloadIdentity:_,...G}=$,X=w?Y3(w):void 0,I={apiKey:v,adminAPIKey:J,organization:z,project:g,webhookSecret:V,workloadIdentity:_,provider:w,...G,baseURL:X?.baseURL??(U||"https://api.openai.com/v1")};if(v&&_)throw new i("The `apiKey` and `workloadIdentity` options are mutually exclusive");if(!X&&!v&&!J&&!_)throw new i("Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.");if(!I.dangerouslyAllowBrowser&&zW())throw new i(`It looks like you're running in a browser-like environment.
|
|
177
|
+
${z}
|
|
178
|
+
${I}`)}return z},Q=fH(L2);class Aw extends K{list($,w={},J){return this._client.getAPIList(Q`/chat/completions/${$}/messages`,d,{query:w,...J,__security:{bearerAuth:!0}})}}function HU($){return $!==void 0&&"function"in $&&$.function!==void 0}function FU($){return $?.$brand==="auto-parseable-response-format"}function r6($){return $?.$brand==="auto-parseable-tool"}function M2($,w){if(!w||!si(w))return{...$,choices:$.choices.map((J)=>{return S2(J.message.tool_calls),{...J,message:{...J.message,parsed:null,...J.message.tool_calls?{tool_calls:J.message.tool_calls}:void 0}}})};return qU($,w)}function qU($,w){let J=$.choices.map((V)=>{if(V.finish_reason==="length")throw new YU;if(V.finish_reason==="content_filter")throw new vU;return S2(V.message.tool_calls),{...V,message:{...V.message,...V.message.tool_calls?{tool_calls:V.message.tool_calls?.map((U)=>SH(w,U))??void 0}:void 0,parsed:V.message.content&&!V.message.refusal?AH(w,V.message.content):null}}});return{...$,choices:J}}function AH($,w){if($.response_format?.type!=="json_schema")return null;if($.response_format?.type==="json_schema"){if("$parseRaw"in $.response_format)return $.response_format.$parseRaw(w);return JSON.parse(w)}return null}function SH($,w){let J=$.tools?.find((V)=>HU(V)&&V.function?.name===w.function.name);return{...w,function:{...w.function,parsed_arguments:r6(J)?J.$parseRaw(w.function.arguments):J?.function.strict?JSON.parse(w.function.arguments):null}}}function A2($,w){if(!$||!("tools"in $)||!$.tools)return!1;let J=$.tools?.find((V)=>HU(V)&&V.function?.name===w.function.name);return HU(J)&&(r6(J)||J?.function.strict||!1)}function si($){if(FU($.response_format))return!0;return $.tools?.some((w)=>r6(w)||w.type==="function"&&w.function.strict===!0)??!1}function S2($){for(let w of $||[])if(w.type!=="function")throw new R(`Currently only \`function\` tool calls are supported; Received \`${w.type}\``)}function _2($){for(let w of $??[]){if(w.type!=="function")throw new R(`Currently only \`function\` tool types support auto-parsing; Received \`${w.type}\``);if(w.function.strict!==!0)throw new R(`The \`${w.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Sw=($)=>{return $?.role==="assistant"},$X=($)=>{return $?.role==="tool"};var zV,iV,XV,ZU,TU,NV,DU,x4,WV,LU,IV,gV,_w,k2,R2;class n6{constructor(){zV.add(this),this.controller=new AbortController,iV.set(this,void 0),XV.set(this,()=>{}),ZU.set(this,()=>{}),TU.set(this,void 0),NV.set(this,()=>{}),DU.set(this,()=>{}),x4.set(this,{}),WV.set(this,[]),LU.set(this,!1),IV.set(this,!1),gV.set(this,!1),_w.set(this,!1),x(this,iV,new Promise(($,w)=>{x(this,XV,$,"f"),x(this,ZU,w,"f")}),"f"),x(this,TU,new Promise(($,w)=>{x(this,NV,$,"f"),x(this,DU,w,"f")}),"f"),B(this,iV,"f").catch(()=>{}),B(this,TU,"f").catch(()=>{})}_run($){setTimeout(()=>{$().then(()=>{this._emitFinal(),this._emit("end")},B(this,zV,"m",R2).bind(this))},0)}_connected(){if(this.ended)return;B(this,XV,"f").call(this),this._emit("connect")}get ended(){return B(this,LU,"f")}get errored(){return B(this,IV,"f")}get aborted(){return B(this,gV,"f")}abort(){this.controller.abort()}_listenForAbort($){if(!$||this.ended)return;if($.aborted){this.controller.abort();return}let w=()=>this.controller.abort();$.addEventListener("abort",w,{once:!0}),B(this,WV,"f").push({signal:$,listener:w})}on($,w){return(B(this,x4,"f")[$]||(B(this,x4,"f")[$]=[])).push({listener:w}),this}off($,w){let J=B(this,x4,"f")[$];if(!J)return this;let V=J.findIndex((U)=>U.listener===w);if(V>=0)J.splice(V,1);return this}once($,w){return(B(this,x4,"f")[$]||(B(this,x4,"f")[$]=[])).push({listener:w,once:!0}),this}emitted($){return new Promise((w,J)=>{if(x(this,_w,!0,"f"),$!=="error")this.once("error",J);this.once($,w)})}async done(){x(this,_w,!0,"f"),await B(this,TU,"f")}_emit($,...w){if(B(this,LU,"f"))return;if($==="end")B(this,zV,"m",k2).call(this),x(this,LU,!0,"f"),B(this,NV,"f").call(this);let J=B(this,x4,"f")[$];if(J)B(this,x4,"f")[$]=J.filter((V)=>!V.once),J.forEach(({listener:V})=>V(...w));if($==="abort"){let V=w[0];if(!B(this,_w,"f")&&!J?.length)Promise.reject(V);B(this,ZU,"f").call(this,V),B(this,DU,"f").call(this,V),this._emit("end");return}if($==="error"){let V=w[0];if(!B(this,_w,"f")&&!J?.length)Promise.reject(V);B(this,ZU,"f").call(this,V),B(this,DU,"f").call(this,V),this._emit("end")}}_emitFinal(){}}iV=new WeakMap,XV=new WeakMap,ZU=new WeakMap,TU=new WeakMap,NV=new WeakMap,DU=new WeakMap,x4=new WeakMap,WV=new WeakMap,LU=new WeakMap,IV=new WeakMap,gV=new WeakMap,_w=new WeakMap,zV=new WeakSet,k2=function(){for(let{signal:w,listener:J}of B(this,WV,"f").splice(0))w.removeEventListener("abort",J)},R2=function(w){if(x(this,IV,!0,"f"),w instanceof Error&&w.name==="AbortError")w=new g$;if(w instanceof g$)return x(this,gV,!0,"f"),this._emit("abort",w);if(w instanceof R)return this._emit("error",w);if(w instanceof Error){let J=new R(w.message);return J.cause=w,this._emit("error",J)}return this._emit("error",new R(String(w)))};function b2($){return typeof $.parse==="function"}var b$,wX,YV,JX,UX,VX,E2,C2,_H=10;class fU extends n6{constructor(){super(...arguments);b$.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion($){this._chatCompletions.push($),this._emit("chatCompletion",$);let w=$.choices[0]?.message;if(w)this._addMessage(w);return $}_addMessage($,w=!0){if(!("content"in $))$.content=null;if(this.messages.push($),w){if(this._emit("message",$),$X($)&&$.content)this._emit("functionToolCallResult",$.content);else if(Sw($)&&$.tool_calls){for(let J of $.tool_calls)if(J.type==="function")this._emit("functionToolCall",J.function)}}}async finalChatCompletion(){await this.done();let $=this._chatCompletions[this._chatCompletions.length-1];if(!$)throw new R("stream ended without producing a ChatCompletion");return $}async finalContent(){return await this.done(),B(this,b$,"m",wX).call(this)}async finalMessage(){return await this.done(),B(this,b$,"m",YV).call(this)}async finalFunctionToolCall(){return await this.done(),B(this,b$,"m",JX).call(this)}async finalFunctionToolCallResult(){return await this.done(),B(this,b$,"m",UX).call(this)}async totalUsage(){return await this.done(),B(this,b$,"m",VX).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let $=this._chatCompletions[this._chatCompletions.length-1];if($)this._emit("finalChatCompletion",$);let w=B(this,b$,"m",YV).call(this);if(w)this._emit("finalMessage",w);let J=B(this,b$,"m",wX).call(this);if(J)this._emit("finalContent",J);let V=B(this,b$,"m",JX).call(this);if(V)this._emit("finalFunctionToolCall",V);let U=B(this,b$,"m",UX).call(this);if(U!=null)this._emit("finalFunctionToolCallResult",U);if(this._chatCompletions.some((G)=>G.usage))this._emit("totalUsage",B(this,b$,"m",VX).call(this))}async _createChatCompletion($,w,J){this._listenForAbort(J?.signal),B(this,b$,"m",E2).call(this,w);let V=await $.chat.completions.create({...w,stream:!1},{...J,signal:this.controller.signal});return this._connected(),this._addChatCompletion(qU(V,w))}async _runChatCompletion($,w,J){for(let V of w.messages)this._addMessage(V,!1);return await this._createChatCompletion($,w,J)}async _runTools($,w,J,V){let{tool_choice:G="auto",stream:z,...i}=w,N=typeof G!=="string"&&G.type==="function"&&G?.function?.name,{maxChatCompletions:X=_H,afterCompletion:W}=V||{},I=w.tools.map((O)=>{if(r6(O)){if(!O.$callback)throw new R("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:O.$callback,name:O.function.name,description:O.function.description||"",parameters:O.function.parameters,parse:O.$parseRaw,strict:!0}}}return O}),g={};for(let O of I)if(O.type==="function")g[O.function.name||O.function.function.name]=O.function;let Y="tools"in w?I.map((O)=>O.type==="function"?{type:"function",function:{name:O.function.name||O.function.function.name,parameters:O.function.parameters,description:O.function.description,strict:O.function.strict}}:O):void 0;for(let O of w.messages)this._addMessage(O,!1);let v=async(O)=>{if(O.type!=="function")return{message:void 0,functionCalled:!1};let P=O.id,{name:F,arguments:q}=O.function,T=g[F];if(!T){let b=`Invalid tool_call: ${JSON.stringify(F)}. Available options are: ${Object.keys(g).map((C)=>JSON.stringify(C)).join(", ")}. Please try again`;return{message:{role:"tool",tool_call_id:P,content:b},functionCalled:!1}}if(N&&N!==F){let b=`Invalid tool_call: ${JSON.stringify(F)}. ${JSON.stringify(N)} requested. Please try again`;return{message:{role:"tool",tool_call_id:P,content:b},functionCalled:!1}}let L;if(b2(T)){let b;try{b=await T.parse(q)}catch(C){let _=C instanceof Error?C.message:String(C);return{message:{role:"tool",tool_call_id:P,content:_},functionCalled:!1}}L=await T.function(b,J)}else L=await T.function(q,J);let k=B(this,b$,"m",C2).call(this,L);return{message:{role:"tool",tool_call_id:P,content:k},functionCalled:!0}};for(let O=0;O<X;++O){let P=await this._createChatCompletion($,{...i,tool_choice:G,tools:Y,messages:[...this.messages]},V),F=P.choices[0]?.message;if(!F)throw new R("missing message in ChatCompletion response");if(!F.tool_calls?.length){await W?.(P,J);return}if(N||w.parallel_tool_calls===!1)for(let q of F.tool_calls){let T=await v(q);if(T.message)this._addMessage(T.message);if(N&&T.functionCalled){await W?.(P,J);return}}else{let q=await Promise.allSettled(F.tool_calls.map(v));for(let T of q)if(T.status==="rejected")throw T.reason;for(let T of q)if(T.status==="fulfilled"&&T.value.message)this._addMessage(T.value.message)}await W?.(P,J)}return}}b$=new WeakSet,wX=function(){return B(this,b$,"m",YV).call(this).content??null},YV=function(){let w=this.messages.length;while(w-- >0){let J=this.messages[w];if(Sw(J))return{...J,content:J.content??null,refusal:J.refusal??null}}throw new R("stream ended without producing a ChatCompletionMessage with role=assistant")},JX=function(){for(let w=this.messages.length-1;w>=0;w--){let J=this.messages[w];if(Sw(J)&&J?.tool_calls?.length)for(let V=J.tool_calls.length-1;V>=0;V--){let U=J.tool_calls[V];if(U?.type==="function")return U.function}}return},UX=function(){for(let w=this.messages.length-1;w>=0;w--){let J=this.messages[w];if($X(J)&&J.content!=null&&typeof J.content==="string"&&this.messages.some((V)=>V.role==="assistant"&&V.tool_calls?.some((U)=>U.type==="function"&&U.id===J.tool_call_id)))return J.content}return},VX=function(){let w={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:J}of this._chatCompletions)if(J)w.completion_tokens+=J.completion_tokens,w.prompt_tokens+=J.prompt_tokens,w.total_tokens+=J.total_tokens;return w},E2=function(w){if(w.n!=null&&w.n>1)throw new R("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},C2=function(w){return typeof w==="string"?w:w===void 0?"undefined":JSON.stringify(w)};class MU extends fU{static runTools($,w,J){let V=new MU,U={...J,headers:{...J?.headers,"X-Stainless-Helper-Method":"runTools"}};return V._run(()=>V._runTools($,w,V,U)),V}_addMessage($,w=!0){if(super._addMessage($,w),Sw($)&&$.content)this._emit("content",$.content)}}var B$={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 j2 extends Error{}class x2 extends Error{}function kH($,w=B$.ALL){if(typeof $!=="string")throw TypeError(`expecting str, got ${typeof $}`);if(!$.trim())throw Error(`${$} is empty`);return RH($.trim(),w)}var RH=($,w)=>{let J=$.length,V=0,U=(g)=>{throw new j2(`${g} at position ${V}`)},G=(g)=>{throw new x2(`${g} at position ${V}`)},z=()=>{if(I(),V>=J)U("Unexpected end of input");if($[V]==='"')return i();if($[V]==="{")return N();if($[V]==="[")return X();if($.substring(V,V+4)==="null"||B$.NULL&w&&J-V<4&&"null".startsWith($.substring(V)))return V+=4,null;if($.substring(V,V+4)==="true"||B$.BOOL&w&&J-V<4&&"true".startsWith($.substring(V)))return V+=4,!0;if($.substring(V,V+5)==="false"||B$.BOOL&w&&J-V<5&&"false".startsWith($.substring(V)))return V+=5,!1;if($.substring(V,V+8)==="Infinity"||B$.INFINITY&w&&J-V<8&&"Infinity".startsWith($.substring(V)))return V+=8,1/0;if($.substring(V,V+9)==="-Infinity"||B$.MINUS_INFINITY&w&&1<J-V&&J-V<9&&"-Infinity".startsWith($.substring(V)))return V+=9,-1/0;if($.substring(V,V+3)==="NaN"||B$.NAN&w&&J-V<3&&"NaN".startsWith($.substring(V)))return V+=3,NaN;return W()},i=()=>{let g=V,Y=!1;V++;while(V<J&&($[V]!=='"'||Y&&$[V-1]==="\\"))Y=$[V]==="\\"?!Y:!1,V++;if($.charAt(V)=='"')try{return JSON.parse($.substring(g,++V-Number(Y)))}catch(v){G(String(v))}else if(B$.STR&w)try{return JSON.parse($.substring(g,V-Number(Y))+'"')}catch(v){return JSON.parse($.substring(g,$.lastIndexOf("\\"))+'"')}U("Unterminated string literal")},N=()=>{V++,I();let g={};try{while($[V]!=="}"){if(I(),V>=J&&B$.OBJ&w)return g;let Y=i();I(),V++;try{let v=z();Object.defineProperty(g,Y,{value:v,writable:!0,enumerable:!0,configurable:!0})}catch(v){if(B$.OBJ&w)return g;else throw v}if(I(),$[V]===",")V++}}catch(Y){if(B$.OBJ&w)return g;else U("Expected '}' at end of object")}return V++,g},X=()=>{V++;let g=[];try{while($[V]!=="]")if(g.push(z()),I(),$[V]===",")V++}catch(Y){if(B$.ARR&w)return g;U("Expected ']' at end of array")}return V++,g},W=()=>{if(V===0){if($==="-"&&B$.NUM&w)U("Not sure what '-' is");try{return JSON.parse($)}catch(Y){if(B$.NUM&w)try{if($[$.length-1]===".")return JSON.parse($.substring(0,$.lastIndexOf(".")));return JSON.parse($.substring(0,$.lastIndexOf("e")))}catch(v){}G(String(Y))}}let g=V;if($[V]==="-")V++;while($[V]&&!",]}".includes($[V]))V++;if(V==J&&!(B$.NUM&w))U("Unterminated number literal");try{return JSON.parse($.substring(g,V))}catch(Y){if($.substring(g,V)==="-"&&B$.NUM&w)U("Not sure what '-' is");try{return JSON.parse($.substring(g,$.lastIndexOf("e")))}catch(v){G(String(v))}}},I=()=>{while(V<J&&`
|
|
179
|
+
\r `.includes($[V]))V++};return z()},GX=($)=>kH($,B$.ALL^B$.NUM);var Q$,r4,kw,U6,zX,vV,iX,XX,NX,QV,WX,r2;class V6 extends fU{constructor($){super();Q$.add(this),r4.set(this,void 0),kw.set(this,void 0),U6.set(this,void 0),x(this,r4,$,"f"),x(this,kw,[],"f")}get currentChatCompletionSnapshot(){return B(this,U6,"f")}static fromReadableStream($){let w=new V6(null);return w._run(()=>w._fromReadableStream($)),w}static createChatCompletion($,w,J){let V=new V6(w);return V._run(()=>V._runChatCompletion($,{...w,stream:!0},{...J,headers:{...J?.headers,"X-Stainless-Helper-Method":"stream"}})),V}async _createChatCompletion($,w,J){super._createChatCompletion,this._listenForAbort(J?.signal),B(this,Q$,"m",zX).call(this);let V=await $.chat.completions.create({...w,stream:!0},{...J,signal:this.controller.signal});this._connected();for await(let U of V)B(this,Q$,"m",iX).call(this,U);if(V.controller.signal?.aborted)throw new g$;return this._addChatCompletion(B(this,Q$,"m",QV).call(this))}async _fromReadableStream($,w){this._listenForAbort(w?.signal),B(this,Q$,"m",zX).call(this),this._connected();let J=l$.fromReadableStream($,this.controller),V;for await(let U of J){if(V&&V!==U.id)this._addChatCompletion(B(this,Q$,"m",QV).call(this));B(this,Q$,"m",iX).call(this,U),V=U.id}if(J.controller.signal?.aborted)throw new g$;return this._addChatCompletion(B(this,Q$,"m",QV).call(this))}[(r4=new WeakMap,kw=new WeakMap,U6=new WeakMap,Q$=new WeakSet,zX=function(){if(this.ended)return;x(this,U6,void 0,"f")},vV=function(w){let J=B(this,kw,"f")[w.index];if(J)return J;return J={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},B(this,kw,"f")[w.index]=J,J},iX=function(w){if(this.ended)return;let J=B(this,Q$,"m",r2).call(this,w);this._emit("chunk",w,J);for(let V of w.choices){let U=J.choices[V.index];if(V.delta.content!=null&&U.message?.role==="assistant"&&U.message?.content)this._emit("content",V.delta.content,U.message.content),this._emit("content.delta",{delta:V.delta.content,snapshot:U.message.content,parsed:U.message.parsed});if(V.delta.refusal!=null&&U.message?.role==="assistant"&&U.message?.refusal)this._emit("refusal.delta",{delta:V.delta.refusal,snapshot:U.message.refusal});if(V.logprobs?.content!=null&&U.message?.role==="assistant")this._emit("logprobs.content.delta",{content:V.logprobs?.content,snapshot:U.logprobs?.content??[]});if(V.logprobs?.refusal!=null&&U.message?.role==="assistant")this._emit("logprobs.refusal.delta",{refusal:V.logprobs?.refusal,snapshot:U.logprobs?.refusal??[]});let G=B(this,Q$,"m",vV).call(this,U);if(U.finish_reason){if(B(this,Q$,"m",NX).call(this,U),G.current_tool_call_index!=null)B(this,Q$,"m",XX).call(this,U,G.current_tool_call_index)}for(let z of V.delta.tool_calls??[]){if(G.current_tool_call_index!==z.index){if(B(this,Q$,"m",NX).call(this,U),G.current_tool_call_index!=null)B(this,Q$,"m",XX).call(this,U,G.current_tool_call_index)}G.current_tool_call_index=z.index}for(let z of V.delta.tool_calls??[]){let i=U.message.tool_calls?.[z.index];if(!i?.type)continue;if(i?.type==="function")this._emit("tool_calls.function.arguments.delta",{name:i.function?.name,index:z.index,arguments:i.function.arguments,parsed_arguments:i.function.parsed_arguments,arguments_delta:z.function?.arguments??""});else d2(i?.type)}}},XX=function(w,J){if(B(this,Q$,"m",vV).call(this,w).done_tool_calls.has(J))return;let U=w.message.tool_calls?.[J];if(!U)throw Error("no tool call snapshot");if(!U.type)throw Error("tool call snapshot missing `type`");if(U.type==="function"){let G=B(this,r4,"f")?.tools?.find((z)=>HU(z)&&z.function.name===U.function.name);this._emit("tool_calls.function.arguments.done",{name:U.function.name,index:J,arguments:U.function.arguments,parsed_arguments:r6(G)?G.$parseRaw(U.function.arguments):G?.function.strict?JSON.parse(U.function.arguments):null})}else d2(U.type)},NX=function(w){let J=B(this,Q$,"m",vV).call(this,w);if(w.message.content&&!J.content_done){J.content_done=!0;let V=B(this,Q$,"m",WX).call(this);this._emit("content.done",{content:w.message.content,parsed:V?V.$parseRaw(w.message.content):null})}if(w.message.refusal&&!J.refusal_done)J.refusal_done=!0,this._emit("refusal.done",{refusal:w.message.refusal});if(w.logprobs?.content&&!J.logprobs_content_done)J.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:w.logprobs.content});if(w.logprobs?.refusal&&!J.logprobs_refusal_done)J.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:w.logprobs.refusal})},QV=function(){if(this.ended)throw new R("stream has ended, this shouldn't happen");let w=B(this,U6,"f");if(!w)throw new R("request ended without sending any chunks");return x(this,U6,void 0,"f"),x(this,kw,[],"f"),bH(w,B(this,r4,"f"))},WX=function(){let w=B(this,r4,"f")?.response_format;if(FU(w))return w;return null},r2=function(w){var J,V,U,G;let z=B(this,U6,"f"),{choices:i,...N}=w;if(!z)z=x(this,U6,{...N,choices:[]},"f");else Object.assign(z,N);for(let{delta:X,finish_reason:W,index:I,logprobs:g=null,...Y}of w.choices){let v=z.choices[I];if(!v)v=z.choices[I]={finish_reason:W,index:I,message:{},logprobs:g,...Y};if(g)if(!v.logprobs)v.logprobs=Object.assign({},g);else{let{content:k,refusal:b,...C}=g;if(n2(C),Object.assign(v.logprobs,C),k)(J=v.logprobs).content??(J.content=[]),v.logprobs.content.push(...k);if(b)(V=v.logprobs).refusal??(V.refusal=[]),v.logprobs.refusal.push(...b)}if(W){if(v.finish_reason=W,B(this,r4,"f")&&si(B(this,r4,"f"))){if(W==="length")throw new YU;if(W==="content_filter")throw new vU}}if(Object.assign(v,Y),!X)continue;let{content:O,refusal:P,function_call:F,role:q,tool_calls:T,...L}=X;if(n2(L),Object.assign(v.message,L),P)v.message.refusal=(v.message.refusal||"")+P;if(q)v.message.role=q;if(F)if(!v.message.function_call)v.message.function_call=F;else{if(F.name)v.message.function_call.name=F.name;if(F.arguments)(U=v.message.function_call).arguments??(U.arguments=""),v.message.function_call.arguments+=F.arguments}if(O){if(v.message.content=(v.message.content||"")+O,!v.message.refusal&&B(this,Q$,"m",WX).call(this))v.message.parsed=v.message.content.trim()?GX(v.message.content):null}if(T){if(!v.message.tool_calls)v.message.tool_calls=[];for(let{index:k,id:b,type:C,function:_,...t}of T){let y=(G=v.message.tool_calls)[k]??(G[k]={});if(Object.assign(y,t),b)y.id=b;if(C)y.type=C;if(_)y.function??(y.function={name:_.name??"",arguments:""});if(_?.name)y.function.name=_.name;if(_?.arguments){if(y.function.arguments+=_.arguments,A2(B(this,r4,"f"),y))y.function.parsed_arguments=GX(y.function.arguments)}}}}return z},Symbol.asyncIterator)](){let $=[],w=[],J=!1;return this.on("chunk",(V)=>{let U=w.shift();if(U)U.resolve(V);else $.push(V)}),this.on("end",()=>{J=!0;for(let V of w)V.resolve(void 0);w.length=0}),this.on("abort",(V)=>{J=!0;for(let U of w)U.reject(V);w.length=0}),this.on("error",(V)=>{J=!0;for(let U of w)U.reject(V);w.length=0}),{next:async()=>{if(!$.length){if(J)return{value:void 0,done:!0};return new Promise((U,G)=>w.push({resolve:U,reject:G})).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}}}}toReadableStream(){return new l$(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function bH($,w){let{id:J,choices:V,created:U,model:G,system_fingerprint:z,...i}=$,N={...i,id:J,choices:V.map(({message:X,finish_reason:W,index:I,logprobs:g,...Y})=>{if(!W)throw new R(`missing finish_reason for choice ${I}`);let{content:v=null,function_call:O,tool_calls:P,...F}=X,q=X.role;if(!q)throw new R(`missing role for choice ${I}`);if(O){let{arguments:T,name:L}=O;if(T==null)throw new R(`missing function_call.arguments for choice ${I}`);if(!L)throw new R(`missing function_call.name for choice ${I}`);return{...Y,message:{content:v,function_call:{arguments:T,name:L},role:q,refusal:X.refusal??null},finish_reason:W,index:I,logprobs:g}}if(P)return{...Y,index:I,finish_reason:W,logprobs:g,message:{...F,role:q,content:v,refusal:X.refusal??null,tool_calls:P.map((T,L)=>{let{function:k,type:b,id:C,..._}=T,{arguments:t,name:y,...W$}=k||{};if(C==null)throw new R(`missing choices[${I}].tool_calls[${L}].id
|
|
180
|
+
${OV($)}`);if(b==null)throw new R(`missing choices[${I}].tool_calls[${L}].type
|
|
181
|
+
${OV($)}`);if(y==null)throw new R(`missing choices[${I}].tool_calls[${L}].function.name
|
|
182
|
+
${OV($)}`);if(t==null)throw new R(`missing choices[${I}].tool_calls[${L}].function.arguments
|
|
183
|
+
${OV($)}`);return{..._,id:C,type:b,function:{...W$,name:y,arguments:t}}})}};return{...Y,message:{...F,content:v,role:q,refusal:X.refusal??null},finish_reason:W,index:I,logprobs:g}}),created:U,model:G,object:"chat.completion",...z?{system_fingerprint:z}:{}};return M2(N,w)}function OV($){return JSON.stringify($)}function n2($){return}function d2($){}class Rw extends V6{static fromReadableStream($){let w=new Rw(null);return w._run(()=>w._fromReadableStream($)),w}static runTools($,w,J){let V=new Rw(w),U={...J,headers:{...J?.headers,"X-Stainless-Helper-Method":"runTools"}};return V._run(()=>V._runTools($,w,V,U)),V}}class G6 extends K{constructor(){super(...arguments);this.messages=new Aw(this._client)}create($,w){return this._client.post("/chat/completions",{body:$,...w,stream:$.stream??!1,__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Q`/chat/completions/${$}`,{...w,__security:{bearerAuth:!0}})}update($,w,J){return this._client.post(Q`/chat/completions/${$}`,{body:w,...J,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/chat/completions",d,{query:$,...w,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Q`/chat/completions/${$}`,{...w,__security:{bearerAuth:!0}})}parse($,w){return _2($.tools),this._client.chat.completions.create($,{...w,headers:{...w?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap((J)=>qU(J,$))}runTools($,w){if($.stream)return Rw.runTools(this._client,$,w);return MU.runTools(this._client,$,w)}stream($,w){return V6.createChatCompletion(this._client,$,w)}}G6.Messages=Aw;class d6 extends K{constructor(){super(...arguments);this.completions=new G6(this._client)}}d6.Completions=G6;class AU extends K{create($,w){return this._client.post("/organization/admin_api_keys",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w){return this._client.get(Q`/organization/admin_api_keys/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/admin_api_keys",d,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Q`/organization/admin_api_keys/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}}class SU extends K{list($={},w){return this._client.getAPIList("/organization/audit_logs",o,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}}class _U extends K{create($,w){return this._client.post("/organization/certificates",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w={},J){return this._client.get(Q`/organization/certificates/${$}`,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}update($,w,J){return this._client.post(Q`/organization/certificates/${$}`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/certificates",o,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Q`/organization/certificates/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}activate($,w){return this._client.getAPIList("/organization/certificates/activate",R$,{body:$,method:"post",...w,__security:{adminAPIKeyAuth:!0}})}deactivate($,w){return this._client.getAPIList("/organization/certificates/deactivate",R$,{body:$,method:"post",...w,__security:{adminAPIKeyAuth:!0}})}}class kU extends K{retrieve($){return this._client.get("/organization/data_retention",{...$,__security:{adminAPIKeyAuth:!0}})}update($,w){return this._client.post("/organization/data_retention",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}}class RU extends K{create($,w){return this._client.post("/organization/invites",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w){return this._client.get(Q`/organization/invites/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/invites",o,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Q`/organization/invites/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}}class bU extends K{create($,w){return this._client.post("/organization/roles",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w){return this._client.get(Q`/organization/roles/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,J){return this._client.post(Q`/organization/roles/${$}`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/roles",v$,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Q`/organization/roles/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}}class EU extends K{create($,w){return this._client.post("/organization/spend_alerts",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w){return this._client.get(Q`/organization/spend_alerts/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,J){return this._client.post(Q`/organization/spend_alerts/${$}`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/spend_alerts",o,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Q`/organization/spend_alerts/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}}class CU extends K{audioSpeeches($,w){return this._client.get("/organization/usage/audio_speeches",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}audioTranscriptions($,w){return this._client.get("/organization/usage/audio_transcriptions",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}codeInterpreterSessions($,w){return this._client.get("/organization/usage/code_interpreter_sessions",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}completions($,w){return this._client.get("/organization/usage/completions",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}costs($,w){return this._client.get("/organization/costs",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}embeddings($,w){return this._client.get("/organization/usage/embeddings",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}fileSearchCalls($,w){return this._client.get("/organization/usage/file_search_calls",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}images($,w){return this._client.get("/organization/usage/images",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}moderations($,w){return this._client.get("/organization/usage/moderations",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}vectorStores($,w){return this._client.get("/organization/usage/vector_stores",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}webSearchCalls($,w){return this._client.get("/organization/usage/web_search_calls",{query:$,...w,__security:{adminAPIKeyAuth:!0}})}}class jU extends K{create($,w,J){return this._client.post(Q`/organization/groups/${$}/roles`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,J){let{group_id:V}=w;return this._client.get(Q`/organization/groups/${V}/roles/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/organization/groups/${$}/roles`,v$,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w,J){let{group_id:V}=w;return this._client.delete(Q`/organization/groups/${V}/roles/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}}class xU extends K{create($,w,J){return this._client.post(Q`/organization/groups/${$}/users`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,J){let{group_id:V}=w;return this._client.get(Q`/organization/groups/${V}/users/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/organization/groups/${$}/users`,v$,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w,J){let{group_id:V}=w;return this._client.delete(Q`/organization/groups/${V}/users/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}}class m6 extends K{constructor(){super(...arguments);this.users=new xU(this._client),this.roles=new jU(this._client)}create($,w){return this._client.post("/organization/groups",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w){return this._client.get(Q`/organization/groups/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,J){return this._client.post(Q`/organization/groups/${$}`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/groups",v$,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Q`/organization/groups/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}}m6.Users=xU;m6.Roles=jU;class rU extends K{retrieve($,w,J){let{project_id:V}=w;return this._client.get(Q`/organization/projects/${V}/api_keys/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/organization/projects/${$}/api_keys`,o,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w,J){let{project_id:V}=w;return this._client.delete(Q`/organization/projects/${V}/api_keys/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}}class nU extends K{list($,w={},J){return this._client.getAPIList(Q`/organization/projects/${$}/certificates`,o,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}activate($,w,J){return this._client.getAPIList(Q`/organization/projects/${$}/certificates/activate`,R$,{body:w,method:"post",...J,__security:{adminAPIKeyAuth:!0}})}deactivate($,w,J){return this._client.getAPIList(Q`/organization/projects/${$}/certificates/deactivate`,R$,{body:w,method:"post",...J,__security:{adminAPIKeyAuth:!0}})}}class dU extends K{retrieve($,w){return this._client.get(Q`/organization/projects/${$}/data_retention`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,J){return this._client.post(Q`/organization/projects/${$}/data_retention`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}}class mU extends K{retrieve($,w){return this._client.get(Q`/organization/projects/${$}/hosted_tool_permissions`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,J){return this._client.post(Q`/organization/projects/${$}/hosted_tool_permissions`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}}class yU extends K{retrieve($,w){return this._client.get(Q`/organization/projects/${$}/model_permissions`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,J){return this._client.post(Q`/organization/projects/${$}/model_permissions`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Q`/organization/projects/${$}/model_permissions`,{...w,__security:{adminAPIKeyAuth:!0}})}}class hU extends K{listRateLimits($,w={},J){return this._client.getAPIList(Q`/organization/projects/${$}/rate_limits`,o,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}updateRateLimit($,w,J){let{project_id:V,...U}=w;return this._client.post(Q`/organization/projects/${V}/rate_limits/${$}`,{body:U,...J,__security:{adminAPIKeyAuth:!0}})}}class cU extends K{create($,w,J){return this._client.post(Q`/projects/${$}/roles`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,J){let{project_id:V}=w;return this._client.get(Q`/projects/${V}/roles/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}update($,w,J){let{project_id:V,...U}=w;return this._client.post(Q`/projects/${V}/roles/${$}`,{body:U,...J,__security:{adminAPIKeyAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/projects/${$}/roles`,v$,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w,J){let{project_id:V}=w;return this._client.delete(Q`/projects/${V}/roles/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}}class lU extends K{create($,w,J){return this._client.post(Q`/organization/projects/${$}/service_accounts`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,J){let{project_id:V}=w;return this._client.get(Q`/organization/projects/${V}/service_accounts/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}update($,w,J){let{project_id:V,...U}=w;return this._client.post(Q`/organization/projects/${V}/service_accounts/${$}`,{body:U,...J,__security:{adminAPIKeyAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/organization/projects/${$}/service_accounts`,o,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w,J){let{project_id:V}=w;return this._client.delete(Q`/organization/projects/${V}/service_accounts/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}}class tU extends K{create($,w,J){return this._client.post(Q`/organization/projects/${$}/spend_alerts`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,J){let{project_id:V}=w;return this._client.get(Q`/organization/projects/${V}/spend_alerts/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}update($,w,J){let{project_id:V,...U}=w;return this._client.post(Q`/organization/projects/${V}/spend_alerts/${$}`,{body:U,...J,__security:{adminAPIKeyAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/organization/projects/${$}/spend_alerts`,o,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w,J){let{project_id:V}=w;return this._client.delete(Q`/organization/projects/${V}/spend_alerts/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}}class oU extends K{create($,w,J){let{project_id:V,...U}=w;return this._client.post(Q`/projects/${V}/groups/${$}/roles`,{body:U,...J,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,J){let{project_id:V,group_id:U}=w;return this._client.get(Q`/projects/${V}/groups/${U}/roles/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}list($,w,J){let{project_id:V,...U}=w;return this._client.getAPIList(Q`/projects/${V}/groups/${$}/roles`,v$,{query:U,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w,J){let{project_id:V,group_id:U}=w;return this._client.delete(Q`/projects/${V}/groups/${U}/roles/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}}class bw extends K{constructor(){super(...arguments);this.roles=new oU(this._client)}create($,w,J){return this._client.post(Q`/organization/projects/${$}/groups`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,J){let{project_id:V,...U}=w;return this._client.get(Q`/organization/projects/${V}/groups/${$}`,{query:U,...J,__security:{adminAPIKeyAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/organization/projects/${$}/groups`,v$,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w,J){let{project_id:V}=w;return this._client.delete(Q`/organization/projects/${V}/groups/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}}bw.Roles=oU;class pU extends K{create($,w,J){let{project_id:V,...U}=w;return this._client.post(Q`/projects/${V}/users/${$}/roles`,{body:U,...J,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,J){let{project_id:V,user_id:U}=w;return this._client.get(Q`/projects/${V}/users/${U}/roles/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}list($,w,J){let{project_id:V,...U}=w;return this._client.getAPIList(Q`/projects/${V}/users/${$}/roles`,v$,{query:U,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w,J){let{project_id:V,user_id:U}=w;return this._client.delete(Q`/projects/${V}/users/${U}/roles/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}}class Ew extends K{constructor(){super(...arguments);this.roles=new pU(this._client)}create($,w,J){return this._client.post(Q`/organization/projects/${$}/users`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,J){let{project_id:V}=w;return this._client.get(Q`/organization/projects/${V}/users/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}update($,w,J){let{project_id:V,...U}=w;return this._client.post(Q`/organization/projects/${V}/users/${$}`,{body:U,...J,__security:{adminAPIKeyAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/organization/projects/${$}/users`,o,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w,J){let{project_id:V}=w;return this._client.delete(Q`/organization/projects/${V}/users/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}}Ew.Roles=pU;class M$ extends K{constructor(){super(...arguments);this.users=new Ew(this._client),this.serviceAccounts=new lU(this._client),this.apiKeys=new rU(this._client),this.rateLimits=new hU(this._client),this.modelPermissions=new yU(this._client),this.hostedToolPermissions=new mU(this._client),this.groups=new bw(this._client),this.roles=new cU(this._client),this.dataRetention=new dU(this._client),this.spendAlerts=new tU(this._client),this.certificates=new nU(this._client)}create($,w){return this._client.post("/organization/projects",{body:$,...w,__security:{adminAPIKeyAuth:!0}})}retrieve($,w){return this._client.get(Q`/organization/projects/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,J){return this._client.post(Q`/organization/projects/${$}`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/projects",o,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}archive($,w){return this._client.post(Q`/organization/projects/${$}/archive`,{...w,__security:{adminAPIKeyAuth:!0}})}}M$.Users=Ew;M$.ServiceAccounts=lU;M$.APIKeys=rU;M$.RateLimits=hU;M$.ModelPermissions=yU;M$.HostedToolPermissions=mU;M$.Groups=bw;M$.Roles=cU;M$.DataRetention=dU;M$.SpendAlerts=tU;M$.Certificates=nU;class aU extends K{create($,w,J){return this._client.post(Q`/organization/users/${$}/roles`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}retrieve($,w,J){let{user_id:V}=w;return this._client.get(Q`/organization/users/${V}/roles/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/organization/users/${$}/roles`,v$,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w,J){let{user_id:V}=w;return this._client.delete(Q`/organization/users/${V}/roles/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}}class Cw extends K{constructor(){super(...arguments);this.roles=new aU(this._client)}retrieve($,w){return this._client.get(Q`/organization/users/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}update($,w,J){return this._client.post(Q`/organization/users/${$}`,{body:w,...J,__security:{adminAPIKeyAuth:!0}})}list($={},w){return this._client.getAPIList("/organization/users",o,{query:$,...w,__security:{adminAPIKeyAuth:!0}})}delete($,w){return this._client.delete(Q`/organization/users/${$}`,{...w,__security:{adminAPIKeyAuth:!0}})}}Cw.Roles=aU;class A$ extends K{constructor(){super(...arguments);this.auditLogs=new SU(this._client),this.adminAPIKeys=new AU(this._client),this.usage=new CU(this._client),this.invites=new RU(this._client),this.users=new Cw(this._client),this.groups=new m6(this._client),this.roles=new bU(this._client),this.dataRetention=new kU(this._client),this.spendAlerts=new EU(this._client),this.certificates=new _U(this._client),this.projects=new M$(this._client)}}A$.AuditLogs=SU;A$.AdminAPIKeys=AU;A$.Usage=CU;A$.Invites=RU;A$.Users=Cw;A$.Groups=m6;A$.Roles=bU;A$.DataRetention=kU;A$.SpendAlerts=EU;A$.Certificates=_U;A$.Projects=M$;class y6 extends K{constructor(){super(...arguments);this.organization=new A$(this._client)}}y6.Organization=A$;var m2=Symbol("brand.privateNullableHeaders");function*IF($){if(!$)return;if(m2 in $){let{values:V,nulls:U}=$;yield*V.entries();for(let G of U)yield[G,null];return}let w=!1,J;if($ instanceof Headers)J=$.entries();else if(Ri($))J=$;else w=!0,J=Object.entries($??{});for(let V of J){let U=V[0];if(typeof U!=="string")throw TypeError("expected header name to be a string");let G=Ri(V[1])?V[1]:[V[1]],z=!1;for(let i of G){if(i===void 0)continue;if(w&&!z)z=!0,yield[U,null];yield[U,i]}}}var M=($)=>{let w=new Headers,J=new Set;for(let V of $){let U=new Set;for(let[G,z]of IF(V)){let i=G.toLowerCase();if(!U.has(i))w.delete(G),U.add(i);if(z===null)w.delete(G),J.add(i);else w.append(G,z),J.delete(i)}}return{[m2]:!0,values:w,nulls:J}};class eU extends K{create($,w){return this._client.post("/audio/speech",{body:$,...w,headers:M([{Accept:"application/octet-stream"},w?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}}class sU extends K{create($,w){return this._client.post("/audio/transcriptions",f$({body:$,...w,stream:$.stream??!1,__metadata:{model:$.model},__security:{bearerAuth:!0}},this._client))}}class $1 extends K{create($,w){return this._client.post("/audio/translations",f$({body:$,...w,__metadata:{model:$.model},__security:{bearerAuth:!0}},this._client))}}class n4 extends K{constructor(){super(...arguments);this.transcriptions=new sU(this._client),this.translations=new $1(this._client),this.speech=new eU(this._client)}}n4.Transcriptions=sU;n4.Translations=$1;n4.Speech=eU;class jw extends K{create($,w){return this._client.post("/batches",{body:$,...w,__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Q`/batches/${$}`,{...w,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/batches",d,{query:$,...w,__security:{bearerAuth:!0}})}cancel($,w){return this._client.post(Q`/batches/${$}/cancel`,{...w,__security:{bearerAuth:!0}})}}class w1 extends K{create($,w){return this._client.post("/assistants",{body:$,...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Q`/assistants/${$}`,{...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}update($,w,J){return this._client.post(Q`/assistants/${$}`,{body:w,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/assistants",d,{query:$,...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Q`/assistants/${$}`,{...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}}class J1 extends K{create($,w){return this._client.post("/realtime/sessions",{body:$,...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}}class U1 extends K{create($,w){return this._client.post("/realtime/transcription_sessions",{body:$,...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}}class h6 extends K{constructor(){super(...arguments);this.sessions=new J1(this._client),this.transcriptionSessions=new U1(this._client)}}h6.Sessions=J1;h6.TranscriptionSessions=U1;class V1 extends K{create($,w){return this._client.post("/chatkit/sessions",{body:$,...w,headers:M([{"OpenAI-Beta":"chatkit_beta=v1"},w?.headers]),__security:{bearerAuth:!0}})}cancel($,w){return this._client.post(Q`/chatkit/sessions/${$}/cancel`,{...w,headers:M([{"OpenAI-Beta":"chatkit_beta=v1"},w?.headers]),__security:{bearerAuth:!0}})}}class G1 extends K{retrieve($,w){return this._client.get(Q`/chatkit/threads/${$}`,{...w,headers:M([{"OpenAI-Beta":"chatkit_beta=v1"},w?.headers]),__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/chatkit/threads",o,{query:$,...w,headers:M([{"OpenAI-Beta":"chatkit_beta=v1"},w?.headers]),__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Q`/chatkit/threads/${$}`,{...w,headers:M([{"OpenAI-Beta":"chatkit_beta=v1"},w?.headers]),__security:{bearerAuth:!0}})}listItems($,w={},J){return this._client.getAPIList(Q`/chatkit/threads/${$}/items`,o,{query:w,...J,headers:M([{"OpenAI-Beta":"chatkit_beta=v1"},J?.headers]),__security:{bearerAuth:!0}})}}class c6 extends K{constructor(){super(...arguments);this.sessions=new V1(this._client),this.threads=new G1(this._client)}}c6.Sessions=V1;c6.Threads=G1;class z1 extends K{create($,w,J){return this._client.post(Q`/threads/${$}/messages`,{body:w,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}retrieve($,w,J){let{thread_id:V}=w;return this._client.get(Q`/threads/${V}/messages/${$}`,{...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}update($,w,J){let{thread_id:V,...U}=w;return this._client.post(Q`/threads/${V}/messages/${$}`,{body:U,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/threads/${$}/messages`,d,{query:w,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}delete($,w,J){let{thread_id:V}=w;return this._client.delete(Q`/threads/${V}/messages/${$}`,{...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}}class i1 extends K{retrieve($,w,J){let{thread_id:V,run_id:U,...G}=w;return this._client.get(Q`/threads/${V}/runs/${U}/steps/${$}`,{query:G,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}list($,w,J){let{thread_id:V,...U}=w;return this._client.getAPIList(Q`/threads/${V}/runs/${$}/steps`,d,{query:U,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}}var y2=($)=>{if(typeof Buffer<"u"){let w=Buffer.from($,"base64");return Array.from(new Float32Array(w.buffer,w.byteOffset,w.length/Float32Array.BYTES_PER_ELEMENT))}else{let w=atob($),J=w.length,V=new Uint8Array(J);for(let U=0;U<J;U++)V[U]=w.charCodeAt(U);return Array.from(new Float32Array(V.buffer))}};var W4=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim()||void 0;return};var F$,t6,IX,H4,PV,I4,o6,xw,l6,BV,t$,KV,uV,W1,X1,N1,h2,c2,l2,t2,o2,p2,a2;class z6 extends n6{constructor(){super(...arguments);F$.add(this),IX.set(this,[]),H4.set(this,{}),PV.set(this,{}),I4.set(this,void 0),o6.set(this,void 0),xw.set(this,void 0),l6.set(this,void 0),BV.set(this,void 0),t$.set(this,void 0),KV.set(this,void 0),uV.set(this,void 0),W1.set(this,void 0)}[(IX=new WeakMap,H4=new WeakMap,PV=new WeakMap,I4=new WeakMap,o6=new WeakMap,xw=new WeakMap,l6=new WeakMap,BV=new WeakMap,t$=new WeakMap,KV=new WeakMap,uV=new WeakMap,W1=new WeakMap,F$=new WeakSet,Symbol.asyncIterator)](){let $=[],w=[],J=!1;return this.on("event",(V)=>{let U=w.shift();if(U)U.resolve(V);else $.push(V)}),this.on("end",()=>{J=!0;for(let V of w)V.resolve(void 0);w.length=0}),this.on("abort",(V)=>{J=!0;for(let U of w)U.reject(V);w.length=0}),this.on("error",(V)=>{J=!0;for(let U of w)U.reject(V);w.length=0}),{next:async()=>{if(!$.length){if(J)return{value:void 0,done:!0};return new Promise((U,G)=>w.push({resolve:U,reject:G})).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 w=new t6;return w._run(()=>w._fromReadableStream($)),w}async _fromReadableStream($,w){this._listenForAbort(w?.signal),this._connected();let J=l$.fromReadableStream($,this.controller);for await(let V of J)B(this,F$,"m",X1).call(this,V);if(J.controller.signal?.aborted)throw new g$;return this._addRun(B(this,F$,"m",N1).call(this))}toReadableStream(){return new l$(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream($,w,J,V){let U=new t6;return U._run(()=>U._runToolAssistantStream($,w,J,{...V,headers:{...V?.headers,"X-Stainless-Helper-Method":"stream"}})),U}async _createToolAssistantStream($,w,J,V){this._listenForAbort(V?.signal);let U={...J,stream:!0},G=await $.submitToolOutputs(w,U,{...V,signal:this.controller.signal});this._connected();for await(let z of G)B(this,F$,"m",X1).call(this,z);if(G.controller.signal?.aborted)throw new g$;return this._addRun(B(this,F$,"m",N1).call(this))}static createThreadAssistantStream($,w,J){let V=new t6;return V._run(()=>V._threadAssistantStream($,w,{...J,headers:{...J?.headers,"X-Stainless-Helper-Method":"stream"}})),V}static createAssistantStream($,w,J,V){let U=new t6;return U._run(()=>U._runAssistantStream($,w,J,{...V,headers:{...V?.headers,"X-Stainless-Helper-Method":"stream"}})),U}currentEvent(){return B(this,KV,"f")}currentRun(){return B(this,uV,"f")}currentMessageSnapshot(){return B(this,I4,"f")}currentRunStepSnapshot(){return B(this,W1,"f")}async finalRunSteps(){return await this.done(),Object.values(B(this,H4,"f"))}async finalMessages(){return await this.done(),Object.values(B(this,PV,"f"))}async finalRun(){if(await this.done(),!B(this,o6,"f"))throw Error("Final run was not received.");return B(this,o6,"f")}async _createThreadAssistantStream($,w,J){this._listenForAbort(J?.signal);let V={...w,stream:!0},U=await $.createAndRun(V,{...J,signal:this.controller.signal});this._connected();for await(let G of U)B(this,F$,"m",X1).call(this,G);if(U.controller.signal?.aborted)throw new g$;return this._addRun(B(this,F$,"m",N1).call(this))}async _createAssistantStream($,w,J,V){this._listenForAbort(V?.signal);let U={...J,stream:!0},G=await $.create(w,U,{...V,signal:this.controller.signal});this._connected();for await(let z of G)B(this,F$,"m",X1).call(this,z);if(G.controller.signal?.aborted)throw new g$;return this._addRun(B(this,F$,"m",N1).call(this))}static accumulateDelta($,w){for(let[J,V]of Object.entries(w)){if(!$.hasOwnProperty(J)){$[J]=V;continue}let U=$[J];if(U===null||U===void 0){$[J]=V;continue}if(J==="index"||J==="type"){$[J]=V;continue}if(typeof U==="string"&&typeof V==="string")U+=V;else if(typeof U==="number"&&typeof V==="number")U+=V;else if(QU(U)&&QU(V))U=this.accumulateDelta(U,V);else if(Array.isArray(U)&&Array.isArray(V)){if(U.every((G)=>typeof G==="string"||typeof G==="number")){U.push(...V);continue}for(let G of V){if(!QU(G))throw Error(`Expected array delta entry to be an object but got: ${G}`);let z=G.index;if(z==null)throw console.error(G),Error("Expected array delta entry to have an `index` property");if(typeof z!=="number")throw Error(`Expected array delta entry \`index\` property to be a number but got ${z}`);let i=U[z];if(i==null)U.push(G);else U[z]=this.accumulateDelta(i,G)}continue}else throw Error(`Unhandled record type: ${J}, deltaValue: ${V}, accValue: ${U}`);$[J]=U}return $}_addRun($){return $}async _threadAssistantStream($,w,J){return await this._createThreadAssistantStream(w,$,J)}async _runAssistantStream($,w,J,V){return await this._createAssistantStream(w,$,J,V)}async _runToolAssistantStream($,w,J,V){return await this._createToolAssistantStream(w,$,J,V)}}t6=z6,X1=function(w){if(this.ended)return;switch(x(this,KV,w,"f"),B(this,F$,"m",l2).call(this,w),w.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":B(this,F$,"m",a2).call(this,w);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":B(this,F$,"m",c2).call(this,w);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":B(this,F$,"m",h2).call(this,w);break;case"error":throw Error("Encountered an error event in event processing - errors should be processed earlier");default:ZF(w)}},N1=function(){if(this.ended)throw new R("stream has ended, this shouldn't happen");if(!B(this,o6,"f"))throw Error("Final run has not been received");return B(this,o6,"f")},h2=function(w){let[J,V]=B(this,F$,"m",o2).call(this,w,B(this,I4,"f"));x(this,I4,J,"f"),B(this,PV,"f")[J.id]=J;for(let U of V){let G=J.content[U.index];if(G?.type=="text")this._emit("textCreated",G.text)}switch(w.event){case"thread.message.created":this._emit("messageCreated",w.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",w.data.delta,J),w.data.delta.content)for(let U of w.data.delta.content){if(U.type=="text"&&U.text){let G=U.text,z=J.content[U.index];if(z&&z.type=="text")this._emit("textDelta",G,z.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(U.index!=B(this,xw,"f")){if(B(this,l6,"f"))switch(B(this,l6,"f").type){case"text":this._emit("textDone",B(this,l6,"f").text,B(this,I4,"f"));break;case"image_file":this._emit("imageFileDone",B(this,l6,"f").image_file,B(this,I4,"f"));break}x(this,xw,U.index,"f")}x(this,l6,J.content[U.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(B(this,xw,"f")!==void 0){let U=w.data.content[B(this,xw,"f")];if(U)switch(U.type){case"image_file":this._emit("imageFileDone",U.image_file,B(this,I4,"f"));break;case"text":this._emit("textDone",U.text,B(this,I4,"f"));break}}if(B(this,I4,"f"))this._emit("messageDone",w.data);x(this,I4,void 0,"f")}},c2=function(w){let J=B(this,F$,"m",t2).call(this,w);switch(x(this,W1,J,"f"),w.event){case"thread.run.step.created":this._emit("runStepCreated",w.data);break;case"thread.run.step.delta":let V=w.data.delta;if(V.step_details&&V.step_details.type=="tool_calls"&&V.step_details.tool_calls&&J.step_details.type=="tool_calls")for(let G of V.step_details.tool_calls)if(G.index==B(this,BV,"f"))this._emit("toolCallDelta",G,J.step_details.tool_calls[G.index]);else{if(B(this,t$,"f"))this._emit("toolCallDone",B(this,t$,"f"));if(x(this,BV,G.index,"f"),x(this,t$,J.step_details.tool_calls[G.index],"f"),B(this,t$,"f"))this._emit("toolCallCreated",B(this,t$,"f"))}this._emit("runStepDelta",w.data.delta,J);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":if(x(this,W1,void 0,"f"),w.data.step_details.type=="tool_calls"){if(B(this,t$,"f"))this._emit("toolCallDone",B(this,t$,"f")),x(this,t$,void 0,"f")}this._emit("runStepDone",w.data,J);break;case"thread.run.step.in_progress":break}},l2=function(w){B(this,IX,"f").push(w),this._emit("event",w)},t2=function(w){switch(w.event){case"thread.run.step.created":return B(this,H4,"f")[w.data.id]=w.data,w.data;case"thread.run.step.delta":let J=B(this,H4,"f")[w.data.id];if(!J)throw Error("Received a RunStepDelta before creation of a snapshot");let V=w.data;if(V.delta){let U=t6.accumulateDelta(J,V.delta);B(this,H4,"f")[w.data.id]=U}return B(this,H4,"f")[w.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":B(this,H4,"f")[w.data.id]=w.data;break}if(B(this,H4,"f")[w.data.id])return B(this,H4,"f")[w.data.id];throw Error("No snapshot available")},o2=function(w,J){let V=[];switch(w.event){case"thread.message.created":return[w.data,V];case"thread.message.delta":if(!J)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let U=w.data;if(U.delta.content)for(let G of U.delta.content)if(G.index in J.content){let z=J.content[G.index];J.content[G.index]=B(this,F$,"m",p2).call(this,G,z)}else J.content[G.index]=G,V.push(G);return[J,V];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(J)return[J,V];else throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},p2=function(w,J){return t6.accumulateDelta(J,w)},a2=function(w){switch(x(this,uV,w.data,"f"),w.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,o6,w.data,"f"),B(this,t$,"f"))this._emit("toolCallDone",B(this,t$,"f")),x(this,t$,void 0,"f");break;case"thread.run.cancelling":break}};function ZF($){}class rw extends K{constructor(){super(...arguments);this.steps=new i1(this._client)}create($,w,J){let{include:V,...U}=w;return this._client.post(Q`/threads/${$}/runs`,{query:{include:V},body:U,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),stream:w.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}retrieve($,w,J){let{thread_id:V}=w;return this._client.get(Q`/threads/${V}/runs/${$}`,{...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}update($,w,J){let{thread_id:V,...U}=w;return this._client.post(Q`/threads/${V}/runs/${$}`,{body:U,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/threads/${$}/runs`,d,{query:w,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}cancel($,w,J){let{thread_id:V}=w;return this._client.post(Q`/threads/${V}/runs/${$}/cancel`,{...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}async createAndPoll($,w,J){let V=await this.create($,w,J);return await this.poll(V.id,{thread_id:$},J)}createAndStream($,w,J){return z6.createAssistantStream($,this._client.beta.threads.runs,w,J)}async poll($,w,J){let V=M([J?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":J?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:U,response:G}=await this.retrieve($,w,{...J,headers:{...J?.headers,...V}}).withResponse();switch(U.status){case"queued":case"in_progress":case"cancelling":let z=5000;if(J?.pollIntervalMs)z=J.pollIntervalMs;else{let i=G.headers.get("openai-poll-after-ms");if(i){let N=parseInt(i);if(!isNaN(N))z=N}}await u4(z);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return U}}}stream($,w,J){return z6.createAssistantStream($,this._client.beta.threads.runs,w,J)}submitToolOutputs($,w,J){let{thread_id:V,...U}=w;return this._client.post(Q`/threads/${V}/runs/${$}/submit_tool_outputs`,{body:U,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),stream:w.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}async submitToolOutputsAndPoll($,w,J){let V=await this.submitToolOutputs($,w,J);return await this.poll(V.id,w,J)}submitToolOutputsStream($,w,J){return z6.createToolAssistantStream($,this._client.beta.threads.runs,w,J)}}rw.Steps=i1;class p6 extends K{constructor(){super(...arguments);this.runs=new rw(this._client),this.messages=new z1(this._client)}create($={},w){return this._client.post("/threads",{body:$,...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Q`/threads/${$}`,{...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}update($,w,J){return this._client.post(Q`/threads/${$}`,{body:w,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Q`/threads/${$}`,{...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}createAndRun($,w){return this._client.post("/threads/runs",{body:$,...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),stream:$.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}async createAndRunPoll($,w){let J=await this.createAndRun($,w);return await this.runs.poll(J.id,{thread_id:J.thread_id},w)}createAndRunStream($,w){return z6.createThreadAssistantStream($,this._client.beta.threads,w)}}p6.Runs=rw;p6.Messages=z1;class F4 extends K{constructor(){super(...arguments);this.realtime=new h6(this._client),this.chatkit=new c6(this._client),this.assistants=new w1(this._client),this.threads=new p6(this._client)}}F4.Realtime=h6;F4.ChatKit=c6;F4.Assistants=w1;F4.Threads=p6;class nw extends K{create($,w){return this._client.post("/completions",{body:$,...w,stream:$.stream??!1,__security:{bearerAuth:!0}})}}class I1 extends K{retrieve($,w,J){let{container_id:V}=w;return this._client.get(Q`/containers/${V}/files/${$}/content`,{...J,headers:M([{Accept:"application/binary"},J?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}}class dw extends K{constructor(){super(...arguments);this.content=new I1(this._client)}create($,w,J){return this._client.post(Q`/containers/${$}/files`,J6({body:w,...J,__security:{bearerAuth:!0}},this._client))}retrieve($,w,J){let{container_id:V}=w;return this._client.get(Q`/containers/${V}/files/${$}`,{...J,__security:{bearerAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/containers/${$}/files`,d,{query:w,...J,__security:{bearerAuth:!0}})}delete($,w,J){let{container_id:V}=w;return this._client.delete(Q`/containers/${V}/files/${$}`,{...J,headers:M([{Accept:"*/*"},J?.headers]),__security:{bearerAuth:!0}})}}dw.Content=I1;class a6 extends K{constructor(){super(...arguments);this.files=new dw(this._client)}create($,w){return this._client.post("/containers",{body:$,...w,__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Q`/containers/${$}`,{...w,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/containers",d,{query:$,...w,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Q`/containers/${$}`,{...w,headers:M([{Accept:"*/*"},w?.headers]),__security:{bearerAuth:!0}})}}a6.Files=dw;class g1 extends K{create($,w,J){let{include:V,...U}=w;return this._client.post(Q`/conversations/${$}/items`,{query:{include:V},body:U,...J,__security:{bearerAuth:!0}})}retrieve($,w,J){let{conversation_id:V,...U}=w;return this._client.get(Q`/conversations/${V}/items/${$}`,{query:U,...J,__security:{bearerAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/conversations/${$}/items`,o,{query:w,...J,__security:{bearerAuth:!0}})}delete($,w,J){let{conversation_id:V}=w;return this._client.delete(Q`/conversations/${V}/items/${$}`,{...J,__security:{bearerAuth:!0}})}}class e6 extends K{constructor(){super(...arguments);this.items=new g1(this._client)}create($={},w){return this._client.post("/conversations",{body:$,...w,__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Q`/conversations/${$}`,{...w,__security:{bearerAuth:!0}})}update($,w,J){return this._client.post(Q`/conversations/${$}`,{body:w,...J,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Q`/conversations/${$}`,{...w,__security:{bearerAuth:!0}})}}e6.Items=g1;class mw extends K{create($,w){let J=!!$.encoding_format,V=J?$.encoding_format:"base64";if(J)N$(this._client).debug("embeddings/user defined encoding_format:",$.encoding_format);let U=this._client.post("/embeddings",{body:{...$,encoding_format:V},...w,__security:{bearerAuth:!0}});if(J)return U;return N$(this._client).debug("embeddings/decoding base64 embeddings from base64"),U._thenUnwrap((G)=>{if(G&&G.data)G.data.forEach((z)=>{let i=z.embedding;z.embedding=y2(i)});return G})}}class Y1 extends K{retrieve($,w,J){let{eval_id:V,run_id:U}=w;return this._client.get(Q`/evals/${V}/runs/${U}/output_items/${$}`,{...J,__security:{bearerAuth:!0}})}list($,w,J){let{eval_id:V,...U}=w;return this._client.getAPIList(Q`/evals/${V}/runs/${$}/output_items`,d,{query:U,...J,__security:{bearerAuth:!0}})}}class yw extends K{constructor(){super(...arguments);this.outputItems=new Y1(this._client)}create($,w,J){return this._client.post(Q`/evals/${$}/runs`,{body:w,...J,__security:{bearerAuth:!0}})}retrieve($,w,J){let{eval_id:V}=w;return this._client.get(Q`/evals/${V}/runs/${$}`,{...J,__security:{bearerAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/evals/${$}/runs`,d,{query:w,...J,__security:{bearerAuth:!0}})}delete($,w,J){let{eval_id:V}=w;return this._client.delete(Q`/evals/${V}/runs/${$}`,{...J,__security:{bearerAuth:!0}})}cancel($,w,J){let{eval_id:V}=w;return this._client.post(Q`/evals/${V}/runs/${$}`,{...J,__security:{bearerAuth:!0}})}}yw.OutputItems=Y1;class s6 extends K{constructor(){super(...arguments);this.runs=new yw(this._client)}create($,w){return this._client.post("/evals",{body:$,...w,__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Q`/evals/${$}`,{...w,__security:{bearerAuth:!0}})}update($,w,J){return this._client.post(Q`/evals/${$}`,{body:w,...J,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/evals",d,{query:$,...w,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Q`/evals/${$}`,{...w,__security:{bearerAuth:!0}})}}s6.Runs=yw;class hw extends K{create($,w){return this._client.post("/files",f$({body:$,...w,__security:{bearerAuth:!0}},this._client))}retrieve($,w){return this._client.get(Q`/files/${$}`,{...w,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/files",d,{query:$,...w,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Q`/files/${$}`,{...w,__security:{bearerAuth:!0}})}content($,w){return this._client.get(Q`/files/${$}/content`,{...w,headers:M([{Accept:"application/binary"},w?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}async waitForProcessing($,{pollInterval:w=5000,maxWait:J=1800000}={}){let V=new Set(["processed","error","deleted"]),U=Date.now(),G=await this.retrieve($);while(!G.status||!V.has(G.status))if(await u4(w),G=await this.retrieve($),Date.now()-U>J)throw new j6({message:`Giving up on waiting for file ${$} to finish processing after ${J} milliseconds.`});return G}}class v1 extends K{}class Q1 extends K{run($,w){return this._client.post("/fine_tuning/alpha/graders/run",{body:$,...w,__security:{bearerAuth:!0}})}validate($,w){return this._client.post("/fine_tuning/alpha/graders/validate",{body:$,...w,__security:{bearerAuth:!0}})}}class cw extends K{constructor(){super(...arguments);this.graders=new Q1(this._client)}}cw.Graders=Q1;class O1 extends K{create($,w,J){return this._client.getAPIList(Q`/fine_tuning/checkpoints/${$}/permissions`,R$,{body:w,method:"post",...J,__security:{adminAPIKeyAuth:!0}})}retrieve($,w={},J){return this._client.get(Q`/fine_tuning/checkpoints/${$}/permissions`,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/fine_tuning/checkpoints/${$}/permissions`,o,{query:w,...J,__security:{adminAPIKeyAuth:!0}})}delete($,w,J){let{fine_tuned_model_checkpoint:V}=w;return this._client.delete(Q`/fine_tuning/checkpoints/${V}/permissions/${$}`,{...J,__security:{adminAPIKeyAuth:!0}})}}class lw extends K{constructor(){super(...arguments);this.permissions=new O1(this._client)}}lw.Permissions=O1;class P1 extends K{list($,w={},J){return this._client.getAPIList(Q`/fine_tuning/jobs/${$}/checkpoints`,d,{query:w,...J,__security:{bearerAuth:!0}})}}class tw extends K{constructor(){super(...arguments);this.checkpoints=new P1(this._client)}create($,w){return this._client.post("/fine_tuning/jobs",{body:$,...w,__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Q`/fine_tuning/jobs/${$}`,{...w,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/fine_tuning/jobs",d,{query:$,...w,__security:{bearerAuth:!0}})}cancel($,w){return this._client.post(Q`/fine_tuning/jobs/${$}/cancel`,{...w,__security:{bearerAuth:!0}})}listEvents($,w={},J){return this._client.getAPIList(Q`/fine_tuning/jobs/${$}/events`,d,{query:w,...J,__security:{bearerAuth:!0}})}pause($,w){return this._client.post(Q`/fine_tuning/jobs/${$}/pause`,{...w,__security:{bearerAuth:!0}})}resume($,w){return this._client.post(Q`/fine_tuning/jobs/${$}/resume`,{...w,__security:{bearerAuth:!0}})}}tw.Checkpoints=P1;class q4 extends K{constructor(){super(...arguments);this.methods=new v1(this._client),this.jobs=new tw(this._client),this.checkpoints=new lw(this._client),this.alpha=new cw(this._client)}}q4.Methods=v1;q4.Jobs=tw;q4.Checkpoints=lw;q4.Alpha=cw;class K1 extends K{}class $w extends K{constructor(){super(...arguments);this.graderModels=new K1(this._client)}}$w.GraderModels=K1;class ow extends K{createVariation($,w){return this._client.post("/images/variations",f$({body:$,...w,__security:{bearerAuth:!0}},this._client))}edit($,w){return this._client.post("/images/edits",f$({body:$,...w,stream:$.stream??!1,__security:{bearerAuth:!0}},this._client))}generate($,w){return this._client.post("/images/generations",{body:$,...w,stream:$.stream??!1,__security:{bearerAuth:!0}})}}class pw extends K{retrieve($,w){return this._client.get(Q`/models/${$}`,{...w,__security:{bearerAuth:!0}})}list($){return this._client.getAPIList("/models",R$,{...$,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Q`/models/${$}`,{...w,__security:{bearerAuth:!0}})}}class aw extends K{create($,w){return this._client.post("/moderations",{body:$,...w,__security:{bearerAuth:!0}})}}class u1 extends K{accept($,w,J){return this._client.post(Q`/realtime/calls/${$}/accept`,{body:w,...J,headers:M([{Accept:"*/*"},J?.headers]),__security:{bearerAuth:!0}})}hangup($,w){return this._client.post(Q`/realtime/calls/${$}/hangup`,{...w,headers:M([{Accept:"*/*"},w?.headers]),__security:{bearerAuth:!0}})}refer($,w,J){return this._client.post(Q`/realtime/calls/${$}/refer`,{body:w,...J,headers:M([{Accept:"*/*"},J?.headers]),__security:{bearerAuth:!0}})}reject($,w={},J){return this._client.post(Q`/realtime/calls/${$}/reject`,{body:w,...J,headers:M([{Accept:"*/*"},J?.headers]),__security:{bearerAuth:!0}})}}class B1 extends K{create($,w){return this._client.post("/realtime/client_secrets",{body:$,...w,__security:{bearerAuth:!0}})}}class i6 extends K{constructor(){super(...arguments);this.clientSecrets=new B1(this._client),this.calls=new u1(this._client)}}i6.ClientSecrets=B1;i6.Calls=u1;function e2($,w){if(!w||!mF(w)){let J={...$,output_parsed:null,output:$.output.map((V)=>{if(V.type==="function_call")return{...V,parsed_arguments:null};if(V.type==="message")return{...V,content:V.content.map((U)=>({...U,parsed:null}))};else return V})};if(s2($,J))o$(J);return J}return gX($,w)}function gX($,w){let J=!$.status||$.status==="completed",V=$.output.map((G)=>{if(G.type==="function_call")return{...G,parsed_arguments:J?cF(w,G):null};if(G.type==="message"){let z=G.content.map((i)=>{if(i.type==="output_text")return{...i,parsed:J?dF(w,i.text):null};return i});return{...G,content:z}}return G}),U=Object.assign({},$,{output:V});if(s2($,U))o$(U);return Object.defineProperty(U,"output_parsed",{enumerable:!0,get(){for(let G of U.output){if(G.type!=="message")continue;for(let z of G.content)if(z.type==="output_text"&&z.parsed!==null)return z.parsed}return null}}),U}function dF($,w){if($.text?.format?.type!=="json_schema")return null;if("$parseRaw"in $.text?.format)return($.text?.format).$parseRaw(w);return JSON.parse(w)}function mF($){if(FU($.text?.format))return!0;return!1}function yF($){return $?.$brand==="auto-parseable-tool"}function hF($,w){return $.find((J)=>J.type==="function"&&J.name===w)}function cF($,w){let J=hF($.tools??[],w.name);return{...w,...w,parsed_arguments:yF(J)?J.$parseRaw(w.arguments):J?.strict?JSON.parse(w.arguments):null}}function s2($,w){return!Object.getOwnPropertyDescriptor($,"output_text")||w.output_text==null}function o$($){let w=[];for(let J of $.output){if(J.type!=="message")continue;for(let V of J.content)if(V.type==="output_text")w.push(V.text)}$.output_text=w.join("")}function wv($,w){if(!w){if($.type!=="response.created")throw new R(`When snapshot hasn't been set yet, expected 'response.created' event, got ${$.type}`);return $v($.response)}switch($.type){case"response.output_item.added":{if(w.output.push(structuredClone($.item)),$.item.type==="message")o$(w);break}case"response.output_item.done":{if(l(w,$.output_index),w.output[$.output_index]=structuredClone($.item),$.item.type==="message")o$(w);break}case"response.content_part.added":{let J=l(w,$.output_index),V=J.type,U=$.part;if(V==="message"&&U.type!=="reasoning_text"){if(J.content.push(structuredClone(U)),U.type==="output_text")o$(w)}else if(V==="reasoning"&&U.type==="reasoning_text"){if(!J.content)J.content=[];J.content.push(structuredClone(U))}break}case"response.content_part.done":{let J=l(w,$.output_index),V=$.part;if(J.type==="message"&&V.type!=="reasoning_text"){if(s$(J.content,$.content_index),J.content[$.content_index]=structuredClone(V),V.type==="output_text")o$(w)}else if(J.type==="reasoning"&&V.type==="reasoning_text"){let U=J.content;if(!U)throw new R(`missing content at index ${$.content_index}`);s$(U,$.content_index),U[$.content_index]=structuredClone(V)}break}case"response.output_text.delta":{let J=l(w,$.output_index);if(J.type==="message"){let V=s$(J.content,$.content_index);if(V.type!=="output_text")throw new R(`expected content to be 'output_text', got ${V.type}`);V.text+=$.delta,w.output_text+=$.delta}break}case"response.output_text.done":{let J=l(w,$.output_index);if(J.type==="message"){let V=s$(J.content,$.content_index);if(V.type!=="output_text")throw new R(`expected content to be 'output_text', got ${V.type}`);V.text=$.text,o$(w)}break}case"response.output_text.annotation.added":{let J=l(w,$.output_index);if(J.type==="message"){let V=s$(J.content,$.content_index);if(V.type!=="output_text")throw new R(`expected content to be 'output_text', got ${V.type}`);V.annotations[$.annotation_index]=structuredClone($.annotation)}break}case"response.refusal.delta":{let J=l(w,$.output_index);if(J.type==="message"){let V=s$(J.content,$.content_index);if(V.type!=="refusal")throw new R(`expected content to be 'refusal', got ${V.type}`);V.refusal+=$.delta}break}case"response.refusal.done":{let J=l(w,$.output_index);if(J.type==="message"){let V=s$(J.content,$.content_index);if(V.type!=="refusal")throw new R(`expected content to be 'refusal', got ${V.type}`);V.refusal=$.refusal}break}case"response.function_call_arguments.delta":{let J=l(w,$.output_index);if(J.type==="function_call")J.arguments+=$.delta;break}case"response.function_call_arguments.done":{let J=l(w,$.output_index);if(J.type==="function_call")J.arguments=$.arguments;break}case"response.reasoning_text.delta":{let J=l(w,$.output_index);if(J.type==="reasoning"){if(!J.content)throw new R(`missing content at index ${$.content_index}`);let V=s$(J.content,$.content_index);if(V.type!=="reasoning_text")throw new R(`expected content to be 'reasoning_text', got ${V.type}`);V.text+=$.delta}break}case"response.reasoning_text.done":{let J=l(w,$.output_index);if(J.type==="reasoning"){if(!J.content)throw new R(`missing content at index ${$.content_index}`);let V=s$(J.content,$.content_index);if(V.type!=="reasoning_text")throw new R(`expected content to be 'reasoning_text', got ${V.type}`);V.text=$.text}break}case"response.reasoning_summary_part.added":{let J=l(w,$.output_index);if(J.type==="reasoning")J.summary.push(structuredClone($.part));break}case"response.reasoning_summary_part.done":{let J=l(w,$.output_index);if(J.type==="reasoning")s$(J.summary,$.summary_index),J.summary[$.summary_index]=structuredClone($.part);break}case"response.reasoning_summary_text.delta":{let J=l(w,$.output_index);if(J.type==="reasoning"){let V=s$(J.summary,$.summary_index);V.text+=$.delta}break}case"response.reasoning_summary_text.done":{let J=l(w,$.output_index);if(J.type==="reasoning"){let V=s$(J.summary,$.summary_index);V.text=$.text}break}case"response.custom_tool_call_input.delta":{let J=l(w,$.output_index);if(J.type==="custom_tool_call")J.input+=$.delta;break}case"response.custom_tool_call_input.done":{let J=l(w,$.output_index);if(J.type==="custom_tool_call")J.input=$.input;break}case"response.mcp_call_arguments.delta":{let J=l(w,$.output_index);if(J.type==="mcp_call")J.arguments+=$.delta;break}case"response.mcp_call_arguments.done":{let J=l(w,$.output_index);if(J.type==="mcp_call")J.arguments=$.arguments;break}case"response.code_interpreter_call_code.delta":{let J=l(w,$.output_index);if(J.type==="code_interpreter_call")J.code=(J.code??"")+$.delta;break}case"response.code_interpreter_call_code.done":{let J=l(w,$.output_index);if(J.type==="code_interpreter_call")J.code=$.code;break}case"response.code_interpreter_call.in_progress":{let J=l(w,$.output_index);if(J.type==="code_interpreter_call")J.status="in_progress";break}case"response.code_interpreter_call.interpreting":{let J=l(w,$.output_index);if(J.type==="code_interpreter_call")J.status="interpreting";break}case"response.code_interpreter_call.completed":{let J=l(w,$.output_index);if(J.type==="code_interpreter_call")J.status="completed";break}case"response.file_search_call.in_progress":{let J=l(w,$.output_index);if(J.type==="file_search_call")J.status="in_progress";break}case"response.file_search_call.searching":{let J=l(w,$.output_index);if(J.type==="file_search_call")J.status="searching";break}case"response.file_search_call.completed":{let J=l(w,$.output_index);if(J.type==="file_search_call")J.status="completed";break}case"response.web_search_call.in_progress":{let J=l(w,$.output_index);if(J.type==="web_search_call")J.status="in_progress";break}case"response.web_search_call.searching":{let J=l(w,$.output_index);if(J.type==="web_search_call")J.status="searching";break}case"response.web_search_call.completed":{let J=l(w,$.output_index);if(J.type==="web_search_call")J.status="completed";break}case"response.image_generation_call.in_progress":{let J=l(w,$.output_index);if(J.type==="image_generation_call")J.status="in_progress";break}case"response.image_generation_call.generating":{let J=l(w,$.output_index);if(J.type==="image_generation_call")J.status="generating";break}case"response.image_generation_call.completed":{let J=l(w,$.output_index);if(J.type==="image_generation_call")J.status="completed";break}case"response.mcp_call.in_progress":{let J=l(w,$.output_index);if(J.type==="mcp_call")J.status="in_progress";break}case"response.mcp_call.completed":{let J=l(w,$.output_index);if(J.type==="mcp_call")J.status="completed";break}case"response.mcp_call.failed":{let J=l(w,$.output_index);if(J.type==="mcp_call")J.status="failed";break}case"response.created":case"response.queued":case"response.in_progress":case"response.completed":case"response.failed":case"response.incomplete":{w=$v($.response);break}case"response.audio.delta":case"response.audio.done":case"response.audio.transcript.delta":case"response.audio.transcript.done":case"response.image_generation_call.partial_image":case"response.mcp_list_tools.in_progress":case"response.mcp_list_tools.completed":case"response.mcp_list_tools.failed":case"error":break;default:lF($)}return w}function $v($){let w=structuredClone($);if(!Object.getOwnPropertyDescriptor(w,"output_text")||w.output_text==null)o$(w);return w}function l($,w){let J=$.output[w];if(!J)throw new R(`missing output at index ${w}`);return J}function s$($,w){let J=$[w];if(!J)throw new R(`missing content at index ${w}`);return J}function lF($){throw new R(`Unhandled response stream event: ${JSON.stringify($)}`)}var H1,HV,ww,FV,Jv,Uv,Vv;class qV extends n6{constructor($){super();H1.add(this),HV.set(this,void 0),ww.set(this,void 0),FV.set(this,void 0),x(this,HV,$,"f")}static createResponse($,w,J){let V=new qV(w);return V._run(()=>V._createOrRetrieveResponse($,w,{...J,headers:{...J?.headers,"X-Stainless-Helper-Method":"stream"}})),V}async _createOrRetrieveResponse($,w,J){this._listenForAbort(J?.signal),B(this,H1,"m",Jv).call(this);let V,U=null;if("response_id"in w)V=await $.responses.retrieve(w.response_id,{stream:!0},{...J,signal:this.controller.signal,stream:!0}),U=w.starting_after??null;else V=await $.responses.create({...w,stream:!0},{...J,signal:this.controller.signal});this._connected();for await(let G of V)B(this,H1,"m",Uv).call(this,G,U);if(V.controller.signal?.aborted)throw new g$;return B(this,H1,"m",Vv).call(this)}[(HV=new WeakMap,ww=new WeakMap,FV=new WeakMap,H1=new WeakSet,Jv=function(){if(this.ended)return;x(this,ww,void 0,"f")},Uv=function(w,J){if(this.ended)return;let V=(G,z)=>{if(J==null||z.sequence_number>J)this._emit(G,z)},U=wv(w,B(this,ww,"f"));switch(x(this,ww,U,"f"),V("event",w),w.type){case"response.output_text.delta":{let G=U.output[w.output_index];if(!G)throw new R(`missing output at index ${w.output_index}`);if(G.type==="message"){let z=G.content[w.content_index];if(!z)throw new R(`missing content at index ${w.content_index}`);if(z.type!=="output_text")throw new R(`expected content to be 'output_text', got ${z.type}`);V("response.output_text.delta",{...w,snapshot:z.text})}break}case"response.function_call_arguments.delta":{let G=U.output[w.output_index];if(!G)throw new R(`missing output at index ${w.output_index}`);if(G.type==="function_call")V("response.function_call_arguments.delta",{...w,snapshot:G.arguments});break}default:V(w.type,w);break}},Vv=function(){if(this.ended)throw new R("stream has ended, this shouldn't happen");let w=B(this,ww,"f");if(!w)throw new R("request ended without sending any events");x(this,ww,void 0,"f");let J=tF(w,B(this,HV,"f"));return x(this,FV,J,"f"),J},Symbol.asyncIterator)](){let $=[],w=[],J=!1;return this.on("event",(V)=>{let U=w.shift();if(U)U.resolve(V);else $.push(V)}),this.on("end",()=>{J=!0;for(let V of w)V.resolve(void 0);w.length=0}),this.on("abort",(V)=>{J=!0;for(let U of w)U.reject(V);w.length=0}),this.on("error",(V)=>{J=!0;for(let U of w)U.reject(V);w.length=0}),{next:async()=>{if(!$.length){if(J)return{value:void 0,done:!0};return new Promise((U,G)=>w.push({resolve:U,reject:G})).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 $=B(this,FV,"f");if(!$)throw new R("stream ended without producing a ChatCompletion");return $}}function tF($,w){return e2($,w)}class F1 extends K{list($,w={},J){return this._client.getAPIList(Q`/responses/${$}/input_items`,d,{query:w,...J,__security:{bearerAuth:!0}})}}class q1 extends K{count($={},w){return this._client.post("/responses/input_tokens",{body:$,...w,__security:{bearerAuth:!0}})}}class d4 extends K{constructor(){super(...arguments);this.inputItems=new F1(this._client),this.inputTokens=new q1(this._client)}create($,w){return this._client.post("/responses",{body:$,...w,stream:$.stream??!1,__security:{bearerAuth:!0}})._thenUnwrap((J)=>{if("object"in J&&J.object==="response")o$(J);return J})}retrieve($,w={},J){return this._client.get(Q`/responses/${$}`,{query:w,...J,stream:w?.stream??!1,__security:{bearerAuth:!0}})._thenUnwrap((V)=>{if("object"in V&&V.object==="response")o$(V);return V})}delete($,w){return this._client.delete(Q`/responses/${$}`,{...w,headers:M([{Accept:"*/*"},w?.headers]),__security:{bearerAuth:!0}})}parse($,w){return this._client.responses.create($,w)._thenUnwrap((J)=>gX(J,$))}stream($,w){return qV.createResponse(this._client,$,w)}cancel($,w){return this._client.post(Q`/responses/${$}/cancel`,{...w,__security:{bearerAuth:!0}})}compact($,w){return this._client.post("/responses/compact",{body:$,...w,__security:{bearerAuth:!0}})}}d4.InputItems=F1;d4.InputTokens=q1;class Z1 extends K{retrieve($,w){return this._client.get(Q`/skills/${$}/content`,{...w,headers:M([{Accept:"application/binary"},w?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}}class T1 extends K{retrieve($,w,J){let{skill_id:V}=w;return this._client.get(Q`/skills/${V}/versions/${$}/content`,{...J,headers:M([{Accept:"application/binary"},J?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}}class ew extends K{constructor(){super(...arguments);this.content=new T1(this._client)}create($,w={},J){return this._client.post(Q`/skills/${$}/versions`,J6({body:w,...J,__security:{bearerAuth:!0}},this._client))}retrieve($,w,J){let{skill_id:V}=w;return this._client.get(Q`/skills/${V}/versions/${$}`,{...J,__security:{bearerAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/skills/${$}/versions`,d,{query:w,...J,__security:{bearerAuth:!0}})}delete($,w,J){let{skill_id:V}=w;return this._client.delete(Q`/skills/${V}/versions/${$}`,{...J,__security:{bearerAuth:!0}})}}ew.Content=T1;class X6 extends K{constructor(){super(...arguments);this.content=new Z1(this._client),this.versions=new ew(this._client)}create($={},w){return this._client.post("/skills",J6({body:$,...w,__security:{bearerAuth:!0}},this._client))}retrieve($,w){return this._client.get(Q`/skills/${$}`,{...w,__security:{bearerAuth:!0}})}update($,w,J){return this._client.post(Q`/skills/${$}`,{body:w,...J,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/skills",d,{query:$,...w,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Q`/skills/${$}`,{...w,__security:{bearerAuth:!0}})}}X6.Content=Z1;X6.Versions=ew;class D1 extends K{create($,w,J){return this._client.post(Q`/uploads/${$}/parts`,f$({body:w,...J,__security:{bearerAuth:!0}},this._client))}}class Jw extends K{constructor(){super(...arguments);this.parts=new D1(this._client)}create($,w){return this._client.post("/uploads",{body:$,...w,__security:{bearerAuth:!0}})}cancel($,w){return this._client.post(Q`/uploads/${$}/cancel`,{...w,__security:{bearerAuth:!0}})}complete($,w,J){return this._client.post(Q`/uploads/${$}/complete`,{body:w,...J,__security:{bearerAuth:!0}})}}Jw.Parts=D1;var Gv=async($)=>{let w=await Promise.allSettled($),J=w.filter((U)=>U.status==="rejected");if(J.length){for(let U of J)console.error(U.reason);throw Error(`${J.length} promise(s) failed - see the above errors`)}let V=[];for(let U of w)if(U.status==="fulfilled")V.push(U.value);return V};class L1 extends K{create($,w,J){return this._client.post(Q`/vector_stores/${$}/file_batches`,{body:w,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}retrieve($,w,J){let{vector_store_id:V}=w;return this._client.get(Q`/vector_stores/${V}/file_batches/${$}`,{...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}cancel($,w,J){let{vector_store_id:V}=w;return this._client.post(Q`/vector_stores/${V}/file_batches/${$}/cancel`,{...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}async createAndPoll($,w,J){let V=await this.create($,w);return await this.poll($,V.id,J)}listFiles($,w,J){let{vector_store_id:V,...U}=w;return this._client.getAPIList(Q`/vector_stores/${V}/file_batches/${$}/files`,d,{query:U,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}async poll($,w,J){let V=M([J?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":J?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:U,response:G}=await this.retrieve(w,{vector_store_id:$},{...J,headers:V}).withResponse();switch(U.status){case"in_progress":let z=5000;if(J?.pollIntervalMs)z=J.pollIntervalMs;else{let i=G.headers.get("openai-poll-after-ms");if(i){let N=parseInt(i);if(!isNaN(N))z=N}}await u4(z);break;case"failed":case"cancelled":case"completed":return U}}}async uploadAndPoll($,{files:w,fileIds:J=[]},V){if(w==null||w.length==0)throw Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let U=V?.maxConcurrency??5,G=Math.min(U,w.length),z=this._client,i=w.values(),N=[...J];async function X(I){for(let g of I){let Y=await z.files.create({file:g,purpose:"assistants"},V);N.push(Y.id)}}let W=Array(G).fill(i).map(X);return await Gv(W),await this.createAndPoll($,{file_ids:N})}}class f1 extends K{create($,w,J){return this._client.post(Q`/vector_stores/${$}/files`,{body:w,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}retrieve($,w,J){let{vector_store_id:V}=w;return this._client.get(Q`/vector_stores/${V}/files/${$}`,{...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}update($,w,J){let{vector_store_id:V,...U}=w;return this._client.post(Q`/vector_stores/${V}/files/${$}`,{body:U,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}list($,w={},J){return this._client.getAPIList(Q`/vector_stores/${$}/files`,d,{query:w,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}delete($,w,J){let{vector_store_id:V}=w;return this._client.delete(Q`/vector_stores/${V}/files/${$}`,{...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}async createAndPoll($,w,J){let V=await this.create($,w,J);return await this.poll($,V.id,J)}async poll($,w,J){let V=M([J?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":J?.pollIntervalMs?.toString()??void 0}]);while(!0){let U=await this.retrieve(w,{vector_store_id:$},{...J,headers:V}).withResponse(),G=U.data;switch(G.status){case"in_progress":let z=5000;if(J?.pollIntervalMs)z=J.pollIntervalMs;else{let i=U.response.headers.get("openai-poll-after-ms");if(i){let N=parseInt(i);if(!isNaN(N))z=N}}await u4(z);break;case"failed":case"completed":return G}}}async upload($,w,J){let V=await this._client.files.create({file:w,purpose:"assistants"},J);return this.create($,{file_id:V.id},J)}async uploadAndPoll($,w,J){let V=await this.upload($,w,J);return await this.poll($,V.id,J)}content($,w,J){let{vector_store_id:V}=w;return this._client.getAPIList(Q`/vector_stores/${V}/files/${$}/content`,R$,{...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}}class N6 extends K{constructor(){super(...arguments);this.files=new f1(this._client),this.fileBatches=new L1(this._client)}create($,w){return this._client.post("/vector_stores",{body:$,...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}retrieve($,w){return this._client.get(Q`/vector_stores/${$}`,{...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}update($,w,J){return this._client.post(Q`/vector_stores/${$}`,{body:w,...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/vector_stores",d,{query:$,...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Q`/vector_stores/${$}`,{...w,headers:M([{"OpenAI-Beta":"assistants=v2"},w?.headers]),__security:{bearerAuth:!0}})}search($,w,J){return this._client.getAPIList(Q`/vector_stores/${$}/search`,R$,{body:w,method:"post",...J,headers:M([{"OpenAI-Beta":"assistants=v2"},J?.headers]),__security:{bearerAuth:!0}})}}N6.Files=f1;N6.FileBatches=L1;class sw extends K{create($,w){return this._client.post("/videos",f$({body:$,...w,__security:{bearerAuth:!0}},this._client))}retrieve($,w){return this._client.get(Q`/videos/${$}`,{...w,__security:{bearerAuth:!0}})}list($={},w){return this._client.getAPIList("/videos",o,{query:$,...w,__security:{bearerAuth:!0}})}delete($,w){return this._client.delete(Q`/videos/${$}`,{...w,__security:{bearerAuth:!0}})}createCharacter($,w){return this._client.post("/videos/characters",f$({body:$,...w,__security:{bearerAuth:!0}},this._client))}downloadContent($,w={},J){return this._client.get(Q`/videos/${$}/content`,{query:w,...J,headers:M([{Accept:"application/binary"},J?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}edit($,w){return this._client.post("/videos/edits",f$({body:$,...w,__security:{bearerAuth:!0}},this._client))}extend($,w){return this._client.post("/videos/extensions",f$({body:$,...w,__security:{bearerAuth:!0}},this._client))}getCharacter($,w){return this._client.get(Q`/videos/characters/${$}`,{...w,__security:{bearerAuth:!0}})}remix($,w,J){return this._client.post(Q`/videos/${$}/remix`,J6({body:w,...J,__security:{bearerAuth:!0}},this._client))}}var $J,zv,ZV;class wJ extends K{constructor(){super(...arguments);$J.add(this)}async unwrap($,w,J=this._client.webhookSecret,V=300){return await this.verifySignature($,w,J,V),JSON.parse($)}async verifySignature($,w,J=this._client.webhookSecret,V=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!=="function"||typeof crypto.subtle.verify!=="function")throw Error("Webhook signature verification is only supported when the `crypto` global is defined");B(this,$J,"m",zv).call(this,J);let U=M([w]).values,G=B(this,$J,"m",ZV).call(this,U,"webhook-signature"),z=B(this,$J,"m",ZV).call(this,U,"webhook-timestamp"),i=B(this,$J,"m",ZV).call(this,U,"webhook-id"),N=parseInt(z,10);if(isNaN(N))throw new C4("Invalid webhook timestamp format");let X=Math.floor(Date.now()/1000);if(X-N>V)throw new C4("Webhook timestamp is too old");if(N>X+V)throw new C4("Webhook timestamp is too new");let W=G.split(" ").map((v)=>v.startsWith("v1,")?v.substring(3):v),I=J.startsWith("whsec_")?Buffer.from(J.replace("whsec_",""),"base64"):Buffer.from(J,"utf-8"),g=i?`${i}.${z}.${$}`:`${z}.${$}`,Y=await crypto.subtle.importKey("raw",I,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let v of W)try{let O=Buffer.from(v,"base64");if(await crypto.subtle.verify("HMAC",Y,O,new TextEncoder().encode(g)))return}catch{continue}throw new C4("The given webhook signature does not match the expected signature")}}$J=new WeakSet,zv=function(w){if(typeof w!=="string"||w.length===0)throw Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},ZV=function(w,J){if(!w)throw Error("Headers are required");let V=w.get(J);if(V===null||V===void 0)throw Error(`Missing required header: ${J}`);return V};var Xv=Symbol.for("openai.node.providerDefinitions.v1"),Nv=globalThis,Wv=Nv[Xv],Iv=Wv??new WeakMap;if(!Wv)Object.defineProperty(Nv,Xv,{value:Iv});function gv($){let w=Iv.get($);if(!w)throw Error("Invalid provider. Providers must be created with createProvider().");return w.configure()}var YX,vX,M1,Yv,Uq="workload-identity-auth";class r{constructor($={}){YX.add(this),M1.set(this,void 0),this.completions=new nw(this),this.chat=new d6(this),this.embeddings=new mw(this),this.files=new hw(this),this.images=new ow(this),this.audio=new n4(this),this.moderations=new aw(this),this.models=new pw(this),this.fineTuning=new q4(this),this.graders=new $w(this),this.vectorStores=new N6(this),this.webhooks=new wJ(this),this.beta=new F4(this),this.batches=new jw(this),this.uploads=new Jw(this),this.admin=new y6(this),this.responses=new d4(this),this.realtime=new i6(this),this.conversations=new e6(this),this.evals=new s6(this),this.containers=new a6(this),this.skills=new X6(this),this.videos=new sw(this);let w=$.provider;if(w){let v=["apiKey","adminAPIKey","workloadIdentity","baseURL"].filter((O)=>$[O]!=null);if(v.length)throw new R(`The \`provider\` option cannot be used with ${v.map((O)=>`\`${O}\``).join(", ")}. Configure authentication and the base URL through the provider instead.`)}let{baseURL:J=w?null:W4("OPENAI_BASE_URL"),apiKey:V=w?null:W4("OPENAI_API_KEY")??null,adminAPIKey:U=w?null:W4("OPENAI_ADMIN_KEY")??null,organization:G=w?null:W4("OPENAI_ORG_ID")??null,project:z=w?null:W4("OPENAI_PROJECT_ID")??null,webhookSecret:i=W4("OPENAI_WEBHOOK_SECRET")??null,workloadIdentity:N,...X}=$,W=w?gv(w):void 0,I={apiKey:V,adminAPIKey:U,organization:G,project:z,webhookSecret:i,workloadIdentity:N,provider:w,...X,baseURL:W?.baseURL??(J||"https://api.openai.com/v1")};if(V&&N)throw new R("The `apiKey` and `workloadIdentity` options are mutually exclusive");if(!W&&!V&&!U&&!N)throw new R("Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.");if(!I.dangerouslyAllowBrowser&&U2())throw new R(`It looks like you're running in a browser-like environment.
|
|
180
184
|
|
|
181
185
|
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
182
186
|
If you understand the risks and have appropriate mitigations in place,
|
|
@@ -185,88 +189,91 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
|
185
189
|
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
|
|
186
190
|
|
|
187
191
|
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
188
|
-
`);this.baseURL=I.baseURL,this.timeout=I.timeout??
|
|
189
|
-
`)){let H=Q.indexOf(":");if(H>=0)P[Q.substring(0,H).trim()]=Q.substring(H+1).trim()}I.defaultHeaders=f([P,I.defaultHeaders])}if(this._options=I,this._provider=X,_)this._workloadIdentityAuth=new R2(_,this.fetch);this.apiKey=typeof v==="string"?v:null,this.adminAPIKey=J,this.organization=z,this.project=g,this.webhookSecret=V}withOptions($){let w=this._options.provider,U=$.provider??w,v={...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._options.apiKey,adminAPIKey:this.adminAPIKey,workloadIdentity:this._options.workloadIdentity,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret};if(U){if(delete v.apiKey,delete v.adminAPIKey,delete v.workloadIdentity,delete v.baseURL,U!==w)delete v.organization,delete v.project,delete v.defaultHeaders}return new this.constructor({...v,...$,provider:U})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:w},U={bearerAuth:!0,adminAPIKeyAuth:!0}){if($.get("authorization")||$.get("api-key"))return;if(w.has("authorization")||w.has("api-key"))return;if(this._workloadIdentityAuth&&U.bearerAuth)return;throw Error('Could not resolve authentication method. Expected either apiKey or adminAPIKey to be set. Or for one of the "Authorization" or "api-key" headers to be explicitly omitted')}async authHeaders($,w={bearerAuth:!0,adminAPIKeyAuth:!0}){return f([w.bearerAuth?await this.bearerAuth($):null,w.adminAPIKeyAuth?await this.adminAPIKeyAuth($):null])}async bearerAuth($){if(this._workloadIdentityAuth)return f([{Authorization:`Bearer ${await this._workloadIdentityAuth.getToken()}`}]);if(this.apiKey==null)return;return f([{Authorization:`Bearer ${this.apiKey}`}])}async adminAPIKeyAuth($){if(this.adminAPIKey==null)return;return f([{Authorization:`Bearer ${this.adminAPIKey}`}])}stringifyQuery($){return OW($)}getUserAgent(){return`${this.constructor.name}/JS ${i4}`}defaultIdempotencyKey(){return`stainless-node-retry-${L2()}`}makeStatusError($,w,U,v){return v$.generate($,w,U,v)}async _callApiKey(){if(this._provider)return!1;let $=this._options.apiKey;if(typeof $!=="function")return!1;let w;try{w=await $()}catch(U){if(U instanceof i)throw U;throw new i(`Failed to get token from 'apiKey' function: ${U.message}`,{cause:U})}if(typeof w!=="string"||!w)throw new i(`Expected 'apiKey' function argument to return a string but it returned ${w}`);return this.apiKey=w,!0}buildURL($,w,U){let v=!q(this,$g,"m",Q3).call(this)&&U||this.baseURL,J=e8($)?new URL($):new URL(v+(v.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),z=this.defaultQuery(),g=Object.fromEntries(J.searchParams);if(!u2(z)||!u2(g))w={...g,...z,...w};if(typeof w==="object"&&w&&!Array.isArray(w))J.search=this.stringifyQuery(w);return J.toString()}async prepareOptions($){if(this._provider)return;if(($.__security??{bearerAuth:!0}).bearerAuth)await this._callApiKey()}async prepareRequest($,{url:w,options:U}){}get($,w){return this.methodRequest("get",$,w)}post($,w){return this.methodRequest("post",$,w)}patch($,w){return this.methodRequest("patch",$,w)}put($,w){return this.methodRequest("put",$,w)}delete($,w){return this.methodRequest("delete",$,w)}methodRequest($,w,U){return this.request(Promise.resolve(U).then((v)=>{return{method:$,path:w,...v}}))}request($,w=null){return new G6(this,this.makeRequest($,w,void 0))}async makeRequest($,w,U){let v=await $,J=v.maxRetries??this.maxRetries;if(w==null)w=J;await this.prepareOptions(v);let{req:z,url:g,timeout:V}=await this.buildRequest(v,{retryCount:J-w});await this.prepareRequest(z,{url:g,options:v}),await this._provider?.prepareRequest?.(z,{url:g,options:v});let _="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=U===void 0?"":`, retryOf: ${U}`,X=Date.now();if(V$(this).debug(`[${_}] sending request`,B4({retryOfRequestLogID:U,method:v.method,url:g,options:v,headers:z.headers})),v.signal?.aborted)throw new _$;let I=v.__security??{bearerAuth:!0},N=new AbortController,W=await this.fetchWithAuth(g,z,V,N,I).catch(OU),P=Date.now();if(W instanceof globalThis.Error){let Z=`retrying, ${w} attempts remaining`;if(v.signal?.aborted)throw new _$;let u=PU(W)||/timed? ?out/i.test(String(W)+("cause"in W?String(W.cause):""));if(w)return V$(this).info(`[${_}] connection ${u?"timed out":"failed"} - ${Z}`),V$(this).debug(`[${_}] connection ${u?"timed out":"failed"} (${Z})`,B4({retryOfRequestLogID:U,url:g,durationMs:P-X,message:W.message})),this.retryRequest(v,w,U??_);if(V$(this).info(`[${_}] connection ${u?"timed out":"failed"} - error; no more retries left`),V$(this).debug(`[${_}] connection ${u?"timed out":"failed"} (error; no more retries left)`,B4({retryOfRequestLogID:U,url:g,durationMs:P-X,message:W.message})),W instanceof l6||W instanceof w0)throw W;if(u)throw new V6;throw new g6({message:SB(W),cause:W})}let Q=[...W.headers.entries()].filter(([Z])=>Z==="x-request-id").map(([Z,u])=>", "+Z+": "+JSON.stringify(u)).join(""),H=`[${_}${G}${Q}] ${z.method} ${g} ${W.ok?"succeeded":"failed"} with status ${W.status} in ${P-X}ms`;if(!W.ok){if(W.status===401&&this._workloadIdentityAuth&&I.bearerAuth&&!v.__metadata?.hasStreamingBody&&!v.__metadata?.workloadIdentityTokenRefreshed)return await f2(W.body),this._workloadIdentityAuth.invalidateToken(),this.makeRequest({...v,__metadata:{...v.__metadata,workloadIdentityTokenRefreshed:!0}},w,U??_);let Z=await this.shouldRetry(W);if(w&&Z){let x=`retrying, ${w} attempts remaining`;return await f2(W.body),V$(this).info(`${H} - ${x}`),V$(this).debug(`[${_}] response error (${x})`,B4({retryOfRequestLogID:U,url:W.url,status:W.status,headers:W.headers,durationMs:P-X})),this.retryRequest(v,w,U??_,W.headers)}let u=Z?"error; no more retries left":"error; not retryable";V$(this).info(`${H} - ${u}`);let b=await W.text().catch((x)=>OU(x).message),M=wW(b),S=M?void 0:b;throw V$(this).debug(`[${_}] response error (${u})`,B4({retryOfRequestLogID:U,url:W.url,status:W.status,headers:W.headers,message:S,durationMs:Date.now()-X})),this.makeStatusError(W.status,M,S,W.headers)}return V$(this).info(H),V$(this).debug(`[${_}] response start`,B4({retryOfRequestLogID:U,url:W.url,status:W.status,headers:W.headers,durationMs:P-X})),{response:W,options:v,controller:N,requestLogID:_,retryOfRequestLogID:U,startTime:X}}getAPIList($,w,U){return this.requestAPIList(w,U&&"then"in U?U.then((v)=>({method:"get",path:$,...v})):{method:"get",path:$,...U})}requestAPIList($,w){let U=this.makeRequest(w,null,void 0);return new X0(this,U,$)}async fetchWithAuth($,w,U,v,J={bearerAuth:!0,adminAPIKeyAuth:!0}){if(this._workloadIdentityAuth&&J.bearerAuth){let g=w.headers,V=g.get("Authorization");if(!V||V===`Bearer ${EB}`){let _=await this._workloadIdentityAuth.getToken();g.set("Authorization",`Bearer ${_}`)}}return await this.fetchWithTimeout($,w,U,v)}async fetchWithTimeout($,w,U,v){let{signal:J,method:z,...g}=w||{},V=this._makeAbort(v);if(J)J.addEventListener("abort",V,{once:!0});let _=setTimeout(V,U),G=globalThis.ReadableStream&&g.body instanceof globalThis.ReadableStream||typeof g.body==="object"&&g.body!==null&&Symbol.asyncIterator in g.body,X={signal:v.signal,...G?{duplex:"half"}:{},method:"GET",...g};if(z)X.method=z.toUpperCase();try{return await this.fetch.call(void 0,$,X)}finally{clearTimeout(_)}}async shouldRetry($){let w=$.headers.get("x-should-retry");if(w==="true")return!0;if(w==="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($,w,U,v){let J,z=v?.get("retry-after-ms");if(z){let V=parseFloat(z);if(!Number.isNaN(V))J=V}let g=v?.get("retry-after");if(g&&!J){let V=parseFloat(g);if(!Number.isNaN(V))J=V*1000;else J=Date.parse(g)-Date.now()}if(J===void 0){let V=$.maxRetries??this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis(w,V)}return await U4(J),this.makeRequest($,w-1,U)}calculateDefaultRetryTimeoutMillis($,w){let J=w-$,z=Math.min(0.5*Math.pow(2,J),8),g=1-Math.random()*0.25;return z*g*1000}async buildRequest($,{retryCount:w=0}={}){let U={...$},{method:v,path:J,query:z,defaultBaseURL:g}=U,V=this.buildURL(J,z,g);if("timeout"in U)$W("timeout",U.timeout);U.timeout=U.timeout??this.timeout;let{bodyHeaders:_,body:G,isStreamingBody:X}=this.buildBody({options:U});if(X)$.__metadata={...$.__metadata,hasStreamingBody:!0};let I=await this.buildHeaders({options:$,method:v,bodyHeaders:_,retryCount:w});return{req:{method:v,headers:I,...U.signal&&{signal:U.signal},...globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"},...G&&{body:G},...this.fetchOptions??{},...U.fetchOptions??{}},url:V,timeout:U.timeout}}async buildHeaders({options:$,method:w,bodyHeaders:U,retryCount:v}){let J={};if(this.idempotencyHeader&&w!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();J[this.idempotencyHeader]=$.idempotencyKey}let z=f([J,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(v),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...gW(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},this._provider?void 0:await this.authHeaders($,$.__security??{bearerAuth:!0}),this._options.defaultHeaders,U,$.headers]);if(!this._provider)this.validateHeaders(z,$.__security??{bearerAuth:!0});return z.values}_makeAbort($){return()=>$.abort()}buildBody({options:$}){let{body:w,headers:U}=$;if(!w){if(w===void 0&&"body"in $)return{...q(this,d1,"f").call(this,{body:w,headers:f([U])}),isStreamingBody:!1};return{bodyHeaders:void 0,body:void 0,isStreamingBody:!1}}let v=f([U]),J=typeof globalThis.ReadableStream<"u"&&w instanceof globalThis.ReadableStream,z=!J&&(typeof w==="string"||w instanceof ArrayBuffer||ArrayBuffer.isView(w)||typeof globalThis.Blob<"u"&&w instanceof globalThis.Blob||w instanceof URLSearchParams||w instanceof FormData);if(ArrayBuffer.isView(w)||w instanceof ArrayBuffer||w instanceof DataView||typeof w==="string"&&v.values.has("content-type")||globalThis.Blob&&w instanceof globalThis.Blob||w instanceof FormData||w instanceof URLSearchParams||J)return{bodyHeaders:void 0,body:w,isStreamingBody:!z};else if(typeof w==="object"&&((Symbol.asyncIterator in w)||(Symbol.iterator in w)&&("next"in w)&&typeof w.next==="function"))return{bodyHeaders:void 0,body:v0(w),isStreamingBody:!0};else if(typeof w==="object"&&v.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(w),isStreamingBody:!1};else return{...q(this,d1,"f").call(this,{body:w,headers:v}),isStreamingBody:!1}}}wg=r,d1=new WeakMap,$g=new WeakSet,Q3=function(){return this._provider!==void 0||this.baseURL!=="https://api.openai.com/v1"};r.OpenAI=wg;r.DEFAULT_TIMEOUT=600000;r.OpenAIError=i;r.APIError=v$;r.APIConnectionError=g6;r.APIConnectionTimeoutError=V6;r.APIUserAbortError=_$;r.NotFoundError=HU;r.ConflictError=uU;r.RateLimitError=DU;r.BadRequestError=BU;r.AuthenticationError=qU;r.InternalServerError=fU;r.PermissionDeniedError=LU;r.UnprocessableEntityError=KU;r.InvalidWebhookSignatureError=O4;r.toFile=a6;r.Completions=_w;r.Chat=I6;r.Embeddings=Iw;r.Files=Ww;r.Images=Ow;r.Audio=H4;r.Moderations=qw;r.Models=Bw;r.FineTuning=g4;r.Graders=K6;r.VectorStores=x4;r.Webhooks=Kw;r.Beta=z4;r.Batches=gw;r.Uploads=f6;r.Admin=W6;r.Responses=u4;r.Realtime=C4;r.Conversations=H6;r.Evals=u6;r.Containers=L6;r.Skills=j4;r.Videos=Hw;function SB($){if(AB($))return"Connection error. This may be caused by passing an undici dispatcher, such as ProxyAgent, that is incompatible with the fetch implementation. If you are using undici's ProxyAgent, pass the fetch implementation from the same undici package: import { fetch, ProxyAgent } from 'undici'; new OpenAI({ fetch, fetchOptions: { dispatcher: new ProxyAgent(...) } });";return}function AB($){let w=$;for(let U=0;U<8&&w&&typeof w==="object";U++){let v=w;if(v.code==="UND_ERR_INVALID_ARG"&&typeof v.message==="string"&&v.message.includes("invalid onRequestStart method"))return!0;w=v.cause}return!1}async function yB($){if($.source==="-"){let U=[];for await(let J of process.stdin)U.push(typeof J==="string"?Buffer.from(J):J);let v=Buffer.concat(U);return{...$,data:v,fileName:$.name??`stdin${cB($.mime)}`}}if(hB($.source)){let U=await fetch($.source);if(!U.ok)throw Error(`Failed to fetch asset ${$.source}: ${U.status} ${U.statusText}`);let v=new Uint8Array(await U.arrayBuffer()),J=new URL($.source),z=($.name??P3(J.pathname))||"asset";return{...$,mime:$.mime??U.headers.get("content-type")??void 0,data:v,fileName:z}}if(!B3($.source))throw Error(`Asset not found: ${$.source}`);let w=await CB($.source);return{...$,mime:$.mime??i0($.source),data:w,fileName:$.name??P3($.source)}}async function r4($){let w=await yB($);return a6(w.data,w.fileName,{type:w.mime??i0(w.fileName)})}function Jg($,w){let U=[],v=$===void 0?[]:Array.isArray($)?$:[$];for(let J of v)U.push({role:"image",source:J,mime:i0(J)});if(w)U.push({role:"mask",source:w,mime:i0(w)});return U}async function E0($){let w=dB($.format);return L3({...$,format:w})}async function L3($){let w=mB($);await kB(jB(w),{recursive:!0});let U=typeof $.data==="string"?Buffer.from($.data,"base64"):Buffer.from($.data);return await q3(w,U),w}async function H3($){let w=await fetch($.url);if(!w.ok)throw Error(`Failed to download generated asset: ${w.status} ${w.statusText}`);let U=new Uint8Array(await w.arrayBuffer());return E0({...$,data:U})}async function u3($){if(!$.response.ok)throw Error(`Failed to download generated asset: ${$.response.status} ${$.response.statusText}`);let w=new Uint8Array(await $.response.arrayBuffer());return L3({...$,data:w})}async function T6($,w,U){for(let v of $.outputs){let J=`${v}.json`,z={...$,operation:U,prompt:w.prompt,params:w.params??{},output:v,createdAt:new Date().toISOString()};await q3(J,`${JSON.stringify(z,null,2)}
|
|
190
|
-
`)}}function i0($){switch(xB($).toLowerCase()){case".png":return"image/png";case".jpg":case".jpeg":return"image/jpeg";case".webp":return"image/webp";case".gif":return"image/gif";case".mp3":return"audio/mpeg";case".wav":return"audio/wav";case".mp4":return"video/mp4";case".mov":return"video/quicktime";default:return}}function dB($){if(!$)return"png";return $.replace(/^\./,"").toLowerCase()}function mB($){let w=$.output;if(!w)return Ug(process.cwd(),`${$.defaultName}${O3($.index,$.total)}.${$.format}`);if(w.endsWith("/")||B3(w)&&nB(w))return Ug(w,`${$.defaultName}${O3($.index,$.total)}.${$.format}`);if($.total<=1)return w;let U=rB(w);return Ug(U.dir,`${U.name}-${$.index+1}${U.ext||`.${$.format}`}`)}function O3($,w){return w<=1?"":`-${$+1}`}function nB($){try{return RB($).isDirectory()}catch{return!1}}function hB($){return $.startsWith("http://")||$.startsWith("https://")}function cB($){if(!$)return"";switch($){case"image/png":return".png";case"image/jpeg":return".jpg";case"image/webp":return".webp";case"video/mp4":return".mp4";case"video/quicktime":return".mov";default:return""}}import{chmodSync as CH,existsSync as jH,mkdirSync as xH,readFileSync as rH,writeFileSync as yH}from"node:fs";import{dirname as dH,join as mH}from"node:path";var C={};Y4(C,{xor:()=>$Y,xid:()=>K9,void:()=>t9,uuidv7:()=>Q9,uuidv6:()=>Y9,uuidv4:()=>W9,uuid:()=>N9,util:()=>T,url:()=>P9,uppercase:()=>Rw,unknown:()=>R6,union:()=>gz,undefined:()=>c9,ulid:()=>u9,uint64:()=>n9,uint32:()=>y9,tuple:()=>fI,trim:()=>yw,treeifyError:()=>Pg,transform:()=>Gz,toUpperCase:()=>mw,toLowerCase:()=>dw,toJSONSchema:()=>Sv,templateLiteral:()=>YY,symbol:()=>h9,superRefine:()=>sI,success:()=>XY,stringbool:()=>uY,stringFormat:()=>A9,string:()=>NJ,strictObject:()=>e9,startsWith:()=>Cw,slugify:()=>nw,size:()=>E6,setErrorMap:()=>TH,set:()=>zY,safeParseAsync:()=>sX,safeParse:()=>eX,safeEncodeAsync:()=>gI,safeEncode:()=>vI,safeDecodeAsync:()=>VI,safeDecode:()=>zI,registry:()=>vv,regexes:()=>x$,regex:()=>Sw,refine:()=>eI,record:()=>TI,readonly:()=>cI,property:()=>Fv,promise:()=>QY,prettifyError:()=>Og,preprocess:()=>DY,prefault:()=>jI,positive:()=>fv,pipe:()=>rv,partialRecord:()=>UY,parseAsync:()=>aX,parse:()=>pX,overwrite:()=>e$,optional:()=>YJ,object:()=>a9,number:()=>_I,nullish:()=>_Y,nullable:()=>QJ,null:()=>YI,normalize:()=>rw,nonpositive:()=>Zv,nonoptional:()=>xI,nonnegative:()=>bv,never:()=>zz,negative:()=>Tv,nativeEnum:()=>gY,nanoid:()=>q9,nan:()=>IY,multipleOf:()=>h4,minSize:()=>X4,minLength:()=>D4,mime:()=>xw,meta:()=>LY,maxSize:()=>c4,maxLength:()=>S6,map:()=>vY,mac:()=>T9,lte:()=>r$,lt:()=>G4,lowercase:()=>Aw,looseRecord:()=>JY,looseObject:()=>s9,locales:()=>GJ,literal:()=>VY,length:()=>A6,lazy:()=>oI,ksuid:()=>D9,keyof:()=>p9,jwt:()=>S9,json:()=>KY,iso:()=>lw,ipv6:()=>Z9,ipv4:()=>f9,invertCodec:()=>WY,intersection:()=>KI,int64:()=>m9,int32:()=>r9,int:()=>xv,instanceof:()=>HY,includes:()=>kw,httpUrl:()=>O9,hostname:()=>R9,hex:()=>k9,hash:()=>C9,guid:()=>I9,gte:()=>b$,gt:()=>_4,globalRegistry:()=>P$,getErrorMap:()=>ZH,function:()=>PY,fromJSONSchema:()=>TY,formatError:()=>a1,float64:()=>x9,float32:()=>j9,flattenError:()=>p1,file:()=>GY,exactOptional:()=>SI,enum:()=>Vz,endsWith:()=>jw,encodeAsync:()=>UI,encode:()=>$I,emoji:()=>B9,email:()=>X9,e164:()=>E9,discriminatedUnion:()=>wY,describe:()=>qY,decodeAsync:()=>JI,decode:()=>wI,date:()=>o9,custom:()=>BY,cuid2:()=>H9,cuid:()=>L9,core:()=>f4,config:()=>g$,coerce:()=>wN,codec:()=>NY,clone:()=>T$,cidrv6:()=>F9,cidrv4:()=>b9,check:()=>OY,catch:()=>dI,boolean:()=>XI,bigint:()=>d9,base64url:()=>i9,base64:()=>M9,array:()=>qJ,any:()=>l9,_function:()=>PY,_default:()=>kI,_ZodString:()=>yv,ZodXor:()=>LI,ZodXID:()=>tv,ZodVoid:()=>BI,ZodUnknown:()=>PI,ZodUnion:()=>HJ,ZodUndefined:()=>NI,ZodUUID:()=>I4,ZodURL:()=>OJ,ZodULID:()=>lv,ZodType:()=>m,ZodTuple:()=>DI,ZodTransform:()=>iI,ZodTemplateLiteral:()=>lI,ZodSymbol:()=>II,ZodSuccess:()=>rI,ZodStringFormat:()=>s,ZodString:()=>pw,ZodSet:()=>bI,ZodRecord:()=>tw,ZodRealError:()=>E$,ZodReadonly:()=>hI,ZodPromise:()=>pI,ZodPreprocess:()=>nI,ZodPrefault:()=>CI,ZodPipe:()=>uJ,ZodOptional:()=>_z,ZodObject:()=>LJ,ZodNumberFormat:()=>k6,ZodNumber:()=>ew,ZodNullable:()=>AI,ZodNull:()=>WI,ZodNonOptional:()=>Xz,ZodNever:()=>OI,ZodNanoID:()=>nv,ZodNaN:()=>mI,ZodMap:()=>ZI,ZodMAC:()=>GI,ZodLiteral:()=>FI,ZodLazy:()=>tI,ZodKSUID:()=>ov,ZodJWT:()=>Jz,ZodIssueCode:()=>fH,ZodIntersection:()=>uI,ZodISOTime:()=>Cv,ZodISODuration:()=>jv,ZodISODateTime:()=>Rv,ZodISODate:()=>kv,ZodIPv6:()=>av,ZodIPv4:()=>pv,ZodGUID:()=>WJ,ZodFunction:()=>aI,ZodFirstPartyTypeKind:()=>$N,ZodFile:()=>MI,ZodExactOptional:()=>EI,ZodError:()=>KH,ZodEnum:()=>ow,ZodEmoji:()=>mv,ZodEmail:()=>dv,ZodE164:()=>Uz,ZodDiscriminatedUnion:()=>HI,ZodDefault:()=>RI,ZodDate:()=>BJ,ZodCustomStringFormat:()=>aw,ZodCustom:()=>DJ,ZodCodec:()=>KJ,ZodCatch:()=>yI,ZodCUID2:()=>cv,ZodCUID:()=>hv,ZodCIDRv6:()=>sv,ZodCIDRv4:()=>ev,ZodBoolean:()=>sw,ZodBigIntFormat:()=>vz,ZodBigInt:()=>$U,ZodBase64URL:()=>wz,ZodBase64:()=>$z,ZodArray:()=>qI,ZodAny:()=>QI,TimePrecision:()=>f_,NEVER:()=>vg,$output:()=>q_,$input:()=>L_,$brand:()=>zg});var f4={};Y4(f4,{version:()=>WV,util:()=>T,treeifyError:()=>Pg,toJSONSchema:()=>Sv,toDotPath:()=>F3,safeParseAsync:()=>qg,safeParse:()=>Bg,safeEncodeAsync:()=>fq,safeEncode:()=>Kq,safeDecodeAsync:()=>Tq,safeDecode:()=>Dq,registry:()=>vv,regexes:()=>x$,process:()=>p,prettifyError:()=>Og,parseAsync:()=>k0,parse:()=>R0,meta:()=>zX,locales:()=>GJ,isValidJWT:()=>a3,isValidBase64URL:()=>p3,isValidBase64:()=>RV,initializeContext:()=>l4,globalRegistry:()=>P$,globalConfig:()=>Z6,formatError:()=>a1,flattenError:()=>p1,finalize:()=>o4,extractDefs:()=>t4,encodeAsync:()=>Hq,encode:()=>qq,describe:()=>vX,decodeAsync:()=>uq,decode:()=>Lq,createToJSONSchemaMethod:()=>VX,createStandardJSONSchemaMethod:()=>cw,config:()=>g$,clone:()=>T$,_xor:()=>sL,_xid:()=>Qv,_void:()=>o_,_uuidv7:()=>_v,_uuidv6:()=>Gv,_uuidv4:()=>Vv,_uuid:()=>gv,_url:()=>XJ,_uppercase:()=>Rw,_unknown:()=>l_,_union:()=>eL,_undefined:()=>n_,_ulid:()=>Yv,_uint64:()=>d_,_uint32:()=>k_,_tuple:()=>UH,_trim:()=>yw,_transform:()=>_H,_toUpperCase:()=>mw,_toLowerCase:()=>dw,_templateLiteral:()=>BH,_symbol:()=>m_,_superRefine:()=>JX,_success:()=>YH,_stringbool:()=>gX,_stringFormat:()=>hw,_string:()=>u_,_startsWith:()=>Cw,_slugify:()=>nw,_size:()=>E6,_set:()=>zH,_safeParseAsync:()=>Mw,_safeParse:()=>Fw,_safeEncodeAsync:()=>m0,_safeEncode:()=>y0,_safeDecodeAsync:()=>n0,_safeDecode:()=>d0,_regex:()=>Sw,_refine:()=>UX,_record:()=>JH,_readonly:()=>OH,_property:()=>Fv,_promise:()=>LH,_positive:()=>fv,_pipe:()=>PH,_parseAsync:()=>bw,_parse:()=>Zw,_overwrite:()=>e$,_optional:()=>XH,_number:()=>M_,_nullable:()=>IH,_null:()=>h_,_normalize:()=>rw,_nonpositive:()=>Zv,_nonoptional:()=>WH,_nonnegative:()=>bv,_never:()=>t_,_negative:()=>Tv,_nativeEnum:()=>VH,_nanoid:()=>Iv,_nan:()=>e_,_multipleOf:()=>h4,_minSize:()=>X4,_minLength:()=>D4,_min:()=>b$,_mime:()=>xw,_maxSize:()=>c4,_maxLength:()=>S6,_max:()=>r$,_map:()=>vH,_mac:()=>D_,_lte:()=>r$,_lt:()=>G4,_lowercase:()=>Aw,_literal:()=>GH,_length:()=>A6,_lazy:()=>qH,_ksuid:()=>Pv,_jwt:()=>Dv,_isoTime:()=>b_,_isoDuration:()=>F_,_isoDateTime:()=>T_,_isoDate:()=>Z_,_ipv6:()=>Bv,_ipv4:()=>Ov,_intersection:()=>wH,_int64:()=>y_,_int32:()=>R_,_int:()=>E_,_includes:()=>kw,_guid:()=>_J,_gte:()=>b$,_gt:()=>_4,_float64:()=>A_,_float32:()=>S_,_file:()=>$X,_enum:()=>gH,_endsWith:()=>jw,_encodeAsync:()=>x0,_encode:()=>C0,_emoji:()=>Xv,_email:()=>zv,_e164:()=>Kv,_discriminatedUnion:()=>$H,_default:()=>NH,_decodeAsync:()=>r0,_decode:()=>j0,_date:()=>p_,_custom:()=>wX,_cuid2:()=>Wv,_cuid:()=>Nv,_coercedString:()=>K_,_coercedNumber:()=>i_,_coercedDate:()=>a_,_coercedBoolean:()=>j_,_coercedBigint:()=>r_,_cidrv6:()=>Lv,_cidrv4:()=>qv,_check:()=>g9,_catch:()=>QH,_boolean:()=>C_,_bigint:()=>x_,_base64url:()=>uv,_base64:()=>Hv,_array:()=>s_,_any:()=>c_,TimePrecision:()=>f_,NEVER:()=>vg,JSONSchemaGenerator:()=>hX,JSONSchema:()=>V9,Doc:()=>t0,$output:()=>q_,$input:()=>L_,$constructor:()=>B,$brand:()=>zg,$ZodXor:()=>sV,$ZodXID:()=>DV,$ZodVoid:()=>oV,$ZodUnknown:()=>lV,$ZodUnion:()=>UJ,$ZodUndefined:()=>nV,$ZodUUID:()=>PV,$ZodURL:()=>BV,$ZodULID:()=>KV,$ZodType:()=>d,$ZodTuple:()=>wv,$ZodTransform:()=>GG,$ZodTemplateLiteral:()=>qG,$ZodSymbol:()=>mV,$ZodSuccess:()=>YG,$ZodStringFormat:()=>e,$ZodString:()=>i6,$ZodSet:()=>vG,$ZodRegistry:()=>H_,$ZodRecord:()=>UG,$ZodRealError:()=>i$,$ZodReadonly:()=>BG,$ZodPromise:()=>HG,$ZodPreprocess:()=>OG,$ZodPrefault:()=>NG,$ZodPipe:()=>Jv,$ZodOptional:()=>Uv,$ZodObjectJIT:()=>eV,$ZodObject:()=>$9,$ZodNumberFormat:()=>yV,$ZodNumber:()=>s0,$ZodNullable:()=>XG,$ZodNull:()=>hV,$ZodNonOptional:()=>WG,$ZodNever:()=>tV,$ZodNanoID:()=>LV,$ZodNaN:()=>PG,$ZodMap:()=>JG,$ZodMAC:()=>EV,$ZodLiteral:()=>gG,$ZodLazy:()=>uG,$ZodKSUID:()=>fV,$ZodJWT:()=>xV,$ZodIntersection:()=>wG,$ZodISOTime:()=>bV,$ZodISODuration:()=>FV,$ZodISODateTime:()=>TV,$ZodISODate:()=>ZV,$ZodIPv6:()=>iV,$ZodIPv4:()=>MV,$ZodGUID:()=>QV,$ZodFunction:()=>LG,$ZodFile:()=>VG,$ZodExactOptional:()=>_G,$ZodError:()=>o1,$ZodEnum:()=>zG,$ZodEncodeError:()=>b6,$ZodEmoji:()=>qV,$ZodEmail:()=>OV,$ZodE164:()=>jV,$ZodDiscriminatedUnion:()=>$G,$ZodDefault:()=>IG,$ZodDate:()=>pV,$ZodCustomStringFormat:()=>rV,$ZodCustom:()=>KG,$ZodCodec:()=>JJ,$ZodCheckUpperCase:()=>gV,$ZodCheckStringFormat:()=>iw,$ZodCheckStartsWith:()=>GV,$ZodCheckSizeEquals:()=>$V,$ZodCheckRegex:()=>vV,$ZodCheckProperty:()=>XV,$ZodCheckOverwrite:()=>NV,$ZodCheckNumberFormat:()=>pg,$ZodCheckMultipleOf:()=>og,$ZodCheckMinSize:()=>sg,$ZodCheckMinLength:()=>UV,$ZodCheckMimeType:()=>IV,$ZodCheckMaxSize:()=>eg,$ZodCheckMaxLength:()=>wV,$ZodCheckLowerCase:()=>zV,$ZodCheckLessThan:()=>c0,$ZodCheckLengthEquals:()=>JV,$ZodCheckIncludes:()=>VV,$ZodCheckGreaterThan:()=>l0,$ZodCheckEndsWith:()=>_V,$ZodCheckBigIntFormat:()=>ag,$ZodCheck:()=>$$,$ZodCatch:()=>QG,$ZodCUID2:()=>uV,$ZodCUID:()=>HV,$ZodCIDRv6:()=>AV,$ZodCIDRv4:()=>SV,$ZodBoolean:()=>wJ,$ZodBigIntFormat:()=>dV,$ZodBigInt:()=>$v,$ZodBase64URL:()=>CV,$ZodBase64:()=>kV,$ZodAsyncError:()=>V4,$ZodArray:()=>aV,$ZodAny:()=>cV});var K3,vg=Object.freeze({status:"aborted"});function B($,w,U){function v(V,_){if(!V._zod)Object.defineProperty(V,"_zod",{value:{def:_,constr:g,traits:new Set},enumerable:!1});if(V._zod.traits.has($))return;V._zod.traits.add($),w(V,_);let G=g.prototype,X=Object.keys(G);for(let I=0;I<X.length;I++){let N=X[I];if(!(N in V))V[N]=G[N].bind(V)}}let J=U?.Parent??Object;class z extends J{}Object.defineProperty(z,"name",{value:$});function g(V){var _;let G=U?.Parent?new z:this;v(G,V),(_=G._zod).deferred??(_.deferred=[]);for(let X of G._zod.deferred)X();return G}return Object.defineProperty(g,"init",{value:v}),Object.defineProperty(g,Symbol.hasInstance,{value:(V)=>{if(U?.Parent&&V instanceof U.Parent)return!0;return V?._zod?.traits?.has($)}}),Object.defineProperty(g,"name",{value:$}),g}var zg=Symbol("zod_brand");class V4 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class b6 extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}}(K3=globalThis).__zod_globalConfig??(K3.__zod_globalConfig={});var Z6=globalThis.__zod_globalConfig;function g$($){if($)Object.assign(Z6,$);return Z6}var T={};Y4(T,{unwrapMessage:()=>m1,uint8ArrayToHex:()=>Oq,uint8ArrayToBase64url:()=>Qq,uint8ArrayToBase64:()=>T3,stringifyPrimitive:()=>K,slugify:()=>Gg,shallowClone:()=>Xg,safeExtend:()=>_q,required:()=>Nq,randomString:()=>Uq,propertyKeyTypes:()=>c1,promiseAllObject:()=>wq,primitiveTypes:()=>Ig,prefixIssues:()=>M$,pick:()=>gq,partial:()=>Iq,parsedType:()=>D,optionalKeys:()=>Ng,omit:()=>Vq,objectClone:()=>eB,numKeys:()=>Jq,nullish:()=>y4,normalizeParams:()=>F,mergeDefs:()=>K4,merge:()=>Xq,jsonStringifyReplacer:()=>Dw,joinValues:()=>L,issue:()=>Tw,isPlainObject:()=>m4,isObject:()=>F6,hexToUint8Array:()=>Pq,getSizableOrigin:()=>l1,getParsedType:()=>vq,getLengthableOrigin:()=>t1,getEnumValues:()=>n1,getElementAtPath:()=>$q,floatSafeRemainder:()=>Vg,finalizeIssue:()=>Z$,extend:()=>Gq,explicitlyAborted:()=>Qg,escapeRegex:()=>n$,esc:()=>S0,defineLazy:()=>n,createTransparentProxy:()=>zq,cloneDef:()=>sB,clone:()=>T$,cleanRegex:()=>h1,cleanEnum:()=>Wq,captureStackTrace:()=>A0,cached:()=>fw,base64urlToUint8Array:()=>Yq,base64ToUint8Array:()=>f3,assignProp:()=>d4,assertNotEqual:()=>tB,assertNever:()=>pB,assertIs:()=>oB,assertEqual:()=>lB,assert:()=>aB,allowsEval:()=>_g,aborted:()=>n4,NUMBER_FORMAT_RANGES:()=>Wg,Class:()=>Z3,BIGINT_FORMAT_RANGES:()=>Yg});function lB($){return $}function tB($){return $}function oB($){}function pB($){throw Error("Unexpected value in exhaustive check")}function aB($){}function n1($){let w=Object.values($).filter((v)=>typeof v==="number");return Object.entries($).filter(([v,J])=>w.indexOf(+v)===-1).map(([v,J])=>J)}function L($,w="|"){return $.map((U)=>K(U)).join(w)}function Dw($,w){if(typeof w==="bigint")return w.toString();return w}function fw($){return{get value(){{let U=$();return Object.defineProperty(this,"value",{value:U}),U}throw Error("cached value already set")}}}function y4($){return $===null||$===void 0}function h1($){let w=$.startsWith("^")?1:0,U=$.endsWith("$")?$.length-1:$.length;return $.slice(w,U)}function Vg($,w){let U=$/w,v=Math.round(U),J=Number.EPSILON*Math.max(Math.abs(U),1);if(Math.abs(U-v)<J)return 0;return U-v}var D3=Symbol("evaluating");function n($,w,U){let v=void 0;Object.defineProperty($,w,{get(){if(v===D3)return;if(v===void 0)v=D3,v=U();return v},set(J){Object.defineProperty($,w,{value:J})},configurable:!0})}function eB($){return Object.create(Object.getPrototypeOf($),Object.getOwnPropertyDescriptors($))}function d4($,w,U){Object.defineProperty($,w,{value:U,writable:!0,enumerable:!0,configurable:!0})}function K4(...$){let w={};for(let U of $){let v=Object.getOwnPropertyDescriptors(U);Object.assign(w,v)}return Object.defineProperties({},w)}function sB($){return K4($._zod.def)}function $q($,w){if(!w)return $;return w.reduce((U,v)=>U?.[v],$)}function wq($){let w=Object.keys($),U=w.map((v)=>$[v]);return Promise.all(U).then((v)=>{let J={};for(let z=0;z<w.length;z++)J[w[z]]=v[z];return J})}function Uq($=10){let U="";for(let v=0;v<$;v++)U+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return U}function S0($){return JSON.stringify($)}function Gg($){return $.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var A0="captureStackTrace"in Error?Error.captureStackTrace:(...$)=>{};function F6($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var _g=fw(()=>{if(Z6.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function m4($){if(F6($)===!1)return!1;let w=$.constructor;if(w===void 0)return!0;if(typeof w!=="function")return!0;let U=w.prototype;if(F6(U)===!1)return!1;if(Object.prototype.hasOwnProperty.call(U,"isPrototypeOf")===!1)return!1;return!0}function Xg($){if(m4($))return{...$};if(Array.isArray($))return[...$];if($ instanceof Map)return new Map($);if($ instanceof Set)return new Set($);return $}function Jq($){let w=0;for(let U in $)if(Object.prototype.hasOwnProperty.call($,U))w++;return w}var vq=($)=>{let w=typeof $;switch(w){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<"u"&&$ instanceof Map)return"map";if(typeof Set<"u"&&$ instanceof Set)return"set";if(typeof Date<"u"&&$ instanceof Date)return"date";if(typeof File<"u"&&$ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${w}`)}},c1=new Set(["string","number","symbol"]),Ig=new Set(["string","number","bigint","boolean","symbol","undefined"]);function n$($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function T$($,w,U){let v=new $._zod.constr(w??$._zod.def);if(!w||U?.parent)v._zod.parent=$;return v}function F($){let w=$;if(!w)return{};if(typeof w==="string")return{error:()=>w};if(w?.message!==void 0){if(w?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");w.error=w.message}if(delete w.message,typeof w.error==="string")return{...w,error:()=>w.error};return w}function zq($){let w;return new Proxy({},{get(U,v,J){return w??(w=$()),Reflect.get(w,v,J)},set(U,v,J,z){return w??(w=$()),Reflect.set(w,v,J,z)},has(U,v){return w??(w=$()),Reflect.has(w,v)},deleteProperty(U,v){return w??(w=$()),Reflect.deleteProperty(w,v)},ownKeys(U){return w??(w=$()),Reflect.ownKeys(w)},getOwnPropertyDescriptor(U,v){return w??(w=$()),Reflect.getOwnPropertyDescriptor(w,v)},defineProperty(U,v,J){return w??(w=$()),Reflect.defineProperty(w,v,J)}})}function K($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function Ng($){return Object.keys($).filter((w)=>{return $[w]._zod.optin==="optional"&&$[w]._zod.optout==="optional"})}var Wg={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]},Yg={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function gq($,w){let U=$._zod.def,v=U.checks;if(v&&v.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let z=K4($._zod.def,{get shape(){let g={};for(let V in w){if(!(V in U.shape))throw Error(`Unrecognized key: "${V}"`);if(!w[V])continue;g[V]=U.shape[V]}return d4(this,"shape",g),g},checks:[]});return T$($,z)}function Vq($,w){let U=$._zod.def,v=U.checks;if(v&&v.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let z=K4($._zod.def,{get shape(){let g={...$._zod.def.shape};for(let V in w){if(!(V in U.shape))throw Error(`Unrecognized key: "${V}"`);if(!w[V])continue;delete g[V]}return d4(this,"shape",g),g},checks:[]});return T$($,z)}function Gq($,w){if(!m4(w))throw Error("Invalid input to extend: expected a plain object");let U=$._zod.def.checks;if(U&&U.length>0){let z=$._zod.def.shape;for(let g in w)if(Object.getOwnPropertyDescriptor(z,g)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let J=K4($._zod.def,{get shape(){let z={...$._zod.def.shape,...w};return d4(this,"shape",z),z}});return T$($,J)}function _q($,w){if(!m4(w))throw Error("Invalid input to safeExtend: expected a plain object");let U=K4($._zod.def,{get shape(){let v={...$._zod.def.shape,...w};return d4(this,"shape",v),v}});return T$($,U)}function Xq($,w){if($._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let U=K4($._zod.def,{get shape(){let v={...$._zod.def.shape,...w._zod.def.shape};return d4(this,"shape",v),v},get catchall(){return w._zod.def.catchall},checks:w._zod.def.checks??[]});return T$($,U)}function Iq($,w,U){let J=w._zod.def.checks;if(J&&J.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let g=K4(w._zod.def,{get shape(){let V=w._zod.def.shape,_={...V};if(U)for(let G in U){if(!(G in V))throw Error(`Unrecognized key: "${G}"`);if(!U[G])continue;_[G]=$?new $({type:"optional",innerType:V[G]}):V[G]}else for(let G in V)_[G]=$?new $({type:"optional",innerType:V[G]}):V[G];return d4(this,"shape",_),_},checks:[]});return T$(w,g)}function Nq($,w,U){let v=K4(w._zod.def,{get shape(){let J=w._zod.def.shape,z={...J};if(U)for(let g in U){if(!(g in z))throw Error(`Unrecognized key: "${g}"`);if(!U[g])continue;z[g]=new $({type:"nonoptional",innerType:J[g]})}else for(let g in J)z[g]=new $({type:"nonoptional",innerType:J[g]});return d4(this,"shape",z),z}});return T$(w,v)}function n4($,w=0){if($.aborted===!0)return!0;for(let U=w;U<$.issues.length;U++)if($.issues[U]?.continue!==!0)return!0;return!1}function Qg($,w=0){if($.aborted===!0)return!0;for(let U=w;U<$.issues.length;U++)if($.issues[U]?.continue===!1)return!0;return!1}function M$($,w){return w.map((U)=>{var v;return(v=U).path??(v.path=[]),U.path.unshift($),U})}function m1($){return typeof $==="string"?$:$?.message}function Z$($,w,U){let v=$.message?$.message:m1($.inst?._zod.def?.error?.($))??m1(w?.error?.($))??m1(U.customError?.($))??m1(U.localeError?.($))??"Invalid input",{inst:J,continue:z,input:g,...V}=$;if(V.path??(V.path=[]),V.message=v,w?.reportInput)V.input=g;return V}function l1($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function t1($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function D($){let w=typeof $;switch(w){case"number":return Number.isNaN($)?"nan":"number";case"object":{if($===null)return"null";if(Array.isArray($))return"array";let U=$;if(U&&Object.getPrototypeOf(U)!==Object.prototype&&"constructor"in U&&U.constructor)return U.constructor.name}}return w}function Tw(...$){let[w,U,v]=$;if(typeof w==="string")return{message:w,code:"custom",input:U,inst:v};return{...w}}function Wq($){return Object.entries($).filter(([w,U])=>{return Number.isNaN(Number.parseInt(w,10))}).map((w)=>w[1])}function f3($){let w=atob($),U=new Uint8Array(w.length);for(let v=0;v<w.length;v++)U[v]=w.charCodeAt(v);return U}function T3($){let w="";for(let U=0;U<$.length;U++)w+=String.fromCharCode($[U]);return btoa(w)}function Yq($){let w=$.replace(/-/g,"+").replace(/_/g,"/"),U="=".repeat((4-w.length%4)%4);return f3(w+U)}function Qq($){return T3($).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Pq($){let w=$.replace(/^0x/,"");if(w.length%2!==0)throw Error("Invalid hex string length");let U=new Uint8Array(w.length/2);for(let v=0;v<w.length;v+=2)U[v/2]=Number.parseInt(w.slice(v,v+2),16);return U}function Oq($){return Array.from($).map((w)=>w.toString(16).padStart(2,"0")).join("")}class Z3{constructor(...$){}}var b3=($,w)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:w,enumerable:!1}),$.message=JSON.stringify(w,Dw,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},o1=B("$ZodError",b3),i$=B("$ZodError",b3,{Parent:Error});function p1($,w=(U)=>U.message){let U={},v=[];for(let J of $.issues)if(J.path.length>0)U[J.path[0]]=U[J.path[0]]||[],U[J.path[0]].push(w(J));else v.push(w(J));return{formErrors:v,fieldErrors:U}}function a1($,w=(U)=>U.message){let U={_errors:[]},v=(J,z=[])=>{for(let g of J.issues)if(g.code==="invalid_union"&&g.errors.length)g.errors.map((V)=>v({issues:V},[...z,...g.path]));else if(g.code==="invalid_key")v({issues:g.issues},[...z,...g.path]);else if(g.code==="invalid_element")v({issues:g.issues},[...z,...g.path]);else{let V=[...z,...g.path];if(V.length===0)U._errors.push(w(g));else{let _=U,G=0;while(G<V.length){let X=V[G];if(G!==V.length-1)_[X]=_[X]||{_errors:[]};else _[X]=_[X]||{_errors:[]},_[X]._errors.push(w(g));_=_[X],G++}}}};return v($),U}function Pg($,w=(U)=>U.message){let U={errors:[]},v=(J,z=[])=>{var g,V;for(let _ of J.issues)if(_.code==="invalid_union"&&_.errors.length)_.errors.map((G)=>v({issues:G},[...z,..._.path]));else if(_.code==="invalid_key")v({issues:_.issues},[...z,..._.path]);else if(_.code==="invalid_element")v({issues:_.issues},[...z,..._.path]);else{let G=[...z,..._.path];if(G.length===0){U.errors.push(w(_));continue}let X=U,I=0;while(I<G.length){let N=G[I],W=I===G.length-1;if(typeof N==="string")X.properties??(X.properties={}),(g=X.properties)[N]??(g[N]={errors:[]}),X=X.properties[N];else X.items??(X.items=[]),(V=X.items)[N]??(V[N]={errors:[]}),X=X.items[N];if(W)X.errors.push(w(_));I++}}};return v($),U}function F3($){let w=[],U=$.map((v)=>typeof v==="object"?v.key:v);for(let v of U)if(typeof v==="number")w.push(`[${v}]`);else if(typeof v==="symbol")w.push(`[${JSON.stringify(String(v))}]`);else if(/[^\w$]/.test(v))w.push(`[${JSON.stringify(v)}]`);else{if(w.length)w.push(".");w.push(v)}return w.join("")}function Og($){let w=[],U=[...$.issues].sort((v,J)=>(v.path??[]).length-(J.path??[]).length);for(let v of U)if(w.push(`✖ ${v.message}`),v.path?.length)w.push(` → at ${F3(v.path)}`);return w.join(`
|
|
191
|
-
`)}var Zw=($)=>(w,U,v,J)=>{let z=v?{...v,async:!1}:{async:!1},g=w._zod.run({value:U,issues:[]},z);if(g instanceof Promise)throw new V4;if(g.issues.length){let V=new(J?.Err??$)(g.issues.map((_)=>Z$(_,z,g$())));throw A0(V,J?.callee),V}return g.value},R0=Zw(i$),bw=($)=>async(w,U,v,J)=>{let z=v?{...v,async:!0}:{async:!0},g=w._zod.run({value:U,issues:[]},z);if(g instanceof Promise)g=await g;if(g.issues.length){let V=new(J?.Err??$)(g.issues.map((_)=>Z$(_,z,g$())));throw A0(V,J?.callee),V}return g.value},k0=bw(i$),Fw=($)=>(w,U,v)=>{let J=v?{...v,async:!1}:{async:!1},z=w._zod.run({value:U,issues:[]},J);if(z instanceof Promise)throw new V4;return z.issues.length?{success:!1,error:new($??o1)(z.issues.map((g)=>Z$(g,J,g$())))}:{success:!0,data:z.value}},Bg=Fw(i$),Mw=($)=>async(w,U,v)=>{let J=v?{...v,async:!0}:{async:!0},z=w._zod.run({value:U,issues:[]},J);if(z instanceof Promise)z=await z;return z.issues.length?{success:!1,error:new $(z.issues.map((g)=>Z$(g,J,g$())))}:{success:!0,data:z.value}},qg=Mw(i$),C0=($)=>(w,U,v)=>{let J=v?{...v,direction:"backward"}:{direction:"backward"};return Zw($)(w,U,J)},qq=C0(i$),j0=($)=>(w,U,v)=>{return Zw($)(w,U,v)},Lq=j0(i$),x0=($)=>async(w,U,v)=>{let J=v?{...v,direction:"backward"}:{direction:"backward"};return bw($)(w,U,J)},Hq=x0(i$),r0=($)=>async(w,U,v)=>{return bw($)(w,U,v)},uq=r0(i$),y0=($)=>(w,U,v)=>{let J=v?{...v,direction:"backward"}:{direction:"backward"};return Fw($)(w,U,J)},Kq=y0(i$),d0=($)=>(w,U,v)=>{return Fw($)(w,U,v)},Dq=d0(i$),m0=($)=>async(w,U,v)=>{let J=v?{...v,direction:"backward"}:{direction:"backward"};return Mw($)(w,U,J)},fq=m0(i$),n0=($)=>async(w,U,v)=>{return Mw($)(w,U,v)},Tq=n0(i$);var x$={};Y4(x$,{xid:()=>Kg,uuid7:()=>Mq,uuid6:()=>Fq,uuid4:()=>bq,uuid:()=>M6,uppercase:()=>tg,unicodeEmail:()=>M3,undefined:()=>cg,ulid:()=>ug,time:()=>xg,string:()=>yg,sha512_hex:()=>aq,sha512_base64url:()=>sq,sha512_base64:()=>eq,sha384_hex:()=>tq,sha384_base64url:()=>pq,sha384_base64:()=>oq,sha256_hex:()=>hq,sha256_base64url:()=>lq,sha256_base64:()=>cq,sha1_hex:()=>dq,sha1_base64url:()=>nq,sha1_base64:()=>mq,rfc5322Email:()=>Eq,number:()=>e1,null:()=>hg,nanoid:()=>fg,md5_hex:()=>xq,md5_base64url:()=>yq,md5_base64:()=>rq,mac:()=>Eg,lowercase:()=>lg,ksuid:()=>Dg,ipv6:()=>ig,ipv4:()=>Mg,integer:()=>mg,idnEmail:()=>Sq,httpProtocol:()=>kg,html5Email:()=>iq,hostname:()=>kq,hex:()=>jq,guid:()=>Zg,extendedDuration:()=>Zq,emoji:()=>Fg,email:()=>bg,e164:()=>Cg,duration:()=>Tg,domain:()=>Cq,datetime:()=>rg,date:()=>jg,cuid2:()=>Hg,cuid:()=>Lg,cidrv6:()=>Ag,cidrv4:()=>Sg,browserEmail:()=>Aq,boolean:()=>ng,bigint:()=>dg,base64url:()=>h0,base64:()=>Rg});var Lg=/^[cC][0-9a-z]{6,}$/,Hg=/^[0-9a-z]+$/,ug=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Kg=/^[0-9a-vA-V]{20}$/,Dg=/^[A-Za-z0-9]{27}$/,fg=/^[a-zA-Z0-9_-]{21}$/,Tg=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zq=/^[-+]?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)?)??$/,Zg=/^([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})$/,M6=($)=>{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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;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})$`)},bq=M6(4),Fq=M6(6),Mq=M6(7),bg=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,iq=/^[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])?)*$/,Eq=/^(([^<>()\[\]\\.,;:\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,}))$/,M3=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Sq=M3,Aq=/^[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])?)*$/,Rq="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Fg(){return new RegExp(Rq,"u")}var Mg=/^(?:(?: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])$/,ig=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Eg=($)=>{let w=n$($??":");return new RegExp(`^(?:[0-9A-F]{2}${w}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${w}){5}[0-9a-f]{2}$`)},Sg=/^((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])$/,Ag=/^(([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])$/,Rg=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,h0=/^[A-Za-z0-9_-]*$/,kq=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Cq=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,kg=/^https?$/,Cg=/^\+[1-9]\d{6,14}$/,i3="(?:(?:\\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])))",jg=new RegExp(`^${i3}$`);function E3($){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 xg($){return new RegExp(`^${E3($)}$`)}function rg($){let w=E3({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let v=`${w}(?:${U.join("|")})`;return new RegExp(`^${i3}T(?:${v})$`)}var yg=($)=>{let w=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${w}$`)},dg=/^-?\d+n?$/,mg=/^-?\d+$/,e1=/^-?\d+(?:\.\d+)?$/,ng=/^(?:true|false)$/i,hg=/^null$/i;var cg=/^undefined$/i;var lg=/^[^A-Z]*$/,tg=/^[^a-z]*$/,jq=/^[0-9a-fA-F]*$/;function s1($,w){return new RegExp(`^[A-Za-z0-9+/]{${$}}${w}$`)}function $J($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var xq=/^[0-9a-fA-F]{32}$/,rq=s1(22,"=="),yq=$J(22),dq=/^[0-9a-fA-F]{40}$/,mq=s1(27,"="),nq=$J(27),hq=/^[0-9a-fA-F]{64}$/,cq=s1(43,"="),lq=$J(43),tq=/^[0-9a-fA-F]{96}$/,oq=s1(64,""),pq=$J(64),aq=/^[0-9a-fA-F]{128}$/,eq=s1(86,"=="),sq=$J(86);var $$=B("$ZodCheck",($,w)=>{var U;$._zod??($._zod={}),$._zod.def=w,(U=$._zod).onattach??(U.onattach=[])}),A3={number:"number",bigint:"bigint",object:"date"},c0=B("$ZodCheckLessThan",($,w)=>{$$.init($,w);let U=A3[typeof w.value];$._zod.onattach.push((v)=>{let J=v._zod.bag,z=(w.inclusive?J.maximum:J.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(w.value<z)if(w.inclusive)J.maximum=w.value;else J.exclusiveMaximum=w.value}),$._zod.check=(v)=>{if(w.inclusive?v.value<=w.value:v.value<w.value)return;v.issues.push({origin:U,code:"too_big",maximum:typeof w.value==="object"?w.value.getTime():w.value,input:v.value,inclusive:w.inclusive,inst:$,continue:!w.abort})}}),l0=B("$ZodCheckGreaterThan",($,w)=>{$$.init($,w);let U=A3[typeof w.value];$._zod.onattach.push((v)=>{let J=v._zod.bag,z=(w.inclusive?J.minimum:J.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(w.value>z)if(w.inclusive)J.minimum=w.value;else J.exclusiveMinimum=w.value}),$._zod.check=(v)=>{if(w.inclusive?v.value>=w.value:v.value>w.value)return;v.issues.push({origin:U,code:"too_small",minimum:typeof w.value==="object"?w.value.getTime():w.value,input:v.value,inclusive:w.inclusive,inst:$,continue:!w.abort})}}),og=B("$ZodCheckMultipleOf",($,w)=>{$$.init($,w),$._zod.onattach.push((U)=>{var v;(v=U._zod.bag).multipleOf??(v.multipleOf=w.value)}),$._zod.check=(U)=>{if(typeof U.value!==typeof w.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof U.value==="bigint"?U.value%w.value===BigInt(0):Vg(U.value,w.value)===0)return;U.issues.push({origin:typeof U.value,code:"not_multiple_of",divisor:w.value,input:U.value,inst:$,continue:!w.abort})}}),pg=B("$ZodCheckNumberFormat",($,w)=>{$$.init($,w),w.format=w.format||"float64";let U=w.format?.includes("int"),v=U?"int":"number",[J,z]=Wg[w.format];$._zod.onattach.push((g)=>{let V=g._zod.bag;if(V.format=w.format,V.minimum=J,V.maximum=z,U)V.pattern=mg}),$._zod.check=(g)=>{let V=g.value;if(U){if(!Number.isInteger(V)){g.issues.push({expected:v,format:w.format,code:"invalid_type",continue:!1,input:V,inst:$});return}if(!Number.isSafeInteger(V)){if(V>0)g.issues.push({input:V,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:v,inclusive:!0,continue:!w.abort});else g.issues.push({input:V,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:v,inclusive:!0,continue:!w.abort});return}}if(V<J)g.issues.push({origin:"number",input:V,code:"too_small",minimum:J,inclusive:!0,inst:$,continue:!w.abort});if(V>z)g.issues.push({origin:"number",input:V,code:"too_big",maximum:z,inclusive:!0,inst:$,continue:!w.abort})}}),ag=B("$ZodCheckBigIntFormat",($,w)=>{$$.init($,w);let[U,v]=Yg[w.format];$._zod.onattach.push((J)=>{let z=J._zod.bag;z.format=w.format,z.minimum=U,z.maximum=v}),$._zod.check=(J)=>{let z=J.value;if(z<U)J.issues.push({origin:"bigint",input:z,code:"too_small",minimum:U,inclusive:!0,inst:$,continue:!w.abort});if(z>v)J.issues.push({origin:"bigint",input:z,code:"too_big",maximum:v,inclusive:!0,inst:$,continue:!w.abort})}}),eg=B("$ZodCheckMaxSize",($,w)=>{var U;$$.init($,w),(U=$._zod.def).when??(U.when=(v)=>{let J=v.value;return!y4(J)&&J.size!==void 0}),$._zod.onattach.push((v)=>{let J=v._zod.bag.maximum??Number.POSITIVE_INFINITY;if(w.maximum<J)v._zod.bag.maximum=w.maximum}),$._zod.check=(v)=>{let J=v.value;if(J.size<=w.maximum)return;v.issues.push({origin:l1(J),code:"too_big",maximum:w.maximum,inclusive:!0,input:J,inst:$,continue:!w.abort})}}),sg=B("$ZodCheckMinSize",($,w)=>{var U;$$.init($,w),(U=$._zod.def).when??(U.when=(v)=>{let J=v.value;return!y4(J)&&J.size!==void 0}),$._zod.onattach.push((v)=>{let J=v._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(w.minimum>J)v._zod.bag.minimum=w.minimum}),$._zod.check=(v)=>{let J=v.value;if(J.size>=w.minimum)return;v.issues.push({origin:l1(J),code:"too_small",minimum:w.minimum,inclusive:!0,input:J,inst:$,continue:!w.abort})}}),$V=B("$ZodCheckSizeEquals",($,w)=>{var U;$$.init($,w),(U=$._zod.def).when??(U.when=(v)=>{let J=v.value;return!y4(J)&&J.size!==void 0}),$._zod.onattach.push((v)=>{let J=v._zod.bag;J.minimum=w.size,J.maximum=w.size,J.size=w.size}),$._zod.check=(v)=>{let J=v.value,z=J.size;if(z===w.size)return;let g=z>w.size;v.issues.push({origin:l1(J),...g?{code:"too_big",maximum:w.size}:{code:"too_small",minimum:w.size},inclusive:!0,exact:!0,input:v.value,inst:$,continue:!w.abort})}}),wV=B("$ZodCheckMaxLength",($,w)=>{var U;$$.init($,w),(U=$._zod.def).when??(U.when=(v)=>{let J=v.value;return!y4(J)&&J.length!==void 0}),$._zod.onattach.push((v)=>{let J=v._zod.bag.maximum??Number.POSITIVE_INFINITY;if(w.maximum<J)v._zod.bag.maximum=w.maximum}),$._zod.check=(v)=>{let J=v.value;if(J.length<=w.maximum)return;let g=t1(J);v.issues.push({origin:g,code:"too_big",maximum:w.maximum,inclusive:!0,input:J,inst:$,continue:!w.abort})}}),UV=B("$ZodCheckMinLength",($,w)=>{var U;$$.init($,w),(U=$._zod.def).when??(U.when=(v)=>{let J=v.value;return!y4(J)&&J.length!==void 0}),$._zod.onattach.push((v)=>{let J=v._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(w.minimum>J)v._zod.bag.minimum=w.minimum}),$._zod.check=(v)=>{let J=v.value;if(J.length>=w.minimum)return;let g=t1(J);v.issues.push({origin:g,code:"too_small",minimum:w.minimum,inclusive:!0,input:J,inst:$,continue:!w.abort})}}),JV=B("$ZodCheckLengthEquals",($,w)=>{var U;$$.init($,w),(U=$._zod.def).when??(U.when=(v)=>{let J=v.value;return!y4(J)&&J.length!==void 0}),$._zod.onattach.push((v)=>{let J=v._zod.bag;J.minimum=w.length,J.maximum=w.length,J.length=w.length}),$._zod.check=(v)=>{let J=v.value,z=J.length;if(z===w.length)return;let g=t1(J),V=z>w.length;v.issues.push({origin:g,...V?{code:"too_big",maximum:w.length}:{code:"too_small",minimum:w.length},inclusive:!0,exact:!0,input:v.value,inst:$,continue:!w.abort})}}),iw=B("$ZodCheckStringFormat",($,w)=>{var U,v;if($$.init($,w),$._zod.onattach.push((J)=>{let z=J._zod.bag;if(z.format=w.format,w.pattern)z.patterns??(z.patterns=new Set),z.patterns.add(w.pattern)}),w.pattern)(U=$._zod).check??(U.check=(J)=>{if(w.pattern.lastIndex=0,w.pattern.test(J.value))return;J.issues.push({origin:"string",code:"invalid_format",format:w.format,input:J.value,...w.pattern?{pattern:w.pattern.toString()}:{},inst:$,continue:!w.abort})});else(v=$._zod).check??(v.check=()=>{})}),vV=B("$ZodCheckRegex",($,w)=>{iw.init($,w),$._zod.check=(U)=>{if(w.pattern.lastIndex=0,w.pattern.test(U.value))return;U.issues.push({origin:"string",code:"invalid_format",format:"regex",input:U.value,pattern:w.pattern.toString(),inst:$,continue:!w.abort})}}),zV=B("$ZodCheckLowerCase",($,w)=>{w.pattern??(w.pattern=lg),iw.init($,w)}),gV=B("$ZodCheckUpperCase",($,w)=>{w.pattern??(w.pattern=tg),iw.init($,w)}),VV=B("$ZodCheckIncludes",($,w)=>{$$.init($,w);let U=n$(w.includes),v=new RegExp(typeof w.position==="number"?`^.{${w.position}}${U}`:U);w.pattern=v,$._zod.onattach.push((J)=>{let z=J._zod.bag;z.patterns??(z.patterns=new Set),z.patterns.add(v)}),$._zod.check=(J)=>{if(J.value.includes(w.includes,w.position))return;J.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:w.includes,input:J.value,inst:$,continue:!w.abort})}}),GV=B("$ZodCheckStartsWith",($,w)=>{$$.init($,w);let U=new RegExp(`^${n$(w.prefix)}.*`);w.pattern??(w.pattern=U),$._zod.onattach.push((v)=>{let J=v._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(U)}),$._zod.check=(v)=>{if(v.value.startsWith(w.prefix))return;v.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:w.prefix,input:v.value,inst:$,continue:!w.abort})}}),_V=B("$ZodCheckEndsWith",($,w)=>{$$.init($,w);let U=new RegExp(`.*${n$(w.suffix)}$`);w.pattern??(w.pattern=U),$._zod.onattach.push((v)=>{let J=v._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(U)}),$._zod.check=(v)=>{if(v.value.endsWith(w.suffix))return;v.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:w.suffix,input:v.value,inst:$,continue:!w.abort})}});function S3($,w,U){if($.issues.length)w.issues.push(...M$(U,$.issues))}var XV=B("$ZodCheckProperty",($,w)=>{$$.init($,w),$._zod.check=(U)=>{let v=w.schema._zod.run({value:U.value[w.property],issues:[]},{});if(v instanceof Promise)return v.then((J)=>S3(J,U,w.property));S3(v,U,w.property);return}}),IV=B("$ZodCheckMimeType",($,w)=>{$$.init($,w);let U=new Set(w.mime);$._zod.onattach.push((v)=>{v._zod.bag.mime=w.mime}),$._zod.check=(v)=>{if(U.has(v.value.type))return;v.issues.push({code:"invalid_value",values:w.mime,input:v.value.type,inst:$,continue:!w.abort})}}),NV=B("$ZodCheckOverwrite",($,w)=>{$$.init($,w),$._zod.check=(U)=>{U.value=w.tx(U.value)}});class t0{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 U=$.split(`
|
|
192
|
-
`).filter((
|
|
193
|
-
`))}}var WV={major:4,minor:4,patch:3};var d=B("$ZodType",($,w)=>{var U;$??($={}),$._zod.def=w,$._zod.bag=$._zod.bag||{},$._zod.version=WV;let v=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))v.unshift($);for(let J of v)for(let z of J._zod.onattach)z($);if(v.length===0)(U=$._zod).deferred??(U.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let J=(g,V,_)=>{let G=n4(g),X;for(let I of V){if(I._zod.def.when){if(Qg(g))continue;if(!I._zod.def.when(g))continue}else if(G)continue;let N=g.issues.length,W=I._zod.check(g);if(W instanceof Promise&&_?.async===!1)throw new V4;if(X||W instanceof Promise)X=(X??Promise.resolve()).then(async()=>{if(await W,g.issues.length===N)return;if(!G)G=n4(g,N)});else{if(g.issues.length===N)continue;if(!G)G=n4(g,N)}}if(X)return X.then(()=>{return g});return g},z=(g,V,_)=>{if(n4(g))return g.aborted=!0,g;let G=J(V,v,_);if(G instanceof Promise){if(_.async===!1)throw new V4;return G.then((X)=>$._zod.parse(X,_))}return $._zod.parse(G,_)};$._zod.run=(g,V)=>{if(V.skipChecks)return $._zod.parse(g,V);if(V.direction==="backward"){let G=$._zod.parse({value:g.value,issues:[]},{...V,skipChecks:!0});if(G instanceof Promise)return G.then((X)=>{return z(X,g,V)});return z(G,g,V)}let _=$._zod.parse(g,V);if(_ instanceof Promise){if(V.async===!1)throw new V4;return _.then((G)=>J(G,v,V))}return J(_,v,V)}}n($,"~standard",()=>({validate:(J)=>{try{let z=Bg($,J);return z.success?{value:z.data}:{issues:z.error?.issues}}catch(z){return qg($,J).then((g)=>g.success?{value:g.data}:{issues:g.error?.issues})}},vendor:"zod",version:1}))}),i6=B("$ZodString",($,w)=>{d.init($,w),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??yg($._zod.bag),$._zod.parse=(U,v)=>{if(w.coerce)try{U.value=String(U.value)}catch(J){}if(typeof U.value==="string")return U;return U.issues.push({expected:"string",code:"invalid_type",input:U.value,inst:$}),U}}),e=B("$ZodStringFormat",($,w)=>{iw.init($,w),i6.init($,w)}),QV=B("$ZodGUID",($,w)=>{w.pattern??(w.pattern=Zg),e.init($,w)}),PV=B("$ZodUUID",($,w)=>{if(w.version){let v={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[w.version];if(v===void 0)throw Error(`Invalid UUID version: "${w.version}"`);w.pattern??(w.pattern=M6(v))}else w.pattern??(w.pattern=M6());e.init($,w)}),OV=B("$ZodEmail",($,w)=>{w.pattern??(w.pattern=bg),e.init($,w)}),BV=B("$ZodURL",($,w)=>{e.init($,w),$._zod.check=(U)=>{try{let v=U.value.trim();if(!w.normalize&&w.protocol?.source===kg.source){if(!/^https?:\/\//i.test(v)){U.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:U.value,inst:$,continue:!w.abort});return}}let J=new URL(v);if(w.hostname){if(w.hostname.lastIndex=0,!w.hostname.test(J.hostname))U.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:w.hostname.source,input:U.value,inst:$,continue:!w.abort})}if(w.protocol){if(w.protocol.lastIndex=0,!w.protocol.test(J.protocol.endsWith(":")?J.protocol.slice(0,-1):J.protocol))U.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:w.protocol.source,input:U.value,inst:$,continue:!w.abort})}if(w.normalize)U.value=J.href;else U.value=v;return}catch(v){U.issues.push({code:"invalid_format",format:"url",input:U.value,inst:$,continue:!w.abort})}}}),qV=B("$ZodEmoji",($,w)=>{w.pattern??(w.pattern=Fg()),e.init($,w)}),LV=B("$ZodNanoID",($,w)=>{w.pattern??(w.pattern=fg),e.init($,w)}),HV=B("$ZodCUID",($,w)=>{w.pattern??(w.pattern=Lg),e.init($,w)}),uV=B("$ZodCUID2",($,w)=>{w.pattern??(w.pattern=Hg),e.init($,w)}),KV=B("$ZodULID",($,w)=>{w.pattern??(w.pattern=ug),e.init($,w)}),DV=B("$ZodXID",($,w)=>{w.pattern??(w.pattern=Kg),e.init($,w)}),fV=B("$ZodKSUID",($,w)=>{w.pattern??(w.pattern=Dg),e.init($,w)}),TV=B("$ZodISODateTime",($,w)=>{w.pattern??(w.pattern=rg(w)),e.init($,w)}),ZV=B("$ZodISODate",($,w)=>{w.pattern??(w.pattern=jg),e.init($,w)}),bV=B("$ZodISOTime",($,w)=>{w.pattern??(w.pattern=xg(w)),e.init($,w)}),FV=B("$ZodISODuration",($,w)=>{w.pattern??(w.pattern=Tg),e.init($,w)}),MV=B("$ZodIPv4",($,w)=>{w.pattern??(w.pattern=Mg),e.init($,w),$._zod.bag.format="ipv4"}),iV=B("$ZodIPv6",($,w)=>{w.pattern??(w.pattern=ig),e.init($,w),$._zod.bag.format="ipv6",$._zod.check=(U)=>{try{new URL(`http://[${U.value}]`)}catch{U.issues.push({code:"invalid_format",format:"ipv6",input:U.value,inst:$,continue:!w.abort})}}}),EV=B("$ZodMAC",($,w)=>{w.pattern??(w.pattern=Eg(w.delimiter)),e.init($,w),$._zod.bag.format="mac"}),SV=B("$ZodCIDRv4",($,w)=>{w.pattern??(w.pattern=Sg),e.init($,w)}),AV=B("$ZodCIDRv6",($,w)=>{w.pattern??(w.pattern=Ag),e.init($,w),$._zod.check=(U)=>{let v=U.value.split("/");try{if(v.length!==2)throw Error();let[J,z]=v;if(!z)throw Error();let g=Number(z);if(`${g}`!==z)throw Error();if(g<0||g>128)throw Error();new URL(`http://[${J}]`)}catch{U.issues.push({code:"invalid_format",format:"cidrv6",input:U.value,inst:$,continue:!w.abort})}}});function RV($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var kV=B("$ZodBase64",($,w)=>{w.pattern??(w.pattern=Rg),e.init($,w),$._zod.bag.contentEncoding="base64",$._zod.check=(U)=>{if(RV(U.value))return;U.issues.push({code:"invalid_format",format:"base64",input:U.value,inst:$,continue:!w.abort})}});function p3($){if(!h0.test($))return!1;let w=$.replace(/[-_]/g,(v)=>v==="-"?"+":"/"),U=w.padEnd(Math.ceil(w.length/4)*4,"=");return RV(U)}var CV=B("$ZodBase64URL",($,w)=>{w.pattern??(w.pattern=h0),e.init($,w),$._zod.bag.contentEncoding="base64url",$._zod.check=(U)=>{if(p3(U.value))return;U.issues.push({code:"invalid_format",format:"base64url",input:U.value,inst:$,continue:!w.abort})}}),jV=B("$ZodE164",($,w)=>{w.pattern??(w.pattern=Cg),e.init($,w)});function a3($,w=null){try{let U=$.split(".");if(U.length!==3)return!1;let[v]=U;if(!v)return!1;let J=JSON.parse(atob(v));if("typ"in J&&J?.typ!=="JWT")return!1;if(!J.alg)return!1;if(w&&(!("alg"in J)||J.alg!==w))return!1;return!0}catch{return!1}}var xV=B("$ZodJWT",($,w)=>{e.init($,w),$._zod.check=(U)=>{if(a3(U.value,w.alg))return;U.issues.push({code:"invalid_format",format:"jwt",input:U.value,inst:$,continue:!w.abort})}}),rV=B("$ZodCustomStringFormat",($,w)=>{e.init($,w),$._zod.check=(U)=>{if(w.fn(U.value))return;U.issues.push({code:"invalid_format",format:w.format,input:U.value,inst:$,continue:!w.abort})}}),s0=B("$ZodNumber",($,w)=>{d.init($,w),$._zod.pattern=$._zod.bag.pattern??e1,$._zod.parse=(U,v)=>{if(w.coerce)try{U.value=Number(U.value)}catch(g){}let J=U.value;if(typeof J==="number"&&!Number.isNaN(J)&&Number.isFinite(J))return U;let z=typeof J==="number"?Number.isNaN(J)?"NaN":!Number.isFinite(J)?"Infinity":void 0:void 0;return U.issues.push({expected:"number",code:"invalid_type",input:J,inst:$,...z?{received:z}:{}}),U}}),yV=B("$ZodNumberFormat",($,w)=>{pg.init($,w),s0.init($,w)}),wJ=B("$ZodBoolean",($,w)=>{d.init($,w),$._zod.pattern=ng,$._zod.parse=(U,v)=>{if(w.coerce)try{U.value=Boolean(U.value)}catch(z){}let J=U.value;if(typeof J==="boolean")return U;return U.issues.push({expected:"boolean",code:"invalid_type",input:J,inst:$}),U}}),$v=B("$ZodBigInt",($,w)=>{d.init($,w),$._zod.pattern=dg,$._zod.parse=(U,v)=>{if(w.coerce)try{U.value=BigInt(U.value)}catch(J){}if(typeof U.value==="bigint")return U;return U.issues.push({expected:"bigint",code:"invalid_type",input:U.value,inst:$}),U}}),dV=B("$ZodBigIntFormat",($,w)=>{ag.init($,w),$v.init($,w)}),mV=B("$ZodSymbol",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{let J=U.value;if(typeof J==="symbol")return U;return U.issues.push({expected:"symbol",code:"invalid_type",input:J,inst:$}),U}}),nV=B("$ZodUndefined",($,w)=>{d.init($,w),$._zod.pattern=cg,$._zod.values=new Set([void 0]),$._zod.parse=(U,v)=>{let J=U.value;if(typeof J>"u")return U;return U.issues.push({expected:"undefined",code:"invalid_type",input:J,inst:$}),U}}),hV=B("$ZodNull",($,w)=>{d.init($,w),$._zod.pattern=hg,$._zod.values=new Set([null]),$._zod.parse=(U,v)=>{let J=U.value;if(J===null)return U;return U.issues.push({expected:"null",code:"invalid_type",input:J,inst:$}),U}}),cV=B("$ZodAny",($,w)=>{d.init($,w),$._zod.parse=(U)=>U}),lV=B("$ZodUnknown",($,w)=>{d.init($,w),$._zod.parse=(U)=>U}),tV=B("$ZodNever",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{return U.issues.push({expected:"never",code:"invalid_type",input:U.value,inst:$}),U}}),oV=B("$ZodVoid",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{let J=U.value;if(typeof J>"u")return U;return U.issues.push({expected:"void",code:"invalid_type",input:J,inst:$}),U}}),pV=B("$ZodDate",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{if(w.coerce)try{U.value=new Date(U.value)}catch(V){}let J=U.value,z=J instanceof Date;if(z&&!Number.isNaN(J.getTime()))return U;return U.issues.push({expected:"date",code:"invalid_type",input:J,...z?{received:"Invalid Date"}:{},inst:$}),U}});function k3($,w,U){if($.issues.length)w.issues.push(...M$(U,$.issues));w.value[U]=$.value}var aV=B("$ZodArray",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{let J=U.value;if(!Array.isArray(J))return U.issues.push({expected:"array",code:"invalid_type",input:J,inst:$}),U;U.value=Array(J.length);let z=[];for(let g=0;g<J.length;g++){let V=J[g],_=w.element._zod.run({value:V,issues:[]},v);if(_ instanceof Promise)z.push(_.then((G)=>k3(G,U,g)));else k3(_,U,g)}if(z.length)return Promise.all(z).then(()=>U);return U}});function e0($,w,U,v,J,z){let g=U in v;if($.issues.length){if(J&&z&&!g)return;w.issues.push(...M$(U,$.issues))}if(!g&&!J){if(!$.issues.length)w.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[U]});return}if($.value===void 0){if(g)w.value[U]=void 0}else w.value[U]=$.value}function e3($){let w=Object.keys($.shape);for(let v of w)if(!$.shape?.[v]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${v}": expected a Zod schema`);let U=Ng($.shape);return{...$,keys:w,keySet:new Set(w),numKeys:w.length,optionalKeys:new Set(U)}}function s3($,w,U,v,J,z){let g=[],V=J.keySet,_=J.catchall._zod,G=_.def.type,X=_.optin==="optional",I=_.optout==="optional";for(let N in w){if(N==="__proto__")continue;if(V.has(N))continue;if(G==="never"){g.push(N);continue}let W=_.run({value:w[N],issues:[]},v);if(W instanceof Promise)$.push(W.then((P)=>e0(P,U,N,w,X,I)));else e0(W,U,N,w,X,I)}if(g.length)U.issues.push({code:"unrecognized_keys",keys:g,input:w,inst:z});if(!$.length)return U;return Promise.all($).then(()=>{return U})}var $9=B("$ZodObject",($,w)=>{if(d.init($,w),!Object.getOwnPropertyDescriptor(w,"shape")?.get){let V=w.shape;Object.defineProperty(w,"shape",{get:()=>{let _={...V};return Object.defineProperty(w,"shape",{value:_}),_}})}let v=fw(()=>e3(w));n($._zod,"propValues",()=>{let V=w.shape,_={};for(let G in V){let X=V[G]._zod;if(X.values){_[G]??(_[G]=new Set);for(let I of X.values)_[G].add(I)}}return _});let J=F6,z=w.catchall,g;$._zod.parse=(V,_)=>{g??(g=v.value);let G=V.value;if(!J(G))return V.issues.push({expected:"object",code:"invalid_type",input:G,inst:$}),V;V.value={};let X=[],I=g.shape;for(let N of g.keys){let W=I[N],P=W._zod.optin==="optional",Q=W._zod.optout==="optional",H=W._zod.run({value:G[N],issues:[]},_);if(H instanceof Promise)X.push(H.then((Z)=>e0(Z,V,N,G,P,Q)));else e0(H,V,N,G,P,Q)}if(!z)return X.length?Promise.all(X).then(()=>V):V;return s3(X,G,V,_,v.value,$)}}),eV=B("$ZodObjectJIT",($,w)=>{$9.init($,w);let U=$._zod.parse,v=fw(()=>e3(w)),J=(N)=>{let W=new t0(["shape","payload","ctx"]),P=v.value,Q=(b)=>{let M=S0(b);return`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`};W.write("const input = payload.value;");let H=Object.create(null),Z=0;for(let b of P.keys)H[b]=`key_${Z++}`;W.write("const newResult = {};");for(let b of P.keys){let M=H[b],S=S0(b),k=N[b],x=k?._zod?.optin==="optional",A=k?._zod?.optout==="optional";if(W.write(`const ${M} = ${Q(b)};`),x&&A)W.write(`
|
|
194
|
-
if (${
|
|
195
|
-
if (${
|
|
196
|
-
payload.issues = payload.issues.concat(${
|
|
192
|
+
`);this.baseURL=I.baseURL,this.timeout=I.timeout??vX.DEFAULT_TIMEOUT,this.logger=I.logger??console;let g="warn";this.logLevel=g,this.logLevel=ci(I.logLevel,"ClientOptions.logLevel",this)??ci(W4("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??g,this.fetchOptions=I.fetchOptions,this.maxRetries=I.maxRetries??2,this.fetch=I.fetch??a0(),x(this,M1,z2,"f");let Y=w?void 0:W4("OPENAI_CUSTOM_HEADERS");if(Y){let v={};for(let O of Y.split(`
|
|
193
|
+
`)){let P=O.indexOf(":");if(P>=0)v[O.substring(0,P).trim()]=O.substring(P+1).trim()}I.defaultHeaders=M([v,I.defaultHeaders])}if(this._options=I,this._provider=W,N)this._workloadIdentityAuth=new ti(N,this.fetch);this.apiKey=typeof V==="string"?V:null,this.adminAPIKey=U,this.organization=G,this.project=z,this.webhookSecret=i}withOptions($){let w=this._options.provider,J=$.provider??w,V={...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._options.apiKey,adminAPIKey:this.adminAPIKey,workloadIdentity:this._options.workloadIdentity,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret};if(J){if(delete V.apiKey,delete V.adminAPIKey,delete V.workloadIdentity,delete V.baseURL,J!==w)delete V.organization,delete V.project,delete V.defaultHeaders}return new this.constructor({...V,...$,provider:J})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:w},J={bearerAuth:!0,adminAPIKeyAuth:!0}){if($.get("authorization")||$.get("api-key"))return;if(w.has("authorization")||w.has("api-key"))return;if(this._workloadIdentityAuth&&J.bearerAuth)return;throw Error('Could not resolve authentication method. Expected either apiKey or adminAPIKey to be set. Or for one of the "Authorization" or "api-key" headers to be explicitly omitted')}async authHeaders($,w={bearerAuth:!0,adminAPIKeyAuth:!0}){return M([w.bearerAuth?await this.bearerAuth($):null,w.adminAPIKeyAuth?await this.adminAPIKeyAuth($):null])}async bearerAuth($){if(this._workloadIdentityAuth)return M([{Authorization:`Bearer ${await this._workloadIdentityAuth.getToken()}`}]);if(this.apiKey==null)return;return M([{Authorization:`Bearer ${this.apiKey}`}])}async adminAPIKeyAuth($){if(this.adminAPIKey==null)return;return M([{Authorization:`Bearer ${this.adminAPIKey}`}])}stringifyQuery($){return Q2($)}getUserAgent(){return`${this.constructor.name}/JS ${w6}`}defaultIdempotencyKey(){return`stainless-node-retry-${ki()}`}makeStatusError($,w,J,V){return z$.generate($,w,J,V)}async _callApiKey(){if(this._provider)return!1;let $=this._options.apiKey;if(typeof $!=="function")return!1;let w;try{w=await $()}catch(J){if(J instanceof R)throw J;throw new R(`Failed to get token from 'apiKey' function: ${J.message}`,{cause:J})}if(typeof w!=="string"||!w)throw new R(`Expected 'apiKey' function argument to return a string but it returned ${w}`);return this.apiKey=w,!0}buildURL($,w,J){let V=!B(this,YX,"m",Yv).call(this)&&J||this.baseURL,U=pY($)?new URL($):new URL(V+(V.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),G=this.defaultQuery(),z=Object.fromEntries(U.searchParams);if(!bi(G)||!bi(z))w={...z,...G,...w};if(typeof w==="object"&&w&&!Array.isArray(w))U.search=this.stringifyQuery(w);return U.toString()}async prepareOptions($){if(this._provider)return;if(($.__security??{bearerAuth:!0}).bearerAuth)await this._callApiKey()}async prepareRequest($,{url:w,options:J}){}get($,w){return this.methodRequest("get",$,w)}post($,w){return this.methodRequest("post",$,w)}patch($,w){return this.methodRequest("patch",$,w)}put($,w){return this.methodRequest("put",$,w)}delete($,w){return this.methodRequest("delete",$,w)}methodRequest($,w,J){return this.request(Promise.resolve(J).then((V)=>{return{method:$,path:w,...V}}))}request($,w=null){return new x6(this,this.makeRequest($,w,void 0))}async makeRequest($,w,J){let V=await $,U=V.maxRetries??this.maxRetries;if(w==null)w=U;await this.prepareOptions(V);let{req:G,url:z,timeout:i}=await this.buildRequest(V,{retryCount:U-w});await this.prepareRequest(G,{url:z,options:V}),await this._provider?.prepareRequest?.(G,{url:z,options:V});let N="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),X=J===void 0?"":`, retryOf: ${J}`,W=Date.now();if(N$(this).debug(`[${N}] sending request`,j4({retryOfRequestLogID:J,method:V.method,url:z,options:V,headers:G.headers})),V.signal?.aborted)throw new g$;let I=V.__security??{bearerAuth:!0},g=new AbortController,Y=await this.fetchWithAuth(z,G,i,g,I).catch(VU),v=Date.now();if(Y instanceof globalThis.Error){let F=`retrying, ${w} attempts remaining`;if(V.signal?.aborted)throw new g$;let q=UU(Y)||/timed? ?out/i.test(String(Y)+("cause"in Y?String(Y.cause):""));if(w)return N$(this).info(`[${N}] connection ${q?"timed out":"failed"} - ${F}`),N$(this).debug(`[${N}] connection ${q?"timed out":"failed"} (${F})`,j4({retryOfRequestLogID:J,url:z,durationMs:v-W,message:Y.message})),this.retryRequest(V,w,J??N);if(N$(this).info(`[${N}] connection ${q?"timed out":"failed"} - error; no more retries left`),N$(this).debug(`[${N}] connection ${q?"timed out":"failed"} (error; no more retries left)`,j4({retryOfRequestLogID:J,url:z,durationMs:v-W,message:Y.message})),Y instanceof Tw||Y instanceof o0)throw Y;if(q)throw new j6;throw new C6({message:Vq(Y),cause:Y})}let O=[...Y.headers.entries()].filter(([F])=>F==="x-request-id").map(([F,q])=>", "+F+": "+JSON.stringify(q)).join(""),P=`[${N}${X}${O}] ${G.method} ${z} ${Y.ok?"succeeded":"failed"} with status ${Y.status} in ${v-W}ms`;if(!Y.ok){if(Y.status===401&&this._workloadIdentityAuth&&I.bearerAuth&&!V.__metadata?.hasStreamingBody&&!V.__metadata?.workloadIdentityTokenRefreshed)return await ji(Y.body),this._workloadIdentityAuth.invalidateToken(),this.makeRequest({...V,__metadata:{...V.__metadata,workloadIdentityTokenRefreshed:!0}},w,J??N);let F=await this.shouldRetry(Y);if(w&&F){let C=`retrying, ${w} attempts remaining`;return await ji(Y.body),N$(this).info(`${P} - ${C}`),N$(this).debug(`[${N}] response error (${C})`,j4({retryOfRequestLogID:J,url:Y.url,status:Y.status,headers:Y.headers,durationMs:v-W})),this.retryRequest(V,w,J??N,Y.headers)}let q=F?"error; no more retries left":"error; not retryable";N$(this).info(`${P} - ${q}`);let T=await Y.text().catch((C)=>VU(C).message),L=sY(T),k=L?void 0:T;throw N$(this).debug(`[${N}] response error (${q})`,j4({retryOfRequestLogID:J,url:Y.url,status:Y.status,headers:Y.headers,message:k,durationMs:Date.now()-W})),this.makeStatusError(Y.status,L,k,Y.headers)}return N$(this).info(P),N$(this).debug(`[${N}] response start`,j4({retryOfRequestLogID:J,url:Y.url,status:Y.status,headers:Y.headers,durationMs:v-W})),{response:Y,options:V,controller:g,requestLogID:N,retryOfRequestLogID:J,startTime:W}}getAPIList($,w,J){return this.requestAPIList(w,J&&"then"in J?J.then((V)=>({method:"get",path:$,...V})):{method:"get",path:$,...J})}requestAPIList($,w){let J=this.makeRequest(w,null,void 0);return new VV(this,J,$)}async fetchWithAuth($,w,J,V,U={bearerAuth:!0,adminAPIKeyAuth:!0}){if(this._workloadIdentityAuth&&U.bearerAuth){let z=w.headers,i=z.get("Authorization");if(!i||i===`Bearer ${Uq}`){let N=await this._workloadIdentityAuth.getToken();z.set("Authorization",`Bearer ${N}`)}}return await this.fetchWithTimeout($,w,J,V)}async fetchWithTimeout($,w,J,V){let{signal:U,method:G,...z}=w||{},i=this._makeAbort(V);if(U)U.addEventListener("abort",i,{once:!0});let N=setTimeout(i,J),X=globalThis.ReadableStream&&z.body instanceof globalThis.ReadableStream||typeof z.body==="object"&&z.body!==null&&Symbol.asyncIterator in z.body,W={signal:V.signal,...X?{duplex:"half"}:{},method:"GET",...z};if(G)W.method=G.toUpperCase();try{return await this.fetch.call(void 0,$,W)}finally{clearTimeout(N)}}async shouldRetry($){let w=$.headers.get("x-should-retry");if(w==="true")return!0;if(w==="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($,w,J,V){let U,G=V?.get("retry-after-ms");if(G){let i=parseFloat(G);if(!Number.isNaN(i))U=i}let z=V?.get("retry-after");if(z&&!U){let i=parseFloat(z);if(!Number.isNaN(i))U=i*1000;else U=Date.parse(z)-Date.now()}if(U===void 0){let i=$.maxRetries??this.maxRetries;U=this.calculateDefaultRetryTimeoutMillis(w,i)}return await u4(U),this.makeRequest($,w-1,J)}calculateDefaultRetryTimeoutMillis($,w){let U=w-$,G=Math.min(0.5*Math.pow(2,U),8),z=1-Math.random()*0.25;return G*z*1000}async buildRequest($,{retryCount:w=0}={}){let J={...$},{method:V,path:U,query:G,defaultBaseURL:z}=J,i=this.buildURL(U,G,z);if("timeout"in J)eY("timeout",J.timeout);J.timeout=J.timeout??this.timeout;let{bodyHeaders:N,body:X,isStreamingBody:W}=this.buildBody({options:J});if(W)$.__metadata={...$.__metadata,hasStreamingBody:!0};let I=await this.buildHeaders({options:$,method:V,bodyHeaders:N,retryCount:w});return{req:{method:V,headers:I,...J.signal&&{signal:J.signal},...globalThis.ReadableStream&&X instanceof globalThis.ReadableStream&&{duplex:"half"},...X&&{body:X},...this.fetchOptions??{},...J.fetchOptions??{}},url:i,timeout:J.timeout}}async buildHeaders({options:$,method:w,bodyHeaders:J,retryCount:V}){let U={};if(this.idempotencyHeader&&w!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();U[this.idempotencyHeader]=$.idempotencyKey}let G=M([U,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(V),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...V2(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},this._provider?void 0:await this.authHeaders($,$.__security??{bearerAuth:!0}),this._options.defaultHeaders,J,$.headers]);if(!this._provider)this.validateHeaders(G,$.__security??{bearerAuth:!0});return G.values}_makeAbort($){return()=>$.abort()}buildBody({options:$}){let{body:w,headers:J}=$;if(!w){if(w===void 0&&"body"in $)return{...B(this,M1,"f").call(this,{body:w,headers:M([J])}),isStreamingBody:!1};return{bodyHeaders:void 0,body:void 0,isStreamingBody:!1}}let V=M([J]),U=typeof globalThis.ReadableStream<"u"&&w instanceof globalThis.ReadableStream,G=!U&&(typeof w==="string"||w instanceof ArrayBuffer||ArrayBuffer.isView(w)||typeof globalThis.Blob<"u"&&w instanceof globalThis.Blob||w instanceof URLSearchParams||w instanceof FormData);if(ArrayBuffer.isView(w)||w instanceof ArrayBuffer||w instanceof DataView||typeof w==="string"&&V.values.has("content-type")||globalThis.Blob&&w instanceof globalThis.Blob||w instanceof FormData||w instanceof URLSearchParams||U)return{bodyHeaders:void 0,body:w,isStreamingBody:!G};else if(typeof w==="object"&&((Symbol.asyncIterator in w)||(Symbol.iterator in w)&&("next"in w)&&typeof w.next==="function"))return{bodyHeaders:void 0,body:e0(w),isStreamingBody:!0};else if(typeof w==="object"&&V.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(w),isStreamingBody:!1};else return{...B(this,M1,"f").call(this,{body:w,headers:V}),isStreamingBody:!1}}}vX=r,M1=new WeakMap,YX=new WeakSet,Yv=function(){return this._provider!==void 0||this.baseURL!=="https://api.openai.com/v1"};r.OpenAI=vX;r.DEFAULT_TIMEOUT=600000;r.OpenAIError=R;r.APIError=z$;r.APIConnectionError=C6;r.APIConnectionTimeoutError=j6;r.APIUserAbortError=g$;r.NotFoundError=XU;r.ConflictError=NU;r.RateLimitError=IU;r.BadRequestError=GU;r.AuthenticationError=zU;r.InternalServerError=gU;r.PermissionDeniedError=iU;r.UnprocessableEntityError=WU;r.InvalidWebhookSignatureError=C4;r.toFile=Mw;r.Completions=nw;r.Chat=d6;r.Embeddings=mw;r.Files=hw;r.Images=ow;r.Audio=n4;r.Moderations=aw;r.Models=pw;r.FineTuning=q4;r.Graders=$w;r.VectorStores=N6;r.Webhooks=wJ;r.Beta=F4;r.Batches=jw;r.Uploads=Jw;r.Admin=y6;r.Responses=d4;r.Realtime=i6;r.Conversations=e6;r.Evals=s6;r.Containers=a6;r.Skills=X6;r.Videos=sw;function Vq($){if(Gq($))return"Connection error. This may be caused by passing an undici dispatcher, such as ProxyAgent, that is incompatible with the fetch implementation. If you are using undici's ProxyAgent, pass the fetch implementation from the same undici package: import { fetch, ProxyAgent } from 'undici'; new OpenAI({ fetch, fetchOptions: { dispatcher: new ProxyAgent(...) } });";return}function Gq($){let w=$;for(let J=0;J<8&&w&&typeof w==="object";J++){let V=w;if(V.code==="UND_ERR_INVALID_ARG"&&typeof V.message==="string"&&V.message.includes("invalid onRequestStart method"))return!0;w=V.cause}return!1}async function OX($){if($.source==="-"){let J=[];for await(let U of process.stdin)J.push(typeof U==="string"?Buffer.from(U):U);let V=Buffer.concat(J);return{...$,data:V,fileName:$.name??`stdin${Oq($.mime)}`}}if(Qq($.source)){let J=await fetch($.source);if(!J.ok)throw Error(`Failed to fetch asset ${$.source}: ${J.status} ${J.statusText}`);let V=new Uint8Array(await J.arrayBuffer()),U=new URL($.source),G=($.name??vv(U.pathname))||"asset";return{...$,mime:$.mime??J.headers.get("content-type")??void 0,data:V,fileName:G}}if(!Ov($.source))throw Error(`Asset not found: ${$.source}`);let w=await Xq($.source);return{...$,mime:$.mime??W6($.source),data:w,fileName:$.name??vv($.source)}}async function g4($){let w=await OX($);return Mw(w.data,w.fileName,{type:w.mime??W6(w.fileName)})}function PX($,w){let J=[],V=$===void 0?[]:Array.isArray($)?$:[$];for(let U of V)J.push({role:"image",source:U,mime:W6(U)});if(w)J.push({role:"mask",source:w,mime:W6(w)});return J}async function TV($){let w=gq($.format);return A1({...$,format:w})}async function A1($){let w=Yq($);await iq(Nq(w),{recursive:!0});let J=typeof $.data==="string"?Buffer.from($.data,"base64"):Buffer.from($.data);return await Pv(w,J),w}async function Kv($){let w=await fetch($.url);if(!w.ok)throw Error(`Failed to download generated asset: ${w.status} ${w.statusText}`);let J=new Uint8Array(await w.arrayBuffer());return TV({...$,data:J})}async function JJ($){if(!$.response.ok)throw Error(`Failed to download generated asset: ${$.response.status} ${$.response.statusText}`);let w=new Uint8Array(await $.response.arrayBuffer());return A1({...$,data:w})}async function S1($){return A1({...$,data:Buffer.from($.text)})}async function $4($,w,J){for(let V of $.outputs){let U=`${V}.json`,G={...$,operation:J,prompt:w.prompt,params:w.params??{},output:V,createdAt:new Date().toISOString()};await Pv(U,`${JSON.stringify(G,null,2)}
|
|
194
|
+
`)}}function W6($){switch(Wq($).toLowerCase()){case".png":return"image/png";case".jpg":case".jpeg":return"image/jpeg";case".webp":return"image/webp";case".gif":return"image/gif";case".mp3":return"audio/mpeg";case".mpeg":case".mpga":return"audio/mpeg";case".m4a":return"audio/mp4";case".wav":return"audio/wav";case".flac":return"audio/flac";case".ogg":return"audio/ogg";case".opus":return"audio/opus";case".aac":return"audio/aac";case".webm":return"audio/webm";case".mp4":return"video/mp4";case".mov":return"video/quicktime";default:return}}function gq($){if(!$)return"png";return $.replace(/^\./,"").toLowerCase()}function Yq($){let w=$.output;if(!w)return QX(process.cwd(),`${$.defaultName}${Qv($.index,$.total)}.${$.format}`);if(w.endsWith("/")||Ov(w)&&vq(w))return QX(w,`${$.defaultName}${Qv($.index,$.total)}.${$.format}`);if($.total<=1)return w;let J=Iq(w);return QX(J.dir,`${J.name}-${$.index+1}${J.ext||`.${$.format}`}`)}function Qv($,w){return w<=1?"":`-${$+1}`}function vq($){try{return zq($).isDirectory()}catch{return!1}}function Qq($){return $.startsWith("http://")||$.startsWith("https://")}function Oq($){if(!$)return"";switch($){case"image/png":return".png";case"image/jpeg":return".jpg";case"image/webp":return".webp";case"video/mp4":return".mp4";case"video/quicktime":return".mov";case"audio/mpeg":return".mp3";case"audio/mp4":return".m4a";case"audio/wav":return".wav";case"audio/flac":return".flac";case"audio/ogg":return".ogg";case"audio/opus":return".opus";case"audio/aac":return".aac";case"audio/webm":return".webm";default:return""}}import{chmodSync as NS,existsSync as WS,mkdirSync as IS,readFileSync as gS,writeFileSync as YS}from"node:fs";import{dirname as vS,join as QS}from"node:path";var j={};R4(j,{xor:()=>p5,xid:()=>u5,void:()=>y5,uuidv7:()=>I5,uuidv6:()=>W5,uuidv4:()=>N5,uuid:()=>X5,util:()=>A,url:()=>g5,uppercase:()=>vJ,unknown:()=>Iw,union:()=>sG,undefined:()=>d5,ulid:()=>K5,uint64:()=>r5,uint32:()=>C5,tuple:()=>xI,trim:()=>BJ,treeifyError:()=>AX,transform:()=>wz,toUpperCase:()=>FJ,toLowerCase:()=>HJ,toJSONSchema:()=>DG,templateLiteral:()=>WQ,symbol:()=>n5,superRefine:()=>Y9,success:()=>zQ,stringbool:()=>KQ,stringFormat:()=>A5,string:()=>w0,strictObject:()=>t5,startsWith:()=>OJ,slugify:()=>qJ,size:()=>Xw,setErrorMap:()=>pT,set:()=>wQ,safeParseAsync:()=>YI,safeParse:()=>gI,safeEncodeAsync:()=>BI,safeEncode:()=>KI,safeDecodeAsync:()=>HI,safeDecode:()=>uI,registry:()=>aV,regexes:()=>p$,regex:()=>gJ,refine:()=>g9,record:()=>rI,readonly:()=>z9,property:()=>FG,promise:()=>IQ,prettifyError:()=>SX,preprocess:()=>BQ,prefault:()=>eI,positive:()=>KG,pipe:()=>kG,partialRecord:()=>e5,parseAsync:()=>II,parse:()=>WI,overwrite:()=>Y4,optional:()=>U0,object:()=>l5,number:()=>qI,nullish:()=>GQ,nullable:()=>V0,null:()=>fI,normalize:()=>uJ,nonpositive:()=>BG,nonoptional:()=>sI,nonnegative:()=>HG,never:()=>eG,negative:()=>uG,nativeEnum:()=>JQ,nanoid:()=>Q5,nan:()=>iQ,multipleOf:()=>Q6,minSize:()=>L4,minLength:()=>y4,mime:()=>KJ,meta:()=>OQ,maxSize:()=>O6,maxLength:()=>Nw,map:()=>$Q,mac:()=>F5,lte:()=>a$,lt:()=>T4,lowercase:()=>YJ,looseRecord:()=>s5,looseObject:()=>o5,locales:()=>a1,literal:()=>UQ,length:()=>Ww,lazy:()=>N9,ksuid:()=>B5,keyof:()=>c5,jwt:()=>M5,json:()=>uQ,iso:()=>DJ,ipv6:()=>q5,ipv4:()=>H5,invertCodec:()=>NQ,intersection:()=>CI,int64:()=>x5,int32:()=>E5,int:()=>_G,instanceof:()=>PQ,includes:()=>QJ,httpUrl:()=>Y5,hostname:()=>S5,hex:()=>_5,hash:()=>k5,guid:()=>i5,gte:()=>j$,gt:()=>D4,globalRegistry:()=>q$,getErrorMap:()=>aT,function:()=>gQ,fromJSONSchema:()=>FQ,formatError:()=>r1,float64:()=>b5,float32:()=>R5,flattenError:()=>x1,file:()=>VQ,exactOptional:()=>lI,enum:()=>$z,endsWith:()=>PJ,encodeAsync:()=>OI,encode:()=>vI,emoji:()=>v5,email:()=>z5,e164:()=>f5,discriminatedUnion:()=>a5,describe:()=>QQ,decodeAsync:()=>PI,decode:()=>QI,date:()=>h5,custom:()=>vQ,cuid2:()=>P5,cuid:()=>O5,core:()=>h4,config:()=>X$,coerce:()=>Q9,codec:()=>XQ,clone:()=>E$,cidrv6:()=>T5,cidrv4:()=>Z5,check:()=>YQ,catch:()=>J9,boolean:()=>ZI,bigint:()=>j5,base64url:()=>L5,base64:()=>D5,array:()=>X0,any:()=>m5,_function:()=>gQ,_default:()=>pI,_ZodString:()=>RG,ZodXor:()=>RI,ZodXID:()=>nG,ZodVoid:()=>_I,ZodUnknown:()=>AI,ZodUnion:()=>W0,ZodUndefined:()=>DI,ZodUUID:()=>f4,ZodURL:()=>z0,ZodULID:()=>rG,ZodType:()=>h,ZodTuple:()=>jI,ZodTransform:()=>hI,ZodTemplateLiteral:()=>i9,ZodSymbol:()=>TI,ZodSuccess:()=>$9,ZodStringFormat:()=>$$,ZodString:()=>MJ,ZodSet:()=>dI,ZodRecord:()=>LJ,ZodRealError:()=>m$,ZodReadonly:()=>G9,ZodPromise:()=>W9,ZodPreprocess:()=>V9,ZodPrefault:()=>aI,ZodPipe:()=>I0,ZodOptional:()=>Jz,ZodObject:()=>N0,ZodNumberFormat:()=>gw,ZodNumber:()=>SJ,ZodNullable:()=>tI,ZodNull:()=>LI,ZodNonOptional:()=>Uz,ZodNever:()=>SI,ZodNanoID:()=>CG,ZodNaN:()=>U9,ZodMap:()=>nI,ZodMAC:()=>FI,ZodLiteral:()=>mI,ZodLazy:()=>X9,ZodKSUID:()=>dG,ZodJWT:()=>pG,ZodIssueCode:()=>oT,ZodIntersection:()=>EI,ZodISOTime:()=>AG,ZodISODuration:()=>SG,ZodISODateTime:()=>fG,ZodISODate:()=>MG,ZodIPv6:()=>yG,ZodIPv4:()=>mG,ZodGUID:()=>J0,ZodFunction:()=>I9,ZodFirstPartyTypeKind:()=>v9,ZodFile:()=>yI,ZodExactOptional:()=>cI,ZodError:()=>lT,ZodEnum:()=>fJ,ZodEmoji:()=>EG,ZodEmail:()=>bG,ZodE164:()=>oG,ZodDiscriminatedUnion:()=>bI,ZodDefault:()=>oI,ZodDate:()=>i0,ZodCustomStringFormat:()=>AJ,ZodCustom:()=>Y0,ZodCodec:()=>g0,ZodCatch:()=>w9,ZodCUID2:()=>xG,ZodCUID:()=>jG,ZodCIDRv6:()=>cG,ZodCIDRv4:()=>hG,ZodBoolean:()=>_J,ZodBigIntFormat:()=>aG,ZodBigInt:()=>kJ,ZodBase64URL:()=>tG,ZodBase64:()=>lG,ZodArray:()=>kI,ZodAny:()=>MI,TimePrecision:()=>xW,NEVER:()=>KX,$output:()=>kW,$input:()=>RW,$brand:()=>uX});var h4={};R4(h4,{version:()=>LN,util:()=>A,treeifyError:()=>AX,toJSONSchema:()=>DG,toDotPath:()=>Tv,safeParseAsync:()=>kX,safeParse:()=>_X,safeEncodeAsync:()=>oq,safeEncode:()=>lq,safeDecodeAsync:()=>pq,safeDecode:()=>tq,registry:()=>aV,regexes:()=>p$,process:()=>e,prettifyError:()=>SX,parseAsync:()=>MV,parse:()=>fV,meta:()=>u3,locales:()=>a1,isValidJWT:()=>lv,isValidBase64URL:()=>cv,isValidBase64:()=>oN,initializeContext:()=>P6,globalRegistry:()=>q$,globalConfig:()=>Uw,formatError:()=>r1,flattenError:()=>x1,finalize:()=>u6,extractDefs:()=>K6,encodeAsync:()=>hq,encode:()=>mq,describe:()=>K3,decodeAsync:()=>cq,decode:()=>yq,createToJSONSchemaMethod:()=>H3,createStandardJSONSchemaMethod:()=>TJ,config:()=>X$,clone:()=>E$,_xor:()=>qT,_xid:()=>XG,_void:()=>N3,_uuidv7:()=>JG,_uuidv6:()=>wG,_uuidv4:()=>$G,_uuid:()=>sV,_url:()=>s1,_uppercase:()=>vJ,_unknown:()=>i3,_union:()=>FT,_undefined:()=>V3,_ulid:()=>iG,_uint64:()=>J3,_uint32:()=>pW,_tuple:()=>DT,_trim:()=>BJ,_transform:()=>kT,_toUpperCase:()=>FJ,_toLowerCase:()=>HJ,_templateLiteral:()=>dT,_symbol:()=>U3,_superRefine:()=>P3,_success:()=>jT,_stringbool:()=>B3,_stringFormat:()=>ZJ,_string:()=>EW,_startsWith:()=>OJ,_slugify:()=>qJ,_size:()=>Xw,_set:()=>MT,_safeParseAsync:()=>NJ,_safeParse:()=>XJ,_safeEncodeAsync:()=>EV,_safeEncode:()=>RV,_safeDecodeAsync:()=>CV,_safeDecode:()=>bV,_regex:()=>gJ,_refine:()=>O3,_record:()=>LT,_readonly:()=>nT,_property:()=>FG,_promise:()=>yT,_positive:()=>KG,_pipe:()=>rT,_parseAsync:()=>iJ,_parse:()=>zJ,_overwrite:()=>Y4,_optional:()=>RT,_number:()=>yW,_nullable:()=>bT,_null:()=>G3,_normalize:()=>uJ,_nonpositive:()=>BG,_nonoptional:()=>CT,_nonnegative:()=>HG,_never:()=>X3,_negative:()=>uG,_nativeEnum:()=>ST,_nanoid:()=>VG,_nan:()=>g3,_multipleOf:()=>Q6,_minSize:()=>L4,_minLength:()=>y4,_min:()=>j$,_mime:()=>KJ,_maxSize:()=>O6,_maxLength:()=>Nw,_max:()=>a$,_map:()=>fT,_mac:()=>jW,_lte:()=>a$,_lt:()=>T4,_lowercase:()=>YJ,_literal:()=>_T,_length:()=>Ww,_lazy:()=>mT,_ksuid:()=>NG,_jwt:()=>PG,_isoTime:()=>dW,_isoDuration:()=>mW,_isoDateTime:()=>rW,_isoDate:()=>nW,_ipv6:()=>IG,_ipv4:()=>WG,_intersection:()=>TT,_int64:()=>w3,_int32:()=>oW,_int:()=>cW,_includes:()=>QJ,_guid:()=>e1,_gte:()=>j$,_gt:()=>D4,_float64:()=>tW,_float32:()=>lW,_file:()=>v3,_enum:()=>AT,_endsWith:()=>PJ,_encodeAsync:()=>_V,_encode:()=>AV,_emoji:()=>UG,_email:()=>eV,_e164:()=>OG,_discriminatedUnion:()=>ZT,_default:()=>ET,_decodeAsync:()=>kV,_decode:()=>SV,_date:()=>W3,_custom:()=>Q3,_cuid2:()=>zG,_cuid:()=>GG,_coercedString:()=>CW,_coercedNumber:()=>hW,_coercedDate:()=>I3,_coercedBoolean:()=>eW,_coercedBigint:()=>$3,_cidrv6:()=>YG,_cidrv4:()=>gG,_check:()=>J5,_catch:()=>xT,_boolean:()=>aW,_bigint:()=>sW,_base64url:()=>QG,_base64:()=>vG,_array:()=>Y3,_any:()=>z3,TimePrecision:()=>xW,NEVER:()=>KX,JSONSchemaGenerator:()=>GI,JSONSchema:()=>U5,Doc:()=>nV,$output:()=>kW,$input:()=>RW,$constructor:()=>u,$brand:()=>uX,$ZodXor:()=>Y8,$ZodXID:()=>jN,$ZodVoid:()=>N8,$ZodUnknown:()=>i8,$ZodUnion:()=>h1,$ZodUndefined:()=>V8,$ZodUUID:()=>AN,$ZodURL:()=>_N,$ZodULID:()=>CN,$ZodType:()=>m,$ZodTuple:()=>tV,$ZodTransform:()=>F8,$ZodTemplateLiteral:()=>k8,$ZodSymbol:()=>U8,$ZodSuccess:()=>f8,$ZodStringFormat:()=>s,$ZodString:()=>iw,$ZodSet:()=>K8,$ZodRegistry:()=>bW,$ZodRecord:()=>O8,$ZodRealError:()=>d$,$ZodReadonly:()=>_8,$ZodPromise:()=>b8,$ZodPreprocess:()=>S8,$ZodPrefault:()=>D8,$ZodPipe:()=>pV,$ZodOptional:()=>oV,$ZodObjectJIT:()=>g8,$ZodObject:()=>pv,$ZodNumberFormat:()=>w8,$ZodNumber:()=>cV,$ZodNullable:()=>Z8,$ZodNull:()=>G8,$ZodNonOptional:()=>L8,$ZodNever:()=>X8,$ZodNanoID:()=>RN,$ZodNaN:()=>A8,$ZodMap:()=>P8,$ZodMAC:()=>cN,$ZodLiteral:()=>B8,$ZodLazy:()=>E8,$ZodKSUID:()=>xN,$ZodJWT:()=>sN,$ZodIntersection:()=>Q8,$ZodISOTime:()=>dN,$ZodISODuration:()=>mN,$ZodISODateTime:()=>rN,$ZodISODate:()=>nN,$ZodIPv6:()=>hN,$ZodIPv4:()=>yN,$ZodGUID:()=>MN,$ZodFunction:()=>R8,$ZodFile:()=>H8,$ZodExactOptional:()=>q8,$ZodError:()=>j1,$ZodEnum:()=>u8,$ZodEncodeError:()=>Vw,$ZodEmoji:()=>kN,$ZodEmail:()=>SN,$ZodE164:()=>eN,$ZodDiscriminatedUnion:()=>v8,$ZodDefault:()=>T8,$ZodDate:()=>W8,$ZodCustomStringFormat:()=>$8,$ZodCustom:()=>C8,$ZodCodec:()=>c1,$ZodCheckUpperCase:()=>BN,$ZodCheckStringFormat:()=>WJ,$ZodCheckStartsWith:()=>FN,$ZodCheckSizeEquals:()=>vN,$ZodCheckRegex:()=>KN,$ZodCheckProperty:()=>ZN,$ZodCheckOverwrite:()=>DN,$ZodCheckNumberFormat:()=>WN,$ZodCheckMultipleOf:()=>NN,$ZodCheckMinSize:()=>YN,$ZodCheckMinLength:()=>ON,$ZodCheckMimeType:()=>TN,$ZodCheckMaxSize:()=>gN,$ZodCheckMaxLength:()=>QN,$ZodCheckLowerCase:()=>uN,$ZodCheckLessThan:()=>xV,$ZodCheckLengthEquals:()=>PN,$ZodCheckIncludes:()=>HN,$ZodCheckGreaterThan:()=>rV,$ZodCheckEndsWith:()=>qN,$ZodCheckBigIntFormat:()=>IN,$ZodCheck:()=>J$,$ZodCatch:()=>M8,$ZodCUID2:()=>EN,$ZodCUID:()=>bN,$ZodCIDRv6:()=>tN,$ZodCIDRv4:()=>lN,$ZodBoolean:()=>y1,$ZodBigIntFormat:()=>J8,$ZodBigInt:()=>lV,$ZodBase64URL:()=>aN,$ZodBase64:()=>pN,$ZodAsyncError:()=>Z4,$ZodArray:()=>I8,$ZodAny:()=>z8});var uv,KX=Object.freeze({status:"aborted"});function u($,w,J){function V(i,N){if(!i._zod)Object.defineProperty(i,"_zod",{value:{def:N,constr:z,traits:new Set},enumerable:!1});if(i._zod.traits.has($))return;i._zod.traits.add($),w(i,N);let X=z.prototype,W=Object.keys(X);for(let I=0;I<W.length;I++){let g=W[I];if(!(g in i))i[g]=X[g].bind(i)}}let U=J?.Parent??Object;class G extends U{}Object.defineProperty(G,"name",{value:$});function z(i){var N;let X=J?.Parent?new G:this;V(X,i),(N=X._zod).deferred??(N.deferred=[]);for(let W of X._zod.deferred)W();return X}return Object.defineProperty(z,"init",{value:V}),Object.defineProperty(z,Symbol.hasInstance,{value:(i)=>{if(J?.Parent&&i instanceof J.Parent)return!0;return i?._zod?.traits?.has($)}}),Object.defineProperty(z,"name",{value:$}),z}var uX=Symbol("zod_brand");class Z4 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Vw extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}}(uv=globalThis).__zod_globalConfig??(uv.__zod_globalConfig={});var Uw=globalThis.__zod_globalConfig;function X$($){if($)Object.assign(Uw,$);return Uw}var A={};R4(A,{unwrapMessage:()=>_1,uint8ArrayToHex:()=>nq,uint8ArrayToBase64url:()=>xq,uint8ArrayToBase64:()=>Fv,stringifyPrimitive:()=>D,slugify:()=>FX,shallowClone:()=>ZX,safeExtend:()=>kq,required:()=>Eq,randomString:()=>Dq,propertyKeyTypes:()=>b1,promiseAllObject:()=>Tq,primitiveTypes:()=>TX,prefixIssues:()=>n$,pick:()=>Aq,partial:()=>bq,parsedType:()=>f,optionalKeys:()=>DX,omit:()=>Sq,objectClone:()=>Fq,numKeys:()=>Lq,nullish:()=>I6,normalizeParams:()=>S,mergeDefs:()=>m4,merge:()=>Rq,jsonStringifyReplacer:()=>UJ,joinValues:()=>H,issue:()=>GJ,isPlainObject:()=>Y6,isObject:()=>Gw,hexToUint8Array:()=>rq,getSizableOrigin:()=>E1,getParsedType:()=>fq,getLengthableOrigin:()=>C1,getEnumValues:()=>k1,getElementAtPath:()=>Zq,floatSafeRemainder:()=>HX,finalizeIssue:()=>C$,extend:()=>_q,explicitlyAborted:()=>MX,escapeRegex:()=>w4,esc:()=>DV,defineLazy:()=>c,createTransparentProxy:()=>Mq,cloneDef:()=>qq,clone:()=>E$,cleanRegex:()=>R1,cleanEnum:()=>Cq,captureStackTrace:()=>LV,cached:()=>VJ,base64urlToUint8Array:()=>jq,base64ToUint8Array:()=>Hv,assignProp:()=>g6,assertNotEqual:()=>Kq,assertNever:()=>Bq,assertIs:()=>uq,assertEqual:()=>Pq,assert:()=>Hq,allowsEval:()=>qX,aborted:()=>v6,NUMBER_FORMAT_RANGES:()=>LX,Class:()=>qv,BIGINT_FORMAT_RANGES:()=>fX});function Pq($){return $}function Kq($){return $}function uq($){}function Bq($){throw Error("Unexpected value in exhaustive check")}function Hq($){}function k1($){let w=Object.values($).filter((V)=>typeof V==="number");return Object.entries($).filter(([V,U])=>w.indexOf(+V)===-1).map(([V,U])=>U)}function H($,w="|"){return $.map((J)=>D(J)).join(w)}function UJ($,w){if(typeof w==="bigint")return w.toString();return w}function VJ($){return{get value(){{let J=$();return Object.defineProperty(this,"value",{value:J}),J}throw Error("cached value already set")}}}function I6($){return $===null||$===void 0}function R1($){let w=$.startsWith("^")?1:0,J=$.endsWith("$")?$.length-1:$.length;return $.slice(w,J)}function HX($,w){let J=$/w,V=Math.round(J),U=Number.EPSILON*Math.max(Math.abs(J),1);if(Math.abs(J-V)<U)return 0;return J-V}var Bv=Symbol("evaluating");function c($,w,J){let V=void 0;Object.defineProperty($,w,{get(){if(V===Bv)return;if(V===void 0)V=Bv,V=J();return V},set(U){Object.defineProperty($,w,{value:U})},configurable:!0})}function Fq($){return Object.create(Object.getPrototypeOf($),Object.getOwnPropertyDescriptors($))}function g6($,w,J){Object.defineProperty($,w,{value:J,writable:!0,enumerable:!0,configurable:!0})}function m4(...$){let w={};for(let J of $){let V=Object.getOwnPropertyDescriptors(J);Object.assign(w,V)}return Object.defineProperties({},w)}function qq($){return m4($._zod.def)}function Zq($,w){if(!w)return $;return w.reduce((J,V)=>J?.[V],$)}function Tq($){let w=Object.keys($),J=w.map((V)=>$[V]);return Promise.all(J).then((V)=>{let U={};for(let G=0;G<w.length;G++)U[w[G]]=V[G];return U})}function Dq($=10){let J="";for(let V=0;V<$;V++)J+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return J}function DV($){return JSON.stringify($)}function FX($){return $.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var LV="captureStackTrace"in Error?Error.captureStackTrace:(...$)=>{};function Gw($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var qX=VJ(()=>{if(Uw.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function Y6($){if(Gw($)===!1)return!1;let w=$.constructor;if(w===void 0)return!0;if(typeof w!=="function")return!0;let J=w.prototype;if(Gw(J)===!1)return!1;if(Object.prototype.hasOwnProperty.call(J,"isPrototypeOf")===!1)return!1;return!0}function ZX($){if(Y6($))return{...$};if(Array.isArray($))return[...$];if($ instanceof Map)return new Map($);if($ instanceof Set)return new Set($);return $}function Lq($){let w=0;for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))w++;return w}var fq=($)=>{let w=typeof $;switch(w){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<"u"&&$ instanceof Map)return"map";if(typeof Set<"u"&&$ instanceof Set)return"set";if(typeof Date<"u"&&$ instanceof Date)return"date";if(typeof File<"u"&&$ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${w}`)}},b1=new Set(["string","number","symbol"]),TX=new Set(["string","number","bigint","boolean","symbol","undefined"]);function w4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function E$($,w,J){let V=new $._zod.constr(w??$._zod.def);if(!w||J?.parent)V._zod.parent=$;return V}function S($){let w=$;if(!w)return{};if(typeof w==="string")return{error:()=>w};if(w?.message!==void 0){if(w?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");w.error=w.message}if(delete w.message,typeof w.error==="string")return{...w,error:()=>w.error};return w}function Mq($){let w;return new Proxy({},{get(J,V,U){return w??(w=$()),Reflect.get(w,V,U)},set(J,V,U,G){return w??(w=$()),Reflect.set(w,V,U,G)},has(J,V){return w??(w=$()),Reflect.has(w,V)},deleteProperty(J,V){return w??(w=$()),Reflect.deleteProperty(w,V)},ownKeys(J){return w??(w=$()),Reflect.ownKeys(w)},getOwnPropertyDescriptor(J,V){return w??(w=$()),Reflect.getOwnPropertyDescriptor(w,V)},defineProperty(J,V,U){return w??(w=$()),Reflect.defineProperty(w,V,U)}})}function D($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function DX($){return Object.keys($).filter((w)=>{return $[w]._zod.optin==="optional"&&$[w]._zod.optout==="optional"})}var LX={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]},fX={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Aq($,w){let J=$._zod.def,V=J.checks;if(V&&V.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let G=m4($._zod.def,{get shape(){let z={};for(let i in w){if(!(i in J.shape))throw Error(`Unrecognized key: "${i}"`);if(!w[i])continue;z[i]=J.shape[i]}return g6(this,"shape",z),z},checks:[]});return E$($,G)}function Sq($,w){let J=$._zod.def,V=J.checks;if(V&&V.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let G=m4($._zod.def,{get shape(){let z={...$._zod.def.shape};for(let i in w){if(!(i in J.shape))throw Error(`Unrecognized key: "${i}"`);if(!w[i])continue;delete z[i]}return g6(this,"shape",z),z},checks:[]});return E$($,G)}function _q($,w){if(!Y6(w))throw Error("Invalid input to extend: expected a plain object");let J=$._zod.def.checks;if(J&&J.length>0){let G=$._zod.def.shape;for(let z in w)if(Object.getOwnPropertyDescriptor(G,z)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let U=m4($._zod.def,{get shape(){let G={...$._zod.def.shape,...w};return g6(this,"shape",G),G}});return E$($,U)}function kq($,w){if(!Y6(w))throw Error("Invalid input to safeExtend: expected a plain object");let J=m4($._zod.def,{get shape(){let V={...$._zod.def.shape,...w};return g6(this,"shape",V),V}});return E$($,J)}function Rq($,w){if($._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let J=m4($._zod.def,{get shape(){let V={...$._zod.def.shape,...w._zod.def.shape};return g6(this,"shape",V),V},get catchall(){return w._zod.def.catchall},checks:w._zod.def.checks??[]});return E$($,J)}function bq($,w,J){let U=w._zod.def.checks;if(U&&U.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let z=m4(w._zod.def,{get shape(){let i=w._zod.def.shape,N={...i};if(J)for(let X in J){if(!(X in i))throw Error(`Unrecognized key: "${X}"`);if(!J[X])continue;N[X]=$?new $({type:"optional",innerType:i[X]}):i[X]}else for(let X in i)N[X]=$?new $({type:"optional",innerType:i[X]}):i[X];return g6(this,"shape",N),N},checks:[]});return E$(w,z)}function Eq($,w,J){let V=m4(w._zod.def,{get shape(){let U=w._zod.def.shape,G={...U};if(J)for(let z in J){if(!(z in G))throw Error(`Unrecognized key: "${z}"`);if(!J[z])continue;G[z]=new $({type:"nonoptional",innerType:U[z]})}else for(let z in U)G[z]=new $({type:"nonoptional",innerType:U[z]});return g6(this,"shape",G),G}});return E$(w,V)}function v6($,w=0){if($.aborted===!0)return!0;for(let J=w;J<$.issues.length;J++)if($.issues[J]?.continue!==!0)return!0;return!1}function MX($,w=0){if($.aborted===!0)return!0;for(let J=w;J<$.issues.length;J++)if($.issues[J]?.continue===!1)return!0;return!1}function n$($,w){return w.map((J)=>{var V;return(V=J).path??(V.path=[]),J.path.unshift($),J})}function _1($){return typeof $==="string"?$:$?.message}function C$($,w,J){let V=$.message?$.message:_1($.inst?._zod.def?.error?.($))??_1(w?.error?.($))??_1(J.customError?.($))??_1(J.localeError?.($))??"Invalid input",{inst:U,continue:G,input:z,...i}=$;if(i.path??(i.path=[]),i.message=V,w?.reportInput)i.input=z;return i}function E1($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function C1($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function f($){let w=typeof $;switch(w){case"number":return Number.isNaN($)?"nan":"number";case"object":{if($===null)return"null";if(Array.isArray($))return"array";let J=$;if(J&&Object.getPrototypeOf(J)!==Object.prototype&&"constructor"in J&&J.constructor)return J.constructor.name}}return w}function GJ(...$){let[w,J,V]=$;if(typeof w==="string")return{message:w,code:"custom",input:J,inst:V};return{...w}}function Cq($){return Object.entries($).filter(([w,J])=>{return Number.isNaN(Number.parseInt(w,10))}).map((w)=>w[1])}function Hv($){let w=atob($),J=new Uint8Array(w.length);for(let V=0;V<w.length;V++)J[V]=w.charCodeAt(V);return J}function Fv($){let w="";for(let J=0;J<$.length;J++)w+=String.fromCharCode($[J]);return btoa(w)}function jq($){let w=$.replace(/-/g,"+").replace(/_/g,"/"),J="=".repeat((4-w.length%4)%4);return Hv(w+J)}function xq($){return Fv($).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function rq($){let w=$.replace(/^0x/,"");if(w.length%2!==0)throw Error("Invalid hex string length");let J=new Uint8Array(w.length/2);for(let V=0;V<w.length;V+=2)J[V/2]=Number.parseInt(w.slice(V,V+2),16);return J}function nq($){return Array.from($).map((w)=>w.toString(16).padStart(2,"0")).join("")}class qv{constructor(...$){}}var Zv=($,w)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:w,enumerable:!1}),$.message=JSON.stringify(w,UJ,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},j1=u("$ZodError",Zv),d$=u("$ZodError",Zv,{Parent:Error});function x1($,w=(J)=>J.message){let J={},V=[];for(let U of $.issues)if(U.path.length>0)J[U.path[0]]=J[U.path[0]]||[],J[U.path[0]].push(w(U));else V.push(w(U));return{formErrors:V,fieldErrors:J}}function r1($,w=(J)=>J.message){let J={_errors:[]},V=(U,G=[])=>{for(let z of U.issues)if(z.code==="invalid_union"&&z.errors.length)z.errors.map((i)=>V({issues:i},[...G,...z.path]));else if(z.code==="invalid_key")V({issues:z.issues},[...G,...z.path]);else if(z.code==="invalid_element")V({issues:z.issues},[...G,...z.path]);else{let i=[...G,...z.path];if(i.length===0)J._errors.push(w(z));else{let N=J,X=0;while(X<i.length){let W=i[X];if(X!==i.length-1)N[W]=N[W]||{_errors:[]};else N[W]=N[W]||{_errors:[]},N[W]._errors.push(w(z));N=N[W],X++}}}};return V($),J}function AX($,w=(J)=>J.message){let J={errors:[]},V=(U,G=[])=>{var z,i;for(let N of U.issues)if(N.code==="invalid_union"&&N.errors.length)N.errors.map((X)=>V({issues:X},[...G,...N.path]));else if(N.code==="invalid_key")V({issues:N.issues},[...G,...N.path]);else if(N.code==="invalid_element")V({issues:N.issues},[...G,...N.path]);else{let X=[...G,...N.path];if(X.length===0){J.errors.push(w(N));continue}let W=J,I=0;while(I<X.length){let g=X[I],Y=I===X.length-1;if(typeof g==="string")W.properties??(W.properties={}),(z=W.properties)[g]??(z[g]={errors:[]}),W=W.properties[g];else W.items??(W.items=[]),(i=W.items)[g]??(i[g]={errors:[]}),W=W.items[g];if(Y)W.errors.push(w(N));I++}}};return V($),J}function Tv($){let w=[],J=$.map((V)=>typeof V==="object"?V.key:V);for(let V of J)if(typeof V==="number")w.push(`[${V}]`);else if(typeof V==="symbol")w.push(`[${JSON.stringify(String(V))}]`);else if(/[^\w$]/.test(V))w.push(`[${JSON.stringify(V)}]`);else{if(w.length)w.push(".");w.push(V)}return w.join("")}function SX($){let w=[],J=[...$.issues].sort((V,U)=>(V.path??[]).length-(U.path??[]).length);for(let V of J)if(w.push(`✖ ${V.message}`),V.path?.length)w.push(` → at ${Tv(V.path)}`);return w.join(`
|
|
195
|
+
`)}var zJ=($)=>(w,J,V,U)=>{let G=V?{...V,async:!1}:{async:!1},z=w._zod.run({value:J,issues:[]},G);if(z instanceof Promise)throw new Z4;if(z.issues.length){let i=new(U?.Err??$)(z.issues.map((N)=>C$(N,G,X$())));throw LV(i,U?.callee),i}return z.value},fV=zJ(d$),iJ=($)=>async(w,J,V,U)=>{let G=V?{...V,async:!0}:{async:!0},z=w._zod.run({value:J,issues:[]},G);if(z instanceof Promise)z=await z;if(z.issues.length){let i=new(U?.Err??$)(z.issues.map((N)=>C$(N,G,X$())));throw LV(i,U?.callee),i}return z.value},MV=iJ(d$),XJ=($)=>(w,J,V)=>{let U=V?{...V,async:!1}:{async:!1},G=w._zod.run({value:J,issues:[]},U);if(G instanceof Promise)throw new Z4;return G.issues.length?{success:!1,error:new($??j1)(G.issues.map((z)=>C$(z,U,X$())))}:{success:!0,data:G.value}},_X=XJ(d$),NJ=($)=>async(w,J,V)=>{let U=V?{...V,async:!0}:{async:!0},G=w._zod.run({value:J,issues:[]},U);if(G instanceof Promise)G=await G;return G.issues.length?{success:!1,error:new $(G.issues.map((z)=>C$(z,U,X$())))}:{success:!0,data:G.value}},kX=NJ(d$),AV=($)=>(w,J,V)=>{let U=V?{...V,direction:"backward"}:{direction:"backward"};return zJ($)(w,J,U)},mq=AV(d$),SV=($)=>(w,J,V)=>{return zJ($)(w,J,V)},yq=SV(d$),_V=($)=>async(w,J,V)=>{let U=V?{...V,direction:"backward"}:{direction:"backward"};return iJ($)(w,J,U)},hq=_V(d$),kV=($)=>async(w,J,V)=>{return iJ($)(w,J,V)},cq=kV(d$),RV=($)=>(w,J,V)=>{let U=V?{...V,direction:"backward"}:{direction:"backward"};return XJ($)(w,J,U)},lq=RV(d$),bV=($)=>(w,J,V)=>{return XJ($)(w,J,V)},tq=bV(d$),EV=($)=>async(w,J,V)=>{let U=V?{...V,direction:"backward"}:{direction:"backward"};return NJ($)(w,J,U)},oq=EV(d$),CV=($)=>async(w,J,V)=>{return NJ($)(w,J,V)},pq=CV(d$);var p$={};R4(p$,{xid:()=>CX,uuid7:()=>$Z,uuid6:()=>sq,uuid4:()=>eq,uuid:()=>zw,uppercase:()=>XN,unicodeEmail:()=>Dv,undefined:()=>zN,ulid:()=>EX,time:()=>sX,string:()=>wN,sha512_hex:()=>HZ,sha512_base64url:()=>qZ,sha512_base64:()=>FZ,sha384_hex:()=>KZ,sha384_base64url:()=>BZ,sha384_base64:()=>uZ,sha256_hex:()=>QZ,sha256_base64url:()=>PZ,sha256_base64:()=>OZ,sha1_hex:()=>gZ,sha1_base64url:()=>vZ,sha1_base64:()=>YZ,rfc5322Email:()=>JZ,number:()=>n1,null:()=>GN,nanoid:()=>xX,md5_hex:()=>NZ,md5_base64url:()=>IZ,md5_base64:()=>WZ,mac:()=>cX,lowercase:()=>iN,ksuid:()=>jX,ipv6:()=>hX,ipv4:()=>yX,integer:()=>UN,idnEmail:()=>UZ,httpProtocol:()=>pX,html5Email:()=>wZ,hostname:()=>zZ,hex:()=>XZ,guid:()=>nX,extendedDuration:()=>aq,emoji:()=>mX,email:()=>dX,e164:()=>aX,duration:()=>rX,domain:()=>iZ,datetime:()=>$N,date:()=>eX,cuid2:()=>bX,cuid:()=>RX,cidrv6:()=>tX,cidrv4:()=>lX,browserEmail:()=>VZ,boolean:()=>VN,bigint:()=>JN,base64url:()=>jV,base64:()=>oX});var RX=/^[cC][0-9a-z]{6,}$/,bX=/^[0-9a-z]+$/,EX=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,CX=/^[0-9a-vA-V]{20}$/,jX=/^[A-Za-z0-9]{27}$/,xX=/^[a-zA-Z0-9_-]{21}$/,rX=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,aq=/^[-+]?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)?)??$/,nX=/^([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})$/,zw=($)=>{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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;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})$`)},eq=zw(4),sq=zw(6),$Z=zw(7),dX=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,wZ=/^[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])?)*$/,JZ=/^(([^<>()\[\]\\.,;:\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,}))$/,Dv=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,UZ=Dv,VZ=/^[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])?)*$/,GZ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function mX(){return new RegExp(GZ,"u")}var yX=/^(?:(?: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])$/,hX=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,cX=($)=>{let w=w4($??":");return new RegExp(`^(?:[0-9A-F]{2}${w}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${w}){5}[0-9a-f]{2}$`)},lX=/^((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])$/,tX=/^(([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])$/,oX=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jV=/^[A-Za-z0-9_-]*$/,zZ=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,iZ=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,pX=/^https?$/,aX=/^\+[1-9]\d{6,14}$/,Lv="(?:(?:\\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])))",eX=new RegExp(`^${Lv}$`);function fv($){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 sX($){return new RegExp(`^${fv($)}$`)}function $N($){let w=fv({precision:$.precision}),J=["Z"];if($.local)J.push("");if($.offset)J.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let V=`${w}(?:${J.join("|")})`;return new RegExp(`^${Lv}T(?:${V})$`)}var wN=($)=>{let w=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${w}$`)},JN=/^-?\d+n?$/,UN=/^-?\d+$/,n1=/^-?\d+(?:\.\d+)?$/,VN=/^(?:true|false)$/i,GN=/^null$/i;var zN=/^undefined$/i;var iN=/^[^A-Z]*$/,XN=/^[^a-z]*$/,XZ=/^[0-9a-fA-F]*$/;function d1($,w){return new RegExp(`^[A-Za-z0-9+/]{${$}}${w}$`)}function m1($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var NZ=/^[0-9a-fA-F]{32}$/,WZ=d1(22,"=="),IZ=m1(22),gZ=/^[0-9a-fA-F]{40}$/,YZ=d1(27,"="),vZ=m1(27),QZ=/^[0-9a-fA-F]{64}$/,OZ=d1(43,"="),PZ=m1(43),KZ=/^[0-9a-fA-F]{96}$/,uZ=d1(64,""),BZ=m1(64),HZ=/^[0-9a-fA-F]{128}$/,FZ=d1(86,"=="),qZ=m1(86);var J$=u("$ZodCheck",($,w)=>{var J;$._zod??($._zod={}),$._zod.def=w,(J=$._zod).onattach??(J.onattach=[])}),Av={number:"number",bigint:"bigint",object:"date"},xV=u("$ZodCheckLessThan",($,w)=>{J$.init($,w);let J=Av[typeof w.value];$._zod.onattach.push((V)=>{let U=V._zod.bag,G=(w.inclusive?U.maximum:U.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(w.value<G)if(w.inclusive)U.maximum=w.value;else U.exclusiveMaximum=w.value}),$._zod.check=(V)=>{if(w.inclusive?V.value<=w.value:V.value<w.value)return;V.issues.push({origin:J,code:"too_big",maximum:typeof w.value==="object"?w.value.getTime():w.value,input:V.value,inclusive:w.inclusive,inst:$,continue:!w.abort})}}),rV=u("$ZodCheckGreaterThan",($,w)=>{J$.init($,w);let J=Av[typeof w.value];$._zod.onattach.push((V)=>{let U=V._zod.bag,G=(w.inclusive?U.minimum:U.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(w.value>G)if(w.inclusive)U.minimum=w.value;else U.exclusiveMinimum=w.value}),$._zod.check=(V)=>{if(w.inclusive?V.value>=w.value:V.value>w.value)return;V.issues.push({origin:J,code:"too_small",minimum:typeof w.value==="object"?w.value.getTime():w.value,input:V.value,inclusive:w.inclusive,inst:$,continue:!w.abort})}}),NN=u("$ZodCheckMultipleOf",($,w)=>{J$.init($,w),$._zod.onattach.push((J)=>{var V;(V=J._zod.bag).multipleOf??(V.multipleOf=w.value)}),$._zod.check=(J)=>{if(typeof J.value!==typeof w.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof J.value==="bigint"?J.value%w.value===BigInt(0):HX(J.value,w.value)===0)return;J.issues.push({origin:typeof J.value,code:"not_multiple_of",divisor:w.value,input:J.value,inst:$,continue:!w.abort})}}),WN=u("$ZodCheckNumberFormat",($,w)=>{J$.init($,w),w.format=w.format||"float64";let J=w.format?.includes("int"),V=J?"int":"number",[U,G]=LX[w.format];$._zod.onattach.push((z)=>{let i=z._zod.bag;if(i.format=w.format,i.minimum=U,i.maximum=G,J)i.pattern=UN}),$._zod.check=(z)=>{let i=z.value;if(J){if(!Number.isInteger(i)){z.issues.push({expected:V,format:w.format,code:"invalid_type",continue:!1,input:i,inst:$});return}if(!Number.isSafeInteger(i)){if(i>0)z.issues.push({input:i,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:V,inclusive:!0,continue:!w.abort});else z.issues.push({input:i,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:V,inclusive:!0,continue:!w.abort});return}}if(i<U)z.issues.push({origin:"number",input:i,code:"too_small",minimum:U,inclusive:!0,inst:$,continue:!w.abort});if(i>G)z.issues.push({origin:"number",input:i,code:"too_big",maximum:G,inclusive:!0,inst:$,continue:!w.abort})}}),IN=u("$ZodCheckBigIntFormat",($,w)=>{J$.init($,w);let[J,V]=fX[w.format];$._zod.onattach.push((U)=>{let G=U._zod.bag;G.format=w.format,G.minimum=J,G.maximum=V}),$._zod.check=(U)=>{let G=U.value;if(G<J)U.issues.push({origin:"bigint",input:G,code:"too_small",minimum:J,inclusive:!0,inst:$,continue:!w.abort});if(G>V)U.issues.push({origin:"bigint",input:G,code:"too_big",maximum:V,inclusive:!0,inst:$,continue:!w.abort})}}),gN=u("$ZodCheckMaxSize",($,w)=>{var J;J$.init($,w),(J=$._zod.def).when??(J.when=(V)=>{let U=V.value;return!I6(U)&&U.size!==void 0}),$._zod.onattach.push((V)=>{let U=V._zod.bag.maximum??Number.POSITIVE_INFINITY;if(w.maximum<U)V._zod.bag.maximum=w.maximum}),$._zod.check=(V)=>{let U=V.value;if(U.size<=w.maximum)return;V.issues.push({origin:E1(U),code:"too_big",maximum:w.maximum,inclusive:!0,input:U,inst:$,continue:!w.abort})}}),YN=u("$ZodCheckMinSize",($,w)=>{var J;J$.init($,w),(J=$._zod.def).when??(J.when=(V)=>{let U=V.value;return!I6(U)&&U.size!==void 0}),$._zod.onattach.push((V)=>{let U=V._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(w.minimum>U)V._zod.bag.minimum=w.minimum}),$._zod.check=(V)=>{let U=V.value;if(U.size>=w.minimum)return;V.issues.push({origin:E1(U),code:"too_small",minimum:w.minimum,inclusive:!0,input:U,inst:$,continue:!w.abort})}}),vN=u("$ZodCheckSizeEquals",($,w)=>{var J;J$.init($,w),(J=$._zod.def).when??(J.when=(V)=>{let U=V.value;return!I6(U)&&U.size!==void 0}),$._zod.onattach.push((V)=>{let U=V._zod.bag;U.minimum=w.size,U.maximum=w.size,U.size=w.size}),$._zod.check=(V)=>{let U=V.value,G=U.size;if(G===w.size)return;let z=G>w.size;V.issues.push({origin:E1(U),...z?{code:"too_big",maximum:w.size}:{code:"too_small",minimum:w.size},inclusive:!0,exact:!0,input:V.value,inst:$,continue:!w.abort})}}),QN=u("$ZodCheckMaxLength",($,w)=>{var J;J$.init($,w),(J=$._zod.def).when??(J.when=(V)=>{let U=V.value;return!I6(U)&&U.length!==void 0}),$._zod.onattach.push((V)=>{let U=V._zod.bag.maximum??Number.POSITIVE_INFINITY;if(w.maximum<U)V._zod.bag.maximum=w.maximum}),$._zod.check=(V)=>{let U=V.value;if(U.length<=w.maximum)return;let z=C1(U);V.issues.push({origin:z,code:"too_big",maximum:w.maximum,inclusive:!0,input:U,inst:$,continue:!w.abort})}}),ON=u("$ZodCheckMinLength",($,w)=>{var J;J$.init($,w),(J=$._zod.def).when??(J.when=(V)=>{let U=V.value;return!I6(U)&&U.length!==void 0}),$._zod.onattach.push((V)=>{let U=V._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(w.minimum>U)V._zod.bag.minimum=w.minimum}),$._zod.check=(V)=>{let U=V.value;if(U.length>=w.minimum)return;let z=C1(U);V.issues.push({origin:z,code:"too_small",minimum:w.minimum,inclusive:!0,input:U,inst:$,continue:!w.abort})}}),PN=u("$ZodCheckLengthEquals",($,w)=>{var J;J$.init($,w),(J=$._zod.def).when??(J.when=(V)=>{let U=V.value;return!I6(U)&&U.length!==void 0}),$._zod.onattach.push((V)=>{let U=V._zod.bag;U.minimum=w.length,U.maximum=w.length,U.length=w.length}),$._zod.check=(V)=>{let U=V.value,G=U.length;if(G===w.length)return;let z=C1(U),i=G>w.length;V.issues.push({origin:z,...i?{code:"too_big",maximum:w.length}:{code:"too_small",minimum:w.length},inclusive:!0,exact:!0,input:V.value,inst:$,continue:!w.abort})}}),WJ=u("$ZodCheckStringFormat",($,w)=>{var J,V;if(J$.init($,w),$._zod.onattach.push((U)=>{let G=U._zod.bag;if(G.format=w.format,w.pattern)G.patterns??(G.patterns=new Set),G.patterns.add(w.pattern)}),w.pattern)(J=$._zod).check??(J.check=(U)=>{if(w.pattern.lastIndex=0,w.pattern.test(U.value))return;U.issues.push({origin:"string",code:"invalid_format",format:w.format,input:U.value,...w.pattern?{pattern:w.pattern.toString()}:{},inst:$,continue:!w.abort})});else(V=$._zod).check??(V.check=()=>{})}),KN=u("$ZodCheckRegex",($,w)=>{WJ.init($,w),$._zod.check=(J)=>{if(w.pattern.lastIndex=0,w.pattern.test(J.value))return;J.issues.push({origin:"string",code:"invalid_format",format:"regex",input:J.value,pattern:w.pattern.toString(),inst:$,continue:!w.abort})}}),uN=u("$ZodCheckLowerCase",($,w)=>{w.pattern??(w.pattern=iN),WJ.init($,w)}),BN=u("$ZodCheckUpperCase",($,w)=>{w.pattern??(w.pattern=XN),WJ.init($,w)}),HN=u("$ZodCheckIncludes",($,w)=>{J$.init($,w);let J=w4(w.includes),V=new RegExp(typeof w.position==="number"?`^.{${w.position}}${J}`:J);w.pattern=V,$._zod.onattach.push((U)=>{let G=U._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(V)}),$._zod.check=(U)=>{if(U.value.includes(w.includes,w.position))return;U.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:w.includes,input:U.value,inst:$,continue:!w.abort})}}),FN=u("$ZodCheckStartsWith",($,w)=>{J$.init($,w);let J=new RegExp(`^${w4(w.prefix)}.*`);w.pattern??(w.pattern=J),$._zod.onattach.push((V)=>{let U=V._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(J)}),$._zod.check=(V)=>{if(V.value.startsWith(w.prefix))return;V.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:w.prefix,input:V.value,inst:$,continue:!w.abort})}}),qN=u("$ZodCheckEndsWith",($,w)=>{J$.init($,w);let J=new RegExp(`.*${w4(w.suffix)}$`);w.pattern??(w.pattern=J),$._zod.onattach.push((V)=>{let U=V._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(J)}),$._zod.check=(V)=>{if(V.value.endsWith(w.suffix))return;V.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:w.suffix,input:V.value,inst:$,continue:!w.abort})}});function Mv($,w,J){if($.issues.length)w.issues.push(...n$(J,$.issues))}var ZN=u("$ZodCheckProperty",($,w)=>{J$.init($,w),$._zod.check=(J)=>{let V=w.schema._zod.run({value:J.value[w.property],issues:[]},{});if(V instanceof Promise)return V.then((U)=>Mv(U,J,w.property));Mv(V,J,w.property);return}}),TN=u("$ZodCheckMimeType",($,w)=>{J$.init($,w);let J=new Set(w.mime);$._zod.onattach.push((V)=>{V._zod.bag.mime=w.mime}),$._zod.check=(V)=>{if(J.has(V.value.type))return;V.issues.push({code:"invalid_value",values:w.mime,input:V.value.type,inst:$,continue:!w.abort})}}),DN=u("$ZodCheckOverwrite",($,w)=>{J$.init($,w),$._zod.check=(J)=>{J.value=w.tx(J.value)}});class nV{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 J=$.split(`
|
|
196
|
+
`).filter((G)=>G),V=Math.min(...J.map((G)=>G.length-G.trimStart().length)),U=J.map((G)=>G.slice(V)).map((G)=>" ".repeat(this.indent*2)+G);for(let G of U)this.content.push(G)}compile(){let $=Function,w=this?.args,V=[...(this?.content??[""]).map((U)=>` ${U}`)];return new $(...w,V.join(`
|
|
197
|
+
`))}}var LN={major:4,minor:4,patch:3};var m=u("$ZodType",($,w)=>{var J;$??($={}),$._zod.def=w,$._zod.bag=$._zod.bag||{},$._zod.version=LN;let V=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))V.unshift($);for(let U of V)for(let G of U._zod.onattach)G($);if(V.length===0)(J=$._zod).deferred??(J.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let U=(z,i,N)=>{let X=v6(z),W;for(let I of i){if(I._zod.def.when){if(MX(z))continue;if(!I._zod.def.when(z))continue}else if(X)continue;let g=z.issues.length,Y=I._zod.check(z);if(Y instanceof Promise&&N?.async===!1)throw new Z4;if(W||Y instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await Y,z.issues.length===g)return;if(!X)X=v6(z,g)});else{if(z.issues.length===g)continue;if(!X)X=v6(z,g)}}if(W)return W.then(()=>{return z});return z},G=(z,i,N)=>{if(v6(z))return z.aborted=!0,z;let X=U(i,V,N);if(X instanceof Promise){if(N.async===!1)throw new Z4;return X.then((W)=>$._zod.parse(W,N))}return $._zod.parse(X,N)};$._zod.run=(z,i)=>{if(i.skipChecks)return $._zod.parse(z,i);if(i.direction==="backward"){let X=$._zod.parse({value:z.value,issues:[]},{...i,skipChecks:!0});if(X instanceof Promise)return X.then((W)=>{return G(W,z,i)});return G(X,z,i)}let N=$._zod.parse(z,i);if(N instanceof Promise){if(i.async===!1)throw new Z4;return N.then((X)=>U(X,V,i))}return U(N,V,i)}}c($,"~standard",()=>({validate:(U)=>{try{let G=_X($,U);return G.success?{value:G.data}:{issues:G.error?.issues}}catch(G){return kX($,U).then((z)=>z.success?{value:z.data}:{issues:z.error?.issues})}},vendor:"zod",version:1}))}),iw=u("$ZodString",($,w)=>{m.init($,w),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??wN($._zod.bag),$._zod.parse=(J,V)=>{if(w.coerce)try{J.value=String(J.value)}catch(U){}if(typeof J.value==="string")return J;return J.issues.push({expected:"string",code:"invalid_type",input:J.value,inst:$}),J}}),s=u("$ZodStringFormat",($,w)=>{WJ.init($,w),iw.init($,w)}),MN=u("$ZodGUID",($,w)=>{w.pattern??(w.pattern=nX),s.init($,w)}),AN=u("$ZodUUID",($,w)=>{if(w.version){let V={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[w.version];if(V===void 0)throw Error(`Invalid UUID version: "${w.version}"`);w.pattern??(w.pattern=zw(V))}else w.pattern??(w.pattern=zw());s.init($,w)}),SN=u("$ZodEmail",($,w)=>{w.pattern??(w.pattern=dX),s.init($,w)}),_N=u("$ZodURL",($,w)=>{s.init($,w),$._zod.check=(J)=>{try{let V=J.value.trim();if(!w.normalize&&w.protocol?.source===pX.source){if(!/^https?:\/\//i.test(V)){J.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:J.value,inst:$,continue:!w.abort});return}}let U=new URL(V);if(w.hostname){if(w.hostname.lastIndex=0,!w.hostname.test(U.hostname))J.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:w.hostname.source,input:J.value,inst:$,continue:!w.abort})}if(w.protocol){if(w.protocol.lastIndex=0,!w.protocol.test(U.protocol.endsWith(":")?U.protocol.slice(0,-1):U.protocol))J.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:w.protocol.source,input:J.value,inst:$,continue:!w.abort})}if(w.normalize)J.value=U.href;else J.value=V;return}catch(V){J.issues.push({code:"invalid_format",format:"url",input:J.value,inst:$,continue:!w.abort})}}}),kN=u("$ZodEmoji",($,w)=>{w.pattern??(w.pattern=mX()),s.init($,w)}),RN=u("$ZodNanoID",($,w)=>{w.pattern??(w.pattern=xX),s.init($,w)}),bN=u("$ZodCUID",($,w)=>{w.pattern??(w.pattern=RX),s.init($,w)}),EN=u("$ZodCUID2",($,w)=>{w.pattern??(w.pattern=bX),s.init($,w)}),CN=u("$ZodULID",($,w)=>{w.pattern??(w.pattern=EX),s.init($,w)}),jN=u("$ZodXID",($,w)=>{w.pattern??(w.pattern=CX),s.init($,w)}),xN=u("$ZodKSUID",($,w)=>{w.pattern??(w.pattern=jX),s.init($,w)}),rN=u("$ZodISODateTime",($,w)=>{w.pattern??(w.pattern=$N(w)),s.init($,w)}),nN=u("$ZodISODate",($,w)=>{w.pattern??(w.pattern=eX),s.init($,w)}),dN=u("$ZodISOTime",($,w)=>{w.pattern??(w.pattern=sX(w)),s.init($,w)}),mN=u("$ZodISODuration",($,w)=>{w.pattern??(w.pattern=rX),s.init($,w)}),yN=u("$ZodIPv4",($,w)=>{w.pattern??(w.pattern=yX),s.init($,w),$._zod.bag.format="ipv4"}),hN=u("$ZodIPv6",($,w)=>{w.pattern??(w.pattern=hX),s.init($,w),$._zod.bag.format="ipv6",$._zod.check=(J)=>{try{new URL(`http://[${J.value}]`)}catch{J.issues.push({code:"invalid_format",format:"ipv6",input:J.value,inst:$,continue:!w.abort})}}}),cN=u("$ZodMAC",($,w)=>{w.pattern??(w.pattern=cX(w.delimiter)),s.init($,w),$._zod.bag.format="mac"}),lN=u("$ZodCIDRv4",($,w)=>{w.pattern??(w.pattern=lX),s.init($,w)}),tN=u("$ZodCIDRv6",($,w)=>{w.pattern??(w.pattern=tX),s.init($,w),$._zod.check=(J)=>{let V=J.value.split("/");try{if(V.length!==2)throw Error();let[U,G]=V;if(!G)throw Error();let z=Number(G);if(`${z}`!==G)throw Error();if(z<0||z>128)throw Error();new URL(`http://[${U}]`)}catch{J.issues.push({code:"invalid_format",format:"cidrv6",input:J.value,inst:$,continue:!w.abort})}}});function oN($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var pN=u("$ZodBase64",($,w)=>{w.pattern??(w.pattern=oX),s.init($,w),$._zod.bag.contentEncoding="base64",$._zod.check=(J)=>{if(oN(J.value))return;J.issues.push({code:"invalid_format",format:"base64",input:J.value,inst:$,continue:!w.abort})}});function cv($){if(!jV.test($))return!1;let w=$.replace(/[-_]/g,(V)=>V==="-"?"+":"/"),J=w.padEnd(Math.ceil(w.length/4)*4,"=");return oN(J)}var aN=u("$ZodBase64URL",($,w)=>{w.pattern??(w.pattern=jV),s.init($,w),$._zod.bag.contentEncoding="base64url",$._zod.check=(J)=>{if(cv(J.value))return;J.issues.push({code:"invalid_format",format:"base64url",input:J.value,inst:$,continue:!w.abort})}}),eN=u("$ZodE164",($,w)=>{w.pattern??(w.pattern=aX),s.init($,w)});function lv($,w=null){try{let J=$.split(".");if(J.length!==3)return!1;let[V]=J;if(!V)return!1;let U=JSON.parse(atob(V));if("typ"in U&&U?.typ!=="JWT")return!1;if(!U.alg)return!1;if(w&&(!("alg"in U)||U.alg!==w))return!1;return!0}catch{return!1}}var sN=u("$ZodJWT",($,w)=>{s.init($,w),$._zod.check=(J)=>{if(lv(J.value,w.alg))return;J.issues.push({code:"invalid_format",format:"jwt",input:J.value,inst:$,continue:!w.abort})}}),$8=u("$ZodCustomStringFormat",($,w)=>{s.init($,w),$._zod.check=(J)=>{if(w.fn(J.value))return;J.issues.push({code:"invalid_format",format:w.format,input:J.value,inst:$,continue:!w.abort})}}),cV=u("$ZodNumber",($,w)=>{m.init($,w),$._zod.pattern=$._zod.bag.pattern??n1,$._zod.parse=(J,V)=>{if(w.coerce)try{J.value=Number(J.value)}catch(z){}let U=J.value;if(typeof U==="number"&&!Number.isNaN(U)&&Number.isFinite(U))return J;let G=typeof U==="number"?Number.isNaN(U)?"NaN":!Number.isFinite(U)?"Infinity":void 0:void 0;return J.issues.push({expected:"number",code:"invalid_type",input:U,inst:$,...G?{received:G}:{}}),J}}),w8=u("$ZodNumberFormat",($,w)=>{WN.init($,w),cV.init($,w)}),y1=u("$ZodBoolean",($,w)=>{m.init($,w),$._zod.pattern=VN,$._zod.parse=(J,V)=>{if(w.coerce)try{J.value=Boolean(J.value)}catch(G){}let U=J.value;if(typeof U==="boolean")return J;return J.issues.push({expected:"boolean",code:"invalid_type",input:U,inst:$}),J}}),lV=u("$ZodBigInt",($,w)=>{m.init($,w),$._zod.pattern=JN,$._zod.parse=(J,V)=>{if(w.coerce)try{J.value=BigInt(J.value)}catch(U){}if(typeof J.value==="bigint")return J;return J.issues.push({expected:"bigint",code:"invalid_type",input:J.value,inst:$}),J}}),J8=u("$ZodBigIntFormat",($,w)=>{IN.init($,w),lV.init($,w)}),U8=u("$ZodSymbol",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{let U=J.value;if(typeof U==="symbol")return J;return J.issues.push({expected:"symbol",code:"invalid_type",input:U,inst:$}),J}}),V8=u("$ZodUndefined",($,w)=>{m.init($,w),$._zod.pattern=zN,$._zod.values=new Set([void 0]),$._zod.parse=(J,V)=>{let U=J.value;if(typeof U>"u")return J;return J.issues.push({expected:"undefined",code:"invalid_type",input:U,inst:$}),J}}),G8=u("$ZodNull",($,w)=>{m.init($,w),$._zod.pattern=GN,$._zod.values=new Set([null]),$._zod.parse=(J,V)=>{let U=J.value;if(U===null)return J;return J.issues.push({expected:"null",code:"invalid_type",input:U,inst:$}),J}}),z8=u("$ZodAny",($,w)=>{m.init($,w),$._zod.parse=(J)=>J}),i8=u("$ZodUnknown",($,w)=>{m.init($,w),$._zod.parse=(J)=>J}),X8=u("$ZodNever",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{return J.issues.push({expected:"never",code:"invalid_type",input:J.value,inst:$}),J}}),N8=u("$ZodVoid",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{let U=J.value;if(typeof U>"u")return J;return J.issues.push({expected:"void",code:"invalid_type",input:U,inst:$}),J}}),W8=u("$ZodDate",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{if(w.coerce)try{J.value=new Date(J.value)}catch(i){}let U=J.value,G=U instanceof Date;if(G&&!Number.isNaN(U.getTime()))return J;return J.issues.push({expected:"date",code:"invalid_type",input:U,...G?{received:"Invalid Date"}:{},inst:$}),J}});function _v($,w,J){if($.issues.length)w.issues.push(...n$(J,$.issues));w.value[J]=$.value}var I8=u("$ZodArray",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{let U=J.value;if(!Array.isArray(U))return J.issues.push({expected:"array",code:"invalid_type",input:U,inst:$}),J;J.value=Array(U.length);let G=[];for(let z=0;z<U.length;z++){let i=U[z],N=w.element._zod.run({value:i,issues:[]},V);if(N instanceof Promise)G.push(N.then((X)=>_v(X,J,z)));else _v(N,J,z)}if(G.length)return Promise.all(G).then(()=>J);return J}});function hV($,w,J,V,U,G){let z=J in V;if($.issues.length){if(U&&G&&!z)return;w.issues.push(...n$(J,$.issues))}if(!z&&!U){if(!$.issues.length)w.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[J]});return}if($.value===void 0){if(z)w.value[J]=void 0}else w.value[J]=$.value}function tv($){let w=Object.keys($.shape);for(let V of w)if(!$.shape?.[V]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${V}": expected a Zod schema`);let J=DX($.shape);return{...$,keys:w,keySet:new Set(w),numKeys:w.length,optionalKeys:new Set(J)}}function ov($,w,J,V,U,G){let z=[],i=U.keySet,N=U.catchall._zod,X=N.def.type,W=N.optin==="optional",I=N.optout==="optional";for(let g in w){if(g==="__proto__")continue;if(i.has(g))continue;if(X==="never"){z.push(g);continue}let Y=N.run({value:w[g],issues:[]},V);if(Y instanceof Promise)$.push(Y.then((v)=>hV(v,J,g,w,W,I)));else hV(Y,J,g,w,W,I)}if(z.length)J.issues.push({code:"unrecognized_keys",keys:z,input:w,inst:G});if(!$.length)return J;return Promise.all($).then(()=>{return J})}var pv=u("$ZodObject",($,w)=>{if(m.init($,w),!Object.getOwnPropertyDescriptor(w,"shape")?.get){let i=w.shape;Object.defineProperty(w,"shape",{get:()=>{let N={...i};return Object.defineProperty(w,"shape",{value:N}),N}})}let V=VJ(()=>tv(w));c($._zod,"propValues",()=>{let i=w.shape,N={};for(let X in i){let W=i[X]._zod;if(W.values){N[X]??(N[X]=new Set);for(let I of W.values)N[X].add(I)}}return N});let U=Gw,G=w.catchall,z;$._zod.parse=(i,N)=>{z??(z=V.value);let X=i.value;if(!U(X))return i.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),i;i.value={};let W=[],I=z.shape;for(let g of z.keys){let Y=I[g],v=Y._zod.optin==="optional",O=Y._zod.optout==="optional",P=Y._zod.run({value:X[g],issues:[]},N);if(P instanceof Promise)W.push(P.then((F)=>hV(F,i,g,X,v,O)));else hV(P,i,g,X,v,O)}if(!G)return W.length?Promise.all(W).then(()=>i):i;return ov(W,X,i,N,V.value,$)}}),g8=u("$ZodObjectJIT",($,w)=>{pv.init($,w);let J=$._zod.parse,V=VJ(()=>tv(w)),U=(g)=>{let Y=new nV(["shape","payload","ctx"]),v=V.value,O=(T)=>{let L=DV(T);return`shape[${L}]._zod.run({ value: input[${L}], issues: [] }, ctx)`};Y.write("const input = payload.value;");let P=Object.create(null),F=0;for(let T of v.keys)P[T]=`key_${F++}`;Y.write("const newResult = {};");for(let T of v.keys){let L=P[T],k=DV(T),b=g[T],C=b?._zod?.optin==="optional",_=b?._zod?.optout==="optional";if(Y.write(`const ${L} = ${O(T)};`),C&&_)Y.write(`
|
|
198
|
+
if (${L}.issues.length) {
|
|
199
|
+
if (${k} in input) {
|
|
200
|
+
payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
|
|
197
201
|
...iss,
|
|
198
|
-
path: iss.path ? [${
|
|
202
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
199
203
|
})));
|
|
200
204
|
}
|
|
201
205
|
}
|
|
202
206
|
|
|
203
|
-
if (${
|
|
204
|
-
if (${
|
|
205
|
-
newResult[${
|
|
207
|
+
if (${L}.value === undefined) {
|
|
208
|
+
if (${k} in input) {
|
|
209
|
+
newResult[${k}] = undefined;
|
|
206
210
|
}
|
|
207
211
|
} else {
|
|
208
|
-
newResult[${
|
|
212
|
+
newResult[${k}] = ${L}.value;
|
|
209
213
|
}
|
|
210
214
|
|
|
211
|
-
`);else if(!
|
|
212
|
-
const ${
|
|
213
|
-
if (${
|
|
214
|
-
payload.issues = payload.issues.concat(${
|
|
215
|
+
`);else if(!C)Y.write(`
|
|
216
|
+
const ${L}_present = ${k} in input;
|
|
217
|
+
if (${L}.issues.length) {
|
|
218
|
+
payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
|
|
215
219
|
...iss,
|
|
216
|
-
path: iss.path ? [${
|
|
220
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
217
221
|
})));
|
|
218
222
|
}
|
|
219
|
-
if (!${
|
|
223
|
+
if (!${L}_present && !${L}.issues.length) {
|
|
220
224
|
payload.issues.push({
|
|
221
225
|
code: "invalid_type",
|
|
222
226
|
expected: "nonoptional",
|
|
223
227
|
input: undefined,
|
|
224
|
-
path: [${
|
|
228
|
+
path: [${k}]
|
|
225
229
|
});
|
|
226
230
|
}
|
|
227
231
|
|
|
228
|
-
if (${
|
|
229
|
-
if (${
|
|
230
|
-
newResult[${
|
|
232
|
+
if (${L}_present) {
|
|
233
|
+
if (${L}.value === undefined) {
|
|
234
|
+
newResult[${k}] = undefined;
|
|
231
235
|
} else {
|
|
232
|
-
newResult[${
|
|
236
|
+
newResult[${k}] = ${L}.value;
|
|
233
237
|
}
|
|
234
238
|
}
|
|
235
239
|
|
|
236
|
-
`);else
|
|
237
|
-
if (${
|
|
238
|
-
payload.issues = payload.issues.concat(${
|
|
240
|
+
`);else Y.write(`
|
|
241
|
+
if (${L}.issues.length) {
|
|
242
|
+
payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
|
|
239
243
|
...iss,
|
|
240
|
-
path: iss.path ? [${
|
|
244
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
241
245
|
})));
|
|
242
246
|
}
|
|
243
247
|
|
|
244
|
-
if (${
|
|
245
|
-
if (${
|
|
246
|
-
newResult[${
|
|
248
|
+
if (${L}.value === undefined) {
|
|
249
|
+
if (${k} in input) {
|
|
250
|
+
newResult[${k}] = undefined;
|
|
247
251
|
}
|
|
248
252
|
} else {
|
|
249
|
-
newResult[${
|
|
253
|
+
newResult[${k}] = ${L}.value;
|
|
250
254
|
}
|
|
251
255
|
|
|
252
|
-
`)}W.write("payload.value = newResult;"),W.write("return payload;");let u=W.compile();return(b,M)=>u(N,b,M)},z,g=F6,V=!Z6.jitless,G=V&&_g.value,X=w.catchall,I;$._zod.parse=(N,W)=>{I??(I=v.value);let P=N.value;if(!g(P))return N.issues.push({expected:"object",code:"invalid_type",input:P,inst:$}),N;if(V&&G&&W?.async===!1&&W.jitless!==!0){if(!z)z=J(w.shape);if(N=z(N,W),!X)return N;return s3([],P,N,W,I,$)}return U(N,W)}});function C3($,w,U,v){for(let z of $)if(z.issues.length===0)return w.value=z.value,w;let J=$.filter((z)=>!n4(z));if(J.length===1)return w.value=J[0].value,J[0];return w.issues.push({code:"invalid_union",input:w.value,inst:U,errors:$.map((z)=>z.issues.map((g)=>Z$(g,v,g$())))}),w}var UJ=B("$ZodUnion",($,w)=>{d.init($,w),n($._zod,"optin",()=>w.options.some((v)=>v._zod.optin==="optional")?"optional":void 0),n($._zod,"optout",()=>w.options.some((v)=>v._zod.optout==="optional")?"optional":void 0),n($._zod,"values",()=>{if(w.options.every((v)=>v._zod.values))return new Set(w.options.flatMap((v)=>Array.from(v._zod.values)));return}),n($._zod,"pattern",()=>{if(w.options.every((v)=>v._zod.pattern)){let v=w.options.map((J)=>J._zod.pattern);return new RegExp(`^(${v.map((J)=>h1(J.source)).join("|")})$`)}return});let U=w.options.length===1?w.options[0]._zod.run:null;$._zod.parse=(v,J)=>{if(U)return U(v,J);let z=!1,g=[];for(let V of w.options){let _=V._zod.run({value:v.value,issues:[]},J);if(_ instanceof Promise)g.push(_),z=!0;else{if(_.issues.length===0)return _;g.push(_)}}if(!z)return C3(g,v,$,J);return Promise.all(g).then((V)=>{return C3(V,v,$,J)})}});function j3($,w,U,v){let J=$.filter((z)=>z.issues.length===0);if(J.length===1)return w.value=J[0].value,w;if(J.length===0)w.issues.push({code:"invalid_union",input:w.value,inst:U,errors:$.map((z)=>z.issues.map((g)=>Z$(g,v,g$())))});else w.issues.push({code:"invalid_union",input:w.value,inst:U,errors:[],inclusive:!1});return w}var sV=B("$ZodXor",($,w)=>{UJ.init($,w),w.inclusive=!1;let U=w.options.length===1?w.options[0]._zod.run:null;$._zod.parse=(v,J)=>{if(U)return U(v,J);let z=!1,g=[];for(let V of w.options){let _=V._zod.run({value:v.value,issues:[]},J);if(_ instanceof Promise)g.push(_),z=!0;else g.push(_)}if(!z)return j3(g,v,$,J);return Promise.all(g).then((V)=>{return j3(V,v,$,J)})}}),$G=B("$ZodDiscriminatedUnion",($,w)=>{w.inclusive=!1,UJ.init($,w);let U=$._zod.parse;n($._zod,"propValues",()=>{let J={};for(let z of w.options){let g=z._zod.propValues;if(!g||Object.keys(g).length===0)throw Error(`Invalid discriminated union option at index "${w.options.indexOf(z)}"`);for(let[V,_]of Object.entries(g)){if(!J[V])J[V]=new Set;for(let G of _)J[V].add(G)}}return J});let v=fw(()=>{let J=w.options,z=new Map;for(let g of J){let V=g._zod.propValues?.[w.discriminator];if(!V||V.size===0)throw Error(`Invalid discriminated union option at index "${w.options.indexOf(g)}"`);for(let _ of V){if(z.has(_))throw Error(`Duplicate discriminator value "${String(_)}"`);z.set(_,g)}}return z});$._zod.parse=(J,z)=>{let g=J.value;if(!F6(g))return J.issues.push({code:"invalid_type",expected:"object",input:g,inst:$}),J;let V=v.value.get(g?.[w.discriminator]);if(V)return V._zod.run(J,z);if(w.unionFallback||z.direction==="backward")return U(J,z);return J.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:w.discriminator,options:Array.from(v.value.keys()),input:g,path:[w.discriminator],inst:$}),J}}),wG=B("$ZodIntersection",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{let J=U.value,z=w.left._zod.run({value:J,issues:[]},v),g=w.right._zod.run({value:J,issues:[]},v);if(z instanceof Promise||g instanceof Promise)return Promise.all([z,g]).then(([_,G])=>{return x3(U,_,G)});return x3(U,z,g)}});function YV($,w){if($===w)return{valid:!0,data:$};if($ instanceof Date&&w instanceof Date&&+$===+w)return{valid:!0,data:$};if(m4($)&&m4(w)){let U=Object.keys(w),v=Object.keys($).filter((z)=>U.indexOf(z)!==-1),J={...$,...w};for(let z of v){let g=YV($[z],w[z]);if(!g.valid)return{valid:!1,mergeErrorPath:[z,...g.mergeErrorPath]};J[z]=g.data}return{valid:!0,data:J}}if(Array.isArray($)&&Array.isArray(w)){if($.length!==w.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let v=0;v<$.length;v++){let J=$[v],z=w[v],g=YV(J,z);if(!g.valid)return{valid:!1,mergeErrorPath:[v,...g.mergeErrorPath]};U.push(g.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function x3($,w,U){let v=new Map,J;for(let V of w.issues)if(V.code==="unrecognized_keys"){J??(J=V);for(let _ of V.keys){if(!v.has(_))v.set(_,{});v.get(_).l=!0}}else $.issues.push(V);for(let V of U.issues)if(V.code==="unrecognized_keys")for(let _ of V.keys){if(!v.has(_))v.set(_,{});v.get(_).r=!0}else $.issues.push(V);let z=[...v].filter(([,V])=>V.l&&V.r).map(([V])=>V);if(z.length&&J)$.issues.push({...J,keys:z});if(n4($))return $;let g=YV(w.value,U.value);if(!g.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(g.mergeErrorPath)}`);return $.value=g.data,$}var wv=B("$ZodTuple",($,w)=>{d.init($,w);let U=w.items;$._zod.parse=(v,J)=>{let z=v.value;if(!Array.isArray(z))return v.issues.push({input:z,inst:$,expected:"tuple",code:"invalid_type"}),v;v.value=[];let g=[],V=r3(U,"optin"),_=r3(U,"optout");if(!w.rest){if(z.length<V)return v.issues.push({code:"too_small",minimum:V,inclusive:!0,input:z,inst:$,origin:"array"}),v;if(z.length>U.length)v.issues.push({code:"too_big",maximum:U.length,inclusive:!0,input:z,inst:$,origin:"array"})}let G=Array(U.length);for(let X=0;X<U.length;X++){let I=U[X]._zod.run({value:z[X],issues:[]},J);if(I instanceof Promise)g.push(I.then((N)=>{G[X]=N}));else G[X]=I}if(w.rest){let X=U.length-1,I=z.slice(U.length);for(let N of I){X++;let W=w.rest._zod.run({value:N,issues:[]},J);if(W instanceof Promise)g.push(W.then((P)=>y3(P,v,X)));else y3(W,v,X)}}if(g.length)return Promise.all(g).then(()=>d3(G,v,U,z,_));return d3(G,v,U,z,_)}});function r3($,w){for(let U=$.length-1;U>=0;U--)if($[U]._zod[w]!=="optional")return U+1;return 0}function y3($,w,U){if($.issues.length)w.issues.push(...M$(U,$.issues));w.value[U]=$.value}function d3($,w,U,v,J){for(let z=0;z<U.length;z++){let g=$[z],V=z<v.length;if(g.issues.length){if(!V&&z>=J){w.value.length=z;break}w.issues.push(...M$(z,g.issues))}w.value[z]=g.value}for(let z=w.value.length-1;z>=v.length;z--)if(U[z]._zod.optout==="optional"&&w.value[z]===void 0)w.value.length=z;else break;return w}var UG=B("$ZodRecord",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{let J=U.value;if(!m4(J))return U.issues.push({expected:"record",code:"invalid_type",input:J,inst:$}),U;let z=[],g=w.keyType._zod.values;if(g){U.value={};let V=new Set;for(let G of g)if(typeof G==="string"||typeof G==="number"||typeof G==="symbol"){V.add(typeof G==="number"?G.toString():G);let X=w.keyType._zod.run({value:G,issues:[]},v);if(X instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(X.issues.length){U.issues.push({code:"invalid_key",origin:"record",issues:X.issues.map((W)=>Z$(W,v,g$())),input:G,path:[G],inst:$});continue}let I=X.value,N=w.valueType._zod.run({value:J[G],issues:[]},v);if(N instanceof Promise)z.push(N.then((W)=>{if(W.issues.length)U.issues.push(...M$(G,W.issues));U.value[I]=W.value}));else{if(N.issues.length)U.issues.push(...M$(G,N.issues));U.value[I]=N.value}}let _;for(let G in J)if(!V.has(G))_=_??[],_.push(G);if(_&&_.length>0)U.issues.push({code:"unrecognized_keys",input:J,inst:$,keys:_})}else{U.value={};for(let V of Reflect.ownKeys(J)){if(V==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(J,V))continue;let _=w.keyType._zod.run({value:V,issues:[]},v);if(_ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof V==="string"&&e1.test(V)&&_.issues.length){let I=w.keyType._zod.run({value:Number(V),issues:[]},v);if(I instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(I.issues.length===0)_=I}if(_.issues.length){if(w.mode==="loose")U.value[V]=J[V];else U.issues.push({code:"invalid_key",origin:"record",issues:_.issues.map((I)=>Z$(I,v,g$())),input:V,path:[V],inst:$});continue}let X=w.valueType._zod.run({value:J[V],issues:[]},v);if(X instanceof Promise)z.push(X.then((I)=>{if(I.issues.length)U.issues.push(...M$(V,I.issues));U.value[_.value]=I.value}));else{if(X.issues.length)U.issues.push(...M$(V,X.issues));U.value[_.value]=X.value}}}if(z.length)return Promise.all(z).then(()=>U);return U}}),JG=B("$ZodMap",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{let J=U.value;if(!(J instanceof Map))return U.issues.push({expected:"map",code:"invalid_type",input:J,inst:$}),U;let z=[];U.value=new Map;for(let[g,V]of J){let _=w.keyType._zod.run({value:g,issues:[]},v),G=w.valueType._zod.run({value:V,issues:[]},v);if(_ instanceof Promise||G instanceof Promise)z.push(Promise.all([_,G]).then(([X,I])=>{m3(X,I,U,g,J,$,v)}));else m3(_,G,U,g,J,$,v)}if(z.length)return Promise.all(z).then(()=>U);return U}});function m3($,w,U,v,J,z,g){if($.issues.length)if(c1.has(typeof v))U.issues.push(...M$(v,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:J,inst:z,issues:$.issues.map((V)=>Z$(V,g,g$()))});if(w.issues.length)if(c1.has(typeof v))U.issues.push(...M$(v,w.issues));else U.issues.push({origin:"map",code:"invalid_element",input:J,inst:z,key:v,issues:w.issues.map((V)=>Z$(V,g,g$()))});U.value.set($.value,w.value)}var vG=B("$ZodSet",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{let J=U.value;if(!(J instanceof Set))return U.issues.push({input:J,inst:$,expected:"set",code:"invalid_type"}),U;let z=[];U.value=new Set;for(let g of J){let V=w.valueType._zod.run({value:g,issues:[]},v);if(V instanceof Promise)z.push(V.then((_)=>n3(_,U)));else n3(V,U)}if(z.length)return Promise.all(z).then(()=>U);return U}});function n3($,w){if($.issues.length)w.issues.push(...$.issues);w.value.add($.value)}var zG=B("$ZodEnum",($,w)=>{d.init($,w);let U=n1(w.entries),v=new Set(U);$._zod.values=v,$._zod.pattern=new RegExp(`^(${U.filter((J)=>c1.has(typeof J)).map((J)=>typeof J==="string"?n$(J):J.toString()).join("|")})$`),$._zod.parse=(J,z)=>{let g=J.value;if(v.has(g))return J;return J.issues.push({code:"invalid_value",values:U,input:g,inst:$}),J}}),gG=B("$ZodLiteral",($,w)=>{if(d.init($,w),w.values.length===0)throw Error("Cannot create literal schema with no valid values");let U=new Set(w.values);$._zod.values=U,$._zod.pattern=new RegExp(`^(${w.values.map((v)=>typeof v==="string"?n$(v):v?n$(v.toString()):String(v)).join("|")})$`),$._zod.parse=(v,J)=>{let z=v.value;if(U.has(z))return v;return v.issues.push({code:"invalid_value",values:w.values,input:z,inst:$}),v}}),VG=B("$ZodFile",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{let J=U.value;if(J instanceof File)return U;return U.issues.push({expected:"file",code:"invalid_type",input:J,inst:$}),U}}),GG=B("$ZodTransform",($,w)=>{d.init($,w),$._zod.optin="optional",$._zod.parse=(U,v)=>{if(v.direction==="backward")throw new b6($.constructor.name);let J=w.transform(U.value,U);if(v.async)return(J instanceof Promise?J:Promise.resolve(J)).then((g)=>{return U.value=g,U.fallback=!0,U});if(J instanceof Promise)throw new V4;return U.value=J,U.fallback=!0,U}});function h3($,w){if(w===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}var Uv=B("$ZodOptional",($,w)=>{d.init($,w),$._zod.optin="optional",$._zod.optout="optional",n($._zod,"values",()=>{return w.innerType._zod.values?new Set([...w.innerType._zod.values,void 0]):void 0}),n($._zod,"pattern",()=>{let U=w.innerType._zod.pattern;return U?new RegExp(`^(${h1(U.source)})?$`):void 0}),$._zod.parse=(U,v)=>{if(w.innerType._zod.optin==="optional"){let J=U.value,z=w.innerType._zod.run(U,v);if(z instanceof Promise)return z.then((g)=>h3(g,J));return h3(z,J)}if(U.value===void 0)return U;return w.innerType._zod.run(U,v)}}),_G=B("$ZodExactOptional",($,w)=>{Uv.init($,w),n($._zod,"values",()=>w.innerType._zod.values),n($._zod,"pattern",()=>w.innerType._zod.pattern),$._zod.parse=(U,v)=>{return w.innerType._zod.run(U,v)}}),XG=B("$ZodNullable",($,w)=>{d.init($,w),n($._zod,"optin",()=>w.innerType._zod.optin),n($._zod,"optout",()=>w.innerType._zod.optout),n($._zod,"pattern",()=>{let U=w.innerType._zod.pattern;return U?new RegExp(`^(${h1(U.source)}|null)$`):void 0}),n($._zod,"values",()=>{return w.innerType._zod.values?new Set([...w.innerType._zod.values,null]):void 0}),$._zod.parse=(U,v)=>{if(U.value===null)return U;return w.innerType._zod.run(U,v)}}),IG=B("$ZodDefault",($,w)=>{d.init($,w),$._zod.optin="optional",n($._zod,"values",()=>w.innerType._zod.values),$._zod.parse=(U,v)=>{if(v.direction==="backward")return w.innerType._zod.run(U,v);if(U.value===void 0)return U.value=w.defaultValue,U;let J=w.innerType._zod.run(U,v);if(J instanceof Promise)return J.then((z)=>c3(z,w));return c3(J,w)}});function c3($,w){if($.value===void 0)$.value=w.defaultValue;return $}var NG=B("$ZodPrefault",($,w)=>{d.init($,w),$._zod.optin="optional",n($._zod,"values",()=>w.innerType._zod.values),$._zod.parse=(U,v)=>{if(v.direction==="backward")return w.innerType._zod.run(U,v);if(U.value===void 0)U.value=w.defaultValue;return w.innerType._zod.run(U,v)}}),WG=B("$ZodNonOptional",($,w)=>{d.init($,w),n($._zod,"values",()=>{let U=w.innerType._zod.values;return U?new Set([...U].filter((v)=>v!==void 0)):void 0}),$._zod.parse=(U,v)=>{let J=w.innerType._zod.run(U,v);if(J instanceof Promise)return J.then((z)=>l3(z,$));return l3(J,$)}});function l3($,w){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:w});return $}var YG=B("$ZodSuccess",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{if(v.direction==="backward")throw new b6("ZodSuccess");let J=w.innerType._zod.run(U,v);if(J instanceof Promise)return J.then((z)=>{return U.value=z.issues.length===0,U});return U.value=J.issues.length===0,U}}),QG=B("$ZodCatch",($,w)=>{d.init($,w),$._zod.optin="optional",n($._zod,"optout",()=>w.innerType._zod.optout),n($._zod,"values",()=>w.innerType._zod.values),$._zod.parse=(U,v)=>{if(v.direction==="backward")return w.innerType._zod.run(U,v);let J=w.innerType._zod.run(U,v);if(J instanceof Promise)return J.then((z)=>{if(U.value=z.value,z.issues.length)U.value=w.catchValue({...U,error:{issues:z.issues.map((g)=>Z$(g,v,g$()))},input:U.value}),U.issues=[],U.fallback=!0;return U});if(U.value=J.value,J.issues.length)U.value=w.catchValue({...U,error:{issues:J.issues.map((z)=>Z$(z,v,g$()))},input:U.value}),U.issues=[],U.fallback=!0;return U}}),PG=B("$ZodNaN",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{if(typeof U.value!=="number"||!Number.isNaN(U.value))return U.issues.push({input:U.value,inst:$,expected:"nan",code:"invalid_type"}),U;return U}}),Jv=B("$ZodPipe",($,w)=>{d.init($,w),n($._zod,"values",()=>w.in._zod.values),n($._zod,"optin",()=>w.in._zod.optin),n($._zod,"optout",()=>w.out._zod.optout),n($._zod,"propValues",()=>w.in._zod.propValues),$._zod.parse=(U,v)=>{if(v.direction==="backward"){let z=w.out._zod.run(U,v);if(z instanceof Promise)return z.then((g)=>o0(g,w.in,v));return o0(z,w.in,v)}let J=w.in._zod.run(U,v);if(J instanceof Promise)return J.then((z)=>o0(z,w.out,v));return o0(J,w.out,v)}});function o0($,w,U){if($.issues.length)return $.aborted=!0,$;return w._zod.run({value:$.value,issues:$.issues,fallback:$.fallback},U)}var JJ=B("$ZodCodec",($,w)=>{d.init($,w),n($._zod,"values",()=>w.in._zod.values),n($._zod,"optin",()=>w.in._zod.optin),n($._zod,"optout",()=>w.out._zod.optout),n($._zod,"propValues",()=>w.in._zod.propValues),$._zod.parse=(U,v)=>{if((v.direction||"forward")==="forward"){let z=w.in._zod.run(U,v);if(z instanceof Promise)return z.then((g)=>p0(g,w,v));return p0(z,w,v)}else{let z=w.out._zod.run(U,v);if(z instanceof Promise)return z.then((g)=>p0(g,w,v));return p0(z,w,v)}}});function p0($,w,U){if($.issues.length)return $.aborted=!0,$;if((U.direction||"forward")==="forward"){let J=w.transform($.value,$);if(J instanceof Promise)return J.then((z)=>a0($,z,w.out,U));return a0($,J,w.out,U)}else{let J=w.reverseTransform($.value,$);if(J instanceof Promise)return J.then((z)=>a0($,z,w.in,U));return a0($,J,w.in,U)}}function a0($,w,U,v){if($.issues.length)return $.aborted=!0,$;return U._zod.run({value:w,issues:$.issues},v)}var OG=B("$ZodPreprocess",($,w)=>{Jv.init($,w)}),BG=B("$ZodReadonly",($,w)=>{d.init($,w),n($._zod,"propValues",()=>w.innerType._zod.propValues),n($._zod,"values",()=>w.innerType._zod.values),n($._zod,"optin",()=>w.innerType?._zod?.optin),n($._zod,"optout",()=>w.innerType?._zod?.optout),$._zod.parse=(U,v)=>{if(v.direction==="backward")return w.innerType._zod.run(U,v);let J=w.innerType._zod.run(U,v);if(J instanceof Promise)return J.then(t3);return t3(J)}});function t3($){return $.value=Object.freeze($.value),$}var qG=B("$ZodTemplateLiteral",($,w)=>{d.init($,w);let U=[];for(let v of w.parts)if(typeof v==="object"&&v!==null){if(!v._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...v._zod.traits].shift()}`);let J=v._zod.pattern instanceof RegExp?v._zod.pattern.source:v._zod.pattern;if(!J)throw Error(`Invalid template literal part: ${v._zod.traits}`);let z=J.startsWith("^")?1:0,g=J.endsWith("$")?J.length-1:J.length;U.push(J.slice(z,g))}else if(v===null||Ig.has(typeof v))U.push(n$(`${v}`));else throw Error(`Invalid template literal part: ${v}`);$._zod.pattern=new RegExp(`^${U.join("")}$`),$._zod.parse=(v,J)=>{if(typeof v.value!=="string")return v.issues.push({input:v.value,inst:$,expected:"string",code:"invalid_type"}),v;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(v.value))return v.issues.push({input:v.value,inst:$,code:"invalid_format",format:w.format??"template_literal",pattern:$._zod.pattern.source}),v;return v}}),LG=B("$ZodFunction",($,w)=>{return d.init($,w),$._def=w,$._zod.def=w,$.implement=(U)=>{if(typeof U!=="function")throw Error("implement() must be called with a function");return function(...v){let J=$._def.input?R0($._def.input,v):v,z=Reflect.apply(U,this,J);if($._def.output)return R0($._def.output,z);return z}},$.implementAsync=(U)=>{if(typeof U!=="function")throw Error("implementAsync() must be called with a function");return async function(...v){let J=$._def.input?await k0($._def.input,v):v,z=await Reflect.apply(U,this,J);if($._def.output)return await k0($._def.output,z);return z}},$._zod.parse=(U,v)=>{if(typeof U.value!=="function")return U.issues.push({code:"invalid_type",expected:"function",input:U.value,inst:$}),U;if($._def.output&&$._def.output._zod.def.type==="promise")U.value=$.implementAsync(U.value);else U.value=$.implement(U.value);return U},$.input=(...U)=>{let v=$.constructor;if(Array.isArray(U[0]))return new v({type:"function",input:new wv({type:"tuple",items:U[0],rest:U[1]}),output:$._def.output});return new v({type:"function",input:U[0],output:$._def.output})},$.output=(U)=>{return new $.constructor({type:"function",input:$._def.input,output:U})},$}),HG=B("$ZodPromise",($,w)=>{d.init($,w),$._zod.parse=(U,v)=>{return Promise.resolve(U.value).then((J)=>w.innerType._zod.run({value:J,issues:[]},v))}}),uG=B("$ZodLazy",($,w)=>{d.init($,w),n($._zod,"innerType",()=>{let U=w;if(!U._cachedInner)U._cachedInner=w.getter();return U._cachedInner}),n($._zod,"pattern",()=>$._zod.innerType?._zod?.pattern),n($._zod,"propValues",()=>$._zod.innerType?._zod?.propValues),n($._zod,"optin",()=>$._zod.innerType?._zod?.optin??void 0),n($._zod,"optout",()=>$._zod.innerType?._zod?.optout??void 0),$._zod.parse=(U,v)=>{return $._zod.innerType._zod.run(U,v)}}),KG=B("$ZodCustom",($,w)=>{$$.init($,w),d.init($,w),$._zod.parse=(U,v)=>{return U},$._zod.check=(U)=>{let v=U.value,J=w.fn(v);if(J instanceof Promise)return J.then((z)=>o3(z,U,v,$));o3(J,U,v,$);return}});function o3($,w,U,v){if(!$){let J={code:"custom",input:U,inst:v,path:[...v._zod.def.path??[]],continue:!v._zod.def.abort};if(v._zod.def.params)J.params=v._zod.def.params;w.issues.push(Tw(J))}}var GJ={};Y4(GJ,{zhTW:()=>O_,zhCN:()=>P_,yo:()=>B_,vi:()=>Q_,uz:()=>Y_,ur:()=>W_,uk:()=>VJ,ua:()=>N_,tr:()=>I_,th:()=>X_,ta:()=>__,sv:()=>G_,sl:()=>V_,ru:()=>g_,ro:()=>z_,pt:()=>v_,ps:()=>U_,pl:()=>J_,ota:()=>w_,no:()=>$_,nl:()=>sG,ms:()=>eG,mk:()=>aG,lt:()=>pG,ko:()=>oG,km:()=>zJ,kh:()=>tG,ka:()=>lG,ja:()=>cG,it:()=>hG,is:()=>nG,id:()=>mG,hy:()=>dG,hu:()=>yG,hr:()=>rG,he:()=>xG,frCA:()=>jG,fr:()=>CG,fi:()=>kG,fa:()=>RG,es:()=>AG,eo:()=>SG,en:()=>vJ,el:()=>EG,de:()=>iG,da:()=>MG,cs:()=>FG,ca:()=>bG,bg:()=>ZG,be:()=>TG,az:()=>fG,ar:()=>DG});var wL=()=>{let $={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function w(J){return $[J]??null}let U={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},v={nan:"NaN"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${J.expected}، ولكن تم إدخال ${V}`;return`مدخلات غير مقبولة: يفترض إدخال ${z}، ولكن تم إدخال ${V}`}case"invalid_value":if(J.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${K(J.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return` أكبر من اللازم: يفترض أن تكون ${J.origin??"القيمة"} ${z} ${J.maximum.toString()} ${g.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${J.origin??"القيمة"} ${z} ${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`أصغر من اللازم: يفترض لـ ${J.origin} أن يكون ${z} ${J.minimum.toString()} ${g.unit}`;return`أصغر من اللازم: يفترض لـ ${J.origin} أن يكون ${z} ${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${J.prefix}"`;if(z.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${z.suffix}"`;if(z.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${z.includes}"`;if(z.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${z.pattern}`;return`${U[z.format]??J.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${J.divisor}`;case"unrecognized_keys":return`معرف${J.keys.length>1?"ات":""} غريب${J.keys.length>1?"ة":""}: ${L(J.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${J.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${J.origin}`;default:return"مدخل غير مقبول"}}};function DG(){return{localeError:wL()}}var UL=()=>{let $={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function w(J){return $[J]??null}let 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"},v={nan:"NaN"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Yanlış dəyər: gözlənilən instanceof ${J.expected}, daxil olan ${V}`;return`Yanlış dəyər: gözlənilən ${z}, daxil olan ${V}`}case"invalid_value":if(J.values.length===1)return`Yanlış dəyər: gözlənilən ${K(J.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Çox böyük: gözlənilən ${J.origin??"dəyər"} ${z}${J.maximum.toString()} ${g.unit??"element"}`;return`Çox böyük: gözlənilən ${J.origin??"dəyər"} ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Çox kiçik: gözlənilən ${J.origin} ${z}${J.minimum.toString()} ${g.unit}`;return`Çox kiçik: gözlənilən ${J.origin} ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Yanlış mətn: "${z.prefix}" ilə başlamalıdır`;if(z.format==="ends_with")return`Yanlış mətn: "${z.suffix}" ilə bitməlidir`;if(z.format==="includes")return`Yanlış mətn: "${z.includes}" daxil olmalıdır`;if(z.format==="regex")return`Yanlış mətn: ${z.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${U[z.format]??J.format}`}case"not_multiple_of":return`Yanlış ədəd: ${J.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${J.keys.length>1?"lar":""}: ${L(J.keys,", ")}`;case"invalid_key":return`${J.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${J.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function fG(){return{localeError:UL()}}function w9($,w,U,v){let J=Math.abs($),z=J%10,g=J%100;if(g>=11&&g<=19)return v;if(z===1)return w;if(z>=2&&z<=4)return U;return v}var JL=()=>{let $={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function w(J){return $[J]??null}let U={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},v={nan:"NaN",number:"лік",array:"масіў"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Няправільны ўвод: чакаўся instanceof ${J.expected}, атрымана ${V}`;return`Няправільны ўвод: чакаўся ${z}, атрымана ${V}`}case"invalid_value":if(J.values.length===1)return`Няправільны ўвод: чакалася ${K(J.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g){let V=Number(J.maximum),_=w9(V,g.unit.one,g.unit.few,g.unit.many);return`Занадта вялікі: чакалася, што ${J.origin??"значэнне"} павінна ${g.verb} ${z}${J.maximum.toString()} ${_}`}return`Занадта вялікі: чакалася, што ${J.origin??"значэнне"} павінна быць ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g){let V=Number(J.minimum),_=w9(V,g.unit.one,g.unit.few,g.unit.many);return`Занадта малы: чакалася, што ${J.origin} павінна ${g.verb} ${z}${J.minimum.toString()} ${_}`}return`Занадта малы: чакалася, што ${J.origin} павінна быць ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${z.prefix}"`;if(z.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${z.suffix}"`;if(z.format==="includes")return`Няправільны радок: павінен змяшчаць "${z.includes}"`;if(z.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${z.pattern}`;return`Няправільны ${U[z.format]??J.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${J.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${J.keys.length>1?"ключы":"ключ"}: ${L(J.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${J.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${J.origin}`;default:return"Няправільны ўвод"}}};function TG(){return{localeError:JL()}}var vL=()=>{let $={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function w(J){return $[J]??null}let U={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},v={nan:"NaN",number:"число",array:"масив"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Невалиден вход: очакван instanceof ${J.expected}, получен ${V}`;return`Невалиден вход: очакван ${z}, получен ${V}`}case"invalid_value":if(J.values.length===1)return`Невалиден вход: очакван ${K(J.values[0])}`;return`Невалидна опция: очаквано едно от ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Твърде голямо: очаква се ${J.origin??"стойност"} да съдържа ${z}${J.maximum.toString()} ${g.unit??"елемента"}`;return`Твърде голямо: очаква се ${J.origin??"стойност"} да бъде ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Твърде малко: очаква се ${J.origin} да съдържа ${z}${J.minimum.toString()} ${g.unit}`;return`Твърде малко: очаква се ${J.origin} да бъде ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Невалиден низ: трябва да започва с "${z.prefix}"`;if(z.format==="ends_with")return`Невалиден низ: трябва да завършва с "${z.suffix}"`;if(z.format==="includes")return`Невалиден низ: трябва да включва "${z.includes}"`;if(z.format==="regex")return`Невалиден низ: трябва да съвпада с ${z.pattern}`;let g="Невалиден";if(z.format==="emoji")g="Невалидно";if(z.format==="datetime")g="Невалидно";if(z.format==="date")g="Невалидна";if(z.format==="time")g="Невалидно";if(z.format==="duration")g="Невалидна";return`${g} ${U[z.format]??J.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${J.divisor}`;case"unrecognized_keys":return`Неразпознат${J.keys.length>1?"и":""} ключ${J.keys.length>1?"ове":""}: ${L(J.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${J.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${J.origin}`;default:return"Невалиден вход"}}};function ZG(){return{localeError:vL()}}var zL=()=>{let $={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function w(J){return $[J]??null}let U={regex:"entrada",email:"adreça electrònica",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ça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},v={nan:"NaN"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Tipus invàlid: s'esperava instanceof ${J.expected}, s'ha rebut ${V}`;return`Tipus invàlid: s'esperava ${z}, s'ha rebut ${V}`}case"invalid_value":if(J.values.length===1)return`Valor invàlid: s'esperava ${K(J.values[0])}`;return`Opció invàlida: s'esperava una de ${L(J.values," o ")}`;case"too_big":{let z=J.inclusive?"com a màxim":"menys de",g=w(J.origin);if(g)return`Massa gran: s'esperava que ${J.origin??"el valor"} contingués ${z} ${J.maximum.toString()} ${g.unit??"elements"}`;return`Massa gran: s'esperava que ${J.origin??"el valor"} fos ${z} ${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?"com a mínim":"més de",g=w(J.origin);if(g)return`Massa petit: s'esperava que ${J.origin} contingués ${z} ${J.minimum.toString()} ${g.unit}`;return`Massa petit: s'esperava que ${J.origin} fos ${z} ${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Format invàlid: ha de començar amb "${z.prefix}"`;if(z.format==="ends_with")return`Format invàlid: ha d'acabar amb "${z.suffix}"`;if(z.format==="includes")return`Format invàlid: ha d'incloure "${z.includes}"`;if(z.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${z.pattern}`;return`Format invàlid per a ${U[z.format]??J.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${J.divisor}`;case"unrecognized_keys":return`Clau${J.keys.length>1?"s":""} no reconeguda${J.keys.length>1?"s":""}: ${L(J.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${J.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${J.origin}`;default:return"Entrada invàlida"}}};function bG(){return{localeError:zL()}}var gL=()=>{let $={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function w(J){return $[J]??null}let U={regex:"regulární výraz",email:"e-mailová 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 čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},v={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Neplatný vstup: očekáváno instanceof ${J.expected}, obdrženo ${V}`;return`Neplatný vstup: očekáváno ${z}, obdrženo ${V}`}case"invalid_value":if(J.values.length===1)return`Neplatný vstup: očekáváno ${K(J.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Hodnota je příliš velká: ${J.origin??"hodnota"} musí mít ${z}${J.maximum.toString()} ${g.unit??"prvků"}`;return`Hodnota je příliš velká: ${J.origin??"hodnota"} musí být ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Hodnota je příliš malá: ${J.origin??"hodnota"} musí mít ${z}${J.minimum.toString()} ${g.unit??"prvků"}`;return`Hodnota je příliš malá: ${J.origin??"hodnota"} musí být ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Neplatný řetězec: musí začínat na "${z.prefix}"`;if(z.format==="ends_with")return`Neplatný řetězec: musí končit na "${z.suffix}"`;if(z.format==="includes")return`Neplatný řetězec: musí obsahovat "${z.includes}"`;if(z.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${z.pattern}`;return`Neplatný formát ${U[z.format]??J.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${J.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${L(J.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${J.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${J.origin}`;default:return"Neplatný vstup"}}};function FG(){return{localeError:gL()}}var VL=()=>{let $={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function w(J){return $[J]??null}let U={regex:"input",email:"e-mailadresse",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 klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},v={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Ugyldigt input: forventede instanceof ${J.expected}, fik ${V}`;return`Ugyldigt input: forventede ${z}, fik ${V}`}case"invalid_value":if(J.values.length===1)return`Ugyldig værdi: forventede ${K(J.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin),V=v[J.origin]??J.origin;if(g)return`For stor: forventede ${V??"value"} ${g.verb} ${z} ${J.maximum.toString()} ${g.unit??"elementer"}`;return`For stor: forventede ${V??"value"} havde ${z} ${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin),V=v[J.origin]??J.origin;if(g)return`For lille: forventede ${V} ${g.verb} ${z} ${J.minimum.toString()} ${g.unit}`;return`For lille: forventede ${V} havde ${z} ${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Ugyldig streng: skal starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: skal ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: skal indeholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: skal matche mønsteret ${z.pattern}`;return`Ugyldig ${U[z.format]??J.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${J.divisor}`;case"unrecognized_keys":return`${J.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${L(J.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${J.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${J.origin}`;default:return"Ugyldigt input"}}};function MG(){return{localeError:VL()}}var GL=()=>{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 w(J){return $[J]??null}let 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"},v={nan:"NaN",number:"Zahl",array:"Array"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Ungültige Eingabe: erwartet instanceof ${J.expected}, erhalten ${V}`;return`Ungültige Eingabe: erwartet ${z}, erhalten ${V}`}case"invalid_value":if(J.values.length===1)return`Ungültige Eingabe: erwartet ${K(J.values[0])}`;return`Ungültige Option: erwartet eine von ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Zu groß: erwartet, dass ${J.origin??"Wert"} ${z}${J.maximum.toString()} ${g.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${J.origin??"Wert"} ${z}${J.maximum.toString()} ist`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Zu klein: erwartet, dass ${J.origin} ${z}${J.minimum.toString()} ${g.unit} hat`;return`Zu klein: erwartet, dass ${J.origin} ${z}${J.minimum.toString()} ist`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Ungültiger String: muss mit "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ungültiger String: muss mit "${z.suffix}" enden`;if(z.format==="includes")return`Ungültiger String: muss "${z.includes}" enthalten`;if(z.format==="regex")return`Ungültiger String: muss dem Muster ${z.pattern} entsprechen`;return`Ungültig: ${U[z.format]??J.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${J.divisor} sein`;case"unrecognized_keys":return`${J.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${L(J.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${J.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${J.origin}`;default:return"Ungültige Eingabe"}}};function iG(){return{localeError:GL()}}var _L=()=>{let $={string:{unit:"χαρακτήρες",verb:"να έχει"},file:{unit:"bytes",verb:"να έχει"},array:{unit:"στοιχεία",verb:"να έχει"},set:{unit:"στοιχεία",verb:"να έχει"},map:{unit:"καταχωρήσεις",verb:"να έχει"}};function w(J){return $[J]??null}let U={regex:"είσοδος",email:"διεύθυνση 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:"ISO ημερομηνία και ώρα",date:"ISO ημερομηνία",time:"ISO ώρα",duration:"ISO διάρκεια",ipv4:"διεύθυνση IPv4",ipv6:"διεύθυνση IPv6",mac:"διεύθυνση MAC",cidrv4:"εύρος IPv4",cidrv6:"εύρος IPv6",base64:"συμβολοσειρά κωδικοποιημένη σε base64",base64url:"συμβολοσειρά κωδικοποιημένη σε base64url",json_string:"συμβολοσειρά JSON",e164:"αριθμός E.164",jwt:"JWT",template_literal:"είσοδος"},v={nan:"NaN"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(typeof J.expected==="string"&&/^[A-Z]/.test(J.expected))return`Μη έγκυρη είσοδος: αναμενόταν instanceof ${J.expected}, λήφθηκε ${V}`;return`Μη έγκυρη είσοδος: αναμενόταν ${z}, λήφθηκε ${V}`}case"invalid_value":if(J.values.length===1)return`Μη έγκυρη είσοδος: αναμενόταν ${K(J.values[0])}`;return`Μη έγκυρη επιλογή: αναμενόταν ένα από ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Πολύ μεγάλο: αναμενόταν ${J.origin??"τιμή"} να έχει ${z}${J.maximum.toString()} ${g.unit??"στοιχεία"}`;return`Πολύ μεγάλο: αναμενόταν ${J.origin??"τιμή"} να είναι ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Πολύ μικρό: αναμενόταν ${J.origin} να έχει ${z}${J.minimum.toString()} ${g.unit}`;return`Πολύ μικρό: αναμενόταν ${J.origin} να είναι ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${z.prefix}"`;if(z.format==="ends_with")return`Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${z.suffix}"`;if(z.format==="includes")return`Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${z.includes}"`;if(z.format==="regex")return`Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${z.pattern}`;return`Μη έγκυρο: ${U[z.format]??J.format}`}case"not_multiple_of":return`Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${J.divisor}`;case"unrecognized_keys":return`Άγνωστ${J.keys.length>1?"α":"ο"} κλειδ${J.keys.length>1?"ιά":"ί"}: ${L(J.keys,", ")}`;case"invalid_key":return`Μη έγκυρο κλειδί στο ${J.origin}`;case"invalid_union":return"Μη έγκυρη είσοδος";case"invalid_element":return`Μη έγκυρη τιμή στο ${J.origin}`;default:return"Μη έγκυρη είσοδος"}}};function EG(){return{localeError:_L()}}var XL=()=>{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"},map:{unit:"entries",verb:"to have"}};function w(J){return $[J]??null}let 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",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},v={nan:"NaN"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;return`Invalid input: expected ${z}, received ${V}`}case"invalid_value":if(J.values.length===1)return`Invalid input: expected ${K(J.values[0])}`;return`Invalid option: expected one of ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Too big: expected ${J.origin??"value"} to have ${z}${J.maximum.toString()} ${g.unit??"elements"}`;return`Too big: expected ${J.origin??"value"} to be ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Too small: expected ${J.origin} to have ${z}${J.minimum.toString()} ${g.unit}`;return`Too small: expected ${J.origin} to be ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Invalid string: must start with "${z.prefix}"`;if(z.format==="ends_with")return`Invalid string: must end with "${z.suffix}"`;if(z.format==="includes")return`Invalid string: must include "${z.includes}"`;if(z.format==="regex")return`Invalid string: must match pattern ${z.pattern}`;return`Invalid ${U[z.format]??J.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${J.divisor}`;case"unrecognized_keys":return`Unrecognized key${J.keys.length>1?"s":""}: ${L(J.keys,", ")}`;case"invalid_key":return`Invalid key in ${J.origin}`;case"invalid_union":if(J.options&&Array.isArray(J.options)&&J.options.length>0)return`Invalid discriminator value. Expected ${J.options.map((g)=>`'${g}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${J.origin}`;default:return"Invalid input"}}};function vJ(){return{localeError:XL()}}var IL=()=>{let $={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function w(J){return $[J]??null}let U={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},v={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Nevalida enigo: atendiĝis instanceof ${J.expected}, riceviĝis ${V}`;return`Nevalida enigo: atendiĝis ${z}, riceviĝis ${V}`}case"invalid_value":if(J.values.length===1)return`Nevalida enigo: atendiĝis ${K(J.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Tro granda: atendiĝis ke ${J.origin??"valoro"} havu ${z}${J.maximum.toString()} ${g.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${J.origin??"valoro"} havu ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Tro malgranda: atendiĝis ke ${J.origin} havu ${z}${J.minimum.toString()} ${g.unit}`;return`Tro malgranda: atendiĝis ke ${J.origin} estu ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${z.prefix}"`;if(z.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${z.suffix}"`;if(z.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${z.includes}"`;if(z.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${z.pattern}`;return`Nevalida ${U[z.format]??J.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${J.divisor}`;case"unrecognized_keys":return`Nekonata${J.keys.length>1?"j":""} ŝlosilo${J.keys.length>1?"j":""}: ${L(J.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${J.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${J.origin}`;default:return"Nevalida enigo"}}};function SG(){return{localeError:IL()}}var NL=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function w(J){return $[J]??null}let U={regex:"entrada",email:"dirección de correo electrónico",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ón ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},v={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Entrada inválida: se esperaba instanceof ${J.expected}, recibido ${V}`;return`Entrada inválida: se esperaba ${z}, recibido ${V}`}case"invalid_value":if(J.values.length===1)return`Entrada inválida: se esperaba ${K(J.values[0])}`;return`Opción inválida: se esperaba una de ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin),V=v[J.origin]??J.origin;if(g)return`Demasiado grande: se esperaba que ${V??"valor"} tuviera ${z}${J.maximum.toString()} ${g.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${V??"valor"} fuera ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin),V=v[J.origin]??J.origin;if(g)return`Demasiado pequeño: se esperaba que ${V} tuviera ${z}${J.minimum.toString()} ${g.unit}`;return`Demasiado pequeño: se esperaba que ${V} fuera ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Cadena inválida: debe comenzar con "${z.prefix}"`;if(z.format==="ends_with")return`Cadena inválida: debe terminar en "${z.suffix}"`;if(z.format==="includes")return`Cadena inválida: debe incluir "${z.includes}"`;if(z.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${z.pattern}`;return`Inválido ${U[z.format]??J.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${J.divisor}`;case"unrecognized_keys":return`Llave${J.keys.length>1?"s":""} desconocida${J.keys.length>1?"s":""}: ${L(J.keys,", ")}`;case"invalid_key":return`Llave inválida en ${v[J.origin]??J.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${v[J.origin]??J.origin}`;default:return"Entrada inválida"}}};function AG(){return{localeError:NL()}}var WL=()=>{let $={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function w(J){return $[J]??null}let U={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},v={nan:"NaN",number:"عدد",array:"آرایه"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`ورودی نامعتبر: میبایست instanceof ${J.expected} میبود، ${V} دریافت شد`;return`ورودی نامعتبر: میبایست ${z} میبود، ${V} دریافت شد`}case"invalid_value":if(J.values.length===1)return`ورودی نامعتبر: میبایست ${K(J.values[0])} میبود`;return`گزینه نامعتبر: میبایست یکی از ${L(J.values,"|")} میبود`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`خیلی بزرگ: ${J.origin??"مقدار"} باید ${z}${J.maximum.toString()} ${g.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${J.origin??"مقدار"} باید ${z}${J.maximum.toString()} باشد`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`خیلی کوچک: ${J.origin} باید ${z}${J.minimum.toString()} ${g.unit} باشد`;return`خیلی کوچک: ${J.origin} باید ${z}${J.minimum.toString()} باشد`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`رشته نامعتبر: باید با "${z.prefix}" شروع شود`;if(z.format==="ends_with")return`رشته نامعتبر: باید با "${z.suffix}" تمام شود`;if(z.format==="includes")return`رشته نامعتبر: باید شامل "${z.includes}" باشد`;if(z.format==="regex")return`رشته نامعتبر: باید با الگوی ${z.pattern} مطابقت داشته باشد`;return`${U[z.format]??J.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${J.divisor} باشد`;case"unrecognized_keys":return`کلید${J.keys.length>1?"های":""} ناشناس: ${L(J.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${J.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${J.origin}`;default:return"ورودی نامعتبر"}}};function RG(){return{localeError:WL()}}var YL=()=>{let $={string:{unit:"merkkiä",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äivämäärän"}};function w(J){return $[J]??null}let U={regex:"säännöllinen lauseke",email:"sähköpostiosoite",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äivämäärä",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"},v={nan:"NaN"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Virheellinen tyyppi: odotettiin instanceof ${J.expected}, oli ${V}`;return`Virheellinen tyyppi: odotettiin ${z}, oli ${V}`}case"invalid_value":if(J.values.length===1)return`Virheellinen syöte: täytyy olla ${K(J.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Liian suuri: ${g.subject} täytyy olla ${z}${J.maximum.toString()} ${g.unit}`.trim();return`Liian suuri: arvon täytyy olla ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Liian pieni: ${g.subject} täytyy olla ${z}${J.minimum.toString()} ${g.unit}`.trim();return`Liian pieni: arvon täytyy olla ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${z.prefix}"`;if(z.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${z.suffix}"`;if(z.format==="includes")return`Virheellinen syöte: täytyy sisältää "${z.includes}"`;if(z.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${z.pattern}`;return`Virheellinen ${U[z.format]??J.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${J.divisor} monikerta`;case"unrecognized_keys":return`${J.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${L(J.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öte"}}};function kG(){return{localeError:YL()}}var QL=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function w(J){return $[J]??null}let U={regex:"entrée",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ée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},v={string:"chaîne",number:"nombre",int:"entier",boolean:"booléen",bigint:"grand entier",symbol:"symbole",undefined:"indéfini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Entrée invalide : instanceof ${J.expected} attendu, ${V} reçu`;return`Entrée invalide : ${z} attendu, ${V} reçu`}case"invalid_value":if(J.values.length===1)return`Entrée invalide : ${K(J.values[0])} attendu`;return`Option invalide : une valeur parmi ${L(J.values,"|")} attendue`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Trop grand : ${v[J.origin]??"valeur"} doit ${g.verb} ${z}${J.maximum.toString()} ${g.unit??"élément(s)"}`;return`Trop grand : ${v[J.origin]??"valeur"} doit être ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Trop petit : ${v[J.origin]??"valeur"} doit ${g.verb} ${z}${J.minimum.toString()} ${g.unit}`;return`Trop petit : ${v[J.origin]??"valeur"} doit être ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${z.pattern}`;return`${U[z.format]??J.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${J.divisor}`;case"unrecognized_keys":return`Clé${J.keys.length>1?"s":""} non reconnue${J.keys.length>1?"s":""} : ${L(J.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${J.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${J.origin}`;default:return"Entrée invalide"}}};function CG(){return{localeError:QL()}}var PL=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function w(J){return $[J]??null}let U={regex:"entrée",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ée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},v={nan:"NaN"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Entrée invalide : attendu instanceof ${J.expected}, reçu ${V}`;return`Entrée invalide : attendu ${z}, reçu ${V}`}case"invalid_value":if(J.values.length===1)return`Entrée invalide : attendu ${K(J.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"≤":"<",g=w(J.origin);if(g)return`Trop grand : attendu que ${J.origin??"la valeur"} ait ${z}${J.maximum.toString()} ${g.unit}`;return`Trop grand : attendu que ${J.origin??"la valeur"} soit ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?"≥":">",g=w(J.origin);if(g)return`Trop petit : attendu que ${J.origin} ait ${z}${J.minimum.toString()} ${g.unit}`;return`Trop petit : attendu que ${J.origin} soit ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au motif ${z.pattern}`;return`${U[z.format]??J.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${J.divisor}`;case"unrecognized_keys":return`Clé${J.keys.length>1?"s":""} non reconnue${J.keys.length>1?"s":""} : ${L(J.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${J.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${J.origin}`;default:return"Entrée invalide"}}};function jG(){return{localeError:PL()}}var OL=()=>{let $={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},w={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},U=(G)=>G?$[G]:void 0,v=(G)=>{let X=U(G);if(X)return X.label;return G??$.unknown.label},J=(G)=>`ה${v(G)}`,z=(G)=>{return(U(G)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות"},g=(G)=>{if(!G)return null;return w[G]??null},V={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},_={nan:"NaN"};return(G)=>{switch(G.code){case"invalid_type":{let X=G.expected,I=_[X??""]??v(X),N=D(G.input),W=_[N]??$[N]?.label??N;if(/^[A-Z]/.test(G.expected))return`קלט לא תקין: צריך להיות instanceof ${G.expected}, התקבל ${W}`;return`קלט לא תקין: צריך להיות ${I}, התקבל ${W}`}case"invalid_value":{if(G.values.length===1)return`ערך לא תקין: הערך חייב להיות ${K(G.values[0])}`;let X=G.values.map((W)=>K(W));if(G.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${X[0]} או ${X[1]}`;let I=X[X.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${X.slice(0,-1).join(", ")} או ${I}`}case"too_big":{let X=g(G.origin),I=J(G.origin??"value");if(G.origin==="string")return`${X?.longLabel??"ארוך"} מדי: ${I} צריכה להכיל ${G.maximum.toString()} ${X?.unit??""} ${G.inclusive?"או פחות":"לכל היותר"}`.trim();if(G.origin==="number"){let P=G.inclusive?`קטן או שווה ל-${G.maximum}`:`קטן מ-${G.maximum}`;return`גדול מדי: ${I} צריך להיות ${P}`}if(G.origin==="array"||G.origin==="set"){let P=G.origin==="set"?"צריכה":"צריך",Q=G.inclusive?`${G.maximum} ${X?.unit??""} או פחות`:`פחות מ-${G.maximum} ${X?.unit??""}`;return`גדול מדי: ${I} ${P} להכיל ${Q}`.trim()}let N=G.inclusive?"<=":"<",W=z(G.origin??"value");if(X?.unit)return`${X.longLabel} מדי: ${I} ${W} ${N}${G.maximum.toString()} ${X.unit}`;return`${X?.longLabel??"גדול"} מדי: ${I} ${W} ${N}${G.maximum.toString()}`}case"too_small":{let X=g(G.origin),I=J(G.origin??"value");if(G.origin==="string")return`${X?.shortLabel??"קצר"} מדי: ${I} צריכה להכיל ${G.minimum.toString()} ${X?.unit??""} ${G.inclusive?"או יותר":"לפחות"}`.trim();if(G.origin==="number"){let P=G.inclusive?`גדול או שווה ל-${G.minimum}`:`גדול מ-${G.minimum}`;return`קטן מדי: ${I} צריך להיות ${P}`}if(G.origin==="array"||G.origin==="set"){let P=G.origin==="set"?"צריכה":"צריך";if(G.minimum===1&&G.inclusive){let H=G.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${I} ${P} להכיל ${H}`}let Q=G.inclusive?`${G.minimum} ${X?.unit??""} או יותר`:`יותר מ-${G.minimum} ${X?.unit??""}`;return`קטן מדי: ${I} ${P} להכיל ${Q}`.trim()}let N=G.inclusive?">=":">",W=z(G.origin??"value");if(X?.unit)return`${X.shortLabel} מדי: ${I} ${W} ${N}${G.minimum.toString()} ${X.unit}`;return`${X?.shortLabel??"קטן"} מדי: ${I} ${W} ${N}${G.minimum.toString()}`}case"invalid_format":{let X=G;if(X.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${X.prefix}"`;if(X.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${X.suffix}"`;if(X.format==="includes")return`המחרוזת חייבת לכלול "${X.includes}"`;if(X.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${X.pattern}`;let I=V[X.format],N=I?.label??X.format,P=(I?.gender??"m")==="f"?"תקינה":"תקין";return`${N} לא ${P}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${G.divisor}`;case"unrecognized_keys":return`מפתח${G.keys.length>1?"ות":""} לא מזוה${G.keys.length>1?"ים":"ה"}: ${L(G.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${J(G.origin??"array")}`;default:return"קלט לא תקין"}}};function xG(){return{localeError:OL()}}var BL=()=>{let $={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function w(J){return $[J]??null}let U={regex:"unos",email:"email 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:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},v={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Neispravan unos: očekuje se instanceof ${J.expected}, a primljeno je ${V}`;return`Neispravan unos: očekuje se ${z}, a primljeno je ${V}`}case"invalid_value":if(J.values.length===1)return`Neispravna vrijednost: očekivano ${K(J.values[0])}`;return`Neispravna opcija: očekivano jedno od ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin),V=v[J.origin]??J.origin;if(g)return`Preveliko: očekivano da ${V??"vrijednost"} ima ${z}${J.maximum.toString()} ${g.unit??"elemenata"}`;return`Preveliko: očekivano da ${V??"vrijednost"} bude ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin),V=v[J.origin]??J.origin;if(g)return`Premalo: očekivano da ${V} ima ${z}${J.minimum.toString()} ${g.unit}`;return`Premalo: očekivano da ${V} bude ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Neispravan tekst: mora započinjati s "${z.prefix}"`;if(z.format==="ends_with")return`Neispravan tekst: mora završavati s "${z.suffix}"`;if(z.format==="includes")return`Neispravan tekst: mora sadržavati "${z.includes}"`;if(z.format==="regex")return`Neispravan tekst: mora odgovarati uzorku ${z.pattern}`;return`Neispravna ${U[z.format]??J.format}`}case"not_multiple_of":return`Neispravan broj: mora biti višekratnik od ${J.divisor}`;case"unrecognized_keys":return`Neprepoznat${J.keys.length>1?"i ključevi":" ključ"}: ${L(J.keys,", ")}`;case"invalid_key":return`Neispravan ključ u ${v[J.origin]??J.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${v[J.origin]??J.origin}`;default:return"Neispravan unos"}}};function rG(){return{localeError:BL()}}var qL=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function w(J){return $[J]??null}let U={regex:"bemenet",email:"email cím",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őbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},v={nan:"NaN",number:"szám",array:"tömb"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Érvénytelen bemenet: a várt érték instanceof ${J.expected}, a kapott érték ${V}`;return`Érvénytelen bemenet: a várt érték ${z}, a kapott érték ${V}`}case"invalid_value":if(J.values.length===1)return`Érvénytelen bemenet: a várt érték ${K(J.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Túl nagy: ${J.origin??"érték"} mérete túl nagy ${z}${J.maximum.toString()} ${g.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${J.origin??"érték"} túl nagy: ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Túl kicsi: a bemeneti érték ${J.origin} mérete túl kicsi ${z}${J.minimum.toString()} ${g.unit}`;return`Túl kicsi: a bemeneti érték ${J.origin} túl kicsi ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Érvénytelen string: "${z.prefix}" értékkel kell kezdődnie`;if(z.format==="ends_with")return`Érvénytelen string: "${z.suffix}" értékkel kell végződnie`;if(z.format==="includes")return`Érvénytelen string: "${z.includes}" értéket kell tartalmaznia`;if(z.format==="regex")return`Érvénytelen string: ${z.pattern} mintának kell megfelelnie`;return`Érvénytelen ${U[z.format]??J.format}`}case"not_multiple_of":return`Érvénytelen szám: ${J.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${J.keys.length>1?"s":""}: ${L(J.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${J.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${J.origin}`;default:return"Érvénytelen bemenet"}}};function yG(){return{localeError:qL()}}function U9($,w,U){return Math.abs($)===1?w:U}function Ew($){if(!$)return"";let w=["ա","ե","ը","ի","ո","ու","օ"],U=$[$.length-1];return $+(w.includes(U)?"ն":"ը")}var LL=()=>{let $={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function w(J){return $[J]??null}let U={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},v={nan:"NaN",number:"թիվ",array:"զանգված"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${J.expected}, ստացվել է ${V}`;return`Սխալ մուտքագրում․ սպասվում էր ${z}, ստացվել է ${V}`}case"invalid_value":if(J.values.length===1)return`Սխալ մուտքագրում․ սպասվում էր ${K(J.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g){let V=Number(J.maximum),_=U9(V,g.unit.one,g.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${Ew(J.origin??"արժեք")} կունենա ${z}${J.maximum.toString()} ${_}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${Ew(J.origin??"արժեք")} լինի ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g){let V=Number(J.minimum),_=U9(V,g.unit.one,g.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${Ew(J.origin)} կունենա ${z}${J.minimum.toString()} ${_}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${Ew(J.origin)} լինի ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Սխալ տող․ պետք է սկսվի "${z.prefix}"-ով`;if(z.format==="ends_with")return`Սխալ տող․ պետք է ավարտվի "${z.suffix}"-ով`;if(z.format==="includes")return`Սխալ տող․ պետք է պարունակի "${z.includes}"`;if(z.format==="regex")return`Սխալ տող․ պետք է համապատասխանի ${z.pattern} ձևաչափին`;return`Սխալ ${U[z.format]??J.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${J.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${J.keys.length>1?"ներ":""}. ${L(J.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${Ew(J.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${Ew(J.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function dG(){return{localeError:LL()}}var HL=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function w(J){return $[J]??null}let 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"},v={nan:"NaN"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Input tidak valid: diharapkan instanceof ${J.expected}, diterima ${V}`;return`Input tidak valid: diharapkan ${z}, diterima ${V}`}case"invalid_value":if(J.values.length===1)return`Input tidak valid: diharapkan ${K(J.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Terlalu besar: diharapkan ${J.origin??"value"} memiliki ${z}${J.maximum.toString()} ${g.unit??"elemen"}`;return`Terlalu besar: diharapkan ${J.origin??"value"} menjadi ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Terlalu kecil: diharapkan ${J.origin} memiliki ${z}${J.minimum.toString()} ${g.unit}`;return`Terlalu kecil: diharapkan ${J.origin} menjadi ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`String tidak valid: harus dimulai dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak valid: harus berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak valid: harus menyertakan "${z.includes}"`;if(z.format==="regex")return`String tidak valid: harus sesuai pola ${z.pattern}`;return`${U[z.format]??J.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${J.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${J.keys.length>1?"s":""}: ${L(J.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${J.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${J.origin}`;default:return"Input tidak valid"}}};function mG(){return{localeError:HL()}}var uL=()=>{let $={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function w(J){return $[J]??null}let U={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},v={nan:"NaN",number:"númer",array:"fylki"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Rangt gildi: Þú slóst inn ${V} þar sem á að vera instanceof ${J.expected}`;return`Rangt gildi: Þú slóst inn ${V} þar sem á að vera ${z}`}case"invalid_value":if(J.values.length===1)return`Rangt gildi: gert ráð fyrir ${K(J.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Of stórt: gert er ráð fyrir að ${J.origin??"gildi"} hafi ${z}${J.maximum.toString()} ${g.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${J.origin??"gildi"} sé ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Of lítið: gert er ráð fyrir að ${J.origin} hafi ${z}${J.minimum.toString()} ${g.unit}`;return`Of lítið: gert er ráð fyrir að ${J.origin} sé ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Ógildur strengur: verður að byrja á "${z.prefix}"`;if(z.format==="ends_with")return`Ógildur strengur: verður að enda á "${z.suffix}"`;if(z.format==="includes")return`Ógildur strengur: verður að innihalda "${z.includes}"`;if(z.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${z.pattern}`;return`Rangt ${U[z.format]??J.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${J.divisor}`;case"unrecognized_keys":return`Óþekkt ${J.keys.length>1?"ir lyklar":"ur lykill"}: ${L(J.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${J.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${J.origin}`;default:return"Rangt gildi"}}};function nG(){return{localeError:uL()}}var KL=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function w(J){return $[J]??null}let 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"},v={nan:"NaN",number:"numero",array:"vettore"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Input non valido: atteso instanceof ${J.expected}, ricevuto ${V}`;return`Input non valido: atteso ${z}, ricevuto ${V}`}case"invalid_value":if(J.values.length===1)return`Input non valido: atteso ${K(J.values[0])}`;return`Opzione non valida: atteso uno tra ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Troppo grande: ${J.origin??"valore"} deve avere ${z}${J.maximum.toString()} ${g.unit??"elementi"}`;return`Troppo grande: ${J.origin??"valore"} deve essere ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Troppo piccolo: ${J.origin} deve avere ${z}${J.minimum.toString()} ${g.unit}`;return`Troppo piccolo: ${J.origin} deve essere ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Stringa non valida: deve iniziare con "${z.prefix}"`;if(z.format==="ends_with")return`Stringa non valida: deve terminare con "${z.suffix}"`;if(z.format==="includes")return`Stringa non valida: deve includere "${z.includes}"`;if(z.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${z.pattern}`;return`Input non valido: ${U[z.format]??J.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${J.divisor}`;case"unrecognized_keys":return`Chiav${J.keys.length>1?"i":"e"} non riconosciut${J.keys.length>1?"e":"a"}: ${L(J.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${J.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${J.origin}`;default:return"Input non valido"}}};function hG(){return{localeError:KL()}}var DL=()=>{let $={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function w(J){return $[J]??null}let U={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},v={nan:"NaN",number:"数値",array:"配列"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`無効な入力: instanceof ${J.expected}が期待されましたが、${V}が入力されました`;return`無効な入力: ${z}が期待されましたが、${V}が入力されました`}case"invalid_value":if(J.values.length===1)return`無効な入力: ${K(J.values[0])}が期待されました`;return`無効な選択: ${L(J.values,"、")}のいずれかである必要があります`;case"too_big":{let z=J.inclusive?"以下である":"より小さい",g=w(J.origin);if(g)return`大きすぎる値: ${J.origin??"値"}は${J.maximum.toString()}${g.unit??"要素"}${z}必要があります`;return`大きすぎる値: ${J.origin??"値"}は${J.maximum.toString()}${z}必要があります`}case"too_small":{let z=J.inclusive?"以上である":"より大きい",g=w(J.origin);if(g)return`小さすぎる値: ${J.origin}は${J.minimum.toString()}${g.unit}${z}必要があります`;return`小さすぎる値: ${J.origin}は${J.minimum.toString()}${z}必要があります`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`無効な文字列: "${z.prefix}"で始まる必要があります`;if(z.format==="ends_with")return`無効な文字列: "${z.suffix}"で終わる必要があります`;if(z.format==="includes")return`無効な文字列: "${z.includes}"を含む必要があります`;if(z.format==="regex")return`無効な文字列: パターン${z.pattern}に一致する必要があります`;return`無効な${U[z.format]??J.format}`}case"not_multiple_of":return`無効な数値: ${J.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${J.keys.length>1?"群":""}: ${L(J.keys,"、")}`;case"invalid_key":return`${J.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${J.origin}内の無効な値`;default:return"無効な入力"}}};function cG(){return{localeError:DL()}}var fL=()=>{let $={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function w(J){return $[J]??null}let U={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული ველი",base64url:"base64url-კოდირებული ველი",json_string:"JSON ველი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},v={nan:"NaN",number:"რიცხვი",string:"ველი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${J.expected}, მიღებული ${V}`;return`არასწორი შეყვანა: მოსალოდნელი ${z}, მიღებული ${V}`}case"invalid_value":if(J.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${K(J.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${L(J.values,"|")}-დან`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`ზედმეტად დიდი: მოსალოდნელი ${J.origin??"მნიშვნელობა"} ${g.verb} ${z}${J.maximum.toString()} ${g.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${J.origin??"მნიშვნელობა"} იყოს ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`ზედმეტად პატარა: მოსალოდნელი ${J.origin} ${g.verb} ${z}${J.minimum.toString()} ${g.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${J.origin} იყოს ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`არასწორი ველი: უნდა იწყებოდეს "${z.prefix}"-ით`;if(z.format==="ends_with")return`არასწორი ველი: უნდა მთავრდებოდეს "${z.suffix}"-ით`;if(z.format==="includes")return`არასწორი ველი: უნდა შეიცავდეს "${z.includes}"-ს`;if(z.format==="regex")return`არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${z.pattern}`;return`არასწორი ${U[z.format]??J.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${J.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${J.keys.length>1?"ები":"ი"}: ${L(J.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${J.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${J.origin}-ში`;default:return"არასწორი შეყვანა"}}};function lG(){return{localeError:fL()}}var TL=()=>{let $={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function w(J){return $[J]??null}let U={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},v={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${J.expected} ប៉ុន្តែទទួលបាន ${V}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${z} ប៉ុន្តែទទួលបាន ${V}`}case"invalid_value":if(J.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${K(J.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`ធំពេក៖ ត្រូវការ ${J.origin??"តម្លៃ"} ${z} ${J.maximum.toString()} ${g.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${J.origin??"តម្លៃ"} ${z} ${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`តូចពេក៖ ត្រូវការ ${J.origin} ${z} ${J.minimum.toString()} ${g.unit}`;return`តូចពេក៖ ត្រូវការ ${J.origin} ${z} ${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${z.prefix}"`;if(z.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${z.suffix}"`;if(z.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${z.includes}"`;if(z.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${z.pattern}`;return`មិនត្រឹមត្រូវ៖ ${U[z.format]??J.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${J.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${L(J.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${J.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${J.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function zJ(){return{localeError:TL()}}function tG(){return zJ()}var ZL=()=>{let $={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function w(J){return $[J]??null}let U={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},v={nan:"NaN"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`잘못된 입력: 예상 타입은 instanceof ${J.expected}, 받은 타입은 ${V}입니다`;return`잘못된 입력: 예상 타입은 ${z}, 받은 타입은 ${V}입니다`}case"invalid_value":if(J.values.length===1)return`잘못된 입력: 값은 ${K(J.values[0])} 이어야 합니다`;return`잘못된 옵션: ${L(J.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let z=J.inclusive?"이하":"미만",g=z==="미만"?"이어야 합니다":"여야 합니다",V=w(J.origin),_=V?.unit??"요소";if(V)return`${J.origin??"값"}이 너무 큽니다: ${J.maximum.toString()}${_} ${z}${g}`;return`${J.origin??"값"}이 너무 큽니다: ${J.maximum.toString()} ${z}${g}`}case"too_small":{let z=J.inclusive?"이상":"초과",g=z==="이상"?"이어야 합니다":"여야 합니다",V=w(J.origin),_=V?.unit??"요소";if(V)return`${J.origin??"값"}이 너무 작습니다: ${J.minimum.toString()}${_} ${z}${g}`;return`${J.origin??"값"}이 너무 작습니다: ${J.minimum.toString()} ${z}${g}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`잘못된 문자열: "${z.prefix}"(으)로 시작해야 합니다`;if(z.format==="ends_with")return`잘못된 문자열: "${z.suffix}"(으)로 끝나야 합니다`;if(z.format==="includes")return`잘못된 문자열: "${z.includes}"을(를) 포함해야 합니다`;if(z.format==="regex")return`잘못된 문자열: 정규식 ${z.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${U[z.format]??J.format}`}case"not_multiple_of":return`잘못된 숫자: ${J.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${L(J.keys,", ")}`;case"invalid_key":return`잘못된 키: ${J.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${J.origin}`;default:return"잘못된 입력"}}};function oG(){return{localeError:ZL()}}var gJ=($)=>{return $.charAt(0).toUpperCase()+$.slice(1)};function J9($){let w=Math.abs($),U=w%10,v=w%100;if(v>=11&&v<=19||U===0)return"many";if(U===1)return"one";return"few"}var bL=()=>{let $={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function w(J,z,g,V){let _=$[J]??null;if(_===null)return _;return{unit:_.unit[z],verb:_.verb[V][g?"inclusive":"notInclusive"]}}let U={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},v={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Gautas tipas ${V}, o tikėtasi - instanceof ${J.expected}`;return`Gautas tipas ${V}, o tikėtasi - ${z}`}case"invalid_value":if(J.values.length===1)return`Privalo būti ${K(J.values[0])}`;return`Privalo būti vienas iš ${L(J.values,"|")} pasirinkimų`;case"too_big":{let z=v[J.origin]??J.origin,g=w(J.origin,J9(Number(J.maximum)),J.inclusive??!1,"smaller");if(g?.verb)return`${gJ(z??J.origin??"reikšmė")} ${g.verb} ${J.maximum.toString()} ${g.unit??"elementų"}`;let V=J.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${gJ(z??J.origin??"reikšmė")} turi būti ${V} ${J.maximum.toString()} ${g?.unit}`}case"too_small":{let z=v[J.origin]??J.origin,g=w(J.origin,J9(Number(J.minimum)),J.inclusive??!1,"bigger");if(g?.verb)return`${gJ(z??J.origin??"reikšmė")} ${g.verb} ${J.minimum.toString()} ${g.unit??"elementų"}`;let V=J.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${gJ(z??J.origin??"reikšmė")} turi būti ${V} ${J.minimum.toString()} ${g?.unit}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Eilutė privalo prasidėti "${z.prefix}"`;if(z.format==="ends_with")return`Eilutė privalo pasibaigti "${z.suffix}"`;if(z.format==="includes")return`Eilutė privalo įtraukti "${z.includes}"`;if(z.format==="regex")return`Eilutė privalo atitikti ${z.pattern}`;return`Neteisingas ${U[z.format]??J.format}`}case"not_multiple_of":return`Skaičius privalo būti ${J.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${J.keys.length>1?"i":"as"} rakt${J.keys.length>1?"ai":"as"}: ${L(J.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let z=v[J.origin]??J.origin;return`${gJ(z??J.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function pG(){return{localeError:bL()}}var FL=()=>{let $={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function w(J){return $[J]??null}let U={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},v={nan:"NaN",number:"број",array:"низа"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Грешен внес: се очекува instanceof ${J.expected}, примено ${V}`;return`Грешен внес: се очекува ${z}, примено ${V}`}case"invalid_value":if(J.values.length===1)return`Invalid input: expected ${K(J.values[0])}`;return`Грешана опција: се очекува една ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Премногу голем: се очекува ${J.origin??"вредноста"} да има ${z}${J.maximum.toString()} ${g.unit??"елементи"}`;return`Премногу голем: се очекува ${J.origin??"вредноста"} да биде ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Премногу мал: се очекува ${J.origin} да има ${z}${J.minimum.toString()} ${g.unit}`;return`Премногу мал: се очекува ${J.origin} да биде ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Неважечка низа: мора да започнува со "${z.prefix}"`;if(z.format==="ends_with")return`Неважечка низа: мора да завршува со "${z.suffix}"`;if(z.format==="includes")return`Неважечка низа: мора да вклучува "${z.includes}"`;if(z.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${z.pattern}`;return`Invalid ${U[z.format]??J.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${J.divisor}`;case"unrecognized_keys":return`${J.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${L(J.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${J.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${J.origin}`;default:return"Грешен внес"}}};function aG(){return{localeError:FL()}}var ML=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function w(J){return $[J]??null}let 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"},v={nan:"NaN",number:"nombor"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Input tidak sah: dijangka instanceof ${J.expected}, diterima ${V}`;return`Input tidak sah: dijangka ${z}, diterima ${V}`}case"invalid_value":if(J.values.length===1)return`Input tidak sah: dijangka ${K(J.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Terlalu besar: dijangka ${J.origin??"nilai"} ${g.verb} ${z}${J.maximum.toString()} ${g.unit??"elemen"}`;return`Terlalu besar: dijangka ${J.origin??"nilai"} adalah ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Terlalu kecil: dijangka ${J.origin} ${g.verb} ${z}${J.minimum.toString()} ${g.unit}`;return`Terlalu kecil: dijangka ${J.origin} adalah ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`String tidak sah: mesti bermula dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak sah: mesti mengandungi "${z.includes}"`;if(z.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${z.pattern}`;return`${U[z.format]??J.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${J.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${L(J.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${J.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${J.origin}`;default:return"Input tidak sah"}}};function eG(){return{localeError:ML()}}var iL=()=>{let $={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function w(J){return $[J]??null}let 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"},v={nan:"NaN",number:"getal"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Ongeldige invoer: verwacht instanceof ${J.expected}, ontving ${V}`;return`Ongeldige invoer: verwacht ${z}, ontving ${V}`}case"invalid_value":if(J.values.length===1)return`Ongeldige invoer: verwacht ${K(J.values[0])}`;return`Ongeldige optie: verwacht één van ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin),V=J.origin==="date"?"laat":J.origin==="string"?"lang":"groot";if(g)return`Te ${V}: verwacht dat ${J.origin??"waarde"} ${z}${J.maximum.toString()} ${g.unit??"elementen"} ${g.verb}`;return`Te ${V}: verwacht dat ${J.origin??"waarde"} ${z}${J.maximum.toString()} is`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin),V=J.origin==="date"?"vroeg":J.origin==="string"?"kort":"klein";if(g)return`Te ${V}: verwacht dat ${J.origin} ${z}${J.minimum.toString()} ${g.unit} ${g.verb}`;return`Te ${V}: verwacht dat ${J.origin} ${z}${J.minimum.toString()} is`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Ongeldige tekst: moet met "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ongeldige tekst: moet op "${z.suffix}" eindigen`;if(z.format==="includes")return`Ongeldige tekst: moet "${z.includes}" bevatten`;if(z.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${z.pattern}`;return`Ongeldig: ${U[z.format]??J.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${J.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${J.keys.length>1?"s":""}: ${L(J.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${J.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${J.origin}`;default:return"Ongeldige invoer"}}};function sG(){return{localeError:iL()}}var EL=()=>{let $={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function w(J){return $[J]??null}let 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åde",ipv6:"IPv6-område",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"},v={nan:"NaN",number:"tall",array:"liste"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Ugyldig input: forventet instanceof ${J.expected}, fikk ${V}`;return`Ugyldig input: forventet ${z}, fikk ${V}`}case"invalid_value":if(J.values.length===1)return`Ugyldig verdi: forventet ${K(J.values[0])}`;return`Ugyldig valg: forventet en av ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`For stor(t): forventet ${J.origin??"value"} til å ha ${z}${J.maximum.toString()} ${g.unit??"elementer"}`;return`For stor(t): forventet ${J.origin??"value"} til å ha ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`For lite(n): forventet ${J.origin} til å ha ${z}${J.minimum.toString()} ${g.unit}`;return`For lite(n): forventet ${J.origin} til å ha ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Ugyldig streng: må starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: må ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: må inneholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: må matche mønsteret ${z.pattern}`;return`Ugyldig ${U[z.format]??J.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${J.divisor}`;case"unrecognized_keys":return`${J.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${L(J.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${J.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${J.origin}`;default:return"Ugyldig input"}}};function $_(){return{localeError:EL()}}var SL=()=>{let $={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function w(J){return $[J]??null}let U={regex:"giren",email:"epostagâh",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âmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},v={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Fâsit giren: umulan instanceof ${J.expected}, alınan ${V}`;return`Fâsit giren: umulan ${z}, alınan ${V}`}case"invalid_value":if(J.values.length===1)return`Fâsit giren: umulan ${K(J.values[0])}`;return`Fâsit tercih: mûteberler ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Fazla büyük: ${J.origin??"value"}, ${z}${J.maximum.toString()} ${g.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${J.origin??"value"}, ${z}${J.maximum.toString()} olmalıydı.`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Fazla küçük: ${J.origin}, ${z}${J.minimum.toString()} ${g.unit} sahip olmalıydı.`;return`Fazla küçük: ${J.origin}, ${z}${J.minimum.toString()} olmalıydı.`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Fâsit metin: "${z.prefix}" ile başlamalı.`;if(z.format==="ends_with")return`Fâsit metin: "${z.suffix}" ile bitmeli.`;if(z.format==="includes")return`Fâsit metin: "${z.includes}" ihtivâ etmeli.`;if(z.format==="regex")return`Fâsit metin: ${z.pattern} nakşına uymalı.`;return`Fâsit ${U[z.format]??J.format}`}case"not_multiple_of":return`Fâsit sayı: ${J.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${J.keys.length>1?"s":""}: ${L(J.keys,", ")}`;case"invalid_key":return`${J.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${J.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function w_(){return{localeError:SL()}}var AL=()=>{let $={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function w(J){return $[J]??null}let U={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},v={nan:"NaN",number:"عدد",array:"ارې"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`ناسم ورودي: باید instanceof ${J.expected} وای, مګر ${V} ترلاسه شو`;return`ناسم ورودي: باید ${z} وای, مګر ${V} ترلاسه شو`}case"invalid_value":if(J.values.length===1)return`ناسم ورودي: باید ${K(J.values[0])} وای`;return`ناسم انتخاب: باید یو له ${L(J.values,"|")} څخه وای`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`ډیر لوی: ${J.origin??"ارزښت"} باید ${z}${J.maximum.toString()} ${g.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${J.origin??"ارزښت"} باید ${z}${J.maximum.toString()} وي`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`ډیر کوچنی: ${J.origin} باید ${z}${J.minimum.toString()} ${g.unit} ولري`;return`ډیر کوچنی: ${J.origin} باید ${z}${J.minimum.toString()} وي`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`ناسم متن: باید د "${z.prefix}" سره پیل شي`;if(z.format==="ends_with")return`ناسم متن: باید د "${z.suffix}" سره پای ته ورسيږي`;if(z.format==="includes")return`ناسم متن: باید "${z.includes}" ولري`;if(z.format==="regex")return`ناسم متن: باید د ${z.pattern} سره مطابقت ولري`;return`${U[z.format]??J.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${J.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${J.keys.length>1?"کلیډونه":"کلیډ"}: ${L(J.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${J.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${J.origin} کې`;default:return"ناسمه ورودي"}}};function U_(){return{localeError:AL()}}var RL=()=>{let $={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function w(J){return $[J]??null}let U={regex:"wyrażenie",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ąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},v={nan:"NaN",number:"liczba",array:"tablica"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${J.expected}, otrzymano ${V}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${z}, otrzymano ${V}`}case"invalid_value":if(J.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${K(J.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Za duża wartość: oczekiwano, że ${J.origin??"wartość"} będzie mieć ${z}${J.maximum.toString()} ${g.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${J.origin??"wartość"} będzie wynosić ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Za mała wartość: oczekiwano, że ${J.origin??"wartość"} będzie mieć ${z}${J.minimum.toString()} ${g.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${J.origin??"wartość"} będzie wynosić ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${z.prefix}"`;if(z.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${z.suffix}"`;if(z.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${z.includes}"`;if(z.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${z.pattern}`;return`Nieprawidłow(y/a/e) ${U[z.format]??J.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${J.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${J.keys.length>1?"s":""}: ${L(J.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${J.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${J.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function J_(){return{localeError:RL()}}var kL=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function w(J){return $[J]??null}let U={regex:"padrão",email:"endereço 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ção ISO",ipv4:"endereço IPv4",ipv6:"endereço 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úmero E.164",jwt:"JWT",template_literal:"entrada"},v={nan:"NaN",number:"número",null:"nulo"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Tipo inválido: esperado instanceof ${J.expected}, recebido ${V}`;return`Tipo inválido: esperado ${z}, recebido ${V}`}case"invalid_value":if(J.values.length===1)return`Entrada inválida: esperado ${K(J.values[0])}`;return`Opção inválida: esperada uma das ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Muito grande: esperado que ${J.origin??"valor"} tivesse ${z}${J.maximum.toString()} ${g.unit??"elementos"}`;return`Muito grande: esperado que ${J.origin??"valor"} fosse ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Muito pequeno: esperado que ${J.origin} tivesse ${z}${J.minimum.toString()} ${g.unit}`;return`Muito pequeno: esperado que ${J.origin} fosse ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Texto inválido: deve começar com "${z.prefix}"`;if(z.format==="ends_with")return`Texto inválido: deve terminar com "${z.suffix}"`;if(z.format==="includes")return`Texto inválido: deve incluir "${z.includes}"`;if(z.format==="regex")return`Texto inválido: deve corresponder ao padrão ${z.pattern}`;return`${U[z.format]??J.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${J.divisor}`;case"unrecognized_keys":return`Chave${J.keys.length>1?"s":""} desconhecida${J.keys.length>1?"s":""}: ${L(J.keys,", ")}`;case"invalid_key":return`Chave inválida em ${J.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${J.origin}`;default:return"Campo inválido"}}};function v_(){return{localeError:kL()}}var CL=()=>{let $={string:{unit:"caractere",verb:"să aibă"},file:{unit:"octeți",verb:"să aibă"},array:{unit:"elemente",verb:"să aibă"},set:{unit:"elemente",verb:"să aibă"},map:{unit:"intrări",verb:"să aibă"}};function w(J){return $[J]??null}let U={regex:"intrare",email:"adresă de 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:"dată și oră ISO",date:"dată ISO",time:"oră ISO",duration:"durată ISO",ipv4:"adresă IPv4",ipv6:"adresă IPv6",mac:"adresă MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"șir codat base64",base64url:"șir codat base64url",json_string:"șir JSON",e164:"număr E.164",jwt:"JWT",template_literal:"intrare"},v={nan:"NaN",string:"șir",number:"număr",boolean:"boolean",function:"funcție",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"număr mare",void:"void",never:"never",map:"hartă",set:"set"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;return`Intrare invalidă: așteptat ${z}, primit ${V}`}case"invalid_value":if(J.values.length===1)return`Intrare invalidă: așteptat ${K(J.values[0])}`;return`Opțiune invalidă: așteptat una dintre ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Prea mare: așteptat ca ${J.origin??"valoarea"} ${g.verb} ${z}${J.maximum.toString()} ${g.unit??"elemente"}`;return`Prea mare: așteptat ca ${J.origin??"valoarea"} să fie ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Prea mic: așteptat ca ${J.origin} ${g.verb} ${z}${J.minimum.toString()} ${g.unit}`;return`Prea mic: așteptat ca ${J.origin} să fie ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Șir invalid: trebuie să înceapă cu "${z.prefix}"`;if(z.format==="ends_with")return`Șir invalid: trebuie să se termine cu "${z.suffix}"`;if(z.format==="includes")return`Șir invalid: trebuie să includă "${z.includes}"`;if(z.format==="regex")return`Șir invalid: trebuie să se potrivească cu modelul ${z.pattern}`;return`Format invalid: ${U[z.format]??J.format}`}case"not_multiple_of":return`Număr invalid: trebuie să fie multiplu de ${J.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${L(J.keys,", ")}`;case"invalid_key":return`Cheie invalidă în ${J.origin}`;case"invalid_union":return"Intrare invalidă";case"invalid_element":return`Valoare invalidă în ${J.origin}`;default:return"Intrare invalidă"}}};function z_(){return{localeError:CL()}}function v9($,w,U,v){let J=Math.abs($),z=J%10,g=J%100;if(g>=11&&g<=19)return v;if(z===1)return w;if(z>=2&&z<=4)return U;return v}var jL=()=>{let $={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function w(J){return $[J]??null}let U={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},v={nan:"NaN",number:"число",array:"массив"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Неверный ввод: ожидалось instanceof ${J.expected}, получено ${V}`;return`Неверный ввод: ожидалось ${z}, получено ${V}`}case"invalid_value":if(J.values.length===1)return`Неверный ввод: ожидалось ${K(J.values[0])}`;return`Неверный вариант: ожидалось одно из ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g){let V=Number(J.maximum),_=v9(V,g.unit.one,g.unit.few,g.unit.many);return`Слишком большое значение: ожидалось, что ${J.origin??"значение"} будет иметь ${z}${J.maximum.toString()} ${_}`}return`Слишком большое значение: ожидалось, что ${J.origin??"значение"} будет ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g){let V=Number(J.minimum),_=v9(V,g.unit.one,g.unit.few,g.unit.many);return`Слишком маленькое значение: ожидалось, что ${J.origin} будет иметь ${z}${J.minimum.toString()} ${_}`}return`Слишком маленькое значение: ожидалось, что ${J.origin} будет ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Неверная строка: должна начинаться с "${z.prefix}"`;if(z.format==="ends_with")return`Неверная строка: должна заканчиваться на "${z.suffix}"`;if(z.format==="includes")return`Неверная строка: должна содержать "${z.includes}"`;if(z.format==="regex")return`Неверная строка: должна соответствовать шаблону ${z.pattern}`;return`Неверный ${U[z.format]??J.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${J.divisor}`;case"unrecognized_keys":return`Нераспознанн${J.keys.length>1?"ые":"ый"} ключ${J.keys.length>1?"и":""}: ${L(J.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${J.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${J.origin}`;default:return"Неверные входные данные"}}};function g_(){return{localeError:jL()}}var xL=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function w(J){return $[J]??null}let U={regex:"vnos",email:"e-poštni 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 čas",date:"ISO datum",time:"ISO čas",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 številka",jwt:"JWT",template_literal:"vnos"},v={nan:"NaN",number:"število",array:"tabela"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Neveljaven vnos: pričakovano instanceof ${J.expected}, prejeto ${V}`;return`Neveljaven vnos: pričakovano ${z}, prejeto ${V}`}case"invalid_value":if(J.values.length===1)return`Neveljaven vnos: pričakovano ${K(J.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Preveliko: pričakovano, da bo ${J.origin??"vrednost"} imelo ${z}${J.maximum.toString()} ${g.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${J.origin??"vrednost"} ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Premajhno: pričakovano, da bo ${J.origin} imelo ${z}${J.minimum.toString()} ${g.unit}`;return`Premajhno: pričakovano, da bo ${J.origin} ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Neveljaven niz: mora se začeti z "${z.prefix}"`;if(z.format==="ends_with")return`Neveljaven niz: mora se končati z "${z.suffix}"`;if(z.format==="includes")return`Neveljaven niz: mora vsebovati "${z.includes}"`;if(z.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${z.pattern}`;return`Neveljaven ${U[z.format]??J.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${J.divisor}`;case"unrecognized_keys":return`Neprepoznan${J.keys.length>1?"i ključi":" ključ"}: ${L(J.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${J.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${J.origin}`;default:return"Neveljaven vnos"}}};function V_(){return{localeError:xL()}}var rL=()=>{let $={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function w(J){return $[J]??null}let U={regex:"reguljärt 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äng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},v={nan:"NaN",number:"antal",array:"lista"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Ogiltig inmatning: förväntat instanceof ${J.expected}, fick ${V}`;return`Ogiltig inmatning: förväntat ${z}, fick ${V}`}case"invalid_value":if(J.values.length===1)return`Ogiltig inmatning: förväntat ${K(J.values[0])}`;return`Ogiltigt val: förväntade en av ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`För stor(t): förväntade ${J.origin??"värdet"} att ha ${z}${J.maximum.toString()} ${g.unit??"element"}`;return`För stor(t): förväntat ${J.origin??"värdet"} att ha ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`För lite(t): förväntade ${J.origin??"värdet"} att ha ${z}${J.minimum.toString()} ${g.unit}`;return`För lite(t): förväntade ${J.origin??"värdet"} att ha ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Ogiltig sträng: måste börja med "${z.prefix}"`;if(z.format==="ends_with")return`Ogiltig sträng: måste sluta med "${z.suffix}"`;if(z.format==="includes")return`Ogiltig sträng: måste innehålla "${z.includes}"`;if(z.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${z.pattern}"`;return`Ogiltig(t) ${U[z.format]??J.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${J.divisor}`;case"unrecognized_keys":return`${J.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${L(J.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${J.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${J.origin??"värdet"}`;default:return"Ogiltig input"}}};function G_(){return{localeError:rL()}}var yL=()=>{let $={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function w(J){return $[J]??null}let U={regex:"உள்ளீடு",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:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},v={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${J.expected}, பெறப்பட்டது ${V}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${z}, பெறப்பட்டது ${V}`}case"invalid_value":if(J.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${K(J.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${L(J.values,"|")} இல் ஒன்று`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${J.origin??"மதிப்பு"} ${z}${J.maximum.toString()} ${g.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${J.origin??"மதிப்பு"} ${z}${J.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${J.origin} ${z}${J.minimum.toString()} ${g.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${J.origin} ${z}${J.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`தவறான சரம்: "${z.prefix}" இல் தொடங்க வேண்டும்`;if(z.format==="ends_with")return`தவறான சரம்: "${z.suffix}" இல் முடிவடைய வேண்டும்`;if(z.format==="includes")return`தவறான சரம்: "${z.includes}" ஐ உள்ளடக்க வேண்டும்`;if(z.format==="regex")return`தவறான சரம்: ${z.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${U[z.format]??J.format}`}case"not_multiple_of":return`தவறான எண்: ${J.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${J.keys.length>1?"கள்":""}: ${L(J.keys,", ")}`;case"invalid_key":return`${J.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${J.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function __(){return{localeError:yL()}}var dL=()=>{let $={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function w(J){return $[J]??null}let U={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},v={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${J.expected} แต่ได้รับ ${V}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${z} แต่ได้รับ ${V}`}case"invalid_value":if(J.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${K(J.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"ไม่เกิน":"น้อยกว่า",g=w(J.origin);if(g)return`เกินกำหนด: ${J.origin??"ค่า"} ควรมี${z} ${J.maximum.toString()} ${g.unit??"รายการ"}`;return`เกินกำหนด: ${J.origin??"ค่า"} ควรมี${z} ${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?"อย่างน้อย":"มากกว่า",g=w(J.origin);if(g)return`น้อยกว่ากำหนด: ${J.origin} ควรมี${z} ${J.minimum.toString()} ${g.unit}`;return`น้อยกว่ากำหนด: ${J.origin} ควรมี${z} ${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${z.prefix}"`;if(z.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${z.suffix}"`;if(z.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${z.includes}" อยู่ในข้อความ`;if(z.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${z.pattern}`;return`รูปแบบไม่ถูกต้อง: ${U[z.format]??J.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${J.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${L(J.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${J.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${J.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function X_(){return{localeError:dL()}}var mL=()=>{let $={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function w(J){return $[J]??null}let U={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üre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},v={nan:"NaN"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Geçersiz değer: beklenen instanceof ${J.expected}, alınan ${V}`;return`Geçersiz değer: beklenen ${z}, alınan ${V}`}case"invalid_value":if(J.values.length===1)return`Geçersiz değer: beklenen ${K(J.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Çok büyük: beklenen ${J.origin??"değer"} ${z}${J.maximum.toString()} ${g.unit??"öğe"}`;return`Çok büyük: beklenen ${J.origin??"değer"} ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Çok küçük: beklenen ${J.origin} ${z}${J.minimum.toString()} ${g.unit}`;return`Çok küçük: beklenen ${J.origin} ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Geçersiz metin: "${z.prefix}" ile başlamalı`;if(z.format==="ends_with")return`Geçersiz metin: "${z.suffix}" ile bitmeli`;if(z.format==="includes")return`Geçersiz metin: "${z.includes}" içermeli`;if(z.format==="regex")return`Geçersiz metin: ${z.pattern} desenine uymalı`;return`Geçersiz ${U[z.format]??J.format}`}case"not_multiple_of":return`Geçersiz sayı: ${J.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${J.keys.length>1?"lar":""}: ${L(J.keys,", ")}`;case"invalid_key":return`${J.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${J.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function I_(){return{localeError:mL()}}var nL=()=>{let $={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function w(J){return $[J]??null}let U={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},v={nan:"NaN",number:"число",array:"масив"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Неправильні вхідні дані: очікується instanceof ${J.expected}, отримано ${V}`;return`Неправильні вхідні дані: очікується ${z}, отримано ${V}`}case"invalid_value":if(J.values.length===1)return`Неправильні вхідні дані: очікується ${K(J.values[0])}`;return`Неправильна опція: очікується одне з ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Занадто велике: очікується, що ${J.origin??"значення"} ${g.verb} ${z}${J.maximum.toString()} ${g.unit??"елементів"}`;return`Занадто велике: очікується, що ${J.origin??"значення"} буде ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Занадто мале: очікується, що ${J.origin} ${g.verb} ${z}${J.minimum.toString()} ${g.unit}`;return`Занадто мале: очікується, що ${J.origin} буде ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Неправильний рядок: повинен починатися з "${z.prefix}"`;if(z.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${z.suffix}"`;if(z.format==="includes")return`Неправильний рядок: повинен містити "${z.includes}"`;if(z.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${z.pattern}`;return`Неправильний ${U[z.format]??J.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${J.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${J.keys.length>1?"і":""}: ${L(J.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${J.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${J.origin}`;default:return"Неправильні вхідні дані"}}};function VJ(){return{localeError:nL()}}function N_(){return VJ()}var hL=()=>{let $={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function w(J){return $[J]??null}let U={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},v={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`غلط ان پٹ: instanceof ${J.expected} متوقع تھا، ${V} موصول ہوا`;return`غلط ان پٹ: ${z} متوقع تھا، ${V} موصول ہوا`}case"invalid_value":if(J.values.length===1)return`غلط ان پٹ: ${K(J.values[0])} متوقع تھا`;return`غلط آپشن: ${L(J.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`بہت بڑا: ${J.origin??"ویلیو"} کے ${z}${J.maximum.toString()} ${g.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${J.origin??"ویلیو"} کا ${z}${J.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`بہت چھوٹا: ${J.origin} کے ${z}${J.minimum.toString()} ${g.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${J.origin} کا ${z}${J.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`غلط سٹرنگ: "${z.prefix}" سے شروع ہونا چاہیے`;if(z.format==="ends_with")return`غلط سٹرنگ: "${z.suffix}" پر ختم ہونا چاہیے`;if(z.format==="includes")return`غلط سٹرنگ: "${z.includes}" شامل ہونا چاہیے`;if(z.format==="regex")return`غلط سٹرنگ: پیٹرن ${z.pattern} سے میچ ہونا چاہیے`;return`غلط ${U[z.format]??J.format}`}case"not_multiple_of":return`غلط نمبر: ${J.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${J.keys.length>1?"ز":""}: ${L(J.keys,"، ")}`;case"invalid_key":return`${J.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${J.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function W_(){return{localeError:hL()}}var cL=()=>{let $={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"},map:{unit:"yozuv",verb:"bo‘lishi kerak"}};function w(J){return $[J]??null}let U={regex:"kirish",email:"elektron pochta manzili",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 sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},v={nan:"NaN",number:"raqam",array:"massiv"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${J.expected}, qabul qilingan ${V}`;return`Noto‘g‘ri kirish: kutilgan ${z}, qabul qilingan ${V}`}case"invalid_value":if(J.values.length===1)return`Noto‘g‘ri kirish: kutilgan ${K(J.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Juda katta: kutilgan ${J.origin??"qiymat"} ${z}${J.maximum.toString()} ${g.unit} ${g.verb}`;return`Juda katta: kutilgan ${J.origin??"qiymat"} ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Juda kichik: kutilgan ${J.origin} ${z}${J.minimum.toString()} ${g.unit} ${g.verb}`;return`Juda kichik: kutilgan ${J.origin} ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Noto‘g‘ri satr: "${z.prefix}" bilan boshlanishi kerak`;if(z.format==="ends_with")return`Noto‘g‘ri satr: "${z.suffix}" bilan tugashi kerak`;if(z.format==="includes")return`Noto‘g‘ri satr: "${z.includes}" ni o‘z ichiga olishi kerak`;if(z.format==="regex")return`Noto‘g‘ri satr: ${z.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${U[z.format]??J.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${J.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${J.keys.length>1?"lar":""}: ${L(J.keys,", ")}`;case"invalid_key":return`${J.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${J.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function Y_(){return{localeError:cL()}}var lL=()=>{let $={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function w(J){return $[J]??null}let U={regex:"đầu vào",email:"địa chỉ 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ày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},v={nan:"NaN",number:"số",array:"mảng"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Đầu vào không hợp lệ: mong đợi instanceof ${J.expected}, nhận được ${V}`;return`Đầu vào không hợp lệ: mong đợi ${z}, nhận được ${V}`}case"invalid_value":if(J.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${K(J.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Quá lớn: mong đợi ${J.origin??"giá trị"} ${g.verb} ${z}${J.maximum.toString()} ${g.unit??"phần tử"}`;return`Quá lớn: mong đợi ${J.origin??"giá trị"} ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Quá nhỏ: mong đợi ${J.origin} ${g.verb} ${z}${J.minimum.toString()} ${g.unit}`;return`Quá nhỏ: mong đợi ${J.origin} ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${z.prefix}"`;if(z.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${z.suffix}"`;if(z.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${z.includes}"`;if(z.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${z.pattern}`;return`${U[z.format]??J.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${J.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${L(J.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${J.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${J.origin}`;default:return"Đầu vào không hợp lệ"}}};function Q_(){return{localeError:lL()}}var tL=()=>{let $={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function w(J){return $[J]??null}let U={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},v={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`无效输入:期望 instanceof ${J.expected},实际接收 ${V}`;return`无效输入:期望 ${z},实际接收 ${V}`}case"invalid_value":if(J.values.length===1)return`无效输入:期望 ${K(J.values[0])}`;return`无效选项:期望以下之一 ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`数值过大:期望 ${J.origin??"值"} ${z}${J.maximum.toString()} ${g.unit??"个元素"}`;return`数值过大:期望 ${J.origin??"值"} ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`数值过小:期望 ${J.origin} ${z}${J.minimum.toString()} ${g.unit}`;return`数值过小:期望 ${J.origin} ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`无效字符串:必须以 "${z.prefix}" 开头`;if(z.format==="ends_with")return`无效字符串:必须以 "${z.suffix}" 结尾`;if(z.format==="includes")return`无效字符串:必须包含 "${z.includes}"`;if(z.format==="regex")return`无效字符串:必须满足正则表达式 ${z.pattern}`;return`无效${U[z.format]??J.format}`}case"not_multiple_of":return`无效数字:必须是 ${J.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${L(J.keys,", ")}`;case"invalid_key":return`${J.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${J.origin} 中包含无效值(value)`;default:return"无效输入"}}};function P_(){return{localeError:tL()}}var oL=()=>{let $={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function w(J){return $[J]??null}let U={regex:"輸入",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:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},v={nan:"NaN"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`無效的輸入值:預期為 instanceof ${J.expected},但收到 ${V}`;return`無效的輸入值:預期為 ${z},但收到 ${V}`}case"invalid_value":if(J.values.length===1)return`無效的輸入值:預期為 ${K(J.values[0])}`;return`無效的選項:預期為以下其中之一 ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`數值過大:預期 ${J.origin??"值"} 應為 ${z}${J.maximum.toString()} ${g.unit??"個元素"}`;return`數值過大:預期 ${J.origin??"值"} 應為 ${z}${J.maximum.toString()}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`數值過小:預期 ${J.origin} 應為 ${z}${J.minimum.toString()} ${g.unit}`;return`數值過小:預期 ${J.origin} 應為 ${z}${J.minimum.toString()}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`無效的字串:必須以 "${z.prefix}" 開頭`;if(z.format==="ends_with")return`無效的字串:必須以 "${z.suffix}" 結尾`;if(z.format==="includes")return`無效的字串:必須包含 "${z.includes}"`;if(z.format==="regex")return`無效的字串:必須符合格式 ${z.pattern}`;return`無效的 ${U[z.format]??J.format}`}case"not_multiple_of":return`無效的數字:必須為 ${J.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${J.keys.length>1?"們":""}:${L(J.keys,"、")}`;case"invalid_key":return`${J.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${J.origin} 中有無效的值`;default:return"無效的輸入值"}}};function O_(){return{localeError:oL()}}var pL=()=>{let $={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function w(J){return $[J]??null}let U={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",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:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},v={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return(J)=>{switch(J.code){case"invalid_type":{let z=v[J.expected]??J.expected,g=D(J.input),V=v[g]??g;if(/^[A-Z]/.test(J.expected))return`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${J.expected}, àmọ̀ a rí ${V}`;return`Ìbáwọlé aṣìṣe: a ní láti fi ${z}, àmọ̀ a rí ${V}`}case"invalid_value":if(J.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${K(J.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${L(J.values,"|")}`;case"too_big":{let z=J.inclusive?"<=":"<",g=w(J.origin);if(g)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${J.origin??"iye"} ${g.verb} ${z}${J.maximum} ${g.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${z}${J.maximum}`}case"too_small":{let z=J.inclusive?">=":">",g=w(J.origin);if(g)return`Kéré ju: a ní láti jẹ́ pé ${J.origin} ${g.verb} ${z}${J.minimum} ${g.unit}`;return`Kéré ju: a ní láti jẹ́ ${z}${J.minimum}`}case"invalid_format":{let z=J;if(z.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${z.prefix}"`;if(z.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${z.suffix}"`;if(z.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${z.includes}"`;if(z.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${z.pattern}`;return`Aṣìṣe: ${U[z.format]??J.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${J.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${L(J.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${J.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${J.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function B_(){return{localeError:pL()}}var z9,q_=Symbol("ZodOutput"),L_=Symbol("ZodInput");class H_{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...w){let U=w[0];if(this._map.set($,U),U&&typeof U==="object"&&"id"in U)this._idmap.set(U.id,$);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove($){let w=this._map.get($);if(w&&typeof w==="object"&&"id"in w)this._idmap.delete(w.id);return this._map.delete($),this}get($){let w=$._zod.parent;if(w){let U={...this.get(w)??{}};delete U.id;let v={...U,...this._map.get($)};return Object.keys(v).length?v:void 0}return this._map.get($)}has($){return this._map.has($)}}function vv(){return new H_}(z9=globalThis).__zod_globalRegistry??(z9.__zod_globalRegistry=vv());var P$=globalThis.__zod_globalRegistry;function u_($,w){return new $({type:"string",...F(w)})}function K_($,w){return new $({type:"string",coerce:!0,...F(w)})}function zv($,w){return new $({type:"string",format:"email",check:"string_format",abort:!1,...F(w)})}function _J($,w){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...F(w)})}function gv($,w){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...F(w)})}function Vv($,w){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...F(w)})}function Gv($,w){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...F(w)})}function _v($,w){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...F(w)})}function XJ($,w){return new $({type:"string",format:"url",check:"string_format",abort:!1,...F(w)})}function Xv($,w){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...F(w)})}function Iv($,w){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...F(w)})}function Nv($,w){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...F(w)})}function Wv($,w){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...F(w)})}function Yv($,w){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...F(w)})}function Qv($,w){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...F(w)})}function Pv($,w){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...F(w)})}function Ov($,w){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...F(w)})}function Bv($,w){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...F(w)})}function D_($,w){return new $({type:"string",format:"mac",check:"string_format",abort:!1,...F(w)})}function qv($,w){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...F(w)})}function Lv($,w){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...F(w)})}function Hv($,w){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...F(w)})}function uv($,w){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...F(w)})}function Kv($,w){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...F(w)})}function Dv($,w){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...F(w)})}var f_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function T_($,w){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...F(w)})}function Z_($,w){return new $({type:"string",format:"date",check:"string_format",...F(w)})}function b_($,w){return new $({type:"string",format:"time",check:"string_format",precision:null,...F(w)})}function F_($,w){return new $({type:"string",format:"duration",check:"string_format",...F(w)})}function M_($,w){return new $({type:"number",checks:[],...F(w)})}function i_($,w){return new $({type:"number",coerce:!0,checks:[],...F(w)})}function E_($,w){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...F(w)})}function S_($,w){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...F(w)})}function A_($,w){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...F(w)})}function R_($,w){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...F(w)})}function k_($,w){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...F(w)})}function C_($,w){return new $({type:"boolean",...F(w)})}function j_($,w){return new $({type:"boolean",coerce:!0,...F(w)})}function x_($,w){return new $({type:"bigint",...F(w)})}function r_($,w){return new $({type:"bigint",coerce:!0,...F(w)})}function y_($,w){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...F(w)})}function d_($,w){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...F(w)})}function m_($,w){return new $({type:"symbol",...F(w)})}function n_($,w){return new $({type:"undefined",...F(w)})}function h_($,w){return new $({type:"null",...F(w)})}function c_($){return new $({type:"any"})}function l_($){return new $({type:"unknown"})}function t_($,w){return new $({type:"never",...F(w)})}function o_($,w){return new $({type:"void",...F(w)})}function p_($,w){return new $({type:"date",...F(w)})}function a_($,w){return new $({type:"date",coerce:!0,...F(w)})}function e_($,w){return new $({type:"nan",...F(w)})}function G4($,w){return new c0({check:"less_than",...F(w),value:$,inclusive:!1})}function r$($,w){return new c0({check:"less_than",...F(w),value:$,inclusive:!0})}function _4($,w){return new l0({check:"greater_than",...F(w),value:$,inclusive:!1})}function b$($,w){return new l0({check:"greater_than",...F(w),value:$,inclusive:!0})}function fv($){return _4(0,$)}function Tv($){return G4(0,$)}function Zv($){return r$(0,$)}function bv($){return b$(0,$)}function h4($,w){return new og({check:"multiple_of",...F(w),value:$})}function c4($,w){return new eg({check:"max_size",...F(w),maximum:$})}function X4($,w){return new sg({check:"min_size",...F(w),minimum:$})}function E6($,w){return new $V({check:"size_equals",...F(w),size:$})}function S6($,w){return new wV({check:"max_length",...F(w),maximum:$})}function D4($,w){return new UV({check:"min_length",...F(w),minimum:$})}function A6($,w){return new JV({check:"length_equals",...F(w),length:$})}function Sw($,w){return new vV({check:"string_format",format:"regex",...F(w),pattern:$})}function Aw($){return new zV({check:"string_format",format:"lowercase",...F($)})}function Rw($){return new gV({check:"string_format",format:"uppercase",...F($)})}function kw($,w){return new VV({check:"string_format",format:"includes",...F(w),includes:$})}function Cw($,w){return new GV({check:"string_format",format:"starts_with",...F(w),prefix:$})}function jw($,w){return new _V({check:"string_format",format:"ends_with",...F(w),suffix:$})}function Fv($,w,U){return new XV({check:"property",property:$,schema:w,...F(U)})}function xw($,w){return new IV({check:"mime_type",mime:$,...F(w)})}function e$($){return new NV({check:"overwrite",tx:$})}function rw($){return e$((w)=>w.normalize($))}function yw(){return e$(($)=>$.trim())}function dw(){return e$(($)=>$.toLowerCase())}function mw(){return e$(($)=>$.toUpperCase())}function nw(){return e$(($)=>Gg($))}function s_($,w,U){return new $({type:"array",element:w,...F(U)})}function eL($,w,U){return new $({type:"union",options:w,...F(U)})}function sL($,w,U){return new $({type:"union",options:w,inclusive:!1,...F(U)})}function $H($,w,U,v){return new $({type:"union",options:U,discriminator:w,...F(v)})}function wH($,w,U){return new $({type:"intersection",left:w,right:U})}function UH($,w,U,v){let J=U instanceof d;return new $({type:"tuple",items:w,rest:J?U:null,...F(J?v:U)})}function JH($,w,U,v){return new $({type:"record",keyType:w,valueType:U,...F(v)})}function vH($,w,U,v){return new $({type:"map",keyType:w,valueType:U,...F(v)})}function zH($,w,U){return new $({type:"set",valueType:w,...F(U)})}function gH($,w,U){let v=Array.isArray(w)?Object.fromEntries(w.map((J)=>[J,J])):w;return new $({type:"enum",entries:v,...F(U)})}function VH($,w,U){return new $({type:"enum",entries:w,...F(U)})}function GH($,w,U){return new $({type:"literal",values:Array.isArray(w)?w:[w],...F(U)})}function $X($,w){return new $({type:"file",...F(w)})}function _H($,w){return new $({type:"transform",transform:w})}function XH($,w){return new $({type:"optional",innerType:w})}function IH($,w){return new $({type:"nullable",innerType:w})}function NH($,w,U){return new $({type:"default",innerType:w,get defaultValue(){return typeof U==="function"?U():Xg(U)}})}function WH($,w,U){return new $({type:"nonoptional",innerType:w,...F(U)})}function YH($,w){return new $({type:"success",innerType:w})}function QH($,w,U){return new $({type:"catch",innerType:w,catchValue:typeof U==="function"?U:()=>U})}function PH($,w,U){return new $({type:"pipe",in:w,out:U})}function OH($,w){return new $({type:"readonly",innerType:w})}function BH($,w,U){return new $({type:"template_literal",parts:w,...F(U)})}function qH($,w){return new $({type:"lazy",getter:w})}function LH($,w){return new $({type:"promise",innerType:w})}function wX($,w,U){let v=F(U);return v.abort??(v.abort=!0),new $({type:"custom",check:"custom",fn:w,...v})}function UX($,w,U){return new $({type:"custom",check:"custom",fn:w,...F(U)})}function JX($,w){let U=g9((v)=>{return v.addIssue=(J)=>{if(typeof J==="string")v.issues.push(Tw(J,v.value,U._zod.def));else{let z=J;if(z.fatal)z.continue=!1;z.code??(z.code="custom"),z.input??(z.input=v.value),z.inst??(z.inst=U),z.continue??(z.continue=!U._zod.def.abort),v.issues.push(Tw(z))}},$(v.value,v)},w);return U}function g9($,w){let U=new $$({check:"custom",...F(w)});return U._zod.check=$,U}function vX($){let w=new $$({check:"describe"});return w._zod.onattach=[(U)=>{let v=P$.get(U)??{};P$.add(U,{...v,description:$})}],w._zod.check=()=>{},w}function zX($){let w=new $$({check:"meta"});return w._zod.onattach=[(U)=>{let v=P$.get(U)??{};P$.add(U,{...v,...$})}],w._zod.check=()=>{},w}function gX($,w){let U=F(w),v=U.truthy??["true","1","yes","on","y","enabled"],J=U.falsy??["false","0","no","off","n","disabled"];if(U.case!=="sensitive")v=v.map((W)=>typeof W==="string"?W.toLowerCase():W),J=J.map((W)=>typeof W==="string"?W.toLowerCase():W);let z=new Set(v),g=new Set(J),V=$.Codec??JJ,_=$.Boolean??wJ,X=new($.String??i6)({type:"string",error:U.error}),I=new _({type:"boolean",error:U.error}),N=new V({type:"pipe",in:X,out:I,transform:(W,P)=>{let Q=W;if(U.case!=="sensitive")Q=Q.toLowerCase();if(z.has(Q))return!0;else if(g.has(Q))return!1;else return P.issues.push({code:"invalid_value",expected:"stringbool",values:[...z,...g],input:P.value,inst:N,continue:!1}),{}},reverseTransform:(W,P)=>{if(W===!0)return v[0]||"true";else return J[0]||"false"},error:U.error});return N}function hw($,w,U,v={}){let J=F(v),z={...F(v),check:"string_format",type:"string",format:w,fn:typeof U==="function"?U:(V)=>U.test(V),...J};if(U instanceof RegExp)z.pattern=U;return new $(z)}function l4($){let w=$?.target??"draft-2020-12";if(w==="draft-4")w="draft-04";if(w==="draft-7")w="draft-07";return{processors:$.processors??{},metadataRegistry:$?.metadata??P$,target:w,unrepresentable:$?.unrepresentable??"throw",override:$?.override??(()=>{}),io:$?.io??"output",counter:0,seen:new Map,cycles:$?.cycles??"ref",reused:$?.reused??"inline",external:$?.external??void 0}}function p($,w,U={path:[],schemaPath:[]}){var v;let J=$._zod.def,z=w.seen.get($);if(z){if(z.count++,U.schemaPath.includes($))z.cycle=U.path;return z.schema}let g={schema:{},count:1,cycle:void 0,path:U.path};w.seen.set($,g);let V=$._zod.toJSONSchema?.();if(V)g.schema=V;else{let X={...U,schemaPath:[...U.schemaPath,$],path:U.path};if($._zod.processJSONSchema)$._zod.processJSONSchema(w,g.schema,X);else{let N=g.schema,W=w.processors[J.type];if(!W)throw Error(`[toJSONSchema]: Non-representable type encountered: ${J.type}`);W($,w,N,X)}let I=$._zod.parent;if(I){if(!g.ref)g.ref=I;p(I,w,X),w.seen.get(I).isParent=!0}}let _=w.metadataRegistry.get($);if(_)Object.assign(g.schema,_);if(w.io==="input"&&F$($))delete g.schema.examples,delete g.schema.default;if(w.io==="input"&&"_prefault"in g.schema)(v=g.schema).default??(v.default=g.schema._prefault);return delete g.schema._prefault,w.seen.get($).schema}function t4($,w){let U=$.seen.get(w);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let v=new Map;for(let g of $.seen.entries()){let V=$.metadataRegistry.get(g[0])?.id;if(V){let _=v.get(V);if(_&&_!==g[0])throw Error(`Duplicate schema id "${V}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);v.set(V,g[0])}}let J=(g)=>{let V=$.target==="draft-2020-12"?"$defs":"definitions";if($.external){let I=$.external.registry.get(g[0])?.id,N=$.external.uri??((P)=>P);if(I)return{ref:N(I)};let W=g[1].defId??g[1].schema.id??`schema${$.counter++}`;return g[1].defId=W,{defId:W,ref:`${N("__shared")}#/${V}/${W}`}}if(g[1]===U)return{ref:"#"};let G=`${"#"}/${V}/`,X=g[1].schema.id??`__schema${$.counter++}`;return{defId:X,ref:G+X}},z=(g)=>{if(g[1].schema.$ref)return;let V=g[1],{ref:_,defId:G}=J(g);if(V.def={...V.schema},G)V.defId=G;let X=V.schema;for(let I in X)delete X[I];X.$ref=_};if($.cycles==="throw")for(let g of $.seen.entries()){let V=g[1];if(V.cycle)throw Error(`Cycle detected: #/${V.cycle?.join("/")}/<root>
|
|
256
|
+
`)}Y.write("payload.value = newResult;"),Y.write("return payload;");let q=Y.compile();return(T,L)=>q(g,T,L)},G,z=Gw,i=!Uw.jitless,X=i&&qX.value,W=w.catchall,I;$._zod.parse=(g,Y)=>{I??(I=V.value);let v=g.value;if(!z(v))return g.issues.push({expected:"object",code:"invalid_type",input:v,inst:$}),g;if(i&&X&&Y?.async===!1&&Y.jitless!==!0){if(!G)G=U(w.shape);if(g=G(g,Y),!W)return g;return ov([],v,g,Y,I,$)}return J(g,Y)}});function kv($,w,J,V){for(let G of $)if(G.issues.length===0)return w.value=G.value,w;let U=$.filter((G)=>!v6(G));if(U.length===1)return w.value=U[0].value,U[0];return w.issues.push({code:"invalid_union",input:w.value,inst:J,errors:$.map((G)=>G.issues.map((z)=>C$(z,V,X$())))}),w}var h1=u("$ZodUnion",($,w)=>{m.init($,w),c($._zod,"optin",()=>w.options.some((V)=>V._zod.optin==="optional")?"optional":void 0),c($._zod,"optout",()=>w.options.some((V)=>V._zod.optout==="optional")?"optional":void 0),c($._zod,"values",()=>{if(w.options.every((V)=>V._zod.values))return new Set(w.options.flatMap((V)=>Array.from(V._zod.values)));return}),c($._zod,"pattern",()=>{if(w.options.every((V)=>V._zod.pattern)){let V=w.options.map((U)=>U._zod.pattern);return new RegExp(`^(${V.map((U)=>R1(U.source)).join("|")})$`)}return});let J=w.options.length===1?w.options[0]._zod.run:null;$._zod.parse=(V,U)=>{if(J)return J(V,U);let G=!1,z=[];for(let i of w.options){let N=i._zod.run({value:V.value,issues:[]},U);if(N instanceof Promise)z.push(N),G=!0;else{if(N.issues.length===0)return N;z.push(N)}}if(!G)return kv(z,V,$,U);return Promise.all(z).then((i)=>{return kv(i,V,$,U)})}});function Rv($,w,J,V){let U=$.filter((G)=>G.issues.length===0);if(U.length===1)return w.value=U[0].value,w;if(U.length===0)w.issues.push({code:"invalid_union",input:w.value,inst:J,errors:$.map((G)=>G.issues.map((z)=>C$(z,V,X$())))});else w.issues.push({code:"invalid_union",input:w.value,inst:J,errors:[],inclusive:!1});return w}var Y8=u("$ZodXor",($,w)=>{h1.init($,w),w.inclusive=!1;let J=w.options.length===1?w.options[0]._zod.run:null;$._zod.parse=(V,U)=>{if(J)return J(V,U);let G=!1,z=[];for(let i of w.options){let N=i._zod.run({value:V.value,issues:[]},U);if(N instanceof Promise)z.push(N),G=!0;else z.push(N)}if(!G)return Rv(z,V,$,U);return Promise.all(z).then((i)=>{return Rv(i,V,$,U)})}}),v8=u("$ZodDiscriminatedUnion",($,w)=>{w.inclusive=!1,h1.init($,w);let J=$._zod.parse;c($._zod,"propValues",()=>{let U={};for(let G of w.options){let z=G._zod.propValues;if(!z||Object.keys(z).length===0)throw Error(`Invalid discriminated union option at index "${w.options.indexOf(G)}"`);for(let[i,N]of Object.entries(z)){if(!U[i])U[i]=new Set;for(let X of N)U[i].add(X)}}return U});let V=VJ(()=>{let U=w.options,G=new Map;for(let z of U){let i=z._zod.propValues?.[w.discriminator];if(!i||i.size===0)throw Error(`Invalid discriminated union option at index "${w.options.indexOf(z)}"`);for(let N of i){if(G.has(N))throw Error(`Duplicate discriminator value "${String(N)}"`);G.set(N,z)}}return G});$._zod.parse=(U,G)=>{let z=U.value;if(!Gw(z))return U.issues.push({code:"invalid_type",expected:"object",input:z,inst:$}),U;let i=V.value.get(z?.[w.discriminator]);if(i)return i._zod.run(U,G);if(w.unionFallback||G.direction==="backward")return J(U,G);return U.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:w.discriminator,options:Array.from(V.value.keys()),input:z,path:[w.discriminator],inst:$}),U}}),Q8=u("$ZodIntersection",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{let U=J.value,G=w.left._zod.run({value:U,issues:[]},V),z=w.right._zod.run({value:U,issues:[]},V);if(G instanceof Promise||z instanceof Promise)return Promise.all([G,z]).then(([N,X])=>{return bv(J,N,X)});return bv(J,G,z)}});function fN($,w){if($===w)return{valid:!0,data:$};if($ instanceof Date&&w instanceof Date&&+$===+w)return{valid:!0,data:$};if(Y6($)&&Y6(w)){let J=Object.keys(w),V=Object.keys($).filter((G)=>J.indexOf(G)!==-1),U={...$,...w};for(let G of V){let z=fN($[G],w[G]);if(!z.valid)return{valid:!1,mergeErrorPath:[G,...z.mergeErrorPath]};U[G]=z.data}return{valid:!0,data:U}}if(Array.isArray($)&&Array.isArray(w)){if($.length!==w.length)return{valid:!1,mergeErrorPath:[]};let J=[];for(let V=0;V<$.length;V++){let U=$[V],G=w[V],z=fN(U,G);if(!z.valid)return{valid:!1,mergeErrorPath:[V,...z.mergeErrorPath]};J.push(z.data)}return{valid:!0,data:J}}return{valid:!1,mergeErrorPath:[]}}function bv($,w,J){let V=new Map,U;for(let i of w.issues)if(i.code==="unrecognized_keys"){U??(U=i);for(let N of i.keys){if(!V.has(N))V.set(N,{});V.get(N).l=!0}}else $.issues.push(i);for(let i of J.issues)if(i.code==="unrecognized_keys")for(let N of i.keys){if(!V.has(N))V.set(N,{});V.get(N).r=!0}else $.issues.push(i);let G=[...V].filter(([,i])=>i.l&&i.r).map(([i])=>i);if(G.length&&U)$.issues.push({...U,keys:G});if(v6($))return $;let z=fN(w.value,J.value);if(!z.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(z.mergeErrorPath)}`);return $.value=z.data,$}var tV=u("$ZodTuple",($,w)=>{m.init($,w);let J=w.items;$._zod.parse=(V,U)=>{let G=V.value;if(!Array.isArray(G))return V.issues.push({input:G,inst:$,expected:"tuple",code:"invalid_type"}),V;V.value=[];let z=[],i=Ev(J,"optin"),N=Ev(J,"optout");if(!w.rest){if(G.length<i)return V.issues.push({code:"too_small",minimum:i,inclusive:!0,input:G,inst:$,origin:"array"}),V;if(G.length>J.length)V.issues.push({code:"too_big",maximum:J.length,inclusive:!0,input:G,inst:$,origin:"array"})}let X=Array(J.length);for(let W=0;W<J.length;W++){let I=J[W]._zod.run({value:G[W],issues:[]},U);if(I instanceof Promise)z.push(I.then((g)=>{X[W]=g}));else X[W]=I}if(w.rest){let W=J.length-1,I=G.slice(J.length);for(let g of I){W++;let Y=w.rest._zod.run({value:g,issues:[]},U);if(Y instanceof Promise)z.push(Y.then((v)=>Cv(v,V,W)));else Cv(Y,V,W)}}if(z.length)return Promise.all(z).then(()=>jv(X,V,J,G,N));return jv(X,V,J,G,N)}});function Ev($,w){for(let J=$.length-1;J>=0;J--)if($[J]._zod[w]!=="optional")return J+1;return 0}function Cv($,w,J){if($.issues.length)w.issues.push(...n$(J,$.issues));w.value[J]=$.value}function jv($,w,J,V,U){for(let G=0;G<J.length;G++){let z=$[G],i=G<V.length;if(z.issues.length){if(!i&&G>=U){w.value.length=G;break}w.issues.push(...n$(G,z.issues))}w.value[G]=z.value}for(let G=w.value.length-1;G>=V.length;G--)if(J[G]._zod.optout==="optional"&&w.value[G]===void 0)w.value.length=G;else break;return w}var O8=u("$ZodRecord",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{let U=J.value;if(!Y6(U))return J.issues.push({expected:"record",code:"invalid_type",input:U,inst:$}),J;let G=[],z=w.keyType._zod.values;if(z){J.value={};let i=new Set;for(let X of z)if(typeof X==="string"||typeof X==="number"||typeof X==="symbol"){i.add(typeof X==="number"?X.toString():X);let W=w.keyType._zod.run({value:X,issues:[]},V);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){J.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((Y)=>C$(Y,V,X$())),input:X,path:[X],inst:$});continue}let I=W.value,g=w.valueType._zod.run({value:U[X],issues:[]},V);if(g instanceof Promise)G.push(g.then((Y)=>{if(Y.issues.length)J.issues.push(...n$(X,Y.issues));J.value[I]=Y.value}));else{if(g.issues.length)J.issues.push(...n$(X,g.issues));J.value[I]=g.value}}let N;for(let X in U)if(!i.has(X))N=N??[],N.push(X);if(N&&N.length>0)J.issues.push({code:"unrecognized_keys",input:U,inst:$,keys:N})}else{J.value={};for(let i of Reflect.ownKeys(U)){if(i==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(U,i))continue;let N=w.keyType._zod.run({value:i,issues:[]},V);if(N instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof i==="string"&&n1.test(i)&&N.issues.length){let I=w.keyType._zod.run({value:Number(i),issues:[]},V);if(I instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(I.issues.length===0)N=I}if(N.issues.length){if(w.mode==="loose")J.value[i]=U[i];else J.issues.push({code:"invalid_key",origin:"record",issues:N.issues.map((I)=>C$(I,V,X$())),input:i,path:[i],inst:$});continue}let W=w.valueType._zod.run({value:U[i],issues:[]},V);if(W instanceof Promise)G.push(W.then((I)=>{if(I.issues.length)J.issues.push(...n$(i,I.issues));J.value[N.value]=I.value}));else{if(W.issues.length)J.issues.push(...n$(i,W.issues));J.value[N.value]=W.value}}}if(G.length)return Promise.all(G).then(()=>J);return J}}),P8=u("$ZodMap",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{let U=J.value;if(!(U instanceof Map))return J.issues.push({expected:"map",code:"invalid_type",input:U,inst:$}),J;let G=[];J.value=new Map;for(let[z,i]of U){let N=w.keyType._zod.run({value:z,issues:[]},V),X=w.valueType._zod.run({value:i,issues:[]},V);if(N instanceof Promise||X instanceof Promise)G.push(Promise.all([N,X]).then(([W,I])=>{xv(W,I,J,z,U,$,V)}));else xv(N,X,J,z,U,$,V)}if(G.length)return Promise.all(G).then(()=>J);return J}});function xv($,w,J,V,U,G,z){if($.issues.length)if(b1.has(typeof V))J.issues.push(...n$(V,$.issues));else J.issues.push({code:"invalid_key",origin:"map",input:U,inst:G,issues:$.issues.map((i)=>C$(i,z,X$()))});if(w.issues.length)if(b1.has(typeof V))J.issues.push(...n$(V,w.issues));else J.issues.push({origin:"map",code:"invalid_element",input:U,inst:G,key:V,issues:w.issues.map((i)=>C$(i,z,X$()))});J.value.set($.value,w.value)}var K8=u("$ZodSet",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{let U=J.value;if(!(U instanceof Set))return J.issues.push({input:U,inst:$,expected:"set",code:"invalid_type"}),J;let G=[];J.value=new Set;for(let z of U){let i=w.valueType._zod.run({value:z,issues:[]},V);if(i instanceof Promise)G.push(i.then((N)=>rv(N,J)));else rv(i,J)}if(G.length)return Promise.all(G).then(()=>J);return J}});function rv($,w){if($.issues.length)w.issues.push(...$.issues);w.value.add($.value)}var u8=u("$ZodEnum",($,w)=>{m.init($,w);let J=k1(w.entries),V=new Set(J);$._zod.values=V,$._zod.pattern=new RegExp(`^(${J.filter((U)=>b1.has(typeof U)).map((U)=>typeof U==="string"?w4(U):U.toString()).join("|")})$`),$._zod.parse=(U,G)=>{let z=U.value;if(V.has(z))return U;return U.issues.push({code:"invalid_value",values:J,input:z,inst:$}),U}}),B8=u("$ZodLiteral",($,w)=>{if(m.init($,w),w.values.length===0)throw Error("Cannot create literal schema with no valid values");let J=new Set(w.values);$._zod.values=J,$._zod.pattern=new RegExp(`^(${w.values.map((V)=>typeof V==="string"?w4(V):V?w4(V.toString()):String(V)).join("|")})$`),$._zod.parse=(V,U)=>{let G=V.value;if(J.has(G))return V;return V.issues.push({code:"invalid_value",values:w.values,input:G,inst:$}),V}}),H8=u("$ZodFile",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{let U=J.value;if(U instanceof File)return J;return J.issues.push({expected:"file",code:"invalid_type",input:U,inst:$}),J}}),F8=u("$ZodTransform",($,w)=>{m.init($,w),$._zod.optin="optional",$._zod.parse=(J,V)=>{if(V.direction==="backward")throw new Vw($.constructor.name);let U=w.transform(J.value,J);if(V.async)return(U instanceof Promise?U:Promise.resolve(U)).then((z)=>{return J.value=z,J.fallback=!0,J});if(U instanceof Promise)throw new Z4;return J.value=U,J.fallback=!0,J}});function nv($,w){if(w===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}var oV=u("$ZodOptional",($,w)=>{m.init($,w),$._zod.optin="optional",$._zod.optout="optional",c($._zod,"values",()=>{return w.innerType._zod.values?new Set([...w.innerType._zod.values,void 0]):void 0}),c($._zod,"pattern",()=>{let J=w.innerType._zod.pattern;return J?new RegExp(`^(${R1(J.source)})?$`):void 0}),$._zod.parse=(J,V)=>{if(w.innerType._zod.optin==="optional"){let U=J.value,G=w.innerType._zod.run(J,V);if(G instanceof Promise)return G.then((z)=>nv(z,U));return nv(G,U)}if(J.value===void 0)return J;return w.innerType._zod.run(J,V)}}),q8=u("$ZodExactOptional",($,w)=>{oV.init($,w),c($._zod,"values",()=>w.innerType._zod.values),c($._zod,"pattern",()=>w.innerType._zod.pattern),$._zod.parse=(J,V)=>{return w.innerType._zod.run(J,V)}}),Z8=u("$ZodNullable",($,w)=>{m.init($,w),c($._zod,"optin",()=>w.innerType._zod.optin),c($._zod,"optout",()=>w.innerType._zod.optout),c($._zod,"pattern",()=>{let J=w.innerType._zod.pattern;return J?new RegExp(`^(${R1(J.source)}|null)$`):void 0}),c($._zod,"values",()=>{return w.innerType._zod.values?new Set([...w.innerType._zod.values,null]):void 0}),$._zod.parse=(J,V)=>{if(J.value===null)return J;return w.innerType._zod.run(J,V)}}),T8=u("$ZodDefault",($,w)=>{m.init($,w),$._zod.optin="optional",c($._zod,"values",()=>w.innerType._zod.values),$._zod.parse=(J,V)=>{if(V.direction==="backward")return w.innerType._zod.run(J,V);if(J.value===void 0)return J.value=w.defaultValue,J;let U=w.innerType._zod.run(J,V);if(U instanceof Promise)return U.then((G)=>dv(G,w));return dv(U,w)}});function dv($,w){if($.value===void 0)$.value=w.defaultValue;return $}var D8=u("$ZodPrefault",($,w)=>{m.init($,w),$._zod.optin="optional",c($._zod,"values",()=>w.innerType._zod.values),$._zod.parse=(J,V)=>{if(V.direction==="backward")return w.innerType._zod.run(J,V);if(J.value===void 0)J.value=w.defaultValue;return w.innerType._zod.run(J,V)}}),L8=u("$ZodNonOptional",($,w)=>{m.init($,w),c($._zod,"values",()=>{let J=w.innerType._zod.values;return J?new Set([...J].filter((V)=>V!==void 0)):void 0}),$._zod.parse=(J,V)=>{let U=w.innerType._zod.run(J,V);if(U instanceof Promise)return U.then((G)=>mv(G,$));return mv(U,$)}});function mv($,w){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:w});return $}var f8=u("$ZodSuccess",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{if(V.direction==="backward")throw new Vw("ZodSuccess");let U=w.innerType._zod.run(J,V);if(U instanceof Promise)return U.then((G)=>{return J.value=G.issues.length===0,J});return J.value=U.issues.length===0,J}}),M8=u("$ZodCatch",($,w)=>{m.init($,w),$._zod.optin="optional",c($._zod,"optout",()=>w.innerType._zod.optout),c($._zod,"values",()=>w.innerType._zod.values),$._zod.parse=(J,V)=>{if(V.direction==="backward")return w.innerType._zod.run(J,V);let U=w.innerType._zod.run(J,V);if(U instanceof Promise)return U.then((G)=>{if(J.value=G.value,G.issues.length)J.value=w.catchValue({...J,error:{issues:G.issues.map((z)=>C$(z,V,X$()))},input:J.value}),J.issues=[],J.fallback=!0;return J});if(J.value=U.value,U.issues.length)J.value=w.catchValue({...J,error:{issues:U.issues.map((G)=>C$(G,V,X$()))},input:J.value}),J.issues=[],J.fallback=!0;return J}}),A8=u("$ZodNaN",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{if(typeof J.value!=="number"||!Number.isNaN(J.value))return J.issues.push({input:J.value,inst:$,expected:"nan",code:"invalid_type"}),J;return J}}),pV=u("$ZodPipe",($,w)=>{m.init($,w),c($._zod,"values",()=>w.in._zod.values),c($._zod,"optin",()=>w.in._zod.optin),c($._zod,"optout",()=>w.out._zod.optout),c($._zod,"propValues",()=>w.in._zod.propValues),$._zod.parse=(J,V)=>{if(V.direction==="backward"){let G=w.out._zod.run(J,V);if(G instanceof Promise)return G.then((z)=>dV(z,w.in,V));return dV(G,w.in,V)}let U=w.in._zod.run(J,V);if(U instanceof Promise)return U.then((G)=>dV(G,w.out,V));return dV(U,w.out,V)}});function dV($,w,J){if($.issues.length)return $.aborted=!0,$;return w._zod.run({value:$.value,issues:$.issues,fallback:$.fallback},J)}var c1=u("$ZodCodec",($,w)=>{m.init($,w),c($._zod,"values",()=>w.in._zod.values),c($._zod,"optin",()=>w.in._zod.optin),c($._zod,"optout",()=>w.out._zod.optout),c($._zod,"propValues",()=>w.in._zod.propValues),$._zod.parse=(J,V)=>{if((V.direction||"forward")==="forward"){let G=w.in._zod.run(J,V);if(G instanceof Promise)return G.then((z)=>mV(z,w,V));return mV(G,w,V)}else{let G=w.out._zod.run(J,V);if(G instanceof Promise)return G.then((z)=>mV(z,w,V));return mV(G,w,V)}}});function mV($,w,J){if($.issues.length)return $.aborted=!0,$;if((J.direction||"forward")==="forward"){let U=w.transform($.value,$);if(U instanceof Promise)return U.then((G)=>yV($,G,w.out,J));return yV($,U,w.out,J)}else{let U=w.reverseTransform($.value,$);if(U instanceof Promise)return U.then((G)=>yV($,G,w.in,J));return yV($,U,w.in,J)}}function yV($,w,J,V){if($.issues.length)return $.aborted=!0,$;return J._zod.run({value:w,issues:$.issues},V)}var S8=u("$ZodPreprocess",($,w)=>{pV.init($,w)}),_8=u("$ZodReadonly",($,w)=>{m.init($,w),c($._zod,"propValues",()=>w.innerType._zod.propValues),c($._zod,"values",()=>w.innerType._zod.values),c($._zod,"optin",()=>w.innerType?._zod?.optin),c($._zod,"optout",()=>w.innerType?._zod?.optout),$._zod.parse=(J,V)=>{if(V.direction==="backward")return w.innerType._zod.run(J,V);let U=w.innerType._zod.run(J,V);if(U instanceof Promise)return U.then(yv);return yv(U)}});function yv($){return $.value=Object.freeze($.value),$}var k8=u("$ZodTemplateLiteral",($,w)=>{m.init($,w);let J=[];for(let V of w.parts)if(typeof V==="object"&&V!==null){if(!V._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...V._zod.traits].shift()}`);let U=V._zod.pattern instanceof RegExp?V._zod.pattern.source:V._zod.pattern;if(!U)throw Error(`Invalid template literal part: ${V._zod.traits}`);let G=U.startsWith("^")?1:0,z=U.endsWith("$")?U.length-1:U.length;J.push(U.slice(G,z))}else if(V===null||TX.has(typeof V))J.push(w4(`${V}`));else throw Error(`Invalid template literal part: ${V}`);$._zod.pattern=new RegExp(`^${J.join("")}$`),$._zod.parse=(V,U)=>{if(typeof V.value!=="string")return V.issues.push({input:V.value,inst:$,expected:"string",code:"invalid_type"}),V;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(V.value))return V.issues.push({input:V.value,inst:$,code:"invalid_format",format:w.format??"template_literal",pattern:$._zod.pattern.source}),V;return V}}),R8=u("$ZodFunction",($,w)=>{return m.init($,w),$._def=w,$._zod.def=w,$.implement=(J)=>{if(typeof J!=="function")throw Error("implement() must be called with a function");return function(...V){let U=$._def.input?fV($._def.input,V):V,G=Reflect.apply(J,this,U);if($._def.output)return fV($._def.output,G);return G}},$.implementAsync=(J)=>{if(typeof J!=="function")throw Error("implementAsync() must be called with a function");return async function(...V){let U=$._def.input?await MV($._def.input,V):V,G=await Reflect.apply(J,this,U);if($._def.output)return await MV($._def.output,G);return G}},$._zod.parse=(J,V)=>{if(typeof J.value!=="function")return J.issues.push({code:"invalid_type",expected:"function",input:J.value,inst:$}),J;if($._def.output&&$._def.output._zod.def.type==="promise")J.value=$.implementAsync(J.value);else J.value=$.implement(J.value);return J},$.input=(...J)=>{let V=$.constructor;if(Array.isArray(J[0]))return new V({type:"function",input:new tV({type:"tuple",items:J[0],rest:J[1]}),output:$._def.output});return new V({type:"function",input:J[0],output:$._def.output})},$.output=(J)=>{return new $.constructor({type:"function",input:$._def.input,output:J})},$}),b8=u("$ZodPromise",($,w)=>{m.init($,w),$._zod.parse=(J,V)=>{return Promise.resolve(J.value).then((U)=>w.innerType._zod.run({value:U,issues:[]},V))}}),E8=u("$ZodLazy",($,w)=>{m.init($,w),c($._zod,"innerType",()=>{let J=w;if(!J._cachedInner)J._cachedInner=w.getter();return J._cachedInner}),c($._zod,"pattern",()=>$._zod.innerType?._zod?.pattern),c($._zod,"propValues",()=>$._zod.innerType?._zod?.propValues),c($._zod,"optin",()=>$._zod.innerType?._zod?.optin??void 0),c($._zod,"optout",()=>$._zod.innerType?._zod?.optout??void 0),$._zod.parse=(J,V)=>{return $._zod.innerType._zod.run(J,V)}}),C8=u("$ZodCustom",($,w)=>{J$.init($,w),m.init($,w),$._zod.parse=(J,V)=>{return J},$._zod.check=(J)=>{let V=J.value,U=w.fn(V);if(U instanceof Promise)return U.then((G)=>hv(G,J,V,$));hv(U,J,V,$);return}});function hv($,w,J,V){if(!$){let U={code:"custom",input:J,inst:V,path:[...V._zod.def.path??[]],continue:!V._zod.def.abort};if(V._zod.def.params)U.params=V._zod.def.params;w.issues.push(GJ(U))}}var a1={};R4(a1,{zhTW:()=>SW,zhCN:()=>AW,yo:()=>_W,vi:()=>MW,uz:()=>fW,ur:()=>LW,uk:()=>p1,ua:()=>DW,tr:()=>TW,th:()=>ZW,ta:()=>qW,sv:()=>FW,sl:()=>HW,ru:()=>BW,ro:()=>uW,pt:()=>KW,ps:()=>OW,pl:()=>PW,ota:()=>QW,no:()=>vW,nl:()=>YW,ms:()=>gW,mk:()=>IW,lt:()=>WW,ko:()=>NW,km:()=>t1,kh:()=>XW,ka:()=>iW,ja:()=>zW,it:()=>GW,is:()=>VW,id:()=>UW,hy:()=>JW,hu:()=>wW,hr:()=>$W,he:()=>s8,frCA:()=>e8,fr:()=>a8,fi:()=>p8,fa:()=>o8,es:()=>t8,eo:()=>l8,en:()=>l1,el:()=>c8,de:()=>h8,da:()=>y8,cs:()=>m8,ca:()=>d8,bg:()=>n8,be:()=>r8,az:()=>x8,ar:()=>j8});var TZ=()=>{let $={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function w(U){return $[U]??null}let J={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},V={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${U.expected}، ولكن تم إدخال ${i}`;return`مدخلات غير مقبولة: يفترض إدخال ${G}، ولكن تم إدخال ${i}`}case"invalid_value":if(U.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${D(U.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return` أكبر من اللازم: يفترض أن تكون ${U.origin??"القيمة"} ${G} ${U.maximum.toString()} ${z.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${U.origin??"القيمة"} ${G} ${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`أصغر من اللازم: يفترض لـ ${U.origin} أن يكون ${G} ${U.minimum.toString()} ${z.unit}`;return`أصغر من اللازم: يفترض لـ ${U.origin} أن يكون ${G} ${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${U.prefix}"`;if(G.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${G.suffix}"`;if(G.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${G.includes}"`;if(G.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${G.pattern}`;return`${J[G.format]??U.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${U.divisor}`;case"unrecognized_keys":return`معرف${U.keys.length>1?"ات":""} غريب${U.keys.length>1?"ة":""}: ${H(U.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${U.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${U.origin}`;default:return"مدخل غير مقبول"}}};function j8(){return{localeError:TZ()}}var DZ=()=>{let $={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function w(U){return $[U]??null}let J={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"},V={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Yanlış dəyər: gözlənilən instanceof ${U.expected}, daxil olan ${i}`;return`Yanlış dəyər: gözlənilən ${G}, daxil olan ${i}`}case"invalid_value":if(U.values.length===1)return`Yanlış dəyər: gözlənilən ${D(U.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Çox böyük: gözlənilən ${U.origin??"dəyər"} ${G}${U.maximum.toString()} ${z.unit??"element"}`;return`Çox böyük: gözlənilən ${U.origin??"dəyər"} ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Çox kiçik: gözlənilən ${U.origin} ${G}${U.minimum.toString()} ${z.unit}`;return`Çox kiçik: gözlənilən ${U.origin} ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Yanlış mətn: "${G.prefix}" ilə başlamalıdır`;if(G.format==="ends_with")return`Yanlış mətn: "${G.suffix}" ilə bitməlidir`;if(G.format==="includes")return`Yanlış mətn: "${G.includes}" daxil olmalıdır`;if(G.format==="regex")return`Yanlış mətn: ${G.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${J[G.format]??U.format}`}case"not_multiple_of":return`Yanlış ədəd: ${U.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${U.keys.length>1?"lar":""}: ${H(U.keys,", ")}`;case"invalid_key":return`${U.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${U.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function x8(){return{localeError:DZ()}}function av($,w,J,V){let U=Math.abs($),G=U%10,z=U%100;if(z>=11&&z<=19)return V;if(G===1)return w;if(G>=2&&G<=4)return J;return V}var LZ=()=>{let $={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function w(U){return $[U]??null}let J={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},V={nan:"NaN",number:"лік",array:"масіў"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Няправільны ўвод: чакаўся instanceof ${U.expected}, атрымана ${i}`;return`Няправільны ўвод: чакаўся ${G}, атрымана ${i}`}case"invalid_value":if(U.values.length===1)return`Няправільны ўвод: чакалася ${D(U.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z){let i=Number(U.maximum),N=av(i,z.unit.one,z.unit.few,z.unit.many);return`Занадта вялікі: чакалася, што ${U.origin??"значэнне"} павінна ${z.verb} ${G}${U.maximum.toString()} ${N}`}return`Занадта вялікі: чакалася, што ${U.origin??"значэнне"} павінна быць ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z){let i=Number(U.minimum),N=av(i,z.unit.one,z.unit.few,z.unit.many);return`Занадта малы: чакалася, што ${U.origin} павінна ${z.verb} ${G}${U.minimum.toString()} ${N}`}return`Занадта малы: чакалася, што ${U.origin} павінна быць ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${G.prefix}"`;if(G.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${G.suffix}"`;if(G.format==="includes")return`Няправільны радок: павінен змяшчаць "${G.includes}"`;if(G.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${G.pattern}`;return`Няправільны ${J[G.format]??U.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${U.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${U.keys.length>1?"ключы":"ключ"}: ${H(U.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${U.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${U.origin}`;default:return"Няправільны ўвод"}}};function r8(){return{localeError:LZ()}}var fZ=()=>{let $={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function w(U){return $[U]??null}let J={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},V={nan:"NaN",number:"число",array:"масив"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Невалиден вход: очакван instanceof ${U.expected}, получен ${i}`;return`Невалиден вход: очакван ${G}, получен ${i}`}case"invalid_value":if(U.values.length===1)return`Невалиден вход: очакван ${D(U.values[0])}`;return`Невалидна опция: очаквано едно от ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Твърде голямо: очаква се ${U.origin??"стойност"} да съдържа ${G}${U.maximum.toString()} ${z.unit??"елемента"}`;return`Твърде голямо: очаква се ${U.origin??"стойност"} да бъде ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Твърде малко: очаква се ${U.origin} да съдържа ${G}${U.minimum.toString()} ${z.unit}`;return`Твърде малко: очаква се ${U.origin} да бъде ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Невалиден низ: трябва да започва с "${G.prefix}"`;if(G.format==="ends_with")return`Невалиден низ: трябва да завършва с "${G.suffix}"`;if(G.format==="includes")return`Невалиден низ: трябва да включва "${G.includes}"`;if(G.format==="regex")return`Невалиден низ: трябва да съвпада с ${G.pattern}`;let z="Невалиден";if(G.format==="emoji")z="Невалидно";if(G.format==="datetime")z="Невалидно";if(G.format==="date")z="Невалидна";if(G.format==="time")z="Невалидно";if(G.format==="duration")z="Невалидна";return`${z} ${J[G.format]??U.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${U.divisor}`;case"unrecognized_keys":return`Неразпознат${U.keys.length>1?"и":""} ключ${U.keys.length>1?"ове":""}: ${H(U.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${U.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${U.origin}`;default:return"Невалиден вход"}}};function n8(){return{localeError:fZ()}}var MZ=()=>{let $={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function w(U){return $[U]??null}let J={regex:"entrada",email:"adreça electrònica",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ça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},V={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Tipus invàlid: s'esperava instanceof ${U.expected}, s'ha rebut ${i}`;return`Tipus invàlid: s'esperava ${G}, s'ha rebut ${i}`}case"invalid_value":if(U.values.length===1)return`Valor invàlid: s'esperava ${D(U.values[0])}`;return`Opció invàlida: s'esperava una de ${H(U.values," o ")}`;case"too_big":{let G=U.inclusive?"com a màxim":"menys de",z=w(U.origin);if(z)return`Massa gran: s'esperava que ${U.origin??"el valor"} contingués ${G} ${U.maximum.toString()} ${z.unit??"elements"}`;return`Massa gran: s'esperava que ${U.origin??"el valor"} fos ${G} ${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?"com a mínim":"més de",z=w(U.origin);if(z)return`Massa petit: s'esperava que ${U.origin} contingués ${G} ${U.minimum.toString()} ${z.unit}`;return`Massa petit: s'esperava que ${U.origin} fos ${G} ${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Format invàlid: ha de començar amb "${G.prefix}"`;if(G.format==="ends_with")return`Format invàlid: ha d'acabar amb "${G.suffix}"`;if(G.format==="includes")return`Format invàlid: ha d'incloure "${G.includes}"`;if(G.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${G.pattern}`;return`Format invàlid per a ${J[G.format]??U.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${U.divisor}`;case"unrecognized_keys":return`Clau${U.keys.length>1?"s":""} no reconeguda${U.keys.length>1?"s":""}: ${H(U.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${U.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${U.origin}`;default:return"Entrada invàlida"}}};function d8(){return{localeError:MZ()}}var AZ=()=>{let $={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function w(U){return $[U]??null}let J={regex:"regulární výraz",email:"e-mailová 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 čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},V={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Neplatný vstup: očekáváno instanceof ${U.expected}, obdrženo ${i}`;return`Neplatný vstup: očekáváno ${G}, obdrženo ${i}`}case"invalid_value":if(U.values.length===1)return`Neplatný vstup: očekáváno ${D(U.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Hodnota je příliš velká: ${U.origin??"hodnota"} musí mít ${G}${U.maximum.toString()} ${z.unit??"prvků"}`;return`Hodnota je příliš velká: ${U.origin??"hodnota"} musí být ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Hodnota je příliš malá: ${U.origin??"hodnota"} musí mít ${G}${U.minimum.toString()} ${z.unit??"prvků"}`;return`Hodnota je příliš malá: ${U.origin??"hodnota"} musí být ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Neplatný řetězec: musí začínat na "${G.prefix}"`;if(G.format==="ends_with")return`Neplatný řetězec: musí končit na "${G.suffix}"`;if(G.format==="includes")return`Neplatný řetězec: musí obsahovat "${G.includes}"`;if(G.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${G.pattern}`;return`Neplatný formát ${J[G.format]??U.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${U.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${H(U.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${U.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${U.origin}`;default:return"Neplatný vstup"}}};function m8(){return{localeError:AZ()}}var SZ=()=>{let $={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function w(U){return $[U]??null}let J={regex:"input",email:"e-mailadresse",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 klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},V={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Ugyldigt input: forventede instanceof ${U.expected}, fik ${i}`;return`Ugyldigt input: forventede ${G}, fik ${i}`}case"invalid_value":if(U.values.length===1)return`Ugyldig værdi: forventede ${D(U.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin),i=V[U.origin]??U.origin;if(z)return`For stor: forventede ${i??"value"} ${z.verb} ${G} ${U.maximum.toString()} ${z.unit??"elementer"}`;return`For stor: forventede ${i??"value"} havde ${G} ${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin),i=V[U.origin]??U.origin;if(z)return`For lille: forventede ${i} ${z.verb} ${G} ${U.minimum.toString()} ${z.unit}`;return`For lille: forventede ${i} havde ${G} ${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Ugyldig streng: skal starte med "${G.prefix}"`;if(G.format==="ends_with")return`Ugyldig streng: skal ende med "${G.suffix}"`;if(G.format==="includes")return`Ugyldig streng: skal indeholde "${G.includes}"`;if(G.format==="regex")return`Ugyldig streng: skal matche mønsteret ${G.pattern}`;return`Ugyldig ${J[G.format]??U.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${H(U.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${U.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${U.origin}`;default:return"Ugyldigt input"}}};function y8(){return{localeError:SZ()}}var _Z=()=>{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 w(U){return $[U]??null}let J={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"},V={nan:"NaN",number:"Zahl",array:"Array"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Ungültige Eingabe: erwartet instanceof ${U.expected}, erhalten ${i}`;return`Ungültige Eingabe: erwartet ${G}, erhalten ${i}`}case"invalid_value":if(U.values.length===1)return`Ungültige Eingabe: erwartet ${D(U.values[0])}`;return`Ungültige Option: erwartet eine von ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Zu groß: erwartet, dass ${U.origin??"Wert"} ${G}${U.maximum.toString()} ${z.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${U.origin??"Wert"} ${G}${U.maximum.toString()} ist`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Zu klein: erwartet, dass ${U.origin} ${G}${U.minimum.toString()} ${z.unit} hat`;return`Zu klein: erwartet, dass ${U.origin} ${G}${U.minimum.toString()} ist`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Ungültiger String: muss mit "${G.prefix}" beginnen`;if(G.format==="ends_with")return`Ungültiger String: muss mit "${G.suffix}" enden`;if(G.format==="includes")return`Ungültiger String: muss "${G.includes}" enthalten`;if(G.format==="regex")return`Ungültiger String: muss dem Muster ${G.pattern} entsprechen`;return`Ungültig: ${J[G.format]??U.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${U.divisor} sein`;case"unrecognized_keys":return`${U.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${H(U.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${U.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${U.origin}`;default:return"Ungültige Eingabe"}}};function h8(){return{localeError:_Z()}}var kZ=()=>{let $={string:{unit:"χαρακτήρες",verb:"να έχει"},file:{unit:"bytes",verb:"να έχει"},array:{unit:"στοιχεία",verb:"να έχει"},set:{unit:"στοιχεία",verb:"να έχει"},map:{unit:"καταχωρήσεις",verb:"να έχει"}};function w(U){return $[U]??null}let J={regex:"είσοδος",email:"διεύθυνση 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:"ISO ημερομηνία και ώρα",date:"ISO ημερομηνία",time:"ISO ώρα",duration:"ISO διάρκεια",ipv4:"διεύθυνση IPv4",ipv6:"διεύθυνση IPv6",mac:"διεύθυνση MAC",cidrv4:"εύρος IPv4",cidrv6:"εύρος IPv6",base64:"συμβολοσειρά κωδικοποιημένη σε base64",base64url:"συμβολοσειρά κωδικοποιημένη σε base64url",json_string:"συμβολοσειρά JSON",e164:"αριθμός E.164",jwt:"JWT",template_literal:"είσοδος"},V={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(typeof U.expected==="string"&&/^[A-Z]/.test(U.expected))return`Μη έγκυρη είσοδος: αναμενόταν instanceof ${U.expected}, λήφθηκε ${i}`;return`Μη έγκυρη είσοδος: αναμενόταν ${G}, λήφθηκε ${i}`}case"invalid_value":if(U.values.length===1)return`Μη έγκυρη είσοδος: αναμενόταν ${D(U.values[0])}`;return`Μη έγκυρη επιλογή: αναμενόταν ένα από ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Πολύ μεγάλο: αναμενόταν ${U.origin??"τιμή"} να έχει ${G}${U.maximum.toString()} ${z.unit??"στοιχεία"}`;return`Πολύ μεγάλο: αναμενόταν ${U.origin??"τιμή"} να είναι ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Πολύ μικρό: αναμενόταν ${U.origin} να έχει ${G}${U.minimum.toString()} ${z.unit}`;return`Πολύ μικρό: αναμενόταν ${U.origin} να είναι ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${G.prefix}"`;if(G.format==="ends_with")return`Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${G.suffix}"`;if(G.format==="includes")return`Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${G.includes}"`;if(G.format==="regex")return`Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${G.pattern}`;return`Μη έγκυρο: ${J[G.format]??U.format}`}case"not_multiple_of":return`Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${U.divisor}`;case"unrecognized_keys":return`Άγνωστ${U.keys.length>1?"α":"ο"} κλειδ${U.keys.length>1?"ιά":"ί"}: ${H(U.keys,", ")}`;case"invalid_key":return`Μη έγκυρο κλειδί στο ${U.origin}`;case"invalid_union":return"Μη έγκυρη είσοδος";case"invalid_element":return`Μη έγκυρη τιμή στο ${U.origin}`;default:return"Μη έγκυρη είσοδος"}}};function c8(){return{localeError:kZ()}}var RZ=()=>{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"},map:{unit:"entries",verb:"to have"}};function w(U){return $[U]??null}let J={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},V={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;return`Invalid input: expected ${G}, received ${i}`}case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${D(U.values[0])}`;return`Invalid option: expected one of ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Too big: expected ${U.origin??"value"} to have ${G}${U.maximum.toString()} ${z.unit??"elements"}`;return`Too big: expected ${U.origin??"value"} to be ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Too small: expected ${U.origin} to have ${G}${U.minimum.toString()} ${z.unit}`;return`Too small: expected ${U.origin} to be ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Invalid string: must start with "${G.prefix}"`;if(G.format==="ends_with")return`Invalid string: must end with "${G.suffix}"`;if(G.format==="includes")return`Invalid string: must include "${G.includes}"`;if(G.format==="regex")return`Invalid string: must match pattern ${G.pattern}`;return`Invalid ${J[G.format]??U.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${U.divisor}`;case"unrecognized_keys":return`Unrecognized key${U.keys.length>1?"s":""}: ${H(U.keys,", ")}`;case"invalid_key":return`Invalid key in ${U.origin}`;case"invalid_union":if(U.options&&Array.isArray(U.options)&&U.options.length>0)return`Invalid discriminator value. Expected ${U.options.map((z)=>`'${z}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${U.origin}`;default:return"Invalid input"}}};function l1(){return{localeError:RZ()}}var bZ=()=>{let $={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function w(U){return $[U]??null}let J={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},V={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Nevalida enigo: atendiĝis instanceof ${U.expected}, riceviĝis ${i}`;return`Nevalida enigo: atendiĝis ${G}, riceviĝis ${i}`}case"invalid_value":if(U.values.length===1)return`Nevalida enigo: atendiĝis ${D(U.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Tro granda: atendiĝis ke ${U.origin??"valoro"} havu ${G}${U.maximum.toString()} ${z.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${U.origin??"valoro"} havu ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Tro malgranda: atendiĝis ke ${U.origin} havu ${G}${U.minimum.toString()} ${z.unit}`;return`Tro malgranda: atendiĝis ke ${U.origin} estu ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${G.prefix}"`;if(G.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${G.suffix}"`;if(G.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${G.includes}"`;if(G.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${G.pattern}`;return`Nevalida ${J[G.format]??U.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${U.divisor}`;case"unrecognized_keys":return`Nekonata${U.keys.length>1?"j":""} ŝlosilo${U.keys.length>1?"j":""}: ${H(U.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${U.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${U.origin}`;default:return"Nevalida enigo"}}};function l8(){return{localeError:bZ()}}var EZ=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function w(U){return $[U]??null}let J={regex:"entrada",email:"dirección de correo electrónico",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ón ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},V={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Entrada inválida: se esperaba instanceof ${U.expected}, recibido ${i}`;return`Entrada inválida: se esperaba ${G}, recibido ${i}`}case"invalid_value":if(U.values.length===1)return`Entrada inválida: se esperaba ${D(U.values[0])}`;return`Opción inválida: se esperaba una de ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin),i=V[U.origin]??U.origin;if(z)return`Demasiado grande: se esperaba que ${i??"valor"} tuviera ${G}${U.maximum.toString()} ${z.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${i??"valor"} fuera ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin),i=V[U.origin]??U.origin;if(z)return`Demasiado pequeño: se esperaba que ${i} tuviera ${G}${U.minimum.toString()} ${z.unit}`;return`Demasiado pequeño: se esperaba que ${i} fuera ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Cadena inválida: debe comenzar con "${G.prefix}"`;if(G.format==="ends_with")return`Cadena inválida: debe terminar en "${G.suffix}"`;if(G.format==="includes")return`Cadena inválida: debe incluir "${G.includes}"`;if(G.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${G.pattern}`;return`Inválido ${J[G.format]??U.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${U.divisor}`;case"unrecognized_keys":return`Llave${U.keys.length>1?"s":""} desconocida${U.keys.length>1?"s":""}: ${H(U.keys,", ")}`;case"invalid_key":return`Llave inválida en ${V[U.origin]??U.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${V[U.origin]??U.origin}`;default:return"Entrada inválida"}}};function t8(){return{localeError:EZ()}}var CZ=()=>{let $={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function w(U){return $[U]??null}let J={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},V={nan:"NaN",number:"عدد",array:"آرایه"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`ورودی نامعتبر: میبایست instanceof ${U.expected} میبود، ${i} دریافت شد`;return`ورودی نامعتبر: میبایست ${G} میبود، ${i} دریافت شد`}case"invalid_value":if(U.values.length===1)return`ورودی نامعتبر: میبایست ${D(U.values[0])} میبود`;return`گزینه نامعتبر: میبایست یکی از ${H(U.values,"|")} میبود`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`خیلی بزرگ: ${U.origin??"مقدار"} باید ${G}${U.maximum.toString()} ${z.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${U.origin??"مقدار"} باید ${G}${U.maximum.toString()} باشد`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`خیلی کوچک: ${U.origin} باید ${G}${U.minimum.toString()} ${z.unit} باشد`;return`خیلی کوچک: ${U.origin} باید ${G}${U.minimum.toString()} باشد`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`رشته نامعتبر: باید با "${G.prefix}" شروع شود`;if(G.format==="ends_with")return`رشته نامعتبر: باید با "${G.suffix}" تمام شود`;if(G.format==="includes")return`رشته نامعتبر: باید شامل "${G.includes}" باشد`;if(G.format==="regex")return`رشته نامعتبر: باید با الگوی ${G.pattern} مطابقت داشته باشد`;return`${J[G.format]??U.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${U.divisor} باشد`;case"unrecognized_keys":return`کلید${U.keys.length>1?"های":""} ناشناس: ${H(U.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${U.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${U.origin}`;default:return"ورودی نامعتبر"}}};function o8(){return{localeError:CZ()}}var jZ=()=>{let $={string:{unit:"merkkiä",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äivämäärän"}};function w(U){return $[U]??null}let J={regex:"säännöllinen lauseke",email:"sähköpostiosoite",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äivämäärä",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"},V={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Virheellinen tyyppi: odotettiin instanceof ${U.expected}, oli ${i}`;return`Virheellinen tyyppi: odotettiin ${G}, oli ${i}`}case"invalid_value":if(U.values.length===1)return`Virheellinen syöte: täytyy olla ${D(U.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Liian suuri: ${z.subject} täytyy olla ${G}${U.maximum.toString()} ${z.unit}`.trim();return`Liian suuri: arvon täytyy olla ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Liian pieni: ${z.subject} täytyy olla ${G}${U.minimum.toString()} ${z.unit}`.trim();return`Liian pieni: arvon täytyy olla ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${G.prefix}"`;if(G.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${G.suffix}"`;if(G.format==="includes")return`Virheellinen syöte: täytyy sisältää "${G.includes}"`;if(G.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${G.pattern}`;return`Virheellinen ${J[G.format]??U.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${U.divisor} monikerta`;case"unrecognized_keys":return`${U.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${H(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öte"}}};function p8(){return{localeError:jZ()}}var xZ=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function w(U){return $[U]??null}let J={regex:"entrée",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ée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},V={string:"chaîne",number:"nombre",int:"entier",boolean:"booléen",bigint:"grand entier",symbol:"symbole",undefined:"indéfini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Entrée invalide : instanceof ${U.expected} attendu, ${i} reçu`;return`Entrée invalide : ${G} attendu, ${i} reçu`}case"invalid_value":if(U.values.length===1)return`Entrée invalide : ${D(U.values[0])} attendu`;return`Option invalide : une valeur parmi ${H(U.values,"|")} attendue`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Trop grand : ${V[U.origin]??"valeur"} doit ${z.verb} ${G}${U.maximum.toString()} ${z.unit??"élément(s)"}`;return`Trop grand : ${V[U.origin]??"valeur"} doit être ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Trop petit : ${V[U.origin]??"valeur"} doit ${z.verb} ${G}${U.minimum.toString()} ${z.unit}`;return`Trop petit : ${V[U.origin]??"valeur"} doit être ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Chaîne invalide : doit commencer par "${G.prefix}"`;if(G.format==="ends_with")return`Chaîne invalide : doit se terminer par "${G.suffix}"`;if(G.format==="includes")return`Chaîne invalide : doit inclure "${G.includes}"`;if(G.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${G.pattern}`;return`${J[G.format]??U.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${U.divisor}`;case"unrecognized_keys":return`Clé${U.keys.length>1?"s":""} non reconnue${U.keys.length>1?"s":""} : ${H(U.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${U.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${U.origin}`;default:return"Entrée invalide"}}};function a8(){return{localeError:xZ()}}var rZ=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function w(U){return $[U]??null}let J={regex:"entrée",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ée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},V={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Entrée invalide : attendu instanceof ${U.expected}, reçu ${i}`;return`Entrée invalide : attendu ${G}, reçu ${i}`}case"invalid_value":if(U.values.length===1)return`Entrée invalide : attendu ${D(U.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"≤":"<",z=w(U.origin);if(z)return`Trop grand : attendu que ${U.origin??"la valeur"} ait ${G}${U.maximum.toString()} ${z.unit}`;return`Trop grand : attendu que ${U.origin??"la valeur"} soit ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?"≥":">",z=w(U.origin);if(z)return`Trop petit : attendu que ${U.origin} ait ${G}${U.minimum.toString()} ${z.unit}`;return`Trop petit : attendu que ${U.origin} soit ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Chaîne invalide : doit commencer par "${G.prefix}"`;if(G.format==="ends_with")return`Chaîne invalide : doit se terminer par "${G.suffix}"`;if(G.format==="includes")return`Chaîne invalide : doit inclure "${G.includes}"`;if(G.format==="regex")return`Chaîne invalide : doit correspondre au motif ${G.pattern}`;return`${J[G.format]??U.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${U.divisor}`;case"unrecognized_keys":return`Clé${U.keys.length>1?"s":""} non reconnue${U.keys.length>1?"s":""} : ${H(U.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${U.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${U.origin}`;default:return"Entrée invalide"}}};function e8(){return{localeError:rZ()}}var nZ=()=>{let $={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},w={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},J=(X)=>X?$[X]:void 0,V=(X)=>{let W=J(X);if(W)return W.label;return X??$.unknown.label},U=(X)=>`ה${V(X)}`,G=(X)=>{return(J(X)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות"},z=(X)=>{if(!X)return null;return w[X]??null},i={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},N={nan:"NaN"};return(X)=>{switch(X.code){case"invalid_type":{let W=X.expected,I=N[W??""]??V(W),g=f(X.input),Y=N[g]??$[g]?.label??g;if(/^[A-Z]/.test(X.expected))return`קלט לא תקין: צריך להיות instanceof ${X.expected}, התקבל ${Y}`;return`קלט לא תקין: צריך להיות ${I}, התקבל ${Y}`}case"invalid_value":{if(X.values.length===1)return`ערך לא תקין: הערך חייב להיות ${D(X.values[0])}`;let W=X.values.map((Y)=>D(Y));if(X.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${W[0]} או ${W[1]}`;let I=W[W.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${W.slice(0,-1).join(", ")} או ${I}`}case"too_big":{let W=z(X.origin),I=U(X.origin??"value");if(X.origin==="string")return`${W?.longLabel??"ארוך"} מדי: ${I} צריכה להכיל ${X.maximum.toString()} ${W?.unit??""} ${X.inclusive?"או פחות":"לכל היותר"}`.trim();if(X.origin==="number"){let v=X.inclusive?`קטן או שווה ל-${X.maximum}`:`קטן מ-${X.maximum}`;return`גדול מדי: ${I} צריך להיות ${v}`}if(X.origin==="array"||X.origin==="set"){let v=X.origin==="set"?"צריכה":"צריך",O=X.inclusive?`${X.maximum} ${W?.unit??""} או פחות`:`פחות מ-${X.maximum} ${W?.unit??""}`;return`גדול מדי: ${I} ${v} להכיל ${O}`.trim()}let g=X.inclusive?"<=":"<",Y=G(X.origin??"value");if(W?.unit)return`${W.longLabel} מדי: ${I} ${Y} ${g}${X.maximum.toString()} ${W.unit}`;return`${W?.longLabel??"גדול"} מדי: ${I} ${Y} ${g}${X.maximum.toString()}`}case"too_small":{let W=z(X.origin),I=U(X.origin??"value");if(X.origin==="string")return`${W?.shortLabel??"קצר"} מדי: ${I} צריכה להכיל ${X.minimum.toString()} ${W?.unit??""} ${X.inclusive?"או יותר":"לפחות"}`.trim();if(X.origin==="number"){let v=X.inclusive?`גדול או שווה ל-${X.minimum}`:`גדול מ-${X.minimum}`;return`קטן מדי: ${I} צריך להיות ${v}`}if(X.origin==="array"||X.origin==="set"){let v=X.origin==="set"?"צריכה":"צריך";if(X.minimum===1&&X.inclusive){let P=X.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${I} ${v} להכיל ${P}`}let O=X.inclusive?`${X.minimum} ${W?.unit??""} או יותר`:`יותר מ-${X.minimum} ${W?.unit??""}`;return`קטן מדי: ${I} ${v} להכיל ${O}`.trim()}let g=X.inclusive?">=":">",Y=G(X.origin??"value");if(W?.unit)return`${W.shortLabel} מדי: ${I} ${Y} ${g}${X.minimum.toString()} ${W.unit}`;return`${W?.shortLabel??"קטן"} מדי: ${I} ${Y} ${g}${X.minimum.toString()}`}case"invalid_format":{let W=X;if(W.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${W.prefix}"`;if(W.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${W.suffix}"`;if(W.format==="includes")return`המחרוזת חייבת לכלול "${W.includes}"`;if(W.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${W.pattern}`;let I=i[W.format],g=I?.label??W.format,v=(I?.gender??"m")==="f"?"תקינה":"תקין";return`${g} לא ${v}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${X.divisor}`;case"unrecognized_keys":return`מפתח${X.keys.length>1?"ות":""} לא מזוה${X.keys.length>1?"ים":"ה"}: ${H(X.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${U(X.origin??"array")}`;default:return"קלט לא תקין"}}};function s8(){return{localeError:nZ()}}var dZ=()=>{let $={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function w(U){return $[U]??null}let J={regex:"unos",email:"email 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:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},V={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Neispravan unos: očekuje se instanceof ${U.expected}, a primljeno je ${i}`;return`Neispravan unos: očekuje se ${G}, a primljeno je ${i}`}case"invalid_value":if(U.values.length===1)return`Neispravna vrijednost: očekivano ${D(U.values[0])}`;return`Neispravna opcija: očekivano jedno od ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin),i=V[U.origin]??U.origin;if(z)return`Preveliko: očekivano da ${i??"vrijednost"} ima ${G}${U.maximum.toString()} ${z.unit??"elemenata"}`;return`Preveliko: očekivano da ${i??"vrijednost"} bude ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin),i=V[U.origin]??U.origin;if(z)return`Premalo: očekivano da ${i} ima ${G}${U.minimum.toString()} ${z.unit}`;return`Premalo: očekivano da ${i} bude ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Neispravan tekst: mora započinjati s "${G.prefix}"`;if(G.format==="ends_with")return`Neispravan tekst: mora završavati s "${G.suffix}"`;if(G.format==="includes")return`Neispravan tekst: mora sadržavati "${G.includes}"`;if(G.format==="regex")return`Neispravan tekst: mora odgovarati uzorku ${G.pattern}`;return`Neispravna ${J[G.format]??U.format}`}case"not_multiple_of":return`Neispravan broj: mora biti višekratnik od ${U.divisor}`;case"unrecognized_keys":return`Neprepoznat${U.keys.length>1?"i ključevi":" ključ"}: ${H(U.keys,", ")}`;case"invalid_key":return`Neispravan ključ u ${V[U.origin]??U.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${V[U.origin]??U.origin}`;default:return"Neispravan unos"}}};function $W(){return{localeError:dZ()}}var mZ=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function w(U){return $[U]??null}let J={regex:"bemenet",email:"email cím",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őbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},V={nan:"NaN",number:"szám",array:"tömb"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Érvénytelen bemenet: a várt érték instanceof ${U.expected}, a kapott érték ${i}`;return`Érvénytelen bemenet: a várt érték ${G}, a kapott érték ${i}`}case"invalid_value":if(U.values.length===1)return`Érvénytelen bemenet: a várt érték ${D(U.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Túl nagy: ${U.origin??"érték"} mérete túl nagy ${G}${U.maximum.toString()} ${z.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${U.origin??"érték"} túl nagy: ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Túl kicsi: a bemeneti érték ${U.origin} mérete túl kicsi ${G}${U.minimum.toString()} ${z.unit}`;return`Túl kicsi: a bemeneti érték ${U.origin} túl kicsi ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Érvénytelen string: "${G.prefix}" értékkel kell kezdődnie`;if(G.format==="ends_with")return`Érvénytelen string: "${G.suffix}" értékkel kell végződnie`;if(G.format==="includes")return`Érvénytelen string: "${G.includes}" értéket kell tartalmaznia`;if(G.format==="regex")return`Érvénytelen string: ${G.pattern} mintának kell megfelelnie`;return`Érvénytelen ${J[G.format]??U.format}`}case"not_multiple_of":return`Érvénytelen szám: ${U.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${U.keys.length>1?"s":""}: ${H(U.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${U.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${U.origin}`;default:return"Érvénytelen bemenet"}}};function wW(){return{localeError:mZ()}}function ev($,w,J){return Math.abs($)===1?w:J}function IJ($){if(!$)return"";let w=["ա","ե","ը","ի","ո","ու","օ"],J=$[$.length-1];return $+(w.includes(J)?"ն":"ը")}var yZ=()=>{let $={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function w(U){return $[U]??null}let J={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},V={nan:"NaN",number:"թիվ",array:"զանգված"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${U.expected}, ստացվել է ${i}`;return`Սխալ մուտքագրում․ սպասվում էր ${G}, ստացվել է ${i}`}case"invalid_value":if(U.values.length===1)return`Սխալ մուտքագրում․ սպասվում էր ${D(U.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z){let i=Number(U.maximum),N=ev(i,z.unit.one,z.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${IJ(U.origin??"արժեք")} կունենա ${G}${U.maximum.toString()} ${N}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${IJ(U.origin??"արժեք")} լինի ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z){let i=Number(U.minimum),N=ev(i,z.unit.one,z.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${IJ(U.origin)} կունենա ${G}${U.minimum.toString()} ${N}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${IJ(U.origin)} լինի ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Սխալ տող․ պետք է սկսվի "${G.prefix}"-ով`;if(G.format==="ends_with")return`Սխալ տող․ պետք է ավարտվի "${G.suffix}"-ով`;if(G.format==="includes")return`Սխալ տող․ պետք է պարունակի "${G.includes}"`;if(G.format==="regex")return`Սխալ տող․ պետք է համապատասխանի ${G.pattern} ձևաչափին`;return`Սխալ ${J[G.format]??U.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${U.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${U.keys.length>1?"ներ":""}. ${H(U.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${IJ(U.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${IJ(U.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function JW(){return{localeError:yZ()}}var hZ=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function w(U){return $[U]??null}let J={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"},V={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Input tidak valid: diharapkan instanceof ${U.expected}, diterima ${i}`;return`Input tidak valid: diharapkan ${G}, diterima ${i}`}case"invalid_value":if(U.values.length===1)return`Input tidak valid: diharapkan ${D(U.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Terlalu besar: diharapkan ${U.origin??"value"} memiliki ${G}${U.maximum.toString()} ${z.unit??"elemen"}`;return`Terlalu besar: diharapkan ${U.origin??"value"} menjadi ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Terlalu kecil: diharapkan ${U.origin} memiliki ${G}${U.minimum.toString()} ${z.unit}`;return`Terlalu kecil: diharapkan ${U.origin} menjadi ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`String tidak valid: harus dimulai dengan "${G.prefix}"`;if(G.format==="ends_with")return`String tidak valid: harus berakhir dengan "${G.suffix}"`;if(G.format==="includes")return`String tidak valid: harus menyertakan "${G.includes}"`;if(G.format==="regex")return`String tidak valid: harus sesuai pola ${G.pattern}`;return`${J[G.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":""}: ${H(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 UW(){return{localeError:hZ()}}var cZ=()=>{let $={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function w(U){return $[U]??null}let J={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},V={nan:"NaN",number:"númer",array:"fylki"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Rangt gildi: Þú slóst inn ${i} þar sem á að vera instanceof ${U.expected}`;return`Rangt gildi: Þú slóst inn ${i} þar sem á að vera ${G}`}case"invalid_value":if(U.values.length===1)return`Rangt gildi: gert ráð fyrir ${D(U.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Of stórt: gert er ráð fyrir að ${U.origin??"gildi"} hafi ${G}${U.maximum.toString()} ${z.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${U.origin??"gildi"} sé ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Of lítið: gert er ráð fyrir að ${U.origin} hafi ${G}${U.minimum.toString()} ${z.unit}`;return`Of lítið: gert er ráð fyrir að ${U.origin} sé ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Ógildur strengur: verður að byrja á "${G.prefix}"`;if(G.format==="ends_with")return`Ógildur strengur: verður að enda á "${G.suffix}"`;if(G.format==="includes")return`Ógildur strengur: verður að innihalda "${G.includes}"`;if(G.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${G.pattern}`;return`Rangt ${J[G.format]??U.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${U.divisor}`;case"unrecognized_keys":return`Óþekkt ${U.keys.length>1?"ir lyklar":"ur lykill"}: ${H(U.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${U.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${U.origin}`;default:return"Rangt gildi"}}};function VW(){return{localeError:cZ()}}var lZ=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function w(U){return $[U]??null}let J={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"},V={nan:"NaN",number:"numero",array:"vettore"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Input non valido: atteso instanceof ${U.expected}, ricevuto ${i}`;return`Input non valido: atteso ${G}, ricevuto ${i}`}case"invalid_value":if(U.values.length===1)return`Input non valido: atteso ${D(U.values[0])}`;return`Opzione non valida: atteso uno tra ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Troppo grande: ${U.origin??"valore"} deve avere ${G}${U.maximum.toString()} ${z.unit??"elementi"}`;return`Troppo grande: ${U.origin??"valore"} deve essere ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Troppo piccolo: ${U.origin} deve avere ${G}${U.minimum.toString()} ${z.unit}`;return`Troppo piccolo: ${U.origin} deve essere ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Stringa non valida: deve iniziare con "${G.prefix}"`;if(G.format==="ends_with")return`Stringa non valida: deve terminare con "${G.suffix}"`;if(G.format==="includes")return`Stringa non valida: deve includere "${G.includes}"`;if(G.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${G.pattern}`;return`Input non valido: ${J[G.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"}: ${H(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 GW(){return{localeError:lZ()}}var tZ=()=>{let $={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function w(U){return $[U]??null}let J={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},V={nan:"NaN",number:"数値",array:"配列"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`無効な入力: instanceof ${U.expected}が期待されましたが、${i}が入力されました`;return`無効な入力: ${G}が期待されましたが、${i}が入力されました`}case"invalid_value":if(U.values.length===1)return`無効な入力: ${D(U.values[0])}が期待されました`;return`無効な選択: ${H(U.values,"、")}のいずれかである必要があります`;case"too_big":{let G=U.inclusive?"以下である":"より小さい",z=w(U.origin);if(z)return`大きすぎる値: ${U.origin??"値"}は${U.maximum.toString()}${z.unit??"要素"}${G}必要があります`;return`大きすぎる値: ${U.origin??"値"}は${U.maximum.toString()}${G}必要があります`}case"too_small":{let G=U.inclusive?"以上である":"より大きい",z=w(U.origin);if(z)return`小さすぎる値: ${U.origin}は${U.minimum.toString()}${z.unit}${G}必要があります`;return`小さすぎる値: ${U.origin}は${U.minimum.toString()}${G}必要があります`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`無効な文字列: "${G.prefix}"で始まる必要があります`;if(G.format==="ends_with")return`無効な文字列: "${G.suffix}"で終わる必要があります`;if(G.format==="includes")return`無効な文字列: "${G.includes}"を含む必要があります`;if(G.format==="regex")return`無効な文字列: パターン${G.pattern}に一致する必要があります`;return`無効な${J[G.format]??U.format}`}case"not_multiple_of":return`無効な数値: ${U.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${U.keys.length>1?"群":""}: ${H(U.keys,"、")}`;case"invalid_key":return`${U.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${U.origin}内の無効な値`;default:return"無効な入力"}}};function zW(){return{localeError:tZ()}}var oZ=()=>{let $={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function w(U){return $[U]??null}let J={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული ველი",base64url:"base64url-კოდირებული ველი",json_string:"JSON ველი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},V={nan:"NaN",number:"რიცხვი",string:"ველი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${U.expected}, მიღებული ${i}`;return`არასწორი შეყვანა: მოსალოდნელი ${G}, მიღებული ${i}`}case"invalid_value":if(U.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${D(U.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${H(U.values,"|")}-დან`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`ზედმეტად დიდი: მოსალოდნელი ${U.origin??"მნიშვნელობა"} ${z.verb} ${G}${U.maximum.toString()} ${z.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${U.origin??"მნიშვნელობა"} იყოს ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`ზედმეტად პატარა: მოსალოდნელი ${U.origin} ${z.verb} ${G}${U.minimum.toString()} ${z.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${U.origin} იყოს ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`არასწორი ველი: უნდა იწყებოდეს "${G.prefix}"-ით`;if(G.format==="ends_with")return`არასწორი ველი: უნდა მთავრდებოდეს "${G.suffix}"-ით`;if(G.format==="includes")return`არასწორი ველი: უნდა შეიცავდეს "${G.includes}"-ს`;if(G.format==="regex")return`არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${G.pattern}`;return`არასწორი ${J[G.format]??U.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${U.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${U.keys.length>1?"ები":"ი"}: ${H(U.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${U.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${U.origin}-ში`;default:return"არასწორი შეყვანა"}}};function iW(){return{localeError:oZ()}}var pZ=()=>{let $={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function w(U){return $[U]??null}let J={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},V={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${U.expected} ប៉ុន្តែទទួលបាន ${i}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${G} ប៉ុន្តែទទួលបាន ${i}`}case"invalid_value":if(U.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${D(U.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`ធំពេក៖ ត្រូវការ ${U.origin??"តម្លៃ"} ${G} ${U.maximum.toString()} ${z.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${U.origin??"តម្លៃ"} ${G} ${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`តូចពេក៖ ត្រូវការ ${U.origin} ${G} ${U.minimum.toString()} ${z.unit}`;return`តូចពេក៖ ត្រូវការ ${U.origin} ${G} ${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${G.prefix}"`;if(G.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${G.suffix}"`;if(G.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${G.includes}"`;if(G.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${G.pattern}`;return`មិនត្រឹមត្រូវ៖ ${J[G.format]??U.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${U.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${H(U.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${U.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${U.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function t1(){return{localeError:pZ()}}function XW(){return t1()}var aZ=()=>{let $={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function w(U){return $[U]??null}let J={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},V={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`잘못된 입력: 예상 타입은 instanceof ${U.expected}, 받은 타입은 ${i}입니다`;return`잘못된 입력: 예상 타입은 ${G}, 받은 타입은 ${i}입니다`}case"invalid_value":if(U.values.length===1)return`잘못된 입력: 값은 ${D(U.values[0])} 이어야 합니다`;return`잘못된 옵션: ${H(U.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let G=U.inclusive?"이하":"미만",z=G==="미만"?"이어야 합니다":"여야 합니다",i=w(U.origin),N=i?.unit??"요소";if(i)return`${U.origin??"값"}이 너무 큽니다: ${U.maximum.toString()}${N} ${G}${z}`;return`${U.origin??"값"}이 너무 큽니다: ${U.maximum.toString()} ${G}${z}`}case"too_small":{let G=U.inclusive?"이상":"초과",z=G==="이상"?"이어야 합니다":"여야 합니다",i=w(U.origin),N=i?.unit??"요소";if(i)return`${U.origin??"값"}이 너무 작습니다: ${U.minimum.toString()}${N} ${G}${z}`;return`${U.origin??"값"}이 너무 작습니다: ${U.minimum.toString()} ${G}${z}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`잘못된 문자열: "${G.prefix}"(으)로 시작해야 합니다`;if(G.format==="ends_with")return`잘못된 문자열: "${G.suffix}"(으)로 끝나야 합니다`;if(G.format==="includes")return`잘못된 문자열: "${G.includes}"을(를) 포함해야 합니다`;if(G.format==="regex")return`잘못된 문자열: 정규식 ${G.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${J[G.format]??U.format}`}case"not_multiple_of":return`잘못된 숫자: ${U.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${H(U.keys,", ")}`;case"invalid_key":return`잘못된 키: ${U.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${U.origin}`;default:return"잘못된 입력"}}};function NW(){return{localeError:aZ()}}var o1=($)=>{return $.charAt(0).toUpperCase()+$.slice(1)};function sv($){let w=Math.abs($),J=w%10,V=w%100;if(V>=11&&V<=19||J===0)return"many";if(J===1)return"one";return"few"}var eZ=()=>{let $={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function w(U,G,z,i){let N=$[U]??null;if(N===null)return N;return{unit:N.unit[G],verb:N.verb[i][z?"inclusive":"notInclusive"]}}let J={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},V={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Gautas tipas ${i}, o tikėtasi - instanceof ${U.expected}`;return`Gautas tipas ${i}, o tikėtasi - ${G}`}case"invalid_value":if(U.values.length===1)return`Privalo būti ${D(U.values[0])}`;return`Privalo būti vienas iš ${H(U.values,"|")} pasirinkimų`;case"too_big":{let G=V[U.origin]??U.origin,z=w(U.origin,sv(Number(U.maximum)),U.inclusive??!1,"smaller");if(z?.verb)return`${o1(G??U.origin??"reikšmė")} ${z.verb} ${U.maximum.toString()} ${z.unit??"elementų"}`;let i=U.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${o1(G??U.origin??"reikšmė")} turi būti ${i} ${U.maximum.toString()} ${z?.unit}`}case"too_small":{let G=V[U.origin]??U.origin,z=w(U.origin,sv(Number(U.minimum)),U.inclusive??!1,"bigger");if(z?.verb)return`${o1(G??U.origin??"reikšmė")} ${z.verb} ${U.minimum.toString()} ${z.unit??"elementų"}`;let i=U.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${o1(G??U.origin??"reikšmė")} turi būti ${i} ${U.minimum.toString()} ${z?.unit}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Eilutė privalo prasidėti "${G.prefix}"`;if(G.format==="ends_with")return`Eilutė privalo pasibaigti "${G.suffix}"`;if(G.format==="includes")return`Eilutė privalo įtraukti "${G.includes}"`;if(G.format==="regex")return`Eilutė privalo atitikti ${G.pattern}`;return`Neteisingas ${J[G.format]??U.format}`}case"not_multiple_of":return`Skaičius privalo būti ${U.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${U.keys.length>1?"i":"as"} rakt${U.keys.length>1?"ai":"as"}: ${H(U.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let G=V[U.origin]??U.origin;return`${o1(G??U.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function WW(){return{localeError:eZ()}}var sZ=()=>{let $={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function w(U){return $[U]??null}let J={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},V={nan:"NaN",number:"број",array:"низа"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Грешен внес: се очекува instanceof ${U.expected}, примено ${i}`;return`Грешен внес: се очекува ${G}, примено ${i}`}case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${D(U.values[0])}`;return`Грешана опција: се очекува една ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Премногу голем: се очекува ${U.origin??"вредноста"} да има ${G}${U.maximum.toString()} ${z.unit??"елементи"}`;return`Премногу голем: се очекува ${U.origin??"вредноста"} да биде ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Премногу мал: се очекува ${U.origin} да има ${G}${U.minimum.toString()} ${z.unit}`;return`Премногу мал: се очекува ${U.origin} да биде ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Неважечка низа: мора да започнува со "${G.prefix}"`;if(G.format==="ends_with")return`Неважечка низа: мора да завршува со "${G.suffix}"`;if(G.format==="includes")return`Неважечка низа: мора да вклучува "${G.includes}"`;if(G.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${G.pattern}`;return`Invalid ${J[G.format]??U.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${H(U.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${U.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${U.origin}`;default:return"Грешен внес"}}};function IW(){return{localeError:sZ()}}var $T=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function w(U){return $[U]??null}let J={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"},V={nan:"NaN",number:"nombor"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Input tidak sah: dijangka instanceof ${U.expected}, diterima ${i}`;return`Input tidak sah: dijangka ${G}, diterima ${i}`}case"invalid_value":if(U.values.length===1)return`Input tidak sah: dijangka ${D(U.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Terlalu besar: dijangka ${U.origin??"nilai"} ${z.verb} ${G}${U.maximum.toString()} ${z.unit??"elemen"}`;return`Terlalu besar: dijangka ${U.origin??"nilai"} adalah ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Terlalu kecil: dijangka ${U.origin} ${z.verb} ${G}${U.minimum.toString()} ${z.unit}`;return`Terlalu kecil: dijangka ${U.origin} adalah ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`String tidak sah: mesti bermula dengan "${G.prefix}"`;if(G.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${G.suffix}"`;if(G.format==="includes")return`String tidak sah: mesti mengandungi "${G.includes}"`;if(G.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${G.pattern}`;return`${J[G.format]??U.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${U.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${H(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 gW(){return{localeError:$T()}}var wT=()=>{let $={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function w(U){return $[U]??null}let J={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"},V={nan:"NaN",number:"getal"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Ongeldige invoer: verwacht instanceof ${U.expected}, ontving ${i}`;return`Ongeldige invoer: verwacht ${G}, ontving ${i}`}case"invalid_value":if(U.values.length===1)return`Ongeldige invoer: verwacht ${D(U.values[0])}`;return`Ongeldige optie: verwacht één van ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin),i=U.origin==="date"?"laat":U.origin==="string"?"lang":"groot";if(z)return`Te ${i}: verwacht dat ${U.origin??"waarde"} ${G}${U.maximum.toString()} ${z.unit??"elementen"} ${z.verb}`;return`Te ${i}: verwacht dat ${U.origin??"waarde"} ${G}${U.maximum.toString()} is`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin),i=U.origin==="date"?"vroeg":U.origin==="string"?"kort":"klein";if(z)return`Te ${i}: verwacht dat ${U.origin} ${G}${U.minimum.toString()} ${z.unit} ${z.verb}`;return`Te ${i}: verwacht dat ${U.origin} ${G}${U.minimum.toString()} is`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Ongeldige tekst: moet met "${G.prefix}" beginnen`;if(G.format==="ends_with")return`Ongeldige tekst: moet op "${G.suffix}" eindigen`;if(G.format==="includes")return`Ongeldige tekst: moet "${G.includes}" bevatten`;if(G.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${G.pattern}`;return`Ongeldig: ${J[G.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":""}: ${H(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 YW(){return{localeError:wT()}}var JT=()=>{let $={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function w(U){return $[U]??null}let J={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åde",ipv6:"IPv6-område",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"},V={nan:"NaN",number:"tall",array:"liste"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Ugyldig input: forventet instanceof ${U.expected}, fikk ${i}`;return`Ugyldig input: forventet ${G}, fikk ${i}`}case"invalid_value":if(U.values.length===1)return`Ugyldig verdi: forventet ${D(U.values[0])}`;return`Ugyldig valg: forventet en av ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`For stor(t): forventet ${U.origin??"value"} til å ha ${G}${U.maximum.toString()} ${z.unit??"elementer"}`;return`For stor(t): forventet ${U.origin??"value"} til å ha ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`For lite(n): forventet ${U.origin} til å ha ${G}${U.minimum.toString()} ${z.unit}`;return`For lite(n): forventet ${U.origin} til å ha ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Ugyldig streng: må starte med "${G.prefix}"`;if(G.format==="ends_with")return`Ugyldig streng: må ende med "${G.suffix}"`;if(G.format==="includes")return`Ugyldig streng: må inneholde "${G.includes}"`;if(G.format==="regex")return`Ugyldig streng: må matche mønsteret ${G.pattern}`;return`Ugyldig ${J[G.format]??U.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${H(U.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${U.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${U.origin}`;default:return"Ugyldig input"}}};function vW(){return{localeError:JT()}}var UT=()=>{let $={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function w(U){return $[U]??null}let J={regex:"giren",email:"epostagâh",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âmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},V={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Fâsit giren: umulan instanceof ${U.expected}, alınan ${i}`;return`Fâsit giren: umulan ${G}, alınan ${i}`}case"invalid_value":if(U.values.length===1)return`Fâsit giren: umulan ${D(U.values[0])}`;return`Fâsit tercih: mûteberler ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Fazla büyük: ${U.origin??"value"}, ${G}${U.maximum.toString()} ${z.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${U.origin??"value"}, ${G}${U.maximum.toString()} olmalıydı.`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Fazla küçük: ${U.origin}, ${G}${U.minimum.toString()} ${z.unit} sahip olmalıydı.`;return`Fazla küçük: ${U.origin}, ${G}${U.minimum.toString()} olmalıydı.`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Fâsit metin: "${G.prefix}" ile başlamalı.`;if(G.format==="ends_with")return`Fâsit metin: "${G.suffix}" ile bitmeli.`;if(G.format==="includes")return`Fâsit metin: "${G.includes}" ihtivâ etmeli.`;if(G.format==="regex")return`Fâsit metin: ${G.pattern} nakşına uymalı.`;return`Fâsit ${J[G.format]??U.format}`}case"not_multiple_of":return`Fâsit sayı: ${U.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${U.keys.length>1?"s":""}: ${H(U.keys,", ")}`;case"invalid_key":return`${U.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${U.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function QW(){return{localeError:UT()}}var VT=()=>{let $={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function w(U){return $[U]??null}let J={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},V={nan:"NaN",number:"عدد",array:"ارې"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`ناسم ورودي: باید instanceof ${U.expected} وای, مګر ${i} ترلاسه شو`;return`ناسم ورودي: باید ${G} وای, مګر ${i} ترلاسه شو`}case"invalid_value":if(U.values.length===1)return`ناسم ورودي: باید ${D(U.values[0])} وای`;return`ناسم انتخاب: باید یو له ${H(U.values,"|")} څخه وای`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`ډیر لوی: ${U.origin??"ارزښت"} باید ${G}${U.maximum.toString()} ${z.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${U.origin??"ارزښت"} باید ${G}${U.maximum.toString()} وي`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`ډیر کوچنی: ${U.origin} باید ${G}${U.minimum.toString()} ${z.unit} ولري`;return`ډیر کوچنی: ${U.origin} باید ${G}${U.minimum.toString()} وي`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`ناسم متن: باید د "${G.prefix}" سره پیل شي`;if(G.format==="ends_with")return`ناسم متن: باید د "${G.suffix}" سره پای ته ورسيږي`;if(G.format==="includes")return`ناسم متن: باید "${G.includes}" ولري`;if(G.format==="regex")return`ناسم متن: باید د ${G.pattern} سره مطابقت ولري`;return`${J[G.format]??U.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${U.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${U.keys.length>1?"کلیډونه":"کلیډ"}: ${H(U.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${U.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${U.origin} کې`;default:return"ناسمه ورودي"}}};function OW(){return{localeError:VT()}}var GT=()=>{let $={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function w(U){return $[U]??null}let J={regex:"wyrażenie",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ąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},V={nan:"NaN",number:"liczba",array:"tablica"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${U.expected}, otrzymano ${i}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${G}, otrzymano ${i}`}case"invalid_value":if(U.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${D(U.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Za duża wartość: oczekiwano, że ${U.origin??"wartość"} będzie mieć ${G}${U.maximum.toString()} ${z.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${U.origin??"wartość"} będzie wynosić ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Za mała wartość: oczekiwano, że ${U.origin??"wartość"} będzie mieć ${G}${U.minimum.toString()} ${z.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${U.origin??"wartość"} będzie wynosić ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${G.prefix}"`;if(G.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${G.suffix}"`;if(G.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${G.includes}"`;if(G.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${G.pattern}`;return`Nieprawidłow(y/a/e) ${J[G.format]??U.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${U.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${U.keys.length>1?"s":""}: ${H(U.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${U.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${U.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function PW(){return{localeError:GT()}}var zT=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function w(U){return $[U]??null}let J={regex:"padrão",email:"endereço 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ção ISO",ipv4:"endereço IPv4",ipv6:"endereço 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úmero E.164",jwt:"JWT",template_literal:"entrada"},V={nan:"NaN",number:"número",null:"nulo"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Tipo inválido: esperado instanceof ${U.expected}, recebido ${i}`;return`Tipo inválido: esperado ${G}, recebido ${i}`}case"invalid_value":if(U.values.length===1)return`Entrada inválida: esperado ${D(U.values[0])}`;return`Opção inválida: esperada uma das ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Muito grande: esperado que ${U.origin??"valor"} tivesse ${G}${U.maximum.toString()} ${z.unit??"elementos"}`;return`Muito grande: esperado que ${U.origin??"valor"} fosse ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Muito pequeno: esperado que ${U.origin} tivesse ${G}${U.minimum.toString()} ${z.unit}`;return`Muito pequeno: esperado que ${U.origin} fosse ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Texto inválido: deve começar com "${G.prefix}"`;if(G.format==="ends_with")return`Texto inválido: deve terminar com "${G.suffix}"`;if(G.format==="includes")return`Texto inválido: deve incluir "${G.includes}"`;if(G.format==="regex")return`Texto inválido: deve corresponder ao padrão ${G.pattern}`;return`${J[G.format]??U.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${U.divisor}`;case"unrecognized_keys":return`Chave${U.keys.length>1?"s":""} desconhecida${U.keys.length>1?"s":""}: ${H(U.keys,", ")}`;case"invalid_key":return`Chave inválida em ${U.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${U.origin}`;default:return"Campo inválido"}}};function KW(){return{localeError:zT()}}var iT=()=>{let $={string:{unit:"caractere",verb:"să aibă"},file:{unit:"octeți",verb:"să aibă"},array:{unit:"elemente",verb:"să aibă"},set:{unit:"elemente",verb:"să aibă"},map:{unit:"intrări",verb:"să aibă"}};function w(U){return $[U]??null}let J={regex:"intrare",email:"adresă de 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:"dată și oră ISO",date:"dată ISO",time:"oră ISO",duration:"durată ISO",ipv4:"adresă IPv4",ipv6:"adresă IPv6",mac:"adresă MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"șir codat base64",base64url:"șir codat base64url",json_string:"șir JSON",e164:"număr E.164",jwt:"JWT",template_literal:"intrare"},V={nan:"NaN",string:"șir",number:"număr",boolean:"boolean",function:"funcție",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"număr mare",void:"void",never:"never",map:"hartă",set:"set"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;return`Intrare invalidă: așteptat ${G}, primit ${i}`}case"invalid_value":if(U.values.length===1)return`Intrare invalidă: așteptat ${D(U.values[0])}`;return`Opțiune invalidă: așteptat una dintre ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Prea mare: așteptat ca ${U.origin??"valoarea"} ${z.verb} ${G}${U.maximum.toString()} ${z.unit??"elemente"}`;return`Prea mare: așteptat ca ${U.origin??"valoarea"} să fie ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Prea mic: așteptat ca ${U.origin} ${z.verb} ${G}${U.minimum.toString()} ${z.unit}`;return`Prea mic: așteptat ca ${U.origin} să fie ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Șir invalid: trebuie să înceapă cu "${G.prefix}"`;if(G.format==="ends_with")return`Șir invalid: trebuie să se termine cu "${G.suffix}"`;if(G.format==="includes")return`Șir invalid: trebuie să includă "${G.includes}"`;if(G.format==="regex")return`Șir invalid: trebuie să se potrivească cu modelul ${G.pattern}`;return`Format invalid: ${J[G.format]??U.format}`}case"not_multiple_of":return`Număr invalid: trebuie să fie multiplu de ${U.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${H(U.keys,", ")}`;case"invalid_key":return`Cheie invalidă în ${U.origin}`;case"invalid_union":return"Intrare invalidă";case"invalid_element":return`Valoare invalidă în ${U.origin}`;default:return"Intrare invalidă"}}};function uW(){return{localeError:iT()}}function $5($,w,J,V){let U=Math.abs($),G=U%10,z=U%100;if(z>=11&&z<=19)return V;if(G===1)return w;if(G>=2&&G<=4)return J;return V}var XT=()=>{let $={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function w(U){return $[U]??null}let J={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},V={nan:"NaN",number:"число",array:"массив"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Неверный ввод: ожидалось instanceof ${U.expected}, получено ${i}`;return`Неверный ввод: ожидалось ${G}, получено ${i}`}case"invalid_value":if(U.values.length===1)return`Неверный ввод: ожидалось ${D(U.values[0])}`;return`Неверный вариант: ожидалось одно из ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z){let i=Number(U.maximum),N=$5(i,z.unit.one,z.unit.few,z.unit.many);return`Слишком большое значение: ожидалось, что ${U.origin??"значение"} будет иметь ${G}${U.maximum.toString()} ${N}`}return`Слишком большое значение: ожидалось, что ${U.origin??"значение"} будет ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z){let i=Number(U.minimum),N=$5(i,z.unit.one,z.unit.few,z.unit.many);return`Слишком маленькое значение: ожидалось, что ${U.origin} будет иметь ${G}${U.minimum.toString()} ${N}`}return`Слишком маленькое значение: ожидалось, что ${U.origin} будет ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Неверная строка: должна начинаться с "${G.prefix}"`;if(G.format==="ends_with")return`Неверная строка: должна заканчиваться на "${G.suffix}"`;if(G.format==="includes")return`Неверная строка: должна содержать "${G.includes}"`;if(G.format==="regex")return`Неверная строка: должна соответствовать шаблону ${G.pattern}`;return`Неверный ${J[G.format]??U.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${U.divisor}`;case"unrecognized_keys":return`Нераспознанн${U.keys.length>1?"ые":"ый"} ключ${U.keys.length>1?"и":""}: ${H(U.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${U.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${U.origin}`;default:return"Неверные входные данные"}}};function BW(){return{localeError:XT()}}var NT=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function w(U){return $[U]??null}let J={regex:"vnos",email:"e-poštni 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 čas",date:"ISO datum",time:"ISO čas",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 številka",jwt:"JWT",template_literal:"vnos"},V={nan:"NaN",number:"število",array:"tabela"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Neveljaven vnos: pričakovano instanceof ${U.expected}, prejeto ${i}`;return`Neveljaven vnos: pričakovano ${G}, prejeto ${i}`}case"invalid_value":if(U.values.length===1)return`Neveljaven vnos: pričakovano ${D(U.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Preveliko: pričakovano, da bo ${U.origin??"vrednost"} imelo ${G}${U.maximum.toString()} ${z.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${U.origin??"vrednost"} ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Premajhno: pričakovano, da bo ${U.origin} imelo ${G}${U.minimum.toString()} ${z.unit}`;return`Premajhno: pričakovano, da bo ${U.origin} ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Neveljaven niz: mora se začeti z "${G.prefix}"`;if(G.format==="ends_with")return`Neveljaven niz: mora se končati z "${G.suffix}"`;if(G.format==="includes")return`Neveljaven niz: mora vsebovati "${G.includes}"`;if(G.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${G.pattern}`;return`Neveljaven ${J[G.format]??U.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${U.divisor}`;case"unrecognized_keys":return`Neprepoznan${U.keys.length>1?"i ključi":" ključ"}: ${H(U.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${U.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${U.origin}`;default:return"Neveljaven vnos"}}};function HW(){return{localeError:NT()}}var WT=()=>{let $={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function w(U){return $[U]??null}let J={regex:"reguljärt 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äng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},V={nan:"NaN",number:"antal",array:"lista"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Ogiltig inmatning: förväntat instanceof ${U.expected}, fick ${i}`;return`Ogiltig inmatning: förväntat ${G}, fick ${i}`}case"invalid_value":if(U.values.length===1)return`Ogiltig inmatning: förväntat ${D(U.values[0])}`;return`Ogiltigt val: förväntade en av ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`För stor(t): förväntade ${U.origin??"värdet"} att ha ${G}${U.maximum.toString()} ${z.unit??"element"}`;return`För stor(t): förväntat ${U.origin??"värdet"} att ha ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`För lite(t): förväntade ${U.origin??"värdet"} att ha ${G}${U.minimum.toString()} ${z.unit}`;return`För lite(t): förväntade ${U.origin??"värdet"} att ha ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Ogiltig sträng: måste börja med "${G.prefix}"`;if(G.format==="ends_with")return`Ogiltig sträng: måste sluta med "${G.suffix}"`;if(G.format==="includes")return`Ogiltig sträng: måste innehålla "${G.includes}"`;if(G.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${G.pattern}"`;return`Ogiltig(t) ${J[G.format]??U.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${H(U.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${U.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${U.origin??"värdet"}`;default:return"Ogiltig input"}}};function FW(){return{localeError:WT()}}var IT=()=>{let $={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function w(U){return $[U]??null}let J={regex:"உள்ளீடு",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:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},V={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${U.expected}, பெறப்பட்டது ${i}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${G}, பெறப்பட்டது ${i}`}case"invalid_value":if(U.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${D(U.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${H(U.values,"|")} இல் ஒன்று`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${U.origin??"மதிப்பு"} ${G}${U.maximum.toString()} ${z.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${U.origin??"மதிப்பு"} ${G}${U.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${U.origin} ${G}${U.minimum.toString()} ${z.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${U.origin} ${G}${U.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`தவறான சரம்: "${G.prefix}" இல் தொடங்க வேண்டும்`;if(G.format==="ends_with")return`தவறான சரம்: "${G.suffix}" இல் முடிவடைய வேண்டும்`;if(G.format==="includes")return`தவறான சரம்: "${G.includes}" ஐ உள்ளடக்க வேண்டும்`;if(G.format==="regex")return`தவறான சரம்: ${G.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${J[G.format]??U.format}`}case"not_multiple_of":return`தவறான எண்: ${U.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${U.keys.length>1?"கள்":""}: ${H(U.keys,", ")}`;case"invalid_key":return`${U.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${U.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function qW(){return{localeError:IT()}}var gT=()=>{let $={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function w(U){return $[U]??null}let J={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},V={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${U.expected} แต่ได้รับ ${i}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${G} แต่ได้รับ ${i}`}case"invalid_value":if(U.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${D(U.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"ไม่เกิน":"น้อยกว่า",z=w(U.origin);if(z)return`เกินกำหนด: ${U.origin??"ค่า"} ควรมี${G} ${U.maximum.toString()} ${z.unit??"รายการ"}`;return`เกินกำหนด: ${U.origin??"ค่า"} ควรมี${G} ${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?"อย่างน้อย":"มากกว่า",z=w(U.origin);if(z)return`น้อยกว่ากำหนด: ${U.origin} ควรมี${G} ${U.minimum.toString()} ${z.unit}`;return`น้อยกว่ากำหนด: ${U.origin} ควรมี${G} ${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${G.prefix}"`;if(G.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${G.suffix}"`;if(G.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${G.includes}" อยู่ในข้อความ`;if(G.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${G.pattern}`;return`รูปแบบไม่ถูกต้อง: ${J[G.format]??U.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${U.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${H(U.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${U.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${U.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function ZW(){return{localeError:gT()}}var YT=()=>{let $={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function w(U){return $[U]??null}let J={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üre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},V={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Geçersiz değer: beklenen instanceof ${U.expected}, alınan ${i}`;return`Geçersiz değer: beklenen ${G}, alınan ${i}`}case"invalid_value":if(U.values.length===1)return`Geçersiz değer: beklenen ${D(U.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Çok büyük: beklenen ${U.origin??"değer"} ${G}${U.maximum.toString()} ${z.unit??"öğe"}`;return`Çok büyük: beklenen ${U.origin??"değer"} ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Çok küçük: beklenen ${U.origin} ${G}${U.minimum.toString()} ${z.unit}`;return`Çok küçük: beklenen ${U.origin} ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Geçersiz metin: "${G.prefix}" ile başlamalı`;if(G.format==="ends_with")return`Geçersiz metin: "${G.suffix}" ile bitmeli`;if(G.format==="includes")return`Geçersiz metin: "${G.includes}" içermeli`;if(G.format==="regex")return`Geçersiz metin: ${G.pattern} desenine uymalı`;return`Geçersiz ${J[G.format]??U.format}`}case"not_multiple_of":return`Geçersiz sayı: ${U.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${U.keys.length>1?"lar":""}: ${H(U.keys,", ")}`;case"invalid_key":return`${U.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${U.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function TW(){return{localeError:YT()}}var vT=()=>{let $={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function w(U){return $[U]??null}let J={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},V={nan:"NaN",number:"число",array:"масив"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Неправильні вхідні дані: очікується instanceof ${U.expected}, отримано ${i}`;return`Неправильні вхідні дані: очікується ${G}, отримано ${i}`}case"invalid_value":if(U.values.length===1)return`Неправильні вхідні дані: очікується ${D(U.values[0])}`;return`Неправильна опція: очікується одне з ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Занадто велике: очікується, що ${U.origin??"значення"} ${z.verb} ${G}${U.maximum.toString()} ${z.unit??"елементів"}`;return`Занадто велике: очікується, що ${U.origin??"значення"} буде ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Занадто мале: очікується, що ${U.origin} ${z.verb} ${G}${U.minimum.toString()} ${z.unit}`;return`Занадто мале: очікується, що ${U.origin} буде ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Неправильний рядок: повинен починатися з "${G.prefix}"`;if(G.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${G.suffix}"`;if(G.format==="includes")return`Неправильний рядок: повинен містити "${G.includes}"`;if(G.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${G.pattern}`;return`Неправильний ${J[G.format]??U.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${U.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${U.keys.length>1?"і":""}: ${H(U.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${U.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${U.origin}`;default:return"Неправильні вхідні дані"}}};function p1(){return{localeError:vT()}}function DW(){return p1()}var QT=()=>{let $={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function w(U){return $[U]??null}let J={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},V={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`غلط ان پٹ: instanceof ${U.expected} متوقع تھا، ${i} موصول ہوا`;return`غلط ان پٹ: ${G} متوقع تھا، ${i} موصول ہوا`}case"invalid_value":if(U.values.length===1)return`غلط ان پٹ: ${D(U.values[0])} متوقع تھا`;return`غلط آپشن: ${H(U.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`بہت بڑا: ${U.origin??"ویلیو"} کے ${G}${U.maximum.toString()} ${z.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${U.origin??"ویلیو"} کا ${G}${U.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`بہت چھوٹا: ${U.origin} کے ${G}${U.minimum.toString()} ${z.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${U.origin} کا ${G}${U.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`غلط سٹرنگ: "${G.prefix}" سے شروع ہونا چاہیے`;if(G.format==="ends_with")return`غلط سٹرنگ: "${G.suffix}" پر ختم ہونا چاہیے`;if(G.format==="includes")return`غلط سٹرنگ: "${G.includes}" شامل ہونا چاہیے`;if(G.format==="regex")return`غلط سٹرنگ: پیٹرن ${G.pattern} سے میچ ہونا چاہیے`;return`غلط ${J[G.format]??U.format}`}case"not_multiple_of":return`غلط نمبر: ${U.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${U.keys.length>1?"ز":""}: ${H(U.keys,"، ")}`;case"invalid_key":return`${U.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${U.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function LW(){return{localeError:QT()}}var OT=()=>{let $={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"},map:{unit:"yozuv",verb:"bo‘lishi kerak"}};function w(U){return $[U]??null}let J={regex:"kirish",email:"elektron pochta manzili",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 sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},V={nan:"NaN",number:"raqam",array:"massiv"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${U.expected}, qabul qilingan ${i}`;return`Noto‘g‘ri kirish: kutilgan ${G}, qabul qilingan ${i}`}case"invalid_value":if(U.values.length===1)return`Noto‘g‘ri kirish: kutilgan ${D(U.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Juda katta: kutilgan ${U.origin??"qiymat"} ${G}${U.maximum.toString()} ${z.unit} ${z.verb}`;return`Juda katta: kutilgan ${U.origin??"qiymat"} ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Juda kichik: kutilgan ${U.origin} ${G}${U.minimum.toString()} ${z.unit} ${z.verb}`;return`Juda kichik: kutilgan ${U.origin} ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Noto‘g‘ri satr: "${G.prefix}" bilan boshlanishi kerak`;if(G.format==="ends_with")return`Noto‘g‘ri satr: "${G.suffix}" bilan tugashi kerak`;if(G.format==="includes")return`Noto‘g‘ri satr: "${G.includes}" ni o‘z ichiga olishi kerak`;if(G.format==="regex")return`Noto‘g‘ri satr: ${G.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${J[G.format]??U.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${U.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${U.keys.length>1?"lar":""}: ${H(U.keys,", ")}`;case"invalid_key":return`${U.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${U.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function fW(){return{localeError:OT()}}var PT=()=>{let $={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function w(U){return $[U]??null}let J={regex:"đầu vào",email:"địa chỉ 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ày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},V={nan:"NaN",number:"số",array:"mảng"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Đầu vào không hợp lệ: mong đợi instanceof ${U.expected}, nhận được ${i}`;return`Đầu vào không hợp lệ: mong đợi ${G}, nhận được ${i}`}case"invalid_value":if(U.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${D(U.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Quá lớn: mong đợi ${U.origin??"giá trị"} ${z.verb} ${G}${U.maximum.toString()} ${z.unit??"phần tử"}`;return`Quá lớn: mong đợi ${U.origin??"giá trị"} ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Quá nhỏ: mong đợi ${U.origin} ${z.verb} ${G}${U.minimum.toString()} ${z.unit}`;return`Quá nhỏ: mong đợi ${U.origin} ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${G.prefix}"`;if(G.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${G.suffix}"`;if(G.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${G.includes}"`;if(G.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${G.pattern}`;return`${J[G.format]??U.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${U.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${H(U.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${U.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${U.origin}`;default:return"Đầu vào không hợp lệ"}}};function MW(){return{localeError:PT()}}var KT=()=>{let $={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function w(U){return $[U]??null}let J={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},V={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`无效输入:期望 instanceof ${U.expected},实际接收 ${i}`;return`无效输入:期望 ${G},实际接收 ${i}`}case"invalid_value":if(U.values.length===1)return`无效输入:期望 ${D(U.values[0])}`;return`无效选项:期望以下之一 ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`数值过大:期望 ${U.origin??"值"} ${G}${U.maximum.toString()} ${z.unit??"个元素"}`;return`数值过大:期望 ${U.origin??"值"} ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`数值过小:期望 ${U.origin} ${G}${U.minimum.toString()} ${z.unit}`;return`数值过小:期望 ${U.origin} ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`无效字符串:必须以 "${G.prefix}" 开头`;if(G.format==="ends_with")return`无效字符串:必须以 "${G.suffix}" 结尾`;if(G.format==="includes")return`无效字符串:必须包含 "${G.includes}"`;if(G.format==="regex")return`无效字符串:必须满足正则表达式 ${G.pattern}`;return`无效${J[G.format]??U.format}`}case"not_multiple_of":return`无效数字:必须是 ${U.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${H(U.keys,", ")}`;case"invalid_key":return`${U.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${U.origin} 中包含无效值(value)`;default:return"无效输入"}}};function AW(){return{localeError:KT()}}var uT=()=>{let $={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function w(U){return $[U]??null}let J={regex:"輸入",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:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},V={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`無效的輸入值:預期為 instanceof ${U.expected},但收到 ${i}`;return`無效的輸入值:預期為 ${G},但收到 ${i}`}case"invalid_value":if(U.values.length===1)return`無效的輸入值:預期為 ${D(U.values[0])}`;return`無效的選項:預期為以下其中之一 ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`數值過大:預期 ${U.origin??"值"} 應為 ${G}${U.maximum.toString()} ${z.unit??"個元素"}`;return`數值過大:預期 ${U.origin??"值"} 應為 ${G}${U.maximum.toString()}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`數值過小:預期 ${U.origin} 應為 ${G}${U.minimum.toString()} ${z.unit}`;return`數值過小:預期 ${U.origin} 應為 ${G}${U.minimum.toString()}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`無效的字串:必須以 "${G.prefix}" 開頭`;if(G.format==="ends_with")return`無效的字串:必須以 "${G.suffix}" 結尾`;if(G.format==="includes")return`無效的字串:必須包含 "${G.includes}"`;if(G.format==="regex")return`無效的字串:必須符合格式 ${G.pattern}`;return`無效的 ${J[G.format]??U.format}`}case"not_multiple_of":return`無效的數字:必須為 ${U.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${U.keys.length>1?"們":""}:${H(U.keys,"、")}`;case"invalid_key":return`${U.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${U.origin} 中有無效的值`;default:return"無效的輸入值"}}};function SW(){return{localeError:uT()}}var BT=()=>{let $={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function w(U){return $[U]??null}let J={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",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:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},V={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return(U)=>{switch(U.code){case"invalid_type":{let G=V[U.expected]??U.expected,z=f(U.input),i=V[z]??z;if(/^[A-Z]/.test(U.expected))return`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${U.expected}, àmọ̀ a rí ${i}`;return`Ìbáwọlé aṣìṣe: a ní láti fi ${G}, àmọ̀ a rí ${i}`}case"invalid_value":if(U.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${D(U.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${H(U.values,"|")}`;case"too_big":{let G=U.inclusive?"<=":"<",z=w(U.origin);if(z)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${U.origin??"iye"} ${z.verb} ${G}${U.maximum} ${z.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${G}${U.maximum}`}case"too_small":{let G=U.inclusive?">=":">",z=w(U.origin);if(z)return`Kéré ju: a ní láti jẹ́ pé ${U.origin} ${z.verb} ${G}${U.minimum} ${z.unit}`;return`Kéré ju: a ní láti jẹ́ ${G}${U.minimum}`}case"invalid_format":{let G=U;if(G.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${G.prefix}"`;if(G.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${G.suffix}"`;if(G.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${G.includes}"`;if(G.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${G.pattern}`;return`Aṣìṣe: ${J[G.format]??U.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${U.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${H(U.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${U.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${U.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function _W(){return{localeError:BT()}}var w5,kW=Symbol("ZodOutput"),RW=Symbol("ZodInput");class bW{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...w){let J=w[0];if(this._map.set($,J),J&&typeof J==="object"&&"id"in J)this._idmap.set(J.id,$);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove($){let w=this._map.get($);if(w&&typeof w==="object"&&"id"in w)this._idmap.delete(w.id);return this._map.delete($),this}get($){let w=$._zod.parent;if(w){let J={...this.get(w)??{}};delete J.id;let V={...J,...this._map.get($)};return Object.keys(V).length?V:void 0}return this._map.get($)}has($){return this._map.has($)}}function aV(){return new bW}(w5=globalThis).__zod_globalRegistry??(w5.__zod_globalRegistry=aV());var q$=globalThis.__zod_globalRegistry;function EW($,w){return new $({type:"string",...S(w)})}function CW($,w){return new $({type:"string",coerce:!0,...S(w)})}function eV($,w){return new $({type:"string",format:"email",check:"string_format",abort:!1,...S(w)})}function e1($,w){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...S(w)})}function sV($,w){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...S(w)})}function $G($,w){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...S(w)})}function wG($,w){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...S(w)})}function JG($,w){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...S(w)})}function s1($,w){return new $({type:"string",format:"url",check:"string_format",abort:!1,...S(w)})}function UG($,w){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...S(w)})}function VG($,w){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...S(w)})}function GG($,w){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...S(w)})}function zG($,w){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...S(w)})}function iG($,w){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...S(w)})}function XG($,w){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...S(w)})}function NG($,w){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...S(w)})}function WG($,w){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...S(w)})}function IG($,w){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...S(w)})}function jW($,w){return new $({type:"string",format:"mac",check:"string_format",abort:!1,...S(w)})}function gG($,w){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...S(w)})}function YG($,w){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...S(w)})}function vG($,w){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...S(w)})}function QG($,w){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...S(w)})}function OG($,w){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...S(w)})}function PG($,w){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...S(w)})}var xW={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function rW($,w){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...S(w)})}function nW($,w){return new $({type:"string",format:"date",check:"string_format",...S(w)})}function dW($,w){return new $({type:"string",format:"time",check:"string_format",precision:null,...S(w)})}function mW($,w){return new $({type:"string",format:"duration",check:"string_format",...S(w)})}function yW($,w){return new $({type:"number",checks:[],...S(w)})}function hW($,w){return new $({type:"number",coerce:!0,checks:[],...S(w)})}function cW($,w){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...S(w)})}function lW($,w){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...S(w)})}function tW($,w){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...S(w)})}function oW($,w){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...S(w)})}function pW($,w){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...S(w)})}function aW($,w){return new $({type:"boolean",...S(w)})}function eW($,w){return new $({type:"boolean",coerce:!0,...S(w)})}function sW($,w){return new $({type:"bigint",...S(w)})}function $3($,w){return new $({type:"bigint",coerce:!0,...S(w)})}function w3($,w){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...S(w)})}function J3($,w){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...S(w)})}function U3($,w){return new $({type:"symbol",...S(w)})}function V3($,w){return new $({type:"undefined",...S(w)})}function G3($,w){return new $({type:"null",...S(w)})}function z3($){return new $({type:"any"})}function i3($){return new $({type:"unknown"})}function X3($,w){return new $({type:"never",...S(w)})}function N3($,w){return new $({type:"void",...S(w)})}function W3($,w){return new $({type:"date",...S(w)})}function I3($,w){return new $({type:"date",coerce:!0,...S(w)})}function g3($,w){return new $({type:"nan",...S(w)})}function T4($,w){return new xV({check:"less_than",...S(w),value:$,inclusive:!1})}function a$($,w){return new xV({check:"less_than",...S(w),value:$,inclusive:!0})}function D4($,w){return new rV({check:"greater_than",...S(w),value:$,inclusive:!1})}function j$($,w){return new rV({check:"greater_than",...S(w),value:$,inclusive:!0})}function KG($){return D4(0,$)}function uG($){return T4(0,$)}function BG($){return a$(0,$)}function HG($){return j$(0,$)}function Q6($,w){return new NN({check:"multiple_of",...S(w),value:$})}function O6($,w){return new gN({check:"max_size",...S(w),maximum:$})}function L4($,w){return new YN({check:"min_size",...S(w),minimum:$})}function Xw($,w){return new vN({check:"size_equals",...S(w),size:$})}function Nw($,w){return new QN({check:"max_length",...S(w),maximum:$})}function y4($,w){return new ON({check:"min_length",...S(w),minimum:$})}function Ww($,w){return new PN({check:"length_equals",...S(w),length:$})}function gJ($,w){return new KN({check:"string_format",format:"regex",...S(w),pattern:$})}function YJ($){return new uN({check:"string_format",format:"lowercase",...S($)})}function vJ($){return new BN({check:"string_format",format:"uppercase",...S($)})}function QJ($,w){return new HN({check:"string_format",format:"includes",...S(w),includes:$})}function OJ($,w){return new FN({check:"string_format",format:"starts_with",...S(w),prefix:$})}function PJ($,w){return new qN({check:"string_format",format:"ends_with",...S(w),suffix:$})}function FG($,w,J){return new ZN({check:"property",property:$,schema:w,...S(J)})}function KJ($,w){return new TN({check:"mime_type",mime:$,...S(w)})}function Y4($){return new DN({check:"overwrite",tx:$})}function uJ($){return Y4((w)=>w.normalize($))}function BJ(){return Y4(($)=>$.trim())}function HJ(){return Y4(($)=>$.toLowerCase())}function FJ(){return Y4(($)=>$.toUpperCase())}function qJ(){return Y4(($)=>FX($))}function Y3($,w,J){return new $({type:"array",element:w,...S(J)})}function FT($,w,J){return new $({type:"union",options:w,...S(J)})}function qT($,w,J){return new $({type:"union",options:w,inclusive:!1,...S(J)})}function ZT($,w,J,V){return new $({type:"union",options:J,discriminator:w,...S(V)})}function TT($,w,J){return new $({type:"intersection",left:w,right:J})}function DT($,w,J,V){let U=J instanceof m;return new $({type:"tuple",items:w,rest:U?J:null,...S(U?V:J)})}function LT($,w,J,V){return new $({type:"record",keyType:w,valueType:J,...S(V)})}function fT($,w,J,V){return new $({type:"map",keyType:w,valueType:J,...S(V)})}function MT($,w,J){return new $({type:"set",valueType:w,...S(J)})}function AT($,w,J){let V=Array.isArray(w)?Object.fromEntries(w.map((U)=>[U,U])):w;return new $({type:"enum",entries:V,...S(J)})}function ST($,w,J){return new $({type:"enum",entries:w,...S(J)})}function _T($,w,J){return new $({type:"literal",values:Array.isArray(w)?w:[w],...S(J)})}function v3($,w){return new $({type:"file",...S(w)})}function kT($,w){return new $({type:"transform",transform:w})}function RT($,w){return new $({type:"optional",innerType:w})}function bT($,w){return new $({type:"nullable",innerType:w})}function ET($,w,J){return new $({type:"default",innerType:w,get defaultValue(){return typeof J==="function"?J():ZX(J)}})}function CT($,w,J){return new $({type:"nonoptional",innerType:w,...S(J)})}function jT($,w){return new $({type:"success",innerType:w})}function xT($,w,J){return new $({type:"catch",innerType:w,catchValue:typeof J==="function"?J:()=>J})}function rT($,w,J){return new $({type:"pipe",in:w,out:J})}function nT($,w){return new $({type:"readonly",innerType:w})}function dT($,w,J){return new $({type:"template_literal",parts:w,...S(J)})}function mT($,w){return new $({type:"lazy",getter:w})}function yT($,w){return new $({type:"promise",innerType:w})}function Q3($,w,J){let V=S(J);return V.abort??(V.abort=!0),new $({type:"custom",check:"custom",fn:w,...V})}function O3($,w,J){return new $({type:"custom",check:"custom",fn:w,...S(J)})}function P3($,w){let J=J5((V)=>{return V.addIssue=(U)=>{if(typeof U==="string")V.issues.push(GJ(U,V.value,J._zod.def));else{let G=U;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=V.value),G.inst??(G.inst=J),G.continue??(G.continue=!J._zod.def.abort),V.issues.push(GJ(G))}},$(V.value,V)},w);return J}function J5($,w){let J=new J$({check:"custom",...S(w)});return J._zod.check=$,J}function K3($){let w=new J$({check:"describe"});return w._zod.onattach=[(J)=>{let V=q$.get(J)??{};q$.add(J,{...V,description:$})}],w._zod.check=()=>{},w}function u3($){let w=new J$({check:"meta"});return w._zod.onattach=[(J)=>{let V=q$.get(J)??{};q$.add(J,{...V,...$})}],w._zod.check=()=>{},w}function B3($,w){let J=S(w),V=J.truthy??["true","1","yes","on","y","enabled"],U=J.falsy??["false","0","no","off","n","disabled"];if(J.case!=="sensitive")V=V.map((Y)=>typeof Y==="string"?Y.toLowerCase():Y),U=U.map((Y)=>typeof Y==="string"?Y.toLowerCase():Y);let G=new Set(V),z=new Set(U),i=$.Codec??c1,N=$.Boolean??y1,W=new($.String??iw)({type:"string",error:J.error}),I=new N({type:"boolean",error:J.error}),g=new i({type:"pipe",in:W,out:I,transform:(Y,v)=>{let O=Y;if(J.case!=="sensitive")O=O.toLowerCase();if(G.has(O))return!0;else if(z.has(O))return!1;else return v.issues.push({code:"invalid_value",expected:"stringbool",values:[...G,...z],input:v.value,inst:g,continue:!1}),{}},reverseTransform:(Y,v)=>{if(Y===!0)return V[0]||"true";else return U[0]||"false"},error:J.error});return g}function ZJ($,w,J,V={}){let U=S(V),G={...S(V),check:"string_format",type:"string",format:w,fn:typeof J==="function"?J:(i)=>J.test(i),...U};if(J instanceof RegExp)G.pattern=J;return new $(G)}function P6($){let w=$?.target??"draft-2020-12";if(w==="draft-4")w="draft-04";if(w==="draft-7")w="draft-07";return{processors:$.processors??{},metadataRegistry:$?.metadata??q$,target:w,unrepresentable:$?.unrepresentable??"throw",override:$?.override??(()=>{}),io:$?.io??"output",counter:0,seen:new Map,cycles:$?.cycles??"ref",reused:$?.reused??"inline",external:$?.external??void 0}}function e($,w,J={path:[],schemaPath:[]}){var V;let U=$._zod.def,G=w.seen.get($);if(G){if(G.count++,J.schemaPath.includes($))G.cycle=J.path;return G.schema}let z={schema:{},count:1,cycle:void 0,path:J.path};w.seen.set($,z);let i=$._zod.toJSONSchema?.();if(i)z.schema=i;else{let W={...J,schemaPath:[...J.schemaPath,$],path:J.path};if($._zod.processJSONSchema)$._zod.processJSONSchema(w,z.schema,W);else{let g=z.schema,Y=w.processors[U.type];if(!Y)throw Error(`[toJSONSchema]: Non-representable type encountered: ${U.type}`);Y($,w,g,W)}let I=$._zod.parent;if(I){if(!z.ref)z.ref=I;e(I,w,W),w.seen.get(I).isParent=!0}}let N=w.metadataRegistry.get($);if(N)Object.assign(z.schema,N);if(w.io==="input"&&x$($))delete z.schema.examples,delete z.schema.default;if(w.io==="input"&&"_prefault"in z.schema)(V=z.schema).default??(V.default=z.schema._prefault);return delete z.schema._prefault,w.seen.get($).schema}function K6($,w){let J=$.seen.get(w);if(!J)throw Error("Unprocessed schema. This is a bug in Zod.");let V=new Map;for(let z of $.seen.entries()){let i=$.metadataRegistry.get(z[0])?.id;if(i){let N=V.get(i);if(N&&N!==z[0])throw Error(`Duplicate schema id "${i}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);V.set(i,z[0])}}let U=(z)=>{let i=$.target==="draft-2020-12"?"$defs":"definitions";if($.external){let I=$.external.registry.get(z[0])?.id,g=$.external.uri??((v)=>v);if(I)return{ref:g(I)};let Y=z[1].defId??z[1].schema.id??`schema${$.counter++}`;return z[1].defId=Y,{defId:Y,ref:`${g("__shared")}#/${i}/${Y}`}}if(z[1]===J)return{ref:"#"};let X=`${"#"}/${i}/`,W=z[1].schema.id??`__schema${$.counter++}`;return{defId:W,ref:X+W}},G=(z)=>{if(z[1].schema.$ref)return;let i=z[1],{ref:N,defId:X}=U(z);if(i.def={...i.schema},X)i.defId=X;let W=i.schema;for(let I in W)delete W[I];W.$ref=N};if($.cycles==="throw")for(let z of $.seen.entries()){let i=z[1];if(i.cycle)throw Error(`Cycle detected: #/${i.cycle?.join("/")}/<root>
|
|
253
257
|
|
|
254
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let g of $.seen.entries()){let V=g[1];if(w===g[0]){z(g);continue}if($.external){let G=$.external.registry.get(g[0])?.id;if(w!==g[0]&&G){z(g);continue}}if($.metadataRegistry.get(g[0])?.id){z(g);continue}if(V.cycle){z(g);continue}if(V.count>1){if($.reused==="ref"){z(g);continue}}}}function o4($,w){let U=$.seen.get(w);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let v=(V)=>{let _=$.seen.get(V);if(_.ref===null)return;let G=_.def??_.schema,X={...G},I=_.ref;if(_.ref=null,I){v(I);let W=$.seen.get(I),P=W.schema;if(P.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))G.allOf=G.allOf??[],G.allOf.push(P);else Object.assign(G,P);if(Object.assign(G,X),V._zod.parent===I)for(let H in G){if(H==="$ref"||H==="allOf")continue;if(!(H in X))delete G[H]}if(P.$ref&&W.def)for(let H in G){if(H==="$ref"||H==="allOf")continue;if(H in W.def&&JSON.stringify(G[H])===JSON.stringify(W.def[H]))delete G[H]}}let N=V._zod.parent;if(N&&N!==I){v(N);let W=$.seen.get(N);if(W?.schema.$ref){if(G.$ref=W.schema.$ref,W.def)for(let P in G){if(P==="$ref"||P==="allOf")continue;if(P in W.def&&JSON.stringify(G[P])===JSON.stringify(W.def[P]))delete G[P]}}}$.override({zodSchema:V,jsonSchema:G,path:_.path??[]})};for(let V of[...$.seen.entries()].reverse())v(V[0]);let J={};if($.target==="draft-2020-12")J.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")J.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")J.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let V=$.external.registry.get(w)?.id;if(!V)throw Error("Schema is missing an `id` property");J.$id=$.external.uri(V)}Object.assign(J,U.def??U.schema);let z=$.metadataRegistry.get(w)?.id;if(z!==void 0&&J.id===z)delete J.id;let g=$.external?.defs??{};for(let V of $.seen.entries()){let _=V[1];if(_.def&&_.defId){if(_.def.id===_.defId)delete _.def.id;g[_.defId]=_.def}}if($.external);else if(Object.keys(g).length>0)if($.target==="draft-2020-12")J.$defs=g;else J.definitions=g;try{let V=JSON.parse(JSON.stringify(J));return Object.defineProperty(V,"~standard",{value:{...w["~standard"],jsonSchema:{input:cw(w,"input",$.processors),output:cw(w,"output",$.processors)}},enumerable:!1,writable:!1}),V}catch(V){throw Error("Error converting schema to JSON.")}}function F$($,w){let U=w??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let v=$._zod.def;if(v.type==="transform")return!0;if(v.type==="array")return F$(v.element,U);if(v.type==="set")return F$(v.valueType,U);if(v.type==="lazy")return F$(v.getter(),U);if(v.type==="promise"||v.type==="optional"||v.type==="nonoptional"||v.type==="nullable"||v.type==="readonly"||v.type==="default"||v.type==="prefault")return F$(v.innerType,U);if(v.type==="intersection")return F$(v.left,U)||F$(v.right,U);if(v.type==="record"||v.type==="map")return F$(v.keyType,U)||F$(v.valueType,U);if(v.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return F$(v.in,U)||F$(v.out,U)}if(v.type==="object"){for(let J in v.shape)if(F$(v.shape[J],U))return!0;return!1}if(v.type==="union"){for(let J of v.options)if(F$(J,U))return!0;return!1}if(v.type==="tuple"){for(let J of v.items)if(F$(J,U))return!0;if(v.rest&&F$(v.rest,U))return!0;return!1}return!1}var VX=($,w={})=>(U)=>{let v=l4({...U,processors:w});return p($,v),t4(v,$),o4(v,$)},cw=($,w,U={})=>(v)=>{let{libraryOptions:J,target:z}=v??{},g=l4({...J??{},target:z,io:w,processors:U});return p($,g),t4(g,$),o4(g,$)};var HH={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},GX=($,w,U,v)=>{let J=U;J.type="string";let{minimum:z,maximum:g,format:V,patterns:_,contentEncoding:G}=$._zod.bag;if(typeof z==="number")J.minLength=z;if(typeof g==="number")J.maxLength=g;if(V){if(J.format=HH[V]??V,J.format==="")delete J.format;if(V==="time")delete J.format}if(G)J.contentEncoding=G;if(_&&_.size>0){let X=[..._];if(X.length===1)J.pattern=X[0].source;else if(X.length>1)J.allOf=[...X.map((I)=>({...w.target==="draft-07"||w.target==="draft-04"||w.target==="openapi-3.0"?{type:"string"}:{},pattern:I.source}))]}},_X=($,w,U,v)=>{let J=U,{minimum:z,maximum:g,format:V,multipleOf:_,exclusiveMaximum:G,exclusiveMinimum:X}=$._zod.bag;if(typeof V==="string"&&V.includes("int"))J.type="integer";else J.type="number";let I=typeof X==="number"&&X>=(z??Number.NEGATIVE_INFINITY),N=typeof G==="number"&&G<=(g??Number.POSITIVE_INFINITY),W=w.target==="draft-04"||w.target==="openapi-3.0";if(I)if(W)J.minimum=X,J.exclusiveMinimum=!0;else J.exclusiveMinimum=X;else if(typeof z==="number")J.minimum=z;if(N)if(W)J.maximum=G,J.exclusiveMaximum=!0;else J.exclusiveMaximum=G;else if(typeof g==="number")J.maximum=g;if(typeof _==="number")J.multipleOf=_},XX=($,w,U,v)=>{U.type="boolean"},IX=($,w,U,v)=>{if(w.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},NX=($,w,U,v)=>{if(w.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},WX=($,w,U,v)=>{if(w.target==="openapi-3.0")U.type="string",U.nullable=!0,U.enum=[null];else U.type="null"},YX=($,w,U,v)=>{if(w.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},QX=($,w,U,v)=>{if(w.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},PX=($,w,U,v)=>{U.not={}},OX=($,w,U,v)=>{},BX=($,w,U,v)=>{},qX=($,w,U,v)=>{if(w.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},LX=($,w,U,v)=>{let J=$._zod.def,z=n1(J.entries);if(z.every((g)=>typeof g==="number"))U.type="number";if(z.every((g)=>typeof g==="string"))U.type="string";U.enum=z},HX=($,w,U,v)=>{let J=$._zod.def,z=[];for(let g of J.values)if(g===void 0){if(w.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g==="bigint")if(w.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else z.push(Number(g));else z.push(g);if(z.length===0);else if(z.length===1){let g=z[0];if(U.type=g===null?"null":typeof g,w.target==="draft-04"||w.target==="openapi-3.0")U.enum=[g];else U.const=g}else{if(z.every((g)=>typeof g==="number"))U.type="number";if(z.every((g)=>typeof g==="string"))U.type="string";if(z.every((g)=>typeof g==="boolean"))U.type="boolean";if(z.every((g)=>g===null))U.type="null";U.enum=z}},uX=($,w,U,v)=>{if(w.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},KX=($,w,U,v)=>{let J=U,z=$._zod.pattern;if(!z)throw Error("Pattern not found in template literal");J.type="string",J.pattern=z.source},DX=($,w,U,v)=>{let J=U,z={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:V,mime:_}=$._zod.bag;if(g!==void 0)z.minLength=g;if(V!==void 0)z.maxLength=V;if(_)if(_.length===1)z.contentMediaType=_[0],Object.assign(J,z);else Object.assign(J,z),J.anyOf=_.map((G)=>({contentMediaType:G}));else Object.assign(J,z)},fX=($,w,U,v)=>{U.type="boolean"},TX=($,w,U,v)=>{if(w.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},ZX=($,w,U,v)=>{if(w.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},bX=($,w,U,v)=>{if(w.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},FX=($,w,U,v)=>{if(w.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},MX=($,w,U,v)=>{if(w.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},iX=($,w,U,v)=>{let J=U,z=$._zod.def,{minimum:g,maximum:V}=$._zod.bag;if(typeof g==="number")J.minItems=g;if(typeof V==="number")J.maxItems=V;J.type="array",J.items=p(z.element,w,{...v,path:[...v.path,"items"]})},EX=($,w,U,v)=>{let J=U,z=$._zod.def;J.type="object",J.properties={};let g=z.shape;for(let G in g)J.properties[G]=p(g[G],w,{...v,path:[...v.path,"properties",G]});let V=new Set(Object.keys(g)),_=new Set([...V].filter((G)=>{let X=z.shape[G]._zod;if(w.io==="input")return X.optin===void 0;else return X.optout===void 0}));if(_.size>0)J.required=Array.from(_);if(z.catchall?._zod.def.type==="never")J.additionalProperties=!1;else if(!z.catchall){if(w.io==="output")J.additionalProperties=!1}else if(z.catchall)J.additionalProperties=p(z.catchall,w,{...v,path:[...v.path,"additionalProperties"]})},iv=($,w,U,v)=>{let J=$._zod.def,z=J.inclusive===!1,g=J.options.map((V,_)=>p(V,w,{...v,path:[...v.path,z?"oneOf":"anyOf",_]}));if(z)U.oneOf=g;else U.anyOf=g},SX=($,w,U,v)=>{let J=$._zod.def,z=p(J.left,w,{...v,path:[...v.path,"allOf",0]}),g=p(J.right,w,{...v,path:[...v.path,"allOf",1]}),V=(G)=>("allOf"in G)&&Object.keys(G).length===1,_=[...V(z)?z.allOf:[z],...V(g)?g.allOf:[g]];U.allOf=_},AX=($,w,U,v)=>{let J=U,z=$._zod.def;J.type="array";let g=w.target==="draft-2020-12"?"prefixItems":"items",V=w.target==="draft-2020-12"?"items":w.target==="openapi-3.0"?"items":"additionalItems",_=z.items.map((N,W)=>p(N,w,{...v,path:[...v.path,g,W]})),G=z.rest?p(z.rest,w,{...v,path:[...v.path,V,...w.target==="openapi-3.0"?[z.items.length]:[]]}):null;if(w.target==="draft-2020-12"){if(J.prefixItems=_,G)J.items=G}else if(w.target==="openapi-3.0"){if(J.items={anyOf:_},G)J.items.anyOf.push(G);if(J.minItems=_.length,!G)J.maxItems=_.length}else if(J.items=_,G)J.additionalItems=G;let{minimum:X,maximum:I}=$._zod.bag;if(typeof X==="number")J.minItems=X;if(typeof I==="number")J.maxItems=I},RX=($,w,U,v)=>{let J=U,z=$._zod.def;J.type="object";let g=z.keyType,_=g._zod.bag?.patterns;if(z.mode==="loose"&&_&&_.size>0){let X=p(z.valueType,w,{...v,path:[...v.path,"patternProperties","*"]});J.patternProperties={};for(let I of _)J.patternProperties[I.source]=X}else{if(w.target==="draft-07"||w.target==="draft-2020-12")J.propertyNames=p(z.keyType,w,{...v,path:[...v.path,"propertyNames"]});J.additionalProperties=p(z.valueType,w,{...v,path:[...v.path,"additionalProperties"]})}let G=g._zod.values;if(G){let X=[...G].filter((I)=>typeof I==="string"||typeof I==="number");if(X.length>0)J.required=X}},kX=($,w,U,v)=>{let J=$._zod.def,z=p(J.innerType,w,v),g=w.seen.get($);if(w.target==="openapi-3.0")g.ref=J.innerType,U.nullable=!0;else U.anyOf=[z,{type:"null"}]},CX=($,w,U,v)=>{let J=$._zod.def;p(J.innerType,w,v);let z=w.seen.get($);z.ref=J.innerType},jX=($,w,U,v)=>{let J=$._zod.def;p(J.innerType,w,v);let z=w.seen.get($);z.ref=J.innerType,U.default=JSON.parse(JSON.stringify(J.defaultValue))},xX=($,w,U,v)=>{let J=$._zod.def;p(J.innerType,w,v);let z=w.seen.get($);if(z.ref=J.innerType,w.io==="input")U._prefault=JSON.parse(JSON.stringify(J.defaultValue))},rX=($,w,U,v)=>{let J=$._zod.def;p(J.innerType,w,v);let z=w.seen.get($);z.ref=J.innerType;let g;try{g=J.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}U.default=g},yX=($,w,U,v)=>{let J=$._zod.def,z=J.in._zod.traits.has("$ZodTransform"),g=w.io==="input"?z?J.out:J.in:J.out;p(g,w,v);let V=w.seen.get($);V.ref=g},dX=($,w,U,v)=>{let J=$._zod.def;p(J.innerType,w,v);let z=w.seen.get($);z.ref=J.innerType,U.readOnly=!0},mX=($,w,U,v)=>{let J=$._zod.def;p(J.innerType,w,v);let z=w.seen.get($);z.ref=J.innerType},Ev=($,w,U,v)=>{let J=$._zod.def;p(J.innerType,w,v);let z=w.seen.get($);z.ref=J.innerType},nX=($,w,U,v)=>{let J=$._zod.innerType;p(J,w,v);let z=w.seen.get($);z.ref=J},Mv={string:GX,number:_X,boolean:XX,bigint:IX,symbol:NX,null:WX,undefined:YX,void:QX,never:PX,any:OX,unknown:BX,date:qX,enum:LX,literal:HX,nan:uX,template_literal:KX,file:DX,success:fX,custom:TX,function:ZX,transform:bX,map:FX,set:MX,array:iX,object:EX,union:iv,intersection:SX,tuple:AX,record:RX,nullable:kX,nonoptional:CX,default:jX,prefault:xX,catch:rX,pipe:yX,readonly:dX,promise:mX,optional:Ev,lazy:nX};function Sv($,w){if("_idmap"in $){let v=$,J=l4({...w,processors:Mv}),z={};for(let _ of v._idmap.entries()){let[G,X]=_;p(X,J)}let g={},V={registry:v,uri:w?.uri,defs:z};J.external=V;for(let _ of v._idmap.entries()){let[G,X]=_;t4(J,X),g[G]=o4(J,X)}if(Object.keys(z).length>0){let _=J.target==="draft-2020-12"?"$defs":"definitions";g.__shared={[_]:z}}return{schemas:g}}let U=l4({...w,processors:Mv});return p($,U),t4(U,$),o4(U,$)}class hX{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter($){this.ctx.counter=$}get seen(){return this.ctx.seen}constructor($){let w=$?.target??"draft-2020-12";if(w==="draft-4")w="draft-04";if(w==="draft-7")w="draft-07";this.ctx=l4({processors:Mv,target:w,...$?.metadata&&{metadata:$.metadata},...$?.unrepresentable&&{unrepresentable:$.unrepresentable},...$?.override&&{override:$.override},...$?.io&&{io:$.io}})}process($,w={path:[],schemaPath:[]}){return p($,this.ctx,w)}emit($,w){if(w){if(w.cycles)this.ctx.cycles=w.cycles;if(w.reused)this.ctx.reused=w.reused;if(w.external)this.ctx.external=w.external}t4(this.ctx,$);let U=o4(this.ctx,$),{"~standard":v,...J}=U;return J}}var V9={};var IJ={};Y4(IJ,{xor:()=>$Y,xid:()=>K9,void:()=>t9,uuidv7:()=>Q9,uuidv6:()=>Y9,uuidv4:()=>W9,uuid:()=>N9,url:()=>P9,unknown:()=>R6,union:()=>gz,undefined:()=>c9,ulid:()=>u9,uint64:()=>n9,uint32:()=>y9,tuple:()=>fI,transform:()=>Gz,templateLiteral:()=>YY,symbol:()=>h9,superRefine:()=>sI,success:()=>XY,stringbool:()=>uY,stringFormat:()=>A9,string:()=>NJ,strictObject:()=>e9,set:()=>zY,refine:()=>eI,record:()=>TI,readonly:()=>cI,promise:()=>QY,preprocess:()=>DY,prefault:()=>jI,pipe:()=>rv,partialRecord:()=>UY,optional:()=>YJ,object:()=>a9,number:()=>_I,nullish:()=>_Y,nullable:()=>QJ,null:()=>YI,nonoptional:()=>xI,never:()=>zz,nativeEnum:()=>gY,nanoid:()=>q9,nan:()=>IY,meta:()=>LY,map:()=>vY,mac:()=>T9,looseRecord:()=>JY,looseObject:()=>s9,literal:()=>VY,lazy:()=>oI,ksuid:()=>D9,keyof:()=>p9,jwt:()=>S9,json:()=>KY,ipv6:()=>Z9,ipv4:()=>f9,invertCodec:()=>WY,intersection:()=>KI,int64:()=>m9,int32:()=>r9,int:()=>xv,instanceof:()=>HY,httpUrl:()=>O9,hostname:()=>R9,hex:()=>k9,hash:()=>C9,guid:()=>I9,function:()=>PY,float64:()=>x9,float32:()=>j9,file:()=>GY,exactOptional:()=>SI,enum:()=>Vz,emoji:()=>B9,email:()=>X9,e164:()=>E9,discriminatedUnion:()=>wY,describe:()=>qY,date:()=>o9,custom:()=>BY,cuid2:()=>H9,cuid:()=>L9,codec:()=>NY,cidrv6:()=>F9,cidrv4:()=>b9,check:()=>OY,catch:()=>dI,boolean:()=>XI,bigint:()=>d9,base64url:()=>i9,base64:()=>M9,array:()=>qJ,any:()=>l9,_function:()=>PY,_default:()=>kI,_ZodString:()=>yv,ZodXor:()=>LI,ZodXID:()=>tv,ZodVoid:()=>BI,ZodUnknown:()=>PI,ZodUnion:()=>HJ,ZodUndefined:()=>NI,ZodUUID:()=>I4,ZodURL:()=>OJ,ZodULID:()=>lv,ZodType:()=>m,ZodTuple:()=>DI,ZodTransform:()=>iI,ZodTemplateLiteral:()=>lI,ZodSymbol:()=>II,ZodSuccess:()=>rI,ZodStringFormat:()=>s,ZodString:()=>pw,ZodSet:()=>bI,ZodRecord:()=>tw,ZodReadonly:()=>hI,ZodPromise:()=>pI,ZodPreprocess:()=>nI,ZodPrefault:()=>CI,ZodPipe:()=>uJ,ZodOptional:()=>_z,ZodObject:()=>LJ,ZodNumberFormat:()=>k6,ZodNumber:()=>ew,ZodNullable:()=>AI,ZodNull:()=>WI,ZodNonOptional:()=>Xz,ZodNever:()=>OI,ZodNanoID:()=>nv,ZodNaN:()=>mI,ZodMap:()=>ZI,ZodMAC:()=>GI,ZodLiteral:()=>FI,ZodLazy:()=>tI,ZodKSUID:()=>ov,ZodJWT:()=>Jz,ZodIntersection:()=>uI,ZodIPv6:()=>av,ZodIPv4:()=>pv,ZodGUID:()=>WJ,ZodFunction:()=>aI,ZodFile:()=>MI,ZodExactOptional:()=>EI,ZodEnum:()=>ow,ZodEmoji:()=>mv,ZodEmail:()=>dv,ZodE164:()=>Uz,ZodDiscriminatedUnion:()=>HI,ZodDefault:()=>RI,ZodDate:()=>BJ,ZodCustomStringFormat:()=>aw,ZodCustom:()=>DJ,ZodCodec:()=>KJ,ZodCatch:()=>yI,ZodCUID2:()=>cv,ZodCUID:()=>hv,ZodCIDRv6:()=>sv,ZodCIDRv4:()=>ev,ZodBoolean:()=>sw,ZodBigIntFormat:()=>vz,ZodBigInt:()=>$U,ZodBase64URL:()=>wz,ZodBase64:()=>$z,ZodArray:()=>qI,ZodAny:()=>QI});var Av={};Y4(Av,{uppercase:()=>Rw,trim:()=>yw,toUpperCase:()=>mw,toLowerCase:()=>dw,startsWith:()=>Cw,slugify:()=>nw,size:()=>E6,regex:()=>Sw,property:()=>Fv,positive:()=>fv,overwrite:()=>e$,normalize:()=>rw,nonpositive:()=>Zv,nonnegative:()=>bv,negative:()=>Tv,multipleOf:()=>h4,minSize:()=>X4,minLength:()=>D4,mime:()=>xw,maxSize:()=>c4,maxLength:()=>S6,lte:()=>r$,lt:()=>G4,lowercase:()=>Aw,length:()=>A6,includes:()=>kw,gte:()=>b$,gt:()=>_4,endsWith:()=>jw});var lw={};Y4(lw,{time:()=>tX,duration:()=>oX,datetime:()=>cX,date:()=>lX,ZodISOTime:()=>Cv,ZodISODuration:()=>jv,ZodISODateTime:()=>Rv,ZodISODate:()=>kv});var Rv=B("ZodISODateTime",($,w)=>{TV.init($,w),s.init($,w)});function cX($){return T_(Rv,$)}var kv=B("ZodISODate",($,w)=>{ZV.init($,w),s.init($,w)});function lX($){return Z_(kv,$)}var Cv=B("ZodISOTime",($,w)=>{bV.init($,w),s.init($,w)});function tX($){return b_(Cv,$)}var jv=B("ZodISODuration",($,w)=>{FV.init($,w),s.init($,w)});function oX($){return F_(jv,$)}var G9=($,w)=>{o1.init($,w),$.name="ZodError",Object.defineProperties($,{format:{value:(U)=>a1($,U)},flatten:{value:(U)=>p1($,U)},addIssue:{value:(U)=>{$.issues.push(U),$.message=JSON.stringify($.issues,Dw,2)}},addIssues:{value:(U)=>{$.issues.push(...U),$.message=JSON.stringify($.issues,Dw,2)}},isEmpty:{get(){return $.issues.length===0}}})},KH=B("ZodError",G9),E$=B("ZodError",G9,{Parent:Error});var pX=Zw(E$),aX=bw(E$),eX=Fw(E$),sX=Mw(E$),$I=C0(E$),wI=j0(E$),UI=x0(E$),JI=r0(E$),vI=y0(E$),zI=d0(E$),gI=m0(E$),VI=n0(E$);var _9=new WeakMap;function PJ($,w,U){let v=Object.getPrototypeOf($),J=_9.get(v);if(!J)J=new Set,_9.set(v,J);if(J.has(w))return;J.add(w);for(let z in U){let g=U[z];Object.defineProperty(v,z,{configurable:!0,enumerable:!1,get(){let V=g.bind(this);return Object.defineProperty(this,z,{configurable:!0,writable:!0,enumerable:!0,value:V}),V},set(V){Object.defineProperty(this,z,{configurable:!0,writable:!0,enumerable:!0,value:V})}})}}var m=B("ZodType",($,w)=>{return d.init($,w),Object.assign($["~standard"],{jsonSchema:{input:cw($,"input"),output:cw($,"output")}}),$.toJSONSchema=VX($,{}),$.def=w,$.type=w.type,Object.defineProperty($,"_def",{value:w}),$.parse=(U,v)=>pX($,U,v,{callee:$.parse}),$.safeParse=(U,v)=>eX($,U,v),$.parseAsync=async(U,v)=>aX($,U,v,{callee:$.parseAsync}),$.safeParseAsync=async(U,v)=>sX($,U,v),$.spa=$.safeParseAsync,$.encode=(U,v)=>$I($,U,v),$.decode=(U,v)=>wI($,U,v),$.encodeAsync=async(U,v)=>UI($,U,v),$.decodeAsync=async(U,v)=>JI($,U,v),$.safeEncode=(U,v)=>vI($,U,v),$.safeDecode=(U,v)=>zI($,U,v),$.safeEncodeAsync=async(U,v)=>gI($,U,v),$.safeDecodeAsync=async(U,v)=>VI($,U,v),PJ($,"ZodType",{check(...U){let v=this.def;return this.clone(T.mergeDefs(v,{checks:[...v.checks??[],...U.map((J)=>typeof J==="function"?{_zod:{check:J,def:{check:"custom"},onattach:[]}}:J)]}),{parent:!0})},with(...U){return this.check(...U)},clone(U,v){return T$(this,U,v)},brand(){return this},register(U,v){return U.add(this,v),this},refine(U,v){return this.check(eI(U,v))},superRefine(U,v){return this.check(sI(U,v))},overwrite(U){return this.check(e$(U))},optional(){return YJ(this)},exactOptional(){return SI(this)},nullable(){return QJ(this)},nullish(){return YJ(QJ(this))},nonoptional(U){return xI(this,U)},array(){return qJ(this)},or(U){return gz([this,U])},and(U){return KI(this,U)},transform(U){return rv(this,Gz(U))},default(U){return kI(this,U)},prefault(U){return jI(this,U)},catch(U){return dI(this,U)},pipe(U){return rv(this,U)},readonly(){return cI(this)},describe(U){let v=this.clone();return P$.add(v,{description:U}),v},meta(...U){if(U.length===0)return P$.get(this);let v=this.clone();return P$.add(v,U[0]),v},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(U){return U(this)}}),Object.defineProperty($,"description",{get(){return P$.get($)?.description},configurable:!0}),$}),yv=B("_ZodString",($,w)=>{i6.init($,w),m.init($,w),$._zod.processJSONSchema=(v,J,z)=>GX($,v,J,z);let U=$._zod.bag;$.format=U.format??null,$.minLength=U.minimum??null,$.maxLength=U.maximum??null,PJ($,"_ZodString",{regex(...v){return this.check(Sw(...v))},includes(...v){return this.check(kw(...v))},startsWith(...v){return this.check(Cw(...v))},endsWith(...v){return this.check(jw(...v))},min(...v){return this.check(D4(...v))},max(...v){return this.check(S6(...v))},length(...v){return this.check(A6(...v))},nonempty(...v){return this.check(D4(1,...v))},lowercase(v){return this.check(Aw(v))},uppercase(v){return this.check(Rw(v))},trim(){return this.check(yw())},normalize(...v){return this.check(rw(...v))},toLowerCase(){return this.check(dw())},toUpperCase(){return this.check(mw())},slugify(){return this.check(nw())}})}),pw=B("ZodString",($,w)=>{i6.init($,w),yv.init($,w),$.email=(U)=>$.check(zv(dv,U)),$.url=(U)=>$.check(XJ(OJ,U)),$.jwt=(U)=>$.check(Dv(Jz,U)),$.emoji=(U)=>$.check(Xv(mv,U)),$.guid=(U)=>$.check(_J(WJ,U)),$.uuid=(U)=>$.check(gv(I4,U)),$.uuidv4=(U)=>$.check(Vv(I4,U)),$.uuidv6=(U)=>$.check(Gv(I4,U)),$.uuidv7=(U)=>$.check(_v(I4,U)),$.nanoid=(U)=>$.check(Iv(nv,U)),$.guid=(U)=>$.check(_J(WJ,U)),$.cuid=(U)=>$.check(Nv(hv,U)),$.cuid2=(U)=>$.check(Wv(cv,U)),$.ulid=(U)=>$.check(Yv(lv,U)),$.base64=(U)=>$.check(Hv($z,U)),$.base64url=(U)=>$.check(uv(wz,U)),$.xid=(U)=>$.check(Qv(tv,U)),$.ksuid=(U)=>$.check(Pv(ov,U)),$.ipv4=(U)=>$.check(Ov(pv,U)),$.ipv6=(U)=>$.check(Bv(av,U)),$.cidrv4=(U)=>$.check(qv(ev,U)),$.cidrv6=(U)=>$.check(Lv(sv,U)),$.e164=(U)=>$.check(Kv(Uz,U)),$.datetime=(U)=>$.check(cX(U)),$.date=(U)=>$.check(lX(U)),$.time=(U)=>$.check(tX(U)),$.duration=(U)=>$.check(oX(U))});function NJ($){return u_(pw,$)}var s=B("ZodStringFormat",($,w)=>{e.init($,w),yv.init($,w)}),dv=B("ZodEmail",($,w)=>{OV.init($,w),s.init($,w)});function X9($){return zv(dv,$)}var WJ=B("ZodGUID",($,w)=>{QV.init($,w),s.init($,w)});function I9($){return _J(WJ,$)}var I4=B("ZodUUID",($,w)=>{PV.init($,w),s.init($,w)});function N9($){return gv(I4,$)}function W9($){return Vv(I4,$)}function Y9($){return Gv(I4,$)}function Q9($){return _v(I4,$)}var OJ=B("ZodURL",($,w)=>{BV.init($,w),s.init($,w)});function P9($){return XJ(OJ,$)}function O9($){return XJ(OJ,{protocol:x$.httpProtocol,hostname:x$.domain,...T.normalizeParams($)})}var mv=B("ZodEmoji",($,w)=>{qV.init($,w),s.init($,w)});function B9($){return Xv(mv,$)}var nv=B("ZodNanoID",($,w)=>{LV.init($,w),s.init($,w)});function q9($){return Iv(nv,$)}var hv=B("ZodCUID",($,w)=>{HV.init($,w),s.init($,w)});function L9($){return Nv(hv,$)}var cv=B("ZodCUID2",($,w)=>{uV.init($,w),s.init($,w)});function H9($){return Wv(cv,$)}var lv=B("ZodULID",($,w)=>{KV.init($,w),s.init($,w)});function u9($){return Yv(lv,$)}var tv=B("ZodXID",($,w)=>{DV.init($,w),s.init($,w)});function K9($){return Qv(tv,$)}var ov=B("ZodKSUID",($,w)=>{fV.init($,w),s.init($,w)});function D9($){return Pv(ov,$)}var pv=B("ZodIPv4",($,w)=>{MV.init($,w),s.init($,w)});function f9($){return Ov(pv,$)}var GI=B("ZodMAC",($,w)=>{EV.init($,w),s.init($,w)});function T9($){return D_(GI,$)}var av=B("ZodIPv6",($,w)=>{iV.init($,w),s.init($,w)});function Z9($){return Bv(av,$)}var ev=B("ZodCIDRv4",($,w)=>{SV.init($,w),s.init($,w)});function b9($){return qv(ev,$)}var sv=B("ZodCIDRv6",($,w)=>{AV.init($,w),s.init($,w)});function F9($){return Lv(sv,$)}var $z=B("ZodBase64",($,w)=>{kV.init($,w),s.init($,w)});function M9($){return Hv($z,$)}var wz=B("ZodBase64URL",($,w)=>{CV.init($,w),s.init($,w)});function i9($){return uv(wz,$)}var Uz=B("ZodE164",($,w)=>{jV.init($,w),s.init($,w)});function E9($){return Kv(Uz,$)}var Jz=B("ZodJWT",($,w)=>{xV.init($,w),s.init($,w)});function S9($){return Dv(Jz,$)}var aw=B("ZodCustomStringFormat",($,w)=>{rV.init($,w),s.init($,w)});function A9($,w,U={}){return hw(aw,$,w,U)}function R9($){return hw(aw,"hostname",x$.hostname,$)}function k9($){return hw(aw,"hex",x$.hex,$)}function C9($,w){let U=w?.enc??"hex",v=`${$}_${U}`,J=x$[v];if(!J)throw Error(`Unrecognized hash format: ${v}`);return hw(aw,v,J,w)}var ew=B("ZodNumber",($,w)=>{s0.init($,w),m.init($,w),$._zod.processJSONSchema=(v,J,z)=>_X($,v,J,z),PJ($,"ZodNumber",{gt(v,J){return this.check(_4(v,J))},gte(v,J){return this.check(b$(v,J))},min(v,J){return this.check(b$(v,J))},lt(v,J){return this.check(G4(v,J))},lte(v,J){return this.check(r$(v,J))},max(v,J){return this.check(r$(v,J))},int(v){return this.check(xv(v))},safe(v){return this.check(xv(v))},positive(v){return this.check(_4(0,v))},nonnegative(v){return this.check(b$(0,v))},negative(v){return this.check(G4(0,v))},nonpositive(v){return this.check(r$(0,v))},multipleOf(v,J){return this.check(h4(v,J))},step(v,J){return this.check(h4(v,J))},finite(){return this}});let U=$._zod.bag;$.minValue=Math.max(U.minimum??Number.NEGATIVE_INFINITY,U.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(U.maximum??Number.POSITIVE_INFINITY,U.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(U.format??"").includes("int")||Number.isSafeInteger(U.multipleOf??0.5),$.isFinite=!0,$.format=U.format??null});function _I($){return M_(ew,$)}var k6=B("ZodNumberFormat",($,w)=>{yV.init($,w),ew.init($,w)});function xv($){return E_(k6,$)}function j9($){return S_(k6,$)}function x9($){return A_(k6,$)}function r9($){return R_(k6,$)}function y9($){return k_(k6,$)}var sw=B("ZodBoolean",($,w)=>{wJ.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>XX($,U,v,J)});function XI($){return C_(sw,$)}var $U=B("ZodBigInt",($,w)=>{$v.init($,w),m.init($,w),$._zod.processJSONSchema=(v,J,z)=>IX($,v,J,z),$.gte=(v,J)=>$.check(b$(v,J)),$.min=(v,J)=>$.check(b$(v,J)),$.gt=(v,J)=>$.check(_4(v,J)),$.gte=(v,J)=>$.check(b$(v,J)),$.min=(v,J)=>$.check(b$(v,J)),$.lt=(v,J)=>$.check(G4(v,J)),$.lte=(v,J)=>$.check(r$(v,J)),$.max=(v,J)=>$.check(r$(v,J)),$.positive=(v)=>$.check(_4(BigInt(0),v)),$.negative=(v)=>$.check(G4(BigInt(0),v)),$.nonpositive=(v)=>$.check(r$(BigInt(0),v)),$.nonnegative=(v)=>$.check(b$(BigInt(0),v)),$.multipleOf=(v,J)=>$.check(h4(v,J));let U=$._zod.bag;$.minValue=U.minimum??null,$.maxValue=U.maximum??null,$.format=U.format??null});function d9($){return x_($U,$)}var vz=B("ZodBigIntFormat",($,w)=>{dV.init($,w),$U.init($,w)});function m9($){return y_(vz,$)}function n9($){return d_(vz,$)}var II=B("ZodSymbol",($,w)=>{mV.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>NX($,U,v,J)});function h9($){return m_(II,$)}var NI=B("ZodUndefined",($,w)=>{nV.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>YX($,U,v,J)});function c9($){return n_(NI,$)}var WI=B("ZodNull",($,w)=>{hV.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>WX($,U,v,J)});function YI($){return h_(WI,$)}var QI=B("ZodAny",($,w)=>{cV.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>OX($,U,v,J)});function l9(){return c_(QI)}var PI=B("ZodUnknown",($,w)=>{lV.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>BX($,U,v,J)});function R6(){return l_(PI)}var OI=B("ZodNever",($,w)=>{tV.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>PX($,U,v,J)});function zz($){return t_(OI,$)}var BI=B("ZodVoid",($,w)=>{oV.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>QX($,U,v,J)});function t9($){return o_(BI,$)}var BJ=B("ZodDate",($,w)=>{pV.init($,w),m.init($,w),$._zod.processJSONSchema=(v,J,z)=>qX($,v,J,z),$.min=(v,J)=>$.check(b$(v,J)),$.max=(v,J)=>$.check(r$(v,J));let U=$._zod.bag;$.minDate=U.minimum?new Date(U.minimum):null,$.maxDate=U.maximum?new Date(U.maximum):null});function o9($){return p_(BJ,$)}var qI=B("ZodArray",($,w)=>{aV.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>iX($,U,v,J),$.element=w.element,PJ($,"ZodArray",{min(U,v){return this.check(D4(U,v))},nonempty(U){return this.check(D4(1,U))},max(U,v){return this.check(S6(U,v))},length(U,v){return this.check(A6(U,v))},unwrap(){return this.element}})});function qJ($,w){return s_(qI,$,w)}function p9($){let w=$._zod.def.shape;return Vz(Object.keys(w))}var LJ=B("ZodObject",($,w)=>{eV.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>EX($,U,v,J),T.defineLazy($,"shape",()=>{return w.shape}),PJ($,"ZodObject",{keyof(){return Vz(Object.keys(this._zod.def.shape))},catchall(U){return this.clone({...this._zod.def,catchall:U})},passthrough(){return this.clone({...this._zod.def,catchall:R6()})},loose(){return this.clone({...this._zod.def,catchall:R6()})},strict(){return this.clone({...this._zod.def,catchall:zz()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(U){return T.extend(this,U)},safeExtend(U){return T.safeExtend(this,U)},merge(U){return T.merge(this,U)},pick(U){return T.pick(this,U)},omit(U){return T.omit(this,U)},partial(...U){return T.partial(_z,this,U[0])},required(...U){return T.required(Xz,this,U[0])}})});function a9($,w){let U={type:"object",shape:$??{},...T.normalizeParams(w)};return new LJ(U)}function e9($,w){return new LJ({type:"object",shape:$,catchall:zz(),...T.normalizeParams(w)})}function s9($,w){return new LJ({type:"object",shape:$,catchall:R6(),...T.normalizeParams(w)})}var HJ=B("ZodUnion",($,w)=>{UJ.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>iv($,U,v,J),$.options=w.options});function gz($,w){return new HJ({type:"union",options:$,...T.normalizeParams(w)})}var LI=B("ZodXor",($,w)=>{HJ.init($,w),sV.init($,w),$._zod.processJSONSchema=(U,v,J)=>iv($,U,v,J),$.options=w.options});function $Y($,w){return new LI({type:"union",options:$,inclusive:!1,...T.normalizeParams(w)})}var HI=B("ZodDiscriminatedUnion",($,w)=>{HJ.init($,w),$G.init($,w)});function wY($,w,U){return new HI({type:"union",options:w,discriminator:$,...T.normalizeParams(U)})}var uI=B("ZodIntersection",($,w)=>{wG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>SX($,U,v,J)});function KI($,w){return new uI({type:"intersection",left:$,right:w})}var DI=B("ZodTuple",($,w)=>{wv.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>AX($,U,v,J),$.rest=(U)=>$.clone({...$._zod.def,rest:U})});function fI($,w,U){let v=w instanceof d,J=v?U:w;return new DI({type:"tuple",items:$,rest:v?w:null,...T.normalizeParams(J)})}var tw=B("ZodRecord",($,w)=>{UG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>RX($,U,v,J),$.keyType=w.keyType,$.valueType=w.valueType});function TI($,w,U){if(!w||!w._zod)return new tw({type:"record",keyType:NJ(),valueType:$,...T.normalizeParams(w)});return new tw({type:"record",keyType:$,valueType:w,...T.normalizeParams(U)})}function UY($,w,U){let v=T$($);return v._zod.values=void 0,new tw({type:"record",keyType:v,valueType:w,...T.normalizeParams(U)})}function JY($,w,U){return new tw({type:"record",keyType:$,valueType:w,mode:"loose",...T.normalizeParams(U)})}var ZI=B("ZodMap",($,w)=>{JG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>FX($,U,v,J),$.keyType=w.keyType,$.valueType=w.valueType,$.min=(...U)=>$.check(X4(...U)),$.nonempty=(U)=>$.check(X4(1,U)),$.max=(...U)=>$.check(c4(...U)),$.size=(...U)=>$.check(E6(...U))});function vY($,w,U){return new ZI({type:"map",keyType:$,valueType:w,...T.normalizeParams(U)})}var bI=B("ZodSet",($,w)=>{vG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>MX($,U,v,J),$.min=(...U)=>$.check(X4(...U)),$.nonempty=(U)=>$.check(X4(1,U)),$.max=(...U)=>$.check(c4(...U)),$.size=(...U)=>$.check(E6(...U))});function zY($,w){return new bI({type:"set",valueType:$,...T.normalizeParams(w)})}var ow=B("ZodEnum",($,w)=>{zG.init($,w),m.init($,w),$._zod.processJSONSchema=(v,J,z)=>LX($,v,J,z),$.enum=w.entries,$.options=Object.values(w.entries);let U=new Set(Object.keys(w.entries));$.extract=(v,J)=>{let z={};for(let g of v)if(U.has(g))z[g]=w.entries[g];else throw Error(`Key ${g} not found in enum`);return new ow({...w,checks:[],...T.normalizeParams(J),entries:z})},$.exclude=(v,J)=>{let z={...w.entries};for(let g of v)if(U.has(g))delete z[g];else throw Error(`Key ${g} not found in enum`);return new ow({...w,checks:[],...T.normalizeParams(J),entries:z})}});function Vz($,w){let U=Array.isArray($)?Object.fromEntries($.map((v)=>[v,v])):$;return new ow({type:"enum",entries:U,...T.normalizeParams(w)})}function gY($,w){return new ow({type:"enum",entries:$,...T.normalizeParams(w)})}var FI=B("ZodLiteral",($,w)=>{gG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>HX($,U,v,J),$.values=new Set(w.values),Object.defineProperty($,"value",{get(){if(w.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return w.values[0]}})});function VY($,w){return new FI({type:"literal",values:Array.isArray($)?$:[$],...T.normalizeParams(w)})}var MI=B("ZodFile",($,w)=>{VG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>DX($,U,v,J),$.min=(U,v)=>$.check(X4(U,v)),$.max=(U,v)=>$.check(c4(U,v)),$.mime=(U,v)=>$.check(xw(Array.isArray(U)?U:[U],v))});function GY($){return $X(MI,$)}var iI=B("ZodTransform",($,w)=>{GG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>bX($,U,v,J),$._zod.parse=(U,v)=>{if(v.direction==="backward")throw new b6($.constructor.name);U.addIssue=(z)=>{if(typeof z==="string")U.issues.push(T.issue(z,U.value,w));else{let g=z;if(g.fatal)g.continue=!1;g.code??(g.code="custom"),g.input??(g.input=U.value),g.inst??(g.inst=$),U.issues.push(T.issue(g))}};let J=w.transform(U.value,U);if(J instanceof Promise)return J.then((z)=>{return U.value=z,U.fallback=!0,U});return U.value=J,U.fallback=!0,U}});function Gz($){return new iI({type:"transform",transform:$})}var _z=B("ZodOptional",($,w)=>{Uv.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>Ev($,U,v,J),$.unwrap=()=>$._zod.def.innerType});function YJ($){return new _z({type:"optional",innerType:$})}var EI=B("ZodExactOptional",($,w)=>{_G.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>Ev($,U,v,J),$.unwrap=()=>$._zod.def.innerType});function SI($){return new EI({type:"optional",innerType:$})}var AI=B("ZodNullable",($,w)=>{XG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>kX($,U,v,J),$.unwrap=()=>$._zod.def.innerType});function QJ($){return new AI({type:"nullable",innerType:$})}function _Y($){return YJ(QJ($))}var RI=B("ZodDefault",($,w)=>{IG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>jX($,U,v,J),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function kI($,w){return new RI({type:"default",innerType:$,get defaultValue(){return typeof w==="function"?w():T.shallowClone(w)}})}var CI=B("ZodPrefault",($,w)=>{NG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>xX($,U,v,J),$.unwrap=()=>$._zod.def.innerType});function jI($,w){return new CI({type:"prefault",innerType:$,get defaultValue(){return typeof w==="function"?w():T.shallowClone(w)}})}var Xz=B("ZodNonOptional",($,w)=>{WG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>CX($,U,v,J),$.unwrap=()=>$._zod.def.innerType});function xI($,w){return new Xz({type:"nonoptional",innerType:$,...T.normalizeParams(w)})}var rI=B("ZodSuccess",($,w)=>{YG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>fX($,U,v,J),$.unwrap=()=>$._zod.def.innerType});function XY($){return new rI({type:"success",innerType:$})}var yI=B("ZodCatch",($,w)=>{QG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>rX($,U,v,J),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function dI($,w){return new yI({type:"catch",innerType:$,catchValue:typeof w==="function"?w:()=>w})}var mI=B("ZodNaN",($,w)=>{PG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>uX($,U,v,J)});function IY($){return e_(mI,$)}var uJ=B("ZodPipe",($,w)=>{Jv.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>yX($,U,v,J),$.in=w.in,$.out=w.out});function rv($,w){return new uJ({type:"pipe",in:$,out:w})}var KJ=B("ZodCodec",($,w)=>{uJ.init($,w),JJ.init($,w)});function NY($,w,U){return new KJ({type:"pipe",in:$,out:w,transform:U.decode,reverseTransform:U.encode})}function WY($){let w=$._zod.def;return new KJ({type:"pipe",in:w.out,out:w.in,transform:w.reverseTransform,reverseTransform:w.transform})}var nI=B("ZodPreprocess",($,w)=>{uJ.init($,w),OG.init($,w)}),hI=B("ZodReadonly",($,w)=>{BG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>dX($,U,v,J),$.unwrap=()=>$._zod.def.innerType});function cI($){return new hI({type:"readonly",innerType:$})}var lI=B("ZodTemplateLiteral",($,w)=>{qG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>KX($,U,v,J)});function YY($,w){return new lI({type:"template_literal",parts:$,...T.normalizeParams(w)})}var tI=B("ZodLazy",($,w)=>{uG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>nX($,U,v,J),$.unwrap=()=>$._zod.def.getter()});function oI($){return new tI({type:"lazy",getter:$})}var pI=B("ZodPromise",($,w)=>{HG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>mX($,U,v,J),$.unwrap=()=>$._zod.def.innerType});function QY($){return new pI({type:"promise",innerType:$})}var aI=B("ZodFunction",($,w)=>{LG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>ZX($,U,v,J)});function PY($){return new aI({type:"function",input:Array.isArray($?.input)?fI($?.input):$?.input??qJ(R6()),output:$?.output??R6()})}var DJ=B("ZodCustom",($,w)=>{KG.init($,w),m.init($,w),$._zod.processJSONSchema=(U,v,J)=>TX($,U,v,J)});function OY($){let w=new $$({check:"custom"});return w._zod.check=$,w}function BY($,w){return wX(DJ,$??(()=>!0),w)}function eI($,w={}){return UX(DJ,$,w)}function sI($,w){return JX($,w)}var qY=vX,LY=zX;function HY($,w={}){let U=new DJ({type:"custom",check:"custom",fn:(v)=>v instanceof $,abort:!0,...T.normalizeParams(w)});return U._zod.bag.Class=$,U._zod.check=(v)=>{if(!(v.value instanceof $))v.issues.push({code:"invalid_type",expected:$.name,input:v.value,inst:U,path:[...U._zod.def.path??[]]})},U}var uY=(...$)=>gX({Codec:KJ,Boolean:sw,String:pw},...$);function KY($){let w=oI(()=>{return gz([NJ($),_I(),XI(),YI(),qJ(w),TI(NJ(),w)])});return w}function DY($,w){return new nI({type:"pipe",in:Gz($),out:w})}var fH={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function TH($){g$({customError:$})}function ZH(){return g$().customError}var $N;(function($){})($N||($N={}));var R={...IJ,...Av,iso:lw},bH=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function FH($,w){let U=$.$schema;if(U==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(U==="http://json-schema.org/draft-07/schema#")return"draft-7";if(U==="http://json-schema.org/draft-04/schema#")return"draft-4";return w??"draft-2020-12"}function MH($,w){if(!$.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let U=$.slice(1).split("/").filter(Boolean);if(U.length===0)return w.rootSchema;let v=w.version==="draft-2020-12"?"$defs":"definitions";if(U[0]===v){let J=U[1];if(!J||!w.defs[J])throw Error(`Reference not found: ${$}`);return w.defs[J]}throw Error(`Reference not found: ${$}`)}function fY($,w){if($.not!==void 0){if(typeof $.not==="object"&&Object.keys($.not).length===0)return R.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if($.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if($.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if($.if!==void 0||$.then!==void 0||$.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if($.dependentSchemas!==void 0||$.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if($.$ref){let J=$.$ref;if(w.refs.has(J))return w.refs.get(J);if(w.processing.has(J))return R.lazy(()=>{if(!w.refs.has(J))throw Error(`Circular reference not resolved: ${J}`);return w.refs.get(J)});w.processing.add(J);let z=MH(J,w),g=u$(z,w);return w.refs.set(J,g),w.processing.delete(J),g}if($.enum!==void 0){let J=$.enum;if(w.version==="openapi-3.0"&&$.nullable===!0&&J.length===1&&J[0]===null)return R.null();if(J.length===0)return R.never();if(J.length===1)return R.literal(J[0]);if(J.every((g)=>typeof g==="string"))return R.enum(J);let z=J.map((g)=>R.literal(g));if(z.length<2)return z[0];return R.union([z[0],z[1],...z.slice(2)])}if($.const!==void 0)return R.literal($.const);let U=$.type;if(Array.isArray(U)){let J=U.map((z)=>{let g={...$,type:z};return fY(g,w)});if(J.length===0)return R.never();if(J.length===1)return J[0];return R.union(J)}if(!U)return R.any();let v;switch(U){case"string":{let J=R.string();if($.format){let z=$.format;if(z==="email")J=J.check(R.email());else if(z==="uri"||z==="uri-reference")J=J.check(R.url());else if(z==="uuid"||z==="guid")J=J.check(R.uuid());else if(z==="date-time")J=J.check(R.iso.datetime());else if(z==="date")J=J.check(R.iso.date());else if(z==="time")J=J.check(R.iso.time());else if(z==="duration")J=J.check(R.iso.duration());else if(z==="ipv4")J=J.check(R.ipv4());else if(z==="ipv6")J=J.check(R.ipv6());else if(z==="mac")J=J.check(R.mac());else if(z==="cidr")J=J.check(R.cidrv4());else if(z==="cidr-v6")J=J.check(R.cidrv6());else if(z==="base64")J=J.check(R.base64());else if(z==="base64url")J=J.check(R.base64url());else if(z==="e164")J=J.check(R.e164());else if(z==="jwt")J=J.check(R.jwt());else if(z==="emoji")J=J.check(R.emoji());else if(z==="nanoid")J=J.check(R.nanoid());else if(z==="cuid")J=J.check(R.cuid());else if(z==="cuid2")J=J.check(R.cuid2());else if(z==="ulid")J=J.check(R.ulid());else if(z==="xid")J=J.check(R.xid());else if(z==="ksuid")J=J.check(R.ksuid())}if(typeof $.minLength==="number")J=J.min($.minLength);if(typeof $.maxLength==="number")J=J.max($.maxLength);if($.pattern)J=J.regex(new RegExp($.pattern));v=J;break}case"number":case"integer":{let J=U==="integer"?R.number().int():R.number();if(typeof $.minimum==="number")J=J.min($.minimum);if(typeof $.maximum==="number")J=J.max($.maximum);if(typeof $.exclusiveMinimum==="number")J=J.gt($.exclusiveMinimum);else if($.exclusiveMinimum===!0&&typeof $.minimum==="number")J=J.gt($.minimum);if(typeof $.exclusiveMaximum==="number")J=J.lt($.exclusiveMaximum);else if($.exclusiveMaximum===!0&&typeof $.maximum==="number")J=J.lt($.maximum);if(typeof $.multipleOf==="number")J=J.multipleOf($.multipleOf);v=J;break}case"boolean":{v=R.boolean();break}case"null":{v=R.null();break}case"object":{let J={},z=$.properties||{},g=new Set($.required||[]);for(let[_,G]of Object.entries(z)){let X=u$(G,w);J[_]=g.has(_)?X:X.optional()}if($.propertyNames){let _=u$($.propertyNames,w),G=$.additionalProperties&&typeof $.additionalProperties==="object"?u$($.additionalProperties,w):R.any();if(Object.keys(J).length===0){v=R.record(_,G);break}let X=R.object(J).passthrough(),I=R.looseRecord(_,G);v=R.intersection(X,I);break}if($.patternProperties){let _=$.patternProperties,G=Object.keys(_),X=[];for(let N of G){let W=u$(_[N],w),P=R.string().regex(new RegExp(N));X.push(R.looseRecord(P,W))}let I=[];if(Object.keys(J).length>0)I.push(R.object(J).passthrough());if(I.push(...X),I.length===0)v=R.object({}).passthrough();else if(I.length===1)v=I[0];else{let N=R.intersection(I[0],I[1]);for(let W=2;W<I.length;W++)N=R.intersection(N,I[W]);v=N}break}let V=R.object(J);if($.additionalProperties===!1)v=V.strict();else if(typeof $.additionalProperties==="object")v=V.catchall(u$($.additionalProperties,w));else v=V.passthrough();break}case"array":{let{prefixItems:J,items:z}=$;if(J&&Array.isArray(J)){let g=J.map((_)=>u$(_,w)),V=z&&typeof z==="object"&&!Array.isArray(z)?u$(z,w):void 0;if(V)v=R.tuple(g).rest(V);else v=R.tuple(g);if(typeof $.minItems==="number")v=v.check(R.minLength($.minItems));if(typeof $.maxItems==="number")v=v.check(R.maxLength($.maxItems))}else if(Array.isArray(z)){let g=z.map((_)=>u$(_,w)),V=$.additionalItems&&typeof $.additionalItems==="object"?u$($.additionalItems,w):void 0;if(V)v=R.tuple(g).rest(V);else v=R.tuple(g);if(typeof $.minItems==="number")v=v.check(R.minLength($.minItems));if(typeof $.maxItems==="number")v=v.check(R.maxLength($.maxItems))}else if(z!==void 0){let g=u$(z,w),V=R.array(g);if(typeof $.minItems==="number")V=V.min($.minItems);if(typeof $.maxItems==="number")V=V.max($.maxItems);v=V}else v=R.array(R.any());break}default:throw Error(`Unsupported type: ${U}`)}return v}function u$($,w){if(typeof $==="boolean")return $?R.any():R.never();let U=fY($,w),v=$.type||$.enum!==void 0||$.const!==void 0;if($.anyOf&&Array.isArray($.anyOf)){let V=$.anyOf.map((G)=>u$(G,w)),_=R.union(V);U=v?R.intersection(U,_):_}if($.oneOf&&Array.isArray($.oneOf)){let V=$.oneOf.map((G)=>u$(G,w)),_=R.xor(V);U=v?R.intersection(U,_):_}if($.allOf&&Array.isArray($.allOf))if($.allOf.length===0)U=v?U:R.any();else{let V=v?U:u$($.allOf[0],w),_=v?0:1;for(let G=_;G<$.allOf.length;G++)V=R.intersection(V,u$($.allOf[G],w));U=V}if($.nullable===!0&&w.version==="openapi-3.0")U=R.nullable(U);if($.readOnly===!0)U=R.readonly(U);if($.default!==void 0)U=U.default($.default);let J={},z=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let V of z)if(V in $)J[V]=$[V];let g=["contentEncoding","contentMediaType","contentSchema"];for(let V of g)if(V in $)J[V]=$[V];for(let V of Object.keys($))if(!bH.has(V))J[V]=$[V];if(Object.keys(J).length>0)w.registry.add(U,J);if($.description)U=U.describe($.description);return U}function TY($,w){if(typeof $==="boolean")return $?R.any():R.never();let U;try{U=JSON.parse(JSON.stringify($))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let v=FH(U,w?.defaultTarget),J=U.$defs||U.definitions||{},z={version:v,defs:J,refs:new Map,processing:new Set,rootSchema:U,registry:w?.registry??P$};return u$(U,z)}var wN={};Y4(wN,{string:()=>iH,number:()=>EH,date:()=>RH,boolean:()=>SH,bigint:()=>AH});function iH($){return K_(pw,$)}function EH($){return i_(ew,$)}function SH($){return j_(sw,$)}function AH($){return r_($U,$)}function RH($){return a_(BJ,$)}g$(vJ());import{join as kH}from"node:path";function wU($){if($)return $;if(process.env.PLOOF_HOME)return process.env.PLOOF_HOME;return kH(process.env.HOME??process.cwd(),".ploof")}var nH=C.object({apiKey:C.string().optional(),organization:C.string().optional(),project:C.string().optional(),baseURL:C.string().optional()}),hH=C.object({providers:C.record(C.string(),C.object({defaultProfile:C.string().default("default"),profiles:C.record(C.string(),nH).default({})})).default({})});class T4{credPath;constructor($){this.credPath=mH(wU($),"credentials.json")}login($,w,U,v=!0){if(!U.apiKey)throw Error("API key is required.");let J=this.read(),z=J.providers[$]??{defaultProfile:w,profiles:{}};if(z.profiles[w]=U,v)z.defaultProfile=w;J.providers[$]=z,this.write(J)}logout($,w){let U=this.read(),v=U.providers[$];if(!v)return!1;let J=w??v.defaultProfile;if(!v.profiles[J])return!1;delete v.profiles[J];let z=Object.keys(v.profiles);if(z.length===0)delete U.providers[$];else if(v.defaultProfile===J)v.defaultProfile=z[0];return this.write(U),!0}listProfiles($){let w=this.read(),U={};for(let[v,J]of Object.entries(w.providers)){if($&&v!==$)continue;U[v]=Object.keys(J.profiles)}return U}getDefaultProfile($){return this.read().providers[$]?.defaultProfile??"default"}getCredential($,w){if($==="openai"){let g=process.env.PLOOF_OPENAI_API_KEY??process.env.OPENAI_API_KEY;if(g)return{apiKey:g,organization:process.env.PLOOF_OPENAI_ORG,project:process.env.PLOOF_OPENAI_PROJECT,baseURL:process.env.PLOOF_OPENAI_BASE_URL,source:"env",profile:w??"env"}}let v=this.read().providers[$];if(!v)return null;let J=w??v.defaultProfile,z=v.profiles[J];if(!z?.apiKey)return null;return{...z,source:"stored",profile:J}}status($,w){let U=w??this.getDefaultProfile($),v=this.getCredential($,w);if(!v?.apiKey)return{provider:$,profile:U,authenticated:!1};return{provider:$,profile:v.profile??U,authenticated:!0,source:v.source,keyPrefix:cH(v.apiKey),organization:v.organization,project:v.project,baseURL:v.baseURL}}read(){try{if(!jH(this.credPath))return{providers:{}};let $=rH(this.credPath,"utf-8");return hH.parse(JSON.parse($))}catch{return{providers:{}}}}write($){xH(dH(this.credPath),{recursive:!0}),yH(this.credPath,`${JSON.stringify($,null,2)}
|
|
255
|
-
|
|
256
|
-
|
|
258
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let z of $.seen.entries()){let i=z[1];if(w===z[0]){G(z);continue}if($.external){let X=$.external.registry.get(z[0])?.id;if(w!==z[0]&&X){G(z);continue}}if($.metadataRegistry.get(z[0])?.id){G(z);continue}if(i.cycle){G(z);continue}if(i.count>1){if($.reused==="ref"){G(z);continue}}}}function u6($,w){let J=$.seen.get(w);if(!J)throw Error("Unprocessed schema. This is a bug in Zod.");let V=(i)=>{let N=$.seen.get(i);if(N.ref===null)return;let X=N.def??N.schema,W={...X},I=N.ref;if(N.ref=null,I){V(I);let Y=$.seen.get(I),v=Y.schema;if(v.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))X.allOf=X.allOf??[],X.allOf.push(v);else Object.assign(X,v);if(Object.assign(X,W),i._zod.parent===I)for(let P in X){if(P==="$ref"||P==="allOf")continue;if(!(P in W))delete X[P]}if(v.$ref&&Y.def)for(let P in X){if(P==="$ref"||P==="allOf")continue;if(P in Y.def&&JSON.stringify(X[P])===JSON.stringify(Y.def[P]))delete X[P]}}let g=i._zod.parent;if(g&&g!==I){V(g);let Y=$.seen.get(g);if(Y?.schema.$ref){if(X.$ref=Y.schema.$ref,Y.def)for(let v in X){if(v==="$ref"||v==="allOf")continue;if(v in Y.def&&JSON.stringify(X[v])===JSON.stringify(Y.def[v]))delete X[v]}}}$.override({zodSchema:i,jsonSchema:X,path:N.path??[]})};for(let i of[...$.seen.entries()].reverse())V(i[0]);let U={};if($.target==="draft-2020-12")U.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")U.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")U.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let i=$.external.registry.get(w)?.id;if(!i)throw Error("Schema is missing an `id` property");U.$id=$.external.uri(i)}Object.assign(U,J.def??J.schema);let G=$.metadataRegistry.get(w)?.id;if(G!==void 0&&U.id===G)delete U.id;let z=$.external?.defs??{};for(let i of $.seen.entries()){let N=i[1];if(N.def&&N.defId){if(N.def.id===N.defId)delete N.def.id;z[N.defId]=N.def}}if($.external);else if(Object.keys(z).length>0)if($.target==="draft-2020-12")U.$defs=z;else U.definitions=z;try{let i=JSON.parse(JSON.stringify(U));return Object.defineProperty(i,"~standard",{value:{...w["~standard"],jsonSchema:{input:TJ(w,"input",$.processors),output:TJ(w,"output",$.processors)}},enumerable:!1,writable:!1}),i}catch(i){throw Error("Error converting schema to JSON.")}}function x$($,w){let J=w??{seen:new Set};if(J.seen.has($))return!1;J.seen.add($);let V=$._zod.def;if(V.type==="transform")return!0;if(V.type==="array")return x$(V.element,J);if(V.type==="set")return x$(V.valueType,J);if(V.type==="lazy")return x$(V.getter(),J);if(V.type==="promise"||V.type==="optional"||V.type==="nonoptional"||V.type==="nullable"||V.type==="readonly"||V.type==="default"||V.type==="prefault")return x$(V.innerType,J);if(V.type==="intersection")return x$(V.left,J)||x$(V.right,J);if(V.type==="record"||V.type==="map")return x$(V.keyType,J)||x$(V.valueType,J);if(V.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return x$(V.in,J)||x$(V.out,J)}if(V.type==="object"){for(let U in V.shape)if(x$(V.shape[U],J))return!0;return!1}if(V.type==="union"){for(let U of V.options)if(x$(U,J))return!0;return!1}if(V.type==="tuple"){for(let U of V.items)if(x$(U,J))return!0;if(V.rest&&x$(V.rest,J))return!0;return!1}return!1}var H3=($,w={})=>(J)=>{let V=P6({...J,processors:w});return e($,V),K6(V,$),u6(V,$)},TJ=($,w,J={})=>(V)=>{let{libraryOptions:U,target:G}=V??{},z=P6({...U??{},target:G,io:w,processors:J});return e($,z),K6(z,$),u6(z,$)};var hT={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},F3=($,w,J,V)=>{let U=J;U.type="string";let{minimum:G,maximum:z,format:i,patterns:N,contentEncoding:X}=$._zod.bag;if(typeof G==="number")U.minLength=G;if(typeof z==="number")U.maxLength=z;if(i){if(U.format=hT[i]??i,U.format==="")delete U.format;if(i==="time")delete U.format}if(X)U.contentEncoding=X;if(N&&N.size>0){let W=[...N];if(W.length===1)U.pattern=W[0].source;else if(W.length>1)U.allOf=[...W.map((I)=>({...w.target==="draft-07"||w.target==="draft-04"||w.target==="openapi-3.0"?{type:"string"}:{},pattern:I.source}))]}},q3=($,w,J,V)=>{let U=J,{minimum:G,maximum:z,format:i,multipleOf:N,exclusiveMaximum:X,exclusiveMinimum:W}=$._zod.bag;if(typeof i==="string"&&i.includes("int"))U.type="integer";else U.type="number";let I=typeof W==="number"&&W>=(G??Number.NEGATIVE_INFINITY),g=typeof X==="number"&&X<=(z??Number.POSITIVE_INFINITY),Y=w.target==="draft-04"||w.target==="openapi-3.0";if(I)if(Y)U.minimum=W,U.exclusiveMinimum=!0;else U.exclusiveMinimum=W;else if(typeof G==="number")U.minimum=G;if(g)if(Y)U.maximum=X,U.exclusiveMaximum=!0;else U.exclusiveMaximum=X;else if(typeof z==="number")U.maximum=z;if(typeof N==="number")U.multipleOf=N},Z3=($,w,J,V)=>{J.type="boolean"},T3=($,w,J,V)=>{if(w.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},D3=($,w,J,V)=>{if(w.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},L3=($,w,J,V)=>{if(w.target==="openapi-3.0")J.type="string",J.nullable=!0,J.enum=[null];else J.type="null"},f3=($,w,J,V)=>{if(w.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},M3=($,w,J,V)=>{if(w.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},A3=($,w,J,V)=>{J.not={}},S3=($,w,J,V)=>{},_3=($,w,J,V)=>{},k3=($,w,J,V)=>{if(w.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},R3=($,w,J,V)=>{let U=$._zod.def,G=k1(U.entries);if(G.every((z)=>typeof z==="number"))J.type="number";if(G.every((z)=>typeof z==="string"))J.type="string";J.enum=G},b3=($,w,J,V)=>{let U=$._zod.def,G=[];for(let z of U.values)if(z===void 0){if(w.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof z==="bigint")if(w.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else G.push(Number(z));else G.push(z);if(G.length===0);else if(G.length===1){let z=G[0];if(J.type=z===null?"null":typeof z,w.target==="draft-04"||w.target==="openapi-3.0")J.enum=[z];else J.const=z}else{if(G.every((z)=>typeof z==="number"))J.type="number";if(G.every((z)=>typeof z==="string"))J.type="string";if(G.every((z)=>typeof z==="boolean"))J.type="boolean";if(G.every((z)=>z===null))J.type="null";J.enum=G}},E3=($,w,J,V)=>{if(w.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},C3=($,w,J,V)=>{let U=J,G=$._zod.pattern;if(!G)throw Error("Pattern not found in template literal");U.type="string",U.pattern=G.source},j3=($,w,J,V)=>{let U=J,G={type:"string",format:"binary",contentEncoding:"binary"},{minimum:z,maximum:i,mime:N}=$._zod.bag;if(z!==void 0)G.minLength=z;if(i!==void 0)G.maxLength=i;if(N)if(N.length===1)G.contentMediaType=N[0],Object.assign(U,G);else Object.assign(U,G),U.anyOf=N.map((X)=>({contentMediaType:X}));else Object.assign(U,G)},x3=($,w,J,V)=>{J.type="boolean"},r3=($,w,J,V)=>{if(w.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},n3=($,w,J,V)=>{if(w.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},d3=($,w,J,V)=>{if(w.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},m3=($,w,J,V)=>{if(w.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},y3=($,w,J,V)=>{if(w.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},h3=($,w,J,V)=>{let U=J,G=$._zod.def,{minimum:z,maximum:i}=$._zod.bag;if(typeof z==="number")U.minItems=z;if(typeof i==="number")U.maxItems=i;U.type="array",U.items=e(G.element,w,{...V,path:[...V.path,"items"]})},c3=($,w,J,V)=>{let U=J,G=$._zod.def;U.type="object",U.properties={};let z=G.shape;for(let X in z)U.properties[X]=e(z[X],w,{...V,path:[...V.path,"properties",X]});let i=new Set(Object.keys(z)),N=new Set([...i].filter((X)=>{let W=G.shape[X]._zod;if(w.io==="input")return W.optin===void 0;else return W.optout===void 0}));if(N.size>0)U.required=Array.from(N);if(G.catchall?._zod.def.type==="never")U.additionalProperties=!1;else if(!G.catchall){if(w.io==="output")U.additionalProperties=!1}else if(G.catchall)U.additionalProperties=e(G.catchall,w,{...V,path:[...V.path,"additionalProperties"]})},ZG=($,w,J,V)=>{let U=$._zod.def,G=U.inclusive===!1,z=U.options.map((i,N)=>e(i,w,{...V,path:[...V.path,G?"oneOf":"anyOf",N]}));if(G)J.oneOf=z;else J.anyOf=z},l3=($,w,J,V)=>{let U=$._zod.def,G=e(U.left,w,{...V,path:[...V.path,"allOf",0]}),z=e(U.right,w,{...V,path:[...V.path,"allOf",1]}),i=(X)=>("allOf"in X)&&Object.keys(X).length===1,N=[...i(G)?G.allOf:[G],...i(z)?z.allOf:[z]];J.allOf=N},t3=($,w,J,V)=>{let U=J,G=$._zod.def;U.type="array";let z=w.target==="draft-2020-12"?"prefixItems":"items",i=w.target==="draft-2020-12"?"items":w.target==="openapi-3.0"?"items":"additionalItems",N=G.items.map((g,Y)=>e(g,w,{...V,path:[...V.path,z,Y]})),X=G.rest?e(G.rest,w,{...V,path:[...V.path,i,...w.target==="openapi-3.0"?[G.items.length]:[]]}):null;if(w.target==="draft-2020-12"){if(U.prefixItems=N,X)U.items=X}else if(w.target==="openapi-3.0"){if(U.items={anyOf:N},X)U.items.anyOf.push(X);if(U.minItems=N.length,!X)U.maxItems=N.length}else if(U.items=N,X)U.additionalItems=X;let{minimum:W,maximum:I}=$._zod.bag;if(typeof W==="number")U.minItems=W;if(typeof I==="number")U.maxItems=I},o3=($,w,J,V)=>{let U=J,G=$._zod.def;U.type="object";let z=G.keyType,N=z._zod.bag?.patterns;if(G.mode==="loose"&&N&&N.size>0){let W=e(G.valueType,w,{...V,path:[...V.path,"patternProperties","*"]});U.patternProperties={};for(let I of N)U.patternProperties[I.source]=W}else{if(w.target==="draft-07"||w.target==="draft-2020-12")U.propertyNames=e(G.keyType,w,{...V,path:[...V.path,"propertyNames"]});U.additionalProperties=e(G.valueType,w,{...V,path:[...V.path,"additionalProperties"]})}let X=z._zod.values;if(X){let W=[...X].filter((I)=>typeof I==="string"||typeof I==="number");if(W.length>0)U.required=W}},p3=($,w,J,V)=>{let U=$._zod.def,G=e(U.innerType,w,V),z=w.seen.get($);if(w.target==="openapi-3.0")z.ref=U.innerType,J.nullable=!0;else J.anyOf=[G,{type:"null"}]},a3=($,w,J,V)=>{let U=$._zod.def;e(U.innerType,w,V);let G=w.seen.get($);G.ref=U.innerType},e3=($,w,J,V)=>{let U=$._zod.def;e(U.innerType,w,V);let G=w.seen.get($);G.ref=U.innerType,J.default=JSON.parse(JSON.stringify(U.defaultValue))},s3=($,w,J,V)=>{let U=$._zod.def;e(U.innerType,w,V);let G=w.seen.get($);if(G.ref=U.innerType,w.io==="input")J._prefault=JSON.parse(JSON.stringify(U.defaultValue))},$I=($,w,J,V)=>{let U=$._zod.def;e(U.innerType,w,V);let G=w.seen.get($);G.ref=U.innerType;let z;try{z=U.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}J.default=z},wI=($,w,J,V)=>{let U=$._zod.def,G=U.in._zod.traits.has("$ZodTransform"),z=w.io==="input"?G?U.out:U.in:U.out;e(z,w,V);let i=w.seen.get($);i.ref=z},JI=($,w,J,V)=>{let U=$._zod.def;e(U.innerType,w,V);let G=w.seen.get($);G.ref=U.innerType,J.readOnly=!0},UI=($,w,J,V)=>{let U=$._zod.def;e(U.innerType,w,V);let G=w.seen.get($);G.ref=U.innerType},TG=($,w,J,V)=>{let U=$._zod.def;e(U.innerType,w,V);let G=w.seen.get($);G.ref=U.innerType},VI=($,w,J,V)=>{let U=$._zod.innerType;e(U,w,V);let G=w.seen.get($);G.ref=U},qG={string:F3,number:q3,boolean:Z3,bigint:T3,symbol:D3,null:L3,undefined:f3,void:M3,never:A3,any:S3,unknown:_3,date:k3,enum:R3,literal:b3,nan:E3,template_literal:C3,file:j3,success:x3,custom:r3,function:n3,transform:d3,map:m3,set:y3,array:h3,object:c3,union:ZG,intersection:l3,tuple:t3,record:o3,nullable:p3,nonoptional:a3,default:e3,prefault:s3,catch:$I,pipe:wI,readonly:JI,promise:UI,optional:TG,lazy:VI};function DG($,w){if("_idmap"in $){let V=$,U=P6({...w,processors:qG}),G={};for(let N of V._idmap.entries()){let[X,W]=N;e(W,U)}let z={},i={registry:V,uri:w?.uri,defs:G};U.external=i;for(let N of V._idmap.entries()){let[X,W]=N;K6(U,W),z[X]=u6(U,W)}if(Object.keys(G).length>0){let N=U.target==="draft-2020-12"?"$defs":"definitions";z.__shared={[N]:G}}return{schemas:z}}let J=P6({...w,processors:qG});return e($,J),K6(J,$),u6(J,$)}class GI{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter($){this.ctx.counter=$}get seen(){return this.ctx.seen}constructor($){let w=$?.target??"draft-2020-12";if(w==="draft-4")w="draft-04";if(w==="draft-7")w="draft-07";this.ctx=P6({processors:qG,target:w,...$?.metadata&&{metadata:$.metadata},...$?.unrepresentable&&{unrepresentable:$.unrepresentable},...$?.override&&{override:$.override},...$?.io&&{io:$.io}})}process($,w={path:[],schemaPath:[]}){return e($,this.ctx,w)}emit($,w){if(w){if(w.cycles)this.ctx.cycles=w.cycles;if(w.reused)this.ctx.reused=w.reused;if(w.external)this.ctx.external=w.external}K6(this.ctx,$);let J=u6(this.ctx,$),{"~standard":V,...U}=J;return U}}var U5={};var $0={};R4($0,{xor:()=>p5,xid:()=>u5,void:()=>y5,uuidv7:()=>I5,uuidv6:()=>W5,uuidv4:()=>N5,uuid:()=>X5,url:()=>g5,unknown:()=>Iw,union:()=>sG,undefined:()=>d5,ulid:()=>K5,uint64:()=>r5,uint32:()=>C5,tuple:()=>xI,transform:()=>wz,templateLiteral:()=>WQ,symbol:()=>n5,superRefine:()=>Y9,success:()=>zQ,stringbool:()=>KQ,stringFormat:()=>A5,string:()=>w0,strictObject:()=>t5,set:()=>wQ,refine:()=>g9,record:()=>rI,readonly:()=>z9,promise:()=>IQ,preprocess:()=>BQ,prefault:()=>eI,pipe:()=>kG,partialRecord:()=>e5,optional:()=>U0,object:()=>l5,number:()=>qI,nullish:()=>GQ,nullable:()=>V0,null:()=>fI,nonoptional:()=>sI,never:()=>eG,nativeEnum:()=>JQ,nanoid:()=>Q5,nan:()=>iQ,meta:()=>OQ,map:()=>$Q,mac:()=>F5,looseRecord:()=>s5,looseObject:()=>o5,literal:()=>UQ,lazy:()=>N9,ksuid:()=>B5,keyof:()=>c5,jwt:()=>M5,json:()=>uQ,ipv6:()=>q5,ipv4:()=>H5,invertCodec:()=>NQ,intersection:()=>CI,int64:()=>x5,int32:()=>E5,int:()=>_G,instanceof:()=>PQ,httpUrl:()=>Y5,hostname:()=>S5,hex:()=>_5,hash:()=>k5,guid:()=>i5,function:()=>gQ,float64:()=>b5,float32:()=>R5,file:()=>VQ,exactOptional:()=>lI,enum:()=>$z,emoji:()=>v5,email:()=>z5,e164:()=>f5,discriminatedUnion:()=>a5,describe:()=>QQ,date:()=>h5,custom:()=>vQ,cuid2:()=>P5,cuid:()=>O5,codec:()=>XQ,cidrv6:()=>T5,cidrv4:()=>Z5,check:()=>YQ,catch:()=>J9,boolean:()=>ZI,bigint:()=>j5,base64url:()=>L5,base64:()=>D5,array:()=>X0,any:()=>m5,_function:()=>gQ,_default:()=>pI,_ZodString:()=>RG,ZodXor:()=>RI,ZodXID:()=>nG,ZodVoid:()=>_I,ZodUnknown:()=>AI,ZodUnion:()=>W0,ZodUndefined:()=>DI,ZodUUID:()=>f4,ZodURL:()=>z0,ZodULID:()=>rG,ZodType:()=>h,ZodTuple:()=>jI,ZodTransform:()=>hI,ZodTemplateLiteral:()=>i9,ZodSymbol:()=>TI,ZodSuccess:()=>$9,ZodStringFormat:()=>$$,ZodString:()=>MJ,ZodSet:()=>dI,ZodRecord:()=>LJ,ZodReadonly:()=>G9,ZodPromise:()=>W9,ZodPreprocess:()=>V9,ZodPrefault:()=>aI,ZodPipe:()=>I0,ZodOptional:()=>Jz,ZodObject:()=>N0,ZodNumberFormat:()=>gw,ZodNumber:()=>SJ,ZodNullable:()=>tI,ZodNull:()=>LI,ZodNonOptional:()=>Uz,ZodNever:()=>SI,ZodNanoID:()=>CG,ZodNaN:()=>U9,ZodMap:()=>nI,ZodMAC:()=>FI,ZodLiteral:()=>mI,ZodLazy:()=>X9,ZodKSUID:()=>dG,ZodJWT:()=>pG,ZodIntersection:()=>EI,ZodIPv6:()=>yG,ZodIPv4:()=>mG,ZodGUID:()=>J0,ZodFunction:()=>I9,ZodFile:()=>yI,ZodExactOptional:()=>cI,ZodEnum:()=>fJ,ZodEmoji:()=>EG,ZodEmail:()=>bG,ZodE164:()=>oG,ZodDiscriminatedUnion:()=>bI,ZodDefault:()=>oI,ZodDate:()=>i0,ZodCustomStringFormat:()=>AJ,ZodCustom:()=>Y0,ZodCodec:()=>g0,ZodCatch:()=>w9,ZodCUID2:()=>xG,ZodCUID:()=>jG,ZodCIDRv6:()=>cG,ZodCIDRv4:()=>hG,ZodBoolean:()=>_J,ZodBigIntFormat:()=>aG,ZodBigInt:()=>kJ,ZodBase64URL:()=>tG,ZodBase64:()=>lG,ZodArray:()=>kI,ZodAny:()=>MI});var LG={};R4(LG,{uppercase:()=>vJ,trim:()=>BJ,toUpperCase:()=>FJ,toLowerCase:()=>HJ,startsWith:()=>OJ,slugify:()=>qJ,size:()=>Xw,regex:()=>gJ,property:()=>FG,positive:()=>KG,overwrite:()=>Y4,normalize:()=>uJ,nonpositive:()=>BG,nonnegative:()=>HG,negative:()=>uG,multipleOf:()=>Q6,minSize:()=>L4,minLength:()=>y4,mime:()=>KJ,maxSize:()=>O6,maxLength:()=>Nw,lte:()=>a$,lt:()=>T4,lowercase:()=>YJ,length:()=>Ww,includes:()=>QJ,gte:()=>j$,gt:()=>D4,endsWith:()=>PJ});var DJ={};R4(DJ,{time:()=>XI,duration:()=>NI,datetime:()=>zI,date:()=>iI,ZodISOTime:()=>AG,ZodISODuration:()=>SG,ZodISODateTime:()=>fG,ZodISODate:()=>MG});var fG=u("ZodISODateTime",($,w)=>{rN.init($,w),$$.init($,w)});function zI($){return rW(fG,$)}var MG=u("ZodISODate",($,w)=>{nN.init($,w),$$.init($,w)});function iI($){return nW(MG,$)}var AG=u("ZodISOTime",($,w)=>{dN.init($,w),$$.init($,w)});function XI($){return dW(AG,$)}var SG=u("ZodISODuration",($,w)=>{mN.init($,w),$$.init($,w)});function NI($){return mW(SG,$)}var V5=($,w)=>{j1.init($,w),$.name="ZodError",Object.defineProperties($,{format:{value:(J)=>r1($,J)},flatten:{value:(J)=>x1($,J)},addIssue:{value:(J)=>{$.issues.push(J),$.message=JSON.stringify($.issues,UJ,2)}},addIssues:{value:(J)=>{$.issues.push(...J),$.message=JSON.stringify($.issues,UJ,2)}},isEmpty:{get(){return $.issues.length===0}}})},lT=u("ZodError",V5),m$=u("ZodError",V5,{Parent:Error});var WI=zJ(m$),II=iJ(m$),gI=XJ(m$),YI=NJ(m$),vI=AV(m$),QI=SV(m$),OI=_V(m$),PI=kV(m$),KI=RV(m$),uI=bV(m$),BI=EV(m$),HI=CV(m$);var G5=new WeakMap;function G0($,w,J){let V=Object.getPrototypeOf($),U=G5.get(V);if(!U)U=new Set,G5.set(V,U);if(U.has(w))return;U.add(w);for(let G in J){let z=J[G];Object.defineProperty(V,G,{configurable:!0,enumerable:!1,get(){let i=z.bind(this);return Object.defineProperty(this,G,{configurable:!0,writable:!0,enumerable:!0,value:i}),i},set(i){Object.defineProperty(this,G,{configurable:!0,writable:!0,enumerable:!0,value:i})}})}}var h=u("ZodType",($,w)=>{return m.init($,w),Object.assign($["~standard"],{jsonSchema:{input:TJ($,"input"),output:TJ($,"output")}}),$.toJSONSchema=H3($,{}),$.def=w,$.type=w.type,Object.defineProperty($,"_def",{value:w}),$.parse=(J,V)=>WI($,J,V,{callee:$.parse}),$.safeParse=(J,V)=>gI($,J,V),$.parseAsync=async(J,V)=>II($,J,V,{callee:$.parseAsync}),$.safeParseAsync=async(J,V)=>YI($,J,V),$.spa=$.safeParseAsync,$.encode=(J,V)=>vI($,J,V),$.decode=(J,V)=>QI($,J,V),$.encodeAsync=async(J,V)=>OI($,J,V),$.decodeAsync=async(J,V)=>PI($,J,V),$.safeEncode=(J,V)=>KI($,J,V),$.safeDecode=(J,V)=>uI($,J,V),$.safeEncodeAsync=async(J,V)=>BI($,J,V),$.safeDecodeAsync=async(J,V)=>HI($,J,V),G0($,"ZodType",{check(...J){let V=this.def;return this.clone(A.mergeDefs(V,{checks:[...V.checks??[],...J.map((U)=>typeof U==="function"?{_zod:{check:U,def:{check:"custom"},onattach:[]}}:U)]}),{parent:!0})},with(...J){return this.check(...J)},clone(J,V){return E$(this,J,V)},brand(){return this},register(J,V){return J.add(this,V),this},refine(J,V){return this.check(g9(J,V))},superRefine(J,V){return this.check(Y9(J,V))},overwrite(J){return this.check(Y4(J))},optional(){return U0(this)},exactOptional(){return lI(this)},nullable(){return V0(this)},nullish(){return U0(V0(this))},nonoptional(J){return sI(this,J)},array(){return X0(this)},or(J){return sG([this,J])},and(J){return CI(this,J)},transform(J){return kG(this,wz(J))},default(J){return pI(this,J)},prefault(J){return eI(this,J)},catch(J){return J9(this,J)},pipe(J){return kG(this,J)},readonly(){return z9(this)},describe(J){let V=this.clone();return q$.add(V,{description:J}),V},meta(...J){if(J.length===0)return q$.get(this);let V=this.clone();return q$.add(V,J[0]),V},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(J){return J(this)}}),Object.defineProperty($,"description",{get(){return q$.get($)?.description},configurable:!0}),$}),RG=u("_ZodString",($,w)=>{iw.init($,w),h.init($,w),$._zod.processJSONSchema=(V,U,G)=>F3($,V,U,G);let J=$._zod.bag;$.format=J.format??null,$.minLength=J.minimum??null,$.maxLength=J.maximum??null,G0($,"_ZodString",{regex(...V){return this.check(gJ(...V))},includes(...V){return this.check(QJ(...V))},startsWith(...V){return this.check(OJ(...V))},endsWith(...V){return this.check(PJ(...V))},min(...V){return this.check(y4(...V))},max(...V){return this.check(Nw(...V))},length(...V){return this.check(Ww(...V))},nonempty(...V){return this.check(y4(1,...V))},lowercase(V){return this.check(YJ(V))},uppercase(V){return this.check(vJ(V))},trim(){return this.check(BJ())},normalize(...V){return this.check(uJ(...V))},toLowerCase(){return this.check(HJ())},toUpperCase(){return this.check(FJ())},slugify(){return this.check(qJ())}})}),MJ=u("ZodString",($,w)=>{iw.init($,w),RG.init($,w),$.email=(J)=>$.check(eV(bG,J)),$.url=(J)=>$.check(s1(z0,J)),$.jwt=(J)=>$.check(PG(pG,J)),$.emoji=(J)=>$.check(UG(EG,J)),$.guid=(J)=>$.check(e1(J0,J)),$.uuid=(J)=>$.check(sV(f4,J)),$.uuidv4=(J)=>$.check($G(f4,J)),$.uuidv6=(J)=>$.check(wG(f4,J)),$.uuidv7=(J)=>$.check(JG(f4,J)),$.nanoid=(J)=>$.check(VG(CG,J)),$.guid=(J)=>$.check(e1(J0,J)),$.cuid=(J)=>$.check(GG(jG,J)),$.cuid2=(J)=>$.check(zG(xG,J)),$.ulid=(J)=>$.check(iG(rG,J)),$.base64=(J)=>$.check(vG(lG,J)),$.base64url=(J)=>$.check(QG(tG,J)),$.xid=(J)=>$.check(XG(nG,J)),$.ksuid=(J)=>$.check(NG(dG,J)),$.ipv4=(J)=>$.check(WG(mG,J)),$.ipv6=(J)=>$.check(IG(yG,J)),$.cidrv4=(J)=>$.check(gG(hG,J)),$.cidrv6=(J)=>$.check(YG(cG,J)),$.e164=(J)=>$.check(OG(oG,J)),$.datetime=(J)=>$.check(zI(J)),$.date=(J)=>$.check(iI(J)),$.time=(J)=>$.check(XI(J)),$.duration=(J)=>$.check(NI(J))});function w0($){return EW(MJ,$)}var $$=u("ZodStringFormat",($,w)=>{s.init($,w),RG.init($,w)}),bG=u("ZodEmail",($,w)=>{SN.init($,w),$$.init($,w)});function z5($){return eV(bG,$)}var J0=u("ZodGUID",($,w)=>{MN.init($,w),$$.init($,w)});function i5($){return e1(J0,$)}var f4=u("ZodUUID",($,w)=>{AN.init($,w),$$.init($,w)});function X5($){return sV(f4,$)}function N5($){return $G(f4,$)}function W5($){return wG(f4,$)}function I5($){return JG(f4,$)}var z0=u("ZodURL",($,w)=>{_N.init($,w),$$.init($,w)});function g5($){return s1(z0,$)}function Y5($){return s1(z0,{protocol:p$.httpProtocol,hostname:p$.domain,...A.normalizeParams($)})}var EG=u("ZodEmoji",($,w)=>{kN.init($,w),$$.init($,w)});function v5($){return UG(EG,$)}var CG=u("ZodNanoID",($,w)=>{RN.init($,w),$$.init($,w)});function Q5($){return VG(CG,$)}var jG=u("ZodCUID",($,w)=>{bN.init($,w),$$.init($,w)});function O5($){return GG(jG,$)}var xG=u("ZodCUID2",($,w)=>{EN.init($,w),$$.init($,w)});function P5($){return zG(xG,$)}var rG=u("ZodULID",($,w)=>{CN.init($,w),$$.init($,w)});function K5($){return iG(rG,$)}var nG=u("ZodXID",($,w)=>{jN.init($,w),$$.init($,w)});function u5($){return XG(nG,$)}var dG=u("ZodKSUID",($,w)=>{xN.init($,w),$$.init($,w)});function B5($){return NG(dG,$)}var mG=u("ZodIPv4",($,w)=>{yN.init($,w),$$.init($,w)});function H5($){return WG(mG,$)}var FI=u("ZodMAC",($,w)=>{cN.init($,w),$$.init($,w)});function F5($){return jW(FI,$)}var yG=u("ZodIPv6",($,w)=>{hN.init($,w),$$.init($,w)});function q5($){return IG(yG,$)}var hG=u("ZodCIDRv4",($,w)=>{lN.init($,w),$$.init($,w)});function Z5($){return gG(hG,$)}var cG=u("ZodCIDRv6",($,w)=>{tN.init($,w),$$.init($,w)});function T5($){return YG(cG,$)}var lG=u("ZodBase64",($,w)=>{pN.init($,w),$$.init($,w)});function D5($){return vG(lG,$)}var tG=u("ZodBase64URL",($,w)=>{aN.init($,w),$$.init($,w)});function L5($){return QG(tG,$)}var oG=u("ZodE164",($,w)=>{eN.init($,w),$$.init($,w)});function f5($){return OG(oG,$)}var pG=u("ZodJWT",($,w)=>{sN.init($,w),$$.init($,w)});function M5($){return PG(pG,$)}var AJ=u("ZodCustomStringFormat",($,w)=>{$8.init($,w),$$.init($,w)});function A5($,w,J={}){return ZJ(AJ,$,w,J)}function S5($){return ZJ(AJ,"hostname",p$.hostname,$)}function _5($){return ZJ(AJ,"hex",p$.hex,$)}function k5($,w){let J=w?.enc??"hex",V=`${$}_${J}`,U=p$[V];if(!U)throw Error(`Unrecognized hash format: ${V}`);return ZJ(AJ,V,U,w)}var SJ=u("ZodNumber",($,w)=>{cV.init($,w),h.init($,w),$._zod.processJSONSchema=(V,U,G)=>q3($,V,U,G),G0($,"ZodNumber",{gt(V,U){return this.check(D4(V,U))},gte(V,U){return this.check(j$(V,U))},min(V,U){return this.check(j$(V,U))},lt(V,U){return this.check(T4(V,U))},lte(V,U){return this.check(a$(V,U))},max(V,U){return this.check(a$(V,U))},int(V){return this.check(_G(V))},safe(V){return this.check(_G(V))},positive(V){return this.check(D4(0,V))},nonnegative(V){return this.check(j$(0,V))},negative(V){return this.check(T4(0,V))},nonpositive(V){return this.check(a$(0,V))},multipleOf(V,U){return this.check(Q6(V,U))},step(V,U){return this.check(Q6(V,U))},finite(){return this}});let J=$._zod.bag;$.minValue=Math.max(J.minimum??Number.NEGATIVE_INFINITY,J.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(J.maximum??Number.POSITIVE_INFINITY,J.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(J.format??"").includes("int")||Number.isSafeInteger(J.multipleOf??0.5),$.isFinite=!0,$.format=J.format??null});function qI($){return yW(SJ,$)}var gw=u("ZodNumberFormat",($,w)=>{w8.init($,w),SJ.init($,w)});function _G($){return cW(gw,$)}function R5($){return lW(gw,$)}function b5($){return tW(gw,$)}function E5($){return oW(gw,$)}function C5($){return pW(gw,$)}var _J=u("ZodBoolean",($,w)=>{y1.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>Z3($,J,V,U)});function ZI($){return aW(_J,$)}var kJ=u("ZodBigInt",($,w)=>{lV.init($,w),h.init($,w),$._zod.processJSONSchema=(V,U,G)=>T3($,V,U,G),$.gte=(V,U)=>$.check(j$(V,U)),$.min=(V,U)=>$.check(j$(V,U)),$.gt=(V,U)=>$.check(D4(V,U)),$.gte=(V,U)=>$.check(j$(V,U)),$.min=(V,U)=>$.check(j$(V,U)),$.lt=(V,U)=>$.check(T4(V,U)),$.lte=(V,U)=>$.check(a$(V,U)),$.max=(V,U)=>$.check(a$(V,U)),$.positive=(V)=>$.check(D4(BigInt(0),V)),$.negative=(V)=>$.check(T4(BigInt(0),V)),$.nonpositive=(V)=>$.check(a$(BigInt(0),V)),$.nonnegative=(V)=>$.check(j$(BigInt(0),V)),$.multipleOf=(V,U)=>$.check(Q6(V,U));let J=$._zod.bag;$.minValue=J.minimum??null,$.maxValue=J.maximum??null,$.format=J.format??null});function j5($){return sW(kJ,$)}var aG=u("ZodBigIntFormat",($,w)=>{J8.init($,w),kJ.init($,w)});function x5($){return w3(aG,$)}function r5($){return J3(aG,$)}var TI=u("ZodSymbol",($,w)=>{U8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>D3($,J,V,U)});function n5($){return U3(TI,$)}var DI=u("ZodUndefined",($,w)=>{V8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>f3($,J,V,U)});function d5($){return V3(DI,$)}var LI=u("ZodNull",($,w)=>{G8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>L3($,J,V,U)});function fI($){return G3(LI,$)}var MI=u("ZodAny",($,w)=>{z8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>S3($,J,V,U)});function m5(){return z3(MI)}var AI=u("ZodUnknown",($,w)=>{i8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>_3($,J,V,U)});function Iw(){return i3(AI)}var SI=u("ZodNever",($,w)=>{X8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>A3($,J,V,U)});function eG($){return X3(SI,$)}var _I=u("ZodVoid",($,w)=>{N8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>M3($,J,V,U)});function y5($){return N3(_I,$)}var i0=u("ZodDate",($,w)=>{W8.init($,w),h.init($,w),$._zod.processJSONSchema=(V,U,G)=>k3($,V,U,G),$.min=(V,U)=>$.check(j$(V,U)),$.max=(V,U)=>$.check(a$(V,U));let J=$._zod.bag;$.minDate=J.minimum?new Date(J.minimum):null,$.maxDate=J.maximum?new Date(J.maximum):null});function h5($){return W3(i0,$)}var kI=u("ZodArray",($,w)=>{I8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>h3($,J,V,U),$.element=w.element,G0($,"ZodArray",{min(J,V){return this.check(y4(J,V))},nonempty(J){return this.check(y4(1,J))},max(J,V){return this.check(Nw(J,V))},length(J,V){return this.check(Ww(J,V))},unwrap(){return this.element}})});function X0($,w){return Y3(kI,$,w)}function c5($){let w=$._zod.def.shape;return $z(Object.keys(w))}var N0=u("ZodObject",($,w)=>{g8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>c3($,J,V,U),A.defineLazy($,"shape",()=>{return w.shape}),G0($,"ZodObject",{keyof(){return $z(Object.keys(this._zod.def.shape))},catchall(J){return this.clone({...this._zod.def,catchall:J})},passthrough(){return this.clone({...this._zod.def,catchall:Iw()})},loose(){return this.clone({...this._zod.def,catchall:Iw()})},strict(){return this.clone({...this._zod.def,catchall:eG()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(J){return A.extend(this,J)},safeExtend(J){return A.safeExtend(this,J)},merge(J){return A.merge(this,J)},pick(J){return A.pick(this,J)},omit(J){return A.omit(this,J)},partial(...J){return A.partial(Jz,this,J[0])},required(...J){return A.required(Uz,this,J[0])}})});function l5($,w){let J={type:"object",shape:$??{},...A.normalizeParams(w)};return new N0(J)}function t5($,w){return new N0({type:"object",shape:$,catchall:eG(),...A.normalizeParams(w)})}function o5($,w){return new N0({type:"object",shape:$,catchall:Iw(),...A.normalizeParams(w)})}var W0=u("ZodUnion",($,w)=>{h1.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>ZG($,J,V,U),$.options=w.options});function sG($,w){return new W0({type:"union",options:$,...A.normalizeParams(w)})}var RI=u("ZodXor",($,w)=>{W0.init($,w),Y8.init($,w),$._zod.processJSONSchema=(J,V,U)=>ZG($,J,V,U),$.options=w.options});function p5($,w){return new RI({type:"union",options:$,inclusive:!1,...A.normalizeParams(w)})}var bI=u("ZodDiscriminatedUnion",($,w)=>{W0.init($,w),v8.init($,w)});function a5($,w,J){return new bI({type:"union",options:w,discriminator:$,...A.normalizeParams(J)})}var EI=u("ZodIntersection",($,w)=>{Q8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>l3($,J,V,U)});function CI($,w){return new EI({type:"intersection",left:$,right:w})}var jI=u("ZodTuple",($,w)=>{tV.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>t3($,J,V,U),$.rest=(J)=>$.clone({...$._zod.def,rest:J})});function xI($,w,J){let V=w instanceof m,U=V?J:w;return new jI({type:"tuple",items:$,rest:V?w:null,...A.normalizeParams(U)})}var LJ=u("ZodRecord",($,w)=>{O8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>o3($,J,V,U),$.keyType=w.keyType,$.valueType=w.valueType});function rI($,w,J){if(!w||!w._zod)return new LJ({type:"record",keyType:w0(),valueType:$,...A.normalizeParams(w)});return new LJ({type:"record",keyType:$,valueType:w,...A.normalizeParams(J)})}function e5($,w,J){let V=E$($);return V._zod.values=void 0,new LJ({type:"record",keyType:V,valueType:w,...A.normalizeParams(J)})}function s5($,w,J){return new LJ({type:"record",keyType:$,valueType:w,mode:"loose",...A.normalizeParams(J)})}var nI=u("ZodMap",($,w)=>{P8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>m3($,J,V,U),$.keyType=w.keyType,$.valueType=w.valueType,$.min=(...J)=>$.check(L4(...J)),$.nonempty=(J)=>$.check(L4(1,J)),$.max=(...J)=>$.check(O6(...J)),$.size=(...J)=>$.check(Xw(...J))});function $Q($,w,J){return new nI({type:"map",keyType:$,valueType:w,...A.normalizeParams(J)})}var dI=u("ZodSet",($,w)=>{K8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>y3($,J,V,U),$.min=(...J)=>$.check(L4(...J)),$.nonempty=(J)=>$.check(L4(1,J)),$.max=(...J)=>$.check(O6(...J)),$.size=(...J)=>$.check(Xw(...J))});function wQ($,w){return new dI({type:"set",valueType:$,...A.normalizeParams(w)})}var fJ=u("ZodEnum",($,w)=>{u8.init($,w),h.init($,w),$._zod.processJSONSchema=(V,U,G)=>R3($,V,U,G),$.enum=w.entries,$.options=Object.values(w.entries);let J=new Set(Object.keys(w.entries));$.extract=(V,U)=>{let G={};for(let z of V)if(J.has(z))G[z]=w.entries[z];else throw Error(`Key ${z} not found in enum`);return new fJ({...w,checks:[],...A.normalizeParams(U),entries:G})},$.exclude=(V,U)=>{let G={...w.entries};for(let z of V)if(J.has(z))delete G[z];else throw Error(`Key ${z} not found in enum`);return new fJ({...w,checks:[],...A.normalizeParams(U),entries:G})}});function $z($,w){let J=Array.isArray($)?Object.fromEntries($.map((V)=>[V,V])):$;return new fJ({type:"enum",entries:J,...A.normalizeParams(w)})}function JQ($,w){return new fJ({type:"enum",entries:$,...A.normalizeParams(w)})}var mI=u("ZodLiteral",($,w)=>{B8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>b3($,J,V,U),$.values=new Set(w.values),Object.defineProperty($,"value",{get(){if(w.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return w.values[0]}})});function UQ($,w){return new mI({type:"literal",values:Array.isArray($)?$:[$],...A.normalizeParams(w)})}var yI=u("ZodFile",($,w)=>{H8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>j3($,J,V,U),$.min=(J,V)=>$.check(L4(J,V)),$.max=(J,V)=>$.check(O6(J,V)),$.mime=(J,V)=>$.check(KJ(Array.isArray(J)?J:[J],V))});function VQ($){return v3(yI,$)}var hI=u("ZodTransform",($,w)=>{F8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>d3($,J,V,U),$._zod.parse=(J,V)=>{if(V.direction==="backward")throw new Vw($.constructor.name);J.addIssue=(G)=>{if(typeof G==="string")J.issues.push(A.issue(G,J.value,w));else{let z=G;if(z.fatal)z.continue=!1;z.code??(z.code="custom"),z.input??(z.input=J.value),z.inst??(z.inst=$),J.issues.push(A.issue(z))}};let U=w.transform(J.value,J);if(U instanceof Promise)return U.then((G)=>{return J.value=G,J.fallback=!0,J});return J.value=U,J.fallback=!0,J}});function wz($){return new hI({type:"transform",transform:$})}var Jz=u("ZodOptional",($,w)=>{oV.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>TG($,J,V,U),$.unwrap=()=>$._zod.def.innerType});function U0($){return new Jz({type:"optional",innerType:$})}var cI=u("ZodExactOptional",($,w)=>{q8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>TG($,J,V,U),$.unwrap=()=>$._zod.def.innerType});function lI($){return new cI({type:"optional",innerType:$})}var tI=u("ZodNullable",($,w)=>{Z8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>p3($,J,V,U),$.unwrap=()=>$._zod.def.innerType});function V0($){return new tI({type:"nullable",innerType:$})}function GQ($){return U0(V0($))}var oI=u("ZodDefault",($,w)=>{T8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>e3($,J,V,U),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function pI($,w){return new oI({type:"default",innerType:$,get defaultValue(){return typeof w==="function"?w():A.shallowClone(w)}})}var aI=u("ZodPrefault",($,w)=>{D8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>s3($,J,V,U),$.unwrap=()=>$._zod.def.innerType});function eI($,w){return new aI({type:"prefault",innerType:$,get defaultValue(){return typeof w==="function"?w():A.shallowClone(w)}})}var Uz=u("ZodNonOptional",($,w)=>{L8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>a3($,J,V,U),$.unwrap=()=>$._zod.def.innerType});function sI($,w){return new Uz({type:"nonoptional",innerType:$,...A.normalizeParams(w)})}var $9=u("ZodSuccess",($,w)=>{f8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>x3($,J,V,U),$.unwrap=()=>$._zod.def.innerType});function zQ($){return new $9({type:"success",innerType:$})}var w9=u("ZodCatch",($,w)=>{M8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>$I($,J,V,U),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function J9($,w){return new w9({type:"catch",innerType:$,catchValue:typeof w==="function"?w:()=>w})}var U9=u("ZodNaN",($,w)=>{A8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>E3($,J,V,U)});function iQ($){return g3(U9,$)}var I0=u("ZodPipe",($,w)=>{pV.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>wI($,J,V,U),$.in=w.in,$.out=w.out});function kG($,w){return new I0({type:"pipe",in:$,out:w})}var g0=u("ZodCodec",($,w)=>{I0.init($,w),c1.init($,w)});function XQ($,w,J){return new g0({type:"pipe",in:$,out:w,transform:J.decode,reverseTransform:J.encode})}function NQ($){let w=$._zod.def;return new g0({type:"pipe",in:w.out,out:w.in,transform:w.reverseTransform,reverseTransform:w.transform})}var V9=u("ZodPreprocess",($,w)=>{I0.init($,w),S8.init($,w)}),G9=u("ZodReadonly",($,w)=>{_8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>JI($,J,V,U),$.unwrap=()=>$._zod.def.innerType});function z9($){return new G9({type:"readonly",innerType:$})}var i9=u("ZodTemplateLiteral",($,w)=>{k8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>C3($,J,V,U)});function WQ($,w){return new i9({type:"template_literal",parts:$,...A.normalizeParams(w)})}var X9=u("ZodLazy",($,w)=>{E8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>VI($,J,V,U),$.unwrap=()=>$._zod.def.getter()});function N9($){return new X9({type:"lazy",getter:$})}var W9=u("ZodPromise",($,w)=>{b8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>UI($,J,V,U),$.unwrap=()=>$._zod.def.innerType});function IQ($){return new W9({type:"promise",innerType:$})}var I9=u("ZodFunction",($,w)=>{R8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>n3($,J,V,U)});function gQ($){return new I9({type:"function",input:Array.isArray($?.input)?xI($?.input):$?.input??X0(Iw()),output:$?.output??Iw()})}var Y0=u("ZodCustom",($,w)=>{C8.init($,w),h.init($,w),$._zod.processJSONSchema=(J,V,U)=>r3($,J,V,U)});function YQ($){let w=new J$({check:"custom"});return w._zod.check=$,w}function vQ($,w){return Q3(Y0,$??(()=>!0),w)}function g9($,w={}){return O3(Y0,$,w)}function Y9($,w){return P3($,w)}var QQ=K3,OQ=u3;function PQ($,w={}){let J=new Y0({type:"custom",check:"custom",fn:(V)=>V instanceof $,abort:!0,...A.normalizeParams(w)});return J._zod.bag.Class=$,J._zod.check=(V)=>{if(!(V.value instanceof $))V.issues.push({code:"invalid_type",expected:$.name,input:V.value,inst:J,path:[...J._zod.def.path??[]]})},J}var KQ=(...$)=>B3({Codec:g0,Boolean:_J,String:MJ},...$);function uQ($){let w=N9(()=>{return sG([w0($),qI(),ZI(),fI(),X0(w),rI(w0(),w)])});return w}function BQ($,w){return new V9({type:"pipe",in:wz($),out:w})}var oT={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function pT($){X$({customError:$})}function aT(){return X$().customError}var v9;(function($){})(v9||(v9={}));var E={...$0,...LG,iso:DJ},eT=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function sT($,w){let J=$.$schema;if(J==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(J==="http://json-schema.org/draft-07/schema#")return"draft-7";if(J==="http://json-schema.org/draft-04/schema#")return"draft-4";return w??"draft-2020-12"}function $D($,w){if(!$.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let J=$.slice(1).split("/").filter(Boolean);if(J.length===0)return w.rootSchema;let V=w.version==="draft-2020-12"?"$defs":"definitions";if(J[0]===V){let U=J[1];if(!U||!w.defs[U])throw Error(`Reference not found: ${$}`);return w.defs[U]}throw Error(`Reference not found: ${$}`)}function HQ($,w){if($.not!==void 0){if(typeof $.not==="object"&&Object.keys($.not).length===0)return E.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if($.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if($.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if($.if!==void 0||$.then!==void 0||$.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if($.dependentSchemas!==void 0||$.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if($.$ref){let U=$.$ref;if(w.refs.has(U))return w.refs.get(U);if(w.processing.has(U))return E.lazy(()=>{if(!w.refs.has(U))throw Error(`Circular reference not resolved: ${U}`);return w.refs.get(U)});w.processing.add(U);let G=$D(U,w),z=S$(G,w);return w.refs.set(U,z),w.processing.delete(U),z}if($.enum!==void 0){let U=$.enum;if(w.version==="openapi-3.0"&&$.nullable===!0&&U.length===1&&U[0]===null)return E.null();if(U.length===0)return E.never();if(U.length===1)return E.literal(U[0]);if(U.every((z)=>typeof z==="string"))return E.enum(U);let G=U.map((z)=>E.literal(z));if(G.length<2)return G[0];return E.union([G[0],G[1],...G.slice(2)])}if($.const!==void 0)return E.literal($.const);let J=$.type;if(Array.isArray(J)){let U=J.map((G)=>{let z={...$,type:G};return HQ(z,w)});if(U.length===0)return E.never();if(U.length===1)return U[0];return E.union(U)}if(!J)return E.any();let V;switch(J){case"string":{let U=E.string();if($.format){let G=$.format;if(G==="email")U=U.check(E.email());else if(G==="uri"||G==="uri-reference")U=U.check(E.url());else if(G==="uuid"||G==="guid")U=U.check(E.uuid());else if(G==="date-time")U=U.check(E.iso.datetime());else if(G==="date")U=U.check(E.iso.date());else if(G==="time")U=U.check(E.iso.time());else if(G==="duration")U=U.check(E.iso.duration());else if(G==="ipv4")U=U.check(E.ipv4());else if(G==="ipv6")U=U.check(E.ipv6());else if(G==="mac")U=U.check(E.mac());else if(G==="cidr")U=U.check(E.cidrv4());else if(G==="cidr-v6")U=U.check(E.cidrv6());else if(G==="base64")U=U.check(E.base64());else if(G==="base64url")U=U.check(E.base64url());else if(G==="e164")U=U.check(E.e164());else if(G==="jwt")U=U.check(E.jwt());else if(G==="emoji")U=U.check(E.emoji());else if(G==="nanoid")U=U.check(E.nanoid());else if(G==="cuid")U=U.check(E.cuid());else if(G==="cuid2")U=U.check(E.cuid2());else if(G==="ulid")U=U.check(E.ulid());else if(G==="xid")U=U.check(E.xid());else if(G==="ksuid")U=U.check(E.ksuid())}if(typeof $.minLength==="number")U=U.min($.minLength);if(typeof $.maxLength==="number")U=U.max($.maxLength);if($.pattern)U=U.regex(new RegExp($.pattern));V=U;break}case"number":case"integer":{let U=J==="integer"?E.number().int():E.number();if(typeof $.minimum==="number")U=U.min($.minimum);if(typeof $.maximum==="number")U=U.max($.maximum);if(typeof $.exclusiveMinimum==="number")U=U.gt($.exclusiveMinimum);else if($.exclusiveMinimum===!0&&typeof $.minimum==="number")U=U.gt($.minimum);if(typeof $.exclusiveMaximum==="number")U=U.lt($.exclusiveMaximum);else if($.exclusiveMaximum===!0&&typeof $.maximum==="number")U=U.lt($.maximum);if(typeof $.multipleOf==="number")U=U.multipleOf($.multipleOf);V=U;break}case"boolean":{V=E.boolean();break}case"null":{V=E.null();break}case"object":{let U={},G=$.properties||{},z=new Set($.required||[]);for(let[N,X]of Object.entries(G)){let W=S$(X,w);U[N]=z.has(N)?W:W.optional()}if($.propertyNames){let N=S$($.propertyNames,w),X=$.additionalProperties&&typeof $.additionalProperties==="object"?S$($.additionalProperties,w):E.any();if(Object.keys(U).length===0){V=E.record(N,X);break}let W=E.object(U).passthrough(),I=E.looseRecord(N,X);V=E.intersection(W,I);break}if($.patternProperties){let N=$.patternProperties,X=Object.keys(N),W=[];for(let g of X){let Y=S$(N[g],w),v=E.string().regex(new RegExp(g));W.push(E.looseRecord(v,Y))}let I=[];if(Object.keys(U).length>0)I.push(E.object(U).passthrough());if(I.push(...W),I.length===0)V=E.object({}).passthrough();else if(I.length===1)V=I[0];else{let g=E.intersection(I[0],I[1]);for(let Y=2;Y<I.length;Y++)g=E.intersection(g,I[Y]);V=g}break}let i=E.object(U);if($.additionalProperties===!1)V=i.strict();else if(typeof $.additionalProperties==="object")V=i.catchall(S$($.additionalProperties,w));else V=i.passthrough();break}case"array":{let{prefixItems:U,items:G}=$;if(U&&Array.isArray(U)){let z=U.map((N)=>S$(N,w)),i=G&&typeof G==="object"&&!Array.isArray(G)?S$(G,w):void 0;if(i)V=E.tuple(z).rest(i);else V=E.tuple(z);if(typeof $.minItems==="number")V=V.check(E.minLength($.minItems));if(typeof $.maxItems==="number")V=V.check(E.maxLength($.maxItems))}else if(Array.isArray(G)){let z=G.map((N)=>S$(N,w)),i=$.additionalItems&&typeof $.additionalItems==="object"?S$($.additionalItems,w):void 0;if(i)V=E.tuple(z).rest(i);else V=E.tuple(z);if(typeof $.minItems==="number")V=V.check(E.minLength($.minItems));if(typeof $.maxItems==="number")V=V.check(E.maxLength($.maxItems))}else if(G!==void 0){let z=S$(G,w),i=E.array(z);if(typeof $.minItems==="number")i=i.min($.minItems);if(typeof $.maxItems==="number")i=i.max($.maxItems);V=i}else V=E.array(E.any());break}default:throw Error(`Unsupported type: ${J}`)}return V}function S$($,w){if(typeof $==="boolean")return $?E.any():E.never();let J=HQ($,w),V=$.type||$.enum!==void 0||$.const!==void 0;if($.anyOf&&Array.isArray($.anyOf)){let i=$.anyOf.map((X)=>S$(X,w)),N=E.union(i);J=V?E.intersection(J,N):N}if($.oneOf&&Array.isArray($.oneOf)){let i=$.oneOf.map((X)=>S$(X,w)),N=E.xor(i);J=V?E.intersection(J,N):N}if($.allOf&&Array.isArray($.allOf))if($.allOf.length===0)J=V?J:E.any();else{let i=V?J:S$($.allOf[0],w),N=V?0:1;for(let X=N;X<$.allOf.length;X++)i=E.intersection(i,S$($.allOf[X],w));J=i}if($.nullable===!0&&w.version==="openapi-3.0")J=E.nullable(J);if($.readOnly===!0)J=E.readonly(J);if($.default!==void 0)J=J.default($.default);let U={},G=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let i of G)if(i in $)U[i]=$[i];let z=["contentEncoding","contentMediaType","contentSchema"];for(let i of z)if(i in $)U[i]=$[i];for(let i of Object.keys($))if(!eT.has(i))U[i]=$[i];if(Object.keys(U).length>0)w.registry.add(J,U);if($.description)J=J.describe($.description);return J}function FQ($,w){if(typeof $==="boolean")return $?E.any():E.never();let J;try{J=JSON.parse(JSON.stringify($))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let V=sT(J,w?.defaultTarget),U=J.$defs||J.definitions||{},G={version:V,defs:U,refs:new Map,processing:new Set,rootSchema:J,registry:w?.registry??q$};return S$(J,G)}var Q9={};R4(Q9,{string:()=>wD,number:()=>JD,date:()=>GD,boolean:()=>UD,bigint:()=>VD});function wD($){return CW(MJ,$)}function JD($){return hW(SJ,$)}function UD($){return eW(_J,$)}function VD($){return $3(kJ,$)}function GD($){return I3(i0,$)}X$(l1());import{join as zD}from"node:path";function RJ($){if($)return $;if(process.env.PLOOF_HOME)return process.env.PLOOF_HOME;return zD(process.env.HOME??process.cwd(),".ploof")}var CO=SY(bO(),1);import{extname as hM}from"node:path";class o9{createClient;id="fal";displayName="fal.ai";auth={apiKeyEnvVars:["PLOOF_FAL_KEY","FAL_KEY"],apiKeyEnvPairs:[{idEnvVar:"PLOOF_FAL_KEY_ID",secretEnvVar:"PLOOF_FAL_KEY_SECRET"},{idEnvVar:"FAL_KEY_ID",secretEnvVar:"FAL_KEY_SECRET"}]};capabilities=["model.run","image.generate","image.edit","image.variation","video.generate","video.edit","video.extend","audio.generate","audio.transcribe","audio.translate"];constructor($=cM){this.createClient=$}async run($,w){if(!this.capabilities.includes($.kind))throw Error(`fal.ai does not support ${$.kind}.`);return this.runEndpoint($,w)}async runEndpoint($,w){let J=pM($),V=this.createClient(w),U=VA($.params),G=await aM($,V,U),z=JA($.params,G,U,w),i=await lM(J,$.kind,()=>V.subscribe(J,z)),N=await GA({data:i.data,job:$,endpoint:J}),X={id:$.id??i.requestId,kind:$.kind,provider:this.id,profile:w.credential.profile,outputs:N,metadata:{model:J,requestId:i.requestId,result:t9(i.data)}};if($.sidecar??w.sidecar??!0)await $4(X,{...$,params:{...$.params,model:J}},$.kind);return X}}function cM($){if(!$.credential.apiKey)throw Error("fal.ai API key is required.");return CO.createFalClient({credentials:$.credential.apiKey})}async function lM($,w,J){try{return await J()}catch(V){throw tM($,w,V)}}function tM($,w,J){let V=oM(J),U=J instanceof Error?J.message:String(J),z=Error(`fal.ai ${w} failed for ${$}: ${U}.${V===401||V===403?" Check the fal.ai API key, account credits, and endpoint access.":""}`);return z.cause=J,z}function oM($){if(!$||typeof $!=="object")return;let w=$,J=w.status??w.statusCode;return typeof J==="number"?J:void 0}function pM($){let w=$.kind==="model.run"?$.model:Z$($.params,"model");if(!w)throw Error(`fal.ai ${$.kind} requires --model <endpoint-id> or params.model.`);return w}async function aM($,w,J){let V=UA($.params);if("prompt"in $&&$.prompt&&V.prompt===void 0)V.prompt=$.prompt;if($.kind==="audio.generate"&&V.text===void 0)V.text=$.input;if(($.kind==="video.edit"||$.kind==="video.extend")&&$.videoId&&V.video_id===void 0)V.video_id=$.videoId;for(let U of eM($)){let G=await sM(U,w,J),z=$.kind==="model.run"?U.role:$A(U.role,$.kind);if(z)wA(V,z,G)}return V}function eM($){return"inputs"in $?$.inputs:[]}async function sM($,w,J){if(WA($.source))return $.source;let V=await OX($),U=new Blob([Buffer.from(V.data)],{type:V.mime??W6(V.fileName)});return w.storage.upload(U,J?{lifecycle:J}:void 0)}function $A($,w){switch($){case"image":return w==="image.variation"?"image_url":"image_url";case"reference":return"image_url";case"mask":return"mask_url";case"style":return"style_image_url";case"audio":return"audio_url";case"video":return"video_url";default:return}}function wA($,w,J){let V=$[w];if(V===void 0){$[w]=J;return}if(Array.isArray(V)){V.push(J);return}$[w]=[V,J]}function JA($,w,J,V){let U={input:w,mode:"polling"},G=Z$($,"method");if(G)U.method=G;let z=D6($,"timeout_ms")??D6($,"timeout");if(z!==void 0)U.timeout=z;let i=D6($,"start_timeout")??D6($,"startTimeout");if(i!==void 0)U.startTimeout=i;let N=D6($,"poll_interval_ms")??D6($,"pollIntervalMs")??D6($,"poll_interval")??D6($,"pollInterval");if(N!==void 0)U.pollInterval=N;let X=Z$($,"priority");if(X){if(X!=="low"&&X!=="normal")throw Error("fal.ai priority must be low or normal.");U.priority=X}let W=vA($,"logs");if(W!==void 0)U.logs=W;if(J)U.storageSettings=J;if(V.verbose)U.onQueueUpdate=(I)=>{process.stderr.write(`fal queue ${JSON.stringify(I)}
|
|
259
|
+
`)};return U}function UA($){let{logs:w,method:J,model:V,poll_interval:U,poll_interval_ms:G,pollInterval:z,pollIntervalMs:i,priority:N,start_timeout:X,startTimeout:W,storage_expires_in:I,storage_settings:g,storageExpiresIn:Y,storageSettings:v,timeout:O,timeout_ms:P,...F}=$??{};return{...F}}function VA($){let w=$?.storage_settings??$?.storageSettings??$?.storage_expires_in??$?.storageExpiresIn;if(w===void 0)return;if(QA(w))return w;return{expiresIn:w}}async function GA($){let w=iA($.data);if(w.length>0)return zA(w,$.job);let J=XA($.data);if(J.length>0){let V=[];for(let U=0;U<J.length;U++)V.push(await S1({text:J[U],output:$.job.output,index:U,total:J.length,format:"txt",defaultName:Bz($.job)}));return V}return[await S1({text:`${JSON.stringify($.data,null,2)}
|
|
260
|
+
`,output:$.job.output,index:0,total:1,format:"json",defaultName:Bz($.job)})]}async function zA($,w){let J=[];for(let V=0;V<$.length;V++){let U=$[V];if(U.url){let G=await fetch(U.url),z=U.format??a9(G.headers.get("content-type"))??p9(U.url)??EO(w.kind);J.push(await JJ({response:G,output:w.output,index:V,total:$.length,format:z,defaultName:Bz(w)}));continue}if(U.data!==void 0)J.push(await A1({data:U.data,output:w.output,index:V,total:$.length,format:U.format??EO(w.kind),defaultName:Bz(w)}))}return J}function iA($){let w=[],J=new WeakSet,V=new Set,U=(i,N)=>{if(V.has(i))return;V.add(i),w.push({url:i,format:N??p9(i)})},G=(i,N)=>{if(V.has(i))return;V.add(i),w.push({data:i,format:N})},z=(i,N)=>{if(typeof i==="string"){if(l9(i))U(i);else if(gA(N))G(i);return}if(!i||typeof i!=="object")return;if(J.has(i))return;if(J.add(i),Array.isArray(i)){for(let v of i)z(v,N);return}let X=i,W=Z$(X,"content_type")??Z$(X,"format")??Z$(X,"file_type")??Z$(X,"mime_type"),I=NA(W),g=Z$(X,"url")??Z$(X,"image_url")??Z$(X,"video_url")??Z$(X,"audio_url")??Z$(X,"file_url");if(g&&l9(g))U(g,I);let Y=Z$(X,"b64_json")??Z$(X,"image_base64")??Z$(X,"audio_base64")??Z$(X,"video_base64")??(I?Z$(X,"data"):void 0);if(Y)G(Y,I);for(let[v,O]of Object.entries(X))if(IA(v))z(O,v)};return z($),w}function XA($){let w=[],J=new WeakSet,V=(U,G)=>{if(typeof U==="string"){if(YA(G)&&!l9(U))w.push(U);return}if(!U||typeof U!=="object")return;if(J.has(U))return;if(J.add(U),Array.isArray(U)){for(let z of U)V(z,G);return}for(let[z,i]of Object.entries(U))V(i,z)};return V($,"output"),w.length>0?w:typeof $==="string"?[$]:[]}function Bz($){return $.id??{"model.run":"result","image.generate":"image","image.edit":"edited-image","image.variation":"variation","video.generate":"video","video.edit":"edited-video","video.extend":"extended-video","audio.generate":"audio","audio.transcribe":"transcript","audio.translate":"translation"}[$.kind]}function EO($){if($.startsWith("image."))return"png";if($.startsWith("video."))return"mp4";if($==="audio.generate")return"mp3";return"bin"}function p9($){if($.startsWith("data:")){let w=$.slice(5,$.indexOf(";"));return a9(w)}try{let w=new URL($);return hM(w.pathname).replace(/^\./,"").toLowerCase()||void 0}catch{return}}function a9($){if(!$)return;let w=$.split(";")[0]?.trim().toLowerCase();switch(w){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/webp":return"webp";case"image/gif":return"gif";case"audio/mpeg":return"mp3";case"audio/mp4":return"m4a";case"audio/wav":case"audio/x-wav":return"wav";case"video/mp4":return"mp4";case"video/quicktime":return"mov";case"application/json":return"json";case"text/plain":return"txt";default:return w?.includes("/")?w.split("/").pop()?.replace(/[^a-z0-9]/gi,""):void 0}}function NA($){if(!$)return;if($.includes("/"))return a9($);return $.replace(/^\./,"").toLowerCase()}function WA($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("data:")}function l9($){if($.startsWith("data:"))return!0;if(!$.startsWith("http://")&&!$.startsWith("https://"))return!1;let w=p9($);return Boolean(w)||$.includes("fal.media")||$.includes("fal.ai")}function IA($){return["audio","audio_url","audios","b64_json","data","file","file_url","files","image","image_url","images","output","outputs","result","url","video","video_url","videos"].includes($)}function gA($){return Boolean($&&["b64_json","image_base64","audio_base64","video_base64"].includes($))}function YA($){return Boolean($&&["content","output","text","transcript","transcription","translation"].includes($))}function Z$($,w){let J=$?.[w];return typeof J==="string"&&J.trim()?J:void 0}function D6($,w){let J=$?.[w];return typeof J==="number"&&Number.isFinite(J)?J:void 0}function vA($,w){let J=$?.[w];return typeof J==="boolean"?J:void 0}function QA($){return Boolean($&&typeof $==="object"&&!Array.isArray($))}function t9($,w=new WeakSet){if(typeof $==="string")return $.length>1024?`${$.slice(0,1024)}...`:$;if(!$||typeof $!=="object")return $;if(w.has($))return"[Circular]";if(w.add($),Array.isArray($))return $.map((V)=>t9(V,w));let J={};for(let[V,U]of Object.entries($))J[V]=t9(U,w);return J}var OA="gpt-4o-mini-tts",PA="alloy",jO="mp3",KA="gpt-4o-mini-transcribe",xO="json",uA="whisper-1",rO="json";async function nO($,w,J){let V=BA({...w.params,input:w.input});DA(V);let U=await hO("audio.generate",()=>e9($).speech.create(V));if(fA(U))throw Error("OpenAI returned a streamed speech response. Ploof audio generation writes complete static audio files; omit stream_format or use stream_format=audio.");let G=ZA(V.response_format),z=await JJ({response:U,output:w.output,index:0,total:1,format:G,defaultName:w.id??"speech"}),i={id:w.id,kind:"audio.generate",provider:"openai",profile:J.credential.profile,outputs:[z],metadata:{model:V.model,voice:V.voice,format:G}};if(w.sidecar??J.sidecar??!0)await $4(i,{...w,params:V},"audio.generate");return i}async function dO($,w,J){let V=cO(w.inputs,"audio");if(!V)throw Error("An --audio input is required for audio transcription.");let U=HA({...w.params,file:await g4(V)});LA(U);let G=await MA("audio.transcribe",()=>e9($).transcriptions.create(U));return yO({kind:"audio.transcribe",job:w,context:J,response:G,params:U,defaultName:w.id??"transcript",defaultFormat:xO})}async function mO($,w,J){let V=cO(w.inputs,"audio");if(!V)throw Error("An --audio input is required for audio translation.");let U=FA({...w.params,file:await g4(V)}),G=await hO("audio.translate",()=>e9($).translations.create(U));return yO({kind:"audio.translate",job:w,context:J,response:G,params:U,defaultName:w.id??"translation",defaultFormat:rO})}function BA($){return{...$,model:$.model??OA,voice:$.voice??PA,response_format:$.response_format??jO}}function HA($){return{...$,model:$.model??KA,response_format:$.response_format??xO}}function FA($){return{...$,model:$.model??uA,response_format:$.response_format??rO}}async function yO($){let w=await qA($.response),J=TA($.params.response_format,w.format??$.defaultFormat),V=$.job.output?[await S1({text:w.text,output:$.job.output,index:0,total:1,format:J,defaultName:$.defaultName})]:[],U={id:$.job.id,kind:$.kind,provider:"openai",profile:$.context.credential.profile,outputs:V,metadata:{model:$.params.model,format:J,text:w.plainText,response:w.metadata}};if(V.length>0&&($.job.sidecar??$.context.sidecar??!0))await $4(U,{...$.job,params:_A($.params)},$.kind);return U}async function qA($){if(SA($))throw Error("Streaming audio processing responses are not supported because Ploof writes complete static assets. Omit stream=true.");if(typeof $==="string")return{text:$,plainText:$,format:"txt",metadata:{text:$}};return{text:`${JSON.stringify($,null,2)}
|
|
261
|
+
`,plainText:AA($),format:"json",metadata:$}}function ZA($){return typeof $==="string"&&$?$:jO}function TA($,w){if(typeof $!=="string"||!$)return w;switch($){case"json":case"verbose_json":case"diarized_json":return"json";case"text":return"txt";case"srt":case"vtt":return $;default:return w}}function DA($){if($.stream_format==="sse")throw Error("OpenAI stream_format=sse is not supported by Ploof audio generation because Ploof writes complete static audio files. Omit stream_format or use stream_format=audio.")}function LA($){if($.stream===!0||$.stream==="true")throw Error("OpenAI stream=true is not supported by Ploof audio processing because Ploof writes complete static transcript assets. Omit stream=true.")}function fA($){return $.headers.get("content-type")?.includes("text/event-stream")===!0}async function MA($,w){try{return await w()}catch(J){if(J instanceof Error)throw J;throw Error(`OpenAI ${$} failed: ${String(J)}`)}}async function hO($,w){try{return await w()}catch(J){if(J instanceof Error)throw J;throw Error(`OpenAI ${$} failed: ${String(J)}`)}}function e9($){return $.audio}function cO($,w){return $.find((J)=>J.role===w)}function AA($){if(!$||typeof $!=="object")return;let w=$.text;return typeof w==="string"?w:void 0}function SA($){return Boolean($&&typeof $==="object"&&Symbol.asyncIterator in $)}function _A($){let{file:w,...J}=$;return J}function lO($){let w=$.credential;if(!w.apiKey)throw Error("No OpenAI API key found. Run 'ploof login openai --api-key <key>' or set PLOOF_OPENAI_API_KEY.");return new r({apiKey:w.apiKey,organization:w.organization,project:w.project,baseURL:w.baseURL})}var oO="sora-2",kA=1e4,RA=900000,bA=new Set(["completed","failed","expired"]);async function pO($,w,J){let V=await EA(w),U=await U4("video.generate",()=>V4($).create(V));return Fz($,w,J,U,V)}async function aO($,w,J){let V=await zP(w),U=await U4("video.edit",()=>V4($).edit(V));return Fz($,w,J,U,V)}async function eO($,w,J){let V=await zP(w),U=await U4("video.extend",()=>V4($).extend(V));return Fz($,w,J,U,V)}async function sO($,w,J){let V=wg({...w.params,prompt:w.prompt}),U=await U4("video.remix",()=>V4($).remix(w.videoId,V));return Fz($,w,J,U,V)}async function $P($,w,J){let V=await U4("video.status",()=>V4($).retrieve(w.videoId));return{id:w.id,kind:"video.status",provider:"openai",profile:J.credential.profile,outputs:[],metadata:{video:V}}}async function wP($,w,J){let V=await iP({client:$,videoId:w.videoId,output:w.output,variants:w.variants}),U={id:w.id,kind:"video.download",provider:"openai",profile:J.credential.profile,outputs:V,metadata:{videoId:w.videoId,variants:w.variants}};if(w.sidecar??J.sidecar??!0)await $4(U,{...w,params:w.params},"video.download");return U}async function JP($,w,J){let V=await U4("video.list",()=>V4($).list(w.params??{}));return{id:w.id,kind:"video.list",provider:"openai",profile:J.credential.profile,outputs:[],metadata:cA(V)}}async function UP($,w,J){let V=await U4("video.delete",()=>V4($).delete(w.videoId));return{id:w.id,kind:"video.delete",provider:"openai",profile:J.credential.profile,outputs:[],metadata:{deleted:V}}}async function VP($,w,J){let V=$g(w.inputs,"video");if(!V)throw Error("A --video input is required to create a character.");let U={...w.params,name:w.name,video:await g4(V)},G=await U4("video.character.create",()=>V4($).createCharacter(U));return{id:w.id,kind:"video.character.create",provider:"openai",profile:J.credential.profile,outputs:[],metadata:{character:G}}}async function GP($,w,J){let V=await U4("video.character.get",()=>V4($).getCharacter(w.characterId));return{id:w.id,kind:"video.character.get",provider:"openai",profile:J.credential.profile,outputs:[],metadata:{character:V}}}async function EA($){let w=wg({...$.params,model:$.params?.model??oO,prompt:$.prompt}),J=$g($.inputs,"reference");if(J)w.input_reference=await CA(J);return w}async function zP($){let w=await jA($),J=wg({...$.params,prompt:$.prompt,video:w});if(!w)throw Error("Provide --video-id or --video.");if(oA(w)&&J.model===void 0)J.model=oO;return J}async function CA($){if($.source.startsWith("file:"))return{file_id:$.source.slice(5)};if(aA($.source))return{file_id:$.source};if(pA($.source)||$.source.startsWith("data:"))return{image_url:$.source};return g4($)}async function jA($){if($.videoId)return{id:$.videoId};let w=$g($.inputs,"video");return w?g4(w):void 0}async function Fz($,w,J,V,U){let G=V,z=tO(V),i=mA(w);if(i){if(!z)throw Error("OpenAI video response did not include a video id.");G=await xA($,z,w),rA(G)}let N=tO(G)??z,X=yA(w)&&N?await iP({client:$,videoId:N,output:w.output,variants:w.variants??["video"]}):[],W={id:w.id,kind:w.kind,provider:"openai",profile:J.credential.profile,outputs:X,metadata:{video:G,submitted:V,waited:i,downloaded:X.length>0}};if(X.length>0&&(w.sidecar??J.sidecar??!0))await $4(W,{...w,params:lA(U)},w.kind);return W}async function xA($,w,J){let V=Date.now(),U=J.pollIntervalMs??kA,G=J.timeoutMs??RA,z=await U4("video.status",()=>V4($).retrieve(w));while(!bA.has(XP(z))){if(Date.now()-V>G)throw Error(`Timed out waiting for OpenAI video ${w} after ${G}ms.`);await eA(U),z=await U4("video.status",()=>V4($).retrieve(w))}return z}function rA($){let w=XP($);if(w==="completed")return;let J=hA($);throw Error(J?`OpenAI video generation failed: ${J}`:`OpenAI video generation ended with status=${w||"unknown"}.`)}async function iP($){let w=[];for(let J=0;J<$.variants.length;J++){let V=$.variants[J],U=await U4("video.download",()=>V4($.client).downloadContent($.videoId,{variant:V}));w.push(await JJ({response:U,output:nA($.output,V,$.variants.length),index:0,total:1,format:s9(V),defaultName:dA($.videoId,V)}))}return w}function nA($,w,J){if(!$||J<=1||$.endsWith("/"))return $;let V=$.lastIndexOf("."),U=Math.max($.lastIndexOf("/"),$.lastIndexOf("\\"));if(V<=U)return`${$}-${w}.${s9(w)}`;return`${$.slice(0,V)}-${w}.${s9(w)}`}function dA($,w){return w==="video"?$:`${$}-${w}`}function s9($){switch($){case"thumbnail":return"webp";case"spritesheet":return"jpg";case"video":return"mp4"}}function mA($){return $.wait===!0||Boolean($.output)||$.download===!0}function yA($){return $.download===!0||Boolean($.output)}function tO($){return Hz($,"id")}function XP($){return Hz($,"status")??""}function hA($){if(!$||typeof $!=="object")return;let w=$.error;if(!w||typeof w!=="object")return;return Hz(w,"message")??Hz(w,"code")}function Hz($,w){if(!$||typeof $!=="object")return;let J=$[w];return typeof J==="string"?J:void 0}function cA($){let w=$&&typeof $==="object"?$:{};return{data:w.data,has_more:w.has_more,first_id:w.first_id,last_id:w.last_id}}function lA($){let{input_reference:w,video:J,...V}=$;return V}async function U4($,w){try{return await w()}catch(J){throw tA($,J)}}function tA($,w){if(w instanceof Error)return w;return Error(`OpenAI ${$} failed: ${String(w)}`)}function V4($){return $.videos}function $g($,w){return $.find((J)=>J.role===w)}function oA($){return Boolean($&&typeof $==="object"&&"name"in $)}function pA($){return $.startsWith("http://")||$.startsWith("https://")}function aA($){return $.startsWith("file-")||$.startsWith("file_")}function eA($){return new Promise((w)=>setTimeout(w,$))}function wg($){let w={};for(let[J,V]of Object.entries($))if(V!==void 0)w[J]=V;return w}var sA="gpt-image-2",$S="dall-e-2";class Wg{id="openai";displayName="OpenAI";auth={apiKeyEnvVars:["PLOOF_OPENAI_API_KEY","OPENAI_API_KEY"],organizationEnvVar:"PLOOF_OPENAI_ORG",projectEnvVar:"PLOOF_OPENAI_PROJECT",baseURLEnvVar:"PLOOF_OPENAI_BASE_URL"};capabilities=["image.generate","image.edit","image.variation","video.generate","video.edit","video.extend","video.remix","video.status","video.download","video.list","video.delete","video.character.create","video.character.get","audio.generate","audio.transcribe","audio.translate"];async run($,w){switch($.kind){case"image.generate":return this.runImageGenerate($,w);case"image.edit":return this.runImageEdit($,w);case"image.variation":return this.runImageVariation($,w);case"video.generate":return this.runVideoGenerate($,w);case"video.edit":return this.runVideoEdit($,w);case"video.extend":return this.runVideoExtend($,w);case"video.remix":return this.runVideoRemix($,w);case"video.status":return this.runVideoStatus($,w);case"video.download":return this.runVideoDownload($,w);case"video.list":return this.runVideoList($,w);case"video.delete":return this.runVideoDelete($,w);case"video.character.create":return this.runVideoCharacterCreate($,w);case"video.character.get":return this.runVideoCharacterGet($,w);case"audio.generate":return this.runAudioGenerate($,w);case"audio.transcribe":return this.runAudioTranscribe($,w);case"audio.translate":return this.runAudioTranslate($,w);default:throw Error(`OpenAI does not support ${$.kind}.`)}}async runImageGenerate($,w){let J=_$(w),V=Jg("image.generate",{...$.params,prompt:$.prompt});Ug("image.generate",V);let U=await Vg("image.generate",()=>zg(J).generate(V)),G=await ig({response:U,output:$.output,format:Ng(V),defaultName:$.id??"image"}),z={id:$.id,kind:"image.generate",provider:this.id,profile:w.credential.profile,outputs:G,metadata:Xg(U,V)};if($.sidecar??w.sidecar??!0)await $4(z,{...$,params:Gg(V)},"image.generate");return z}async runImageEdit($,w){let J=_$(w),V=$.inputs.filter((g)=>g.role==="image"),U=$.inputs.find((g)=>g.role==="mask");if(V.length===0)throw Error("At least one --image input is required for image edits.");let G=await Promise.all(V.map(g4)),z=U?await g4(U):void 0,i=G.length===1?G[0]:G,N=Jg("image.edit",{...$.params,prompt:$.prompt,image:i,...z?{mask:z}:{}});Ug("image.edit",N);let X=await Vg("image.edit",()=>zg(J).edit(N)),W=await ig({response:X,output:$.output,format:Ng(N),defaultName:$.id??"edited-image"}),I={id:$.id,kind:"image.edit",provider:this.id,profile:w.credential.profile,outputs:W,metadata:Xg(X,N)};if($.sidecar??w.sidecar??!0)await $4(I,{...$,params:Gg(N)},"image.edit");return I}async runImageVariation($,w){let J=_$(w),V=$.inputs.find((X)=>X.role==="image");if(!V)throw Error("An --image input is required for image variations.");let U=await g4(V),G=Jg("image.variation",{...$.params,image:U});Ug("image.variation",G);let z=await Vg("image.variation",()=>zg(J).createVariation(G)),i=await ig({response:z,output:$.output,format:Ng(G),defaultName:$.id??"variation"}),N={id:$.id,kind:"image.variation",provider:this.id,profile:w.credential.profile,outputs:i,metadata:Xg(z,G)};if($.sidecar??w.sidecar??!0)await $4(N,{...$,params:Gg(G)},"image.variation");return N}async runVideoGenerate($,w){return pO(_$(w),$,w)}async runVideoEdit($,w){return aO(_$(w),$,w)}async runVideoExtend($,w){return eO(_$(w),$,w)}async runVideoRemix($,w){return sO(_$(w),$,w)}async runVideoStatus($,w){return $P(_$(w),$,w)}async runVideoDownload($,w){return wP(_$(w),$,w)}async runVideoList($,w){return JP(_$(w),$,w)}async runVideoDelete($,w){return UP(_$(w),$,w)}async runVideoCharacterCreate($,w){return VP(_$(w),$,w)}async runVideoCharacterGet($,w){return GP(_$(w),$,w)}async runAudioGenerate($,w){return nO(_$(w),$,w)}async runAudioTranscribe($,w){return dO(_$(w),$,w)}async runAudioTranslate($,w){return mO(_$(w),$,w)}}function Jg($,w){return{...w,model:w.model??($==="image.variation"?$S:sA)}}function Ug($,w){let J=typeof w.model==="string"?w.model:void 0;if($==="image.variation"&&J&&J!=="dall-e-2")throw Error("OpenAI image variations currently only support model=dall-e-2.");if(!J)return;if(US(J)&&w.response_format!==void 0)throw Error("`response_format` is only supported for DALL-E image models. GPT image models return base64 image data.");if(VS(J)){if(w.background==="transparent")throw Error("`background=transparent` is not supported by gpt-image-2. Use `background=auto` or `background=opaque`.");if(w.input_fidelity!==void 0)throw Error("`input_fidelity` is not configurable for gpt-image-2; omit it because gpt-image-2 processes image inputs at high fidelity automatically.")}}async function Vg($,w){try{return await w()}catch(J){throw wS($,J)}}function wS($,w){let J=JS(w);if($==="image.variation"&&J===404){let V=Error("OpenAI image variations returned 404. The variations endpoint is legacy and only supports dall-e-2; this usually means the current API key or project cannot access that endpoint. Use `ploof image edit` for image-to-image workflows, or try a profile/project with DALL-E 2 variation access.");return V.cause=w,V}if(w instanceof Error)return w;return Error(String(w))}function JS($){if(!$||typeof $!=="object")return;let w=$,J=w.status??w.statusCode;return typeof J==="number"?J:void 0}function Gg($){let{image:w,mask:J,...V}=$;return V}function US($){return $.startsWith("gpt-image-")||$==="chatgpt-image-latest"}function VS($){return $==="gpt-image-2"||$.startsWith("gpt-image-2-")}function _$($){return lO($)}function zg($){return $.images}async function ig($){if(iS($.response))return GS($);let w=NP($.response),J=w.length,V=[];for(let U=0;U<w.length;U++){let G=w[U];if(G.b64_json)V.push(await TV({data:G.b64_json,output:$.output,index:U,total:J,format:$.format,defaultName:$.defaultName}));else if(G.url)V.push(await Kv({url:G.url,output:$.output,index:U,total:J,format:$.format,defaultName:$.defaultName}))}if(V.length===0)throw Error("OpenAI response did not include image data or URLs.");return V}async function GS($){let w=[];for await(let V of $.response)w.push(...zS(V));if(w.length===0)throw Error("OpenAI stream did not include image data.");let J=[];for(let V=0;V<w.length;V++)J.push(await TV({data:w[V],output:$.output,index:V,total:w.length,format:$.format,defaultName:$.defaultName}));return J}function Xg($,w){let J=$&&typeof $==="object"?$:{};return{model:w?.model,created:J.created,usage:J.usage,revisedPrompts:NP($).map((V)=>V.revised_prompt).filter(Boolean)}}function NP($){if(!$||typeof $!=="object")return[];let w=$.data;return Array.isArray(w)?w:[]}function zS($){if(!$||typeof $!=="object")return[];let w=[],J=(V)=>{if(!V||typeof V!=="object")return;for(let[U,G]of Object.entries(V))if(typeof G==="string"&&(U==="b64_json"||U==="partial_image_b64"||U==="image_b64"))w.push(G);else if(typeof G==="object")J(G)};return J($),w}function Ng($){return $?.output_format??$?.format}function iS($){return Boolean($&&typeof $==="object"&&Symbol.asyncIterator in $)}var XS=[new Wg,new o9];function Pw($){return XS.find((w)=>w.id===$)}function qz($){let w=Pw($);if(!w)throw Error(`Unknown provider: ${$}`);return w}var OS=j.object({apiKey:j.string().optional(),organization:j.string().optional(),project:j.string().optional(),baseURL:j.string().optional()}),PS=j.object({providers:j.record(j.string(),j.object({defaultProfile:j.string().default("default"),profiles:j.record(j.string(),OS).default({})})).default({})});class o4{credPath;constructor($){this.credPath=QS(RJ($),"credentials.json")}login($,w,J,V=!0){if(!J.apiKey)throw Error("API key is required.");let U=this.read(),G=U.providers[$]??{defaultProfile:w,profiles:{}};if(G.profiles[w]=J,V)G.defaultProfile=w;U.providers[$]=G,this.write(U)}logout($,w){let J=this.read(),V=J.providers[$];if(!V)return!1;let U=w??V.defaultProfile;if(!V.profiles[U])return!1;delete V.profiles[U];let G=Object.keys(V.profiles);if(G.length===0)delete J.providers[$];else if(V.defaultProfile===U)V.defaultProfile=G[0];return this.write(J),!0}listProfiles($){let w=this.read(),J={};for(let[V,U]of Object.entries(w.providers)){if($&&V!==$)continue;J[V]=Object.keys(U.profiles)}return J}getDefaultProfile($){return this.read().providers[$]?.defaultProfile??"default"}getCredential($,w){let J=KS($,w);if(J)return J;let U=this.read().providers[$];if(!U)return null;let G=w??U.defaultProfile,z=U.profiles[G];if(!z?.apiKey)return null;return{...z,source:"stored",profile:G}}status($,w){let J=w??this.getDefaultProfile($),V=this.getCredential($,w);if(!V?.apiKey)return{provider:$,profile:J,authenticated:!1};return{provider:$,profile:V.profile??J,authenticated:!0,source:V.source,keyPrefix:HS(V.apiKey),organization:V.organization,project:V.project,baseURL:V.baseURL}}read(){try{if(!WS(this.credPath))return{providers:{}};let $=gS(this.credPath,"utf-8");return PS.parse(JSON.parse($))}catch{return{providers:{}}}}write($){IS(vS(this.credPath),{recursive:!0}),YS(this.credPath,`${JSON.stringify($,null,2)}
|
|
262
|
+
`,{mode:384});try{NS(this.credPath,384)}catch{}}}function KS($,w){let J=Pw($)?.auth;if(!J)return null;let U=uS(J.apiKeyEnvVars)??BS(J.apiKeyEnvPairs);if(!U)return null;return{apiKey:U,organization:J.organizationEnvVar?process.env[J.organizationEnvVar]:void 0,project:J.projectEnvVar?process.env[J.projectEnvVar]:void 0,baseURL:J.baseURLEnvVar?process.env[J.baseURLEnvVar]:void 0,source:"env",profile:w??"env"}}function uS($){for(let w of $){let J=process.env[w]?.trim();if(J)return J}return}function BS($){for(let w of $??[]){let J=process.env[w.idEnvVar]?.trim(),V=process.env[w.secretEnvVar]?.trim();if(J&&V)return`${J}:${V}`}return}function HS($){if($.length<=12)return`${$.slice(0,4)}...`;return`${$.slice(0,8)}...${$.slice(-4)}`}import{existsSync as FS,mkdirSync as qS,readFileSync as ZS,writeFileSync as TS}from"node:fs";import{dirname as DS,join as LS}from"node:path";var WP=j.object({output:j.enum(["auto","table","compact","json","jsonl"]).default("auto"),defaultParallel:j.number().int().positive().default(4),sidecar:j.boolean().default(!0),noColor:j.boolean().default(!1)}),Zz={output:"auto",defaultParallel:4,sidecar:!0,noColor:!1},fS=new Set(["output","defaultParallel","sidecar","noColor"]);class p4{configPath;values;constructor($){this.configPath=LS(RJ($),"config.json"),this.values={...Zz},this.loadSync()}loadSync(){try{if(!FS(this.configPath))return;let $=ZS(this.configPath,"utf-8"),w=JSON.parse($);this.values=WP.parse({...Zz,...w})}catch{this.values={...Zz}}}async load(){this.loadSync()}get($){return this.values[$]}set($,w){if(!fS.has($))throw Error(`Invalid config key: ${String($)}`);let J=WP.parse({...this.values,[$]:w});this.values=J,this.save()}list(){return{...this.values}}reset(){this.values={...Zz},this.save()}save(){qS(DS(this.configPath),{recursive:!0}),TS(this.configPath,`${JSON.stringify(this.values,null,2)}
|
|
263
|
+
`)}}var IP=($=0)=>(w)=>`\x1B[${w+$}m`,gP=($=0)=>(w)=>`\x1B[${38+$};5;${w}m`,YP=($=0)=>(w,J,V)=>`\x1B[${38+$};2;${w};${J};${V}m`,V$={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Vw$=Object.keys(V$.modifier),MS=Object.keys(V$.color),AS=Object.keys(V$.bgColor),Gw$=[...MS,...AS];function SS(){let $=new Map;for(let[w,J]of Object.entries(V$)){for(let[V,U]of Object.entries(J))V$[V]={open:`\x1B[${U[0]}m`,close:`\x1B[${U[1]}m`},J[V]=V$[V],$.set(U[0],U[1]);Object.defineProperty(V$,w,{value:J,enumerable:!1})}return Object.defineProperty(V$,"codes",{value:$,enumerable:!1}),V$.color.close="\x1B[39m",V$.bgColor.close="\x1B[49m",V$.color.ansi=IP(),V$.color.ansi256=gP(),V$.color.ansi16m=YP(),V$.bgColor.ansi=IP(10),V$.bgColor.ansi256=gP(10),V$.bgColor.ansi16m=YP(10),Object.defineProperties(V$,{rgbToAnsi256:{value(w,J,V){if(w===J&&J===V){if(w<8)return 16;if(w>248)return 231;return Math.round((w-8)/247*24)+232}return 16+36*Math.round(w/255*5)+6*Math.round(J/255*5)+Math.round(V/255*5)},enumerable:!1},hexToRgb:{value(w){let J=/[a-f\d]{6}|[a-f\d]{3}/i.exec(w.toString(16));if(!J)return[0,0,0];let[V]=J;if(V.length===3)V=[...V].map((G)=>G+G).join("");let U=Number.parseInt(V,16);return[U>>16&255,U>>8&255,U&255]},enumerable:!1},hexToAnsi256:{value:(w)=>V$.rgbToAnsi256(...V$.hexToRgb(w)),enumerable:!1},ansi256ToAnsi:{value(w){if(w<8)return 30+w;if(w<16)return 90+(w-8);let J,V,U;if(w>=232)J=((w-232)*10+8)/255,V=J,U=J;else{w-=16;let i=w%36;J=Math.floor(w/36)/5,V=Math.floor(i/6)/5,U=i%6/5}let G=Math.max(J,V,U)*2;if(G===0)return 30;let z=30+(Math.round(U)<<2|Math.round(V)<<1|Math.round(J));if(G===2)z+=60;return z},enumerable:!1},rgbToAnsi:{value:(w,J,V)=>V$.ansi256ToAnsi(V$.rgbToAnsi256(w,J,V)),enumerable:!1},hexToAnsi:{value:(w)=>V$.ansi256ToAnsi(V$.hexToAnsi256(w)),enumerable:!1}}),V$}var _S=SS(),Q4=_S;import Ig from"node:process";import kS from"node:os";import vP from"node:tty";function G4($,w=globalThis.Deno?globalThis.Deno.args:Ig.argv){let J=$.startsWith("-")?"":$.length===1?"-":"--",V=w.indexOf(J+$),U=w.indexOf("--");return V!==-1&&(U===-1||V<U)}var{env:G$}=Ig,Tz;if(G4("no-color")||G4("no-colors")||G4("color=false")||G4("color=never"))Tz=0;else if(G4("color")||G4("colors")||G4("color=true")||G4("color=always"))Tz=1;function RS(){if("FORCE_COLOR"in G$){if(G$.FORCE_COLOR==="true")return 1;if(G$.FORCE_COLOR==="false")return 0;return G$.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(G$.FORCE_COLOR,10),3)}}function bS($){if($===0)return!1;return{level:$,hasBasic:!0,has256:$>=2,has16m:$>=3}}function ES($,{streamIsTTY:w,sniffFlags:J=!0}={}){let V=RS();if(V!==void 0)Tz=V;let U=J?Tz:V;if(U===0)return 0;if(J){if(G4("color=16m")||G4("color=full")||G4("color=truecolor"))return 3;if(G4("color=256"))return 2}if("TF_BUILD"in G$&&"AGENT_NAME"in G$)return 1;if($&&!w&&U===void 0)return 0;let G=U||0;if(G$.TERM==="dumb")return G;if(Ig.platform==="win32"){let z=kS.release().split(".");if(Number(z[0])>=10&&Number(z[2])>=10586)return Number(z[2])>=14931?3:2;return 1}if("CI"in G$){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((z)=>(z in G$)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((z)=>(z in G$))||G$.CI_NAME==="codeship")return 1;return G}if("TEAMCITY_VERSION"in G$)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(G$.TEAMCITY_VERSION)?1:0;if(G$.COLORTERM==="truecolor")return 3;if(G$.TERM==="xterm-kitty")return 3;if(G$.TERM==="xterm-ghostty")return 3;if(G$.TERM==="wezterm")return 3;if("TERM_PROGRAM"in G$){let z=Number.parseInt((G$.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(G$.TERM_PROGRAM){case"iTerm.app":return z>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(G$.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(G$.TERM))return 1;if("COLORTERM"in G$)return 1;return G}function QP($,w={}){let J=ES($,{streamIsTTY:$&&$.isTTY,...w});return bS(J)}var CS={stdout:QP({isTTY:vP.isatty(1)}),stderr:QP({isTTY:vP.isatty(2)})},OP=CS;function PP($,w,J){let V=$.indexOf(w);if(V===-1)return $;let U=w.length,G=0,z="";do z+=$.slice(G,V)+w+J,G=V+U,V=$.indexOf(w,G);while(V!==-1);return z+=$.slice(G),z}function KP($,w,J,V){let U=0,G="";do{let z=$[V-1]==="\r";G+=$.slice(U,z?V-1:V)+w+(z?`\r
|
|
257
264
|
`:`
|
|
258
|
-
`)+U
|
|
259
|
-
`,
|
|
260
|
-
`);if(
|
|
265
|
+
`)+J,U=V+1,V=$.indexOf(`
|
|
266
|
+
`,U)}while(V!==-1);return G+=$.slice(U),G}var{stdout:uP,stderr:BP}=OP,gg=Symbol("GENERATOR"),nJ=Symbol("STYLER"),F0=Symbol("IS_EMPTY"),HP=["ansi","ansi","ansi256","ansi16m"],dJ=Object.create(null),jS=($,w={})=>{if(w.level&&!(Number.isInteger(w.level)&&w.level>=0&&w.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let J=uP?uP.level:0;$.level=w.level===void 0?J:w.level};var xS=($)=>{let w=(...J)=>J.join(" ");return jS(w,$),Object.setPrototypeOf(w,q0.prototype),w};function q0($){return xS($)}Object.setPrototypeOf(q0.prototype,Function.prototype);for(let[$,w]of Object.entries(Q4))dJ[$]={get(){let J=Dz(this,vg(w.open,w.close,this[nJ]),this[F0]);return Object.defineProperty(this,$,{value:J}),J}};dJ.visible={get(){let $=Dz(this,this[nJ],!0);return Object.defineProperty(this,"visible",{value:$}),$}};var Yg=($,w,J,...V)=>{if($==="rgb"){if(w==="ansi16m")return Q4[J].ansi16m(...V);if(w==="ansi256")return Q4[J].ansi256(Q4.rgbToAnsi256(...V));return Q4[J].ansi(Q4.rgbToAnsi(...V))}if($==="hex")return Yg("rgb",w,J,...Q4.hexToRgb(...V));return Q4[J][$](...V)},rS=["rgb","hex","ansi256"];for(let $ of rS){dJ[$]={get(){let{level:J}=this;return function(...V){let U=vg(Yg($,HP[J],"color",...V),Q4.color.close,this[nJ]);return Dz(this,U,this[F0])}}};let w="bg"+$[0].toUpperCase()+$.slice(1);dJ[w]={get(){let{level:J}=this;return function(...V){let U=vg(Yg($,HP[J],"bgColor",...V),Q4.bgColor.close,this[nJ]);return Dz(this,U,this[F0])}}}}var nS=Object.defineProperties(()=>{},{...dJ,level:{enumerable:!0,get(){return this[gg].level},set($){this[gg].level=$}}}),vg=($,w,J)=>{let V,U;if(J===void 0)V=$,U=w;else V=J.openAll+$,U=w+J.closeAll;return{open:$,close:w,openAll:V,closeAll:U,parent:J}},Dz=($,w,J)=>{let V=(...U)=>dS(V,U.length===1?""+U[0]:U.join(" "));return Object.setPrototypeOf(V,nS),V[gg]=$,V[nJ]=w,V[F0]=J,V},dS=($,w)=>{if($.level<=0||!w)return $[F0]?"":w;let J=$[nJ];if(J===void 0)return w;let{openAll:V,closeAll:U}=J;if(w.includes("\x1B"))while(J!==void 0)w=PP(w,J.close,J.open),J=J.parent;let G=w.indexOf(`
|
|
267
|
+
`);if(G!==-1)w=KP(w,U,V,G);return V+w+U};Object.defineProperties(q0.prototype,dJ);var mS=q0(),Qw$=q0({level:BP?BP.level:0});var Lz=mS;class K$ extends Error{code;constructor($,w=1){super($);this.code=w;this.name="CliError"}}function FP($,w=!1){let J=$ instanceof Error?$.message:String($);if(w)return`Error: ${J}`;return`${Lz.red("Error:")} ${J}`}function ZP($){return`${$.join(`
|
|
261
268
|
`).trim()}
|
|
262
|
-
`}var Qu=yY(["# Generate assets with the ploof CLI","","Ploof is an AI asset generation CLI. Use it when a task needs generated or edited images or videos, batch asset creation, provider authentication, image/video context inputs, or reusable generation manifests.","","Package name: `@miketromba/ploof`. Command name: `ploof`. Supported today: OpenAI image generation/editing and OpenAI video generation/editing/extensions/downloads/characters. OpenAI image variations are implemented through the legacy DALL-E 2 endpoint when the authenticated project has access.","","## Core workflow","","1. Run `ploof whoami openai`. If unauthenticated, ask the user to run `ploof login openai` or provide `PLOOF_OPENAI_API_KEY` in their shell.","2. For one image asset, use `ploof image generate` or `ploof image edit` with an explicit `--out` path.","3. For one video asset, use `ploof video generate --out <path>` so Ploof waits for completion and downloads the MP4.","4. For multiple assets, dependencies, or parallel work, write a YAML manifest and run `ploof run <manifest.yaml>`.","5. Use `--output json` for commands another tool or agent must parse. Use `--output jsonl` for batch streams.","6. After a command completes, verify every path in `outputs` exists before telling the user generation succeeded.","","## Authentication","","```bash","ploof login openai --api-key <key>","ploof whoami openai","ploof profiles openai","```","","There is no `ploof auth` namespace. The authentication commands are top-level: `login`, `whoami`, `profiles`, and `logout`.","","Environment variables override stored credentials:","","```bash","PLOOF_OPENAI_API_KEY=...","OPENAI_API_KEY=...","```","","Use `--profile <name>` on `login`, `whoami`, `image ...`, `video ...`, and manifest tasks when the user has multiple OpenAI credentials. Never print or store secrets in generated project files.","","## Image generation","","```bash","ploof image generate \\"," --provider openai \\",' --prompt "Studio product photo" \\'," --out assets/hero.png \\"," --model gpt-image-2 \\"," --size 1024x1024 \\"," --quality high \\"," --format png \\"," --output json","```","","OpenAI image generation and editing default to `gpt-image-2` when `--model` is omitted.","","Important: `--format png` controls the generated asset format. `--output json` controls CLI output formatting.","","First-class OpenAI image flags:","","- `--model <model>`: for example `gpt-image-2`.","- `--size <size>`: provider size such as `1024x1024`.","- `--quality <quality>`: provider quality such as `low`, `medium`, or `high` when supported.","- `--format <format>` or `--output-format <format>`: provider image format, usually `png`, `jpeg`, or `webp` when supported.","- `--background <value>`, `--moderation <value>`, `--n <count>`, `--output-compression <number>`, `--partial-images <number>`, `--response-format <format>`, `--style <style>`, `--user <id>`, `--stream`.","- `--param key=value`: pass one provider-specific parameter. Nested keys work, such as `--param extra.foo=bar`.","- `--json '{...}'`: merge a provider-specific JSON object into the request. Explicit first-class flags override overlapping JSON keys.","","Use `--quality low` for cheap smoke tests. Use the user's requested quality and size for final assets.","","## Image editing and context images","","```bash","ploof image edit \\"," --provider openai \\"," --image input.png \\"," --image reference.png \\"," --mask mask.png \\",' --prompt "Replace the background" \\'," --out assets/edited.png \\"," --model gpt-image-2 \\"," --format png \\"," --output json","```","","Pass every source image the provider should see with repeated `--image`. Use `--mask` only when the provider/model supports masked edits. Edit also supports `--input-fidelity <value>`.","","Input assets can be local paths, `http://` or `https://` URLs, or `-` for stdin. Ploof infers common image MIME types from file extensions and preserves generated files locally.","","## Image variations","","```bash","ploof image variation \\"," --provider openai \\"," --image input.png \\"," --out assets/variation.png \\"," --size 1024x1024 \\"," --output json","```","","OpenAI variations default to `dall-e-2`, because OpenAI's legacy variations endpoint currently only supports `dall-e-2`. If OpenAI returns a 404, use `ploof image edit` for image-to-image workflows or try a profile/project with DALL-E 2 variation access. `ploof image variations` is an alias.","","## Video generation","","```bash","ploof video generate \\"," --provider openai \\",' --prompt "Wide tracking shot of a paper city at blue hour" \\'," --model sora-2 \\"," --size 1280x720 \\"," --seconds 4 \\"," --out assets/clip.mp4 \\"," --output json","```","","OpenAI video generation defaults to `sora-2` when `--model` is omitted. Video jobs are asynchronous. Passing `--out` or `--download` makes Ploof wait for a terminal status and download the requested asset.","","First-class OpenAI video flags:","","- `--model <model>`: for example `sora-2` or `sora-2-pro`.","- `--size <size>`: provider size such as `1280x720`.","- `--seconds <seconds>`: clip or extension duration.","- `--input-reference <path-or-url-or-file-id>`, `--input-reference-file-id <id>`, or `--input-reference-url <url>`: image reference for the first frame.","- `--character <id>`: reusable character id; repeat for multiple characters and mention the character name in the prompt.","- `--wait`, `--download`, `--variant video|thumbnail|spritesheet`, `--poll-interval <seconds>`, `--timeout <seconds>`.","- `--param key=value` and `--json '{...}'` work for provider-specific video settings.","","## Video editing, extension, and library","","```bash","ploof video edit \\"," --video-id video_abc123 \\",' --prompt "Shift the palette to teal and rust" \\'," --out assets/edit.mp4 \\"," --output json","","ploof video extend \\"," --video-id video_abc123 \\",' --prompt "Continue as the camera rises over the rooftops" \\'," --seconds 4 \\"," --out assets/extended.mp4 \\"," --output json","","ploof video download video_abc123 --variant thumbnail --out assets/thumb.webp --output json","ploof video status video_abc123 --output json","ploof video list --limit 20 --output json","```","","Video edits accept `--video-id <id>` for completed OpenAI videos or `--video <path>` for uploaded source videos when the authenticated project is eligible. Extensions accept `--video-id` or `--video`, plus `--seconds`.","","Reusable characters:","","```bash","ploof video character create --name Mossy --video character.mp4 --output json","ploof video character get char_abc123 --output json","```","","## Outputs and verification","","`--out <path>` can be a file path or directory. When generating multiple images with `--n`, a file path is expanded with `-1`, `-2`, etc. Video downloads use `.mp4`, thumbnails use `.webp`, and spritesheets use `.jpg`. If `--out` is omitted for image generation, Ploof writes in the current directory using default names like `image.png` or `edited-image.png`.","","Default sidecar metadata is enabled. For each output file, Ploof writes `<output>.json` with the operation, prompt, params, outputs, provider metadata, and timestamp.","","Parseable result shape:","","```json","{",' "kind": "video.generate",',' "provider": "openai",',' "profile": "default",',' "outputs": ["assets/clip.mp4"],',' "metadata": { "video": { "id": "video_...", "status": "completed" } }',"}","```","","Useful global output flags:","","- `--output json|jsonl|compact|table`: choose CLI output format.","- `--fields outputs,metadata.usage.total_tokens`: select fields for parseable outputs.","- `--detail`, `--quiet`, `--no-color`, `--verbose`.","","## Batch manifests","","```yaml","version: 1","parallel: 4","tasks:"," - id: base"," kind: image.generate"," provider: openai"," profile: default",' prompt: "Studio product photo"'," output: assets/base.png"," params:"," model: gpt-image-2"," size: 1024x1024"," quality: high"," output_format: png",""," - id: edit"," kind: image.edit"," provider: openai"," needs: [base]"," inputs:"," images:"," - task: base"," - source: ./reference.png"," mask:"," source: ./mask.png",' prompt: "Add a premium background"'," output: assets/final.png"," params:"," model: gpt-image-2"," size: 1024x1024",""," - id: variation"," kind: image.variation"," provider: openai"," needs: [base]"," inputs:"," images:"," - task: base"," output: assets/variation.png",""," - id: clip"," kind: video.generate"," provider: openai",' prompt: "Slow dolly shot through a miniature paper city"'," output: assets/clip.mp4"," wait: true"," download: true"," params:"," model: sora-2"," size: 1280x720"," seconds: '4'","```","","Run it with:","","```bash","ploof run assets.yaml --parallel 4 --output json","```","","Manifest notes:","","- `version: 1`, `parallel`, and `tasks` are supported.","- Task kinds include `image.generate`, `image.edit`, `image.variation`, `video.generate`, `video.edit`, `video.extend`, `video.remix`, `video.status`, `video.download`, `video.list`, `video.delete`, `video.character.create`, and `video.character.get`.","- Task fields: `id`, `kind`, `provider`, `profile`, `needs`, `prompt`, `output`, `params`, `sidecar`, `inputs`, `videoId`, `characterId`, `name`, `wait`, `download`, `variants`, `pollIntervalMs`, and `timeoutMs`.","- Relative paths are resolved from the manifest file location.","- `inputs.images` accepts strings, `{ source }`, or `{ task }`. `{ task: base }` uses the first output from that completed task.","- `inputs.video`, `inputs.videos`, and `inputs.inputReference` use the same input reference shape.","- Run `ploof run assets.yaml --dry-run --output json` before expensive batches.","","## Configuration","","```bash","ploof config list","ploof config set output json","ploof config set defaultParallel 4","ploof config set sidecar true","ploof config reset","```","","Config is stored at `~/.ploof/config.json`. Credentials are stored separately at `~/.ploof/credentials.json`.","","## Agent guidance","","- Prefer exact user-provided prompts, dimensions, source images, and output paths. Ask only when a missing choice would change the intended asset.","- Keep prompts and params explicit in commands or manifests.","- Use deterministic output paths, usually under the user's requested asset directory or a temp directory for tests.","- Use manifests for parallel generation, dependency chains, or more than one related asset.","- Keep `--parallel` modest unless the user requests volume; generation costs money and provider rate limits may apply.","- Report generated file paths and any relevant metadata such as model and token usage.","- Do not claim assets were generated unless the command completed successfully and output files exist.","- If a command fails, report the command goal, the error, and the next concrete fix. Do not fabricate assets.","- Run `ploof <command> --help` when a detail is unclear; prefer the installed CLI help over memory."]);function rY(){return yY(["Usage: ploof learn [options]","","Print AI-agent instructions for using the installed ploof CLI.","","Options:"," --help, -h Show this help","","Examples:"," ploof learn"])}function dY($=[]){if($.includes("--help")||$.includes("-h"))return rY();let w=$.find((U)=>U.trim()!=="");if(w)throw Error(`Unknown learn argument: ${w}
|
|
269
|
+
`}var yS=ZP(["# Generate assets with the ploof CLI","","Ploof is an AI asset generation CLI. Use it when a task needs generated or edited images or videos, generated or processed audio, arbitrary provider model endpoints, batch asset creation, provider authentication, media context inputs, or reusable generation manifests.","","Package name: `@miketromba/ploof`. Command name: `ploof`. Supported today: OpenAI image generation/editing, OpenAI video generation/editing/extensions/downloads/characters, OpenAI audio generation/transcription/translation, and fal.ai model endpoints through the official fal client. OpenAI image variations are implemented through the legacy DALL-E 2 endpoint when the authenticated project has access.","","## Core workflow","","1. Run `ploof whoami <provider>` for the provider you need, usually `openai` or `fal`. If unauthenticated, ask the user to run `ploof login <provider>` or provide the provider API key environment variable in their shell.","2. For one image asset, use `ploof image generate` or `ploof image edit` with an explicit `--out` path.","3. For one video asset, use `ploof video generate --out <path>` so Ploof waits for completion and downloads the MP4.","4. For one audio asset, use `ploof audio generate --out <path>` for TTS, or `ploof audio transcribe/translate --audio <path> --out <path>` for processing.","5. For arbitrary fal.ai endpoints, use `ploof model run --provider fal --model <endpoint-id>` with `--param`, `--json`, and repeated `--input field=path` values.","6. For multiple assets, dependencies, or parallel work, write a YAML manifest and run `ploof run <manifest.yaml>`.","7. Use `--output json` for commands another tool or agent must parse. Use `--output jsonl` for batch streams.","8. After a command completes, verify every path in `outputs` exists before telling the user generation succeeded.","","## Authentication","","```bash","ploof login openai --api-key <key>","ploof login fal --api-key <key>","ploof whoami openai","ploof whoami fal","ploof profiles openai","```","","There is no `ploof auth` namespace. The authentication commands are top-level: `login`, `whoami`, `profiles`, and `logout`.","","Environment variables override stored credentials:","","```bash","PLOOF_OPENAI_API_KEY=...","OPENAI_API_KEY=...","PLOOF_FAL_KEY=...","FAL_KEY=...","PLOOF_FAL_KEY_ID=... PLOOF_FAL_KEY_SECRET=...","FAL_KEY_ID=... FAL_KEY_SECRET=...","```","","Use `--profile <name>` on `login`, `whoami`, `image ...`, `video ...`, `audio ...`, `model run`, and manifest tasks when the user has multiple provider credentials. Never print or store secrets in generated project files.","","## Image generation","","```bash","ploof image generate \\"," --provider openai \\",' --prompt "Studio product photo" \\'," --out assets/hero.png \\"," --model gpt-image-2 \\"," --size 1024x1024 \\"," --quality high \\"," --format png \\"," --output json","```","","OpenAI image generation and editing default to `gpt-image-2` when `--model` is omitted.","","Important: `--format png` controls the generated asset format. `--output json` controls CLI output formatting.","","First-class OpenAI image flags:","","- `--model <model>`: for example `gpt-image-2`.","- `--size <size>`: provider size such as `1024x1024`.","- `--quality <quality>`: provider quality such as `low`, `medium`, or `high` when supported.","- `--format <format>` or `--output-format <format>`: provider image format, usually `png`, `jpeg`, or `webp` when supported.","- `--background <value>`, `--moderation <value>`, `--n <count>`, `--output-compression <number>`, `--partial-images <number>`, `--response-format <format>`, `--style <style>`, `--user <id>`, `--stream`.","- `--param key=value`: pass one provider-specific parameter. Nested keys work, such as `--param extra.foo=bar`.","- `--json '{...}'`: merge a provider-specific JSON object into the request. Explicit first-class flags override overlapping JSON keys.","","Use `--quality low` for cheap smoke tests. Use the user's requested quality and size for final assets.","","## Image editing and context images","","```bash","ploof image edit \\"," --provider openai \\"," --image input.png \\"," --image reference.png \\"," --mask mask.png \\",' --prompt "Replace the background" \\'," --out assets/edited.png \\"," --model gpt-image-2 \\"," --format png \\"," --output json","```","","Pass every source image the provider should see with repeated `--image`. Use `--mask` only when the provider/model supports masked edits. Edit also supports `--input-fidelity <value>`.","","Input assets can be local paths, `http://` or `https://` URLs, or `-` for stdin. Ploof infers common image MIME types from file extensions and preserves generated files locally.","","## Image variations","","```bash","ploof image variation \\"," --provider openai \\"," --image input.png \\"," --out assets/variation.png \\"," --size 1024x1024 \\"," --output json","```","","OpenAI variations default to `dall-e-2`, because OpenAI's legacy variations endpoint currently only supports `dall-e-2`. If OpenAI returns a 404, use `ploof image edit` for image-to-image workflows or try a profile/project with DALL-E 2 variation access. `ploof image variations` is an alias.","","## fal.ai model endpoints","","Use fal.ai when the user asks for a model from fal or when a broad model marketplace is better suited than a first-party provider endpoint.","","```bash","ploof model run \\"," --provider fal \\"," --model fal-ai/flux/dev \\",' --prompt "Small mascot icon for a CLI asset tool" \\'," --param image_size=square_hd \\"," --out assets/fal-icon.png \\"," --output json","```","","Named asset inputs use exact provider field names and can be repeated:","","```bash","ploof model run \\"," --provider fal \\"," --model <fal-endpoint-id> \\",' --prompt "Animate this image into a short loop" \\'," --input image_url=assets/source.png \\"," --param duration=4 \\"," --out assets/loop.mp4 \\"," --output json","```","","Media commands can target fal endpoints when the endpoint schema matches the command shape:","","```bash",'ploof image generate --provider fal --model fal-ai/flux/dev --prompt "Soft clay mascot icon" --param image_size=square_hd --out assets/mascot.png --output json','ploof video generate --provider fal --model <fal-video-endpoint-id> --prompt "Slow camera push" --input-reference assets/ref.png --param duration=4 --out assets/video.mp4 --output json','ploof audio generate --provider fal --model <fal-audio-endpoint-id> --text "Short spoken line." --out assets/audio.mp3 --output json',"```","","fal uses polling queue subscription and writes complete returned files or text outputs to disk. Use `--param key=value` or `--json '{...}'` for endpoint-specific settings. Queue controls: `--start-timeout`, `--timeout`, `--poll-interval`, `--priority low|normal`, and `--storage-expires-in`.","","## Video generation","","```bash","ploof video generate \\"," --provider openai \\",' --prompt "Wide tracking shot of a paper city at blue hour" \\'," --model sora-2 \\"," --size 1280x720 \\"," --seconds 4 \\"," --out assets/clip.mp4 \\"," --output json","```","","OpenAI video generation defaults to `sora-2` when `--model` is omitted. Video jobs are asynchronous. Passing `--out` or `--download` makes Ploof wait for a terminal status and download the requested asset.","","First-class OpenAI video flags:","","- `--model <model>`: for example `sora-2` or `sora-2-pro`.","- `--size <size>`: provider size such as `1280x720`.","- `--seconds <seconds>`: clip or extension duration.","- `--input-reference <path-or-url-or-file-id>`, `--input-reference-file-id <id>`, or `--input-reference-url <url>`: image reference for the first frame.","- `--character <id>`: reusable character id; repeat for multiple characters and mention the character name in the prompt.","- `--wait`, `--download`, `--variant video|thumbnail|spritesheet`, `--poll-interval <seconds>`, `--timeout <seconds>`.","- `--param key=value` and `--json '{...}'` work for provider-specific video settings.","","## Video editing, extension, and library","","```bash","ploof video edit \\"," --video-id video_abc123 \\",' --prompt "Shift the palette to teal and rust" \\'," --out assets/edit.mp4 \\"," --output json","","ploof video extend \\"," --video-id video_abc123 \\",' --prompt "Continue as the camera rises over the rooftops" \\'," --seconds 4 \\"," --out assets/extended.mp4 \\"," --output json","","ploof video download video_abc123 --variant thumbnail --out assets/thumb.webp --output json","ploof video status video_abc123 --output json","ploof video list --limit 20 --output json","```","","Video edits accept `--video-id <id>` for completed OpenAI videos or `--video <path>` for uploaded source videos when the authenticated project is eligible. Extensions accept `--video-id` or `--video`, plus `--seconds`.","","Reusable characters:","","```bash","ploof video character create --name Mossy --video character.mp4 --output json","ploof video character get char_abc123 --output json","```","","## Audio generation and processing","","```bash","ploof audio generate \\"," --provider openai \\",' --text "Short narration for the generated asset." \\'," --model gpt-4o-mini-tts \\"," --voice alloy \\"," --format mp3 \\"," --out assets/narration.mp3 \\"," --output json","","ploof audio transcribe \\"," --audio assets/narration.mp3 \\"," --model gpt-4o-mini-transcribe \\"," --out assets/transcript.json \\"," --output json","","ploof audio translate \\"," --audio assets/spanish.mp3 \\"," --model whisper-1 \\"," --format text \\"," --out assets/translation.txt \\"," --output json","```","","OpenAI audio generation defaults to `gpt-4o-mini-tts`, `alloy`, and `mp3`. OpenAI transcription defaults to `gpt-4o-mini-transcribe` with JSON output. OpenAI translation defaults to `whisper-1` with JSON output.","","First-class audio generation flags:","","- `--model <model>`, `--voice <voice>`, `--voice-id <id>`, `--instructions <text>`, `--format <format>`, `--speed <number>`.","- `--format` or `--response-format` can be `mp3`, `opus`, `aac`, `flac`, `wav`, or `pcm` when supported.","- `--param key=value` and `--json '{...}'` work for provider-specific audio settings.","- Ploof writes complete static audio files. Do not use streaming transport settings such as OpenAI `stream_format=sse`.","","First-class audio processing flags:","","- Transcribe: `--model`, `--language`, `--prompt`, `--format`, `--temperature`, `--include`, `--timestamp-granularity`, `--chunking-strategy`, `--known-speaker-name`, `--known-speaker-reference`.","- Translate: `--model`, `--prompt`, `--format`, `--temperature`.","- Text outputs can be JSON, plain text, SRT, or VTT depending on provider/model support. Do not use streaming transport settings such as OpenAI `stream=true`.","","## Outputs and verification","","`--out <path>` can be a file path or directory. When generating multiple images with `--n`, a file path is expanded with `-1`, `-2`, etc. Video downloads use `.mp4`, thumbnails use `.webp`, and spritesheets use `.jpg`. If `--out` is omitted for image generation, Ploof writes in the current directory using default names like `image.png` or `edited-image.png`.","","Default sidecar metadata is enabled. For each output file, Ploof writes `<output>.json` with the operation, prompt, params, outputs, provider metadata, and timestamp.","","Parseable result shape:","","```json","{",' "kind": "video.generate",',' "provider": "openai",',' "profile": "default",',' "outputs": ["assets/clip.mp4"],',' "metadata": { "video": { "id": "video_...", "status": "completed" } }',"}","```","","Useful global output flags:","","- `--output json|jsonl|compact|table`: choose CLI output format.","- `--fields outputs,metadata.usage.total_tokens`: select fields for parseable outputs.","- `--detail`, `--quiet`, `--no-color`, `--verbose`.","","## Batch manifests","","```yaml","version: 1","parallel: 4","tasks:"," - id: base"," kind: image.generate"," provider: openai"," profile: default",' prompt: "Studio product photo"'," output: assets/base.png"," params:"," model: gpt-image-2"," size: 1024x1024"," quality: high"," output_format: png",""," - id: edit"," kind: image.edit"," provider: openai"," needs: [base]"," inputs:"," images:"," - task: base"," - source: ./reference.png"," mask:"," source: ./mask.png",' prompt: "Add a premium background"'," output: assets/final.png"," params:"," model: gpt-image-2"," size: 1024x1024",""," - id: variation"," kind: image.variation"," provider: openai"," needs: [base]"," inputs:"," images:"," - task: base"," output: assets/variation.png",""," - id: clip"," kind: video.generate"," provider: openai",' prompt: "Slow dolly shot through a miniature paper city"'," output: assets/clip.mp4"," wait: true"," download: true"," params:"," model: sora-2"," size: 1280x720"," seconds: '4'",""," - id: narration"," kind: audio.generate"," provider: openai",' text: "Short narration for the generated clip."'," output: assets/narration.mp3"," params:"," model: gpt-4o-mini-tts"," voice: alloy"," response_format: mp3",""," - id: transcript"," kind: audio.transcribe"," provider: openai"," needs: [narration]"," inputs:"," audio:"," task: narration"," output: assets/transcript.json"," params:"," model: gpt-4o-mini-transcribe",""," - id: fal-icon"," kind: model.run"," provider: fal"," model: fal-ai/flux/dev",' prompt: "Small mascot icon for a CLI tool"'," output: assets/fal-icon.png"," params:"," image_size: square_hd","```","","Run it with:","","```bash","ploof run assets.yaml --parallel 4 --output json","```","","Manifest notes:","","- `version: 1`, `parallel`, and `tasks` are supported.","- Media task kinds default to `provider: openai`; `model.run` defaults to `provider: fal`.","- Task kinds include `model.run`, `image.generate`, `image.edit`, `image.variation`, `video.generate`, `video.edit`, `video.extend`, `video.remix`, `video.status`, `video.download`, `video.list`, `video.delete`, `video.character.create`, `video.character.get`, `audio.generate`, `audio.transcribe`, and `audio.translate`.","- Task fields: `id`, `kind`, `provider`, `profile`, `needs`, `model`, `prompt`, `text`, `output`, `params`, `sidecar`, `inputs`, `videoId`, `characterId`, `name`, `wait`, `download`, `variants`, `pollIntervalMs`, and `timeoutMs`.","- Relative paths are resolved from the manifest file location.","- `inputs.images` accepts strings, `{ source }`, or `{ task }`. `{ task: base }` uses the first output from that completed task.","- `inputs.video`, `inputs.videos`, and `inputs.inputReference` use the same input reference shape.","- `inputs.audio` uses the same input reference shape for transcription and translation.","- `model.run` preserves exact input keys, so `inputs.image_url` maps to the provider input field `image_url`.","- Run `ploof run assets.yaml --dry-run --output json` before expensive batches.","","## Configuration","","```bash","ploof config list","ploof config set output json","ploof config set defaultParallel 4","ploof config set sidecar true","ploof config reset","```","","Config is stored at `~/.ploof/config.json`. Credentials are stored separately at `~/.ploof/credentials.json`.","","## Agent guidance","","- Prefer exact user-provided prompts, dimensions, source images, and output paths. Ask only when a missing choice would change the intended asset.","- Keep prompts and params explicit in commands or manifests.","- Use deterministic output paths, usually under the user's requested asset directory or a temp directory for tests.","- Use manifests for parallel generation, dependency chains, or more than one related asset.","- Keep `--parallel` modest unless the user requests volume; generation costs money and provider rate limits may apply.","- Report generated file paths and any relevant metadata such as model and token usage.","- Do not claim assets were generated unless the command completed successfully and output files exist.","- If a command fails, report the command goal, the error, and the next concrete fix. Do not fabricate assets.","- Run `ploof <command> --help` when a detail is unclear; prefer the installed CLI help over memory."]);function qP(){return ZP(["Usage: ploof learn [options]","","Print AI-agent instructions for using the installed ploof CLI.","","Options:"," --help, -h Show this help","","Examples:"," ploof learn"])}function TP($=[]){if($.includes("--help")||$.includes("-h"))return qP();let w=$.find((J)=>J.trim()!=="");if(w)throw Error(`Unknown learn argument: ${w}
|
|
263
270
|
|
|
264
|
-
${rY()}`);return Qu}import{readFile as di}from"node:fs/promises";import{dirname as mi,extname as ni,resolve as P7}from"node:path";var bM=v8(),FM=mJ(),MM=dN(),P8=nJ(),iM=FJ(),v6=t(),EM=s4(),SM=G$(),AM=w6(),RM=U6(),Wt=sz(),kM=W8(),CM=Y8(),jM=Q8(),J2=p5(),a5=ZJ();var xM=bM.Composer,rM=FM.Document,yM=MM.Schema,dM=P8.YAMLError,mM=P8.YAMLParseError,nM=P8.YAMLWarning,hM=iM.Alias,cM=v6.isAlias,lM=v6.isCollection,tM=v6.isDocument,oM=v6.isMap,pM=v6.isNode,aM=v6.isPair,eM=v6.isScalar,sM=v6.isSeq,$i=EM.Pair,wi=SM.Scalar,Ui=AM.YAMLMap,Ji=RM.YAMLSeq;var vi=kM.Lexer,zi=CM.LineCounter,gi=jM.Parser,O8=J2.parse,Vi=J2.parseAllDocuments,Gi=J2.parseDocument,_i=J2.stringify,Xi=a5.visit,Ii=a5.visitAsync;function e5($){let w=$.credential;if(!w.apiKey)throw Error("No OpenAI API key found. Run 'ploof login openai --api-key <key>' or set PLOOF_OPENAI_API_KEY.");return new r({apiKey:w.apiKey,organization:w.organization,project:w.project,baseURL:w.baseURL})}var $7="sora-2",Ni=1e4,Wi=900000,Yi=new Set(["completed","failed","expired"]);async function w7($,w,U){let v=await Qi(w),J=await t$("video.generate",()=>o$($).create(v));return z2($,w,U,J,v)}async function U7($,w,U){let v=await I7(w),J=await t$("video.edit",()=>o$($).edit(v));return z2($,w,U,J,v)}async function J7($,w,U){let v=await I7(w),J=await t$("video.extend",()=>o$($).extend(v));return z2($,w,U,J,v)}async function v7($,w,U){let v=L8({...w.params,prompt:w.prompt}),J=await t$("video.remix",()=>o$($).remix(w.videoId,v));return z2($,w,U,J,v)}async function z7($,w,U){let v=await t$("video.status",()=>o$($).retrieve(w.videoId));return{id:w.id,kind:"video.status",provider:"openai",profile:U.credential.profile,outputs:[],metadata:{video:v}}}async function g7($,w,U){let v=await N7({client:$,videoId:w.videoId,output:w.output,variants:w.variants}),J={id:w.id,kind:"video.download",provider:"openai",profile:U.credential.profile,outputs:v,metadata:{videoId:w.videoId,variants:w.variants}};if(w.sidecar??U.sidecar??!0)await T6(J,{...w,params:w.params},"video.download");return J}async function V7($,w,U){let v=await t$("video.list",()=>o$($).list(w.params??{}));return{id:w.id,kind:"video.list",provider:"openai",profile:U.credential.profile,outputs:[],metadata:fi(v)}}async function G7($,w,U){let v=await t$("video.delete",()=>o$($).delete(w.videoId));return{id:w.id,kind:"video.delete",provider:"openai",profile:U.credential.profile,outputs:[],metadata:{deleted:v}}}async function _7($,w,U){let v=q8(w.inputs,"video");if(!v)throw Error("A --video input is required to create a character.");let J={...w.params,name:w.name,video:await r4(v)},z=await t$("video.character.create",()=>o$($).createCharacter(J));return{id:w.id,kind:"video.character.create",provider:"openai",profile:U.credential.profile,outputs:[],metadata:{character:z}}}async function X7($,w,U){let v=await t$("video.character.get",()=>o$($).getCharacter(w.characterId));return{id:w.id,kind:"video.character.get",provider:"openai",profile:U.credential.profile,outputs:[],metadata:{character:v}}}async function Qi($){let w=L8({...$.params,model:$.params?.model??$7,prompt:$.prompt}),U=q8($.inputs,"reference");if(U)w.input_reference=await Pi(U);return w}async function I7($){let w=await Oi($),U=L8({...$.params,prompt:$.prompt,video:w});if(!w)throw Error("Provide --video-id or --video.");if(bi(w)&&U.model===void 0)U.model=$7;return U}async function Pi($){if($.source.startsWith("file:"))return{file_id:$.source.slice(5)};if(Mi($.source))return{file_id:$.source};if(Fi($.source)||$.source.startsWith("data:"))return{image_url:$.source};return r4($)}async function Oi($){if($.videoId)return{id:$.videoId};let w=q8($.inputs,"video");return w?r4(w):void 0}async function z2($,w,U,v,J){let z=v,g=s5(v),V=ui(w);if(V){if(!g)throw Error("OpenAI video response did not include a video id.");z=await Bi($,g,w),qi(z)}let _=s5(z)??g,G=Ki(w)&&_?await N7({client:$,videoId:_,output:w.output,variants:w.variants??["video"]}):[],X={id:w.id,kind:w.kind,provider:"openai",profile:U.credential.profile,outputs:G,metadata:{video:z,submitted:v,waited:V,downloaded:G.length>0}};if(G.length>0&&(w.sidecar??U.sidecar??!0))await T6(X,{...w,params:Ti(J)},w.kind);return X}async function Bi($,w,U){let v=Date.now(),J=U.pollIntervalMs??Ni,z=U.timeoutMs??Wi,g=await t$("video.status",()=>o$($).retrieve(w));while(!Yi.has(W7(g))){if(Date.now()-v>z)throw Error(`Timed out waiting for OpenAI video ${w} after ${z}ms.`);await ii(J),g=await t$("video.status",()=>o$($).retrieve(w))}return g}function qi($){let w=W7($);if(w==="completed")return;let U=Di($);throw Error(U?`OpenAI video generation failed: ${U}`:`OpenAI video generation ended with status=${w||"unknown"}.`)}async function N7($){let w=[];for(let U=0;U<$.variants.length;U++){let v=$.variants[U],J=await t$("video.download",()=>o$($.client).downloadContent($.videoId,{variant:v}));w.push(await u3({response:J,output:Li($.output,v,$.variants.length),index:0,total:1,format:B8(v),defaultName:Hi($.videoId,v)}))}return w}function Li($,w,U){if(!$||U<=1||$.endsWith("/"))return $;let v=$.lastIndexOf("."),J=Math.max($.lastIndexOf("/"),$.lastIndexOf("\\"));if(v<=J)return`${$}-${w}.${B8(w)}`;return`${$.slice(0,v)}-${w}.${B8(w)}`}function Hi($,w){return w==="video"?$:`${$}-${w}`}function B8($){switch($){case"thumbnail":return"webp";case"spritesheet":return"jpg";case"video":return"mp4"}}function ui($){return $.wait===!0||Boolean($.output)||$.download===!0}function Ki($){return $.download===!0||Boolean($.output)}function s5($){return v2($,"id")}function W7($){return v2($,"status")??""}function Di($){if(!$||typeof $!=="object")return;let w=$.error;if(!w||typeof w!=="object")return;return v2(w,"message")??v2(w,"code")}function v2($,w){if(!$||typeof $!=="object")return;let U=$[w];return typeof U==="string"?U:void 0}function fi($){let w=$&&typeof $==="object"?$:{};return{data:w.data,has_more:w.has_more,first_id:w.first_id,last_id:w.last_id}}function Ti($){let{input_reference:w,video:U,...v}=$;return v}async function t$($,w){try{return await w()}catch(U){throw Zi($,U)}}function Zi($,w){if(w instanceof Error)return w;return Error(`OpenAI ${$} failed: ${String(w)}`)}function o$($){return $.videos}function q8($,w){return $.find((U)=>U.role===w)}function bi($){return Boolean($&&typeof $==="object"&&"name"in $)}function Fi($){return $.startsWith("http://")||$.startsWith("https://")}function Mi($){return $.startsWith("file-")||$.startsWith("file_")}function ii($){return new Promise((w)=>setTimeout(w,$))}function L8($){let w={};for(let[U,v]of Object.entries($))if(v!==void 0)w[U]=v;return w}var Ei="gpt-image-2",Si="dall-e-2";class F8{id="openai";capabilities=["image.generate","image.edit","image.variation","video.generate","video.edit","video.extend","video.remix","video.status","video.download","video.list","video.delete","video.character.create","video.character.get"];async runImageGenerate($,w){let U=y$(w),v=H8("image.generate",{...$.params,prompt:$.prompt});u8("image.generate",v);let J=await K8("image.generate",()=>f8(U).generate(v)),z=await T8({response:J,output:$.output,format:b8(v),defaultName:$.id??"image"}),g={id:$.id,kind:"image.generate",provider:this.id,profile:w.credential.profile,outputs:z,metadata:Z8(J,v)};if($.sidecar??w.sidecar??!0)await T6(g,{...$,params:D8(v)},"image.generate");return g}async runImageEdit($,w){let U=y$(w),v=$.inputs.filter((N)=>N.role==="image"),J=$.inputs.find((N)=>N.role==="mask");if(v.length===0)throw Error("At least one --image input is required for image edits.");let z=await Promise.all(v.map(r4)),g=J?await r4(J):void 0,V=z.length===1?z[0]:z,_=H8("image.edit",{...$.params,prompt:$.prompt,image:V,...g?{mask:g}:{}});u8("image.edit",_);let G=await K8("image.edit",()=>f8(U).edit(_)),X=await T8({response:G,output:$.output,format:b8(_),defaultName:$.id??"edited-image"}),I={id:$.id,kind:"image.edit",provider:this.id,profile:w.credential.profile,outputs:X,metadata:Z8(G,_)};if($.sidecar??w.sidecar??!0)await T6(I,{...$,params:D8(_)},"image.edit");return I}async runImageVariation($,w){let U=y$(w),v=$.inputs.find((G)=>G.role==="image");if(!v)throw Error("An --image input is required for image variations.");let J=await r4(v),z=H8("image.variation",{...$.params,image:J});u8("image.variation",z);let g=await K8("image.variation",()=>f8(U).createVariation(z)),V=await T8({response:g,output:$.output,format:b8(z),defaultName:$.id??"variation"}),_={id:$.id,kind:"image.variation",provider:this.id,profile:w.credential.profile,outputs:V,metadata:Z8(g,z)};if($.sidecar??w.sidecar??!0)await T6(_,{...$,params:D8(z)},"image.variation");return _}async runVideoGenerate($,w){return w7(y$(w),$,w)}async runVideoEdit($,w){return U7(y$(w),$,w)}async runVideoExtend($,w){return J7(y$(w),$,w)}async runVideoRemix($,w){return v7(y$(w),$,w)}async runVideoStatus($,w){return z7(y$(w),$,w)}async runVideoDownload($,w){return g7(y$(w),$,w)}async runVideoList($,w){return V7(y$(w),$,w)}async runVideoDelete($,w){return G7(y$(w),$,w)}async runVideoCharacterCreate($,w){return _7(y$(w),$,w)}async runVideoCharacterGet($,w){return X7(y$(w),$,w)}}function H8($,w){return{...w,model:w.model??($==="image.variation"?Si:Ei)}}function u8($,w){let U=typeof w.model==="string"?w.model:void 0;if($==="image.variation"&&U&&U!=="dall-e-2")throw Error("OpenAI image variations currently only support model=dall-e-2.");if(!U)return;if(ki(U)&&w.response_format!==void 0)throw Error("`response_format` is only supported for DALL-E image models. GPT image models return base64 image data.");if(Ci(U)){if(w.background==="transparent")throw Error("`background=transparent` is not supported by gpt-image-2. Use `background=auto` or `background=opaque`.");if(w.input_fidelity!==void 0)throw Error("`input_fidelity` is not configurable for gpt-image-2; omit it because gpt-image-2 processes image inputs at high fidelity automatically.")}}async function K8($,w){try{return await w()}catch(U){throw Ai($,U)}}function Ai($,w){let U=Ri(w);if($==="image.variation"&&U===404){let v=Error("OpenAI image variations returned 404. The variations endpoint is legacy and only supports dall-e-2; this usually means the current API key or project cannot access that endpoint. Use `ploof image edit` for image-to-image workflows, or try a profile/project with DALL-E 2 variation access.");return v.cause=w,v}if(w instanceof Error)return w;return Error(String(w))}function Ri($){if(!$||typeof $!=="object")return;let w=$,U=w.status??w.statusCode;return typeof U==="number"?U:void 0}function D8($){let{image:w,mask:U,...v}=$;return v}function ki($){return $.startsWith("gpt-image-")||$==="chatgpt-image-latest"}function Ci($){return $==="gpt-image-2"||$.startsWith("gpt-image-2-")}function y$($){return e5($)}function f8($){return $.images}async function T8($){if(ri($.response))return ji($);let w=Y7($.response),U=w.length,v=[];for(let J=0;J<w.length;J++){let z=w[J];if(z.b64_json)v.push(await E0({data:z.b64_json,output:$.output,index:J,total:U,format:$.format,defaultName:$.defaultName}));else if(z.url)v.push(await H3({url:z.url,output:$.output,index:J,total:U,format:$.format,defaultName:$.defaultName}))}if(v.length===0)throw Error("OpenAI response did not include image data or URLs.");return v}async function ji($){let w=[];for await(let v of $.response)w.push(...xi(v));if(w.length===0)throw Error("OpenAI stream did not include image data.");let U=[];for(let v=0;v<w.length;v++)U.push(await E0({data:w[v],output:$.output,index:v,total:w.length,format:$.format,defaultName:$.defaultName}));return U}function Z8($,w){let U=$&&typeof $==="object"?$:{};return{model:w?.model,created:U.created,usage:U.usage,revisedPrompts:Y7($).map((v)=>v.revised_prompt).filter(Boolean)}}function Y7($){if(!$||typeof $!=="object")return[];let w=$.data;return Array.isArray(w)?w:[]}function xi($){if(!$||typeof $!=="object")return[];let w=[],U=(v)=>{if(!v||typeof v!=="object")return;for(let[J,z]of Object.entries(v))if(typeof z==="string"&&(J==="b64_json"||J==="partial_image_b64"||J==="image_b64"))w.push(z);else if(typeof z==="object")U(z)};return U($),w}function b8($){return $?.output_format??$?.format}function ri($){return Boolean($&&typeof $==="object"&&Symbol.asyncIterator in $)}var yi=[new F8];function g2($){let w=yi.find((U)=>U.id===$);if(!w)throw Error(`Unknown provider: ${$}`);return w}var pJ=C.union([C.string(),C.object({source:C.string().optional(),task:C.string().optional(),mime:C.string().optional(),name:C.string().optional()})]),hi=C.object({id:C.string(),kind:C.enum(["image.generate","image.edit","image.variation","video.generate","video.edit","video.extend","video.remix","video.status","video.download","video.list","video.delete","video.character.create","video.character.get"]),provider:C.string().default("openai"),profile:C.string().optional(),needs:C.array(C.string()).default([]),prompt:C.string().optional(),params:C.record(C.string(),C.unknown()).default({}),output:C.string().optional(),sidecar:C.boolean().optional(),videoId:C.string().optional(),characterId:C.string().optional(),name:C.string().optional(),wait:C.boolean().optional(),download:C.boolean().optional(),variants:C.array(C.enum(["video","thumbnail","spritesheet"])).optional(),pollIntervalMs:C.number().int().nonnegative().optional(),timeoutMs:C.number().int().nonnegative().optional(),inputs:C.object({images:C.array(pJ).optional(),mask:pJ.optional(),video:pJ.optional(),videos:C.array(pJ).optional(),inputReference:pJ.optional()}).optional()}),ci=C.object({version:C.union([C.literal(1),C.string()]).default(1),parallel:C.number().int().positive().optional(),tasks:C.array(hi).min(1)});async function li($){let w=await di($,"utf-8"),v=ni($).toLowerCase()===".json"?JSON.parse(w):O8(w),J=ci.parse(v);return ti(J),J}async function O7($,w={}){let U=await li($),v=w.parallel??U.parallel??4,J=mi(P7($));if(w.dryRun)return U.tasks.map((I)=>({id:I.id,kind:I.kind,provider:I.provider,profile:I.profile,outputs:I.output?[V2(J,I.output)]:[],metadata:{dryRun:!0,needs:I.needs}}));let z=w.auth??new T4,g=new Map,V=new Map,_=new Map(U.tasks.map((I)=>[I.id,I])),G=[],X;while(_.size>0||V.size>0){if(X)throw X;for(let[I,N]of[..._]){if(V.size>=v)break;if(!N.needs.every((P)=>g.has(P)))continue;_.delete(I);let W=pi(N,{auth:z,baseDir:J,completed:g,verbose:w.verbose,sidecar:w.config?.get("sidecar")??!0}).then((P)=>{g.set(I,P),G.push(P)}).catch((P)=>{X=P}).finally(()=>{V.delete(I)});V.set(I,W)}if(V.size===0&&_.size>0)throw Error("Manifest has unresolved dependencies.");if(V.size>0)await Promise.race(V.values())}if(X)throw X;return G}function ti($){let w=new Set;for(let U of $.tasks){if(w.has(U.id))throw Error(`Duplicate task id: ${U.id}`);w.add(U.id)}for(let U of $.tasks){if(oi(U.kind)&&!U.prompt)throw Error(`Task ${U.id} requires a prompt.`);if(U.kind==="image.variation"&&!U.inputs?.images?.length)throw Error(`Task ${U.id} requires inputs.images.`);if(["video.edit","video.extend"].includes(U.kind)&&!U.videoId&&!U.inputs?.video&&!U.inputs?.videos?.length)throw Error(`Task ${U.id} requires videoId or inputs.video.`);if(["video.status","video.download","video.delete","video.remix"].includes(U.kind)&&!U.videoId)throw Error(`Task ${U.id} requires videoId.`);if(U.kind==="video.character.create"){if(!U.name)throw Error(`Task ${U.id} requires name.`);if(!U.inputs?.video&&!U.inputs?.videos?.length)throw Error(`Task ${U.id} requires inputs.video.`)}if(U.kind==="video.character.get"&&!U.characterId)throw Error(`Task ${U.id} requires characterId.`);for(let v of U.needs)if(!w.has(v))throw Error(`Task ${U.id} depends on unknown task ${v}.`)}}function oi($){return["image.generate","image.edit","video.generate","video.edit","video.extend","video.remix"].includes($)}async function pi($,w){let U=g2($.provider),v=w.auth.getCredential($.provider,$.profile);if(!v?.apiKey)throw Error(`No credentials found for ${$.provider}. Run 'ploof login ${$.provider}'.`);let J={id:$.id,kind:$.kind,provider:$.provider,profile:$.profile,prompt:$.prompt??"",params:$.params,output:$.output?V2(w.baseDir,$.output):void 0,sidecar:$.sidecar??w.sidecar};if($.kind==="image.generate")return U.runImageGenerate({...J,kind:"image.generate"},{credential:v,verbose:w.verbose,sidecar:J.sidecar});let z=ai($,w);if($.kind==="image.variation")return U.runImageVariation({...J,kind:"image.variation",inputs:z},{credential:v,verbose:w.verbose,sidecar:J.sidecar});if($.kind==="image.edit")return U.runImageEdit({...J,kind:"image.edit",inputs:z},{credential:v,verbose:w.verbose,sidecar:J.sidecar});let g={wait:$.wait,download:$.download,variants:$.variants,pollIntervalMs:$.pollIntervalMs,timeoutMs:$.timeoutMs},V={credential:v,verbose:w.verbose,sidecar:J.sidecar};switch($.kind){case"video.generate":return U.runVideoGenerate({...J,kind:"video.generate",inputs:z,...g},V);case"video.edit":return U.runVideoEdit({...J,kind:"video.edit",inputs:z,videoId:$.videoId,...g},V);case"video.extend":return U.runVideoExtend({...J,kind:"video.extend",inputs:z,videoId:$.videoId,...g},V);case"video.remix":return U.runVideoRemix({...J,kind:"video.remix",videoId:$.videoId??"",...g},V);case"video.status":return U.runVideoStatus({...J,kind:"video.status",videoId:$.videoId??""},V);case"video.download":return U.runVideoDownload({...J,kind:"video.download",videoId:$.videoId??"",variants:$.variants??["video"]},V);case"video.list":return U.runVideoList({...J,kind:"video.list"},V);case"video.delete":return U.runVideoDelete({...J,kind:"video.delete",videoId:$.videoId??""},V);case"video.character.create":return U.runVideoCharacterCreate({...J,kind:"video.character.create",name:$.name??"",inputs:z},V);case"video.character.get":return U.runVideoCharacterGet({...J,kind:"video.character.get",characterId:$.characterId??""},V)}}function ai($,w){let U=[];for(let v of $.inputs?.images??[])U.push(aJ("image",v,w));if($.inputs?.mask)U.push(aJ("mask",$.inputs.mask,w));if($.inputs?.inputReference)U.push(aJ("reference",$.inputs.inputReference,w));if($.inputs?.video)U.push(aJ("video",$.inputs.video,w));for(let v of $.inputs?.videos??[])U.push(aJ("video",v,w));return U}function aJ($,w,U){if(typeof w==="string")return{role:$,source:Q7(w,U)};return{role:$,source:Q7(w,U),mime:w.mime,name:w.name}}function Q7($,w){if(typeof $==="string")return V2(w.baseDir,$);if($.task){let v=w.completed.get($.task)?.outputs[0];if(!v)throw Error(`Task output not available: ${$.task}`);return v}if($.source)return V2(w.baseDir,$.source);throw Error("Input reference must include source or task.")}function V2($,w){if(w.startsWith("/")||w.startsWith("http://")||w.startsWith("https://")||w==="-")return w;return P7($,w)}function B7($,w,U,v){let J=$??U??w;if(J&&J!=="auto"){if(UE(J))return J;throw Error(`Invalid output format: ${J}`)}return v?"table":"compact"}function q7($,w){let U=Array.isArray($)?$:[$],v=w.fields?.length?U.map((J)=>$E(J,w.fields)):U;switch(w.format){case"json":return JSON.stringify(Array.isArray($)?v:v[0],null,2);case"jsonl":return v.map((J)=>JSON.stringify(J)).join(`
|
|
265
|
-
`);case"table":return
|
|
266
|
-
`)}}function
|
|
267
|
-
`)}function
|
|
271
|
+
${qP()}`);return yS}import{readFile as rr}from"node:fs/promises";import{dirname as nr,extname as dr,resolve as ju}from"node:path";var Jr=YY(),Ur=r0(),Vr=ag(),TY=n0(),Gr=D0(),b6=p(),zr=A6(),ir=I$(),Xr=_6(),Nr=k6(),CJ$=gi(),Wr=FY(),Ir=qY(),gr=ZY(),Oi=ku(),Ru=Z0();var Yr=Jr.Composer,vr=Ur.Document,Qr=Vr.Schema,Or=TY.YAMLError,Pr=TY.YAMLParseError,Kr=TY.YAMLWarning,ur=Gr.Alias,Br=b6.isAlias,Hr=b6.isCollection,Fr=b6.isDocument,qr=b6.isMap,Zr=b6.isNode,Tr=b6.isPair,Dr=b6.isScalar,Lr=b6.isSeq,fr=zr.Pair,Mr=ir.Scalar,Ar=Xr.YAMLMap,Sr=Nr.YAMLSeq;var _r=Wr.Lexer,kr=Ir.LineCounter,Rr=gr.Parser,DY=Oi.parse,br=Oi.parseAllDocuments,Er=Oi.parseDocument,Cr=Oi.stringify,jr=Ru.visit,xr=Ru.visitAsync;var bu=["model.run","image.generate","image.edit","image.variation","video.generate","video.edit","video.extend","video.remix","video.status","video.download","video.list","video.delete","video.character.create","video.character.get","audio.generate","audio.transcribe","audio.translate"];var Eu=j.union([j.string(),j.object({source:j.string().optional(),task:j.string().optional(),mime:j.string().optional(),name:j.string().optional()})]),mr=j.union([Eu,j.array(Eu)]),yr=j.object({id:j.string(),kind:j.enum(bu),provider:j.string().optional(),profile:j.string().optional(),needs:j.array(j.string()).default([]),model:j.string().optional(),prompt:j.string().optional(),text:j.string().optional(),params:j.record(j.string(),j.unknown()).default({}),output:j.string().optional(),sidecar:j.boolean().optional(),videoId:j.string().optional(),characterId:j.string().optional(),name:j.string().optional(),wait:j.boolean().optional(),download:j.boolean().optional(),variants:j.array(j.enum(["video","thumbnail","spritesheet"])).optional(),pollIntervalMs:j.number().int().nonnegative().optional(),timeoutMs:j.number().int().nonnegative().optional(),inputs:j.record(j.string(),mr).optional()}),hr=j.object({version:j.union([j.literal(1),j.string()]).default(1),parallel:j.number().int().positive().optional(),tasks:j.array(yr).min(1)});async function cr($){let w=await rr($,"utf-8"),V=dr($).toLowerCase()===".json"?JSON.parse(w):DY(w),U=hr.parse(V);return lr(U),U}async function xu($,w={}){let J=await cr($),V=w.parallel??J.parallel??4,U=nr(ju($));if(w.dryRun)return J.tasks.map((I)=>({id:I.id,kind:I.kind,provider:ru(I),profile:I.profile,outputs:I.output?[Ki(U,I.output)]:[],metadata:{dryRun:!0,needs:I.needs}}));let G=w.auth??new o4,z=new Map,i=new Map,N=new Map(J.tasks.map((I)=>[I.id,I])),X=[],W;while(N.size>0||i.size>0){if(W)throw W;for(let[I,g]of[...N]){if(i.size>=V)break;if(!g.needs.every((v)=>z.has(v)))continue;N.delete(I);let Y=or(g,{auth:G,baseDir:U,completed:z,verbose:w.verbose,sidecar:w.config?.get("sidecar")??!0}).then((v)=>{z.set(I,v),X.push(v)}).catch((v)=>{W=v}).finally(()=>{i.delete(I)});i.set(I,Y)}if(i.size===0&&N.size>0)throw Error("Manifest has unresolved dependencies.");if(i.size>0)await Promise.race(i.values())}if(W)throw W;return X}function lr($){let w=new Set;for(let J of $.tasks){if(w.has(J.id))throw Error(`Duplicate task id: ${J.id}`);w.add(J.id)}for(let J of $.tasks){if(tr(J.kind)&&!J.prompt)throw Error(`Task ${J.id} requires a prompt.`);if(J.kind==="audio.generate"&&!J.text&&!J.prompt)throw Error(`Task ${J.id} requires text.`);if(J.kind==="model.run"&&!J.model&&typeof J.params.model!=="string")throw Error(`Task ${J.id} requires model.`);if(["audio.transcribe","audio.translate"].includes(J.kind)&&!Pi(J,"audio"))throw Error(`Task ${J.id} requires inputs.audio.`);if(J.kind==="image.variation"&&!Pi(J,"image"))throw Error(`Task ${J.id} requires inputs.images.`);if(["video.edit","video.extend"].includes(J.kind)&&!J.videoId&&!Pi(J,"video"))throw Error(`Task ${J.id} requires videoId or inputs.video.`);if(["video.status","video.download","video.delete","video.remix"].includes(J.kind)&&!J.videoId)throw Error(`Task ${J.id} requires videoId.`);if(J.kind==="video.character.create"){if(!J.name)throw Error(`Task ${J.id} requires name.`);if(!Pi(J,"video"))throw Error(`Task ${J.id} requires inputs.video.`)}if(J.kind==="video.character.get"&&!J.characterId)throw Error(`Task ${J.id} requires characterId.`);for(let V of J.needs)if(!w.has(V))throw Error(`Task ${J.id} depends on unknown task ${V}.`)}}function Pi($,w){for(let[J,V]of Object.entries($.inputs??{})){if(nu(J)!==w)continue;if((Array.isArray(V)?V:[V]).length>0)return!0}return!1}function tr($){return["image.generate","image.edit","video.generate","video.edit","video.extend","video.remix"].includes($)}async function or($,w){let J=ru($),V=qz(J),U=w.auth.getCredential(J,$.profile);if(!U?.apiKey)throw Error(`No credentials found for ${J}. Run 'ploof login ${J}'.`);let G={id:$.id,kind:$.kind,provider:J,profile:$.profile,prompt:$.prompt??"",params:$.params,output:$.output?Ki(w.baseDir,$.output):void 0,sidecar:$.sidecar??w.sidecar},z=ar($,w),i={wait:$.wait,download:$.download,variants:$.variants,pollIntervalMs:$.pollIntervalMs,timeoutMs:$.timeoutMs},N={credential:U,verbose:w.verbose,sidecar:G.sidecar},X=pr($,G,z,i);return V.run(X,N)}function ru($){return $.provider??($.kind==="model.run"?"fal":"openai")}function pr($,w,J,V){switch($.kind){case"model.run":return{...w,kind:"model.run",model:$.model??String($.params.model??""),inputs:J};case"image.generate":return{...w,kind:"image.generate",prompt:w.prompt??""};case"image.variation":return{...w,kind:"image.variation",inputs:J};case"image.edit":return{...w,kind:"image.edit",prompt:w.prompt??"",inputs:J};case"video.generate":return{...w,kind:"video.generate",prompt:w.prompt??"",inputs:J,...V};case"video.edit":return{...w,kind:"video.edit",prompt:w.prompt??"",inputs:J,videoId:$.videoId,...V};case"video.extend":return{...w,kind:"video.extend",prompt:w.prompt??"",inputs:J,videoId:$.videoId,...V};case"video.remix":return{...w,kind:"video.remix",prompt:w.prompt??"",videoId:$.videoId??"",...V};case"video.status":return{...w,kind:"video.status",videoId:$.videoId??""};case"video.download":return{...w,kind:"video.download",videoId:$.videoId??"",variants:$.variants??["video"]};case"video.list":return{...w,kind:"video.list"};case"video.delete":return{...w,kind:"video.delete",videoId:$.videoId??""};case"video.character.create":return{...w,kind:"video.character.create",name:$.name??"",inputs:J};case"video.character.get":return{...w,kind:"video.character.get",characterId:$.characterId??""};case"audio.generate":return{...w,kind:"audio.generate",input:$.text??$.prompt??""};case"audio.transcribe":return{...w,kind:"audio.transcribe",inputs:J};case"audio.translate":return{...w,kind:"audio.translate",inputs:J}}}function ar($,w){let J=[];for(let[V,U]of Object.entries($.inputs??{})){let G=nu(V),z=Array.isArray(U)?U:[U];for(let i of z)J.push(er(G,i,w))}return J}function nu($){return{image:"image",images:"image",mask:"mask",reference:"reference",references:"reference",inputReference:"reference",style:"style",styles:"style",audio:"audio",video:"video",videos:"video"}[$]??$}function er($,w,J){if(typeof w==="string")return{role:$,source:Cu(w,J)};return{role:$,source:Cu(w,J),mime:w.mime,name:w.name}}function Cu($,w){if(typeof $==="string")return Ki(w.baseDir,$);if($.task){let V=w.completed.get($.task)?.outputs[0];if(!V)throw Error(`Task output not available: ${$.task}`);return V}if($.source)return Ki(w.baseDir,$.source);throw Error("Input reference must include source or task.")}function Ki($,w){if(w.startsWith("/")||w.startsWith("http://")||w.startsWith("https://")||w==="-")return w;return ju($,w)}function du($,w,J,V){let U=$??J??w;if(U&&U!=="auto"){if(Un(U))return U;throw Error(`Invalid output format: ${U}`)}return V?"table":"compact"}function mu($,w){let J=Array.isArray($)?$:[$],V=w.fields?.length?J.map((U)=>wn(U,w.fields)):J;switch(w.format){case"json":return JSON.stringify(Array.isArray($)?V:V[0],null,2);case"jsonl":return V.map((U)=>JSON.stringify(U)).join(`
|
|
272
|
+
`);case"table":return $n(J,w);case"compact":return J.map(sr).join(`
|
|
273
|
+
`)}}function sr($){return`asset ${[$.id?`id=${$.id}`:void 0,`kind=${$.kind}`,`provider=${$.provider}`,$.profile?`profile=${$.profile}`:void 0,`outputs=${$.outputs.join(",")}`].filter(Boolean).join(" ")}`}function $n($,w){if($.length===0)return"No results.";let J=$.map((i)=>({id:i.id??"-",kind:i.kind,provider:i.provider,outputs:i.outputs.join(", ")})),V=["ID","Kind","Provider","Outputs"],U=[Math.max(V[0].length,...J.map((i)=>i.id.length)),Math.max(V[1].length,...J.map((i)=>i.kind.length)),Math.max(V[2].length,...J.map((i)=>i.provider.length)),Math.max(V[3].length,...J.map((i)=>i.outputs.length))],G=w.noColor?(i)=>i:Lz.bold,z=[V.map((i,N)=>G(i.padEnd(U[N]))).join(" "),U.map((i)=>"-".repeat(i)).join(" ")];for(let i of J)z.push([i.id.padEnd(U[0]),i.kind.padEnd(U[1]),i.provider.padEnd(U[2]),i.outputs.padEnd(U[3])].join(" "));return z.join(`
|
|
274
|
+
`)}function wn($,w){let J={};for(let V of w)J[V]=Jn($,V);return J}function Jn($,w){let J=$;for(let V of w.split(".")){if(!J||typeof J!=="object")return;J=J[V]}return J}function Un($){return["table","compact","json","jsonl"].includes($)}function K4($){let w={},J=$===void 0?[]:Array.isArray($)?$:[$];for(let V of J){let U=V.indexOf("=");if(U===-1)throw Error(`Invalid --param value "${V}". Use key=value.`);let G=V.slice(0,U).trim(),z=V.slice(U+1).trim();if(!G)throw Error(`Invalid --param value "${V}". Key is empty.`);Vn(w,G,Gn(z))}return w}function X4($){if(!$)return{};try{let w=JSON.parse($);if(!w||typeof w!=="object"||Array.isArray(w))throw Error("JSON override must be an object.");return w}catch(w){if(w instanceof Error)throw Error(`Invalid --json value: ${w.message}`);throw w}}function N4(...$){let w={};for(let J of $){if(!J)continue;for(let[V,U]of Object.entries(J))if(LY(U)&&LY(w[V]))w[V]=N4(w[V],U);else w[V]=U}return w}function Vn($,w,J){let V=w.split(".").filter(Boolean),U=$;for(let G=0;G<V.length;G++){let z=V[G];if(G===V.length-1){U[z]=J;return}if(!LY(U[z]))U[z]={};U=U[z]}}function Gn($){if($==="true")return!0;if($==="false")return!1;if($==="null")return null;if(/^-?\d+(\.\d+)?$/.test($))return Number($);if($.startsWith("{")&&$.endsWith("}")||$.startsWith("[")&&$.endsWith("]"))try{return JSON.parse($)}catch{return $}return $}function LY($){return Boolean($&&typeof $==="object"&&!Array.isArray($))}import{existsSync as zn,mkdirSync as Xn,writeFileSync as Nn}from"node:fs";import{dirname as yu,join as hu}from"node:path";var Wn=`---
|
|
268
275
|
name: asset-generation
|
|
269
|
-
description: Generate, edit, or batch-create AI assets with the ploof CLI. Use when working with generated images, provider auth, asset manifests, image context inputs, masks, or agent-driven creative asset workflows.
|
|
276
|
+
description: Generate, edit, process, or batch-create AI assets with the ploof CLI. Use when working with generated images, videos, audio, arbitrary provider model endpoints, provider auth, asset manifests, image/video/audio context inputs, masks, OpenAI media jobs, fal.ai models, or agent-driven creative asset workflows.
|
|
270
277
|
---
|
|
271
278
|
|
|
272
279
|
# Learn ploof from the CLI
|
|
@@ -282,32 +289,32 @@ Follow the instructions printed by \`ploof learn\`. That output is the canonical
|
|
|
282
289
|
If \`ploof learn\` is unavailable because the CLI is not installed, ask the user to install \`@miketromba/ploof\` first, then rerun \`ploof learn\`.
|
|
283
290
|
|
|
284
291
|
Do not rely on this skill file for operational details. It is only a bootstrap adapter that points agents to \`ploof learn\`.
|
|
285
|
-
`;function
|
|
292
|
+
`;function cu($){let w=$??hu(RJ(),"skills","asset-generation"),J=hu(w,"SKILL.md");if(!zn(yu(J)))Xn(yu(J),{recursive:!0});return Nn(J,Wn),J}var In="0.4.0";function su(){let $=new oY().name("ploof").description("AI asset generation CLI for images, audio, video, and provider-backed creative workflows").version(In).showSuggestionAfterError().addHelpText("after",`
|
|
286
293
|
Getting started:
|
|
287
294
|
$ ploof login openai --api-key <your-api-key>
|
|
288
295
|
$ ploof image generate --prompt "Studio product photo" --out assets/hero.png
|
|
289
296
|
$ ploof learn
|
|
290
297
|
|
|
291
|
-
Use "ploof <command> --help" for more information about a command.`);return $.option("-o, --output <format>","Output format: auto|table|compact|json|jsonl").option("-f, --fields <list>","Comma-separated field list").option("-d, --detail","Full detail view").option("--no-color","Disable color").option("--verbose","Debug output to stderr").option("-q, --quiet","Data only, no hints").option("-y, --yes","Skip confirmation prompts"),
|
|
298
|
+
Use "ploof <command> --help" for more information about a command.`);return $.option("-o, --output <format>","Output format: auto|table|compact|json|jsonl").option("-f, --fields <list>","Comma-separated field list").option("-d, --detail","Full detail view").option("--no-color","Disable color").option("--verbose","Debug output to stderr").option("-q, --quiet","Data only, no hints").option("-y, --yes","Skip confirmation prompts"),gn($),Yn($),Hn($),Fn($),qn($),Zn($),Tn($),Dn($),Ln($),$.configureOutput({writeErr:(w)=>process.stderr.write(w),writeOut:(w)=>process.stdout.write(w)}),$.exitOverride((w)=>{if(w.code==="commander.helpDisplayed"||w.code==="commander.version")process.exit(0);throw w}),$}function gn($){let w=$.command("config").description("CLI configuration management").addHelpText("after",`
|
|
292
299
|
Examples:
|
|
293
300
|
$ ploof config list
|
|
294
301
|
$ ploof config get output
|
|
295
302
|
$ ploof config set output compact
|
|
296
|
-
$ ploof config reset`);w.command("list").description("List all config values").action(
|
|
297
|
-
`)})),w.command("get <key>").description("Get a config value").action(
|
|
298
|
-
`)})),w.command("set <key> <value>").description("Set a config value").action(
|
|
299
|
-
`)})),w.command("reset").description("Reset to defaults").action(
|
|
300
|
-
`)}))}function
|
|
301
|
-
`)}))}function
|
|
303
|
+
$ ploof config reset`);w.command("list").description("List all config values").action(w$(()=>{let J=new p4().list();for(let[V,U]of Object.entries(J))process.stdout.write(`${V}=${JSON.stringify(U)}
|
|
304
|
+
`)})),w.command("get <key>").description("Get a config value").action(w$((J)=>{let V=new p4;process.stdout.write(`${JSON.stringify(eu(V,J))}
|
|
305
|
+
`)})),w.command("set <key> <value>").description("Set a config value").action(w$((J,V)=>{let U=new p4;yn(U,J,mn(V)),process.stdout.write(`Set ${J}=${JSON.stringify(eu(U,J))}
|
|
306
|
+
`)})),w.command("reset").description("Reset to defaults").action(w$(()=>{new p4().reset(),process.stdout.write(`Config reset to defaults.
|
|
307
|
+
`)}))}function Yn($){vn($),Qn($),On($),Pn($)}function vn($){$.command("login <provider>").description("Store provider credentials").option("--api-key <key>","Provider API key").option("--profile <name>","Profile name","default").option("--organization <id>","OpenAI organization id").option("--project <id>","OpenAI project id").option("--base-url <url>","Provider base URL").option("--no-default","Do not set this profile as default").action(w$(async(w,J)=>{let V=Pw(w);if(!V?.auth)throw new K$(`Unsupported provider for auth: ${w}`,2);let U=V.auth,G=J.profile??"default",z=await Kn(w,J.apiKey);new o4().login(w,G,{apiKey:z,organization:J.organization??fY(U.organizationEnvVar),project:J.project??fY(U.projectEnvVar),baseURL:J.baseUrl??fY(U.baseURLEnvVar)},J.default??!0),process.stdout.write(`Authenticated ${w} profile=${G}.
|
|
308
|
+
`)}))}function Qn($){$.command("logout <provider>").description("Remove stored credentials").option("--profile <name>","Profile name").action(w$((w,J)=>{let V=new o4().logout(w,J.profile);process.stdout.write(V?`Logged out ${w}${J.profile?` profile=${J.profile}`:""}.
|
|
302
309
|
`:`No stored credentials found for ${w}.
|
|
303
|
-
`)}))}function
|
|
304
|
-
`);return}process.stdout.write(`${[`Authenticated: provider=${
|
|
305
|
-
`)}))}function
|
|
306
|
-
`);return}for(let[
|
|
307
|
-
`)}))}async function
|
|
308
|
-
`)},
|
|
309
|
-
`||G==="\x04"){g(),w(v.trim());return}if(G==="\x03"){g(),U(new O$("Login cancelled.",130));return}if(G===""||G==="\b"){v=v.slice(0,-1);continue}if(G>=" ")v+=G}};process.stdout.write(`${$}: `),J.setEncoding("utf8"),J.resume(),J.setRawMode(!0),J.on("data",V)})}function LE($){let w=$.command("image").description("Generate and edit image assets"),U=w.command("generate").description("Generate images").requiredOption("--prompt <prompt>","Image prompt").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output file or directory");K7(U),U.action(J$(async(z,g)=>{let V={...g.optsWithGlobals(),...z},_=D7(V),G={kind:"image.generate",provider:V.provider??"openai",profile:V.profile,prompt:V.prompt??"",output:V.out,params:_};await d$(G,V)}));let v=w.command("edit").description("Edit images with optional context images and masks").requiredOption("--prompt <prompt>","Edit prompt").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--image <path>","Input/context image path or URL",M4,[]).option("--mask <path>","Mask image path or URL").option("--out <path>","Output file or directory");K7(v),v.option("--input-fidelity <value>","OpenAI input fidelity"),v.action(J$(async(z,g)=>{let V={...g.optsWithGlobals(),...z};if(!V.image||V.image.length===0)throw new O$("At least one --image is required.",2);let _=D7(V),G={kind:"image.edit",provider:V.provider??"openai",profile:V.profile,prompt:V.prompt??"",output:V.out,params:_,inputs:Jg(V.image,V.mask)};await d$(G,V)}));let J=w.command("variation").alias("variations").description("Create image variations").requiredOption("--image <path>","Input image path or URL").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output file or directory");fE(J),J.action(J$(async(z,g)=>{let V={...g.optsWithGlobals(),...z},_=TE(V),G=typeof V.image==="string"?V.image:"",X={kind:"image.variation",provider:V.provider??"openai",profile:V.profile,output:V.out,params:_,inputs:Jg(G,void 0)};await d$(X,V)}))}function HE($){let w=$.command("video").description("Generate, edit, extend, inspect, and download video assets"),U=w.command("generate").alias("create").description("Create an OpenAI video generation job").requiredOption("--prompt <prompt>","Video prompt").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output file or directory").option("--input-reference <path-or-url-or-file-id>","Image reference path, URL, data URL, or file id").option("--input-reference-file-id <id>","Uploaded image file id").option("--input-reference-url <url>","Image URL or data URL reference").option("--character <id>","Reusable character id",M4,[]);i8(U),U.action(J$(async(V,_)=>{let G={..._.optsWithGlobals(),...V},X={kind:"video.generate",provider:G.provider??"openai",profile:G.profile,prompt:G.prompt??"",output:G.out,params:ZE(G),inputs:ME(G),...G2(G)};await d$(X,G)}));let v=w.command("edit").description("Create a video edit job from a completed video id or upload").requiredOption("--prompt <prompt>","Edit prompt").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--video-id <id>","Completed OpenAI video id").option("--video <path>","Source video path or URL").option("--out <path>","Output file or directory");i8(v),v.action(J$(async(V,_)=>{let G={..._.optsWithGlobals(),...V};if(!G.videoId&&!G.video)throw new O$("Provide --video-id or --video.",2);let X={kind:"video.edit",provider:G.provider??"openai",profile:G.profile,prompt:G.prompt??"",output:G.out,params:f7(G),videoId:G.videoId,inputs:E8(G.video),...G2(G)};await d$(X,G)}));let J=w.command("extend").description("Create a video extension job").requiredOption("--prompt <prompt>","Extension prompt").requiredOption("--seconds <seconds>","New segment duration").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--video-id <id>","Completed OpenAI video id").option("--video <path>","Source video path or URL").option("--out <path>","Output file or directory");i8(J,{includeSeconds:!1}),J.action(J$(async(V,_)=>{let G={..._.optsWithGlobals(),...V};if(!G.videoId&&!G.video)throw new O$("Provide --video-id or --video.",2);let X={kind:"video.extend",provider:G.provider??"openai",profile:G.profile,prompt:G.prompt??"",output:G.out,params:f7(G),videoId:G.videoId,inputs:E8(G.video),...G2(G)};await d$(X,G)}));let z=w.command("remix").description("Create a deprecated OpenAI video remix job").requiredOption("--video-id <id>","Completed OpenAI video id").requiredOption("--prompt <prompt>","Remix prompt").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output file or directory");b7(z),z.option("--param <key=value>","Provider-specific parameter",M4,[]).option("--json <object>","Provider-specific JSON object"),z.action(J$(async(V,_)=>{let G={..._.optsWithGlobals(),...V},X={kind:"video.remix",provider:G.provider??"openai",profile:G.profile,prompt:G.prompt??"",output:G.out,params:z6(h6(G.json),n6(G.param)),videoId:G.videoId??"",...G2(G)};await d$(X,G)})),w.command("status <video-id>").alias("get").alias("retrieve").description("Fetch video job metadata").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").action(J$(async(V,_,G)=>{let X={...G.optsWithGlobals(),..._},I={kind:"video.status",provider:X.provider??"openai",profile:X.profile,videoId:V};await d$(I,X)})),w.command("download <video-id>").description("Download a completed video or supporting asset").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output file or directory").option("--variant <variant>","video, thumbnail, or spritesheet",M4,[]).action(J$(async(V,_,G)=>{let X={...G.optsWithGlobals(),..._},I={kind:"video.download",provider:X.provider??"openai",profile:X.profile,output:X.out,videoId:V,variants:F7(X.variant)};await d$(I,X)})),w.command("list").description("List recently generated videos").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--limit <count>","Maximum videos to return",X2).option("--after <id>","Pagination cursor").option("--order <order>","asc or desc").action(J$(async(V,_)=>{let G={..._.optsWithGlobals(),...V},X={kind:"video.list",provider:G.provider??"openai",profile:G.profile,params:bE(G)};await d$(X,G)})),w.command("delete <video-id>").description("Delete a completed or failed video").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").action(J$(async(V,_,G)=>{let X={...G.optsWithGlobals(),..._},I={kind:"video.delete",provider:X.provider??"openai",profile:X.profile,videoId:V};await d$(I,X)}));let g=w.command("character").description("Manage reusable OpenAI video characters");g.command("create").description("Create a reusable character from an uploaded video").requiredOption("--name <name>","Character display name").requiredOption("--video <path>","Character video path or URL").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--param <key=value>","Provider-specific parameter",M4,[]).option("--json <object>","Provider-specific JSON object").action(J$(async(V,_)=>{let G={..._.optsWithGlobals(),...V},X={kind:"video.character.create",provider:G.provider??"openai",profile:G.profile,name:G.name??"",inputs:E8(G.video),params:z6(h6(G.json),n6(G.param))};await d$(X,G)})),g.command("get <character-id>").description("Fetch a reusable character").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").action(J$(async(V,_,G)=>{let X={...G.optsWithGlobals(),..._},I={kind:"video.character.get",provider:X.provider??"openai",profile:X.profile,characterId:V};await d$(I,X)}))}function uE($){$.command("run <manifest>").description("Run a YAML or JSON asset generation manifest").option("--parallel <count>","Maximum concurrent tasks",X2).option("--dry-run","Validate and print planned tasks without API calls").action(J$(async(w,U,v)=>{let J={...v.optsWithGlobals(),...U},z=new Z4,g=await O7(w,{parallel:J.parallel??z.get("defaultParallel"),dryRun:J.dryRun,config:z,verbose:J.verbose});M7(g,J)}))}function KE($){$.command("learn").description("Print AI-agent instructions for this ploof version").allowUnknownOption(!1).action(J$(()=>{process.stdout.write(dY([]))}))}function DE($){$.command("skill").description("Agent skill helpers").command("install").description("Install the ploof bootstrap skill").option("--target <dir>","Skill directory target").action(J$((U)=>{let v=u7(U.target);process.stdout.write(`Installed ploof bootstrap skill: ${v}
|
|
310
|
-
`)}))}function
|
|
311
|
-
`)}function
|
|
312
|
-
`),process.exit(
|
|
310
|
+
`)}))}function On($){$.command("whoami [provider]").description("Show current auth state").option("--profile <name>","Profile name").action(w$((w="openai",J)=>{let V=new o4().status(w,J.profile);if(!V.authenticated){process.stdout.write(`Not authenticated: provider=${w} profile=${V.profile}. Run 'ploof login ${w}'.
|
|
311
|
+
`);return}process.stdout.write(`${[`Authenticated: provider=${V.provider}`,`profile=${V.profile}`,`source=${V.source}`,`key=${V.keyPrefix}`,V.organization?`organization=${V.organization}`:void 0,V.project?`project=${V.project}`:void 0,V.baseURL?`baseURL=${V.baseURL}`:void 0].filter(Boolean).join(" ")}
|
|
312
|
+
`)}))}function Pn($){$.command("profiles [provider]").description("List stored auth profiles").action(w$((w)=>{let J=new o4().listProfiles(w);if(Object.keys(J).length===0){process.stdout.write(`No stored profiles.
|
|
313
|
+
`);return}for(let[V,U]of Object.entries(J))process.stdout.write(`${V}: ${U.join(", ")}
|
|
314
|
+
`)}))}async function Kn($,w){let J=w?.trim();if(J)return J;let V=un($)?.trim();if(V)return V;let U=await Bn(`${$} API key`);if(U)return U;throw new K$(`API key is required. Pass --api-key <key>, set ${$B($)}, or run this command in an interactive terminal.`,2)}function un($){let w=Pw($)?.auth;if(!w)return;for(let J of w.apiKeyEnvVars){let V=process.env[J]?.trim();if(V)return V}for(let J of w.apiKeyEnvPairs??[]){let V=process.env[J.idEnvVar]?.trim(),U=process.env[J.secretEnvVar]?.trim();if(V&&U)return`${V}:${U}`}return}function $B($){let w=Pw($)?.auth,J=[...w?.apiKeyEnvVars??[],...(w?.apiKeyEnvPairs??[]).map((V)=>`${V.idEnvVar}+${V.secretEnvVar}`)];if(J.length)return J.join(" or ");return"the provider API key environment variable"}function fY($){return $?process.env[$]:void 0}async function Bn($){if(!process.stdin.isTTY||!process.stdout.isTTY)return;if(typeof process.stdin.setRawMode!=="function")return;return new Promise((w,J)=>{let V="",U=process.stdin,G=U.isRaw,z=()=>{U.off("data",i),U.setRawMode(G),U.pause(),process.stdout.write(`
|
|
315
|
+
`)},i=(N)=>{for(let X of String(N)){if(X==="\r"||X===`
|
|
316
|
+
`||X==="\x04"){z(),w(V.trim());return}if(X==="\x03"){z(),J(new K$("Login cancelled.",130));return}if(X===""||X==="\b"){V=V.slice(0,-1);continue}if(X>=" ")V+=X}};process.stdout.write(`${$}: `),U.setEncoding("utf8"),U.resume(),U.setRawMode(!0),U.on("data",i)})}function Hn($){let w=$.command("image").description("Generate and edit image assets"),J=w.command("generate").description("Generate images").requiredOption("--prompt <prompt>","Image prompt").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output file or directory");lu(J),J.action(w$(async(G,z)=>{let i={...z.optsWithGlobals(),...G},N=ou(i),X={kind:"image.generate",provider:i.provider??"openai",profile:i.profile,prompt:i.prompt??"",output:i.out,params:N};await T$(X,i)}));let V=w.command("edit").description("Edit images with optional context images and masks").requiredOption("--prompt <prompt>","Edit prompt").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--image <path>","Input/context image path or URL",D$,[]).option("--mask <path>","Mask image path or URL").option("--out <path>","Output file or directory");lu(V),V.option("--input-fidelity <value>","OpenAI input fidelity"),V.action(w$(async(G,z)=>{let i={...z.optsWithGlobals(),...G};if(!i.image||i.image.length===0)throw new K$("At least one --image is required.",2);let N=ou(i),X={kind:"image.edit",provider:i.provider??"openai",profile:i.profile,prompt:i.prompt??"",output:i.out,params:N,inputs:PX(i.image,i.mask)};await T$(X,i)}));let U=w.command("variation").alias("variations").description("Create image variations").requiredOption("--image <path>","Input image path or URL").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output file or directory");fn(U),U.action(w$(async(G,z)=>{let i={...z.optsWithGlobals(),...G},N=An(i),X=typeof i.image==="string"?i.image:"",W={kind:"image.variation",provider:i.provider??"openai",profile:i.profile,output:i.out,params:N,inputs:PX(X,void 0)};await T$(W,i)}))}function Fn($){let w=$.command("video").description("Generate, edit, extend, inspect, and download video assets"),J=w.command("generate").alias("create").description("Create an OpenAI video generation job").requiredOption("--prompt <prompt>","Video prompt").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output file or directory").option("--input-reference <path-or-url-or-file-id>","Image reference path, URL, data URL, or file id").option("--input-reference-file-id <id>","Uploaded image file id").option("--input-reference-url <url>","Image URL or data URL reference").option("--character <id>","Reusable character id",D$,[]);MY(J),J.action(w$(async(i,N)=>{let X={...N.optsWithGlobals(),...i},W={kind:"video.generate",provider:X.provider??"openai",profile:X.profile,prompt:X.prompt??"",output:X.out,params:En(X),inputs:xn(X),...ui(X)};await T$(W,X)}));let V=w.command("edit").description("Create a video edit job from a completed video id or upload").requiredOption("--prompt <prompt>","Edit prompt").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--video-id <id>","Completed OpenAI video id").option("--video <path>","Source video path or URL").option("--out <path>","Output file or directory");MY(V),V.action(w$(async(i,N)=>{let X={...N.optsWithGlobals(),...i};if(!X.videoId&&!X.video)throw new K$("Provide --video-id or --video.",2);let W={kind:"video.edit",provider:X.provider??"openai",profile:X.profile,prompt:X.prompt??"",output:X.out,params:au(X),videoId:X.videoId,inputs:AY(X.video),...ui(X)};await T$(W,X)}));let U=w.command("extend").description("Create a video extension job").requiredOption("--prompt <prompt>","Extension prompt").requiredOption("--seconds <seconds>","New segment duration").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--video-id <id>","Completed OpenAI video id").option("--video <path>","Source video path or URL").option("--out <path>","Output file or directory");MY(U,{includeSeconds:!1}),U.action(w$(async(i,N)=>{let X={...N.optsWithGlobals(),...i};if(!X.videoId&&!X.video)throw new K$("Provide --video-id or --video.",2);let W={kind:"video.extend",provider:X.provider??"openai",profile:X.profile,prompt:X.prompt??"",output:X.out,params:au(X),videoId:X.videoId,inputs:AY(X.video),...ui(X)};await T$(W,X)}));let G=w.command("remix").description("Create a deprecated OpenAI video remix job").requiredOption("--video-id <id>","Completed OpenAI video id").requiredOption("--prompt <prompt>","Remix prompt").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output file or directory");wB(G),G.option("--param <key=value>","Provider-specific parameter",D$,[]).option("--json <object>","Provider-specific JSON object"),G.action(w$(async(i,N)=>{let X={...N.optsWithGlobals(),...i},W={kind:"video.remix",provider:X.provider??"openai",profile:X.profile,prompt:X.prompt??"",output:X.out,params:N4(X4(X.json),K4(X.param)),videoId:X.videoId??"",...ui(X)};await T$(W,X)})),w.command("status <video-id>").alias("get").alias("retrieve").description("Fetch video job metadata").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").action(w$(async(i,N,X)=>{let W={...X.optsWithGlobals(),...N},I={kind:"video.status",provider:W.provider??"openai",profile:W.profile,videoId:i};await T$(I,W)})),w.command("download <video-id>").description("Download a completed video or supporting asset").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output file or directory").option("--variant <variant>","video, thumbnail, or spritesheet",D$,[]).action(w$(async(i,N,X)=>{let W={...X.optsWithGlobals(),...N},I={kind:"video.download",provider:W.provider??"openai",profile:W.profile,output:W.out,videoId:i,variants:JB(W.variant)};await T$(I,W)})),w.command("list").description("List recently generated videos").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--limit <count>","Maximum videos to return",Hi).option("--after <id>","Pagination cursor").option("--order <order>","asc or desc").action(w$(async(i,N)=>{let X={...N.optsWithGlobals(),...i},W={kind:"video.list",provider:X.provider??"openai",profile:X.profile,params:Cn(X)};await T$(W,X)})),w.command("delete <video-id>").description("Delete a completed or failed video").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").action(w$(async(i,N,X)=>{let W={...X.optsWithGlobals(),...N},I={kind:"video.delete",provider:W.provider??"openai",profile:W.profile,videoId:i};await T$(I,W)}));let z=w.command("character").description("Manage reusable OpenAI video characters");z.command("create").description("Create a reusable character from an uploaded video").requiredOption("--name <name>","Character display name").requiredOption("--video <path>","Character video path or URL").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--param <key=value>","Provider-specific parameter",D$,[]).option("--json <object>","Provider-specific JSON object").action(w$(async(i,N)=>{let X={...N.optsWithGlobals(),...i},W={kind:"video.character.create",provider:X.provider??"openai",profile:X.profile,name:X.name??"",inputs:AY(X.video),params:N4(X4(X.json),K4(X.param))};await T$(W,X)})),z.command("get <character-id>").description("Fetch a reusable character").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").action(w$(async(i,N,X)=>{let W={...X.optsWithGlobals(),...N},I={kind:"video.character.get",provider:W.provider??"openai",profile:W.profile,characterId:i};await T$(I,W)}))}function qn($){let w=$.command("audio").description("Generate and process audio assets"),J=w.command("generate").alias("speech").alias("tts").description("Generate speech audio from text").requiredOption("--text <text>","Text to synthesize").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output file or directory");Mn(J),J.action(w$(async(G,z)=>{let i={...z.optsWithGlobals(),...G},N={kind:"audio.generate",provider:i.provider??"openai",profile:i.profile,input:i.text??"",output:i.out,params:Sn(i)};await T$(N,i)}));let V=w.command("transcribe").description("Transcribe audio into text").requiredOption("--audio <path>","Audio file path or URL").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output transcript file");tu(V,{includeTranscriptionOnly:!0}),V.action(w$(async(G,z)=>{let i={...z.optsWithGlobals(),...G},N={kind:"audio.transcribe",provider:i.provider??"openai",profile:i.profile,output:i.out,params:_n(i),inputs:pu(i.audio)};await T$(N,i)}));let U=w.command("translate").description("Translate audio into English text").requiredOption("--audio <path>","Audio file path or URL").option("--provider <provider>","Provider id","openai").option("--profile <name>","Auth profile").option("--out <path>","Output translation file");tu(U),U.action(w$(async(G,z)=>{let i={...z.optsWithGlobals(),...G},N={kind:"audio.translate",provider:i.provider??"openai",profile:i.profile,output:i.out,params:kn(i),inputs:pu(i.audio)};await T$(N,i)}))}function Zn($){$.command("model").description("Run provider model endpoints directly").command("run").description("Run a provider model endpoint and write returned assets").requiredOption("--model <id>","Provider model or endpoint id").option("--provider <provider>","Provider id","fal").option("--profile <name>","Auth profile").option("--prompt <prompt>","Prompt input").option("--text <text>","Text input").option("--input <field=path>","Named asset input field; repeat for multiple inputs",D$,[]).option("--out <path>","Output file or directory").option("--method <method>","Provider request method").option("--start-timeout <seconds>","Provider queue start timeout in seconds",s4).option("--timeout <seconds>","Client-side wait timeout in seconds",s4).option("--poll-interval <seconds>","Polling interval while waiting",s4).option("--priority <priority>","Provider queue priority").option("--storage-expires-in <value>","Provider object storage expiration, such as 1h, 1d, 30d, or never").option("--param <key=value>","Provider-specific model input",D$,[]).option("--json <object>","Provider-specific model input JSON object").action(w$(async(J,V)=>{let U={...V.optsWithGlobals(),...J},G={kind:"model.run",provider:U.provider??"fal",profile:U.profile,model:U.model??"",prompt:U.prompt,output:U.out,params:Rn(U),inputs:bn(U.input)};await T$(G,U)}))}function Tn($){$.command("run <manifest>").description("Run a YAML or JSON asset generation manifest").option("--parallel <count>","Maximum concurrent tasks",Hi).option("--dry-run","Validate and print planned tasks without API calls").action(w$(async(w,J,V)=>{let U={...V.optsWithGlobals(),...J},G=new p4,z=await xu(w,{parallel:U.parallel??G.get("defaultParallel"),dryRun:U.dryRun,config:G,verbose:U.verbose});UB(z,U)}))}function Dn($){$.command("learn").description("Print AI-agent instructions for this ploof version").allowUnknownOption(!1).action(w$(()=>{process.stdout.write(TP([]))}))}function Ln($){$.command("skill").description("Agent skill helpers").command("install").description("Install the ploof bootstrap skill").option("--target <dir>","Skill directory target").action(w$((J)=>{let V=cu(J.target);process.stdout.write(`Installed ploof bootstrap skill: ${V}
|
|
317
|
+
`)}))}function lu($){$.option("--model <model>","Image model").option("--size <size>","Image size").option("--quality <quality>","Image quality").option("--format <format>","Output image format").option("--output-format <format>","Provider output_format value").option("--background <background>","Background setting").option("--moderation <moderation>","Moderation setting").option("--n <count>","Number of images",Hi).option("--output-compression <number>","Output compression",s4).option("--partial-images <number>","Number of partial images",s4).option("--response-format <format>","Provider response format").option("--style <style>","Image style").option("--user <user>","End-user identifier").option("--stream","Request streamed image events").option("--param <key=value>","Provider-specific parameter",D$,[]).option("--json <object>","Provider-specific JSON object")}function fn($){$.option("--model <model>","Image model").option("--size <size>","Image size").option("--n <count>","Number of images",Hi).option("--response-format <format>","Provider response format").option("--user <user>","End-user identifier").option("--param <key=value>","Provider-specific parameter",D$,[]).option("--json <object>","Provider-specific JSON object")}function MY($,w={}){if($.option("--model <model>","Video model").option("--size <size>","Video size").option("--param <key=value>","Provider-specific parameter",D$,[]).option("--json <object>","Provider-specific JSON object"),w.includeSeconds??!0)$.option("--seconds <seconds>","Video duration in seconds");wB($)}function wB($){$.option("--wait","Poll until the video reaches a terminal status").option("--download","Download the video after waiting").option("--variant <variant>","Download variant: video, thumbnail, or spritesheet",D$,[]).option("--poll-interval <seconds>","Polling interval while waiting",s4).option("--timeout <seconds>","Maximum wait time before timing out",s4)}function Mn($){$.option("--model <model>","Audio generation model").option("--voice <voice>","Built-in voice name").option("--voice-id <id>","Custom voice id").option("--instructions <text>","Voice/style instructions").option("--format <format>","Audio format").option("--response-format <format>","Provider response_format value").option("--speed <number>","Speech speed",s4).option("--param <key=value>","Provider-specific parameter",D$,[]).option("--json <object>","Provider-specific JSON object")}function tu($,w={}){if($.option("--model <model>","Audio processing model").option("--prompt <prompt>","Prompt/context for the audio model").option("--format <format>","Transcript output format").option("--response-format <format>","Provider response_format value").option("--temperature <number>","Sampling temperature",s4).option("--param <key=value>","Provider-specific parameter",D$,[]).option("--json <object>","Provider-specific JSON object"),w.includeTranscriptionOnly)$.option("--language <code>","Input language code").option("--include <value>","Additional response include",D$,[]).option("--timestamp-granularity <value>","word or segment",D$,[]).option("--chunking-strategy <value>","auto or JSON object").option("--known-speaker-name <name>","Known speaker label",D$,[]).option("--known-speaker-reference <data-url>","Known speaker audio sample data URL",D$,[])}function ou($){let w=$6({model:$.model,size:$.size,quality:$.quality,output_format:$.outputFormat??$.format,background:$.background,moderation:$.moderation,n:$.n,output_compression:$.outputCompression,partial_images:$.partialImages,response_format:$.responseFormat,style:$.style,user:$.user,stream:$.stream,input_fidelity:$.inputFidelity});return N4(X4($.json),w,K4($.param))}function An($){let w=$6({model:$.model,size:$.size,n:$.n,response_format:$.responseFormat,user:$.user});return N4(X4($.json),w,K4($.param))}function Sn($){let w=$6({model:$.model,voice:$.voiceId?{id:$.voiceId}:$.voice,instructions:$.instructions,response_format:$.responseFormat??$.format,speed:$.speed});return N4(X4($.json),w,K4($.param))}function _n($){let w=$6({model:$.model,language:$.language,prompt:$.prompt,response_format:$.responseFormat??$.format,temperature:$.temperature,include:Bi($.include),timestamp_granularities:Bi($.timestampGranularity),chunking_strategy:rn($.chunkingStrategy),known_speaker_names:Bi($.knownSpeakerName),known_speaker_references:Bi($.knownSpeakerReference)});return N4(X4($.json),w,K4($.param))}function kn($){let w=$6({model:$.model,prompt:$.prompt,response_format:$.responseFormat??$.format,temperature:$.temperature});return N4(X4($.json),w,K4($.param))}function Rn($){let w=$6({prompt:$.prompt,text:$.text,method:$.method,start_timeout:$.startTimeout,timeout_ms:$.timeout===void 0?void 0:Math.max(0,$.timeout*1000),poll_interval_ms:$.pollInterval===void 0?void 0:Math.max(0,$.pollInterval*1000),priority:$.priority,storage_expires_in:$.storageExpiresIn});return N4(X4($.json),w,K4($.param))}function bn($){return($===void 0?[]:Array.isArray($)?$:[$]).map((J)=>{let V=J.indexOf("=");if(V===-1)throw new K$(`Invalid --input value "${J}". Use field=path-or-url.`,2);let U=J.slice(0,V).trim(),G=J.slice(V+1).trim();if(!U||!G)throw new K$(`Invalid --input value "${J}". Use field=path-or-url.`,2);return{role:U,source:G,mime:W6(G)}})}function pu($){if(!$)return[];return[{role:"audio",source:$}]}function En($){let w=$6({model:$.model,size:$.size,seconds:$.seconds,characters:jn($.character)});return N4(X4($.json),w,K4($.param))}function au($){let w=$6({model:$.model,size:$.size,seconds:$.seconds});return N4(X4($.json),w,K4($.param))}function Cn($){if($.order&&!["asc","desc"].includes($.order))throw new K$("Video list --order must be asc or desc.",2);return $6({limit:$.limit,after:$.after,order:$.order})}function jn($){let J=($===void 0?[]:Array.isArray($)?$:[$]).map((V)=>V.trim()).filter(Boolean);return J.length>0?J.map((V)=>({id:V})):void 0}function xn($){let w=$.inputReferenceFileId!==void 0?`file:${$.inputReferenceFileId}`:$.inputReferenceUrl??$.inputReference;if(!w)return[];return[{role:"reference",source:w}]}function AY($){if(!$)return[];return[{role:"video",source:$}]}function ui($){return{wait:$.wait,download:$.download,variants:JB($.variant),pollIntervalMs:$.pollInterval===void 0?void 0:Math.max(0,$.pollInterval*1000),timeoutMs:$.timeout===void 0?void 0:Math.max(0,$.timeout*1000)}}function JB($){let w=$===void 0?[]:Array.isArray($)?$:[$];return(w.length>0?w:["video"]).map((V)=>{if(V==="video"||V==="thumbnail"||V==="spritesheet")return V;throw new K$(`Invalid video variant: ${V}. Expected video, thumbnail, or spritesheet.`,2)})}function Bi($){let J=($===void 0?[]:Array.isArray($)?$:[$]).map((V)=>V.trim()).filter(Boolean);return J.length>0?J:void 0}function rn($){if($===void 0)return;if($==="auto")return $;return X4($)}async function T$($,w){let J=new p4,V=new o4,U=qz($.provider),G=V.getCredential($.provider,$.profile);if(!G?.apiKey)throw new K$(`No credentials found for ${$.provider}. Run 'ploof login ${$.provider} --api-key <key>' or set ${$B($.provider)}.`,1);let z=J.get("sidecar"),i={credential:G,verbose:w.verbose,sidecar:z},N=await U.run($,i);UB(N,w)}function UB($,w){let J=new p4,V=nn(w,J),U=mu($,V);if(U)process.stdout.write(`${U}
|
|
318
|
+
`)}function nn($,w){return{format:du($.output,w.get("output"),process.env.PLOOF_OUTPUT,process.stdout.isTTY??!1),fields:typeof $.fields==="string"?$.fields.split(",").map((V)=>V.trim()):void 0,detail:$.detail,quiet:$.quiet,noColor:$.noColor??w.get("noColor")}}function w$($){return async(...w)=>{try{await $(...w)}catch(J){let V=dn(w);process.stderr.write(`${FP(J,V.noColor===!0)}
|
|
319
|
+
`),process.exit(J instanceof K$?J.code:1)}}}function dn($){for(let w of $)if(w&&typeof w==="object"&&"parent"in w)return w.optsWithGlobals();return{}}function D$($,w){return[...w,$]}function Hi($){let w=Number.parseInt($,10);if(!Number.isFinite(w)||w<=0)throw Error(`Expected positive integer, received ${$}`);return w}function s4($){let w=Number($);if(!Number.isFinite(w))throw Error(`Expected number, received ${$}`);return w}function mn($){if($==="true")return!0;if($==="false")return!1;if(/^-?\d+$/.test($))return Number.parseInt($,10);return $}function VB($){return["output","defaultParallel","sidecar","noColor"].includes($)}function eu($,w){if(!VB(w))throw new K$(`Invalid config key: ${w}`,2);return $.get(w)}function yn($,w,J){if(!VB(w))throw new K$(`Invalid config key: ${w}`,2);switch(w){case"output":if(!["auto","table","compact","json","jsonl"].includes(String(J)))throw new K$(`Invalid output format: ${String(J)}`,2);$.set("output",String(J));return;case"defaultParallel":if(typeof J!=="number"||J<=0)throw new K$("defaultParallel must be a positive number.",2);$.set("defaultParallel",J);return;case"sidecar":case"noColor":if(typeof J!=="boolean")throw new K$(`${w} must be true or false.`,2);$.set(w,J)}}function $6($){let w={};for(let[J,V]of Object.entries($))if(V!==void 0)w[J]=V;return w}var hn=su();hn.parseAsync(process.argv).catch(($)=>{process.stderr.write(`${$ instanceof Error?$.message:String($)}
|
|
313
320
|
`),process.exit(1)});
|