@limai.io/cli 0.4.4 → 0.4.5

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/cli.js CHANGED
@@ -1,31 +1,31 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var Ma=Object.create;var us=Object.defineProperty;var Ua=Object.getOwnPropertyDescriptor;var Wa=Object.getOwnPropertyNames;var Va=Object.getPrototypeOf,Ha=Object.prototype.hasOwnProperty;var P=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Ja=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Wa(e))!Ha.call(s,i)&&i!==t&&us(s,i,{get:()=>e[i],enumerable:!(n=Ua(e,i))||n.enumerable});return s};var I=(s,e,t)=>(t=s!=null?Ma(Va(s)):{},Ja(e||!s||!s.__esModule?us(t,"default",{value:s,enumerable:!0}):t,s));var Xe=P(vn=>{"use strict";var wt=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},_n=class extends wt{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};vn.CommanderError=wt;vn.InvalidArgumentError=_n});var It=P(xn=>{"use strict";var{InvalidArgumentError:qa}=Xe(),Sn=class{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}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){return t===this.defaultValue||!Array.isArray(t)?[e]: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,n)=>{if(!this.argChoices.includes(t))throw new qa(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Ga(s){let e=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+e+">":"["+e+"]"}xn.Argument=Sn;xn.humanReadableArgName=Ga});var On=P(Rn=>{"use strict";var{humanReadableArgName:Ka}=It(),Tn=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,r)=>i.name().localeCompare(r.name())),t}compareOptions(e,t){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),r=n.long&&e._findOption(n.long);!i&&!r?t.push(n):n.long&&!r?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(r=>!r.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>Ka(n)).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((n,i)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth??80;function r(d,m){return t.formatItem(d,n,m,t)}let o=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],a=t.commandDescription(e);a.length>0&&(o=o.concat([t.boxWrap(t.styleCommandDescription(a),i),""]));let u=t.visibleArguments(e).map(d=>r(t.styleArgumentTerm(t.argumentTerm(d)),t.styleArgumentDescription(t.argumentDescription(d))));u.length>0&&(o=o.concat([t.styleTitle("Arguments:"),...u,""]));let l=t.visibleOptions(e).map(d=>r(t.styleOptionTerm(t.optionTerm(d)),t.styleOptionDescription(t.optionDescription(d))));if(l.length>0&&(o=o.concat([t.styleTitle("Options:"),...l,""])),t.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(m=>r(t.styleOptionTerm(t.optionTerm(m)),t.styleOptionDescription(t.optionDescription(m))));d.length>0&&(o=o.concat([t.styleTitle("Global Options:"),...d,""]))}let c=t.visibleCommands(e).map(d=>r(t.styleSubcommandTerm(t.subcommandTerm(d)),t.styleSubcommandDescription(t.subcommandDescription(d))));return c.length>0&&(o=o.concat([t.styleTitle("Commands:"),...c,""])),o.join(`
3
- `)}displayWidth(e){return ls(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,i){let o=" ".repeat(2);if(!n)return o+e;let a=e.padEnd(t+e.length-i.displayWidth(e)),u=2,c=(this.helpWidth??80)-t-u-2,d;return c<this.minWidthToWrap||i.preformatted(n)?d=n:d=i.boxWrap(n,c).replace(/\n/g,`
2
+ "use strict";var Ma=Object.create;var cs=Object.defineProperty;var Ua=Object.getOwnPropertyDescriptor;var Wa=Object.getOwnPropertyNames;var Va=Object.getPrototypeOf,Ha=Object.prototype.hasOwnProperty;var P=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Ja=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Wa(e))!Ha.call(s,i)&&i!==t&&cs(s,i,{get:()=>e[i],enumerable:!(n=Ua(e,i))||n.enumerable});return s};var I=(s,e,t)=>(t=s!=null?Ma(Va(s)):{},Ja(e||!s||!s.__esModule?cs(t,"default",{value:s,enumerable:!0}):t,s));var Xe=P(vn=>{"use strict";var wt=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},_n=class extends wt{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};vn.CommanderError=wt;vn.InvalidArgumentError=_n});var It=P(xn=>{"use strict";var{InvalidArgumentError:qa}=Xe(),Sn=class{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}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){return t===this.defaultValue||!Array.isArray(t)?[e]: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,n)=>{if(!this.argChoices.includes(t))throw new qa(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Ga(s){let e=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+e+">":"["+e+"]"}xn.Argument=Sn;xn.humanReadableArgName=Ga});var On=P(Rn=>{"use strict";var{humanReadableArgName:Ka}=It(),Tn=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,r)=>i.name().localeCompare(r.name())),t}compareOptions(e,t){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),r=n.long&&e._findOption(n.long);!i&&!r?t.push(n):n.long&&!r?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(r=>!r.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>Ka(n)).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((n,i)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth??80;function r(d,m){return t.formatItem(d,n,m,t)}let o=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],a=t.commandDescription(e);a.length>0&&(o=o.concat([t.boxWrap(t.styleCommandDescription(a),i),""]));let u=t.visibleArguments(e).map(d=>r(t.styleArgumentTerm(t.argumentTerm(d)),t.styleArgumentDescription(t.argumentDescription(d))));u.length>0&&(o=o.concat([t.styleTitle("Arguments:"),...u,""]));let l=t.visibleOptions(e).map(d=>r(t.styleOptionTerm(t.optionTerm(d)),t.styleOptionDescription(t.optionDescription(d))));if(l.length>0&&(o=o.concat([t.styleTitle("Options:"),...l,""])),t.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(m=>r(t.styleOptionTerm(t.optionTerm(m)),t.styleOptionDescription(t.optionDescription(m))));d.length>0&&(o=o.concat([t.styleTitle("Global Options:"),...d,""]))}let c=t.visibleCommands(e).map(d=>r(t.styleSubcommandTerm(t.subcommandTerm(d)),t.styleSubcommandDescription(t.subcommandDescription(d))));return c.length>0&&(o=o.concat([t.styleTitle("Commands:"),...c,""])),o.join(`
3
+ `)}displayWidth(e){return ds(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,i){let o=" ".repeat(2);if(!n)return o+e;let a=e.padEnd(t+e.length-i.displayWidth(e)),u=2,c=(this.helpWidth??80)-t-u-2,d;return c<this.minWidthToWrap||i.preformatted(n)?d=n:d=i.boxWrap(n,c).replace(/\n/g,`
4
4
  `+" ".repeat(t+u)),o+a+" ".repeat(u)+d.replace(/\n/g,`
5
5
  ${o}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,r=[];return n.forEach(o=>{let a=o.match(i);if(a===null){r.push("");return}let u=[a.shift()],l=this.displayWidth(u[0]);a.forEach(c=>{let d=this.displayWidth(c);if(l+d<=t){u.push(c),l+=d;return}r.push(u.join(""));let m=c.trimStart();u=[m],l=this.displayWidth(m)}),r.push(u.join(""))}),r.join(`
6
- `)}};function ls(s){let e=/\x1b\[\d*(;\d*)*m/g;return s.replace(e,"")}Rn.Help=Tn;Rn.stripColor=ls});var Pn=P($n=>{"use strict";var{InvalidArgumentError:Ya}=Xe(),kn=class{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 n=za(e);this.short=n.shortFlag,this.long=n.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;return typeof e=="string"&&(t={[e]:!0}),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){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new Ya(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?cs(this.name().replace(/^no-/,"")):cs(this.name())}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Bn=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,r=i!==void 0?i:!1;return t.negate===(r===e)}};function cs(s){return s.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function za(s){let e,t,n=/^-[^-]$/,i=/^--[^-]/,r=s.split(/[ |,]+/).concat("guard");if(n.test(r[0])&&(e=r.shift()),i.test(r[0])&&(t=r.shift()),!e&&n.test(r[0])&&(e=r.shift()),!e&&i.test(r[0])&&(e=t,t=r.shift()),r[0].startsWith("-")){let o=r[0],a=`option creation failed due to '${o}' in option flags '${s}'`;throw/^-[^-][^-]/.test(o)?new Error(`${a}
6
+ `)}};function ds(s){let e=/\x1b\[\d*(;\d*)*m/g;return s.replace(e,"")}Rn.Help=Tn;Rn.stripColor=ds});var Pn=P($n=>{"use strict";var{InvalidArgumentError:Ya}=Xe(),kn=class{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 n=za(e);this.short=n.shortFlag,this.long=n.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;return typeof e=="string"&&(t={[e]:!0}),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){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new Ya(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?ps(this.name().replace(/^no-/,"")):ps(this.name())}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Bn=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,r=i!==void 0?i:!1;return t.negate===(r===e)}};function ps(s){return s.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function za(s){let e,t,n=/^-[^-]$/,i=/^--[^-]/,r=s.split(/[ |,]+/).concat("guard");if(n.test(r[0])&&(e=r.shift()),i.test(r[0])&&(t=r.shift()),!e&&n.test(r[0])&&(e=r.shift()),!e&&i.test(r[0])&&(e=t,t=r.shift()),r[0].startsWith("-")){let o=r[0],a=`option creation failed due to '${o}' in option flags '${s}'`;throw/^-[^-][^-]/.test(o)?new Error(`${a}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
9
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(o)?new Error(`${a}
10
10
  - too many short flags`):i.test(o)?new Error(`${a}
11
11
  - too many long flags`):new Error(`${a}
12
- - unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${s}'.`);return{shortFlag:e,longFlag:t}}$n.Option=kn;$n.DualOptions=Bn});var ps=P(ds=>{"use strict";function Xa(s,e){if(Math.abs(s.length-e.length)>3)return Math.max(s.length,e.length);let t=[];for(let n=0;n<=s.length;n++)t[n]=[n];for(let n=0;n<=e.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=s.length;i++){let r=1;s[i-1]===e[n-1]?r=0:r=1,t[i][n]=Math.min(t[i-1][n]+1,t[i][n-1]+1,t[i-1][n-1]+r),i>1&&n>1&&s[i-1]===e[n-2]&&s[i-2]===e[n-1]&&(t[i][n]=Math.min(t[i][n],t[i-2][n-2]+1))}return t[s.length][e.length]}function Qa(s,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=s.startsWith("--");t&&(s=s.slice(2),e=e.map(o=>o.slice(2)));let n=[],i=3,r=.4;return e.forEach(o=>{if(o.length<=1)return;let a=Xa(s,o),u=Math.max(s.length,o.length);(u-a)/u>r&&(a<i?(i=a,n=[o]):a===i&&n.push(o))}),n.sort((o,a)=>o.localeCompare(a)),t&&(n=n.map(o=>`--${o}`)),n.length>1?`
12
+ - unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${s}'.`);return{shortFlag:e,longFlag:t}}$n.Option=kn;$n.DualOptions=Bn});var Ds=P(ms=>{"use strict";function Xa(s,e){if(Math.abs(s.length-e.length)>3)return Math.max(s.length,e.length);let t=[];for(let n=0;n<=s.length;n++)t[n]=[n];for(let n=0;n<=e.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=s.length;i++){let r=1;s[i-1]===e[n-1]?r=0:r=1,t[i][n]=Math.min(t[i-1][n]+1,t[i][n-1]+1,t[i-1][n-1]+r),i>1&&n>1&&s[i-1]===e[n-2]&&s[i-2]===e[n-1]&&(t[i][n]=Math.min(t[i][n],t[i-2][n-2]+1))}return t[s.length][e.length]}function Qa(s,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=s.startsWith("--");t&&(s=s.slice(2),e=e.map(o=>o.slice(2)));let n=[],i=3,r=.4;return e.forEach(o=>{if(o.length<=1)return;let a=Xa(s,o),u=Math.max(s.length,o.length);(u-a)/u>r&&(a<i?(i=a,n=[o]):a===i&&n.push(o))}),n.sort((o,a)=>o.localeCompare(a)),t&&(n=n.map(o=>`--${o}`)),n.length>1?`
13
13
  (Did you mean one of ${n.join(", ")}?)`:n.length===1?`
14
- (Did you mean ${n[0]}?)`:""}ds.suggestSimilar=Qa});var gs=P(Un=>{"use strict";var Za=require("events").EventEmitter,Nn=require("child_process"),pe=require("path"),At=require("fs"),$=require("process"),{Argument:eu,humanReadableArgName:tu}=It(),{CommanderError:jn}=Xe(),{Help:nu,stripColor:iu}=On(),{Option:ms,DualOptions:su}=Pn(),{suggestSimilar:Ds}=ps(),Ln=class s extends Za{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=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._savedState=null,this._outputConfiguration={writeOut:t=>$.stdout.write(t),writeErr:t=>$.stderr.write(t),outputError:(t,n)=>n(t),getOutHelpWidth:()=>$.stdout.isTTY?$.stdout.columns:void 0,getErrHelpWidth:()=>$.stderr.isTTY?$.stderr.columns:void 0,getOutHasColors:()=>Mn()??($.stdout.isTTY&&$.stdout.hasColors?.()),getErrHasColors:()=>Mn()??($.stderr.isTTY&&$.stderr.hasColors?.()),stripColor:t=>iu(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,n){let i=t,r=n;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(o);return i&&(u.description(i),u._executableHandler=!0),r.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(r.noHelp||r.hidden),u._executableFile=r.executableFile||null,a&&u.arguments(a),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),i?this:u}createCommand(e){return new s(e)}createHelp(){return Object.assign(new nu,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
14
+ (Did you mean ${n[0]}?)`:""}ms.suggestSimilar=Qa});var Fs=P(Un=>{"use strict";var Za=require("events").EventEmitter,Nn=require("child_process"),pe=require("path"),At=require("fs"),$=require("process"),{Argument:eu,humanReadableArgName:tu}=It(),{CommanderError:jn}=Xe(),{Help:nu,stripColor:iu}=On(),{Option:fs,DualOptions:su}=Pn(),{suggestSimilar:gs}=Ds(),Ln=class s extends Za{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=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._savedState=null,this._outputConfiguration={writeOut:t=>$.stdout.write(t),writeErr:t=>$.stderr.write(t),outputError:(t,n)=>n(t),getOutHelpWidth:()=>$.stdout.isTTY?$.stdout.columns:void 0,getErrHelpWidth:()=>$.stderr.isTTY?$.stderr.columns:void 0,getOutHasColors:()=>Mn()??($.stdout.isTTY&&$.stdout.hasColors?.()),getErrHasColors:()=>Mn()??($.stderr.isTTY&&$.stderr.hasColors?.()),stripColor:t=>iu(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,n){let i=t,r=n;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(o);return i&&(u.description(i),u._executableHandler=!0),r.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(r.noHelp||r.hidden),u._executableFile=r.executableFile||null,a&&u.arguments(a),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),i?this:u}createCommand(e){return new s(e)}createHelp(){return Object.assign(new nu,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
15
15
  - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new eu(e,t)}argument(e,t,n,i){let r=this.createArgument(e,t);return typeof n=="function"?r.default(i).argParser(n):r.default(n),this.addArgument(r),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 new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new 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[,n,i]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",o=this.createCommand(n);return o.helpOption(!1),i&&o.arguments(i),r&&o.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
16
- Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new jn(e,t,n)),$.exit(e)}action(e){let t=n=>{let i=this.registeredArguments.length,r=n.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new ms(e,t)}_callParseArg(e,t,n,i){try{return e.parseArg(t,n)}catch(r){if(r.code==="commander.invalidArgument"){let o=`${i} ${r.message}`;this.error(o,{exitCode:r.exitCode,code:r.code})}throw r}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
17
- - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),n=t(e).find(i=>this._findCommand(i));if(n){let i=t(this._findCommand(n)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(r,o,a)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let u=this.getOptionValue(n);r!==null&&e.parseArg?r=this._callParseArg(e,r,u,o):r!==null&&e.variadic&&(r=e._concatValue(r,u)),r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(n,r,a)};return this.on("option:"+t,r=>{let o=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let o=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,o,"env")}),this}_optionEx(e,t,n,i,r){if(typeof t=="object"&&t instanceof ms)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,n);if(o.makeOptionMandatory(!!e.mandatory),typeof i=="function")o.default(r).argParser(i);else if(i instanceof RegExp){let a=i;i=(u,l)=>{let c=a.exec(u);return c?c[0]:l},o.default(r).argParser(i)}else o.default(i);return this.addOption(o)}option(e,t,n,i){return this._optionEx({},e,t,n,i)}requiredOption(e,t,n,i){return this._optionEx({mandatory:!0},e,t,n,i)}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 new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){$.versions?.electron&&(t.from="electron");let i=$.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(t.from="eval")}e===void 0&&(e=$.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":$.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
16
+ Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new jn(e,t,n)),$.exit(e)}action(e){let t=n=>{let i=this.registeredArguments.length,r=n.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new fs(e,t)}_callParseArg(e,t,n,i){try{return e.parseArg(t,n)}catch(r){if(r.code==="commander.invalidArgument"){let o=`${i} ${r.message}`;this.error(o,{exitCode:r.exitCode,code:r.code})}throw r}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
17
+ - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),n=t(e).find(i=>this._findCommand(i));if(n){let i=t(this._findCommand(n)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(r,o,a)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let u=this.getOptionValue(n);r!==null&&e.parseArg?r=this._callParseArg(e,r,u,o):r!==null&&e.variadic&&(r=e._concatValue(r,u)),r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(n,r,a)};return this.on("option:"+t,r=>{let o=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let o=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,o,"env")}),this}_optionEx(e,t,n,i,r){if(typeof t=="object"&&t instanceof fs)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,n);if(o.makeOptionMandatory(!!e.mandatory),typeof i=="function")o.default(r).argParser(i);else if(i instanceof RegExp){let a=i;i=(u,l)=>{let c=a.exec(u);return c?c[0]:l},o.default(r).argParser(i)}else o.default(i);return this.addOption(o)}option(e,t,n,i){return this._optionEx({},e,t,n,i)}requiredOption(e,t,n,i){return this._optionEx({mandatory:!0},e,t,n,i)}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 new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){$.versions?.electron&&(t.from="electron");let i=$.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(t.from="eval")}e===void 0&&(e=$.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":$.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
18
  - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(At.existsSync(e))return;let i=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",r=`'${e}' does not exist
19
19
  - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${i}`;throw new Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(c,d){let m=pe.resolve(c,d);if(At.existsSync(m))return m;if(i.includes(pe.extname(d)))return;let h=i.find(F=>At.existsSync(`${m}${F}`));if(h)return`${m}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let c;try{c=At.realpathSync(this._scriptPath)}catch{c=this._scriptPath}a=pe.resolve(pe.dirname(c),a)}if(a){let c=r(a,o);if(!c&&!e._executableFile&&this._scriptPath){let d=pe.basename(this._scriptPath,pe.extname(this._scriptPath));d!==this._name&&(c=r(a,`${d}-${e._name}`))}o=c||o}n=i.includes(pe.extname(o));let u;$.platform!=="win32"?n?(t.unshift(o),t=fs($.execArgv).concat(t),u=Nn.spawn($.argv[0],t,{stdio:"inherit"})):u=Nn.spawn(o,t,{stdio:"inherit"}):(this._checkForMissingExecutable(o,a,e._name),t.unshift(o),t=fs($.execArgv).concat(t),u=Nn.spawn($.execPath,t,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{$.on(d,()=>{u.killed===!1&&u.exitCode===null&&u.kill(d)})});let l=this._exitCallback;u.on("close",c=>{c=c??1,l?l(new jn(c,"commander.executeSubCommandAsync","(close)")):$.exit(c)}),u.on("error",c=>{if(c.code==="ENOENT")this._checkForMissingExecutable(o,a,e._name);else if(c.code==="EACCES")throw new Error(`'${o}' not executable`);if(!l)$.exit(1);else{let d=new jn(1,"commander.executeSubCommandAsync","(error)");d.nestedError=c,l(d)}}),this.runningCommand=u}_dispatchSubcommand(e,t,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(n));else return i._parseCommand(t,n)}),r}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,r)=>{let o=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;o=this._callParseArg(n,i,r,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,i)=>{let r=n.defaultValue;n.variadic?i<this.args.length?(r=this.args.slice(i),n.parseArg&&(r=r.reduce((o,a)=>e(n,a,o),n.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],n.parseArg&&(r=e(n,r,n.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(o=>{i.push({hookedCommand:r,callback:o})})}),t==="postAction"&&i.reverse(),i.forEach(r=>{n=this._chainOrCall(n,()=>r.callback(r.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(r=>{i=this._chainOrCall(i,()=>r(this,t))}),i}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.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);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(r,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)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=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(r=>n.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],i=t,r=e.slice();function o(u){return u.length>1&&u[0]==="-"}let a=null;for(;r.length;){let u=r.shift();if(u==="--"){i===n&&i.push(u),i.push(...r);break}if(a&&!o(u)){this.emit(`option:${a.name()}`,u);continue}if(a=null,o(u)){let l=this._findOption(u);if(l){if(l.required){let c=r.shift();c===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,c)}else if(l.optional){let c=null;r.length>0&&!o(r[0])&&(c=r.shift()),this.emit(`option:${l.name()}`,c)}else this.emit(`option:${l.name()}`);a=l.variadic?l:null;continue}}if(u.length>2&&u[0]==="-"&&u[1]!=="-"){let l=this._findOption(`-${u[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,u.slice(2)):(this.emit(`option:${l.name()}`),r.unshift(`-${u.slice(2)}`));continue}}if(/^--[^=]+=/.test(u)){let l=u.indexOf("="),c=this._findOption(u.slice(0,l));if(c&&(c.required||c.optional)){this.emit(`option:${c.name()}`,u.slice(l+1));continue}}if(o(u)&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(u)){t.push(u),r.length>0&&n.push(...r);break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){t.push(u),r.length>0&&t.push(...r);break}else if(this._defaultCommandName){n.push(u),r.length>0&&n.push(...r);break}}if(this._passThroughOptions){i.push(u),r.length>0&&i.push(...r);break}i.push(u)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let i=this.options[n].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
21
+ - ${i}`;throw new Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(c,d){let m=pe.resolve(c,d);if(At.existsSync(m))return m;if(i.includes(pe.extname(d)))return;let h=i.find(F=>At.existsSync(`${m}${F}`));if(h)return`${m}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let c;try{c=At.realpathSync(this._scriptPath)}catch{c=this._scriptPath}a=pe.resolve(pe.dirname(c),a)}if(a){let c=r(a,o);if(!c&&!e._executableFile&&this._scriptPath){let d=pe.basename(this._scriptPath,pe.extname(this._scriptPath));d!==this._name&&(c=r(a,`${d}-${e._name}`))}o=c||o}n=i.includes(pe.extname(o));let u;$.platform!=="win32"?n?(t.unshift(o),t=hs($.execArgv).concat(t),u=Nn.spawn($.argv[0],t,{stdio:"inherit"})):u=Nn.spawn(o,t,{stdio:"inherit"}):(this._checkForMissingExecutable(o,a,e._name),t.unshift(o),t=hs($.execArgv).concat(t),u=Nn.spawn($.execPath,t,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{$.on(d,()=>{u.killed===!1&&u.exitCode===null&&u.kill(d)})});let l=this._exitCallback;u.on("close",c=>{c=c??1,l?l(new jn(c,"commander.executeSubCommandAsync","(close)")):$.exit(c)}),u.on("error",c=>{if(c.code==="ENOENT")this._checkForMissingExecutable(o,a,e._name);else if(c.code==="EACCES")throw new Error(`'${o}' not executable`);if(!l)$.exit(1);else{let d=new jn(1,"commander.executeSubCommandAsync","(error)");d.nestedError=c,l(d)}}),this.runningCommand=u}_dispatchSubcommand(e,t,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(n));else return i._parseCommand(t,n)}),r}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,r)=>{let o=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;o=this._callParseArg(n,i,r,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,i)=>{let r=n.defaultValue;n.variadic?i<this.args.length?(r=this.args.slice(i),n.parseArg&&(r=r.reduce((o,a)=>e(n,a,o),n.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],n.parseArg&&(r=e(n,r,n.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(o=>{i.push({hookedCommand:r,callback:o})})}),t==="postAction"&&i.reverse(),i.forEach(r=>{n=this._chainOrCall(n,()=>r.callback(r.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(r=>{i=this._chainOrCall(i,()=>r(this,t))}),i}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.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);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(r,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)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=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(r=>n.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],i=t,r=e.slice();function o(u){return u.length>1&&u[0]==="-"}let a=null;for(;r.length;){let u=r.shift();if(u==="--"){i===n&&i.push(u),i.push(...r);break}if(a&&!o(u)){this.emit(`option:${a.name()}`,u);continue}if(a=null,o(u)){let l=this._findOption(u);if(l){if(l.required){let c=r.shift();c===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,c)}else if(l.optional){let c=null;r.length>0&&!o(r[0])&&(c=r.shift()),this.emit(`option:${l.name()}`,c)}else this.emit(`option:${l.name()}`);a=l.variadic?l:null;continue}}if(u.length>2&&u[0]==="-"&&u[1]!=="-"){let l=this._findOption(`-${u[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,u.slice(2)):(this.emit(`option:${l.name()}`),r.unshift(`-${u.slice(2)}`));continue}}if(/^--[^=]+=/.test(u)){let l=u.indexOf("="),c=this._findOption(u.slice(0,l));if(c&&(c.required||c.optional)){this.emit(`option:${c.name()}`,u.slice(l+1));continue}}if(o(u)&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(u)){t.push(u),r.length>0&&n.push(...r);break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){t.push(u),r.length>0&&t.push(...r);break}else if(this._defaultCommandName){n.push(u),r.length>0&&n.push(...r);break}}if(this._passThroughOptions){i.push(u),r.length>0&&i.push(...r);break}i.push(u)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let i=this.options[n].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0}));let n=t||{},i=n.exitCode||1,r=n.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in $.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,$.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new su(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"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 n=o=>{let a=o.attributeName(),u=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),c=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&u===!1||l.presetArg!==void 0&&u===l.presetArg)?l:c||o},i=o=>{let a=n(o),u=a.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},r=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let o=r.createHelp().visibleOptions(r).filter(a=>a.long).map(a=>a.long);i=i.concat(o),r=r.parent}while(r&&!r._enablePositionalOptions);t=Ds(e,i)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),t=Ds(e,i)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let i=this.createOption(t,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
24
+ `),this.outputHelp({error:!0}));let n=t||{},i=n.exitCode||1,r=n.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in $.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,$.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new su(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"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 n=o=>{let a=o.attributeName(),u=this.getOptionValue(a),l=this.options.find(d=>d.negate&&a===d.attributeName()),c=this.options.find(d=>!d.negate&&a===d.attributeName());return l&&(l.presetArg===void 0&&u===!1||l.presetArg!==void 0&&u===l.presetArg)?l:c||o},i=o=>{let a=n(o),u=a.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},r=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let o=r.createHelp().visibleOptions(r).filter(a=>a.long).map(a=>a.long);i=i.concat(o),r=r.parent}while(r&&!r._enablePositionalOptions);t=gs(e,i)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),t=gs(e,i)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let i=this.createOption(t,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
25
25
  `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(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]),e===t._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(n=>tu(n));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){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=pe.basename(e,pe.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=t.formatHelp(this,t);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let t=!!e.error,n,i,r;return t?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),r=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),r=this._outputConfiguration.getOutHelpWidth()),{error:t,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:r}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(o=>o.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let r=this.helpInformation({error:n.error});if(t&&(r=t(r),typeof r!="string"&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(o=>o.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=Number($.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let o;typeof t=="function"?o=t({error:r.error,command:r.command}):o=t,o&&r.write(`${o}
27
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function fs(s){return s.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:n=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],n=r[3],i=r[4]),t&&i!=="0"?`${t}=${n}:${parseInt(i)+1}`:e})}function Mn(){if($.env.NO_COLOR||$.env.FORCE_COLOR==="0"||$.env.FORCE_COLOR==="false")return!1;if($.env.FORCE_COLOR||$.env.CLICOLOR_FORCE!==void 0)return!0}Un.Command=Ln;Un.useColor=Mn});var ys=P(X=>{"use strict";var{Argument:hs}=It(),{Command:Wn}=gs(),{CommanderError:ru,InvalidArgumentError:Fs}=Xe(),{Help:ou}=On(),{Option:Cs}=Pn();X.program=new Wn;X.createCommand=s=>new Wn(s);X.createOption=(s,e)=>new Cs(s,e);X.createArgument=(s,e)=>new hs(s,e);X.Command=Wn;X.Option=Cs;X.Argument=hs;X.Help=ou;X.CommanderError=ru;X.InvalidArgumentError=Fs;X.InvalidOptionArgumentError=Fs});var Ir=P((Wp,tl)=>{tl.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var Fi=P((Vp,_r)=>{"use strict";var en=Object.assign({},Ir()),Ar=Object.keys(en);Object.defineProperty(en,"random",{get(){let s=Math.floor(Math.random()*Ar.length),e=Ar[s];return en[e]}});_r.exports=en});var io=P((ED,no)=>{"use strict";var Oi=class{constructor(e,t,n){this.etaBufferLength=e||100,this.valueBuffer=[n],this.timeBuffer=[t],this.eta="0"}update(e,t,n){this.valueBuffer.push(t),this.timeBuffer.push(e),this.calculate(n-t)}getTime(){return this.eta}calculate(e){let t=this.valueBuffer.length,n=Math.min(this.etaBufferLength,t),i=this.valueBuffer[t-1]-this.valueBuffer[t-n],r=this.timeBuffer[t-1]-this.timeBuffer[t-n],o=i/r;this.valueBuffer=this.valueBuffer.slice(-this.etaBufferLength),this.timeBuffer=this.timeBuffer.slice(-this.etaBufferLength);let a=Math.ceil(e/o/1e3);isNaN(a)?this.eta="NULL":isFinite(a)?a>1e7?this.eta="INF":a<0?this.eta=0:this.eta=a:this.eta="INF"}};no.exports=Oi});var Bi=P((bD,so)=>{"use strict";var _e=require("readline"),ki=class{constructor(e){this.stream=e,this.linewrap=!0,this.dy=0}cursorSave(){this.stream.isTTY&&this.stream.write("\x1B7")}cursorRestore(){this.stream.isTTY&&this.stream.write("\x1B8")}cursor(e){this.stream.isTTY&&(e?this.stream.write("\x1B[?25h"):this.stream.write("\x1B[?25l"))}cursorTo(e=null,t=null){this.stream.isTTY&&_e.cursorTo(this.stream,e,t)}cursorRelative(e=null,t=null){this.stream.isTTY&&(this.dy=this.dy+t,_e.moveCursor(this.stream,e,t))}cursorRelativeReset(){this.stream.isTTY&&(_e.moveCursor(this.stream,0,-this.dy),_e.cursorTo(this.stream,0,null),this.dy=0)}clearRight(){this.stream.isTTY&&_e.clearLine(this.stream,1)}clearLine(){this.stream.isTTY&&_e.clearLine(this.stream,0)}clearBottom(){this.stream.isTTY&&_e.clearScreenDown(this.stream)}newline(){this.stream.write(`
28
- `),this.dy++}write(e,t=!1){this.linewrap===!0&&t===!1?this.stream.write(e.substr(0,this.getWidth())):this.stream.write(e)}lineWrapping(e){this.stream.isTTY&&(this.linewrap=e,e?this.stream.write("\x1B[?7h"):this.stream.write("\x1B[?7l"))}isTTY(){return this.stream.isTTY===!0}getWidth(){return this.stream.columns||(this.stream.isTTY?80:200)}};so.exports=ki});var oo=P((wD,ro)=>{"use strict";ro.exports=({onlyFirst:s=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,s?void 0:"g")}});var uo=P((ID,ao)=>{"use strict";var jl=oo();ao.exports=s=>typeof s=="string"?s.replace(jl(),""):s});var co=P((AD,$i)=>{"use strict";var lo=s=>Number.isNaN(s)?!1:s>=4352&&(s<=4447||s===9001||s===9002||11904<=s&&s<=12871&&s!==12351||12880<=s&&s<=19903||19968<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65131||65281<=s&&s<=65376||65504<=s&&s<=65510||110592<=s&&s<=110593||127488<=s&&s<=127569||131072<=s&&s<=262141);$i.exports=lo;$i.exports.default=lo});var mo=P((_D,po)=>{"use strict";po.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var fo=P((vD,Pi)=>{"use strict";var Ll=uo(),Ml=co(),Ul=mo(),Do=s=>{if(typeof s!="string"||s.length===0||(s=Ll(s),s.length===0))return 0;s=s.replace(Ul()," ");let e=0;for(let t=0;t<s.length;t++){let n=s.codePointAt(t);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&t++,e+=Ml(n)?2:1)}return e};Pi.exports=Do;Pi.exports.default=Do});var Ni=P((SD,go)=>{"use strict";go.exports=function(e,t,n){if(t.autopadding!==!0)return e;function i(r,o){return(t.autopaddingChar+r).slice(-o)}return n==="percentage"?i(e,3):e}});var ji=P((xD,ho)=>{"use strict";ho.exports=function(e,t){let n=Math.round(e*t.barsize),i=t.barsize-n;return t.barCompleteString.substr(0,n)+t.barGlue+t.barIncompleteString.substr(0,i)}});var Li=P((TD,Fo)=>{"use strict";Fo.exports=function(e,t,n){function i(o){return n?n*Math.round(o/n):o}function r(o){return(t.autopaddingChar+o).slice(-2)}return e>3600?r(Math.floor(e/3600))+"h"+r(i(e%3600/60))+"m":e>60?r(Math.floor(e/60))+"m"+r(i(e%60))+"s":e>10?r(i(e))+"s":r(e)+"s"}});var Mi=P((RD,Co)=>{"use strict";var Wl=fo(),Vl=Ni(),Hl=ji(),Jl=Li();Co.exports=function(e,t,n){let i=e.format,r=e.formatTime||Jl,o=e.formatValue||Vl,a=e.formatBar||Hl,u=Math.floor(t.progress*100)+"",l=t.stopTime||Date.now(),c=Math.round((l-t.startTime)/1e3),d=Object.assign({},n,{bar:a(t.progress,e),percentage:o(u,e,"percentage"),total:o(t.total,e,"total"),value:o(t.value,e,"value"),eta:o(t.eta,e,"eta"),eta_formatted:r(t.eta,e,5),duration:o(c,e,"duration"),duration_formatted:r(c,e,1)});i=i.replace(/\{(\w+)\}/g,function(F,A){return typeof d[A]<"u"?d[A]:F});let m=Math.max(0,t.maxWidth-Wl(i)-2),h=Math.floor(m/2);switch(e.align){case"right":i=m>0?" ".repeat(m)+i:i;break;case"center":i=h>0?" ".repeat(h)+i:i;break;default:break}return i}});var ln=P((OD,yo)=>{"use strict";function j(s,e){return typeof s>"u"||s===null?e:s}yo.exports={parse:function(e,t){let n={},i=Object.assign({},t,e);return n.throttleTime=1e3/j(i.fps,10),n.stream=j(i.stream,process.stderr),n.terminal=j(i.terminal,null),n.clearOnComplete=j(i.clearOnComplete,!1),n.stopOnComplete=j(i.stopOnComplete,!1),n.barsize=j(i.barsize,40),n.align=j(i.align,"left"),n.hideCursor=j(i.hideCursor,!1),n.linewrap=j(i.linewrap,!1),n.barGlue=j(i.barGlue,""),n.barCompleteChar=j(i.barCompleteChar,"="),n.barIncompleteChar=j(i.barIncompleteChar,"-"),n.format=j(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=j(i.formatTime,null),n.formatValue=j(i.formatValue,null),n.formatBar=j(i.formatBar,null),n.etaBufferLength=j(i.etaBuffer,10),n.etaAsynchronousUpdate=j(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=j(i.progressCalculationRelative,!1),n.synchronousUpdate=j(i.synchronousUpdate,!0),n.noTTYOutput=j(i.noTTYOutput,!1),n.notTTYSchedule=j(i.notTTYSchedule,2e3),n.emptyOnZero=j(i.emptyOnZero,!1),n.forceRedraw=j(i.forceRedraw,!1),n.autopadding=j(i.autopadding,!1),n.gracefulExit=j(i.gracefulExit,!1),n},assignDerivedOptions:function(e){return e.barCompleteString=e.barCompleteChar.repeat(e.barsize+1),e.barIncompleteString=e.barIncompleteChar.repeat(e.barsize+1),e.autopaddingChar=e.autopadding?j(e.autopaddingChar," "):"",e}}});var Ui=P((BD,bo)=>{"use strict";var Eo=io(),ql=Bi(),Gl=Mi(),Kl=ln(),Yl=require("events");bo.exports=class extends Yl{constructor(e){super(),this.options=Kl.assignDerivedOptions(e),this.terminal=this.options.terminal?this.options.terminal:new ql(this.options.stream),this.value=0,this.startValue=0,this.total=100,this.lastDrawnString=null,this.startTime=null,this.stopTime=null,this.lastRedraw=Date.now(),this.eta=new Eo(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:Gl}render(e=!1){let t={progress:this.getProgress(),eta:this.eta.getTime(),startTime:this.startTime,stopTime:this.stopTime,total:this.total,value:this.value,maxWidth:this.terminal.getWidth()};this.options.etaAsynchronousUpdate&&this.updateETA();let n=this.formatter(this.options,t,this.payload);(e||this.options.forceRedraw||this.options.noTTYOutput&&!this.terminal.isTTY()||this.lastDrawnString!=n)&&(this.emit("redraw-pre"),this.terminal.cursorTo(0,null),this.terminal.write(n),this.terminal.clearRight(),this.lastDrawnString=n,this.lastRedraw=Date.now(),this.emit("redraw-post"))}start(e,t,n){this.value=t||0,this.total=typeof e<"u"&&e>=0?e:100,this.startValue=t||0,this.payload=n||{},this.startTime=Date.now(),this.stopTime=null,this.lastDrawnString="",this.eta=new Eo(this.options.etaBufferLength,this.startTime,this.value),this.isActive=!0,this.emit("start",e,t)}stop(){this.isActive=!1,this.stopTime=Date.now(),this.emit("stop",this.total,this.value)}update(e,t={}){typeof e=="number"&&(this.value=e,this.eta.update(Date.now(),e,this.total));let n=(typeof e=="object"?e:t)||{};this.emit("update",this.total,this.value);for(let i in n)this.payload[i]=n[i];this.value>=this.getTotal()&&this.options.stopOnComplete&&this.stop()}getProgress(){let e=this.value/this.total;return this.options.progressCalculationRelative&&(e=(this.value-this.startValue)/(this.total-this.startValue)),isNaN(e)&&(e=this.options&&this.options.emptyOnZero?0:1),e=Math.min(Math.max(e,0),1),e}increment(e=1,t={}){typeof e=="object"?this.update(this.value+1,e):this.update(this.value+e,t)}getTotal(){return this.total}setTotal(e){typeof e<"u"&&e>=0&&(this.total=e)}updateETA(){this.eta.update(Date.now(),this.value,this.total)}}});var Io=P((PD,wo)=>{"use strict";var zl=Ui(),Xl=ln();wo.exports=class extends zl{constructor(e,t){super(Xl.parse(e,t)),this.timer=null,this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.options.synchronousUpdate=!1),this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.sigintCallback=null}render(){this.timer&&(clearTimeout(this.timer),this.timer=null),super.render(),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&this.terminal.newline(),this.timer=setTimeout(this.render.bind(this),this.schedulingRate)}update(e,t){this.timer&&(super.update(e,t),this.options.synchronousUpdate&&this.lastRedraw+this.options.throttleTime*2<Date.now()&&this.render())}start(e,t,n){this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.terminal.cursorSave(),this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),super.start(e,t,n),this.render())}stop(){this.timer&&(this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.render(),super.stop(),clearTimeout(this.timer),this.timer=null,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRestore(),this.options.clearOnComplete?(this.terminal.cursorTo(0,null),this.terminal.clearLine()):this.terminal.newline())}}});var _o=P((jD,Ao)=>{"use strict";var Ql=Bi(),Zl=Ui(),ec=ln(),tc=require("events");Ao.exports=class extends tc{constructor(e,t){super(),this.bars=[],this.options=ec.parse(e,t),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new Ql(this.options.stream),this.timer=null,this.isActive=!1,this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.loggingBuffer=[],this.sigintCallback=null}create(e,t,n,i={}){let r=new Zl(Object.assign({},this.options,{terminal:this.terminal},i));return this.bars.push(r),this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.isActive||(this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),this.timer=setTimeout(this.update.bind(this),this.schedulingRate)),this.isActive=!0,r.start(e,t,n),this.emit("start")),r}remove(e){let t=this.bars.indexOf(e);return t<0?!1:(this.bars.splice(t,1),this.update(),this.terminal.newline(),this.terminal.clearBottom(),!0)}update(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.emit("update-pre"),this.terminal.cursorRelativeReset(),this.emit("redraw-pre"),this.loggingBuffer.length>0)for(this.terminal.clearLine();this.loggingBuffer.length>0;)this.terminal.write(this.loggingBuffer.shift(),!0);for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render();this.emit("redraw-post"),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.terminal.newline(),this.terminal.newline()),this.timer=setTimeout(this.update.bind(this),this.schedulingRate),this.emit("update-post"),this.options.stopOnComplete&&!this.bars.find(e=>e.isActive)&&this.stop()}stop(){if(clearTimeout(this.timer),this.timer=null,this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.isActive=!1,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRelativeReset(),this.emit("stop-pre-clear"),this.options.clearOnComplete)this.terminal.clearBottom();else{for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render(),this.bars[e].stop();this.terminal.newline()}this.emit("stop")}log(e){this.loggingBuffer.push(e)}}});var So=P((LD,vo)=>{"use strict";vo.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var To=P((MD,xo)=>{"use strict";xo.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Oo=P((UD,Ro)=>{"use strict";Ro.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Bo=P((WD,ko)=>{"use strict";ko.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var Po=P((VD,$o)=>{"use strict";var nc=So(),ic=To(),sc=Oo(),rc=Bo();$o.exports={legacy:nc,shades_classic:ic,shades_grey:sc,rect:rc}});var Lo=P((HD,jo)=>{"use strict";var No=Io(),oc=_o(),ac=Po(),uc=Mi(),lc=Ni(),cc=ji(),dc=Li();jo.exports={Bar:No,SingleBar:No,MultiBar:oc,Presets:ac,Format:{Formatter:uc,BarFormat:cc,ValueFormat:lc,TimeFormat:dc}}});var Es=I(ys(),1),{program:Vc,createCommand:Hc,createArgument:Jc,createOption:qc,CommanderError:Gc,InvalidArgumentError:Q,InvalidOptionArgumentError:Kc,Command:bs,Argument:Yc,Option:zc,Help:Xc}=Es.default;var Ee=!1,ws=!1;function Is(s){Ee=s}function p(){return Ee}function As(s){ws=s}function D(s){console.log(JSON.stringify(s,null,2))}function _(s){Ee?console.error(JSON.stringify({error:s})):(console.error(`Error: ${s.message}`),s.details&&ws&&console.error(JSON.stringify(s.details,null,2)))}function au(s){return s instanceof Error&&"code"in s&&"exitCode"in s&&typeof s.code=="string"&&typeof s.exitCode=="number"}function _s(s){au(s)&&(_({code:s.code,message:s.message,details:s.details}),process.exit(s.exitCode)),_({code:"UNKNOWN_ERROR",message:s instanceof Error?s.message:"Unknown error"}),process.exit(1)}function E(s){Ee||console.log(`\x1B[32m${s}\x1B[0m`)}function B(s){Ee||console.log(`\x1B[36m${s}\x1B[0m`)}function Y(s){Ee||console.log(`\x1B[33m${s}\x1B[0m`)}function Qe(s){Ee||console.log(`\x1B[2m${s}\x1B[0m`)}var ei=I(require("readline"));var q=I(require("fs")),Be=I(require("path")),vs=I(require("os")),_t=require("child_process"),Vn=Be.join(vs.homedir(),".limai"),Ze=Be.join(Vn,"config.json"),uu=".limai.token",ke;function lu(s){if(!q.existsSync(s))return{};let e={};for(let t of q.readFileSync(s,"utf-8").split(/\r?\n/)){let n=t.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/);n&&(e[n[1]]=n[2].replace(/^(["'])(.*)\1$/,"$2"))}return e}function Ss(){if(ke!==void 0)return ke;try{let s=(0,_t.execSync)("git rev-parse --show-toplevel",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(!q.existsSync(Be.join(s,"packages","cli")))return ke=null,null;let e=(0,_t.execSync)("git rev-parse --git-common-dir",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),t="";if(e!==".git"){let i=(0,_t.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(i){let r=i.replace(/[/\\]/g,"-").replace(/[^a-zA-Z0-9._-]/g,"").replace(/^-+|-+$/g,"");r&&(t=`${r}.`)}}let n=lu(Be.join(s,"tables",".env.local"));return ke={root:s,apiUrl:n.NEXT_PUBLIC_BASE_URL??`https://${t}tables.localhost`,sseUrl:n.NEXT_PUBLIC_SSE_URL??`https://${t}ws.localhost`},ke}catch{return ke=null,null}}function cu(){let s=Ss();if(!s)return;let e=Be.join(s.root,uu);if(q.existsSync(e))return q.readFileSync(e,"utf-8").trim()}function $e(){let s=process.env.LIMAI_API_TOKEN,e=process.env.LIMAI_API_URL,t=process.env.LIMAI_SSE_URL,n={};if(q.existsSync(Ze))try{let u=q.readFileSync(Ze,"utf-8"),l=JSON.parse(u);l&&typeof l=="object"&&!Array.isArray(l)&&(n=l)}catch{n={}}let i=Ss(),r=s||cu()||n.token,o=e||n.apiUrl||i?.apiUrl||process.env.LIMAI_BUILD_URL||void 0,a=t||n.sseUrl||i?.sseUrl||void 0;return!r||!o?null:{token:r,apiUrl:o,sseUrl:a,defaultProjectId:n.defaultProjectId,defaultDeploymentId:n.defaultDeploymentId}}function be(s){let e={};if(q.existsSync(Ze))try{let n=q.readFileSync(Ze,"utf-8");e=JSON.parse(n)}catch{e={}}let t={...e,...s};q.existsSync(Vn)||q.mkdirSync(Vn,{recursive:!0,mode:448}),q.writeFileSync(Ze,JSON.stringify(t,null,2),{mode:384})}function f(){let s=$e();return s||(console.error("Not authenticated. Run `npm run cli:setup` or set LIMAI_API_TOKEN environment variable."),process.exit(1)),s}function xs(){return!!process.env.LIMAI_EXECUTION_ID}var ks=require("fs"),Bs=require("fs/promises"),$s=require("stream");var R=class extends Error{code;statusCode;exitCode;details;constructor(e,t){super(e),this.name="LimaiError",this.code=t.code,this.statusCode=t.statusCode,this.exitCode=t.exitCode??1,this.details=t.details}},Hn=class extends R{constructor(e,t){super(e,{code:"AUTH_ERROR",statusCode:401,exitCode:2,details:t}),this.name="AuthError"}},Jn=class extends R{constructor(e,t){super(e,{code:"FORBIDDEN",statusCode:403,exitCode:2,details:t}),this.name="ForbiddenError"}},et=class extends R{constructor(e,t){super(e,{code:"NOT_FOUND",statusCode:404,exitCode:3,details:t}),this.name="NotFoundError"}},W=class extends R{constructor(e,t){super(e,{code:"VALIDATION_ERROR",statusCode:400,exitCode:4,details:t}),this.name="ValidationError"}},qn=class extends R{constructor(e,t){super(e,{code:"CONFLICT",statusCode:409,exitCode:4,details:t}),this.name="ConflictError"}},Gn=class extends R{retryAfterMs;constructor(e,t){super(e,{code:"RATE_LIMITED",statusCode:429,exitCode:5}),this.name="RateLimitError",this.retryAfterMs=t}},Kn=class extends R{constructor(e,t=500,n){super(e,{code:"SERVER_ERROR",statusCode:t,exitCode:6,details:n}),this.name="ServerError"}},Pe=class extends R{constructor(e){super(e,{code:"TIMEOUT",exitCode:7}),this.name="TimeoutError"}},ge=class extends R{constructor(e,t){super(e,{code:"UPLOAD_ERROR",exitCode:8,details:t}),this.name="UploadError"}};function Ts(s,e,t){switch(s){case 400:return new W(e,t);case 401:return new Hn(e,t);case 403:return new Jn(e,t);case 404:return new et(e,t);case 409:return new qn(e,t);case 429:return new Gn(e);default:return s>=500?new Kn(e,s,t):new R(e,{code:"HTTP_ERROR",statusCode:s,details:t})}}var du=3e4,Yn=3,Rs=1e3,Os=2;function pu(){return process.env.LIMAI_DEBUG==="1"}function tt(...s){pu()&&console.error("[limai:http]",...s)}var vt=class{baseUrl;token;constructor(e){this.baseUrl=e.apiUrl.replace(/\/$/,""),this.token=e.token}buildUrl(e,t){let n=new URL(`/api/v1${e}`,this.baseUrl);if(t)for(let[i,r]of Object.entries(t))r!=null&&n.searchParams.set(i,r);return n.toString()}authHeaders(){let e={Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},t=process.env.VERCEL_BYPASS;return t&&(e["x-vercel-protection-bypass"]=t),e}async parseErrorBody(e){try{let t=await e.json();return{message:typeof t.error=="string"?t.error:typeof t.message=="string"?t.message:`HTTP ${e.status}`,details:t.details}}catch{return{message:await e.text().catch(()=>"")||`HTTP ${e.status}`}}}shouldRetry(e){return e===429||e>=500}getRetryDelay(e,t){let n=e.headers.get("Retry-After");if(n){let i=parseInt(n,10);if(!isNaN(i))return i*1e3}return Rs*Math.pow(Os,t)}async request(e,t,n={}){let i=this.buildUrl(t,n.params),r=n.timeoutMs??du;for(let o=0;o<=Yn;o++){let a=new AbortController,u=setTimeout(()=>a.abort(),r);n.signal&&n.signal.addEventListener("abort",()=>a.abort());try{tt(`${e} ${i}${o>0?` (retry ${o})`:""}`);let l=await fetch(i,{method:e,headers:this.authHeaders(),body:n.body?JSON.stringify(n.body):void 0,signal:a.signal});if(clearTimeout(u),l.ok){let m=await l.text();return m?JSON.parse(m):{}}if(n.retry!==!1&&this.shouldRetry(l.status)&&o<Yn){let m=this.getRetryDelay(l,o);tt(`Retrying in ${m}ms (status ${l.status})`),await new Promise(h=>setTimeout(h,m));continue}let{message:c,details:d}=await this.parseErrorBody(l);throw Ts(l.status,c,d)}catch(l){if(clearTimeout(u),l instanceof R)throw l;if(l instanceof DOMException&&l.name==="AbortError"){if(n.retry!==!1&&o<Yn){let c=Rs*Math.pow(Os,o);tt(`Timeout, retrying in ${c}ms`),await new Promise(d=>setTimeout(d,c));continue}throw new Pe(`Request timed out after ${r}ms: ${e} ${t}`)}throw new R(l instanceof Error?l.message:"Unknown network error",{code:"NETWORK_ERROR",exitCode:1})}}throw new R("Max retries exceeded",{code:"MAX_RETRIES",exitCode:1})}async get(e,t,n){return this.request("GET",e,{params:t,timeoutMs:n})}async post(e,t,n,i){return this.request("POST",e,{body:t,timeoutMs:n,retry:i?.retry})}async patch(e,t,n){return this.request("PATCH",e,{body:t,retry:n?.retry})}async del(e,t){return this.request("DELETE",e,{body:t})}async putRaw(e,t,n,i){let r=t instanceof Blob?t.size:t.length;tt(`PUT ${e} (${r} bytes)`);let o=await fetch(e,{method:"PUT",headers:{"Content-Type":n},body:t});if(i&&i(r,r),!o.ok)throw new ge(`Upload failed: HTTP ${o.status}`)}async putFile(e,t,n,i){let r=(await(0,Bs.stat)(t)).size;tt(`PUT ${e} (${r} bytes, streamed from ${t})`);let o=(0,ks.createReadStream)(t),a=o;if(i){let l=0,c=new $s.Transform({transform(d,m,h){l+=d.byteLength,i(l,r),h(null,d)}});a=o.pipe(c)}let u=await fetch(e,{method:"PUT",headers:{"Content-Type":n,"Content-Length":String(r)},body:a,duplex:"half"});if(i&&i(r,r),!u.ok)throw new ge(`Upload failed: HTTP ${u.status}`);return r}};var St=class{constructor(e){this.http=e}http;async getUploadUrl(e,t,n){let i={filename:t,contentHash:n};return this.http.get(`/document/${e}/get-url`,i)}async processSync(e,t,n){return this.http.post(`/document/${e}/process-file/${t}`,n,18e4)}async processAsync(e,t,n){return this.http.post(`/document/${e}/process-file-async/${t}`,n)}async processFilesAsync(e,t,n){return this.http.post(`/document/${e}/process-files-async`,{fileIds:t,...n})}async getFileData(e,t,n){let i={fileId:e,extractionSchemaId:t,include:n?.length?n.join(","):void 0};return this.http.get("/document/get-file-data",i)}async getFilesData(e,t){return this.http.post("/document/get-files-data",{fileIds:e,...t?.length?{include:t}:{}})}async getDocumentData(e,t,n){let i={include:n?.length?n.join(","):void 0};return this.http.get(`/deployments/${e}/documents/${t}/data`,i)}async getDocumentsData(e,t,n){return this.http.post(`/deployments/${e}/documents/data`,{fileIds:t,...n?.length?{include:n}:{}})}async submitCorrections(e,t,n){return this.http.post(`/document/${e}/process-file/${t}/submit-corrections`,n)}};var xt=class{constructor(e){this.http=e}http;async list(){let e=await this.http.get("/projects");return Array.isArray(e)?e:e.data}async create(e){return this.http.post("/projects",e)}async delete(e){return this.http.del(`/projects/${e}`)}async getSharedColumnIds(e){return this.http.get(`/projects/${e}/shared-column-ids`)}async listDeployments(e){return this.http.get(`/projects/${e}/deployments`)}async listBenchmarks(e){return this.http.get(`/projects/${e}/benchmarks`)}async listNotificationRoutes(e){return this.http.get(`/projects/${e}/notifications`)}async createNotificationRoute(e,t){return this.http.post(`/projects/${e}/notifications`,t)}async updateNotificationRoute(e,t,n){return this.http.patch(`/projects/${e}/notifications/${t}`,n)}async deleteNotificationRoute(e,t){return this.http.del(`/projects/${e}/notifications/${t}`)}async listNotificationIntegrations(e,t){return this.http.get(`/projects/${e}/notifications/integrations`,{provider:t})}async listNotificationSlackChannels(e,t){return this.http.get(`/projects/${e}/notifications/integrations/slack/channels`,{connectionId:t})}async listNotificationTeamsTeams(e,t){return this.http.get(`/projects/${e}/notifications/integrations/teams/teams`,{connectionId:t})}async listNotificationTeamsChannels(e,t,n){return this.http.get(`/projects/${e}/notifications/integrations/teams/channels`,{connectionId:t,teamId:n})}};var Tt=class{constructor(e){this.http=e}http;async list(e,t){let n={status:t?.status,type:t?.type},i=await this.http.get(`/projects/${e}/deployments`,n);return Array.isArray(i)?i:i.data}async create(e,t){return this.http.post(`/projects/${e}/deployments`,t)}async getConfig(e){return this.http.get(`/deployments/${e}/configuration`)}async updateConfig(e,t){await this.http.patch(`/deployment/${e}/configuration`,t)}async listDocuments(e,t){let n={limit:t?.limit?.toString(),offset:t?.offset?.toString(),status:t?.status};return this.http.get(`/deployments/${e}/documents`,n)}async getDocument(e,t){return this.http.get(`/deployments/${e}/documents/${t}`)}async deleteDocument(e,t){await this.http.del(`/deployments/${e}/documents/${t}`)}async bulkDelete(e,t){await this.http.del(`/deployments/${e}/documents/bulk-delete`,{fileIds:t})}};var Rt=class{constructor(e){this.http=e}http;async get(e){return this.http.get(`/tables/${e}`)}async listColumns(e){let t=await this.http.get(`/tables/${e}/columns`);return Array.isArray(t)?t:t.data}async listRows(e,t){let n={limit:t?.limit?.toString(),offset:t?.offset?.toString(),status:t?.status};return this.http.get(`/tables/${e}/rows`,n)}async createRows(e,t){return this.http.post(`/tables/${e}/rows`,t,6e4)}async deleteRows(e,t){return this.http.del(`/tables/${e}/rows`,t)}async createTable(e,t){return this.http.post(`/deployments/${e}/tables`,t)}async update(e,t){return this.http.patch(`/tables/${e}`,t)}};var Ot=class{constructor(e){this.http=e}http;async list(e){let t=await this.http.get(`/tables/${e}/columns`);return Array.isArray(t)?t:t.data}async get(e){return this.http.get(`/columns/${e}`)}async create(e,t){let n=await this.http.post(`/tables/${e}/columns`,t);return n&&typeof n=="object"&&"data"in n?n.data:[n]}async update(e,t){return this.http.patch(`/columns/${e}`,t)}};async function*Ps(s,e={}){let t=Math.min(e.pageSize??100,500),n=0,i=0;for(;;){let r=e.maxItems?Math.min(t,e.maxItems-i):t;if(r<=0)break;let o=await s(r,n),a=o.data;if(a.length===0||(yield a,i+=a.length,n+=a.length,n>=o.pagination.total)||e.maxItems&&i>=e.maxItems)break}}async function*Ns(s,e={}){let t=Math.min(e.pageSize??100,500),n=1,i=0;for(;;){let r=e.maxItems?Math.min(t,e.maxItems-i):t;if(r<=0)break;let o=await s(n,r),a=o.data;if(a.length===0||(yield a,i+=a.length,n++,n>o.pagination.totalPages)||e.maxItems&&i>=e.maxItems)break}}async function kt(s){let e=[];for await(let t of s)e.push(...t);return e}var Bt=class{constructor(e){this.http=e}http;async getRows(e,t){let n={page:t?.page?.toString(),limit:t?.limit?.toString(),order:t?.order,status:t?.status};return this.http.get(`/extractions/${e}`,n)}async*getAllRows(e,t){yield*Ns(async(n,i)=>this.http.get(`/extractions/${e}`,{page:n.toString(),limit:i.toString(),order:t?.order,status:t?.status}),t)}async collectAllRows(e,t){return kt(this.getAllRows(e,t))}};var $t=class{constructor(e){this.http=e}http;async getStatus(e){return this.http.get(`/queue/${e}/status`)}async cancel(e){await this.http.post("/queue/cancel",{jobId:e})}async updateStatus(e,t){return this.http.patch(`/queue/${e}/status`,t)}};var Pt=class{constructor(e){this.http=e}http;async list(e){return this.http.get("/classify",{projectId:e})}async getUploadUrl(e,t){return this.http.get(`/classify/${e}/get-url`,{filename:t})}async classify(e,t){return this.http.post(`/classify/${e}`,{fileId:t})}async classifyAsync(e,t){return this.http.post(`/classify/${e}/async`,{fileId:t})}async getStatus(e,t){return this.http.get(`/classify/${e}`,{classificationId:t})}async createClassifier(e){return this.http.post("/classify",e)}async createRoute(e,t){return this.http.post(`/classify/${e}/routes`,t)}};var Nt=class{constructor(e){this.http=e}http;async list(e){return this.http.get("/split",{projectId:e})}async getUploadUrl(e,t){return this.http.get(`/split/${e}/get-url`,{filename:t})}async split(e,t){return this.http.post(`/split/${e}`,{fileId:t})}async splitAsync(e,t){return this.http.post(`/split/${e}/async`,{fileId:t})}async getStatus(e,t){return this.http.get(`/split/${e}`,{splitId:t})}async listSplits(e){return this.http.get(`/split/${e}/splits`)}async createSplitter(e){return this.http.post("/split",e)}};var jt=class{constructor(e){this.http=e}http;async get(e){return this.http.get(`/deployments/${e}/configuration`)}async update(e,t){return this.http.patch(`/deployments/${e}/configuration`,t)}async getAllData(e){return this.http.get(`/deployments/${e}/all-data`)}};var Lt=class{constructor(e){this.http=e}http;async list(e){return this.http.get(`/projects/${e}/buckets`)}async get(e){return this.http.get(`/buckets/${e}`)}async create(e,t,n){return this.http.post(`/projects/${e}/buckets`,{name:t,description:n})}async delete(e){await this.http.del(`/buckets/${e}`)}async getUploadUrl(e,t){return this.http.get(`/buckets/${e}/get-url`,{filename:t})}async confirmUpload(e,t,n){await this.http.patch(`/buckets/${e}/files/${t}/status`,{status:"UPLOADED",...n!==void 0&&{sizeBytes:n}})}async listFiles(e,t){let n={};return t&&t.length>0&&(n.labels=t.join(",")),this.http.get(`/buckets/${e}/files`,n)}async getDownloadUrl(e,t){return this.http.get(`/buckets/${e}/files/${t}/download`)}async updateLabels(e,t,n){return this.http.patch(`/buckets/${e}/files/${t}`,{labels:n})}async deleteFile(e,t){await this.http.del(`/buckets/${e}/files/${t}`)}async sendTo(e,t,n,i){return this.http.post(`/buckets/${e}/files/${t}/send-to`,{targetType:n,targetId:i})}};var Mt=class{constructor(e){this.http=e}http;async list(e,t){let n={};return t?.status&&(n.status=t.status),this.http.get(`/projects/${e}/agents`,n)}async get(e,t){return this.http.get(`/projects/${e}/agents/${t}`)}async create(e,t){return this.http.post(`/projects/${e}/agents`,t)}async update(e,t,n){return this.http.patch(`/projects/${e}/agents/${t}`,n)}async delete(e,t){await this.http.del(`/projects/${e}/agents/${t}`)}async getFileUploadUrl(e,t,n){return this.http.get(`/projects/${e}/agents/${t}/files/get-url`,{filename:n})}async deleteFile(e,t,n){await this.http.del(`/projects/${e}/agents/${t}/files/${n}`)}async updateFileMetadata(e,t,n,i){return this.http.patch(`/projects/${e}/agents/${t}/files/${n}`,i)}async getFileDownloadUrl(e,t,n){return this.http.get(`/projects/${e}/agents/${t}/files/${n}/download`)}async listSkills(e,t){return this.http.get(`/projects/${e}/agents/${t}/skills`)}async createSkill(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/skills`,n)}async updateSkill(e,t,n,i){return this.http.patch(`/projects/${e}/agents/${t}/skills/${n}`,i)}async deleteSkill(e,t,n){await this.http.del(`/projects/${e}/agents/${t}/skills/${n}`)}async linkFileToSkill(e,t,n,i){return this.http.post(`/projects/${e}/agents/${t}/skills/${n}/files`,{fileId:i})}async unlinkFileFromSkill(e,t,n,i){await this.http.del(`/projects/${e}/agents/${t}/skills/${n}/files/${i}`)}async listRuns(e,t,n){let i={};return n?.limit&&(i.limit=String(n.limit)),n?.status&&(i.status=n.status),this.http.get(`/projects/${e}/agents/${t}/runs`,i)}async getRun(e,t,n){return this.http.get(`/projects/${e}/agents/${t}/runs/${n}`)}async getRunConversation(e,t,n,i){let r={};return i?.stepId&&(r.stepId=i.stepId),this.http.get(`/projects/${e}/agents/${t}/runs/${n}/conversation`,r)}async getRunInferenceLogs(e,t,n,i){let r={};return i?.limit!==void 0&&(r.limit=String(i.limit)),i?.status&&(r.status=i.status),this.http.get(`/projects/${e}/agents/${t}/runs/${n}/inference-logs`,r)}async createRun(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/runs`,n)}async createStep(e,t,n,i){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/steps`,i)}async createSteps(e,t,n,i){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/steps`,{steps:i})}async updateRun(e,t,n,i){return this.http.patch(`/projects/${e}/agents/${t}/runs/${n}`,i)}async updateStep(e,t,n,i,r){return this.http.patch(`/projects/${e}/agents/${t}/runs/${n}/steps/${i}`,r)}async updateStepConditions(e,t,n,i,r){return this.http.patch(`/projects/${e}/agents/${t}/runs/${n}/steps/${i}`,{conditions:r})}async pauseRun(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/pause`,{})}async submitStepAction(e,t,n,i,r){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/steps/${i}/action`,r)}async sendEmail(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/send-email`,n)}async completeExecution(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/executions/complete`,n)}async getSharePointToken(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/sharepoint-token`,n)}async getArtifactUploadUrl(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/upload-artifact/get-url`,n)}};var Ut=class{constructor(e){this.http=e}http;async ask(e,t){return this.http.post(`/projects/${e}/vision/ask`,t,12e4)}};var Wt=class{constructor(e){this.http=e}http;async submit(e,t,n){return this.http.post(`/document/${e}/process-file/${t}/submit-validation`,n)}async listScripts(e){return(await this.http.get(`/deployments/${e}/validation-scripts`)).scripts}async getScript(e,t,n){return(await this.http.get(`/deployments/${e}/validation-scripts/${encodeURIComponent(t)}`,n?.includeSource?{includeSource:"true"}:void 0)).script}async pushScript(e,t){return this.http.post(`/deployments/${e}/validation-scripts`,t)}async updateScript(e,t,n){return(await this.http.patch(`/deployments/${e}/validation-scripts/${encodeURIComponent(t)}`,n)).script}async deleteScript(e,t){return this.http.del(`/deployments/${e}/validation-scripts/${encodeURIComponent(t)}`)}};var Vt=class{constructor(e){this.http=e}http;async list(e,t){let n={};return t?.entityType&&(n.entityType=t.entityType),this.http.get(`/projects/${e}/labels`,n)}async addRemove(e,t,n,i,r){return this.http.post(`/projects/${e}/labels`,{entityType:t,entityId:n,add:i,remove:r})}async search(e,t){let n={};return t?.entityType&&(n.entityType=t.entityType),t?.labels&&(n.labels=t.labels),t?.key&&(n.key=t.key),this.http.get(`/projects/${e}/labels/search`,n)}};var nt=["DOCUMENT_EXTRACTED","DOCUMENT_REVIEWED","DOCUMENT_EXTRACTION_FAILED","DOCUMENT_VALIDATED","DOCUMENT_VALIDATION_STARTED","DOCUMENT_VALIDATION_FAILED","DOCUMENT_CLASSIFIED","DOCUMENT_CLASSIFICATION_FAILED","DOCUMENT_SPLIT","DOCUMENT_SPLIT_FAILED","AGENT_RUN_STARTED","AGENT_RUN_COMPLETED","AGENT_RUN_FAILED","AGENT_RUN_WAITING_HUMAN"],zn=["success","failed","dead_lettered","retrying","pending"],Xn=["24h","7d","30d"],Qn=["hour","day"];var Ht=class{constructor(e){this.http=e}http;basePath(e){return`/projects/${e}/webhooks`}async list(e){return this.http.get(this.basePath(e))}async get(e,t){return this.http.get(`${this.basePath(e)}/${t}`)}async create(e,t){return this.http.post(this.basePath(e),t,void 0,{retry:!1})}async update(e,t,n){return this.http.patch(`${this.basePath(e)}/${t}`,n,{retry:!1})}async delete(e,t){await this.http.del(`${this.basePath(e)}/${t}`)}async pause(e,t){return this.http.post(`${this.basePath(e)}/${t}/pause`)}async resume(e,t){return this.http.post(`${this.basePath(e)}/${t}/resume`)}async verify(e,t){return this.http.post(`${this.basePath(e)}/${t}/verify`,void 0,void 0,{retry:!1})}async rotateSecret(e,t){return this.http.post(`${this.basePath(e)}/${t}/rotate-secret`,void 0,void 0,{retry:!1})}async deliveries(e,t,n){let i={};return n?.status&&(i.status=n.status),n?.eventType&&(i.eventType=n.eventType),n?.deploymentId&&(i.deploymentId=n.deploymentId),n?.agentId&&(i.agentId=n.agentId),n?.classifierId&&(i.classifierId=n.classifierId),n?.splitterId&&(i.splitterId=n.splitterId),n?.limit!==void 0&&(i.limit=String(n.limit)),n?.offset!==void 0&&(i.offset=String(n.offset)),this.http.get(`${this.basePath(e)}/${t}/deliveries`,i)}async metrics(e,t,n){let i={};return n?.window&&(i.window=n.window),n?.bucket&&(i.bucket=n.bucket),this.http.get(`${this.basePath(e)}/${t}/metrics`,i)}async retry(e,t,n){return this.http.post(`${this.basePath(e)}/${t}/retry`,{eventIds:n})}};var Jt=I(require("fs")),Ne=I(require("path"));var js=I(require("fs")),Ls=I(require("crypto"));async function Ms(s){return new Promise((e,t)=>{let n=Ls.createHash("sha256"),i=js.createReadStream(s);i.on("data",r=>n.update(r)),i.on("end",()=>e(n.digest("hex"))),i.on("error",t)})}var mu={".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".tiff":"image/tiff",".tif":"image/tiff",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xls":"application/vnd.ms-excel",".csv":"text/csv",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".doc":"application/msword"};function Du(s){let e=Ne.extname(s).toLowerCase();return mu[e]||"application/octet-stream"}async function qt(s,e,t,n,i){let r=Ne.resolve(n),o=Ne.basename(r);if(!Jt.existsSync(r))throw new ge(`File not found: ${r}`);if(!Jt.statSync(r).isFile())throw new ge(`Not a file: ${r}`);let u=await Ms(r),l=await e.getUploadUrl(t,o,u);if(l.isDuplicate)return{fileId:l.fileId,filename:l.fileName??o,isDuplicate:!0,bytesUploaded:0};let c=Du(r),d=await s.putFile(l.url,r,c,i);return{fileId:l.fileId,filename:l.fileName??o,isDuplicate:!1,bytesUploaded:d}}var je=I(require("fs")),Le=I(require("path"));var Ws=I(require("path"));var Us=250,fu=5,Zn=class{constructor(e){this.max=e}max;queue=[];current=0;async acquire(){if(this.current<this.max){this.current++;return}return new Promise(e=>{this.queue.push(e)})}release(){this.current--;let e=this.queue.shift();e&&(this.current++,e())}};async function Vs(s,e,t,n,i){let r=Math.min(i?.concurrency??fu,10),o=new Zn(r),a=n.map(m=>({path:m,filename:Ws.basename(m),status:"pending"})),u=a.map(async(m,h)=>{await o.acquire();try{m.status="uploading",i?.onFileStatus?.(m);let F=await qt(s,e,t,m.path);m.fileId=F.fileId,m.status="uploaded",i?.onFileStatus?.(m)}catch(F){m.status="failed",m.error=F instanceof Error?F.message:String(F),i?.onFileStatus?.(m)}finally{o.release()}});if(await Promise.all(u),i?.process){let h=a.filter(F=>F.status==="uploaded"&&F.fileId).map(F=>F.fileId);for(let F=0;F<h.length;F+=Us){let A=h.slice(F,F+Us);try{let k=await e.processFilesAsync(t,A,i.processOptions);for(let[b,C]of Object.entries(k.results)){let x=a.find(V=>V.fileId===b);x&&(C.status==="queued"?(x.status="queued",x.jobId=C.jobId):(x.status="failed",x.error=C.error),i?.onFileStatus?.(x))}}catch(k){for(let b of A){let C=a.find(x=>x.fileId===b);C&&(C.status="failed",C.error=k instanceof Error?k.message:String(k),i?.onFileStatus?.(C))}}}}let l=a.filter(m=>m.status==="uploaded"||m.status==="queued").length,c=a.filter(m=>m.status==="queued").length,d=a.filter(m=>m.status==="failed").length;return{total:n.length,uploaded:l,queued:c,failed:d,files:a}}var gu=new Set([".pdf",".png",".jpg",".jpeg",".tiff",".tif",".xlsx",".xls",".csv",".docx",".doc"]);function Hs(s,e){let t=[],n=je.readdirSync(s,{withFileTypes:!0});for(let i of n){let r=Le.join(s,i.name);if(!i.name.startsWith(".")){if(i.isDirectory())t.push(...Hs(r,e));else if(i.isFile()){let o=Le.extname(i.name).toLowerCase();if(!gu.has(o)||e&&!hu(i.name,e))continue;t.push(r)}}}return t.sort()}function hu(s,e){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,".*").replace(/\\\?/g,".");return new RegExp(`^${t}$`,"i").test(s)}async function Js(s,e,t,n,i){let r=Le.resolve(n);if(!je.existsSync(r))throw new Error(`Directory not found: ${r}`);if(!je.statSync(r).isDirectory())throw new Error(`Not a directory: ${r}`);let a=Hs(r,i?.globPattern);return a.length===0?{total:0,uploaded:0,queued:0,failed:0,files:[]}:Vs(s,e,t,a,{concurrency:i?.concurrency,process:i?.process,processOptions:i?.processOptions,onFileStatus:i?.onFileStatus})}var Fu=1e3,Cu=1e4,yu=1.5,Eu=3e5,bu=["COMPLETED","FAILED","STALLED"],Z=class{constructor(e){this.queue=e}queue;async*poll(e,t){let n=t?.intervalMs??Fu,i=t?.maxIntervalMs??Cu,r=t?.backoffMultiplier??yu,o=t?.timeoutMs??Eu,a=n,u=Date.now(),l;for(;;){if(Date.now()-u>o)throw new Pe(`Polling timed out after ${Math.round(o/1e3)}s for job ${e}`);let c=await this.queue.getStatus(e);if(c.status!==l&&(l=c.status,t?.onStatus?.(c),yield c),bu.includes(c.status))return;await new Promise(d=>setTimeout(d,a)),a=Math.min(a*r,i)}}async waitForCompletion(e,t){let n;for await(let i of this.poll(e,t))n=i;if(!n)throw new Error(`No status received for job ${e}`);return n}};var g=class{http;documents;projects;deployments;tables;columns;extractions;queue;classify;split;schema;buckets;agents;vision;validations;labels;webhooks;constructor(e){this.http=new vt({apiUrl:e.apiUrl,token:e.token}),this.documents=new St(this.http),this.projects=new xt(this.http),this.deployments=new Tt(this.http),this.tables=new Rt(this.http),this.columns=new Ot(this.http),this.extractions=new Bt(this.http),this.queue=new $t(this.http),this.classify=new Pt(this.http),this.split=new Nt(this.http),this.schema=new jt(this.http),this.buckets=new Lt(this.http),this.agents=new Mt(this.http),this.vision=new Ut(this.http),this.validations=new Wt(this.http),this.labels=new Vt(this.http),this.webhooks=new Ht(this.http)}async uploadFile(e,t,n){return qt(this.http,this.documents,e,t,n)}async uploadFolder(e,t,n){return Js(this.http,this.documents,e,t,n)}async processAndWait(e,t,n){let i=await this.documents.processAsync(e,t,n?.processOptions),r=new Z(this.queue),o;for await(let a of r.poll(i.jobId,n?.pollOptions))o=a;if(!o||o.status==="FAILED")throw new Error(`Extraction failed for file ${t}${o?`: ${o.status}`:""}`);return this.documents.getFileData(t,e)}async*downloadAll(e,t){yield*this.extractions.getAllRows(e,t)}};function v(s,e){if(p()){D(s);return}if(s.length===0){console.log("\x1B[2mNo results.\x1B[0m");return}let t=e||Object.keys(s[0]),n={};for(let r of t)n[r]=r.length;for(let r of s)for(let o of t){let a=String(r[o]??"");n[o]=Math.max(n[o],Math.min(a.length,60))}let i=t.map(r=>`\x1B[1m${r.padEnd(n[r])}\x1B[0m`).join(" ");console.log(i),console.log(t.map(r=>"\u2500".repeat(n[r])).join(" "));for(let r of s){let o=t.map(a=>{let u=String(r[a]??"");return u.length>60?u.slice(0,57)+"...":u.padEnd(n[a])}).join(" ");console.log(o)}}function w(s){if(p()){D(s);return}let e=Math.max(...Object.keys(s).map(t=>t.length));for(let[t,n]of Object.entries(s)){let i=`\x1B[1m${t.padEnd(e)}\x1B[0m`,r=typeof n=="object"&&n!==null?JSON.stringify(n):String(n??"");console.log(`${i} ${r}`)}}var Ks=require("child_process"),Ys=require("crypto"),zs=require("http"),qs=9768,Gs=9780,wu=12e4;function Iu(){return(0,Ys.randomBytes)(32).toString("hex")}function Au(s){let e=process.platform,t=e==="darwin"?`open "${s}"`:e==="win32"?`start "" "${s}"`:`xdg-open "${s}"`;try{return(0,Ks.exec)(t),!0}catch{return!1}}function _u(){return`<!DOCTYPE html>
27
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function hs(s){return s.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:n=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],n=r[3],i=r[4]),t&&i!=="0"?`${t}=${n}:${parseInt(i)+1}`:e})}function Mn(){if($.env.NO_COLOR||$.env.FORCE_COLOR==="0"||$.env.FORCE_COLOR==="false")return!1;if($.env.FORCE_COLOR||$.env.CLICOLOR_FORCE!==void 0)return!0}Un.Command=Ln;Un.useColor=Mn});var bs=P(X=>{"use strict";var{Argument:Cs}=It(),{Command:Wn}=Fs(),{CommanderError:ru,InvalidArgumentError:ys}=Xe(),{Help:ou}=On(),{Option:Es}=Pn();X.program=new Wn;X.createCommand=s=>new Wn(s);X.createOption=(s,e)=>new Es(s,e);X.createArgument=(s,e)=>new Cs(s,e);X.Command=Wn;X.Option=Es;X.Argument=Cs;X.Help=ou;X.CommanderError=ru;X.InvalidArgumentError=ys;X.InvalidOptionArgumentError=ys});var _r=P((Wp,tl)=>{tl.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var Fi=P((Vp,Sr)=>{"use strict";var en=Object.assign({},_r()),vr=Object.keys(en);Object.defineProperty(en,"random",{get(){let s=Math.floor(Math.random()*vr.length),e=vr[s];return en[e]}});Sr.exports=en});var io=P((ED,no)=>{"use strict";var Bi=class{constructor(e,t,n){this.etaBufferLength=e||100,this.valueBuffer=[n],this.timeBuffer=[t],this.eta="0"}update(e,t,n){this.valueBuffer.push(t),this.timeBuffer.push(e),this.calculate(n-t)}getTime(){return this.eta}calculate(e){let t=this.valueBuffer.length,n=Math.min(this.etaBufferLength,t),i=this.valueBuffer[t-1]-this.valueBuffer[t-n],r=this.timeBuffer[t-1]-this.timeBuffer[t-n],o=i/r;this.valueBuffer=this.valueBuffer.slice(-this.etaBufferLength),this.timeBuffer=this.timeBuffer.slice(-this.etaBufferLength);let a=Math.ceil(e/o/1e3);isNaN(a)?this.eta="NULL":isFinite(a)?a>1e7?this.eta="INF":a<0?this.eta=0:this.eta=a:this.eta="INF"}};no.exports=Bi});var Pi=P((bD,so)=>{"use strict";var _e=require("readline"),$i=class{constructor(e){this.stream=e,this.linewrap=!0,this.dy=0}cursorSave(){this.stream.isTTY&&this.stream.write("\x1B7")}cursorRestore(){this.stream.isTTY&&this.stream.write("\x1B8")}cursor(e){this.stream.isTTY&&(e?this.stream.write("\x1B[?25h"):this.stream.write("\x1B[?25l"))}cursorTo(e=null,t=null){this.stream.isTTY&&_e.cursorTo(this.stream,e,t)}cursorRelative(e=null,t=null){this.stream.isTTY&&(this.dy=this.dy+t,_e.moveCursor(this.stream,e,t))}cursorRelativeReset(){this.stream.isTTY&&(_e.moveCursor(this.stream,0,-this.dy),_e.cursorTo(this.stream,0,null),this.dy=0)}clearRight(){this.stream.isTTY&&_e.clearLine(this.stream,1)}clearLine(){this.stream.isTTY&&_e.clearLine(this.stream,0)}clearBottom(){this.stream.isTTY&&_e.clearScreenDown(this.stream)}newline(){this.stream.write(`
28
+ `),this.dy++}write(e,t=!1){this.linewrap===!0&&t===!1?this.stream.write(e.substr(0,this.getWidth())):this.stream.write(e)}lineWrapping(e){this.stream.isTTY&&(this.linewrap=e,e?this.stream.write("\x1B[?7h"):this.stream.write("\x1B[?7l"))}isTTY(){return this.stream.isTTY===!0}getWidth(){return this.stream.columns||(this.stream.isTTY?80:200)}};so.exports=$i});var oo=P((wD,ro)=>{"use strict";ro.exports=({onlyFirst:s=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,s?void 0:"g")}});var uo=P((ID,ao)=>{"use strict";var jl=oo();ao.exports=s=>typeof s=="string"?s.replace(jl(),""):s});var co=P((AD,Ni)=>{"use strict";var lo=s=>Number.isNaN(s)?!1:s>=4352&&(s<=4447||s===9001||s===9002||11904<=s&&s<=12871&&s!==12351||12880<=s&&s<=19903||19968<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65131||65281<=s&&s<=65376||65504<=s&&s<=65510||110592<=s&&s<=110593||127488<=s&&s<=127569||131072<=s&&s<=262141);Ni.exports=lo;Ni.exports.default=lo});var mo=P((_D,po)=>{"use strict";po.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var fo=P((vD,ji)=>{"use strict";var Ll=uo(),Ml=co(),Ul=mo(),Do=s=>{if(typeof s!="string"||s.length===0||(s=Ll(s),s.length===0))return 0;s=s.replace(Ul()," ");let e=0;for(let t=0;t<s.length;t++){let n=s.codePointAt(t);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&t++,e+=Ml(n)?2:1)}return e};ji.exports=Do;ji.exports.default=Do});var Li=P((SD,go)=>{"use strict";go.exports=function(e,t,n){if(t.autopadding!==!0)return e;function i(r,o){return(t.autopaddingChar+r).slice(-o)}return n==="percentage"?i(e,3):e}});var Mi=P((xD,ho)=>{"use strict";ho.exports=function(e,t){let n=Math.round(e*t.barsize),i=t.barsize-n;return t.barCompleteString.substr(0,n)+t.barGlue+t.barIncompleteString.substr(0,i)}});var Ui=P((TD,Fo)=>{"use strict";Fo.exports=function(e,t,n){function i(o){return n?n*Math.round(o/n):o}function r(o){return(t.autopaddingChar+o).slice(-2)}return e>3600?r(Math.floor(e/3600))+"h"+r(i(e%3600/60))+"m":e>60?r(Math.floor(e/60))+"m"+r(i(e%60))+"s":e>10?r(i(e))+"s":r(e)+"s"}});var Wi=P((RD,Co)=>{"use strict";var Wl=fo(),Vl=Li(),Hl=Mi(),Jl=Ui();Co.exports=function(e,t,n){let i=e.format,r=e.formatTime||Jl,o=e.formatValue||Vl,a=e.formatBar||Hl,u=Math.floor(t.progress*100)+"",l=t.stopTime||Date.now(),c=Math.round((l-t.startTime)/1e3),d=Object.assign({},n,{bar:a(t.progress,e),percentage:o(u,e,"percentage"),total:o(t.total,e,"total"),value:o(t.value,e,"value"),eta:o(t.eta,e,"eta"),eta_formatted:r(t.eta,e,5),duration:o(c,e,"duration"),duration_formatted:r(c,e,1)});i=i.replace(/\{(\w+)\}/g,function(F,A){return typeof d[A]<"u"?d[A]:F});let m=Math.max(0,t.maxWidth-Wl(i)-2),h=Math.floor(m/2);switch(e.align){case"right":i=m>0?" ".repeat(m)+i:i;break;case"center":i=h>0?" ".repeat(h)+i:i;break;default:break}return i}});var ln=P((OD,yo)=>{"use strict";function j(s,e){return typeof s>"u"||s===null?e:s}yo.exports={parse:function(e,t){let n={},i=Object.assign({},t,e);return n.throttleTime=1e3/j(i.fps,10),n.stream=j(i.stream,process.stderr),n.terminal=j(i.terminal,null),n.clearOnComplete=j(i.clearOnComplete,!1),n.stopOnComplete=j(i.stopOnComplete,!1),n.barsize=j(i.barsize,40),n.align=j(i.align,"left"),n.hideCursor=j(i.hideCursor,!1),n.linewrap=j(i.linewrap,!1),n.barGlue=j(i.barGlue,""),n.barCompleteChar=j(i.barCompleteChar,"="),n.barIncompleteChar=j(i.barIncompleteChar,"-"),n.format=j(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=j(i.formatTime,null),n.formatValue=j(i.formatValue,null),n.formatBar=j(i.formatBar,null),n.etaBufferLength=j(i.etaBuffer,10),n.etaAsynchronousUpdate=j(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=j(i.progressCalculationRelative,!1),n.synchronousUpdate=j(i.synchronousUpdate,!0),n.noTTYOutput=j(i.noTTYOutput,!1),n.notTTYSchedule=j(i.notTTYSchedule,2e3),n.emptyOnZero=j(i.emptyOnZero,!1),n.forceRedraw=j(i.forceRedraw,!1),n.autopadding=j(i.autopadding,!1),n.gracefulExit=j(i.gracefulExit,!1),n},assignDerivedOptions:function(e){return e.barCompleteString=e.barCompleteChar.repeat(e.barsize+1),e.barIncompleteString=e.barIncompleteChar.repeat(e.barsize+1),e.autopaddingChar=e.autopadding?j(e.autopaddingChar," "):"",e}}});var Vi=P((BD,bo)=>{"use strict";var Eo=io(),ql=Pi(),Gl=Wi(),Kl=ln(),Yl=require("events");bo.exports=class extends Yl{constructor(e){super(),this.options=Kl.assignDerivedOptions(e),this.terminal=this.options.terminal?this.options.terminal:new ql(this.options.stream),this.value=0,this.startValue=0,this.total=100,this.lastDrawnString=null,this.startTime=null,this.stopTime=null,this.lastRedraw=Date.now(),this.eta=new Eo(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:Gl}render(e=!1){let t={progress:this.getProgress(),eta:this.eta.getTime(),startTime:this.startTime,stopTime:this.stopTime,total:this.total,value:this.value,maxWidth:this.terminal.getWidth()};this.options.etaAsynchronousUpdate&&this.updateETA();let n=this.formatter(this.options,t,this.payload);(e||this.options.forceRedraw||this.options.noTTYOutput&&!this.terminal.isTTY()||this.lastDrawnString!=n)&&(this.emit("redraw-pre"),this.terminal.cursorTo(0,null),this.terminal.write(n),this.terminal.clearRight(),this.lastDrawnString=n,this.lastRedraw=Date.now(),this.emit("redraw-post"))}start(e,t,n){this.value=t||0,this.total=typeof e<"u"&&e>=0?e:100,this.startValue=t||0,this.payload=n||{},this.startTime=Date.now(),this.stopTime=null,this.lastDrawnString="",this.eta=new Eo(this.options.etaBufferLength,this.startTime,this.value),this.isActive=!0,this.emit("start",e,t)}stop(){this.isActive=!1,this.stopTime=Date.now(),this.emit("stop",this.total,this.value)}update(e,t={}){typeof e=="number"&&(this.value=e,this.eta.update(Date.now(),e,this.total));let n=(typeof e=="object"?e:t)||{};this.emit("update",this.total,this.value);for(let i in n)this.payload[i]=n[i];this.value>=this.getTotal()&&this.options.stopOnComplete&&this.stop()}getProgress(){let e=this.value/this.total;return this.options.progressCalculationRelative&&(e=(this.value-this.startValue)/(this.total-this.startValue)),isNaN(e)&&(e=this.options&&this.options.emptyOnZero?0:1),e=Math.min(Math.max(e,0),1),e}increment(e=1,t={}){typeof e=="object"?this.update(this.value+1,e):this.update(this.value+e,t)}getTotal(){return this.total}setTotal(e){typeof e<"u"&&e>=0&&(this.total=e)}updateETA(){this.eta.update(Date.now(),this.value,this.total)}}});var Io=P((PD,wo)=>{"use strict";var zl=Vi(),Xl=ln();wo.exports=class extends zl{constructor(e,t){super(Xl.parse(e,t)),this.timer=null,this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.options.synchronousUpdate=!1),this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.sigintCallback=null}render(){this.timer&&(clearTimeout(this.timer),this.timer=null),super.render(),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&this.terminal.newline(),this.timer=setTimeout(this.render.bind(this),this.schedulingRate)}update(e,t){this.timer&&(super.update(e,t),this.options.synchronousUpdate&&this.lastRedraw+this.options.throttleTime*2<Date.now()&&this.render())}start(e,t,n){this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.terminal.cursorSave(),this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),super.start(e,t,n),this.render())}stop(){this.timer&&(this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.render(),super.stop(),clearTimeout(this.timer),this.timer=null,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRestore(),this.options.clearOnComplete?(this.terminal.cursorTo(0,null),this.terminal.clearLine()):this.terminal.newline())}}});var _o=P((jD,Ao)=>{"use strict";var Ql=Pi(),Zl=Vi(),ec=ln(),tc=require("events");Ao.exports=class extends tc{constructor(e,t){super(),this.bars=[],this.options=ec.parse(e,t),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new Ql(this.options.stream),this.timer=null,this.isActive=!1,this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.loggingBuffer=[],this.sigintCallback=null}create(e,t,n,i={}){let r=new Zl(Object.assign({},this.options,{terminal:this.terminal},i));return this.bars.push(r),this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.isActive||(this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),this.timer=setTimeout(this.update.bind(this),this.schedulingRate)),this.isActive=!0,r.start(e,t,n),this.emit("start")),r}remove(e){let t=this.bars.indexOf(e);return t<0?!1:(this.bars.splice(t,1),this.update(),this.terminal.newline(),this.terminal.clearBottom(),!0)}update(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.emit("update-pre"),this.terminal.cursorRelativeReset(),this.emit("redraw-pre"),this.loggingBuffer.length>0)for(this.terminal.clearLine();this.loggingBuffer.length>0;)this.terminal.write(this.loggingBuffer.shift(),!0);for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render();this.emit("redraw-post"),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.terminal.newline(),this.terminal.newline()),this.timer=setTimeout(this.update.bind(this),this.schedulingRate),this.emit("update-post"),this.options.stopOnComplete&&!this.bars.find(e=>e.isActive)&&this.stop()}stop(){if(clearTimeout(this.timer),this.timer=null,this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.isActive=!1,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRelativeReset(),this.emit("stop-pre-clear"),this.options.clearOnComplete)this.terminal.clearBottom();else{for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render(),this.bars[e].stop();this.terminal.newline()}this.emit("stop")}log(e){this.loggingBuffer.push(e)}}});var So=P((LD,vo)=>{"use strict";vo.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var To=P((MD,xo)=>{"use strict";xo.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Oo=P((UD,Ro)=>{"use strict";Ro.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Bo=P((WD,ko)=>{"use strict";ko.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var Po=P((VD,$o)=>{"use strict";var nc=So(),ic=To(),sc=Oo(),rc=Bo();$o.exports={legacy:nc,shades_classic:ic,shades_grey:sc,rect:rc}});var Lo=P((HD,jo)=>{"use strict";var No=Io(),oc=_o(),ac=Po(),uc=Wi(),lc=Li(),cc=Mi(),dc=Ui();jo.exports={Bar:No,SingleBar:No,MultiBar:oc,Presets:ac,Format:{Formatter:uc,BarFormat:cc,ValueFormat:lc,TimeFormat:dc}}});var ws=I(bs(),1),{program:Vc,createCommand:Hc,createArgument:Jc,createOption:qc,CommanderError:Gc,InvalidArgumentError:Q,InvalidOptionArgumentError:Kc,Command:Is,Argument:Yc,Option:zc,Help:Xc}=ws.default;var Ee=!1,As=!1;function _s(s){Ee=s}function p(){return Ee}function vs(s){As=s}function D(s){console.log(JSON.stringify(s,null,2))}function _(s){Ee?console.error(JSON.stringify({error:s})):(console.error(`Error: ${s.message}`),s.details&&As&&console.error(JSON.stringify(s.details,null,2)))}function au(s){return s instanceof Error&&"code"in s&&"exitCode"in s&&typeof s.code=="string"&&typeof s.exitCode=="number"}function Ss(s){au(s)&&(_({code:s.code,message:s.message,details:s.details}),process.exit(s.exitCode)),_({code:"UNKNOWN_ERROR",message:s instanceof Error?s.message:"Unknown error"}),process.exit(1)}function E(s){Ee||console.log(`\x1B[32m${s}\x1B[0m`)}function B(s){Ee||console.log(`\x1B[36m${s}\x1B[0m`)}function Y(s){Ee||console.log(`\x1B[33m${s}\x1B[0m`)}function Qe(s){Ee||console.log(`\x1B[2m${s}\x1B[0m`)}var ei=I(require("readline"));var q=I(require("fs")),Be=I(require("path")),xs=I(require("os")),_t=require("child_process"),Vn=Be.join(xs.homedir(),".limai"),Ze=Be.join(Vn,"config.json"),uu=".limai.token",ke;function lu(s){if(!q.existsSync(s))return{};let e={};for(let t of q.readFileSync(s,"utf-8").split(/\r?\n/)){let n=t.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/);n&&(e[n[1]]=n[2].replace(/^(["'])(.*)\1$/,"$2"))}return e}function Ts(){if(ke!==void 0)return ke;try{let s=(0,_t.execSync)("git rev-parse --show-toplevel",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(!q.existsSync(Be.join(s,"packages","cli")))return ke=null,null;let e=(0,_t.execSync)("git rev-parse --git-common-dir",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),t="";if(e!==".git"){let i=(0,_t.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(i){let r=i.replace(/[/\\]/g,"-").replace(/[^a-zA-Z0-9._-]/g,"").replace(/^-+|-+$/g,"");r&&(t=`${r}.`)}}let n=lu(Be.join(s,"tables",".env.local"));return ke={root:s,apiUrl:n.NEXT_PUBLIC_BASE_URL??`https://${t}tables.localhost`,sseUrl:n.NEXT_PUBLIC_SSE_URL??`https://${t}ws.localhost`},ke}catch{return ke=null,null}}function cu(){let s=Ts();if(!s)return;let e=Be.join(s.root,uu);if(q.existsSync(e))return q.readFileSync(e,"utf-8").trim()}function $e(){let s=process.env.LIMAI_API_TOKEN,e=process.env.LIMAI_API_URL,t=process.env.LIMAI_SSE_URL,n={};if(q.existsSync(Ze))try{let u=q.readFileSync(Ze,"utf-8"),l=JSON.parse(u);l&&typeof l=="object"&&!Array.isArray(l)&&(n=l)}catch{n={}}let i=Ts(),r=s||cu()||n.token,o=e||n.apiUrl||i?.apiUrl||process.env.LIMAI_BUILD_URL||void 0,a=t||n.sseUrl||i?.sseUrl||void 0;return!r||!o?null:{token:r,apiUrl:o,sseUrl:a,defaultProjectId:n.defaultProjectId,defaultDeploymentId:n.defaultDeploymentId}}function be(s){let e={};if(q.existsSync(Ze))try{let n=q.readFileSync(Ze,"utf-8");e=JSON.parse(n)}catch{e={}}let t={...e,...s};q.existsSync(Vn)||q.mkdirSync(Vn,{recursive:!0,mode:448}),q.writeFileSync(Ze,JSON.stringify(t,null,2),{mode:384})}function f(){let s=$e();return s||(console.error("Not authenticated. Run `npm run cli:setup` or set LIMAI_API_TOKEN environment variable."),process.exit(1)),s}function Rs(){return!!process.env.LIMAI_EXECUTION_ID}var $s=require("fs"),Ps=require("fs/promises"),Ns=require("stream");var R=class extends Error{code;statusCode;exitCode;details;constructor(e,t){super(e),this.name="LimaiError",this.code=t.code,this.statusCode=t.statusCode,this.exitCode=t.exitCode??1,this.details=t.details}},Hn=class extends R{constructor(e,t){super(e,{code:"AUTH_ERROR",statusCode:401,exitCode:2,details:t}),this.name="AuthError"}},Jn=class extends R{constructor(e,t){super(e,{code:"FORBIDDEN",statusCode:403,exitCode:2,details:t}),this.name="ForbiddenError"}},et=class extends R{constructor(e,t){super(e,{code:"NOT_FOUND",statusCode:404,exitCode:3,details:t}),this.name="NotFoundError"}},W=class extends R{constructor(e,t){super(e,{code:"VALIDATION_ERROR",statusCode:400,exitCode:4,details:t}),this.name="ValidationError"}},qn=class extends R{constructor(e,t){super(e,{code:"CONFLICT",statusCode:409,exitCode:4,details:t}),this.name="ConflictError"}},Gn=class extends R{retryAfterMs;constructor(e,t){super(e,{code:"RATE_LIMITED",statusCode:429,exitCode:5}),this.name="RateLimitError",this.retryAfterMs=t}},Kn=class extends R{constructor(e,t=500,n){super(e,{code:"SERVER_ERROR",statusCode:t,exitCode:6,details:n}),this.name="ServerError"}},Pe=class extends R{constructor(e){super(e,{code:"TIMEOUT",exitCode:7}),this.name="TimeoutError"}},ge=class extends R{constructor(e,t){super(e,{code:"UPLOAD_ERROR",exitCode:8,details:t}),this.name="UploadError"}};function Os(s,e,t){switch(s){case 400:return new W(e,t);case 401:return new Hn(e,t);case 403:return new Jn(e,t);case 404:return new et(e,t);case 409:return new qn(e,t);case 429:return new Gn(e);default:return s>=500?new Kn(e,s,t):new R(e,{code:"HTTP_ERROR",statusCode:s,details:t})}}var du=3e4,Yn=3,ks=1e3,Bs=2;function pu(){return process.env.LIMAI_DEBUG==="1"}function tt(...s){pu()&&console.error("[limai:http]",...s)}var vt=class{baseUrl;token;constructor(e){this.baseUrl=e.apiUrl.replace(/\/$/,""),this.token=e.token}buildUrl(e,t){let n=new URL(`/api/v1${e}`,this.baseUrl);if(t)for(let[i,r]of Object.entries(t))r!=null&&n.searchParams.set(i,r);return n.toString()}authHeaders(){let e={Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},t=process.env.VERCEL_BYPASS;return t&&(e["x-vercel-protection-bypass"]=t),e}async parseErrorBody(e){try{let t=await e.json();return{message:typeof t.error=="string"?t.error:typeof t.message=="string"?t.message:`HTTP ${e.status}`,details:t.details}}catch{return{message:await e.text().catch(()=>"")||`HTTP ${e.status}`}}}shouldRetry(e){return e===429||e>=500}getRetryDelay(e,t){let n=e.headers.get("Retry-After");if(n){let i=parseInt(n,10);if(!isNaN(i))return i*1e3}return ks*Math.pow(Bs,t)}async request(e,t,n={}){let i=this.buildUrl(t,n.params),r=n.timeoutMs??du;for(let o=0;o<=Yn;o++){let a=new AbortController,u=setTimeout(()=>a.abort(),r);n.signal&&n.signal.addEventListener("abort",()=>a.abort());try{tt(`${e} ${i}${o>0?` (retry ${o})`:""}`);let l=await fetch(i,{method:e,headers:this.authHeaders(),body:n.body?JSON.stringify(n.body):void 0,signal:a.signal});if(clearTimeout(u),l.ok){let m=await l.text();return m?JSON.parse(m):{}}if(n.retry!==!1&&this.shouldRetry(l.status)&&o<Yn){let m=this.getRetryDelay(l,o);tt(`Retrying in ${m}ms (status ${l.status})`),await new Promise(h=>setTimeout(h,m));continue}let{message:c,details:d}=await this.parseErrorBody(l);throw Os(l.status,c,d)}catch(l){if(clearTimeout(u),l instanceof R)throw l;if(l instanceof DOMException&&l.name==="AbortError"){if(n.retry!==!1&&o<Yn){let c=ks*Math.pow(Bs,o);tt(`Timeout, retrying in ${c}ms`),await new Promise(d=>setTimeout(d,c));continue}throw new Pe(`Request timed out after ${r}ms: ${e} ${t}`)}throw new R(l instanceof Error?l.message:"Unknown network error",{code:"NETWORK_ERROR",exitCode:1})}}throw new R("Max retries exceeded",{code:"MAX_RETRIES",exitCode:1})}async get(e,t,n){return this.request("GET",e,{params:t,timeoutMs:n})}async post(e,t,n,i){return this.request("POST",e,{body:t,timeoutMs:n,retry:i?.retry})}async patch(e,t,n){return this.request("PATCH",e,{body:t,retry:n?.retry})}async del(e,t){return this.request("DELETE",e,{body:t})}async putRaw(e,t,n,i){let r=t instanceof Blob?t.size:t.length;tt(`PUT ${e} (${r} bytes)`);let o=await fetch(e,{method:"PUT",headers:{"Content-Type":n},body:t});if(i&&i(r,r),!o.ok)throw new ge(`Upload failed: HTTP ${o.status}`)}async putFile(e,t,n,i){let r=(await(0,Ps.stat)(t)).size;tt(`PUT ${e} (${r} bytes, streamed from ${t})`);let o=(0,$s.createReadStream)(t),a=o;if(i){let l=0,c=new Ns.Transform({transform(d,m,h){l+=d.byteLength,i(l,r),h(null,d)}});a=o.pipe(c)}let u=await fetch(e,{method:"PUT",headers:{"Content-Type":n,"Content-Length":String(r)},body:a,duplex:"half"});if(i&&i(r,r),!u.ok)throw new ge(`Upload failed: HTTP ${u.status}`);return r}};var St=class{constructor(e){this.http=e}http;async getUploadUrl(e,t,n){let i={filename:t,contentHash:n};return this.http.get(`/document/${e}/get-url`,i)}async processSync(e,t,n){return this.http.post(`/document/${e}/process-file/${t}`,n,18e4)}async processAsync(e,t,n){return this.http.post(`/document/${e}/process-file-async/${t}`,n)}async processFilesAsync(e,t,n){return this.http.post(`/document/${e}/process-files-async`,{fileIds:t,...n})}async getFileData(e,t,n){let i={fileId:e,extractionSchemaId:t,include:n?.length?n.join(","):void 0};return this.http.get("/document/get-file-data",i)}async getFilesData(e,t){return this.http.post("/document/get-files-data",{fileIds:e,...t?.length?{include:t}:{}})}async getDocumentData(e,t,n){let i={include:n?.length?n.join(","):void 0};return this.http.get(`/deployments/${e}/documents/${t}/data`,i)}async getDocumentsData(e,t,n){return this.http.post(`/deployments/${e}/documents/data`,{fileIds:t,...n?.length?{include:n}:{}})}async submitCorrections(e,t,n){return this.http.post(`/document/${e}/process-file/${t}/submit-corrections`,n)}};var xt=class{constructor(e){this.http=e}http;async list(){let e=await this.http.get("/projects");return Array.isArray(e)?e:e.data}async create(e){return this.http.post("/projects",e)}async delete(e){return this.http.del(`/projects/${e}`)}async getSharedColumnIds(e){return this.http.get(`/projects/${e}/shared-column-ids`)}async listDeployments(e){return this.http.get(`/projects/${e}/deployments`)}async listBenchmarks(e){return this.http.get(`/projects/${e}/benchmarks`)}async listNotificationRoutes(e){return this.http.get(`/projects/${e}/notifications`)}async createNotificationRoute(e,t){return this.http.post(`/projects/${e}/notifications`,t)}async updateNotificationRoute(e,t,n){return this.http.patch(`/projects/${e}/notifications/${t}`,n)}async deleteNotificationRoute(e,t){return this.http.del(`/projects/${e}/notifications/${t}`)}async listNotificationIntegrations(e,t){return this.http.get(`/projects/${e}/notifications/integrations`,{provider:t})}async listNotificationSlackChannels(e,t){return this.http.get(`/projects/${e}/notifications/integrations/slack/channels`,{connectionId:t})}async listNotificationTeamsTeams(e,t){return this.http.get(`/projects/${e}/notifications/integrations/teams/teams`,{connectionId:t})}async listNotificationTeamsChannels(e,t,n){return this.http.get(`/projects/${e}/notifications/integrations/teams/channels`,{connectionId:t,teamId:n})}};var Tt=class{constructor(e){this.http=e}http;async list(e,t){let n={status:t?.status,type:t?.type},i=await this.http.get(`/projects/${e}/deployments`,n);return Array.isArray(i)?i:i.data}async create(e,t){return this.http.post(`/projects/${e}/deployments`,t)}async getConfig(e){return this.http.get(`/deployments/${e}/configuration`)}async updateConfig(e,t){await this.http.patch(`/deployment/${e}/configuration`,t)}async listDocuments(e,t){let n={limit:t?.limit?.toString(),offset:t?.offset?.toString(),status:t?.status};return this.http.get(`/deployments/${e}/documents`,n)}async getDocument(e,t){return this.http.get(`/deployments/${e}/documents/${t}`)}async deleteDocument(e,t){await this.http.del(`/deployments/${e}/documents/${t}`)}async bulkDelete(e,t){await this.http.del(`/deployments/${e}/documents/bulk-delete`,{fileIds:t})}};var Rt=class{constructor(e){this.http=e}http;async get(e){return this.http.get(`/tables/${e}`)}async listColumns(e){let t=await this.http.get(`/tables/${e}/columns`);return Array.isArray(t)?t:t.data}async listRows(e,t){let n={limit:t?.limit?.toString(),offset:t?.offset?.toString(),status:t?.status};return this.http.get(`/tables/${e}/rows`,n)}async createRows(e,t){return this.http.post(`/tables/${e}/rows`,t,6e4)}async deleteRows(e,t){return this.http.del(`/tables/${e}/rows`,t)}async createTable(e,t){return this.http.post(`/deployments/${e}/tables`,t)}async update(e,t){return this.http.patch(`/tables/${e}`,t)}};var Ot=class{constructor(e){this.http=e}http;async list(e){let t=await this.http.get(`/tables/${e}/columns`);return Array.isArray(t)?t:t.data}async get(e){return this.http.get(`/columns/${e}`)}async create(e,t){let n=await this.http.post(`/tables/${e}/columns`,t);return n&&typeof n=="object"&&"data"in n?n.data:[n]}async update(e,t){return this.http.patch(`/columns/${e}`,t)}};async function*js(s,e={}){let t=Math.min(e.pageSize??100,500),n=0,i=0;for(;;){let r=e.maxItems?Math.min(t,e.maxItems-i):t;if(r<=0)break;let o=await s(r,n),a=o.data;if(a.length===0||(yield a,i+=a.length,n+=a.length,n>=o.pagination.total)||e.maxItems&&i>=e.maxItems)break}}async function*Ls(s,e={}){let t=Math.min(e.pageSize??100,500),n=1,i=0;for(;;){let r=e.maxItems?Math.min(t,e.maxItems-i):t;if(r<=0)break;let o=await s(n,r),a=o.data;if(a.length===0||(yield a,i+=a.length,n++,n>o.pagination.totalPages)||e.maxItems&&i>=e.maxItems)break}}async function kt(s){let e=[];for await(let t of s)e.push(...t);return e}var Bt=class{constructor(e){this.http=e}http;async getRows(e,t){let n={page:t?.page?.toString(),limit:t?.limit?.toString(),order:t?.order,status:t?.status};return this.http.get(`/extractions/${e}`,n)}async*getAllRows(e,t){yield*Ls(async(n,i)=>this.http.get(`/extractions/${e}`,{page:n.toString(),limit:i.toString(),order:t?.order,status:t?.status}),t)}async collectAllRows(e,t){return kt(this.getAllRows(e,t))}};var $t=class{constructor(e){this.http=e}http;async getStatus(e){return this.http.get(`/queue/${e}/status`)}async cancel(e){await this.http.post("/queue/cancel",{jobId:e})}async updateStatus(e,t){return this.http.patch(`/queue/${e}/status`,t)}};var Pt=class{constructor(e){this.http=e}http;async list(e){return this.http.get("/classify",{projectId:e})}async getUploadUrl(e,t){return this.http.get(`/classify/${e}/get-url`,{filename:t})}async classify(e,t){return this.http.post(`/classify/${e}`,{fileId:t})}async classifyAsync(e,t){return this.http.post(`/classify/${e}/async`,{fileId:t})}async getStatus(e,t){return this.http.get(`/classify/${e}`,{classificationId:t})}async createClassifier(e){return this.http.post("/classify",e)}async createRoute(e,t){return this.http.post(`/classify/${e}/routes`,t)}};var Nt=class{constructor(e){this.http=e}http;async list(e){return this.http.get("/split",{projectId:e})}async getUploadUrl(e,t){return this.http.get(`/split/${e}/get-url`,{filename:t})}async split(e,t){return this.http.post(`/split/${e}`,{fileId:t})}async splitAsync(e,t){return this.http.post(`/split/${e}/async`,{fileId:t})}async getStatus(e,t){return this.http.get(`/split/${e}`,{splitId:t})}async listSplits(e){return this.http.get(`/split/${e}/splits`)}async createSplitter(e){return this.http.post("/split",e)}};var jt=class{constructor(e){this.http=e}http;async get(e){return this.http.get(`/deployments/${e}/configuration`)}async update(e,t){return this.http.patch(`/deployments/${e}/configuration`,t)}async getAllData(e){return this.http.get(`/deployments/${e}/all-data`)}};var Lt=class{constructor(e){this.http=e}http;async list(e){return this.http.get(`/projects/${e}/buckets`)}async get(e){return this.http.get(`/buckets/${e}`)}async create(e,t,n){return this.http.post(`/projects/${e}/buckets`,{name:t,description:n})}async delete(e){await this.http.del(`/buckets/${e}`)}async getUploadUrl(e,t){return this.http.get(`/buckets/${e}/get-url`,{filename:t})}async confirmUpload(e,t,n){await this.http.patch(`/buckets/${e}/files/${t}/status`,{status:"UPLOADED",...n!==void 0&&{sizeBytes:n}})}async listFiles(e,t){let n={};return t&&t.length>0&&(n.labels=t.join(",")),this.http.get(`/buckets/${e}/files`,n)}async getDownloadUrl(e,t){return this.http.get(`/buckets/${e}/files/${t}/download`)}async updateLabels(e,t,n){return this.http.patch(`/buckets/${e}/files/${t}`,{labels:n})}async deleteFile(e,t){await this.http.del(`/buckets/${e}/files/${t}`)}async sendTo(e,t,n,i){return this.http.post(`/buckets/${e}/files/${t}/send-to`,{targetType:n,targetId:i})}};var Mt=class{constructor(e){this.http=e}http;async list(e,t){let n={};return t?.status&&(n.status=t.status),this.http.get(`/projects/${e}/agents`,n)}async get(e,t){return this.http.get(`/projects/${e}/agents/${t}`)}async create(e,t){return this.http.post(`/projects/${e}/agents`,t)}async update(e,t,n){return this.http.patch(`/projects/${e}/agents/${t}`,n)}async delete(e,t){await this.http.del(`/projects/${e}/agents/${t}`)}async getFileUploadUrl(e,t,n){return this.http.get(`/projects/${e}/agents/${t}/files/get-url`,{filename:n})}async deleteFile(e,t,n){await this.http.del(`/projects/${e}/agents/${t}/files/${n}`)}async updateFileMetadata(e,t,n,i){return this.http.patch(`/projects/${e}/agents/${t}/files/${n}`,i)}async getFileDownloadUrl(e,t,n){return this.http.get(`/projects/${e}/agents/${t}/files/${n}/download`)}async listSkills(e,t){return this.http.get(`/projects/${e}/agents/${t}/skills`)}async createSkill(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/skills`,n)}async updateSkill(e,t,n,i){return this.http.patch(`/projects/${e}/agents/${t}/skills/${n}`,i)}async deleteSkill(e,t,n){await this.http.del(`/projects/${e}/agents/${t}/skills/${n}`)}async linkFileToSkill(e,t,n,i){return this.http.post(`/projects/${e}/agents/${t}/skills/${n}/files`,{fileId:i})}async unlinkFileFromSkill(e,t,n,i){await this.http.del(`/projects/${e}/agents/${t}/skills/${n}/files/${i}`)}async listRuns(e,t,n){let i={};return n?.limit&&(i.limit=String(n.limit)),n?.status&&(i.status=n.status),this.http.get(`/projects/${e}/agents/${t}/runs`,i)}async getRun(e,t,n){return this.http.get(`/projects/${e}/agents/${t}/runs/${n}`)}async getRunConversation(e,t,n,i){let r={};return i?.stepId&&(r.stepId=i.stepId),this.http.get(`/projects/${e}/agents/${t}/runs/${n}/conversation`,r)}async getRunInferenceLogs(e,t,n,i){let r={};return i?.limit!==void 0&&(r.limit=String(i.limit)),i?.status&&(r.status=i.status),this.http.get(`/projects/${e}/agents/${t}/runs/${n}/inference-logs`,r)}async createRun(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/runs`,n)}async createStep(e,t,n,i){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/steps`,i)}async createSteps(e,t,n,i){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/steps`,{steps:i})}async updateRun(e,t,n,i){return this.http.patch(`/projects/${e}/agents/${t}/runs/${n}`,i)}async updateStep(e,t,n,i,r){return this.http.patch(`/projects/${e}/agents/${t}/runs/${n}/steps/${i}`,r)}async updateStepConditions(e,t,n,i,r){return this.http.patch(`/projects/${e}/agents/${t}/runs/${n}/steps/${i}`,{conditions:r})}async pauseRun(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/pause`,{})}async submitStepAction(e,t,n,i,r){return this.http.post(`/projects/${e}/agents/${t}/runs/${n}/steps/${i}/action`,r)}async sendEmail(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/send-email`,n)}async completeExecution(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/executions/complete`,n)}async getSharePointToken(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/sharepoint-token`,n)}async getArtifactUploadUrl(e,t,n){return this.http.post(`/projects/${e}/agents/${t}/upload-artifact/get-url`,n)}};var Ut=class{constructor(e){this.http=e}http;async ask(e,t){return this.http.post(`/projects/${e}/vision/ask`,t,12e4)}};var Wt=class{constructor(e){this.http=e}http;async submit(e,t,n){return this.http.post(`/document/${e}/process-file/${t}/submit-validation`,n)}async listScripts(e){return(await this.http.get(`/deployments/${e}/validation-scripts`)).scripts}async getScript(e,t,n){return(await this.http.get(`/deployments/${e}/validation-scripts/${encodeURIComponent(t)}`,n?.includeSource?{includeSource:"true"}:void 0)).script}async pushScript(e,t){return this.http.post(`/deployments/${e}/validation-scripts`,t)}async updateScript(e,t,n){return(await this.http.patch(`/deployments/${e}/validation-scripts/${encodeURIComponent(t)}`,n)).script}async deleteScript(e,t){return this.http.del(`/deployments/${e}/validation-scripts/${encodeURIComponent(t)}`)}};var Vt=class{constructor(e){this.http=e}http;async list(e,t){let n={};return t?.entityType&&(n.entityType=t.entityType),this.http.get(`/projects/${e}/labels`,n)}async addRemove(e,t,n,i,r){return this.http.post(`/projects/${e}/labels`,{entityType:t,entityId:n,add:i,remove:r})}async search(e,t){let n={};return t?.entityType&&(n.entityType=t.entityType),t?.labels&&(n.labels=t.labels),t?.key&&(n.key=t.key),this.http.get(`/projects/${e}/labels/search`,n)}};var nt=["DOCUMENT_EXTRACTED","DOCUMENT_REVIEWED","DOCUMENT_EXTRACTION_FAILED","DOCUMENT_VALIDATED","DOCUMENT_VALIDATION_STARTED","DOCUMENT_VALIDATION_FAILED","DOCUMENT_CLASSIFIED","DOCUMENT_CLASSIFICATION_FAILED","DOCUMENT_SPLIT","DOCUMENT_SPLIT_FAILED","AGENT_RUN_STARTED","AGENT_RUN_COMPLETED","AGENT_RUN_FAILED","AGENT_RUN_WAITING_HUMAN"],zn=["success","failed","dead_lettered","retrying","pending"],Xn=["24h","7d","30d"],Qn=["hour","day"];var Ht=class{constructor(e){this.http=e}http;basePath(e){return`/projects/${e}/webhooks`}async list(e){return this.http.get(this.basePath(e))}async get(e,t){return this.http.get(`${this.basePath(e)}/${t}`)}async create(e,t){return this.http.post(this.basePath(e),t,void 0,{retry:!1})}async update(e,t,n){return this.http.patch(`${this.basePath(e)}/${t}`,n,{retry:!1})}async delete(e,t){await this.http.del(`${this.basePath(e)}/${t}`)}async pause(e,t){return this.http.post(`${this.basePath(e)}/${t}/pause`)}async resume(e,t){return this.http.post(`${this.basePath(e)}/${t}/resume`)}async verify(e,t){return this.http.post(`${this.basePath(e)}/${t}/verify`,void 0,void 0,{retry:!1})}async rotateSecret(e,t){return this.http.post(`${this.basePath(e)}/${t}/rotate-secret`,void 0,void 0,{retry:!1})}async deliveries(e,t,n){let i={};return n?.status&&(i.status=n.status),n?.eventType&&(i.eventType=n.eventType),n?.deploymentId&&(i.deploymentId=n.deploymentId),n?.agentId&&(i.agentId=n.agentId),n?.classifierId&&(i.classifierId=n.classifierId),n?.splitterId&&(i.splitterId=n.splitterId),n?.limit!==void 0&&(i.limit=String(n.limit)),n?.offset!==void 0&&(i.offset=String(n.offset)),this.http.get(`${this.basePath(e)}/${t}/deliveries`,i)}async metrics(e,t,n){let i={};return n?.window&&(i.window=n.window),n?.bucket&&(i.bucket=n.bucket),this.http.get(`${this.basePath(e)}/${t}/metrics`,i)}async retry(e,t,n){return this.http.post(`${this.basePath(e)}/${t}/retry`,{eventIds:n})}};var Jt=I(require("fs")),Ne=I(require("path"));var Ms=I(require("fs")),Us=I(require("crypto"));async function Ws(s){return new Promise((e,t)=>{let n=Us.createHash("sha256"),i=Ms.createReadStream(s);i.on("data",r=>n.update(r)),i.on("end",()=>e(n.digest("hex"))),i.on("error",t)})}var mu={".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".tiff":"image/tiff",".tif":"image/tiff",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xls":"application/vnd.ms-excel",".csv":"text/csv",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".doc":"application/msword"};function Du(s){let e=Ne.extname(s).toLowerCase();return mu[e]||"application/octet-stream"}async function qt(s,e,t,n,i){let r=Ne.resolve(n),o=Ne.basename(r);if(!Jt.existsSync(r))throw new ge(`File not found: ${r}`);if(!Jt.statSync(r).isFile())throw new ge(`Not a file: ${r}`);let u=await Ws(r),l=await e.getUploadUrl(t,o,u);if(l.isDuplicate)return{fileId:l.fileId,filename:l.fileName??o,isDuplicate:!0,bytesUploaded:0};let c=Du(r),d=await s.putFile(l.url,r,c,i);return{fileId:l.fileId,filename:l.fileName??o,isDuplicate:!1,bytesUploaded:d}}var je=I(require("fs")),Le=I(require("path"));var Hs=I(require("path"));var Vs=250,fu=5,Zn=class{constructor(e){this.max=e}max;queue=[];current=0;async acquire(){if(this.current<this.max){this.current++;return}return new Promise(e=>{this.queue.push(e)})}release(){this.current--;let e=this.queue.shift();e&&(this.current++,e())}};async function Js(s,e,t,n,i){let r=Math.min(i?.concurrency??fu,10),o=new Zn(r),a=n.map(m=>({path:m,filename:Hs.basename(m),status:"pending"})),u=a.map(async(m,h)=>{await o.acquire();try{m.status="uploading",i?.onFileStatus?.(m);let F=await qt(s,e,t,m.path);m.fileId=F.fileId,m.status="uploaded",i?.onFileStatus?.(m)}catch(F){m.status="failed",m.error=F instanceof Error?F.message:String(F),i?.onFileStatus?.(m)}finally{o.release()}});if(await Promise.all(u),i?.process){let h=a.filter(F=>F.status==="uploaded"&&F.fileId).map(F=>F.fileId);for(let F=0;F<h.length;F+=Vs){let A=h.slice(F,F+Vs);try{let k=await e.processFilesAsync(t,A,i.processOptions);for(let[b,C]of Object.entries(k.results)){let x=a.find(V=>V.fileId===b);x&&(C.status==="queued"?(x.status="queued",x.jobId=C.jobId):(x.status="failed",x.error=C.error),i?.onFileStatus?.(x))}}catch(k){for(let b of A){let C=a.find(x=>x.fileId===b);C&&(C.status="failed",C.error=k instanceof Error?k.message:String(k),i?.onFileStatus?.(C))}}}}let l=a.filter(m=>m.status==="uploaded"||m.status==="queued").length,c=a.filter(m=>m.status==="queued").length,d=a.filter(m=>m.status==="failed").length;return{total:n.length,uploaded:l,queued:c,failed:d,files:a}}var gu=new Set([".pdf",".png",".jpg",".jpeg",".tiff",".tif",".xlsx",".xls",".csv",".docx",".doc"]);function qs(s,e){let t=[],n=je.readdirSync(s,{withFileTypes:!0});for(let i of n){let r=Le.join(s,i.name);if(!i.name.startsWith(".")){if(i.isDirectory())t.push(...qs(r,e));else if(i.isFile()){let o=Le.extname(i.name).toLowerCase();if(!gu.has(o)||e&&!hu(i.name,e))continue;t.push(r)}}}return t.sort()}function hu(s,e){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,".*").replace(/\\\?/g,".");return new RegExp(`^${t}$`,"i").test(s)}async function Gs(s,e,t,n,i){let r=Le.resolve(n);if(!je.existsSync(r))throw new Error(`Directory not found: ${r}`);if(!je.statSync(r).isDirectory())throw new Error(`Not a directory: ${r}`);let a=qs(r,i?.globPattern);return a.length===0?{total:0,uploaded:0,queued:0,failed:0,files:[]}:Js(s,e,t,a,{concurrency:i?.concurrency,process:i?.process,processOptions:i?.processOptions,onFileStatus:i?.onFileStatus})}var Fu=1e3,Cu=1e4,yu=1.5,Eu=3e5,bu=["COMPLETED","FAILED","STALLED"],Z=class{constructor(e){this.queue=e}queue;async*poll(e,t){let n=t?.intervalMs??Fu,i=t?.maxIntervalMs??Cu,r=t?.backoffMultiplier??yu,o=t?.timeoutMs??Eu,a=n,u=Date.now(),l;for(;;){if(Date.now()-u>o)throw new Pe(`Polling timed out after ${Math.round(o/1e3)}s for job ${e}`);let c=await this.queue.getStatus(e);if(c.status!==l&&(l=c.status,t?.onStatus?.(c),yield c),bu.includes(c.status))return;await new Promise(d=>setTimeout(d,a)),a=Math.min(a*r,i)}}async waitForCompletion(e,t){let n;for await(let i of this.poll(e,t))n=i;if(!n)throw new Error(`No status received for job ${e}`);return n}};var g=class{http;documents;projects;deployments;tables;columns;extractions;queue;classify;split;schema;buckets;agents;vision;validations;labels;webhooks;constructor(e){this.http=new vt({apiUrl:e.apiUrl,token:e.token}),this.documents=new St(this.http),this.projects=new xt(this.http),this.deployments=new Tt(this.http),this.tables=new Rt(this.http),this.columns=new Ot(this.http),this.extractions=new Bt(this.http),this.queue=new $t(this.http),this.classify=new Pt(this.http),this.split=new Nt(this.http),this.schema=new jt(this.http),this.buckets=new Lt(this.http),this.agents=new Mt(this.http),this.vision=new Ut(this.http),this.validations=new Wt(this.http),this.labels=new Vt(this.http),this.webhooks=new Ht(this.http)}async uploadFile(e,t,n){return qt(this.http,this.documents,e,t,n)}async uploadFolder(e,t,n){return Gs(this.http,this.documents,e,t,n)}async processAndWait(e,t,n){let i=await this.documents.processAsync(e,t,n?.processOptions),r=new Z(this.queue),o;for await(let a of r.poll(i.jobId,n?.pollOptions))o=a;if(!o||o.status==="FAILED")throw new Error(`Extraction failed for file ${t}${o?`: ${o.status}`:""}`);return this.documents.getFileData(t,e)}async*downloadAll(e,t){yield*this.extractions.getAllRows(e,t)}};function v(s,e){if(p()){D(s);return}if(s.length===0){console.log("\x1B[2mNo results.\x1B[0m");return}let t=e||Object.keys(s[0]),n={};for(let r of t)n[r]=r.length;for(let r of s)for(let o of t){let a=String(r[o]??"");n[o]=Math.max(n[o],Math.min(a.length,60))}let i=t.map(r=>`\x1B[1m${r.padEnd(n[r])}\x1B[0m`).join(" ");console.log(i),console.log(t.map(r=>"\u2500".repeat(n[r])).join(" "));for(let r of s){let o=t.map(a=>{let u=String(r[a]??"");return u.length>60?u.slice(0,57)+"...":u.padEnd(n[a])}).join(" ");console.log(o)}}function w(s){if(p()){D(s);return}let e=Math.max(...Object.keys(s).map(t=>t.length));for(let[t,n]of Object.entries(s)){let i=`\x1B[1m${t.padEnd(e)}\x1B[0m`,r=typeof n=="object"&&n!==null?JSON.stringify(n):String(n??"");console.log(`${i} ${r}`)}}var zs=require("child_process"),Xs=require("crypto"),Qs=require("http"),Ks=9768,Ys=9780,wu=12e4;function Iu(){return(0,Xs.randomBytes)(32).toString("hex")}function Au(s){let e=process.platform,t=e==="darwin"?`open "${s}"`:e==="win32"?`start "" "${s}"`:`xdg-open "${s}"`;try{return(0,zs.exec)(t),!0}catch{return!1}}function _u(){return`<!DOCTYPE html>
29
29
  <html>
30
30
  <head><title>LimAI CLI</title></head>
31
31
  <body style="font-family: system-ui, sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; background: #0a0a0a; color: #fafafa;">
@@ -34,22 +34,22 @@ Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let
34
34
  <p style="color: #888;">You can close this tab and return to the terminal.</p>
35
35
  </div>
36
36
  </body>
37
- </html>`}function vu(s){return new Promise((e,t)=>{let n,i=new Promise(u=>{n=u}),r=(0,zs.createServer)((u,l)=>{let c=new URL(u.url??"/","http://127.0.0.1");if(c.pathname!=="/callback"){l.writeHead(404).end("Not found");return}let d=c.searchParams.get("state"),m=c.searchParams.get("token");if(d!==s){l.writeHead(403).end("Invalid state parameter");return}if(!m){l.writeHead(400).end("Missing token");return}n(m),l.writeHead(200,{"Content-Type":"text/html"}).end(_u())}),o=qs,a=()=>{r.listen(o,"127.0.0.1")};r.on("listening",()=>{e({port:o,tokenPromise:i,stop:()=>{r.closeAllConnections?.(),r.close()}})}),r.on("error",u=>{if(u.code!=="EADDRINUSE"){t(u);return}if(o++,o>Gs){t(new Error(`Could not start local server. All ports ${qs}-${Gs} are in use.`));return}a()}),a()})}async function Xs(s){let e=Iu(),{port:t,tokenPromise:n,stop:i}=await vu(e),r=()=>{i(),process.exit(130)};process.on("SIGINT",r);let o=`${s}/cli-auth?state=${e}&port=${t}`;Au(o)||console.log(`Open this URL in your browser:
38
- ${o}`);try{return{token:await Promise.race([n,new Promise((l,c)=>setTimeout(()=>c(new Error("Login timed out. No response received from browser.")),wu))])}}finally{process.removeListener("SIGINT",r),i()}}var Qs="https://app.limai.io";function Su(s){let e=ei.createInterface({input:process.stdin,output:process.stderr});return new Promise(t=>{e.question(s,n=>{e.close(),t(n.trim())})})}function Zs(s){return new Promise(e=>{let t=ei.createInterface({input:process.stdin,output:process.stderr});process.stderr.write(s),process.stdin.isTTY&&process.stdin.setRawMode(!0),process.stdin.resume();let n="",i=r=>{let o=r.toString("utf8"),a=o.search(/[\r\n]/);a!==-1?(n+=o.slice(0,a),process.stdin.isTTY&&process.stdin.setRawMode(!1),process.stdin.pause(),process.stdin.removeListener("data",i),process.stderr.write(`
39
- `),t.close(),e(n.trim())):o===""?process.exit(130):o==="\x7F"||o==="\b"?n.length>0&&(n=n.slice(0,-1)):n+=o};process.stdin.on("data",i)})}function er(s){let e=s.command("auth").description("Authentication management");e.command("login").description("Authenticate with LimAI").option("--no-browser","Skip browser login, paste token manually").action(async i=>{let r=process.stdin.isTTY&&i.browser,o=process.env.LIMAI_API_URL||Qs;if(o!==Qs&&B(`Using API URL override: ${o}`),r){let a=await Su(`How would you like to authenticate?
37
+ </html>`}function vu(s){return new Promise((e,t)=>{let n,i=new Promise(u=>{n=u}),r=(0,Qs.createServer)((u,l)=>{let c=new URL(u.url??"/","http://127.0.0.1");if(c.pathname!=="/callback"){l.writeHead(404).end("Not found");return}let d=c.searchParams.get("state"),m=c.searchParams.get("token");if(d!==s){l.writeHead(403).end("Invalid state parameter");return}if(!m){l.writeHead(400).end("Missing token");return}n(m),l.writeHead(200,{"Content-Type":"text/html"}).end(_u())}),o=Ks,a=()=>{r.listen(o,"127.0.0.1")};r.on("listening",()=>{e({port:o,tokenPromise:i,stop:()=>{r.closeAllConnections?.(),r.close()}})}),r.on("error",u=>{if(u.code!=="EADDRINUSE"){t(u);return}if(o++,o>Ys){t(new Error(`Could not start local server. All ports ${Ks}-${Ys} are in use.`));return}a()}),a()})}async function Zs(s){let e=Iu(),{port:t,tokenPromise:n,stop:i}=await vu(e),r=()=>{i(),process.exit(130)};process.on("SIGINT",r);let o=`${s}/cli-auth?state=${e}&port=${t}`;Au(o)||console.log(`Open this URL in your browser:
38
+ ${o}`);try{return{token:await Promise.race([n,new Promise((l,c)=>setTimeout(()=>c(new Error("Login timed out. No response received from browser.")),wu))])}}finally{process.removeListener("SIGINT",r),i()}}var er="https://app.limai.io";function Su(s){let e=ei.createInterface({input:process.stdin,output:process.stderr});return new Promise(t=>{e.question(s,n=>{e.close(),t(n.trim())})})}function tr(s){return new Promise(e=>{let t=ei.createInterface({input:process.stdin,output:process.stderr});process.stderr.write(s),process.stdin.isTTY&&process.stdin.setRawMode(!0),process.stdin.resume();let n="",i=r=>{let o=r.toString("utf8"),a=o.search(/[\r\n]/);a!==-1?(n+=o.slice(0,a),process.stdin.isTTY&&process.stdin.setRawMode(!1),process.stdin.pause(),process.stdin.removeListener("data",i),process.stderr.write(`
39
+ `),t.close(),e(n.trim())):o===""?process.exit(130):o==="\x7F"||o==="\b"?n.length>0&&(n=n.slice(0,-1)):n+=o};process.stdin.on("data",i)})}function nr(s){let e=s.command("auth").description("Authentication management");e.command("login").description("Authenticate with LimAI").option("--no-browser","Skip browser login, paste token manually").action(async i=>{let r=process.stdin.isTTY&&i.browser,o=process.env.LIMAI_API_URL||er;if(o!==er&&B(`Using API URL override: ${o}`),r){let a=await Su(`How would you like to authenticate?
40
40
  [1] Log in with browser (default)
41
41
  [2] Log in with a browser on another device
42
42
  [3] Paste a token manually
43
- Choice: `);if(a==="2"){await t(o);return}if(a==="3"){await n(o);return}B("Opening browser for authentication...");try{let{token:u}=await Xs(o);be({apiUrl:o,token:u}),E("Authenticated successfully. Credentials saved to ~/.limai/config.json")}catch(u){_({code:"AUTH",message:u instanceof Error?u.message:"Browser login failed"}),B("If this terminal has no browser, run `limai auth login` again and choose option 2."),process.exit(1)}}else await n(o)});async function t(i){B("Open this URL in a browser on any device:"),B(` ${i}/cli-auth?mode=remote`),B("After authorizing, a code will be shown.");let r=await Zs("Paste the code here: ");r||(_({code:"VALIDATION",message:"No code entered."}),process.exit(1));let o=new g({apiUrl:i,token:r});try{await o.http.get("/health")}catch{_({code:"AUTH",message:"The code could not be verified. Make sure you copied it completely and try again."}),process.exit(1)}be({apiUrl:i,token:r}),E("Authenticated successfully. Credentials saved to ~/.limai/config.json")}async function n(i){let r=await Zs("API Token: ");r||(_({code:"VALIDATION",message:"API token is required."}),process.exit(1)),be({apiUrl:i,token:r}),E("Credentials saved to ~/.limai/config.json")}e.command("logout").description("Clear stored credentials").action(()=>{be({apiUrl:"",token:""}),E("Credentials cleared.")}),e.command("status").description("Verify authentication").action(async()=>{let i=$e();i||(_({code:"AUTH",message:"Not authenticated. Run `limai auth login` first."}),process.exit(1));let r=new g(i);try{let o=await r.http.get("/me").catch(a=>{if(a instanceof et)return null;throw a});o||await r.http.get("/health"),p()?D({status:"ok",apiUrl:i.apiUrl,...o?{email:o.email}:{}}):w({status:"Authenticated",apiUrl:i.apiUrl,...o?{email:o.email}:{}})}catch(o){_({code:"AUTH",message:o instanceof Error?o.message:"Authentication failed"}),process.exit(2)}})}var ir=I(require("fs")),sr=I(require("path")),rr=I(require("readline"));var ii=["EXTRACTION_COMPLETED","DOCUMENT_REVIEWED","CONTEXT_DOCUMENT_NEEDS_REVIEW","INTEGRATION_FILE_UPLOADED","AGENT_RUN_WAITING_HUMAN","AGENT_RUN_COMPLETED"],ti=["SLACK","TEAMS_CHANNEL","TEAMS_CHAT","EMAIL_ADDRESS"],ni=["SLACK","TEAMS","SHAREPOINT","GOOGLE_DRIVE"];function xu(s){let e=rr.createInterface({input:process.stdin,output:process.stderr});return new Promise(t=>{e.question(s,n=>{e.close(),t(n.trim().toLowerCase()==="y")})})}function tr(s){let e=s.split(",").map(n=>n.trim()).filter(Boolean);if(e.length===0)throw new Error("--events must list at least one event");let t=e.filter(n=>!ii.includes(n));if(t.length>0)throw new Error(`Unknown event(s): ${t.join(", ")}. Valid: ${ii.join(", ")}`);return e}function nr(s){let e=s.destinationFile?ir.readFileSync(sr.resolve(s.destinationFile),"utf-8"):s.destinationJson;if(!e)throw new Error("Provide --destination-json or --destination-file");let t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))throw new Error("destination must be a JSON object");return t}function Tu(s){let e=s.command("notifications").description("Project notification channels (Slack / Teams / email event routes)");e.command("integrations <projectId>").description("List connected integrations for the project").option("--provider <provider>",`Filter by provider (${ni.join(", ")})`).action(async(t,n)=>{if(n.provider&&!ni.includes(n.provider))throw new Error(`Unknown provider. Valid: ${ni.join(", ")}`);let r=await new g(f()).projects.listNotificationIntegrations(t,n.provider);p()?D(r):v(r,["id","provider","tenantName","tenantId"])}),e.command("channels <projectId>").description("List Slack channels, or Teams teams (no --team-id) / Teams channels (with --team-id)").requiredOption("--connection-id <id>","Integration connection ID").option("--team-id <id>","Teams team ID (to list that team's channels)").action(async(t,n)=>{let i=new g(f());if(n.teamId){let a=await i.projects.listNotificationTeamsChannels(t,n.connectionId,n.teamId);p()?D(a):v(a,["id","displayName","membershipType"]);return}let r=await i.projects.listNotificationSlackChannels(t,n.connectionId).catch(()=>null);if(r){p()?D(r):v(r,["id","name","isPrivate"]);return}let o=await i.projects.listNotificationTeamsTeams(t,n.connectionId);p()?D(o):v(o,["id","displayName"])}),e.command("list <projectId>").description("List notification routes for the project").action(async t=>{let i=await new g(f()).projects.listNotificationRoutes(t);p()?D(i):v(i,["id","channelType","destinationLabel","subscribedEvents","deploymentId","agentId","enabled"])}),e.command("create <projectId>").description("Create a notification route").requiredOption("--channel-type <type>",ti.join(" | ")).requiredOption("--events <events>",`Comma-separated events (${ii.join(", ")})`).option("--connection-id <id>","Integration connection ID (Slack / Teams)").option("--destination-json <json>","Destination payload as JSON").option("--destination-file <path>","Path to a JSON file with the destination payload").option("--destination-label <label>","Human-readable label for the destination").option("--deployment-id <id>","Scope this route to one deployment").option("--agent-id <id>","Scope this route to one agent").option("--enabled <bool>","Enable the route (true|false), default true").action(async(t,n)=>{if(!ti.includes(n.channelType))throw new Error(`Unknown channel type. Valid: ${ti.join(", ")}`);let i={channelType:n.channelType,subscribedEvents:tr(n.events),destination:nr(n),connectionId:n.connectionId??null,destinationLabel:n.destinationLabel??null,deploymentId:n.deploymentId??null,agentId:n.agentId??null,...n.enabled!==void 0&&{enabled:n.enabled==="true"}},o=await new g(f()).projects.createNotificationRoute(t,i);p()?D(o):(E("Notification route created."),w(o))}),e.command("update <projectId> <routeId>").description("Update a notification route").option("--events <events>","Comma-separated events").option("--connection-id <id>","Integration connection ID").option("--destination-json <json>","Destination payload as JSON").option("--destination-file <path>","Path to a JSON file with the destination payload").option("--destination-label <label>","Human-readable label").option("--deployment-id <id>","Scope to one deployment (empty string clears)").option("--agent-id <id>","Scope to one agent (empty string clears)").option("--enabled <bool>","Enable the route (true|false)").action(async(t,n,i)=>{let r={...i.events!==void 0&&{subscribedEvents:tr(i.events)},...i.connectionId!==void 0&&{connectionId:i.connectionId===""?null:i.connectionId},...(i.destinationJson!==void 0||i.destinationFile!==void 0)&&{destination:nr(i)},...i.destinationLabel!==void 0&&{destinationLabel:i.destinationLabel},...i.deploymentId!==void 0&&{deploymentId:i.deploymentId===""?null:i.deploymentId},...i.agentId!==void 0&&{agentId:i.agentId===""?null:i.agentId},...i.enabled!==void 0&&{enabled:i.enabled==="true"}},a=await new g(f()).projects.updateNotificationRoute(t,n,r);p()?D(a):(E("Notification route updated."),w(a))}),e.command("delete <projectId> <routeId>").description("Delete a notification route").action(async(t,n)=>{await new g(f()).projects.deleteNotificationRoute(t,n),p()?D({success:!0}):E("Notification route deleted.")})}function or(s){let e=s.command("projects").description("Project management");e.command("list").description("List projects").action(async()=>{let n=await new g(f()).projects.list();p()?D(n):v(n,["id","name","icon","createdAt"])}),e.command("create").description("Create a new project").requiredOption("--name <name>","Project name").option("--team-id <teamId>","Team ID (defaults to first accessible team)").option("--icon <icon>","Project icon emoji").action(async t=>{let i=await new g(f()).projects.create({name:t.name,teamId:t.teamId,icon:t.icon});p()?D(i):(E("Project created."),w(i))}),e.command("delete <projectId>").description("Delete a project and everything inside it (deployments, tables, files)").option("-y, --yes","Skip the confirmation prompt").option("--force","Alias for --yes").action(async(t,n)=>{let i=n.yes===!0||n.force===!0,r=process.stdin.isTTY===!0&&!p();if(!i&&(r||(_({code:"CONFIRMATION_REQUIRED",message:`Refusing to delete project ${t} without confirmation. Re-run with --yes.`}),process.exit(1)),Y(`This permanently deletes project ${t} and all of its deployments, tables, and files.`),!await xu("Type y to continue: "))){E("Aborted. Nothing was deleted.");return}let a=await new g(f()).projects.delete(t);p()?D(a):E(`Project ${a.name} (${a.id}) deleted.`)}),Tu(e)}var si=I(require("fs"));function ar(s){let e=s.command("deployments").description("Deployment management");e.command("list <projectId>").description("List deployments for a project").option("--status <status>","Filter by status").option("--type <type>","Filter by type").action(async(t,n)=>{let r=await new g(f()).deployments.list(t,n);p()?D(r):v(r,["id","name","type","status","createdAt"])}),e.command("create <projectId>").description("Create a new deployment").requiredOption("--name <name>","Deployment name").requiredOption("--type <type>","Deployment type").option("--tables-file <file>","JSON file with tables configuration").action(async(t,n)=>{let i=new g(f()),r;if(n.tablesFile){let a=si.readFileSync(n.tablesFile,"utf-8");r=JSON.parse(a)}let o=await i.deployments.create(t,{name:n.name,type:n.type,tables:r});p()?D(o):(E("Deployment created."),w(o))}),e.command("config <deploymentId>").description("Get deployment configuration").action(async t=>{let i=await new g(f()).deployments.getConfig(t);p()?D(i):w(i)}),e.command("update <deploymentId>").description("Update deployment configuration").requiredOption("--body <file>","JSON file with configuration updates").action(async(t,n)=>{let i=new g(f()),r=si.readFileSync(n.body,"utf-8"),o=JSON.parse(r);await i.deployments.updateConfig(t,o),p()?D({success:!0}):E("Deployment configuration updated.")}),e.command("documents <deploymentId>").description("List documents in a deployment").option("--limit <n>","Max results","50").option("--offset <n>","Offset","0").option("--status <status>","Filter by status").action(async(t,n)=>{let r=await new g(f()).deployments.listDocuments(t,{limit:parseInt(n.limit),offset:parseInt(n.offset),status:n.status});p()?D(r):v(r.data,["id","name","status","createdAt"])})}var rn=I(require("fs")),on=I(require("path"));var lt=I(require("process"),1);var ur=(s=0)=>e=>`\x1B[${e+s}m`,lr=(s=0)=>e=>`\x1B[${38+s};5;${e}m`,cr=(s=0)=>(e,t,n)=>`\x1B[${38+s};2;${e};${t};${n}m`,L={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Cp=Object.keys(L.modifier),Ru=Object.keys(L.color),Ou=Object.keys(L.bgColor),yp=[...Ru,...Ou];function ku(){let s=new Map;for(let[e,t]of Object.entries(L)){for(let[n,i]of Object.entries(t))L[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[n]=L[n],s.set(i[0],i[1]);Object.defineProperty(L,e,{value:t,enumerable:!1})}return Object.defineProperty(L,"codes",{value:s,enumerable:!1}),L.color.close="\x1B[39m",L.bgColor.close="\x1B[49m",L.color.ansi=ur(),L.color.ansi256=lr(),L.color.ansi16m=cr(),L.bgColor.ansi=ur(10),L.bgColor.ansi256=lr(10),L.bgColor.ansi16m=cr(10),Object.defineProperties(L,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(r=>r+r).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>L.rgbToAnsi256(...L.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,i;if(e>=232)t=((e-232)*10+8)/255,n=t,i=t;else{e-=16;let a=e%36;t=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let r=Math.max(t,n,i)*2;if(r===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(t));return r===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>L.ansi256ToAnsi(L.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>L.ansi256ToAnsi(L.hexToAnsi256(e)),enumerable:!1}}),L}var Bu=ku(),ie=Bu;var Kt=I(require("process"),1),pr=I(require("os"),1),ri=I(require("tty"),1);function ee(s,e=globalThis.Deno?globalThis.Deno.args:Kt.default.argv){let t=s.startsWith("-")?"":s.length===1?"-":"--",n=e.indexOf(t+s),i=e.indexOf("--");return n!==-1&&(i===-1||n<i)}var{env:M}=Kt.default,Gt;ee("no-color")||ee("no-colors")||ee("color=false")||ee("color=never")?Gt=0:(ee("color")||ee("colors")||ee("color=true")||ee("color=always"))&&(Gt=1);function $u(){if("FORCE_COLOR"in M)return M.FORCE_COLOR==="true"?1:M.FORCE_COLOR==="false"?0:M.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(M.FORCE_COLOR,10),3)}function Pu(s){return s===0?!1:{level:s,hasBasic:!0,has256:s>=2,has16m:s>=3}}function Nu(s,{streamIsTTY:e,sniffFlags:t=!0}={}){let n=$u();n!==void 0&&(Gt=n);let i=t?Gt:n;if(i===0)return 0;if(t){if(ee("color=16m")||ee("color=full")||ee("color=truecolor"))return 3;if(ee("color=256"))return 2}if("TF_BUILD"in M&&"AGENT_NAME"in M)return 1;if(s&&!e&&i===void 0)return 0;let r=i||0;if(M.TERM==="dumb")return r;if(Kt.default.platform==="win32"){let o=pr.default.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in M)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(o=>o in M)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(o=>o in M)||M.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in M)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(M.TEAMCITY_VERSION)?1:0;if(M.COLORTERM==="truecolor"||M.TERM==="xterm-kitty"||M.TERM==="xterm-ghostty"||M.TERM==="wezterm")return 3;if("TERM_PROGRAM"in M){let o=Number.parseInt((M.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(M.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(M.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(M.TERM)||"COLORTERM"in M?1:r}function dr(s,e={}){let t=Nu(s,{streamIsTTY:s&&s.isTTY,...e});return Pu(t)}var ju={stdout:dr({isTTY:ri.default.isatty(1)}),stderr:dr({isTTY:ri.default.isatty(2)})},mr=ju;function Dr(s,e,t){let n=s.indexOf(e);if(n===-1)return s;let i=e.length,r=0,o="";do o+=s.slice(r,n)+e+t,r=n+i,n=s.indexOf(e,r);while(n!==-1);return o+=s.slice(r),o}function fr(s,e,t,n){let i=0,r="";do{let o=s[n-1]==="\r";r+=s.slice(i,o?n-1:n)+e+(o?`\r
43
+ Choice: `);if(a==="2"){await t(o);return}if(a==="3"){await n(o);return}B("Opening browser for authentication...");try{let{token:u}=await Zs(o);be({apiUrl:o,token:u}),E("Authenticated successfully. Credentials saved to ~/.limai/config.json")}catch(u){_({code:"AUTH",message:u instanceof Error?u.message:"Browser login failed"}),B("If this terminal has no browser, run `limai auth login` again and choose option 2."),process.exit(1)}}else await n(o)});async function t(i){B("Open this URL in a browser on any device:"),B(` ${i}/cli-auth?mode=remote`),B("After authorizing, a code will be shown.");let r=await tr("Paste the code here: ");r||(_({code:"VALIDATION",message:"No code entered."}),process.exit(1));let o=new g({apiUrl:i,token:r});try{await o.http.get("/health")}catch{_({code:"AUTH",message:"The code could not be verified. Make sure you copied it completely and try again."}),process.exit(1)}be({apiUrl:i,token:r}),E("Authenticated successfully. Credentials saved to ~/.limai/config.json")}async function n(i){let r=await tr("API Token: ");r||(_({code:"VALIDATION",message:"API token is required."}),process.exit(1)),be({apiUrl:i,token:r}),E("Credentials saved to ~/.limai/config.json")}e.command("logout").description("Clear stored credentials").action(()=>{be({apiUrl:"",token:""}),E("Credentials cleared.")}),e.command("status").description("Verify authentication").action(async()=>{let i=$e();i||(_({code:"AUTH",message:"Not authenticated. Run `limai auth login` first."}),process.exit(1));let r=new g(i);try{let o=await r.http.get("/me").catch(a=>{if(a instanceof et)return null;throw a});o||await r.http.get("/health"),p()?D({status:"ok",apiUrl:i.apiUrl,...o?{email:o.email}:{}}):w({status:"Authenticated",apiUrl:i.apiUrl,...o?{email:o.email}:{}})}catch(o){_({code:"AUTH",message:o instanceof Error?o.message:"Authentication failed"}),process.exit(2)}})}var rr=I(require("fs")),or=I(require("path")),ar=I(require("readline"));var ii=["EXTRACTION_COMPLETED","DOCUMENT_REVIEWED","CONTEXT_DOCUMENT_NEEDS_REVIEW","INTEGRATION_FILE_UPLOADED","AGENT_RUN_WAITING_HUMAN","AGENT_RUN_COMPLETED"],ti=["SLACK","TEAMS_CHANNEL","TEAMS_CHAT","EMAIL_ADDRESS"],ni=["SLACK","TEAMS","SHAREPOINT","GOOGLE_DRIVE"];function xu(s){let e=ar.createInterface({input:process.stdin,output:process.stderr});return new Promise(t=>{e.question(s,n=>{e.close(),t(n.trim().toLowerCase()==="y")})})}function ir(s){let e=s.split(",").map(n=>n.trim()).filter(Boolean);if(e.length===0)throw new Error("--events must list at least one event");let t=e.filter(n=>!ii.includes(n));if(t.length>0)throw new Error(`Unknown event(s): ${t.join(", ")}. Valid: ${ii.join(", ")}`);return e}function sr(s){let e=s.destinationFile?rr.readFileSync(or.resolve(s.destinationFile),"utf-8"):s.destinationJson;if(!e)throw new Error("Provide --destination-json or --destination-file");let t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))throw new Error("destination must be a JSON object");return t}function Tu(s){let e=s.command("notifications").description("Project notification channels (Slack / Teams / email event routes)");e.command("integrations <projectId>").description("List connected integrations for the project").option("--provider <provider>",`Filter by provider (${ni.join(", ")})`).action(async(t,n)=>{if(n.provider&&!ni.includes(n.provider))throw new Error(`Unknown provider. Valid: ${ni.join(", ")}`);let r=await new g(f()).projects.listNotificationIntegrations(t,n.provider);p()?D(r):v(r,["id","provider","tenantName","tenantId"])}),e.command("channels <projectId>").description("List Slack channels, or Teams teams (no --team-id) / Teams channels (with --team-id)").requiredOption("--connection-id <id>","Integration connection ID").option("--team-id <id>","Teams team ID (to list that team's channels)").action(async(t,n)=>{let i=new g(f());if(n.teamId){let a=await i.projects.listNotificationTeamsChannels(t,n.connectionId,n.teamId);p()?D(a):v(a,["id","displayName","membershipType"]);return}let r=await i.projects.listNotificationSlackChannels(t,n.connectionId).catch(()=>null);if(r){p()?D(r):v(r,["id","name","isPrivate"]);return}let o=await i.projects.listNotificationTeamsTeams(t,n.connectionId);p()?D(o):v(o,["id","displayName"])}),e.command("list <projectId>").description("List notification routes for the project").action(async t=>{let i=await new g(f()).projects.listNotificationRoutes(t);p()?D(i):v(i,["id","channelType","destinationLabel","subscribedEvents","deploymentId","agentId","enabled"])}),e.command("create <projectId>").description("Create a notification route").requiredOption("--channel-type <type>",ti.join(" | ")).requiredOption("--events <events>",`Comma-separated events (${ii.join(", ")})`).option("--connection-id <id>","Integration connection ID (Slack / Teams)").option("--destination-json <json>","Destination payload as JSON").option("--destination-file <path>","Path to a JSON file with the destination payload").option("--destination-label <label>","Human-readable label for the destination").option("--deployment-id <id>","Scope this route to one deployment").option("--agent-id <id>","Scope this route to one agent").option("--enabled <bool>","Enable the route (true|false), default true").action(async(t,n)=>{if(!ti.includes(n.channelType))throw new Error(`Unknown channel type. Valid: ${ti.join(", ")}`);let i={channelType:n.channelType,subscribedEvents:ir(n.events),destination:sr(n),connectionId:n.connectionId??null,destinationLabel:n.destinationLabel??null,deploymentId:n.deploymentId??null,agentId:n.agentId??null,...n.enabled!==void 0&&{enabled:n.enabled==="true"}},o=await new g(f()).projects.createNotificationRoute(t,i);p()?D(o):(E("Notification route created."),w(o))}),e.command("update <projectId> <routeId>").description("Update a notification route").option("--events <events>","Comma-separated events").option("--connection-id <id>","Integration connection ID").option("--destination-json <json>","Destination payload as JSON").option("--destination-file <path>","Path to a JSON file with the destination payload").option("--destination-label <label>","Human-readable label").option("--deployment-id <id>","Scope to one deployment (empty string clears)").option("--agent-id <id>","Scope to one agent (empty string clears)").option("--enabled <bool>","Enable the route (true|false)").action(async(t,n,i)=>{let r={...i.events!==void 0&&{subscribedEvents:ir(i.events)},...i.connectionId!==void 0&&{connectionId:i.connectionId===""?null:i.connectionId},...(i.destinationJson!==void 0||i.destinationFile!==void 0)&&{destination:sr(i)},...i.destinationLabel!==void 0&&{destinationLabel:i.destinationLabel},...i.deploymentId!==void 0&&{deploymentId:i.deploymentId===""?null:i.deploymentId},...i.agentId!==void 0&&{agentId:i.agentId===""?null:i.agentId},...i.enabled!==void 0&&{enabled:i.enabled==="true"}},a=await new g(f()).projects.updateNotificationRoute(t,n,r);p()?D(a):(E("Notification route updated."),w(a))}),e.command("delete <projectId> <routeId>").description("Delete a notification route").action(async(t,n)=>{await new g(f()).projects.deleteNotificationRoute(t,n),p()?D({success:!0}):E("Notification route deleted.")})}function ur(s){let e=s.command("projects").description("Project management");e.command("list").description("List projects").action(async()=>{let n=await new g(f()).projects.list();p()?D(n):v(n,["id","name","icon","createdAt"])}),e.command("create").description("Create a new project").requiredOption("--name <name>","Project name").option("--team-id <teamId>","Team ID (defaults to first accessible team)").option("--icon <icon>","Project icon emoji").action(async t=>{let i=await new g(f()).projects.create({name:t.name,teamId:t.teamId,icon:t.icon});p()?D(i):(E("Project created."),w(i))}),e.command("delete <projectId>").description("Delete a project and everything inside it (deployments, tables, files)").option("-y, --yes","Skip the confirmation prompt").option("--force","Alias for --yes").action(async(t,n)=>{let i=n.yes===!0||n.force===!0,r=process.stdin.isTTY===!0&&!p();if(!i&&(r||(_({code:"CONFIRMATION_REQUIRED",message:`Refusing to delete project ${t} without confirmation. Re-run with --yes.`}),process.exit(1)),Y(`This permanently deletes project ${t} and all of its deployments, tables, and files.`),!await xu("Type y to continue: "))){E("Aborted. Nothing was deleted.");return}let a=await new g(f()).projects.delete(t);p()?D(a):E(`Project ${a.name} (${a.id}) deleted.`)}),Tu(e)}var si=I(require("fs"));function lr(s){let e=s.command("deployments").description("Deployment management");e.command("list <projectId>").description("List deployments for a project").option("--status <status>","Filter by status").option("--type <type>","Filter by type").action(async(t,n)=>{let r=await new g(f()).deployments.list(t,n);p()?D(r):v(r,["id","name","type","status","createdAt"])}),e.command("create <projectId>").description("Create a new deployment").requiredOption("--name <name>","Deployment name").requiredOption("--type <type>","Deployment type").option("--tables-file <file>","JSON file with tables configuration").action(async(t,n)=>{let i=new g(f()),r;if(n.tablesFile){let a=si.readFileSync(n.tablesFile,"utf-8");r=JSON.parse(a)}let o=await i.deployments.create(t,{name:n.name,type:n.type,tables:r});p()?D(o):(E("Deployment created."),w(o))}),e.command("config <deploymentId>").description("Get deployment configuration").action(async t=>{let i=await new g(f()).deployments.getConfig(t);p()?D(i):w(i)}),e.command("update <deploymentId>").description("Update deployment configuration").requiredOption("--body <file>","JSON file with configuration updates").action(async(t,n)=>{let i=new g(f()),r=si.readFileSync(n.body,"utf-8"),o=JSON.parse(r);await i.deployments.updateConfig(t,o),p()?D({success:!0}):E("Deployment configuration updated.")}),e.command("documents <deploymentId>").description("List documents in a deployment").option("--limit <n>","Max results","50").option("--offset <n>","Offset","0").option("--status <status>","Filter by status").action(async(t,n)=>{let r=await new g(f()).deployments.listDocuments(t,{limit:parseInt(n.limit),offset:parseInt(n.offset),status:n.status});p()?D(r):v(r.data,["id","name","status","createdAt"])})}var rn=I(require("fs")),on=I(require("path"));var lt=I(require("process"),1);var cr=(s=0)=>e=>`\x1B[${e+s}m`,dr=(s=0)=>e=>`\x1B[${38+s};5;${e}m`,pr=(s=0)=>(e,t,n)=>`\x1B[${38+s};2;${e};${t};${n}m`,L={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Cp=Object.keys(L.modifier),Ru=Object.keys(L.color),Ou=Object.keys(L.bgColor),yp=[...Ru,...Ou];function ku(){let s=new Map;for(let[e,t]of Object.entries(L)){for(let[n,i]of Object.entries(t))L[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[n]=L[n],s.set(i[0],i[1]);Object.defineProperty(L,e,{value:t,enumerable:!1})}return Object.defineProperty(L,"codes",{value:s,enumerable:!1}),L.color.close="\x1B[39m",L.bgColor.close="\x1B[49m",L.color.ansi=cr(),L.color.ansi256=dr(),L.color.ansi16m=pr(),L.bgColor.ansi=cr(10),L.bgColor.ansi256=dr(10),L.bgColor.ansi16m=pr(10),Object.defineProperties(L,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(r=>r+r).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>L.rgbToAnsi256(...L.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,i;if(e>=232)t=((e-232)*10+8)/255,n=t,i=t;else{e-=16;let a=e%36;t=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let r=Math.max(t,n,i)*2;if(r===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(t));return r===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>L.ansi256ToAnsi(L.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>L.ansi256ToAnsi(L.hexToAnsi256(e)),enumerable:!1}}),L}var Bu=ku(),ie=Bu;var Kt=I(require("process"),1),Dr=I(require("os"),1),ri=I(require("tty"),1);function ee(s,e=globalThis.Deno?globalThis.Deno.args:Kt.default.argv){let t=s.startsWith("-")?"":s.length===1?"-":"--",n=e.indexOf(t+s),i=e.indexOf("--");return n!==-1&&(i===-1||n<i)}var{env:M}=Kt.default,Gt;ee("no-color")||ee("no-colors")||ee("color=false")||ee("color=never")?Gt=0:(ee("color")||ee("colors")||ee("color=true")||ee("color=always"))&&(Gt=1);function $u(){if("FORCE_COLOR"in M)return M.FORCE_COLOR==="true"?1:M.FORCE_COLOR==="false"?0:M.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(M.FORCE_COLOR,10),3)}function Pu(s){return s===0?!1:{level:s,hasBasic:!0,has256:s>=2,has16m:s>=3}}function Nu(s,{streamIsTTY:e,sniffFlags:t=!0}={}){let n=$u();n!==void 0&&(Gt=n);let i=t?Gt:n;if(i===0)return 0;if(t){if(ee("color=16m")||ee("color=full")||ee("color=truecolor"))return 3;if(ee("color=256"))return 2}if("TF_BUILD"in M&&"AGENT_NAME"in M)return 1;if(s&&!e&&i===void 0)return 0;let r=i||0;if(M.TERM==="dumb")return r;if(Kt.default.platform==="win32"){let o=Dr.default.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in M)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(o=>o in M)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(o=>o in M)||M.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in M)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(M.TEAMCITY_VERSION)?1:0;if(M.COLORTERM==="truecolor"||M.TERM==="xterm-kitty"||M.TERM==="xterm-ghostty"||M.TERM==="wezterm")return 3;if("TERM_PROGRAM"in M){let o=Number.parseInt((M.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(M.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(M.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(M.TERM)||"COLORTERM"in M?1:r}function mr(s,e={}){let t=Nu(s,{streamIsTTY:s&&s.isTTY,...e});return Pu(t)}var ju={stdout:mr({isTTY:ri.default.isatty(1)}),stderr:mr({isTTY:ri.default.isatty(2)})},fr=ju;function gr(s,e,t){let n=s.indexOf(e);if(n===-1)return s;let i=e.length,r=0,o="";do o+=s.slice(r,n)+e+t,r=n+i,n=s.indexOf(e,r);while(n!==-1);return o+=s.slice(r),o}function hr(s,e,t,n){let i=0,r="";do{let o=s[n-1]==="\r";r+=s.slice(i,o?n-1:n)+e+(o?`\r
44
44
  `:`
45
45
  `)+t,i=n+1,n=s.indexOf(`
46
- `,i)}while(n!==-1);return r+=s.slice(i),r}var{stdout:gr,stderr:hr}=mr,oi=Symbol("GENERATOR"),Me=Symbol("STYLER"),it=Symbol("IS_EMPTY"),Fr=["ansi","ansi","ansi256","ansi16m"],Ue=Object.create(null),Lu=(s,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let t=gr?gr.level:0;s.level=e.level===void 0?t:e.level};var Mu=s=>{let e=(...t)=>t.join(" ");return Lu(e,s),Object.setPrototypeOf(e,st.prototype),e};function st(s){return Mu(s)}Object.setPrototypeOf(st.prototype,Function.prototype);for(let[s,e]of Object.entries(ie))Ue[s]={get(){let t=Yt(this,ui(e.open,e.close,this[Me]),this[it]);return Object.defineProperty(this,s,{value:t}),t}};Ue.visible={get(){let s=Yt(this,this[Me],!0);return Object.defineProperty(this,"visible",{value:s}),s}};var ai=(s,e,t,...n)=>s==="rgb"?e==="ansi16m"?ie[t].ansi16m(...n):e==="ansi256"?ie[t].ansi256(ie.rgbToAnsi256(...n)):ie[t].ansi(ie.rgbToAnsi(...n)):s==="hex"?ai("rgb",e,t,...ie.hexToRgb(...n)):ie[t][s](...n),Uu=["rgb","hex","ansi256"];for(let s of Uu){Ue[s]={get(){let{level:t}=this;return function(...n){let i=ui(ai(s,Fr[t],"color",...n),ie.color.close,this[Me]);return Yt(this,i,this[it])}}};let e="bg"+s[0].toUpperCase()+s.slice(1);Ue[e]={get(){let{level:t}=this;return function(...n){let i=ui(ai(s,Fr[t],"bgColor",...n),ie.bgColor.close,this[Me]);return Yt(this,i,this[it])}}}}var Wu=Object.defineProperties(()=>{},{...Ue,level:{enumerable:!0,get(){return this[oi].level},set(s){this[oi].level=s}}}),ui=(s,e,t)=>{let n,i;return t===void 0?(n=s,i=e):(n=t.openAll+s,i=e+t.closeAll),{open:s,close:e,openAll:n,closeAll:i,parent:t}},Yt=(s,e,t)=>{let n=(...i)=>Vu(n,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(n,Wu),n[oi]=s,n[Me]=e,n[it]=t,n},Vu=(s,e)=>{if(s.level<=0||!e)return s[it]?"":e;let t=s[Me];if(t===void 0)return e;let{openAll:n,closeAll:i}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=Dr(e,t.close,t.open),t=t.parent;let r=e.indexOf(`
47
- `);return r!==-1&&(e=fr(e,i,n,r)),n+e+i};Object.defineProperties(st.prototype,Ue);var Hu=st(),vp=st({level:hr?hr.level:0});var se=Hu;var gi=I(require("process"),1);var rt=I(require("process"),1);var Ju=(s,e,t,n)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;let i=Object.getOwnPropertyDescriptor(s,t),r=Object.getOwnPropertyDescriptor(e,t);!qu(i,r)&&n||Object.defineProperty(s,t,r)},qu=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},Gu=(s,e)=>{let t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Ku=(s,e)=>`/* Wrapped ${s}*/
48
- ${e}`,Yu=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),zu=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Xu=(s,e,t)=>{let n=t===""?"":`with ${t.trim()}() `,i=Ku.bind(null,n,e.toString());Object.defineProperty(i,"name",zu);let{writable:r,enumerable:o,configurable:a}=Yu;Object.defineProperty(s,"toString",{value:i,writable:r,enumerable:o,configurable:a})};function li(s,e,{ignoreNonConfigurable:t=!1}={}){let{name:n}=s;for(let i of Reflect.ownKeys(e))Ju(s,e,i,t);return Gu(s,e),Xu(s,e,n),s}var zt=new WeakMap,Cr=(s,e={})=>{if(typeof s!="function")throw new TypeError("Expected a function");let t,n=0,i=s.displayName||s.name||"<anonymous>",r=function(...o){if(zt.set(r,++n),n===1)t=s.apply(this,o),s=void 0;else if(e.throw===!0)throw new Error(`Function \`${i}\` can only be called once`);return t};return li(r,s),zt.set(r,n),r};Cr.callCount=s=>{if(!zt.has(s))throw new Error(`The given function \`${s.name}\` is not wrapped by the \`onetime\` package`);return zt.get(s)};var yr=Cr;var we=[];we.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&we.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&we.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Xt=s=>!!s&&typeof s=="object"&&typeof s.removeListener=="function"&&typeof s.emit=="function"&&typeof s.reallyExit=="function"&&typeof s.listeners=="function"&&typeof s.kill=="function"&&typeof s.pid=="number"&&typeof s.on=="function",ci=Symbol.for("signal-exit emitter"),di=globalThis,Qu=Object.defineProperty.bind(Object),pi=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(di[ci])return di[ci];Qu(di,ci,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let n=this.listeners[e],i=n.indexOf(t);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,t,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let r of this.listeners[e])i=r(t,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",t,n)||i),i}},Qt=class{},Zu=s=>({onExit(e,t){return s.onExit(e,t)},load(){return s.load()},unload(){return s.unload()}}),mi=class extends Qt{onExit(){return()=>{}}load(){}unload(){}},Di=class extends Qt{#o=fi.platform==="win32"?"SIGINT":"SIGHUP";#n=new pi;#e;#s;#p;#t={};#r=!1;constructor(e){super(),this.#e=e,this.#t={};for(let t of we)this.#t[t]=()=>{let n=this.#e.listeners(t),{count:i}=this.#n,r=e;if(typeof r.__signal_exit_emitter__=="object"&&typeof r.__signal_exit_emitter__.count=="number"&&(i+=r.__signal_exit_emitter__.count),n.length===i){this.unload();let o=this.#n.emit("exit",null,t),a=t==="SIGHUP"?this.#o:t;o||e.kill(e.pid,a)}};this.#p=e.reallyExit,this.#s=e.emit}onExit(e,t){if(!Xt(this.#e))return()=>{};this.#r===!1&&this.load();let n=t?.alwaysLast?"afterExit":"exit";return this.#n.on(n,e),()=>{this.#n.removeListener(n,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#r){this.#r=!0,this.#n.count+=1;for(let e of we)try{let t=this.#t[e];t&&this.#e.on(e,t)}catch{}this.#e.emit=(e,...t)=>this.#m(e,...t),this.#e.reallyExit=e=>this.#i(e)}}unload(){this.#r&&(this.#r=!1,we.forEach(e=>{let t=this.#t[e];if(!t)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,t)}catch{}}),this.#e.emit=this.#s,this.#e.reallyExit=this.#p,this.#n.count-=1)}#i(e){return Xt(this.#e)?(this.#e.exitCode=e||0,this.#n.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#m(e,...t){let n=this.#s;if(e==="exit"&&Xt(this.#e)){typeof t[0]=="number"&&(this.#e.exitCode=t[0]);let i=n.call(this.#e,e,...t);return this.#n.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...t)}},fi=globalThis.process,{onExit:Er,load:Bp,unload:$p}=Zu(Xt(fi)?new Di(fi):new mi);var br=rt.default.stderr.isTTY?rt.default.stderr:rt.default.stdout.isTTY?rt.default.stdout:void 0,el=br?yr(()=>{Er(()=>{br.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},wr=el;var Zt=!1,We={};We.show=(s=gi.default.stderr)=>{s.isTTY&&(Zt=!1,s.write("\x1B[?25h"))};We.hide=(s=gi.default.stderr)=>{s.isTTY&&(wr(),Zt=!0,s.write("\x1B[?25l"))};We.toggle=(s,e)=>{s!==void 0&&(Zt=s),Zt?We.show(e):We.hide(e)};var hi=We;var ct=I(Fi(),1);var te=I(require("process"),1);function Ci(){return te.default.platform!=="win32"?te.default.env.TERM!=="linux":!!te.default.env.CI||!!te.default.env.WT_SESSION||!!te.default.env.TERMINUS_SUBLIME||te.default.env.ConEmuTask==="{cmd::Cmder}"||te.default.env.TERM_PROGRAM==="Terminus-Sublime"||te.default.env.TERM_PROGRAM==="vscode"||te.default.env.TERM==="xterm-256color"||te.default.env.TERM==="alacritty"||te.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var nl={info:se.blue("\u2139"),success:se.green("\u2714"),warning:se.yellow("\u26A0"),error:se.red("\u2716")},il={info:se.blue("i"),success:se.green("\u221A"),warning:se.yellow("\u203C"),error:se.red("\xD7")},sl=Ci()?nl:il,ot=sl;function yi({onlyFirst:s=!1}={}){let i="(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,s?void 0:"g")}var rl=yi();function at(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return!s.includes("\x1B")&&!s.includes("\x9B")?s:s.replace(rl,"")}var tn=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],nn=[12288,12288,65281,65376,65504,65510],Ei=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],bi=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],ut=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var sn=(s,e)=>{let t=0,n=Math.floor(s.length/2)-1;for(;t<=n;){let i=Math.floor((t+n)/2),r=i*2;if(e<s[r])n=i-1;else if(e>s[r+1])t=i+1;else return!0}return!1};var ol=tn[0],al=tn.at(-1),ul=nn[0],ll=nn.at(-1),tm=Ei[0],nm=Ei.at(-1),im=bi[0],sm=bi.at(-1),cl=ut[0],dl=ut.at(-1),vr=19968,[pl,ml]=Dl(ut);function Dl(s){let e=s[0],t=s[1];for(let n=0;n<s.length;n+=2){let i=s[n],r=s[n+1];if(vr>=i&&vr<=r)return[i,r];r-i>t-e&&(e=i,t=r)}return[e,t]}var Sr=s=>s<ol||s>al?!1:sn(tn,s),xr=s=>s<ul||s>ll?!1:sn(nn,s);var Tr=s=>s>=pl&&s<=ml?!0:s<cl||s>dl?!1:sn(ut,s);function fl(s){if(!Number.isSafeInteger(s))throw new TypeError(`Expected a code point, got \`${typeof s}\`.`)}function Rr(s,{ambiguousAsWide:e=!1}={}){return fl(s),xr(s)||Tr(s)||e&&Sr(s)?2:1}var Or=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;var gl=new Intl.Segmenter,hl=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function wi(s,e={}){if(typeof s!="string"||s.length===0)return 0;let{ambiguousIsNarrow:t=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(s=at(s)),s.length===0)return 0;let i=0,r={ambiguousAsWide:!t};for(let{segment:o}of gl.segment(s)){let a=o.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!hl.test(o)){if(Or().test(o)){i+=2;continue}i+=Rr(a,r)}}return i}function Ii({stream:s=process.stdout}={}){return!!(s&&s.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var Ai=I(require("process"),1);function _i(){let{env:s}=Ai.default,{TERM:e,TERM_PROGRAM:t}=s;return Ai.default.platform!=="win32"?e!=="linux":!!s.WT_SESSION||!!s.TERMINUS_SUBLIME||s.ConEmuTask==="{cmd::Cmder}"||t==="Terminus-Sublime"||t==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||s.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var re=I(require("process"),1),Fl=3,vi=class{#o=0;start(){this.#o++,this.#o===1&&this.#n()}stop(){if(this.#o<=0)throw new Error("`stop` called more times than `start`");this.#o--,this.#o===0&&this.#e()}#n(){re.default.platform==="win32"||!re.default.stdin.isTTY||(re.default.stdin.setRawMode(!0),re.default.stdin.on("data",this.#s),re.default.stdin.resume())}#e(){re.default.stdin.isTTY&&(re.default.stdin.off("data",this.#s),re.default.stdin.pause(),re.default.stdin.setRawMode(!1))}#s(e){e[0]===Fl&&re.default.emit("SIGINT")}},Cl=new vi,Si=Cl;var yl=I(Fi(),1),xi=class{#o=0;#n=!1;#e=0;#s=-1;#p=0;#t;#r;#i;#m;#f;#l;#c;#d;#g;#a;#u;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:lt.default.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#f=this.#t.interval,this.#i=this.#t.stream,this.#l=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Ii({stream:this.#i}),this.#c=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,lt.default.env.NODE_ENV==="test"&&(this._stream=this.#i,this._isEnabled=this.#l,Object.defineProperty(this,"_linesToClear",{get(){return this.#o},set(t){this.#o=t}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#s}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#d}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#d=e,this.#D()}get interval(){return this.#f??this.#r.interval??100}get spinner(){return this.#r}set spinner(e){if(this.#s=-1,this.#f=void 0,typeof e=="object"){if(e.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#r=e}else if(!_i())this.#r=ct.default.line;else if(e===void 0)this.#r=ct.default.dots;else if(e!=="default"&&ct.default[e])this.#r=ct.default[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#g}set text(e=""){this.#g=e,this.#D()}get prefixText(){return this.#a}set prefixText(e=""){this.#a=e,this.#D()}get suffixText(){return this.#u}set suffixText(e=""){this.#u=e,this.#D()}get isSpinning(){return this.#m!==void 0}#h(e=this.#a,t=" "){return typeof e=="string"&&e!==""?e+t:typeof e=="function"?e()+t:""}#F(e=this.#u,t=" "){return typeof e=="string"&&e!==""?t+e:typeof e=="function"?t+e():""}#D(){let e=this.#i.columns??80,t=this.#h(this.#a,"-"),n=this.#F(this.#u,"-"),i=" ".repeat(this.#d)+t+"--"+this.#g+"--"+n;this.#e=0;for(let r of at(i).split(`
46
+ `,i)}while(n!==-1);return r+=s.slice(i),r}var{stdout:Fr,stderr:Cr}=fr,oi=Symbol("GENERATOR"),Me=Symbol("STYLER"),it=Symbol("IS_EMPTY"),yr=["ansi","ansi","ansi256","ansi16m"],Ue=Object.create(null),Lu=(s,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let t=Fr?Fr.level:0;s.level=e.level===void 0?t:e.level};var Mu=s=>{let e=(...t)=>t.join(" ");return Lu(e,s),Object.setPrototypeOf(e,st.prototype),e};function st(s){return Mu(s)}Object.setPrototypeOf(st.prototype,Function.prototype);for(let[s,e]of Object.entries(ie))Ue[s]={get(){let t=Yt(this,ui(e.open,e.close,this[Me]),this[it]);return Object.defineProperty(this,s,{value:t}),t}};Ue.visible={get(){let s=Yt(this,this[Me],!0);return Object.defineProperty(this,"visible",{value:s}),s}};var ai=(s,e,t,...n)=>s==="rgb"?e==="ansi16m"?ie[t].ansi16m(...n):e==="ansi256"?ie[t].ansi256(ie.rgbToAnsi256(...n)):ie[t].ansi(ie.rgbToAnsi(...n)):s==="hex"?ai("rgb",e,t,...ie.hexToRgb(...n)):ie[t][s](...n),Uu=["rgb","hex","ansi256"];for(let s of Uu){Ue[s]={get(){let{level:t}=this;return function(...n){let i=ui(ai(s,yr[t],"color",...n),ie.color.close,this[Me]);return Yt(this,i,this[it])}}};let e="bg"+s[0].toUpperCase()+s.slice(1);Ue[e]={get(){let{level:t}=this;return function(...n){let i=ui(ai(s,yr[t],"bgColor",...n),ie.bgColor.close,this[Me]);return Yt(this,i,this[it])}}}}var Wu=Object.defineProperties(()=>{},{...Ue,level:{enumerable:!0,get(){return this[oi].level},set(s){this[oi].level=s}}}),ui=(s,e,t)=>{let n,i;return t===void 0?(n=s,i=e):(n=t.openAll+s,i=e+t.closeAll),{open:s,close:e,openAll:n,closeAll:i,parent:t}},Yt=(s,e,t)=>{let n=(...i)=>Vu(n,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(n,Wu),n[oi]=s,n[Me]=e,n[it]=t,n},Vu=(s,e)=>{if(s.level<=0||!e)return s[it]?"":e;let t=s[Me];if(t===void 0)return e;let{openAll:n,closeAll:i}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=gr(e,t.close,t.open),t=t.parent;let r=e.indexOf(`
47
+ `);return r!==-1&&(e=hr(e,i,n,r)),n+e+i};Object.defineProperties(st.prototype,Ue);var Hu=st(),vp=st({level:Cr?Cr.level:0});var se=Hu;var gi=I(require("process"),1);var rt=I(require("process"),1);var Ju=(s,e,t,n)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;let i=Object.getOwnPropertyDescriptor(s,t),r=Object.getOwnPropertyDescriptor(e,t);!qu(i,r)&&n||Object.defineProperty(s,t,r)},qu=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},Gu=(s,e)=>{let t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Ku=(s,e)=>`/* Wrapped ${s}*/
48
+ ${e}`,Yu=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),zu=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Xu=(s,e,t)=>{let n=t===""?"":`with ${t.trim()}() `,i=Ku.bind(null,n,e.toString());Object.defineProperty(i,"name",zu);let{writable:r,enumerable:o,configurable:a}=Yu;Object.defineProperty(s,"toString",{value:i,writable:r,enumerable:o,configurable:a})};function li(s,e,{ignoreNonConfigurable:t=!1}={}){let{name:n}=s;for(let i of Reflect.ownKeys(e))Ju(s,e,i,t);return Gu(s,e),Xu(s,e,n),s}var zt=new WeakMap,Er=(s,e={})=>{if(typeof s!="function")throw new TypeError("Expected a function");let t,n=0,i=s.displayName||s.name||"<anonymous>",r=function(...o){if(zt.set(r,++n),n===1)t=s.apply(this,o),s=void 0;else if(e.throw===!0)throw new Error(`Function \`${i}\` can only be called once`);return t};return li(r,s),zt.set(r,n),r};Er.callCount=s=>{if(!zt.has(s))throw new Error(`The given function \`${s.name}\` is not wrapped by the \`onetime\` package`);return zt.get(s)};var br=Er;var we=[];we.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&we.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&we.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Xt=s=>!!s&&typeof s=="object"&&typeof s.removeListener=="function"&&typeof s.emit=="function"&&typeof s.reallyExit=="function"&&typeof s.listeners=="function"&&typeof s.kill=="function"&&typeof s.pid=="number"&&typeof s.on=="function",ci=Symbol.for("signal-exit emitter"),di=globalThis,Qu=Object.defineProperty.bind(Object),pi=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(di[ci])return di[ci];Qu(di,ci,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let n=this.listeners[e],i=n.indexOf(t);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,t,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let r of this.listeners[e])i=r(t,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",t,n)||i),i}},Qt=class{},Zu=s=>({onExit(e,t){return s.onExit(e,t)},load(){return s.load()},unload(){return s.unload()}}),mi=class extends Qt{onExit(){return()=>{}}load(){}unload(){}},Di=class extends Qt{#o=fi.platform==="win32"?"SIGINT":"SIGHUP";#n=new pi;#e;#s;#p;#t={};#r=!1;constructor(e){super(),this.#e=e,this.#t={};for(let t of we)this.#t[t]=()=>{let n=this.#e.listeners(t),{count:i}=this.#n,r=e;if(typeof r.__signal_exit_emitter__=="object"&&typeof r.__signal_exit_emitter__.count=="number"&&(i+=r.__signal_exit_emitter__.count),n.length===i){this.unload();let o=this.#n.emit("exit",null,t),a=t==="SIGHUP"?this.#o:t;o||e.kill(e.pid,a)}};this.#p=e.reallyExit,this.#s=e.emit}onExit(e,t){if(!Xt(this.#e))return()=>{};this.#r===!1&&this.load();let n=t?.alwaysLast?"afterExit":"exit";return this.#n.on(n,e),()=>{this.#n.removeListener(n,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#r){this.#r=!0,this.#n.count+=1;for(let e of we)try{let t=this.#t[e];t&&this.#e.on(e,t)}catch{}this.#e.emit=(e,...t)=>this.#m(e,...t),this.#e.reallyExit=e=>this.#i(e)}}unload(){this.#r&&(this.#r=!1,we.forEach(e=>{let t=this.#t[e];if(!t)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,t)}catch{}}),this.#e.emit=this.#s,this.#e.reallyExit=this.#p,this.#n.count-=1)}#i(e){return Xt(this.#e)?(this.#e.exitCode=e||0,this.#n.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#m(e,...t){let n=this.#s;if(e==="exit"&&Xt(this.#e)){typeof t[0]=="number"&&(this.#e.exitCode=t[0]);let i=n.call(this.#e,e,...t);return this.#n.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...t)}},fi=globalThis.process,{onExit:wr,load:Bp,unload:$p}=Zu(Xt(fi)?new Di(fi):new mi);var Ir=rt.default.stderr.isTTY?rt.default.stderr:rt.default.stdout.isTTY?rt.default.stdout:void 0,el=Ir?br(()=>{wr(()=>{Ir.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Ar=el;var Zt=!1,We={};We.show=(s=gi.default.stderr)=>{s.isTTY&&(Zt=!1,s.write("\x1B[?25h"))};We.hide=(s=gi.default.stderr)=>{s.isTTY&&(Ar(),Zt=!0,s.write("\x1B[?25l"))};We.toggle=(s,e)=>{s!==void 0&&(Zt=s),Zt?We.show(e):We.hide(e)};var hi=We;var ct=I(Fi(),1);var te=I(require("process"),1);function Ci(){return te.default.platform!=="win32"?te.default.env.TERM!=="linux":!!te.default.env.CI||!!te.default.env.WT_SESSION||!!te.default.env.TERMINUS_SUBLIME||te.default.env.ConEmuTask==="{cmd::Cmder}"||te.default.env.TERM_PROGRAM==="Terminus-Sublime"||te.default.env.TERM_PROGRAM==="vscode"||te.default.env.TERM==="xterm-256color"||te.default.env.TERM==="alacritty"||te.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var nl={info:se.blue("\u2139"),success:se.green("\u2714"),warning:se.yellow("\u26A0"),error:se.red("\u2716")},il={info:se.blue("i"),success:se.green("\u221A"),warning:se.yellow("\u203C"),error:se.red("\xD7")},sl=Ci()?nl:il,ot=sl;function yi({onlyFirst:s=!1}={}){let i="(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,s?void 0:"g")}var rl=yi();function at(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return!s.includes("\x1B")&&!s.includes("\x9B")?s:s.replace(rl,"")}var tn=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],nn=[12288,12288,65281,65376,65504,65510],Ei=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],bi=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],ut=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var sn=(s,e)=>{let t=0,n=Math.floor(s.length/2)-1;for(;t<=n;){let i=Math.floor((t+n)/2),r=i*2;if(e<s[r])n=i-1;else if(e>s[r+1])t=i+1;else return!0}return!1};var ol=tn[0],al=tn.at(-1),ul=nn[0],ll=nn.at(-1),tm=Ei[0],nm=Ei.at(-1),im=bi[0],sm=bi.at(-1),cl=ut[0],dl=ut.at(-1),xr=19968,[pl,ml]=Dl(ut);function Dl(s){let e=s[0],t=s[1];for(let n=0;n<s.length;n+=2){let i=s[n],r=s[n+1];if(xr>=i&&xr<=r)return[i,r];r-i>t-e&&(e=i,t=r)}return[e,t]}var Tr=s=>s<ol||s>al?!1:sn(tn,s),Rr=s=>s<ul||s>ll?!1:sn(nn,s);var Or=s=>s>=pl&&s<=ml?!0:s<cl||s>dl?!1:sn(ut,s);function fl(s){if(!Number.isSafeInteger(s))throw new TypeError(`Expected a code point, got \`${typeof s}\`.`)}function kr(s,{ambiguousAsWide:e=!1}={}){return fl(s),Rr(s)||Or(s)||e&&Tr(s)?2:1}var Br=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;var gl=new Intl.Segmenter,hl=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function wi(s,e={}){if(typeof s!="string"||s.length===0)return 0;let{ambiguousIsNarrow:t=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(s=at(s)),s.length===0)return 0;let i=0,r={ambiguousAsWide:!t};for(let{segment:o}of gl.segment(s)){let a=o.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!hl.test(o)){if(Br().test(o)){i+=2;continue}i+=kr(a,r)}}return i}function Ii({stream:s=process.stdout}={}){return!!(s&&s.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var Ai=I(require("process"),1);function _i(){let{env:s}=Ai.default,{TERM:e,TERM_PROGRAM:t}=s;return Ai.default.platform!=="win32"?e!=="linux":!!s.WT_SESSION||!!s.TERMINUS_SUBLIME||s.ConEmuTask==="{cmd::Cmder}"||t==="Terminus-Sublime"||t==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||s.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var re=I(require("process"),1),Fl=3,vi=class{#o=0;start(){this.#o++,this.#o===1&&this.#n()}stop(){if(this.#o<=0)throw new Error("`stop` called more times than `start`");this.#o--,this.#o===0&&this.#e()}#n(){re.default.platform==="win32"||!re.default.stdin.isTTY||(re.default.stdin.setRawMode(!0),re.default.stdin.on("data",this.#s),re.default.stdin.resume())}#e(){re.default.stdin.isTTY&&(re.default.stdin.off("data",this.#s),re.default.stdin.pause(),re.default.stdin.setRawMode(!1))}#s(e){e[0]===Fl&&re.default.emit("SIGINT")}},Cl=new vi,Si=Cl;var yl=I(Fi(),1),xi=class{#o=0;#n=!1;#e=0;#s=-1;#p=0;#t;#r;#i;#m;#f;#l;#c;#d;#g;#a;#u;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:lt.default.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#f=this.#t.interval,this.#i=this.#t.stream,this.#l=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Ii({stream:this.#i}),this.#c=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,lt.default.env.NODE_ENV==="test"&&(this._stream=this.#i,this._isEnabled=this.#l,Object.defineProperty(this,"_linesToClear",{get(){return this.#o},set(t){this.#o=t}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#s}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#d}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#d=e,this.#D()}get interval(){return this.#f??this.#r.interval??100}get spinner(){return this.#r}set spinner(e){if(this.#s=-1,this.#f=void 0,typeof e=="object"){if(e.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#r=e}else if(!_i())this.#r=ct.default.line;else if(e===void 0)this.#r=ct.default.dots;else if(e!=="default"&&ct.default[e])this.#r=ct.default[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#g}set text(e=""){this.#g=e,this.#D()}get prefixText(){return this.#a}set prefixText(e=""){this.#a=e,this.#D()}get suffixText(){return this.#u}set suffixText(e=""){this.#u=e,this.#D()}get isSpinning(){return this.#m!==void 0}#h(e=this.#a,t=" "){return typeof e=="string"&&e!==""?e+t:typeof e=="function"?e()+t:""}#F(e=this.#u,t=" "){return typeof e=="string"&&e!==""?t+e:typeof e=="function"?t+e():""}#D(){let e=this.#i.columns??80,t=this.#h(this.#a,"-"),n=this.#F(this.#u,"-"),i=" ".repeat(this.#d)+t+"--"+this.#g+"--"+n;this.#e=0;for(let r of at(i).split(`
49
49
  `))this.#e+=Math.max(1,Math.ceil(wi(r,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#l&&!this.#c}set isEnabled(e){if(typeof e!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#l=e}get isSilent(){return this.#c}set isSilent(e){if(typeof e!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#c=e}frame(){let e=Date.now();(this.#s===-1||e-this.#p>=this.interval)&&(this.#s=++this.#s%this.#r.frames.length,this.#p=e);let{frames:t}=this.#r,n=t[this.#s];this.color&&(n=se[this.color](n));let i=typeof this.#a=="string"&&this.#a!==""?this.#a+" ":"",r=typeof this.text=="string"?" "+this.text:"",o=typeof this.#u=="string"&&this.#u!==""?" "+this.#u:"";return i+n+r+o}clear(){if(!this.#l||!this.#i.isTTY)return this;this.#i.cursorTo(0);for(let e=0;e<this.#o;e++)e>0&&this.#i.moveCursor(0,-1),this.#i.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#i.cursorTo(this.#d),this.lastIndent=this.#d,this.#o=0,this}render(){return this.#c?this:(this.clear(),this.#i.write(this.frame()),this.#o=this.#e,this)}start(e){return e&&(this.text=e),this.#c?this:this.#l?this.isSpinning?this:(this.#t.hideCursor&&hi.hide(this.#i),this.#t.discardStdin&&lt.default.stdin.isTTY&&(this.#n=!0,Si.start()),this.render(),this.#m=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#i.write(`- ${this.text}
50
50
  `),this)}stop(){return this.#l?(clearInterval(this.#m),this.#m=void 0,this.#s=0,this.clear(),this.#t.hideCursor&&hi.show(this.#i),this.#t.discardStdin&&lt.default.stdin.isTTY&&this.#n&&(Si.stop(),this.#n=!1),this):this}succeed(e){return this.stopAndPersist({symbol:ot.success,text:e})}fail(e){return this.stopAndPersist({symbol:ot.error,text:e})}warn(e){return this.stopAndPersist({symbol:ot.warning,text:e})}info(e){return this.stopAndPersist({symbol:ot.info,text:e})}stopAndPersist(e={}){if(this.#c)return this;let t=e.prefixText??this.#a,n=this.#h(t," "),i=e.symbol??" ",r=e.text??this.text,a=typeof r=="string"?(i?" ":"")+r:"",u=e.suffixText??this.#u,l=this.#F(u," "),c=n+i+a+l+`
51
- `;return this.stop(),this.#i.write(c),this}};function Ti(s){return new xi(s)}var Ie={start(){return Ie},stop(){return Ie},succeed(){return Ie},fail(){return Ie},warn(){return Ie},info(){return Ie},text:"",isSpinning:!1};function y(s){return p()?Ie:Ti({text:s,color:"cyan"})}function kr(s){let e=s.command("documents").description("Document upload and processing");e.command("upload <extractionSchemaId> <file>").description("Upload a document for extraction").action(async(t,n)=>{let i=new g(f()),r=on.resolve(n);rn.existsSync(r)||(console.error(`File not found: ${r}`),process.exit(1));let o=y(`Uploading ${on.basename(r)}...`);o.start();let a=await i.uploadFile(t,r);a.isDuplicate?o.warn("File already exists (duplicate)."):o.succeed("File uploaded."),p()?D(a):w(a)}),e.command("process <extractionSchemaId> <fileId>").description("Process a document for extraction").option("--async","Process asynchronously").option("--wait","Wait for completion (implies --async)").action(async(t,n,i)=>{let r=new g(f());if(i.async||i.wait){let a=await r.documents.processAsync(t,n);if(i.wait){let u=y(`Waiting for extraction (job ${a.jobId})...`);u.start();let c=await new Z(r.queue).waitForCompletion(a.jobId,{onStatus:d=>{u.text=`Extraction: ${d.status} (${d.extractionStageStatus})`}});if(c.status==="COMPLETED"){u.succeed("Extraction completed.");let d=await r.documents.getFileData(n,t);p()?D(d):w({fileId:n,status:"COMPLETED",tables:Object.keys(d.data?.tables??{}).length})}else u.fail(`Extraction ${c.status}`),process.exit(1)}else p()?D(a):(E("Processing job queued."),w(a))}else{let a=y("Processing file...");a.start();let u=await r.documents.processSync(t,n);a.succeed("Processing complete."),p()?D(u):w(u)}}),e.command("get <fileId>").description("Get extracted file data").option("--extraction-schema-id <id>","Extraction schema ID").action(async(t,n)=>{let r=await new g(f()).documents.getFileData(t,n.extractionSchemaId);p()?D(r):w(r)}),e.command("data <deploymentId> <fileIds...>").description("Get flat slug-keyed data for one or more documents").option("--include <options>","Comma-separated enrichments: confidence, boundingBoxes, validations").action(async(t,n,i)=>{let r=new g(f()),o=i.include?.split(",").map(u=>u.trim()).filter(Boolean),a=await r.documents.getDocumentsData(t,n,o);p()?D(a):w(a)}),e.command("correct <extractionSchemaId> <fileId>").description("Submit corrections for extracted data").requiredOption("--corrections <file>","JSON file with corrections").action(async(t,n,i)=>{let r=new g(f()),o=rn.readFileSync(i.corrections,"utf-8"),a=JSON.parse(o);await r.documents.submitCorrections(t,n,a),p()?D({success:!0}):E("Corrections submitted.")})}var Ri=I(require("fs"));function Br(s){let e=s.command("tables").description("Table management");e.command("create <deploymentId>").description("Create a table in a deployment").requiredOption("--body <file>","JSON file with table definition").action(async(t,n)=>{let i=new g(f()),r=Ri.readFileSync(n.body,"utf-8"),o=JSON.parse(r),a=await i.tables.createTable(t,o);p()?D(a):(E("Table created."),w(a))}),e.command("update <tableId>").description("Update a table's instructions or name").option("--instructions <text>","New instructions text").option("--instructions-file <file>","Read new instructions from a file (overrides --instructions)").option("--name <name>","New table name").action(async(t,n)=>{let i=new g(f()),r={};if(n.instructionsFile?r.instructions=Ri.readFileSync(n.instructionsFile,"utf-8"):n.instructions!==void 0&&(r.instructions=n.instructions),n.name!==void 0&&(r.name=n.name),Object.keys(r).length===0)throw new Error("Provide at least one of --instructions, --instructions-file, or --name");let o=await i.tables.update(t,r);p()?D(o):(E("Table updated."),w(o))}),e.command("get <tableId>").description("Get table details").action(async t=>{let i=await new g(f()).tables.get(t);p()?D(i):w(i)}),e.command("rows <tableId>").description("List rows in a table").option("--limit <n>","Number of rows","50").option("--offset <n>","Offset","0").option("--all","Fetch all rows (auto-paginate)").action(async(t,n)=>{let i=new g(f());if(n.all){let r=await kt(Ps(async(o,a)=>i.tables.listRows(t,{limit:o,offset:a}),{pageSize:500}));p()?D(r):v(r)}else{let r=await i.tables.listRows(t,{limit:parseInt(n.limit),offset:parseInt(n.offset)});p()?D(r):v(r.data)}}),e.command("columns <tableId>").description("List columns in a table").action(async t=>{let i=await new g(f()).tables.listColumns(t);p()?D(i):v(i,["id","name","type"])})}var Wr=I(require("fs"));var $r=["index","id","name","slug","type","isKey","units","autoGenerateUnits","defaultValue","defaultValueEnabled"],El="NUMBER_WITH_UNIT columns need --units a,b or --auto-generate-units on.";function Pr(s){return{...s,units:(s.units??[]).map(e=>e.name).join(", ")}}function bl(s){if(s.type==="NUMBER_WITH_UNIT"&&!s.autoGenerateUnits&&!(s.units&&s.units.length>0))throw new Q(El)}function Ae(s){if(s==="on")return!0;if(s==="off")return!1;throw new Q("Expected 'on' or 'off'.")}function wl(s){let e=Number(s);if(!Number.isInteger(e)||e<40||e>2e3)throw new Q("Expected an integer between 40 and 2000.");return e}function Il(s){try{return JSON.parse(s)}catch{return s}}function Nr(s){return s.split(",").map(e=>e.trim()).filter(Boolean)}function jr(s){return s.option("--name <name>","Column name").option("--slug <slug>","Column slug (snake_case)").option("--type <type>","Column type, e.g. TEXT, NUMBER, DATE, LABEL").option("--description <text>","Column description").option("--is-key <on|off>","Mark the column as a key column",Ae).option("--is-list <on|off>","Store multiple values per cell",Ae).option("--date-format <format>","Date format: EU, US or ISO").option("--measurement-type <type>","Benchmark measurement type").option("--excluded-from-extraction <on|off>","Keep the column out of extraction prompts",Ae).option("--pinned <on|off>","Pin the column in the grid",Ae).option("--size <px>","Column width in pixels (40-2000)",wl).option("--default-value <json>","Default value as JSON (falls back to a plain string)",Il).option("--clear-default-value","Clear the stored default value").option("--default-value-enabled <on|off>","Write the default value into empty cells during extraction",Ae).option("--auto-generate-labels <on|off>","Let extraction invent new labels",Ae).option("--auto-generate-units <on|off>","Let extraction invent new units",Ae).option("--labels <names>","Comma-separated label names",Nr).option("--units <names>","Comma-separated unit names",Nr)}function Lr(s){let e={};return s.name!==void 0&&(e.name=s.name),s.slug!==void 0&&(e.slug=s.slug),s.type!==void 0&&(e.type=s.type),s.description!==void 0&&(e.description=s.description),s.isKey!==void 0&&(e.isKey=s.isKey),s.isList!==void 0&&(e.isList=s.isList),s.dateFormat!==void 0&&(e.dateFormat=s.dateFormat),s.measurementType!==void 0&&(e.measurementType=s.measurementType),s.excludedFromExtraction!==void 0&&(e.excludedFromExtraction=s.excludedFromExtraction),s.pinned!==void 0&&(e.pinned=s.pinned),s.size!==void 0&&(e.size=s.size),s.clearDefaultValue?e.defaultValue=null:s.defaultValue!==void 0&&(e.defaultValue=s.defaultValue),s.defaultValueEnabled!==void 0&&(e.defaultValueEnabled=s.defaultValueEnabled),s.autoGenerateLabels!==void 0&&(e.autoGenerateLabels=s.autoGenerateLabels),s.autoGenerateUnits!==void 0&&(e.autoGenerateUnits=s.autoGenerateUnits),s.labels!==void 0&&(e.labels=s.labels.map(t=>({name:t}))),s.units!==void 0&&(e.units=s.units.map(t=>({name:t}))),e}function Mr(s){return JSON.parse(Wr.readFileSync(s,"utf-8"))}function Ur(s){if(p()){D(s);return}w(s)}function Vr(s){let e=s.command("columns").description("Column management");e.command("list <tableId>").description("List the columns of a table").action(async t=>{let i=await new g(f()).columns.list(t);p()?D(i):v(i.map(Pr),$r)}),e.command("get <columnId>").description("Get column details").action(async t=>{let i=await new g(f()).columns.get(t);Ur(i)}),jr(e.command("create <tableId>").description("Create one or more columns in a table").option("--body <file>","JSON file with a column object or { columns: [...] }")).action(async(t,n)=>{let i=Lr(n),r=n.body?Mr(n.body):void 0,o=Al(r,i);for(let l of"columns"in o?o.columns:[o])bl(l);let u=await new g(f()).columns.create(t,o);if(p()){D(u);return}E(`Created ${u.length} column${u.length===1?"":"s"}.`),v(u.map(Pr),$r)}),jr(e.command("update <columnId>").description("Update a column").option("--body <file>","JSON file with the fields to update").option("--confirm-slug-change","Confirm a slug change (breaks integrations that reference it)")).action(async(t,n)=>{let r={...n.body?Mr(n.body):{},...Lr(n)};if(n.confirmSlugChange&&(r.confirmSlugChange=!0),Object.keys(r).every(u=>u==="confirmSlugChange"))throw new Q("Provide --body or at least one field flag.");let a=await new g(f()).columns.update(t,r);if(p()){D(a);return}E("Column updated."),Ur(a)})}function Al(s,e){if(s&&typeof s=="object"&&"columns"in s){if(Object.keys(e).length>0)throw new Q("Field flags cannot be combined with a bulk --body file.");return s}let t={...s,...e};if(typeof t.name!="string"||t.name.length===0)throw new Q("A column name is required (--name).");return t}var qr=I(require("fs"));var Hr=["OFF","FAST","BALANCED","PRO"],Jr=["LOW","MEDIUM","HIGH"];function _l(s){if(s==="on")return!0;if(s==="off")return!1;throw new Q("Expected 'on' or 'off'.")}function vl(s){let e=s.toUpperCase();if(Hr.includes(e))return e;throw new Q(`Expected one of ${Hr.join(", ")}.`)}function Sl(s){let e=s.toUpperCase();if(Jr.includes(e))return e;throw new Q(`Expected one of ${Jr.join(", ")}.`)}function Gr(s){let e=s.command("schema").description("Extraction schema management");e.command("get <deploymentId>").description("Get extraction schema details").action(async t=>{let i=await new g(f()).schema.get(t);p()?D(i):w(i)}),e.command("update <deploymentId>").description("Update extraction schema settings (dynamic mapping, bbox tier, reasoning level, or any field via --body)").option("--body <file>","JSON file with schema settings to update").option("--dynamic-mapping <on|off>","Enable or disable dynamic mapping (turns big-table extraction off when enabled)",_l).option("--bbox-tier <tier>","Bounding box tier: OFF, FAST, BALANCED or PRO",vl).option("--reasoning-level <level>","Reasoning depth: LOW, MEDIUM or HIGH",Sl).action(async(t,n)=>{let r={...n.body?JSON.parse(qr.readFileSync(n.body,"utf-8")):{},...n.dynamicMapping!==void 0?{useDynamicMapping:n.dynamicMapping}:{},...n.bboxTier!==void 0?{bboxTier:n.bboxTier}:{},...n.reasoningLevel!==void 0?{reasoningLevel:n.reasoningLevel}:{}};if(Object.keys(r).length===0)throw new Q("Provide --body, --dynamic-mapping, --bbox-tier or --reasoning-level.");let a=await new g(f()).schema.update(t,r);p()?D(a):(E("Extraction schema updated."),w(a))}),e.command("data <deploymentId>").description("Get all data for an extraction schema").action(async t=>{let i=await new g(f()).schema.getAllData(t);p()?D(i):w(i)})}var Kr=I(require("fs"));function Yr(s){let e=s.command("benchmarks").description("Benchmark management");e.command("run <extractionSchemaId>").description("Run a benchmark").requiredOption("--name <name>","Benchmark name").option("--description <desc>","Benchmark description").option("--file-ids <ids>","Comma-separated file IDs").option("--config-file <file>","JSON file with benchmark configuration").action(async(t,n)=>{let i=new g(f()),r={name:n.name};if(n.description&&(r.description=n.description),n.fileIds&&(r.fileIds=n.fileIds.split(",")),n.configFile){let a=Kr.readFileSync(n.configFile,"utf-8"),u=JSON.parse(a);r={...r,...u}}let o=await i.http.post(`/benchmark/${t}/run-benchmark`,r);p()?D(o):(E("Benchmark started."),w(o))}),e.command("files <extractionSchemaId>").description("List files available for benchmarking").action(async t=>{let i=await new g(f()).http.get(`/benchmark/${t}/list-files`),r=Array.isArray(i)?i:i.data||i;p()?D(i):v(r)}),e.command("results <extractionSchemaId>").description("Get benchmark results").requiredOption("--execution-id <id>","Execution ID").action(async(t,n)=>{let r=await new g(f()).http.get(`/benchmark/${t}/get-results`,{executionId:n.executionId});p()?D(r):w(r)}),e.command("status <executionId>").description("Get benchmark execution status").action(async t=>{let i=await new g(f()).http.get(`/benchmarks/${t}`);p()?D(i):w(i)}),e.command("metrics <executionId>").description("Get benchmark execution metrics").action(async t=>{let i=await new g(f()).http.get(`/benchmarks/${t}/metrics`);p()?D(i):w(i)})}var me=I(require("fs")),pt=I(require("path")),un=require("stream"),Zr=require("stream/promises");var an=I(require("fs")),dt=I(require("path"));var xl=["JOB_CONTEXT.json",dt.join(process.env.HOME||"/home/daytona","JOB_CONTEXT.json")];function zr(s){let e=s?[dt.resolve(s)]:xl.map(t=>dt.resolve(t));for(let t of e)if(an.existsSync(t)){let n=an.readFileSync(t,"utf-8"),i;try{i=JSON.parse(n)}catch{throw new W(`Invalid JSON in ${t}`)}return Tl(i,t),i}throw new R("JOB_CONTEXT.json not found. Searched: "+e.join(", "),{code:"JOB_CONTEXT_NOT_FOUND",exitCode:1})}function Tl(s,e){let t=[];if(s.jobId||t.push("jobId"),s.fileId||t.push("fileId"),s.fileName||t.push("fileName"),s.sourceFileUrl||t.push("sourceFileUrl"),s.deploymentId||t.push("deploymentId"),s.extractionSchemaId||t.push("extractionSchemaId"),t.length>0)throw new W(`JOB_CONTEXT.json (${e}) missing required fields: ${t.join(", ")}`);if(!s.schema||!Array.isArray(s.schema.tables)||s.schema.tables.length===0)throw new W(`JOB_CONTEXT.json (${e}) must have schema.tables with at least one table`);for(let n of s.schema.tables){if(!n.id||!n.name)throw new W("JOB_CONTEXT.json: table missing id or name");if(!Array.isArray(n.columns)||n.columns.length===0)throw new W(`JOB_CONTEXT.json: table "${n.name}" has no columns`)}}function Xr(s,e){let t=[],n=[],i=[],r=0;if(!s||typeof s!="object")return{valid:!1,errors:["Submission must be a JSON object"],warnings:[],summary:{tablesFound:0,totalRows:0,tableDetails:[]}};if(!s.tables||typeof s.tables!="object")return{valid:!1,errors:['Submission must have a "tables" object'],warnings:[],summary:{tablesFound:0,totalRows:0,tableDetails:[]}};let o=new Map;for(let u of e.schema.tables)o.set(u.name,u);let a=Object.keys(s.tables);for(let u of a){let l=o.get(u);if(!l){t.push(`Table "${u}" not found in schema. Available tables: ${[...o.keys()].join(", ")}`);continue}let c=s.tables[u];if(!Array.isArray(c)){t.push(`Table "${u}": rows must be an array`);continue}let d=!l.isPrimary,m=new Set(l.columns.map(F=>F.name)),h=new Map(l.columns.map(F=>[F.name,F]));for(let F=0;F<c.length;F++){let A=c[F];Rl(A,F,u,d,m,h,t,n)}i.push({name:u,rowCount:c.length,isChild:d}),r+=c.length}for(let u of e.schema.tables)a.includes(u.name)||n.push(`Schema table "${u.name}" has no data in submission`);return{valid:t.length===0,errors:t,warnings:n,summary:{tablesFound:a.length,totalRows:r,tableDetails:i}}}function Rl(s,e,t,n,i,r,o,a){let u=`Table "${t}" row ${e}`;if(typeof s!="object"||s===null){o.push(`${u}: must be an object`);return}if(typeof s.index!="number"&&o.push(`${u}: missing or invalid "index" (must be a number)`),!s.cells||typeof s.cells!="object"){o.push(`${u}: missing or invalid "cells" object`);return}n&&(s.parentIndex===void 0||s.parentIndex===null)&&o.push(`${u}: child table rows must have "parentIndex"`),n&&s.parentIndex!==void 0&&typeof s.parentIndex!="number"&&o.push(`${u}: "parentIndex" must be a number`);let l=Object.keys(s.cells);if(l.length===0){o.push(`${u}: cells object is empty`);return}let c=0;for(let d of l)if(!i.has(d))a.push(`${u}: unknown column "${d}" (will be skipped by API)`);else{c++;let m=r.get(d);m&&Ol(s.cells[d],d,m.type,m.isList,u,a)}c===0&&o.push(`${u}: no cell keys match any schema column`)}function Ol(s,e,t,n,i,r){if(s!=null){if(n&&!Array.isArray(s)){r.push(`${i}: column "${e}" is a LIST but value is not an array`);return}switch(t){case"NUMBER":typeof s!="number"&&typeof s!="string"&&r.push(`${i}: column "${e}" (NUMBER) has unexpected type ${typeof s}`);break;case"BOOLEAN":typeof s!="boolean"&&r.push(`${i}: column "${e}" (BOOLEAN) has unexpected type ${typeof s}`);break;case"DATE":typeof s!="string"&&r.push(`${i}: column "${e}" (DATE) should be an ISO date string`);break;case"LIST":Array.isArray(s)||r.push(`${i}: column "${e}" (LIST) should be an array`);break}}}var Qr=200;function eo(s){let e=s.command("jobs").description("Job queue management");e.command("status <jobId>").description("Get job status").option("--wait","Poll until job completes").option("--timeout <seconds>","Timeout in seconds","300").action(async(t,n)=>{let i=new g(f());if(n.wait){let r=new Z(i.queue),o=y(`Waiting for job ${t}...`);o.start();let a;for await(let u of r.poll(t,{timeoutMs:parseInt(n.timeout)*1e3}))o.text=`Job ${t}: ${u.status} (extraction: ${u.extractionStageStatus})`,a=u;a?.status==="COMPLETED"?o.succeed(`Job ${t} completed.`):o.fail(`Job ${t}: ${a?.status}`),p()?D(a):w(a)}else{let r=await i.queue.getStatus(t);p()?D(r):w(r)}}),e.command("wait <jobId>").description("Wait for a job to complete").option("--timeout <seconds>","Timeout in seconds","300").action(async(t,n)=>{let i=new g(f()),r=new Z(i.queue),o=y(`Waiting for job ${t}...`);o.start();let a=await r.waitForCompletion(t,{timeoutMs:parseInt(n.timeout)*1e3,onStatus:u=>{o.text=`Job ${t}: ${u.status}`}});a.status==="COMPLETED"?o.succeed(`Job ${t} completed.`):o.fail(`Job ${t}: ${a.status}`),p()?D(a):w(a)}),e.command("cancel <jobId>").description("Cancel a queued job").action(async t=>{await new g(f()).queue.cancel(t),p()?D({success:!0,jobId:t}):E(`Job ${t} cancelled.`)}),e.command("update <jobId>").description("Update job status").requiredOption("--status <status>","Status: PROCESSING, COMPLETED, or FAILED").option("--error-message <msg>","Error message (required for FAILED)").option("--pages <n>","Pages processed (for COMPLETED billing)").option("--rows <n>","Rows created (for COMPLETED billing)").action(async(t,n)=>{let i=n.status.toUpperCase();if(!["PROCESSING","COMPLETED","FAILED"].includes(i))throw new W("Status must be PROCESSING, COMPLETED, or FAILED");if(i==="FAILED"&&!n.errorMessage)throw new W("--error-message is required when status is FAILED");let o=await new g(f()).queue.updateStatus(t,{status:i,errorMessage:n.errorMessage,pages:n.pages?parseInt(n.pages):void 0,rows:n.rows?parseInt(n.rows):void 0});p()?D(o):E(`Job ${t} status updated to ${i}`)}),e.command("download <url>").description("Download a file from a URL and optionally mark a job as PROCESSING").option("--job-id <id>","Job ID to mark as PROCESSING (or $LIMAI_JOB_ID)").option("--output <path>","Output file path","./source").action(async(t,n)=>{let i=new g(f()),r=n.jobId||process.env.LIMAI_JOB_ID,o=y("Downloading...");o.start();try{r&&(o.text="Marking job as PROCESSING...",await i.queue.updateStatus(r,{status:"PROCESSING"})),o.text="Downloading file...";let a=await fetch(t);if(!a.ok)throw new R(`Failed to download: HTTP ${a.status}`,{code:"DOWNLOAD_ERROR",exitCode:1});let u=pt.resolve(n.output),l=pt.dirname(u);if(me.existsSync(l)||me.mkdirSync(l,{recursive:!0}),!a.body)throw new R("Download failed: response body is empty",{code:"DOWNLOAD_ERROR",exitCode:1});let c=0,d=new un.Transform({transform(h,F,A){c+=h.byteLength,A(null,h)}});await(0,Zr.pipeline)(un.Readable.fromWeb(a.body),d,me.createWriteStream(u)),o.succeed(`Downloaded (${Nl(c)})`);let m={file:u,bytes:c};r&&(m.jobId=r,m.status="PROCESSING"),p()&&D(m)}catch(a){throw o.fail("Download failed"),r&&await Pl(i,r,a),a}}),e.command("submit <file>").description("Validate and submit extraction data, then mark job complete").requiredOption("--context <path>","Path to JOB_CONTEXT.json").option("--job-id <id>","Job ID (or $LIMAI_JOB_ID)").option("--file-id <id>","File ID (or $LIMAI_FILE_ID)").option("--deployment-id <id>","Deployment ID (or $LIMAI_DEPLOYMENT_ID)").option("--batch-size <n>","Rows per API batch",String(Qr)).option("--dry-run","Validate and show plan without submitting").action(async(t,n)=>{let i=zr(n.context),r=n.jobId||process.env.LIMAI_JOB_ID||i.jobId,o=n.fileId||process.env.LIMAI_FILE_ID||i.fileId,a=n.deploymentId||process.env.LIMAI_DEPLOYMENT_ID||i.deploymentId,u=new g(f()),l=parseInt(n.batchSize)||Qr,c=y("Loading and validating submission...");c.start();try{let d=$l(t),m=Xr(d,i);if(!m.valid){c.fail("Validation failed");for(let S of m.errors)console.error(`\x1B[31m ${S}\x1B[0m`);p()&&D({error:{code:"VALIDATION_ERROR",errors:m.errors}}),process.exit(1)}if(m.warnings.length>0&&!p())for(let S of m.warnings)Y(` ${S}`);let h=new Map,F=[],A=[];for(let S of i.schema.tables)h.set(S.name,S.id),S.isPrimary?F.push(S.name):A.push(S.name);if(n.dryRun){c.succeed("Validation passed (dry run)");let S={dryRun:!0,validation:m.summary,deleteOrder:[...A,...F].filter(T=>d.tables[T]).map(T=>({table:T,tableId:h.get(T)})),createOrder:[...F,...A].filter(T=>d.tables[T]).map(T=>({table:T,tableId:h.get(T),rows:d.tables[T].length,batches:Math.ceil(d.tables[T].length/l)}))};if(p())D(S);else{B("Delete order:");for(let T of S.deleteOrder)B(` ${T.table} (${T.tableId})`);B("Create order:");for(let T of S.createOrder)B(` ${T.table}: ${T.rows} rows in ${T.batches} batch(es)`)}return}let k=Object.keys(d.tables),b=[...A,...F].filter(S=>k.includes(S));for(let S of b){let T=h.get(S);c.text=`Deleting existing rows from "${S}"...`,await u.tables.deleteRows(T,{fileId:o,deploymentId:a})}let C=0,x=new Map;for(let S of F){let T=d.tables[S];if(!T||T.length===0)continue;let ze=h.get(S),ye=new Map;x.set(S,ye);let fe=await kl(u,ze,o,a,T,l,c,S);for(let K=0;K<T.length;K++)fe[K]&&ye.set(T[K].index,fe[K]);C+=fe.length}for(let S of A){let T=d.tables[S];if(!T||T.length===0)continue;let ze=h.get(S),ye=Bl(S,i),fe=ye?x.get(ye):void 0,K=T.map(Oe=>{let An;if(Oe.parentIndex!==void 0&&fe&&(An=fe.get(Oe.parentIndex),!An))throw new W(`Table "${S}" row ${Oe.index}: parentIndex ${Oe.parentIndex} does not match any parent row`);return{cells:Oe.cells,index:Oe.index,parentRowId:An}}),bt=await to(u,ze,o,a,K,l,c,S);C+=bt.length}c.text="Marking job as COMPLETED...",await u.queue.updateStatus(r,{status:"COMPLETED",pages:d.metadata?.pages,rows:C}),c.succeed(`Submitted ${C} rows across ${m.summary.tablesFound} table(s). Job COMPLETED.`);let V={status:"COMPLETED",jobId:r,tablesProcessed:m.summary.tablesFound,totalRowsCreated:C,tables:m.summary.tableDetails};p()&&D(V)}catch(d){c.fail("Submission failed");let m=d instanceof Error?d.message:String(d),h=d instanceof W?"VALIDATION_ERROR":"SUBMISSION_ERROR";p()?D({error:{code:h,message:m}}):console.error(`\x1B[31m ${m}\x1B[0m`),process.exit(1)}})}async function kl(s,e,t,n,i,r,o,a){let u=i.map(l=>({cells:l.cells,index:l.index}));return to(s,e,t,n,u,r,o,a)}async function to(s,e,t,n,i,r,o,a){let u=Array.from({length:i.length}),l=Math.ceil(i.length/r),c=3,d=0,m=[];for(let h=0;h<i.length;h+=r)m.push({start:h,batchRows:i.slice(h,h+r)});for(let h=0;h<m.length;h+=c){let F=m.slice(h,h+c),A=await Promise.all(F.map(({batchRows:k})=>s.tables.createRows(e,{fileId:t,deploymentId:n,rows:k})));for(let k=0;k<F.length;k++){let{start:b}=F[k];A[k].rowIds.forEach((C,x)=>{u[b+x]=C})}d+=F.length,o.text=`"${a}" batch ${d}/${l} (${Math.min(d*r,i.length)}/${i.length} rows)...`}return u.filter(Boolean)}function Bl(s,e){let t=e.schema.tables.find(i=>i.name===s);return!t||t.isPrimary?void 0:e.schema.tables.find(i=>i.isPrimary)?.name}function $l(s){let e=pt.resolve(s);if(!me.existsSync(e))throw new W(`File not found: ${e}`);let t=me.readFileSync(e,"utf-8");try{return JSON.parse(t)}catch{throw new W(`Invalid JSON in ${e}`)}}async function Pl(s,e,t){try{let n=t instanceof Error?t.message:String(t);await s.queue.updateStatus(e,{status:"FAILED",errorMessage:n.slice(0,500)})}catch{}}function Nl(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}var ve=I(require("fs")),cn=I(require("path"));var Wi=I(Lo());var pc={update(){},increment(){},stop(){}};function Mo(s){if(p())return pc;let e=s.format??" {bar} {percentage}% | {value}/{total} | {filename}",t=new Wi.default.SingleBar({format:e,barCompleteChar:"\u2588",barIncompleteChar:"\u2591",hideCursor:!0,clearOnComplete:!1,stopOnComplete:!0},Wi.default.Presets.shades_classic);return t.start(s.total,0),{update(n,i){t.update(n,i)},increment(n=1,i){t.increment(n,i)},stop(){t.stop()}}}function Uo(s){s.command("upload <extractionSchemaId> <path>").description("Upload a file or folder for extraction").option("--concurrency <n>","Concurrent uploads","5").option("--process","Queue files for extraction after upload").option("--wait","Wait for all extractions to complete (implies --process)").option("--output <file>","Write results to JSON file").option("--glob <pattern>","Filter files by glob pattern").action(async(e,t,n)=>{let i=f(),r=new g(i),o=cn.resolve(t),a=n.process||n.wait;ve.existsSync(o)||(console.error(`Path not found: ${o}`),process.exit(1));let u=ve.statSync(o);if(u.isFile()){let l=y(`Uploading ${cn.basename(o)}...`);l.start();let c=await r.uploadFile(e,o);if(c.isDuplicate?l.warn(`File already exists (duplicate). File ID: ${c.fileId}`):l.succeed(`Uploaded ${c.filename} (${mc(c.bytesUploaded)})`),a){let d=y("Queuing for extraction...");d.start();let m=await r.documents.processAsync(e,c.fileId);if(d.succeed(`Queued. Job ID: ${m.jobId}`),n.wait){let h=new Z(r.queue),F=y("Waiting for extraction...");F.start();let A=await h.waitForCompletion(m.jobId,{onStatus:k=>{F.text=`Extraction: ${k.status} (${k.extractionStageStatus})`}});if(A.status==="COMPLETED"){F.succeed("Extraction completed.");let k=await r.documents.getFileData(c.fileId,e);n.output?(ve.writeFileSync(n.output,JSON.stringify(k,null,2)),E(`Results written to ${n.output}`)):p()?D(k):w({fileId:c.fileId,status:"COMPLETED",tables:Object.keys(k.data?.tables??{}).length})}else F.fail(`Extraction ${A.status}`),process.exit(1)}else p()&&D({fileId:c.fileId,fileName:c.filename,jobId:m.jobId})}else p()&&D(c)}else if(u.isDirectory()){B(`Scanning ${o} for files...`);let l=await r.uploadFolder(e,o,{concurrency:parseInt(n.concurrency),process:a,globPattern:n.glob});if(l.total===0){Y("No supported files found in directory.");return}if(E(`Upload complete: ${l.uploaded} uploaded, ${l.queued} queued, ${l.failed} failed (${l.total} total)`),l.failed>0){let c=l.files.filter(d=>d.status==="failed");for(let d of c)Y(` Failed: ${d.filename} - ${d.error}`)}if(n.wait&&l.queued>0){let c=l.files.filter(h=>h.status==="queued"&&h.jobId);B(`Waiting for ${c.length} extractions to complete...`);let d=Mo({total:c.length,format:" Extracting {bar} {percentage}% | {value}/{total} files"}),m=0;await Promise.all(c.map(async h=>{await new Z(r.queue).waitForCompletion(h.jobId),m++,d.update(m)})),d.stop(),E("All extractions completed.")}n.output?(ve.writeFileSync(n.output,JSON.stringify(l,null,2)),E(`Results written to ${n.output}`)):p()&&D(l)}})}function mc(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var Wo=I(require("fs"));function Vo(s){s.command("download <tableId>").description("Download extracted data from a table").option("--output <file>","Output file path (streams NDJSON to file)").option("--limit <n>","Max rows to download").option("--all","Download all rows (auto-paginate)").option("--page-size <n>","Rows per API call","100").option("--order <order>","Sort order (asc|desc)","desc").option("--status <status>","Filter by row status").action(async(e,t)=>{let n=new g(f()),i=y("Fetching extraction data...");i.start();let r=t.limit?parseInt(t.limit):t.all?void 0:100;if(t.output){let o=Wo.createWriteStream(t.output),a=0,u=0;for await(let l of n.downloadAll(e,{pageSize:parseInt(t.pageSize),maxItems:r,order:t.order,status:t.status})){for(let c of l)o.write(JSON.stringify(c)+`
52
- `);a+=l.length,u++,i.text=`Streamed ${a} rows (${u} pages)...`}await new Promise((l,c)=>{o.end(()=>l()),o.on("error",c)}),i.succeed(`Downloaded ${a} rows.`),E(`Data written to ${t.output} (NDJSON format)`)}else{let o=[],a=0;for await(let u of n.downloadAll(e,{pageSize:parseInt(t.pageSize),maxItems:r,order:t.order,status:t.status}))o.push(...u),a++,i.text=`Fetched ${o.length} rows (${a} pages)...`;i.succeed(`Downloaded ${o.length} rows.`),D(o)}})}var dn=class extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},Ho=10,Dc=13,Se=32;function Vi(s){}function Go(s){if(typeof s=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Vi,onError:t=Vi,onRetry:n=Vi,onComment:i}=s,r=[],o=!0,a,u="",l=0,c;function d(b){if(o&&(o=!1,b.charCodeAt(0)===239&&b.charCodeAt(1)===187&&b.charCodeAt(2)===191&&(b=b.slice(3))),r.length===0){let V=m(b);V!==""&&r.push(V);return}if(b.indexOf(`
51
+ `;return this.stop(),this.#i.write(c),this}};function Ti(s){return new xi(s)}var Ie={start(){return Ie},stop(){return Ie},succeed(){return Ie},fail(){return Ie},warn(){return Ie},info(){return Ie},text:"",isSpinning:!1};function y(s){return p()?Ie:Ti({text:s,color:"cyan"})}function $r(s){let e=s.command("documents").description("Document upload and processing");e.command("upload <extractionSchemaId> <file>").description("Upload a document for extraction").action(async(t,n)=>{let i=new g(f()),r=on.resolve(n);rn.existsSync(r)||(console.error(`File not found: ${r}`),process.exit(1));let o=y(`Uploading ${on.basename(r)}...`);o.start();let a=await i.uploadFile(t,r);a.isDuplicate?o.warn("File already exists (duplicate)."):o.succeed("File uploaded."),p()?D(a):w(a)}),e.command("process <extractionSchemaId> <fileId>").description("Process a document for extraction").option("--async","Process asynchronously").option("--wait","Wait for completion (implies --async)").action(async(t,n,i)=>{let r=new g(f());if(i.async||i.wait){let a=await r.documents.processAsync(t,n);if(i.wait){let u=y(`Waiting for extraction (job ${a.jobId})...`);u.start();let c=await new Z(r.queue).waitForCompletion(a.jobId,{onStatus:d=>{u.text=`Extraction: ${d.status} (${d.extractionStageStatus})`}});if(c.status==="COMPLETED"){u.succeed("Extraction completed.");let d=await r.documents.getFileData(n,t);p()?D(d):w({fileId:n,status:"COMPLETED",tables:Object.keys(d.data?.tables??{}).length})}else u.fail(`Extraction ${c.status}`),process.exit(1)}else p()?D(a):(E("Processing job queued."),w(a))}else{let a=y("Processing file...");a.start();let u=await r.documents.processSync(t,n);a.succeed("Processing complete."),p()?D(u):w(u)}}),e.command("get <fileId>").description("Get extracted file data").option("--extraction-schema-id <id>","Extraction schema ID").action(async(t,n)=>{let r=await new g(f()).documents.getFileData(t,n.extractionSchemaId);p()?D(r):w(r)}),e.command("data <deploymentId> <fileIds...>").description("Get flat slug-keyed data for one or more documents").option("--include <options>","Comma-separated enrichments: confidence, boundingBoxes, grounding, validations").action(async(t,n,i)=>{let r=new g(f()),o=i.include?.split(",").map(u=>u.trim()).filter(Boolean),a=await r.documents.getDocumentsData(t,n,o);p()?D(a):w(a)}),e.command("correct <extractionSchemaId> <fileId>").description("Submit corrections for extracted data").requiredOption("--corrections <file>","JSON file with corrections").action(async(t,n,i)=>{let r=new g(f()),o=rn.readFileSync(i.corrections,"utf-8"),a=JSON.parse(o);await r.documents.submitCorrections(t,n,a),p()?D({success:!0}):E("Corrections submitted.")})}var Ri=I(require("fs"));function Pr(s){let e=s.command("tables").description("Table management");e.command("create <deploymentId>").description("Create a table in a deployment").requiredOption("--body <file>","JSON file with table definition").action(async(t,n)=>{let i=new g(f()),r=Ri.readFileSync(n.body,"utf-8"),o=JSON.parse(r),a=await i.tables.createTable(t,o);p()?D(a):(E("Table created."),w(a))}),e.command("update <tableId>").description("Update a table's instructions or name").option("--instructions <text>","New instructions text").option("--instructions-file <file>","Read new instructions from a file (overrides --instructions)").option("--name <name>","New table name").action(async(t,n)=>{let i=new g(f()),r={};if(n.instructionsFile?r.instructions=Ri.readFileSync(n.instructionsFile,"utf-8"):n.instructions!==void 0&&(r.instructions=n.instructions),n.name!==void 0&&(r.name=n.name),Object.keys(r).length===0)throw new Error("Provide at least one of --instructions, --instructions-file, or --name");let o=await i.tables.update(t,r);p()?D(o):(E("Table updated."),w(o))}),e.command("get <tableId>").description("Get table details").action(async t=>{let i=await new g(f()).tables.get(t);p()?D(i):w(i)}),e.command("rows <tableId>").description("List rows in a table").option("--limit <n>","Number of rows","50").option("--offset <n>","Offset","0").option("--all","Fetch all rows (auto-paginate)").action(async(t,n)=>{let i=new g(f());if(n.all){let r=await kt(js(async(o,a)=>i.tables.listRows(t,{limit:o,offset:a}),{pageSize:500}));p()?D(r):v(r)}else{let r=await i.tables.listRows(t,{limit:parseInt(n.limit),offset:parseInt(n.offset)});p()?D(r):v(r.data)}}),e.command("columns <tableId>").description("List columns in a table").action(async t=>{let i=await new g(f()).tables.listColumns(t);p()?D(i):v(i,["id","name","type"])})}var Hr=I(require("fs"));var Nr=["index","id","name","slug","type","isKey","units","autoGenerateUnits","defaultValue","defaultValueEnabled"],El="NUMBER_WITH_UNIT columns need --units a,b or --auto-generate-units on.";function jr(s){return{...s,units:(s.units??[]).map(e=>e.name).join(", ")}}function bl(s){if(s.type==="NUMBER_WITH_UNIT"&&!s.autoGenerateUnits&&!(s.units&&s.units.length>0))throw new Q(El)}function Ae(s){if(s==="on")return!0;if(s==="off")return!1;throw new Q("Expected 'on' or 'off'.")}function wl(s){let e=Number(s);if(!Number.isInteger(e)||e<40||e>2e3)throw new Q("Expected an integer between 40 and 2000.");return e}function Il(s){try{return JSON.parse(s)}catch{return s}}function Lr(s){return s.split(",").map(e=>e.trim()).filter(Boolean)}function Mr(s){return s.option("--name <name>","Column name").option("--slug <slug>","Column slug (snake_case)").option("--type <type>","Column type, e.g. TEXT, NUMBER, DATE, LABEL").option("--description <text>","Column description").option("--is-key <on|off>","Mark the column as a key column",Ae).option("--is-list <on|off>","Store multiple values per cell",Ae).option("--date-format <format>","Date format: EU, US or ISO").option("--measurement-type <type>","Benchmark measurement type").option("--excluded-from-extraction <on|off>","Keep the column out of extraction prompts",Ae).option("--pinned <on|off>","Pin the column in the grid",Ae).option("--size <px>","Column width in pixels (40-2000)",wl).option("--default-value <json>","Default value as JSON (falls back to a plain string)",Il).option("--clear-default-value","Clear the stored default value").option("--default-value-enabled <on|off>","Write the default value into empty cells during extraction",Ae).option("--auto-generate-labels <on|off>","Let extraction invent new labels",Ae).option("--auto-generate-units <on|off>","Let extraction invent new units",Ae).option("--labels <names>","Comma-separated label names",Lr).option("--units <names>","Comma-separated unit names",Lr)}function Ur(s){let e={};return s.name!==void 0&&(e.name=s.name),s.slug!==void 0&&(e.slug=s.slug),s.type!==void 0&&(e.type=s.type),s.description!==void 0&&(e.description=s.description),s.isKey!==void 0&&(e.isKey=s.isKey),s.isList!==void 0&&(e.isList=s.isList),s.dateFormat!==void 0&&(e.dateFormat=s.dateFormat),s.measurementType!==void 0&&(e.measurementType=s.measurementType),s.excludedFromExtraction!==void 0&&(e.excludedFromExtraction=s.excludedFromExtraction),s.pinned!==void 0&&(e.pinned=s.pinned),s.size!==void 0&&(e.size=s.size),s.clearDefaultValue?e.defaultValue=null:s.defaultValue!==void 0&&(e.defaultValue=s.defaultValue),s.defaultValueEnabled!==void 0&&(e.defaultValueEnabled=s.defaultValueEnabled),s.autoGenerateLabels!==void 0&&(e.autoGenerateLabels=s.autoGenerateLabels),s.autoGenerateUnits!==void 0&&(e.autoGenerateUnits=s.autoGenerateUnits),s.labels!==void 0&&(e.labels=s.labels.map(t=>({name:t}))),s.units!==void 0&&(e.units=s.units.map(t=>({name:t}))),e}function Wr(s){return JSON.parse(Hr.readFileSync(s,"utf-8"))}function Vr(s){if(p()){D(s);return}w(s)}function Jr(s){let e=s.command("columns").description("Column management");e.command("list <tableId>").description("List the columns of a table").action(async t=>{let i=await new g(f()).columns.list(t);p()?D(i):v(i.map(jr),Nr)}),e.command("get <columnId>").description("Get column details").action(async t=>{let i=await new g(f()).columns.get(t);Vr(i)}),Mr(e.command("create <tableId>").description("Create one or more columns in a table").option("--body <file>","JSON file with a column object or { columns: [...] }")).action(async(t,n)=>{let i=Ur(n),r=n.body?Wr(n.body):void 0,o=Al(r,i);for(let l of"columns"in o?o.columns:[o])bl(l);let u=await new g(f()).columns.create(t,o);if(p()){D(u);return}E(`Created ${u.length} column${u.length===1?"":"s"}.`),v(u.map(jr),Nr)}),Mr(e.command("update <columnId>").description("Update a column").option("--body <file>","JSON file with the fields to update").option("--confirm-slug-change","Confirm a slug change (breaks integrations that reference it)")).action(async(t,n)=>{let r={...n.body?Wr(n.body):{},...Ur(n)};if(n.confirmSlugChange&&(r.confirmSlugChange=!0),Object.keys(r).every(u=>u==="confirmSlugChange"))throw new Q("Provide --body or at least one field flag.");let a=await new g(f()).columns.update(t,r);if(p()){D(a);return}E("Column updated."),Vr(a)})}function Al(s,e){if(s&&typeof s=="object"&&"columns"in s){if(Object.keys(e).length>0)throw new Q("Field flags cannot be combined with a bulk --body file.");return s}let t={...s,...e};if(typeof t.name!="string"||t.name.length===0)throw new Q("A column name is required (--name).");return t}var qr=I(require("fs"));var Oi=["OFF","TEXT","FAST","BALANCED","PRO"],ki=["LOW","MEDIUM","HIGH"];function _l(s){if(s==="on")return!0;if(s==="off")return!1;throw new Q("Expected 'on' or 'off'.")}function vl(s){let e=s.toUpperCase();if(Oi.includes(e))return e;throw new Q(`Expected one of ${Oi.join(", ")}.`)}function Sl(s){let e=s.toUpperCase();if(ki.includes(e))return e;throw new Q(`Expected one of ${ki.join(", ")}.`)}function Gr(s){let e=s.command("schema").description("Extraction schema management");e.command("get <deploymentId>").description("Get extraction schema details").action(async t=>{let i=await new g(f()).schema.get(t);p()?D(i):w(i)}),e.command("update <deploymentId>").description("Update extraction schema settings (dynamic mapping, bbox tier, reasoning level, or any field via --body)").option("--body <file>","JSON file with schema settings to update").option("--dynamic-mapping <on|off>","Enable or disable dynamic mapping (turns big-table extraction off when enabled)",_l).option("--bbox-tier <tier>",`Bounding box tier: ${Oi.join(", ")}`,vl).option("--reasoning-level <level>",`Reasoning depth: ${ki.join(", ")}`,Sl).action(async(t,n)=>{let r={...n.body?JSON.parse(qr.readFileSync(n.body,"utf-8")):{},...n.dynamicMapping!==void 0?{useDynamicMapping:n.dynamicMapping}:{},...n.bboxTier!==void 0?{bboxTier:n.bboxTier}:{},...n.reasoningLevel!==void 0?{reasoningLevel:n.reasoningLevel}:{}};if(Object.keys(r).length===0)throw new Q("Provide --body, --dynamic-mapping, --bbox-tier or --reasoning-level.");let a=await new g(f()).schema.update(t,r);p()?D(a):(E("Extraction schema updated."),w(a))}),e.command("data <deploymentId>").description("Get all data for an extraction schema").action(async t=>{let i=await new g(f()).schema.getAllData(t);p()?D(i):w(i)})}var Kr=I(require("fs"));function Yr(s){let e=s.command("benchmarks").description("Benchmark management");e.command("run <extractionSchemaId>").description("Run a benchmark").requiredOption("--name <name>","Benchmark name").option("--description <desc>","Benchmark description").option("--file-ids <ids>","Comma-separated file IDs").option("--config-file <file>","JSON file with benchmark configuration").action(async(t,n)=>{let i=new g(f()),r={name:n.name};if(n.description&&(r.description=n.description),n.fileIds&&(r.fileIds=n.fileIds.split(",")),n.configFile){let a=Kr.readFileSync(n.configFile,"utf-8"),u=JSON.parse(a);r={...r,...u}}let o=await i.http.post(`/benchmark/${t}/run-benchmark`,r);p()?D(o):(E("Benchmark started."),w(o))}),e.command("files <extractionSchemaId>").description("List files available for benchmarking").action(async t=>{let i=await new g(f()).http.get(`/benchmark/${t}/list-files`),r=Array.isArray(i)?i:i.data||i;p()?D(i):v(r)}),e.command("results <extractionSchemaId>").description("Get benchmark results").requiredOption("--execution-id <id>","Execution ID").action(async(t,n)=>{let r=await new g(f()).http.get(`/benchmark/${t}/get-results`,{executionId:n.executionId});p()?D(r):w(r)}),e.command("status <executionId>").description("Get benchmark execution status").action(async t=>{let i=await new g(f()).http.get(`/benchmarks/${t}`);p()?D(i):w(i)}),e.command("metrics <executionId>").description("Get benchmark execution metrics").action(async t=>{let i=await new g(f()).http.get(`/benchmarks/${t}/metrics`);p()?D(i):w(i)})}var me=I(require("fs")),pt=I(require("path")),un=require("stream"),Zr=require("stream/promises");var an=I(require("fs")),dt=I(require("path"));var xl=["JOB_CONTEXT.json",dt.join(process.env.HOME||"/home/daytona","JOB_CONTEXT.json")];function zr(s){let e=s?[dt.resolve(s)]:xl.map(t=>dt.resolve(t));for(let t of e)if(an.existsSync(t)){let n=an.readFileSync(t,"utf-8"),i;try{i=JSON.parse(n)}catch{throw new W(`Invalid JSON in ${t}`)}return Tl(i,t),i}throw new R("JOB_CONTEXT.json not found. Searched: "+e.join(", "),{code:"JOB_CONTEXT_NOT_FOUND",exitCode:1})}function Tl(s,e){let t=[];if(s.jobId||t.push("jobId"),s.fileId||t.push("fileId"),s.fileName||t.push("fileName"),s.sourceFileUrl||t.push("sourceFileUrl"),s.deploymentId||t.push("deploymentId"),s.extractionSchemaId||t.push("extractionSchemaId"),t.length>0)throw new W(`JOB_CONTEXT.json (${e}) missing required fields: ${t.join(", ")}`);if(!s.schema||!Array.isArray(s.schema.tables)||s.schema.tables.length===0)throw new W(`JOB_CONTEXT.json (${e}) must have schema.tables with at least one table`);for(let n of s.schema.tables){if(!n.id||!n.name)throw new W("JOB_CONTEXT.json: table missing id or name");if(!Array.isArray(n.columns)||n.columns.length===0)throw new W(`JOB_CONTEXT.json: table "${n.name}" has no columns`)}}function Xr(s,e){let t=[],n=[],i=[],r=0;if(!s||typeof s!="object")return{valid:!1,errors:["Submission must be a JSON object"],warnings:[],summary:{tablesFound:0,totalRows:0,tableDetails:[]}};if(!s.tables||typeof s.tables!="object")return{valid:!1,errors:['Submission must have a "tables" object'],warnings:[],summary:{tablesFound:0,totalRows:0,tableDetails:[]}};let o=new Map;for(let u of e.schema.tables)o.set(u.name,u);let a=Object.keys(s.tables);for(let u of a){let l=o.get(u);if(!l){t.push(`Table "${u}" not found in schema. Available tables: ${[...o.keys()].join(", ")}`);continue}let c=s.tables[u];if(!Array.isArray(c)){t.push(`Table "${u}": rows must be an array`);continue}let d=!l.isPrimary,m=new Set(l.columns.map(F=>F.name)),h=new Map(l.columns.map(F=>[F.name,F]));for(let F=0;F<c.length;F++){let A=c[F];Rl(A,F,u,d,m,h,t,n)}i.push({name:u,rowCount:c.length,isChild:d}),r+=c.length}for(let u of e.schema.tables)a.includes(u.name)||n.push(`Schema table "${u.name}" has no data in submission`);return{valid:t.length===0,errors:t,warnings:n,summary:{tablesFound:a.length,totalRows:r,tableDetails:i}}}function Rl(s,e,t,n,i,r,o,a){let u=`Table "${t}" row ${e}`;if(typeof s!="object"||s===null){o.push(`${u}: must be an object`);return}if(typeof s.index!="number"&&o.push(`${u}: missing or invalid "index" (must be a number)`),!s.cells||typeof s.cells!="object"){o.push(`${u}: missing or invalid "cells" object`);return}n&&(s.parentIndex===void 0||s.parentIndex===null)&&o.push(`${u}: child table rows must have "parentIndex"`),n&&s.parentIndex!==void 0&&typeof s.parentIndex!="number"&&o.push(`${u}: "parentIndex" must be a number`);let l=Object.keys(s.cells);if(l.length===0){o.push(`${u}: cells object is empty`);return}let c=0;for(let d of l)if(!i.has(d))a.push(`${u}: unknown column "${d}" (will be skipped by API)`);else{c++;let m=r.get(d);m&&Ol(s.cells[d],d,m.type,m.isList,u,a)}c===0&&o.push(`${u}: no cell keys match any schema column`)}function Ol(s,e,t,n,i,r){if(s!=null){if(n&&!Array.isArray(s)){r.push(`${i}: column "${e}" is a LIST but value is not an array`);return}switch(t){case"NUMBER":typeof s!="number"&&typeof s!="string"&&r.push(`${i}: column "${e}" (NUMBER) has unexpected type ${typeof s}`);break;case"BOOLEAN":typeof s!="boolean"&&r.push(`${i}: column "${e}" (BOOLEAN) has unexpected type ${typeof s}`);break;case"DATE":typeof s!="string"&&r.push(`${i}: column "${e}" (DATE) should be an ISO date string`);break;case"LIST":Array.isArray(s)||r.push(`${i}: column "${e}" (LIST) should be an array`);break}}}var Qr=200;function eo(s){let e=s.command("jobs").description("Job queue management");e.command("status <jobId>").description("Get job status").option("--wait","Poll until job completes").option("--timeout <seconds>","Timeout in seconds","300").action(async(t,n)=>{let i=new g(f());if(n.wait){let r=new Z(i.queue),o=y(`Waiting for job ${t}...`);o.start();let a;for await(let u of r.poll(t,{timeoutMs:parseInt(n.timeout)*1e3}))o.text=`Job ${t}: ${u.status} (extraction: ${u.extractionStageStatus})`,a=u;a?.status==="COMPLETED"?o.succeed(`Job ${t} completed.`):o.fail(`Job ${t}: ${a?.status}`),p()?D(a):w(a)}else{let r=await i.queue.getStatus(t);p()?D(r):w(r)}}),e.command("wait <jobId>").description("Wait for a job to complete").option("--timeout <seconds>","Timeout in seconds","300").action(async(t,n)=>{let i=new g(f()),r=new Z(i.queue),o=y(`Waiting for job ${t}...`);o.start();let a=await r.waitForCompletion(t,{timeoutMs:parseInt(n.timeout)*1e3,onStatus:u=>{o.text=`Job ${t}: ${u.status}`}});a.status==="COMPLETED"?o.succeed(`Job ${t} completed.`):o.fail(`Job ${t}: ${a.status}`),p()?D(a):w(a)}),e.command("cancel <jobId>").description("Cancel a queued job").action(async t=>{await new g(f()).queue.cancel(t),p()?D({success:!0,jobId:t}):E(`Job ${t} cancelled.`)}),e.command("update <jobId>").description("Update job status").requiredOption("--status <status>","Status: PROCESSING, COMPLETED, or FAILED").option("--error-message <msg>","Error message (required for FAILED)").option("--pages <n>","Pages processed (for COMPLETED billing)").option("--rows <n>","Rows created (for COMPLETED billing)").action(async(t,n)=>{let i=n.status.toUpperCase();if(!["PROCESSING","COMPLETED","FAILED"].includes(i))throw new W("Status must be PROCESSING, COMPLETED, or FAILED");if(i==="FAILED"&&!n.errorMessage)throw new W("--error-message is required when status is FAILED");let o=await new g(f()).queue.updateStatus(t,{status:i,errorMessage:n.errorMessage,pages:n.pages?parseInt(n.pages):void 0,rows:n.rows?parseInt(n.rows):void 0});p()?D(o):E(`Job ${t} status updated to ${i}`)}),e.command("download <url>").description("Download a file from a URL and optionally mark a job as PROCESSING").option("--job-id <id>","Job ID to mark as PROCESSING (or $LIMAI_JOB_ID)").option("--output <path>","Output file path","./source").action(async(t,n)=>{let i=new g(f()),r=n.jobId||process.env.LIMAI_JOB_ID,o=y("Downloading...");o.start();try{r&&(o.text="Marking job as PROCESSING...",await i.queue.updateStatus(r,{status:"PROCESSING"})),o.text="Downloading file...";let a=await fetch(t);if(!a.ok)throw new R(`Failed to download: HTTP ${a.status}`,{code:"DOWNLOAD_ERROR",exitCode:1});let u=pt.resolve(n.output),l=pt.dirname(u);if(me.existsSync(l)||me.mkdirSync(l,{recursive:!0}),!a.body)throw new R("Download failed: response body is empty",{code:"DOWNLOAD_ERROR",exitCode:1});let c=0,d=new un.Transform({transform(h,F,A){c+=h.byteLength,A(null,h)}});await(0,Zr.pipeline)(un.Readable.fromWeb(a.body),d,me.createWriteStream(u)),o.succeed(`Downloaded (${Nl(c)})`);let m={file:u,bytes:c};r&&(m.jobId=r,m.status="PROCESSING"),p()&&D(m)}catch(a){throw o.fail("Download failed"),r&&await Pl(i,r,a),a}}),e.command("submit <file>").description("Validate and submit extraction data, then mark job complete").requiredOption("--context <path>","Path to JOB_CONTEXT.json").option("--job-id <id>","Job ID (or $LIMAI_JOB_ID)").option("--file-id <id>","File ID (or $LIMAI_FILE_ID)").option("--deployment-id <id>","Deployment ID (or $LIMAI_DEPLOYMENT_ID)").option("--batch-size <n>","Rows per API batch",String(Qr)).option("--dry-run","Validate and show plan without submitting").action(async(t,n)=>{let i=zr(n.context),r=n.jobId||process.env.LIMAI_JOB_ID||i.jobId,o=n.fileId||process.env.LIMAI_FILE_ID||i.fileId,a=n.deploymentId||process.env.LIMAI_DEPLOYMENT_ID||i.deploymentId,u=new g(f()),l=parseInt(n.batchSize)||Qr,c=y("Loading and validating submission...");c.start();try{let d=$l(t),m=Xr(d,i);if(!m.valid){c.fail("Validation failed");for(let S of m.errors)console.error(`\x1B[31m ${S}\x1B[0m`);p()&&D({error:{code:"VALIDATION_ERROR",errors:m.errors}}),process.exit(1)}if(m.warnings.length>0&&!p())for(let S of m.warnings)Y(` ${S}`);let h=new Map,F=[],A=[];for(let S of i.schema.tables)h.set(S.name,S.id),S.isPrimary?F.push(S.name):A.push(S.name);if(n.dryRun){c.succeed("Validation passed (dry run)");let S={dryRun:!0,validation:m.summary,deleteOrder:[...A,...F].filter(T=>d.tables[T]).map(T=>({table:T,tableId:h.get(T)})),createOrder:[...F,...A].filter(T=>d.tables[T]).map(T=>({table:T,tableId:h.get(T),rows:d.tables[T].length,batches:Math.ceil(d.tables[T].length/l)}))};if(p())D(S);else{B("Delete order:");for(let T of S.deleteOrder)B(` ${T.table} (${T.tableId})`);B("Create order:");for(let T of S.createOrder)B(` ${T.table}: ${T.rows} rows in ${T.batches} batch(es)`)}return}let k=Object.keys(d.tables),b=[...A,...F].filter(S=>k.includes(S));for(let S of b){let T=h.get(S);c.text=`Deleting existing rows from "${S}"...`,await u.tables.deleteRows(T,{fileId:o,deploymentId:a})}let C=0,x=new Map;for(let S of F){let T=d.tables[S];if(!T||T.length===0)continue;let ze=h.get(S),ye=new Map;x.set(S,ye);let fe=await kl(u,ze,o,a,T,l,c,S);for(let K=0;K<T.length;K++)fe[K]&&ye.set(T[K].index,fe[K]);C+=fe.length}for(let S of A){let T=d.tables[S];if(!T||T.length===0)continue;let ze=h.get(S),ye=Bl(S,i),fe=ye?x.get(ye):void 0,K=T.map(Oe=>{let An;if(Oe.parentIndex!==void 0&&fe&&(An=fe.get(Oe.parentIndex),!An))throw new W(`Table "${S}" row ${Oe.index}: parentIndex ${Oe.parentIndex} does not match any parent row`);return{cells:Oe.cells,index:Oe.index,parentRowId:An}}),bt=await to(u,ze,o,a,K,l,c,S);C+=bt.length}c.text="Marking job as COMPLETED...",await u.queue.updateStatus(r,{status:"COMPLETED",pages:d.metadata?.pages,rows:C}),c.succeed(`Submitted ${C} rows across ${m.summary.tablesFound} table(s). Job COMPLETED.`);let V={status:"COMPLETED",jobId:r,tablesProcessed:m.summary.tablesFound,totalRowsCreated:C,tables:m.summary.tableDetails};p()&&D(V)}catch(d){c.fail("Submission failed");let m=d instanceof Error?d.message:String(d),h=d instanceof W?"VALIDATION_ERROR":"SUBMISSION_ERROR";p()?D({error:{code:h,message:m}}):console.error(`\x1B[31m ${m}\x1B[0m`),process.exit(1)}})}async function kl(s,e,t,n,i,r,o,a){let u=i.map(l=>({cells:l.cells,index:l.index}));return to(s,e,t,n,u,r,o,a)}async function to(s,e,t,n,i,r,o,a){let u=Array.from({length:i.length}),l=Math.ceil(i.length/r),c=3,d=0,m=[];for(let h=0;h<i.length;h+=r)m.push({start:h,batchRows:i.slice(h,h+r)});for(let h=0;h<m.length;h+=c){let F=m.slice(h,h+c),A=await Promise.all(F.map(({batchRows:k})=>s.tables.createRows(e,{fileId:t,deploymentId:n,rows:k})));for(let k=0;k<F.length;k++){let{start:b}=F[k];A[k].rowIds.forEach((C,x)=>{u[b+x]=C})}d+=F.length,o.text=`"${a}" batch ${d}/${l} (${Math.min(d*r,i.length)}/${i.length} rows)...`}return u.filter(Boolean)}function Bl(s,e){let t=e.schema.tables.find(i=>i.name===s);return!t||t.isPrimary?void 0:e.schema.tables.find(i=>i.isPrimary)?.name}function $l(s){let e=pt.resolve(s);if(!me.existsSync(e))throw new W(`File not found: ${e}`);let t=me.readFileSync(e,"utf-8");try{return JSON.parse(t)}catch{throw new W(`Invalid JSON in ${e}`)}}async function Pl(s,e,t){try{let n=t instanceof Error?t.message:String(t);await s.queue.updateStatus(e,{status:"FAILED",errorMessage:n.slice(0,500)})}catch{}}function Nl(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}var ve=I(require("fs")),cn=I(require("path"));var Hi=I(Lo());var pc={update(){},increment(){},stop(){}};function Mo(s){if(p())return pc;let e=s.format??" {bar} {percentage}% | {value}/{total} | {filename}",t=new Hi.default.SingleBar({format:e,barCompleteChar:"\u2588",barIncompleteChar:"\u2591",hideCursor:!0,clearOnComplete:!1,stopOnComplete:!0},Hi.default.Presets.shades_classic);return t.start(s.total,0),{update(n,i){t.update(n,i)},increment(n=1,i){t.increment(n,i)},stop(){t.stop()}}}function Uo(s){s.command("upload <extractionSchemaId> <path>").description("Upload a file or folder for extraction").option("--concurrency <n>","Concurrent uploads","5").option("--process","Queue files for extraction after upload").option("--wait","Wait for all extractions to complete (implies --process)").option("--output <file>","Write results to JSON file").option("--glob <pattern>","Filter files by glob pattern").action(async(e,t,n)=>{let i=f(),r=new g(i),o=cn.resolve(t),a=n.process||n.wait;ve.existsSync(o)||(console.error(`Path not found: ${o}`),process.exit(1));let u=ve.statSync(o);if(u.isFile()){let l=y(`Uploading ${cn.basename(o)}...`);l.start();let c=await r.uploadFile(e,o);if(c.isDuplicate?l.warn(`File already exists (duplicate). File ID: ${c.fileId}`):l.succeed(`Uploaded ${c.filename} (${mc(c.bytesUploaded)})`),a){let d=y("Queuing for extraction...");d.start();let m=await r.documents.processAsync(e,c.fileId);if(d.succeed(`Queued. Job ID: ${m.jobId}`),n.wait){let h=new Z(r.queue),F=y("Waiting for extraction...");F.start();let A=await h.waitForCompletion(m.jobId,{onStatus:k=>{F.text=`Extraction: ${k.status} (${k.extractionStageStatus})`}});if(A.status==="COMPLETED"){F.succeed("Extraction completed.");let k=await r.documents.getFileData(c.fileId,e);n.output?(ve.writeFileSync(n.output,JSON.stringify(k,null,2)),E(`Results written to ${n.output}`)):p()?D(k):w({fileId:c.fileId,status:"COMPLETED",tables:Object.keys(k.data?.tables??{}).length})}else F.fail(`Extraction ${A.status}`),process.exit(1)}else p()&&D({fileId:c.fileId,fileName:c.filename,jobId:m.jobId})}else p()&&D(c)}else if(u.isDirectory()){B(`Scanning ${o} for files...`);let l=await r.uploadFolder(e,o,{concurrency:parseInt(n.concurrency),process:a,globPattern:n.glob});if(l.total===0){Y("No supported files found in directory.");return}if(E(`Upload complete: ${l.uploaded} uploaded, ${l.queued} queued, ${l.failed} failed (${l.total} total)`),l.failed>0){let c=l.files.filter(d=>d.status==="failed");for(let d of c)Y(` Failed: ${d.filename} - ${d.error}`)}if(n.wait&&l.queued>0){let c=l.files.filter(h=>h.status==="queued"&&h.jobId);B(`Waiting for ${c.length} extractions to complete...`);let d=Mo({total:c.length,format:" Extracting {bar} {percentage}% | {value}/{total} files"}),m=0;await Promise.all(c.map(async h=>{await new Z(r.queue).waitForCompletion(h.jobId),m++,d.update(m)})),d.stop(),E("All extractions completed.")}n.output?(ve.writeFileSync(n.output,JSON.stringify(l,null,2)),E(`Results written to ${n.output}`)):p()&&D(l)}})}function mc(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var Wo=I(require("fs"));function Vo(s){s.command("download <tableId>").description("Download extracted data from a table").option("--output <file>","Output file path (streams NDJSON to file)").option("--limit <n>","Max rows to download").option("--all","Download all rows (auto-paginate)").option("--page-size <n>","Rows per API call","100").option("--order <order>","Sort order (asc|desc)","desc").option("--status <status>","Filter by row status").action(async(e,t)=>{let n=new g(f()),i=y("Fetching extraction data...");i.start();let r=t.limit?parseInt(t.limit):t.all?void 0:100;if(t.output){let o=Wo.createWriteStream(t.output),a=0,u=0;for await(let l of n.downloadAll(e,{pageSize:parseInt(t.pageSize),maxItems:r,order:t.order,status:t.status})){for(let c of l)o.write(JSON.stringify(c)+`
52
+ `);a+=l.length,u++,i.text=`Streamed ${a} rows (${u} pages)...`}await new Promise((l,c)=>{o.end(()=>l()),o.on("error",c)}),i.succeed(`Downloaded ${a} rows.`),E(`Data written to ${t.output} (NDJSON format)`)}else{let o=[],a=0;for await(let u of n.downloadAll(e,{pageSize:parseInt(t.pageSize),maxItems:r,order:t.order,status:t.status}))o.push(...u),a++,i.text=`Fetched ${o.length} rows (${a} pages)...`;i.succeed(`Downloaded ${o.length} rows.`),D(o)}})}var dn=class extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},Ho=10,Dc=13,Se=32;function Ji(s){}function Go(s){if(typeof s=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Ji,onError:t=Ji,onRetry:n=Ji,onComment:i}=s,r=[],o=!0,a,u="",l=0,c;function d(b){if(o&&(o=!1,b.charCodeAt(0)===239&&b.charCodeAt(1)===187&&b.charCodeAt(2)===191&&(b=b.slice(3))),r.length===0){let V=m(b);V!==""&&r.push(V);return}if(b.indexOf(`
53
53
  `)===-1&&b.indexOf("\r")===-1){r.push(b);return}r.push(b);let C=r.join("");r.length=0;let x=m(C);x!==""&&r.push(x)}function m(b){let C=0;if(b.indexOf("\r")===-1){let x=b.indexOf(`
54
54
  `,C);for(;x!==-1;){if(C===x){l>0&&e({id:a,event:c,data:u}),a=void 0,u="",l=0,c=void 0,C=x+1,x=b.indexOf(`
55
55
  `,C);continue}let V=b.charCodeAt(C);if(Jo(b,C,V)){let S=b.charCodeAt(C+5)===Se?C+6:C+5,T=b.slice(S,x);if(l===0&&b.charCodeAt(x+1)===Ho){e({id:a,event:c,data:T}),a=void 0,u="",c=void 0,C=x+2,x=b.indexOf(`
@@ -58,14 +58,14 @@ ${T}`,l++}else qo(b,C,V)?c=b.slice(b.charCodeAt(C+6)===Se?C+7:C+6,x)||void 0:h(b
58
58
  `,C)}return b.slice(C)}for(;C<b.length;){let x=b.indexOf("\r",C),V=b.indexOf(`
59
59
  `,C),S=-1;if(x!==-1&&V!==-1?S=x<V?x:V:x!==-1?x===b.length-1?S=-1:S=x:V!==-1&&(S=V),S===-1)break;h(b,C,S),C=S+1,b.charCodeAt(C-1)===Dc&&b.charCodeAt(C)===Ho&&C++}return b.slice(C)}function h(b,C,x){if(C===x){A();return}let V=b.charCodeAt(C);if(Jo(b,C,V)){let K=b.charCodeAt(C+5)===Se?C+6:C+5,bt=b.slice(K,x);u=l===0?bt:`${u}
60
60
  ${bt}`,l++;return}if(qo(b,C,V)){c=b.slice(b.charCodeAt(C+6)===Se?C+7:C+6,x)||void 0;return}if(V===105&&b.charCodeAt(C+1)===100&&b.charCodeAt(C+2)===58){let K=b.slice(b.charCodeAt(C+3)===Se?C+4:C+3,x);a=K.includes("\0")?void 0:K;return}if(V===58){if(i){let K=b.slice(C,x);i(K.slice(b.charCodeAt(C+1)===Se?2:1))}return}let S=b.slice(C,x),T=S.indexOf(":");if(T===-1){F(S,"",S);return}let ze=S.slice(0,T),ye=S.charCodeAt(T+1)===Se?2:1,fe=S.slice(T+ye);F(ze,fe,S)}function F(b,C,x){switch(b){case"event":c=C||void 0;break;case"data":u=l===0?C:`${u}
61
- ${C}`,l++;break;case"id":a=C.includes("\0")?void 0:C;break;case"retry":/^\d+$/.test(C)?n(parseInt(C,10)):t(new dn(`Invalid \`retry\` value: "${C}"`,{type:"invalid-retry",value:C,line:x}));break;default:t(new dn(`Unknown field "${b.length>20?`${b.slice(0,20)}\u2026`:b}"`,{type:"unknown-field",field:b,value:C,line:x}));break}}function A(){l>0&&e({id:a,event:c,data:u}),a=void 0,u="",l=0,c=void 0}function k(b={}){if(b.consume&&r.length>0){let C=r.join("");h(C,0,C.length)}o=!0,a=void 0,u="",l=0,c=void 0,r.length=0}return{feed:d,reset:k}}function Jo(s,e,t){return t===100&&s.charCodeAt(e+1)===97&&s.charCodeAt(e+2)===116&&s.charCodeAt(e+3)===97&&s.charCodeAt(e+4)===58}function qo(s,e,t){return t===101&&s.charCodeAt(e+1)===118&&s.charCodeAt(e+2)===101&&s.charCodeAt(e+3)===110&&s.charCodeAt(e+4)===116&&s.charCodeAt(e+5)===58}var mn=class extends Event{constructor(e,t){var n,i;super(e),this.code=(n=t?.code)!=null?n:void 0,this.message=(i=t?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,n){return n(Ko(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(Ko(this),t)}};function fc(s){let e=globalThis.DOMException;return typeof e=="function"?new e(s,"SyntaxError"):new SyntaxError(s)}function Hi(s){return s instanceof Error?"errors"in s&&Array.isArray(s.errors)?s.errors.map(Hi).join(", "):"cause"in s&&s.cause instanceof Error?`${s}: ${Hi(s.cause)}`:s.message:`${s}`}function Ko(s){return{type:s.type,message:s.message,code:s.code,defaultPrevented:s.defaultPrevented,cancelable:s.cancelable,timeStamp:s.timeStamp}}var zo=s=>{throw TypeError(s)},Qi=(s,e,t)=>e.has(s)||zo("Cannot "+t),O=(s,e,t)=>(Qi(s,e,"read from private field"),t?t.call(s):e.get(s)),H=(s,e,t)=>e.has(s)?zo("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),U=(s,e,t,n)=>(Qi(s,e,"write to private field"),e.set(s,t),t),De=(s,e,t)=>(Qi(s,e,"access private method"),t),z,xe,Ve,pn,Dn,ft,qe,gt,he,He,Ge,Je,mt,oe,Ji,qi,Gi,Yo,Ki,Yi,Dt,zi,Xi,Te=class extends EventTarget{constructor(e,t){var n,i;super(),H(this,oe),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,H(this,z),H(this,xe),H(this,Ve),H(this,pn),H(this,Dn),H(this,ft),H(this,qe),H(this,gt,null),H(this,he),H(this,He),H(this,Ge,null),H(this,Je,null),H(this,mt,null),H(this,qi,async r=>{var o;O(this,He).reset();let{body:a,redirected:u,status:l,headers:c}=r;if(l===204){De(this,oe,Dt).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?U(this,Ve,new URL(r.url)):U(this,Ve,void 0),l!==200){De(this,oe,Dt).call(this,`Non-200 status code (${l})`,l);return}if(!(c.get("content-type")||"").startsWith("text/event-stream")){De(this,oe,Dt).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(O(this,z)===this.CLOSED)return;U(this,z,this.OPEN);let d=new Event("open");if((o=O(this,mt))==null||o.call(this,d),this.dispatchEvent(d),typeof a!="object"||!a||!("getReader"in a)){De(this,oe,Dt).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}let m=new TextDecoder,h=a.getReader(),F=!0;do{let{done:A,value:k}=await h.read();k&&O(this,He).feed(m.decode(k,{stream:!A})),A&&(F=!1,O(this,He).reset(),De(this,oe,zi).call(this))}while(F)}),H(this,Gi,r=>{U(this,he,void 0),!(r.name==="AbortError"||r.type==="aborted")&&De(this,oe,zi).call(this,Hi(r))}),H(this,Ki,r=>{typeof r.id=="string"&&U(this,gt,r.id);let o=new MessageEvent(r.event||"message",{data:r.data,origin:O(this,Ve)?O(this,Ve).origin:O(this,xe).origin,lastEventId:r.id||""});O(this,Je)&&(!r.event||r.event==="message")&&O(this,Je).call(this,o),this.dispatchEvent(o)}),H(this,Yi,r=>{U(this,ft,r)}),H(this,Xi,()=>{U(this,qe,void 0),O(this,z)===this.CONNECTING&&De(this,oe,Ji).call(this)});try{if(e instanceof URL)U(this,xe,e);else if(typeof e=="string")U(this,xe,new URL(e,gc()));else throw new Error("Invalid URL")}catch{throw fc("An invalid or illegal string was specified")}U(this,He,Go({onEvent:O(this,Ki),onRetry:O(this,Yi)})),U(this,z,this.CONNECTING),U(this,ft,3e3),U(this,Dn,(n=t?.fetch)!=null?n:globalThis.fetch),U(this,pn,(i=t?.withCredentials)!=null?i:!1),De(this,oe,Ji).call(this)}get readyState(){return O(this,z)}get url(){return O(this,xe).href}get withCredentials(){return O(this,pn)}get onerror(){return O(this,Ge)}set onerror(e){U(this,Ge,e)}get onmessage(){return O(this,Je)}set onmessage(e){U(this,Je,e)}get onopen(){return O(this,mt)}set onopen(e){U(this,mt,e)}addEventListener(e,t,n){let i=t;super.addEventListener(e,i,n)}removeEventListener(e,t,n){let i=t;super.removeEventListener(e,i,n)}close(){O(this,qe)&&clearTimeout(O(this,qe)),O(this,z)!==this.CLOSED&&(O(this,he)&&O(this,he).abort(),U(this,z,this.CLOSED),U(this,he,void 0))}};z=new WeakMap,xe=new WeakMap,Ve=new WeakMap,pn=new WeakMap,Dn=new WeakMap,ft=new WeakMap,qe=new WeakMap,gt=new WeakMap,he=new WeakMap,He=new WeakMap,Ge=new WeakMap,Je=new WeakMap,mt=new WeakMap,oe=new WeakSet,Ji=function(){U(this,z,this.CONNECTING),U(this,he,new AbortController),O(this,Dn)(O(this,xe),De(this,oe,Yo).call(this)).then(O(this,qi)).catch(O(this,Gi))},qi=new WeakMap,Gi=new WeakMap,Yo=function(){var s;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...O(this,gt)?{"Last-Event-ID":O(this,gt)}:void 0},cache:"no-store",signal:(s=O(this,he))==null?void 0:s.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Ki=new WeakMap,Yi=new WeakMap,Dt=function(s,e){var t;O(this,z)!==this.CLOSED&&U(this,z,this.CLOSED);let n=new mn("error",{code:e,message:s});(t=O(this,Ge))==null||t.call(this,n),this.dispatchEvent(n)},zi=function(s,e){var t;if(O(this,z)===this.CLOSED)return;U(this,z,this.CONNECTING);let n=new mn("error",{code:e,message:s});(t=O(this,Ge))==null||t.call(this,n),this.dispatchEvent(n),U(this,qe,setTimeout(O(this,Xi),O(this,ft)))},Xi=new WeakMap,Te.CONNECTING=0,Te.OPEN=1,Te.CLOSED=2;function gc(){let s="document"in globalThis?globalThis.document:void 0;return s&&typeof s=="object"&&"baseURI"in s&&typeof s.baseURI=="string"?s.baseURI:void 0}var fn=class{eventSource=null;handlers=new Map;config;reconnectAttempts=0;maxReconnectAttempts=10;baseReconnectDelay=1e3;connected=!1;constructor(e){this.config={...e,sessionId:e.sessionId??crypto.randomUUID()}}async connect(){return new Promise((e,t)=>{let n=new URL("/events",this.config.sseUrl);n.searchParams.set("sessionId",this.config.sessionId),this.eventSource=new Te(n.toString(),{fetch:(i,r)=>fetch(i,{...r,headers:{...r?.headers,Authorization:`Bearer ${this.config.token}`}})}),this.eventSource.onopen=()=>{this.connected=!0,this.reconnectAttempts=0,e()},this.eventSource.onerror=()=>{if(!this.connected){t(new Error("Failed to connect to SSE server"));return}this.handleReconnect()},this.eventSource.onmessage=i=>{try{let r=JSON.parse(i.data);this.dispatchEvent(r)}catch{}}})}async subscribe(e){if(!this.connected)throw new Error("Not connected to SSE server");let t=new URL("/subscribe",this.config.sseUrl),n=await fetch(t.toString(),{method:"POST",headers:{Authorization:`Bearer ${this.config.token}`,"Content-Type":"application/json"},body:JSON.stringify({projectId:e})});if(!n.ok)throw new Error(`Failed to subscribe to project ${e}: ${n.status}`)}async unsubscribe(e){if(!this.connected)return;let t=new URL("/unsubscribe",this.config.sseUrl);await fetch(t.toString(),{method:"POST",headers:{Authorization:`Bearer ${this.config.token}`,"Content-Type":"application/json"},body:JSON.stringify({projectId:e})})}on(e,t){let n=e;return this.handlers.has(n)||this.handlers.set(n,new Set),this.handlers.get(n).add(t),()=>{this.handlers.get(n)?.delete(t)}}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.connected=!1,this.handlers.clear()}get isConnected(){return this.connected}dispatchEvent(e){let t={type:e.type,data:e.data??e,timestamp:e.timestamp??new Date().toISOString(),sequenceNumber:e.sequenceNumber},n=this.handlers.get(t.type);if(n)for(let r of n)r(t);let i=this.handlers.get("*");if(i)for(let r of i)r(t)}handleReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts){this.disconnect();return}this.eventSource&&(this.eventSource.close(),this.eventSource=null);let e=this.baseReconnectDelay*Math.pow(2,this.reconnectAttempts);this.reconnectAttempts++,setTimeout(()=>{this.connect().catch(()=>{this.handleReconnect()})},e)}};function Xo(s){s.command("watch <projectId>").description("Watch real-time events for a project").option("--events <types>","Comma-separated event types to filter").option("--timeout <seconds>","Max watch duration in seconds").action(async(e,t)=>{let n=f();n.sseUrl||(Y("SSE URL not configured. Set LIMAI_SSE_URL or run `limai config set sseUrl <url>`"),process.exit(1));let i=t.events?.split(",").map(o=>o.trim().toUpperCase())??null;B(`Connecting to event stream for project ${e}...`);let r=new fn({sseUrl:n.sseUrl,token:n.token});try{if(await r.connect(),await r.subscribe(e),B("Connected. Watching for events... (Ctrl+C to stop)"),r.on("*",o=>{if(!(i&&!i.includes(o.type)))if(p())D(o);else{let a=new Date(o.timestamp).toLocaleTimeString();console.log(`[${a}] ${o.type}`),o.data&&console.log(` ${JSON.stringify(o.data)}`)}}),t.timeout){let o=parseInt(t.timeout)*1e3;setTimeout(()=>{B("Watch timeout reached."),r.disconnect(),process.exit(0)},o)}await new Promise(()=>{})}catch(o){r.disconnect(),console.error(o instanceof Error?o.message:"Connection failed"),process.exit(1)}})}var Qo=I(require("fs")),Re=I(require("path"));function Zo(s){let e=s.command("classify").description("Document classification");e.command("list").description("List classifiers visible in a project, including global classifiers that route into it").requiredOption("--project-id <id>","Project ID").action(async t=>{let i=await new g(f()).classify.list(t.projectId);if(p()){D(i);return}let r=i.map(o=>({id:o.id,name:o.name,scope:o.projectId===null?"GLOBAL":"PROJECT",routes:o.deploymentRoutes?.length??0,projects:(o.routeProjects??[]).map(a=>a.name).join(", "),classifications:o.classificationCount??0}));v(r,["id","name","scope","routes","projects","classifications"])}),e.command("file <classifierId> <file>").description("Upload and classify a file").option("--async","Use async classification").option("--wait","Wait for async result").action(async(t,n,i)=>{let r=f(),o=new g(r),a=Re.resolve(n);Qo.existsSync(a)||(_({code:"NOT_FOUND",message:`File not found: ${a}`}),process.exit(1));let u=y(`Uploading ${Re.basename(a)}...`);u.start();let l=await o.classify.getUploadUrl(t,Re.basename(a)),c=Re.extname(a).toLowerCase(),m={".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg"}[c]||"application/octet-stream";if(await o.http.putFile(l.url,a,m),u.succeed("File uploaded."),i.async){let h=y("Classifying (async)...");h.start();let F=await o.classify.classifyAsync(t,l.fileId);F.fileId?h.succeed(`Classified -> ${F.deploymentName}`):h.warn("File could not be classified (UNCLASSIFIED)"),p()?D(F):w(F)}else{let h=y("Classifying...");h.start();let F=await o.classify.classify(t,l.fileId);F.fileId?h.succeed(`Classified -> ${F.deploymentName}`):h.warn("File could not be classified (UNCLASSIFIED)"),p()?D(F):w(F)}}),e.command("create").description("Create a new classifier (always project-scoped; making it global is a separate action in the app)").requiredOption("--name <name>","Classifier name").requiredOption("--project-id <id>","Project ID").action(async t=>{let i=await new g(f()).classify.createClassifier({name:t.name,projectId:t.projectId});p()?D(i):(E("Classifier created."),w(i))}),e.command("add-route <classifierId>").description("Add a deployment route to a classifier (global classifiers may target deployments in any project you can access)").requiredOption("--deployment-id <id>","Deployment ID").requiredOption("--name <name>","Route name").requiredOption("--description <desc>","Route description").action(async(t,n)=>{let r=await new g(f()).classify.createRoute(t,{deploymentId:n.deploymentId,name:n.name,description:n.description});p()?D(r):(E("Route added."),w(r))}),e.command("status <classifierId>").description("Check classification status").requiredOption("--classification-id <id>","Classification ID").action(async(t,n)=>{let r=await new g(f()).classify.getStatus(t,n.classificationId);p()?D(r):w(r)})}var ea=I(require("fs")),ht=I(require("path"));function ta(s){let e=s.command("split").description("Document splitting");e.command("list-project").description("List splitters in a project").requiredOption("--project-id <id>","Project ID").action(async t=>{let i=await new g(f()).split.list(t.projectId);if(p())D(i);else{let r=Array.isArray(i)?i:[];v(r)}}),e.command("file <splitterId> <file>").description("Upload and split a document").option("--async","Use async splitting").option("--wait","Wait for async result").action(async(t,n,i)=>{let r=f(),o=new g(r),a=ht.resolve(n);ea.existsSync(a)||(_({code:"NOT_FOUND",message:`File not found: ${a}`}),process.exit(1));let u=y(`Uploading ${ht.basename(a)}...`);u.start();let l=await o.split.getUploadUrl(t,ht.basename(a));if(await o.http.putFile(l.url,a,"application/pdf"),u.succeed("File uploaded."),i.async){let c=y("Queuing split...");c.start();let d=await o.split.splitAsync(t,l.fileId);if(c.succeed(`Split queued. ID: ${d.splitId}`),i.wait){let m=y("Waiting for split...");m.start();let h=await o.split.getStatus(t,d.splitId);for(;h.status==="PENDING"||h.status==="PROCESSING";)await new Promise(F=>setTimeout(F,2e3)),h=await o.split.getStatus(t,d.splitId),m.text=`Split: ${h.status}`;h.status==="COMPLETED"?m.succeed(`Split completed. ${h.result?.segmentCount??0} segments.`):m.fail(`Split ${h.status}`),p()?D(h):w(h)}else p()&&D(d)}else{let c=y("Splitting document...");c.start();let d=await o.split.split(t,l.fileId);d.status==="COMPLETED"?c.succeed(`Split into ${d.segmentCount} segments.`):c.fail(`Split ${d.status}`),p()?D(d):w(d)}}),e.command("create").description("Create a new splitter").requiredOption("--name <name>","Splitter name").requiredOption("--output-type <type>","Output type: DEPLOYMENT or CLASSIFIER").requiredOption("--project-id <id>","Project ID").option("--deployment-id <id>","Target deployment ID").option("--classifier-id <id>","Target classifier ID").option("--prompt <text>","Split prompt","Split this document into individual documents.").option("--merge-segments","Merge segments").action(async t=>{let i=await new g(f()).split.createSplitter({name:t.name,prompt:t.prompt,outputType:t.outputType,deploymentId:t.deploymentId,classifierId:t.classifierId,projectId:t.projectId,mergeSegments:t.mergeSegments});p()?D(i):(E("Splitter created."),w(i))}),e.command("status <splitterId>").description("Check split status").requiredOption("--split-id <id>","Split ID").action(async(t,n)=>{let r=await new g(f()).split.getStatus(t,n.splitId);p()?D(r):w(r)}),e.command("list <splitterId>").description("List splits").action(async t=>{let i=await new g(f()).split.listSplits(t);if(p())D(i);else{let r=Array.isArray(i)?i:[];v(r)}})}var gn=["apiUrl","token","sseUrl","defaultProjectId","defaultDeploymentId"],hc=["token"],na=12;function ia(s){return gn.includes(s)}function sa(s){return hc.includes(s)}function Zi(s){return s.length<=na?"***":`${s.slice(0,na)}...`}function ra(s){let e=s.command("config").description("CLI configuration");e.command("list").description("Show all config values, with secrets masked").option("--reveal","Print secret values in full instead of masking them").action(t=>{let n=$e();n||(_({code:"NOT_FOUND",message:"No configuration found."}),process.exit(1));let i=n.token?t.reveal?n.token:Zi(n.token):"(not set)",r={...n,token:i};p()?D(r):w(r)}),e.command("get <key>").description(`Get one config value (${gn.join(", ")}). Secrets are masked unless --reveal is passed. With --json the value is printed on its own, so "limai config get token --reveal --json | jq -r '.'" yields the token itself.`).option("--reveal","Print the real value instead of a masked one").action((t,n)=>{ia(t)||(_({code:"VALIDATION",message:`Unknown key: ${t}. Allowed: ${gn.join(", ")}`}),process.exit(1));let i=$e();i||(_({code:"NOT_FOUND",message:"No configuration found."}),process.exit(1));let r=i[t];r===void 0&&(_({code:"NOT_FOUND",message:`${t} is not set.`}),process.exit(1));let o=!n.reveal&&sa(t)&&typeof r=="string"?Zi(r):r;p()?D(o):console.log(String(o))}),e.command("set <key> <value>").description("Set a config value").action((t,n)=>{ia(t)||(_({code:"VALIDATION",message:`Unknown key: ${t}. Allowed: ${gn.join(", ")}`}),process.exit(1)),be({[t]:n});let i=sa(t)?Zi(n):n;p()?D({[t]:i}):E(`Set ${t} = ${i}`)})}var hn=I(require("fs")),aa=I(require("path"));var oa=50;function ua(s){let e=s.command("rows").description("Row operations on tables");e.command("create <tableId>").description("Create rows in a table from a JSON file").requiredOption("--data <file>","JSON file with rows array").requiredOption("--file-id <id>","File ID").requiredOption("--deployment-id <id>","Deployment ID").option("--batch-size <n>","Rows per batch",String(oa)).action(async(t,n)=>{let i=new g(f()),r=parseInt(n.batchSize)||oa,o=aa.resolve(n.data);if(!hn.existsSync(o))throw new W(`File not found: ${o}`);let a=hn.readFileSync(o,"utf-8"),u;try{u=JSON.parse(a)}catch{throw new W(`Invalid JSON in ${o}`)}if(!Array.isArray(u))throw new W("Data file must contain a JSON array of rows");let l=y(`Creating ${u.length} rows...`);l.start();let c=[],d=Math.ceil(u.length/r);for(let h=0;h<u.length;h+=r){let F=u.slice(h,h+r),A=Math.floor(h/r)+1;l.text=`Creating rows batch ${A}/${d} (${c.length+F.length}/${u.length})...`;let k=await i.tables.createRows(t,{fileId:n.fileId,deploymentId:n.deploymentId,rows:F});c.push(...k.rowIds)}l.succeed(`Created ${c.length} rows.`);let m={rowsCreated:c.length,rowIds:c};p()?D(m):E(`${c.length} rows created in table ${t}`)}),e.command("delete <tableId>").description("Delete all rows for a file in a table").requiredOption("--file-id <id>","File ID").requiredOption("--deployment-id <id>","Deployment ID").action(async(t,n)=>{let i=new g(f()),r=y("Deleting rows...");r.start();let o=await i.tables.deleteRows(t,{fileId:n.fileId,deploymentId:n.deploymentId});r.succeed(`Deleted ${o.rowsDeleted} rows.`),p()?D(o):E(`${o.rowsDeleted} rows deleted from table ${t}`)})}var ae=I(require("fs")),ne=I(require("path"));function ca(s){let e=s.command("buckets").description("Bucket management");e.command("list <projectId>").description("List buckets in a project").action(async t=>{let i=await new g(f()).buckets.list(t);p()?D(i):v(i.map(r=>({id:r.id,name:r.name,files:r.fileCount,created:r.createdAt})))}),e.command("create <projectId>").description("Create a new bucket").requiredOption("--name <name>","Bucket name").option("--description <description>","Bucket description").action(async(t,n)=>{let r=await new g(f()).buckets.create(t,n.name,n.description);p()?D(r):(E(`Bucket created: ${r.id}`),w({id:r.id,name:r.name,description:r.description??""}))}),e.command("delete <bucketId>").description("Delete a bucket").action(async t=>{await new g(f()).buckets.delete(t),p()?D({success:!0}):E(`Bucket ${t} deleted.`)}),e.command("upload <bucketId> <path>").description("Upload file(s) to a bucket").action(async(t,n)=>{let i=f(),r=new g(i),o=ne.resolve(n);ae.existsSync(o)||(_({code:"NOT_FOUND",message:`Path not found: ${o}`}),process.exit(1));let a=ae.statSync(o);if(a.isFile())await la(r,t,o);else if(a.isDirectory()){let l=ae.readdirSync(o).map(m=>ne.join(o,m)).filter(m=>ae.statSync(m).isFile());if(l.length===0){Y("No files found in directory.");return}B(`Found ${l.length} file(s) to upload.`);let c=0,d=0;for(let m of l)try{await la(r,t,m),c++}catch(h){d++,Y(`Failed: ${ne.basename(m)} - ${h instanceof Error?h.message:"Unknown error"}`)}E(`Upload complete: ${c} uploaded, ${d} failed (${l.length} total)`)}}),e.command("files <bucketId>").description("List files in a bucket").option("--label <labels...>","Filter by labels").action(async(t,n)=>{let r=await new g(f()).buckets.listFiles(t,n.label);p()?D(r):v(r.map(o=>({id:o.id,name:o.name,labels:o.labels.join(", "),size:o.sizeBytes?es(o.sizeBytes):"-",status:o.status,created:o.createdAt})))}),e.command("download <bucketId> <fileId>").description("Download a file from a bucket").option("--output <path>","Output file path").action(async(t,n,i)=>{let r=new g(f()),o=y("Getting download URL...");o.start();let{url:a,fileName:u}=await r.buckets.getDownloadUrl(t,n),l=ne.basename(u).replace(/[/\\:*?"<>|]/g,"_");!(l===u&&!u.startsWith(".")&&u.length>0)&&!i.output&&(o.fail(`Server returned an unsafe filename "${u}". Use --output to specify an explicit path.`),process.exit(1));let d=i.output?ne.resolve(i.output):ne.resolve(l);ae.mkdirSync(ne.dirname(d),{recursive:!0}),o.text=`Downloading ${l}...`;let m=await fetch(a);m.ok||(o.fail(`Download failed: HTTP ${m.status}`),process.exit(1));let h=Buffer.from(await m.arrayBuffer());ae.writeFileSync(d,h);let F=h.length;o.succeed(`Downloaded ${l} (${es(F)}) to ${d}`),p()&&D({fileId:n,fileName:u,outputPath:d,bytes:F})}),e.command("label <bucketId> <fileId>").description("Add or remove labels on a file").option("--add <labels...>","Labels to add").option("--remove <labels...>","Labels to remove").action(async(t,n,i)=>{!i.add&&!i.remove&&(_({code:"VALIDATION",message:"Provide --add or --remove with label values."}),process.exit(1));let r=new g(f()),a=(await r.buckets.listFiles(t)).find(c=>c.id===n);a||(_({code:"NOT_FOUND",message:`File ${n} not found in bucket.`}),process.exit(1));let u=[...a.labels];if(i.add)for(let c of i.add)u.includes(c)||u.push(c);i.remove&&(u=u.filter(c=>!i.remove.includes(c)));let l=await r.buckets.updateLabels(t,n,u);p()?D(l):E(`Labels updated: [${u.join(", ")}]`)}),e.command("send <bucketId> <fileId>").description("Send a bucket file to a deployment, classifier, or splitter").option("--deployment <id>","Target deployment ID").option("--classifier <id>","Target classifier ID").option("--splitter <id>","Target splitter ID").action(async(t,n,i)=>{[i.deployment,i.classifier,i.splitter].filter(Boolean).length!==1&&(_({code:"VALIDATION",message:"Provide exactly one target: --deployment, --classifier, or --splitter."}),process.exit(1));let o=new g(f()),a,u;i.deployment?(a="DEPLOYMENT",u=i.deployment):i.classifier?(a="CLASSIFIER",u=i.classifier):(a="SPLITTER",u=i.splitter);let l=y(`Sending file to ${a.toLowerCase()} ${u}...`);l.start();let c=await o.buckets.sendTo(t,n,a,u);l.succeed(`File sent to ${a.toLowerCase()}.`),p()&&D(c)})}async function la(s,e,t){let n=ne.basename(t),i=y(`Uploading ${n}...`);i.start();let{url:r,fileId:o}=await s.buckets.getUploadUrl(e,n),a=await s.http.putFile(r,t,"application/octet-stream");await s.buckets.confirmUpload(e,o,a),i.succeed(`Uploaded ${n} (${es(a)}) - File ID: ${o}`),p()&&D({fileId:o,filename:n,bytes:a})}function es(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var G=I(require("fs")),J=I(require("path"));var da=I(require("path")),Fc={".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".heic":"image/heic",".heif":"image/heif",".svg":"image/svg+xml",".txt":"text/plain",".md":"text/markdown",".csv":"text/csv",".json":"application/json",".xml":"application/xml",".html":"text/html",".htm":"text/html",".js":"application/javascript",".ts":"application/typescript",".py":"text/x-python",".sh":"application/x-sh",".yaml":"application/yaml",".yml":"application/yaml",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".zip":"application/zip"};function Fn(s){let e=da.extname(s).toLowerCase();return Fc[e]??"application/octet-stream"}var pa=500;function Da(s){let e=s.command("agents").description("Agent management");e.command("list <projectId>").description("List agents in a project").option("--status <status>","Filter by status (ACTIVE, PAUSED, DISABLED)").action(async(r,o)=>{let u=await new g(f()).agents.list(r,o);p()?D(u):v(u.map(l=>({id:l.id,name:l.name,status:l.status,role:l.role??"GENERAL",triggers:l.triggerTypes.join(", "),deployments:l.deploymentRoutes.map(c=>c.deploymentName).join(", "),runs:l.runCount,created:l.createdAt})))}),e.command("get <projectId> <agentId>").description("Show agent details").action(async(r,o)=>{let u=await new g(f()).agents.get(r,o);p()?D(u):w({id:u.id,name:u.name,status:u.status,role:u.role??"GENERAL",triggers:u.triggerTypes.join(", "),"process content":Fe(u.processContent,120),deployments:u.deploymentRoutes.map(l=>`${l.deploymentName} (${l.deploymentId})`).join(", "),"email address":u.ingestEmailAddress??"",connection:u.connection?`${u.connection.provider} (${u.connection.status})`:"",files:u.files.map(l=>l.fileName).join(", "),skills:u.skills.map(l=>l.name).join(", "),runs:u.runCount,created:u.createdAt,updated:u.updatedAt})}),e.command("create <projectId>").description("Create a new agent").requiredOption("--name <name>","Agent name").requiredOption("--triggers <triggers>","Comma-separated trigger types (DOCUMENT_EXTRACTED, DOCUMENT_REVIEWED, EMAIL_RECEIVED)").option("--process-file <path>","Read process content from file").option("--deployments <deployments>","Comma-separated deployment IDs").option("--connection-id <connectionId>","Integration connection ID").option("--integration-config-file <path>","Read provider-specific integrationConfigs JSON from file").option("--tier <tier>","Agent tier (STANDARD, STANDARD_PLUS, MAX)").option("--role <role>","Agent role (GENERAL, VALIDATOR). VALIDATOR agents run document validation and report into the validation lifecycle.").option("--email-local-part <value>","Custom email local part (before @domain). Optional; auto-generated if omitted.").option("--file <path>","Attach a template file (repeatable). Equivalent to chaining `agents upload-file` after create.",yc,[]).action(async(r,o)=>{let a=new g(f()),u="";if(o.processFile){let A=J.resolve(o.processFile);u=G.readFileSync(A,"utf-8")}let l=o.triggers.split(",").map(A=>A.trim()),c=o.deployments?o.deployments.split(",").map(A=>A.trim()):void 0,d=o.integrationConfigFile?JSON.parse(G.readFileSync(J.resolve(o.integrationConfigFile),"utf-8")):void 0,m=y("Creating agent...");m.start();let h=await a.agents.create(r,{name:o.name,processContent:u,triggerTypes:l,deploymentIds:c,connectionId:o.connectionId,integrationConfigs:d,tier:o.tier,role:o.role,emailLocalPart:o.emailLocalPart});m.succeed(`Agent created: ${h.id}`);let F=[];for(let A of o.file){let k=await ma(a,r,h.id,A);F.push(k)}p()?D({...h,uploadedFiles:F}):w({id:h.id,name:h.name,status:h.status,role:h.role??"GENERAL",triggers:h.triggerTypes.join(", "),...F.length>0&&{files:F.map(A=>`${A.filename} (${A.fileId})`).join(", ")}})}),e.command("update <projectId> <agentId>").description("Update an agent").option("--name <name>","Agent name").option("--process-file <path>","Read process content from file").option("--triggers <triggers>","Comma-separated trigger types").option("--deployments <deployments>","Comma-separated deployment IDs").option("--connection-id <connectionId>","Integration connection ID").option("--integration-config-file <path>","Read provider-specific integrationConfigs JSON from file").option("--status <status>","Agent status (ACTIVE, PAUSED, DISABLED)").option("--tier <tier>","Agent tier (STANDARD, STANDARD_PLUS, MAX)").option("--role <role>","Agent role (GENERAL, VALIDATOR). VALIDATOR agents run document validation and report into the validation lifecycle.").option("--email-local-part <value>","Custom email local part (before @domain). Optional.").action(async(r,o,a)=>{let u=new g(f()),l={};a.name&&(l.name=a.name),a.status&&(l.status=a.status),a.tier&&(l.tier=a.tier),a.role&&(l.role=a.role),a.connectionId&&(l.connectionId=a.connectionId),a.emailLocalPart&&(l.emailLocalPart=a.emailLocalPart),a.integrationConfigFile&&(l.integrationConfigs=JSON.parse(G.readFileSync(J.resolve(a.integrationConfigFile),"utf-8"))),a.processFile&&(l.processContent=G.readFileSync(J.resolve(a.processFile),"utf-8")),a.triggers&&(l.triggerTypes=a.triggers.split(",").map(d=>d.trim())),a.deployments&&(l.deploymentIds=a.deployments.split(",").map(d=>d.trim()));let c=y("Updating agent...");c.start(),await u.agents.update(r,o,l),c.succeed("Agent updated."),p()&&D({success:!0})}),e.command("delete <projectId> <agentId>").description("Delete an agent").action(async(r,o)=>{await new g(f()).agents.delete(r,o),p()?D({success:!0}):E(`Agent ${o} deleted.`)}),e.command("upload-file <projectId> <agentId> <filePath>").description("Upload a template file to an agent").action(async(r,o,a)=>{let u=new g(f()),l=await ma(u,r,o,a);p()&&D(l)}),e.command("delete-file <projectId> <agentId> <fileId>").description("Delete a template file from an agent").action(async(r,o,a)=>{await new g(f()).agents.deleteFile(r,o,a),p()?D({success:!0}):E(`File ${a} deleted.`)}),e.command("download-file <projectId> <agentId> <fileId>").description("Download a template file from an agent").option("--output <path>","Output file path").action(async(r,o,a,u)=>{let l=new g(f()),c=y("Getting download URL...");c.start();let{url:d,fileName:m}=await l.agents.getFileDownloadUrl(r,o,a),h=J.basename(m).replace(/[/\\:*?"<>|]/g,"_");!(h===m&&!m.startsWith(".")&&m.length>0)&&!u.output&&(c.fail(`Server returned an unsafe filename "${m}". Use --output to specify an explicit path.`),process.exit(1));let A=u.output?J.resolve(u.output):J.resolve(h);G.mkdirSync(J.dirname(A),{recursive:!0}),c.text=`Downloading ${m}...`;let k=await fetch(d);k.ok||(c.fail(`Download failed: HTTP ${k.status}`),process.exit(1));let b=Buffer.from(await k.arrayBuffer());G.writeFileSync(A,b);let C=b.length;c.succeed(`Downloaded ${m} (${ts(C)}) to ${A}`),p()&&D({fileId:a,fileName:m,outputPath:A,bytes:C})});let t=e.command("skills").description("Agent skill management");t.command("list <projectId> <agentId>").description("List skills for an agent").action(async(r,o)=>{let u=await new g(f()).agents.listSkills(r,o);p()?D(u):v(u.map(l=>({id:l.id,name:l.name,content:Fe(l.content,80),created:l.createdAt})))}),t.command("create <projectId> <agentId>").description("Create a skill for an agent").requiredOption("--name <name>","Skill name").requiredOption("--content-file <path>","Read skill content from file").action(async(r,o,a)=>{let u=new g(f()),l=G.readFileSync(J.resolve(a.contentFile),"utf-8"),c=y("Creating skill...");c.start();let d=await u.agents.createSkill(r,o,{name:a.name,content:l});c.succeed(`Skill created: ${d.id}`),p()?D(d):w({id:d.id,name:d.name})}),t.command("update <projectId> <agentId> <skillId>").description("Update a skill").option("--name <name>","Skill name").option("--content-file <path>","Read skill content from file").action(async(r,o,a,u)=>{let l=new g(f()),c={};u.name&&(c.name=u.name),u.contentFile&&(c.content=G.readFileSync(J.resolve(u.contentFile),"utf-8"));let d=y("Updating skill...");d.start(),await l.agents.updateSkill(r,o,a,c),d.succeed("Skill updated."),p()&&D({success:!0})}),t.command("delete <projectId> <agentId> <skillId>").description("Delete a skill").action(async(r,o,a)=>{await new g(f()).agents.deleteSkill(r,o,a),p()?D({success:!0}):E(`Skill ${a} deleted.`)}),t.command("link-file <projectId> <agentId> <skillId> <fileId>").description("Link an agent file to a skill (file lands in the skill folder at runtime)").action(async(r,o,a,u)=>{let c=await new g(f()).agents.linkFileToSkill(r,o,a,u);p()?D(c):E(`Linked ${c.file.fileName} to skill ${a}.`)}),t.command("unlink-file <projectId> <agentId> <skillId> <fileId>").description("Unlink a file from a skill").action(async(r,o,a,u)=>{await new g(f()).agents.unlinkFileFromSkill(r,o,a,u),p()?D({success:!0}):E(`Unlinked file ${u} from skill ${a}.`)});let n=e.command("runs").description("Agent run management");n.command("list <projectId> <agentId>").description("List runs for an agent").option("--limit <limit>","Max results (default 20, max 100)").option("--status <status>","Filter by status (PENDING, RUNNING, COMPLETED, FAILED, ...)").action(async(r,o,a)=>{let l=await new g(f()).agents.listRuns(r,o,{limit:a.limit?parseInt(a.limit,10):void 0,status:a.status});p()?D(l):v(l.map(c=>({id:c.id,status:c.status,triggerType:c.triggerType,title:Fe(c.title,40),steps:c.stepsCount,duration:c.executionDurationMs?`${(c.executionDurationMs/1e3).toFixed(1)}s`:"-",created:c.createdAt})))}),n.command("get <projectId> <agentId> <runId>").description("Show run details").action(async(r,o,a)=>{let l=await new g(f()).agents.getRun(r,o,a);p()?D(l):(w({id:l.id,status:l.status,triggerType:l.triggerType,triggerEventId:l.triggerEventId,title:l.title,sandboxId:l.sandboxId??"-",errorMessage:l.errorMessage??"",duration:l.executionDurationMs?`${(l.executionDurationMs/1e3).toFixed(1)}s`:"-",startedAt:l.startedAt??"-",completedAt:l.completedAt??"-",created:l.createdAt}),l.steps.length>0&&(console.log(`
61
+ ${C}`,l++;break;case"id":a=C.includes("\0")?void 0:C;break;case"retry":/^\d+$/.test(C)?n(parseInt(C,10)):t(new dn(`Invalid \`retry\` value: "${C}"`,{type:"invalid-retry",value:C,line:x}));break;default:t(new dn(`Unknown field "${b.length>20?`${b.slice(0,20)}\u2026`:b}"`,{type:"unknown-field",field:b,value:C,line:x}));break}}function A(){l>0&&e({id:a,event:c,data:u}),a=void 0,u="",l=0,c=void 0}function k(b={}){if(b.consume&&r.length>0){let C=r.join("");h(C,0,C.length)}o=!0,a=void 0,u="",l=0,c=void 0,r.length=0}return{feed:d,reset:k}}function Jo(s,e,t){return t===100&&s.charCodeAt(e+1)===97&&s.charCodeAt(e+2)===116&&s.charCodeAt(e+3)===97&&s.charCodeAt(e+4)===58}function qo(s,e,t){return t===101&&s.charCodeAt(e+1)===118&&s.charCodeAt(e+2)===101&&s.charCodeAt(e+3)===110&&s.charCodeAt(e+4)===116&&s.charCodeAt(e+5)===58}var mn=class extends Event{constructor(e,t){var n,i;super(e),this.code=(n=t?.code)!=null?n:void 0,this.message=(i=t?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,n){return n(Ko(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(Ko(this),t)}};function fc(s){let e=globalThis.DOMException;return typeof e=="function"?new e(s,"SyntaxError"):new SyntaxError(s)}function qi(s){return s instanceof Error?"errors"in s&&Array.isArray(s.errors)?s.errors.map(qi).join(", "):"cause"in s&&s.cause instanceof Error?`${s}: ${qi(s.cause)}`:s.message:`${s}`}function Ko(s){return{type:s.type,message:s.message,code:s.code,defaultPrevented:s.defaultPrevented,cancelable:s.cancelable,timeStamp:s.timeStamp}}var zo=s=>{throw TypeError(s)},es=(s,e,t)=>e.has(s)||zo("Cannot "+t),O=(s,e,t)=>(es(s,e,"read from private field"),t?t.call(s):e.get(s)),H=(s,e,t)=>e.has(s)?zo("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),U=(s,e,t,n)=>(es(s,e,"write to private field"),e.set(s,t),t),De=(s,e,t)=>(es(s,e,"access private method"),t),z,xe,Ve,pn,Dn,ft,qe,gt,he,He,Ge,Je,mt,oe,Gi,Ki,Yi,Yo,zi,Xi,Dt,Qi,Zi,Te=class extends EventTarget{constructor(e,t){var n,i;super(),H(this,oe),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,H(this,z),H(this,xe),H(this,Ve),H(this,pn),H(this,Dn),H(this,ft),H(this,qe),H(this,gt,null),H(this,he),H(this,He),H(this,Ge,null),H(this,Je,null),H(this,mt,null),H(this,Ki,async r=>{var o;O(this,He).reset();let{body:a,redirected:u,status:l,headers:c}=r;if(l===204){De(this,oe,Dt).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?U(this,Ve,new URL(r.url)):U(this,Ve,void 0),l!==200){De(this,oe,Dt).call(this,`Non-200 status code (${l})`,l);return}if(!(c.get("content-type")||"").startsWith("text/event-stream")){De(this,oe,Dt).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(O(this,z)===this.CLOSED)return;U(this,z,this.OPEN);let d=new Event("open");if((o=O(this,mt))==null||o.call(this,d),this.dispatchEvent(d),typeof a!="object"||!a||!("getReader"in a)){De(this,oe,Dt).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}let m=new TextDecoder,h=a.getReader(),F=!0;do{let{done:A,value:k}=await h.read();k&&O(this,He).feed(m.decode(k,{stream:!A})),A&&(F=!1,O(this,He).reset(),De(this,oe,Qi).call(this))}while(F)}),H(this,Yi,r=>{U(this,he,void 0),!(r.name==="AbortError"||r.type==="aborted")&&De(this,oe,Qi).call(this,qi(r))}),H(this,zi,r=>{typeof r.id=="string"&&U(this,gt,r.id);let o=new MessageEvent(r.event||"message",{data:r.data,origin:O(this,Ve)?O(this,Ve).origin:O(this,xe).origin,lastEventId:r.id||""});O(this,Je)&&(!r.event||r.event==="message")&&O(this,Je).call(this,o),this.dispatchEvent(o)}),H(this,Xi,r=>{U(this,ft,r)}),H(this,Zi,()=>{U(this,qe,void 0),O(this,z)===this.CONNECTING&&De(this,oe,Gi).call(this)});try{if(e instanceof URL)U(this,xe,e);else if(typeof e=="string")U(this,xe,new URL(e,gc()));else throw new Error("Invalid URL")}catch{throw fc("An invalid or illegal string was specified")}U(this,He,Go({onEvent:O(this,zi),onRetry:O(this,Xi)})),U(this,z,this.CONNECTING),U(this,ft,3e3),U(this,Dn,(n=t?.fetch)!=null?n:globalThis.fetch),U(this,pn,(i=t?.withCredentials)!=null?i:!1),De(this,oe,Gi).call(this)}get readyState(){return O(this,z)}get url(){return O(this,xe).href}get withCredentials(){return O(this,pn)}get onerror(){return O(this,Ge)}set onerror(e){U(this,Ge,e)}get onmessage(){return O(this,Je)}set onmessage(e){U(this,Je,e)}get onopen(){return O(this,mt)}set onopen(e){U(this,mt,e)}addEventListener(e,t,n){let i=t;super.addEventListener(e,i,n)}removeEventListener(e,t,n){let i=t;super.removeEventListener(e,i,n)}close(){O(this,qe)&&clearTimeout(O(this,qe)),O(this,z)!==this.CLOSED&&(O(this,he)&&O(this,he).abort(),U(this,z,this.CLOSED),U(this,he,void 0))}};z=new WeakMap,xe=new WeakMap,Ve=new WeakMap,pn=new WeakMap,Dn=new WeakMap,ft=new WeakMap,qe=new WeakMap,gt=new WeakMap,he=new WeakMap,He=new WeakMap,Ge=new WeakMap,Je=new WeakMap,mt=new WeakMap,oe=new WeakSet,Gi=function(){U(this,z,this.CONNECTING),U(this,he,new AbortController),O(this,Dn)(O(this,xe),De(this,oe,Yo).call(this)).then(O(this,Ki)).catch(O(this,Yi))},Ki=new WeakMap,Yi=new WeakMap,Yo=function(){var s;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...O(this,gt)?{"Last-Event-ID":O(this,gt)}:void 0},cache:"no-store",signal:(s=O(this,he))==null?void 0:s.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},zi=new WeakMap,Xi=new WeakMap,Dt=function(s,e){var t;O(this,z)!==this.CLOSED&&U(this,z,this.CLOSED);let n=new mn("error",{code:e,message:s});(t=O(this,Ge))==null||t.call(this,n),this.dispatchEvent(n)},Qi=function(s,e){var t;if(O(this,z)===this.CLOSED)return;U(this,z,this.CONNECTING);let n=new mn("error",{code:e,message:s});(t=O(this,Ge))==null||t.call(this,n),this.dispatchEvent(n),U(this,qe,setTimeout(O(this,Zi),O(this,ft)))},Zi=new WeakMap,Te.CONNECTING=0,Te.OPEN=1,Te.CLOSED=2;function gc(){let s="document"in globalThis?globalThis.document:void 0;return s&&typeof s=="object"&&"baseURI"in s&&typeof s.baseURI=="string"?s.baseURI:void 0}var fn=class{eventSource=null;handlers=new Map;config;reconnectAttempts=0;maxReconnectAttempts=10;baseReconnectDelay=1e3;connected=!1;constructor(e){this.config={...e,sessionId:e.sessionId??crypto.randomUUID()}}async connect(){return new Promise((e,t)=>{let n=new URL("/events",this.config.sseUrl);n.searchParams.set("sessionId",this.config.sessionId),this.eventSource=new Te(n.toString(),{fetch:(i,r)=>fetch(i,{...r,headers:{...r?.headers,Authorization:`Bearer ${this.config.token}`}})}),this.eventSource.onopen=()=>{this.connected=!0,this.reconnectAttempts=0,e()},this.eventSource.onerror=()=>{if(!this.connected){t(new Error("Failed to connect to SSE server"));return}this.handleReconnect()},this.eventSource.onmessage=i=>{try{let r=JSON.parse(i.data);this.dispatchEvent(r)}catch{}}})}async subscribe(e){if(!this.connected)throw new Error("Not connected to SSE server");let t=new URL("/subscribe",this.config.sseUrl),n=await fetch(t.toString(),{method:"POST",headers:{Authorization:`Bearer ${this.config.token}`,"Content-Type":"application/json"},body:JSON.stringify({projectId:e})});if(!n.ok)throw new Error(`Failed to subscribe to project ${e}: ${n.status}`)}async unsubscribe(e){if(!this.connected)return;let t=new URL("/unsubscribe",this.config.sseUrl);await fetch(t.toString(),{method:"POST",headers:{Authorization:`Bearer ${this.config.token}`,"Content-Type":"application/json"},body:JSON.stringify({projectId:e})})}on(e,t){let n=e;return this.handlers.has(n)||this.handlers.set(n,new Set),this.handlers.get(n).add(t),()=>{this.handlers.get(n)?.delete(t)}}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.connected=!1,this.handlers.clear()}get isConnected(){return this.connected}dispatchEvent(e){let t={type:e.type,data:e.data??e,timestamp:e.timestamp??new Date().toISOString(),sequenceNumber:e.sequenceNumber},n=this.handlers.get(t.type);if(n)for(let r of n)r(t);let i=this.handlers.get("*");if(i)for(let r of i)r(t)}handleReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts){this.disconnect();return}this.eventSource&&(this.eventSource.close(),this.eventSource=null);let e=this.baseReconnectDelay*Math.pow(2,this.reconnectAttempts);this.reconnectAttempts++,setTimeout(()=>{this.connect().catch(()=>{this.handleReconnect()})},e)}};function Xo(s){s.command("watch <projectId>").description("Watch real-time events for a project").option("--events <types>","Comma-separated event types to filter").option("--timeout <seconds>","Max watch duration in seconds").action(async(e,t)=>{let n=f();n.sseUrl||(Y("SSE URL not configured. Set LIMAI_SSE_URL or run `limai config set sseUrl <url>`"),process.exit(1));let i=t.events?.split(",").map(o=>o.trim().toUpperCase())??null;B(`Connecting to event stream for project ${e}...`);let r=new fn({sseUrl:n.sseUrl,token:n.token});try{if(await r.connect(),await r.subscribe(e),B("Connected. Watching for events... (Ctrl+C to stop)"),r.on("*",o=>{if(!(i&&!i.includes(o.type)))if(p())D(o);else{let a=new Date(o.timestamp).toLocaleTimeString();console.log(`[${a}] ${o.type}`),o.data&&console.log(` ${JSON.stringify(o.data)}`)}}),t.timeout){let o=parseInt(t.timeout)*1e3;setTimeout(()=>{B("Watch timeout reached."),r.disconnect(),process.exit(0)},o)}await new Promise(()=>{})}catch(o){r.disconnect(),console.error(o instanceof Error?o.message:"Connection failed"),process.exit(1)}})}var Qo=I(require("fs")),Re=I(require("path"));function Zo(s){let e=s.command("classify").description("Document classification");e.command("list").description("List classifiers visible in a project, including global classifiers that route into it").requiredOption("--project-id <id>","Project ID").action(async t=>{let i=await new g(f()).classify.list(t.projectId);if(p()){D(i);return}let r=i.map(o=>({id:o.id,name:o.name,scope:o.projectId===null?"GLOBAL":"PROJECT",routes:o.deploymentRoutes?.length??0,projects:(o.routeProjects??[]).map(a=>a.name).join(", "),classifications:o.classificationCount??0}));v(r,["id","name","scope","routes","projects","classifications"])}),e.command("file <classifierId> <file>").description("Upload and classify a file").option("--async","Use async classification").option("--wait","Wait for async result").action(async(t,n,i)=>{let r=f(),o=new g(r),a=Re.resolve(n);Qo.existsSync(a)||(_({code:"NOT_FOUND",message:`File not found: ${a}`}),process.exit(1));let u=y(`Uploading ${Re.basename(a)}...`);u.start();let l=await o.classify.getUploadUrl(t,Re.basename(a)),c=Re.extname(a).toLowerCase(),m={".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg"}[c]||"application/octet-stream";if(await o.http.putFile(l.url,a,m),u.succeed("File uploaded."),i.async){let h=y("Classifying (async)...");h.start();let F=await o.classify.classifyAsync(t,l.fileId);F.fileId?h.succeed(`Classified -> ${F.deploymentName}`):h.warn("File could not be classified (UNCLASSIFIED)"),p()?D(F):w(F)}else{let h=y("Classifying...");h.start();let F=await o.classify.classify(t,l.fileId);F.fileId?h.succeed(`Classified -> ${F.deploymentName}`):h.warn("File could not be classified (UNCLASSIFIED)"),p()?D(F):w(F)}}),e.command("create").description("Create a new classifier (always project-scoped; making it global is a separate action in the app)").requiredOption("--name <name>","Classifier name").requiredOption("--project-id <id>","Project ID").action(async t=>{let i=await new g(f()).classify.createClassifier({name:t.name,projectId:t.projectId});p()?D(i):(E("Classifier created."),w(i))}),e.command("add-route <classifierId>").description("Add a deployment route to a classifier (global classifiers may target deployments in any project you can access)").requiredOption("--deployment-id <id>","Deployment ID").requiredOption("--name <name>","Route name").requiredOption("--description <desc>","Route description").action(async(t,n)=>{let r=await new g(f()).classify.createRoute(t,{deploymentId:n.deploymentId,name:n.name,description:n.description});p()?D(r):(E("Route added."),w(r))}),e.command("status <classifierId>").description("Check classification status").requiredOption("--classification-id <id>","Classification ID").action(async(t,n)=>{let r=await new g(f()).classify.getStatus(t,n.classificationId);p()?D(r):w(r)})}var ea=I(require("fs")),ht=I(require("path"));function ta(s){let e=s.command("split").description("Document splitting");e.command("list-project").description("List splitters in a project").requiredOption("--project-id <id>","Project ID").action(async t=>{let i=await new g(f()).split.list(t.projectId);if(p())D(i);else{let r=Array.isArray(i)?i:[];v(r)}}),e.command("file <splitterId> <file>").description("Upload and split a document").option("--async","Use async splitting").option("--wait","Wait for async result").action(async(t,n,i)=>{let r=f(),o=new g(r),a=ht.resolve(n);ea.existsSync(a)||(_({code:"NOT_FOUND",message:`File not found: ${a}`}),process.exit(1));let u=y(`Uploading ${ht.basename(a)}...`);u.start();let l=await o.split.getUploadUrl(t,ht.basename(a));if(await o.http.putFile(l.url,a,"application/pdf"),u.succeed("File uploaded."),i.async){let c=y("Queuing split...");c.start();let d=await o.split.splitAsync(t,l.fileId);if(c.succeed(`Split queued. ID: ${d.splitId}`),i.wait){let m=y("Waiting for split...");m.start();let h=await o.split.getStatus(t,d.splitId);for(;h.status==="PENDING"||h.status==="PROCESSING";)await new Promise(F=>setTimeout(F,2e3)),h=await o.split.getStatus(t,d.splitId),m.text=`Split: ${h.status}`;h.status==="COMPLETED"?m.succeed(`Split completed. ${h.result?.segmentCount??0} segments.`):m.fail(`Split ${h.status}`),p()?D(h):w(h)}else p()&&D(d)}else{let c=y("Splitting document...");c.start();let d=await o.split.split(t,l.fileId);d.status==="COMPLETED"?c.succeed(`Split into ${d.segmentCount} segments.`):c.fail(`Split ${d.status}`),p()?D(d):w(d)}}),e.command("create").description("Create a new splitter").requiredOption("--name <name>","Splitter name").requiredOption("--output-type <type>","Output type: DEPLOYMENT or CLASSIFIER").requiredOption("--project-id <id>","Project ID").option("--deployment-id <id>","Target deployment ID").option("--classifier-id <id>","Target classifier ID").option("--prompt <text>","Split prompt","Split this document into individual documents.").option("--merge-segments","Merge segments").action(async t=>{let i=await new g(f()).split.createSplitter({name:t.name,prompt:t.prompt,outputType:t.outputType,deploymentId:t.deploymentId,classifierId:t.classifierId,projectId:t.projectId,mergeSegments:t.mergeSegments});p()?D(i):(E("Splitter created."),w(i))}),e.command("status <splitterId>").description("Check split status").requiredOption("--split-id <id>","Split ID").action(async(t,n)=>{let r=await new g(f()).split.getStatus(t,n.splitId);p()?D(r):w(r)}),e.command("list <splitterId>").description("List splits").action(async t=>{let i=await new g(f()).split.listSplits(t);if(p())D(i);else{let r=Array.isArray(i)?i:[];v(r)}})}var gn=["apiUrl","token","sseUrl","defaultProjectId","defaultDeploymentId"],hc=["token"],na=12;function ia(s){return gn.includes(s)}function sa(s){return hc.includes(s)}function ts(s){return s.length<=na?"***":`${s.slice(0,na)}...`}function ra(s){let e=s.command("config").description("CLI configuration");e.command("list").description("Show all config values, with secrets masked").option("--reveal","Print secret values in full instead of masking them").action(t=>{let n=$e();n||(_({code:"NOT_FOUND",message:"No configuration found."}),process.exit(1));let i=n.token?t.reveal?n.token:ts(n.token):"(not set)",r={...n,token:i};p()?D(r):w(r)}),e.command("get <key>").description(`Get one config value (${gn.join(", ")}). Secrets are masked unless --reveal is passed. With --json the value is printed on its own, so "limai config get token --reveal --json | jq -r '.'" yields the token itself.`).option("--reveal","Print the real value instead of a masked one").action((t,n)=>{ia(t)||(_({code:"VALIDATION",message:`Unknown key: ${t}. Allowed: ${gn.join(", ")}`}),process.exit(1));let i=$e();i||(_({code:"NOT_FOUND",message:"No configuration found."}),process.exit(1));let r=i[t];r===void 0&&(_({code:"NOT_FOUND",message:`${t} is not set.`}),process.exit(1));let o=!n.reveal&&sa(t)&&typeof r=="string"?ts(r):r;p()?D(o):console.log(String(o))}),e.command("set <key> <value>").description("Set a config value").action((t,n)=>{ia(t)||(_({code:"VALIDATION",message:`Unknown key: ${t}. Allowed: ${gn.join(", ")}`}),process.exit(1)),be({[t]:n});let i=sa(t)?ts(n):n;p()?D({[t]:i}):E(`Set ${t} = ${i}`)})}var hn=I(require("fs")),aa=I(require("path"));var oa=50;function ua(s){let e=s.command("rows").description("Row operations on tables");e.command("create <tableId>").description("Create rows in a table from a JSON file").requiredOption("--data <file>","JSON file with rows array").requiredOption("--file-id <id>","File ID").requiredOption("--deployment-id <id>","Deployment ID").option("--batch-size <n>","Rows per batch",String(oa)).action(async(t,n)=>{let i=new g(f()),r=parseInt(n.batchSize)||oa,o=aa.resolve(n.data);if(!hn.existsSync(o))throw new W(`File not found: ${o}`);let a=hn.readFileSync(o,"utf-8"),u;try{u=JSON.parse(a)}catch{throw new W(`Invalid JSON in ${o}`)}if(!Array.isArray(u))throw new W("Data file must contain a JSON array of rows");let l=y(`Creating ${u.length} rows...`);l.start();let c=[],d=Math.ceil(u.length/r);for(let h=0;h<u.length;h+=r){let F=u.slice(h,h+r),A=Math.floor(h/r)+1;l.text=`Creating rows batch ${A}/${d} (${c.length+F.length}/${u.length})...`;let k=await i.tables.createRows(t,{fileId:n.fileId,deploymentId:n.deploymentId,rows:F});c.push(...k.rowIds)}l.succeed(`Created ${c.length} rows.`);let m={rowsCreated:c.length,rowIds:c};p()?D(m):E(`${c.length} rows created in table ${t}`)}),e.command("delete <tableId>").description("Delete all rows for a file in a table").requiredOption("--file-id <id>","File ID").requiredOption("--deployment-id <id>","Deployment ID").action(async(t,n)=>{let i=new g(f()),r=y("Deleting rows...");r.start();let o=await i.tables.deleteRows(t,{fileId:n.fileId,deploymentId:n.deploymentId});r.succeed(`Deleted ${o.rowsDeleted} rows.`),p()?D(o):E(`${o.rowsDeleted} rows deleted from table ${t}`)})}var ae=I(require("fs")),ne=I(require("path"));function ca(s){let e=s.command("buckets").description("Bucket management");e.command("list <projectId>").description("List buckets in a project").action(async t=>{let i=await new g(f()).buckets.list(t);p()?D(i):v(i.map(r=>({id:r.id,name:r.name,files:r.fileCount,created:r.createdAt})))}),e.command("create <projectId>").description("Create a new bucket").requiredOption("--name <name>","Bucket name").option("--description <description>","Bucket description").action(async(t,n)=>{let r=await new g(f()).buckets.create(t,n.name,n.description);p()?D(r):(E(`Bucket created: ${r.id}`),w({id:r.id,name:r.name,description:r.description??""}))}),e.command("delete <bucketId>").description("Delete a bucket").action(async t=>{await new g(f()).buckets.delete(t),p()?D({success:!0}):E(`Bucket ${t} deleted.`)}),e.command("upload <bucketId> <path>").description("Upload file(s) to a bucket").action(async(t,n)=>{let i=f(),r=new g(i),o=ne.resolve(n);ae.existsSync(o)||(_({code:"NOT_FOUND",message:`Path not found: ${o}`}),process.exit(1));let a=ae.statSync(o);if(a.isFile())await la(r,t,o);else if(a.isDirectory()){let l=ae.readdirSync(o).map(m=>ne.join(o,m)).filter(m=>ae.statSync(m).isFile());if(l.length===0){Y("No files found in directory.");return}B(`Found ${l.length} file(s) to upload.`);let c=0,d=0;for(let m of l)try{await la(r,t,m),c++}catch(h){d++,Y(`Failed: ${ne.basename(m)} - ${h instanceof Error?h.message:"Unknown error"}`)}E(`Upload complete: ${c} uploaded, ${d} failed (${l.length} total)`)}}),e.command("files <bucketId>").description("List files in a bucket").option("--label <labels...>","Filter by labels").action(async(t,n)=>{let r=await new g(f()).buckets.listFiles(t,n.label);p()?D(r):v(r.map(o=>({id:o.id,name:o.name,labels:o.labels.join(", "),size:o.sizeBytes?ns(o.sizeBytes):"-",status:o.status,created:o.createdAt})))}),e.command("download <bucketId> <fileId>").description("Download a file from a bucket").option("--output <path>","Output file path").action(async(t,n,i)=>{let r=new g(f()),o=y("Getting download URL...");o.start();let{url:a,fileName:u}=await r.buckets.getDownloadUrl(t,n),l=ne.basename(u).replace(/[/\\:*?"<>|]/g,"_");!(l===u&&!u.startsWith(".")&&u.length>0)&&!i.output&&(o.fail(`Server returned an unsafe filename "${u}". Use --output to specify an explicit path.`),process.exit(1));let d=i.output?ne.resolve(i.output):ne.resolve(l);ae.mkdirSync(ne.dirname(d),{recursive:!0}),o.text=`Downloading ${l}...`;let m=await fetch(a);m.ok||(o.fail(`Download failed: HTTP ${m.status}`),process.exit(1));let h=Buffer.from(await m.arrayBuffer());ae.writeFileSync(d,h);let F=h.length;o.succeed(`Downloaded ${l} (${ns(F)}) to ${d}`),p()&&D({fileId:n,fileName:u,outputPath:d,bytes:F})}),e.command("label <bucketId> <fileId>").description("Add or remove labels on a file").option("--add <labels...>","Labels to add").option("--remove <labels...>","Labels to remove").action(async(t,n,i)=>{!i.add&&!i.remove&&(_({code:"VALIDATION",message:"Provide --add or --remove with label values."}),process.exit(1));let r=new g(f()),a=(await r.buckets.listFiles(t)).find(c=>c.id===n);a||(_({code:"NOT_FOUND",message:`File ${n} not found in bucket.`}),process.exit(1));let u=[...a.labels];if(i.add)for(let c of i.add)u.includes(c)||u.push(c);i.remove&&(u=u.filter(c=>!i.remove.includes(c)));let l=await r.buckets.updateLabels(t,n,u);p()?D(l):E(`Labels updated: [${u.join(", ")}]`)}),e.command("send <bucketId> <fileId>").description("Send a bucket file to a deployment, classifier, or splitter").option("--deployment <id>","Target deployment ID").option("--classifier <id>","Target classifier ID").option("--splitter <id>","Target splitter ID").action(async(t,n,i)=>{[i.deployment,i.classifier,i.splitter].filter(Boolean).length!==1&&(_({code:"VALIDATION",message:"Provide exactly one target: --deployment, --classifier, or --splitter."}),process.exit(1));let o=new g(f()),a,u;i.deployment?(a="DEPLOYMENT",u=i.deployment):i.classifier?(a="CLASSIFIER",u=i.classifier):(a="SPLITTER",u=i.splitter);let l=y(`Sending file to ${a.toLowerCase()} ${u}...`);l.start();let c=await o.buckets.sendTo(t,n,a,u);l.succeed(`File sent to ${a.toLowerCase()}.`),p()&&D(c)})}async function la(s,e,t){let n=ne.basename(t),i=y(`Uploading ${n}...`);i.start();let{url:r,fileId:o}=await s.buckets.getUploadUrl(e,n),a=await s.http.putFile(r,t,"application/octet-stream");await s.buckets.confirmUpload(e,o,a),i.succeed(`Uploaded ${n} (${ns(a)}) - File ID: ${o}`),p()&&D({fileId:o,filename:n,bytes:a})}function ns(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var G=I(require("fs")),J=I(require("path"));var da=I(require("path")),Fc={".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".heic":"image/heic",".heif":"image/heif",".svg":"image/svg+xml",".txt":"text/plain",".md":"text/markdown",".csv":"text/csv",".json":"application/json",".xml":"application/xml",".html":"text/html",".htm":"text/html",".js":"application/javascript",".ts":"application/typescript",".py":"text/x-python",".sh":"application/x-sh",".yaml":"application/yaml",".yml":"application/yaml",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".zip":"application/zip"};function Fn(s){let e=da.extname(s).toLowerCase();return Fc[e]??"application/octet-stream"}var pa=500;function Da(s){let e=s.command("agents").description("Agent management");e.command("list <projectId>").description("List agents in a project").option("--status <status>","Filter by status (ACTIVE, PAUSED, DISABLED)").action(async(r,o)=>{let u=await new g(f()).agents.list(r,o);p()?D(u):v(u.map(l=>({id:l.id,name:l.name,status:l.status,role:l.role??"GENERAL",triggers:l.triggerTypes.join(", "),deployments:l.deploymentRoutes.map(c=>c.deploymentName).join(", "),runs:l.runCount,created:l.createdAt})))}),e.command("get <projectId> <agentId>").description("Show agent details").action(async(r,o)=>{let u=await new g(f()).agents.get(r,o);p()?D(u):w({id:u.id,name:u.name,status:u.status,role:u.role??"GENERAL",triggers:u.triggerTypes.join(", "),"process content":Fe(u.processContent,120),deployments:u.deploymentRoutes.map(l=>`${l.deploymentName} (${l.deploymentId})`).join(", "),"email address":u.ingestEmailAddress??"",connection:u.connection?`${u.connection.provider} (${u.connection.status})`:"",files:u.files.map(l=>l.fileName).join(", "),skills:u.skills.map(l=>l.name).join(", "),runs:u.runCount,created:u.createdAt,updated:u.updatedAt})}),e.command("create <projectId>").description("Create a new agent").requiredOption("--name <name>","Agent name").requiredOption("--triggers <triggers>","Comma-separated trigger types (DOCUMENT_EXTRACTED, DOCUMENT_REVIEWED, EMAIL_RECEIVED)").option("--process-file <path>","Read process content from file").option("--deployments <deployments>","Comma-separated deployment IDs").option("--connection-id <connectionId>","Integration connection ID").option("--integration-config-file <path>","Read provider-specific integrationConfigs JSON from file").option("--tier <tier>","Agent tier (STANDARD, STANDARD_PLUS, MAX)").option("--role <role>","Agent role (GENERAL, VALIDATOR). VALIDATOR agents run document validation and report into the validation lifecycle.").option("--email-local-part <value>","Custom email local part (before @domain). Optional; auto-generated if omitted.").option("--file <path>","Attach a template file (repeatable). Equivalent to chaining `agents upload-file` after create.",yc,[]).action(async(r,o)=>{let a=new g(f()),u="";if(o.processFile){let A=J.resolve(o.processFile);u=G.readFileSync(A,"utf-8")}let l=o.triggers.split(",").map(A=>A.trim()),c=o.deployments?o.deployments.split(",").map(A=>A.trim()):void 0,d=o.integrationConfigFile?JSON.parse(G.readFileSync(J.resolve(o.integrationConfigFile),"utf-8")):void 0,m=y("Creating agent...");m.start();let h=await a.agents.create(r,{name:o.name,processContent:u,triggerTypes:l,deploymentIds:c,connectionId:o.connectionId,integrationConfigs:d,tier:o.tier,role:o.role,emailLocalPart:o.emailLocalPart});m.succeed(`Agent created: ${h.id}`);let F=[];for(let A of o.file){let k=await ma(a,r,h.id,A);F.push(k)}p()?D({...h,uploadedFiles:F}):w({id:h.id,name:h.name,status:h.status,role:h.role??"GENERAL",triggers:h.triggerTypes.join(", "),...F.length>0&&{files:F.map(A=>`${A.filename} (${A.fileId})`).join(", ")}})}),e.command("update <projectId> <agentId>").description("Update an agent").option("--name <name>","Agent name").option("--process-file <path>","Read process content from file").option("--triggers <triggers>","Comma-separated trigger types").option("--deployments <deployments>","Comma-separated deployment IDs").option("--connection-id <connectionId>","Integration connection ID").option("--integration-config-file <path>","Read provider-specific integrationConfigs JSON from file").option("--status <status>","Agent status (ACTIVE, PAUSED, DISABLED)").option("--tier <tier>","Agent tier (STANDARD, STANDARD_PLUS, MAX)").option("--role <role>","Agent role (GENERAL, VALIDATOR). VALIDATOR agents run document validation and report into the validation lifecycle.").option("--email-local-part <value>","Custom email local part (before @domain). Optional.").action(async(r,o,a)=>{let u=new g(f()),l={};a.name&&(l.name=a.name),a.status&&(l.status=a.status),a.tier&&(l.tier=a.tier),a.role&&(l.role=a.role),a.connectionId&&(l.connectionId=a.connectionId),a.emailLocalPart&&(l.emailLocalPart=a.emailLocalPart),a.integrationConfigFile&&(l.integrationConfigs=JSON.parse(G.readFileSync(J.resolve(a.integrationConfigFile),"utf-8"))),a.processFile&&(l.processContent=G.readFileSync(J.resolve(a.processFile),"utf-8")),a.triggers&&(l.triggerTypes=a.triggers.split(",").map(d=>d.trim())),a.deployments&&(l.deploymentIds=a.deployments.split(",").map(d=>d.trim()));let c=y("Updating agent...");c.start(),await u.agents.update(r,o,l),c.succeed("Agent updated."),p()&&D({success:!0})}),e.command("delete <projectId> <agentId>").description("Delete an agent").action(async(r,o)=>{await new g(f()).agents.delete(r,o),p()?D({success:!0}):E(`Agent ${o} deleted.`)}),e.command("upload-file <projectId> <agentId> <filePath>").description("Upload a template file to an agent").action(async(r,o,a)=>{let u=new g(f()),l=await ma(u,r,o,a);p()&&D(l)}),e.command("delete-file <projectId> <agentId> <fileId>").description("Delete a template file from an agent").action(async(r,o,a)=>{await new g(f()).agents.deleteFile(r,o,a),p()?D({success:!0}):E(`File ${a} deleted.`)}),e.command("download-file <projectId> <agentId> <fileId>").description("Download a template file from an agent").option("--output <path>","Output file path").action(async(r,o,a,u)=>{let l=new g(f()),c=y("Getting download URL...");c.start();let{url:d,fileName:m}=await l.agents.getFileDownloadUrl(r,o,a),h=J.basename(m).replace(/[/\\:*?"<>|]/g,"_");!(h===m&&!m.startsWith(".")&&m.length>0)&&!u.output&&(c.fail(`Server returned an unsafe filename "${m}". Use --output to specify an explicit path.`),process.exit(1));let A=u.output?J.resolve(u.output):J.resolve(h);G.mkdirSync(J.dirname(A),{recursive:!0}),c.text=`Downloading ${m}...`;let k=await fetch(d);k.ok||(c.fail(`Download failed: HTTP ${k.status}`),process.exit(1));let b=Buffer.from(await k.arrayBuffer());G.writeFileSync(A,b);let C=b.length;c.succeed(`Downloaded ${m} (${is(C)}) to ${A}`),p()&&D({fileId:a,fileName:m,outputPath:A,bytes:C})});let t=e.command("skills").description("Agent skill management");t.command("list <projectId> <agentId>").description("List skills for an agent").action(async(r,o)=>{let u=await new g(f()).agents.listSkills(r,o);p()?D(u):v(u.map(l=>({id:l.id,name:l.name,content:Fe(l.content,80),created:l.createdAt})))}),t.command("create <projectId> <agentId>").description("Create a skill for an agent").requiredOption("--name <name>","Skill name").requiredOption("--content-file <path>","Read skill content from file").action(async(r,o,a)=>{let u=new g(f()),l=G.readFileSync(J.resolve(a.contentFile),"utf-8"),c=y("Creating skill...");c.start();let d=await u.agents.createSkill(r,o,{name:a.name,content:l});c.succeed(`Skill created: ${d.id}`),p()?D(d):w({id:d.id,name:d.name})}),t.command("update <projectId> <agentId> <skillId>").description("Update a skill").option("--name <name>","Skill name").option("--content-file <path>","Read skill content from file").action(async(r,o,a,u)=>{let l=new g(f()),c={};u.name&&(c.name=u.name),u.contentFile&&(c.content=G.readFileSync(J.resolve(u.contentFile),"utf-8"));let d=y("Updating skill...");d.start(),await l.agents.updateSkill(r,o,a,c),d.succeed("Skill updated."),p()&&D({success:!0})}),t.command("delete <projectId> <agentId> <skillId>").description("Delete a skill").action(async(r,o,a)=>{await new g(f()).agents.deleteSkill(r,o,a),p()?D({success:!0}):E(`Skill ${a} deleted.`)}),t.command("link-file <projectId> <agentId> <skillId> <fileId>").description("Link an agent file to a skill (file lands in the skill folder at runtime)").action(async(r,o,a,u)=>{let c=await new g(f()).agents.linkFileToSkill(r,o,a,u);p()?D(c):E(`Linked ${c.file.fileName} to skill ${a}.`)}),t.command("unlink-file <projectId> <agentId> <skillId> <fileId>").description("Unlink a file from a skill").action(async(r,o,a,u)=>{await new g(f()).agents.unlinkFileFromSkill(r,o,a,u),p()?D({success:!0}):E(`Unlinked file ${u} from skill ${a}.`)});let n=e.command("runs").description("Agent run management");n.command("list <projectId> <agentId>").description("List runs for an agent").option("--limit <limit>","Max results (default 20, max 100)").option("--status <status>","Filter by status (PENDING, RUNNING, COMPLETED, FAILED, ...)").action(async(r,o,a)=>{let l=await new g(f()).agents.listRuns(r,o,{limit:a.limit?parseInt(a.limit,10):void 0,status:a.status});p()?D(l):v(l.map(c=>({id:c.id,status:c.status,triggerType:c.triggerType,title:Fe(c.title,40),steps:c.stepsCount,duration:c.executionDurationMs?`${(c.executionDurationMs/1e3).toFixed(1)}s`:"-",created:c.createdAt})))}),n.command("get <projectId> <agentId> <runId>").description("Show run details").action(async(r,o,a)=>{let l=await new g(f()).agents.getRun(r,o,a);p()?D(l):(w({id:l.id,status:l.status,triggerType:l.triggerType,triggerEventId:l.triggerEventId,title:l.title,sandboxId:l.sandboxId??"-",errorMessage:l.errorMessage??"",duration:l.executionDurationMs?`${(l.executionDurationMs/1e3).toFixed(1)}s`:"-",startedAt:l.startedAt??"-",completedAt:l.completedAt??"-",created:l.createdAt}),l.steps.length>0&&(console.log(`
62
62
  Steps:`),v(l.steps.map(c=>({id:c.id,type:c.type,title:Fe(c.title,40),status:c.status,order:c.order})))),l.emailDrafts.length>0&&(console.log(`
63
63
  Email Drafts:`),v(l.emailDrafts.map(c=>({id:c.id,to:c.toAddress,subject:Fe(c.subject,40),status:c.status,created:c.createdAt})))))}),n.command("conversation <projectId> <agentId> <runId>").description("Show sanitized run conversation").option("--step-id <stepId>","Limit to the conversation for a specific step/session").action(async(r,o,a,u)=>{let c=await new g(f()).agents.getRunConversation(r,o,a,{stepId:u.stepId});if(p()){D(c);return}if(c.unavailable){_({code:"CONVERSATION_UNAVAILABLE",message:"Conversation unavailable."});return}for(let d of c.messages){let m=d,h=m.info?.role??"unknown",F=m.info?.finish?` (${m.info.finish})`:"";console.log(`
64
64
  [${h}${F}]`);for(let A of m.parts??[])if(A.type==="text"&&A.text)console.log(A.text);else if(A.type==="tool"){let k=A.state?.status??"unknown",b=A.state?.input?` ${JSON.stringify(A.state.input)}`:"";console.log(`- tool: ${A.tool??"unknown"} [${k}]${b}`),A.state?.output&&console.log(` output: ${Fe(A.state.output,240)}`)}}});function i(r){if(r===void 0)return;let o=Number(r);return(!Number.isInteger(o)||o<1||o>pa)&&(_({code:"VALIDATION_ERROR",message:`--limit must be a whole number between 1 and ${pa}, got "${r}".`}),process.exit(1)),o}n.command("inference-logs <projectId> <agentId> <runId>").description("Show the model calls a run made (step counts, failures, token usage)").option("--limit <n>","Max log entries to return (max 500)").option("--status <status>","Filter by call status (success, error)").action(async(r,o,a,u)=>{let l=i(u.limit),c=new g(f()),d=y("Loading inference logs...");d.start();let m=await c.agents.getRunInferenceLogs(r,o,a,{limit:l,status:u.status}).finally(()=>d.stop());if(p()){D(m);return}if(w({runId:m.runId,totalCalls:m.summary.totalCalls,success:m.summary.successCount,errors:m.summary.errorCount,inputTokens:m.summary.totalInputTokens,outputTokens:m.summary.totalOutputTokens,duration:`${(m.summary.totalDurationMs/1e3).toFixed(1)}s`,truncated:m.truncated}),m.data.length===0){console.log(`
65
65
  No model calls recorded for this run.`);return}console.log(`
66
66
  Calls:`),v(m.data.map(h=>({id:h.id,step:h.stepNumber??"-",callType:h.callType,model:h.model,status:h.status,duration:`${(h.durationMs/1e3).toFixed(1)}s`,inputTokens:h.inputTokens??"-",outputTokens:h.outputTokens??"-",error:h.errorMessage?Fe(h.errorMessage,40):""})))}),e.command("create-run <projectId> <agentId>").description("Create a new agent run").requiredOption("--trigger-event-id <triggerEventId>","ID of the triggering event").requiredOption("--trigger-type <triggerType>","Trigger type (DOCUMENT_EXTRACTED, DOCUMENT_REVIEWED, EMAIL_RECEIVED)").requiredOption("--title <title>","Run title").option("--metadata <json>","JSON metadata string").action(async(r,o,a)=>{let u=new g(f()),l=y("Creating run...");l.start();let c=a.metadata?JSON.parse(a.metadata):void 0,d=await u.agents.createRun(r,o,{triggerEventId:a.triggerEventId,triggerType:a.triggerType,title:a.title,metadata:c});l.succeed(`Run created: ${d.id}`),p()?D(d):w({id:d.id,status:d.status,title:d.title})}),e.command("create-step <projectId> <agentId> <runId>").description("Create a step within a run").requiredOption("--type <type>","Step type (EMAIL_DRAFT, DATA_REVIEW, FILE_OUTPUT, TASK, USER_INPUT)").requiredOption("--title <title>","Step title").requiredOption("--order <order>","Step order (integer)").option("--description <description>","Step description").option("--post-review-action <action>","Post-review action (NONE, RESUME_AGENT)").option("--data <json>","JSON data string").option("--conditions <json>",`JSON array of conditions, e.g. '[{"type":"DOCUMENT_REVIEWED","entityId":"fileId1","label":"Invoice 1"}]'`).action(async(r,o,a,u)=>{let l=new g(f()),c=y("Creating step...");c.start();let d;if(u.conditions){let h=JSON.parse(u.conditions);Array.isArray(h)||(c.fail("--conditions must be a JSON array"),process.exit(1)),d=h}let m=await l.agents.createStep(r,o,a,{type:u.type,title:u.title,order:parseInt(u.order,10),description:u.description,postReviewAction:u.postReviewAction,data:u.data?JSON.parse(u.data):void 0,conditions:d});c.succeed(`Step created: ${m.id}`),p()?D(m):(w({id:m.id,type:m.type,title:m.title,status:m.status}),m.conditions&&m.conditions.length>0&&(console.log(`
67
- Conditions:`),v(m.conditions.map(h=>({id:h.id,type:h.type,entityId:h.entityId,label:h.label??"",met:h.met?"yes":"no"})))))}),e.command("create-steps <projectId> <agentId> <runId>").description("Create multiple steps within a run in a single batch request").requiredOption("--steps-file <path>",'JSON file with {"steps":[...]} or a bare array of step objects').action(async(r,o,a,u)=>{let l=new g(f()),c=JSON.parse(G.readFileSync(J.resolve(u.stepsFile),"utf-8")),d=Array.isArray(c)?c:c?.steps;Array.isArray(d)||(_({code:"INVALID_STEPS_FILE",message:'Steps file must be a JSON array or an object with a "steps" array.'}),process.exit(1));let m=y(`Creating ${d.length} steps...`);m.start();let h=await l.agents.createSteps(r,o,a,d);m.succeed(`Steps created: ${h.steps.length}`),p()?D(h):v(h.steps.map(F=>({id:F.id,type:F.type,title:Fe(F.title,40),status:F.status,order:F.order,conditions:F.conditions?.length??0})))}),e.command("update-run <projectId> <agentId> <runId>").description("Update a run's status, metadata, or error message").option("--status <status>","Run status (PENDING, RUNNING, PAUSED, WAITING_HUMAN, COMPLETED, FAILED)").option("--metadata <json>","JSON object to merge into run metadata").option("--error-message <message>","Error message").action(async(r,o,a,u)=>{let l=new g(f()),c=y("Updating run...");c.start();let d={};u.status&&(d.status=u.status),u.errorMessage&&(d.errorMessage=u.errorMessage),u.metadata&&(d.metadata=JSON.parse(u.metadata));let m=await l.agents.updateRun(r,o,a,d);c.succeed(`Run updated: ${m.status}`),p()&&D(m)}),e.command("update-step <projectId> <agentId> <runId> <stepId>").description("Update a step's status or data").option("--status <status>","Step status (PENDING, IN_PROGRESS, WAITING_HUMAN, COMPLETED, FAILED, SKIPPED)").option("--data <json>","JSON data string").action(async(r,o,a,u,l)=>{let c=new g(f()),d=y("Updating step...");d.start();let m=await c.agents.updateStep(r,o,a,u,{status:l.status,data:l.data?JSON.parse(l.data):void 0});d.succeed(`Step updated: ${m.status}`),p()&&D(m)}),e.command("update-step-conditions <projectId> <agentId> <runId> <stepId>").description("Replace a step's conditions (e.g. patch placeholder entityIds)").requiredOption("--conditions <json>",'JSON array: [{"type":"DOCUMENT_REVIEWED","entityId":"<fileId>","label":"..."}]').action(async(r,o,a,u,l)=>{let c=new g(f()),d=y("Updating step conditions...");d.start();let m=JSON.parse(l.conditions),h=await c.agents.updateStepConditions(r,o,a,u,m);d.succeed(`Step conditions replaced (${m.length})`),p()&&D(h)}),e.command("pause-run <projectId> <agentId> <runId>").description("Pause a running agent run").action(async(r,o,a)=>{let u=new g(f()),l=y("Pausing run...");l.start();let c=await u.agents.pauseRun(r,o,a);l.succeed(`Run paused: ${c.runId}`),p()&&D(c)}),xs()&&Cc(e)}function Cc(s){s.command("send-email <projectId> <agentId>").description("Draft or send an email from an agent execution").requiredOption("--execution-id <executionId>","Agent execution ID").requiredOption("--to <to>","Recipient email address").requiredOption("--subject <subject>","Email subject").option("--body <body>","Email body text").option("--body-file <path>","Read email body from file (overrides --body)").option("--html-body <htmlBody>","HTML version of the email body").option("--in-reply-to <messageId>","Message-ID of the email being replied to").action(async(e,t,n)=>{!n.body&&!n.bodyFile&&(console.error("Either --body or --body-file is required"),process.exit(1));let i=new g(f()),r=n.body??"";if(n.bodyFile){let u=J.resolve(n.bodyFile);r=G.readFileSync(u,"utf-8")}let o=y("Sending email...");o.start();let a=await i.agents.sendEmail(e,t,{executionId:n.executionId,to:n.to,subject:n.subject,body:r,htmlBody:n.htmlBody,inReplyTo:n.inReplyTo});a.status==="SENT"?o.succeed(`Email sent. Draft ID: ${a.draftId}`):o.succeed(`Email draft created (${a.status}). Draft ID: ${a.draftId}`),p()&&D(a)}),s.command("complete <projectId> <agentId> <executionId>").description("Mark an agent execution as completed or failed").option("--status <status>","Execution status (COMPLETED or FAILED)","COMPLETED").option("--error <message>","Error message (when status is FAILED)").option("--output-file <name>","Name of generated output file").option("--output-url <url>","URL to output file").action(async(e,t,n,i)=>{let r=i.status.toUpperCase();r!=="COMPLETED"&&r!=="FAILED"&&(console.error("Status must be COMPLETED or FAILED"),process.exit(1));let o=new g(f()),a=y(`Completing execution (${r.toLowerCase()})...`);a.start();let u=await o.agents.completeExecution(e,t,{executionId:n,status:r,errorMessage:i.error,outputFileName:i.outputFile,outputUrl:i.outputUrl});a.succeed(`Execution ${n} marked as ${r.toLowerCase()}${u.sandboxArchived?" \u2014 sandbox archived":""}`),p()&&D(u)}),s.command("sharepoint-token <projectId> <agentId>").description("Deprecated: SharePoint uploads now go through integrations sharepoint upload").requiredOption("--execution-id <executionId>","Agent execution ID").action(async(e,t,n)=>{_({code:"SHAREPOINT_TOKEN_DEPRECATED",message:"SharePoint token access is deprecated. Use `limai integrations sharepoint upload` instead."}),process.exit(1)}),s.command("upload-artifact <projectId> <agentId> <executionId> <filePath>").description("Upload a file as an artifact for an agent execution").action(async(e,t,n,i)=>{let r=new g(f()),{filename:o,buffer:a}=fa(i),u=y(`Uploading ${o}...`);u.start();let{uploadUrl:l,s3Key:c}=await r.agents.getArtifactUploadUrl(e,t,{executionId:n,fileName:o});await r.http.putRaw(l,a,"application/octet-stream"),u.succeed(`Uploaded ${o} (${ts(a.length)})`),p()&&D({success:!0,s3Key:c,fileName:o})})}function fa(s){let e=J.resolve(s);return G.existsSync(e)||(console.error(`File not found: ${e}`),process.exit(1)),{filename:J.basename(e),buffer:G.readFileSync(e)}}async function ma(s,e,t,n){let{filename:i,buffer:r}=fa(n),o=Fn(i),a=y(`Uploading ${i}...`);a.start();let{url:u,fileId:l}=await s.agents.getFileUploadUrl(e,t,i);return await s.http.putRaw(u,r,o),await s.agents.updateFileMetadata(e,t,l,{sizeBytes:r.length,mimeType:o}),a.succeed(`Uploaded ${i} (${ts(r.length)}) - File ID: ${l}`),{fileId:l,filename:i,bytes:r.length}}function yc(s,e){return[...e,s]}function Fe(s,e){return s.length<=e?s:s.slice(0,e-3)+"..."}function ts(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var Ke=I(require("fs")),ns=I(require("path"));function Ec(s,e){return[...e,s]}function ga(s){s.command("vision").description("Vision queries against PDFs and images via Gemini").command("ask").description("Ask a vision question about one or more PDFs or images").requiredOption("-f, --files <path>","File path (repeatable) \u2014 PDFs or images",Ec,[]).requiredOption("-p, --prompt <text>","The question to ask").option("--project <id>","Project ID (defaults to LIMAI_PROJECT_ID env var)").option("--schema-file <path>","JSON Schema file \u2014 when provided, returns structured output").option("--fast","Use the faster Gemini 3.1 Flash Lite model instead of Gemini 3.1 Pro").action(async t=>{let n=t.project??process.env.LIMAI_PROJECT_ID;n||(_({code:"VALIDATION",message:"Missing project ID. Pass --project <id> or set LIMAI_PROJECT_ID."}),process.exit(1)),t.files.length===0&&(_({code:"VALIDATION",message:"Pass at least one --files <path>."}),process.exit(1));let i=t.files.map(l=>{let c=ns.resolve(l);return Ke.existsSync(c)||(_({code:"NOT_FOUND",message:`File not found: ${c}`}),process.exit(1)),{data:Ke.readFileSync(c).toString("base64"),mimeType:Fn(c)}}),r;if(t.schemaFile){let l=ns.resolve(t.schemaFile);Ke.existsSync(l)||(_({code:"NOT_FOUND",message:`Schema file not found: ${l}`}),process.exit(1));try{let c=JSON.parse(Ke.readFileSync(l,"utf-8"));if(!c||typeof c!="object"||Array.isArray(c))throw new Error("Schema file must contain a JSON object");r=c}catch(c){_({code:"VALIDATION",message:`Invalid schema file: ${c instanceof Error?c.message:c}`}),process.exit(1)}}let o=new g(f()),a=y(`Asking Gemini${t.fast?" Flash Lite":""} about ${i.length} file(s)...`);a.start();let u=await o.vision.ask(n,{prompt:t.prompt,files:i,...r&&{schema:r},...t.fast&&{fast:!0}});a.succeed("Vision response received"),p()?D(u):"text"in u?console.log(u.text):console.log(JSON.stringify(u.data,null,2))})}var le=I(require("fs")),Ce=I(require("path"));function Cn(s){return JSON.parse(le.readFileSync(Ce.resolve(s),"utf-8"))}var ha=["SURFACE","RESEND"];function is(s){let e=s.toUpperCase();if(!ha.includes(e))throw new R(`Invalid --behavior "${s}". Expected one of: ${ha.join(", ")}`,{code:"INVALID_ARGUMENT",exitCode:2});return e}var Fa=1e3,Ca=6e5;function ya(s){let e=Number(s);if(!Number.isInteger(e)||e<Fa||e>Ca)throw new R(`Invalid --timeout-ms "${s}". Expected an integer between ${Fa} and ${Ca}`,{code:"INVALID_ARGUMENT",exitCode:2});return e}function bc(s){let e=Ce.resolve(s),t=Ce.join(e,"manifest.json"),n=Ce.join(e,"script.mjs");if(!le.existsSync(t))throw new R(`Missing manifest.json in ${e}`,{code:"INVALID_ARGUMENT",exitCode:2});if(!le.existsSync(n))throw new R(`Missing script.mjs in ${e}`,{code:"INVALID_ARGUMENT",exitCode:2});let i=JSON.parse(le.readFileSync(t,"utf-8"));if(!i.key||!i.name)throw new R(`${t} must define "key" and "name"`,{code:"INVALID_ARGUMENT",exitCode:2});return{manifest:i,source:le.readFileSync(n,"utf-8")}}function ss(s){return{key:s.key,name:s.name,behavior:s.behavior,version:s.version,enabled:s.enabled,timeoutMs:s.timeoutMs,updatedAt:s.updatedAt}}function Ea(s){let e=s.command("validations").description("Validation result submission and custom validation scripts");e.command("submit <extractionSchemaId> <fileId>").description("Submit a validation result for a file").requiredOption("--findings-file <path>","Read findings JSON array from file").option("--changes-file <path>","Read cell changes JSON array from file").option("--breakdown-file <path>","Read breakdown JSON object from file").option("--new-rows-file <path>","Read new rows JSON array from file").option("--no-strict","Skip unresolved references instead of failing the whole request").action(async(n,i,r)=>{let o=new g(f()),a={findings:Cn(r.findingsFile),strict:r.strict};r.changesFile&&(a.cellChanges=Cn(r.changesFile)),r.breakdownFile&&(a.breakdown=Cn(r.breakdownFile)),r.newRowsFile&&(a.newRows=Cn(r.newRowsFile));let u=y("Submitting validation...");u.start();let l;try{l=await o.validations.submit(n,i,a)}catch(c){if(u.fail("Validation submission failed."),Ac(c)){let d=c.details.invalidValues;console.error(`Submission rejected: ${d.length} value(s) do not match their column type. No changes were applied.`);for(let m of d)console.error(` - ${_c(m)}`)}else if(wc(c)){let d=c.details.unresolvedReferences;console.error(`Strict mode rejected the submission: ${d.length} unresolved reference(s). No changes were applied.`);for(let m of d)console.error(` - ${Ic(m)}`)}throw c}u.succeed("Validation submitted."),p()?D(l):w(l)});let t=e.command("scripts").description("Manage custom validation scripts on an extraction schema (uploads the source and registers it in one call)");t.command("list <extractionSchemaId>").description("List the custom validation scripts registered on a schema").action(async n=>{let i=await Ft().validations.listScripts(n);if(p()){D(i);return}v(i.map(ss))}),t.command("get <extractionSchemaId> <key>").description("Show one custom validation script").option("--source","Include the script source").option("--output <path>","Write the script source to a file").action(async(n,i,r)=>{let o=!!(r.source||r.output),a=await Ft().validations.getScript(n,i,{includeSource:o});if(r.output&&a.source!==void 0&&le.writeFileSync(Ce.resolve(r.output),a.source,"utf-8"),p()){D(a);return}let{source:u,...l}=a;w(l),r.output?E(`Source written to ${r.output}`):r.source&&u!==void 0&&(console.log(),console.log(u))}),t.command("push <extractionSchemaId>").description("Upload a validation script and register it. Creates it, or bumps its version when the source changed.").option("--dir <path>","Script directory containing manifest.json and script.mjs").option("--file <path>","Script source file (.mjs)").option("--key <key>","Script key (lowercase letters, digits, hyphens)").option("--name <name>","Human-readable script name").option("--description <text>","Script description").option("--behavior <behavior>","SURFACE or RESEND").option("--timeout-ms <ms>","Per-run timeout in milliseconds").option("--disabled","Register the script without enabling it").action(async(n,i)=>{if(!i.dir&&!i.file)throw new R("Provide either --dir or --file",{code:"INVALID_ARGUMENT",exitCode:2});if(i.dir&&i.file)throw new R("--dir and --file are mutually exclusive",{code:"INVALID_ARGUMENT",exitCode:2});let r;if(i.dir){let{manifest:u,source:l}=bc(i.dir);r={key:i.key??u.key,name:i.name??u.name,description:i.description??u.description??null,behavior:is(i.behavior??u.behavior??"SURFACE"),source:l}}else{if(!i.key||!i.name)throw new R("--file requires --key and --name",{code:"INVALID_ARGUMENT",exitCode:2});r={key:i.key,name:i.name,description:i.description??null,behavior:is(i.behavior??"SURFACE"),source:le.readFileSync(Ce.resolve(i.file),"utf-8")}}i.disabled&&(r.enabled=!1),i.timeoutMs!==void 0&&(r.timeoutMs=ya(i.timeoutMs));let o=y(`Pushing validation script "${r.key}"...`);o.start();let a;try{a=await Ft().validations.pushScript(n,r)}catch(u){throw o.fail("Validation script push failed."),u}o.succeed(`Validation script "${r.key}": ${a.action}`),p()?D(a):(w(ss(a.script)),Qe(`S3 key: ${a.script.s3Key}`))}),t.command("update <extractionSchemaId> <key>").description("Update script metadata without uploading a new source version").option("--name <name>","New name").option("--description <text>","New description").option("--behavior <behavior>","SURFACE or RESEND").option("--timeout-ms <ms>","Per-run timeout in milliseconds").option("--enable","Enable the script").option("--disable","Disable the script").action(async(n,i,r)=>{if(r.enable&&r.disable)throw new R("--enable and --disable are mutually exclusive",{code:"INVALID_ARGUMENT",exitCode:2});let o={};if(r.name&&(o.name=r.name),r.description!==void 0&&(o.description=r.description),r.behavior&&(o.behavior=is(r.behavior)),r.timeoutMs!==void 0&&(o.timeoutMs=ya(r.timeoutMs)),r.enable&&(o.enabled=!0),r.disable&&(o.enabled=!1),Object.keys(o).length===0)throw new R("Provide at least one field to update",{code:"INVALID_ARGUMENT",exitCode:2});let a=await Ft().validations.updateScript(n,i,o);p()?D(a):w(ss(a))}),t.command("delete <extractionSchemaId> <key>").description("Delete a validation script and all of its stored results. Use `update --disable` to keep the history.").action(async(n,i)=>{let r=await Ft().validations.deleteScript(n,i);p()?D(r):E(`Deleted validation script "${i}" (${r.deletedResults} result(s) removed).`)})}function Ft(){return new g(f())}function wc(s){if(!(s instanceof R)||s.statusCode!==400)return!1;let e=s.details;return!!e&&typeof e=="object"&&Array.isArray(e.unresolvedReferences)}function Ic(s){return Object.entries(s).map(([t,n])=>`${t}=${String(n)}`).join(" ")}function Ac(s){if(!(s instanceof R)||s.statusCode!==400)return!1;let e=s.details;return!!e&&typeof e=="object"&&Array.isArray(e.invalidValues)}function _c(s){let e=String(s.columnName??s.columnId??"unknown column"),t=JSON.stringify(s.receivedValue),n=s.hint?` \u2014 ${String(s.hint)}`:"";return`${e} (${String(s.expectedType)}): received ${t}${n}`}var bn=I(require("fs")),ba=I(require("path"));function ce(s){let e=s.commands.find(t=>t.name()==="integrations");return e||s.command("integrations").description("Agent-facing integration tools")}function yn(){let s=process.env.LIMAI_API_BASE_URL||process.env.LIMAI_API_URL,e=process.env.LIMAI_API_SECRET;return s||(console.error("LIMAI_API_BASE_URL (or LIMAI_API_URL) environment variable is required."),process.exit(1)),e||(console.error("LIMAI_API_SECRET environment variable is required."),process.exit(1)),{apiBaseUrl:s,apiSecret:e}}function En(s,e){let t=process.env.LIMAI_API_SECRET;if(t){let i=process.env.LIMAI_API_BASE_URL||process.env.LIMAI_API_URL;return i||(console.error("LIMAI_API_BASE_URL (or LIMAI_API_URL) environment variable is required."),process.exit(1)),{url:`${i.replace(/\/$/,"")}/api/internal/integrations/${s}/upload`,headers:{"Content-Type":"application/json","x-api-secret":t}}}(!e.agent||!e.executionId)&&(console.error("--agent and --execution-id are required when uploading with LIMAI_API_TOKEN."),process.exit(1));let n=f();return{url:`${n.apiUrl.replace(/\/$/,"")}/api/v1/projects/${e.project}/agents/${e.agent}/runs/${e.executionId}/integrations/${s}/upload`,headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.token}`}}}function wa(s){ce(s).command("slack").description("Slack integration commands").command("send").description("Post a message to a Slack channel via the configured project connection").requiredOption("--project <projectId>","Project ID").requiredOption("--channel <channelId>","Slack channel ID").requiredOption("--text <text>","Message text (fallback for notifications)").option("--blocks <file>","Path to a JSON file containing a Slack blocks array").action(async n=>{let{apiBaseUrl:i,apiSecret:r}=yn(),o;if(n.blocks){let c=ba.resolve(n.blocks);bn.existsSync(c)||(console.error(`Blocks file not found: ${c}`),process.exit(1));let d=bn.readFileSync(c,"utf-8");try{let m=JSON.parse(d);Array.isArray(m)||(console.error("Blocks file must contain a JSON array"),process.exit(1)),o=m}catch(m){console.error(`Failed to parse blocks JSON: ${m instanceof Error?m.message:String(m)}`),process.exit(1)}}let a=p()?null:y("Sending Slack message...");a?.start();let u=await fetch(`${i.replace(/\/$/,"")}/api/internal/integrations/slack/send`,{method:"POST",headers:{"Content-Type":"application/json","x-api-secret":r},body:JSON.stringify({projectId:n.project,channelId:n.channel,text:n.text,...o?{blocks:o}:{}})});if(!u.ok){let c=await u.json().catch(()=>({})),d=(c&&typeof c=="object"&&"error"in c?String(c.error):null)||`HTTP ${u.status}`;a?.fail(`Failed to send Slack message: ${d}`),_({code:"SLACK_SEND_FAILED",message:d}),process.exit(1)}let l=await u.json();a?.succeed(`Message sent to ${l.channel}`),p()?D(l):console.log(JSON.stringify(l,null,2))})}var wn=I(require("fs")),Ia=I(require("path"));function Aa(s){ce(s).command("gdrive").description("Google Drive integration commands").command("upload").description("Upload a file from an S3 key to Google Drive via the project connection").requiredOption("--project <projectId>","Project ID").option("--agent <agentId>","Agent ID for resolving default destination config").option("--execution-id <executionId>","Agent execution ID for run authorization").requiredOption("--file <s3Key>","S3 key or local path; local paths are resolved to S3 keys if already uploaded").requiredOption("--name <fileName>","Destination file name in Google Drive").option("--folder <folderId>","Destination Google Drive folder ID; omit it when --step is passed").option("--step <stepId>","Step ID whose picked destination and approving user own this upload").option("--mime <mimeType>","MIME type (defaults to S3 ContentType or application/octet-stream)").action(async n=>{let i=n.file,r=Ia.resolve(n.file);wn.existsSync(r)&&wn.statSync(r).isFile()&&(console.error("Local file paths are not supported. Upload to S3 first, then pass the S3 key via --file."),process.exit(1));let o=p()?null:y(`Uploading ${n.name} to Google Drive...`);o?.start();let a=En("google-drive",n),u=await fetch(a.url,{method:"POST",headers:a.headers,body:JSON.stringify({projectId:n.project,agentId:n.agent,executionId:n.executionId,folderId:n.folder,stepId:n.step,fileName:n.name,s3Key:i,mimeType:n.mime})});if(!u.ok){let c=await u.json().catch(()=>({})),d=(c&&typeof c=="object"&&"error"in c?String(c.error):null)||`HTTP ${u.status}`;o?.fail(`Failed to upload to Google Drive: ${d}`),_({code:"GDRIVE_UPLOAD_FAILED",message:d}),process.exit(1)}let l=await u.json();o?.succeed(`Uploaded to Google Drive: ${l.fileId}`),p()?D(l):console.log(JSON.stringify(l,null,2))})}function _a(s){ce(s).command("sharepoint").description("SharePoint integration commands").command("upload").description("Upload a file from an S3 key to SharePoint via the agent's configured connection").requiredOption("--project <projectId>","Project ID").requiredOption("--agent <agentId>","Agent ID").requiredOption("--execution-id <executionId>","Agent execution ID").requiredOption("--file <s3Key>","S3 key for the uploaded artifact").requiredOption("--name <fileName>","Destination file name in SharePoint").option("--drive <driveId>","Destination SharePoint drive ID; omit it when --step is passed").option("--folder <folderId>","Destination SharePoint folder ID; omit it when --step is passed").option("--step <stepId>","Step ID whose picked destination and approving user own this upload").option("--mime <mimeType>","MIME type (defaults to S3 ContentType or application/octet-stream)").action(async n=>{let i=p()?null:y(`Uploading ${n.name} to SharePoint...`);i?.start();let r=En("sharepoint",n),o=await fetch(r.url,{method:"POST",headers:r.headers,body:JSON.stringify({projectId:n.project,agentId:n.agent,executionId:n.executionId,driveId:n.drive,folderId:n.folder,stepId:n.step,fileName:n.name,s3Key:n.file,mimeType:n.mime})});if(!o.ok){let u=await o.json().catch(()=>({})),l=(u&&typeof u=="object"&&"error"in u?String(u.error):null)||`HTTP ${o.status}`;i?.fail(`Failed to upload to SharePoint: ${l}`),_({code:"SHAREPOINT_UPLOAD_FAILED",message:l}),process.exit(1)}let a=await o.json();i?.succeed(`Uploaded to SharePoint: ${a.itemId}`),p()?D(a):console.log(JSON.stringify(a,null,2))})}function vc(){let s=process.env.LIMAI_API_BASE_URL||process.env.LIMAI_API_URL;return s||f().apiUrl}function va(s){ce(s).command("teams").description("Microsoft Teams integration commands").command("send").description("Send a message to a Teams channel or chat via the project connection").requiredOption("--project <projectId>","Project ID").option("--team <teamId>","Target team ID (use with --channel)").option("--channel <channelId>","Target channel ID (use with --team)").option("--chat <chatId>","Target chat ID (alternative to --team/--channel)").requiredOption("--text <text>","Message text").action(async n=>{let i=!!n.team&&!!n.channel,r=!!n.chat;if(i===r)throw new W("Provide either --team and --channel, or --chat (but not both)");let o=vc(),a=process.env.LIMAI_API_SECRET;if(!a)throw new R("LIMAI_API_SECRET env var is required for internal integration calls",{code:"MISSING_API_SECRET",exitCode:1});let u=r?{chatId:n.chat}:{teamId:n.team,channelId:n.channel},l=`${o.replace(/\/$/,"")}/api/internal/integrations/teams/send`,c=y("Sending Teams message...");c.start();let d=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json","x-api-secret":a},body:JSON.stringify({projectId:n.project,target:u,text:n.text})});if(!d.ok){c.fail("Failed to send");let h=await d.json().catch(()=>({})),F=typeof h?.error=="string"?h.error:`HTTP ${d.status}`;throw new R(F,{code:"TEAMS_SEND_FAILED",exitCode:1})}let m=await d.json();c.succeed("Message sent"),p()?D(m):(E(`Message ID: ${m.messageId}`),m.webUrl&&E(`URL: ${m.webUrl}`))})}function Sa(s){ce(s).command("status").description("List integration connection status for a project").requiredOption("--project <projectId>","Project ID").action(async t=>{let{apiBaseUrl:n,apiSecret:i}=yn(),r=p()?null:y("Loading integration status...");r?.start();let o=await fetch(`${n.replace(/\/$/,"")}/api/internal/integrations/status?projectId=${encodeURIComponent(t.project)}`,{headers:{"x-api-secret":i}});if(!o.ok){let u=await o.json().catch(()=>({})),l=(u&&typeof u=="object"&&"error"in u?String(u.error):null)||`HTTP ${o.status}`;r?.fail(`Failed to load status: ${l}`),_({code:"INTEGRATIONS_STATUS_FAILED",message:l}),process.exit(1)}let a=await o.json();r?.succeed("Integration status loaded"),p()?D(a):console.log(JSON.stringify(a,null,2))})}function xa(s){let e=s.command("labels").description("Manage key:value labels on files and emails");e.command("list <projectId>").description("List all distinct labels in a project").option("--entity-type <type>","Filter by entity type (file|email)").action(async(t,n)=>{let i=new g(f()),r=y("Fetching labels..."),o=await i.labels.list(t,n);r.stop(),p()?D(o):o.labels.length===0?E("No labels found"):v(o.labels.map(a=>{let u=a.split(":");return{label:a,key:u[0],value:u.length>1?u.slice(1).join(":"):""}}))}),e.command("get <projectId> <entityType> <entityId>").description("Get labels on a specific entity").action(async(t,n,i)=>{let r=new g(f()),o=y("Fetching labels..."),a=await r.labels.addRemove(t,n,i);o.stop(),p()?D(a):a.labels.length===0?E("No labels on this entity"):w(Object.fromEntries(a.labels.map((u,l)=>[`label ${l+1}`,u])))}),e.command("add <projectId> <entityType> <entityId> <labels...>").description("Add labels to an entity").action(async(t,n,i,r)=>{let o=new g(f()),a=y("Adding labels..."),u=await o.labels.addRemove(t,n,i,r);a.stop(),p()?D(u):E(`Added ${r.length} label(s). Current labels: ${u.labels.join(", ")}`)}),e.command("remove <projectId> <entityType> <entityId> <labels...>").description("Remove labels from an entity").action(async(t,n,i,r)=>{let o=new g(f()),a=y("Removing labels..."),u=await o.labels.addRemove(t,n,i,void 0,r);a.stop(),p()?D(u):E(`Removed ${r.length} label(s). Current labels: ${u.labels.join(", ")||"(none)"}`)}),e.command("search <projectId>").description("Search entities by labels").option("--entity-type <type>","Filter by entity type (file|email)").option("--labels <labels>","Comma-separated key:value pairs to match (AND logic)").option("--key <key>","Match all labels with this key prefix").action(async(t,n)=>{let i=new g(f()),r=y("Searching..."),o=await i.labels.search(t,n);r.stop(),p()?D(o):o.results.length===0?E("No matching entities found"):v(o.results.map(a=>({type:a.entityType,id:a.entityId,name:a.name||a.subject||"",labels:a.labels.join(", "),date:a.createdAt||a.receivedAt||""})))})}function ue(s,e){return[...e??[],s]}function de(s,e){_({code:s,message:e}),process.exit(1)}function Sc(s,e){return e.includes(s)}function yt(s,e,t){e!==void 0&&(Sc(e,t)||de("VALIDATION_ERROR",`Invalid ${s} "${e}". Expected one of: ${t.join(", ")}`))}function xc(s,e,t){for(let n of e??[])yt(s,n,t)}function Ct(s,e){e&&(e.length>100&&de("VALIDATION_ERROR",`Too many ${s} (${e.length}). The API accepts at most ${100}.`),new Set(e).size!==e.length&&de("VALIDATION_ERROR",`Duplicate ${s} are not allowed`))}function Ra(s){xc("event type",s.event,nt),Ct("event types",s.event),Ct("deployment IDs",s.deploymentId),Ct("agent IDs",s.agentId),Ct("classifier IDs",s.classifierId),Ct("splitter IDs",s.splitterId)}function Oa(s){return{...s.url!==void 0?{url:s.url}:{},...s.event!==void 0?{events:s.event}:{},...s.deploymentId!==void 0?{deploymentIds:s.deploymentId}:{},...s.agentId!==void 0?{agentIds:s.agentId}:{},...s.classifierId!==void 0?{classifierIds:s.classifierId}:{},...s.splitterId!==void 0?{splitterIds:s.splitterId}:{}}}function as(s){return s.length===0?"-":s.map(e=>`${e.name} (${e.id})`).join(", ")}function Tc(s){return{id:s.id,url:s.url||"(unset)",active:s.isActive,verified:s.isVerified,events:s.events.length,routes:s.deployments.length+s.agents.length+s.classifiers.length+s.splitters.length,created:s.createdAt}}function Ye(s){w({id:s.id,projectId:s.projectId,url:s.url||"(unset)",active:s.isActive,verified:s.isVerified,events:s.events.length>0?s.events.join(", "):"-",deployments:s.deployments.length?s.deployments.map(e=>`${e.name} [${e.type}] (${e.id})`).join(", "):"-",agents:as(s.agents),classifiers:as(s.classifiers),splitters:as(s.splitters),createdAt:s.createdAt,updatedAt:s.updatedAt})}function ka(s){Y(`secretKey ${s.secretKey}`),Qe("This signing secret is shown only once. Store it now \u2014 it cannot be retrieved later.")}function Ba(s,e){let t=Number(e);return Number.isInteger(t)||de("VALIDATION_ERROR",`${s} must be an integer`),t}function $a(s){let e=s.command("webhooks").description("Manage project webhook subscriptions and deliveries");e.command("list <projectId>").description("List webhook subscriptions in a project").action(async t=>{let n=new g(f()),i=y("Fetching webhooks...");i.start();let r=await n.webhooks.list(t);if(i.stop(),p()){D(r);return}v(r.webhooks.map(Tc))}),e.command("get <projectId> <webhookId>").description("Show a webhook subscription").action(async(t,n)=>{let i=new g(f()),r=y("Fetching webhook...");r.start();let o=await i.webhooks.get(t,n);if(r.stop(),p()){D(o);return}Ye(o)}),e.command("create <projectId>").description("Create a webhook subscription").option("--url <url>","Destination URL").option("--event <type>",`Event type to subscribe to (repeatable). One of: ${nt.join(", ")}`,ue).option("--deployment-id <id>","Route deployment ID (repeatable)",ue).option("--agent-id <id>","Route agent ID (repeatable)",ue).option("--classifier-id <id>","Route classifier ID (repeatable)",ue).option("--splitter-id <id>","Route splitter ID (repeatable)",ue).action(async(t,n)=>{Ra(n);let i=new g(f()),r=y("Creating webhook...");r.start();let o=await i.webhooks.create(t,Oa(n));if(r.succeed(`Webhook created: ${o.id}`),p()){D(o);return}Ye(o),ka(o)}),e.command("update <projectId> <webhookId>").description("Update a webhook subscription").option("--url <url>","Destination URL").option("--event <type>",`Replace the subscribed event types (repeatable). One of: ${nt.join(", ")}`,ue).option("--deployment-id <id>","Replace deployment routes (repeatable)",ue).option("--agent-id <id>","Replace agent routes (repeatable)",ue).option("--classifier-id <id>","Replace classifier routes (repeatable)",ue).option("--splitter-id <id>","Replace splitter routes (repeatable)",ue).option("--active","Activate the subscription").option("--inactive","Deactivate the subscription").action(async(t,n,i)=>{i.active&&i.inactive&&de("VALIDATION_ERROR","Pass either --active or --inactive, not both"),Ra(i);let r={...Oa(i),...i.active?{isActive:!0}:{},...i.inactive?{isActive:!1}:{}};Object.keys(r).length===0&&de("VALIDATION_ERROR","Provide at least one field to update (--url, --event, --deployment-id, --agent-id, --classifier-id, --splitter-id, --active, --inactive)");let o=new g(f()),a=y("Updating webhook...");a.start();let u=await o.webhooks.update(t,n,r);if(a.succeed("Webhook updated."),p()){D(u);return}Ye(u)}),e.command("delete <projectId> <webhookId>").description("Delete a webhook subscription").action(async(t,n)=>{let i=new g(f()),r=y("Deleting webhook...");if(r.start(),await i.webhooks.delete(t,n),r.stop(),p()){D({deleted:!0,webhookId:n});return}E(`Webhook deleted: ${n}`)}),e.command("pause <projectId> <webhookId>").description("Pause deliveries for a webhook subscription").action(async(t,n)=>{let i=new g(f()),r=y("Pausing webhook...");r.start();let o=await i.webhooks.pause(t,n);if(r.succeed("Webhook paused."),p()){D(o);return}Ye(o)}),e.command("resume <projectId> <webhookId>").description("Resume deliveries for a webhook subscription").action(async(t,n)=>{let i=new g(f()),r=y("Resuming webhook...");r.start();let o=await i.webhooks.resume(t,n);if(r.succeed("Webhook resumed."),p()){D(o);return}Ye(o)}),e.command("verify <projectId> <webhookId>").description("Send a verification ping to the webhook URL").action(async(t,n)=>{let i=new g(f()),r=y("Verifying endpoint...");r.start();let o=await i.webhooks.verify(t,n);r.succeed(o.message),p()&&D(o)}),e.command("rotate-secret <projectId> <webhookId>").description("Generate a new signing secret for a webhook subscription").action(async(t,n)=>{let i=new g(f()),r=y("Rotating secret...");r.start();let o=await i.webhooks.rotateSecret(t,n);if(r.succeed("Signing secret rotated."),p()){D(o);return}Ye(o),ka(o)}),e.command("deliveries <projectId> <webhookId>").description("List delivery attempts for a webhook subscription").option("--status <status>",`Filter by delivery status. One of: ${zn.join(", ")}`).option("--event-type <type>","Filter by event type").option("--deployment-id <id>","Filter by deployment route").option("--agent-id <id>","Filter by agent route").option("--classifier-id <id>","Filter by classifier route").option("--splitter-id <id>","Filter by splitter route").option("--limit <n>",`Page size (1-${200}, default 50)`).option("--offset <n>","Page offset (default 0)").action(async(t,n,i)=>{yt("status",i.status,zn),yt("event type",i.eventType,nt),[i.deploymentId,i.agentId,i.classifierId,i.splitterId].filter(d=>d!==void 0).length>1&&de("VALIDATION_ERROR","Pass at most one of --deployment-id, --agent-id, --classifier-id, --splitter-id");let o;i.limit!==void 0&&(o=Ba("--limit",i.limit),(o<1||o>200)&&de("VALIDATION_ERROR",`--limit must be between 1 and ${200}`));let a;i.offset!==void 0&&(a=Ba("--offset",i.offset),a<0&&de("VALIDATION_ERROR","--offset must be >= 0"));let u=new g(f()),l=y("Fetching deliveries...");l.start();let c=await u.webhooks.deliveries(t,n,{status:i.status,eventType:i.eventType,deploymentId:i.deploymentId,agentId:i.agentId,classifierId:i.classifierId,splitterId:i.splitterId,limit:o,offset:a});if(l.stop(),p()){D(c);return}v(c.deliveries.map(d=>({eventId:d.eventId,eventType:d.eventType,status:d.status,code:d.responseCode??"-",retries:d.retryCount,ms:d.durationMs??"-",error:d.errorType??"-",route:d.deploymentName??d.agentName??d.classifierName??d.splitterName??"-",timestamp:d.timestamp}))),Qe(`Showing ${c.deliveries.length} of ${c.total} (limit ${c.limit}, offset ${c.offset})`)}),e.command("metrics <projectId> <webhookId>").description("Show delivery metrics for a webhook subscription").option("--window <window>",`Time window. One of: ${Xn.join(", ")} (default 30d)`).option("--bucket <bucket>",`Series bucket. One of: ${Qn.join(", ")}`).action(async(t,n,i)=>{yt("window",i.window,Xn),yt("bucket",i.bucket,Qn);let r=new g(f()),o=y("Fetching metrics...");o.start();let a=await r.webhooks.metrics(t,n,{window:i.window,bucket:i.bucket});if(o.stop(),p()){D(a);return}w({window:a.window,bucket:a.bucket,totalEvents:a.totalEvents,successfulEvents:a.successfulEvents,failedEvents:a.failedEvents,pendingEvents:a.pendingEvents,successRate:a.successRate,averageResponseTime:a.averageResponseTime??"-"}),B(`
67
+ Conditions:`),v(m.conditions.map(h=>({id:h.id,type:h.type,entityId:h.entityId,label:h.label??"",met:h.met?"yes":"no"})))))}),e.command("create-steps <projectId> <agentId> <runId>").description("Create multiple steps within a run in a single batch request").requiredOption("--steps-file <path>",'JSON file with {"steps":[...]} or a bare array of step objects').action(async(r,o,a,u)=>{let l=new g(f()),c=JSON.parse(G.readFileSync(J.resolve(u.stepsFile),"utf-8")),d=Array.isArray(c)?c:c?.steps;Array.isArray(d)||(_({code:"INVALID_STEPS_FILE",message:'Steps file must be a JSON array or an object with a "steps" array.'}),process.exit(1));let m=y(`Creating ${d.length} steps...`);m.start();let h=await l.agents.createSteps(r,o,a,d);m.succeed(`Steps created: ${h.steps.length}`),p()?D(h):v(h.steps.map(F=>({id:F.id,type:F.type,title:Fe(F.title,40),status:F.status,order:F.order,conditions:F.conditions?.length??0})))}),e.command("update-run <projectId> <agentId> <runId>").description("Update a run's status, metadata, or error message").option("--status <status>","Run status (PENDING, RUNNING, PAUSED, WAITING_HUMAN, COMPLETED, FAILED)").option("--metadata <json>","JSON object to merge into run metadata").option("--error-message <message>","Error message").action(async(r,o,a,u)=>{let l=new g(f()),c=y("Updating run...");c.start();let d={};u.status&&(d.status=u.status),u.errorMessage&&(d.errorMessage=u.errorMessage),u.metadata&&(d.metadata=JSON.parse(u.metadata));let m=await l.agents.updateRun(r,o,a,d);c.succeed(`Run updated: ${m.status}`),p()&&D(m)}),e.command("update-step <projectId> <agentId> <runId> <stepId>").description("Update a step's status or data").option("--status <status>","Step status (PENDING, IN_PROGRESS, WAITING_HUMAN, COMPLETED, FAILED, SKIPPED)").option("--data <json>","JSON data string").action(async(r,o,a,u,l)=>{let c=new g(f()),d=y("Updating step...");d.start();let m=await c.agents.updateStep(r,o,a,u,{status:l.status,data:l.data?JSON.parse(l.data):void 0});d.succeed(`Step updated: ${m.status}`),p()&&D(m)}),e.command("update-step-conditions <projectId> <agentId> <runId> <stepId>").description("Replace a step's conditions (e.g. patch placeholder entityIds)").requiredOption("--conditions <json>",'JSON array: [{"type":"DOCUMENT_REVIEWED","entityId":"<fileId>","label":"..."}]').action(async(r,o,a,u,l)=>{let c=new g(f()),d=y("Updating step conditions...");d.start();let m=JSON.parse(l.conditions),h=await c.agents.updateStepConditions(r,o,a,u,m);d.succeed(`Step conditions replaced (${m.length})`),p()&&D(h)}),e.command("pause-run <projectId> <agentId> <runId>").description("Pause a running agent run").action(async(r,o,a)=>{let u=new g(f()),l=y("Pausing run...");l.start();let c=await u.agents.pauseRun(r,o,a);l.succeed(`Run paused: ${c.runId}`),p()&&D(c)}),Rs()&&Cc(e)}function Cc(s){s.command("send-email <projectId> <agentId>").description("Draft or send an email from an agent execution").requiredOption("--execution-id <executionId>","Agent execution ID").requiredOption("--to <to>","Recipient email address").requiredOption("--subject <subject>","Email subject").option("--body <body>","Email body text").option("--body-file <path>","Read email body from file (overrides --body)").option("--html-body <htmlBody>","HTML version of the email body").option("--in-reply-to <messageId>","Message-ID of the email being replied to").action(async(e,t,n)=>{!n.body&&!n.bodyFile&&(console.error("Either --body or --body-file is required"),process.exit(1));let i=new g(f()),r=n.body??"";if(n.bodyFile){let u=J.resolve(n.bodyFile);r=G.readFileSync(u,"utf-8")}let o=y("Sending email...");o.start();let a=await i.agents.sendEmail(e,t,{executionId:n.executionId,to:n.to,subject:n.subject,body:r,htmlBody:n.htmlBody,inReplyTo:n.inReplyTo});a.status==="SENT"?o.succeed(`Email sent. Draft ID: ${a.draftId}`):o.succeed(`Email draft created (${a.status}). Draft ID: ${a.draftId}`),p()&&D(a)}),s.command("complete <projectId> <agentId> <executionId>").description("Mark an agent execution as completed or failed").option("--status <status>","Execution status (COMPLETED or FAILED)","COMPLETED").option("--error <message>","Error message (when status is FAILED)").option("--output-file <name>","Name of generated output file").option("--output-url <url>","URL to output file").action(async(e,t,n,i)=>{let r=i.status.toUpperCase();r!=="COMPLETED"&&r!=="FAILED"&&(console.error("Status must be COMPLETED or FAILED"),process.exit(1));let o=new g(f()),a=y(`Completing execution (${r.toLowerCase()})...`);a.start();let u=await o.agents.completeExecution(e,t,{executionId:n,status:r,errorMessage:i.error,outputFileName:i.outputFile,outputUrl:i.outputUrl});a.succeed(`Execution ${n} marked as ${r.toLowerCase()}${u.sandboxArchived?" \u2014 sandbox archived":""}`),p()&&D(u)}),s.command("sharepoint-token <projectId> <agentId>").description("Deprecated: SharePoint uploads now go through integrations sharepoint upload").requiredOption("--execution-id <executionId>","Agent execution ID").action(async(e,t,n)=>{_({code:"SHAREPOINT_TOKEN_DEPRECATED",message:"SharePoint token access is deprecated. Use `limai integrations sharepoint upload` instead."}),process.exit(1)}),s.command("upload-artifact <projectId> <agentId> <executionId> <filePath>").description("Upload a file as an artifact for an agent execution").action(async(e,t,n,i)=>{let r=new g(f()),{filename:o,buffer:a}=fa(i),u=y(`Uploading ${o}...`);u.start();let{uploadUrl:l,s3Key:c}=await r.agents.getArtifactUploadUrl(e,t,{executionId:n,fileName:o});await r.http.putRaw(l,a,"application/octet-stream"),u.succeed(`Uploaded ${o} (${is(a.length)})`),p()&&D({success:!0,s3Key:c,fileName:o})})}function fa(s){let e=J.resolve(s);return G.existsSync(e)||(console.error(`File not found: ${e}`),process.exit(1)),{filename:J.basename(e),buffer:G.readFileSync(e)}}async function ma(s,e,t,n){let{filename:i,buffer:r}=fa(n),o=Fn(i),a=y(`Uploading ${i}...`);a.start();let{url:u,fileId:l}=await s.agents.getFileUploadUrl(e,t,i);return await s.http.putRaw(u,r,o),await s.agents.updateFileMetadata(e,t,l,{sizeBytes:r.length,mimeType:o}),a.succeed(`Uploaded ${i} (${is(r.length)}) - File ID: ${l}`),{fileId:l,filename:i,bytes:r.length}}function yc(s,e){return[...e,s]}function Fe(s,e){return s.length<=e?s:s.slice(0,e-3)+"..."}function is(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var Ke=I(require("fs")),ss=I(require("path"));function Ec(s,e){return[...e,s]}function ga(s){s.command("vision").description("Vision queries against PDFs and images via Gemini").command("ask").description("Ask a vision question about one or more PDFs or images").requiredOption("-f, --files <path>","File path (repeatable) \u2014 PDFs or images",Ec,[]).requiredOption("-p, --prompt <text>","The question to ask").option("--project <id>","Project ID (defaults to LIMAI_PROJECT_ID env var)").option("--schema-file <path>","JSON Schema file \u2014 when provided, returns structured output").option("--fast","Use the faster Gemini 3.1 Flash Lite model instead of Gemini 3.1 Pro").action(async t=>{let n=t.project??process.env.LIMAI_PROJECT_ID;n||(_({code:"VALIDATION",message:"Missing project ID. Pass --project <id> or set LIMAI_PROJECT_ID."}),process.exit(1)),t.files.length===0&&(_({code:"VALIDATION",message:"Pass at least one --files <path>."}),process.exit(1));let i=t.files.map(l=>{let c=ss.resolve(l);return Ke.existsSync(c)||(_({code:"NOT_FOUND",message:`File not found: ${c}`}),process.exit(1)),{data:Ke.readFileSync(c).toString("base64"),mimeType:Fn(c)}}),r;if(t.schemaFile){let l=ss.resolve(t.schemaFile);Ke.existsSync(l)||(_({code:"NOT_FOUND",message:`Schema file not found: ${l}`}),process.exit(1));try{let c=JSON.parse(Ke.readFileSync(l,"utf-8"));if(!c||typeof c!="object"||Array.isArray(c))throw new Error("Schema file must contain a JSON object");r=c}catch(c){_({code:"VALIDATION",message:`Invalid schema file: ${c instanceof Error?c.message:c}`}),process.exit(1)}}let o=new g(f()),a=y(`Asking Gemini${t.fast?" Flash Lite":""} about ${i.length} file(s)...`);a.start();let u=await o.vision.ask(n,{prompt:t.prompt,files:i,...r&&{schema:r},...t.fast&&{fast:!0}});a.succeed("Vision response received"),p()?D(u):"text"in u?console.log(u.text):console.log(JSON.stringify(u.data,null,2))})}var le=I(require("fs")),Ce=I(require("path"));function Cn(s){return JSON.parse(le.readFileSync(Ce.resolve(s),"utf-8"))}var ha=["SURFACE","RESEND"];function rs(s){let e=s.toUpperCase();if(!ha.includes(e))throw new R(`Invalid --behavior "${s}". Expected one of: ${ha.join(", ")}`,{code:"INVALID_ARGUMENT",exitCode:2});return e}var Fa=1e3,Ca=6e5;function ya(s){let e=Number(s);if(!Number.isInteger(e)||e<Fa||e>Ca)throw new R(`Invalid --timeout-ms "${s}". Expected an integer between ${Fa} and ${Ca}`,{code:"INVALID_ARGUMENT",exitCode:2});return e}function bc(s){let e=Ce.resolve(s),t=Ce.join(e,"manifest.json"),n=Ce.join(e,"script.mjs");if(!le.existsSync(t))throw new R(`Missing manifest.json in ${e}`,{code:"INVALID_ARGUMENT",exitCode:2});if(!le.existsSync(n))throw new R(`Missing script.mjs in ${e}`,{code:"INVALID_ARGUMENT",exitCode:2});let i=JSON.parse(le.readFileSync(t,"utf-8"));if(!i.key||!i.name)throw new R(`${t} must define "key" and "name"`,{code:"INVALID_ARGUMENT",exitCode:2});return{manifest:i,source:le.readFileSync(n,"utf-8")}}function os(s){return{key:s.key,name:s.name,behavior:s.behavior,version:s.version,enabled:s.enabled,timeoutMs:s.timeoutMs,updatedAt:s.updatedAt}}function Ea(s){let e=s.command("validations").description("Validation result submission and custom validation scripts");e.command("submit <extractionSchemaId> <fileId>").description("Submit a validation result for a file").requiredOption("--findings-file <path>","Read findings JSON array from file").option("--changes-file <path>","Read cell changes JSON array from file").option("--breakdown-file <path>","Read breakdown JSON object from file").option("--new-rows-file <path>","Read new rows JSON array from file").option("--no-strict","Skip unresolved references instead of failing the whole request").action(async(n,i,r)=>{let o=new g(f()),a={findings:Cn(r.findingsFile),strict:r.strict};r.changesFile&&(a.cellChanges=Cn(r.changesFile)),r.breakdownFile&&(a.breakdown=Cn(r.breakdownFile)),r.newRowsFile&&(a.newRows=Cn(r.newRowsFile));let u=y("Submitting validation...");u.start();let l;try{l=await o.validations.submit(n,i,a)}catch(c){if(u.fail("Validation submission failed."),Ac(c)){let d=c.details.invalidValues;console.error(`Submission rejected: ${d.length} value(s) do not match their column type. No changes were applied.`);for(let m of d)console.error(` - ${_c(m)}`)}else if(wc(c)){let d=c.details.unresolvedReferences;console.error(`Strict mode rejected the submission: ${d.length} unresolved reference(s). No changes were applied.`);for(let m of d)console.error(` - ${Ic(m)}`)}throw c}u.succeed("Validation submitted."),p()?D(l):w(l)});let t=e.command("scripts").description("Manage custom validation scripts on an extraction schema (uploads the source and registers it in one call)");t.command("list <extractionSchemaId>").description("List the custom validation scripts registered on a schema").action(async n=>{let i=await Ft().validations.listScripts(n);if(p()){D(i);return}v(i.map(os))}),t.command("get <extractionSchemaId> <key>").description("Show one custom validation script").option("--source","Include the script source").option("--output <path>","Write the script source to a file").action(async(n,i,r)=>{let o=!!(r.source||r.output),a=await Ft().validations.getScript(n,i,{includeSource:o});if(r.output&&a.source!==void 0&&le.writeFileSync(Ce.resolve(r.output),a.source,"utf-8"),p()){D(a);return}let{source:u,...l}=a;w(l),r.output?E(`Source written to ${r.output}`):r.source&&u!==void 0&&(console.log(),console.log(u))}),t.command("push <extractionSchemaId>").description("Upload a validation script and register it. Creates it, or bumps its version when the source changed.").option("--dir <path>","Script directory containing manifest.json and script.mjs").option("--file <path>","Script source file (.mjs)").option("--key <key>","Script key (lowercase letters, digits, hyphens)").option("--name <name>","Human-readable script name").option("--description <text>","Script description").option("--behavior <behavior>","SURFACE or RESEND").option("--timeout-ms <ms>","Per-run timeout in milliseconds").option("--disabled","Register the script without enabling it").action(async(n,i)=>{if(!i.dir&&!i.file)throw new R("Provide either --dir or --file",{code:"INVALID_ARGUMENT",exitCode:2});if(i.dir&&i.file)throw new R("--dir and --file are mutually exclusive",{code:"INVALID_ARGUMENT",exitCode:2});let r;if(i.dir){let{manifest:u,source:l}=bc(i.dir);r={key:i.key??u.key,name:i.name??u.name,description:i.description??u.description??null,behavior:rs(i.behavior??u.behavior??"SURFACE"),source:l}}else{if(!i.key||!i.name)throw new R("--file requires --key and --name",{code:"INVALID_ARGUMENT",exitCode:2});r={key:i.key,name:i.name,description:i.description??null,behavior:rs(i.behavior??"SURFACE"),source:le.readFileSync(Ce.resolve(i.file),"utf-8")}}i.disabled&&(r.enabled=!1),i.timeoutMs!==void 0&&(r.timeoutMs=ya(i.timeoutMs));let o=y(`Pushing validation script "${r.key}"...`);o.start();let a;try{a=await Ft().validations.pushScript(n,r)}catch(u){throw o.fail("Validation script push failed."),u}o.succeed(`Validation script "${r.key}": ${a.action}`),p()?D(a):(w(os(a.script)),Qe(`S3 key: ${a.script.s3Key}`))}),t.command("update <extractionSchemaId> <key>").description("Update script metadata without uploading a new source version").option("--name <name>","New name").option("--description <text>","New description").option("--behavior <behavior>","SURFACE or RESEND").option("--timeout-ms <ms>","Per-run timeout in milliseconds").option("--enable","Enable the script").option("--disable","Disable the script").action(async(n,i,r)=>{if(r.enable&&r.disable)throw new R("--enable and --disable are mutually exclusive",{code:"INVALID_ARGUMENT",exitCode:2});let o={};if(r.name&&(o.name=r.name),r.description!==void 0&&(o.description=r.description),r.behavior&&(o.behavior=rs(r.behavior)),r.timeoutMs!==void 0&&(o.timeoutMs=ya(r.timeoutMs)),r.enable&&(o.enabled=!0),r.disable&&(o.enabled=!1),Object.keys(o).length===0)throw new R("Provide at least one field to update",{code:"INVALID_ARGUMENT",exitCode:2});let a=await Ft().validations.updateScript(n,i,o);p()?D(a):w(os(a))}),t.command("delete <extractionSchemaId> <key>").description("Delete a validation script and all of its stored results. Use `update --disable` to keep the history.").action(async(n,i)=>{let r=await Ft().validations.deleteScript(n,i);p()?D(r):E(`Deleted validation script "${i}" (${r.deletedResults} result(s) removed).`)})}function Ft(){return new g(f())}function wc(s){if(!(s instanceof R)||s.statusCode!==400)return!1;let e=s.details;return!!e&&typeof e=="object"&&Array.isArray(e.unresolvedReferences)}function Ic(s){return Object.entries(s).map(([t,n])=>`${t}=${String(n)}`).join(" ")}function Ac(s){if(!(s instanceof R)||s.statusCode!==400)return!1;let e=s.details;return!!e&&typeof e=="object"&&Array.isArray(e.invalidValues)}function _c(s){let e=String(s.columnName??s.columnId??"unknown column"),t=JSON.stringify(s.receivedValue),n=s.hint?` \u2014 ${String(s.hint)}`:"";return`${e} (${String(s.expectedType)}): received ${t}${n}`}var bn=I(require("fs")),ba=I(require("path"));function ce(s){let e=s.commands.find(t=>t.name()==="integrations");return e||s.command("integrations").description("Agent-facing integration tools")}function yn(){let s=process.env.LIMAI_API_BASE_URL||process.env.LIMAI_API_URL,e=process.env.LIMAI_API_SECRET;return s||(console.error("LIMAI_API_BASE_URL (or LIMAI_API_URL) environment variable is required."),process.exit(1)),e||(console.error("LIMAI_API_SECRET environment variable is required."),process.exit(1)),{apiBaseUrl:s,apiSecret:e}}function En(s,e){let t=process.env.LIMAI_API_SECRET;if(t){let i=process.env.LIMAI_API_BASE_URL||process.env.LIMAI_API_URL;return i||(console.error("LIMAI_API_BASE_URL (or LIMAI_API_URL) environment variable is required."),process.exit(1)),{url:`${i.replace(/\/$/,"")}/api/internal/integrations/${s}/upload`,headers:{"Content-Type":"application/json","x-api-secret":t}}}(!e.agent||!e.executionId)&&(console.error("--agent and --execution-id are required when uploading with LIMAI_API_TOKEN."),process.exit(1));let n=f();return{url:`${n.apiUrl.replace(/\/$/,"")}/api/v1/projects/${e.project}/agents/${e.agent}/runs/${e.executionId}/integrations/${s}/upload`,headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.token}`}}}function wa(s){ce(s).command("slack").description("Slack integration commands").command("send").description("Post a message to a Slack channel via the configured project connection").requiredOption("--project <projectId>","Project ID").requiredOption("--channel <channelId>","Slack channel ID").requiredOption("--text <text>","Message text (fallback for notifications)").option("--blocks <file>","Path to a JSON file containing a Slack blocks array").action(async n=>{let{apiBaseUrl:i,apiSecret:r}=yn(),o;if(n.blocks){let c=ba.resolve(n.blocks);bn.existsSync(c)||(console.error(`Blocks file not found: ${c}`),process.exit(1));let d=bn.readFileSync(c,"utf-8");try{let m=JSON.parse(d);Array.isArray(m)||(console.error("Blocks file must contain a JSON array"),process.exit(1)),o=m}catch(m){console.error(`Failed to parse blocks JSON: ${m instanceof Error?m.message:String(m)}`),process.exit(1)}}let a=p()?null:y("Sending Slack message...");a?.start();let u=await fetch(`${i.replace(/\/$/,"")}/api/internal/integrations/slack/send`,{method:"POST",headers:{"Content-Type":"application/json","x-api-secret":r},body:JSON.stringify({projectId:n.project,channelId:n.channel,text:n.text,...o?{blocks:o}:{}})});if(!u.ok){let c=await u.json().catch(()=>({})),d=(c&&typeof c=="object"&&"error"in c?String(c.error):null)||`HTTP ${u.status}`;a?.fail(`Failed to send Slack message: ${d}`),_({code:"SLACK_SEND_FAILED",message:d}),process.exit(1)}let l=await u.json();a?.succeed(`Message sent to ${l.channel}`),p()?D(l):console.log(JSON.stringify(l,null,2))})}var wn=I(require("fs")),Ia=I(require("path"));function Aa(s){ce(s).command("gdrive").description("Google Drive integration commands").command("upload").description("Upload a file from an S3 key to Google Drive via the project connection").requiredOption("--project <projectId>","Project ID").option("--agent <agentId>","Agent ID for resolving default destination config").option("--execution-id <executionId>","Agent execution ID for run authorization").requiredOption("--file <s3Key>","S3 key or local path; local paths are resolved to S3 keys if already uploaded").requiredOption("--name <fileName>","Destination file name in Google Drive").option("--folder <folderId>","Destination Google Drive folder ID; omit it when --step is passed").option("--step <stepId>","Step ID whose picked destination and approving user own this upload").option("--mime <mimeType>","MIME type (defaults to S3 ContentType or application/octet-stream)").action(async n=>{let i=n.file,r=Ia.resolve(n.file);wn.existsSync(r)&&wn.statSync(r).isFile()&&(console.error("Local file paths are not supported. Upload to S3 first, then pass the S3 key via --file."),process.exit(1));let o=p()?null:y(`Uploading ${n.name} to Google Drive...`);o?.start();let a=En("google-drive",n),u=await fetch(a.url,{method:"POST",headers:a.headers,body:JSON.stringify({projectId:n.project,agentId:n.agent,executionId:n.executionId,folderId:n.folder,stepId:n.step,fileName:n.name,s3Key:i,mimeType:n.mime})});if(!u.ok){let c=await u.json().catch(()=>({})),d=(c&&typeof c=="object"&&"error"in c?String(c.error):null)||`HTTP ${u.status}`;o?.fail(`Failed to upload to Google Drive: ${d}`),_({code:"GDRIVE_UPLOAD_FAILED",message:d}),process.exit(1)}let l=await u.json();o?.succeed(`Uploaded to Google Drive: ${l.fileId}`),p()?D(l):console.log(JSON.stringify(l,null,2))})}function _a(s){ce(s).command("sharepoint").description("SharePoint integration commands").command("upload").description("Upload a file from an S3 key to SharePoint via the agent's configured connection").requiredOption("--project <projectId>","Project ID").requiredOption("--agent <agentId>","Agent ID").requiredOption("--execution-id <executionId>","Agent execution ID").requiredOption("--file <s3Key>","S3 key for the uploaded artifact").requiredOption("--name <fileName>","Destination file name in SharePoint").option("--drive <driveId>","Destination SharePoint drive ID; omit it when --step is passed").option("--folder <folderId>","Destination SharePoint folder ID; omit it when --step is passed").option("--step <stepId>","Step ID whose picked destination and approving user own this upload").option("--mime <mimeType>","MIME type (defaults to S3 ContentType or application/octet-stream)").action(async n=>{let i=p()?null:y(`Uploading ${n.name} to SharePoint...`);i?.start();let r=En("sharepoint",n),o=await fetch(r.url,{method:"POST",headers:r.headers,body:JSON.stringify({projectId:n.project,agentId:n.agent,executionId:n.executionId,driveId:n.drive,folderId:n.folder,stepId:n.step,fileName:n.name,s3Key:n.file,mimeType:n.mime})});if(!o.ok){let u=await o.json().catch(()=>({})),l=(u&&typeof u=="object"&&"error"in u?String(u.error):null)||`HTTP ${o.status}`;i?.fail(`Failed to upload to SharePoint: ${l}`),_({code:"SHAREPOINT_UPLOAD_FAILED",message:l}),process.exit(1)}let a=await o.json();i?.succeed(`Uploaded to SharePoint: ${a.itemId}`),p()?D(a):console.log(JSON.stringify(a,null,2))})}function vc(){let s=process.env.LIMAI_API_BASE_URL||process.env.LIMAI_API_URL;return s||f().apiUrl}function va(s){ce(s).command("teams").description("Microsoft Teams integration commands").command("send").description("Send a message to a Teams channel or chat via the project connection").requiredOption("--project <projectId>","Project ID").option("--team <teamId>","Target team ID (use with --channel)").option("--channel <channelId>","Target channel ID (use with --team)").option("--chat <chatId>","Target chat ID (alternative to --team/--channel)").requiredOption("--text <text>","Message text").action(async n=>{let i=!!n.team&&!!n.channel,r=!!n.chat;if(i===r)throw new W("Provide either --team and --channel, or --chat (but not both)");let o=vc(),a=process.env.LIMAI_API_SECRET;if(!a)throw new R("LIMAI_API_SECRET env var is required for internal integration calls",{code:"MISSING_API_SECRET",exitCode:1});let u=r?{chatId:n.chat}:{teamId:n.team,channelId:n.channel},l=`${o.replace(/\/$/,"")}/api/internal/integrations/teams/send`,c=y("Sending Teams message...");c.start();let d=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json","x-api-secret":a},body:JSON.stringify({projectId:n.project,target:u,text:n.text})});if(!d.ok){c.fail("Failed to send");let h=await d.json().catch(()=>({})),F=typeof h?.error=="string"?h.error:`HTTP ${d.status}`;throw new R(F,{code:"TEAMS_SEND_FAILED",exitCode:1})}let m=await d.json();c.succeed("Message sent"),p()?D(m):(E(`Message ID: ${m.messageId}`),m.webUrl&&E(`URL: ${m.webUrl}`))})}function Sa(s){ce(s).command("status").description("List integration connection status for a project").requiredOption("--project <projectId>","Project ID").action(async t=>{let{apiBaseUrl:n,apiSecret:i}=yn(),r=p()?null:y("Loading integration status...");r?.start();let o=await fetch(`${n.replace(/\/$/,"")}/api/internal/integrations/status?projectId=${encodeURIComponent(t.project)}`,{headers:{"x-api-secret":i}});if(!o.ok){let u=await o.json().catch(()=>({})),l=(u&&typeof u=="object"&&"error"in u?String(u.error):null)||`HTTP ${o.status}`;r?.fail(`Failed to load status: ${l}`),_({code:"INTEGRATIONS_STATUS_FAILED",message:l}),process.exit(1)}let a=await o.json();r?.succeed("Integration status loaded"),p()?D(a):console.log(JSON.stringify(a,null,2))})}function xa(s){let e=s.command("labels").description("Manage key:value labels on files and emails");e.command("list <projectId>").description("List all distinct labels in a project").option("--entity-type <type>","Filter by entity type (file|email)").action(async(t,n)=>{let i=new g(f()),r=y("Fetching labels..."),o=await i.labels.list(t,n);r.stop(),p()?D(o):o.labels.length===0?E("No labels found"):v(o.labels.map(a=>{let u=a.split(":");return{label:a,key:u[0],value:u.length>1?u.slice(1).join(":"):""}}))}),e.command("get <projectId> <entityType> <entityId>").description("Get labels on a specific entity").action(async(t,n,i)=>{let r=new g(f()),o=y("Fetching labels..."),a=await r.labels.addRemove(t,n,i);o.stop(),p()?D(a):a.labels.length===0?E("No labels on this entity"):w(Object.fromEntries(a.labels.map((u,l)=>[`label ${l+1}`,u])))}),e.command("add <projectId> <entityType> <entityId> <labels...>").description("Add labels to an entity").action(async(t,n,i,r)=>{let o=new g(f()),a=y("Adding labels..."),u=await o.labels.addRemove(t,n,i,r);a.stop(),p()?D(u):E(`Added ${r.length} label(s). Current labels: ${u.labels.join(", ")}`)}),e.command("remove <projectId> <entityType> <entityId> <labels...>").description("Remove labels from an entity").action(async(t,n,i,r)=>{let o=new g(f()),a=y("Removing labels..."),u=await o.labels.addRemove(t,n,i,void 0,r);a.stop(),p()?D(u):E(`Removed ${r.length} label(s). Current labels: ${u.labels.join(", ")||"(none)"}`)}),e.command("search <projectId>").description("Search entities by labels").option("--entity-type <type>","Filter by entity type (file|email)").option("--labels <labels>","Comma-separated key:value pairs to match (AND logic)").option("--key <key>","Match all labels with this key prefix").action(async(t,n)=>{let i=new g(f()),r=y("Searching..."),o=await i.labels.search(t,n);r.stop(),p()?D(o):o.results.length===0?E("No matching entities found"):v(o.results.map(a=>({type:a.entityType,id:a.entityId,name:a.name||a.subject||"",labels:a.labels.join(", "),date:a.createdAt||a.receivedAt||""})))})}function ue(s,e){return[...e??[],s]}function de(s,e){_({code:s,message:e}),process.exit(1)}function Sc(s,e){return e.includes(s)}function yt(s,e,t){e!==void 0&&(Sc(e,t)||de("VALIDATION_ERROR",`Invalid ${s} "${e}". Expected one of: ${t.join(", ")}`))}function xc(s,e,t){for(let n of e??[])yt(s,n,t)}function Ct(s,e){e&&(e.length>100&&de("VALIDATION_ERROR",`Too many ${s} (${e.length}). The API accepts at most ${100}.`),new Set(e).size!==e.length&&de("VALIDATION_ERROR",`Duplicate ${s} are not allowed`))}function Ra(s){xc("event type",s.event,nt),Ct("event types",s.event),Ct("deployment IDs",s.deploymentId),Ct("agent IDs",s.agentId),Ct("classifier IDs",s.classifierId),Ct("splitter IDs",s.splitterId)}function Oa(s){return{...s.url!==void 0?{url:s.url}:{},...s.event!==void 0?{events:s.event}:{},...s.deploymentId!==void 0?{deploymentIds:s.deploymentId}:{},...s.agentId!==void 0?{agentIds:s.agentId}:{},...s.classifierId!==void 0?{classifierIds:s.classifierId}:{},...s.splitterId!==void 0?{splitterIds:s.splitterId}:{}}}function ls(s){return s.length===0?"-":s.map(e=>`${e.name} (${e.id})`).join(", ")}function Tc(s){return{id:s.id,url:s.url||"(unset)",active:s.isActive,verified:s.isVerified,events:s.events.length,routes:s.deployments.length+s.agents.length+s.classifiers.length+s.splitters.length,created:s.createdAt}}function Ye(s){w({id:s.id,projectId:s.projectId,url:s.url||"(unset)",active:s.isActive,verified:s.isVerified,events:s.events.length>0?s.events.join(", "):"-",deployments:s.deployments.length?s.deployments.map(e=>`${e.name} [${e.type}] (${e.id})`).join(", "):"-",agents:ls(s.agents),classifiers:ls(s.classifiers),splitters:ls(s.splitters),createdAt:s.createdAt,updatedAt:s.updatedAt})}function ka(s){Y(`secretKey ${s.secretKey}`),Qe("This signing secret is shown only once. Store it now \u2014 it cannot be retrieved later.")}function Ba(s,e){let t=Number(e);return Number.isInteger(t)||de("VALIDATION_ERROR",`${s} must be an integer`),t}function $a(s){let e=s.command("webhooks").description("Manage project webhook subscriptions and deliveries");e.command("list <projectId>").description("List webhook subscriptions in a project").action(async t=>{let n=new g(f()),i=y("Fetching webhooks...");i.start();let r=await n.webhooks.list(t);if(i.stop(),p()){D(r);return}v(r.webhooks.map(Tc))}),e.command("get <projectId> <webhookId>").description("Show a webhook subscription").action(async(t,n)=>{let i=new g(f()),r=y("Fetching webhook...");r.start();let o=await i.webhooks.get(t,n);if(r.stop(),p()){D(o);return}Ye(o)}),e.command("create <projectId>").description("Create a webhook subscription").option("--url <url>","Destination URL").option("--event <type>",`Event type to subscribe to (repeatable). One of: ${nt.join(", ")}`,ue).option("--deployment-id <id>","Route deployment ID (repeatable)",ue).option("--agent-id <id>","Route agent ID (repeatable)",ue).option("--classifier-id <id>","Route classifier ID (repeatable)",ue).option("--splitter-id <id>","Route splitter ID (repeatable)",ue).action(async(t,n)=>{Ra(n);let i=new g(f()),r=y("Creating webhook...");r.start();let o=await i.webhooks.create(t,Oa(n));if(r.succeed(`Webhook created: ${o.id}`),p()){D(o);return}Ye(o),ka(o)}),e.command("update <projectId> <webhookId>").description("Update a webhook subscription").option("--url <url>","Destination URL").option("--event <type>",`Replace the subscribed event types (repeatable). One of: ${nt.join(", ")}`,ue).option("--deployment-id <id>","Replace deployment routes (repeatable)",ue).option("--agent-id <id>","Replace agent routes (repeatable)",ue).option("--classifier-id <id>","Replace classifier routes (repeatable)",ue).option("--splitter-id <id>","Replace splitter routes (repeatable)",ue).option("--active","Activate the subscription").option("--inactive","Deactivate the subscription").action(async(t,n,i)=>{i.active&&i.inactive&&de("VALIDATION_ERROR","Pass either --active or --inactive, not both"),Ra(i);let r={...Oa(i),...i.active?{isActive:!0}:{},...i.inactive?{isActive:!1}:{}};Object.keys(r).length===0&&de("VALIDATION_ERROR","Provide at least one field to update (--url, --event, --deployment-id, --agent-id, --classifier-id, --splitter-id, --active, --inactive)");let o=new g(f()),a=y("Updating webhook...");a.start();let u=await o.webhooks.update(t,n,r);if(a.succeed("Webhook updated."),p()){D(u);return}Ye(u)}),e.command("delete <projectId> <webhookId>").description("Delete a webhook subscription").action(async(t,n)=>{let i=new g(f()),r=y("Deleting webhook...");if(r.start(),await i.webhooks.delete(t,n),r.stop(),p()){D({deleted:!0,webhookId:n});return}E(`Webhook deleted: ${n}`)}),e.command("pause <projectId> <webhookId>").description("Pause deliveries for a webhook subscription").action(async(t,n)=>{let i=new g(f()),r=y("Pausing webhook...");r.start();let o=await i.webhooks.pause(t,n);if(r.succeed("Webhook paused."),p()){D(o);return}Ye(o)}),e.command("resume <projectId> <webhookId>").description("Resume deliveries for a webhook subscription").action(async(t,n)=>{let i=new g(f()),r=y("Resuming webhook...");r.start();let o=await i.webhooks.resume(t,n);if(r.succeed("Webhook resumed."),p()){D(o);return}Ye(o)}),e.command("verify <projectId> <webhookId>").description("Send a verification ping to the webhook URL").action(async(t,n)=>{let i=new g(f()),r=y("Verifying endpoint...");r.start();let o=await i.webhooks.verify(t,n);r.succeed(o.message),p()&&D(o)}),e.command("rotate-secret <projectId> <webhookId>").description("Generate a new signing secret for a webhook subscription").action(async(t,n)=>{let i=new g(f()),r=y("Rotating secret...");r.start();let o=await i.webhooks.rotateSecret(t,n);if(r.succeed("Signing secret rotated."),p()){D(o);return}Ye(o),ka(o)}),e.command("deliveries <projectId> <webhookId>").description("List delivery attempts for a webhook subscription").option("--status <status>",`Filter by delivery status. One of: ${zn.join(", ")}`).option("--event-type <type>","Filter by event type").option("--deployment-id <id>","Filter by deployment route").option("--agent-id <id>","Filter by agent route").option("--classifier-id <id>","Filter by classifier route").option("--splitter-id <id>","Filter by splitter route").option("--limit <n>",`Page size (1-${200}, default 50)`).option("--offset <n>","Page offset (default 0)").action(async(t,n,i)=>{yt("status",i.status,zn),yt("event type",i.eventType,nt),[i.deploymentId,i.agentId,i.classifierId,i.splitterId].filter(d=>d!==void 0).length>1&&de("VALIDATION_ERROR","Pass at most one of --deployment-id, --agent-id, --classifier-id, --splitter-id");let o;i.limit!==void 0&&(o=Ba("--limit",i.limit),(o<1||o>200)&&de("VALIDATION_ERROR",`--limit must be between 1 and ${200}`));let a;i.offset!==void 0&&(a=Ba("--offset",i.offset),a<0&&de("VALIDATION_ERROR","--offset must be >= 0"));let u=new g(f()),l=y("Fetching deliveries...");l.start();let c=await u.webhooks.deliveries(t,n,{status:i.status,eventType:i.eventType,deploymentId:i.deploymentId,agentId:i.agentId,classifierId:i.classifierId,splitterId:i.splitterId,limit:o,offset:a});if(l.stop(),p()){D(c);return}v(c.deliveries.map(d=>({eventId:d.eventId,eventType:d.eventType,status:d.status,code:d.responseCode??"-",retries:d.retryCount,ms:d.durationMs??"-",error:d.errorType??"-",route:d.deploymentName??d.agentName??d.classifierName??d.splitterName??"-",timestamp:d.timestamp}))),Qe(`Showing ${c.deliveries.length} of ${c.total} (limit ${c.limit}, offset ${c.offset})`)}),e.command("metrics <projectId> <webhookId>").description("Show delivery metrics for a webhook subscription").option("--window <window>",`Time window. One of: ${Xn.join(", ")} (default 30d)`).option("--bucket <bucket>",`Series bucket. One of: ${Qn.join(", ")}`).action(async(t,n,i)=>{yt("window",i.window,Xn),yt("bucket",i.bucket,Qn);let r=new g(f()),o=y("Fetching metrics...");o.start();let a=await r.webhooks.metrics(t,n,{window:i.window,bucket:i.bucket});if(o.stop(),p()){D(a);return}w({window:a.window,bucket:a.bucket,totalEvents:a.totalEvents,successfulEvents:a.successfulEvents,failedEvents:a.failedEvents,pendingEvents:a.pendingEvents,successRate:a.successRate,averageResponseTime:a.averageResponseTime??"-"}),B(`
68
68
  Per route`),v(a.perRoute.map(u=>({family:u.routeFamily,id:u.routeId,name:u.routeName,total:u.totalEvents,success:u.successfulEvents,failed:u.failedEvents,pending:u.pendingEvents,successRate:u.successRate}))),B(`
69
69
  Series`),v(a.series.map(u=>({bucket:u.bucket,successful:u.successful,failed:u.failed,pending:u.pending})))}),e.command("retry <projectId> <webhookId>").description("Re-enqueue failed deliveries for a webhook subscription").requiredOption("--event-id <id>",`Delivery event ID to retry (repeatable, max ${100})`,ue).action(async(t,n,i)=>{i.eventId.length>100&&de("VALIDATION_ERROR",`Too many event IDs (${i.eventId.length}). The API accepts at most ${100} per call.`);let r=new g(f()),o=y("Retrying deliveries...");o.start();let a=await r.webhooks.retry(t,n,i.eventId);if(o.succeed(a.message),p()){D(a);return}a.retried.length>0&&(B(`
70
70
  Retried`),v(a.retried.map(u=>({eventId:u.eventId,url:u.url})))),a.skipped.length>0&&(B(`
71
- Skipped`),v(a.skipped.map(u=>({eventId:u.eventId,url:u.url,reason:u.reason}))))})}var Pa=require("child_process"),Na=I(require("os")),ja=I(require("path"));var Et="@limai.io/cli",Rc=`https://registry.npmjs.org/${Et.replaceAll("/","%2f")}/latest`,In="0.4.4";function Oc(){let s=ja.join(Na.homedir(),".limai","bin");return process.execPath.startsWith(s)}async function kc(){let s=await fetch(Rc);if(!s.ok)throw new Error(`npm registry responded with ${s.status}`);let e=await s.json();if(!e.version)throw new Error("npm registry response did not include a version");return e.version}function La(s){s.command("update").description("Update the LimAI CLI to the latest version").action(async()=>{if(Oc()&&(_({code:"UPDATE",message:"This copy of the CLI is the discontinued standalone binary and can no longer be updated."}),B("Remove it and reinstall with npm:"),B(" rm -rf ~/.limai/bin"),B(` npm install -g ${Et}`),process.exit(1)),In.endsWith("-dev")){B("Running from source \u2014 update with `git pull` in the monorepo instead.");return}let e;try{e=await kc()}catch(n){_({code:"UPDATE",message:n instanceof Error?`Could not check for updates: ${n.message}`:"Could not check for updates"}),process.exit(1)}if(e===In){E(`Already up to date (v${In}).`);return}B(`Updating ${Et} v${In} \u2192 v${e}...`);let t=(0,Pa.spawnSync)("npm",["install","-g",`${Et}@latest`],{stdio:"inherit",shell:process.platform==="win32"});(t.error||t.status!==0)&&(_({code:"UPDATE",message:t.error instanceof Error?t.error.message:`npm install exited with status ${t.status}`}),B(`Run it manually: npm install -g ${Et}@latest`),process.exit(1)),E(`Updated to v${e}.`)})}var N=new bs,Bc="0.4.4";N.name("limai").description("CLI for the LimAI data extraction platform").version(Bc).option("--json","Output raw JSON (pipe-friendly)").option("--verbose","Enable debug logging").option("--token <token>","Override stored API token").option("--api-url <url>","Override stored API URL").hook("preAction",s=>{let e=s.optsWithGlobals();e.json&&Is(!0),e.verbose&&As(!0),e.token&&(process.env.LIMAI_API_TOKEN=e.token),e.apiUrl&&(process.env.LIMAI_API_URL=e.apiUrl)});er(N);ra(N);or(N);ar(N);kr(N);Br(N);Vr(N);Gr(N);Yr(N);eo(N);Uo(N);Vo(N);Xo(N);Zo(N);ta(N);ua(N);ca(N);Da(N);ga(N);Ea(N);wa(N);Aa(N);_a(N);va(N);Sa(N);xa(N);$a(N);La(N);process.on("unhandledRejection",s=>{_s(s)});N.parse();
71
+ Skipped`),v(a.skipped.map(u=>({eventId:u.eventId,url:u.url,reason:u.reason}))))})}var Pa=require("child_process"),Na=I(require("os")),ja=I(require("path"));var Et="@limai.io/cli",Rc=`https://registry.npmjs.org/${Et.replaceAll("/","%2f")}/latest`,In="0.4.5";function Oc(){let s=ja.join(Na.homedir(),".limai","bin");return process.execPath.startsWith(s)}async function kc(){let s=await fetch(Rc);if(!s.ok)throw new Error(`npm registry responded with ${s.status}`);let e=await s.json();if(!e.version)throw new Error("npm registry response did not include a version");return e.version}function La(s){s.command("update").description("Update the LimAI CLI to the latest version").action(async()=>{if(Oc()&&(_({code:"UPDATE",message:"This copy of the CLI is the discontinued standalone binary and can no longer be updated."}),B("Remove it and reinstall with npm:"),B(" rm -rf ~/.limai/bin"),B(` npm install -g ${Et}`),process.exit(1)),In.endsWith("-dev")){B("Running from source \u2014 update with `git pull` in the monorepo instead.");return}let e;try{e=await kc()}catch(n){_({code:"UPDATE",message:n instanceof Error?`Could not check for updates: ${n.message}`:"Could not check for updates"}),process.exit(1)}if(e===In){E(`Already up to date (v${In}).`);return}B(`Updating ${Et} v${In} \u2192 v${e}...`);let t=(0,Pa.spawnSync)("npm",["install","-g",`${Et}@latest`],{stdio:"inherit",shell:process.platform==="win32"});(t.error||t.status!==0)&&(_({code:"UPDATE",message:t.error instanceof Error?t.error.message:`npm install exited with status ${t.status}`}),B(`Run it manually: npm install -g ${Et}@latest`),process.exit(1)),E(`Updated to v${e}.`)})}var N=new Is,Bc="0.4.5";N.name("limai").description("CLI for the LimAI data extraction platform").version(Bc).option("--json","Output raw JSON (pipe-friendly)").option("--verbose","Enable debug logging").option("--token <token>","Override stored API token").option("--api-url <url>","Override stored API URL").hook("preAction",s=>{let e=s.optsWithGlobals();e.json&&_s(!0),e.verbose&&vs(!0),e.token&&(process.env.LIMAI_API_TOKEN=e.token),e.apiUrl&&(process.env.LIMAI_API_URL=e.apiUrl)});nr(N);ra(N);ur(N);lr(N);$r(N);Pr(N);Jr(N);Gr(N);Yr(N);eo(N);Uo(N);Vo(N);Xo(N);Zo(N);ta(N);ua(N);ca(N);Da(N);ga(N);Ea(N);wa(N);Aa(N);_a(N);va(N);Sa(N);xa(N);$a(N);La(N);process.on("unhandledRejection",s=>{Ss(s)});N.parse();