@shotstack/cli 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/shotstack.js CHANGED
@@ -1,96 +1,96 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as Ka}from"node:module";var Ga=Object.defineProperty;var $e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Wa=(e,t,r)=>{for(var n in t)Ga(e,n,{get:t[n],set:r[n],enumerable:!0,configurable:!0})},Ne=Ka(import.meta.url);var Ce=$e(function(Ya){class yt 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 Ar extends yt{constructor(e){super(1,"commander.invalidArgument",e);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}Ya.CommanderError=yt;Ya.InvalidArgumentError=Ar});var ve=$e(function(ru){var{InvalidArgumentError:eu}=Ce();class wr{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 eu(`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 tu(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}ru.Argument=wr;ru.humanReadableArgName=tu});var bt=$e(function(iu){var{humanReadableArgName:su}=ve();class zr{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)=>su(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(x,z){if(z){let U=`${x.padEnd(r+2)}${z}`;return t.wrap(U,n-2,r+2)}return x}function c(x){return x.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 _=t.visibleArguments(e).map((x)=>i(t.argumentTerm(x),t.argumentDescription(x)));if(_.length>0)p=p.concat(["Arguments:",c(_),""]);let y=t.visibleOptions(e).map((x)=>i(t.optionTerm(x),t.optionDescription(x)));if(y.length>0)p=p.concat(["Options:",c(y),""]);if(this.showGlobalOptions){let x=t.visibleGlobalOptions(e).map((z)=>i(t.optionTerm(z),t.optionDescription(z)));if(x.length>0)p=p.concat(["Global Options:",c(x),""])}let A=t.visibleCommands(e).map((x)=>i(t.subcommandTerm(x),t.subcommandDescription(x)));if(A.length>0)p=p.concat(["Commands:",c(A),""]);return p.join(`
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 c=e.slice(0,r),p=e.slice(r).replace(`\r
2
+ import{createRequire as Wa}from"node:module";var Ha=Object.defineProperty;var $e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ga=(e,t,r)=>{for(var n in t)Ha(e,n,{get:t[n],set:r[n],enumerable:!0,configurable:!0})},Te=Wa(import.meta.url);var Ie=$e(function(Ka){class At 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 Ar extends At{constructor(e){super(1,"commander.invalidArgument",e);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}Ka.CommanderError=At;Ka.InvalidArgumentError=Ar});var Ge=$e(function(tu){var{InvalidArgumentError:Xa}=Ie();class wr{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 Xa(`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 eu(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}tu.Argument=wr;tu.humanReadableArgName=eu});var wt=$e(function(su){var{humanReadableArgName:ou}=Ge();class zr{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)=>ou(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(x,z){if(z){let M=`${x.padEnd(r+2)}${z}`;return t.wrap(M,n-2,r+2)}return x}function u(x){return x.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 _=t.visibleArguments(e).map((x)=>i(t.argumentTerm(x),t.argumentDescription(x)));if(_.length>0)p=p.concat(["Arguments:",u(_),""]);let y=t.visibleOptions(e).map((x)=>i(t.optionTerm(x),t.optionDescription(x)));if(y.length>0)p=p.concat(["Options:",u(y),""]);if(this.showGlobalOptions){let x=t.visibleGlobalOptions(e).map((z)=>i(t.optionTerm(z),t.optionDescription(z)));if(x.length>0)p=p.concat(["Global Options:",u(x),""])}let A=t.visibleCommands(e).map((x)=>i(t.subcommandTerm(x),t.subcommandDescription(x)));if(A.length>0)p=p.concat(["Commands:",u(A),""]);return p.join(`
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
6
  `),l=" ".repeat(r),y=`\\s${"​"}`,A=new RegExp(`
7
- |.{1,${i-1}}([${y}]|$)|[^${y}]+?([${y}]|$)`,"g"),x=p.match(A)||[];return c+x.map((z,U)=>{if(z===`
8
- `)return"";return(U>0?l:"")+z.trimEnd()}).join(`
9
- `)}}iu.Help=zr});var $t=$e(function(lu){var{InvalidArgumentError:uu}=Ce();class Sr{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=pu(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 uu(`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 cu(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class kr{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 cu(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function pu(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}}lu.Option=Sr;lu.DualOptions=kr});var Zr=$e(function(gu){function mu(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 hu(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 c=mu(e,i),p=Math.max(e.length,i.length);if((p-c)/p>s){if(c<o)o=c,n=[i];else if(c===o)n.push(i)}}),n.sort((i,c)=>i.localeCompare(c)),r)n=n.map((i)=>`--${i}`);if(n.length>1)return`
7
+ |.{1,${i-1}}([${y}]|$)|[^${y}]+?([${y}]|$)`,"g"),x=p.match(A)||[];return u+x.map((z,M)=>{if(z===`
8
+ `)return"";return(M>0?l:"")+z.trimEnd()}).join(`
9
+ `)}}su.Help=zr});var zt=$e(function(pu){var{InvalidArgumentError:au}=Ie();class Sr{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=cu(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 au(`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 uu(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class kr{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 uu(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function cu(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=Sr;pu.DualOptions=kr});var Zr=$e(function(hu){function du(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 mu(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=du(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""}gu.suggestSimilar=hu});var Rr=$e(function(wu){var xu=Ne("node:events").EventEmitter,At=Ne("node:child_process"),se=Ne("node:path"),zt=Ne("node:fs"),V=Ne("node:process"),{Argument:yu,humanReadableArgName:bu}=ve(),{CommanderError:wt}=Ce(),{Help:$u}=bt(),{Option:Or,DualOptions:Au}=$t(),{suggestSimilar:Er}=Zr();class St extends xu{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)=>V.stdout.write(t),writeErr:(t)=>V.stderr.write(t),getOutHelpWidth:()=>V.stdout.isTTY?V.stdout.columns:void 0,getErrHelpWidth:()=>V.stderr.isTTY?V.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(/([^ ]+) *(.*)/),c=this.createCommand(s);if(n)c.description(n),c._executableHandler=!0;if(o.isDefault)this._defaultCommandName=c._name;if(c._hidden=!!(o.noHelp||o.hidden),c._executableFile=o.executableFile||null,i)c.arguments(i);if(this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),n)return this;return c}createCommand(e){return new St(e)}createHelp(){return Object.assign(new $u,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 yu(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 wt(e,t,r));V.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 Or(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 c=this.getOptionValue(r);if(o!==null&&e.parseArg)o=this._callParseArg(e,o,c,s);else if(o!==null&&e.variadic)o=e._concatValue(o,c);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 Or)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=(c,p)=>{let l=i.exec(c);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(V.versions?.electron)t.from="electron";let n=V.execArgv??[];if(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))t.from="eval"}if(e===void 0)e=V.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(V.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,_){let y=se.resolve(l,_);if(zt.existsSync(y))return y;if(n.includes(se.extname(_)))return;let A=n.find((x)=>zt.existsSync(`${y}${x}`));if(A)return`${y}${A}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,i=this._executableDir||"";if(this._scriptPath){let l;try{l=zt.realpathSync(this._scriptPath)}catch(_){l=this._scriptPath}i=se.resolve(se.dirname(l),i)}if(i){let l=o(i,s);if(!l&&!e._executableFile&&this._scriptPath){let _=se.basename(this._scriptPath,se.extname(this._scriptPath));if(_!==this._name)l=o(i,`${_}-${e._name}`)}s=l||s}r=n.includes(se.extname(s));let c;if(V.platform!=="win32")if(r)t.unshift(s),t=Pr(V.execArgv).concat(t),c=At.spawn(V.argv[0],t,{stdio:"inherit"});else c=At.spawn(s,t,{stdio:"inherit"});else t.unshift(s),t=Pr(V.execArgv).concat(t),c=At.spawn(V.execPath,t,{stdio:"inherit"});if(!c.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((_)=>{V.on(_,()=>{if(c.killed===!1&&c.exitCode===null)c.kill(_)})});let p=this._exitCallback;c.on("close",(l)=>{if(l=l??1,!p)V.exit(l);else p(new wt(l,"commander.executeSubCommandAsync","(close)"))}),c.on("error",(l)=>{if(l.code==="ENOENT"){let _=i?`searched for local subcommand relative to directory '${i}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",y=`'${s}' does not exist
11
+ (Did you mean ${n[0]}?)`;return""}hu.suggestSimilar=mu});var Rr=$e(function(Au){var _u=Te("node:events").EventEmitter,Ae=Te("node:child_process"),W=Te("node:path"),we=Te("node:fs"),k=Te("node:process"),{Argument:xu,humanReadableArgName:yu}=Ge(),{CommanderError:St}=Ie(),{Help:bu}=wt(),{Option:Or,DualOptions:$u}=zt(),{suggestSimilar:Er}=Zr();class kt extends _u{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 kt(e)}createHelp(){return Object.assign(new bu,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 xu(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 St(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 Or(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 Or)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,_){let y=W.resolve(l,_);if(we.existsSync(y))return y;if(n.includes(W.extname(_)))return;let A=n.find((x)=>we.existsSync(`${y}${x}`));if(A)return`${y}${A}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,i=this._executableDir||"";if(this._scriptPath){let l;try{l=we.realpathSync(this._scriptPath)}catch(_){l=this._scriptPath}i=W.resolve(W.dirname(l),i)}if(i){let l=o(i,s);if(!l&&!e._executableFile&&this._scriptPath){let _=W.basename(this._scriptPath,W.extname(this._scriptPath));if(_!==this._name)l=o(i,`${_}-${e._name}`)}s=l||s}r=n.includes(W.extname(s));let u;if(k.platform!=="win32")if(r)t.unshift(s),t=Pr(k.execArgv).concat(t),u=Ae.spawn(k.argv[0],t,{stdio:"inherit"});else u=Ae.spawn(s,t,{stdio:"inherit"});else t.unshift(s),t=Pr(k.execArgv).concat(t),u=Ae.spawn(k.execPath,t,{stdio:"inherit"});if(!u.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((_)=>{k.on(_,()=>{if(u.killed===!1&&u.exitCode===null)u.kill(_)})});let p=this._exitCallback;u.on("close",(l)=>{if(l=l??1,!p)k.exit(l);else p(new St(l,"commander.executeSubCommandAsync","(close)"))}),u.on("error",(l)=>{if(l.code==="ENOENT"){let _=i?`searched for local subcommand relative to directory '${i}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",y=`'${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
- - ${_}`;throw Error(y)}else if(l.code==="EACCES")throw Error(`'${s}' not executable`);if(!p)V.exit(1);else{let _=new wt(1,"commander.executeSubCommandAsync","(error)");_.nestedError=l,p(_)}}),this.runningCommand=c}_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(c){return c.length>1&&c[0]==="-"}let i=null;while(o.length){let c=o.shift();if(c==="--"){if(n===r)n.push(c);n.push(...o);break}if(i&&!s(c)){this.emit(`option:${i.name()}`,c);continue}if(i=null,s(c)){let p=this._findOption(c);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(c.length>2&&c[0]==="-"&&c[1]!=="-"){let p=this._findOption(`-${c[1]}`);if(p){if(p.required||p.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${p.name()}`,c.slice(2));else this.emit(`option:${p.name()}`),o.unshift(`-${c.slice(2)}`);continue}}if(/^--[^=]+=/.test(c)){let p=c.indexOf("="),l=this._findOption(c.slice(0,p));if(l&&(l.required||l.optional)){this.emit(`option:${l.name()}`,c.slice(p+1));continue}}if(s(c))n=r;if((this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(c)){if(t.push(c),o.length>0)r.push(...o);break}else if(this._getHelpCommand()&&c===this._getHelpCommand().name()){if(t.push(c),o.length>0)t.push(...o);break}else if(this._defaultCommandName){if(r.push(c),o.length>0)r.push(...o);break}}if(this._passThroughOptions){if(n.push(c),o.length>0)n.push(...o);break}n.push(c)}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}
17
+ - ${_}`;throw Error(y)}else if(l.code==="EACCES")throw Error(`'${s}' not executable`);if(!p)k.exit(1);else{let _=new St(1,"commander.executeSubCommandAsync","(error)");_.nestedError=l,p(_)}}),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 V.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()}`,V.env[e.envVar]);else this.emit(`optionEnv:${e.name()}`)}})}_parseOptionsImplied(){let e=new Au(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(),c=this.getOptionValue(i),p=this.options.find((_)=>_.negate&&i===_.attributeName()),l=this.options.find((_)=>!_.negate&&i===_.attributeName());if(p&&(p.presetArg===void 0&&c===!1||p.presetArg!==void 0&&c===p.presetArg))return p;return l||s},n=(s)=>{let i=r(s),c=i.attributeName();if(this.getOptionValueSource(c)==="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=Er(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=Er(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)=>bu(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=se.basename(e,se.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=V.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.
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 $u(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((_)=>_.negate&&i===_.attributeName()),l=this.options.find((_)=>!_.negate&&i===_.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=Er(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=Er(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)=>yu(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=W.basename(e,W.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 Pr(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})}wu.Command=St});var Zt={};Wa(Zt,{program:()=>Ir,createCommand:()=>jr,createOption:()=>Fr,createArgument:()=>Dr,Command:()=>Lr,Option:()=>Ur,Argument:()=>Mr,Help:()=>Vr,CommanderError:()=>Jr,InvalidArgumentError:()=>qr,InvalidOptionArgumentError:()=>Br},{program:(qd)=>Ir=qd,createCommand:(qd)=>jr=qd,createOption:(qd)=>Fr=qd,createArgument:(qd)=>Dr=qd,Command:(qd)=>Lr=qd,Option:(qd)=>Ur=qd,Argument:(qd)=>Mr=qd,Help:(qd)=>Vr=qd,CommanderError:(qd)=>Jr=qd,InvalidArgumentError:(qd)=>qr=qd,InvalidOptionArgumentError:(qd)=>Br=qd});var{Argument:Nr}=ve(),{Command:kt}=Rr(),{CommanderError:Su,InvalidArgumentError:Cr}=Ce(),{Help:ku}=bt(),{Option:Tr}=$t();var Ir=new kt,jr=(e)=>new kt(e),Fr=(e,t)=>new Tr(e,t),Dr=(e,t)=>new Nr(e,t),Lr=kt,Ur=Tr,Mr=Nr,Vr=ku,Jr=Su,qr=Cr,Br=Cr;var{program:vd,createCommand:Hd,createArgument:Gd,createOption:Wd,CommanderError:Kd,InvalidArgumentError:He,InvalidOptionArgumentError:Yd,Command:L,Argument:Xd,Option:Qd,Help:em}=Zt;import{readFile as Sf}from"node:fs/promises";import{resolve as kf}from"node:path";var vr={name:"@shotstack/cli",version:"0.9.0",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.20.1",commander:"^12.1.0",zod:"^4.4.3"},devDependencies:{"@types/bun":"latest",typescript:"^5.6.0"}};var Te=vr.version,Hr=`shotstack-cli/${Te} (${process.platform}-${process.arch})`;class ie 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 q(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":Hr,...s!==void 0?{"content-type":"application/json"}:{}},body:s!==void 0?JSON.stringify(s):void 0}),c=await i.text(),p=c?Ou(c):void 0;if(!i.ok)throw new ie(i.status,p??c,`${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 Ou(e){try{return JSON.parse(e)}catch{return e}}import{mkdir as Eu,writeFile as Pu,chmod as Ru}from"node:fs/promises";import{readFileSync as Nu}from"node:fs";import{join as Ot,dirname as Cu}from"node:path";import{homedir as Gr}from"node:os";function Ae(){if(process.platform==="win32"){let e=process.env.APPDATA??Ot(Gr(),"AppData","Roaming");return Ot(e,"shotstack","credentials.json")}return Ot(Gr(),".shotstack","credentials.json")}function Et(e){try{let t=JSON.parse(Nu(e,"utf8"));if(t&&typeof t==="object"&&!Array.isArray(t))return t}catch{}return{}}function Wr(e,t=Ae()){return Et(t)[e]?.trim()||void 0}async function Kr(e,t,r=Ae()){let n=Et(r);n[e]=t.trim(),await Pt(r,n)}async function Yr(e,t=Ae()){let r=Et(t);if(!(e in r))return!1;return delete r[e],await Pt(t,r),!0}async function Xr(e=Ae()){await Pt(e,{})}async function Pt(e,t){await Eu(Cu(e),{recursive:!0,mode:448}),await Pu(e,JSON.stringify(t,null,2)+`
24
- `,{mode:384}),await Ru(e,384).catch(()=>{})}class we 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 B(e,t){let r=process.env.SHOTSTACK_API_KEY?.trim();if(r)return r;let n=Wr(e,t);if(n)return n;throw new we(e)}var I=["dev","stage","v1"];class ze extends Error{constructor(e){super(`Invalid environment "${e}". Use one of: ${I.join(", ")}.`);this.name="InvalidEnvError"}}function Ge(e){let t=e??process.env.SHOTSTACK_ENV?.trim()??"v1";if(!Iu(t))throw new ze(t);return t}function v(e,t="edit"){let r=Tu(t);if(r)return{name:"custom",baseUrl:r};let n=Ge(e);return{name:n,baseUrl:`https://api.shotstack.io/${t}/${n}`}}function Tu(e){return(e==="ingest"?process.env.SHOTSTACK_INGEST_BASE_URL:process.env.SHOTSTACK_API_BASE_URL)?.trim()||void 0}function Iu(e){return I.includes(e)}function R(e){if(e==="json")return"json";return"text"}function N(e,t,r){if(e==="json")console.log(JSON.stringify(t));else console.log(r)}import{mkdir as ju,appendFile as Fu,stat as rn,readFile as Du,writeFile as nn}from"node:fs/promises";import{join as Rt,dirname as Lu}from"node:path";import{homedir as Qr}from"node:os";var Uu=1e6,Mu=500000,en=2000;function We(){if(process.platform==="win32"){let e=process.env.APPDATA??Rt(Qr(),"AppData","Roaming");return Rt(e,"shotstack","log.jsonl")}return Rt(Qr(),".shotstack","log.jsonl")}function Vu(e,t=new Date){let r={ts:t.toISOString(),cmd:e.cmd,args:e.args.map(Wu),exit:e.exit,durationMs:e.durationMs};if(e.renderId)r.renderId=e.renderId;if(e.response!==void 0)r.response=Yu(Nt(e.response));if(e.error)r.error=Ju(e.error);return r}function Ju(e){return{name:e.name,message:typeof e.message==="string"?Ct(e.message):String(e.message)}}function qu(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 tn(e,t=We()){let r=Vu(e),n=JSON.stringify(r)+`
25
- `;if(await ju(Lu(t),{recursive:!0,mode:448}),!await Bu(t))await nn(t,"",{mode:384});await Fu(t,n),await vu(t)}async function Bu(e){try{return await rn(e),!0}catch{return!1}}async function vu(e){let t=await rn(e).catch(()=>null);if(!t||t.size<=Uu)return;let r=await Du(e),n=r.subarray(Math.max(0,r.length-Mu)),o=n.indexOf(10),s=o>=0?n.subarray(o+1):n;await nn(e,s,{mode:384})}var Hu=/^https?:\/\//i,Gu=/(https?:\/\/[^\s'"<>?]+)\?[^\s'"<>]*?(?:Signature|X-Amz-[A-Za-z0-9-]+|x-amz-security-token)=[^\s'"<>]*/gi;function Ct(e){return e.replace(Gu,"$1?[redacted-signed]")}function Wu(e){if(typeof e!=="string")return e;if(e.startsWith("-"))return e;if(Hu.test(e))return Ct(e);if(/[\/\\]/.test(e))return Ku(e);return e}function Ku(e){let t=e.split(/[\/\\]/);return t[t.length-1]||e}function Nt(e){if(typeof e==="string")return Ct(e);if(Array.isArray(e))return e.map(Nt);if(e&&typeof e==="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=Nt(n);return t}return e}function Yu(e){let t=JSON.stringify(e);if(t===void 0||t.length<=en)return e;return t.slice(0,en)+"...[truncated]"}async function H(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=Xu(o),i=o instanceof ie?o.body:void 0;throw await tn({cmd:e,args:t,exit:s,durationMs:Date.now()-n,response:i,error:qu(o)}).catch(()=>{}),o}}function Xu(e){if(e instanceof ie)return e.isTransient?2:1;if(e instanceof we||e instanceof ze)return 1;if(e instanceof Error&&e.code==="ENOENT")return 1;return 2}function G(e){let t=process.argv.slice(2),r=t.indexOf(e);return r>=0?t.slice(r+1):t}var Qu=new Set(["done","failed"]),ec=3000,on=new L("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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await H("status",G("status"),async()=>{let r=R(t.output),n=v(t.env),o=B(n.name),s=q({apiKey:o,env:n}),i=await Tt(s,e,r,t.watch===!0),c=i.status==="failed"?1:0;return{renderId:i.id,response:i,exitCode:c}})});async function Tt(e,t,r,n){while(!0){let s=(await e.get(`/render/${encodeURIComponent(t)}`)).response;if(N(r,s,tc(s)),!n||Qu.has(s.status))return s;await rc(ec)}}function tc(e){let t=[e.status];if(e.url)t.push(e.url);if(e.error)t.push(`error: ${e.error}`);return t.join(" ")}function rc(e){return new Promise((t)=>setTimeout(t,e))}var sn;function m(e,t,r){function n(c,p){if(!c._zod)Object.defineProperty(c,"_zod",{value:{def:p,constr:i,traits:new Set},enumerable:!1});if(c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,p);let l=i.prototype,_=Object.keys(l);for(let y=0;y<_.length;y++){let A=_[y];if(!(A in c))c[A]=l[A].bind(c)}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(c){var p;let l=r?.Parent?new s:this;n(l,c),(p=l._zod).deferred??(p.deferred=[]);for(let _ of l._zod.deferred)_();return l}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:(c)=>{if(r?.Parent&&c instanceof r.Parent)return!0;return c?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var Pm=Symbol("zod_brand");class ae extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ie extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(sn=globalThis).__zod_globalConfig??(sn.__zod_globalConfig={});var Se=globalThis.__zod_globalConfig;function Q(e){if(e)Object.assign(Se,e);return Se}function Ye(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 je(e,t){if(typeof t==="bigint")return t.toString();return t}function Fe(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function Xe(e){return e===null||e===void 0}function Qe(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 O(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 de(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ue(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function jt(e){return JSON.stringify(e)}function cn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ft="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ke(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var pn=Fe(()=>{if(Se.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function me(e){if(ke(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(ke(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Dt(e){if(me(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 ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ne(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 nc(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=ue(e._zod.def,{get shape(){let i={};for(let c in t){if(!(c in r.shape))throw Error(`Unrecognized key: "${c}"`);if(!t[c])continue;i[c]=r.shape[c]}return de(this,"shape",i),i},checks:[]});return ne(e,s)}function oc(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=ue(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let c in t){if(!(c in r.shape))throw Error(`Unrecognized key: "${c}"`);if(!t[c])continue;delete i[c]}return de(this,"shape",i),i},checks:[]});return ne(e,s)}function sc(e,t){if(!me(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=ue(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return de(this,"shape",s),s}});return ne(e,o)}function ic(e,t){if(!me(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ue(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return de(this,"shape",n),n}});return ne(e,r)}function ac(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ue(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return de(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ne(e,r)}function uc(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=ue(t._zod.def,{get shape(){let c=t._zod.def.shape,p={...c};if(r)for(let l in r){if(!(l in c))throw Error(`Unrecognized key: "${l}"`);if(!r[l])continue;p[l]=e?new e({type:"optional",innerType:c[l]}):c[l]}else for(let l in c)p[l]=e?new e({type:"optional",innerType:c[l]}):c[l];return de(this,"shape",p),p},checks:[]});return ne(t,i)}function cc(e,t,r){let n=ue(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 de(this,"shape",s),s}});return ne(t,n)}function he(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 pe(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ke(e){return typeof e==="string"?e:e?.message}function ee(e,t,r){let n=e.message?e.message:Ke(e.inst?._zod.def?.error?.(e))??Ke(t?.error?.(e))??Ke(r.customError?.(e))??Ke(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...c}=e;if(c.path??(c.path=[]),c.message=n,t?.reportInput)c.input=i;return c}function et(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ge(...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,je,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},tt=m("$ZodError",hn),Lt=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((c)=>n({issues:c},[...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 c=[...s,...i.path];if(c.length===0)r._errors.push(t(i));else{let p=r,l=0;while(l<c.length){let _=c[l];if(l!==c.length-1)p[_]=p[_]||{_errors:[]};else p[_]=p[_]||{_errors:[]},p[_]._errors.push(t(i));p=p[_],l++}}}};return n(e),r}var rt=(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 c=new(o?.Err??e)(i.issues.map((p)=>ee(p,s,Q())));throw Ft(c,o?.callee),c}return i.value};var nt=(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 c=new(o?.Err??e)(i.issues.map((p)=>ee(p,s,Q())));throw Ft(c,o?.callee),c}return i.value};var De=(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??tt)(s.issues.map((i)=>ee(i,o,Q())))}:{success:!0,data:s.value}},xn=De(Lt),Le=(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)=>ee(i,o,Q())))}:{success:!0,data:s.value}},yn=Le(Lt),bn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return rt(e)(t,r,o)};var $n=(e)=>(t,r,n)=>rt(e)(t,r,n);var An=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return nt(e)(t,r,o)};var wn=(e)=>async(t,r,n)=>nt(e)(t,r,n);var zn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return De(e)(t,r,o)};var Sn=(e)=>(t,r,n)=>De(e)(t,r,n);var kn=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Le(e)(t,r,o)};var Zn=(e)=>async(t,r,n)=>Le(e)(t,r,n);var On=/^[cC][0-9a-z]{6,}$/,En=/^[0-9a-z]+$/,Pn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Rn=/^[0-9a-vA-V]{20}$/,Nn=/^[A-Za-z0-9]{27}$/,Cn=/^[a-zA-Z0-9_-]{21}$/,Tn=/^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})$/,Ut=(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 lc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Fn(){return new RegExp(lc,"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}=))?$/,Mt=/^[A-Za-z0-9_-]*$/;var Jn=/^https?$/,qn=/^\+[1-9]\d{6,14}$/,Bn="(?:(?:\\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])))",vn=new RegExp(`^${Bn}$`);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 Wn(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(`^${Bn}T(?:${n})$`)}var Kn=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Yn=/^-?\d+$/,Vt=/^-?\d+(?:\.\d+)?$/,Xn=/^(?:true|false)$/i,Qn=/^null$/i;var eo=/^[^A-Z]*$/,to=/^[^a-z]*$/;var K=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"},Jt=m("$ZodCheckLessThan",(e,t)=>{K.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})}}),qt=m("$ZodCheckGreaterThan",(e,t)=>{K.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)=>{K.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)=>{K.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 c=i._zod.bag;if(c.format=t.format,c.minimum=o,c.maximum=s,r)c.pattern=Yn}),e._zod.check=(i)=>{let c=i.value;if(r){if(!Number.isInteger(c)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)i.issues.push({input:c,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:c,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(c<o)i.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(c>s)i.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var so=m("$ZodCheckMaxLength",(e,t)=>{var r;K.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!Xe(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=et(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;K.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!Xe(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=et(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;K.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!Xe(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=et(o),c=s>t.length;n.issues.push({origin:i,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ue=m("$ZodCheckStringFormat",(e,t)=>{var r,n;if(K.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)=>{Ue.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),Ue.init(e,t)}),po=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=to),Ue.init(e,t)}),lo=m("$ZodCheckIncludes",(e,t)=>{K.init(e,t);let r=ce(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)=>{K.init(e,t);let r=new RegExp(`^${ce(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)=>{K.init(e,t);let r=new RegExp(`.*${ce(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)=>{K.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 Pr(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})}Au.Command=kt});var Ot={};Ga(Ot,{program:()=>Ir,createCommand:()=>jr,createOption:()=>Fr,createArgument:()=>Dr,Command:()=>Lr,Option:()=>Ur,Argument:()=>Mr,Help:()=>Vr,CommanderError:()=>vr,InvalidArgumentError:()=>qr,InvalidOptionArgumentError:()=>Jr},{program:(Kd)=>Ir=Kd,createCommand:(Kd)=>jr=Kd,createOption:(Kd)=>Fr=Kd,createArgument:(Kd)=>Dr=Kd,Command:(Kd)=>Lr=Kd,Option:(Kd)=>Ur=Kd,Argument:(Kd)=>Mr=Kd,Help:(Kd)=>Vr=Kd,CommanderError:(Kd)=>vr=Kd,InvalidArgumentError:(Kd)=>qr=Kd,InvalidOptionArgumentError:(Kd)=>Jr=Kd});var{Argument:Cr}=Ge(),{Command:Zt}=Rr(),{CommanderError:zu,InvalidArgumentError:Nr}=Ie(),{Help:Su}=wt(),{Option:Tr}=zt();var Ir=new Zt,jr=(e)=>new Zt(e),Fr=(e,t)=>new Tr(e,t),Dr=(e,t)=>new Cr(e,t),Lr=Zt,Ur=Tr,Mr=Cr,Vr=Su,vr=zu,qr=Nr,Jr=Nr;var{program:Qd,createCommand:Xd,createArgument:em,createOption:tm,CommanderError:rm,InvalidArgumentError:We,InvalidOptionArgumentError:nm,Command:F,Argument:om,Option:sm,Help:im}=Ot;import{readFile as Zf}from"node:fs/promises";import{resolve as Of}from"node:path";var Br={name:"@shotstack/cli",version:"0.11.0",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 je=Br.version,Hr=`shotstack-cli/${je} (${process.platform}-${process.arch})`;class ie 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 v(e){let t=e.env.baseUrl.replace(/\/$/,"");async function r(n,o,s){let i=await fetch(`${t}${o}`,{method:n,headers:{...e.apiKey!==void 0?{"x-api-key":e.apiKey}:{},"x-shotstack-origin":"cli","x-shotstack-environment":e.env.name,"user-agent":Hr,...s!==void 0?{"content-type":"application/json"}:{}},body:s!==void 0?JSON.stringify(s):void 0}),u=await i.text(),p=u?Zu(u):void 0;if(!i.ok)throw new ie(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 Zu(e){try{return JSON.parse(e)}catch{return e}}import{mkdir as Ou,writeFile as Eu,chmod as Pu}from"node:fs/promises";import{readFileSync as Ru}from"node:fs";import{join as Et,dirname as Cu}from"node:path";import{homedir as Gr}from"node:os";function ze(){if(process.platform==="win32"){let e=process.env.APPDATA??Et(Gr(),"AppData","Roaming");return Et(e,"shotstack","credentials.json")}return Et(Gr(),".shotstack","credentials.json")}function Pt(e){try{let t=JSON.parse(Ru(e,"utf8"));if(t&&typeof t==="object"&&!Array.isArray(t))return t}catch{}return{}}function Wr(e,t=ze()){return Pt(t)[e]?.trim()||void 0}async function Kr(e,t,r=ze()){let n=Pt(r);n[e]=t.trim(),await Rt(r,n)}async function Yr(e,t=ze()){let r=Pt(t);if(!(e in r))return!1;return delete r[e],await Rt(t,r),!0}async function Qr(e=ze()){await Rt(e,{})}async function Rt(e,t){await Ou(Cu(e),{recursive:!0,mode:448}),await Eu(e,JSON.stringify(t,null,2)+`
24
+ `,{mode:384}),await Pu(e,384).catch(()=>{})}class Se 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 G(e,t){let r=process.env.SHOTSTACK_API_KEY?.trim();if(r)return r;let n=Wr(e,t);if(n)return n;throw new Se(e)}var I=["dev","stage","v1"];class ke extends Error{constructor(e){super(`Invalid environment "${e}". Use one of: ${I.join(", ")}.`);this.name="InvalidEnvError"}}function Ke(e){let t=e??process.env.SHOTSTACK_ENV?.trim()??"v1";if(!Tu(t))throw new ke(t);return t}function q(e,t="edit"){let r=Nu(t);if(r)return{name:"custom",baseUrl:r};let n=Ke(e);return{name:n,baseUrl:`https://api.shotstack.io/${t}/${n}`}}function Nu(e){return(e==="ingest"?process.env.SHOTSTACK_INGEST_BASE_URL:process.env.SHOTSTACK_API_BASE_URL)?.trim()||void 0}function Tu(e){return I.includes(e)}function R(e){if(e==="json")return"json";return"text"}function E(e,t,r){if(e==="json")console.log(JSON.stringify(t));else console.log(r)}import{mkdir as Iu,appendFile as ju,stat as rn,readFile as Fu,writeFile as nn}from"node:fs/promises";import{join as Ct,dirname as Du}from"node:path";import{homedir as Xr}from"node:os";var Lu=1e6,Uu=500000,en=2000;function Ye(){if(process.platform==="win32"){let e=process.env.APPDATA??Ct(Xr(),"AppData","Roaming");return Ct(e,"shotstack","log.jsonl")}return Ct(Xr(),".shotstack","log.jsonl")}function Mu(e,t=new Date){let r={ts:t.toISOString(),cmd:e.cmd,args:e.args.map(Gu),exit:e.exit,durationMs:e.durationMs};if(e.renderId)r.renderId=e.renderId;if(e.response!==void 0)r.response=Ku(Nt(e.response));if(e.error)r.error=Vu(e.error);return r}function Vu(e){return{name:e.name,message:typeof e.message==="string"?Tt(e.message):String(e.message)}}function vu(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 tn(e,t=Ye()){let r=Mu(e),n=JSON.stringify(r)+`
25
+ `;if(await Iu(Du(t),{recursive:!0,mode:448}),!await qu(t))await nn(t,"",{mode:384});await ju(t,n),await Ju(t)}async function qu(e){try{return await rn(e),!0}catch{return!1}}async function Ju(e){let t=await rn(e).catch(()=>null);if(!t||t.size<=Lu)return;let r=await Fu(e),n=r.subarray(Math.max(0,r.length-Uu)),o=n.indexOf(10),s=o>=0?n.subarray(o+1):n;await nn(e,s,{mode:384})}var Bu=/^https?:\/\//i,Hu=/(https?:\/\/[^\s'"<>?]+)\?[^\s'"<>]*?(?:Signature|X-Amz-[A-Za-z0-9-]+|x-amz-security-token)=[^\s'"<>]*/gi;function Tt(e){return e.replace(Hu,"$1?[redacted-signed]")}function Gu(e){if(typeof e!=="string")return e;if(e.startsWith("-"))return e;if(Bu.test(e))return Tt(e);if(/[\/\\]/.test(e))return Wu(e);return e}function Wu(e){let t=e.split(/[\/\\]/);return t[t.length-1]||e}function Nt(e){if(typeof e==="string")return Tt(e);if(Array.isArray(e))return e.map(Nt);if(e&&typeof e==="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=Nt(n);return t}return e}function Ku(e){let t=JSON.stringify(e);if(t===void 0||t.length<=en)return e;return t.slice(0,en)+"...[truncated]"}async function J(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=Yu(o),i=o instanceof ie?o.body:void 0;throw await tn({cmd:e,args:t,exit:s,durationMs:Date.now()-n,response:i,error:vu(o)}).catch(()=>{}),o}}function Yu(e){if(e instanceof ie)return e.isTransient?2:1;if(e instanceof Se||e instanceof ke)return 1;if(e instanceof Error&&e.code==="ENOENT")return 1;return 2}function B(e){let t=process.argv.slice(2),r=t.indexOf(e);return r>=0?t.slice(r+1):t}var Qu=new Set(["done","failed"]),Xu=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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("status",B("status"),async()=>{let r=R(t.output),n=q(t.env),o=G(n.name),s=v({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(E(r,s,ec(s)),!n||Qu.has(s.status))return s;await tc(Xu)}}function ec(e){let t=[e.status];if(e.url)t.push(e.url);if(e.error)t.push(`error: ${e.error}`);return t.join(" ")}function tc(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,_=Object.keys(l);for(let y=0;y<_.length;y++){let A=_[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 _ of l._zod.deferred)_();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 jm=Symbol("zod_brand");class ae extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Fe extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(sn=globalThis).__zod_globalConfig??(sn.__zod_globalConfig={});var Ze=globalThis.__zod_globalConfig;function ee(e){if(e)Object.assign(Ze,e);return Ze}function Xe(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 De(e,t){if(typeof t==="bigint")return t.toString();return t}function Le(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function et(e){return e===null||e===void 0}function tt(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 P(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 de(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ue(...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 Oe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var pn=Le(()=>{if(Ze.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function me(e){if(Oe(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(Oe(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Lt(e){if(me(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 ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function oe(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 rc(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=ue(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 de(this,"shape",i),i},checks:[]});return oe(e,s)}function nc(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=ue(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 de(this,"shape",i),i},checks:[]});return oe(e,s)}function oc(e,t){if(!me(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=ue(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return de(this,"shape",s),s}});return oe(e,o)}function sc(e,t){if(!me(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ue(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return de(this,"shape",n),n}});return oe(e,r)}function ic(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ue(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return de(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return oe(e,r)}function ac(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=ue(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 de(this,"shape",p),p},checks:[]});return oe(t,i)}function uc(e,t,r){let n=ue(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 de(this,"shape",s),s}});return oe(t,n)}function he(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 pe(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Qe(e){return typeof e==="string"?e:e?.message}function te(e,t,r){let n=e.message?e.message:Qe(e.inst?._zod.def?.error?.(e))??Qe(t?.error?.(e))??Qe(r.customError?.(e))??Qe(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 rt(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ge(...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,De,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},nt=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 _=u[l];if(l!==u.length-1)p[_]=p[_]||{_errors:[]};else p[_]=p[_]||{_errors:[]},p[_]._errors.push(t(i));p=p[_],l++}}}};return n(e),r}var ot=(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)=>te(p,s,ee())));throw Dt(u,o?.callee),u}return i.value};var st=(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)=>te(p,s,ee())));throw Dt(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 ae;return s.issues.length?{success:!1,error:new(e??nt)(s.issues.map((i)=>te(i,o,ee())))}:{success:!0,data:s.value}},xn=Ue(Ut),Me=(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)=>te(i,o,ee())))}:{success:!0,data:s.value}},yn=Me(Ut),bn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ot(e)(t,r,o)};var $n=(e)=>(t,r,n)=>ot(e)(t,r,n);var An=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return st(e)(t,r,o)};var wn=(e)=>async(t,r,n)=>st(e)(t,r,n);var zn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Ue(e)(t,r,o)};var Sn=(e)=>(t,r,n)=>Ue(e)(t,r,n);var kn=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Me(e)(t,r,o)};var Zn=(e)=>async(t,r,n)=>Me(e)(t,r,n);var On=/^[cC][0-9a-z]{6,}$/,En=/^[0-9a-z]+$/,Pn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Rn=/^[0-9a-vA-V]{20}$/,Cn=/^[A-Za-z0-9]{27}$/,Nn=/^[a-zA-Z0-9_-]{21}$/,Tn=/^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 pc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Fn(){return new RegExp(pc,"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 Wn(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 Kn=(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!et(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=rt(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!et(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=rt(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!et(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=rt(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=ce(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(`^${ce(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(`.*${ce(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(`
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 T=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,c,p)=>{let l=he(i),_;for(let y of c){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(_||x instanceof Promise)_=(_??Promise.resolve()).then(async()=>{if(await x,i.issues.length===A)return;if(!l)l=he(i,A)});else{if(i.issues.length===A)continue;if(!l)l=he(i,A)}}if(_)return _.then(()=>i);return i},s=(i,c,p)=>{if(he(i))return i.aborted=!0,i;let l=o(c,n,p);if(l instanceof Promise){if(p.async===!1)throw new ae;return l.then((_)=>e._zod.parse(_,p))}return e._zod.parse(l,p)};e._zod.run=(i,c)=>{if(c.skipChecks)return e._zod.parse(i,c);if(c.direction==="backward"){let l=e._zod.parse({value:i.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((_)=>s(_,i,c));return s(l,i,c)}let p=e._zod.parse(i,c);if(p instanceof Promise){if(c.async===!1)throw new ae;return p.then((l)=>o(l,n,c))}return o(p,n,c)}}O(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}))}),at=m("$ZodString",(e,t)=>{T.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Kn(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}}),j=m("$ZodStringFormat",(e,t)=>{Ue.init(e,t),at.init(e,t)}),ko=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=In),j.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=Ut(n))}else t.pattern??(t.pattern=Ut());j.init(e,t)}),Oo=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=jn),j.init(e,t)}),Eo=m("$ZodURL",(e,t)=>{j.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===Jn.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})}}}),Po=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Fn()),j.init(e,t)}),Ro=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Cn),j.init(e,t)}),No=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=On),j.init(e,t)}),Co=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=En),j.init(e,t)}),To=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Pn),j.init(e,t)}),Io=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Rn),j.init(e,t)}),jo=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Nn),j.init(e,t)}),Fo=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Wn(t)),j.init(e,t)}),Do=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=vn),j.init(e,t)}),Lo=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Gn(t)),j.init(e,t)}),Uo=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Tn),j.init(e,t)}),Mo=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Dn),j.init(e,t),e._zod.bag.format="ipv4"}),Vo=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ln),j.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 Jo=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Un),j.init(e,t)}),qo=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Mn),j.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 Bo(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 vo=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Vn),j.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(Bo(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function fc(e){if(!Mt.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Bo(r)}var Ho=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Mt),j.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(fc(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),j.init(e,t)});function dc(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 Wo=m("$ZodJWT",(e,t)=>{j.init(e,t),e._zod.check=(r)=>{if(dc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Ht=m("$ZodNumber",(e,t)=>{T.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}}),Ko=m("$ZodNumberFormat",(e,t)=>{oo.init(e,t),Ht.init(e,t)}),Yo=m("$ZodBoolean",(e,t)=>{T.init(e,t),e._zod.pattern=Xn,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 Xo=m("$ZodNull",(e,t)=>{T.init(e,t),e._zod.pattern=Qn,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 Qo=m("$ZodUnknown",(e,t)=>{T.init(e,t),e._zod.parse=(r)=>r}),es=m("$ZodNever",(e,t)=>{T.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)=>{T.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(...pe(r,e.issues));t.value[r]=e.value}var rs=m("$ZodArray",(e,t)=>{T.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 c=o[i],p=t.element._zod.run({value:c,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 it(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...pe(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=[],c=o.keySet,p=o.catchall._zod,l=p.def.type,_=p.optin==="optional",y=p.optout==="optional";for(let A in t){if(A==="__proto__")continue;if(c.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)=>it(z,r,A,t,_,y)));else it(x,r,A,t,_,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 mc=m("$ZodObject",(e,t)=>{if(T.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let p={...c};return Object.defineProperty(t,"shape",{value:p}),p}})}let n=Fe(()=>ns(t));O(e._zod,"propValues",()=>{let c=t.shape,p={};for(let l in c){let _=c[l]._zod;if(_.values){p[l]??(p[l]=new Set);for(let y of _.values)p[l].add(y)}}return p});let o=ke,s=t.catchall,i;e._zod.parse=(c,p)=>{i??(i=n.value);let l=c.value;if(!o(l))return c.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),c;c.value={};let _=[],y=i.shape;for(let A of i.keys){let x=y[A],z=x._zod.optin==="optional",U=x._zod.optout==="optional",E=x._zod.run({value:l[A],issues:[]},p);if(E instanceof Promise)_.push(E.then((oe)=>it(oe,c,A,l,z,U)));else it(E,c,A,l,z,U)}if(!s)return _.length?Promise.all(_).then(()=>c):c;return os(_,l,c,p,n.value,e)}}),ss=m("$ZodObjectJIT",(e,t)=>{mc.init(e,t);let r=e._zod.parse,n=Fe(()=>ns(t)),o=(A)=>{let x=new Bt(["shape","payload","ctx"]),z=n.value,U=(re)=>{let M=jt(re);return`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`};x.write("const input = payload.value;");let E=Object.create(null),oe=0;for(let re of z.keys)E[re]=`key_${oe++}`;x.write("const newResult = {};");for(let re of z.keys){let M=E[re],W=jt(re),br=A[re],$r=br?._zod?.optin==="optional",Ha=br?._zod?.optout==="optional";if(x.write(`const ${M} = ${U(re)};`),$r&&Ha)x.write(`
28
- if (${M}.issues.length) {
29
- if (${W} in input) {
30
- payload.issues = payload.issues.concat(${M}.issues.map(iss => ({
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=he(i),_;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(_||x instanceof Promise)_=(_??Promise.resolve()).then(async()=>{if(await x,i.issues.length===A)return;if(!l)l=he(i,A)});else{if(i.issues.length===A)continue;if(!l)l=he(i,A)}}if(_)return _.then(()=>i);return i},s=(i,u,p)=>{if(he(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((_)=>e._zod.parse(_,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((_)=>s(_,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)}}P(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}))}),ct=m("$ZodString",(e,t)=>{j.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Kn(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),ct.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})}}}),Po=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Fn()),D.init(e,t)}),Ro=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Nn),D.init(e,t)}),Co=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=On),D.init(e,t)}),No=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=En),D.init(e,t)}),To=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Pn),D.init(e,t)}),Io=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Rn),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=Wn(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=Tn),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 lc(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(lc(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 fc(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 Wo=m("$ZodJWT",(e,t)=>{D.init(e,t),e._zod.check=(r)=>{if(fc(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}}),Ko=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(...pe(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 ut(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...pe(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,_=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)=>ut(z,r,A,t,_,y)));else ut(x,r,A,t,_,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 dc=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=Le(()=>ns(t));P(e._zod,"propValues",()=>{let u=t.shape,p={};for(let l in u){let _=u[l]._zod;if(_.values){p[l]??(p[l]=new Set);for(let y of _.values)p[l].add(y)}}return p});let o=Oe,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 _=[],y=i.shape;for(let A of i.keys){let x=y[A],z=x._zod.optin==="optional",M=x._zod.optout==="optional",C=x._zod.run({value:l[A],issues:[]},p);if(C instanceof Promise)_.push(C.then((se)=>ut(se,u,A,l,z,M)));else ut(C,u,A,l,z,M)}if(!s)return _.length?Promise.all(_).then(()=>u):u;return os(_,l,u,p,n.value,e)}}),ss=m("$ZodObjectJIT",(e,t)=>{dc.init(e,t);let r=e._zod.parse,n=Le(()=>ns(t)),o=(A)=>{let x=new Bt(["shape","payload","ctx"]),z=n.value,M=(ne)=>{let V=Ft(ne);return`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`};x.write("const input = payload.value;");let C=Object.create(null),se=0;for(let ne of z.keys)C[ne]=`key_${se++}`;x.write("const newResult = {};");for(let ne of z.keys){let V=C[ne],K=Ft(ne),br=A[ne],$r=br?._zod?.optin==="optional",Ba=br?._zod?.optout==="optional";if(x.write(`const ${V} = ${M(ne)};`),$r&&Ba)x.write(`
28
+ if (${V}.issues.length) {
29
+ if (${K} in input) {
30
+ payload.issues = payload.issues.concat(${V}.issues.map(iss => ({
31
31
  ...iss,
32
- path: iss.path ? [${W}, ...iss.path] : [${W}]
32
+ path: iss.path ? [${K}, ...iss.path] : [${K}]
33
33
  })));
34
34
  }
35
35
  }
36
36
 
37
- if (${M}.value === undefined) {
38
- if (${W} in input) {
39
- newResult[${W}] = undefined;
37
+ if (${V}.value === undefined) {
38
+ if (${K} in input) {
39
+ newResult[${K}] = undefined;
40
40
  }
41
41
  } else {
42
- newResult[${W}] = ${M}.value;
42
+ newResult[${K}] = ${V}.value;
43
43
  }
44
44
 
45
45
  `);else if(!$r)x.write(`
46
- const ${M}_present = ${W} in input;
47
- if (${M}.issues.length) {
48
- payload.issues = payload.issues.concat(${M}.issues.map(iss => ({
46
+ const ${V}_present = ${K} in input;
47
+ if (${V}.issues.length) {
48
+ payload.issues = payload.issues.concat(${V}.issues.map(iss => ({
49
49
  ...iss,
50
- path: iss.path ? [${W}, ...iss.path] : [${W}]
50
+ path: iss.path ? [${K}, ...iss.path] : [${K}]
51
51
  })));
52
52
  }
53
- if (!${M}_present && !${M}.issues.length) {
53
+ if (!${V}_present && !${V}.issues.length) {
54
54
  payload.issues.push({
55
55
  code: "invalid_type",
56
56
  expected: "nonoptional",
57
57
  input: undefined,
58
- path: [${W}]
58
+ path: [${K}]
59
59
  });
60
60
  }
61
61
 
62
- if (${M}_present) {
63
- if (${M}.value === undefined) {
64
- newResult[${W}] = undefined;
62
+ if (${V}_present) {
63
+ if (${V}.value === undefined) {
64
+ newResult[${K}] = undefined;
65
65
  } else {
66
- newResult[${W}] = ${M}.value;
66
+ newResult[${K}] = ${V}.value;
67
67
  }
68
68
  }
69
69
 
70
70
  `);else x.write(`
71
- if (${M}.issues.length) {
72
- payload.issues = payload.issues.concat(${M}.issues.map(iss => ({
71
+ if (${V}.issues.length) {
72
+ payload.issues = payload.issues.concat(${V}.issues.map(iss => ({
73
73
  ...iss,
74
- path: iss.path ? [${W}, ...iss.path] : [${W}]
74
+ path: iss.path ? [${K}, ...iss.path] : [${K}]
75
75
  })));
76
76
  }
77
77
 
78
- if (${M}.value === undefined) {
79
- if (${W} in input) {
80
- newResult[${W}] = undefined;
78
+ if (${V}.value === undefined) {
79
+ if (${K} in input) {
80
+ newResult[${K}] = undefined;
81
81
  }
82
82
  } else {
83
- newResult[${W}] = ${M}.value;
83
+ newResult[${K}] = ${V}.value;
84
84
  }
85
85
 
86
- `)}x.write("payload.value = newResult;"),x.write("return payload;");let va=x.compile();return(re,M)=>va(A,re,M)},s,i=ke,c=!Se.jitless,l=c&&pn.value,_=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(c&&l&&x?.async===!1&&x.jitless!==!0){if(!s)s=o(t.shape);if(A=s(A,x),!_)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)=>!he(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)=>ee(i,n,Q())))}),t}var Gt=m("$ZodUnion",(e,t)=>{T.init(e,t),O(e._zod,"optin",()=>t.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),O(e._zod,"optout",()=>t.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),O(e._zod,"values",()=>{if(t.options.every((n)=>n._zod.values))return new Set(t.options.flatMap((n)=>Array.from(n._zod.values)));return}),O(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)=>Qe(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 c of t.options){let p=c._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((c)=>yo(c,n,e,o))}});var is=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Gt.init(e,t);let r=e._zod.parse;O(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[c,p]of Object.entries(i)){if(!o[c])o[c]=new Set;for(let l of p)o[c].add(l)}}return o});let n=Fe(()=>{let o=t.options,s=new Map;for(let i of o){let c=i._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let p of c){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(!ke(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let c=n.value.get(i?.[t.discriminator]);if(c)return c._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)=>{T.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 vt(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(me(e)&&me(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=vt(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=vt(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 c of t.issues)if(c.code==="unrecognized_keys"){o??(o=c);for(let p of c.keys){if(!n.has(p))n.set(p,{});n.get(p).l=!0}}else e.issues.push(c);for(let c of r.issues)if(c.code==="unrecognized_keys")for(let p of c.keys){if(!n.has(p))n.set(p,{});n.get(p).r=!0}else e.issues.push(c);let s=[...n].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(s.length&&o)e.issues.push({...o,keys:s});if(he(e))return e;let i=vt(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)=>{T.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!me(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 c=new Set;for(let l of i)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){c.add(typeof l==="number"?l.toString():l);let _=t.keyType._zod.run({value:l,issues:[]},n);if(_ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(_.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:_.issues.map((x)=>ee(x,n,Q())),input:l,path:[l],inst:e});continue}let y=_.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(...pe(l,x.issues));r.value[y]=x.value}));else{if(A.issues.length)r.issues.push(...pe(l,A.issues));r.value[y]=A.value}}let p;for(let l in o)if(!c.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 c of Reflect.ownKeys(o)){if(c==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,c))continue;let p=t.keyType._zod.run({value:c,issues:[]},n);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof c==="string"&&Vt.test(c)&&p.issues.length){let y=t.keyType._zod.run({value:Number(c),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[c]=o[c];else r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((y)=>ee(y,n,Q())),input:c,path:[c],inst:e});continue}let _=t.valueType._zod.run({value:o[c],issues:[]},n);if(_ instanceof Promise)s.push(_.then((y)=>{if(y.issues.length)r.issues.push(...pe(c,y.issues));r.value[p.value]=y.value}));else{if(_.issues.length)r.issues.push(...pe(c,_.issues));r.value[p.value]=_.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var cs=m("$ZodEnum",(e,t)=>{T.init(e,t);let r=Ye(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"?ce(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(T.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"?ce(n):n?ce(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)=>{T.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie(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)=>{T.init(e,t),e._zod.optin="optional",e._zod.optout="optional",O(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),O(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Qe(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),O(e._zod,"values",()=>t.innerType._zod.values),O(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ds=m("$ZodNullable",(e,t)=>{T.init(e,t),O(e._zod,"optin",()=>t.innerType._zod.optin),O(e._zod,"optout",()=>t.innerType._zod.optout),O(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Qe(r.source)}|null)$`):void 0}),O(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)=>{T.init(e,t),e._zod.optin="optional",O(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)=>{T.init(e,t),e._zod.optin="optional",O(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)=>{T.init(e,t),O(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)=>{T.init(e,t),e._zod.optin="optional",O(e._zod,"optout",()=>t.innerType._zod.optout),O(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)=>ee(i,n,Q()))},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)=>ee(s,n,Q()))},input:r.value}),r.issues=[],r.fallback=!0;return r}});var Kt=m("$ZodPipe",(e,t)=>{T.init(e,t),O(e._zod,"values",()=>t.in._zod.values),O(e._zod,"optin",()=>t.in._zod.optin),O(e._zod,"optout",()=>t.out._zod.optout),O(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)=>st(i,t.in,n));return st(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>st(s,t.out,n));return st(o,t.out,n)}});function st(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)=>{Kt.init(e,t)}),ys=m("$ZodReadonly",(e,t)=>{T.init(e,t),O(e._zod,"propValues",()=>t.innerType._zod.propValues),O(e._zod,"values",()=>t.innerType._zod.values),O(e._zod,"optin",()=>t.innerType?._zod?.optin),O(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)=>{K.init(e,t),T.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(ge(o))}}var $s,Km=Symbol("ZodOutput"),Ym=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 hc(){return new As}($s=globalThis).__zod_globalRegistry??($s.__zod_globalRegistry=hc());var _e=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 Yt(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 Ps(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function Rs(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function Ns(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function Cs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function Ts(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 Js(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 Bs(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function vs(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 Ws(e,t){return new e({type:"number",checks:[],...w(t)})}function Ks(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 Xs(e,t){return new e({type:"null",...w(t)})}function Qs(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 ut(e,t){return new Jt({check:"less_than",...w(t),value:e,inclusive:!1})}function Me(e,t){return new Jt({check:"less_than",...w(t),value:e,inclusive:!0})}function ct(e,t){return new qt({check:"greater_than",...w(t),value:e,inclusive:!1})}function Ve(e,t){return new qt({check:"greater_than",...w(t),value:e,inclusive:!0})}function pt(e,t){return new no({check:"multiple_of",...w(t),value:e})}function lt(e,t){return new so({check:"max_length",...w(t),maximum:e})}function Ze(e,t){return new io({check:"min_length",...w(t),minimum:e})}function ft(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 Qt(e){return new co({check:"string_format",format:"lowercase",...w(e)})}function er(e){return new po({check:"string_format",format:"uppercase",...w(e)})}function tr(e,t){return new lo({check:"string_format",format:"includes",...w(t),includes:e})}function rr(e,t){return new fo({check:"string_format",format:"starts_with",...w(t),prefix:e})}function nr(e,t){return new mo({check:"string_format",format:"ends_with",...w(t),suffix:e})}function fe(e){return new ho({check:"overwrite",tx:e})}function or(e){return fe((t)=>t.normalize(e))}function sr(){return fe((e)=>e.trim())}function ir(){return fe((e)=>e.toLowerCase())}function ar(){return fe((e)=>e.toUpperCase())}function ur(){return fe((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=gc((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ge(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(ge(s))}},e(n.value,n)),t);return r}function gc(e,t){let r=new K({check:"custom",...w(t)});return r._zod.check=e,r}function cr(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 J(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 c=e._zod.toJSONSchema?.();if(c)i.schema=c;else{let _={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,_);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,_)}let y=e._zod.parent;if(y){if(!i.ref)i.ref=y;J(y,t,_),t.seen.get(y).isParent=!0}}let p=t.metadataRegistry.get(e);if(p)Object.assign(i.schema,p);if(t.io==="input"&&Y(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 pr(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 c=e.metadataRegistry.get(i[0])?.id;if(c){let p=n.get(c);if(p&&p!==i[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,i[0])}}let o=(i)=>{let c=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")}#/${c}/${x}`}}if(i[1]===r)return{ref:"#"};let l=`${"#"}/${c}/`,_=i[1].schema.id??`__schema${e.counter++}`;return{defId:_,ref:l+_}},s=(i)=>{if(i[1].schema.$ref)return;let c=i[1],{ref:p,defId:l}=o(i);if(c.def={...c.schema},l)c.defId=l;let _=c.schema;for(let y in _)delete _[y];_.$ref=p};if(e.cycles==="throw")for(let i of e.seen.entries()){let c=i[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
86
+ `)}x.write("payload.value = newResult;"),x.write("return payload;");let Ja=x.compile();return(ne,V)=>Ja(A,ne,V)},s,i=Oe,u=!Ze.jitless,l=u&&pn.value,_=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),!_)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)=>!he(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)=>te(i,n,ee())))}),t}var Wt=m("$ZodUnion",(e,t)=>{j.init(e,t),P(e._zod,"optin",()=>t.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),P(e._zod,"optout",()=>t.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),P(e._zod,"values",()=>{if(t.options.every((n)=>n._zod.values))return new Set(t.options.flatMap((n)=>Array.from(n._zod.values)));return}),P(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)=>tt(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,Wt.init(e,t);let r=e._zod.parse;P(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=Le(()=>{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(!Oe(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(me(e)&&me(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(he(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(!me(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 _=t.keyType._zod.run({value:l,issues:[]},n);if(_ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(_.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:_.issues.map((x)=>te(x,n,ee())),input:l,path:[l],inst:e});continue}let y=_.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(...pe(l,x.issues));r.value[y]=x.value}));else{if(A.issues.length)r.issues.push(...pe(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)=>te(y,n,ee())),input:u,path:[u],inst:e});continue}let _=t.valueType._zod.run({value:o[u],issues:[]},n);if(_ instanceof Promise)s.push(_.then((y)=>{if(y.issues.length)r.issues.push(...pe(u,y.issues));r.value[p.value]=y.value}));else{if(_.issues.length)r.issues.push(...pe(u,_.issues));r.value[p.value]=_.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var cs=m("$ZodEnum",(e,t)=>{j.init(e,t);let r=Xe(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"?ce(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"?ce(n):n?ce(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 Fe(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 Kt=m("$ZodOptional",(e,t)=>{j.init(e,t),e._zod.optin="optional",e._zod.optout="optional",P(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),P(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${tt(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)=>{Kt.init(e,t),P(e._zod,"values",()=>t.innerType._zod.values),P(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),P(e._zod,"optin",()=>t.innerType._zod.optin),P(e._zod,"optout",()=>t.innerType._zod.optout),P(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${tt(r.source)}|null)$`):void 0}),P(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",P(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",P(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),P(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",P(e._zod,"optout",()=>t.innerType._zod.optout),P(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)=>te(i,n,ee()))},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)=>te(s,n,ee()))},input:r.value}),r.issues=[],r.fallback=!0;return r}});var Yt=m("$ZodPipe",(e,t)=>{j.init(e,t),P(e._zod,"values",()=>t.in._zod.values),P(e._zod,"optin",()=>t.in._zod.optin),P(e._zod,"optout",()=>t.out._zod.optout),P(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)=>at(i,t.in,n));return at(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>at(s,t.out,n));return at(o,t.out,n)}});function at(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),P(e._zod,"propValues",()=>t.innerType._zod.propValues),P(e._zod,"values",()=>t.innerType._zod.values),P(e._zod,"optin",()=>t.innerType?._zod?.optin),P(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(ge(o))}}var $s,rh=Symbol("ZodOutput"),nh=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 mc(){return new As}($s=globalThis).__zod_globalRegistry??($s.__zod_globalRegistry=mc());var _e=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 Ps(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function Rs(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 Ns(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function Ts(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 Ws(e,t){return new e({type:"number",checks:[],...w(t)})}function Ks(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 pt(e,t){return new qt({check:"less_than",...w(t),value:e,inclusive:!1})}function ve(e,t){return new qt({check:"less_than",...w(t),value:e,inclusive:!0})}function lt(e,t){return new Jt({check:"greater_than",...w(t),value:e,inclusive:!1})}function qe(e,t){return new Jt({check:"greater_than",...w(t),value:e,inclusive:!0})}function ft(e,t){return new no({check:"multiple_of",...w(t),value:e})}function dt(e,t){return new so({check:"max_length",...w(t),maximum:e})}function Ee(e,t){return new io({check:"min_length",...w(t),minimum:e})}function mt(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 fe(e){return new ho({check:"overwrite",tx:e})}function sr(e){return fe((t)=>t.normalize(e))}function ir(){return fe((e)=>e.trim())}function ar(){return fe((e)=>e.toLowerCase())}function ur(){return fe((e)=>e.toUpperCase())}function cr(){return fe((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=hc((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ge(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(ge(s))}},e(n.value,n)),t);return r}function hc(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??_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 H(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 _={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,_);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,_)}let y=e._zod.parent;if(y){if(!i.ref)i.ref=y;H(y,t,_),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}/`,_=i[1].schema.id??`__schema${e.counter++}`;return{defId:_,ref:l+_}},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 _=u.schema;for(let y in _)delete _[y];_.$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 c=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(c.cycle){s(i);continue}if(c.count>1){if(e.reused==="ref"){s(i);continue}}}}function lr(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let p=e.seen.get(c);if(p.ref===null)return;let l=p.def??p.schema,_={...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,_),c._zod.parent===y)for(let E in l){if(E==="$ref"||E==="allOf")continue;if(!(E in _))delete l[E]}if(z.$ref&&x.def)for(let E in l){if(E==="$ref"||E==="allOf")continue;if(E in x.def&&JSON.stringify(l[E])===JSON.stringify(x.def[E]))delete l[E]}}let A=c._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:c,jsonSchema:l,path:p.path??[]})};for(let c of[...e.seen.entries()].reverse())n(c[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 c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}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 c of e.seen.entries()){let p=c[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 c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Je(t,"input",e.processors),output:Je(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function Y(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 Y(n.element,r);if(n.type==="set")return Y(n.valueType,r);if(n.type==="lazy")return Y(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 Y(n.innerType,r);if(n.type==="intersection")return Y(n.left,r)||Y(n.right,r);if(n.type==="record"||n.type==="map")return Y(n.keyType,r)||Y(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Y(n.in,r)||Y(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(Y(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Y(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Y(o,r))return!0;if(n.rest&&Y(n.rest,r))return!0;return!1}return!1}var si=(e,t={})=>(r)=>{let n=cr({...r,processors:t});return J(e,n),pr(n,e),lr(n,e)},Je=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=cr({...o??{},target:s,io:t,processors:r});return J(e,i),pr(i,e),lr(i,e)};var _c={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:c,patterns:p,contentEncoding:l}=e._zod.bag;if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(c){if(o.format=_c[c]??c,o.format==="")delete o.format;if(c==="time")delete o.format}if(l)o.contentEncoding=l;if(p&&p.size>0){let _=[...p];if(_.length===1)o.pattern=_[0].source;else if(_.length>1)o.allOf=[..._.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:c,multipleOf:p,exclusiveMaximum:l,exclusiveMinimum:_}=e._zod.bag;if(typeof c==="string"&&c.includes("int"))o.type="integer";else o.type="number";let y=typeof _==="number"&&_>=(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=_,o.exclusiveMinimum=!0;else o.exclusiveMinimum=_;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=Ye(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:c}=e._zod.bag;if(typeof i==="number")o.minItems=i;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=J(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]=J(i[l],t,{...n,path:[...n.path,"properties",l]});let c=new Set(Object.keys(i)),p=new Set([...c].filter((l)=>{let _=s.shape[l]._zod;if(t.io==="input")return _.optin===void 0;else return _.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=J(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((c,p)=>J(c,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=J(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=J(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(l)=>("allOf"in l)&&Object.keys(l).length===1,p=[...c(s)?s.allOf:[s],...c(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 _=J(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let y of p)o.patternProperties[y.source]=_}else{if(t.target==="draft-07"||t.target==="draft-2020-12")o.propertyNames=J(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});o.additionalProperties=J(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=i._zod.values;if(l){let _=[...l].filter((y)=>typeof y==="string"||typeof y==="number");if(_.length>0)o.required=_}},Ai=(e,t,r,n)=>{let o=e._zod.def,s=J(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;J(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},zi=(e,t,r,n)=>{let o=e._zod.def;J(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;J(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;J(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;J(i,t,n);let c=t.seen.get(e);c.ref=i},Oi=(e,t,r,n)=>{let o=e._zod.def;J(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var fr=(e,t,r,n)=>{let o=e._zod.def;J(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};var zc=m("ZodISODateTime",(e,t)=>{Fo.init(e,t),D.init(e,t)});function Ei(e){return Bs(zc,e)}var Sc=m("ZodISODate",(e,t)=>{Do.init(e,t),D.init(e,t)});function Pi(e){return vs(Sc,e)}var kc=m("ZodISOTime",(e,t)=>{Lo.init(e,t),D.init(e,t)});function Ri(e){return Hs(kc,e)}var Zc=m("ZodISODuration",(e,t)=>{Uo.init(e,t),D.init(e,t)});function Ni(e){return Gs(Zc,e)}var Pc=(e,t)=>{tt.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,je,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,je,2)}},isEmpty:{get(){return e.issues.length===0}}})};var X=m("ZodError",Pc,{Parent:Error});var Ci=rt(X),Ti=nt(X),Ii=De(X),ji=Le(X),Fi=bn(X),Di=$n(X),Li=An(X),Ui=wn(X),Mi=zn(X),Vi=Sn(X),Ji=kn(X),qi=Zn(X);var Bi=new WeakMap;function qe(e,t,r){let n=Object.getPrototypeOf(e),o=Bi.get(n);if(!o)o=new Set,Bi.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 c=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}var F=m("ZodType",(e,t)=>(T.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Je(e,"input"),output:Je(e,"output")}}),e.toJSONSchema=si(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>Ci(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Ii(e,r,n),e.parseAsync=async(r,n)=>Ti(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)=>Ji(e,r,n),e.safeDecodeAsync=async(r,n)=>qi(e,r,n),qe(e,"ZodType",{check(...r){let n=this.def;return this.clone(ue(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 ne(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(wp(r,n))},superRefine(r,n){return this.check(zp(r,n))},overwrite(r){return this.check(fe(r))},optional(){return a(this)},exactOptional(){return pp(this)},nullable(){return Wi(this)},nullish(){return a(Wi(this))},nonoptional(r){return gp(this,r)},array(){return P(this)},or(r){return f([this,r])},and(r){return ip(this,r)},transform(r){return Ki(this,ta(r))},default(r){return dp(this,r)},prefault(r){return hp(this,r)},catch(r){return xp(this,r)},pipe(r){return Ki(this,r)},readonly(){return $p(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)),Yi=m("_ZodString",(e,t)=>{at.init(e,t),F.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,qe(e,"_ZodString",{regex(...n){return this.check(Xt(...n))},includes(...n){return this.check(tr(...n))},startsWith(...n){return this.check(rr(...n))},endsWith(...n){return this.check(nr(...n))},min(...n){return this.check(Ze(...n))},max(...n){return this.check(lt(...n))},length(...n){return this.check(ft(...n))},nonempty(...n){return this.check(Ze(1,...n))},lowercase(n){return this.check(Qt(n))},uppercase(n){return this.check(er(n))},trim(){return this.check(sr())},normalize(...n){return this.check(or(...n))},toLowerCase(){return this.check(ir())},toUpperCase(){return this.check(ar())},slugify(){return this.check(ur())}})}),Nc=m("ZodString",(e,t)=>{at.init(e,t),Yi.init(e,t),e.email=(r)=>e.check(zs(Cc,r)),e.url=(r)=>e.check(Es(Tc,r)),e.jwt=(r)=>e.check(qs(Wc,r)),e.emoji=(r)=>e.check(Ps(Ic,r)),e.guid=(r)=>e.check(Yt(vi,r)),e.uuid=(r)=>e.check(Ss(mt,r)),e.uuidv4=(r)=>e.check(ks(mt,r)),e.uuidv6=(r)=>e.check(Zs(mt,r)),e.uuidv7=(r)=>e.check(Os(mt,r)),e.nanoid=(r)=>e.check(Rs(jc,r)),e.guid=(r)=>e.check(Yt(vi,r)),e.cuid=(r)=>e.check(Ns(Fc,r)),e.cuid2=(r)=>e.check(Cs(Dc,r)),e.ulid=(r)=>e.check(Ts(Lc,r)),e.base64=(r)=>e.check(Ms(vc,r)),e.base64url=(r)=>e.check(Vs(Hc,r)),e.xid=(r)=>e.check(Is(Uc,r)),e.ksuid=(r)=>e.check(js(Mc,r)),e.ipv4=(r)=>e.check(Fs(Vc,r)),e.ipv6=(r)=>e.check(Ds(Jc,r)),e.cidrv4=(r)=>e.check(Ls(qc,r)),e.cidrv6=(r)=>e.check(Us(Bc,r)),e.e164=(r)=>e.check(Js(Gc,r)),e.datetime=(r)=>e.check(Ei(r)),e.date=(r)=>e.check(Pi(r)),e.time=(r)=>e.check(Ri(r)),e.duration=(r)=>e.check(Ni(r))});function u(e){return ws(Nc,e)}var D=m("ZodStringFormat",(e,t)=>{j.init(e,t),Yi.init(e,t)}),Cc=m("ZodEmail",(e,t)=>{Oo.init(e,t),D.init(e,t)});var vi=m("ZodGUID",(e,t)=>{ko.init(e,t),D.init(e,t)});var mt=m("ZodUUID",(e,t)=>{Zo.init(e,t),D.init(e,t)});var Tc=m("ZodURL",(e,t)=>{Eo.init(e,t),D.init(e,t)});var Ic=m("ZodEmoji",(e,t)=>{Po.init(e,t),D.init(e,t)});var jc=m("ZodNanoID",(e,t)=>{Ro.init(e,t),D.init(e,t)});var Fc=m("ZodCUID",(e,t)=>{No.init(e,t),D.init(e,t)});var Dc=m("ZodCUID2",(e,t)=>{Co.init(e,t),D.init(e,t)});var Lc=m("ZodULID",(e,t)=>{To.init(e,t),D.init(e,t)});var Uc=m("ZodXID",(e,t)=>{Io.init(e,t),D.init(e,t)});var Mc=m("ZodKSUID",(e,t)=>{jo.init(e,t),D.init(e,t)});var Vc=m("ZodIPv4",(e,t)=>{Mo.init(e,t),D.init(e,t)});var Jc=m("ZodIPv6",(e,t)=>{Vo.init(e,t),D.init(e,t)});var qc=m("ZodCIDRv4",(e,t)=>{Jo.init(e,t),D.init(e,t)});var Bc=m("ZodCIDRv6",(e,t)=>{qo.init(e,t),D.init(e,t)});var vc=m("ZodBase64",(e,t)=>{vo.init(e,t),D.init(e,t)});var Hc=m("ZodBase64URL",(e,t)=>{Ho.init(e,t),D.init(e,t)});var Gc=m("ZodE164",(e,t)=>{Go.init(e,t),D.init(e,t)});var Wc=m("ZodJWT",(e,t)=>{Wo.init(e,t),D.init(e,t)});var Xi=m("ZodNumber",(e,t)=>{Ht.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,s)=>ai(e,n,o,s),qe(e,"ZodNumber",{gt(n,o){return this.check(ct(n,o))},gte(n,o){return this.check(Ve(n,o))},min(n,o){return this.check(Ve(n,o))},lt(n,o){return this.check(ut(n,o))},lte(n,o){return this.check(Me(n,o))},max(n,o){return this.check(Me(n,o))},int(n){return this.check(Hi(n))},safe(n){return this.check(Hi(n))},positive(n){return this.check(ct(0,n))},nonnegative(n){return this.check(Ve(0,n))},negative(n){return this.check(ut(0,n))},nonpositive(n){return this.check(Me(0,n))},multipleOf(n,o){return this.check(pt(n,o))},step(n,o){return this.check(pt(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 h(e){return Ws(Xi,e)}var Kc=m("ZodNumberFormat",(e,t)=>{Ko.init(e,t),Xi.init(e,t)});function Hi(e){return Ks(Kc,e)}var Yc=m("ZodBoolean",(e,t)=>{Yo.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ui(e,r,n,o)});function C(e){return Ys(Yc,e)}var Xc=m("ZodNull",(e,t)=>{Xo.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ci(e,r,n,o)});function Oe(e){return Xs(Xc,e)}var Qc=m("ZodUnknown",(e,t)=>{Qo.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fi(e,r,n,o)});function Z(){return Qs(Qc)}var ep=m("ZodNever",(e,t)=>{es.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>li(e,r,n,o)});function S(e){return ei(ep,e)}var tp=m("ZodVoid",(e,t)=>{ts.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pi(e,r,n,o)});function mr(e){return ti(tp,e)}var rp=m("ZodArray",(e,t)=>{rs.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_i(e,r,n,o),e.element=t.element,qe(e,"ZodArray",{min(r,n){return this.check(Ze(r,n))},nonempty(r){return this.check(Ze(1,r))},max(r,n){return this.check(lt(r,n))},length(r,n){return this.check(ft(r,n))},unwrap(){return this.element}})});function P(e,t){return ri(rp,e,t)}var np=m("ZodObject",(e,t)=>{ss.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xi(e,r,n,o),O(e,"shape",()=>t.shape),qe(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 sc(this,r)},safeExtend(r){return ic(this,r)},merge(r){return ac(this,r)},pick(r){return nc(this,r)},omit(r){return oc(this,r)},partial(...r){return uc(ra,this,r[0])},required(...r){return cc(na,this,r[0])}})});function d(e,t){let r={type:"object",shape:e??{},...w(t)};return new np(r)}var Qi=m("ZodUnion",(e,t)=>{Gt.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yi(e,r,n,o),e.options=t.options});function f(e,t){return new Qi({type:"union",options:e,...w(t)})}var op=m("ZodDiscriminatedUnion",(e,t)=>{Qi.init(e,t),is.init(e,t)});function ea(e,t,r){return new op({type:"union",options:t,discriminator:e,...w(r)})}var sp=m("ZodIntersection",(e,t)=>{as.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bi(e,r,n,o)});function ip(e,t){return new sp({type:"intersection",left:e,right:t})}var Gi=m("ZodRecord",(e,t)=>{us.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$i(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ee(e,t,r){if(!t||!t._zod)return new Gi({type:"record",keyType:u(),valueType:e,...w(t)});return new Gi({type:"record",keyType:e,valueType:t,...w(r)})}var dr=m("ZodEnum",(e,t)=>{cs.init(e,t),F.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 dr({...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 dr({...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 dr({type:"enum",entries:r,...w(t)})}var ap=m("ZodLiteral",(e,t)=>{ps.init(e,t),F.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 k(e,t){return new ap({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}var up=m("ZodTransform",(e,t)=>{ls.init(e,t),F.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 Ie(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(ge(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(ge(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 up({type:"transform",transform:e})}var ra=m("ZodOptional",(e,t)=>{Wt.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function a(e){return new ra({type:"optional",innerType:e})}var cp=m("ZodExactOptional",(e,t)=>{fs.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function pp(e){return new cp({type:"optional",innerType:e})}var lp=m("ZodNullable",(e,t)=>{ds.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ai(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Wi(e){return new lp({type:"nullable",innerType:e})}var fp=m("ZodDefault",(e,t)=>{ms.init(e,t),F.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 dp(e,t){return new fp({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Dt(t)}})}var mp=m("ZodPrefault",(e,t)=>{hs.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Si(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hp(e,t){return new mp({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Dt(t)}})}var na=m("ZodNonOptional",(e,t)=>{gs.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gp(e,t){return new na({type:"nonoptional",innerType:e,...w(t)})}var _p=m("ZodCatch",(e,t)=>{_s.init(e,t),F.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 xp(e,t){return new _p({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var oa=m("ZodPipe",(e,t)=>{Kt.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zi(e,r,n,o),e.in=t.in,e.out=t.out});function Ki(e,t){return new oa({type:"pipe",in:e,out:t})}var yp=m("ZodPreprocess",(e,t)=>{oa.init(e,t),xs.init(e,t)}),bp=m("ZodReadonly",(e,t)=>{ys.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $p(e){return new bp({type:"readonly",innerType:e})}var Ap=m("ZodCustom",(e,t)=>{bs.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hi(e,r,n,o)});function wp(e,t={}){return ni(Ap,e,t)}function zp(e,t){return oi(e,t)}function g(e,t){return new yp({type:"pipe",in:ta(e),out:t})}var Pe={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 jg=Z(),Fg=Z(),Dg=Z(),Lg=Z(),Ug=Z(),Mg=Z(),Vg=Z(),Jg=Z(),qg=Z(),Bg=Z(),vg=Z(),Hg=Z(),Gg=Z(),Wg=Z(),Kg=Z(),Yg=Z(),Xg=Z(),Qg=Z(),kp=d({color:a(u()),opacity:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),padding:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),borderRadius:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Zp=d({family:a(u()),color:a(u()),opacity:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),size:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),lineHeight:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),stroke:a(u()),strokeWidth:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Op=d({top:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),left:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),right:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Ep=d({type:b(["caption"]),src:u().min(1).regex(/\S/),font:a(Zp),background:a(kp),margin:a(Op),trim:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),speed:a(f([g((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},h().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Pp=d({color:f([u().regex(/^#[0-9a-fA-F]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),threshold:a(f([g((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},h().int().gte(0).lte(250)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),halo:a(f([g((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},h().int().gte(0).lte(250)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var ht=d({top:a(f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),bottom:a(f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),left:a(f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),right:a(f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Rp=d({host:u(),cpCode:u(),path:a(f([u(),Oe()])),filename:a(f([u(),Oe()]))}).strict(),Np=d({provider:k("akamai-netstorage"),options:a(Rp)}).strict(),Cp=d({accountName:u(),container:u(),prefix:a(f([u(),Oe()])),filename:a(f([u(),Oe()]))}).strict(),Tp=d({provider:k("azure-blob-storage"),options:a(Cp)}).strict(),Ip=d({bucket:u(),prefix:a(u()),filename:a(u())}).strict();var jp=d({provider:k("google-cloud-storage"),options:a(Ip)}).strict();var Fp=d({folderId:a(u()),filename:a(u())}).strict();var Dp=d({provider:k("google-drive"),options:a(Fp)}).strict();var Lp=d({playbackPolicy:a(P(b(["public","signed"]))),passthrough:a(u().max(255))}).strict();var Up=d({provider:k("mux"),options:a(Lp)}).strict();var Mp=d({region:u(),bucket:u(),prefix:a(u()),filename:a(u()),acl:a(u())}).strict();var Vp=d({provider:k("s3"),options:a(Mp)}).strict();var Jp=d({provider:k("shotstack"),exclude:a(C())}).strict();var qp=d({title:a(u().max(150)),privacyLevel:a(b(["public","friends","private"])),disableDuet:a(C()).default(!1),disableStitch:a(C()).default(!1),disableComment:a(C()).default(!1)}).strict(),Bp=d({provider:k("tiktok"),options:a(qp)}).strict(),vp=d({view:a(b(["anybody","nobody","contacts","password","unlisted"])),embed:a(b(["public","private","whitelist"])),comments:a(b(["anybody","nobody","contacts"])),download:a(C()),add:a(C())}).strict();var Hp=d({name:a(u()),description:a(u()),privacy:a(vp),folderUri:a(u())}).strict();var Gp=d({provider:k("vimeo"),options:a(Hp)}).strict();var hr=ea("provider",[Jp,Up,Vp,jp,Dp,Gp,Bp,Np,Tp]);var Wp=d({horizontal:a(C()),vertical:a(C())}).strict();var Kp=d({src:u()}).strict();var Yp=d({credits:f([f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),Ee(u(),f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))]),tieredBy:a(d({option:u(),default:u()})),quantity:a(d({measure:b(["clipSeconds","promptCharacters"]),per:f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),min:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),max:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),default:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),round:a(b(["up"]))})),effectiveFrom:u()}).strict();var Xp=d({model:u(),type:b(["image","video","audio"]),name:a(u()),description:a(u()),pricing:a(Yp),options:a(Ee(u(),Z())),available:a(C()),unavailableReason:a(b(["AiCapabilityNotIncluded","AiDisabled","AiAccessUnavailable"]))}).strict();var Qp=d({type:b(["html5"]),html:u().max(1e6),css:a(u().max(500000)),js:a(u().max(500000))}).strict();var el=d({type:b(["html"]),html:u(),css:a(u()),width:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),background:a(u()),position:a(b(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"]))}).strict();var ia=d({type:b(["image"]),src:a(u().min(1).regex(/\S/)),prompt:a(u().max(4000)),model:a(u()),options:a(Ee(u(),Z())),crop:a(ht)}).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:Pe.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var tl=d({type:b(["image-to-video"]),src:u().min(1),prompt:a(u()),aspectRatio:a(b(["1:1","4:3","16:9","9:16","3:4","21:9","9:21"])),speed:a(f([g((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},h().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),crop:a(ht)}).strict();var rl=d({preset:b(["conference","interview","lecture","meeting","mobile_phone","music","podcast","studio","voice_over"])}).strict();var nl=d({provider:u().default("dolby"),options:rl}).strict();var ol=d({enhancement:k("dolbyEnhancement_DolbyEnhancement")}).strict().and(nl);var sl=d({audio:a(ol)}).strict();var il=d({status:u(),title:u(),detail:u()}).strict();var e_=d({errors:P(il)}).strict();var al=d({type:u(),id:u()}).strict();var t_=d({data:al}).strict();var ul=d({id:u(),url:u(),expires:u()}).strict();var cl=d({type:u(),id:u(),attributes:ul}).strict();var r_=d({data:cl}).strict();var pl=d({speed:a(f([g((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},h().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),preservePitch:a(C())}).strict();var ll=d({format:a(b(["srt","vtt"]))}).strict();var fl=d({type:b(["luma"]),src:u().min(1).regex(/\S/),trim:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var aa=d({find:u(),replace:Z()}).strict();var dl=d({capture:f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}).strict();var ml=d({start:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),length:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var hl=d({id:u(),owner:u(),region:a(u()),renderId:a(u()),providerId:a(u()),filename:a(u()),url:a(u()),status:b(["importing","ready","failed","deleted"]),created:a(u()),updated:a(u())}).strict();var ua=d({type:u(),attributes:hl}).strict();var n_=d({data:P(ua)}).strict();var o_=d({data:ua}).strict();var s_=d({error:u(),code:a(u()),available:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var i_=d({error:d({name:b(["UnknownGenerationModel","WithdrawnGenerationModel"]),message:u()})}).strict();var a_=d({models:P(Xp)}).strict();var u_=d({id:u(),status:b(["queued","processing","done","failed"]),url:a(u()),error:a(u())}).strict();var c_=d({success:C(),message:u(),response:Ee(u(),Z())}).strict();var gl=d({message:u(),id:u()}).strict();var p_=d({success:C(),message:u(),response:gl}).strict();var _l=d({id:u(),name:u(),created:a(u()),updated:a(u())}).strict();var xl=d({owner:u(),templates:P(_l)}).strict();var l_=d({success:C(),message:u(),response:xl}).strict();var yl=d({message:u(),id:u()}).strict();var f_=d({success:C(),message:u(),response:yl}).strict();var bl=d({family:a(u()),weight:a(Z()).default("400"),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),background:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),size:a(f([g((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},h().gte(1).lte(500)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),textDecoration:a(b(["none","underline","line-through"]))}).strict();var $l=d({style:b(["karaoke","highlight","pop","fade","slide","bounce","typewriter","none"]),direction:a(b(["left","right","up","down"]))}).strict();var Al=d({family:a(u()).default("Roboto"),size:a(f([g((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},h().int().gte(1).lte(500)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),weight:a(Z()).default("400"),style:a(b(["normal","italic"])),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#ffffff"),opacity:a(f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),background:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),ca=d({horizontal:a(b(["left","center","right"])),vertical:a(b(["top","middle","bottom"]))}).strict();var wl=d({preset:b(["fadeIn","slideIn","typewriter","ascend","shift","movingLetters"]),duration:a(f([g((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},h().gte(0.1).lte(30)),u().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([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),borderRadius:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),wrap:a(C()).default(!1),padding:a(f([g((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},h().int().gte(0).lte(200)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var la=d({width:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),radius:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0)}).strict(),fa=d({type:a(b(["linear","radial"])),angle:a(f([g((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},h().gte(0).lte(360)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),stops:P(d({offset:f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),color:f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])})).min(2)}).strict();var zl=d({letterSpacing:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),lineHeight:a(f([g((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},h().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1.2),textTransform:a(b(["none","uppercase","lowercase","capitalize"])),size:a(f([g((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},h().gte(1).lte(500)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),textDecoration:a(b(["none","underline","line-through"])),gradient:a(fa)}).strict(),da=d({top:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),right:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),bottom:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),left:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0)}).strict(),gr=d({offsetX:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),offsetY:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),blur:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.5)}).strict();var gt=d({width:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1)}).strict();var Sl=d({font:a(bl),stroke:a(f([gt,b(["none"])])),shadow:a(f([gr,b(["none"])]))}).strict();var kl=d({type:b(["rich-caption"]),src:u().min(1),font:a(Al),style:a(zl),stroke:a(gt),shadow:a(gr),background:a(pa),border:a(la),padding:a(f([f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),da])),align:a(ca),active:a(Sl),animation:a($l)}).strict();var Zl=d({family:a(u()).default("Open Sans"),size:a(f([g((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},h().int().gte(1).lte(500)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),weight:a(Z()).default("400"),style:a(b(["normal","italic"])),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),opacity:a(f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),background:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),stroke:a(gt)}).strict();var Ol=d({letterSpacing:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),wordSpacing:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),lineHeight:a(f([g((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},h().gte(0).lte(10)),u().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 El=d({type:b(["rich-text"]),text:u().max(5000),font:a(Zl),style:a(Ol),stroke:a(gt),shadow:a(gr),background:a(pa),border:a(la),padding:a(f([f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),da])),align:a(ca),animation:a(wl)}).strict();var Pl=d({id:a(u()),owner:a(u()),status:a(b(["queued","failed"])),created:a(u())}).strict();var Rl=d({type:a(u()),attributes:a(Pl)}).strict();var d_=d({data:Rl}).strict();var Nl=d({url:u(),id:u(),destinations:P(hr)}).strict();var Cl=d({type:b(["shape"]),shape:b(["rectangle","circle","line"]),width:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fill:a(d({color:a(u()),opacity:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),stroke:a(d({color:a(u()),width:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),rectangle:a(d({width:f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),height:f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),cornerRadius:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),circle:a(d({radius:f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])})),line:a(d({length:f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),thickness:f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}))}).strict();var ma=d({width:a(f([g((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},h().int().gte(1).lte(4096)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().int().gte(1).lte(4096)),u().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([g((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},h().int().gte(1).lte(100)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([k(12),k(15),k(23.976),k(24),k(25),k(29.97),k(30),k(48),k(50),k(59.94),k(60)])),speed:a(pl),keyframeInterval:a(f([g((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},h().int().gte(1).lte(300)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fixOffset:a(C()),fixRotation:a(C()),enhance:a(sl),filename:a(u())}).strict();var Tl=d({renditions:a(P(ha)),transcription:a(ll)}).strict();var Il=d({id:u(),status:a(b(["queued","importing","ready","failed","deleted","overwritten"])),url:a(u()),executionTime:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),transformation:a(ha),width:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),duration:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var jl=d({renditions:a(P(Il))}).strict();var Fl=d({id:u(),owner:u(),input:a(u()),source:a(u()),status:a(b(["queued","importing","ready","failed","deleted","overwritten"])),outputs:a(jl),width:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),duration:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),created:a(u()),updated:a(u())}).strict();var ga=d({type:u(),id:u(),attributes:Fl}).strict();var m_=d({data:P(ga)}).strict();var h_=d({data:ga}).strict();var Dl=d({url:a(u()),outputs:a(Tl),destinations:a(hr),callback:a(u())}).strict();var Ll=d({src:u().min(1).regex(/\S/),effect:a(b(["fadeIn","fadeOut","fadeInFadeOut"])),volume:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Ul=d({type:b(["svg"]),src:u().min(1).max(500000)}).strict();var Ml=d({id:u(),merge:a(P(aa))}).strict();var Vl=d({horizontal:a(b(["left","center","right"])),vertical:a(b(["top","center","bottom"]))}).strict();var Jl=d({preset:b(["typewriter"]),duration:a(f([g((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},h().gte(0.1).lte(30)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),ql=d({color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),padding:a(f([g((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},h().gte(0).lte(100)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),borderRadius:a(f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),wrap:a(C())}).strict();var Bl=d({family:a(u()),color:a(u()),opacity:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),size:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),weight:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),lineHeight:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var vl=d({width:a(f([g((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},h().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),color:a(f([u().regex(/^#[A-Fa-f0-9]{6}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),Hl=d({type:b(["text"]),text:u(),width:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),font:a(Bl),background:a(ql),alignment:a(Vl),stroke:a(vl),animation:a(Jl),ellipsis:a(u())}).strict().superRefine((e,t)=>{if(e.background&&e.background.wrap===!0)t.addIssue({code:Pe.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 Gl=d({type:b(["text-to-image"]),prompt:u(),width:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().int()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),crop:a(ht)}).strict();var Wl=d({capture:f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),scale:f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}).strict();var Kl=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([k(12),k(15),k(23.976),k(24),k(25),k(29.97),k(30),k(48),k(50),k(59.94),k(60)])),scaleTo:a(b(["preview","mobile","sd","hd","1080","4k"])),quality:a(b(["verylow","low","medium","high","veryhigh"])),repeat:a(C()),mute:a(C()),range:a(ml),poster:a(dl),thumbnail:a(Wl),destinations:a(P(hr))}).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:Pe.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:Pe.custom,message:'output requires either "resolution" or "size" (with width and height)'})});var Yl=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 te=d({from:a(Z()),to:a(Z()),start:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),length:a(f([g((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},h()),u().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 _a=d({type:b(["audio"]),src:a(u().min(1).regex(/\S/)),prompt:a(u().max(4000)),model:a(u()),options:a(Ee(u(),Z())),trim:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),P(te)])),speed:a(f([g((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},h().gte(0).lte(10)),u().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:Pe.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var xa=d({x:a(f([f([g((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},h().gte(-10).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),P(te)])),y:a(f([f([g((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},h().gte(-10).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),P(te)]))}).strict();var Xl=d({angle:a(f([f([g((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},h().gte(-360).lte(360)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),P(te)]))}).strict();var Ql=d({x:a(f([f([g((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},h().gte(-100).lte(100)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),P(te)])),y:a(f([f([g((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},h().gte(-100).lte(100)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),P(te)]))}).strict();var ef=d({type:b(["text-to-speech"]),text:u(),voice:u(),language:a(u()),newscaster:a(C()).default(!1),trim:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),P(te)])),speed:a(f([g((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},h().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),effect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"]))}).strict();var tf=d({type:b(["title"]),text:u(),style:a(b(["minimal","blockbuster","vogue","sketchy","skinny","chunk","chunkLight","marker","future","subtitle"])),color:a(u()),size:a(b(["xx-small","x-small","small","medium","large","x-large","xx-large"])),background:a(u()),position:a(b(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"])),offset:a(xa)}).strict();var rf=d({rotate:a(Xl),skew:a(Ql),flip:a(Wp)}).strict();var ya=d({type:b(["video"]),src:a(u().min(1).regex(/\S/)),prompt:a(u().max(4000)),model:a(u()),options:a(Ee(u(),Z())),transcode:a(C()),trim:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([g((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},h().gte(0).lte(1)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),P(te)])),volumeEffect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"])),speed:a(f([f([g((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},h().gte(0).lte(10)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),P(te)])),crop:a(ht),chromaKey:a(Pp)}).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:Pe.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var nf=ea("type",[ya,ia,Hl,El,_a,fl,Ep,kl,el,Qp,tf,Cl,Ul,Gl,tl,ef]);var of=d({id:a(u()),asset:nf,start:f([f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),f([u().regex(/^(auto|alias:\/\/[A-Za-z0-9_-]+)$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])]),length:f([f([g((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},h().gte(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),f([u().regex(/^(auto|end|alias:\/\/[A-Za-z0-9_-]+)$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])]),fit:a(b(["cover","contain","crop","none"])),scale:a(f([f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),P(te)])),width:a(f([g((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},h().gte(1).lte(3840)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().gte(1).lte(2160)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),position:a(b(["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft","center"])),offset:a(xa),transition:a(Yl),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([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),P(te)])),transform:a(rf),alias:a(f([u().regex(/^[A-Za-z0-9_-]+$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var sf=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}),af=d({clips:P(sf).min(1)}).strict();var uf=d({soundtrack:a(Ll),background:a(u()),fonts:a(P(Kp)),tracks:P(af).min(1),cache:a(C())}).strict();var Be=d({timeline:uf,output:Kl,merge:a(P(aa)),callback:a(u()),disk:a(b(["local","mount"])),instance:a(b(["s1","s2","a1"]))}).strict(),ba=Be,cf=d({id:u(),owner:u(),plan:a(u()),status:b(["queued","fetching","preprocessing","rendering","generating","saving","done","failed"]),error:a(u()),duration:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),renderTime:a(f([g((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},h()),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),url:a(u()),poster:a(f([u(),Oe()])),thumbnail:a(f([u(),Oe()])),data:a(Be),created:a(u()),updated:a(u())}).strict();var g_=d({success:C(),message:u(),response:cf}).strict();var pf=d({id:u(),name:u(),owner:u(),template:Be}).strict();var __=d({success:C(),message:u(),response:pf}).strict();var $a=d({name:u(),template:a(Be)}).strict();var x_=d({body:Be,path:a(S()),query:a(S())}).strict();var y_=d({body:a(S()),path:d({id:f([u().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}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(d({data:a(C()),merged:a(C())}))}).strict();var b_=d({body:a(S()),path:a(S()),query:a(S())}).strict();var $_=d({body:$a,path:a(S()),query:a(S())}).strict();var A_=d({body:a(S()),path:d({id:f([u().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}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict(),w_=mr(),z_=d({body:a(S()),path:d({id:f([u().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}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var S_=d({body:$a,path:d({id:f([u().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}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var k_=d({body:Ml,path:a(S()),query:a(S())}).strict();var Z_=d({body:a(S()),path:d({url:u()}),query:a(S())}).strict();var O_=d({body:a(d({asset:f([ia,ya,_a]),length:a(f([g((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},h().gt(0)),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),path:a(S()),query:a(S()),headers:a(d({"Idempotency-Key":a(u())}))}).strict();var E_=d({body:a(S()),path:d({id:u()}),query:a(S())}).strict();var P_=d({body:a(S()),path:a(S()),query:a(d({expand:a(b(["options"]))}))}).strict();var R_=d({body:a(S()),path:d({id:u()}),query:a(S())}).strict();var N_=d({body:a(S()),path:d({id:f([u().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}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict(),C_=mr(),T_=d({body:a(S()),path:d({id:f([u().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}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var I_=d({body:a(S()),path:d({id:f([u().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}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var j_=d({body:Nl,path:a(S()),query:a(S())}).strict();var F_=d({body:a(S()),path:a(S()),query:a(S())}).strict();var D_=d({body:Dl,path:a(S()),query:a(S())}).strict();var L_=d({body:a(S()),path:d({id:f([u().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}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict(),U_=mr(),M_=d({body:a(S()),path:d({id:f([u().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}$/),u().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}),query:a(S())}).strict();var V_=d({body:a(S()),path:a(S()),query:a(S())}).strict();var lf={alignment:"align",duration:"length",transitions:"transition",name:"family"},Aa={"align.vertical":{center:"middle"},fit:{cover:"crop"}},ff=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"]),df=/-(?:(?:Extra(?:Light|Bold)|SemiBold|Regular|Medium|Light|Black|Bold|Thin|Heavy)(?:Italic|Oblique)?|(?:Italic|Oblique))$/i,mf=new Set(["image","video","audio","luma"]);function Re(e){let t=[],r=ba.safeParse(e);if(!r.success)for(let o of bf(r.error))t.push({...o,level:"error"});for(let o of hf(e))t.push(o);return{ok:!t.some((o)=>(o.level??"error")==="error"),issues:t}}function xe(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 hf(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 c=_f(i?.src);if(c)s.push(c)}return o.forEach((i,c)=>{let p=i?.clips;if(!Array.isArray(p))return;let l=p.map((_,y)=>({ci:y,start:_?.start,len:_?.length})).filter((_)=>typeof _.start==="number"&&typeof _.len==="number");for(let _=0;_<l.length;_++)for(let y=_+1;y<l.length;y++){let A=l[_],x=l[y];if(A.start<x.start+x.len&&x.start<A.start+A.len){let[z,U]=A.ci<x.ci?[A.ci,x.ci]:[x.ci,A.ci];t.push({path:`timeline.tracks[${c}].clips`,code:"clip_overlap",level:"error",message:`clips [${z}] and [${U}] overlap in time — clips on one track must not `+"overlap (they flicker). Put simultaneous elements on separate tracks."})}}p.forEach((_,y)=>{let A=_?.asset,x=`timeline.tracks[${c}].clips[${y}]`,z=A?.font?.family;if(typeof z==="string"&&z.length>0){let oe=gf(z,s,`${x}.asset.font.family`);if(oe)t.push(oe)}let U=A?.type;if(U==="html5"&&typeof A?.js==="string"&&A.js.length>0){let oe=xf(A.js,`${x}.asset.js`);if(oe)t.push(oe)}let E=A?.src;if(typeof U==="string"&&mf.has(U)&&typeof E==="string")if(/^https:\/\//i.test(E)||/^alias:\/\//i.test(E));else if(/^data:/i.test(E))t.push({path:`${x}.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(E))t.push({path:`${x}.asset.src`,code:"src_not_https",level:"warning",message:"http:// sources are blocked/upgraded — use https://."});else t.push({path:`${x}.asset.src`,code:"src_not_public",level:"warning",message:`'${yf(E,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 gf(e,t,r){let n=e.toLowerCase();if(ff.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 _f(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(df,"")}:null}function xf(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 yf(e,t){return e.length>t?`${e.slice(0,t)}…`:e}function bf(e){return e.issues.flatMap((t)=>$f(t))}function $f(e){let t=wf(e.path);if(e.code==="unrecognized_keys"&&"keys"in e)return e.keys.map((n)=>({path:zf(t,n),code:e.code,message:`unrecognized key '${n}'`,suggestion:lf[n]}));let r=Af(t,e);return[{path:t,code:e.code,message:e.message,...r?{suggestion:r}:{}}]}function Af(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 Aa[n]?.[o]??Aa[r]?.[o]}return}function wf(e){return e.reduce((t,r)=>{if(typeof r==="number")return`${t}[${r}]`;let n=String(r);return t?`${t}.${n}`:n},"")}function zf(e,t){return e?`${e}.${t}`:t}var wa=new L("render").description("Submit a Shotstack Edit JSON to the render API").argument("<file>","Path to a Shotstack Edit JSON file").option("--env <name>",`Environment: ${I.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 H("render",G("render"),async()=>{let r=R(t.output),n=v(t.env),o=B(n.name),s=kf(process.cwd(),e),i=await Sf(s,"utf8"),c=JSON.parse(i),p=Re(c);if(!p.ok){if(r==="json")console.log(JSON.stringify({ok:!1,issues:p.issues}));else console.error(xe(p.issues));return{exitCode:1,validation:p}}if(p.issues.length>0&&r!=="json")console.error(xe(p.issues));let l=q({apiKey:o,env:n}),_=t.watch?2:1,y="";for(let A=1;A<=_;A++){let x=await l.post("/render",c),z=x.response.id;if(y=z,!t.watch)return N(r,{id:z},z),{renderId:z,response:x.response};let U=await Tt(l,z,r,!0);if(U.status!=="failed")return{renderId:z,response:U,exitCode:0};let E=Of(U.error);if(E&&A<_){if(r!=="json")console.error(`⚠ render failed (${U.error??"unknown"}) — looks transient, resubmitting ${A+1}/${_}…`);await Ef(2000);continue}if(r!=="json")console.error(E?`✗ render still failing after ${_} attempts. For a complex multi-scene edit, preview it client-side first: shotstack studio ${e}`:`✗ render failed: ${U.error??"unknown error"}`);return{renderId:z,response:U,exitCode:1}}return{renderId:y,exitCode:1}})}),Zf=/temporar|try again|time ?d? ?out|timeout|too many requests|service unavailable|unavailable|throttl/i;function Of(e){return typeof e==="string"&&Zf.test(e)}function Ef(e){return new Promise((t)=>setTimeout(t,e))}import{readFile as Pf,writeFile as Rf,mkdtemp as Nf}from"node:fs/promises";import{tmpdir as Cf}from"node:os";import{join as za}from"node:path";import{spawn as Tf}from"node:child_process";var Sa="https://github.com/shotstack/shotstack-cli/issues/new?template=bug.yml",If=6000,Ea=5,Pa=new L("feedback").description("Open a pre-filled GitHub issue with a flight-recorder dossier from your last 5 invocations").action(async()=>{let e=await jf(Ea),t=Ff(e),r=Lf(e),n=`&title=${encodeURIComponent(r)}`,o=`${Sa}${n}&body=${encodeURIComponent(t)}`;if(o.length<=If){Oa(o),console.log("Opened browser with pre-filled issue. Review before submitting.");return}let s=await Nf(za(Cf(),"shotstack-feedback-")),i=za(s,"dossier.md");await Rf(i,t),Oa(`${Sa}${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 jf(e){let t=We(),r;try{r=await Pf(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 Ff(e){let t=[];if(t.push("## Environment"),t.push(`- Shotstack CLI: ${Te}`),t.push(`- OS: ${process.platform}-${process.arch}`),t.push(""),t.push(`## Last ${Ea} 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 ${We()}]`),t.push(""),t.push("## What I expected vs what happened"),t.push("<!-- Describe the issue, request, or question here. -->"),t.join(`
91
- `)}var ka=80,Df="Feedback from shotstack CLI";function Lf(e){let t=e.find((o)=>o.error);if(t&&t.error)return xr(`${t.cmd}: ${t.error.name} — ${t.error.message}`);let r=e.find((o)=>Za(o.response)!==null);if(r){let o=Za(r.response);return xr(`Render failed: ${o}`)}let n=e.find((o)=>o.exit!==0);if(n)return xr(`${n.cmd} exited ${n.exit}`);return Df}function Za(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 xr(e){return e.length<=ka?e:e.slice(0,ka-1)+"…"}function Oa(e){let t=process.platform==="win32",r=process.platform==="darwin"?"open":t?"cmd":"xdg-open",o=Tf(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 Uf}from"node:fs/promises";import{resolve as Mf}from"node:path";import{spawn as Ra,execSync as Vf}from"node:child_process";var Na="https://shotstack.studio",Jf=`${Na}/api/share`,qf=3000,Bf=6000,Ca=new L("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("--output <format>","Output format: text | json","text").action(async(e,t)=>{let r=R(t.output),n=Mf(process.cwd(),e),o=await Uf(n,"utf8"),s=JSON.parse(o),i=Re(s);if(!i.ok){if(r==="json")console.log(JSON.stringify({ok:!1,issues:i.issues}));else console.error(xe(i.issues));process.exit(1)}let{url:c,shortened:p}=await vf(s,{shorten:t.shorten});if(!p&&c.length>Bf)console.error(`warning: encoded URL is ${c.length} characters; large templates may exceed browser URL limits.`);if(t.copy)await Wf(c);let l=t.open&&Qf()&&Yf(c);if(r==="json"||!l)N(r,{url:c,shortened:p},c)});async function vf(e,t={}){if(t.shorten!==!1){let n=await Gf(e);if(n)return{url:n,shortened:!0};console.error("warning: could not reach the shotstack.studio share API; falling back to inline URL.")}return{url:Hf(e),shortened:!1}}function Hf(e){let t=Buffer.from(JSON.stringify(e),"utf8").toString("base64url");return`${Na}/#json=${t}`}async function Gf(e){try{let t=await fetch(Jf,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(qf)});if(!t.ok)return null;return(await t.json()).url??null}catch{return null}}async function Wf(e){let{cmd:t,args:r}=Kf();await new Promise((n,o)=>{let s=Ra(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 Kf(){if(process.platform==="darwin")return{cmd:"pbcopy",args:[]};if(process.platform==="win32")return{cmd:"clip",args:[]};return{cmd:"xclip",args:["-selection","clipboard"]}}function Yf(e){let{cmd:t,args:r}=Xf(e);try{let n=Ra(t,r,{detached:!0,stdio:"ignore"});return n.on("error",()=>{}),n.unref(),!0}catch{return!1}}function Xf(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 Qf(){if(process.platform==="darwin"||process.platform==="win32")return!0;if(!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY)return!1;try{return Vf("command -v xdg-open",{stdio:"ignore"}),!0}catch{return!1}}import{readFile as ed}from"node:fs/promises";import{resolve as td,extname as rd}from"node:path";var nd=3000,od=new Set(["ready","failed","deleted","overwritten"]),ye=new L("ingest").description("Ingest source media via the Shotstack Ingest API: upload local files, fetch remote URLs, and manage stored sources");ye.command("upload <file>").description("Upload a local file and host it on Shotstack for use as an Edit asset src").option("--env <name>",`Environment: ${I.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 H("ingest upload",G("upload"),async()=>{let r=R(t.output),n=v(t.env,"ingest"),o=B(n.name),s=q({apiKey:o,env:n}),i=await ed(td(process.cwd(),e)),c=await s.post("/upload"),{id:p,url:l}=c.data.attributes;return await sd(l,i,ad(e)),Ta(s,p,r,t.watch===!0)})});ye.command("fetch <url>").description("Ingest a remote URL into Shotstack-hosted storage").option("--env <name>",`Environment: ${I.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 H("ingest fetch",G("fetch"),async()=>{let r=R(t.output),n=v(t.env,"ingest"),o=B(n.name),s=q({apiKey:o,env:n}),i=await s.post("/sources",{url:e});return Ta(s,i.data.id,r,t.watch===!0)})});ye.command("status <id>").description("Poll the status of an ingested source").option("--env <name>",`Environment: ${I.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 H("ingest status",G("status"),async()=>{let r=R(t.output),n=v(t.env,"ingest"),o=B(n.name),s=q({apiKey:o,env:n}),i=await Ia(s,e,r,t.watch===!0);return{renderId:i.id,response:_t(i),exitCode:i.status==="failed"?1:0}})});ye.command("list").description("List ingested sources").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{await H("ingest list",G("list"),async()=>{let t=R(e.output),r=v(e.env,"ingest"),n=B(r.name),i=(await q({apiKey:n,env:r}).get("/sources")).data.map((p)=>_t(p.attributes)),c=i.length?i.map((p)=>[p.id,p.status,p.source??""].join(" ").trimEnd()).join(`
92
- `):"No sources.";return N(t,i,c),{response:{count:i.length}}})});ye.command("delete <id>").description("Delete an ingested source").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await H("ingest delete",G("delete"),async()=>{let r=R(t.output),n=v(t.env,"ingest"),o=B(n.name);return await q({apiKey:o,env:n}).del(`/sources/${encodeURIComponent(e)}`),N(r,{id:e,deleted:!0},`deleted ${e}`),{renderId:e,response:{id:e,deleted:!0}}})});async function Ta(e,t,r,n){if(!n)return N(r,{id:t},t),{renderId:t,response:{id:t}};let o=await Ia(e,t,r,!0);return{renderId:t,response:_t(o),exitCode:o.status==="failed"?1:0}}async function Ia(e,t,r,n,o=nd){while(!0){let i=(await e.get(`/sources/${encodeURIComponent(t)}`)).data.attributes;if(N(r,_t(i),ud(i)),!n||od.has(i.status))return i;await cd(o)}}async function sd(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 ie(n.status,o||void 0,`PUT upload → ${n.status} ${n.statusText}`)}}var id={".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 ad(e){return id[rd(e).toLowerCase()]}function _t(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;return t}function ud(e){let t=[e.status];if(e.source)t.push(e.source);if(e.error)t.push(`error: ${e.error}`);return t.join(" ")}function cd(e){return new Promise((t)=>setTimeout(t,e))}import{readFile as pd}from"node:fs/promises";import{resolve as ld}from"node:path";async function fd(e,t){return(await e.get(`/templates/${encodeURIComponent(t)}`)).response}async function dd(e){return(await e.get("/templates")).response.templates}async function md(e,t,r){return(await e.post("/templates",{name:t,template:r})).response.id}async function hd(e,t,r,n){let o={template:r};if(n)o.name=n;await e.put(`/templates/${encodeURIComponent(t)}`,o)}async function gd(e,t){await e.del(`/templates/${encodeURIComponent(t)}`)}async function ja(e){let t=await pd(ld(process.cwd(),e),"utf8");return JSON.parse(t)}var be=new L("template").description("Work with saved Shotstack templates");be.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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await H("template get",G("get"),async()=>{let r=R(t.output),n=v(t.env),o=B(n.name),s=q({apiKey:o,env:n}),i=await fd(s,e);return N(r,i.template,JSON.stringify(i.template,null,2)),{templateId:i.id,exitCode:0}})});be.command("list").description("List your saved templates (id and name), newest first").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{await H("template list",G("list"),async()=>{let t=R(e.output),r=v(e.env),n=B(r.name),o=q({apiKey:n,env:r}),s=await dd(o),i=s.length?s.map((c)=>`${c.id} ${c.name??""}`.trimEnd()).join(`
93
- `):"No templates found";return N(t,s,i),{count:s.length,exitCode:0}})});be.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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await H("template create",G("create"),async()=>{let r=R(t.output),n=v(t.env),o=B(n.name),s=q({apiKey:o,env:n}),i=await ja(e),c=await md(s,t.name,i);return N(r,{id:c},c),{templateId:c,exitCode:0}})});be.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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t,r)=>{await H("template update",G("update"),async()=>{let n=R(r.output),o=v(r.env),s=B(o.name),i=q({apiKey:s,env:o}),c=await ja(t);return await hd(i,e,c,r.name),N(n,{id:e,status:"updated"},`updated ${e}`),{templateId:e,exitCode:0}})});be.command("delete <id>").description("Delete a saved template").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await H("template delete",G("delete"),async()=>{let r=R(t.output),n=v(t.env),o=B(n.name),s=q({apiKey:o,env:n});return await gd(s,e),N(r,{id:e,status:"deleted"},`deleted ${e}`),{templateId:e,exitCode:0}})});import{readFile as _d}from"node:fs/promises";import{resolve as xd}from"node:path";var Fa=new L("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=R(t.output),n=xd(process.cwd(),e),o=await _d(n,"utf8"),s;try{s=JSON.parse(o)}catch(l){let _=l instanceof Error?l.message:String(l),y={path:"<root>",code:"invalid_json",level:"error",message:_};if(r==="json")console.log(JSON.stringify({ok:!1,issues:[y]}));else console.error(`✗ ${e}: invalid JSON — ${_}`);process.exitCode=1;return}let i=Re(s),c=i.issues.some((l)=>l.level==="warning"),p=!i.ok||t.strict===!0&&c;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=xe(i.issues);if(p)console.error(l);else console.log(l)}process.exitCode=p?1:0});var yd={clipSeconds:"second",promptCharacters:"character"};async function bd(e){return(await e.get("/models")).models}async function yr(e,t){return e.get(`/models/${encodeURIComponent(t)}`)}var Da=new L("models").description("List generation models with availability and price, or show one model's options").argument("[id]","Model id; prints the JSON Schema for its options").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await H("models",G("models"),async()=>{let r=R(t.output),n=v(t.env),o=B(n.name),s=q({apiKey:o,env:n});if(e){let c=await yr(s,e);return N(r,c,wd(c)),{response:{model:c.model,available:c.available}}}let i=await bd(s);return N(r,i,i.length?Ad(i):"No models."),{response:{count:i.length}}})});function xt(e){if(e.available===!0)return"available";if(e.available===!1)return`unavailable: ${e.unavailableReason??"no reason given"}`;return"availability unknown"}function La(e){let t=$d(e.quantity);if(typeof e.credits==="number")return`${e.credits} ${e.credits===1?"credit":"credits"} ${t}`;let r=e.tieredBy?.default,n=Object.entries(e.credits).map(([o,s])=>`${o} ${s}${o===r?" (default)":""}`).join(", ");return`credits ${t} by ${e.tieredBy?.option??"option"}: ${n}`}function $d(e){if(!e)return"per generation";let t=yd[e.measure]??e.measure;return e.per===1?`per ${t}`:`per ${e.per} ${t}s`}function Ad(e){let t=e.map((n)=>[n.model,n.type,xt(n),n.pricing?La(n.pricing):""]),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(`
94
- `)}function wd(e){let t=[`${e.model} ${e.type} ${xt(e)}`];if(e.name)t.push(e.description?`${e.name}: ${e.description}`:e.name);if(e.pricing)t.push(`Price: ${La(e.pricing)}`);if(e.options)t.push("Options:",JSON.stringify(e.options,null,2));return t.join(`
95
- `)}var Ua=new Set(["done","failed"]),Ma=3000,Va=new L("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>`)",Zd).option("--length <seconds>","Length of the clip the asset fills; models that generate to a duration use it",Od).option("--watch","Poll until the asset is ready, then print its URL").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t,r)=>{await H("generate",G("generate"),async()=>{let n=R(r.output),o=v(r.env),s=B(o.name),i=q({apiKey:s,env:o}),c={model:e,prompt:t,options:r.options,length:r.length};return zd(i,c,n,r.watch===!0)})});async function zd(e,t,r,n,o=Ma){let s=await yr(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 ${xt(s)}`);return{response:p,exitCode:1}}let i=await e.post("/generate",Sd(s,t));N(r,i,Ja(i));let c=i;if(!Ua.has(i.status)){if(n)c=await kd(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:c.id,response:c,exitCode:c.status==="failed"?1:0}}function Sd(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 kd(e,t,r,n=Ma){while(!0){await Ed(n);let o=await e.get(`/generate/${encodeURIComponent(t)}`);if(N(r,o,Ja(o)),Ua.has(o.status))return o}}function Zd(e){let t;try{t=JSON.parse(e)}catch{throw new He("Not valid JSON.")}if(t===null||typeof t!=="object"||Array.isArray(t))throw new He("Expected a JSON object.");return t}function Od(e){let t=Number(e);if(!Number.isFinite(t)||t<=0)throw new He("Expected a positive number of seconds.");return t}function Ja(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 Ed(e){return new Promise((t)=>setTimeout(t,e))}import{createInterface as Pd}from"node:readline";import{Writable as Rd}from"node:stream";var qa=new L("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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{let t=R(e.output),r=Ge(e.env),n=await Nd();if(!n)console.error("No API key provided."),process.exit(1);await Kr(r,n);let o=Ae();N(t,{env:r,stored:!0,path:o},`Saved API key for ${r} → ${o} (chmod 600).`)}),Ba=new L("logout").description("Remove a saved Shotstack API key").option("--env <name>",`Environment to forget: ${I.join(" | ")}`).option("--all","Remove saved keys for every environment").option("--output <format>","Output format: text | json","text").action(async(e)=>{let t=R(e.output);if(e.all){await Xr(),N(t,{cleared:!0},"Removed all saved API keys.");return}let r=Ge(e.env),n=await Yr(r);N(t,{env:r,removed:n},n?`Removed saved API key for ${r}.`:`No saved API key for ${r}.`)});async function Nd(){if(!process.stdin.isTTY){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf8").trim()}return Cd("Shotstack API key: ")}function Cd(e){return new Promise((t)=>{let r=!1,n=new Rd({write(s,i,c){if(!r)process.stdout.write(s);c()}}),o=Pd({input:process.stdin,output:n,terminal:!0});o.question(e,(s)=>{o.close(),process.stdout.write(`
96
- `),t(s.trim())}),r=!0})}var Td=new L().name("shotstack").description("Command-line interface for the Shotstack video rendering API").version(Te).addCommand(wa).addCommand(on).addCommand(Ca).addCommand(ye).addCommand(be).addCommand(Fa).addCommand(Da).addCommand(Va).addCommand(qa).addCommand(Ba).addCommand(Pa);try{await Td.parseAsync(process.argv)}catch(e){process.exit(Id(e))}function Id(e){if(e instanceof we||e instanceof ze)return console.error(e.message),1;if(e instanceof ie){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}
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,_={...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,_),u._zod.parent===y)for(let C in l){if(C==="$ref"||C==="allOf")continue;if(!(C in _))delete l[C]}if(z.$ref&&x.def)for(let C in l){if(C==="$ref"||C==="allOf")continue;if(C in x.def&&JSON.stringify(l[C])===JSON.stringify(x.def[C]))delete l[C]}}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:Je(t,"input",e.processors),output:Je(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 H(e,n),lr(n,e),fr(n,e)},Je=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=pr({...o??{},target:s,io:t,processors:r});return H(e,i),lr(i,e),fr(i,e)};var gc={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=gc[u]??u,o.format==="")delete o.format;if(u==="time")delete o.format}if(l)o.contentEncoding=l;if(p&&p.size>0){let _=[...p];if(_.length===1)o.pattern=_[0].source;else if(_.length>1)o.allOf=[..._.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:_}=e._zod.bag;if(typeof u==="string"&&u.includes("int"))o.type="integer";else o.type="number";let y=typeof _==="number"&&_>=(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=_,o.exclusiveMinimum=!0;else o.exclusiveMinimum=_;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=Xe(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=H(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]=H(i[l],t,{...n,path:[...n.path,"properties",l]});let u=new Set(Object.keys(i)),p=new Set([...u].filter((l)=>{let _=s.shape[l]._zod;if(t.io==="input")return _.optin===void 0;else return _.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=H(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)=>H(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=H(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=H(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(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let y of p)o.patternProperties[y.source]=_}else{if(t.target==="draft-07"||t.target==="draft-2020-12")o.propertyNames=H(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});o.additionalProperties=H(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=i._zod.values;if(l){let _=[...l].filter((y)=>typeof y==="string"||typeof y==="number");if(_.length>0)o.required=_}},Ai=(e,t,r,n)=>{let o=e._zod.def,s=H(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;H(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},zi=(e,t,r,n)=>{let o=e._zod.def;H(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;H(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;H(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;H(i,t,n);let u=t.seen.get(e);u.ref=i},Oi=(e,t,r,n)=>{let o=e._zod.def;H(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;H(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};var wc=m("ZodISODateTime",(e,t)=>{Fo.init(e,t),U.init(e,t)});function Ei(e){return Js(wc,e)}var zc=m("ZodISODate",(e,t)=>{Do.init(e,t),U.init(e,t)});function Pi(e){return Bs(zc,e)}var Sc=m("ZodISOTime",(e,t)=>{Lo.init(e,t),U.init(e,t)});function Ri(e){return Hs(Sc,e)}var kc=m("ZodISODuration",(e,t)=>{Uo.init(e,t),U.init(e,t)});function Ci(e){return Gs(kc,e)}var Ec=(e,t)=>{nt.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,De,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,De,2)}},isEmpty:{get(){return e.issues.length===0}}})};var X=m("ZodError",Ec,{Parent:Error});var Ni=ot(X),Ti=st(X),Ii=Ue(X),ji=Me(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 Be(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:Je(e,"input"),output:Je(e,"output")}}),e.toJSONSchema=si(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>Ni(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Ii(e,r,n),e.parseAsync=async(r,n)=>Ti(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),Be(e,"ZodType",{check(...r){let n=this.def;return this.clone(ue(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 oe(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(Ap(r,n))},superRefine(r,n){return this.check(wp(r,n))},overwrite(r){return this.check(fe(r))},optional(){return a(this)},exactOptional(){return cp(this)},nullable(){return Wi(this)},nullish(){return a(Wi(this))},nonoptional(r){return hp(this,r)},array(){return T(this)},or(r){return f([this,r])},and(r){return sp(this,r)},transform(r){return Ki(this,ta(r))},default(r){return fp(this,r)},prefault(r){return mp(this,r)},catch(r){return _p(this,r)},pipe(r){return Ki(this,r)},readonly(){return bp(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)),Yi=m("_ZodString",(e,t)=>{ct.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,Be(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(Ee(...n))},max(...n){return this.check(dt(...n))},length(...n){return this.check(mt(...n))},nonempty(...n){return this.check(Ee(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())}})}),Rc=m("ZodString",(e,t)=>{ct.init(e,t),Yi.init(e,t),e.email=(r)=>e.check(zs(Cc,r)),e.url=(r)=>e.check(Es(Nc,r)),e.jwt=(r)=>e.check(qs(Gc,r)),e.emoji=(r)=>e.check(Ps(Tc,r)),e.guid=(r)=>e.check(Qt(Bi,r)),e.uuid=(r)=>e.check(Ss(gt,r)),e.uuidv4=(r)=>e.check(ks(gt,r)),e.uuidv6=(r)=>e.check(Zs(gt,r)),e.uuidv7=(r)=>e.check(Os(gt,r)),e.nanoid=(r)=>e.check(Rs(Ic,r)),e.guid=(r)=>e.check(Qt(Bi,r)),e.cuid=(r)=>e.check(Cs(jc,r)),e.cuid2=(r)=>e.check(Ns(Fc,r)),e.ulid=(r)=>e.check(Ts(Dc,r)),e.base64=(r)=>e.check(Ms(Jc,r)),e.base64url=(r)=>e.check(Vs(Bc,r)),e.xid=(r)=>e.check(Is(Lc,r)),e.ksuid=(r)=>e.check(js(Uc,r)),e.ipv4=(r)=>e.check(Fs(Mc,r)),e.ipv6=(r)=>e.check(Ds(Vc,r)),e.cidrv4=(r)=>e.check(Ls(vc,r)),e.cidrv6=(r)=>e.check(Us(qc,r)),e.e164=(r)=>e.check(vs(Hc,r)),e.datetime=(r)=>e.check(Ei(r)),e.date=(r)=>e.check(Pi(r)),e.time=(r)=>e.check(Ri(r)),e.duration=(r)=>e.check(Ci(r))});function c(e){return ws(Rc,e)}var U=m("ZodStringFormat",(e,t)=>{D.init(e,t),Yi.init(e,t)}),Cc=m("ZodEmail",(e,t)=>{Oo.init(e,t),U.init(e,t)});var Bi=m("ZodGUID",(e,t)=>{ko.init(e,t),U.init(e,t)});var gt=m("ZodUUID",(e,t)=>{Zo.init(e,t),U.init(e,t)});var Nc=m("ZodURL",(e,t)=>{Eo.init(e,t),U.init(e,t)});var Tc=m("ZodEmoji",(e,t)=>{Po.init(e,t),U.init(e,t)});var Ic=m("ZodNanoID",(e,t)=>{Ro.init(e,t),U.init(e,t)});var jc=m("ZodCUID",(e,t)=>{Co.init(e,t),U.init(e,t)});var Fc=m("ZodCUID2",(e,t)=>{No.init(e,t),U.init(e,t)});var Dc=m("ZodULID",(e,t)=>{To.init(e,t),U.init(e,t)});var Lc=m("ZodXID",(e,t)=>{Io.init(e,t),U.init(e,t)});var Uc=m("ZodKSUID",(e,t)=>{jo.init(e,t),U.init(e,t)});var Mc=m("ZodIPv4",(e,t)=>{Mo.init(e,t),U.init(e,t)});var Vc=m("ZodIPv6",(e,t)=>{Vo.init(e,t),U.init(e,t)});var vc=m("ZodCIDRv4",(e,t)=>{vo.init(e,t),U.init(e,t)});var qc=m("ZodCIDRv6",(e,t)=>{qo.init(e,t),U.init(e,t)});var Jc=m("ZodBase64",(e,t)=>{Bo.init(e,t),U.init(e,t)});var Bc=m("ZodBase64URL",(e,t)=>{Ho.init(e,t),U.init(e,t)});var Hc=m("ZodE164",(e,t)=>{Go.init(e,t),U.init(e,t)});var Gc=m("ZodJWT",(e,t)=>{Wo.init(e,t),U.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),Be(e,"ZodNumber",{gt(n,o){return this.check(lt(n,o))},gte(n,o){return this.check(qe(n,o))},min(n,o){return this.check(qe(n,o))},lt(n,o){return this.check(pt(n,o))},lte(n,o){return this.check(ve(n,o))},max(n,o){return this.check(ve(n,o))},int(n){return this.check(Hi(n))},safe(n){return this.check(Hi(n))},positive(n){return this.check(lt(0,n))},nonnegative(n){return this.check(qe(0,n))},negative(n){return this.check(pt(0,n))},nonpositive(n){return this.check(ve(0,n))},multipleOf(n,o){return this.check(ft(n,o))},step(n,o){return this.check(ft(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 h(e){return Ws(Qi,e)}var Wc=m("ZodNumberFormat",(e,t)=>{Ko.init(e,t),Qi.init(e,t)});function Hi(e){return Ks(Wc,e)}var Kc=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(Kc,e)}var Yc=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(Yc,e)}var Qc=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(Qc)}var Xc=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(Xc,e)}var ep=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(ep,e)}var tp=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,Be(e,"ZodArray",{min(r,n){return this.check(Ee(r,n))},nonempty(r){return this.check(Ee(1,r))},max(r,n){return this.check(dt(r,n))},length(r,n){return this.check(mt(r,n))},unwrap(){return this.element}})});function T(e,t){return ri(tp,e,t)}var rp=m("ZodObject",(e,t)=>{ss.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xi(e,r,n,o),P(e,"shape",()=>t.shape),Be(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 oc(this,r)},safeExtend(r){return sc(this,r)},merge(r){return ic(this,r)},pick(r){return rc(this,r)},omit(r){return nc(this,r)},partial(...r){return ac(ra,this,r[0])},required(...r){return uc(na,this,r[0])}})});function d(e,t){let r={type:"object",shape:e??{},...w(t)};return new rp(r)}var Xi=m("ZodUnion",(e,t)=>{Wt.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 np=m("ZodDiscriminatedUnion",(e,t)=>{Xi.init(e,t),is.init(e,t)});function ea(e,t,r){return new np({type:"union",options:t,discriminator:e,...w(r)})}var op=m("ZodIntersection",(e,t)=>{as.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bi(e,r,n,o)});function sp(e,t){return new op({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 Re(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 ip=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 O(e,t){return new ip({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}var ap=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 Fe(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(ge(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(ge(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 ap({type:"transform",transform:e})}var ra=m("ZodOptional",(e,t)=>{Kt.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 up=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 cp(e){return new up({type:"optional",innerType:e})}var pp=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 Wi(e){return new pp({type:"nullable",innerType:e})}var lp=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 fp(e,t){return new lp({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Lt(t)}})}var dp=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 mp(e,t){return new dp({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 hp(e,t){return new na({type:"nonoptional",innerType:e,...w(t)})}var gp=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 _p(e,t){return new gp({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 Ki(e,t){return new oa({type:"pipe",in:e,out:t})}var xp=m("ZodPreprocess",(e,t)=>{oa.init(e,t),xs.init(e,t)}),yp=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 bp(e){return new yp({type:"readonly",innerType:e})}var $p=m("ZodCustom",(e,t)=>{bs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hi(e,r,n,o)});function Ap(e,t={}){return ni($p,e,t)}function wp(e,t){return oi(e,t)}function g(e,t){return new xp({type:"pipe",in:ta(e),out:t})}var Ce={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 Vg=Z(),vg=Z(),qg=Z(),Jg=Z(),Bg=Z(),Hg=Z(),Gg=Z(),Wg=Z(),Kg=Z(),Yg=Z(),Qg=Z(),Xg=Z(),e_=Z(),t_=Z(),r_=Z(),n_=Z(),o_=Z(),s_=Z(),i_=Z(),Sp=d({color:a(c()),opacity:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),padding:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),borderRadius:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var kp=d({family:a(c()),color:a(c()),opacity:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),size:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),lineHeight:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),stroke:a(c()),strokeWidth:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Zp=d({top:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),left:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),right:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Op=d({type:b(["caption"]),src:c().min(1).regex(/\S/),font:a(kp),background:a(Sp),margin:a(Zp),trim:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),speed:a(f([g((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},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Ep=d({color:f([c().regex(/^#[0-9a-fA-F]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),threshold:a(f([g((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},h().int().gte(0).lte(250)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),halo:a(f([g((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},h().int().gte(0).lte(250)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var _t=d({top:a(f([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),bottom:a(f([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),left:a(f([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),right:a(f([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Pp=d({host:c(),cpCode:c(),path:a(f([c(),Pe()])),filename:a(f([c(),Pe()]))}).strict(),Rp=d({provider:O("akamai-netstorage"),options:a(Pp)}).strict(),Cp=d({accountName:c(),container:c(),prefix:a(f([c(),Pe()])),filename:a(f([c(),Pe()]))}).strict(),Np=d({provider:O("azure-blob-storage"),options:a(Cp)}).strict(),Tp=d({bucket:c(),prefix:a(c()),filename:a(c())}).strict();var Ip=d({provider:O("google-cloud-storage"),options:a(Tp)}).strict();var jp=d({folderId:a(c()),filename:a(c())}).strict();var Fp=d({provider:O("google-drive"),options:a(jp)}).strict();var Dp=d({playbackPolicy:a(T(b(["public","signed"]))),passthrough:a(c().max(255))}).strict();var Lp=d({provider:O("mux"),options:a(Dp)}).strict();var Up=d({region:c(),bucket:c(),prefix:a(c()),filename:a(c()),acl:a(c())}).strict();var Mp=d({provider:O("s3"),options:a(Up)}).strict();var Vp=d({provider:O("shotstack"),exclude:a(N())}).strict();var vp=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(),qp=d({provider:O("tiktok"),options:a(vp)}).strict(),Jp=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 Bp=d({name:a(c()),description:a(c()),privacy:a(Jp),folderUri:a(c())}).strict();var Hp=d({provider:O("vimeo"),options:a(Bp)}).strict();var gr=ea("provider",[Vp,Lp,Mp,Ip,Fp,Hp,qp,Rp,Np]);var Gp=d({horizontal:a(N()),vertical:a(N())}).strict();var Wp=d({src:c()}).strict();var Kp=d({type:b(["image","video","audio"]),prompt:c().min(1).max(4000).regex(/\S/),model:a(c()),options:a(Re(c(),Z()))}).strict();var Yp=d({model:c(),type:b(["image","video","audio"]),name:a(c()),description:a(c()),options:a(Re(c(),Z())),available:a(N()),unavailableReason:a(b(["AiCapabilityNotIncluded","AiDisabled","AiAccessUnavailable"]))}).strict();var ia=d({asset:Kp,length:a(f([g((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},h().gt(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Qp=d({type:b(["html5"]),html:c().max(1e6),css:a(c().max(500000)),js:a(c().max(500000))}).strict();var Xp=d({type:b(["html"]),html:c(),css:a(c()),width:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().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 el=d({type:b(["image"]),src:a(c().min(1).regex(/\S/)),prompt:a(c().max(4000)),model:a(c()),options:a(Re(c(),Z())),crop:a(_t)}).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:Ce.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var tl=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([g((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},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),crop:a(_t)}).strict();var rl=d({preset:b(["conference","interview","lecture","meeting","mobile_phone","music","podcast","studio","voice_over"])}).strict();var nl=d({provider:c().default("dolby"),options:rl}).strict();var ol=d({enhancement:O("dolbyEnhancement_DolbyEnhancement")}).strict().and(nl);var sl=d({audio:a(ol)}).strict();var il=d({status:c(),title:c(),detail:c()}).strict();var a_=d({errors:T(il)}).strict();var al=d({type:c(),id:c()}).strict();var u_=d({data:al}).strict();var ul=d({id:c(),url:c(),expires:c()}).strict();var cl=d({type:c(),id:c(),attributes:ul}).strict();var c_=d({data:cl}).strict();var pl=d({speed:a(f([g((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},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),preservePitch:a(N())}).strict();var ll=d({format:a(b(["srt","vtt"]))}).strict();var fl=d({type:b(["luma"]),src:c().min(1).regex(/\S/),trim:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var aa=d({find:c(),replace:Z()}).strict();var dl=d({capture:f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}).strict();var ml=d({start:a(f([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),length:a(f([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var hl=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:hl}).strict();var p_=d({data:T(ua)}).strict();var l_=d({data:ua}).strict();var f_=d({error:c(),code:a(c()),available:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var d_=d({error:d({name:b(["UnknownGenerationModel","WithdrawnGenerationModel"]),message:c()})}).strict();var m_=d({models:T(Yp)}).strict();var h_=d({credits:f([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),ceiling:N()}).strict();var g_=d({id:c(),status:b(["queued","processing","done","failed"]),url:a(c()),error:a(c())}).strict();var __=d({success:N(),message:c(),response:Re(c(),Z())}).strict();var gl=d({message:c(),id:c()}).strict();var x_=d({success:N(),message:c(),response:gl}).strict();var _l=d({id:c(),name:c(),created:a(c()),updated:a(c())}).strict();var xl=d({owner:c(),templates:T(_l)}).strict();var y_=d({success:N(),message:c(),response:xl}).strict();var yl=d({message:c(),id:c()}).strict();var b_=d({success:N(),message:c(),response:yl}).strict();var bl=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([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),size:a(f([g((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},h().gte(1).lte(500)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),textDecoration:a(b(["none","underline","line-through"]))}).strict();var $l=d({style:b(["karaoke","highlight","pop","fade","slide","bounce","typewriter","none"]),direction:a(b(["left","right","up","down"]))}).strict();var Al=d({family:a(c()).default("Roboto"),size:a(f([g((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},h().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([g((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},h().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 wl=d({preset:b(["fadeIn","slideIn","typewriter","ascend","shift","movingLetters"]),duration:a(f([g((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},h().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([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),borderRadius:a(f([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),wrap:a(N()).default(!1),padding:a(f([g((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},h().int().gte(0).lte(200)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var la=d({width:a(f([g((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},h().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([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),radius:a(f([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0)}).strict();var fa=d({type:a(b(["linear","radial"])),angle:a(f([g((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},h().gte(0).lte(360)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),stops:T(d({offset:f([g((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},h().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 zl=d({letterSpacing:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),lineHeight:a(f([g((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},h().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([g((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},h().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([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),right:a(f([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),bottom:a(f([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),left:a(f([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0)}).strict();var _r=d({offsetX:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),offsetY:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),blur:a(f([g((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},h().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([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.5)}).strict();var xt=d({width:a(f([g((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},h().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([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1)}).strict();var Sl=d({font:a(bl),stroke:a(f([xt,b(["none"])])),shadow:a(f([_r,b(["none"])]))}).strict();var kl=d({type:b(["rich-caption"]),src:c().min(1),font:a(Al),style:a(zl),stroke:a(xt),shadow:a(_r),background:a(pa),border:a(la),padding:a(f([f([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),da])),align:a(ca),active:a(Sl),animation:a($l)}).strict();var Zl=d({family:a(c()).default("Open Sans"),size:a(f([g((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},h().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([g((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},h().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(xt)}).strict();var Ol=d({letterSpacing:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),wordSpacing:a(f([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),lineHeight:a(f([g((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},h().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 El=d({type:b(["rich-text"]),text:c().max(5000),font:a(Zl),style:a(Ol),stroke:a(xt),shadow:a(_r),background:a(pa),border:a(la),padding:a(f([f([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),da])),align:a(ca),animation:a(wl)}).strict();var Pl=d({id:a(c()),owner:a(c()),status:a(b(["queued","failed"])),created:a(c())}).strict();var Rl=d({type:a(c()),attributes:a(Pl)}).strict();var $_=d({data:Rl}).strict();var Cl=d({url:c(),id:c(),destinations:T(gr)}).strict();var Nl=d({type:b(["shape"]),shape:b(["rectangle","circle","line"]),width:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fill:a(d({color:a(c()),opacity:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),stroke:a(d({color:a(c()),width:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),rectangle:a(d({width:f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),height:f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),cornerRadius:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))})),circle:a(d({radius:f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])})),line:a(d({length:f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),thickness:f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}))}).strict();var ma=d({width:a(f([g((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},h().int().gte(1).lte(4096)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().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([g((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},h().int().gte(1).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([O(12),O(15),O(23.976),O(24),O(25),O(29.97),O(30),O(48),O(50),O(59.94),O(60)])),speed:a(pl),keyframeInterval:a(f([g((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},h().int().gte(1).lte(300)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fixOffset:a(N()),fixRotation:a(N()),enhance:a(sl),filename:a(c())}).strict();var Tl=d({renditions:a(T(ha)),transcription:a(ll)}).strict();var Il=d({id:c(),status:a(b(["queued","importing","ready","failed","deleted","overwritten"])),url:a(c()),executionTime:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),transformation:a(ha),width:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),duration:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var jl=d({renditions:a(T(Il))}).strict();var Fl=d({id:c(),owner:c(),input:a(c()),source:a(c()),status:a(b(["queued","importing","ready","failed","deleted","overwritten"])),outputs:a(jl),width:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),duration:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),fps:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),created:a(c()),updated:a(c())}).strict();var ga=d({type:c(),id:c(),attributes:Fl}).strict();var A_=d({data:T(ga)}).strict();var w_=d({data:ga}).strict();var Dl=d({url:a(c()),outputs:a(Tl),destinations:a(gr),callback:a(c())}).strict();var Ll=d({src:c().min(1).regex(/\S/),effect:a(b(["fadeIn","fadeOut","fadeInFadeOut"])),volume:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Ul=d({type:b(["svg"]),src:c().min(1).max(500000)}).strict();var Ml=d({id:c(),merge:a(T(aa))}).strict();var Vl=d({horizontal:a(b(["left","center","right"])),vertical:a(b(["top","center","bottom"]))}).strict();var vl=d({preset:b(["typewriter"]),duration:a(f([g((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},h().gte(0.1).lte(30)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict(),ql=d({color:a(f([c().regex(/^#[A-Fa-f0-9]{6}$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),opacity:a(f([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),padding:a(f([g((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},h().gte(0).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),borderRadius:a(f([g((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},h().gte(0)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),wrap:a(N())}).strict();var Jl=d({family:a(c()),color:a(c()),opacity:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),size:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),weight:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),lineHeight:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var Bl=d({width:a(f([g((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},h().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(),Hl=d({type:b(["text"]),text:c(),width:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),font:a(Jl),background:a(ql),alignment:a(Vl),stroke:a(Bl),animation:a(vl),ellipsis:a(c())}).strict().superRefine((e,t)=>{if(e.background&&e.background.wrap===!0)t.addIssue({code:Ce.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 Gl=d({type:b(["text-to-image"]),prompt:c(),width:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().int()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),crop:a(_t)}).strict();var Wl=d({capture:f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),scale:f([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])}).strict();var Kl=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([O(12),O(15),O(23.976),O(24),O(25),O(29.97),O(30),O(48),O(50),O(59.94),O(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(ml),poster:a(dl),thumbnail:a(Wl),destinations:a(T(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:Ce.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:Ce.custom,message:'output requires either "resolution" or "size" (with width and height)'})});var Yl=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 re=d({from:a(Z()),to:a(Z()),start:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),length:a(f([g((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},h()),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 Ql=d({type:b(["audio"]),src:a(c().min(1).regex(/\S/)),prompt:a(c().max(4000)),model:a(c()),options:a(Re(c(),Z())),trim:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),speed:a(f([g((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},h().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:Ce.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([g((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},h().gte(-10).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),y:a(f([f([g((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},h().gte(-10).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)]))}).strict();var Xl=d({angle:a(f([f([g((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},h().gte(-360).lte(360)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)]))}).strict();var ef=d({x:a(f([f([g((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},h().gte(-100).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),y:a(f([f([g((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},h().gte(-100).lte(100)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)]))}).strict();var tf=d({type:b(["text-to-speech"]),text:c(),voice:c(),language:a(c()),newscaster:a(N()).default(!1),trim:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),speed:a(f([g((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},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),effect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"]))}).strict();var rf=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 nf=d({rotate:a(Xl),skew:a(ef),flip:a(Gp)}).strict();var of=d({type:b(["video"]),src:a(c().min(1).regex(/\S/)),prompt:a(c().max(4000)),model:a(c()),options:a(Re(c(),Z())),transcode:a(N()),trim:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),volume:a(f([f([g((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},h().gte(0).lte(1)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),volumeEffect:a(b(["none","fadeIn","fadeOut","fadeInFadeOut"])),speed:a(f([f([g((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},h().gte(0).lte(10)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),crop:a(_t),chromaKey:a(Ep)}).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:Ce.custom,message:'A media asset requires either "src" (a source URL) or "prompt" (to generate the asset). Provide one.',path:["src"]})});var sf=ea("type",[of,el,Hl,El,Ql,fl,Op,kl,Xp,Qp,rf,Nl,Ul,Gl,tl,tf]);var af=d({id:a(c()),asset:sf,start:f([f([g((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},h().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([g((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},h().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([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),width:a(f([g((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},h().gte(1).lte(3840)),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),height:a(f([g((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},h().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(Yl),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([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),T(re)])),transform:a(nf),alias:a(f([c().regex(/^[A-Za-z0-9_-]+$/),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))}).strict();var uf=af.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}),cf=d({clips:T(uf).min(1)}).strict();var pf=d({soundtrack:a(Ll),background:a(c()),fonts:a(T(Wp)),tracks:T(cf).min(1),cache:a(N())}).strict();var He=d({timeline:pf,output:Kl,merge:a(T(aa)),callback:a(c()),disk:a(b(["local","mount"])),instance:a(b(["s1","s2","a1"]))}).strict(),xa=He,lf=d({id:c(),owner:c(),plan:a(c()),status:b(["queued","fetching","preprocessing","rendering","generating","saving","done","failed"]),error:a(c()),duration:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),renderTime:a(f([g((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},h()),c().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),url:a(c()),poster:a(f([c(),Pe()])),thumbnail:a(f([c(),Pe()])),data:a(He),created:a(c()),updated:a(c())}).strict();var z_=d({success:N(),message:c(),response:lf}).strict();var ff=d({id:c(),name:c(),owner:c(),template:He}).strict();var S_=d({success:N(),message:c(),response:ff}).strict();var ya=d({name:c(),template:a(He)}).strict();var k_=d({body:He,path:a(S()),query:a(S())}).strict();var Z_=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 O_=d({body:a(S()),path:a(S()),query:a(S())}).strict();var E_=d({body:ya,path:a(S()),query:a(S())}).strict();var P_=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(),R_=hr(),C_=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 N_=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 T_=d({body:Ml,path:a(S()),query:a(S())}).strict();var I_=d({body:a(S()),path:d({url:c()}),query:a(S())}).strict();var j_=d({body:ia,path:a(S()),query:a(S()),headers:a(d({"Idempotency-Key":a(c())}))}).strict();var F_=d({body:ia,path:a(S()),query:a(S())}).strict();var D_=d({body:a(S()),path:d({id:c()}),query:a(S())}).strict();var L_=d({body:a(S()),path:a(S()),query:a(d({expand:a(b(["options"]))}))}).strict();var U_=d({body:a(S()),path:d({id:c()}),query:a(S())}).strict();var M_=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(),V_=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 q_=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 J_=d({body:Cl,path:a(S()),query:a(S())}).strict();var B_=d({body:a(S()),path:a(S()),query:a(S())}).strict();var H_=d({body:Dl,path:a(S()),query:a(S())}).strict();var G_=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(),W_=hr(),K_=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 Y_=d({body:a(S()),path:a(S()),query:a(S())}).strict();var df={alignment:"align",duration:"length",transitions:"transition",name:"family"},ba={"align.vertical":{center:"middle"},fit:{cover:"crop"}},mf=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"]),hf=/-(?:(?:Extra(?:Light|Bold)|SemiBold|Regular|Medium|Light|Black|Bold|Thin|Heavy)(?:Italic|Oblique)?|(?:Italic|Oblique))$/i,gf=new Set(["image","video","audio","luma"]);function Ne(e){let t=[],r=xa.safeParse(e);if(!r.success)for(let o of Af(r.error))t.push({...o,level:"error"});for(let o of _f(e))t.push(o);return{ok:!t.some((o)=>(o.level??"error")==="error"),issues:t}}function xe(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 xr(e){return e===1?"":"s"}function _f(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=yf(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((_,y)=>({ci:y,start:_?.start,len:_?.length})).filter((_)=>typeof _.start==="number"&&typeof _.len==="number");for(let _=0;_<l.length;_++)for(let y=_+1;y<l.length;y++){let A=l[_],x=l[y];if(A.start<x.start+x.len&&x.start<A.start+A.len){let[z,M]=A.ci<x.ci?[A.ci,x.ci]:[x.ci,A.ci];t.push({path:`timeline.tracks[${u}].clips`,code:"clip_overlap",level:"error",message:`clips [${z}] and [${M}] overlap in time — clips on one track must not `+"overlap (they flicker). Put simultaneous elements on separate tracks."})}}p.forEach((_,y)=>{let A=_?.asset,x=`timeline.tracks[${u}].clips[${y}]`,z=A?.font?.family;if(typeof z==="string"&&z.length>0){let se=xf(z,s,`${x}.asset.font.family`);if(se)t.push(se)}let M=A?.type;if(M==="html5"&&typeof A?.js==="string"&&A.js.length>0){let se=bf(A.js,`${x}.asset.js`);if(se)t.push(se)}let C=A?.src;if(typeof M==="string"&&gf.has(M)&&typeof C==="string")if(/^https:\/\//i.test(C)||/^alias:\/\//i.test(C));else if(/^data:/i.test(C))t.push({path:`${x}.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(C))t.push({path:`${x}.asset.src`,code:"src_not_https",level:"warning",message:"http:// sources are blocked/upgraded — use https://."});else t.push({path:`${x}.asset.src`,code:"src_not_public",level:"warning",message:`'${$f(C,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 xf(e,t,r){let n=e.toLowerCase();if(mf.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 yf(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(hf,"")}:null}function bf(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 $f(e,t){return e.length>t?`${e.slice(0,t)}…`:e}function Af(e){return e.issues.flatMap((t)=>wf(t))}function wf(e){let t=Sf(e.path);if(e.code==="unrecognized_keys"&&"keys"in e)return e.keys.map((n)=>({path:kf(t,n),code:e.code,message:`unrecognized key '${n}'`,suggestion:df[n]}));let r=zf(t,e);return[{path:t,code:e.code,message:e.message,...r?{suggestion:r}:{}}]}function zf(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 ba[n]?.[o]??ba[r]?.[o]}return}function Sf(e){return e.reduce((t,r)=>{if(typeof r==="number")return`${t}[${r}]`;let n=String(r);return t?`${t}.${n}`:n},"")}function kf(e,t){return e?`${e}.${t}`:t}var $a=new F("render").description("Submit a Shotstack Edit JSON to the render API").argument("<file>","Path to a Shotstack Edit JSON file").option("--env <name>",`Environment: ${I.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",B("render"),async()=>{let r=R(t.output),n=q(t.env),o=G(n.name),s=Of(process.cwd(),e),i=await Zf(s,"utf8"),u=JSON.parse(i),p=Ne(u);if(!p.ok){if(r==="json")console.log(JSON.stringify({ok:!1,issues:p.issues}));else console.error(xe(p.issues));return{exitCode:1,validation:p}}if(p.issues.length>0&&r!=="json")console.error(xe(p.issues));let l=v({apiKey:o,env:n}),_=t.watch?2:1,y="";for(let A=1;A<=_;A++){let x=await l.post("/render",u),z=x.response.id;if(y=z,!t.watch)return E(r,{id:z},z),{renderId:z,response:x.response};let M=await It(l,z,r,!0);if(M.status!=="failed")return{renderId:z,response:M,exitCode:0};let C=Pf(M.error);if(C&&A<_){if(r!=="json")console.error(`⚠ render failed (${M.error??"unknown"}) — looks transient, resubmitting ${A+1}/${_}…`);await Rf(2000);continue}if(r!=="json")console.error(C?`✗ render still failing after ${_} attempts. For a complex multi-scene edit, preview it client-side first: shotstack studio ${e}`:`✗ render failed: ${M.error??"unknown error"}`);return{renderId:z,response:M,exitCode:1}}return{renderId:y,exitCode:1}})}),Ef=/temporar|try again|time ?d? ?out|timeout|too many requests|service unavailable|unavailable|throttl/i;function Pf(e){return typeof e==="string"&&Ef.test(e)}function Rf(e){return new Promise((t)=>setTimeout(t,e))}import{readFile as Cf,writeFile as Nf,mkdtemp as Tf}from"node:fs/promises";import{tmpdir as If}from"node:os";import{join as Aa}from"node:path";import{spawn as jf}from"node:child_process";var wa="https://github.com/shotstack/shotstack-cli/issues/new?template=bug.yml",Ff=6000,Za=5,Oa=new F("feedback").description("Open a pre-filled GitHub issue with a flight-recorder dossier from your last 5 invocations").action(async()=>{let e=await Df(Za),t=Lf(e),r=Mf(e),n=`&title=${encodeURIComponent(r)}`,o=`${wa}${n}&body=${encodeURIComponent(t)}`;if(o.length<=Ff){ka(o),console.log("Opened browser with pre-filled issue. Review before submitting.");return}let s=await Tf(Aa(If(),"shotstack-feedback-")),i=Aa(s,"dossier.md");await Nf(i,t),ka(`${wa}${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 Df(e){let t=Ye(),r;try{r=await Cf(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 Lf(e){let t=[];if(t.push("## Environment"),t.push(`- Shotstack CLI: ${je}`),t.push(`- OS: ${process.platform}-${process.arch}`),t.push(""),t.push(`## Last ${Za} 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 ${Ye()}]`),t.push(""),t.push("## What I expected vs what happened"),t.push("<!-- Describe the issue, request, or question here. -->"),t.join(`
91
+ `)}var za=80,Uf="Feedback from shotstack CLI";function Mf(e){let t=e.find((o)=>o.error);if(t&&t.error)return yr(`${t.cmd}: ${t.error.name} — ${t.error.message}`);let r=e.find((o)=>Sa(o.response)!==null);if(r){let o=Sa(r.response);return yr(`Render failed: ${o}`)}let n=e.find((o)=>o.exit!==0);if(n)return yr(`${n.cmd} exited ${n.exit}`);return Uf}function Sa(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 yr(e){return e.length<=za?e:e.slice(0,za-1)+"…"}function ka(e){let t=process.platform==="win32",r=process.platform==="darwin"?"open":t?"cmd":"xdg-open",o=jf(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 Vf}from"node:fs/promises";import{resolve as vf}from"node:path";import{spawn as Ea,execSync as qf}from"node:child_process";var Pa="https://shotstack.studio",Jf=`${Pa}/api/share`,Bf=3000,Hf=6000,Ra=new F("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("--output <format>","Output format: text | json","text").action(async(e,t)=>{let r=R(t.output),n=vf(process.cwd(),e),o=await Vf(n,"utf8"),s=JSON.parse(o),i=Ne(s);if(!i.ok){if(r==="json")console.log(JSON.stringify({ok:!1,issues:i.issues}));else console.error(xe(i.issues));process.exit(1)}let{url:u,shortened:p}=await Gf(s,{shorten:t.shorten});if(!p&&u.length>Hf)console.error(`warning: encoded URL is ${u.length} characters; large templates may exceed browser URL limits.`);if(t.copy)await Yf(u);let l=t.open&&td()&&Xf(u);if(r==="json"||!l)E(r,{url:u,shortened:p},u)});async function Gf(e,t={}){if(t.shorten!==!1){let n=await Kf(e);if(n)return{url:n,shortened:!0};console.error("warning: could not reach the shotstack.studio share API; falling back to inline URL.")}return{url:Wf(e),shortened:!1}}function Wf(e){let t=Buffer.from(JSON.stringify(e),"utf8").toString("base64url");return`${Pa}/#json=${t}`}async function Kf(e){try{let t=await fetch(Jf,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(Bf)});if(!t.ok)return null;return(await t.json()).url??null}catch{return null}}async function Yf(e){let{cmd:t,args:r}=Qf();await new Promise((n,o)=>{let s=Ea(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 Qf(){if(process.platform==="darwin")return{cmd:"pbcopy",args:[]};if(process.platform==="win32")return{cmd:"clip",args:[]};return{cmd:"xclip",args:["-selection","clipboard"]}}function Xf(e){let{cmd:t,args:r}=ed(e);try{let n=Ea(t,r,{detached:!0,stdio:"ignore"});return n.on("error",()=>{}),n.unref(),!0}catch{return!1}}function ed(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 td(){if(process.platform==="darwin"||process.platform==="win32")return!0;if(!process.env.DISPLAY&&!process.env.WAYLAND_DISPLAY)return!1;try{return qf("command -v xdg-open",{stdio:"ignore"}),!0}catch{return!1}}import{readFile as rd}from"node:fs/promises";import{resolve as nd,extname as od}from"node:path";var sd=3000,id=new Set(["ready","failed","deleted","overwritten"]),ye=new F("ingest").description("Ingest source media via the Shotstack Ingest API: upload local files, fetch remote URLs, and manage stored sources");ye.command("upload <file>").description("Upload a local file and host it on Shotstack for use as an Edit asset src").option("--env <name>",`Environment: ${I.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",B("upload"),async()=>{let r=R(t.output),n=q(t.env,"ingest"),o=G(n.name),s=v({apiKey:o,env:n}),i=await rd(nd(process.cwd(),e)),u=await s.post("/upload"),{id:p,url:l}=u.data.attributes;return await ad(l,i,cd(e)),Ca(s,p,r,t.watch===!0)})});ye.command("fetch <url>").description("Ingest a remote URL into Shotstack-hosted storage").option("--env <name>",`Environment: ${I.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",B("fetch"),async()=>{let r=R(t.output),n=q(t.env,"ingest"),o=G(n.name),s=v({apiKey:o,env:n}),i=await s.post("/sources",{url:e});return Ca(s,i.data.id,r,t.watch===!0)})});ye.command("status <id>").description("Poll the status of an ingested source").option("--env <name>",`Environment: ${I.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",B("status"),async()=>{let r=R(t.output),n=q(t.env,"ingest"),o=G(n.name),s=v({apiKey:o,env:n}),i=await Na(s,e,r,t.watch===!0);return{renderId:i.id,response:yt(i),exitCode:i.status==="failed"?1:0}})});ye.command("list").description("List ingested sources").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{await J("ingest list",B("list"),async()=>{let t=R(e.output),r=q(e.env,"ingest"),n=G(r.name),i=(await v({apiKey:n,env:r}).get("/sources")).data.map((p)=>yt(p.attributes)),u=i.length?i.map((p)=>[p.id,p.status,p.source??""].join(" ").trimEnd()).join(`
92
+ `):"No sources.";return E(t,i,u),{response:{count:i.length}}})});ye.command("delete <id>").description("Delete an ingested source").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("ingest delete",B("delete"),async()=>{let r=R(t.output),n=q(t.env,"ingest"),o=G(n.name);return await v({apiKey:o,env:n}).del(`/sources/${encodeURIComponent(e)}`),E(r,{id:e,deleted:!0},`deleted ${e}`),{renderId:e,response:{id:e,deleted:!0}}})});async function Ca(e,t,r,n){if(!n)return E(r,{id:t},t),{renderId:t,response:{id:t}};let o=await Na(e,t,r,!0);return{renderId:t,response:yt(o),exitCode:o.status==="failed"?1:0}}async function Na(e,t,r,n,o=sd){while(!0){let i=(await e.get(`/sources/${encodeURIComponent(t)}`)).data.attributes;if(E(r,yt(i),pd(i)),!n||id.has(i.status))return i;await ld(o)}}async function ad(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 ie(n.status,o||void 0,`PUT upload → ${n.status} ${n.statusText}`)}}var ud={".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 cd(e){return ud[od(e).toLowerCase()]}function yt(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;return t}function pd(e){let t=[e.status];if(e.source)t.push(e.source);if(e.error)t.push(`error: ${e.error}`);return t.join(" ")}function ld(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 md(e,t){return(await e.get(`/templates/${encodeURIComponent(t)}`)).response}async function hd(e){return(await e.get("/templates")).response.templates}async function gd(e,t,r){return(await e.post("/templates",{name:t,template:r})).response.id}async function _d(e,t,r,n){let o={template:r};if(n)o.name=n;await e.put(`/templates/${encodeURIComponent(t)}`,o)}async function xd(e,t){await e.del(`/templates/${encodeURIComponent(t)}`)}async function Ta(e){let t=await fd(dd(process.cwd(),e),"utf8");return JSON.parse(t)}var be=new F("template").description("Work with saved Shotstack templates");be.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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("template get",B("get"),async()=>{let r=R(t.output),n=q(t.env),o=G(n.name),s=v({apiKey:o,env:n}),i=await md(s,e);return E(r,i.template,JSON.stringify(i.template,null,2)),{templateId:i.id,exitCode:0}})});be.command("list").description("List your saved templates (id and name), newest first").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{await J("template list",B("list"),async()=>{let t=R(e.output),r=q(e.env),n=G(r.name),o=v({apiKey:n,env:r}),s=await hd(o),i=s.length?s.map((u)=>`${u.id} ${u.name??""}`.trimEnd()).join(`
93
+ `):"No templates found";return E(t,s,i),{count:s.length,exitCode:0}})});be.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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("template create",B("create"),async()=>{let r=R(t.output),n=q(t.env),o=G(n.name),s=v({apiKey:o,env:n}),i=await Ta(e),u=await gd(s,t.name,i);return E(r,{id:u},u),{templateId:u,exitCode:0}})});be.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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t,r)=>{await J("template update",B("update"),async()=>{let n=R(r.output),o=q(r.env),s=G(o.name),i=v({apiKey:s,env:o}),u=await Ta(t);return await _d(i,e,u,r.name),E(n,{id:e,status:"updated"},`updated ${e}`),{templateId:e,exitCode:0}})});be.command("delete <id>").description("Delete a saved template").option("--env <name>",`Environment: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("template delete",B("delete"),async()=>{let r=R(t.output),n=q(t.env),o=G(n.name),s=v({apiKey:o,env:n});return await xd(s,e),E(r,{id:e,status:"deleted"},`deleted ${e}`),{templateId:e,exitCode:0}})});import{readFile as yd}from"node:fs/promises";import{resolve as bd}from"node:path";var Ia=new F("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=R(t.output),n=bd(process.cwd(),e),o=await yd(n,"utf8"),s;try{s=JSON.parse(o)}catch(l){let _=l instanceof Error?l.message:String(l),y={path:"<root>",code:"invalid_json",level:"error",message:_};if(r==="json")console.log(JSON.stringify({ok:!1,issues:[y]}));else console.error(`✗ ${e}: invalid JSON — ${_}`);process.exitCode=1;return}let i=Ne(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=xe(i.issues);if(p)console.error(l);else console.log(l)}process.exitCode=p?1:0});async function $d(e){return(await e.get("/models")).models}async function bt(e,t){return e.get(`/models/${encodeURIComponent(t)}`)}var ja=new F("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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("models",B("models"),async()=>{let r=R(t.output),n=q(t.env),o=G(n.name),s=v({apiKey:o,env:n});if(e){let u=await bt(s,e);return E(r,u,wd(u)),{response:{model:u.model,available:u.available}}}let i=await $d(s);return E(r,i,i.length?Ad(i):"No models."),{response:{count:i.length}}})});function $t(e){if(e.available===!0)return"available";if(e.available===!1)return`unavailable: ${e.unavailableReason??"no reason given"}`;return"availability unknown"}function Ad(e){let t=e.map((n)=>[n.model,n.type,$t(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(`
94
+ `)}function wd(e){let t=[`${e.model} ${e.type} ${$t(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(`
95
+ `)}var Fa=new Set(["done","failed"]),Da=3000,La=new F("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>`)",Od).option("--length <seconds>","Length of the clip the asset fills; models that generate to a duration use it",Ed).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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t,r)=>{await J("generate",B("generate"),async()=>{let n=R(r.output),o=q(r.env),s=G(o.name),i=v({apiKey:s,env:o}),u={model:e,prompt:t,options:r.options,length:r.length};if(r.quote)return Sd(i,u,n);return zd(i,u,n,r.watch===!0)})});async function zd(e,t,r,n,o=Da){let s=await bt(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 ${$t(s)}`);return{response:p,exitCode:1}}let i=await e.post("/generate",Ua(s,t));E(r,i,Ma(i));let u=i;if(!Fa.has(i.status)){if(n)u=await Zd(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 Sd(e,t,r){let n=await bt(e,t.model),o=await e.post("/generate/quote",Ua(n,t));return E(r,o,kd(o)),{response:o}}function kd(e){return`${e.ceiling?"up to ":""}${e.credits} ${e.credits===1?"credit":"credits"}`}function Ua(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 Zd(e,t,r,n=Da){while(!0){await Pd(n);let o=await e.get(`/generate/${encodeURIComponent(t)}`);if(E(r,o,Ma(o)),Fa.has(o.status))return o}}function Od(e){let t;try{t=JSON.parse(e)}catch{throw new We("Not valid JSON.")}if(t===null||typeof t!=="object"||Array.isArray(t))throw new We("Expected a JSON object.");return t}function Ed(e){let t=Number(e);if(!Number.isFinite(t)||t<=0)throw new We("Expected a positive number of seconds.");return t}function Ma(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 Pd(e){return new Promise((t)=>setTimeout(t,e))}var Rd=new Set(["done","failed"]),Cd=3000,Va=new F("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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e,t)=>{await J("analyze",B("analyze"),async()=>{let r=R(t.output),n=v({env:q(t.env)});return Nd(n,e,r)})});async function Nd(e,t,r,n=Cd){let o=await e.post("/analysis",{src:t});while(!Rd.has(o.status)){if(r!=="json")console.error(`${o.status} ${o.id}`);await Id(n),o=await e.get(`/analysis/${encodeURIComponent(o.id)}`)}if(o.status==="failed")return E(r,o,`failed error: ${o.error??"unknown error"}`),{response:o,exitCode:1};if(E(r,o.result,`done ${Td(o.result??{})}`),r!=="json")console.error("Print the full map with --output json.");return{response:o,exitCode:0}}function Td(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 Id(e){return new Promise((t)=>setTimeout(t,e))}import{createInterface as jd}from"node:readline";import{Writable as Fd}from"node:stream";var va=new F("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: ${I.join(" | ")}`).option("--output <format>","Output format: text | json","text").action(async(e)=>{let t=R(e.output),r=Ke(e.env),n=await Dd();if(!n)console.error("No API key provided."),process.exit(1);await Kr(r,n);let o=ze();E(t,{env:r,stored:!0,path:o},`Saved API key for ${r} → ${o} (chmod 600).`)}),qa=new F("logout").description("Remove a saved Shotstack API key").option("--env <name>",`Environment to forget: ${I.join(" | ")}`).option("--all","Remove saved keys for every environment").option("--output <format>","Output format: text | json","text").action(async(e)=>{let t=R(e.output);if(e.all){await Qr(),E(t,{cleared:!0},"Removed all saved API keys.");return}let r=Ke(e.env),n=await Yr(r);E(t,{env:r,removed:n},n?`Removed saved API key for ${r}.`:`No saved API key for ${r}.`)});async function Dd(){if(!process.stdin.isTTY){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf8").trim()}return Ld("Shotstack API key: ")}function Ld(e){return new Promise((t)=>{let r=!1,n=new Fd({write(s,i,u){if(!r)process.stdout.write(s);u()}}),o=jd({input:process.stdin,output:n,terminal:!0});o.question(e,(s)=>{o.close(),process.stdout.write(`
96
+ `),t(s.trim())}),r=!0})}var Ud=new F().name("shotstack").description("Command-line interface for the Shotstack video rendering API").version(je).addCommand($a).addCommand(on).addCommand(Ra).addCommand(ye).addCommand(be).addCommand(Ia).addCommand(ja).addCommand(La).addCommand(Va).addCommand(va).addCommand(qa).addCommand(Oa);try{await Ud.parseAsync(process.argv)}catch(e){process.exit(Md(e))}function Md(e){if(e instanceof Se||e instanceof ke)return console.error(e.message),1;if(e instanceof ie){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}