@shotstack/cli 0.15.2 → 0.16.1
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 +12 -0
- package/dist/shotstack.js +48 -45
- package/package.json +1 -1
- package/skills/shotstack/SKILL.md +23 -7
- package/skills/shotstack/references/beat-sync.md +1 -1
package/dist/shotstack.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
3
|
-
`).replace(/^/gm," ".repeat(2))}let p=[`Usage: ${t.commandUsage(e)}`,""],l=t.commandDescription(e);if(l.length>0)p=p.concat([t.wrap(l,n,0),""]);let
|
|
2
|
+
import{createRequire as gu}from"node:module";var mu=Object.defineProperty;var ze=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var hu=(e,t,r)=>{for(var n in t)mu(e,n,{get:t[n],set:r[n],enumerable:!0,configurable:!0})},je=gu(import.meta.url);var Fe=ze(function(_u){class kt extends Error{constructor(e,t,r){super(r);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}}class Er extends kt{constructor(e){super(1,"commander.invalidArgument",e);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}_u.CommanderError=kt;_u.InvalidArgumentError=Er});var et=ze(function($u){var{InvalidArgumentError:bu}=Fe();class Rr{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;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(e,t){if(t===this.defaultValue||!Array.isArray(t))return[e];return t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new bu(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(t,r);return t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function wu(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}$u.Argument=Rr;$u.humanReadableArgName=wu});var Zt=ze(function(ku){var{humanReadableArgName:zu}=et();class Pr{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter((n)=>!n._hidden),r=e._getHelpCommand();if(r&&!r._hidden)t.push(r);if(this.sortSubcommands)t.sort((n,o)=>n.name().localeCompare(o.name()));return t}compareOptions(e,t){let r=(n)=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter((n)=>!n.hidden),r=e._getHelpOption();if(r&&!r.hidden){let n=r.short&&e._findOption(r.short),o=r.long&&e._findOption(r.long);if(!n&&!o)t.push(r);else if(r.long&&!o)t.push(e.createOption(r.long,r.description));else if(r.short&&!n)t.push(e.createOption(r.short,r.description))}if(this.sortOptions)t.sort(this.compareOptions);return t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let n=r.options.filter((o)=>!o.hidden);t.push(...n)}if(this.sortOptions)t.sort(this.compareOptions);return t}visibleArguments(e){if(e._argsDescription)e.registeredArguments.forEach((t)=>{t.description=t.description||e._argsDescription[t.name()]||""});if(e.registeredArguments.find((t)=>t.description))return e.registeredArguments;return[]}subcommandTerm(e){let t=e.registeredArguments.map((r)=>zu(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,n)=>Math.max(r,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,n)=>Math.max(r,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,n)=>Math.max(r,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,n)=>Math.max(r,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;if(e._aliases[0])t=t+"|"+e._aliases[0];let r="";for(let n=e.parent;n;n=n.parent)r=n.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices)t.push(`choices: ${e.argChoices.map((r)=>JSON.stringify(r)).join(", ")}`);if(e.defaultValue!==void 0){if(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==="boolean")t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}if(e.presetArg!==void 0&&e.optional)t.push(`preset: ${JSON.stringify(e.presetArg)}`);if(e.envVar!==void 0)t.push(`env: ${e.envVar}`);if(t.length>0)return`${e.description} (${t.join(", ")})`;return e.description}argumentDescription(e){let t=[];if(e.argChoices)t.push(`choices: ${e.argChoices.map((r)=>JSON.stringify(r)).join(", ")}`);if(e.defaultValue!==void 0)t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`);if(t.length>0){let r=`(${t.join(", ")})`;if(e.description)return`${e.description} ${r}`;return r}return e.description}formatHelp(e,t){let r=t.padWidth(e,t),n=t.helpWidth||80,o=2,s=2;function i(y,S){if(S){let F=`${y.padEnd(r+2)}${S}`;return t.wrap(F,n-2,r+2)}return y}function u(y){return y.join(`
|
|
3
|
+
`).replace(/^/gm," ".repeat(2))}let p=[`Usage: ${t.commandUsage(e)}`,""],l=t.commandDescription(e);if(l.length>0)p=p.concat([t.wrap(l,n,0),""]);let m=t.visibleArguments(e).map((y)=>i(t.argumentTerm(y),t.argumentDescription(y)));if(m.length>0)p=p.concat(["Arguments:",u(m),""]);let x=t.visibleOptions(e).map((y)=>i(t.optionTerm(y),t.optionDescription(y)));if(x.length>0)p=p.concat(["Options:",u(x),""]);if(this.showGlobalOptions){let y=t.visibleGlobalOptions(e).map((S)=>i(t.optionTerm(S),t.optionDescription(S)));if(y.length>0)p=p.concat(["Global Options:",u(y),""])}let b=t.visibleCommands(e).map((y)=>i(t.subcommandTerm(y),t.subcommandDescription(y)));if(b.length>0)p=p.concat(["Commands:",u(b),""]);return p.join(`
|
|
4
4
|
`)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,r,n=40){let s=new RegExp(`[\\n][${" \\f\\t\\v - \uFEFF"}]+`);if(e.match(s))return e;let i=t-r;if(i<n)return e;let u=e.slice(0,r),p=e.slice(r).replace(`\r
|
|
5
5
|
`,`
|
|
6
|
-
`),l=" ".repeat(r),
|
|
7
|
-
|.{1,${i-1}}([${
|
|
8
|
-
`)return"";return(
|
|
9
|
-
`)}}
|
|
6
|
+
`),l=" ".repeat(r),x=`\\s${""}`,b=new RegExp(`
|
|
7
|
+
|.{1,${i-1}}([${x}]|$)|[^${x}]+?([${x}]|$)`,"g"),y=p.match(b)||[];return u+y.map((S,F)=>{if(S===`
|
|
8
|
+
`)return"";return(F>0?l:"")+S.trimEnd()}).join(`
|
|
9
|
+
`)}}ku.Help=Pr});var Ot=ze(function(Pu){var{InvalidArgumentError:Ou}=Fe();class Cr{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let r=Ru(e);if(this.short=r.shortFlag,this.long=r.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(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;if(typeof e==="string")t={[e]:!0};return this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t))return[e];return t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new Ou(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(t,r);return t},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return Eu(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class Tr{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach((t)=>{if(t.negate)this.negativeOptions.set(t.attributeName(),t);else this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,r)=>{if(this.positiveOptions.has(r))this.dualOptions.add(r)})}valueFromOption(e,t){let r=t.attributeName();if(!this.dualOptions.has(r))return!0;let n=this.negativeOptions.get(r).presetArg,o=n!==void 0?n:!1;return t.negate===(o===e)}}function Eu(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function Ru(e){let t,r,n=e.split(/[ |,]+/);if(n.length>1&&!/^[[<]/.test(n[1]))t=n.shift();if(r=n.shift(),!t&&/^-[^-]$/.test(r))t=r,r=void 0;return{shortFlag:t,longFlag:r}}Pu.Option=Cr;Pu.DualOptions=Tr});var Nr=ze(function(ju){function Nu(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let n=0;n<=e.length;n++)r[n]=[n];for(let n=0;n<=t.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let o=1;o<=e.length;o++){let s=1;if(e[o-1]===t[n-1])s=0;else s=1;if(r[o][n]=Math.min(r[o-1][n]+1,r[o][n-1]+1,r[o-1][n-1]+s),o>1&&n>1&&e[o-1]===t[n-2]&&e[o-2]===t[n-1])r[o][n]=Math.min(r[o][n],r[o-2][n-2]+1)}return r[e.length][t.length]}function Iu(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");if(r)e=e.slice(2),t=t.map((i)=>i.slice(2));let n=[],o=3,s=0.4;if(t.forEach((i)=>{if(i.length<=1)return;let u=Nu(e,i),p=Math.max(e.length,i.length);if((p-u)/p>s){if(u<o)o=u,n=[i];else if(u===o)n.push(i)}}),n.sort((i,u)=>i.localeCompare(u)),r)n=n.map((i)=>`--${i}`);if(n.length>1)return`
|
|
10
10
|
(Did you mean one of ${n.join(", ")}?)`;if(n.length===1)return`
|
|
11
|
-
(Did you mean ${n[0]}?)`;return""}
|
|
12
|
-
- specify the name in Command constructor or using .name()`);if(t=t||{},t.isDefault)this._defaultCommandName=e._name;if(t.noHelp||t.hidden)e._hidden=!0;return this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new
|
|
13
|
-
Expecting one of '${r.join("', '")}'`);if(this._lifeCycleHooks[e])this._lifeCycleHooks[e].push(t);else this._lifeCycleHooks[e]=[t];return this}exitOverride(e){if(e)this._exitCallback=e;else this._exitCallback=(t)=>{if(t.code!=="commander.executeSubCommandAsync")throw t};return this}_exit(e,t,r){if(this._exitCallback)this._exitCallback(new
|
|
14
|
-
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=(n)=>[n.name()].concat(n.aliases()),r=t(e).find((n)=>this._findCommand(n));if(r){let n=t(this._findCommand(r)).join("|"),o=t(e).join("|");throw Error(`cannot add command '${o}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),r=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");if(!this._findOption(o))this.setOptionValueWithSource(r,e.defaultValue===void 0?!0:e.defaultValue,"default")}else if(e.defaultValue!==void 0)this.setOptionValueWithSource(r,e.defaultValue,"default");let n=(o,s,i)=>{if(o==null&&e.presetArg!==void 0)o=e.presetArg;let u=this.getOptionValue(r);if(o!==null&&e.parseArg)o=this._callParseArg(e,o,u,s);else if(o!==null&&e.variadic)o=e._concatValue(o,u);if(o==null)if(e.negate)o=!1;else if(e.isBoolean()||e.optional)o=!0;else o="";this.setOptionValueWithSource(r,o,i)};if(this.on("option:"+t,(o)=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;n(o,s,"cli")}),e.envVar)this.on("optionEnv:"+t,(o)=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;n(o,s,"env")});return this}_optionEx(e,t,r,n,o){if(typeof t==="object"&&t instanceof
|
|
11
|
+
(Did you mean ${n[0]}?)`;return""}ju.suggestSimilar=Iu});var Dr=ze(function(Vu){var Du=je("node:events").EventEmitter,ke=je("node:child_process"),K=je("node:path"),Ze=je("node:fs"),k=je("node:process"),{Argument:Lu,humanReadableArgName:Mu}=et(),{CommanderError:Et}=Fe(),{Help:vu}=Zt(),{Option:Ir,DualOptions:Uu}=Ot(),{suggestSimilar:jr}=Nr();class Rt extends Du{constructor(e){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",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._outputConfiguration={writeOut:(t)=>k.stdout.write(t),writeErr:(t)=>k.stderr.write(t),getOutHelpWidth:()=>k.stdout.isTTY?k.stdout.columns:void 0,getErrHelpWidth:()=>k.stderr.isTTY?k.stderr.columns:void 0,outputError:(t,r)=>r(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,r){let n=t,o=r;if(typeof n==="object"&&n!==null)o=n,n=null;o=o||{};let[,s,i]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(s);if(n)u.description(n),u._executableHandler=!0;if(o.isDefault)this._defaultCommandName=u._name;if(u._hidden=!!(o.noHelp||o.hidden),u._executableFile=o.executableFile||null,i)u.arguments(i);if(this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),n)return this;return u}createCommand(e){return new Rt(e)}createHelp(){return Object.assign(new vu,this.configureHelp())}configureHelp(e){if(e===void 0)return this._helpConfiguration;return this._helpConfiguration=e,this}configureOutput(e){if(e===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,e),this}showHelpAfterError(e=!0){if(typeof e!=="string")e=!!e;return this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
|
|
12
|
+
- specify the name in Command constructor or using .name()`);if(t=t||{},t.isDefault)this._defaultCommandName=e._name;if(t.noHelp||t.hidden)e._hidden=!0;return this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new Lu(e,t)}argument(e,t,r,n){let o=this.createArgument(e,t);if(typeof r==="function")o.default(n).argParser(r);else o.default(r);return this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach((t)=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,r,n]=e.match(/([^ ]+) *(.*)/),o=t??"display help for command",s=this.createCommand(r);if(s.helpOption(!1),n)s.arguments(n);if(o)s.description(o);return this._addImplicitHelpCommand=!0,this._helpCommand=s,this}addHelpCommand(e,t){if(typeof e!=="object")return this.helpCommand(e,t),this;return this._addImplicitHelpCommand=!0,this._helpCommand=e,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(e,t){let r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
|
|
13
|
+
Expecting one of '${r.join("', '")}'`);if(this._lifeCycleHooks[e])this._lifeCycleHooks[e].push(t);else this._lifeCycleHooks[e]=[t];return this}exitOverride(e){if(e)this._exitCallback=e;else this._exitCallback=(t)=>{if(t.code!=="commander.executeSubCommandAsync")throw t};return this}_exit(e,t,r){if(this._exitCallback)this._exitCallback(new Et(e,t,r));k.exit(e)}action(e){let t=(r)=>{let n=this.registeredArguments.length,o=r.slice(0,n);if(this._storeOptionsAsProperties)o[n]=this;else o[n]=this.opts();return o.push(this),e.apply(this,o)};return this._actionHandler=t,this}createOption(e,t){return new Ir(e,t)}_callParseArg(e,t,r,n){try{return e.parseArg(t,r)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${n} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let r=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${r}'
|
|
14
|
+
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=(n)=>[n.name()].concat(n.aliases()),r=t(e).find((n)=>this._findCommand(n));if(r){let n=t(this._findCommand(r)).join("|"),o=t(e).join("|");throw Error(`cannot add command '${o}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),r=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");if(!this._findOption(o))this.setOptionValueWithSource(r,e.defaultValue===void 0?!0:e.defaultValue,"default")}else if(e.defaultValue!==void 0)this.setOptionValueWithSource(r,e.defaultValue,"default");let n=(o,s,i)=>{if(o==null&&e.presetArg!==void 0)o=e.presetArg;let u=this.getOptionValue(r);if(o!==null&&e.parseArg)o=this._callParseArg(e,o,u,s);else if(o!==null&&e.variadic)o=e._concatValue(o,u);if(o==null)if(e.negate)o=!1;else if(e.isBoolean()||e.optional)o=!0;else o="";this.setOptionValueWithSource(r,o,i)};if(this.on("option:"+t,(o)=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;n(o,s,"cli")}),e.envVar)this.on("optionEnv:"+t,(o)=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;n(o,s,"env")});return this}_optionEx(e,t,r,n,o){if(typeof t==="object"&&t instanceof Ir)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(t,r);if(s.makeOptionMandatory(!!e.mandatory),typeof n==="function")s.default(o).argParser(n);else if(n instanceof RegExp){let i=n;n=(u,p)=>{let l=i.exec(u);return l?l[0]:p},s.default(o).argParser(n)}else s.default(n);return this.addOption(s)}option(e,t,r,n){return this._optionEx({},e,t,r,n)}requiredOption(e,t,r,n){return this._optionEx({mandatory:!0},e,t,r,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,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(e=!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=!!e,this}getOptionValue(e){if(this._storeOptionsAsProperties)return this[e];return this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,r){if(this._storeOptionsAsProperties)this[e]=t;else this._optionValues[e]=t;return this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach((r)=>{if(r.getOptionValueSource(e)!==void 0)t=r.getOptionValueSource(e)}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){if(k.versions?.electron)t.from="electron";let n=k.execArgv??[];if(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))t.from="eval"}if(e===void 0)e=k.argv;this.rawArgs=e.slice();let r;switch(t.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":if(k.defaultApp)this._scriptPath=e[1],r=e.slice(2);else r=e.slice(1);break;case"user":r=e.slice(0);break;case"eval":r=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",r}parse(e,t){let r=this._prepareUserArgs(e,t);return this._parseCommand([],r),this}async parseAsync(e,t){let r=this._prepareUserArgs(e,t);return await this._parseCommand([],r),this}_executeSubCommand(e,t){t=t.slice();let r=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function o(l,m){let x=K.resolve(l,m);if(Ze.existsSync(x))return x;if(n.includes(K.extname(m)))return;let b=n.find((y)=>Ze.existsSync(`${x}${y}`));if(b)return`${x}${b}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,i=this._executableDir||"";if(this._scriptPath){let l;try{l=Ze.realpathSync(this._scriptPath)}catch(m){l=this._scriptPath}i=K.resolve(K.dirname(l),i)}if(i){let l=o(i,s);if(!l&&!e._executableFile&&this._scriptPath){let m=K.basename(this._scriptPath,K.extname(this._scriptPath));if(m!==this._name)l=o(i,`${m}-${e._name}`)}s=l||s}r=n.includes(K.extname(s));let u;if(k.platform!=="win32")if(r)t.unshift(s),t=Fr(k.execArgv).concat(t),u=ke.spawn(k.argv[0],t,{stdio:"inherit"});else u=ke.spawn(s,t,{stdio:"inherit"});else t.unshift(s),t=Fr(k.execArgv).concat(t),u=ke.spawn(k.execPath,t,{stdio:"inherit"});if(!u.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((m)=>{k.on(m,()=>{if(u.killed===!1&&u.exitCode===null)u.kill(m)})});let p=this._exitCallback;u.on("close",(l)=>{if(l=l??1,!p)k.exit(l);else p(new Et(l,"commander.executeSubCommandAsync","(close)"))}),u.on("error",(l)=>{if(l.code==="ENOENT"){let m=i?`searched for local subcommand relative to directory '${i}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",x=`'${s}' does not exist
|
|
15
15
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
16
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
-
- ${
|
|
17
|
+
- ${m}`;throw Error(x)}else if(l.code==="EACCES")throw Error(`'${s}' not executable`);if(!p)k.exit(1);else{let m=new Et(1,"commander.executeSubCommandAsync","(error)");m.nestedError=l,p(m)}}),this.runningCommand=u}_dispatchSubcommand(e,t,r){let n=this._findCommand(e);if(!n)this.help({error:!0});let o;return o=this._chainOrCallSubCommandHook(o,n,"preSubcommand"),o=this._chainOrCall(o,()=>{if(n._executableHandler)this._executeSubCommand(n,t.concat(r));else return n._parseCommand(t,r)}),o}_dispatchHelpCommand(e){if(!e)this.help();let t=this._findCommand(e);if(t&&!t._executableHandler)t.help();return this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((e,t)=>{if(e.required&&this.args[t]==null)this.missingArgument(e.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 e=(r,n,o)=>{let s=n;if(n!==null&&r.parseArg){let i=`error: command-argument value '${n}' is invalid for argument '${r.name()}'.`;s=this._callParseArg(r,n,o,i)}return s};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((r,n)=>{let o=r.defaultValue;if(r.variadic){if(n<this.args.length){if(o=this.args.slice(n),r.parseArg)o=o.reduce((s,i)=>e(r,i,s),r.defaultValue)}else if(o===void 0)o=[]}else if(n<this.args.length){if(o=this.args[n],r.parseArg)o=e(r,o,r.defaultValue)}t[n]=o}),this.processedArgs=t}_chainOrCall(e,t){if(e&&e.then&&typeof e.then==="function")return e.then(()=>t());return t()}_chainOrCallHooks(e,t){let r=e,n=[];if(this._getCommandAndAncestors().reverse().filter((o)=>o._lifeCycleHooks[t]!==void 0).forEach((o)=>{o._lifeCycleHooks[t].forEach((s)=>{n.push({hookedCommand:o,callback:s})})}),t==="postAction")n.reverse();return n.forEach((o)=>{r=this._chainOrCall(r,()=>o.callback(o.hookedCommand,this))}),r}_chainOrCallSubCommandHook(e,t,r){let n=e;if(this._lifeCycleHooks[r]!==void 0)this._lifeCycleHooks[r].forEach((o)=>{n=this._chainOrCall(n,()=>o(this,t))});return n}_parseCommand(e,t){let r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{if(r.unknown.length>0)this.unknownOption(r.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let s;if(s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent)s=this._chainOrCall(s,()=>{this.parent.emit(o,e,t)});return s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent&&this.parent.listenerCount(o))n(),this._processArguments(),this.parent.emit(o,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);if(this.listenerCount("command:*"))this.emit("command:*",e,t);else if(this.commands.length)this.unknownCommand();else n(),this._processArguments()}else if(this.commands.length)n(),this.help({error:!0});else n(),this._processArguments()}_findCommand(e){if(!e)return;return this.commands.find((t)=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find((t)=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((e)=>{e.options.forEach((t)=>{if(t.mandatory&&e.getOptionValue(t.attributeName())===void 0)e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter((r)=>{let n=r.attributeName();if(this.getOptionValue(n)===void 0)return!1;return this.getOptionValueSource(n)!=="default"});e.filter((r)=>r.conflictsWith.length>0).forEach((r)=>{let n=e.find((o)=>r.conflictsWith.includes(o.attributeName()));if(n)this._conflictingOption(r,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((e)=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],r=[],n=t,o=e.slice();function s(u){return u.length>1&&u[0]==="-"}let i=null;while(o.length){let u=o.shift();if(u==="--"){if(n===r)n.push(u);n.push(...o);break}if(i&&!s(u)){this.emit(`option:${i.name()}`,u);continue}if(i=null,s(u)){let p=this._findOption(u);if(p){if(p.required){let l=o.shift();if(l===void 0)this.optionMissingArgument(p);this.emit(`option:${p.name()}`,l)}else if(p.optional){let l=null;if(o.length>0&&!s(o[0]))l=o.shift();this.emit(`option:${p.name()}`,l)}else this.emit(`option:${p.name()}`);i=p.variadic?p:null;continue}}if(u.length>2&&u[0]==="-"&&u[1]!=="-"){let p=this._findOption(`-${u[1]}`);if(p){if(p.required||p.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${p.name()}`,u.slice(2));else this.emit(`option:${p.name()}`),o.unshift(`-${u.slice(2)}`);continue}}if(/^--[^=]+=/.test(u)){let p=u.indexOf("="),l=this._findOption(u.slice(0,p));if(l&&(l.required||l.optional)){this.emit(`option:${l.name()}`,u.slice(p+1));continue}}if(s(u))n=r;if((this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(u)){if(t.push(u),o.length>0)r.push(...o);break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){if(t.push(u),o.length>0)t.push(...o);break}else if(this._defaultCommandName){if(r.push(u),o.length>0)r.push(...o);break}}if(this._passThroughOptions){if(n.push(u),o.length>0)n.push(...o);break}n.push(u)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let r=0;r<t;r++){let n=this.options[r].attributeName();e[n]=n===this._versionOptionName?this._version:this[n]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){if(this._outputConfiguration.outputError(`${e}
|
|
18
18
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
19
19
|
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
|
|
20
|
-
`),this.outputHelp({error:!0});let r=t||{},n=r.exitCode||1,o=r.code||"commander.error";this._exit(n,o,e)}_parseOptionsEnv(){this.options.forEach((e)=>{if(e.envVar&&e.envVar in k.env){let t=e.attributeName();if(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))if(e.required||e.optional)this.emit(`optionEnv:${e.name()}`,k.env[e.envVar]);else this.emit(`optionEnv:${e.name()}`)}})}_parseOptionsImplied(){let e=new
|
|
21
|
-
`),this._exit(0,"commander.version",e)}),this}description(e,t){if(e===void 0&&t===void 0)return this._description;if(this._description=e,t)this._argsDescription=t;return this}summary(e){if(e===void 0)return this._summary;return this._summary=e,this}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)t=this.commands[this.commands.length-1];if(e===t._name)throw Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let n=[r.name()].concat(r.aliases()).join("|");throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${n}'`)}return t._aliases.push(e),this}aliases(e){if(e===void 0)return this._aliases;return e.forEach((t)=>this.alias(t)),this}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map((r)=>
|
|
20
|
+
`),this.outputHelp({error:!0});let r=t||{},n=r.exitCode||1,o=r.code||"commander.error";this._exit(n,o,e)}_parseOptionsEnv(){this.options.forEach((e)=>{if(e.envVar&&e.envVar in k.env){let t=e.attributeName();if(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))if(e.required||e.optional)this.emit(`optionEnv:${e.name()}`,k.env[e.envVar]);else this.emit(`optionEnv:${e.name()}`)}})}_parseOptionsImplied(){let e=new Uu(this.options),t=(r)=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r));this.options.filter((r)=>r.implied!==void 0&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach((r)=>{Object.keys(r.implied).filter((n)=>!t(n)).forEach((n)=>{this.setOptionValueWithSource(n,r.implied[n],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let r=(s)=>{let i=s.attributeName(),u=this.getOptionValue(i),p=this.options.find((m)=>m.negate&&i===m.attributeName()),l=this.options.find((m)=>!m.negate&&i===m.attributeName());if(p&&(p.presetArg===void 0&&u===!1||p.presetArg!==void 0&&u===p.presetArg))return p;return l||s},n=(s)=>{let i=r(s),u=i.attributeName();if(this.getOptionValueSource(u)==="env")return`environment variable '${i.envVar}'`;return`option '${i.flags}'`},o=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter((i)=>i.long).map((i)=>i.long);n=n.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);t=jr(e,n)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,r=t===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${r} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach((o)=>{if(n.push(o.name()),o.alias())n.push(o.alias())}),t=jr(e,n)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";let n=this.createOption(t,r);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
21
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){if(e===void 0&&t===void 0)return this._description;if(this._description=e,t)this._argsDescription=t;return this}summary(e){if(e===void 0)return this._summary;return this._summary=e,this}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)t=this.commands[this.commands.length-1];if(e===t._name)throw Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let n=[r.name()].concat(r.aliases()).join("|");throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${n}'`)}return t._aliases.push(e),this}aliases(e){if(e===void 0)return this._aliases;return e.forEach((t)=>this.alias(t)),this}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map((r)=>Mu(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){if(e===void 0)return this._name;return this._name=e,this}nameFromFilename(e){return this._name=K.basename(e,K.extname(e)),this}executableDir(e){if(e===void 0)return this._executableDir;return this._executableDir=e,this}helpInformation(e){let t=this.createHelp();if(t.helpWidth===void 0)t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},r;if(t.error)r=(n)=>this._outputConfiguration.writeErr(n);else r=(n)=>this._outputConfiguration.writeOut(n);return t.write=e.write||r,t.command=this,t}outputHelp(e){let t;if(typeof e==="function")t=e,e=void 0;let r=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach((o)=>o.emit("beforeAllHelp",r)),this.emit("beforeHelp",r);let n=this.helpInformation(r);if(t){if(n=t(n),typeof n!=="string"&&!Buffer.isBuffer(n))throw Error("outputHelp callback must return a string or a Buffer")}if(r.write(n),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",r),this._getCommandAndAncestors().forEach((o)=>o.emit("afterAllHelp",r))}helpOption(e,t){if(typeof e==="boolean"){if(e)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=k.exitCode||0;if(t===0&&e&&typeof e!=="function"&&e.error)t=1;this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
22
22
|
Expecting one of '${r.join("', '")}'`);let n=`${e}Help`;return this.on(n,(o)=>{let s;if(typeof t==="function")s=t({error:o.error,command:o.command});else s=t;if(s)o.write(`${s}
|
|
23
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();if(t&&e.find((n)=>t.is(n)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function
|
|
24
|
-
`,{mode:384}),await
|
|
25
|
-
`;if(await Mu(qu(t),{recursive:!0,mode:448}),!await Wu(t))await nn(t,"",{mode:384});await vu(t,n),await Yu(t)}async function Wu(e){try{return await rn(e),!0}catch{return!1}}async function Yu(e){let t=await rn(e).catch(()=>null);if(!t||t.size<=Ju)return;let r=await Vu(e),n=r.subarray(Math.max(0,r.length-Bu)),o=n.indexOf(10),s=o>=0?n.subarray(o+1):n;await nn(e,s,{mode:384})}var Qu=/^https?:\/\//i,Xu=/(https?:\/\/[^\s'"<>?]+)\?[^\s'"<>]*?(?:Signature|X-Amz-[A-Za-z0-9-]+|x-amz-security-token)=[^\s'"<>]*/gi;function Nt(e){return e.replace(Xu,"$1?[redacted-signed]")}function ec(e){if(typeof e!=="string")return e;if(e.startsWith("-"))return e;if(Qu.test(e))return Nt(e);if(/[\/\\]/.test(e))return tc(e);return e}function tc(e){let t=e.split(/[\/\\]/);return t[t.length-1]||e}function Tt(e){if(typeof e==="string")return Nt(e);if(Array.isArray(e))return e.map(Tt);if(e&&typeof e==="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=Tt(n);return t}return e}function rc(e){let t=JSON.stringify(e);if(t===void 0||t.length<=en)return e;return t.slice(0,en)+"...[truncated]"}async function B(e,t,r){let n=Date.now();try{let o=await r(),s=o.exitCode??0;if(await tn({cmd:e,args:t,exit:s,durationMs:Date.now()-n,renderId:o.renderId,response:o.response}).catch(()=>{}),s!==0)process.exit(s)}catch(o){let s=nc(o),i=o instanceof ee?o.body:void 0;throw await tn({cmd:e,args:t,exit:s,durationMs:Date.now()-n,response:i,error:Ku(o)}).catch(()=>{}),o}}function nc(e){if(e instanceof ee)return e.isTransient?2:1;if(e instanceof ue||e instanceof Ze)return 1;if(e instanceof Error&&e.code==="ENOENT")return 1;return 2}function H(e){let t=process.argv.slice(2),r=t.indexOf(e);return r>=0?t.slice(r+1):t}var oc=new Set(["done","failed"]),sc=3000,on=new F("status").description("Poll the status of a Shotstack render").argument("<id>","Render ID returned by `shotstack render`").option("--watch","Poll continuously until the render reaches a terminal state").option("--env <name>",`Environment: ${P.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await B("status",H("status"),async()=>{let r=C(t.output),n=J(t.env),o=U(n.name),s=q({apiKey:o,env:n}),i=await It(s,e,r,t.watch===!0),u=i.status==="failed"?1:0;return{renderId:i.id,response:i,exitCode:u}})});async function It(e,t,r,n){while(!0){let s=(await e.get(`/render/${encodeURIComponent(t)}`)).response;if(O(r,s,ic(s)),!n||oc.has(s.status))return s;await ac(sc)}}function ic(e){let t=[e.status];if(e.url)t.push(e.url);if(e.error)t.push(`error: ${e.error}`);return t.join(" ")}function ac(e){return new Promise((t)=>setTimeout(t,e))}var sn;function m(e,t,r){function n(u,p){if(!u._zod)Object.defineProperty(u,"_zod",{value:{def:p,constr:i,traits:new Set},enumerable:!1});if(u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,p);let l=i.prototype,h=Object.keys(l);for(let y=0;y<h.length;y++){let A=h[y];if(!(A in u))u[A]=l[A].bind(u)}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(u){var p;let l=r?.Parent?new s:this;n(l,u),(p=l._zod).deferred??(p.deferred=[]);for(let h of l._zod.deferred)h();return l}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:(u)=>{if(r?.Parent&&u instanceof r.Parent)return!0;return u?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var Bm=Symbol("zod_brand");class ae extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class De extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(sn=globalThis).__zod_globalConfig??(sn.__zod_globalConfig={});var Oe=globalThis.__zod_globalConfig;function te(e){if(e)Object.assign(Oe,e);return Oe}function et(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Le(e,t){if(typeof t==="bigint")return t.toString();return t}function Ue(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function tt(e){return e===null||e===void 0}function rt(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function un(e,t){let r=e/t,n=Math.round(r),o=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}var an=Symbol("evaluating");function R(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===an)return;if(n===void 0)n=an,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function he(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ce(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Ft(e){return JSON.stringify(e)}function cn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Dt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ee(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var pn=Ue(()=>{if(Oe.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ge(e){if(Ee(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(Ee(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Lt(e){if(ge(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var ln=new Set(["string","number","symbol"]);function pe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function se(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function w(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function fn(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var dn={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]};function uc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s=ce(e._zod.def,{get shape(){let i={};for(let u in t){if(!(u in r.shape))throw Error(`Unrecognized key: "${u}"`);if(!t[u])continue;i[u]=r.shape[u]}return he(this,"shape",i),i},checks:[]});return se(e,s)}function cc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=ce(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let u in t){if(!(u in r.shape))throw Error(`Unrecognized key: "${u}"`);if(!t[u])continue;delete i[u]}return he(this,"shape",i),i},checks:[]});return se(e,s)}function pc(e,t){if(!ge(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=ce(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return he(this,"shape",s),s}});return se(e,o)}function lc(e,t){if(!ge(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ce(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return he(this,"shape",n),n}});return se(e,r)}function fc(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ce(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return he(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return se(e,r)}function dc(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=ce(t._zod.def,{get shape(){let u=t._zod.def.shape,p={...u};if(r)for(let l in r){if(!(l in u))throw Error(`Unrecognized key: "${l}"`);if(!r[l])continue;p[l]=e?new e({type:"optional",innerType:u[l]}):u[l]}else for(let l in u)p[l]=e?new e({type:"optional",innerType:u[l]}):u[l];return he(this,"shape",p),p},checks:[]});return se(t,i)}function mc(e,t,r){let n=ce(t._zod.def,{get shape(){let o=t._zod.def.shape,s={...o};if(r)for(let i in r){if(!(i in s))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;s[i]=new e({type:"nonoptional",innerType:o[i]})}else for(let i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return he(this,"shape",s),s}});return se(t,n)}function _e(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function mn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function le(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Xe(e){return typeof e==="string"?e:e?.message}function re(e,t,r){let n=e.message?e.message:Xe(e.inst?._zod.def?.error?.(e))??Xe(t?.error?.(e))??Xe(r.customError?.(e))??Xe(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...u}=e;if(u.path??(u.path=[]),u.message=n,t?.reportInput)u.input=i;return u}function nt(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function xe(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}var hn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Le,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ot=m("$ZodError",hn),Ut=m("$ZodError",hn,{Parent:Error});function gn(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function _n(e,t=(r)=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((u)=>n({issues:u},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let u=[...s,...i.path];if(u.length===0)r._errors.push(t(i));else{let p=r,l=0;while(l<u.length){let h=u[l];if(l!==u.length-1)p[h]=p[h]||{_errors:[]};else p[h]=p[h]||{_errors:[]},p[h]._errors.push(t(i));p=p[h],l++}}}};return n(e),r}var st=(e)=>(t,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new ae;if(i.issues.length){let u=new(o?.Err??e)(i.issues.map((p)=>re(p,s,te())));throw Dt(u,o?.callee),u}return i.value};var it=(e)=>async(t,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let u=new(o?.Err??e)(i.issues.map((p)=>re(p,s,te())));throw Dt(u,o?.callee),u}return i.value};var Me=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ae;return s.issues.length?{success:!1,error:new(e??ot)(s.issues.map((i)=>re(i,o,te())))}:{success:!0,data:s.value}},xn=Me(Ut),ve=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>re(i,o,te())))}:{success:!0,data:s.value}},yn=ve(Ut),bn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return st(e)(t,r,o)};var $n=(e)=>(t,r,n)=>st(e)(t,r,n);var An=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return it(e)(t,r,o)};var wn=(e)=>async(t,r,n)=>it(e)(t,r,n);var zn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Me(e)(t,r,o)};var Sn=(e)=>(t,r,n)=>Me(e)(t,r,n);var kn=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ve(e)(t,r,o)};var Zn=(e)=>async(t,r,n)=>ve(e)(t,r,n);var On=/^[cC][0-9a-z]{6,}$/,En=/^[0-9a-z]+$/,Rn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Pn=/^[0-9a-vA-V]{20}$/,Cn=/^[A-Za-z0-9]{27}$/,Tn=/^[a-zA-Z0-9_-]{21}$/,Nn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var In=/^([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})$/,Mt=(e)=>{if(!e)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}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var jn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var gc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Fn(){return new RegExp(gc,"u")}var Dn=/^(?:(?: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])$/,Ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Un=/^((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])$/,Mn=/^(([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])$/,vn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vt=/^[A-Za-z0-9_-]*$/;var Vn=/^https?$/,qn=/^\+[1-9]\d{6,14}$/,Jn="(?:(?:\\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])))",Bn=new RegExp(`^${Jn}$`);function Hn(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.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{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Gn(e){return new RegExp(`^${Hn(e)}$`)}function Kn(e){let t=Hn({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Jn}T(?:${n})$`)}var Wn=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Yn=/^-?\d+$/,Vt=/^-?\d+(?:\.\d+)?$/,Qn=/^(?:true|false)$/i,Xn=/^null$/i;var eo=/^[^A-Z]*$/,to=/^[^a-z]*$/;var Y=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ro={number:"number",bigint:"bigint",object:"date"},qt=m("$ZodCheckLessThan",(e,t)=>{Y.init(e,t);let r=ro[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)o.maximum=t.value;else o.exclusiveMaximum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jt=m("$ZodCheckGreaterThan",(e,t)=>{Y.init(e,t);let r=ro[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)o.minimum=t.value;else o.exclusiveMinimum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),no=m("$ZodCheckMultipleOf",(e,t)=>{Y.init(e,t),e._zod.onattach.push((r)=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):un(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),oo=m("$ZodCheckNumberFormat",(e,t)=>{Y.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=dn[t.format];e._zod.onattach.push((i)=>{let u=i._zod.bag;if(u.format=t.format,u.minimum=o,u.maximum=s,r)u.pattern=Yn}),e._zod.check=(i)=>{let u=i.value;if(r){if(!Number.isInteger(u)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){if(u>0)i.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else i.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(u<o)i.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(u>s)i.issues.push({origin:"number",input:u,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var so=m("$ZodCheckMaxLength",(e,t)=>{var r;Y.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!tt(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)n._zod.bag.maximum=t.maximum}),e._zod.check=(n)=>{let o=n.value;if(o.length<=t.maximum)return;let i=nt(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),io=m("$ZodCheckMinLength",(e,t)=>{var r;Y.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!tt(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)n._zod.bag.minimum=t.minimum}),e._zod.check=(n)=>{let o=n.value;if(o.length>=t.minimum)return;let i=nt(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ao=m("$ZodCheckLengthEquals",(e,t)=>{var r;Y.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!tt(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(n)=>{let o=n.value,s=o.length;if(s===t.length)return;let i=nt(o),u=s>t.length;n.issues.push({origin:i,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ve=m("$ZodCheckStringFormat",(e,t)=>{var r,n;if(Y.init(e,t),e._zod.onattach.push((o)=>{let s=o._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),uo=m("$ZodCheckRegex",(e,t)=>{Ve.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),co=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=eo),Ve.init(e,t)}),po=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=to),Ve.init(e,t)}),lo=m("$ZodCheckIncludes",(e,t)=>{Y.init(e,t);let r=pe(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),fo=m("$ZodCheckStartsWith",(e,t)=>{Y.init(e,t);let r=new RegExp(`^${pe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),mo=m("$ZodCheckEndsWith",(e,t)=>{Y.init(e,t);let r=new RegExp(`.*${pe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var ho=m("$ZodCheckOverwrite",(e,t)=>{Y.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Bt{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
23
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();if(t&&e.find((n)=>t.is(n)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function Fr(e){return e.map((t)=>{if(!t.startsWith("--inspect"))return t;let r,n="127.0.0.1",o="9229",s;if((s=t.match(/^(--inspect(-brk)?)$/))!==null)r=s[1];else if((s=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(r=s[1],/^\d+$/.test(s[3]))o=s[3];else n=s[3];else if((s=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)r=s[1],n=s[3],o=s[4];if(r&&o!=="0")return`${r}=${n}:${parseInt(o)+1}`;return t})}Vu.Command=Rt});var Ct={};hu(Ct,{program:()=>Ur,createCommand:()=>Vr,createOption:()=>Jr,createArgument:()=>qr,Command:()=>Br,Option:()=>Hr,Argument:()=>Gr,Help:()=>Kr,CommanderError:()=>Wr,InvalidArgumentError:()=>Yr,InvalidOptionArgumentError:()=>Xr},{program:(Qm)=>Ur=Qm,createCommand:(Qm)=>Vr=Qm,createOption:(Qm)=>Jr=Qm,createArgument:(Qm)=>qr=Qm,Command:(Qm)=>Br=Qm,Option:(Qm)=>Hr=Qm,Argument:(Qm)=>Gr=Qm,Help:(Qm)=>Kr=Qm,CommanderError:(Qm)=>Wr=Qm,InvalidArgumentError:(Qm)=>Yr=Qm,InvalidOptionArgumentError:(Qm)=>Xr=Qm});var{Argument:Lr}=et(),{Command:Pt}=Dr(),{CommanderError:qu,InvalidArgumentError:Mr}=Fe(),{Help:Bu}=Zt(),{Option:vr}=Ot();var Ur=new Pt,Vr=(e)=>new Pt(e),Jr=(e,t)=>new vr(e,t),qr=(e,t)=>new Lr(e,t),Br=Pt,Hr=vr,Gr=Lr,Kr=Bu,Wr=qu,Yr=Mr,Xr=Mr;var{program:th,createCommand:rh,createArgument:nh,createOption:oh,CommanderError:sh,InvalidArgumentError:ee,InvalidOptionArgumentError:ih,Command:j,Argument:ah,Option:uh,Help:ch}=Ct;import{readFile as Gf}from"node:fs/promises";import{resolve as Kf}from"node:path";var Qr={name:"@shotstack/cli",version:"0.16.1",description:"Command-line interface for the Shotstack video rendering API.",license:"Apache-2.0",homepage:"https://github.com/shotstack/shotstack-cli",repository:{type:"git",url:"git+https://github.com/shotstack/shotstack-cli.git"},bugs:{url:"https://github.com/shotstack/shotstack-cli/issues"},type:"module",bin:{shotstack:"dist/shotstack.js"},files:["dist/shotstack.js","skills"],scripts:{start:"bun run src/index.ts",build:"bun build src/index.ts --target=node --minify --outfile=dist/shotstack.js --banner='#!/usr/bin/env node' && chmod +x dist/shotstack.js",prepack:"bun run build",typecheck:"tsc --noEmit",test:"bun test"},dependencies:{"@shotstack/schemas":"^1.22.0",commander:"^12.1.0",zod:"^4.4.3"},devDependencies:{"@types/bun":"latest",typescript:"^5.6.0"}};var De=Qr.version,en=`shotstack-cli/${De} (${process.platform}-${process.arch})`;class te extends Error{status;body;constructor(e,t,r){super(r);this.status=e;this.body=t;this.name="ApiError"}get isTransient(){return this.status>=500||this.status===429}}function U(e){let t=e.env.baseUrl.replace(/\/$/,"");async function r(n,o,s){let i=await fetch(`${t}${o}`,{method:n,headers:{"x-api-key":e.apiKey,"x-shotstack-origin":"cli","x-shotstack-environment":e.env.name,"user-agent":en,...s!==void 0?{"content-type":"application/json"}:{}},body:s!==void 0?JSON.stringify(s):void 0}),u=await i.text(),p=u?Gu(u):void 0;if(!i.ok)throw new te(i.status,p??u,`${n} ${o} → ${i.status} ${i.statusText}`);return p}return{post:(n,o)=>r("POST",n,o),put:(n,o)=>r("PUT",n,o),get:(n)=>r("GET",n),del:(n)=>r("DELETE",n)}}function Gu(e){try{return JSON.parse(e)}catch{return e}}import{mkdir as Ku,writeFile as Wu,chmod as Yu}from"node:fs/promises";import{readFileSync as Xu}from"node:fs";import{join as Tt,dirname as Qu}from"node:path";import{homedir as tn}from"node:os";function Oe(){if(process.platform==="win32"){let e=process.env.APPDATA??Tt(tn(),"AppData","Roaming");return Tt(e,"shotstack","credentials.json")}return Tt(tn(),".shotstack","credentials.json")}function Nt(e){try{let t=JSON.parse(Xu(e,"utf8"));if(t&&typeof t==="object"&&!Array.isArray(t))return t}catch{}return{}}function rn(e,t=Oe()){return Nt(t)[e]?.trim()||void 0}async function nn(e,t,r=Oe()){let n=Nt(r);n[e]=t.trim(),await It(r,n)}async function on(e,t=Oe()){let r=Nt(t);if(!(e in r))return!1;return delete r[e],await It(t,r),!0}async function sn(e=Oe()){await It(e,{})}async function It(e,t){await Ku(Qu(e),{recursive:!0,mode:448}),await Wu(e,JSON.stringify(t,null,2)+`
|
|
24
|
+
`,{mode:384}),await Yu(e,384).catch(()=>{})}class pe extends Error{constructor(e){let t=e?` for env "${e}"`:"",r=e?`shotstack login --env ${e}`:"shotstack login";super(`No Shotstack API key found${t}. Run \`${r}\` to save one, or set SHOTSTACK_API_KEY. Get a key at https://shotstack.io.`);this.name="MissingApiKeyError"}}function D(e,t){let r=process.env.SHOTSTACK_API_KEY?.trim();if(r)return r;let n=rn(e,t);if(n)return n;throw new pe(e)}var R=["dev","stage","v1"];class Ee extends Error{constructor(e){super(`Invalid environment "${e}". Use one of: ${R.join(", ")}.`);this.name="InvalidEnvError"}}function _e(e){let t=e??process.env.SHOTSTACK_ENV?.trim()??"v1";if(!tc(t))throw new Ee(t);return t}function V(e,t="edit"){let r=ec(t);if(r)return{name:"custom",baseUrl:r};let n=_e(e);return{name:n,baseUrl:`https://api.shotstack.io/${t}/${n}`}}function ec(e){return(e==="ingest"?process.env.SHOTSTACK_INGEST_BASE_URL:process.env.SHOTSTACK_API_BASE_URL)?.trim()||void 0}function tc(e){return R.includes(e)}function P(e){if(e==="json")return"json";return"text"}function O(e,t,r){if(e==="json")console.log(JSON.stringify(t));else console.log(r)}import{mkdir as rc,appendFile as nc,stat as pn,readFile as oc,writeFile as ln}from"node:fs/promises";import{join as jt,dirname as sc}from"node:path";import{homedir as an}from"node:os";var ic=1e6,ac=500000,un=2000;function tt(){if(process.platform==="win32"){let e=process.env.APPDATA??jt(an(),"AppData","Roaming");return jt(e,"shotstack","log.jsonl")}return jt(an(),".shotstack","log.jsonl")}function uc(e,t=new Date){let r={ts:t.toISOString(),cmd:e.cmd,args:e.args.map(hc),exit:e.exit,durationMs:e.durationMs};if(e.renderId)r.renderId=e.renderId;if(e.response!==void 0)r.response=_c(Ft(e.response));if(e.error)r.error=cc(e.error);return r}function cc(e){return{name:e.name,message:typeof e.message==="string"?Dt(e.message):String(e.message)}}function pc(e){if(e instanceof Error)return{name:e.name,message:e.message};if(e===void 0||e===null)return;return{name:"Unknown",message:String(e)}}async function cn(e,t=tt()){let r=uc(e),n=JSON.stringify(r)+`
|
|
25
|
+
`;if(await rc(sc(t),{recursive:!0,mode:448}),!await lc(t))await ln(t,"",{mode:384});await nc(t,n),await fc(t)}async function lc(e){try{return await pn(e),!0}catch{return!1}}async function fc(e){let t=await pn(e).catch(()=>null);if(!t||t.size<=ic)return;let r=await oc(e),n=r.subarray(Math.max(0,r.length-ac)),o=n.indexOf(10),s=o>=0?n.subarray(o+1):n;await ln(e,s,{mode:384})}var dc=/^https?:\/\//i,mc=/(https?:\/\/[^\s'"<>?]+)\?[^\s'"<>]*?(?:Signature|X-Amz-[A-Za-z0-9-]+|x-amz-security-token)=[^\s'"<>]*/gi;function Dt(e){return e.replace(mc,"$1?[redacted-signed]")}function hc(e){if(typeof e!=="string")return e;if(e.startsWith("-"))return e;if(dc.test(e))return Dt(e);if(/[\/\\]/.test(e))return gc(e);return e}function gc(e){let t=e.split(/[\/\\]/);return t[t.length-1]||e}function Ft(e){if(typeof e==="string")return Dt(e);if(Array.isArray(e))return e.map(Ft);if(e&&typeof e==="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=Ft(n);return t}return e}function _c(e){let t=JSON.stringify(e);if(t===void 0||t.length<=un)return e;return t.slice(0,un)+"...[truncated]"}async function J(e,t,r){let n=Date.now();try{let o=await r(),s=o.exitCode??0;if(await cn({cmd:e,args:t,exit:s,durationMs:Date.now()-n,renderId:o.renderId,response:o.response}).catch(()=>{}),s!==0)process.exit(s)}catch(o){let s=xc(o),i=o instanceof te?o.body:void 0;throw await cn({cmd:e,args:t,exit:s,durationMs:Date.now()-n,response:i,error:pc(o)}).catch(()=>{}),o}}function xc(e){if(e instanceof te)return e.isTransient?2:1;if(e instanceof pe||e instanceof Ee)return 1;if(e instanceof Error&&e.code==="ENOENT")return 1;return 2}function q(e){let t=process.argv.slice(2),r=t.indexOf(e);return r>=0?t.slice(r+1):t}var yc=new Set(["done","failed"]),bc=3000,fn=new j("status").description("Poll the status of a Shotstack render").argument("<id>","Render ID returned by `shotstack render`").option("--watch","Poll continuously until the render reaches a terminal state").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("status",q("status"),async()=>{let r=P(t.output),n=V(t.env),o=D(n.name),s=U({apiKey:o,env:n}),i=await Lt(s,e,r,t.watch===!0),u=i.status==="failed"?1:0;return{renderId:i.id,response:i,exitCode:u}})});async function Lt(e,t,r,n){while(!0){let s=(await e.get(`/render/${encodeURIComponent(t)}`)).response;if(O(r,s,wc(s)),!n||yc.has(s.status))return s;await $c(bc)}}function wc(e){let t=[e.status];if(e.url)t.push(e.url);if(e.error)t.push(`error: ${e.error}`);return t.join(" ")}function $c(e){return new Promise((t)=>setTimeout(t,e))}var dn;function h(e,t,r){function n(u,p){if(!u._zod)Object.defineProperty(u,"_zod",{value:{def:p,constr:i,traits:new Set},enumerable:!1});if(u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,p);let l=i.prototype,m=Object.keys(l);for(let x=0;x<m.length;x++){let b=m[x];if(!(b in u))u[b]=l[b].bind(u)}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(u){var p;let l=r?.Parent?new s:this;n(l,u),(p=l._zod).deferred??(p.deferred=[]);for(let m of l._zod.deferred)m();return l}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:(u)=>{if(r?.Parent&&u instanceof r.Parent)return!0;return u?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var Lh=Symbol("zod_brand");class ue extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Le extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(dn=globalThis).__zod_globalConfig??(dn.__zod_globalConfig={});var Re=globalThis.__zod_globalConfig;function re(e){if(e)Object.assign(Re,e);return Re}function nt(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Me(e,t){if(typeof t==="bigint")return t.toString();return t}function ve(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function ot(e){return e===null||e===void 0}function st(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function hn(e,t){let r=e/t,n=Math.round(r),o=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}var mn=Symbol("evaluating");function C(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===mn)return;if(n===void 0)n=mn,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function xe(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function le(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function vt(e){return JSON.stringify(e)}function gn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ut="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Pe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var _n=ve(()=>{if(Re.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ye(e){if(Pe(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(Pe(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Vt(e){if(ye(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var xn=new Set(["string","number","symbol"]);function fe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ie(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function A(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function yn(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var bn={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]};function Ac(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s=le(e._zod.def,{get shape(){let i={};for(let u in t){if(!(u in r.shape))throw Error(`Unrecognized key: "${u}"`);if(!t[u])continue;i[u]=r.shape[u]}return xe(this,"shape",i),i},checks:[]});return ie(e,s)}function Sc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=le(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let u in t){if(!(u in r.shape))throw Error(`Unrecognized key: "${u}"`);if(!t[u])continue;delete i[u]}return xe(this,"shape",i),i},checks:[]});return ie(e,s)}function zc(e,t){if(!ye(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=le(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return xe(this,"shape",s),s}});return ie(e,o)}function kc(e,t){if(!ye(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=le(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return xe(this,"shape",n),n}});return ie(e,r)}function Zc(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=le(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return xe(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ie(e,r)}function Oc(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=le(t._zod.def,{get shape(){let u=t._zod.def.shape,p={...u};if(r)for(let l in r){if(!(l in u))throw Error(`Unrecognized key: "${l}"`);if(!r[l])continue;p[l]=e?new e({type:"optional",innerType:u[l]}):u[l]}else for(let l in u)p[l]=e?new e({type:"optional",innerType:u[l]}):u[l];return xe(this,"shape",p),p},checks:[]});return ie(t,i)}function Ec(e,t,r){let n=le(t._zod.def,{get shape(){let o=t._zod.def.shape,s={...o};if(r)for(let i in r){if(!(i in s))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;s[i]=new e({type:"nonoptional",innerType:o[i]})}else for(let i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return xe(this,"shape",s),s}});return ie(t,n)}function be(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function wn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function de(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function rt(e){return typeof e==="string"?e:e?.message}function ne(e,t,r){let n=e.message?e.message:rt(e.inst?._zod.def?.error?.(e))??rt(t?.error?.(e))??rt(r.customError?.(e))??rt(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...u}=e;if(u.path??(u.path=[]),u.message=n,t?.reportInput)u.input=i;return u}function it(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function we(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}var $n=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Me,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},at=h("$ZodError",$n),Jt=h("$ZodError",$n,{Parent:Error});function An(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Sn(e,t=(r)=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((u)=>n({issues:u},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let u=[...s,...i.path];if(u.length===0)r._errors.push(t(i));else{let p=r,l=0;while(l<u.length){let m=u[l];if(l!==u.length-1)p[m]=p[m]||{_errors:[]};else p[m]=p[m]||{_errors:[]},p[m]._errors.push(t(i));p=p[m],l++}}}};return n(e),r}var ut=(e)=>(t,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new ue;if(i.issues.length){let u=new(o?.Err??e)(i.issues.map((p)=>ne(p,s,re())));throw Ut(u,o?.callee),u}return i.value};var ct=(e)=>async(t,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let u=new(o?.Err??e)(i.issues.map((p)=>ne(p,s,re())));throw Ut(u,o?.callee),u}return i.value};var Ue=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ue;return s.issues.length?{success:!1,error:new(e??at)(s.issues.map((i)=>ne(i,o,re())))}:{success:!0,data:s.value}},zn=Ue(Jt),Ve=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>ne(i,o,re())))}:{success:!0,data:s.value}},kn=Ve(Jt),Zn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ut(e)(t,r,o)};var On=(e)=>(t,r,n)=>ut(e)(t,r,n);var En=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ct(e)(t,r,o)};var Rn=(e)=>async(t,r,n)=>ct(e)(t,r,n);var Pn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ue(e)(t,r,o)};var Cn=(e)=>(t,r,n)=>Ue(e)(t,r,n);var Tn=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ve(e)(t,r,o)};var Nn=(e)=>async(t,r,n)=>Ve(e)(t,r,n);var In=/^[cC][0-9a-z]{6,}$/,jn=/^[0-9a-z]+$/,Fn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Dn=/^[0-9a-vA-V]{20}$/,Ln=/^[A-Za-z0-9]{27}$/,Mn=/^[a-zA-Z0-9_-]{21}$/,vn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Un=/^([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})$/,qt=(e)=>{if(!e)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}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Vn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Pc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Jn(){return new RegExp(Pc,"u")}var qn=/^(?:(?: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])$/,Bn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Hn=/^((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])$/,Gn=/^(([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])$/,Kn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Bt=/^[A-Za-z0-9_-]*$/;var Wn=/^https?$/,Yn=/^\+[1-9]\d{6,14}$/,Xn="(?:(?:\\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])))",Qn=new RegExp(`^${Xn}$`);function eo(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.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{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function to(e){return new RegExp(`^${eo(e)}$`)}function ro(e){let t=eo({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Xn}T(?:${n})$`)}var no=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var oo=/^-?\d+$/,Ht=/^-?\d+(?:\.\d+)?$/,so=/^(?:true|false)$/i,io=/^null$/i;var ao=/^[^A-Z]*$/,uo=/^[^a-z]*$/;var Y=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),co={number:"number",bigint:"bigint",object:"date"},Gt=h("$ZodCheckLessThan",(e,t)=>{Y.init(e,t);let r=co[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)o.maximum=t.value;else o.exclusiveMaximum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Kt=h("$ZodCheckGreaterThan",(e,t)=>{Y.init(e,t);let r=co[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)o.minimum=t.value;else o.exclusiveMinimum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),po=h("$ZodCheckMultipleOf",(e,t)=>{Y.init(e,t),e._zod.onattach.push((r)=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):hn(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),lo=h("$ZodCheckNumberFormat",(e,t)=>{Y.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=bn[t.format];e._zod.onattach.push((i)=>{let u=i._zod.bag;if(u.format=t.format,u.minimum=o,u.maximum=s,r)u.pattern=oo}),e._zod.check=(i)=>{let u=i.value;if(r){if(!Number.isInteger(u)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){if(u>0)i.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else i.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(u<o)i.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(u>s)i.issues.push({origin:"number",input:u,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var fo=h("$ZodCheckMaxLength",(e,t)=>{var r;Y.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!ot(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)n._zod.bag.maximum=t.maximum}),e._zod.check=(n)=>{let o=n.value;if(o.length<=t.maximum)return;let i=it(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),mo=h("$ZodCheckMinLength",(e,t)=>{var r;Y.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!ot(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)n._zod.bag.minimum=t.minimum}),e._zod.check=(n)=>{let o=n.value;if(o.length>=t.minimum)return;let i=it(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ho=h("$ZodCheckLengthEquals",(e,t)=>{var r;Y.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!ot(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(n)=>{let o=n.value,s=o.length;if(s===t.length)return;let i=it(o),u=s>t.length;n.issues.push({origin:i,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Je=h("$ZodCheckStringFormat",(e,t)=>{var r,n;if(Y.init(e,t),e._zod.onattach.push((o)=>{let s=o._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),go=h("$ZodCheckRegex",(e,t)=>{Je.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_o=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ao),Je.init(e,t)}),xo=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=uo),Je.init(e,t)}),yo=h("$ZodCheckIncludes",(e,t)=>{Y.init(e,t);let r=fe(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),bo=h("$ZodCheckStartsWith",(e,t)=>{Y.init(e,t);let r=new RegExp(`^${fe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),wo=h("$ZodCheckEndsWith",(e,t)=>{Y.init(e,t);let r=new RegExp(`.*${fe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var $o=h("$ZodCheckOverwrite",(e,t)=>{Y.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Wt{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
26
26
|
`).filter((s)=>s),n=Math.min(...r.map((s)=>s.length-s.trimStart().length)),o=r.map((s)=>s.slice(n)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[""]).map((o)=>` ${o}`)];return new e(...t,n.join(`
|
|
27
|
-
`))}}var _o={major:4,minor:4,patch:3};var j=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_o;let n=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,u,p)=>{let l=_e(i),h;for(let y of u){if(y._zod.def.when){if(mn(i))continue;if(!y._zod.def.when(i))continue}else if(l)continue;let A=i.issues.length,x=y._zod.check(i);if(x instanceof Promise&&p?.async===!1)throw new ae;if(h||x instanceof Promise)h=(h??Promise.resolve()).then(async()=>{if(await x,i.issues.length===A)return;if(!l)l=_e(i,A)});else{if(i.issues.length===A)continue;if(!l)l=_e(i,A)}}if(h)return h.then(()=>i);return i},s=(i,u,p)=>{if(_e(i))return i.aborted=!0,i;let l=o(u,n,p);if(l instanceof Promise){if(p.async===!1)throw new ae;return l.then((h)=>e._zod.parse(h,p))}return e._zod.parse(l,p)};e._zod.run=(i,u)=>{if(u.skipChecks)return e._zod.parse(i,u);if(u.direction==="backward"){let l=e._zod.parse({value:i.value,issues:[]},{...u,skipChecks:!0});if(l instanceof Promise)return l.then((h)=>s(h,i,u));return s(l,i,u)}let p=e._zod.parse(i,u);if(p instanceof Promise){if(u.async===!1)throw new ae;return p.then((l)=>o(l,n,u))}return o(p,n,u)}}R(e,"~standard",()=>({validate:(o)=>{try{let s=xn(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return yn(e,o).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),pt=m("$ZodString",(e,t)=>{j.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Wn(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),D=m("$ZodStringFormat",(e,t)=>{Ve.init(e,t),pt.init(e,t)}),ko=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=In),D.init(e,t)}),Zo=m("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Mt(n))}else t.pattern??(t.pattern=Mt());D.init(e,t)}),Oo=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=jn),D.init(e,t)}),Eo=m("$ZodURL",(e,t)=>{D.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===Vn.source){if(!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let o=new URL(n);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(o.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=o.href;else r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ro=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Fn()),D.init(e,t)}),Po=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Tn),D.init(e,t)}),Co=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=On),D.init(e,t)}),To=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=En),D.init(e,t)}),No=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Rn),D.init(e,t)}),Io=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Pn),D.init(e,t)}),jo=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Cn),D.init(e,t)}),Fo=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Kn(t)),D.init(e,t)}),Do=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Bn),D.init(e,t)}),Lo=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Gn(t)),D.init(e,t)}),Uo=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Nn),D.init(e,t)}),Mo=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Dn),D.init(e,t),e._zod.bag.format="ipv4"}),vo=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ln),D.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var Vo=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Un),D.init(e,t)}),qo=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Mn),D.init(e,t),e._zod.check=(r)=>{let n=r.value.split("/");try{if(n.length!==2)throw Error();let[o,s]=n;if(!s)throw Error();let i=Number(s);if(`${i}`!==s)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Jo(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Bo=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=vn),D.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(Jo(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function _c(e){if(!vt.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Jo(r)}var Ho=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=vt),D.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(_c(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Go=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qn),D.init(e,t)});function xc(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Ko=m("$ZodJWT",(e,t)=>{D.init(e,t),e._zod.check=(r)=>{if(xc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Gt=m("$ZodNumber",(e,t)=>{j.init(e,t),e._zod.pattern=e._zod.bag.pattern??Vt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),Wo=m("$ZodNumberFormat",(e,t)=>{oo.init(e,t),Gt.init(e,t)}),Yo=m("$ZodBoolean",(e,t)=>{j.init(e,t),e._zod.pattern=Qn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Qo=m("$ZodNull",(e,t)=>{j.init(e,t),e._zod.pattern=Xn,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;if(o===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var Xo=m("$ZodUnknown",(e,t)=>{j.init(e,t),e._zod.parse=(r)=>r}),es=m("$ZodNever",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),ts=m("$ZodVoid",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(typeof o>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}});function xo(e,t,r){if(e.issues.length)t.issues.push(...le(r,e.issues));t.value[r]=e.value}var rs=m("$ZodArray",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let u=o[i],p=t.element._zod.run({value:u,issues:[]},n);if(p instanceof Promise)s.push(p.then((l)=>xo(l,r,i)));else xo(p,r,i)}if(s.length)return Promise.all(s).then(()=>r);return r}});function ct(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...le(r,e.issues))}if(!i&&!o){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i)t.value[r]=void 0}else t.value[r]=e.value}function ns(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let r=fn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function os(e,t,r,n,o,s){let i=[],u=o.keySet,p=o.catchall._zod,l=p.def.type,h=p.optin==="optional",y=p.optout==="optional";for(let A in t){if(A==="__proto__")continue;if(u.has(A))continue;if(l==="never"){i.push(A);continue}let x=p.run({value:t[A],issues:[]},n);if(x instanceof Promise)e.push(x.then((z)=>ct(z,r,A,t,h,y)));else ct(x,r,A,t,h,y)}if(i.length)r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s});if(!e.length)return r;return Promise.all(e).then(()=>r)}var yc=m("$ZodObject",(e,t)=>{if(j.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let u=t.shape;Object.defineProperty(t,"shape",{get:()=>{let p={...u};return Object.defineProperty(t,"shape",{value:p}),p}})}let n=Ue(()=>ns(t));R(e._zod,"propValues",()=>{let u=t.shape,p={};for(let l in u){let h=u[l]._zod;if(h.values){p[l]??(p[l]=new Set);for(let y of h.values)p[l].add(y)}}return p});let o=Ee,s=t.catchall,i;e._zod.parse=(u,p)=>{i??(i=n.value);let l=u.value;if(!o(l))return u.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),u;u.value={};let h=[],y=i.shape;for(let A of i.keys){let x=y[A],z=x._zod.optin==="optional",v=x._zod.optout==="optional",T=x._zod.run({value:l[A],issues:[]},p);if(T instanceof Promise)h.push(T.then((ie)=>ct(ie,u,A,l,z,v)));else ct(T,u,A,l,z,v)}if(!s)return h.length?Promise.all(h).then(()=>u):u;return os(h,l,u,p,n.value,e)}}),ss=m("$ZodObjectJIT",(e,t)=>{yc.init(e,t);let r=e._zod.parse,n=Ue(()=>ns(t)),o=(A)=>{let x=new Bt(["shape","payload","ctx"]),z=n.value,v=(oe)=>{let V=Ft(oe);return`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`};x.write("const input = payload.value;");let T=Object.create(null),ie=0;for(let oe of z.keys)T[oe]=`key_${ie++}`;x.write("const newResult = {};");for(let oe of z.keys){let V=T[oe],W=Ft(oe),br=A[oe],$r=br?._zod?.optin==="optional",Qa=br?._zod?.optout==="optional";if(x.write(`const ${V} = ${v(oe)};`),$r&&Qa)x.write(`
|
|
28
|
-
if (${
|
|
27
|
+
`))}}var So={major:4,minor:4,patch:3};var L=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=So;let n=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,u,p)=>{let l=be(i),m;for(let x of u){if(x._zod.def.when){if(wn(i))continue;if(!x._zod.def.when(i))continue}else if(l)continue;let b=i.issues.length,y=x._zod.check(i);if(y instanceof Promise&&p?.async===!1)throw new ue;if(m||y instanceof Promise)m=(m??Promise.resolve()).then(async()=>{if(await y,i.issues.length===b)return;if(!l)l=be(i,b)});else{if(i.issues.length===b)continue;if(!l)l=be(i,b)}}if(m)return m.then(()=>i);return i},s=(i,u,p)=>{if(be(i))return i.aborted=!0,i;let l=o(u,n,p);if(l instanceof Promise){if(p.async===!1)throw new ue;return l.then((m)=>e._zod.parse(m,p))}return e._zod.parse(l,p)};e._zod.run=(i,u)=>{if(u.skipChecks)return e._zod.parse(i,u);if(u.direction==="backward"){let l=e._zod.parse({value:i.value,issues:[]},{...u,skipChecks:!0});if(l instanceof Promise)return l.then((m)=>s(m,i,u));return s(l,i,u)}let p=e._zod.parse(i,u);if(p instanceof Promise){if(u.async===!1)throw new ue;return p.then((l)=>o(l,n,u))}return o(p,n,u)}}C(e,"~standard",()=>({validate:(o)=>{try{let s=zn(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return kn(e,o).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),dt=h("$ZodString",(e,t)=>{L.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??no(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),M=h("$ZodStringFormat",(e,t)=>{Je.init(e,t),dt.init(e,t)}),To=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Un),M.init(e,t)}),No=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=qt(n))}else t.pattern??(t.pattern=qt());M.init(e,t)}),Io=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Vn),M.init(e,t)}),jo=h("$ZodURL",(e,t)=>{M.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===Wn.source){if(!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let o=new URL(n);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(o.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=o.href;else r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Fo=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Jn()),M.init(e,t)}),Do=h("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Mn),M.init(e,t)}),Lo=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=In),M.init(e,t)}),Mo=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=jn),M.init(e,t)}),vo=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Fn),M.init(e,t)}),Uo=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Dn),M.init(e,t)}),Vo=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ln),M.init(e,t)}),Jo=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ro(t)),M.init(e,t)}),qo=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Qn),M.init(e,t)}),Bo=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=to(t)),M.init(e,t)}),Ho=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vn),M.init(e,t)}),Go=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=qn),M.init(e,t),e._zod.bag.format="ipv4"}),Ko=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Bn),M.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var Wo=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Hn),M.init(e,t)}),Yo=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Gn),M.init(e,t),e._zod.check=(r)=>{let n=r.value.split("/");try{if(n.length!==2)throw Error();let[o,s]=n;if(!s)throw Error();let i=Number(s);if(`${i}`!==s)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Xo(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Qo=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Kn),M.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(Xo(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Cc(e){if(!Bt.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Xo(r)}var es=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Bt),M.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(Cc(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ts=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Yn),M.init(e,t)});function Tc(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var rs=h("$ZodJWT",(e,t)=>{M.init(e,t),e._zod.check=(r)=>{if(Tc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Xt=h("$ZodNumber",(e,t)=>{L.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ht,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),ns=h("$ZodNumberFormat",(e,t)=>{lo.init(e,t),Xt.init(e,t)}),os=h("$ZodBoolean",(e,t)=>{L.init(e,t),e._zod.pattern=so,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var ss=h("$ZodNull",(e,t)=>{L.init(e,t),e._zod.pattern=io,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;if(o===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var is=h("$ZodUnknown",(e,t)=>{L.init(e,t),e._zod.parse=(r)=>r}),as=h("$ZodNever",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),us=h("$ZodVoid",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(typeof o>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}});function zo(e,t,r){if(e.issues.length)t.issues.push(...de(r,e.issues));t.value[r]=e.value}var cs=h("$ZodArray",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let u=o[i],p=t.element._zod.run({value:u,issues:[]},n);if(p instanceof Promise)s.push(p.then((l)=>zo(l,r,i)));else zo(p,r,i)}if(s.length)return Promise.all(s).then(()=>r);return r}});function ft(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...de(r,e.issues))}if(!i&&!o){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i)t.value[r]=void 0}else t.value[r]=e.value}function ps(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let r=yn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function ls(e,t,r,n,o,s){let i=[],u=o.keySet,p=o.catchall._zod,l=p.def.type,m=p.optin==="optional",x=p.optout==="optional";for(let b in t){if(b==="__proto__")continue;if(u.has(b))continue;if(l==="never"){i.push(b);continue}let y=p.run({value:t[b],issues:[]},n);if(y instanceof Promise)e.push(y.then((S)=>ft(S,r,b,t,m,x)));else ft(y,r,b,t,m,x)}if(i.length)r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s});if(!e.length)return r;return Promise.all(e).then(()=>r)}var Nc=h("$ZodObject",(e,t)=>{if(L.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let u=t.shape;Object.defineProperty(t,"shape",{get:()=>{let p={...u};return Object.defineProperty(t,"shape",{value:p}),p}})}let n=ve(()=>ps(t));C(e._zod,"propValues",()=>{let u=t.shape,p={};for(let l in u){let m=u[l]._zod;if(m.values){p[l]??(p[l]=new Set);for(let x of m.values)p[l].add(x)}}return p});let o=Pe,s=t.catchall,i;e._zod.parse=(u,p)=>{i??(i=n.value);let l=u.value;if(!o(l))return u.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),u;u.value={};let m=[],x=i.shape;for(let b of i.keys){let y=x[b],S=y._zod.optin==="optional",F=y._zod.optout==="optional",T=y._zod.run({value:l[b],issues:[]},p);if(T instanceof Promise)m.push(T.then((ae)=>ft(ae,u,b,l,S,F)));else ft(T,u,b,l,S,F)}if(!s)return m.length?Promise.all(m).then(()=>u):u;return ls(m,l,u,p,n.value,e)}}),fs=h("$ZodObjectJIT",(e,t)=>{Nc.init(e,t);let r=e._zod.parse,n=ve(()=>ps(t)),o=(b)=>{let y=new Wt(["shape","payload","ctx"]),S=n.value,F=(se)=>{let H=vt(se);return`shape[${H}]._zod.run({ value: input[${H}], issues: [] }, ctx)`};y.write("const input = payload.value;");let T=Object.create(null),ae=0;for(let se of S.keys)T[se]=`key_${ae++}`;y.write("const newResult = {};");for(let se of S.keys){let H=T[se],W=vt(se),Zr=b[se],Or=Zr?._zod?.optin==="optional",du=Zr?._zod?.optout==="optional";if(y.write(`const ${H} = ${F(se)};`),Or&&du)y.write(`
|
|
28
|
+
if (${H}.issues.length) {
|
|
29
29
|
if (${W} in input) {
|
|
30
|
-
payload.issues = payload.issues.concat(${
|
|
30
|
+
payload.issues = payload.issues.concat(${H}.issues.map(iss => ({
|
|
31
31
|
...iss,
|
|
32
32
|
path: iss.path ? [${W}, ...iss.path] : [${W}]
|
|
33
33
|
})));
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if (${
|
|
37
|
+
if (${H}.value === undefined) {
|
|
38
38
|
if (${W} in input) {
|
|
39
39
|
newResult[${W}] = undefined;
|
|
40
40
|
}
|
|
41
41
|
} else {
|
|
42
|
-
newResult[${W}] = ${
|
|
42
|
+
newResult[${W}] = ${H}.value;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
`);else if(
|
|
46
|
-
const ${
|
|
47
|
-
if (${
|
|
48
|
-
payload.issues = payload.issues.concat(${
|
|
45
|
+
`);else if(!Or)y.write(`
|
|
46
|
+
const ${H}_present = ${W} in input;
|
|
47
|
+
if (${H}.issues.length) {
|
|
48
|
+
payload.issues = payload.issues.concat(${H}.issues.map(iss => ({
|
|
49
49
|
...iss,
|
|
50
50
|
path: iss.path ? [${W}, ...iss.path] : [${W}]
|
|
51
51
|
})));
|
|
52
52
|
}
|
|
53
|
-
if (!${
|
|
53
|
+
if (!${H}_present && !${H}.issues.length) {
|
|
54
54
|
payload.issues.push({
|
|
55
55
|
code: "invalid_type",
|
|
56
56
|
expected: "nonoptional",
|
|
@@ -59,39 +59,42 @@ Expecting one of '${r.join("', '")}'`);let n=`${e}Help`;return this.on(n,(o)=>{l
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
if (${
|
|
63
|
-
if (${
|
|
62
|
+
if (${H}_present) {
|
|
63
|
+
if (${H}.value === undefined) {
|
|
64
64
|
newResult[${W}] = undefined;
|
|
65
65
|
} else {
|
|
66
|
-
newResult[${W}] = ${
|
|
66
|
+
newResult[${W}] = ${H}.value;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
`);else
|
|
71
|
-
if (${
|
|
72
|
-
payload.issues = payload.issues.concat(${
|
|
70
|
+
`);else y.write(`
|
|
71
|
+
if (${H}.issues.length) {
|
|
72
|
+
payload.issues = payload.issues.concat(${H}.issues.map(iss => ({
|
|
73
73
|
...iss,
|
|
74
74
|
path: iss.path ? [${W}, ...iss.path] : [${W}]
|
|
75
75
|
})));
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
if (${
|
|
78
|
+
if (${H}.value === undefined) {
|
|
79
79
|
if (${W} in input) {
|
|
80
80
|
newResult[${W}] = undefined;
|
|
81
81
|
}
|
|
82
82
|
} else {
|
|
83
|
-
newResult[${W}] = ${
|
|
83
|
+
newResult[${W}] = ${H}.value;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
`)}x.write("payload.value = newResult;"),x.write("return payload;");let Ya=x.compile();return(oe,V)=>Ya(A,oe,V)},s,i=Ee,u=!Oe.jitless,l=u&&pn.value,h=t.catchall,y;e._zod.parse=(A,x)=>{y??(y=n.value);let z=A.value;if(!i(z))return A.issues.push({expected:"object",code:"invalid_type",input:z,inst:e}),A;if(u&&l&&x?.async===!1&&x.jitless!==!0){if(!s)s=o(t.shape);if(A=s(A,x),!h)return A;return os([],z,A,x,y,e)}return r(A,x)}});function yo(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!_e(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>re(i,n,te())))}),t}var Kt=m("$ZodUnion",(e,t)=>{j.init(e,t),R(e._zod,"optin",()=>t.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),R(e._zod,"optout",()=>t.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),R(e._zod,"values",()=>{if(t.options.every((n)=>n._zod.values))return new Set(t.options.flatMap((n)=>Array.from(n._zod.values)));return}),R(e._zod,"pattern",()=>{if(t.options.every((n)=>n._zod.pattern)){let n=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${n.map((o)=>rt(o.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let u of t.options){let p=u._zod.run({value:n.value,issues:[]},o);if(p instanceof Promise)i.push(p),s=!0;else{if(p.issues.length===0)return p;i.push(p)}}if(!s)return yo(i,n,e,o);return Promise.all(i).then((u)=>yo(u,n,e,o))}});var is=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Kt.init(e,t);let r=e._zod.parse;R(e._zod,"propValues",()=>{let o={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[u,p]of Object.entries(i)){if(!o[u])o[u]=new Set;for(let l of p)o[u].add(l)}}return o});let n=Ue(()=>{let o=t.options,s=new Map;for(let i of o){let u=i._zod.propValues?.[t.discriminator];if(!u||u.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let p of u){if(s.has(p))throw Error(`Duplicate discriminator value "${String(p)}"`);s.set(p,i)}}return s});e._zod.parse=(o,s)=>{let i=o.value;if(!Ee(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let u=n.value.get(i?.[t.discriminator]);if(u)return u._zod.run(o,s);if(t.unionFallback||s.direction==="backward")return r(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:i,path:[t.discriminator],inst:e}),o}}),as=m("$ZodIntersection",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([p,l])=>bo(r,p,l));return bo(r,s,i)}});function Ht(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ge(e)&&ge(t)){let r=Object.keys(t),n=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),o={...e,...t};for(let s of n){let i=Ht(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=Ht(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bo(e,t,r){let n=new Map,o;for(let u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(let p of u.keys){if(!n.has(p))n.set(p,{});n.get(p).l=!0}}else e.issues.push(u);for(let u of r.issues)if(u.code==="unrecognized_keys")for(let p of u.keys){if(!n.has(p))n.set(p,{});n.get(p).r=!0}else e.issues.push(u);let s=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length&&o)e.issues.push({...o,keys:s});if(_e(e))return e;let i=Ht(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var us=m("$ZodRecord",(e,t)=>{j.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!ge(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let u=new Set;for(let l of i)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){u.add(typeof l==="number"?l.toString():l);let h=t.keyType._zod.run({value:l,issues:[]},n);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map((x)=>re(x,n,te())),input:l,path:[l],inst:e});continue}let y=h.value,A=t.valueType._zod.run({value:o[l],issues:[]},n);if(A instanceof Promise)s.push(A.then((x)=>{if(x.issues.length)r.issues.push(...le(l,x.issues));r.value[y]=x.value}));else{if(A.issues.length)r.issues.push(...le(l,A.issues));r.value[y]=A.value}}let p;for(let l in o)if(!u.has(l))p=p??[],p.push(l);if(p&&p.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:p})}else{r.value={};for(let u of Reflect.ownKeys(o)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,u))continue;let p=t.keyType._zod.run({value:u,issues:[]},n);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Vt.test(u)&&p.issues.length){let y=t.keyType._zod.run({value:Number(u),issues:[]},n);if(y instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(y.issues.length===0)p=y}if(p.issues.length){if(t.mode==="loose")r.value[u]=o[u];else r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((y)=>re(y,n,te())),input:u,path:[u],inst:e});continue}let h=t.valueType._zod.run({value:o[u],issues:[]},n);if(h instanceof Promise)s.push(h.then((y)=>{if(y.issues.length)r.issues.push(...le(u,y.issues));r.value[p.value]=y.value}));else{if(h.issues.length)r.issues.push(...le(u,h.issues));r.value[p.value]=h.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var cs=m("$ZodEnum",(e,t)=>{j.init(e,t);let r=et(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter((o)=>ln.has(typeof o)).map((o)=>typeof o==="string"?pe(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;if(n.has(i))return o;return o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),ps=m("$ZodLiteral",(e,t)=>{if(j.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n==="string"?pe(n):n?pe(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var ls=m("$ZodTransform",(e,t)=>{j.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new De(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(r.value=i,r.fallback=!0,r));if(o instanceof Promise)throw new ae;return r.value=o,r.fallback=!0,r}});function $o(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Wt=m("$ZodOptional",(e,t)=>{j.init(e,t),e._zod.optin="optional",e._zod.optout="optional",R(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),R(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${rt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,s=t.innerType._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>$o(i,o));return $o(s,o)}if(r.value===void 0)return r;return t.innerType._zod.run(r,n)}}),fs=m("$ZodExactOptional",(e,t)=>{Wt.init(e,t),R(e._zod,"values",()=>t.innerType._zod.values),R(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ds=m("$ZodNullable",(e,t)=>{j.init(e,t),R(e._zod,"optin",()=>t.innerType._zod.optin),R(e._zod,"optout",()=>t.innerType._zod.optout),R(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${rt(r.source)}|null)$`):void 0}),R(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),ms=m("$ZodDefault",(e,t)=>{j.init(e,t),e._zod.optin="optional",R(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Ao(s,t));return Ao(o,t)}});function Ao(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var hs=m("$ZodPrefault",(e,t)=>{j.init(e,t),e._zod.optin="optional",R(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),gs=m("$ZodNonOptional",(e,t)=>{j.init(e,t),R(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>wo(s,e));return wo(o,e)}});function wo(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var _s=m("$ZodCatch",(e,t)=>{j.init(e,t),e._zod.optin="optional",R(e._zod,"optout",()=>t.innerType._zod.optout),R(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((i)=>re(i,n,te()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=o.value,o.issues.length)r.value=t.catchValue({...r,error:{issues:o.issues.map((s)=>re(s,n,te()))},input:r.value}),r.issues=[],r.fallback=!0;return r}});var Yt=m("$ZodPipe",(e,t)=>{j.init(e,t),R(e._zod,"values",()=>t.in._zod.values),R(e._zod,"optin",()=>t.in._zod.optin),R(e._zod,"optout",()=>t.out._zod.optout),R(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>ut(i,t.in,n));return ut(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>ut(s,t.out,n));return ut(o,t.out,n)}});function ut(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var xs=m("$ZodPreprocess",(e,t)=>{Yt.init(e,t)}),ys=m("$ZodReadonly",(e,t)=>{j.init(e,t),R(e._zod,"propValues",()=>t.innerType._zod.propValues),R(e._zod,"values",()=>t.innerType._zod.values),R(e._zod,"optin",()=>t.innerType?._zod?.optin),R(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(zo);return zo(o)}});function zo(e){return e.value=Object.freeze(e.value),e}var bs=m("$ZodCustom",(e,t)=>{Y.init(e,t),j.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((s)=>So(s,r,n,e));So(o,r,n,e);return}});function So(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(xe(o))}}var $s,fh=Symbol("ZodOutput"),dh=Symbol("ZodInput");class As{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function bc(){return new As}($s=globalThis).__zod_globalRegistry??($s.__zod_globalRegistry=bc());var ye=globalThis.__zod_globalRegistry;function ws(e,t){return new e({type:"string",...w(t)})}function zs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}function Qt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function Ss(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}function ks(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}function Zs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}function Os(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}function Es(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function Rs(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function Ps(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function Cs(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function Ts(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function Ns(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}function Is(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}function js(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}function Fs(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function Ds(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function Ls(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}function Us(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}function Ms(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}function vs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}function Vs(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}function qs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}function Js(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function Bs(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}function Hs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}function Gs(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}function Ks(e,t){return new e({type:"number",checks:[],...w(t)})}function Ws(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}function Ys(e,t){return new e({type:"boolean",...w(t)})}function Qs(e,t){return new e({type:"null",...w(t)})}function Xs(e){return new e({type:"unknown"})}function ei(e,t){return new e({type:"never",...w(t)})}function ti(e,t){return new e({type:"void",...w(t)})}function lt(e,t){return new qt({check:"less_than",...w(t),value:e,inclusive:!1})}function qe(e,t){return new qt({check:"less_than",...w(t),value:e,inclusive:!0})}function ft(e,t){return new Jt({check:"greater_than",...w(t),value:e,inclusive:!1})}function Je(e,t){return new Jt({check:"greater_than",...w(t),value:e,inclusive:!0})}function dt(e,t){return new no({check:"multiple_of",...w(t),value:e})}function mt(e,t){return new so({check:"max_length",...w(t),maximum:e})}function Re(e,t){return new io({check:"min_length",...w(t),minimum:e})}function ht(e,t){return new ao({check:"length_equals",...w(t),length:e})}function Xt(e,t){return new uo({check:"string_format",format:"regex",...w(t),pattern:e})}function er(e){return new co({check:"string_format",format:"lowercase",...w(e)})}function tr(e){return new po({check:"string_format",format:"uppercase",...w(e)})}function rr(e,t){return new lo({check:"string_format",format:"includes",...w(t),includes:e})}function nr(e,t){return new fo({check:"string_format",format:"starts_with",...w(t),prefix:e})}function or(e,t){return new mo({check:"string_format",format:"ends_with",...w(t),suffix:e})}function de(e){return new ho({check:"overwrite",tx:e})}function sr(e){return de((t)=>t.normalize(e))}function ir(){return de((e)=>e.trim())}function ar(){return de((e)=>e.toLowerCase())}function ur(){return de((e)=>e.toUpperCase())}function cr(){return de((e)=>cn(e))}function ri(e,t,r){return new e({type:"array",element:t,...w(r)})}function ni(e,t,r){return new e({type:"custom",check:"custom",fn:t,...w(r)})}function oi(e,t){let r=$c((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(xe(o,n.value,r._zod.def));else{let s=o;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(xe(s))}},e(n.value,n)),t);return r}function $c(e,t){let r=new Y({check:"custom",...w(t)});return r._zod.check=e,r}function pr(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??ye,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function G(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let u=e._zod.toJSONSchema?.();if(u)i.schema=u;else{let h={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,h);else{let A=i.schema,x=t.processors[o.type];if(!x)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);x(e,t,A,h)}let y=e._zod.parent;if(y){if(!i.ref)i.ref=y;G(y,t,h),t.seen.get(y).isParent=!0}}let p=t.metadataRegistry.get(e);if(p)Object.assign(i.schema,p);if(t.io==="input"&&Q(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function lr(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let i of e.seen.entries()){let u=e.metadataRegistry.get(i[0])?.id;if(u){let p=n.get(u);if(p&&p!==i[0])throw Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(u,i[0])}}let o=(i)=>{let u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let y=e.external.registry.get(i[0])?.id,A=e.external.uri??((z)=>z);if(y)return{ref:A(y)};let x=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=x,{defId:x,ref:`${A("__shared")}#/${u}/${x}`}}if(i[1]===r)return{ref:"#"};let l=`${"#"}/${u}/`,h=i[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:l+h}},s=(i)=>{if(i[1].schema.$ref)return;let u=i[1],{ref:p,defId:l}=o(i);if(u.def={...u.schema},l)u.defId=l;let h=u.schema;for(let y in h)delete h[y];h.$ref=p};if(e.cycles==="throw")for(let i of e.seen.entries()){let u=i[1];if(u.cycle)throw Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
|
|
86
|
+
`)}y.write("payload.value = newResult;"),y.write("return payload;");let fu=y.compile();return(se,H)=>fu(b,se,H)},s,i=Pe,u=!Re.jitless,l=u&&_n.value,m=t.catchall,x;e._zod.parse=(b,y)=>{x??(x=n.value);let S=b.value;if(!i(S))return b.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),b;if(u&&l&&y?.async===!1&&y.jitless!==!0){if(!s)s=o(t.shape);if(b=s(b,y),!m)return b;return ls([],S,b,y,x,e)}return r(b,y)}});function ko(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!be(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>ne(i,n,re())))}),t}var Qt=h("$ZodUnion",(e,t)=>{L.init(e,t),C(e._zod,"optin",()=>t.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),C(e._zod,"optout",()=>t.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),C(e._zod,"values",()=>{if(t.options.every((n)=>n._zod.values))return new Set(t.options.flatMap((n)=>Array.from(n._zod.values)));return}),C(e._zod,"pattern",()=>{if(t.options.every((n)=>n._zod.pattern)){let n=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${n.map((o)=>st(o.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let u of t.options){let p=u._zod.run({value:n.value,issues:[]},o);if(p instanceof Promise)i.push(p),s=!0;else{if(p.issues.length===0)return p;i.push(p)}}if(!s)return ko(i,n,e,o);return Promise.all(i).then((u)=>ko(u,n,e,o))}});var ds=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Qt.init(e,t);let r=e._zod.parse;C(e._zod,"propValues",()=>{let o={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[u,p]of Object.entries(i)){if(!o[u])o[u]=new Set;for(let l of p)o[u].add(l)}}return o});let n=ve(()=>{let o=t.options,s=new Map;for(let i of o){let u=i._zod.propValues?.[t.discriminator];if(!u||u.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let p of u){if(s.has(p))throw Error(`Duplicate discriminator value "${String(p)}"`);s.set(p,i)}}return s});e._zod.parse=(o,s)=>{let i=o.value;if(!Pe(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let u=n.value.get(i?.[t.discriminator]);if(u)return u._zod.run(o,s);if(t.unionFallback||s.direction==="backward")return r(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:i,path:[t.discriminator],inst:e}),o}}),ms=h("$ZodIntersection",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([p,l])=>Zo(r,p,l));return Zo(r,s,i)}});function Yt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ye(e)&&ye(t)){let r=Object.keys(t),n=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),o={...e,...t};for(let s of n){let i=Yt(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=Yt(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Zo(e,t,r){let n=new Map,o;for(let u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(let p of u.keys){if(!n.has(p))n.set(p,{});n.get(p).l=!0}}else e.issues.push(u);for(let u of r.issues)if(u.code==="unrecognized_keys")for(let p of u.keys){if(!n.has(p))n.set(p,{});n.get(p).r=!0}else e.issues.push(u);let s=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length&&o)e.issues.push({...o,keys:s});if(be(e))return e;let i=Yt(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var hs=h("$ZodRecord",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!ye(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let u=new Set;for(let l of i)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){u.add(typeof l==="number"?l.toString():l);let m=t.keyType._zod.run({value:l,issues:[]},n);if(m instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(m.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map((y)=>ne(y,n,re())),input:l,path:[l],inst:e});continue}let x=m.value,b=t.valueType._zod.run({value:o[l],issues:[]},n);if(b instanceof Promise)s.push(b.then((y)=>{if(y.issues.length)r.issues.push(...de(l,y.issues));r.value[x]=y.value}));else{if(b.issues.length)r.issues.push(...de(l,b.issues));r.value[x]=b.value}}let p;for(let l in o)if(!u.has(l))p=p??[],p.push(l);if(p&&p.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:p})}else{r.value={};for(let u of Reflect.ownKeys(o)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,u))continue;let p=t.keyType._zod.run({value:u,issues:[]},n);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Ht.test(u)&&p.issues.length){let x=t.keyType._zod.run({value:Number(u),issues:[]},n);if(x instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(x.issues.length===0)p=x}if(p.issues.length){if(t.mode==="loose")r.value[u]=o[u];else r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((x)=>ne(x,n,re())),input:u,path:[u],inst:e});continue}let m=t.valueType._zod.run({value:o[u],issues:[]},n);if(m instanceof Promise)s.push(m.then((x)=>{if(x.issues.length)r.issues.push(...de(u,x.issues));r.value[p.value]=x.value}));else{if(m.issues.length)r.issues.push(...de(u,m.issues));r.value[p.value]=m.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var gs=h("$ZodEnum",(e,t)=>{L.init(e,t);let r=nt(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter((o)=>xn.has(typeof o)).map((o)=>typeof o==="string"?fe(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;if(n.has(i))return o;return o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),_s=h("$ZodLiteral",(e,t)=>{if(L.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n==="string"?fe(n):n?fe(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var xs=h("$ZodTransform",(e,t)=>{L.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Le(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(r.value=i,r.fallback=!0,r));if(o instanceof Promise)throw new ue;return r.value=o,r.fallback=!0,r}});function Oo(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var er=h("$ZodOptional",(e,t)=>{L.init(e,t),e._zod.optin="optional",e._zod.optout="optional",C(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),C(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${st(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,s=t.innerType._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>Oo(i,o));return Oo(s,o)}if(r.value===void 0)return r;return t.innerType._zod.run(r,n)}}),ys=h("$ZodExactOptional",(e,t)=>{er.init(e,t),C(e._zod,"values",()=>t.innerType._zod.values),C(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),bs=h("$ZodNullable",(e,t)=>{L.init(e,t),C(e._zod,"optin",()=>t.innerType._zod.optin),C(e._zod,"optout",()=>t.innerType._zod.optout),C(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${st(r.source)}|null)$`):void 0}),C(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),ws=h("$ZodDefault",(e,t)=>{L.init(e,t),e._zod.optin="optional",C(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Eo(s,t));return Eo(o,t)}});function Eo(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var $s=h("$ZodPrefault",(e,t)=>{L.init(e,t),e._zod.optin="optional",C(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),As=h("$ZodNonOptional",(e,t)=>{L.init(e,t),C(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Ro(s,e));return Ro(o,e)}});function Ro(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var Ss=h("$ZodCatch",(e,t)=>{L.init(e,t),e._zod.optin="optional",C(e._zod,"optout",()=>t.innerType._zod.optout),C(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((i)=>ne(i,n,re()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=o.value,o.issues.length)r.value=t.catchValue({...r,error:{issues:o.issues.map((s)=>ne(s,n,re()))},input:r.value}),r.issues=[],r.fallback=!0;return r}});var tr=h("$ZodPipe",(e,t)=>{L.init(e,t),C(e._zod,"values",()=>t.in._zod.values),C(e._zod,"optin",()=>t.in._zod.optin),C(e._zod,"optout",()=>t.out._zod.optout),C(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>lt(i,t.in,n));return lt(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>lt(s,t.out,n));return lt(o,t.out,n)}});function lt(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var zs=h("$ZodPreprocess",(e,t)=>{tr.init(e,t)}),ks=h("$ZodReadonly",(e,t)=>{L.init(e,t),C(e._zod,"propValues",()=>t.innerType._zod.propValues),C(e._zod,"values",()=>t.innerType._zod.values),C(e._zod,"optin",()=>t.innerType?._zod?.optin),C(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(Po);return Po(o)}});function Po(e){return e.value=Object.freeze(e.value),e}var Zs=h("$ZodCustom",(e,t)=>{Y.init(e,t),L.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((s)=>Co(s,r,n,e));Co(o,r,n,e);return}});function Co(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(we(o))}}var Os,sg=Symbol("ZodOutput"),ig=Symbol("ZodInput");class Es{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Ic(){return new Es}(Os=globalThis).__zod_globalRegistry??(Os.__zod_globalRegistry=Ic());var $e=globalThis.__zod_globalRegistry;function Rs(e,t){return new e({type:"string",...A(t)})}function Ps(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...A(t)})}function rr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...A(t)})}function Cs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...A(t)})}function Ts(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(t)})}function Ns(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(t)})}function Is(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(t)})}function js(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...A(t)})}function Fs(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...A(t)})}function Ds(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(t)})}function Ls(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...A(t)})}function Ms(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(t)})}function vs(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...A(t)})}function Us(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...A(t)})}function Vs(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(t)})}function Js(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(t)})}function qs(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(t)})}function Bs(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(t)})}function Hs(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(t)})}function Gs(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...A(t)})}function Ks(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...A(t)})}function Ws(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...A(t)})}function Ys(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...A(t)})}function Xs(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(t)})}function Qs(e,t){return new e({type:"string",format:"date",check:"string_format",...A(t)})}function ei(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...A(t)})}function ti(e,t){return new e({type:"string",format:"duration",check:"string_format",...A(t)})}function ri(e,t){return new e({type:"number",checks:[],...A(t)})}function ni(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...A(t)})}function oi(e,t){return new e({type:"boolean",...A(t)})}function si(e,t){return new e({type:"null",...A(t)})}function ii(e){return new e({type:"unknown"})}function ai(e,t){return new e({type:"never",...A(t)})}function ui(e,t){return new e({type:"void",...A(t)})}function mt(e,t){return new Gt({check:"less_than",...A(t),value:e,inclusive:!1})}function qe(e,t){return new Gt({check:"less_than",...A(t),value:e,inclusive:!0})}function ht(e,t){return new Kt({check:"greater_than",...A(t),value:e,inclusive:!1})}function Be(e,t){return new Kt({check:"greater_than",...A(t),value:e,inclusive:!0})}function gt(e,t){return new po({check:"multiple_of",...A(t),value:e})}function _t(e,t){return new fo({check:"max_length",...A(t),maximum:e})}function Ce(e,t){return new mo({check:"min_length",...A(t),minimum:e})}function xt(e,t){return new ho({check:"length_equals",...A(t),length:e})}function nr(e,t){return new go({check:"string_format",format:"regex",...A(t),pattern:e})}function or(e){return new _o({check:"string_format",format:"lowercase",...A(e)})}function sr(e){return new xo({check:"string_format",format:"uppercase",...A(e)})}function ir(e,t){return new yo({check:"string_format",format:"includes",...A(t),includes:e})}function ar(e,t){return new bo({check:"string_format",format:"starts_with",...A(t),prefix:e})}function ur(e,t){return new wo({check:"string_format",format:"ends_with",...A(t),suffix:e})}function he(e){return new $o({check:"overwrite",tx:e})}function cr(e){return he((t)=>t.normalize(e))}function pr(){return he((e)=>e.trim())}function lr(){return he((e)=>e.toLowerCase())}function fr(){return he((e)=>e.toUpperCase())}function dr(){return he((e)=>gn(e))}function ci(e,t,r){return new e({type:"array",element:t,...A(r)})}function pi(e,t,r){return new e({type:"custom",check:"custom",fn:t,...A(r)})}function li(e,t){let r=jc((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(we(o,n.value,r._zod.def));else{let s=o;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(we(s))}},e(n.value,n)),t);return r}function jc(e,t){let r=new Y({check:"custom",...A(t)});return r._zod.check=e,r}function mr(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??$e,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function G(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let u=e._zod.toJSONSchema?.();if(u)i.schema=u;else{let m={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,m);else{let b=i.schema,y=t.processors[o.type];if(!y)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);y(e,t,b,m)}let x=e._zod.parent;if(x){if(!i.ref)i.ref=x;G(x,t,m),t.seen.get(x).isParent=!0}}let p=t.metadataRegistry.get(e);if(p)Object.assign(i.schema,p);if(t.io==="input"&&X(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function hr(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let i of e.seen.entries()){let u=e.metadataRegistry.get(i[0])?.id;if(u){let p=n.get(u);if(p&&p!==i[0])throw Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(u,i[0])}}let o=(i)=>{let u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let x=e.external.registry.get(i[0])?.id,b=e.external.uri??((S)=>S);if(x)return{ref:b(x)};let y=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=y,{defId:y,ref:`${b("__shared")}#/${u}/${y}`}}if(i[1]===r)return{ref:"#"};let l=`${"#"}/${u}/`,m=i[1].schema.id??`__schema${e.counter++}`;return{defId:m,ref:l+m}},s=(i)=>{if(i[1].schema.$ref)return;let u=i[1],{ref:p,defId:l}=o(i);if(u.def={...u.schema},l)u.defId=l;let m=u.schema;for(let x in m)delete m[x];m.$ref=p};if(e.cycles==="throw")for(let i of e.seen.entries()){let u=i[1];if(u.cycle)throw Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
|
|
87
87
|
|
|
88
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let u=i[1];if(t===i[0]){s(i);continue}if(e.external){let l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(u.cycle){s(i);continue}if(u.count>1){if(e.reused==="ref"){s(i);continue}}}}function fr(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(u)=>{let p=e.seen.get(u);if(p.ref===null)return;let l=p.def??p.schema,h={...l},y=p.ref;if(p.ref=null,y){n(y);let x=e.seen.get(y),z=x.schema;if(z.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(z);else Object.assign(l,z);if(Object.assign(l,h),u._zod.parent===y)for(let T in l){if(T==="$ref"||T==="allOf")continue;if(!(T in h))delete l[T]}if(z.$ref&&x.def)for(let T in l){if(T==="$ref"||T==="allOf")continue;if(T in x.def&&JSON.stringify(l[T])===JSON.stringify(x.def[T]))delete l[T]}}let A=u._zod.parent;if(A&&A!==y){n(A);let x=e.seen.get(A);if(x?.schema.$ref){if(l.$ref=x.schema.$ref,x.def)for(let z in l){if(z==="$ref"||z==="allOf")continue;if(z in x.def&&JSON.stringify(l[z])===JSON.stringify(x.def[z]))delete l[z]}}}e.override({zodSchema:u,jsonSchema:l,path:p.path??[]})};for(let u of[...e.seen.entries()].reverse())n(u[0]);let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let u=e.external.registry.get(t)?.id;if(!u)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}Object.assign(o,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let i=e.external?.defs??{};for(let u of e.seen.entries()){let p=u[1];if(p.def&&p.defId){if(p.def.id===p.defId)delete p.def.id;i[p.defId]=p.def}}if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")o.$defs=i;else o.definitions=i;try{let u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Be(t,"input",e.processors),output:Be(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch(u){throw Error("Error converting schema to JSON.")}}function Q(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Q(n.element,r);if(n.type==="set")return Q(n.valueType,r);if(n.type==="lazy")return Q(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Q(n.innerType,r);if(n.type==="intersection")return Q(n.left,r)||Q(n.right,r);if(n.type==="record"||n.type==="map")return Q(n.keyType,r)||Q(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Q(n.in,r)||Q(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(Q(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Q(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Q(o,r))return!0;if(n.rest&&Q(n.rest,r))return!0;return!1}return!1}var si=(e,t={})=>(r)=>{let n=pr({...r,processors:t});return G(e,n),lr(n,e),fr(n,e)},Be=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=pr({...o??{},target:s,io:t,processors:r});return G(e,i),lr(i,e),fr(i,e)};var Ac={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ii=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:u,patterns:p,contentEncoding:l}=e._zod.bag;if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(u){if(o.format=Ac[u]??u,o.format==="")delete o.format;if(u==="time")delete o.format}if(l)o.contentEncoding=l;if(p&&p.size>0){let h=[...p];if(h.length===1)o.pattern=h[0].source;else if(h.length>1)o.allOf=[...h.map((y)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))]}},ai=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,format:u,multipleOf:p,exclusiveMaximum:l,exclusiveMinimum:h}=e._zod.bag;if(typeof u==="string"&&u.includes("int"))o.type="integer";else o.type="number";let y=typeof h==="number"&&h>=(s??Number.NEGATIVE_INFINITY),A=typeof l==="number"&&l<=(i??Number.POSITIVE_INFINITY),x=t.target==="draft-04"||t.target==="openapi-3.0";if(y)if(x)o.minimum=h,o.exclusiveMinimum=!0;else o.exclusiveMinimum=h;else if(typeof s==="number")o.minimum=s;if(A)if(x)o.maximum=l,o.exclusiveMaximum=!0;else o.exclusiveMaximum=l;else if(typeof i==="number")o.maximum=i;if(typeof p==="number")o.multipleOf=p},ui=(e,t,r,n)=>{r.type="boolean"};var ci=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"};var pi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},li=(e,t,r,n)=>{r.not={}};var fi=(e,t,r,n)=>{};var di=(e,t,r,n)=>{let o=e._zod.def,s=et(o.entries);if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},mi=(e,t,r,n)=>{let o=e._zod.def,s=[];for(let i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else s.push(Number(i));else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}};var hi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var gi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var _i=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:u}=e._zod.bag;if(typeof i==="number")o.minItems=i;if(typeof u==="number")o.maxItems=u;o.type="array",o.items=G(s.element,t,{...n,path:[...n.path,"items"]})},xi=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object",o.properties={};let i=s.shape;for(let l in i)o.properties[l]=G(i[l],t,{...n,path:[...n.path,"properties",l]});let u=new Set(Object.keys(i)),p=new Set([...u].filter((l)=>{let h=s.shape[l]._zod;if(t.io==="input")return h.optin===void 0;else return h.optout===void 0}));if(p.size>0)o.required=Array.from(p);if(s.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=G(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},yi=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((u,p)=>G(u,t,{...n,path:[...n.path,s?"oneOf":"anyOf",p]}));if(s)r.oneOf=i;else r.anyOf=i},bi=(e,t,r,n)=>{let o=e._zod.def,s=G(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=G(o.right,t,{...n,path:[...n.path,"allOf",1]}),u=(l)=>("allOf"in l)&&Object.keys(l).length===1,p=[...u(s)?s.allOf:[s],...u(i)?i.allOf:[i]];r.allOf=p};var $i=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,p=i._zod.bag?.patterns;if(s.mode==="loose"&&p&&p.size>0){let h=G(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let y of p)o.patternProperties[y.source]=h}else{if(t.target==="draft-07"||t.target==="draft-2020-12")o.propertyNames=G(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});o.additionalProperties=G(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=i._zod.values;if(l){let h=[...l].filter((y)=>typeof y==="string"||typeof y==="number");if(h.length>0)o.required=h}},Ai=(e,t,r,n)=>{let o=e._zod.def,s=G(o.innerType,t,n),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=o.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},wi=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},zi=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Si=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(o.defaultValue))},ki=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Zi=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;G(i,t,n);let u=t.seen.get(e);u.ref=i},Oi=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var dr=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};var Ec=m("ZodISODateTime",(e,t)=>{Fo.init(e,t),M.init(e,t)});function Ei(e){return Js(Ec,e)}var Rc=m("ZodISODate",(e,t)=>{Do.init(e,t),M.init(e,t)});function Ri(e){return Bs(Rc,e)}var Pc=m("ZodISOTime",(e,t)=>{Lo.init(e,t),M.init(e,t)});function Pi(e){return Hs(Pc,e)}var Cc=m("ZodISODuration",(e,t)=>{Uo.init(e,t),M.init(e,t)});function Ci(e){return Gs(Cc,e)}var Ic=(e,t)=>{ot.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>_n(e,r)},flatten:{value:(r)=>gn(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Le,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Le,2)}},isEmpty:{get(){return e.issues.length===0}}})};var X=m("ZodError",Ic,{Parent:Error});var Ti=st(X),Ni=it(X),Ii=Me(X),ji=ve(X),Fi=bn(X),Di=$n(X),Li=An(X),Ui=wn(X),Mi=zn(X),vi=Sn(X),Vi=kn(X),qi=Zn(X);var Ji=new WeakMap;function He(e,t,r){let n=Object.getPrototypeOf(e),o=Ji.get(n);if(!o)o=new Set,Ji.set(n,o);if(o.has(t))return;o.add(t);for(let s in r){let i=r[s];Object.defineProperty(n,s,{configurable:!0,enumerable:!1,get(){let u=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:u}),u},set(u){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:u})}})}}var L=m("ZodType",(e,t)=>(j.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Be(e,"input"),output:Be(e,"output")}}),e.toJSONSchema=si(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>Ti(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Ii(e,r,n),e.parseAsync=async(r,n)=>Ni(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>ji(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Fi(e,r,n),e.decode=(r,n)=>Di(e,r,n),e.encodeAsync=async(r,n)=>Li(e,r,n),e.decodeAsync=async(r,n)=>Ui(e,r,n),e.safeEncode=(r,n)=>Mi(e,r,n),e.safeDecode=(r,n)=>vi(e,r,n),e.safeEncodeAsync=async(r,n)=>Vi(e,r,n),e.safeDecodeAsync=async(r,n)=>qi(e,r,n),He(e,"ZodType",{check(...r){let n=this.def;return this.clone(ce(n,{checks:[...n.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return se(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(Op(r,n))},superRefine(r,n){return this.check(Ep(r,n))},overwrite(r){return this.check(de(r))},optional(){return a(this)},exactOptional(){return hp(this)},nullable(){return Ki(this)},nullish(){return a(Ki(this))},nonoptional(r){return $p(this,r)},array(){return I(this)},or(r){return f([this,r])},and(r){return lp(this,r)},transform(r){return Wi(this,ta(r))},default(r){return xp(this,r)},prefault(r){return bp(this,r)},catch(r){return wp(this,r)},pipe(r){return Wi(this,r)},readonly(){return kp(this)},describe(r){let n=this.clone();return ye.add(n,{description:r}),n},meta(...r){if(r.length===0)return ye.get(this);let n=this.clone();return ye.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return ye.get(e)?.description},configurable:!0}),e)),Yi=m("_ZodString",(e,t)=>{pt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(n,o,s)=>ii(e,n,o,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,He(e,"_ZodString",{regex(...n){return this.check(Xt(...n))},includes(...n){return this.check(rr(...n))},startsWith(...n){return this.check(nr(...n))},endsWith(...n){return this.check(or(...n))},min(...n){return this.check(Re(...n))},max(...n){return this.check(mt(...n))},length(...n){return this.check(ht(...n))},nonempty(...n){return this.check(Re(1,...n))},lowercase(n){return this.check(er(n))},uppercase(n){return this.check(tr(n))},trim(){return this.check(ir())},normalize(...n){return this.check(sr(...n))},toLowerCase(){return this.check(ar())},toUpperCase(){return this.check(ur())},slugify(){return this.check(cr())}})}),Fc=m("ZodString",(e,t)=>{pt.init(e,t),Yi.init(e,t),e.email=(r)=>e.check(zs(Dc,r)),e.url=(r)=>e.check(Es(Lc,r)),e.jwt=(r)=>e.check(qs(ep,r)),e.emoji=(r)=>e.check(Rs(Uc,r)),e.guid=(r)=>e.check(Qt(Bi,r)),e.uuid=(r)=>e.check(Ss(_t,r)),e.uuidv4=(r)=>e.check(ks(_t,r)),e.uuidv6=(r)=>e.check(Zs(_t,r)),e.uuidv7=(r)=>e.check(Os(_t,r)),e.nanoid=(r)=>e.check(Ps(Mc,r)),e.guid=(r)=>e.check(Qt(Bi,r)),e.cuid=(r)=>e.check(Cs(vc,r)),e.cuid2=(r)=>e.check(Ts(Vc,r)),e.ulid=(r)=>e.check(Ns(qc,r)),e.base64=(r)=>e.check(Ms(Yc,r)),e.base64url=(r)=>e.check(vs(Qc,r)),e.xid=(r)=>e.check(Is(Jc,r)),e.ksuid=(r)=>e.check(js(Bc,r)),e.ipv4=(r)=>e.check(Fs(Hc,r)),e.ipv6=(r)=>e.check(Ds(Gc,r)),e.cidrv4=(r)=>e.check(Ls(Kc,r)),e.cidrv6=(r)=>e.check(Us(Wc,r)),e.e164=(r)=>e.check(Vs(Xc,r)),e.datetime=(r)=>e.check(Ei(r)),e.date=(r)=>e.check(Ri(r)),e.time=(r)=>e.check(Pi(r)),e.duration=(r)=>e.check(Ci(r))});function c(e){return ws(Fc,e)}var M=m("ZodStringFormat",(e,t)=>{D.init(e,t),Yi.init(e,t)}),Dc=m("ZodEmail",(e,t)=>{Oo.init(e,t),M.init(e,t)});var Bi=m("ZodGUID",(e,t)=>{ko.init(e,t),M.init(e,t)});var _t=m("ZodUUID",(e,t)=>{Zo.init(e,t),M.init(e,t)});var Lc=m("ZodURL",(e,t)=>{Eo.init(e,t),M.init(e,t)});var Uc=m("ZodEmoji",(e,t)=>{Ro.init(e,t),M.init(e,t)});var Mc=m("ZodNanoID",(e,t)=>{Po.init(e,t),M.init(e,t)});var vc=m("ZodCUID",(e,t)=>{Co.init(e,t),M.init(e,t)});var Vc=m("ZodCUID2",(e,t)=>{To.init(e,t),M.init(e,t)});var qc=m("ZodULID",(e,t)=>{No.init(e,t),M.init(e,t)});var Jc=m("ZodXID",(e,t)=>{Io.init(e,t),M.init(e,t)});var Bc=m("ZodKSUID",(e,t)=>{jo.init(e,t),M.init(e,t)});var Hc=m("ZodIPv4",(e,t)=>{Mo.init(e,t),M.init(e,t)});var Gc=m("ZodIPv6",(e,t)=>{vo.init(e,t),M.init(e,t)});var Kc=m("ZodCIDRv4",(e,t)=>{Vo.init(e,t),M.init(e,t)});var Wc=m("ZodCIDRv6",(e,t)=>{qo.init(e,t),M.init(e,t)});var Yc=m("ZodBase64",(e,t)=>{Bo.init(e,t),M.init(e,t)});var Qc=m("ZodBase64URL",(e,t)=>{Ho.init(e,t),M.init(e,t)});var Xc=m("ZodE164",(e,t)=>{Go.init(e,t),M.init(e,t)});var ep=m("ZodJWT",(e,t)=>{Ko.init(e,t),M.init(e,t)});var Qi=m("ZodNumber",(e,t)=>{Gt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(n,o,s)=>ai(e,n,o,s),He(e,"ZodNumber",{gt(n,o){return this.check(ft(n,o))},gte(n,o){return this.check(Je(n,o))},min(n,o){return this.check(Je(n,o))},lt(n,o){return this.check(lt(n,o))},lte(n,o){return this.check(qe(n,o))},max(n,o){return this.check(qe(n,o))},int(n){return this.check(Hi(n))},safe(n){return this.check(Hi(n))},positive(n){return this.check(ft(0,n))},nonnegative(n){return this.check(Je(0,n))},negative(n){return this.check(lt(0,n))},nonpositive(n){return this.check(qe(0,n))},multipleOf(n,o){return this.check(dt(n,o))},step(n,o){return this.check(dt(n,o))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function g(e){return Ks(Qi,e)}var tp=m("ZodNumberFormat",(e,t)=>{Wo.init(e,t),Qi.init(e,t)});function Hi(e){return Ws(tp,e)}var rp=m("ZodBoolean",(e,t)=>{Yo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ui(e,r,n,o)});function N(e){return Ys(rp,e)}var np=m("ZodNull",(e,t)=>{Qo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ci(e,r,n,o)});function Pe(e){return Qs(np,e)}var op=m("ZodUnknown",(e,t)=>{Xo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fi(e,r,n,o)});function Z(){return Xs(op)}var sp=m("ZodNever",(e,t)=>{es.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>li(e,r,n,o)});function S(e){return ei(sp,e)}var ip=m("ZodVoid",(e,t)=>{ts.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pi(e,r,n,o)});function hr(e){return ti(ip,e)}var ap=m("ZodArray",(e,t)=>{rs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_i(e,r,n,o),e.element=t.element,He(e,"ZodArray",{min(r,n){return this.check(Re(r,n))},nonempty(r){return this.check(Re(1,r))},max(r,n){return this.check(mt(r,n))},length(r,n){return this.check(ht(r,n))},unwrap(){return this.element}})});function I(e,t){return ri(ap,e,t)}var up=m("ZodObject",(e,t)=>{ss.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xi(e,r,n,o),R(e,"shape",()=>t.shape),He(e,"ZodObject",{keyof(){return b(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Z()})},loose(){return this.clone({...this._zod.def,catchall:Z()})},strict(){return this.clone({...this._zod.def,catchall:S()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return pc(this,r)},safeExtend(r){return lc(this,r)},merge(r){return fc(this,r)},pick(r){return uc(this,r)},omit(r){return cc(this,r)},partial(...r){return dc(ra,this,r[0])},required(...r){return mc(na,this,r[0])}})});function d(e,t){let r={type:"object",shape:e??{},...w(t)};return new up(r)}var Xi=m("ZodUnion",(e,t)=>{Kt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yi(e,r,n,o),e.options=t.options});function f(e,t){return new Xi({type:"union",options:e,...w(t)})}var cp=m("ZodDiscriminatedUnion",(e,t)=>{Xi.init(e,t),is.init(e,t)});function ea(e,t,r){return new cp({type:"union",options:t,discriminator:e,...w(r)})}var pp=m("ZodIntersection",(e,t)=>{as.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bi(e,r,n,o)});function lp(e,t){return new pp({type:"intersection",left:e,right:t})}var Gi=m("ZodRecord",(e,t)=>{us.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$i(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ce(e,t,r){if(!t||!t._zod)return new Gi({type:"record",keyType:c(),valueType:e,...w(t)});return new Gi({type:"record",keyType:e,valueType:t,...w(r)})}var mr=m("ZodEnum",(e,t)=>{cs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(n,o,s)=>di(e,n,o,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new mr({...t,checks:[],...w(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new mr({...t,checks:[],...w(o),entries:s})}});function b(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new mr({type:"enum",entries:r,...w(t)})}var fp=m("ZodLiteral",(e,t)=>{ps.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mi(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function E(e,t){return new fp({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}var dp=m("ZodTransform",(e,t)=>{ls.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gi(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new De(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(xe(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(xe(i))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((s)=>(r.value=s,r.fallback=!0,r));return r.value=o,r.fallback=!0,r}});function ta(e){return new dp({type:"transform",transform:e})}var ra=m("ZodOptional",(e,t)=>{Wt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function a(e){return new ra({type:"optional",innerType:e})}var mp=m("ZodExactOptional",(e,t)=>{fs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hp(e){return new mp({type:"optional",innerType:e})}var gp=m("ZodNullable",(e,t)=>{ds.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ai(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ki(e){return new gp({type:"nullable",innerType:e})}var _p=m("ZodDefault",(e,t)=>{ms.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function xp(e,t){return new _p({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Lt(t)}})}var yp=m("ZodPrefault",(e,t)=>{hs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Si(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bp(e,t){return new yp({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Lt(t)}})}var na=m("ZodNonOptional",(e,t)=>{gs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $p(e,t){return new na({type:"nonoptional",innerType:e,...w(t)})}var Ap=m("ZodCatch",(e,t)=>{_s.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ki(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wp(e,t){return new Ap({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var oa=m("ZodPipe",(e,t)=>{Yt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zi(e,r,n,o),e.in=t.in,e.out=t.out});function Wi(e,t){return new oa({type:"pipe",in:e,out:t})}var zp=m("ZodPreprocess",(e,t)=>{oa.init(e,t),xs.init(e,t)}),Sp=m("ZodReadonly",(e,t)=>{ys.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function kp(e){return new Sp({type:"readonly",innerType:e})}var Zp=m("ZodCustom",(e,t)=>{bs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hi(e,r,n,o)});function Op(e,t={}){return ni(Zp,e,t)}function Ep(e,t){return oi(e,t)}function _(e,t){return new zp({type:"pipe",in:ta(e),out:t})}var Te={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var sa;(function(e){})(sa||(sa={}));var Qg=Z(),Xg=Z(),e_=Z(),t_=Z(),r_=Z(),n_=Z(),o_=Z(),s_=Z(),i_=Z(),a_=Z(),u_=Z(),c_=Z(),p_=Z(),l_=Z(),f_=Z(),d_=Z(),m_=Z(),h_=Z(),g_=Z(),Pp=d({color:a(c()),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),padding:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),borderRadius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Cp=d({family:a(c()),color:a(c()),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),lineHeight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),stroke:a(c()),strokeWidth:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Tp=d({top:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),left:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),right:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Np=d({type:b(["caption"]),src:c().min(1).regex(/\S/),font:a(Cp),background:a(Pp),margin:a(Tp),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Ip=d({color:f([c().regex(/^#[0-9a-fA-F]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),threshold:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(0).lte(250)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),halo:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(0).lte(250)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var xt=d({top:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),bottom:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),left:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),right:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var jp=d({host:c(),cpCode:c(),path:a(f([c(),Pe()])),filename:a(f([c(),Pe()]))}).strict(),Fp=d({provider:E("akamai-netstorage"),options:a(jp)}).strict(),Dp=d({accountName:c(),container:c(),prefix:a(f([c(),Pe()])),filename:a(f([c(),Pe()]))}).strict(),Lp=d({provider:E("azure-blob-storage"),options:a(Dp)}).strict(),Up=d({bucket:c(),prefix:a(c()),filename:a(c())}).strict();var Mp=d({provider:E("google-cloud-storage"),options:a(Up)}).strict();var vp=d({folderId:a(c()),filename:a(c())}).strict();var Vp=d({provider:E("google-drive"),options:a(vp)}).strict();var qp=d({playbackPolicy:a(I(b(["public","signed"]))),passthrough:a(c().max(255))}).strict();var Jp=d({provider:E("mux"),options:a(qp)}).strict();var Bp=d({region:c(),bucket:c(),prefix:a(c()),filename:a(c()),acl:a(c())}).strict();var Hp=d({provider:E("s3"),options:a(Bp)}).strict();var Gp=d({provider:E("shotstack"),exclude:a(N())}).strict();var Kp=d({title:a(c().max(150)),privacyLevel:a(b(["public","friends","private"])),disableDuet:a(N()).default(!1),disableStitch:a(N()).default(!1),disableComment:a(N()).default(!1)}).strict(),Wp=d({provider:E("tiktok"),options:a(Kp)}).strict(),Yp=d({view:a(b(["anybody","nobody","contacts","password","unlisted"])),embed:a(b(["public","private","whitelist"])),comments:a(b(["anybody","nobody","contacts"])),download:a(N()),add:a(N())}).strict();var Qp=d({name:a(c()),description:a(c()),privacy:a(Yp),folderUri:a(c())}).strict();var Xp=d({provider:E("vimeo"),options:a(Qp)}).strict();var gr=ea("provider",[Gp,Jp,Hp,Mp,Vp,Xp,Wp,Fp,Lp]);var el=d({horizontal:a(N()),vertical:a(N())}).strict();var tl=d({src:c()}).strict();var rl=d({type:b(["image","video","audio"]),prompt:c().min(1).max(4000).regex(/\S/),model:a(c()),options:a(Ce(c(),Z()))}).strict();var nl=d({model:c(),type:b(["image","video","audio"]),name:a(c()),description:a(c()),options:a(Ce(c(),Z())),available:a(N()),unavailableReason:a(b(["AiCapabilityNotIncluded","AiDisabled","AiAccessUnavailable"]))}).strict();var ia=d({asset:rl,length:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gt(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var ol=d({type:b(["html5"]),html:c().max(1e6),css:a(c().max(500000)),js:a(c().max(500000))}).strict();var sl=d({type:b(["html"]),html:c(),css:a(c()),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),background:a(c()),position:a(b(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"]))}).strict();var il=d({type:b(["image"]),src:a(c().min(1).regex(/\S/)),prompt:a(c().max(4000)),model:a(c()),options:a(Ce(c(),Z())),crop:a(xt)}).strict().superRefine((e,t)=>{var r=typeof e.src==="string"&&e.src.trim().length>0,n=typeof e.prompt==="string"&&e.prompt.trim().length>0;if(!r&&!n)t.addIssue({code:Te.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var al=d({type:b(["image-to-video"]),src:c().min(1),prompt:a(c()),aspectRatio:a(b(["1:1","4:3","16:9","9:16","3:4","21:9","9:21"])),speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),crop:a(xt)}).strict();var ul=d({preset:b(["conference","interview","lecture","meeting","mobile_phone","music","podcast","studio","voice_over"])}).strict();var cl=d({provider:c().default("dolby"),options:ul}).strict();var pl=d({enhancement:E("dolbyEnhancement_DolbyEnhancement")}).strict().and(cl);var ll=d({audio:a(pl)}).strict();var fl=d({status:c(),title:c(),detail:c()}).strict();var __=d({errors:I(fl)}).strict();var dl=d({type:c(),id:c()}).strict();var x_=d({data:dl}).strict();var ml=d({id:c(),url:c(),expires:c()}).strict();var hl=d({type:c(),id:c(),attributes:ml}).strict();var y_=d({data:hl}).strict();var gl=d({speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),preservePitch:a(N())}).strict();var _l=d({format:a(b(["srt","vtt"]))}).strict();var xl=d({type:b(["luma"]),src:c().min(1).regex(/\S/),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var aa=d({find:c(),replace:Z()}).strict();var yl=d({capture:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}).strict();var bl=d({start:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),length:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var $l=d({id:c(),owner:c(),region:a(c()),renderId:a(c()),providerId:a(c()),filename:a(c()),url:a(c()),status:b(["importing","ready","failed","deleted"]),created:a(c()),updated:a(c())}).strict();var ua=d({type:c(),attributes:$l}).strict();var b_=d({data:I(ua)}).strict();var $_=d({data:ua}).strict();var A_=d({error:c(),code:a(c()),available:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var w_=d({error:d({name:b(["UnknownGenerationModel","WithdrawnGenerationModel"]),message:c()})}).strict();var z_=d({models:I(nl)}).strict();var S_=d({credits:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),ceiling:N()}).strict();var k_=d({id:c(),status:b(["queued","processing","done","failed"]),url:a(c()),error:a(c())}).strict();var Z_=d({success:N(),message:c(),response:Ce(c(),Z())}).strict();var Al=d({message:c(),id:c()}).strict();var O_=d({success:N(),message:c(),response:Al}).strict();var wl=d({id:c(),name:c(),created:a(c()),updated:a(c())}).strict();var zl=d({owner:c(),templates:I(wl)}).strict();var E_=d({success:N(),message:c(),response:zl}).strict();var Sl=d({message:c(),id:c()}).strict();var R_=d({success:N(),message:c(),response:Sl}).strict();var kl=d({family:a(c()),weight:a(Z()).default("400"),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),background:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),textDecoration:a(b(["none","underline","line-through"]))}).strict();var Zl=d({style:b(["karaoke","highlight","pop","fade","slide","bounce","typewriter","none"]),direction:a(b(["left","right","up","down"]))}).strict();var Ol=d({family:a(c()).default("Roboto"),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),weight:a(Z()).default("400"),style:a(b(["normal","italic"])),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#ffffff"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),background:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),ca=d({horizontal:a(b(["left","center","right"])),vertical:a(b(["top","middle","bottom"]))}).strict();var El=d({preset:b(["fadeIn","slideIn","typewriter","ascend","shift","movingLetters"]),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0.1).lte(30)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),style:a(b(["character","word"])),direction:a(b(["left","right","up","down"]))}).strict();var pa=d({color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),borderRadius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),wrap:a(N()).default(!1),padding:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(0).lte(200)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var la=d({width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),radius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0)}).strict();var fa=d({type:a(b(["linear","radial"])),angle:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(360)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),stops:I(d({offset:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),color:f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])})).min(2)}).strict();var Rl=d({letterSpacing:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),lineHeight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1.2),textTransform:a(b(["none","uppercase","lowercase","capitalize"])),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),textDecoration:a(b(["none","underline","line-through"])),gradient:a(fa)}).strict(),da=d({top:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),right:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),bottom:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),left:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0)}).strict();var _r=d({offsetX:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),offsetY:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),blur:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.5)}).strict();var yt=d({width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1)}).strict();var Pl=d({font:a(kl),stroke:a(f([yt,b(["none"])])),shadow:a(f([_r,b(["none"])]))}).strict();var Cl=d({type:b(["rich-caption"]),src:c().min(1),font:a(Ol),style:a(Rl),stroke:a(yt),shadow:a(_r),background:a(pa),border:a(la),padding:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),da])),align:a(ca),active:a(Pl),animation:a(Zl)}).strict();var Tl=d({family:a(c()).default("Open Sans"),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),weight:a(Z()).default("400"),style:a(b(["normal","italic"])),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),background:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),stroke:a(yt)}).strict();var Nl=d({letterSpacing:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),wordSpacing:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),lineHeight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1.2),textTransform:a(b(["none","uppercase","lowercase","capitalize"])),textDecoration:a(b(["none","underline","line-through"])),gradient:a(fa)}).strict();var Il=d({type:b(["rich-text"]),text:c().max(5000),font:a(Tl),style:a(Nl),stroke:a(yt),shadow:a(_r),background:a(pa),border:a(la),padding:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),da])),align:a(ca),animation:a(El)}).strict();var jl=d({id:a(c()),owner:a(c()),status:a(b(["queued","failed"])),created:a(c())}).strict();var Fl=d({type:a(c()),attributes:a(jl)}).strict();var P_=d({data:Fl}).strict();var Dl=d({url:c(),id:c(),destinations:I(gr)}).strict();var Ll=d({type:b(["shape"]),shape:b(["rectangle","circle","line"]),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fill:a(d({color:a(c()),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),stroke:a(d({color:a(c()),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),rectangle:a(d({width:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),height:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),cornerRadius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),circle:a(d({radius:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])})),line:a(d({length:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),thickness:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}))}).strict();var ma=d({width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(4096)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(4096)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var ha=d({format:a(b(["mp4","webm","mov","avi","mkv","ogv","wmv","avif","gif","mp3","wav","jpg","png","webp","tif"])),size:a(ma),fit:a(b(["cover","contain","crop"])),resolution:a(b(["preview","mobile","sd","hd","fhd"])),quality:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([E(12),E(15),E(23.976),E(24),E(25),E(29.97),E(30),E(48),E(50),E(59.94),E(60)])),speed:a(gl),keyframeInterval:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(300)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fixOffset:a(N()),fixRotation:a(N()),enhance:a(ll),filename:a(c())}).strict();var Ul=d({renditions:a(I(ha)),transcription:a(_l)}).strict();var Ml=d({id:c(),status:a(b(["queued","importing","ready","failed","deleted","overwritten"])),url:a(c()),executionTime:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),transformation:a(ha),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var vl=d({renditions:a(I(Ml))}).strict();var Vl=d({id:c(),owner:c(),input:a(c()),source:a(c()),status:a(b(["queued","importing","ready","failed","deleted","overwritten"])),outputs:a(vl),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),created:a(c()),updated:a(c())}).strict();var ga=d({type:c(),id:c(),attributes:Vl}).strict();var C_=d({data:I(ga)}).strict();var T_=d({data:ga}).strict();var ql=d({url:a(c()),outputs:a(Ul),destinations:a(gr),callback:a(c())}).strict();var Jl=d({src:c().min(1).regex(/\S/),effect:a(b(["fadeIn","fadeOut","fadeInFadeOut"])),volume:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Bl=d({type:b(["svg"]),src:c().min(1).max(500000)}).strict();var Hl=d({id:c(),merge:a(I(aa))}).strict();var Gl=d({horizontal:a(b(["left","center","right"])),vertical:a(b(["top","center","bottom"]))}).strict();var Kl=d({preset:b(["typewriter"]),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0.1).lte(30)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),Wl=d({color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),padding:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),borderRadius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),wrap:a(N())}).strict();var Yl=d({family:a(c()),color:a(c()),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),weight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),lineHeight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Ql=d({width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),Xl=d({type:b(["text"]),text:c(),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),font:a(Yl),background:a(Wl),alignment:a(Gl),stroke:a(Ql),animation:a(Kl),ellipsis:a(c())}).strict().superRefine((e,t)=>{if(e.background&&e.background.wrap===!0)t.addIssue({code:Te.custom,message:'background.wrap is only supported on rich-text and rich-caption assets. For type "text", migrate to type "rich-text" to use this feature.',path:["background","wrap"]})});var ef=d({type:b(["text-to-image"]),prompt:c(),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),crop:a(xt)}).strict();var tf=d({capture:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),scale:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}).strict();var rf=d({format:b(["mp4","gif","mp3","jpg","png","bmp"]),resolution:a(b(["preview","mobile","sd","hd","1080","4k"])),aspectRatio:a(b(["16:9","9:16","1:1","4:5","4:3"])),size:a(ma),fps:a(f([E(12),E(15),E(23.976),E(24),E(25),E(29.97),E(30),E(48),E(50),E(59.94),E(60)])),scaleTo:a(b(["preview","mobile","sd","hd","1080","4k"])),quality:a(b(["verylow","low","medium","high","veryhigh"])),repeat:a(N()),mute:a(N()),range:a(bl),poster:a(yl),thumbnail:a(tf),destinations:a(I(gr))}).strict().superRefine((e,t)=>{var r=e.format==="mp3";if(!r&&e.size!=null&&(e.size.width==null||e.size.height==null)){t.addIssue({code:Te.custom,path:["size"],message:"size requires both width and height"});return}var n=typeof e.resolution==="string",o=e.size!=null&&e.size.width!=null&&e.size.height!=null;if(!r&&!n&&!o)t.addIssue({code:Te.custom,message:'output requires either "resolution" or "size" (with width and height)'})});var nf=d({in:a(b(["none","fade","fadeSlow","fadeFast","reveal","revealSlow","revealFast","wipeLeft","wipeLeftSlow","wipeLeftFast","wipeRight","wipeRightSlow","wipeRightFast","slideLeft","slideLeftSlow","slideLeftFast","slideRight","slideRightSlow","slideRightFast","slideUp","slideUpSlow","slideUpFast","slideDown","slideDownSlow","slideDownFast","carouselLeft","carouselLeftSlow","carouselLeftFast","carouselRight","carouselRightSlow","carouselRightFast","carouselUp","carouselUpSlow","carouselUpFast","carouselDown","carouselDownSlow","carouselDownFast","shuffleTopRight","shuffleTopRightSlow","shuffleTopRightFast","shuffleRightTop","shuffleRightTopSlow","shuffleRightTopFast","shuffleRightBottom","shuffleRightBottomSlow","shuffleRightBottomFast","shuffleBottomRight","shuffleBottomRightSlow","shuffleBottomRightFast","shuffleBottomLeft","shuffleBottomLeftSlow","shuffleBottomLeftFast","shuffleLeftBottom","shuffleLeftBottomSlow","shuffleLeftBottomFast","shuffleLeftTop","shuffleLeftTopSlow","shuffleLeftTopFast","shuffleTopLeft","shuffleTopLeftSlow","shuffleTopLeftFast","zoom"])),out:a(b(["none","fade","fadeSlow","fadeFast","reveal","revealSlow","revealFast","wipeLeft","wipeLeftSlow","wipeLeftFast","wipeRight","wipeRightSlow","wipeRightFast","slideLeft","slideLeftSlow","slideLeftFast","slideRight","slideRightSlow","slideRightFast","slideUp","slideUpSlow","slideUpFast","slideDown","slideDownSlow","slideDownFast","carouselLeft","carouselLeftSlow","carouselLeftFast","carouselRight","carouselRightSlow","carouselRightFast","carouselUp","carouselUpSlow","carouselUpFast","carouselDown","carouselDownSlow","carouselDownFast","shuffleTopRight","shuffleTopRightSlow","shuffleTopRightFast","shuffleRightTop","shuffleRightTopSlow","shuffleRightTopFast","shuffleRightBottom","shuffleRightBottomSlow","shuffleRightBottomFast","shuffleBottomRight","shuffleBottomRightSlow","shuffleBottomRightFast","shuffleBottomLeft","shuffleBottomLeftSlow","shuffleBottomLeftFast","shuffleLeftBottom","shuffleLeftBottomSlow","shuffleLeftBottomFast","shuffleLeftTop","shuffleLeftTopSlow","shuffleLeftTopFast","shuffleTopLeft","shuffleTopLeftSlow","shuffleTopLeftFast","zoom"]))}).strict();var ne=d({from:a(Z()),to:a(Z()),start:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),length:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),interpolation:a(b(["linear","bezier","constant"])),easing:a(b(["ease","easeIn","easeOut","easeInOut","easeInQuad","easeInCubic","easeInQuart","easeInQuint","easeInSine","easeInExpo","easeInCirc","easeInBack","easeOutQuad","easeOutCubic","easeOutQuart","easeOutQuint","easeOutSine","easeOutExpo","easeOutCirc","easeOutBack","easeInOutQuad","easeInOutCubic","easeInOutQuart","easeInOutQuint","easeInOutSine","easeInOutExpo","easeInOutCirc","easeInOutBack"]))}).strict();var of=d({type:b(["audio"]),src:a(c().min(1).regex(/\S/)),prompt:a(c().max(4000)),model:a(c()),options:a(Ce(c(),Z())),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),effect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"]))}).strict().superRefine((e,t)=>{var r=typeof e.src==="string"&&e.src.trim().length>0,n=typeof e.prompt==="string"&&e.prompt.trim().length>0;if(!r&&!n)t.addIssue({code:Te.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var _a=d({x:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-10).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),y:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-10).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)]))}).strict();var sf=d({angle:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-360).lte(360)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)]))}).strict();var af=d({x:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-100).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),y:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-100).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)]))}).strict();var uf=d({type:b(["text-to-speech"]),text:c(),voice:c(),language:a(c()),newscaster:a(N()).default(!1),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),effect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"]))}).strict();var cf=d({type:b(["title"]),text:c(),style:a(b(["minimal","blockbuster","vogue","sketchy","skinny","chunk","chunkLight","marker","future","subtitle"])),color:a(c()),size:a(b(["xx-small","x-small","small","medium","large","x-large","xx-large"])),background:a(c()),position:a(b(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"])),offset:a(_a)}).strict();var pf=d({rotate:a(sf),skew:a(af),flip:a(el)}).strict();var lf=d({type:b(["video"]),src:a(c().min(1).regex(/\S/)),prompt:a(c().max(4000)),model:a(c()),options:a(Ce(c(),Z())),transcode:a(N()),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),volumeEffect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"])),speed:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),crop:a(xt),chromaKey:a(Ip)}).strict().superRefine((e,t)=>{var r=typeof e.src==="string"&&e.src.trim().length>0,n=typeof e.prompt==="string"&&e.prompt.trim().length>0;if(!r&&!n)t.addIssue({code:Te.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var ff=ea("type",[lf,il,Xl,Il,of,xl,Np,Cl,sl,ol,cf,Ll,Bl,ef,al,uf]);var df=d({id:a(c()),asset:ff,start:f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),f([c().regex(/^(auto|alias:\/\/[A-Za-z0-9_-]+)$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])]),length:f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),f([c().regex(/^(auto|end|alias:\/\/[A-Za-z0-9_-]+)$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])]),fit:a(b(["cover","contain","crop","none"])),scale:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(1).lte(3840)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(1).lte(2160)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),position:a(b(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"])),offset:a(_a),transition:a(nf),effect:a(b(["zoomIn","zoomInSlow","zoomInFast","zoomOut","zoomOutSlow","zoomOutFast","slideLeft","slideLeftSlow","slideLeftFast","slideRight","slideRightSlow","slideRightFast","slideUp","slideUpSlow","slideUpFast","slideDown","slideDownSlow","slideDownFast"])),filter:a(b(["none","blur","boost","contrast","darken","greyscale","lighten","muted","negative"])),opacity:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(ne)])),transform:a(pf),alias:a(f([c().regex(/^[A-Za-z0-9_-]+$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var mf=df.transform((e)=>{if(e.asset&&typeof e.asset==="object"&&"type"in e.asset){if(e.asset.type==="rich-text"){let{fit:r,...n}=e;return n}}return e}),hf=d({clips:I(mf).min(1)}).strict();var gf=d({soundtrack:a(Jl),background:a(c()),fonts:a(I(tl)),tracks:I(hf).min(1),cache:a(N())}).strict();var Ge=d({timeline:gf,output:rf,merge:a(I(aa)),callback:a(c()),disk:a(b(["local","mount"])),instance:a(b(["s1","s2","a1"]))}).strict(),xa=Ge,_f=d({id:c(),owner:c(),plan:a(c()),status:b(["queued","fetching","preprocessing","rendering","generating","saving","done","failed"]),error:a(c()),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),renderTime:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),url:a(c()),poster:a(f([c(),Pe()])),thumbnail:a(f([c(),Pe()])),data:a(Ge),created:a(c()),updated:a(c())}).strict();var N_=d({success:N(),message:c(),response:_f}).strict();var xf=d({id:c(),name:c(),owner:c(),template:Ge}).strict();var I_=d({success:N(),message:c(),response:xf}).strict();var ya=d({name:c(),template:a(Ge)}).strict();var j_=d({body:Ge,path:a(S()),query:a(S())}).strict();var F_=d({body:a(S()),path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(d({data:a(N()),merged:a(N())}))}).strict();var D_=d({body:a(S()),path:a(S()),query:a(S())}).strict();var L_=d({body:ya,path:a(S()),query:a(S())}).strict();var U_=d({body:a(S()),path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict(),M_=hr(),v_=d({body:a(S()),path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var V_=d({body:ya,path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var q_=d({body:Hl,path:a(S()),query:a(S())}).strict();var J_=d({body:a(S()),path:d({url:c()}),query:a(S())}).strict();var B_=d({body:ia,path:a(S()),query:a(S()),headers:a(d({"Idempotency-Key":a(c())}))}).strict();var H_=d({body:ia,path:a(S()),query:a(S())}).strict();var G_=d({body:a(S()),path:d({id:c()}),query:a(S())}).strict();var K_=d({body:a(S()),path:a(S()),query:a(d({expand:a(b(["options"]))}))}).strict();var W_=d({body:a(S()),path:d({id:c()}),query:a(S())}).strict();var Y_=d({body:a(S()),path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict(),Q_=hr(),X_=d({body:a(S()),path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var ex=d({body:a(S()),path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var tx=d({body:Dl,path:a(S()),query:a(S())}).strict();var rx=d({body:a(S()),path:a(S()),query:a(S())}).strict();var nx=d({body:ql,path:a(S()),query:a(S())}).strict();var ox=d({body:a(S()),path:d({id:f([c().regex(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict(),sx=hr(),ix=d({body:a(S()),path:d({id:f([c().regex(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var ax=d({body:a(S()),path:a(S()),query:a(S())}).strict();var yf={alignment:"align",duration:"length",transitions:"transition",name:"family"},ba={"align.vertical":{center:"middle"},fit:{cover:"crop"}},bf=new Set(["arapey","clear sans","clearsans","didact gothic","didactgothic","montserrat","movlette","notoemoji","open sans","opensans","permanent marker","permanentmarker","roboto","sue ellen francisco","sueellenfrancisco","uni neue","unineue","work sans","worksans"]),$f=/-(?:(?:Extra(?:Light|Bold)|SemiBold|Regular|Medium|Light|Black|Bold|Thin|Heavy)(?:Italic|Oblique)?|(?:Italic|Oblique))$/i,Af=new Set(["image","video","audio","luma"]);function Ne(e){let t=[],r=xa.safeParse(e);if(!r.success)for(let o of Of(r.error))t.push({...o,level:"error"});for(let o of wf(e))t.push(o);return{ok:!t.some((o)=>(o.level??"error")==="error"),issues:t}}function be(e){let t=e.filter((o)=>(o.level??"error")==="error"),r=e.filter((o)=>o.level==="warning"),n=[];if(t.length){let o=r.length?`, ${r.length} warning${xr(r.length)}`:"";n.push(`✗ Edit JSON failed validation (${t.length} error${xr(t.length)}${o}):`)}else n.push(`⚠ Edit JSON valid, with ${r.length} warning${xr(r.length)}:`);for(let o of e){let s=(o.level??"error")==="error"?"✗":"⚠",i=o.suggestion?` (did you mean '${o.suggestion}'?)`:"";n.push(` ${s} ${o.path||"<root>"}: ${o.message}${i}`)}return n.join(`
|
|
89
|
-
`)}function
|
|
90
|
-
`).filter((i)=>i.trim().length>0).slice(-e).reverse(),s=[];for(let i of o)try{s.push(JSON.parse(i))}catch{}return s}function
|
|
91
|
-
`)}var
|
|
92
|
-
`):"No sources.";return O(t,i,u),{response:{count:i.length}}})})
|
|
93
|
-
${e.status} ${r}`.trimEnd()}function
|
|
94
|
-
`):"No templates found";return O(t,s,i),{count:s.length,exitCode:0}})});
|
|
95
|
-
`)}function
|
|
96
|
-
`)}var
|
|
97
|
-
`)
|
|
88
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let u=i[1];if(t===i[0]){s(i);continue}if(e.external){let l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(u.cycle){s(i);continue}if(u.count>1){if(e.reused==="ref"){s(i);continue}}}}function gr(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(u)=>{let p=e.seen.get(u);if(p.ref===null)return;let l=p.def??p.schema,m={...l},x=p.ref;if(p.ref=null,x){n(x);let y=e.seen.get(x),S=y.schema;if(S.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(S);else Object.assign(l,S);if(Object.assign(l,m),u._zod.parent===x)for(let T in l){if(T==="$ref"||T==="allOf")continue;if(!(T in m))delete l[T]}if(S.$ref&&y.def)for(let T in l){if(T==="$ref"||T==="allOf")continue;if(T in y.def&&JSON.stringify(l[T])===JSON.stringify(y.def[T]))delete l[T]}}let b=u._zod.parent;if(b&&b!==x){n(b);let y=e.seen.get(b);if(y?.schema.$ref){if(l.$ref=y.schema.$ref,y.def)for(let S in l){if(S==="$ref"||S==="allOf")continue;if(S in y.def&&JSON.stringify(l[S])===JSON.stringify(y.def[S]))delete l[S]}}}e.override({zodSchema:u,jsonSchema:l,path:p.path??[]})};for(let u of[...e.seen.entries()].reverse())n(u[0]);let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let u=e.external.registry.get(t)?.id;if(!u)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}Object.assign(o,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let i=e.external?.defs??{};for(let u of e.seen.entries()){let p=u[1];if(p.def&&p.defId){if(p.def.id===p.defId)delete p.def.id;i[p.defId]=p.def}}if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")o.$defs=i;else o.definitions=i;try{let u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:He(t,"input",e.processors),output:He(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch(u){throw Error("Error converting schema to JSON.")}}function X(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return X(n.element,r);if(n.type==="set")return X(n.valueType,r);if(n.type==="lazy")return X(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return X(n.innerType,r);if(n.type==="intersection")return X(n.left,r)||X(n.right,r);if(n.type==="record"||n.type==="map")return X(n.keyType,r)||X(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return X(n.in,r)||X(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(X(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(X(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(X(o,r))return!0;if(n.rest&&X(n.rest,r))return!0;return!1}return!1}var fi=(e,t={})=>(r)=>{let n=mr({...r,processors:t});return G(e,n),hr(n,e),gr(n,e)},He=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=mr({...o??{},target:s,io:t,processors:r});return G(e,i),hr(i,e),gr(i,e)};var Fc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},di=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:u,patterns:p,contentEncoding:l}=e._zod.bag;if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(u){if(o.format=Fc[u]??u,o.format==="")delete o.format;if(u==="time")delete o.format}if(l)o.contentEncoding=l;if(p&&p.size>0){let m=[...p];if(m.length===1)o.pattern=m[0].source;else if(m.length>1)o.allOf=[...m.map((x)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:x.source}))]}},mi=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,format:u,multipleOf:p,exclusiveMaximum:l,exclusiveMinimum:m}=e._zod.bag;if(typeof u==="string"&&u.includes("int"))o.type="integer";else o.type="number";let x=typeof m==="number"&&m>=(s??Number.NEGATIVE_INFINITY),b=typeof l==="number"&&l<=(i??Number.POSITIVE_INFINITY),y=t.target==="draft-04"||t.target==="openapi-3.0";if(x)if(y)o.minimum=m,o.exclusiveMinimum=!0;else o.exclusiveMinimum=m;else if(typeof s==="number")o.minimum=s;if(b)if(y)o.maximum=l,o.exclusiveMaximum=!0;else o.exclusiveMaximum=l;else if(typeof i==="number")o.maximum=i;if(typeof p==="number")o.multipleOf=p},hi=(e,t,r,n)=>{r.type="boolean"};var gi=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"};var _i=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},xi=(e,t,r,n)=>{r.not={}};var yi=(e,t,r,n)=>{};var bi=(e,t,r,n)=>{let o=e._zod.def,s=nt(o.entries);if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},wi=(e,t,r,n)=>{let o=e._zod.def,s=[];for(let i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else s.push(Number(i));else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}};var $i=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var Ai=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var Si=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:u}=e._zod.bag;if(typeof i==="number")o.minItems=i;if(typeof u==="number")o.maxItems=u;o.type="array",o.items=G(s.element,t,{...n,path:[...n.path,"items"]})},zi=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object",o.properties={};let i=s.shape;for(let l in i)o.properties[l]=G(i[l],t,{...n,path:[...n.path,"properties",l]});let u=new Set(Object.keys(i)),p=new Set([...u].filter((l)=>{let m=s.shape[l]._zod;if(t.io==="input")return m.optin===void 0;else return m.optout===void 0}));if(p.size>0)o.required=Array.from(p);if(s.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=G(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},ki=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((u,p)=>G(u,t,{...n,path:[...n.path,s?"oneOf":"anyOf",p]}));if(s)r.oneOf=i;else r.anyOf=i},Zi=(e,t,r,n)=>{let o=e._zod.def,s=G(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=G(o.right,t,{...n,path:[...n.path,"allOf",1]}),u=(l)=>("allOf"in l)&&Object.keys(l).length===1,p=[...u(s)?s.allOf:[s],...u(i)?i.allOf:[i]];r.allOf=p};var Oi=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,p=i._zod.bag?.patterns;if(s.mode==="loose"&&p&&p.size>0){let m=G(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let x of p)o.patternProperties[x.source]=m}else{if(t.target==="draft-07"||t.target==="draft-2020-12")o.propertyNames=G(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});o.additionalProperties=G(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=i._zod.values;if(l){let m=[...l].filter((x)=>typeof x==="string"||typeof x==="number");if(m.length>0)o.required=m}},Ei=(e,t,r,n)=>{let o=e._zod.def,s=G(o.innerType,t,n),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=o.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},Ri=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Pi=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Ci=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(o.defaultValue))},Ti=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Ni=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;G(i,t,n);let u=t.seen.get(e);u.ref=i},Ii=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var _r=(e,t,r,n)=>{let o=e._zod.def;G(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};var Jc=h("ZodISODateTime",(e,t)=>{Jo.init(e,t),B.init(e,t)});function ji(e){return Xs(Jc,e)}var qc=h("ZodISODate",(e,t)=>{qo.init(e,t),B.init(e,t)});function Fi(e){return Qs(qc,e)}var Bc=h("ZodISOTime",(e,t)=>{Bo.init(e,t),B.init(e,t)});function Di(e){return ei(Bc,e)}var Hc=h("ZodISODuration",(e,t)=>{Ho.init(e,t),B.init(e,t)});function Li(e){return ti(Hc,e)}var Wc=(e,t)=>{at.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Sn(e,r)},flatten:{value:(r)=>An(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Me,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Me,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Q=h("ZodError",Wc,{Parent:Error});var Mi=ut(Q),vi=ct(Q),Ui=Ue(Q),Vi=Ve(Q),Ji=Zn(Q),qi=On(Q),Bi=En(Q),Hi=Rn(Q),Gi=Pn(Q),Ki=Cn(Q),Wi=Tn(Q),Yi=Nn(Q);var Xi=new WeakMap;function Ge(e,t,r){let n=Object.getPrototypeOf(e),o=Xi.get(n);if(!o)o=new Set,Xi.set(n,o);if(o.has(t))return;o.add(t);for(let s in r){let i=r[s];Object.defineProperty(n,s,{configurable:!0,enumerable:!1,get(){let u=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:u}),u},set(u){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:u})}})}}var v=h("ZodType",(e,t)=>(L.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:He(e,"input"),output:He(e,"output")}}),e.toJSONSchema=fi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>Mi(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Ui(e,r,n),e.parseAsync=async(r,n)=>vi(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Vi(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Ji(e,r,n),e.decode=(r,n)=>qi(e,r,n),e.encodeAsync=async(r,n)=>Bi(e,r,n),e.decodeAsync=async(r,n)=>Hi(e,r,n),e.safeEncode=(r,n)=>Gi(e,r,n),e.safeDecode=(r,n)=>Ki(e,r,n),e.safeEncodeAsync=async(r,n)=>Wi(e,r,n),e.safeDecodeAsync=async(r,n)=>Yi(e,r,n),Ge(e,"ZodType",{check(...r){let n=this.def;return this.clone(le(n,{checks:[...n.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return ie(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(Vp(r,n))},superRefine(r,n){return this.check(Jp(r,n))},overwrite(r){return this.check(he(r))},optional(){return a(this)},exactOptional(){return Rp(this)},nullable(){return ra(this)},nullish(){return a(ra(this))},nonoptional(r){return jp(this,r)},array(){return I(this)},or(r){return f([this,r])},and(r){return kp(this,r)},transform(r){return na(this,ua(r))},default(r){return Tp(this,r)},prefault(r){return Ip(this,r)},catch(r){return Dp(this,r)},pipe(r){return na(this,r)},readonly(){return vp(this)},describe(r){let n=this.clone();return $e.add(n,{description:r}),n},meta(...r){if(r.length===0)return $e.get(this);let n=this.clone();return $e.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return $e.get(e)?.description},configurable:!0}),e)),oa=h("_ZodString",(e,t)=>{dt.init(e,t),v.init(e,t),e._zod.processJSONSchema=(n,o,s)=>di(e,n,o,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Ge(e,"_ZodString",{regex(...n){return this.check(nr(...n))},includes(...n){return this.check(ir(...n))},startsWith(...n){return this.check(ar(...n))},endsWith(...n){return this.check(ur(...n))},min(...n){return this.check(Ce(...n))},max(...n){return this.check(_t(...n))},length(...n){return this.check(xt(...n))},nonempty(...n){return this.check(Ce(1,...n))},lowercase(n){return this.check(or(n))},uppercase(n){return this.check(sr(n))},trim(){return this.check(pr())},normalize(...n){return this.check(cr(...n))},toLowerCase(){return this.check(lr())},toUpperCase(){return this.check(fr())},slugify(){return this.check(dr())}})}),Xc=h("ZodString",(e,t)=>{dt.init(e,t),oa.init(e,t),e.email=(r)=>e.check(Ps(Qc,r)),e.url=(r)=>e.check(js(ep,r)),e.jwt=(r)=>e.check(Ys(hp,r)),e.emoji=(r)=>e.check(Fs(tp,r)),e.guid=(r)=>e.check(rr(Qi,r)),e.uuid=(r)=>e.check(Cs(bt,r)),e.uuidv4=(r)=>e.check(Ts(bt,r)),e.uuidv6=(r)=>e.check(Ns(bt,r)),e.uuidv7=(r)=>e.check(Is(bt,r)),e.nanoid=(r)=>e.check(Ds(rp,r)),e.guid=(r)=>e.check(rr(Qi,r)),e.cuid=(r)=>e.check(Ls(np,r)),e.cuid2=(r)=>e.check(Ms(op,r)),e.ulid=(r)=>e.check(vs(sp,r)),e.base64=(r)=>e.check(Gs(fp,r)),e.base64url=(r)=>e.check(Ks(dp,r)),e.xid=(r)=>e.check(Us(ip,r)),e.ksuid=(r)=>e.check(Vs(ap,r)),e.ipv4=(r)=>e.check(Js(up,r)),e.ipv6=(r)=>e.check(qs(cp,r)),e.cidrv4=(r)=>e.check(Bs(pp,r)),e.cidrv6=(r)=>e.check(Hs(lp,r)),e.e164=(r)=>e.check(Ws(mp,r)),e.datetime=(r)=>e.check(ji(r)),e.date=(r)=>e.check(Fi(r)),e.time=(r)=>e.check(Di(r)),e.duration=(r)=>e.check(Li(r))});function c(e){return Rs(Xc,e)}var B=h("ZodStringFormat",(e,t)=>{M.init(e,t),oa.init(e,t)}),Qc=h("ZodEmail",(e,t)=>{Io.init(e,t),B.init(e,t)});var Qi=h("ZodGUID",(e,t)=>{To.init(e,t),B.init(e,t)});var bt=h("ZodUUID",(e,t)=>{No.init(e,t),B.init(e,t)});var ep=h("ZodURL",(e,t)=>{jo.init(e,t),B.init(e,t)});var tp=h("ZodEmoji",(e,t)=>{Fo.init(e,t),B.init(e,t)});var rp=h("ZodNanoID",(e,t)=>{Do.init(e,t),B.init(e,t)});var np=h("ZodCUID",(e,t)=>{Lo.init(e,t),B.init(e,t)});var op=h("ZodCUID2",(e,t)=>{Mo.init(e,t),B.init(e,t)});var sp=h("ZodULID",(e,t)=>{vo.init(e,t),B.init(e,t)});var ip=h("ZodXID",(e,t)=>{Uo.init(e,t),B.init(e,t)});var ap=h("ZodKSUID",(e,t)=>{Vo.init(e,t),B.init(e,t)});var up=h("ZodIPv4",(e,t)=>{Go.init(e,t),B.init(e,t)});var cp=h("ZodIPv6",(e,t)=>{Ko.init(e,t),B.init(e,t)});var pp=h("ZodCIDRv4",(e,t)=>{Wo.init(e,t),B.init(e,t)});var lp=h("ZodCIDRv6",(e,t)=>{Yo.init(e,t),B.init(e,t)});var fp=h("ZodBase64",(e,t)=>{Qo.init(e,t),B.init(e,t)});var dp=h("ZodBase64URL",(e,t)=>{es.init(e,t),B.init(e,t)});var mp=h("ZodE164",(e,t)=>{ts.init(e,t),B.init(e,t)});var hp=h("ZodJWT",(e,t)=>{rs.init(e,t),B.init(e,t)});var sa=h("ZodNumber",(e,t)=>{Xt.init(e,t),v.init(e,t),e._zod.processJSONSchema=(n,o,s)=>mi(e,n,o,s),Ge(e,"ZodNumber",{gt(n,o){return this.check(ht(n,o))},gte(n,o){return this.check(Be(n,o))},min(n,o){return this.check(Be(n,o))},lt(n,o){return this.check(mt(n,o))},lte(n,o){return this.check(qe(n,o))},max(n,o){return this.check(qe(n,o))},int(n){return this.check(ea(n))},safe(n){return this.check(ea(n))},positive(n){return this.check(ht(0,n))},nonnegative(n){return this.check(Be(0,n))},negative(n){return this.check(mt(0,n))},nonpositive(n){return this.check(qe(0,n))},multipleOf(n,o){return this.check(gt(n,o))},step(n,o){return this.check(gt(n,o))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function g(e){return ri(sa,e)}var gp=h("ZodNumberFormat",(e,t)=>{ns.init(e,t),sa.init(e,t)});function ea(e){return ni(gp,e)}var _p=h("ZodBoolean",(e,t)=>{os.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hi(e,r,n,o)});function N(e){return oi(_p,e)}var xp=h("ZodNull",(e,t)=>{ss.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gi(e,r,n,o)});function Te(e){return si(xp,e)}var yp=h("ZodUnknown",(e,t)=>{is.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yi(e,r,n,o)});function Z(){return ii(yp)}var bp=h("ZodNever",(e,t)=>{as.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xi(e,r,n,o)});function z(e){return ai(bp,e)}var wp=h("ZodVoid",(e,t)=>{us.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_i(e,r,n,o)});function yr(e){return ui(wp,e)}var $p=h("ZodArray",(e,t)=>{cs.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Si(e,r,n,o),e.element=t.element,Ge(e,"ZodArray",{min(r,n){return this.check(Ce(r,n))},nonempty(r){return this.check(Ce(1,r))},max(r,n){return this.check(_t(r,n))},length(r,n){return this.check(xt(r,n))},unwrap(){return this.element}})});function I(e,t){return ci($p,e,t)}var Ap=h("ZodObject",(e,t)=>{fs.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zi(e,r,n,o),C(e,"shape",()=>t.shape),Ge(e,"ZodObject",{keyof(){return w(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Z()})},loose(){return this.clone({...this._zod.def,catchall:Z()})},strict(){return this.clone({...this._zod.def,catchall:z()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return zc(this,r)},safeExtend(r){return kc(this,r)},merge(r){return Zc(this,r)},pick(r){return Ac(this,r)},omit(r){return Sc(this,r)},partial(...r){return Oc(ca,this,r[0])},required(...r){return Ec(pa,this,r[0])}})});function d(e,t){let r={type:"object",shape:e??{},...A(t)};return new Ap(r)}var ia=h("ZodUnion",(e,t)=>{Qt.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ki(e,r,n,o),e.options=t.options});function f(e,t){return new ia({type:"union",options:e,...A(t)})}var Sp=h("ZodDiscriminatedUnion",(e,t)=>{ia.init(e,t),ds.init(e,t)});function aa(e,t,r){return new Sp({type:"union",options:t,discriminator:e,...A(r)})}var zp=h("ZodIntersection",(e,t)=>{ms.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zi(e,r,n,o)});function kp(e,t){return new zp({type:"intersection",left:e,right:t})}var ta=h("ZodRecord",(e,t)=>{hs.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oi(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ne(e,t,r){if(!t||!t._zod)return new ta({type:"record",keyType:c(),valueType:e,...A(t)});return new ta({type:"record",keyType:e,valueType:t,...A(r)})}var xr=h("ZodEnum",(e,t)=>{gs.init(e,t),v.init(e,t),e._zod.processJSONSchema=(n,o,s)=>bi(e,n,o,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new xr({...t,checks:[],...A(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new xr({...t,checks:[],...A(o),entries:s})}});function w(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new xr({type:"enum",entries:r,...A(t)})}var Zp=h("ZodLiteral",(e,t)=>{_s.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wi(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function E(e,t){return new Zp({type:"literal",values:Array.isArray(e)?e:[e],...A(t)})}var Op=h("ZodTransform",(e,t)=>{xs.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ai(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Le(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(we(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(we(i))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((s)=>(r.value=s,r.fallback=!0,r));return r.value=o,r.fallback=!0,r}});function ua(e){return new Op({type:"transform",transform:e})}var ca=h("ZodOptional",(e,t)=>{er.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_r(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function a(e){return new ca({type:"optional",innerType:e})}var Ep=h("ZodExactOptional",(e,t)=>{ys.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_r(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Rp(e){return new Ep({type:"optional",innerType:e})}var Pp=h("ZodNullable",(e,t)=>{bs.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ei(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ra(e){return new Pp({type:"nullable",innerType:e})}var Cp=h("ZodDefault",(e,t)=>{ws.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Tp(e,t){return new Cp({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Vt(t)}})}var Np=h("ZodPrefault",(e,t)=>{$s.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ci(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ip(e,t){return new Np({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Vt(t)}})}var pa=h("ZodNonOptional",(e,t)=>{As.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ri(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function jp(e,t){return new pa({type:"nonoptional",innerType:e,...A(t)})}var Fp=h("ZodCatch",(e,t)=>{Ss.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ti(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Dp(e,t){return new Fp({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var la=h("ZodPipe",(e,t)=>{tr.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ni(e,r,n,o),e.in=t.in,e.out=t.out});function na(e,t){return new la({type:"pipe",in:e,out:t})}var Lp=h("ZodPreprocess",(e,t)=>{la.init(e,t),zs.init(e,t)}),Mp=h("ZodReadonly",(e,t)=>{ks.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ii(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vp(e){return new Mp({type:"readonly",innerType:e})}var Up=h("ZodCustom",(e,t)=>{Zs.init(e,t),v.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$i(e,r,n,o)});function Vp(e,t={}){return pi(Up,e,t)}function Jp(e,t){return li(e,t)}function _(e,t){return new Lp({type:"pipe",in:ua(e),out:t})}var Ie={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var fa;(function(e){})(fa||(fa={}));var q_=Z(),B_=Z(),H_=Z(),G_=Z(),K_=Z(),W_=Z(),Y_=Z(),X_=Z(),Q_=Z(),ex=Z(),tx=Z(),rx=Z(),nx=Z(),ox=Z(),sx=Z(),ix=Z(),ax=Z(),ux=Z(),cx=Z(),Bp=d({color:a(c()),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),padding:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),borderRadius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Hp=d({family:a(c()),color:a(c()),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),lineHeight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),stroke:a(c()),strokeWidth:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Gp=d({top:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),left:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),right:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Kp=d({type:w(["caption"]),src:c().min(1).regex(/\S/),font:a(Hp),background:a(Bp),margin:a(Gp),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Wp=d({color:f([c().regex(/^#[0-9a-fA-F]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),threshold:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(0).lte(250)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),halo:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(0).lte(250)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var wt=d({top:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),bottom:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),left:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),right:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Yp=d({host:c(),cpCode:c(),path:a(f([c(),Te()])),filename:a(f([c(),Te()]))}).strict(),Xp=d({provider:E("akamai-netstorage"),options:a(Yp)}).strict(),Qp=d({accountName:c(),container:c(),prefix:a(f([c(),Te()])),filename:a(f([c(),Te()]))}).strict(),el=d({provider:E("azure-blob-storage"),options:a(Qp)}).strict(),tl=d({bucket:c(),prefix:a(c()),filename:a(c())}).strict();var rl=d({provider:E("google-cloud-storage"),options:a(tl)}).strict();var nl=d({folderId:a(c()),filename:a(c())}).strict();var ol=d({provider:E("google-drive"),options:a(nl)}).strict();var sl=d({playbackPolicy:a(I(w(["public","signed"]))),passthrough:a(c().max(255))}).strict();var il=d({provider:E("mux"),options:a(sl)}).strict();var al=d({region:c(),bucket:c(),prefix:a(c()),filename:a(c()),acl:a(c())}).strict();var ul=d({provider:E("s3"),options:a(al)}).strict();var cl=d({provider:E("shotstack"),exclude:a(N())}).strict();var pl=d({title:a(c().max(150)),privacyLevel:a(w(["public","friends","private"])),disableDuet:a(N()).default(!1),disableStitch:a(N()).default(!1),disableComment:a(N()).default(!1)}).strict(),ll=d({provider:E("tiktok"),options:a(pl)}).strict(),fl=d({view:a(w(["anybody","nobody","contacts","password","unlisted"])),embed:a(w(["public","private","whitelist"])),comments:a(w(["anybody","nobody","contacts"])),download:a(N()),add:a(N())}).strict();var dl=d({name:a(c()),description:a(c()),privacy:a(fl),folderUri:a(c())}).strict();var ml=d({provider:E("vimeo"),options:a(dl)}).strict();var br=aa("provider",[cl,il,ul,rl,ol,ml,ll,Xp,el]);var hl=d({horizontal:a(N()),vertical:a(N())}).strict();var gl=d({src:c()}).strict();var _l=d({type:w(["image","video","audio"]),prompt:c().min(1).max(4000).regex(/\S/),model:a(c()),options:a(Ne(c(),Z()))}).strict();var xl=d({model:c(),type:w(["image","video","audio"]),name:a(c()),description:a(c()),options:a(Ne(c(),Z())),available:a(N()),unavailableReason:a(w(["AiCapabilityNotIncluded","AiDisabled","AiAccessUnavailable"]))}).strict();var da=d({asset:_l,length:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gt(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var yl=d({type:w(["html5"]),html:c().max(1e6),css:a(c().max(500000)),js:a(c().max(500000))}).strict();var bl=d({type:w(["html"]),html:c(),css:a(c()),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),background:a(c()),position:a(w(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"]))}).strict();var wl=d({type:w(["image"]),src:a(c().min(1).regex(/\S/)),prompt:a(c().max(4000)),model:a(c()),options:a(Ne(c(),Z())),crop:a(wt)}).strict().superRefine((e,t)=>{var r=typeof e.src==="string"&&e.src.trim().length>0,n=typeof e.prompt==="string"&&e.prompt.trim().length>0;if(!r&&!n)t.addIssue({code:Ie.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var $l=d({type:w(["image-to-video"]),src:c().min(1),prompt:a(c()),aspectRatio:a(w(["1:1","4:3","16:9","9:16","3:4","21:9","9:21"])),speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),crop:a(wt)}).strict();var Al=d({preset:w(["conference","interview","lecture","meeting","mobile_phone","music","podcast","studio","voice_over"])}).strict();var Sl=d({provider:c().default("dolby"),options:Al}).strict();var zl=d({enhancement:E("dolbyEnhancement_DolbyEnhancement")}).strict().and(Sl);var kl=d({audio:a(zl)}).strict();var Zl=d({status:c(),title:c(),detail:c()}).strict();var px=d({errors:I(Zl)}).strict();var Ol=d({type:c(),id:c()}).strict();var lx=d({data:Ol}).strict();var El=d({id:c(),url:c(),expires:c()}).strict();var Rl=d({type:c(),id:c(),attributes:El}).strict();var fx=d({data:Rl}).strict();var Pl=d({speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),preservePitch:a(N())}).strict();var Cl=d({format:a(w(["srt","vtt"]))}).strict();var Tl=d({type:w(["luma"]),src:c().min(1).regex(/\S/),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var ma=d({find:c(),replace:Z()}).strict();var Nl=d({capture:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}).strict();var Il=d({start:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),length:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var jl=d({id:c(),owner:c(),region:a(c()),renderId:a(c()),providerId:a(c()),filename:a(c()),url:a(c()),status:w(["importing","ready","failed","deleted"]),created:a(c()),updated:a(c())}).strict();var ha=d({type:c(),attributes:jl}).strict();var dx=d({data:I(ha)}).strict();var mx=d({data:ha}).strict();var hx=d({error:c(),code:a(c()),available:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var gx=d({error:d({name:w(["UnknownGenerationModel","WithdrawnGenerationModel"]),message:c()})}).strict();var _x=d({models:I(xl)}).strict();var xx=d({credits:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),ceiling:N()}).strict();var yx=d({id:c(),status:w(["queued","processing","done","failed"]),url:a(c()),error:a(c())}).strict();var bx=d({success:N(),message:c(),response:Ne(c(),Z())}).strict();var Fl=d({message:c(),id:c()}).strict();var wx=d({success:N(),message:c(),response:Fl}).strict();var Dl=d({id:c(),name:c(),created:a(c()),updated:a(c())}).strict();var Ll=d({owner:c(),templates:I(Dl)}).strict();var $x=d({success:N(),message:c(),response:Ll}).strict();var Ml=d({message:c(),id:c()}).strict();var Ax=d({success:N(),message:c(),response:Ml}).strict();var vl=d({family:a(c()),weight:a(Z()).default("400"),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),background:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),textDecoration:a(w(["none","underline","line-through"]))}).strict();var Ul=d({style:w(["karaoke","highlight","pop","fade","slide","bounce","typewriter","none"]),direction:a(w(["left","right","up","down"]))}).strict();var Vl=d({family:a(c()).default("Roboto"),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),weight:a(Z()).default("400"),style:a(w(["normal","italic"])),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#ffffff"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),background:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),ga=d({horizontal:a(w(["left","center","right"])),vertical:a(w(["top","middle","bottom"]))}).strict();var Jl=d({preset:w(["fadeIn","slideIn","typewriter","ascend","shift","movingLetters"]),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0.1).lte(30)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),style:a(w(["character","word"])),direction:a(w(["left","right","up","down"]))}).strict();var _a=d({color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),borderRadius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),wrap:a(N()).default(!1),padding:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(0).lte(200)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var xa=d({width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),radius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0)}).strict();var ya=d({type:a(w(["linear","radial"])),angle:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(360)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),stops:I(d({offset:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),color:f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])})).min(2)}).strict();var ql=d({letterSpacing:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),lineHeight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1.2),textTransform:a(w(["none","uppercase","lowercase","capitalize"])),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),textDecoration:a(w(["none","underline","line-through"])),gradient:a(ya)}).strict(),ba=d({top:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),right:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),bottom:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),left:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0)}).strict();var wr=d({offsetX:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),offsetY:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),blur:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.5)}).strict();var $t=d({width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1)}).strict();var Bl=d({font:a(vl),stroke:a(f([$t,w(["none"])])),shadow:a(f([wr,w(["none"])]))}).strict();var Hl=d({type:w(["rich-caption"]),src:c().min(1),font:a(Vl),style:a(ql),stroke:a($t),shadow:a(wr),background:a(_a),border:a(xa),padding:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),ba])),align:a(ga),active:a(Bl),animation:a(Ul)}).strict();var Gl=d({family:a(c()).default("Open Sans"),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),weight:a(Z()).default("400"),style:a(w(["normal","italic"])),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),background:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),stroke:a($t)}).strict();var Kl=d({letterSpacing:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),wordSpacing:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),lineHeight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1.2),textTransform:a(w(["none","uppercase","lowercase","capitalize"])),textDecoration:a(w(["none","underline","line-through"])),gradient:a(ya)}).strict();var Wl=d({type:w(["rich-text"]),text:c().max(5000),font:a(Gl),style:a(Kl),stroke:a($t),shadow:a(wr),background:a(_a),border:a(xa),padding:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),ba])),align:a(ga),animation:a(Jl)}).strict();var Yl=d({id:a(c()),owner:a(c()),status:a(w(["queued","failed"])),created:a(c())}).strict();var Xl=d({type:a(c()),attributes:a(Yl)}).strict();var Sx=d({data:Xl}).strict();var Ql=d({url:c(),id:c(),destinations:I(br)}).strict();var ef=d({type:w(["shape"]),shape:w(["rectangle","circle","line"]),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fill:a(d({color:a(c()),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),stroke:a(d({color:a(c()),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),rectangle:a(d({width:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),height:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),cornerRadius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),circle:a(d({radius:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])})),line:a(d({length:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),thickness:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}))}).strict();var wa=d({width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(4096)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(4096)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var $a=d({format:a(w(["mp4","webm","mov","avi","mkv","ogv","wmv","avif","gif","mp3","wav","jpg","png","webp","tif"])),size:a(wa),fit:a(w(["cover","contain","crop"])),resolution:a(w(["preview","mobile","sd","hd","fhd"])),quality:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([E(12),E(15),E(23.976),E(24),E(25),E(29.97),E(30),E(48),E(50),E(59.94),E(60)])),speed:a(Pl),keyframeInterval:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int().gte(1).lte(300)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fixOffset:a(N()),fixRotation:a(N()),enhance:a(kl),filename:a(c())}).strict();var tf=d({renditions:a(I($a)),transcription:a(Cl)}).strict();var rf=d({id:c(),status:a(w(["queued","importing","ready","failed","deleted","overwritten"])),url:a(c()),executionTime:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),transformation:a($a),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var nf=d({renditions:a(I(rf))}).strict();var of=d({id:c(),owner:c(),input:a(c()),source:a(c()),status:a(w(["queued","importing","ready","failed","deleted","overwritten"])),outputs:a(nf),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),created:a(c()),updated:a(c())}).strict();var Aa=d({type:c(),id:c(),attributes:of}).strict();var zx=d({data:I(Aa)}).strict();var kx=d({data:Aa}).strict();var sf=d({url:a(c()),outputs:a(tf),destinations:a(br),callback:a(c())}).strict();var af=d({src:c().min(1).regex(/\S/),effect:a(w(["fadeIn","fadeOut","fadeInFadeOut"])),volume:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var uf=d({type:w(["svg"]),src:c().min(1).max(500000)}).strict();var cf=d({id:c(),merge:a(I(ma))}).strict();var pf=d({horizontal:a(w(["left","center","right"])),vertical:a(w(["top","center","bottom"]))}).strict();var lf=d({preset:w(["typewriter"]),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0.1).lte(30)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),ff=d({color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),padding:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),borderRadius:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),wrap:a(N())}).strict();var df=d({family:a(c()),color:a(c()),opacity:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),size:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),weight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),lineHeight:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var mf=d({width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),hf=d({type:w(["text"]),text:c(),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),font:a(df),background:a(ff),alignment:a(pf),stroke:a(mf),animation:a(lf),ellipsis:a(c())}).strict().superRefine((e,t)=>{if(e.background&&e.background.wrap===!0)t.addIssue({code:Ie.custom,message:'background.wrap is only supported on rich-text and rich-caption assets. For type "text", migrate to type "rich-text" to use this feature.',path:["background","wrap"]})});var gf=d({type:w(["text-to-image"]),prompt:c(),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),crop:a(wt)}).strict();var _f=d({capture:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),scale:f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}).strict();var xf=d({format:w(["mp4","gif","mp3","jpg","png","bmp"]),resolution:a(w(["preview","mobile","sd","hd","1080","4k"])),aspectRatio:a(w(["16:9","9:16","1:1","4:5","4:3"])),size:a(wa),fps:a(f([E(12),E(15),E(23.976),E(24),E(25),E(29.97),E(30),E(48),E(50),E(59.94),E(60)])),scaleTo:a(w(["preview","mobile","sd","hd","1080","4k"])),quality:a(w(["verylow","low","medium","high","veryhigh"])),repeat:a(N()),mute:a(N()),range:a(Il),poster:a(Nl),thumbnail:a(_f),destinations:a(I(br))}).strict().superRefine((e,t)=>{var r=e.format==="mp3";if(!r&&e.size!=null&&(e.size.width==null||e.size.height==null)){t.addIssue({code:Ie.custom,path:["size"],message:"size requires both width and height"});return}var n=typeof e.resolution==="string",o=e.size!=null&&e.size.width!=null&&e.size.height!=null;if(!r&&!n&&!o)t.addIssue({code:Ie.custom,message:'output requires either "resolution" or "size" (with width and height)'})});var yf=d({in:a(w(["none","fade","fadeSlow","fadeFast","reveal","revealSlow","revealFast","wipeLeft","wipeLeftSlow","wipeLeftFast","wipeRight","wipeRightSlow","wipeRightFast","slideLeft","slideLeftSlow","slideLeftFast","slideRight","slideRightSlow","slideRightFast","slideUp","slideUpSlow","slideUpFast","slideDown","slideDownSlow","slideDownFast","carouselLeft","carouselLeftSlow","carouselLeftFast","carouselRight","carouselRightSlow","carouselRightFast","carouselUp","carouselUpSlow","carouselUpFast","carouselDown","carouselDownSlow","carouselDownFast","shuffleTopRight","shuffleTopRightSlow","shuffleTopRightFast","shuffleRightTop","shuffleRightTopSlow","shuffleRightTopFast","shuffleRightBottom","shuffleRightBottomSlow","shuffleRightBottomFast","shuffleBottomRight","shuffleBottomRightSlow","shuffleBottomRightFast","shuffleBottomLeft","shuffleBottomLeftSlow","shuffleBottomLeftFast","shuffleLeftBottom","shuffleLeftBottomSlow","shuffleLeftBottomFast","shuffleLeftTop","shuffleLeftTopSlow","shuffleLeftTopFast","shuffleTopLeft","shuffleTopLeftSlow","shuffleTopLeftFast","zoom"])),out:a(w(["none","fade","fadeSlow","fadeFast","reveal","revealSlow","revealFast","wipeLeft","wipeLeftSlow","wipeLeftFast","wipeRight","wipeRightSlow","wipeRightFast","slideLeft","slideLeftSlow","slideLeftFast","slideRight","slideRightSlow","slideRightFast","slideUp","slideUpSlow","slideUpFast","slideDown","slideDownSlow","slideDownFast","carouselLeft","carouselLeftSlow","carouselLeftFast","carouselRight","carouselRightSlow","carouselRightFast","carouselUp","carouselUpSlow","carouselUpFast","carouselDown","carouselDownSlow","carouselDownFast","shuffleTopRight","shuffleTopRightSlow","shuffleTopRightFast","shuffleRightTop","shuffleRightTopSlow","shuffleRightTopFast","shuffleRightBottom","shuffleRightBottomSlow","shuffleRightBottomFast","shuffleBottomRight","shuffleBottomRightSlow","shuffleBottomRightFast","shuffleBottomLeft","shuffleBottomLeftSlow","shuffleBottomLeftFast","shuffleLeftBottom","shuffleLeftBottomSlow","shuffleLeftBottomFast","shuffleLeftTop","shuffleLeftTopSlow","shuffleLeftTopFast","shuffleTopLeft","shuffleTopLeftSlow","shuffleTopLeftFast","zoom"]))}).strict();var oe=d({from:a(Z()),to:a(Z()),start:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),length:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),interpolation:a(w(["linear","bezier","constant"])),easing:a(w(["ease","easeIn","easeOut","easeInOut","easeInQuad","easeInCubic","easeInQuart","easeInQuint","easeInSine","easeInExpo","easeInCirc","easeInBack","easeOutQuad","easeOutCubic","easeOutQuart","easeOutQuint","easeOutSine","easeOutExpo","easeOutCirc","easeOutBack","easeInOutQuad","easeInOutCubic","easeInOutQuart","easeInOutQuint","easeInOutSine","easeInOutExpo","easeInOutCirc","easeInOutBack"]))}).strict();var bf=d({type:w(["audio"]),src:a(c().min(1).regex(/\S/)),prompt:a(c().max(4000)),model:a(c()),options:a(Ne(c(),Z())),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(oe)])),speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),effect:a(w(["none","fadeIn","fadeOut","fadeInFadeOut"]))}).strict().superRefine((e,t)=>{var r=typeof e.src==="string"&&e.src.trim().length>0,n=typeof e.prompt==="string"&&e.prompt.trim().length>0;if(!r&&!n)t.addIssue({code:Ie.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var Sa=d({x:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-10).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(oe)])),y:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-10).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(oe)]))}).strict();var wf=d({angle:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-360).lte(360)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(oe)]))}).strict();var $f=d({x:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-100).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(oe)])),y:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(-100).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(oe)]))}).strict();var Af=d({type:w(["text-to-speech"]),text:c(),voice:c(),language:a(c()),newscaster:a(N()).default(!1),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(oe)])),speed:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),effect:a(w(["none","fadeIn","fadeOut","fadeInFadeOut"]))}).strict();var Sf=d({type:w(["title"]),text:c(),style:a(w(["minimal","blockbuster","vogue","sketchy","skinny","chunk","chunkLight","marker","future","subtitle"])),color:a(c()),size:a(w(["xx-small","x-small","small","medium","large","x-large","xx-large"])),background:a(c()),position:a(w(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"])),offset:a(Sa)}).strict();var zf=d({rotate:a(wf),skew:a($f),flip:a(hl)}).strict();var kf=d({type:w(["video"]),src:a(c().min(1).regex(/\S/)),prompt:a(c().max(4000)),model:a(c()),options:a(Ne(c(),Z())),transcode:a(N()),trim:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(oe)])),volumeEffect:a(w(["none","fadeIn","fadeOut","fadeInFadeOut"])),speed:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(oe)])),crop:a(wt),chromaKey:a(Wp)}).strict().superRefine((e,t)=>{var r=typeof e.src==="string"&&e.src.trim().length>0,n=typeof e.prompt==="string"&&e.prompt.trim().length>0;if(!r&&!n)t.addIssue({code:Ie.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var Zf=aa("type",[kf,wl,hf,Wl,bf,Tl,Kp,Hl,bl,yl,Sf,ef,uf,gf,$l,Af]);var Of=d({id:a(c()),asset:Zf,start:f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),f([c().regex(/^(auto|alias:\/\/[A-Za-z0-9_-]+)$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])]),length:f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),f([c().regex(/^(auto|end|alias:\/\/[A-Za-z0-9_-]+)$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])]),fit:a(w(["cover","contain","crop","none"])),scale:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(oe)])),width:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(1).lte(3840)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g().gte(1).lte(2160)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),position:a(w(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"])),offset:a(Sa),transition:a(yf),effect:a(w(["zoomIn","zoomInSlow","zoomInFast","zoomOut","zoomOutSlow","zoomOutFast","slideLeft","slideLeftSlow","slideLeftFast","slideRight","slideRightSlow","slideRightFast","slideUp","slideUpSlow","slideUpFast","slideDown","slideDownSlow","slideDownFast"])),filter:a(w(["none","blur","boost","contrast","darken","greyscale","lighten","muted","negative"])),opacity:a(f([f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),I(oe)])),transform:a(zf),alias:a(f([c().regex(/^[A-Za-z0-9_-]+$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Ef=Of.transform((e)=>{if(e.asset&&typeof e.asset==="object"&&"type"in e.asset){if(e.asset.type==="rich-text"){let{fit:r,...n}=e;return n}}return e}),Rf=d({clips:I(Ef).min(1)}).strict();var Pf=d({soundtrack:a(af),background:a(c()),fonts:a(I(gl)),tracks:I(Rf).min(1),cache:a(N())}).strict();var Ke=d({timeline:Pf,output:xf,merge:a(I(ma)),callback:a(c()),disk:a(w(["local","mount"])),instance:a(w(["s1","s2","a1"]))}).strict(),za=Ke,Cf=d({id:c(),owner:c(),plan:a(c()),status:w(["queued","fetching","preprocessing","rendering","generating","saving","done","failed"]),error:a(c()),duration:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),renderTime:a(f([_((e)=>{if(e===""||e===null||e===void 0)return;if(Array.isArray(e))return e;if(typeof e==="string"){if(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(e))return e;return Number(e)}return e},g()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),url:a(c()),poster:a(f([c(),Te()])),thumbnail:a(f([c(),Te()])),data:a(Ke),created:a(c()),updated:a(c())}).strict();var Zx=d({success:N(),message:c(),response:Cf}).strict();var Tf=d({id:c(),name:c(),owner:c(),template:Ke}).strict();var Ox=d({success:N(),message:c(),response:Tf}).strict();var ka=d({name:c(),template:a(Ke)}).strict();var Ex=d({body:Ke,path:a(z()),query:a(z())}).strict();var Rx=d({body:a(z()),path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(d({data:a(N()),merged:a(N())}))}).strict();var Px=d({body:a(z()),path:a(z()),query:a(z())}).strict();var Cx=d({body:ka,path:a(z()),query:a(z())}).strict();var Tx=d({body:a(z()),path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(z())}).strict(),Nx=yr(),Ix=d({body:a(z()),path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(z())}).strict();var jx=d({body:ka,path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(z())}).strict();var Fx=d({body:cf,path:a(z()),query:a(z())}).strict();var Dx=d({body:a(z()),path:d({url:c()}),query:a(z())}).strict();var Lx=d({body:da,path:a(z()),query:a(z()),headers:a(d({"Idempotency-Key":a(c())}))}).strict();var Mx=d({body:da,path:a(z()),query:a(z())}).strict();var vx=d({body:a(z()),path:d({id:c()}),query:a(z())}).strict();var Ux=d({body:a(z()),path:a(z()),query:a(d({expand:a(w(["options"]))}))}).strict();var Vx=d({body:a(z()),path:d({id:c()}),query:a(z())}).strict();var Jx=d({body:a(z()),path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(z())}).strict(),qx=yr(),Bx=d({body:a(z()),path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(z())}).strict();var Hx=d({body:a(z()),path:d({id:f([c().regex(/^[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}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(z())}).strict();var Gx=d({body:Ql,path:a(z()),query:a(z())}).strict();var Kx=d({body:a(z()),path:a(z()),query:a(z())}).strict();var Wx=d({body:sf,path:a(z()),query:a(z())}).strict();var Yx=d({body:a(z()),path:d({id:f([c().regex(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(z())}).strict(),Xx=yr(),Qx=d({body:a(z()),path:d({id:f([c().regex(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(z())}).strict();var ey=d({body:a(z()),path:a(z()),query:a(z())}).strict();var Nf={alignment:"align",duration:"length",transitions:"transition",name:"family"},Za={"align.vertical":{center:"middle"},fit:{cover:"crop"}},If=new Set(["arapey","clear sans","clearsans","didact gothic","didactgothic","montserrat","movlette","notoemoji","open sans","opensans","permanent marker","permanentmarker","roboto","sue ellen francisco","sueellenfrancisco","uni neue","unineue","work sans","worksans"]),jf=/-(?:(?:Extra(?:Light|Bold)|SemiBold|Regular|Medium|Light|Black|Bold|Thin|Heavy)(?:Italic|Oblique)?|(?:Italic|Oblique))$/i,Ff=new Set(["image","video","audio","luma"]);function ge(e){let t=[],r=za.safeParse(e);if(!r.success)for(let o of Vf(r.error))t.push({...o,level:"error"});for(let o of Df(e))t.push(o);return{ok:!t.some((o)=>(o.level??"error")==="error"),issues:t}}function ce(e){let t=e.filter((o)=>(o.level??"error")==="error"),r=e.filter((o)=>o.level==="warning"),n=[];if(t.length){let o=r.length?`, ${r.length} warning${$r(r.length)}`:"";n.push(`✗ Edit JSON failed validation (${t.length} error${$r(t.length)}${o}):`)}else n.push(`⚠ Edit JSON valid, with ${r.length} warning${$r(r.length)}:`);for(let o of e){let s=(o.level??"error")==="error"?"✗":"⚠",i=o.suggestion?` (did you mean '${o.suggestion}'?)`:"";n.push(` ${s} ${o.path||"<root>"}: ${o.message}${i}`)}return n.join(`
|
|
89
|
+
`)}function $r(e){return e===1?"":"s"}function Df(e){let t=[],n=e?.timeline,o=n?.tracks;if(!Array.isArray(o))return t;let s=[];if(Array.isArray(n?.fonts))for(let i of n.fonts){let u=Mf(i?.src);if(u)s.push(u)}return o.forEach((i,u)=>{let p=i?.clips;if(!Array.isArray(p))return;let l=p.map((m,x)=>({ci:x,start:m?.start,len:m?.length})).filter((m)=>typeof m.start==="number"&&typeof m.len==="number");for(let m=0;m<l.length;m++)for(let x=m+1;x<l.length;x++){let b=l[m],y=l[x];if(b.start<y.start+y.len&&y.start<b.start+b.len){let[S,F]=b.ci<y.ci?[b.ci,y.ci]:[y.ci,b.ci];t.push({path:`timeline.tracks[${u}].clips`,code:"clip_overlap",level:"error",message:`clips [${S}] and [${F}] overlap in time — clips on one track must not `+"overlap (they flicker). Put simultaneous elements on separate tracks."})}}p.forEach((m,x)=>{let b=m?.asset,y=`timeline.tracks[${u}].clips[${x}]`,S=b?.font?.family;if(typeof S==="string"&&S.length>0){let ae=Lf(S,s,`${y}.asset.font.family`);if(ae)t.push(ae)}let F=b?.type;if(F==="html5"&&typeof b?.js==="string"&&b.js.length>0){let ae=vf(b.js,`${y}.asset.js`);if(ae)t.push(ae)}let T=b?.src;if(typeof F==="string"&&Ff.has(F)&&typeof T==="string")if(/^https:\/\//i.test(T)||/^alias:\/\//i.test(T));else if(/^data:/i.test(T))t.push({path:`${y}.asset.src`,code:"src_not_public",level:"warning",message:"data: URIs aren't fetched by render workers — host the asset and use a public https:// URL."});else if(/^http:\/\//i.test(T))t.push({path:`${y}.asset.src`,code:"src_not_https",level:"warning",message:"http:// sources are blocked/upgraded — use https://."});else t.push({path:`${y}.asset.src`,code:"src_not_public",level:"warning",message:`'${Uf(T,48)}' is not a public https:// URL — local paths don't render. `+"Host it with 'shotstack ingest upload' and use the returned URL."})})}),t}function Lf(e,t,r){let n=e.toLowerCase();if(If.has(n))return null;if(t.some((s)=>n===s.full.toLowerCase()||n===s.base.toLowerCase()))return null;let o="the exact family name stored in the font file, which can differ from the name on Google Fonts (Space Grotesk's file says 'Space Grotesk Light')";if(t.length===0)return{path:r,code:"font_not_loaded",level:"warning",message:`font.family '${e}' is neither a built-in font nor loaded via timeline.fonts[] — `+"it renders in Roboto. Add the font's URL to timeline.fonts[] and use its filename as font.family."};if(t.length===1)return{path:r,code:"font_not_loaded",level:"warning",message:`font.family '${e}' doesn't match the timeline.fonts[] filename. It renders in that font only because it's the sole entry; add another font and it falls back to Roboto unless it's ${o}. Use the filename to be sure.`,suggestion:t[0].full};return{path:r,code:"font_not_loaded",level:"warning",message:`font.family '${e}' doesn't match any timeline.fonts[] filename (${t.map((s)=>`'${s.full}'`).join(", ")}). It renders in Roboto unless it's ${o}. Use the filename to be sure.`}}function Mf(e){if(typeof e!=="string")return null;let t=e.split(/[?#]/,1)[0].split("/").pop()??"";try{t=decodeURIComponent(t)}catch{}let r=t.replace(/\.(ttf|otf|woff2?|eot)$/i,"");return r.length?{full:r,base:r.replace(jf,"")}:null}function vf(e,t){try{Function(e)}catch(r){let n=r instanceof Error?r.message:String(r);return{path:t,code:"js_syntax_error",level:"error",message:`asset.js has a syntax error — the html5 clip will render completely blank with no render error. ${n}`}}return null}function Uf(e,t){return e.length>t?`${e.slice(0,t)}…`:e}function Vf(e){return e.issues.flatMap((t)=>Jf(t))}function Jf(e){let t=Bf(e.path);if(e.code==="unrecognized_keys"&&"keys"in e)return e.keys.map((n)=>({path:Hf(t,n),code:e.code,message:`unrecognized key '${n}'`,suggestion:Nf[n]}));let r=qf(t,e);return[{path:t,code:e.code,message:e.message,...r?{suggestion:r}:{}}]}function qf(e,t){let r=e.replace(/\[\d+\]/g,""),n=r.split(".").slice(-2).join(".");if(t.code==="invalid_value"&&"received"in t){let o=String(t.received);return Za[n]?.[o]??Za[r]?.[o]}return}function Bf(e){return e.reduce((t,r)=>{if(typeof r==="number")return`${t}[${r}]`;let n=String(r);return t?`${t}.${n}`:n},"")}function Hf(e,t){return e?`${e}.${t}`:t}var Oa=new j("render").description("Submit a Shotstack Edit JSON to the render API").argument("<file>","Path to a Shotstack Edit JSON file").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--watch","After submitting, poll until the render reaches a terminal state").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("render",q("render"),async()=>{let r=P(t.output),n=V(t.env),o=D(n.name),s=Kf(process.cwd(),e),i=await Gf(s,"utf8"),u=JSON.parse(i),p=ge(u);if(!p.ok){if(r==="json")console.log(JSON.stringify({ok:!1,issues:p.issues}));else console.error(ce(p.issues));return{exitCode:1,validation:p}}if(p.issues.length>0&&r!=="json")console.error(ce(p.issues));let l=U({apiKey:o,env:n}),m=t.watch?2:1,x="";for(let b=1;b<=m;b++){let y=await l.post("/render",u),S=y.response.id;if(x=S,!t.watch)return O(r,{id:S},S),{renderId:S,response:y.response};let F=await Lt(l,S,r,!0);if(F.status!=="failed")return{renderId:S,response:F,exitCode:0};let T=Yf(F.error);if(T&&b<m){if(r!=="json")console.error(`⚠ render failed (${F.error??"unknown"}) — looks transient, resubmitting ${b+1}/${m}…`);await Xf(2000);continue}if(r!=="json")console.error(T?`✗ render still failing after ${m} attempts. For a complex multi-scene edit, preview it client-side first: shotstack studio ${e}`:`✗ render failed: ${F.error??"unknown error"}`);return{renderId:S,response:F,exitCode:1}}return{renderId:x,exitCode:1}})}),Wf=/temporar|try again|time ?d? ?out|timeout|too many requests|service unavailable|unavailable|throttl/i;function Yf(e){return typeof e==="string"&&Wf.test(e)}function Xf(e){return new Promise((t)=>setTimeout(t,e))}import{readFile as Qf,writeFile as ed,mkdtemp as td}from"node:fs/promises";import{tmpdir as rd}from"node:os";import{join as Ea}from"node:path";import{spawn as nd}from"node:child_process";var Ra="https://github.com/shotstack/shotstack-cli/issues/new?template=bug.yml",od=6000,Na=5,Ia=new j("feedback").description("Open a pre-filled GitHub issue with a flight-recorder dossier from your last 5 invocations").action(async()=>{let e=await sd(Na),t=id(e),r=ud(e),n=`&title=${encodeURIComponent(r)}`,o=`${Ra}${n}&body=${encodeURIComponent(t)}`;if(o.length<=od){Ta(o),console.log("Opened browser with pre-filled issue. Review before submitting.");return}let s=await td(Ea(rd(),"shotstack-feedback-")),i=Ea(s,"dossier.md");await ed(i,t),Ta(`${Ra}${n}`),console.log(`Dossier too large to inline. Saved to: ${i}`),console.log("Drag the file into the issue body, or paste its contents.")});async function sd(e){let t=tt(),r;try{r=await Qf(t,"utf8")}catch{return[]}let o=r.split(`
|
|
90
|
+
`).filter((i)=>i.trim().length>0).slice(-e).reverse(),s=[];for(let i of o)try{s.push(JSON.parse(i))}catch{}return s}function id(e){let t=[];if(t.push("## Environment"),t.push(`- Shotstack CLI: ${De}`),t.push(`- OS: ${process.platform}-${process.arch}`),t.push(""),t.push(`## Last ${Na} invocations (most recent first)`),t.push(""),e.length===0)t.push("_No recorded invocations._");else for(let r of e){let n=(r.args??[]).join(" "),o=`### ${r.ts} — shotstack ${r.cmd}${n?" "+n:""}`;if(t.push(o),t.push(`- Exit: ${r.exit} Duration: ${r.durationMs}ms`),r.renderId)t.push(`- Render ID: ${r.renderId}`);if(r.response!==void 0){let s=typeof r.response==="string"?r.response:JSON.stringify(r.response);t.push(`- Response: ${s}`)}if(r.error)t.push(`- Error: ${r.error.name}: ${r.error.message}`);t.push("")}return t.push(`[full log at ${tt()}]`),t.push(""),t.push("## What I expected vs what happened"),t.push("<!-- Describe the issue, request, or question here. -->"),t.join(`
|
|
91
|
+
`)}var Pa=80,ad="Feedback from shotstack CLI";function ud(e){let t=e.find((o)=>o.error);if(t&&t.error)return Ar(`${t.cmd}: ${t.error.name} — ${t.error.message}`);let r=e.find((o)=>Ca(o.response)!==null);if(r){let o=Ca(r.response);return Ar(`Render failed: ${o}`)}let n=e.find((o)=>o.exit!==0);if(n)return Ar(`${n.cmd} exited ${n.exit}`);return ad}function Ca(e){if(!e||typeof e!=="object"||Array.isArray(e))return null;let t=e;if(t.state!=="failed")return null;return typeof t.error==="string"&&t.error.length>0?t.error:"unknown error"}function Ar(e){return e.length<=Pa?e:e.slice(0,Pa-1)+"…"}function Ta(e){let t=process.platform==="win32",r=process.platform==="darwin"?"open":t?"cmd":"xdg-open",o=nd(r,t?["/c","start","",e]:[e],{stdio:"ignore",detached:!0});o.on("error",()=>{console.error(`Could not open browser. Visit: ${e}`)}),o.unref()}import{readFile as cd}from"node:fs/promises";import{resolve as pd}from"node:path";import{spawn as Fa,execSync as ld}from"node:child_process";var Da="https://shotstack.studio",fd=`${Da}/api/share`,dd=5000,md=6000,La=new j("studio").description("Open the Edit JSON in the shotstack.studio web editor. By default, posts the JSON to the share API and returns a short URL.").argument("<file>","Path to a Shotstack Edit JSON file").option("--copy","Copy the URL to the clipboard").option("--no-open","Do not try to open the URL in a browser").option("--no-shorten","Skip the share API; emit a base64url URL inline").option("--env <name>",`Environment whose API key makes the short link permanent: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{let r=P(t.output),n=pd(process.cwd(),e),o=await cd(n,"utf8"),s=JSON.parse(o),i=ge(s);if(!i.ok){if(r==="json")console.log(JSON.stringify({ok:!1,issues:i.issues}));else console.error(ce(i.issues));process.exit(1)}let u=t.shorten?gd(t.env):void 0,{url:p,shortened:l}=await hd(s,{shorten:t.shorten,apiKey:u,env:t.shorten?_e(t.env):void 0});if(!l&&p.length>md)console.error(`warning: encoded URL is ${p.length} characters; large templates may exceed browser URL limits.`);if(t.copy)await yd(p);let m=t.open&&Ad()&&wd(p);if(r==="json"||!m)O(r,{url:p,shortened:l},p)});async function hd(e,t={}){if(t.shorten!==!1){let n=await xd(e,t.apiKey);if("url"in n){if(!t.apiKey)console.error(t.env==="dev"?"note: this link lasts 30 days. Dev keys can't make links permanent; use --env stage or --env v1.":"note: this link lasts 30 days. Run `shotstack login` or set SHOTSTACK_API_KEY to make your links permanent.");return{url:n.url,shortened:!0}}console.error(`warning: the shotstack.studio share API failed (${n.failed}); falling back to inline URL.`)}return{url:_d(e),shortened:!1}}function gd(e,t){let r=_e(e);if(r==="dev")return;try{return D(r,t)}catch(n){if(n instanceof pe)return;throw n}}function _d(e){let t=Buffer.from(JSON.stringify(e),"utf8").toString("base64url");return`${Da}/#json=${t}`}async function xd(e,t){let r={"Content-Type":"application/json","x-share-source":"cli"};if(t)r["x-api-key"]=t;let n=await ja(e,r);return"retry"in n&&n.retry?ja(e,r):n}async function ja(e,t){let r;try{r=await fetch(fd,{method:"POST",headers:t,body:JSON.stringify(e),redirect:"error",signal:AbortSignal.timeout(dd)})}catch(o){return{failed:o.message,retry:!0}}let n=await r.json().catch(()=>({}));if(r.ok&&n.url)return{url:n.url};if(r.status===429||r.status>=500)return{failed:`HTTP ${r.status}`,retry:!0};if(r.status>=400){let o=`${n.error??"no reason given"} (HTTP ${r.status})`;throw new te(r.status,n,`The shotstack.studio share API refused the request: ${o}`)}return{failed:`HTTP ${r.status} without a url`,retry:!1}}async function yd(e){let{cmd:t,args:r}=bd();await new Promise((n,o)=>{let s=Fa(t,r,{stdio:["pipe","ignore","ignore"]});s.on("error",o),s.on("exit",(i)=>i===0?n():o(Error(`${t} exited ${i}`))),s.stdin.end(e)})}function bd(){if(process.platform==="darwin")return{cmd:"pbcopy",args:[]};if(process.platform==="win32")return{cmd:"clip",args:[]};return{cmd:"xclip",args:["-selection","clipboard"]}}function wd(e){let{cmd:t,args:r}=$d(e);try{let n=Fa(t,r,{detached:!0,stdio:"ignore"});return n.on("error",()=>{}),n.unref(),!0}catch{return!1}}function $d(e){if(process.platform==="win32")return{cmd:"cmd",args:["/c","start","",e]};if(process.platform==="darwin")return{cmd:"open",args:[e]};return{cmd:"xdg-open",args:[e]}}function Ad(){if(process.platform==="darwin"||process.platform==="win32")return!0;if(!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY)return!1;try{return ld("command -v xdg-open",{stdio:"ignore"}),!0}catch{return!1}}import{readFile as Sd}from"node:fs/promises";import{resolve as zd,extname as Ma}from"node:path";var va=3000,kd=new Set(["ready","failed","deleted","overwritten"]),Zd=new Set(["ready","failed","deleted","overwritten"]),Od=[512,1024,2048,4096],Ed=60000,Rd=new Set([".jpg",".jpeg",".png",".webp",".avif",".tif",".tiff"]),Ae=new j("ingest").description("Ingest source media via the Shotstack Ingest API: upload local files, fetch remote URLs, and manage stored sources");Ae.command("upload <file>").description("Upload a local file and host it on Shotstack for use as an Edit asset src").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--watch","Poll until the source is ready, then print its hosted URL").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("ingest upload",q("upload"),async()=>{let r=P(t.output),n=V(t.env,"ingest"),o=D(n.name),s=U({apiKey:o,env:n}),i=await Sd(zd(process.cwd(),e)),u=await s.post("/upload"),{id:p,url:l}=u.data.attributes;return await Td(l,i,Id(e)),Ua(s,p,r,t.watch===!0)})});Ae.command("fetch <url>").description("Ingest a remote URL into Shotstack-hosted storage").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--watch","Poll until the source is ready, then print its hosted URL").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("ingest fetch",q("fetch"),async()=>{let r=P(t.output),n=V(t.env,"ingest"),o=D(n.name),s=U({apiKey:o,env:n}),i=await s.post("/sources",{url:e});return Ua(s,i.data.id,r,t.watch===!0)})});Ae.command("status <id>").description("Poll the status of an ingested source").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--watch","Poll continuously until the source reaches a terminal state").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("ingest status",q("status"),async()=>{let r=P(t.output),n=V(t.env,"ingest"),o=D(n.name),s=U({apiKey:o,env:n}),i=await Va(s,e,r,t.watch===!0);return{renderId:i.id,response:We(i),exitCode:i.status==="failed"?1:0}})});Ae.command("list").description("List ingested sources").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{await J("ingest list",q("list"),async()=>{let t=P(e.output),r=V(e.env,"ingest"),n=D(r.name),i=(await U({apiKey:n,env:r}).get("/sources")).data.map((p)=>We(p.attributes)),u=i.length?i.map((p)=>[p.id,p.status,p.source??""].join(" ").trimEnd()).join(`
|
|
92
|
+
`):"No sources.";return O(t,i,u),{response:{count:i.length}}})});Ae.command("delete <id>").description("Delete an ingested source").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("ingest delete",q("delete"),async()=>{let r=P(t.output),n=V(t.env,"ingest"),o=D(n.name);return await U({apiKey:o,env:n}).del(`/sources/${encodeURIComponent(e)}`),O(r,{id:e,deleted:!0},`deleted ${e}`),{renderId:e,response:{id:e,deleted:!0}}})});async function Ua(e,t,r,n){if(!n)return O(r,{id:t},t),{renderId:t,response:{id:t}};let o=await Cd(e,await Va(e,t,r,!0),r);return{renderId:t,response:We(o),exitCode:o.status==="failed"?1:0}}function Pd(e){let{status:t,width:r,height:n}=e;if(t!=="ready"||!r||!n||!e.source)return[];if(!Rd.has(Ma(new URL(e.source).pathname).toLowerCase()))return[];let o=r>=n?"width":"height";return Od.filter((s)=>s<Math.max(r,n)).map((s)=>({format:"webp",size:{[o]:s},filename:`html5-${s}`}))}async function Cd(e,t,r,{timeoutMs:n=Ed,intervalMs:o=va}={}){let s=Pd(t);if(!s.length)return t;let i=`/sources/${encodeURIComponent(t.id)}`;try{await e.post(`${i}/renditions`,{outputs:{renditions:s}})}catch(p){return console.error(`Could not request html5 size steps: ${p instanceof Error?p.message:String(p)}`),t}let u=Date.now()+n;while(!0){let p=(await e.get(i)).data.attributes;O(r,We(p),Ja(p));let l=p.outputs?.renditions??[];if(!(l.length<s.length||l.some((x)=>!Zd.has(x.status)))||Date.now()>=u)return p;await qa(o)}}async function Va(e,t,r,n,o=va){while(!0){let i=(await e.get(`/sources/${encodeURIComponent(t)}`)).data.attributes;if(O(r,We(i),Ja(i)),!n||kd.has(i.status))return i;await qa(o)}}async function Td(e,t,r){let n=await fetch(e,{method:"PUT",headers:r?{"content-type":r}:void 0,body:t});if(!n.ok){let o=await n.text().catch(()=>"");throw new te(n.status,o||void 0,`PUT upload → ${n.status} ${n.statusText}`)}}var Nd={".mp4":"video/mp4",".webm":"video/webm",".mov":"video/quicktime",".avi":"video/x-msvideo",".mkv":"video/x-matroska",".ogv":"video/ogg",".wmv":"video/x-ms-wmv",".gif":"image/gif",".mp3":"audio/mpeg",".wav":"audio/wav",".m4a":"audio/mp4",".aac":"audio/aac",".ogg":"audio/ogg",".flac":"audio/flac",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp",".avif":"image/avif",".tif":"image/tiff",".tiff":"image/tiff",".svg":"image/svg+xml",".srt":"application/x-subrip",".vtt":"text/vtt",".ttf":"font/ttf",".otf":"font/otf",".woff":"font/woff",".woff2":"font/woff2"};function Id(e){return Nd[Ma(e).toLowerCase()]}function We(e){let t={id:e.id,status:e.status};if(e.source)t.source=e.source;if(e.input)t.input=e.input;if(e.width)t.width=e.width;if(e.height)t.height=e.height;if(e.duration)t.duration=e.duration;if(e.error)t.error=e.error;let r=e.outputs?.renditions;if(r?.length)t.outputs={renditions:r.map(({status:n,url:o})=>({status:n,url:o}))};return t}function Ja(e){let t=[e.status];if(e.source)t.push(e.source);if(e.error)t.push(`error: ${e.error}`);return t.join(" ")+(e.outputs?.renditions??[]).map(jd).join("")}function jd(e){let t=e.transformation?.size,r=e.url??(t?`${t.width??t.height}px`:"");return`
|
|
93
|
+
${e.status} ${r}`.trimEnd()}function qa(e){return new Promise((t)=>setTimeout(t,e))}import{readFile as Fd}from"node:fs/promises";import{resolve as Dd}from"node:path";async function Ld(e,t){return(await e.get(`/templates/${encodeURIComponent(t)}`)).response}async function Md(e){return(await e.get("/templates")).response.templates}async function vd(e,t,r){return(await e.post("/templates",{name:t,template:r})).response.id}async function Ud(e,t,r,n){let o={template:r};if(n)o.name=n;await e.put(`/templates/${encodeURIComponent(t)}`,o)}async function Vd(e,t){await e.del(`/templates/${encodeURIComponent(t)}`)}async function Ba(e){let t=await Fd(Dd(process.cwd(),e),"utf8");return JSON.parse(t)}var Se=new j("template").description("Work with saved Shotstack templates");Se.command("get <id>").description("Fetch a saved template's Edit JSON by id — pipe it to a file or `shotstack render`").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("template get",q("get"),async()=>{let r=P(t.output),n=V(t.env),o=D(n.name),s=U({apiKey:o,env:n}),i=await Ld(s,e);return O(r,i.template,JSON.stringify(i.template,null,2)),{templateId:i.id,exitCode:0}})});Se.command("list").description("List your saved templates (id and name), newest first").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{await J("template list",q("list"),async()=>{let t=P(e.output),r=V(e.env),n=D(r.name),o=U({apiKey:n,env:r}),s=await Md(o),i=s.length?s.map((u)=>`${u.id} ${u.name??""}`.trimEnd()).join(`
|
|
94
|
+
`):"No templates found";return O(t,s,i),{count:s.length,exitCode:0}})});Se.command("create <file>").description("Save an Edit JSON file as a new template; prints the new template id").requiredOption("--name <name>","Name for the saved template").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("template create",q("create"),async()=>{let r=P(t.output),n=V(t.env),o=D(n.name),s=U({apiKey:o,env:n}),i=await Ba(e),u=await vd(s,t.name,i);return O(r,{id:u},u),{templateId:u,exitCode:0}})});Se.command("update <id> <file>").description("Overwrite a saved template with an Edit JSON file").option("--name <name>","Also rename the template").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t,r)=>{await J("template update",q("update"),async()=>{let n=P(r.output),o=V(r.env),s=D(o.name),i=U({apiKey:s,env:o}),u=await Ba(t);return await Ud(i,e,u,r.name),O(n,{id:e,status:"updated"},`updated ${e}`),{templateId:e,exitCode:0}})});Se.command("delete <id>").description("Delete a saved template").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("template delete",q("delete"),async()=>{let r=P(t.output),n=V(t.env),o=D(n.name),s=U({apiKey:o,env:n});return await Vd(s,e),O(r,{id:e,status:"deleted"},`deleted ${e}`),{templateId:e,exitCode:0}})});import{readFile as Jd}from"node:fs/promises";import{resolve as qd}from"node:path";var Ha=new j("validate").description("Validate an Edit JSON offline — schema (property names, enums, types) plus "+"same-track overlaps, unloaded fonts, non-public asset URLs and html5 JS syntax errors. No API key, no credits.").argument("<file>","Path to a Shotstack Edit JSON file").option("--strict","Treat warnings as errors (exit 1 on any warning)").option("--output <format>","Output format: text | json","text").action(async(e,t)=>{let r=P(t.output),n=qd(process.cwd(),e),o=await Jd(n,"utf8"),s;try{s=JSON.parse(o)}catch(l){let m=l instanceof Error?l.message:String(l),x={path:"<root>",code:"invalid_json",level:"error",message:m};if(r==="json")console.log(JSON.stringify({ok:!1,issues:[x]}));else console.error(`✗ ${e}: invalid JSON — ${m}`);process.exitCode=1;return}let i=ge(s),u=i.issues.some((l)=>l.level==="warning"),p=!i.ok||t.strict===!0&&u;if(r==="json")console.log(JSON.stringify({ok:!p,issues:i.issues}));else if(i.issues.length===0)console.log(`✓ ${e} is valid`);else{let l=ce(i.issues);if(p)console.error(l);else console.log(l)}process.exitCode=p?1:0});async function Bd(e){return(await e.get("/models")).models}async function At(e,t){return e.get(`/models/${encodeURIComponent(t)}`)}var Ga=new j("models").description("List generation models with availability, or show one model's options").argument("[id]","Model id; prints the JSON Schema for its options").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("models",q("models"),async()=>{let r=P(t.output),n=V(t.env),o=D(n.name),s=U({apiKey:o,env:n});if(e){let u=await At(s,e);return O(r,u,Gd(u)),{response:{model:u.model,available:u.available}}}let i=await Bd(s);return O(r,i,i.length?Hd(i):"No models."),{response:{count:i.length}}})});function St(e){if(e.available===!0)return"available";if(e.available===!1)return`unavailable: ${e.unavailableReason??"no reason given"}`;return"availability unknown"}function Hd(e){let t=e.map((n)=>[n.model,n.type,St(n)]),r=t[0].map((n,o)=>Math.max(...t.map((s)=>s[o].length)));return t.map((n)=>n.map((o,s)=>o.padEnd(r[s])).join(" ").trimEnd()).join(`
|
|
95
|
+
`)}function Gd(e){let t=[`${e.model} ${e.type} ${St(e)}`];if(e.name)t.push(e.description?`${e.name}: ${e.description}`:e.name);if(e.options)t.push("Options:",JSON.stringify(e.options,null,2));return t.join(`
|
|
96
|
+
`)}var Ka=new Set(["done","failed"]),Wa=3000,Ya=new j("generate").description("Generate one image, video or audio asset from a prompt").argument("<model>","Model id from `shotstack models`").argument("<prompt>","Text prompt; for a speech model, the words to speak").option("--options <json>","Model options as a JSON object (see `shotstack models <model>`)",Qd).option("--length <seconds>","Length of the clip the asset fills; models that generate to a duration use it",em).option("--watch","Poll until the asset is ready, then print its URL").option("--quote","Print the credits this exact request would cost, without generating or charging").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t,r)=>{await J("generate",q("generate"),async()=>{let n=P(r.output),o=V(r.env),s=D(o.name),i=U({apiKey:s,env:o}),u={model:e,prompt:t,options:r.options,length:r.length};if(r.quote)return Wd(i,u,n);return Kd(i,u,n,r.watch===!0)})});async function Kd(e,t,r,n,o=Wa){let s=await At(e,t.model);if(s.available===!1){let p={model:s.model,available:!1,unavailableReason:s.unavailableReason};if(r==="json")console.log(JSON.stringify(p));else console.error(`✗ ${s.model} is ${St(s)}`);return{response:p,exitCode:1}}let i=await e.post("/generate",Xa(s,t));O(r,i,Qa(i));let u=i;if(!Ka.has(i.status)){if(n)u=await Xd(e,i.id,r,o);else if(r!=="json")console.error("Still generating. Run the same command with --watch to wait; the same request returns this job instead of starting another.")}return{renderId:u.id,response:u,exitCode:u.status==="failed"?1:0}}async function Wd(e,t,r){let n=await At(e,t.model),o=await e.post("/generate/quote",Xa(n,t));return O(r,o,Yd(o)),{response:o}}function Yd(e){return`${e.ceiling?"up to ":""}${e.credits} ${e.credits===1?"credit":"credits"}`}function Xa(e,t){return{asset:{type:e.type,prompt:t.prompt,model:e.model,...t.options&&{options:t.options}},...t.length!==void 0&&{length:t.length}}}async function Xd(e,t,r,n=Wa){while(!0){await tm(n);let o=await e.get(`/generate/${encodeURIComponent(t)}`);if(O(r,o,Qa(o)),Ka.has(o.status))return o}}function Qd(e){let t;try{t=JSON.parse(e)}catch{throw new ee("Not valid JSON.")}if(t===null||typeof t!=="object"||Array.isArray(t))throw new ee("Expected a JSON object.");return t}function em(e){let t=Number(e);if(!Number.isFinite(t)||t<=0)throw new ee("Expected a positive number of seconds.");return t}function Qa(e){if(e.status==="done")return`done ${e.url??""}`.trimEnd();if(e.status==="failed")return`failed error: ${e.error??"unknown error"}`;return`${e.status} ${e.id}`}function tm(e){return new Promise((t)=>setTimeout(t,e))}var rm=new Set(["done","failed"]),nm=3000,tu=new j("analyze").alias("analyse").description("Find a music track's tempo, beats, bars, drops and sections").argument("<src>","Public URL of an audio or video file; host a local file with `shotstack ingest upload` first").option("--env <name>",`Environment: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("analyze",q("analyze"),async()=>{let r=P(t.output),n=V(t.env),o=U({apiKey:D(n.name),env:n});return om(o,e,r)})});async function om(e,t,r,n=nm){let o=await e.post("/generate",{asset:{type:"audio",model:"shotstack-music-analysis",src:t}});while(!rm.has(o.status)){if(r!=="json")console.error(`${o.status} ${o.id}`);await im(n),o=await e.get(`/generate/${encodeURIComponent(o.id)}`)}if(o.status==="failed")return O(r,o,`failed error: ${o.error??"unknown error"}`),{response:o,exitCode:1};if(!o.url)return eu(o,"analysis finished without a map URL");let s=await fetch(o.url);if(!s.ok)return eu(o,`could not fetch the analysis map (${s.status}) from ${o.url}`);let i=await s.json();if(O(r,{...i,src:t},`done ${sm(i)}`),r!=="json")console.error("Print the full map with --output json.");return{response:o,exitCode:0}}function eu(e,t){return console.error(t),{response:e,exitCode:1}}function sm(e){let t=`${e.drops?.length??0} drops, ${e.sections?.length??0} sections`;if(!e.steady)return`tempo varies (about ${e.bpm} BPM): ${e.beats?.length??0} beats, ${e.downbeats?.length??0} downbeats, ${t}`;return`${e.bpm} BPM, ${e.meter}/4, bar ${e.bar?.toFixed(2)} s from ${e.origin?.toFixed(2)} s, ${e.bars?.count??0} bars, ${t}`}function im(e){return new Promise((t)=>setTimeout(t,e))}import{existsSync as $m}from"node:fs";import{mkdir as Am,readFile as au,writeFile as Sm}from"node:fs/promises";import{homedir as zm}from"node:os";import{dirname as km,join as uu,parse as Zm,resolve as kr}from"node:path";import{mkdtemp as mm,rm as hm}from"node:fs/promises";import{tmpdir as gm}from"node:os";import{join as _m}from"node:path";import{setTimeout as xm}from"node:timers/promises";import{spawn as am}from"node:child_process";import{existsSync as um}from"node:fs";import{delimiter as cm,join as Sr}from"node:path";function ru(e,t){let r=new Map,n=0,o="";t.setEncoding("utf8"),t.on("data",(i)=>{o+=i;for(let u=o.indexOf("\x00");u!==-1;u=o.indexOf("\x00")){let p=JSON.parse(o.slice(0,u));o=o.slice(u+1);let l=p.id===void 0?void 0:r.get(p.id);if(!l)continue;if(r.delete(p.id),p.error)l.reject(Error(p.error.message));else l.resolve(p.result)}});let s=()=>{for(let i of r.values())i.reject(Error("Chrome closed the DevTools pipe."));r.clear()};return t.on("end",s),t.on("close",s),t.on("error",s),e.on("error",s),{send(i,u={},p){return new Promise((l,m)=>{let x=++n;r.set(x,{resolve:l,reject:m}),e.write(`${JSON.stringify({id:x,method:i,params:u,...p?{sessionId:p}:{}})}\x00`)})},close:()=>e.end()}}class zt extends Error{constructor(){super("No browser found. Install Google Chrome, or set CHROME_PATH to a Chromium-based browser.");this.name="ChromeNotFoundError"}}var pm=["Google Chrome.app/Contents/MacOS/Google Chrome","Chromium.app/Contents/MacOS/Chromium","Microsoft Edge.app/Contents/MacOS/Microsoft Edge","Brave Browser.app/Contents/MacOS/Brave Browser"],lm=["google-chrome","google-chrome-stable","chromium","chromium-browser","microsoft-edge","microsoft-edge-stable","brave-browser"];function fm(e,t){if(t==="darwin")return pm.map((n)=>Sr("/Applications",n));if(t==="win32")return[e.PROGRAMFILES,e["PROGRAMFILES(X86)"],e.LOCALAPPDATA].filter((o)=>Boolean(o)).map((o)=>Sr(o,"Google","Chrome","Application","chrome.exe"));let r=(e.PATH??"").split(cm).filter(Boolean);return lm.flatMap((n)=>r.map((o)=>Sr(o,n)))}function nu(e=process.env,t=process.platform,r=um){let n=[e.CHROME_PATH,...fm(e,t)].find((o)=>Boolean(o)&&r(o));if(!n)throw new zt;return n}var dm=["--headless=new","--remote-debugging-pipe","--no-first-run","--no-default-browser-check","--mute-audio","--autoplay-policy=no-user-gesture-required","--enable-unsafe-swiftshader"];function zr(e=process.env){return e.SHOTSTACK_CHROME_NO_SANDBOX==="1"}function ou({path:e,profileDir:t,env:r=process.env,spawn:n=am}){let o=zr(r)?["--no-sandbox"]:[],s=n(e,[...dm,...o,`--user-data-dir=${t}`],{stdio:["ignore","ignore","pipe","pipe","pipe"]}),i="";s.stdio[2].on("data",(p)=>{i=(i+p.toString()).slice(-2000)});let u=new Promise((p)=>{s.once("exit",()=>p()),s.once("error",()=>p())});return{cdp:ru(s.stdio[3],s.stdio[4]),exited:u,kill:()=>void s.kill("SIGKILL"),output:()=>i.trim()}}class Ye extends Error{name="ChromeLaunchError"}class Xe extends Error{name="PageError"}async function su(e,t,r){let{result:n,exceptionDetails:o}=await e.send("Runtime.evaluate",{expression:r,awaitPromise:!0,returnByValue:!0},t);if(o){let s=o.exception?.description??o.text??"The capture page threw an error.";throw new Xe(s.split(`
|
|
97
|
+
`)[0].replace(/^Error: /,""))}return n?.value}var ym=["Running as root without --no-sandbox is not supported.","No usable sandbox!"],bm=["- If you control this container, run it as a non-root user with user namespaces allowed (for example Playwright's seccomp profile), or with --cap-add SYS_ADMIN.","- On Ubuntu 23.10 or later, use Google Chrome stable, which Ubuntu lets use its sandbox.","- Only in a disposable container running edits you trust, set SHOTSTACK_CHROME_NO_SANDBOX=1 to run Chrome without its sandbox."];function wm(e){let t=ym.find((r)=>e.includes(r));if(t)return new Ye([`Chrome can't start its sandbox here: ${t}`,...bm].join(`
|
|
98
|
+
`));return new Ye(`Chrome couldn't start${e?`:
|
|
99
|
+
${e}`:"."}`)}async function iu(e,{pageUrl:t,timeoutMs:r,profileDir:n,launch:o}){let s=o??((x)=>ou({path:nu(),profileDir:x})),i,u,p=async()=>{i=s(n);let x=await i.cdp.send("Target.createTarget",{url:"about:blank"}).catch(()=>{return});if(!x){i.kill(),u=await mm(_m(gm(),"shotstack-chrome-"));let F=s(u);i=F,x=await F.cdp.send("Target.createTarget",{url:"about:blank"}).catch(()=>{throw wm(F.output())})}let{cdp:b}=i,{sessionId:y}=await b.send("Target.attachToTarget",{targetId:x.targetId,flatten:!0}),{errorText:S}=await b.send("Page.navigate",{url:t},y);if(S)throw new Xe(`Couldn't load ${t}: ${S}`);while(await su(b,y,"window.captureReady === true")!==!0)await xm(50);return await su(b,y,`capture(${JSON.stringify(e)})`)},l,m=new Promise((x,b)=>{l=setTimeout(()=>b(Error(`Capture timed out after ${r/1000} s`)),r)});try{return await Promise.race([p(),m])}finally{if(clearTimeout(l),i?.kill(),u)await hm(u,{recursive:!0,force:!0})}}var Om="https://shotstack.studio/capture.html",Em=60000,cu=new j("inspect").description("Draw an edit's frames at given times into a contact sheet, in headless Chrome, without rendering").argument("<edit>","Path to an Edit JSON file, a render ID, or the URL of a video").option("--at <seconds>","Times to capture, separated by commas, e.g. 0.5,8.05",Tm).option("--bars <map.json>","A music map from `shotstack analyze --output json`: adds a time at every bar line").option("--grid","Overlay a grid labelled in output pixels on a single --at time, for placing overlays").option("--out <path>","Where to write the sheet; past six times, sheets are numbered inspect-1.jpg, inspect-2.jpg, …","inspect.jpg").option("--env <name>",`Environment a render ID belongs to: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("inspect",q("inspect"),async()=>{let r=P(t.output),n=t.bars?JSON.parse(await au(kr(process.cwd(),t.bars),"utf8")):void 0,o=n&&Nm(n),s=await Pm(e,{exists:(u)=>$m(kr(process.cwd(),u)),readEdit:async(u)=>JSON.parse(await au(kr(process.cwd(),u),"utf8")),getRender:async(u)=>{let p=V(t.env);return(await U({apiKey:D(p.name),env:p}).get(`/render/${encodeURIComponent(u)}`)).response}}),i=jm(t.at,o&&"edit"in s?Im(o,s.edit,n?.src):o);return Dm({...s,times:i,grid:t.grid},{out:t.out,format:r,capture:Cm})})});class Qe extends Error{name="RenderNotReadyError"}var Rm=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;async function Pm(e,t){if(/^https?:\/\//i.test(e))return{src:e};if(t.exists(e)||!Rm.test(e))return{edit:await t.readEdit(e)};let r=await t.getRender(e);if(r.status==="failed")throw new Qe(`Render ${e} failed, so there's nothing to inspect.`);if(r.status!=="done"||!r.url)throw new Qe(`Render ${e} is ${r.status}. Inspect it once it's done.`);return{src:r.url}}function Cm(e){if(zr())console.error("Chrome is running without its sandbox (SHOTSTACK_CHROME_NO_SANDBOX=1).");return iu(e,{pageUrl:process.env.SHOTSTACK_CAPTURE_URL?.trim()||Om,timeoutMs:Em,profileDir:uu(zm(),".shotstack","chrome")})}function Tm(e){let t=e.split(",").map((n)=>n.trim()),r=t.map(Number);if(t.some((n)=>n==="")||r.some((n)=>!Number.isFinite(n)))throw new ee("--at takes seconds separated by commas, e.g. 0.5,8.05");return r}function Nm(e){let{steady:t,origin:r,bar:n,bars:o,downbeats:s}=e;if(t&&r!==void 0&&n!==void 0&&o?.count)return Array.from({length:o.count},(i,u)=>Math.round((r+u*n)*1000)/1000);if(s?.length)return s;throw new ee("The map has no bar grid or downbeats.")}function Im(e,t,r){let s=(t.timeline?.tracks??[]).flatMap((m)=>m.clips??[]).filter((m)=>r?m.asset?.src===r:m.asset?.type==="audio"),i=new Map(s.map((m)=>[`${String(m.start)}|${m.asset?.trim??0}`,m]));if(i.size===0)return e;if(i.size>1)throw new ee("The edit has audio at different offsets, so --bars can't tell which clip the map measures. Run `shotstack analyze` again so the map names its track, or give the bar times with --at.");let{start:u,asset:p}=[...i.values()][0];if(typeof u!=="number")throw new ee(`The music clip's start is ${JSON.stringify(u)}, so --bars can't place the bar lines. Give it a start in seconds, or give the bar times with --at.`);let l=p?.trim??0;return e.filter((m)=>m>=l).map((m)=>Math.round((m-l+u)*1000)/1000)}function jm(e,t){if(!e&&!t)throw new ee("Give --at, --bars, or both.");return[...new Set([...e??[],...t??[]])].sort((r,n)=>r-n)}function Fm(e,t){if(t===1)return[e];let{dir:r,name:n,ext:o}=Zm(e);return Array.from({length:t},(s,i)=>uu(r,`${n}-${i+1}${o}`))}async function Dm(e,{out:t,format:r,capture:n}){if(e.grid&&e.times.length!==1)return console.error("--grid takes one --at time."),{exitCode:1};if("edit"in e){let{ok:p,issues:l}=ge(e.edit),m=l.filter((x)=>(x.level??"error")==="error"||x.code==="src_not_public");if(!p||m.length>0){if(r==="json")console.log(JSON.stringify({ok:!1,issues:m}));else console.error(ce(m));return{exitCode:1}}}let{sheets:o,skipped:s}=await n(e),i=Fm(t,o.length);for(let[p,l]of o.entries())await Am(km(i[p]),{recursive:!0}),await Sm(i[p],Buffer.from(l.image.slice(l.image.indexOf(",")+1),"base64"));let u=o.map((p,l)=>({path:i[l],times:p.times}));if(r==="json")console.log(JSON.stringify({sheets:u,skipped:s}));else{for(let p of s)console.error(`skipped ${p.toFixed(2)}s: past the edit's end`);for(let{path:p,times:l}of u)console.log(`${p} ${l.map((m)=>`${m.toFixed(2)}s`).join(" ")}`)}return{exitCode:o.length>0?0:1,response:{sheets:u,skipped:s}}}import{createInterface as Lm}from"node:readline";import{Writable as Mm}from"node:stream";var pu=new j("login").description("Save your Shotstack API key so you don't have to set SHOTSTACK_API_KEY every session").option("--env <name>",`Environment the key belongs to: ${R.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{let t=P(e.output),r=_e(e.env),n=await vm();if(!n)console.error("No API key provided."),process.exit(1);await nn(r,n);let o=Oe();O(t,{env:r,stored:!0,path:o},`Saved API key for ${r} → ${o} (chmod 600).`)}),lu=new j("logout").description("Remove a saved Shotstack API key").option("--env <name>",`Environment to forget: ${R.join(" | ")}`).option("--all","Remove saved keys for every environment").option("--output <format>","Output format: text | json","text").action(async(e)=>{let t=P(e.output);if(e.all){await sn(),O(t,{cleared:!0},"Removed all saved API keys.");return}let r=_e(e.env),n=await on(r);O(t,{env:r,removed:n},n?`Removed saved API key for ${r}.`:`No saved API key for ${r}.`)});async function vm(){if(!process.stdin.isTTY){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf8").trim()}return Um("Shotstack API key: ")}function Um(e){return new Promise((t)=>{let r=!1,n=new Mm({write(s,i,u){if(!r)process.stdout.write(s);u()}}),o=Lm({input:process.stdin,output:n,terminal:!0});o.question(e,(s)=>{o.close(),process.stdout.write(`
|
|
100
|
+
`),t(s.trim())}),r=!0})}var Vm=new j().name("shotstack").description("Command-line interface for the Shotstack video rendering API").version(De).addCommand(Oa).addCommand(fn).addCommand(La).addCommand(Ae).addCommand(Se).addCommand(Ha).addCommand(Ga).addCommand(Ya).addCommand(tu).addCommand(cu).addCommand(pu).addCommand(lu).addCommand(Ia);try{await Vm.parseAsync(process.argv)}catch(e){process.exit(Jm(e))}function Jm(e){if(e instanceof pe||e instanceof Ee||e instanceof zt||e instanceof Xe||e instanceof Ye||e instanceof Qe||e instanceof ee)return console.error(e.message),1;if(e instanceof te){if(console.error(e.message),e.body)console.error(typeof e.body==="string"?e.body:JSON.stringify(e.body));return e.isTransient?2:1}if(e instanceof Error){if("code"in e&&e.code==="ENOENT")return console.error(e.message),1;return console.error(e.message),2}return console.error(String(e)),2}
|