@limai.io/cli 0.1.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,31 +1,31 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var ko=Object.create;var $i=Object.defineProperty;var Po=Object.getOwnPropertyDescriptor;var jo=Object.getOwnPropertyNames;var No=Object.getPrototypeOf,Lo=Object.prototype.hasOwnProperty;var $=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports);var Mo=(s,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jo(t))!Lo.call(s,i)&&i!==e&&$i(s,i,{get:()=>t[i],enumerable:!(n=Po(t,i))||n.enumerable});return s};var A=(s,t,e)=>(e=s!=null?ko(No(s)):{},Mo(t||!s||!s.__esModule?$i(e,"default",{value:s,enumerable:!0}):e,s));var Jt=$(an=>{"use strict";var le=class extends Error{constructor(t,e,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=e,this.exitCode=t,this.nestedError=void 0}},on=class extends le{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};an.CommanderError=le;an.InvalidArgumentError=on});var ce=$(ln=>{"use strict";var{InvalidArgumentError:Uo}=Jt(),un=class{constructor(t,e){switch(this.description=e||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new Uo(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function qo(s){let t=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+t+">":"["+t+"]"}ln.Argument=un;ln.humanReadableArgName=qo});var dn=$(Dn=>{"use strict";var{humanReadableArgName:Jo}=ce(),cn=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let e=t.commands.filter(i=>!i._hidden),n=t._getHelpCommand();return n&&!n._hidden&&e.push(n),this.sortSubcommands&&e.sort((i,r)=>i.name().localeCompare(r.name())),e}compareOptions(t,e){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(t).localeCompare(n(e))}visibleOptions(t){let e=t.options.filter(i=>!i.hidden),n=t._getHelpOption();if(n&&!n.hidden){let i=n.short&&t._findOption(n.short),r=n.long&&t._findOption(n.long);!i&&!r?e.push(n):n.long&&!r?e.push(t.createOption(n.long,n.description)):n.short&&!i&&e.push(t.createOption(n.short,n.description))}return this.sortOptions&&e.sort(this.compareOptions),e}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let e=[];for(let n=t.parent;n;n=n.parent){let i=n.options.filter(r=>!r.hidden);e.push(...i)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(e=>{e.description=e.description||t._argsDescription[e.name()]||""}),t.registeredArguments.find(e=>e.description)?t.registeredArguments:[]}subcommandTerm(t){let e=t.registeredArguments.map(n=>Jo(n)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(e?" "+e:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,e){return e.visibleCommands(t).reduce((n,i)=>Math.max(n,this.displayWidth(e.styleSubcommandTerm(e.subcommandTerm(i)))),0)}longestOptionTermLength(t,e){return e.visibleOptions(t).reduce((n,i)=>Math.max(n,this.displayWidth(e.styleOptionTerm(e.optionTerm(i)))),0)}longestGlobalOptionTermLength(t,e){return e.visibleGlobalOptions(t).reduce((n,i)=>Math.max(n,this.displayWidth(e.styleOptionTerm(e.optionTerm(i)))),0)}longestArgumentTermLength(t,e){return e.visibleArguments(t).reduce((n,i)=>Math.max(n,this.displayWidth(e.styleArgumentTerm(e.argumentTerm(i)))),0)}commandUsage(t){let e=t._name;t._aliases[0]&&(e=e+"|"+t._aliases[0]);let n="";for(let i=t.parent;i;i=i.parent)n=i.name()+" "+n;return n+e+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let e=[];return t.argChoices&&e.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&e.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&e.push(`env: ${t.envVar}`),e.length>0?`${t.description} (${e.join(", ")})`:t.description}argumentDescription(t){let e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),e.length>0){let n=`(${e.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatHelp(t,e){let n=e.padWidth(t,e),i=e.helpWidth??80;function r(D,p){return e.formatItem(D,n,p,e)}let o=[`${e.styleTitle("Usage:")} ${e.styleUsage(e.commandUsage(t))}`,""],a=e.commandDescription(t);a.length>0&&(o=o.concat([e.boxWrap(e.styleCommandDescription(a),i),""]));let u=e.visibleArguments(t).map(D=>r(e.styleArgumentTerm(e.argumentTerm(D)),e.styleArgumentDescription(e.argumentDescription(D))));u.length>0&&(o=o.concat([e.styleTitle("Arguments:"),...u,""]));let l=e.visibleOptions(t).map(D=>r(e.styleOptionTerm(e.optionTerm(D)),e.styleOptionDescription(e.optionDescription(D))));if(l.length>0&&(o=o.concat([e.styleTitle("Options:"),...l,""])),e.showGlobalOptions){let D=e.visibleGlobalOptions(t).map(p=>r(e.styleOptionTerm(e.optionTerm(p)),e.styleOptionDescription(e.optionDescription(p))));D.length>0&&(o=o.concat([e.styleTitle("Global Options:"),...D,""]))}let c=e.visibleCommands(t).map(D=>r(e.styleSubcommandTerm(e.subcommandTerm(D)),e.styleSubcommandDescription(e.subcommandDescription(D))));return c.length>0&&(o=o.concat([e.styleTitle("Commands:"),...c,""])),o.join(`
3
- `)}displayWidth(t){return ki(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(e=>e==="[options]"?this.styleOptionText(e):e==="[command]"?this.styleSubcommandText(e):e[0]==="["||e[0]==="<"?this.styleArgumentText(e):this.styleCommandText(e)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(e=>e==="[options]"?this.styleOptionText(e):e[0]==="["||e[0]==="<"?this.styleArgumentText(e):this.styleSubcommandText(e)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,e){return Math.max(e.longestOptionTermLength(t,e),e.longestGlobalOptionTermLength(t,e),e.longestSubcommandTermLength(t,e),e.longestArgumentTermLength(t,e))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,e,n,i){let o=" ".repeat(2);if(!n)return o+t;let a=t.padEnd(e+t.length-i.displayWidth(t)),u=2,c=(this.helpWidth??80)-e-u-2,D;return c<this.minWidthToWrap||i.preformatted(n)?D=n:D=i.boxWrap(n,c).replace(/\n/g,`
2
+ "use strict";var Go=Object.create;var Ni=Object.defineProperty;var Yo=Object.getOwnPropertyDescriptor;var Ko=Object.getOwnPropertyNames;var zo=Object.getPrototypeOf,Xo=Object.prototype.hasOwnProperty;var $=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports);var Zo=(s,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ko(t))!Xo.call(s,i)&&i!==e&&Ni(s,i,{get:()=>t[i],enumerable:!(n=Yo(t,i))||n.enumerable});return s};var A=(s,t,e)=>(e=s!=null?Go(zo(s)):{},Zo(t||!s||!s.__esModule?Ni(e,"default",{value:s,enumerable:!0}):e,s));var Jt=$(Dn=>{"use strict";var ce=class extends Error{constructor(t,e,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=e,this.exitCode=t,this.nestedError=void 0}},cn=class extends ce{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Dn.CommanderError=ce;Dn.InvalidArgumentError=cn});var De=$(pn=>{"use strict";var{InvalidArgumentError:Qo}=Jt(),dn=class{constructor(t,e){switch(this.description=e||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new Qo(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ta(s){let t=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+t+">":"["+t+"]"}pn.Argument=dn;pn.humanReadableArgName=ta});var hn=$(fn=>{"use strict";var{humanReadableArgName:ea}=De(),mn=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let e=t.commands.filter(i=>!i._hidden),n=t._getHelpCommand();return n&&!n._hidden&&e.push(n),this.sortSubcommands&&e.sort((i,r)=>i.name().localeCompare(r.name())),e}compareOptions(t,e){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(t).localeCompare(n(e))}visibleOptions(t){let e=t.options.filter(i=>!i.hidden),n=t._getHelpOption();if(n&&!n.hidden){let i=n.short&&t._findOption(n.short),r=n.long&&t._findOption(n.long);!i&&!r?e.push(n):n.long&&!r?e.push(t.createOption(n.long,n.description)):n.short&&!i&&e.push(t.createOption(n.short,n.description))}return this.sortOptions&&e.sort(this.compareOptions),e}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let e=[];for(let n=t.parent;n;n=n.parent){let i=n.options.filter(r=>!r.hidden);e.push(...i)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(e=>{e.description=e.description||t._argsDescription[e.name()]||""}),t.registeredArguments.find(e=>e.description)?t.registeredArguments:[]}subcommandTerm(t){let e=t.registeredArguments.map(n=>ea(n)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(e?" "+e:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,e){return e.visibleCommands(t).reduce((n,i)=>Math.max(n,this.displayWidth(e.styleSubcommandTerm(e.subcommandTerm(i)))),0)}longestOptionTermLength(t,e){return e.visibleOptions(t).reduce((n,i)=>Math.max(n,this.displayWidth(e.styleOptionTerm(e.optionTerm(i)))),0)}longestGlobalOptionTermLength(t,e){return e.visibleGlobalOptions(t).reduce((n,i)=>Math.max(n,this.displayWidth(e.styleOptionTerm(e.optionTerm(i)))),0)}longestArgumentTermLength(t,e){return e.visibleArguments(t).reduce((n,i)=>Math.max(n,this.displayWidth(e.styleArgumentTerm(e.argumentTerm(i)))),0)}commandUsage(t){let e=t._name;t._aliases[0]&&(e=e+"|"+t._aliases[0]);let n="";for(let i=t.parent;i;i=i.parent)n=i.name()+" "+n;return n+e+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let e=[];return t.argChoices&&e.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&e.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&e.push(`env: ${t.envVar}`),e.length>0?`${t.description} (${e.join(", ")})`:t.description}argumentDescription(t){let e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),e.length>0){let n=`(${e.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatHelp(t,e){let n=e.padWidth(t,e),i=e.helpWidth??80;function r(D,m){return e.formatItem(D,n,m,e)}let o=[`${e.styleTitle("Usage:")} ${e.styleUsage(e.commandUsage(t))}`,""],a=e.commandDescription(t);a.length>0&&(o=o.concat([e.boxWrap(e.styleCommandDescription(a),i),""]));let u=e.visibleArguments(t).map(D=>r(e.styleArgumentTerm(e.argumentTerm(D)),e.styleArgumentDescription(e.argumentDescription(D))));u.length>0&&(o=o.concat([e.styleTitle("Arguments:"),...u,""]));let l=e.visibleOptions(t).map(D=>r(e.styleOptionTerm(e.optionTerm(D)),e.styleOptionDescription(e.optionDescription(D))));if(l.length>0&&(o=o.concat([e.styleTitle("Options:"),...l,""])),e.showGlobalOptions){let D=e.visibleGlobalOptions(t).map(m=>r(e.styleOptionTerm(e.optionTerm(m)),e.styleOptionDescription(e.optionDescription(m))));D.length>0&&(o=o.concat([e.styleTitle("Global Options:"),...D,""]))}let c=e.visibleCommands(t).map(D=>r(e.styleSubcommandTerm(e.subcommandTerm(D)),e.styleSubcommandDescription(e.subcommandDescription(D))));return c.length>0&&(o=o.concat([e.styleTitle("Commands:"),...c,""])),o.join(`
3
+ `)}displayWidth(t){return Li(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(e=>e==="[options]"?this.styleOptionText(e):e==="[command]"?this.styleSubcommandText(e):e[0]==="["||e[0]==="<"?this.styleArgumentText(e):this.styleCommandText(e)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(e=>e==="[options]"?this.styleOptionText(e):e[0]==="["||e[0]==="<"?this.styleArgumentText(e):this.styleSubcommandText(e)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,e){return Math.max(e.longestOptionTermLength(t,e),e.longestGlobalOptionTermLength(t,e),e.longestSubcommandTermLength(t,e),e.longestArgumentTermLength(t,e))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,e,n,i){let o=" ".repeat(2);if(!n)return o+t;let a=t.padEnd(e+t.length-i.displayWidth(t)),u=2,c=(this.helpWidth??80)-e-u-2,D;return c<this.minWidthToWrap||i.preformatted(n)?D=n:D=i.boxWrap(n,c).replace(/\n/g,`
4
4
  `+" ".repeat(e+u)),o+a+" ".repeat(u)+D.replace(/\n/g,`
5
- ${o}`)}boxWrap(t,e){if(e<this.minWidthToWrap)return t;let n=t.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<=e){u.push(c),l+=D;return}r.push(u.join(""));let p=c.trimStart();u=[p],l=this.displayWidth(p)}),r.push(u.join(""))}),r.join(`
6
- `)}};function ki(s){let t=/\x1b\[\d*(;\d*)*m/g;return s.replace(t,"")}Dn.Help=cn;Dn.stripColor=ki});var hn=$(fn=>{"use strict";var{InvalidArgumentError:Vo}=Jt(),pn=class{constructor(t,e){this.flags=t,this.description=e||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let n=Ho(t);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(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let e=t;return typeof t=="string"&&(e={[t]:!0}),this.implied=Object.assign(this.implied||{},e),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new Vo(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Pi(this.name().replace(/^no-/,"")):Pi(this.name())}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},mn=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(t,e){let n=e.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,r=i!==void 0?i:!1;return e.negate===(r===t)}};function Pi(s){return s.split("-").reduce((t,e)=>t+e[0].toUpperCase()+e.slice(1))}function Ho(s){let t,e,n=/^-[^-]$/,i=/^--[^-]/,r=s.split(/[ |,]+/).concat("guard");if(n.test(r[0])&&(t=r.shift()),i.test(r[0])&&(e=r.shift()),!t&&n.test(r[0])&&(t=r.shift()),!t&&i.test(r[0])&&(t=e,e=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}
5
+ ${o}`)}boxWrap(t,e){if(e<this.minWidthToWrap)return t;let n=t.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<=e){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 Li(s){let t=/\x1b\[\d*(;\d*)*m/g;return s.replace(t,"")}fn.Help=mn;fn.stripColor=Li});var En=$(Cn=>{"use strict";var{InvalidArgumentError:na}=Jt(),gn=class{constructor(t,e){this.flags=t,this.description=e||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let n=ia(t);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(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let e=t;return typeof t=="string"&&(e={[t]:!0}),this.implied=Object.assign(this.implied||{},e),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new na(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Mi(this.name().replace(/^no-/,"")):Mi(this.name())}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Fn=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(t,e){let n=e.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,r=i!==void 0?i:!1;return e.negate===(r===t)}};function Mi(s){return s.split("-").reduce((t,e)=>t+e[0].toUpperCase()+e.slice(1))}function ia(s){let t,e,n=/^-[^-]$/,i=/^--[^-]/,r=s.split(/[ |,]+/).concat("guard");if(n.test(r[0])&&(t=r.shift()),i.test(r[0])&&(e=r.shift()),!t&&n.test(r[0])&&(t=r.shift()),!t&&i.test(r[0])&&(t=e,e=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(t===void 0&&e===void 0)throw new Error(`option creation failed due to no flags found in '${s}'.`);return{shortFlag:t,longFlag:e}}fn.Option=pn;fn.DualOptions=mn});var Ni=$(ji=>{"use strict";function Wo(s,t){if(Math.abs(s.length-t.length)>3)return Math.max(s.length,t.length);let e=[];for(let n=0;n<=s.length;n++)e[n]=[n];for(let n=0;n<=t.length;n++)e[0][n]=n;for(let n=1;n<=t.length;n++)for(let i=1;i<=s.length;i++){let r=1;s[i-1]===t[n-1]?r=0:r=1,e[i][n]=Math.min(e[i-1][n]+1,e[i][n-1]+1,e[i-1][n-1]+r),i>1&&n>1&&s[i-1]===t[n-2]&&s[i-2]===t[n-1]&&(e[i][n]=Math.min(e[i][n],e[i-2][n-2]+1))}return e[s.length][t.length]}function Go(s,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let e=s.startsWith("--");e&&(s=s.slice(2),t=t.map(o=>o.slice(2)));let n=[],i=3,r=.4;return t.forEach(o=>{if(o.length<=1)return;let a=Wo(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)),e&&(n=n.map(o=>`--${o}`)),n.length>1?`
12
+ - unrecognised flag format`)}if(t===void 0&&e===void 0)throw new Error(`option creation failed due to no flags found in '${s}'.`);return{shortFlag:t,longFlag:e}}Cn.Option=gn;Cn.DualOptions=Fn});var qi=$(Ui=>{"use strict";function sa(s,t){if(Math.abs(s.length-t.length)>3)return Math.max(s.length,t.length);let e=[];for(let n=0;n<=s.length;n++)e[n]=[n];for(let n=0;n<=t.length;n++)e[0][n]=n;for(let n=1;n<=t.length;n++)for(let i=1;i<=s.length;i++){let r=1;s[i-1]===t[n-1]?r=0:r=1,e[i][n]=Math.min(e[i-1][n]+1,e[i][n-1]+1,e[i-1][n-1]+r),i>1&&n>1&&s[i-1]===t[n-2]&&s[i-2]===t[n-1]&&(e[i][n]=Math.min(e[i][n],e[i-2][n-2]+1))}return e[s.length][t.length]}function ra(s,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let e=s.startsWith("--");e&&(s=s.slice(2),t=t.map(o=>o.slice(2)));let n=[],i=3,r=.4;return t.forEach(o=>{if(o.length<=1)return;let a=sa(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)),e&&(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]}?)`:""}ji.suggestSimilar=Go});var qi=$(yn=>{"use strict";var Yo=require("events").EventEmitter,gn=require("child_process"),ut=require("path"),De=require("fs"),R=require("process"),{Argument:Ko,humanReadableArgName:zo}=ce(),{CommanderError:Fn}=Jt(),{Help:Xo,stripColor:Zo}=dn(),{Option:Li,DualOptions:Qo}=hn(),{suggestSimilar:Mi}=Ni(),Cn=class s extends Yo{constructor(t){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=t||"",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:e=>R.stdout.write(e),writeErr:e=>R.stderr.write(e),outputError:(e,n)=>n(e),getOutHelpWidth:()=>R.stdout.isTTY?R.stdout.columns:void 0,getErrHelpWidth:()=>R.stderr.isTTY?R.stderr.columns:void 0,getOutHasColors:()=>En()??(R.stdout.isTTY&&R.stdout.hasColors?.()),getErrHasColors:()=>En()??(R.stderr.isTTY&&R.stderr.hasColors?.()),stripColor:e=>Zo(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let e=this;e;e=e.parent)t.push(e);return t}command(t,e,n){let i=e,r=n;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,o,a]=t.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(t){return new s(t)}createHelp(){return Object.assign(new Xo,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,t),this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,e){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);return e=e||{},e.isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,e){return new Ko(t,e)}argument(t,e,n,i){let r=this.createArgument(t,e);return typeof n=="function"?r.default(i).argParser(n):r.default(n),this.addArgument(r),this}arguments(t){return t.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(t){let e=this.registeredArguments.slice(-1)[0];if(e&&e.variadic)throw new Error(`only the last argument can be variadic '${e.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,e){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,this;t=t??"help [command]";let[,n,i]=t.match(/([^ ]+) *(.*)/),r=e??"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(t,e){return typeof t!="object"?(this.helpCommand(t,e),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,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(t,e){let n=["preSubcommand","preAction","postAction"];if(!n.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
16
- Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(e):this._lifeCycleHooks[t]=[e],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=e=>{if(e.code!=="commander.executeSubCommandAsync")throw e},this}_exit(t,e,n){this._exitCallback&&this._exitCallback(new Fn(t,e,n)),R.exit(t)}action(t){let e=n=>{let i=this.registeredArguments.length,r=n.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),t.apply(this,r)};return this._actionHandler=e,this}createOption(t,e){return new Li(t,e)}_callParseArg(t,e,n,i){try{return t.parseArg(e,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(t){let e=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(e){let n=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
17
- - already used by option '${e.flags}'`)}this.options.push(t)}_registerCommand(t){let e=i=>[i.name()].concat(i.aliases()),n=e(t).find(i=>this._findCommand(i));if(n){let i=e(this._findCommand(n)).join("|"),r=e(t).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);let e=t.name(),n=t.attributeName();if(t.negate){let r=t.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(n,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(n,t.defaultValue,"default");let i=(r,o,a)=>{r==null&&t.presetArg!==void 0&&(r=t.presetArg);let u=this.getOptionValue(n);r!==null&&t.parseArg?r=this._callParseArg(t,r,u,o):r!==null&&t.variadic&&(r=t._concatValue(r,u)),r==null&&(t.negate?r=!1:t.isBoolean()||t.optional?r=!0:r=""),this.setOptionValueWithSource(n,r,a)};return this.on("option:"+e,r=>{let o=`error: option '${t.flags}' argument '${r}' is invalid.`;i(r,o,"cli")}),t.envVar&&this.on("optionEnv:"+e,r=>{let o=`error: option '${t.flags}' value '${r}' from env '${t.envVar}' is invalid.`;i(r,o,"env")}),this}_optionEx(t,e,n,i,r){if(typeof e=="object"&&e instanceof Li)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(e,n);if(o.makeOptionMandatory(!!t.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(t,e,n,i){return this._optionEx({},t,e,n,i)}requiredOption(t,e,n,i){return this._optionEx({mandatory:!0},t,e,n,i)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,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(t=!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=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,e){return this.setOptionValueWithSource(t,e,void 0)}setOptionValueWithSource(t,e,n){return this._storeOptionsAsProperties?this[t]=e:this._optionValues[t]=e,this._optionValueSources[t]=n,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let e;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(t)!==void 0&&(e=n.getOptionValueSource(t))}),e}_prepareUserArgs(t,e){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(e=e||{},t===void 0&&e.from===void 0){R.versions?.electron&&(e.from="electron");let i=R.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(e.from="eval")}t===void 0&&(t=R.argv),this.rawArgs=t.slice();let n;switch(e.from){case void 0:case"node":this._scriptPath=t[1],n=t.slice(2);break;case"electron":R.defaultApp?(this._scriptPath=t[1],n=t.slice(2)):n=t.slice(1);break;case"user":n=t.slice(0);break;case"eval":n=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${e.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(t,e){this._prepareForParse();let n=this._prepareUserArgs(t,e);return this._parseCommand([],n),this}async parseAsync(t,e){this._prepareForParse();let n=this._prepareUserArgs(t,e);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
- - 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(t,e,n){if(De.existsSync(t))return;let i=e?`searched for local subcommand relative to directory '${e}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",r=`'${t}' does not exist
14
+ (Did you mean ${n[0]}?)`:""}Ui.suggestSimilar=ra});var Wi=$(_n=>{"use strict";var oa=require("events").EventEmitter,yn=require("child_process"),ut=require("path"),de=require("fs"),R=require("process"),{Argument:aa,humanReadableArgName:ua}=De(),{CommanderError:bn}=Jt(),{Help:la,stripColor:ca}=hn(),{Option:Ji,DualOptions:Da}=En(),{suggestSimilar:Vi}=qi(),wn=class s extends oa{constructor(t){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=t||"",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:e=>R.stdout.write(e),writeErr:e=>R.stderr.write(e),outputError:(e,n)=>n(e),getOutHelpWidth:()=>R.stdout.isTTY?R.stdout.columns:void 0,getErrHelpWidth:()=>R.stderr.isTTY?R.stderr.columns:void 0,getOutHasColors:()=>An()??(R.stdout.isTTY&&R.stdout.hasColors?.()),getErrHasColors:()=>An()??(R.stderr.isTTY&&R.stderr.hasColors?.()),stripColor:e=>ca(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let e=this;e;e=e.parent)t.push(e);return t}command(t,e,n){let i=e,r=n;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,o,a]=t.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(t){return new s(t)}createHelp(){return Object.assign(new la,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,t),this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,e){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);return e=e||{},e.isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,e){return new aa(t,e)}argument(t,e,n,i){let r=this.createArgument(t,e);return typeof n=="function"?r.default(i).argParser(n):r.default(n),this.addArgument(r),this}arguments(t){return t.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(t){let e=this.registeredArguments.slice(-1)[0];if(e&&e.variadic)throw new Error(`only the last argument can be variadic '${e.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,e){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,this;t=t??"help [command]";let[,n,i]=t.match(/([^ ]+) *(.*)/),r=e??"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(t,e){return typeof t!="object"?(this.helpCommand(t,e),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,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(t,e){let n=["preSubcommand","preAction","postAction"];if(!n.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
16
+ Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(e):this._lifeCycleHooks[t]=[e],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=e=>{if(e.code!=="commander.executeSubCommandAsync")throw e},this}_exit(t,e,n){this._exitCallback&&this._exitCallback(new bn(t,e,n)),R.exit(t)}action(t){let e=n=>{let i=this.registeredArguments.length,r=n.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),t.apply(this,r)};return this._actionHandler=e,this}createOption(t,e){return new Ji(t,e)}_callParseArg(t,e,n,i){try{return t.parseArg(e,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(t){let e=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(e){let n=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
17
+ - already used by option '${e.flags}'`)}this.options.push(t)}_registerCommand(t){let e=i=>[i.name()].concat(i.aliases()),n=e(t).find(i=>this._findCommand(i));if(n){let i=e(this._findCommand(n)).join("|"),r=e(t).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);let e=t.name(),n=t.attributeName();if(t.negate){let r=t.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(n,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(n,t.defaultValue,"default");let i=(r,o,a)=>{r==null&&t.presetArg!==void 0&&(r=t.presetArg);let u=this.getOptionValue(n);r!==null&&t.parseArg?r=this._callParseArg(t,r,u,o):r!==null&&t.variadic&&(r=t._concatValue(r,u)),r==null&&(t.negate?r=!1:t.isBoolean()||t.optional?r=!0:r=""),this.setOptionValueWithSource(n,r,a)};return this.on("option:"+e,r=>{let o=`error: option '${t.flags}' argument '${r}' is invalid.`;i(r,o,"cli")}),t.envVar&&this.on("optionEnv:"+e,r=>{let o=`error: option '${t.flags}' value '${r}' from env '${t.envVar}' is invalid.`;i(r,o,"env")}),this}_optionEx(t,e,n,i,r){if(typeof e=="object"&&e instanceof Ji)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(e,n);if(o.makeOptionMandatory(!!t.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(t,e,n,i){return this._optionEx({},t,e,n,i)}requiredOption(t,e,n,i){return this._optionEx({mandatory:!0},t,e,n,i)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,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(t=!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=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,e){return this.setOptionValueWithSource(t,e,void 0)}setOptionValueWithSource(t,e,n){return this._storeOptionsAsProperties?this[t]=e:this._optionValues[t]=e,this._optionValueSources[t]=n,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let e;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(t)!==void 0&&(e=n.getOptionValueSource(t))}),e}_prepareUserArgs(t,e){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(e=e||{},t===void 0&&e.from===void 0){R.versions?.electron&&(e.from="electron");let i=R.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(e.from="eval")}t===void 0&&(t=R.argv),this.rawArgs=t.slice();let n;switch(e.from){case void 0:case"node":this._scriptPath=t[1],n=t.slice(2);break;case"electron":R.defaultApp?(this._scriptPath=t[1],n=t.slice(2)):n=t.slice(1);break;case"user":n=t.slice(0);break;case"eval":n=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${e.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(t,e){this._prepareForParse();let n=this._prepareUserArgs(t,e);return this._parseCommand([],n),this}async parseAsync(t,e){this._prepareForParse();let n=this._prepareUserArgs(t,e);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
+ - 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(t,e,n){if(de.existsSync(t))return;let i=e?`searched for local subcommand relative to directory '${e}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",r=`'${t}' 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(t,e){e=e.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(c,D){let p=ut.resolve(c,D);if(De.existsSync(p))return p;if(i.includes(ut.extname(D)))return;let F=i.find(g=>De.existsSync(`${p}${g}`));if(F)return`${p}${F}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let c;try{c=De.realpathSync(this._scriptPath)}catch{c=this._scriptPath}a=ut.resolve(ut.dirname(c),a)}if(a){let c=r(a,o);if(!c&&!t._executableFile&&this._scriptPath){let D=ut.basename(this._scriptPath,ut.extname(this._scriptPath));D!==this._name&&(c=r(a,`${D}-${t._name}`))}o=c||o}n=i.includes(ut.extname(o));let u;R.platform!=="win32"?n?(e.unshift(o),e=Ui(R.execArgv).concat(e),u=gn.spawn(R.argv[0],e,{stdio:"inherit"})):u=gn.spawn(o,e,{stdio:"inherit"}):(this._checkForMissingExecutable(o,a,t._name),e.unshift(o),e=Ui(R.execArgv).concat(e),u=gn.spawn(R.execPath,e,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(D=>{R.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 Fn(c,"commander.executeSubCommandAsync","(close)")):R.exit(c)}),u.on("error",c=>{if(c.code==="ENOENT")this._checkForMissingExecutable(o,a,t._name);else if(c.code==="EACCES")throw new Error(`'${o}' not executable`);if(!l)R.exit(1);else{let D=new Fn(1,"commander.executeSubCommandAsync","(error)");D.nestedError=c,l(D)}}),this.runningCommand=u}_dispatchSubcommand(t,e,n){let i=this._findCommand(t);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,e.concat(n));else return i._parseCommand(e,n)}),r}_dispatchHelpCommand(t){t||this.help();let e=this._findCommand(t);return e&&!e._executableHandler&&e.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,e)=>{t.required&&this.args[e]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(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 e=[];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)=>t(n,a,o),n.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],n.parseArg&&(r=t(n,r,n.defaultValue))),e[i]=r}),this.processedArgs=e}_chainOrCall(t,e){return t&&t.then&&typeof t.then=="function"?t.then(()=>e()):e()}_chainOrCallHooks(t,e){let n=t,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[e]!==void 0).forEach(r=>{r._lifeCycleHooks[e].forEach(o=>{i.push({hookedCommand:r,callback:o})})}),e==="postAction"&&i.reverse(),i.forEach(r=>{n=this._chainOrCall(n,()=>r.callback(r.hookedCommand,this))}),n}_chainOrCallSubCommandHook(t,e,n){let i=t;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(r=>{i=this._chainOrCall(i,()=>r(this,e))}),i}_parseCommand(t,e){let n=this.parseOptions(e);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(n.operands),e=n.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),e);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(e),this._dispatchSubcommand(this._defaultCommandName,t,e);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,t,e)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,t,e);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,e);this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(e=>e._name===t||e._aliases.includes(t))}_findOption(t){return this.options.find(e=>e.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(e=>{e.mandatory&&t.getOptionValue(e.attributeName())===void 0&&t.missingMandatoryOptionValue(e)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});t.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=t.find(r=>n.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let e=[],n=[],i=e,r=t.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)&&e.length===0&&n.length===0){if(this._findCommand(u)){e.push(u),r.length>0&&n.push(...r);break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){e.push(u),r.length>0&&e.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:e,unknown:n}}opts(){if(this._storeOptionsAsProperties){let t={},e=this.options.length;for(let n=0;n<e;n++){let i=this.options[n].attributeName();t[i]=i===this._versionOptionName?this._version:this[i]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,e)=>Object.assign(t,e.opts()),{})}error(t,e){this._outputConfiguration.outputError(`${t}
21
+ - ${i}`;throw new Error(r)}_executeSubCommand(t,e){e=e.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(c,D){let m=ut.resolve(c,D);if(de.existsSync(m))return m;if(i.includes(ut.extname(D)))return;let F=i.find(g=>de.existsSync(`${m}${g}`));if(F)return`${m}${F}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let c;try{c=de.realpathSync(this._scriptPath)}catch{c=this._scriptPath}a=ut.resolve(ut.dirname(c),a)}if(a){let c=r(a,o);if(!c&&!t._executableFile&&this._scriptPath){let D=ut.basename(this._scriptPath,ut.extname(this._scriptPath));D!==this._name&&(c=r(a,`${D}-${t._name}`))}o=c||o}n=i.includes(ut.extname(o));let u;R.platform!=="win32"?n?(e.unshift(o),e=Hi(R.execArgv).concat(e),u=yn.spawn(R.argv[0],e,{stdio:"inherit"})):u=yn.spawn(o,e,{stdio:"inherit"}):(this._checkForMissingExecutable(o,a,t._name),e.unshift(o),e=Hi(R.execArgv).concat(e),u=yn.spawn(R.execPath,e,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(D=>{R.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 bn(c,"commander.executeSubCommandAsync","(close)")):R.exit(c)}),u.on("error",c=>{if(c.code==="ENOENT")this._checkForMissingExecutable(o,a,t._name);else if(c.code==="EACCES")throw new Error(`'${o}' not executable`);if(!l)R.exit(1);else{let D=new bn(1,"commander.executeSubCommandAsync","(error)");D.nestedError=c,l(D)}}),this.runningCommand=u}_dispatchSubcommand(t,e,n){let i=this._findCommand(t);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,e.concat(n));else return i._parseCommand(e,n)}),r}_dispatchHelpCommand(t){t||this.help();let e=this._findCommand(t);return e&&!e._executableHandler&&e.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,e)=>{t.required&&this.args[e]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(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 e=[];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)=>t(n,a,o),n.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],n.parseArg&&(r=t(n,r,n.defaultValue))),e[i]=r}),this.processedArgs=e}_chainOrCall(t,e){return t&&t.then&&typeof t.then=="function"?t.then(()=>e()):e()}_chainOrCallHooks(t,e){let n=t,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[e]!==void 0).forEach(r=>{r._lifeCycleHooks[e].forEach(o=>{i.push({hookedCommand:r,callback:o})})}),e==="postAction"&&i.reverse(),i.forEach(r=>{n=this._chainOrCall(n,()=>r.callback(r.hookedCommand,this))}),n}_chainOrCallSubCommandHook(t,e,n){let i=t;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(r=>{i=this._chainOrCall(i,()=>r(this,e))}),i}_parseCommand(t,e){let n=this.parseOptions(e);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(n.operands),e=n.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),e);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(e),this._dispatchSubcommand(this._defaultCommandName,t,e);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,t,e)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,t,e);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,e);this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(e=>e._name===t||e._aliases.includes(t))}_findOption(t){return this.options.find(e=>e.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(e=>{e.mandatory&&t.getOptionValue(e.attributeName())===void 0&&t.missingMandatoryOptionValue(e)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});t.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=t.find(r=>n.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let e=[],n=[],i=e,r=t.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)&&e.length===0&&n.length===0){if(this._findCommand(u)){e.push(u),r.length>0&&n.push(...r);break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){e.push(u),r.length>0&&e.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:e,unknown:n}}opts(){if(this._storeOptionsAsProperties){let t={},e=this.options.length;for(let n=0;n<e;n++){let i=this.options[n].attributeName();t[i]=i===this._versionOptionName?this._version:this[i]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,e)=>Object.assign(t,e.opts()),{})}error(t,e){this._outputConfiguration.outputError(`${t}
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=e||{},i=n.exitCode||1,r=n.code||"commander.error";this._exit(i,r,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in R.env){let e=t.attributeName();(this.getOptionValue(e)===void 0||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,R.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Qo(this.options),e=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&e(n.attributeName())&&t.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!e(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(t){let e=`error: missing required argument '${t}'`;this.error(e,{code:"commander.missingArgument"})}optionMissingArgument(t){let e=`error: option '${t.flags}' argument missing`;this.error(e,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let e=`error: required option '${t.flags}' not specified`;this.error(e,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,e){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(t)} cannot be used with ${i(e)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let e="";if(t.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);e=Mi(t,i)}let n=`error: unknown option '${t}'${e}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let e=this.registeredArguments.length,n=e===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${e} argument${n} but got ${t.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],e="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),e=Mi(t,i)}let n=`error: unknown command '${t}'${e}`;this.error(n,{code:"commander.unknownCommand"})}version(t,e,n){if(t===void 0)return this._version;this._version=t,e=e||"-V, --version",n=n||"output the version number";let i=this.createOption(e,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${t}
25
- `),this._exit(0,"commander.version",t)}),this}description(t,e){return t===void 0&&e===void 0?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let e=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(t);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${i}'`)}return e._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(e=>this.alias(e)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(n=>zo(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}nameFromFilename(t){return this._name=ut.basename(t,ut.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let e=this.createHelp(),n=this._getOutputContext(t);e.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=e.formatHelp(this,e);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(t){t=t||{};let e=!!t.error,n,i,r;return e?(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:e,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:r}}outputHelp(t){let e;typeof t=="function"&&(e=t,t=void 0);let n=this._getOutputContext(t),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(e&&(r=e(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(t,e){return typeof t=="boolean"?(t?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(t=t??"-h, --help",e=e??"display help for command",this._helpOption=this.createOption(t,e),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this}help(t){this.outputHelp(t);let e=Number(R.exitCode??0);e===0&&t&&typeof t!="function"&&t.error&&(e=1),this._exit(e,"commander.help","(outputHelp)")}addHelpText(t,e){let n=["beforeAll","before","after","afterAll"];if(!n.includes(t))throw new Error(`Unexpected value for position to addHelpText.
24
+ `),this.outputHelp({error:!0}));let n=e||{},i=n.exitCode||1,r=n.code||"commander.error";this._exit(i,r,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in R.env){let e=t.attributeName();(this.getOptionValue(e)===void 0||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,R.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Da(this.options),e=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&e(n.attributeName())&&t.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!e(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(t){let e=`error: missing required argument '${t}'`;this.error(e,{code:"commander.missingArgument"})}optionMissingArgument(t){let e=`error: option '${t.flags}' argument missing`;this.error(e,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let e=`error: required option '${t.flags}' not specified`;this.error(e,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,e){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(t)} cannot be used with ${i(e)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let e="";if(t.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);e=Vi(t,i)}let n=`error: unknown option '${t}'${e}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let e=this.registeredArguments.length,n=e===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${e} argument${n} but got ${t.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],e="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),e=Vi(t,i)}let n=`error: unknown command '${t}'${e}`;this.error(n,{code:"commander.unknownCommand"})}version(t,e,n){if(t===void 0)return this._version;this._version=t,e=e||"-V, --version",n=n||"output the version number";let i=this.createOption(e,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${t}
25
+ `),this._exit(0,"commander.version",t)}),this}description(t,e){return t===void 0&&e===void 0?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let e=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(t);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${i}'`)}return e._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(e=>this.alias(e)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(n=>ua(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}nameFromFilename(t){return this._name=ut.basename(t,ut.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let e=this.createHelp(),n=this._getOutputContext(t);e.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=e.formatHelp(this,e);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(t){t=t||{};let e=!!t.error,n,i,r;return e?(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:e,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:r}}outputHelp(t){let e;typeof t=="function"&&(e=t,t=void 0);let n=this._getOutputContext(t),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(e&&(r=e(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(t,e){return typeof t=="boolean"?(t?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(t=t??"-h, --help",e=e??"display help for command",this._helpOption=this.createOption(t,e),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this}help(t){this.outputHelp(t);let e=Number(R.exitCode??0);e===0&&t&&typeof t!="function"&&t.error&&(e=1),this._exit(e,"commander.help","(outputHelp)")}addHelpText(t,e){let n=["beforeAll","before","after","afterAll"];if(!n.includes(t))throw new Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${n.join("', '")}'`);let i=`${t}Help`;return this.on(i,r=>{let o;typeof e=="function"?o=e({error:r.error,command:r.command}):o=e,o&&r.write(`${o}
27
- `)}),this}_outputHelpIfRequested(t){let e=this._getHelpOption();e&&t.find(i=>e.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Ui(s){return s.map(t=>{if(!t.startsWith("--inspect"))return t;let e,n="127.0.0.1",i="9229",r;return(r=t.match(/^(--inspect(-brk)?)$/))!==null?e=r[1]:(r=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(e=r[1],/^\d+$/.test(r[3])?i=r[3]:n=r[3]):(r=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(e=r[1],n=r[3],i=r[4]),e&&i!=="0"?`${e}=${n}:${parseInt(i)+1}`:t})}function En(){if(R.env.NO_COLOR||R.env.FORCE_COLOR==="0"||R.env.FORCE_COLOR==="false")return!1;if(R.env.FORCE_COLOR||R.env.CLICOLOR_FORCE!==void 0)return!0}yn.Command=Cn;yn.useColor=En});var Wi=$(z=>{"use strict";var{Argument:Ji}=ce(),{Command:bn}=qi(),{CommanderError:ta,InvalidArgumentError:Vi}=Jt(),{Help:ea}=dn(),{Option:Hi}=hn();z.program=new bn;z.createCommand=s=>new bn(s);z.createOption=(s,t)=>new Hi(s,t);z.createArgument=(s,t)=>new Ji(s,t);z.Command=bn;z.Option=Hi;z.Argument=Ji;z.Help=ea;z.CommanderError=ta;z.InvalidArgumentError=Vi;z.InvalidOptionArgumentError=Vi});var Gs=$((lD,Ya)=>{Ya.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 Xn=$((cD,Ks)=>{"use strict";var je=Object.assign({},Gs()),Ys=Object.keys(je);Object.defineProperty(je,"random",{get(){let s=Math.floor(Math.random()*Ys.length),t=Ys[s];return je[t]}});Ks.exports=je});var hr=$((Nd,fr)=>{"use strict";var ci=class{constructor(t,e,n){this.etaBufferLength=t||100,this.valueBuffer=[n],this.timeBuffer=[e],this.eta="0"}update(t,e,n){this.valueBuffer.push(e),this.timeBuffer.push(t),this.calculate(n-e)}getTime(){return this.eta}calculate(t){let e=this.valueBuffer.length,n=Math.min(this.etaBufferLength,e),i=this.valueBuffer[e-1]-this.valueBuffer[e-n],r=this.timeBuffer[e-1]-this.timeBuffer[e-n],o=i/r;this.valueBuffer=this.valueBuffer.slice(-this.etaBufferLength),this.timeBuffer=this.timeBuffer.slice(-this.etaBufferLength);let a=Math.ceil(t/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"}};fr.exports=ci});var di=$((Ld,gr)=>{"use strict";var gt=require("readline"),Di=class{constructor(t){this.stream=t,this.linewrap=!0,this.dy=0}cursorSave(){this.stream.isTTY&&this.stream.write("\x1B7")}cursorRestore(){this.stream.isTTY&&this.stream.write("\x1B8")}cursor(t){this.stream.isTTY&&(t?this.stream.write("\x1B[?25h"):this.stream.write("\x1B[?25l"))}cursorTo(t=null,e=null){this.stream.isTTY&&gt.cursorTo(this.stream,t,e)}cursorRelative(t=null,e=null){this.stream.isTTY&&(this.dy=this.dy+e,gt.moveCursor(this.stream,t,e))}cursorRelativeReset(){this.stream.isTTY&&(gt.moveCursor(this.stream,0,-this.dy),gt.cursorTo(this.stream,0,null),this.dy=0)}clearRight(){this.stream.isTTY&&gt.clearLine(this.stream,1)}clearLine(){this.stream.isTTY&&gt.clearLine(this.stream,0)}clearBottom(){this.stream.isTTY&&gt.clearScreenDown(this.stream)}newline(){this.stream.write(`
28
- `),this.dy++}write(t,e=!1){this.linewrap===!0&&e===!1?this.stream.write(t.substr(0,this.getWidth())):this.stream.write(t)}lineWrapping(t){this.stream.isTTY&&(this.linewrap=t,t?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)}};gr.exports=Di});var Cr=$((Md,Fr)=>{"use strict";Fr.exports=({onlyFirst:s=!1}={})=>{let t=["[\\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(t,s?void 0:"g")}});var yr=$((Ud,Er)=>{"use strict";var wu=Cr();Er.exports=s=>typeof s=="string"?s.replace(wu(),""):s});var wr=$((qd,pi)=>{"use strict";var br=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);pi.exports=br;pi.exports.default=br});var _r=$((Jd,Ar)=>{"use strict";Ar.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 xr=$((Vd,mi)=>{"use strict";var Au=yr(),_u=wr(),Iu=_r(),Ir=s=>{if(typeof s!="string"||s.length===0||(s=Au(s),s.length===0))return 0;s=s.replace(Iu()," ");let t=0;for(let e=0;e<s.length;e++){let n=s.codePointAt(e);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&e++,t+=_u(n)?2:1)}return t};mi.exports=Ir;mi.exports.default=Ir});var fi=$((Hd,Sr)=>{"use strict";Sr.exports=function(t,e,n){if(e.autopadding!==!0)return t;function i(r,o){return(e.autopaddingChar+r).slice(-o)}return n==="percentage"?i(t,3):t}});var hi=$((Wd,Tr)=>{"use strict";Tr.exports=function(t,e){let n=Math.round(t*e.barsize),i=e.barsize-n;return e.barCompleteString.substr(0,n)+e.barGlue+e.barIncompleteString.substr(0,i)}});var gi=$((Gd,vr)=>{"use strict";vr.exports=function(t,e,n){function i(o){return n?n*Math.round(o/n):o}function r(o){return(e.autopaddingChar+o).slice(-2)}return t>3600?r(Math.floor(t/3600))+"h"+r(i(t%3600/60))+"m":t>60?r(Math.floor(t/60))+"m"+r(i(t%60))+"s":t>10?r(i(t))+"s":r(t)+"s"}});var Fi=$((Yd,Or)=>{"use strict";var xu=xr(),Su=fi(),Tu=hi(),vu=gi();Or.exports=function(t,e,n){let i=t.format,r=t.formatTime||vu,o=t.formatValue||Su,a=t.formatBar||Tu,u=Math.floor(e.progress*100)+"",l=e.stopTime||Date.now(),c=Math.round((l-e.startTime)/1e3),D=Object.assign({},n,{bar:a(e.progress,t),percentage:o(u,t,"percentage"),total:o(e.total,t,"total"),value:o(e.value,t,"value"),eta:o(e.eta,t,"eta"),eta_formatted:r(e.eta,t,5),duration:o(c,t,"duration"),duration_formatted:r(c,t,1)});i=i.replace(/\{(\w+)\}/g,function(g,v){return typeof D[v]<"u"?D[v]:g});let p=Math.max(0,e.maxWidth-xu(i)-2),F=Math.floor(p/2);switch(t.align){case"right":i=p>0?" ".repeat(p)+i:i;break;case"center":i=F>0?" ".repeat(F)+i:i;break;default:break}return i}});var He=$((Kd,Br)=>{"use strict";function k(s,t){return typeof s>"u"||s===null?t:s}Br.exports={parse:function(t,e){let n={},i=Object.assign({},e,t);return n.throttleTime=1e3/k(i.fps,10),n.stream=k(i.stream,process.stderr),n.terminal=k(i.terminal,null),n.clearOnComplete=k(i.clearOnComplete,!1),n.stopOnComplete=k(i.stopOnComplete,!1),n.barsize=k(i.barsize,40),n.align=k(i.align,"left"),n.hideCursor=k(i.hideCursor,!1),n.linewrap=k(i.linewrap,!1),n.barGlue=k(i.barGlue,""),n.barCompleteChar=k(i.barCompleteChar,"="),n.barIncompleteChar=k(i.barIncompleteChar,"-"),n.format=k(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=k(i.formatTime,null),n.formatValue=k(i.formatValue,null),n.formatBar=k(i.formatBar,null),n.etaBufferLength=k(i.etaBuffer,10),n.etaAsynchronousUpdate=k(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=k(i.progressCalculationRelative,!1),n.synchronousUpdate=k(i.synchronousUpdate,!0),n.noTTYOutput=k(i.noTTYOutput,!1),n.notTTYSchedule=k(i.notTTYSchedule,2e3),n.emptyOnZero=k(i.emptyOnZero,!1),n.forceRedraw=k(i.forceRedraw,!1),n.autopadding=k(i.autopadding,!1),n.gracefulExit=k(i.gracefulExit,!1),n},assignDerivedOptions:function(t){return t.barCompleteString=t.barCompleteChar.repeat(t.barsize+1),t.barIncompleteString=t.barIncompleteChar.repeat(t.barsize+1),t.autopaddingChar=t.autopadding?k(t.autopaddingChar," "):"",t}}});var Ci=$((Xd,$r)=>{"use strict";var Rr=hr(),Ou=di(),Bu=Fi(),Ru=He(),$u=require("events");$r.exports=class extends $u{constructor(t){super(),this.options=Ru.assignDerivedOptions(t),this.terminal=this.options.terminal?this.options.terminal:new Ou(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 Rr(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:Bu}render(t=!1){let e={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,e,this.payload);(t||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(t,e,n){this.value=e||0,this.total=typeof t<"u"&&t>=0?t:100,this.startValue=e||0,this.payload=n||{},this.startTime=Date.now(),this.stopTime=null,this.lastDrawnString="",this.eta=new Rr(this.options.etaBufferLength,this.startTime,this.value),this.isActive=!0,this.emit("start",t,e)}stop(){this.isActive=!1,this.stopTime=Date.now(),this.emit("stop",this.total,this.value)}update(t,e={}){typeof t=="number"&&(this.value=t,this.eta.update(Date.now(),t,this.total));let n=(typeof t=="object"?t:e)||{};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 t=this.value/this.total;return this.options.progressCalculationRelative&&(t=(this.value-this.startValue)/(this.total-this.startValue)),isNaN(t)&&(t=this.options&&this.options.emptyOnZero?0:1),t=Math.min(Math.max(t,0),1),t}increment(t=1,e={}){typeof t=="object"?this.update(this.value+1,t):this.update(this.value+t,e)}getTotal(){return this.total}setTotal(t){typeof t<"u"&&t>=0&&(this.total=t)}updateETA(){this.eta.update(Date.now(),this.value,this.total)}}});var Pr=$((Qd,kr)=>{"use strict";var ku=Ci(),Pu=He();kr.exports=class extends ku{constructor(t,e){super(Pu.parse(t,e)),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(t,e){this.timer&&(super.update(t,e),this.options.synchronousUpdate&&this.lastRedraw+this.options.throttleTime*2<Date.now()&&this.render())}start(t,e,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(t,e,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 Nr=$((ep,jr)=>{"use strict";var ju=di(),Nu=Ci(),Lu=He(),Mu=require("events");jr.exports=class extends Mu{constructor(t,e){super(),this.bars=[],this.options=Lu.parse(t,e),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new ju(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(t,e,n,i={}){let r=new Nu(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(t,e,n),this.emit("start")),r}remove(t){let e=this.bars.indexOf(t);return e<0?!1:(this.bars.splice(e,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 t=0;t<this.bars.length;t++)t>0&&this.terminal.newline(),this.bars[t].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(t=>t.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 t=0;t<this.bars.length;t++)t>0&&this.terminal.newline(),this.bars[t].render(),this.bars[t].stop();this.terminal.newline()}this.emit("stop")}log(t){this.loggingBuffer.push(t)}}});var Mr=$((np,Lr)=>{"use strict";Lr.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var qr=$((ip,Ur)=>{"use strict";Ur.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Vr=$((sp,Jr)=>{"use strict";Jr.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Wr=$((rp,Hr)=>{"use strict";Hr.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var Yr=$((op,Gr)=>{"use strict";var Uu=Mr(),qu=qr(),Ju=Vr(),Vu=Wr();Gr.exports={legacy:Uu,shades_classic:qu,shades_grey:Ju,rect:Vu}});var Xr=$((ap,zr)=>{"use strict";var Kr=Pr(),Hu=Nr(),Wu=Yr(),Gu=Fi(),Yu=fi(),Ku=hi(),zu=gi();zr.exports={Bar:Kr,SingleBar:Kr,MultiBar:Hu,Presets:Wu,Format:{Formatter:Gu,BarFormat:Ku,ValueFormat:Yu,TimeFormat:zu}}});var Gi=A(Wi(),1),{program:hl,createCommand:gl,createArgument:Fl,createOption:Cl,CommanderError:El,InvalidArgumentError:yl,InvalidOptionArgumentError:bl,Command:Yi,Argument:wl,Option:Al,Help:_l}=Gi.default;var At=!1,Ki=!1;function zi(s){At=s}function d(){return At}function Xi(s){Ki=s}function m(s){console.log(JSON.stringify(s,null,2))}function S(s){At?console.error(JSON.stringify({error:s})):(console.error(`Error: ${s.message}`),s.details&&Ki&&console.error(JSON.stringify(s.details,null,2)))}function na(s){return s instanceof Error&&"code"in s&&"exitCode"in s&&typeof s.code=="string"&&typeof s.exitCode=="number"}function Zi(s){na(s)&&(S({code:s.code,message:s.message,details:s.details}),process.exit(s.exitCode)),S({code:"UNKNOWN_ERROR",message:s instanceof Error?s.message:"Unknown error"}),process.exit(1)}function b(s){At||console.log(`\x1B[32m${s}\x1B[0m`)}function V(s){At||console.log(`\x1B[36m${s}\x1B[0m`)}function ot(s){At||console.log(`\x1B[33m${s}\x1B[0m`)}var Rn=A(require("readline"));var Y=A(require("fs")),Ht=A(require("path")),Qi=A(require("os")),de=require("child_process"),wn=Ht.join(Qi.homedir(),".limai"),Vt=Ht.join(wn,"config.json"),ia=".limai.token",_t;function ts(){if(_t!==void 0)return _t;try{let s=(0,de.execSync)("git rev-parse --show-toplevel",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(!Y.existsSync(Ht.join(s,"packages","cli")))return _t=null,null;let t=(0,de.execSync)("git rev-parse --git-common-dir",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),e="";if(t!==".git"){let n=(0,de.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(n){let i=n.replace(/[/\\]/g,"-").replace(/[^a-zA-Z0-9._-]/g,"").replace(/^-+|-+$/g,"");i&&(e=`${i}.`)}}return _t={root:s,apiUrl:`http://${e}tables.localhost:1355`,sseUrl:`http://${e}ws.localhost:1355`},_t}catch{return _t=null,null}}function sa(){let s=ts();if(!s)return;let t=Ht.join(s.root,ia);if(Y.existsSync(t))return Y.readFileSync(t,"utf-8").trim()}function It(){let s=process.env.LIMAI_API_TOKEN,t=process.env.LIMAI_API_URL,e=process.env.LIMAI_SSE_URL,n={};if(Y.existsSync(Vt))try{let u=Y.readFileSync(Vt,"utf-8"),l=JSON.parse(u);l&&typeof l=="object"&&!Array.isArray(l)&&(n=l)}catch{n={}}let i=ts(),r=s||sa()||n.token,o=t||n.apiUrl||i?.apiUrl||process.env.LIMAI_BUILD_URL||void 0,a=e||n.sseUrl||i?.sseUrl||void 0;return!r||!o?null:{token:r,apiUrl:o,sseUrl:a,defaultProjectId:n.defaultProjectId,defaultDeploymentId:n.defaultDeploymentId}}function xt(s){let t={};if(Y.existsSync(Vt))try{let n=Y.readFileSync(Vt,"utf-8");t=JSON.parse(n)}catch{t={}}let e={...t,...s};Y.existsSync(wn)||Y.mkdirSync(wn,{recursive:!0,mode:448}),Y.writeFileSync(Vt,JSON.stringify(e,null,2),{mode:384})}function f(){let s=It();return s||(console.error("Not authenticated. Run `npm run cli:setup` or set LIMAI_API_TOKEN environment variable."),process.exit(1)),s}function es(){return!!process.env.LIMAI_EXECUTION_ID}var rs=require("fs"),os=require("fs/promises"),as=require("stream");var j=class extends Error{code;statusCode;exitCode;details;constructor(t,e){super(t),this.name="LimaiError",this.code=e.code,this.statusCode=e.statusCode,this.exitCode=e.exitCode??1,this.details=e.details}},An=class extends j{constructor(t,e){super(t,{code:"AUTH_ERROR",statusCode:401,exitCode:2,details:e}),this.name="AuthError"}},_n=class extends j{constructor(t,e){super(t,{code:"FORBIDDEN",statusCode:403,exitCode:2,details:e}),this.name="ForbiddenError"}},In=class extends j{constructor(t,e){super(t,{code:"NOT_FOUND",statusCode:404,exitCode:3,details:e}),this.name="NotFoundError"}},U=class extends j{constructor(t,e){super(t,{code:"VALIDATION_ERROR",statusCode:400,exitCode:4,details:e}),this.name="ValidationError"}},xn=class extends j{constructor(t,e){super(t,{code:"CONFLICT",statusCode:409,exitCode:4,details:e}),this.name="ConflictError"}},Sn=class extends j{retryAfterMs;constructor(t,e){super(t,{code:"RATE_LIMITED",statusCode:429,exitCode:5}),this.name="RateLimitError",this.retryAfterMs=e}},Tn=class extends j{constructor(t,e=500,n){super(t,{code:"SERVER_ERROR",statusCode:e,exitCode:6,details:n}),this.name="ServerError"}},St=class extends j{constructor(t){super(t,{code:"TIMEOUT",exitCode:7}),this.name="TimeoutError"}},dt=class extends j{constructor(t,e){super(t,{code:"UPLOAD_ERROR",exitCode:8,details:e}),this.name="UploadError"}};function ns(s,t,e){switch(s){case 400:return new U(t,e);case 401:return new An(t,e);case 403:return new _n(t,e);case 404:return new In(t,e);case 409:return new xn(t,e);case 429:return new Sn(t);default:return s>=500?new Tn(t,s,e):new j(t,{code:"HTTP_ERROR",statusCode:s,details:e})}}var ra=3e4,vn=3,is=1e3,ss=2;function oa(){return process.env.LIMAI_DEBUG==="1"}function Wt(...s){oa()&&console.error("[limai:http]",...s)}var pe=class{baseUrl;token;constructor(t){this.baseUrl=t.apiUrl.replace(/\/$/,""),this.token=t.token}buildUrl(t,e){let n=new URL(`/api/v1${t}`,this.baseUrl);if(e)for(let[i,r]of Object.entries(e))r!=null&&n.searchParams.set(i,r);return n.toString()}authHeaders(){let t={Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},e=process.env.VERCEL_BYPASS;return e&&(t["x-vercel-protection-bypass"]=e),t}async parseErrorBody(t){try{let e=await t.json();return{message:typeof e.error=="string"?e.error:`HTTP ${t.status}`,details:e.details}}catch{return{message:await t.text().catch(()=>"")||`HTTP ${t.status}`}}}shouldRetry(t){return t===429||t>=500}getRetryDelay(t,e){let n=t.headers.get("Retry-After");if(n){let i=parseInt(n,10);if(!isNaN(i))return i*1e3}return is*Math.pow(ss,e)}async request(t,e,n={}){let i=this.buildUrl(e,n.params),r=n.timeoutMs??ra;for(let o=0;o<=vn;o++){let a=new AbortController,u=setTimeout(()=>a.abort(),r);n.signal&&n.signal.addEventListener("abort",()=>a.abort());try{Wt(`${t} ${i}${o>0?` (retry ${o})`:""}`);let l=await fetch(i,{method:t,headers:this.authHeaders(),body:n.body?JSON.stringify(n.body):void 0,signal:a.signal});if(clearTimeout(u),l.ok){let p=await l.text();return p?JSON.parse(p):{}}if(this.shouldRetry(l.status)&&o<vn){let p=this.getRetryDelay(l,o);Wt(`Retrying in ${p}ms (status ${l.status})`),await new Promise(F=>setTimeout(F,p));continue}let{message:c,details:D}=await this.parseErrorBody(l);throw ns(l.status,c,D)}catch(l){if(clearTimeout(u),l instanceof j)throw l;if(l instanceof DOMException&&l.name==="AbortError"){if(o<vn){let c=is*Math.pow(ss,o);Wt(`Timeout, retrying in ${c}ms`),await new Promise(D=>setTimeout(D,c));continue}throw new St(`Request timed out after ${r}ms: ${t} ${e}`)}throw new j(l instanceof Error?l.message:"Unknown network error",{code:"NETWORK_ERROR",exitCode:1})}}throw new j("Max retries exceeded",{code:"MAX_RETRIES",exitCode:1})}async get(t,e,n){return this.request("GET",t,{params:e,timeoutMs:n})}async post(t,e,n){return this.request("POST",t,{body:e,timeoutMs:n})}async patch(t,e){return this.request("PATCH",t,{body:e})}async del(t,e){return this.request("DELETE",t,{body:e})}async putRaw(t,e,n,i){let r=e instanceof Blob?e.size:e.length;Wt(`PUT ${t} (${r} bytes)`);let o=await fetch(t,{method:"PUT",headers:{"Content-Type":n},body:e});if(i&&i(r,r),!o.ok)throw new dt(`Upload failed: HTTP ${o.status}`)}async putFile(t,e,n,i){let r=(await(0,os.stat)(e)).size;Wt(`PUT ${t} (${r} bytes, streamed from ${e})`);let o=(0,rs.createReadStream)(e),a=o;if(i){let l=0,c=new as.Transform({transform(D,p,F){l+=D.byteLength,i(l,r),F(null,D)}});a=o.pipe(c)}let u=await fetch(t,{method:"PUT",headers:{"Content-Type":n,"Content-Length":String(r)},body:a,duplex:"half"});if(i&&i(r,r),!u.ok)throw new dt(`Upload failed: HTTP ${u.status}`);return r}};var me=class{constructor(t){this.http=t}http;async getUploadUrl(t,e,n){let i={filename:e,contentHash:n};return this.http.get(`/document/${t}/get-url`,i)}async processSync(t,e,n){return this.http.post(`/document/${t}/process-file/${e}`,n,18e4)}async processAsync(t,e,n){return this.http.post(`/document/${t}/process-file-async/${e}`,n)}async processFilesAsync(t,e,n){return this.http.post(`/document/${t}/process-files-async`,{fileIds:e,...n})}async getFileData(t,e){let n={fileId:t,extractionSchemaId:e};return this.http.get("/document/get-file-data",n)}async getFilesData(t,e){return this.http.get("/document/get-files-data",{fileIds:t.join(","),extractionSchemaId:e})}async submitCorrections(t,e,n){return this.http.post(`/document/${t}/process-file/${e}/submit-corrections`,n)}};var fe=class{constructor(t){this.http=t}http;async list(){let t=await this.http.get("/projects");return Array.isArray(t)?t:t.data}async create(t){return this.http.post("/projects",t)}async getSchema(t){return this.http.get(`/projects/${t}/schema`)}async getSharedColumnIds(t){return this.http.get(`/projects/${t}/shared-column-ids`)}async listDeployments(t){return this.http.get(`/projects/${t}/deployments`)}async listBenchmarks(t){return this.http.get(`/projects/${t}/benchmarks`)}async listNotificationRoutes(t){return this.http.get(`/projects/${t}/notifications`)}async createNotificationRoute(t,e){return this.http.post(`/projects/${t}/notifications`,e)}async updateNotificationRoute(t,e,n){return this.http.patch(`/projects/${t}/notifications/${e}`,n)}async deleteNotificationRoute(t,e){return this.http.del(`/projects/${t}/notifications/${e}`)}async listNotificationIntegrations(t,e){return this.http.get(`/projects/${t}/notifications/integrations`,{provider:e})}async listNotificationSlackChannels(t,e){return this.http.get(`/projects/${t}/notifications/integrations/slack/channels`,{connectionId:e})}async listNotificationTeamsTeams(t,e){return this.http.get(`/projects/${t}/notifications/integrations/teams/teams`,{connectionId:e})}async listNotificationTeamsChannels(t,e,n){return this.http.get(`/projects/${t}/notifications/integrations/teams/channels`,{connectionId:e,teamId:n})}};var he=class{constructor(t){this.http=t}http;async list(t,e){let n={status:e?.status,type:e?.type},i=await this.http.get(`/projects/${t}/deployments`,n);return Array.isArray(i)?i:i.data}async create(t,e){return this.http.post(`/projects/${t}/deployments`,e)}async getConfig(t){return this.http.get(`/deployments/${t}/configuration`)}async updateConfig(t,e){await this.http.patch(`/deployment/${t}/configuration`,e)}async listDocuments(t,e){let n={limit:e?.limit?.toString(),offset:e?.offset?.toString(),status:e?.status};return this.http.get(`/deployments/${t}/documents`,n)}async getDocument(t,e){return this.http.get(`/deployments/${t}/documents/${e}`)}async deleteDocument(t,e){await this.http.del(`/deployments/${t}/documents/${e}`)}async bulkDelete(t,e){await this.http.del(`/deployments/${t}/documents/bulk-delete`,{fileIds:e})}};var ge=class{constructor(t){this.http=t}http;async get(t){return this.http.get(`/tables/${t}`)}async listColumns(t){let e=await this.http.get(`/tables/${t}/columns`);return Array.isArray(e)?e:e.data}async listRows(t,e){let n={limit:e?.limit?.toString(),offset:e?.offset?.toString(),status:e?.status};return this.http.get(`/tables/${t}/rows`,n)}async createRows(t,e){return this.http.post(`/tables/${t}/rows`,e,6e4)}async deleteRows(t,e){return this.http.del(`/tables/${t}/rows`,e)}async createTable(t,e){return this.http.post(`/deployments/${t}/tables`,e)}};async function*us(s,t={}){let e=Math.min(t.pageSize??100,500),n=0,i=0;for(;;){let r=t.maxItems?Math.min(e,t.maxItems-i):e;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)||t.maxItems&&i>=t.maxItems)break}}async function*ls(s,t={}){let e=Math.min(t.pageSize??100,500),n=1,i=0;for(;;){let r=t.maxItems?Math.min(e,t.maxItems-i):e;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)||t.maxItems&&i>=t.maxItems)break}}async function Fe(s){let t=[];for await(let e of s)t.push(...e);return t}var Ce=class{constructor(t){this.http=t}http;async getRows(t,e){let n={page:e?.page?.toString(),limit:e?.limit?.toString(),order:e?.order,status:e?.status};return this.http.get(`/extractions/${t}`,n)}async*getAllRows(t,e){yield*ls(async(n,i)=>this.http.get(`/extractions/${t}`,{page:n.toString(),limit:i.toString(),order:e?.order,status:e?.status}),e)}async collectAllRows(t,e){return Fe(this.getAllRows(t,e))}};var Ee=class{constructor(t){this.http=t}http;async getStatus(t){return this.http.get(`/queue/${t}/status`)}async cancel(t){await this.http.post("/queue/cancel",{jobId:t})}async updateStatus(t,e){return this.http.patch(`/queue/${t}/status`,e)}};var ye=class{constructor(t){this.http=t}http;async list(t){return this.http.get("/classify",{projectId:t})}async getUploadUrl(t,e){return this.http.get(`/classify/${t}/get-url`,{filename:e})}async classify(t,e){return this.http.post(`/classify/${t}`,{fileId:e})}async classifyAsync(t,e){return this.http.post(`/classify/${t}/async`,{fileId:e})}async getStatus(t,e){return this.http.get(`/classify/${t}`,{classificationId:e})}async createClassifier(t){return this.http.post("/classify",t)}async createRoute(t,e){return this.http.post(`/classify/${t}/routes`,e)}};var be=class{constructor(t){this.http=t}http;async list(t){return this.http.get("/split",{projectId:t})}async getUploadUrl(t,e){return this.http.get(`/split/${t}/get-url`,{filename:e})}async split(t,e){return this.http.post(`/split/${t}`,{fileId:e})}async splitAsync(t,e){return this.http.post(`/split/${t}/async`,{fileId:e})}async getStatus(t,e){return this.http.get(`/split/${t}`,{splitId:e})}async listSplits(t){return this.http.get(`/split/${t}/splits`)}async createSplitter(t){return this.http.post("/split",t)}};var we=class{constructor(t){this.http=t}http;async get(t){return this.http.get(`/extraction-schema/${t}`)}async update(t,e){await this.http.patch(`/extraction-schema/${t}`,e)}async getAllData(t){return this.http.get("/extraction-schema/get-all-data",{extractionSchemaId:t})}};var Ae=class{constructor(t){this.http=t}http;async list(t){return this.http.get(`/projects/${t}/buckets`)}async get(t){return this.http.get(`/buckets/${t}`)}async create(t,e,n){return this.http.post(`/projects/${t}/buckets`,{name:e,description:n})}async delete(t){await this.http.del(`/buckets/${t}`)}async getUploadUrl(t,e){return this.http.get(`/buckets/${t}/get-url`,{filename:e})}async confirmUpload(t,e,n){await this.http.patch(`/buckets/${t}/files/${e}/status`,{status:"UPLOADED",...n!==void 0&&{sizeBytes:n}})}async listFiles(t,e){let n={};return e&&e.length>0&&(n.labels=e.join(",")),this.http.get(`/buckets/${t}/files`,n)}async getDownloadUrl(t,e){return this.http.get(`/buckets/${t}/files/${e}/download`)}async updateLabels(t,e,n){return this.http.patch(`/buckets/${t}/files/${e}`,{labels:n})}async deleteFile(t,e){await this.http.del(`/buckets/${t}/files/${e}`)}async sendTo(t,e,n,i){return this.http.post(`/buckets/${t}/files/${e}/send-to`,{targetType:n,targetId:i})}};var _e=class{constructor(t){this.http=t}http;async list(t,e){let n={};return e?.status&&(n.status=e.status),this.http.get(`/projects/${t}/agents`,n)}async get(t,e){return this.http.get(`/projects/${t}/agents/${e}`)}async create(t,e){return this.http.post(`/projects/${t}/agents`,e)}async update(t,e,n){return this.http.patch(`/projects/${t}/agents/${e}`,n)}async delete(t,e){await this.http.del(`/projects/${t}/agents/${e}`)}async getFileUploadUrl(t,e,n){return this.http.get(`/projects/${t}/agents/${e}/files/get-url`,{filename:n})}async deleteFile(t,e,n){await this.http.del(`/projects/${t}/agents/${e}/files/${n}`)}async updateFileMetadata(t,e,n,i){return this.http.patch(`/projects/${t}/agents/${e}/files/${n}`,i)}async getFileDownloadUrl(t,e,n){return this.http.get(`/projects/${t}/agents/${e}/files/${n}/download`)}async listSkills(t,e){return this.http.get(`/projects/${t}/agents/${e}/skills`)}async createSkill(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/skills`,n)}async updateSkill(t,e,n,i){return this.http.patch(`/projects/${t}/agents/${e}/skills/${n}`,i)}async deleteSkill(t,e,n){await this.http.del(`/projects/${t}/agents/${e}/skills/${n}`)}async linkFileToSkill(t,e,n,i){return this.http.post(`/projects/${t}/agents/${e}/skills/${n}/files`,{fileId:i})}async unlinkFileFromSkill(t,e,n,i){await this.http.del(`/projects/${t}/agents/${e}/skills/${n}/files/${i}`)}async listRuns(t,e,n){let i={};return n?.limit&&(i.limit=String(n.limit)),n?.status&&(i.status=n.status),this.http.get(`/projects/${t}/agents/${e}/runs`,i)}async getRun(t,e,n){return this.http.get(`/projects/${t}/agents/${e}/runs/${n}`)}async getRunConversation(t,e,n,i){let r={};return i?.stepId&&(r.stepId=i.stepId),this.http.get(`/projects/${t}/agents/${e}/runs/${n}/conversation`,r)}async createRun(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/runs`,n)}async createStep(t,e,n,i){return this.http.post(`/projects/${t}/agents/${e}/runs/${n}/steps`,i)}async updateRun(t,e,n,i){return this.http.patch(`/projects/${t}/agents/${e}/runs/${n}`,i)}async updateStep(t,e,n,i,r){return this.http.patch(`/projects/${t}/agents/${e}/runs/${n}/steps/${i}`,r)}async updateStepConditions(t,e,n,i,r){return this.http.patch(`/projects/${t}/agents/${e}/runs/${n}/steps/${i}`,{conditions:r})}async pauseRun(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/runs/${n}/pause`,{})}async submitStepAction(t,e,n,i,r){return this.http.post(`/projects/${t}/agents/${e}/runs/${n}/steps/${i}/action`,r)}async sendEmail(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/send-email`,n)}async completeExecution(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/executions/complete`,n)}async getSharePointToken(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/sharepoint-token`,n)}async getArtifactUploadUrl(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/upload-artifact/get-url`,n)}};var Ie=class{constructor(t){this.http=t}http;async ask(t,e){return this.http.post(`/projects/${t}/vision/ask`,e,12e4)}};var xe=class{constructor(t){this.http=t}http;async list(t,e){let n={};return e?.entityType&&(n.entityType=e.entityType),this.http.get(`/projects/${t}/labels`,n)}async addRemove(t,e,n,i,r){return this.http.post(`/projects/${t}/labels`,{entityType:e,entityId:n,add:i,remove:r})}async search(t,e){let n={};return e?.entityType&&(n.entityType=e.entityType),e?.labels&&(n.labels=e.labels),e?.key&&(n.key=e.key),this.http.get(`/projects/${t}/labels/search`,n)}};var Se=A(require("fs")),Tt=A(require("path"));var cs=A(require("fs")),Ds=A(require("crypto"));async function ds(s){return new Promise((t,e)=>{let n=Ds.createHash("sha256"),i=cs.createReadStream(s);i.on("data",r=>n.update(r)),i.on("end",()=>t(n.digest("hex"))),i.on("error",e)})}var aa={".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 ua(s){let t=Tt.extname(s).toLowerCase();return aa[t]||"application/octet-stream"}async function Te(s,t,e,n,i){let r=Tt.resolve(n),o=Tt.basename(r);if(!Se.existsSync(r))throw new dt(`File not found: ${r}`);if(!Se.statSync(r).isFile())throw new dt(`Not a file: ${r}`);let u=await ds(r),l=await t.getUploadUrl(e,o,u);if(l.isDuplicate)return{fileId:l.fileId,filename:l.fileName??o,isDuplicate:!0,bytesUploaded:0};let c=ua(r),D=await s.putFile(l.url,r,c,i);return{fileId:l.fileId,filename:l.fileName??o,isDuplicate:!1,bytesUploaded:D}}var vt=A(require("fs")),Ot=A(require("path"));var ms=A(require("path"));var ps=250,la=5,On=class{constructor(t){this.max=t}max;queue=[];current=0;async acquire(){if(this.current<this.max){this.current++;return}return new Promise(t=>{this.queue.push(t)})}release(){this.current--;let t=this.queue.shift();t&&(this.current++,t())}};async function fs(s,t,e,n,i){let r=Math.min(i?.concurrency??la,10),o=new On(r),a=n.map(p=>({path:p,filename:ms.basename(p),status:"pending"})),u=a.map(async(p,F)=>{await o.acquire();try{p.status="uploading",i?.onFileStatus?.(p);let g=await Te(s,t,e,p.path);p.fileId=g.fileId,p.status="uploaded",i?.onFileStatus?.(p)}catch(g){p.status="failed",p.error=g instanceof Error?g.message:String(g),i?.onFileStatus?.(p)}finally{o.release()}});if(await Promise.all(u),i?.process){let F=a.filter(g=>g.status==="uploaded"&&g.fileId).map(g=>g.fileId);for(let g=0;g<F.length;g+=ps){let v=F.slice(g,g+ps);try{let B=await t.processFilesAsync(e,v,i.processOptions);for(let[E,C]of Object.entries(B.results)){let I=a.find(q=>q.fileId===E);I&&(C.status==="queued"?(I.status="queued",I.jobId=C.jobId):(I.status="failed",I.error=C.error),i?.onFileStatus?.(I))}}catch(B){for(let E of v){let C=a.find(I=>I.fileId===E);C&&(C.status="failed",C.error=B instanceof Error?B.message:String(B),i?.onFileStatus?.(C))}}}}let l=a.filter(p=>p.status==="uploaded"||p.status==="queued").length,c=a.filter(p=>p.status==="queued").length,D=a.filter(p=>p.status==="failed").length;return{total:n.length,uploaded:l,queued:c,failed:D,files:a}}var ca=new Set([".pdf",".png",".jpg",".jpeg",".tiff",".tif",".xlsx",".xls",".csv",".docx",".doc"]);function hs(s,t){let e=[],n=vt.readdirSync(s,{withFileTypes:!0});for(let i of n){let r=Ot.join(s,i.name);if(!i.name.startsWith(".")){if(i.isDirectory())e.push(...hs(r,t));else if(i.isFile()){let o=Ot.extname(i.name).toLowerCase();if(!ca.has(o)||t&&!Da(i.name,t))continue;e.push(r)}}}return e.sort()}function Da(s,t){let e=t.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${e}$`,"i").test(s)}async function gs(s,t,e,n,i){let r=Ot.resolve(n);if(!vt.existsSync(r))throw new Error(`Directory not found: ${r}`);if(!vt.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:[]}:fs(s,t,e,a,{concurrency:i?.concurrency,process:i?.process,processOptions:i?.processOptions,onFileStatus:i?.onFileStatus})}var da=1e3,pa=1e4,ma=1.5,fa=3e5,ha=["COMPLETED","FAILED","STALLED"],X=class{constructor(t){this.queue=t}queue;async*poll(t,e){let n=e?.intervalMs??da,i=e?.maxIntervalMs??pa,r=e?.backoffMultiplier??ma,o=e?.timeoutMs??fa,a=n,u=Date.now(),l;for(;;){if(Date.now()-u>o)throw new St(`Polling timed out after ${Math.round(o/1e3)}s for job ${t}`);let c=await this.queue.getStatus(t);if(c.status!==l&&(l=c.status,e?.onStatus?.(c),yield c),ha.includes(c.status))return;await new Promise(D=>setTimeout(D,a)),a=Math.min(a*r,i)}}async waitForCompletion(t,e){let n;for await(let i of this.poll(t,e))n=i;if(!n)throw new Error(`No status received for job ${t}`);return n}};var h=class{http;documents;projects;deployments;tables;extractions;queue;classify;split;schema;buckets;agents;vision;labels;constructor(t){this.http=new pe({apiUrl:t.apiUrl,token:t.token}),this.documents=new me(this.http),this.projects=new fe(this.http),this.deployments=new he(this.http),this.tables=new ge(this.http),this.extractions=new Ce(this.http),this.queue=new Ee(this.http),this.classify=new ye(this.http),this.split=new be(this.http),this.schema=new we(this.http),this.buckets=new Ae(this.http),this.agents=new _e(this.http),this.vision=new Ie(this.http),this.labels=new xe(this.http)}async uploadFile(t,e,n){return Te(this.http,this.documents,t,e,n)}async uploadFolder(t,e,n){return gs(this.http,this.documents,t,e,n)}async processAndWait(t,e,n){let i=await this.documents.processAsync(t,e,n?.processOptions),r=new X(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 ${e}${o?`: ${o.status}`:""}`);return this.documents.getFileData(e,t)}async*downloadAll(t,e){yield*this.extractions.getAllRows(t,e)}};function O(s,t){if(d()){m(s);return}if(s.length===0){console.log("\x1B[2mNo results.\x1B[0m");return}let e=t||Object.keys(s[0]),n={};for(let r of e)n[r]=r.length;for(let r of s)for(let o of e){let a=String(r[o]??"");n[o]=Math.max(n[o],Math.min(a.length,60))}let i=e.map(r=>`\x1B[1m${r.padEnd(n[r])}\x1B[0m`).join(" ");console.log(i),console.log(e.map(r=>"\u2500".repeat(n[r])).join(" "));for(let r of s){let o=e.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(d()){m(s);return}let t=Math.max(...Object.keys(s).map(e=>e.length));for(let[e,n]of Object.entries(s)){let i=`\x1B[1m${e.padEnd(t)}\x1B[0m`,r=typeof n=="object"&&n!==null?JSON.stringify(n):String(n??"");console.log(`${i} ${r}`)}}var Es=require("child_process"),ys=require("crypto"),bs=require("http"),Fs=9768,Cs=9780,ga=12e4;function Fa(){return(0,ys.randomBytes)(32).toString("hex")}function Ca(s){let t=process.platform,e=t==="darwin"?`open "${s}"`:t==="win32"?`start "" "${s}"`:`xdg-open "${s}"`;try{return(0,Es.exec)(e),!0}catch{return!1}}function Ea(){return`<!DOCTYPE html>
27
+ `)}),this}_outputHelpIfRequested(t){let e=this._getHelpOption();e&&t.find(i=>e.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Hi(s){return s.map(t=>{if(!t.startsWith("--inspect"))return t;let e,n="127.0.0.1",i="9229",r;return(r=t.match(/^(--inspect(-brk)?)$/))!==null?e=r[1]:(r=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(e=r[1],/^\d+$/.test(r[3])?i=r[3]:n=r[3]):(r=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(e=r[1],n=r[3],i=r[4]),e&&i!=="0"?`${e}=${n}:${parseInt(i)+1}`:t})}function An(){if(R.env.NO_COLOR||R.env.FORCE_COLOR==="0"||R.env.FORCE_COLOR==="false")return!1;if(R.env.FORCE_COLOR||R.env.CLICOLOR_FORCE!==void 0)return!0}_n.Command=wn;_n.useColor=An});var zi=$(z=>{"use strict";var{Argument:Gi}=De(),{Command:In}=Wi(),{CommanderError:da,InvalidArgumentError:Yi}=Jt(),{Help:pa}=hn(),{Option:Ki}=En();z.program=new In;z.createCommand=s=>new In(s);z.createOption=(s,t)=>new Ki(s,t);z.createArgument=(s,t)=>new Gi(s,t);z.Command=In;z.Option=Ki;z.Argument=Gi;z.Help=pa;z.CommanderError=da;z.InvalidArgumentError=Yi;z.InvalidOptionArgumentError=Yi});var Qs=$((ID,ou)=>{ou.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 ti=$((xD,er)=>{"use strict";var Le=Object.assign({},Qs()),tr=Object.keys(Le);Object.defineProperty(Le,"random",{get(){let s=Math.floor(Math.random()*tr.length),t=tr[s];return Le[t]}});er.exports=Le});var yr=$((ep,Er)=>{"use strict";var mi=class{constructor(t,e,n){this.etaBufferLength=t||100,this.valueBuffer=[n],this.timeBuffer=[e],this.eta="0"}update(t,e,n){this.valueBuffer.push(e),this.timeBuffer.push(t),this.calculate(n-e)}getTime(){return this.eta}calculate(t){let e=this.valueBuffer.length,n=Math.min(this.etaBufferLength,e),i=this.valueBuffer[e-1]-this.valueBuffer[e-n],r=this.timeBuffer[e-1]-this.timeBuffer[e-n],o=i/r;this.valueBuffer=this.valueBuffer.slice(-this.etaBufferLength),this.timeBuffer=this.timeBuffer.slice(-this.etaBufferLength);let a=Math.ceil(t/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"}};Er.exports=mi});var hi=$((np,br)=>{"use strict";var Ft=require("readline"),fi=class{constructor(t){this.stream=t,this.linewrap=!0,this.dy=0}cursorSave(){this.stream.isTTY&&this.stream.write("\x1B7")}cursorRestore(){this.stream.isTTY&&this.stream.write("\x1B8")}cursor(t){this.stream.isTTY&&(t?this.stream.write("\x1B[?25h"):this.stream.write("\x1B[?25l"))}cursorTo(t=null,e=null){this.stream.isTTY&&Ft.cursorTo(this.stream,t,e)}cursorRelative(t=null,e=null){this.stream.isTTY&&(this.dy=this.dy+e,Ft.moveCursor(this.stream,t,e))}cursorRelativeReset(){this.stream.isTTY&&(Ft.moveCursor(this.stream,0,-this.dy),Ft.cursorTo(this.stream,0,null),this.dy=0)}clearRight(){this.stream.isTTY&&Ft.clearLine(this.stream,1)}clearLine(){this.stream.isTTY&&Ft.clearLine(this.stream,0)}clearBottom(){this.stream.isTTY&&Ft.clearScreenDown(this.stream)}newline(){this.stream.write(`
28
+ `),this.dy++}write(t,e=!1){this.linewrap===!0&&e===!1?this.stream.write(t.substr(0,this.getWidth())):this.stream.write(t)}lineWrapping(t){this.stream.isTTY&&(this.linewrap=t,t?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)}};br.exports=fi});var Ar=$((ip,wr)=>{"use strict";wr.exports=({onlyFirst:s=!1}={})=>{let t=["[\\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(t,s?void 0:"g")}});var Ir=$((sp,_r)=>{"use strict";var ku=Ar();_r.exports=s=>typeof s=="string"?s.replace(ku(),""):s});var Sr=$((rp,gi)=>{"use strict";var xr=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);gi.exports=xr;gi.exports.default=xr});var Tr=$((op,vr)=>{"use strict";vr.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 Br=$((ap,Fi)=>{"use strict";var Pu=Ir(),ju=Sr(),Nu=Tr(),Or=s=>{if(typeof s!="string"||s.length===0||(s=Pu(s),s.length===0))return 0;s=s.replace(Nu()," ");let t=0;for(let e=0;e<s.length;e++){let n=s.codePointAt(e);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&e++,t+=ju(n)?2:1)}return t};Fi.exports=Or;Fi.exports.default=Or});var Ci=$((up,Rr)=>{"use strict";Rr.exports=function(t,e,n){if(e.autopadding!==!0)return t;function i(r,o){return(e.autopaddingChar+r).slice(-o)}return n==="percentage"?i(t,3):t}});var Ei=$((lp,$r)=>{"use strict";$r.exports=function(t,e){let n=Math.round(t*e.barsize),i=e.barsize-n;return e.barCompleteString.substr(0,n)+e.barGlue+e.barIncompleteString.substr(0,i)}});var yi=$((cp,kr)=>{"use strict";kr.exports=function(t,e,n){function i(o){return n?n*Math.round(o/n):o}function r(o){return(e.autopaddingChar+o).slice(-2)}return t>3600?r(Math.floor(t/3600))+"h"+r(i(t%3600/60))+"m":t>60?r(Math.floor(t/60))+"m"+r(i(t%60))+"s":t>10?r(i(t))+"s":r(t)+"s"}});var bi=$((Dp,Pr)=>{"use strict";var Lu=Br(),Mu=Ci(),Uu=Ei(),qu=yi();Pr.exports=function(t,e,n){let i=t.format,r=t.formatTime||qu,o=t.formatValue||Mu,a=t.formatBar||Uu,u=Math.floor(e.progress*100)+"",l=e.stopTime||Date.now(),c=Math.round((l-e.startTime)/1e3),D=Object.assign({},n,{bar:a(e.progress,t),percentage:o(u,t,"percentage"),total:o(e.total,t,"total"),value:o(e.value,t,"value"),eta:o(e.eta,t,"eta"),eta_formatted:r(e.eta,t,5),duration:o(c,t,"duration"),duration_formatted:r(c,t,1)});i=i.replace(/\{(\w+)\}/g,function(g,T){return typeof D[T]<"u"?D[T]:g});let m=Math.max(0,e.maxWidth-Lu(i)-2),F=Math.floor(m/2);switch(t.align){case"right":i=m>0?" ".repeat(m)+i:i;break;case"center":i=F>0?" ".repeat(F)+i:i;break;default:break}return i}});var Ge=$((dp,jr)=>{"use strict";function j(s,t){return typeof s>"u"||s===null?t:s}jr.exports={parse:function(t,e){let n={},i=Object.assign({},e,t);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(t){return t.barCompleteString=t.barCompleteChar.repeat(t.barsize+1),t.barIncompleteString=t.barIncompleteChar.repeat(t.barsize+1),t.autopaddingChar=t.autopadding?j(t.autopaddingChar," "):"",t}}});var wi=$((mp,Lr)=>{"use strict";var Nr=yr(),Ju=hi(),Vu=bi(),Hu=Ge(),Wu=require("events");Lr.exports=class extends Wu{constructor(t){super(),this.options=Hu.assignDerivedOptions(t),this.terminal=this.options.terminal?this.options.terminal:new Ju(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 Nr(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:Vu}render(t=!1){let e={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,e,this.payload);(t||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(t,e,n){this.value=e||0,this.total=typeof t<"u"&&t>=0?t:100,this.startValue=e||0,this.payload=n||{},this.startTime=Date.now(),this.stopTime=null,this.lastDrawnString="",this.eta=new Nr(this.options.etaBufferLength,this.startTime,this.value),this.isActive=!0,this.emit("start",t,e)}stop(){this.isActive=!1,this.stopTime=Date.now(),this.emit("stop",this.total,this.value)}update(t,e={}){typeof t=="number"&&(this.value=t,this.eta.update(Date.now(),t,this.total));let n=(typeof t=="object"?t:e)||{};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 t=this.value/this.total;return this.options.progressCalculationRelative&&(t=(this.value-this.startValue)/(this.total-this.startValue)),isNaN(t)&&(t=this.options&&this.options.emptyOnZero?0:1),t=Math.min(Math.max(t,0),1),t}increment(t=1,e={}){typeof t=="object"?this.update(this.value+1,t):this.update(this.value+t,e)}getTotal(){return this.total}setTotal(t){typeof t<"u"&&t>=0&&(this.total=t)}updateETA(){this.eta.update(Date.now(),this.value,this.total)}}});var Ur=$((hp,Mr)=>{"use strict";var Gu=wi(),Yu=Ge();Mr.exports=class extends Gu{constructor(t,e){super(Yu.parse(t,e)),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(t,e){this.timer&&(super.update(t,e),this.options.synchronousUpdate&&this.lastRedraw+this.options.throttleTime*2<Date.now()&&this.render())}start(t,e,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(t,e,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 Jr=$((Fp,qr)=>{"use strict";var Ku=hi(),zu=wi(),Xu=Ge(),Zu=require("events");qr.exports=class extends Zu{constructor(t,e){super(),this.bars=[],this.options=Xu.parse(t,e),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new Ku(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(t,e,n,i={}){let r=new zu(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(t,e,n),this.emit("start")),r}remove(t){let e=this.bars.indexOf(t);return e<0?!1:(this.bars.splice(e,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 t=0;t<this.bars.length;t++)t>0&&this.terminal.newline(),this.bars[t].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(t=>t.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 t=0;t<this.bars.length;t++)t>0&&this.terminal.newline(),this.bars[t].render(),this.bars[t].stop();this.terminal.newline()}this.emit("stop")}log(t){this.loggingBuffer.push(t)}}});var Hr=$((Cp,Vr)=>{"use strict";Vr.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var Gr=$((Ep,Wr)=>{"use strict";Wr.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Kr=$((yp,Yr)=>{"use strict";Yr.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Xr=$((bp,zr)=>{"use strict";zr.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var Qr=$((wp,Zr)=>{"use strict";var Qu=Hr(),tl=Gr(),el=Kr(),nl=Xr();Zr.exports={legacy:Qu,shades_classic:tl,shades_grey:el,rect:nl}});var no=$((Ap,eo)=>{"use strict";var to=Ur(),il=Jr(),sl=Qr(),rl=bi(),ol=Ci(),al=Ei(),ul=yi();eo.exports={Bar:to,SingleBar:to,MultiBar:il,Presets:sl,Format:{Formatter:rl,BarFormat:al,ValueFormat:ol,TimeFormat:ul}}});var Xi=A(zi(),1),{program:Ol,createCommand:Bl,createArgument:Rl,createOption:$l,CommanderError:kl,InvalidArgumentError:Pl,InvalidOptionArgumentError:jl,Command:Zi,Argument:Nl,Option:Ll,Help:Ml}=Xi.default;var _t=!1,Qi=!1;function ts(s){_t=s}function d(){return _t}function es(s){Qi=s}function p(s){console.log(JSON.stringify(s,null,2))}function x(s){_t?console.error(JSON.stringify({error:s})):(console.error(`Error: ${s.message}`),s.details&&Qi&&console.error(JSON.stringify(s.details,null,2)))}function ma(s){return s instanceof Error&&"code"in s&&"exitCode"in s&&typeof s.code=="string"&&typeof s.exitCode=="number"}function ns(s){ma(s)&&(x({code:s.code,message:s.message,details:s.details}),process.exit(s.exitCode)),x({code:"UNKNOWN_ERROR",message:s instanceof Error?s.message:"Unknown error"}),process.exit(1)}function b(s){_t||console.log(`\x1B[32m${s}\x1B[0m`)}function P(s){_t||console.log(`\x1B[36m${s}\x1B[0m`)}function ot(s){_t||console.log(`\x1B[33m${s}\x1B[0m`)}var Pn=A(require("readline"));var Y=A(require("fs")),Ht=A(require("path")),is=A(require("os")),pe=require("child_process"),xn=Ht.join(is.homedir(),".limai"),Vt=Ht.join(xn,"config.json"),fa=".limai.token",It;function ss(){if(It!==void 0)return It;try{let s=(0,pe.execSync)("git rev-parse --show-toplevel",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(!Y.existsSync(Ht.join(s,"packages","cli")))return It=null,null;let t=(0,pe.execSync)("git rev-parse --git-common-dir",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),e="";if(t!==".git"){let n=(0,pe.execSync)("git rev-parse --abbrev-ref HEAD",{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();if(n){let i=n.replace(/[/\\]/g,"-").replace(/[^a-zA-Z0-9._-]/g,"").replace(/^-+|-+$/g,"");i&&(e=`${i}.`)}}return It={root:s,apiUrl:`https://${e}tables.localhost`,sseUrl:`https://${e}ws.localhost`},It}catch{return It=null,null}}function ha(){let s=ss();if(!s)return;let t=Ht.join(s.root,fa);if(Y.existsSync(t))return Y.readFileSync(t,"utf-8").trim()}function xt(){let s=process.env.LIMAI_API_TOKEN,t=process.env.LIMAI_API_URL,e=process.env.LIMAI_SSE_URL,n={};if(Y.existsSync(Vt))try{let u=Y.readFileSync(Vt,"utf-8"),l=JSON.parse(u);l&&typeof l=="object"&&!Array.isArray(l)&&(n=l)}catch{n={}}let i=ss(),r=s||ha()||n.token,o=t||n.apiUrl||i?.apiUrl||process.env.LIMAI_BUILD_URL||void 0,a=e||n.sseUrl||i?.sseUrl||void 0;return!r||!o?null:{token:r,apiUrl:o,sseUrl:a,defaultProjectId:n.defaultProjectId,defaultDeploymentId:n.defaultDeploymentId}}function ft(s){let t={};if(Y.existsSync(Vt))try{let n=Y.readFileSync(Vt,"utf-8");t=JSON.parse(n)}catch{t={}}let e={...t,...s};Y.existsSync(xn)||Y.mkdirSync(xn,{recursive:!0,mode:448}),Y.writeFileSync(Vt,JSON.stringify(e,null,2),{mode:384})}function f(){let s=xt();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 ls=require("fs"),cs=require("fs/promises"),Ds=require("stream");var N=class extends Error{code;statusCode;exitCode;details;constructor(t,e){super(t),this.name="LimaiError",this.code=e.code,this.statusCode=e.statusCode,this.exitCode=e.exitCode??1,this.details=e.details}},Sn=class extends N{constructor(t,e){super(t,{code:"AUTH_ERROR",statusCode:401,exitCode:2,details:e}),this.name="AuthError"}},vn=class extends N{constructor(t,e){super(t,{code:"FORBIDDEN",statusCode:403,exitCode:2,details:e}),this.name="ForbiddenError"}},Tn=class extends N{constructor(t,e){super(t,{code:"NOT_FOUND",statusCode:404,exitCode:3,details:e}),this.name="NotFoundError"}},q=class extends N{constructor(t,e){super(t,{code:"VALIDATION_ERROR",statusCode:400,exitCode:4,details:e}),this.name="ValidationError"}},On=class extends N{constructor(t,e){super(t,{code:"CONFLICT",statusCode:409,exitCode:4,details:e}),this.name="ConflictError"}},Bn=class extends N{retryAfterMs;constructor(t,e){super(t,{code:"RATE_LIMITED",statusCode:429,exitCode:5}),this.name="RateLimitError",this.retryAfterMs=e}},Rn=class extends N{constructor(t,e=500,n){super(t,{code:"SERVER_ERROR",statusCode:e,exitCode:6,details:n}),this.name="ServerError"}},St=class extends N{constructor(t){super(t,{code:"TIMEOUT",exitCode:7}),this.name="TimeoutError"}},dt=class extends N{constructor(t,e){super(t,{code:"UPLOAD_ERROR",exitCode:8,details:e}),this.name="UploadError"}};function os(s,t,e){switch(s){case 400:return new q(t,e);case 401:return new Sn(t,e);case 403:return new vn(t,e);case 404:return new Tn(t,e);case 409:return new On(t,e);case 429:return new Bn(t);default:return s>=500?new Rn(t,s,e):new N(t,{code:"HTTP_ERROR",statusCode:s,details:e})}}var ga=3e4,$n=3,as=1e3,us=2;function Fa(){return process.env.LIMAI_DEBUG==="1"}function Wt(...s){Fa()&&console.error("[limai:http]",...s)}var me=class{baseUrl;token;constructor(t){this.baseUrl=t.apiUrl.replace(/\/$/,""),this.token=t.token}buildUrl(t,e){let n=new URL(`/api/v1${t}`,this.baseUrl);if(e)for(let[i,r]of Object.entries(e))r!=null&&n.searchParams.set(i,r);return n.toString()}authHeaders(){let t={Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},e=process.env.VERCEL_BYPASS;return e&&(t["x-vercel-protection-bypass"]=e),t}async parseErrorBody(t){try{let e=await t.json();return{message:typeof e.error=="string"?e.error:`HTTP ${t.status}`,details:e.details}}catch{return{message:await t.text().catch(()=>"")||`HTTP ${t.status}`}}}shouldRetry(t){return t===429||t>=500}getRetryDelay(t,e){let n=t.headers.get("Retry-After");if(n){let i=parseInt(n,10);if(!isNaN(i))return i*1e3}return as*Math.pow(us,e)}async request(t,e,n={}){let i=this.buildUrl(e,n.params),r=n.timeoutMs??ga;for(let o=0;o<=$n;o++){let a=new AbortController,u=setTimeout(()=>a.abort(),r);n.signal&&n.signal.addEventListener("abort",()=>a.abort());try{Wt(`${t} ${i}${o>0?` (retry ${o})`:""}`);let l=await fetch(i,{method:t,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(this.shouldRetry(l.status)&&o<$n){let m=this.getRetryDelay(l,o);Wt(`Retrying in ${m}ms (status ${l.status})`),await new Promise(F=>setTimeout(F,m));continue}let{message:c,details:D}=await this.parseErrorBody(l);throw os(l.status,c,D)}catch(l){if(clearTimeout(u),l instanceof N)throw l;if(l instanceof DOMException&&l.name==="AbortError"){if(o<$n){let c=as*Math.pow(us,o);Wt(`Timeout, retrying in ${c}ms`),await new Promise(D=>setTimeout(D,c));continue}throw new St(`Request timed out after ${r}ms: ${t} ${e}`)}throw new N(l instanceof Error?l.message:"Unknown network error",{code:"NETWORK_ERROR",exitCode:1})}}throw new N("Max retries exceeded",{code:"MAX_RETRIES",exitCode:1})}async get(t,e,n){return this.request("GET",t,{params:e,timeoutMs:n})}async post(t,e,n){return this.request("POST",t,{body:e,timeoutMs:n})}async patch(t,e){return this.request("PATCH",t,{body:e})}async del(t,e){return this.request("DELETE",t,{body:e})}async putRaw(t,e,n,i){let r=e instanceof Blob?e.size:e.length;Wt(`PUT ${t} (${r} bytes)`);let o=await fetch(t,{method:"PUT",headers:{"Content-Type":n},body:e});if(i&&i(r,r),!o.ok)throw new dt(`Upload failed: HTTP ${o.status}`)}async putFile(t,e,n,i){let r=(await(0,cs.stat)(e)).size;Wt(`PUT ${t} (${r} bytes, streamed from ${e})`);let o=(0,ls.createReadStream)(e),a=o;if(i){let l=0,c=new Ds.Transform({transform(D,m,F){l+=D.byteLength,i(l,r),F(null,D)}});a=o.pipe(c)}let u=await fetch(t,{method:"PUT",headers:{"Content-Type":n,"Content-Length":String(r)},body:a,duplex:"half"});if(i&&i(r,r),!u.ok)throw new dt(`Upload failed: HTTP ${u.status}`);return r}};var fe=class{constructor(t){this.http=t}http;async getUploadUrl(t,e,n){let i={filename:e,contentHash:n};return this.http.get(`/document/${t}/get-url`,i)}async processSync(t,e,n){return this.http.post(`/document/${t}/process-file/${e}`,n,18e4)}async processAsync(t,e,n){return this.http.post(`/document/${t}/process-file-async/${e}`,n)}async processFilesAsync(t,e,n){return this.http.post(`/document/${t}/process-files-async`,{fileIds:e,...n})}async getFileData(t,e){let n={fileId:t,extractionSchemaId:e};return this.http.get("/document/get-file-data",n)}async getFilesData(t,e){return this.http.get("/document/get-files-data",{fileIds:t.join(","),extractionSchemaId:e})}async submitCorrections(t,e,n){return this.http.post(`/document/${t}/process-file/${e}/submit-corrections`,n)}};var he=class{constructor(t){this.http=t}http;async list(){let t=await this.http.get("/projects");return Array.isArray(t)?t:t.data}async create(t){return this.http.post("/projects",t)}async getSchema(t){return this.http.get(`/projects/${t}/schema`)}async getSharedColumnIds(t){return this.http.get(`/projects/${t}/shared-column-ids`)}async listDeployments(t){return this.http.get(`/projects/${t}/deployments`)}async listBenchmarks(t){return this.http.get(`/projects/${t}/benchmarks`)}async listNotificationRoutes(t){return this.http.get(`/projects/${t}/notifications`)}async createNotificationRoute(t,e){return this.http.post(`/projects/${t}/notifications`,e)}async updateNotificationRoute(t,e,n){return this.http.patch(`/projects/${t}/notifications/${e}`,n)}async deleteNotificationRoute(t,e){return this.http.del(`/projects/${t}/notifications/${e}`)}async listNotificationIntegrations(t,e){return this.http.get(`/projects/${t}/notifications/integrations`,{provider:e})}async listNotificationSlackChannels(t,e){return this.http.get(`/projects/${t}/notifications/integrations/slack/channels`,{connectionId:e})}async listNotificationTeamsTeams(t,e){return this.http.get(`/projects/${t}/notifications/integrations/teams/teams`,{connectionId:e})}async listNotificationTeamsChannels(t,e,n){return this.http.get(`/projects/${t}/notifications/integrations/teams/channels`,{connectionId:e,teamId:n})}};var ge=class{constructor(t){this.http=t}http;async list(t,e){let n={status:e?.status,type:e?.type},i=await this.http.get(`/projects/${t}/deployments`,n);return Array.isArray(i)?i:i.data}async create(t,e){return this.http.post(`/projects/${t}/deployments`,e)}async getConfig(t){return this.http.get(`/deployments/${t}/configuration`)}async updateConfig(t,e){await this.http.patch(`/deployment/${t}/configuration`,e)}async listDocuments(t,e){let n={limit:e?.limit?.toString(),offset:e?.offset?.toString(),status:e?.status};return this.http.get(`/deployments/${t}/documents`,n)}async getDocument(t,e){return this.http.get(`/deployments/${t}/documents/${e}`)}async deleteDocument(t,e){await this.http.del(`/deployments/${t}/documents/${e}`)}async bulkDelete(t,e){await this.http.del(`/deployments/${t}/documents/bulk-delete`,{fileIds:e})}};var Fe=class{constructor(t){this.http=t}http;async get(t){return this.http.get(`/tables/${t}`)}async listColumns(t){let e=await this.http.get(`/tables/${t}/columns`);return Array.isArray(e)?e:e.data}async listRows(t,e){let n={limit:e?.limit?.toString(),offset:e?.offset?.toString(),status:e?.status};return this.http.get(`/tables/${t}/rows`,n)}async createRows(t,e){return this.http.post(`/tables/${t}/rows`,e,6e4)}async deleteRows(t,e){return this.http.del(`/tables/${t}/rows`,e)}async createTable(t,e){return this.http.post(`/deployments/${t}/tables`,e)}async update(t,e){return this.http.patch(`/tables/${t}`,e)}};async function*ds(s,t={}){let e=Math.min(t.pageSize??100,500),n=0,i=0;for(;;){let r=t.maxItems?Math.min(e,t.maxItems-i):e;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)||t.maxItems&&i>=t.maxItems)break}}async function*ps(s,t={}){let e=Math.min(t.pageSize??100,500),n=1,i=0;for(;;){let r=t.maxItems?Math.min(e,t.maxItems-i):e;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)||t.maxItems&&i>=t.maxItems)break}}async function Ce(s){let t=[];for await(let e of s)t.push(...e);return t}var Ee=class{constructor(t){this.http=t}http;async getRows(t,e){let n={page:e?.page?.toString(),limit:e?.limit?.toString(),order:e?.order,status:e?.status};return this.http.get(`/extractions/${t}`,n)}async*getAllRows(t,e){yield*ps(async(n,i)=>this.http.get(`/extractions/${t}`,{page:n.toString(),limit:i.toString(),order:e?.order,status:e?.status}),e)}async collectAllRows(t,e){return Ce(this.getAllRows(t,e))}};var ye=class{constructor(t){this.http=t}http;async getStatus(t){return this.http.get(`/queue/${t}/status`)}async cancel(t){await this.http.post("/queue/cancel",{jobId:t})}async updateStatus(t,e){return this.http.patch(`/queue/${t}/status`,e)}};var be=class{constructor(t){this.http=t}http;async list(t){return this.http.get("/classify",{projectId:t})}async getUploadUrl(t,e){return this.http.get(`/classify/${t}/get-url`,{filename:e})}async classify(t,e){return this.http.post(`/classify/${t}`,{fileId:e})}async classifyAsync(t,e){return this.http.post(`/classify/${t}/async`,{fileId:e})}async getStatus(t,e){return this.http.get(`/classify/${t}`,{classificationId:e})}async createClassifier(t){return this.http.post("/classify",t)}async createRoute(t,e){return this.http.post(`/classify/${t}/routes`,e)}};var we=class{constructor(t){this.http=t}http;async list(t){return this.http.get("/split",{projectId:t})}async getUploadUrl(t,e){return this.http.get(`/split/${t}/get-url`,{filename:e})}async split(t,e){return this.http.post(`/split/${t}`,{fileId:e})}async splitAsync(t,e){return this.http.post(`/split/${t}/async`,{fileId:e})}async getStatus(t,e){return this.http.get(`/split/${t}`,{splitId:e})}async listSplits(t){return this.http.get(`/split/${t}/splits`)}async createSplitter(t){return this.http.post("/split",t)}};var Ae=class{constructor(t){this.http=t}http;async get(t){return this.http.get(`/extraction-schema/${t}`)}async update(t,e){await this.http.patch(`/extraction-schema/${t}`,e)}async getAllData(t){return this.http.get("/extraction-schema/get-all-data",{extractionSchemaId:t})}};var _e=class{constructor(t){this.http=t}http;async list(t){return this.http.get(`/projects/${t}/buckets`)}async get(t){return this.http.get(`/buckets/${t}`)}async create(t,e,n){return this.http.post(`/projects/${t}/buckets`,{name:e,description:n})}async delete(t){await this.http.del(`/buckets/${t}`)}async getUploadUrl(t,e){return this.http.get(`/buckets/${t}/get-url`,{filename:e})}async confirmUpload(t,e,n){await this.http.patch(`/buckets/${t}/files/${e}/status`,{status:"UPLOADED",...n!==void 0&&{sizeBytes:n}})}async listFiles(t,e){let n={};return e&&e.length>0&&(n.labels=e.join(",")),this.http.get(`/buckets/${t}/files`,n)}async getDownloadUrl(t,e){return this.http.get(`/buckets/${t}/files/${e}/download`)}async updateLabels(t,e,n){return this.http.patch(`/buckets/${t}/files/${e}`,{labels:n})}async deleteFile(t,e){await this.http.del(`/buckets/${t}/files/${e}`)}async sendTo(t,e,n,i){return this.http.post(`/buckets/${t}/files/${e}/send-to`,{targetType:n,targetId:i})}};var Ie=class{constructor(t){this.http=t}http;async list(t,e){let n={};return e?.status&&(n.status=e.status),this.http.get(`/projects/${t}/agents`,n)}async get(t,e){return this.http.get(`/projects/${t}/agents/${e}`)}async create(t,e){return this.http.post(`/projects/${t}/agents`,e)}async update(t,e,n){return this.http.patch(`/projects/${t}/agents/${e}`,n)}async delete(t,e){await this.http.del(`/projects/${t}/agents/${e}`)}async getFileUploadUrl(t,e,n){return this.http.get(`/projects/${t}/agents/${e}/files/get-url`,{filename:n})}async deleteFile(t,e,n){await this.http.del(`/projects/${t}/agents/${e}/files/${n}`)}async updateFileMetadata(t,e,n,i){return this.http.patch(`/projects/${t}/agents/${e}/files/${n}`,i)}async getFileDownloadUrl(t,e,n){return this.http.get(`/projects/${t}/agents/${e}/files/${n}/download`)}async listSkills(t,e){return this.http.get(`/projects/${t}/agents/${e}/skills`)}async createSkill(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/skills`,n)}async updateSkill(t,e,n,i){return this.http.patch(`/projects/${t}/agents/${e}/skills/${n}`,i)}async deleteSkill(t,e,n){await this.http.del(`/projects/${t}/agents/${e}/skills/${n}`)}async linkFileToSkill(t,e,n,i){return this.http.post(`/projects/${t}/agents/${e}/skills/${n}/files`,{fileId:i})}async unlinkFileFromSkill(t,e,n,i){await this.http.del(`/projects/${t}/agents/${e}/skills/${n}/files/${i}`)}async listRuns(t,e,n){let i={};return n?.limit&&(i.limit=String(n.limit)),n?.status&&(i.status=n.status),this.http.get(`/projects/${t}/agents/${e}/runs`,i)}async getRun(t,e,n){return this.http.get(`/projects/${t}/agents/${e}/runs/${n}`)}async getRunConversation(t,e,n,i){let r={};return i?.stepId&&(r.stepId=i.stepId),this.http.get(`/projects/${t}/agents/${e}/runs/${n}/conversation`,r)}async createRun(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/runs`,n)}async createStep(t,e,n,i){return this.http.post(`/projects/${t}/agents/${e}/runs/${n}/steps`,i)}async updateRun(t,e,n,i){return this.http.patch(`/projects/${t}/agents/${e}/runs/${n}`,i)}async updateStep(t,e,n,i,r){return this.http.patch(`/projects/${t}/agents/${e}/runs/${n}/steps/${i}`,r)}async updateStepConditions(t,e,n,i,r){return this.http.patch(`/projects/${t}/agents/${e}/runs/${n}/steps/${i}`,{conditions:r})}async pauseRun(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/runs/${n}/pause`,{})}async submitStepAction(t,e,n,i,r){return this.http.post(`/projects/${t}/agents/${e}/runs/${n}/steps/${i}/action`,r)}async sendEmail(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/send-email`,n)}async completeExecution(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/executions/complete`,n)}async getSharePointToken(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/sharepoint-token`,n)}async getArtifactUploadUrl(t,e,n){return this.http.post(`/projects/${t}/agents/${e}/upload-artifact/get-url`,n)}};var xe=class{constructor(t){this.http=t}http;async ask(t,e){return this.http.post(`/projects/${t}/vision/ask`,e,12e4)}};var Se=class{constructor(t){this.http=t}http;async submit(t,e,n){return this.http.post(`/document/${t}/process-file/${e}/submit-validation`,n)}};var ve=class{constructor(t){this.http=t}http;async list(t,e){let n={};return e?.entityType&&(n.entityType=e.entityType),this.http.get(`/projects/${t}/labels`,n)}async addRemove(t,e,n,i,r){return this.http.post(`/projects/${t}/labels`,{entityType:e,entityId:n,add:i,remove:r})}async search(t,e){let n={};return e?.entityType&&(n.entityType=e.entityType),e?.labels&&(n.labels=e.labels),e?.key&&(n.key=e.key),this.http.get(`/projects/${t}/labels/search`,n)}};var Te=A(require("fs")),vt=A(require("path"));var ms=A(require("fs")),fs=A(require("crypto"));async function hs(s){return new Promise((t,e)=>{let n=fs.createHash("sha256"),i=ms.createReadStream(s);i.on("data",r=>n.update(r)),i.on("end",()=>t(n.digest("hex"))),i.on("error",e)})}var Ca={".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 Ea(s){let t=vt.extname(s).toLowerCase();return Ca[t]||"application/octet-stream"}async function Oe(s,t,e,n,i){let r=vt.resolve(n),o=vt.basename(r);if(!Te.existsSync(r))throw new dt(`File not found: ${r}`);if(!Te.statSync(r).isFile())throw new dt(`Not a file: ${r}`);let u=await hs(r),l=await t.getUploadUrl(e,o,u);if(l.isDuplicate)return{fileId:l.fileId,filename:l.fileName??o,isDuplicate:!0,bytesUploaded:0};let c=Ea(r),D=await s.putFile(l.url,r,c,i);return{fileId:l.fileId,filename:l.fileName??o,isDuplicate:!1,bytesUploaded:D}}var Tt=A(require("fs")),Ot=A(require("path"));var Fs=A(require("path"));var gs=250,ya=5,kn=class{constructor(t){this.max=t}max;queue=[];current=0;async acquire(){if(this.current<this.max){this.current++;return}return new Promise(t=>{this.queue.push(t)})}release(){this.current--;let t=this.queue.shift();t&&(this.current++,t())}};async function Cs(s,t,e,n,i){let r=Math.min(i?.concurrency??ya,10),o=new kn(r),a=n.map(m=>({path:m,filename:Fs.basename(m),status:"pending"})),u=a.map(async(m,F)=>{await o.acquire();try{m.status="uploading",i?.onFileStatus?.(m);let g=await Oe(s,t,e,m.path);m.fileId=g.fileId,m.status="uploaded",i?.onFileStatus?.(m)}catch(g){m.status="failed",m.error=g instanceof Error?g.message:String(g),i?.onFileStatus?.(m)}finally{o.release()}});if(await Promise.all(u),i?.process){let F=a.filter(g=>g.status==="uploaded"&&g.fileId).map(g=>g.fileId);for(let g=0;g<F.length;g+=gs){let T=F.slice(g,g+gs);try{let B=await t.processFilesAsync(e,T,i.processOptions);for(let[E,C]of Object.entries(B.results)){let I=a.find(J=>J.fileId===E);I&&(C.status==="queued"?(I.status="queued",I.jobId=C.jobId):(I.status="failed",I.error=C.error),i?.onFileStatus?.(I))}}catch(B){for(let E of T){let C=a.find(I=>I.fileId===E);C&&(C.status="failed",C.error=B instanceof Error?B.message:String(B),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 ba=new Set([".pdf",".png",".jpg",".jpeg",".tiff",".tif",".xlsx",".xls",".csv",".docx",".doc"]);function Es(s,t){let e=[],n=Tt.readdirSync(s,{withFileTypes:!0});for(let i of n){let r=Ot.join(s,i.name);if(!i.name.startsWith(".")){if(i.isDirectory())e.push(...Es(r,t));else if(i.isFile()){let o=Ot.extname(i.name).toLowerCase();if(!ba.has(o)||t&&!wa(i.name,t))continue;e.push(r)}}}return e.sort()}function wa(s,t){let e=t.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${e}$`,"i").test(s)}async function ys(s,t,e,n,i){let r=Ot.resolve(n);if(!Tt.existsSync(r))throw new Error(`Directory not found: ${r}`);if(!Tt.statSync(r).isDirectory())throw new Error(`Not a directory: ${r}`);let a=Es(r,i?.globPattern);return a.length===0?{total:0,uploaded:0,queued:0,failed:0,files:[]}:Cs(s,t,e,a,{concurrency:i?.concurrency,process:i?.process,processOptions:i?.processOptions,onFileStatus:i?.onFileStatus})}var Aa=1e3,_a=1e4,Ia=1.5,xa=3e5,Sa=["COMPLETED","FAILED","STALLED"],X=class{constructor(t){this.queue=t}queue;async*poll(t,e){let n=e?.intervalMs??Aa,i=e?.maxIntervalMs??_a,r=e?.backoffMultiplier??Ia,o=e?.timeoutMs??xa,a=n,u=Date.now(),l;for(;;){if(Date.now()-u>o)throw new St(`Polling timed out after ${Math.round(o/1e3)}s for job ${t}`);let c=await this.queue.getStatus(t);if(c.status!==l&&(l=c.status,e?.onStatus?.(c),yield c),Sa.includes(c.status))return;await new Promise(D=>setTimeout(D,a)),a=Math.min(a*r,i)}}async waitForCompletion(t,e){let n;for await(let i of this.poll(t,e))n=i;if(!n)throw new Error(`No status received for job ${t}`);return n}};var h=class{http;documents;projects;deployments;tables;extractions;queue;classify;split;schema;buckets;agents;vision;validations;labels;constructor(t){this.http=new me({apiUrl:t.apiUrl,token:t.token}),this.documents=new fe(this.http),this.projects=new he(this.http),this.deployments=new ge(this.http),this.tables=new Fe(this.http),this.extractions=new Ee(this.http),this.queue=new ye(this.http),this.classify=new be(this.http),this.split=new we(this.http),this.schema=new Ae(this.http),this.buckets=new _e(this.http),this.agents=new Ie(this.http),this.vision=new xe(this.http),this.validations=new Se(this.http),this.labels=new ve(this.http)}async uploadFile(t,e,n){return Oe(this.http,this.documents,t,e,n)}async uploadFolder(t,e,n){return ys(this.http,this.documents,t,e,n)}async processAndWait(t,e,n){let i=await this.documents.processAsync(t,e,n?.processOptions),r=new X(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 ${e}${o?`: ${o.status}`:""}`);return this.documents.getFileData(e,t)}async*downloadAll(t,e){yield*this.extractions.getAllRows(t,e)}};function O(s,t){if(d()){p(s);return}if(s.length===0){console.log("\x1B[2mNo results.\x1B[0m");return}let e=t||Object.keys(s[0]),n={};for(let r of e)n[r]=r.length;for(let r of s)for(let o of e){let a=String(r[o]??"");n[o]=Math.max(n[o],Math.min(a.length,60))}let i=e.map(r=>`\x1B[1m${r.padEnd(n[r])}\x1B[0m`).join(" ");console.log(i),console.log(e.map(r=>"\u2500".repeat(n[r])).join(" "));for(let r of s){let o=e.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(d()){p(s);return}let t=Math.max(...Object.keys(s).map(e=>e.length));for(let[e,n]of Object.entries(s)){let i=`\x1B[1m${e.padEnd(t)}\x1B[0m`,r=typeof n=="object"&&n!==null?JSON.stringify(n):String(n??"");console.log(`${i} ${r}`)}}var As=require("child_process"),_s=require("crypto"),Is=require("http"),bs=9768,ws=9780,va=12e4;function Ta(){return(0,_s.randomBytes)(32).toString("hex")}function Oa(s){let t=process.platform,e=t==="darwin"?`open "${s}"`:t==="win32"?`start "" "${s}"`:`xdg-open "${s}"`;try{return(0,As.exec)(e),!0}catch{return!1}}function Ba(){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,32 +34,32 @@ Expecting one of '${n.join("', '")}'`);let i=`${t}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 ya(s){return new Promise((t,e)=>{let n,i=new Promise(u=>{n=u}),r=(0,bs.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"),p=c.searchParams.get("token");if(D!==s){l.writeHead(403).end("Invalid state parameter");return}if(!p){l.writeHead(400).end("Missing token");return}n(p),l.writeHead(200,{"Content-Type":"text/html"}).end(Ea())}),o=Fs,a=()=>{r.listen(o,"127.0.0.1")};r.on("listening",()=>{t({port:o,tokenPromise:i,stop:()=>{r.closeAllConnections?.(),r.close()}})}),r.on("error",u=>{if(u.code!=="EADDRINUSE"){e(u);return}if(o++,o>Cs){e(new Error(`Could not start local server. All ports ${Fs}-${Cs} are in use.`));return}a()}),a()})}async function ws(s){let t=Fa(),{port:e,tokenPromise:n,stop:i}=await ya(t),r=()=>{i(),process.exit(130)};process.on("SIGINT",r);let o=`${s}/cli-auth?state=${t}&port=${e}`;Ca(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.")),ga))])}}finally{process.removeListener("SIGINT",r),i()}}function Bn(s){let t=Rn.createInterface({input:process.stdin,output:process.stderr});return new Promise(e=>{t.question(s,n=>{t.close(),e(n.trim())})})}function ba(s){return new Promise(t=>{let e=Rn.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");o===`
39
- `||o==="\r"?(process.stdin.isTTY&&process.stdin.setRawMode(!1),process.stdin.pause(),process.stdin.removeListener("data",i),process.stderr.write(`
40
- `),e.close(),t(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 As(s){let t=s.command("auth").description("Authentication management");t.command("login").description("Authenticate with LimAI").option("--no-browser","Skip browser login, paste token manually").action(async n=>{if(process.stdin.isTTY&&n.browser){let o=await Bn("API URL (https://app.limai.ai): ")||"https://app.limai.ai";if(await Bn(`How would you like to authenticate?
37
+ </html>`}function Ra(s){return new Promise((t,e)=>{let n,i=new Promise(u=>{n=u}),r=(0,Is.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(Ba())}),o=bs,a=()=>{r.listen(o,"127.0.0.1")};r.on("listening",()=>{t({port:o,tokenPromise:i,stop:()=>{r.closeAllConnections?.(),r.close()}})}),r.on("error",u=>{if(u.code!=="EADDRINUSE"){e(u);return}if(o++,o>ws){e(new Error(`Could not start local server. All ports ${bs}-${ws} are in use.`));return}a()}),a()})}async function xs(s){let t=Ta(),{port:e,tokenPromise:n,stop:i}=await Ra(t),r=()=>{i(),process.exit(130)};process.on("SIGINT",r);let o=`${s}/cli-auth?state=${t}&port=${e}`;Oa(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.")),va))])}}finally{process.removeListener("SIGINT",r),i()}}var Ss="https://app.limai.io";function $a(s){let t=Pn.createInterface({input:process.stdin,output:process.stderr});return new Promise(e=>{t.question(s,n=>{t.close(),e(n.trim())})})}function vs(s){return new Promise(t=>{let e=Pn.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
+ `),e.close(),t(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 Ts(s){let t=s.command("auth").description("Authentication management");t.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||Ss;if(o!==Ss&&P(`Using API URL override: ${o}`),r){let a=await $a(`How would you like to authenticate?
41
40
  [1] Log in with browser (default)
42
- [2] Paste a token manually
43
- Choice: `)==="2"){await e(o);return}V("Opening browser for authentication...");try{let{token:u}=await ws(o);xt({apiUrl:o,token:u}),b("Authenticated successfully. Credentials saved to ~/.limai/config.json")}catch(u){S({code:"AUTH",message:u instanceof Error?u.message:"Browser login failed"}),V("Try again with: limai auth login --no-browser"),process.exit(1)}}else{let r=await Bn("API URL (e.g. https://app.limai.ai): ");await e(r)}});async function e(n){let i=await ba("API Token: ");(!n||!i)&&(S({code:"VALIDATION",message:"Both API URL and token are required."}),process.exit(1)),xt({apiUrl:n,token:i}),b("Credentials saved to ~/.limai/config.json")}t.command("logout").description("Clear stored credentials").action(()=>{xt({apiUrl:"",token:""}),b("Credentials cleared.")}),t.command("status").description("Verify authentication").action(async()=>{let n=It();n||(S({code:"AUTH",message:"Not authenticated. Run `limai auth login` first."}),process.exit(1));let i=new h(n);try{await i.http.get("/health"),d()?m({status:"ok",apiUrl:n.apiUrl}):w({status:"Authenticated",apiUrl:n.apiUrl})}catch(r){S({code:"AUTH",message:r instanceof Error?r.message:"Authentication failed"}),process.exit(2)}})}var xs=A(require("fs")),Ss=A(require("path"));var Pn=["EXTRACTION_COMPLETED","DOCUMENT_REVIEWED","CONTEXT_DOCUMENT_NEEDS_REVIEW","INTEGRATION_FILE_UPLOADED","AGENT_RUN_WAITING_HUMAN","AGENT_RUN_COMPLETED"],$n=["SLACK","TEAMS_CHANNEL","TEAMS_CHAT","EMAIL_ADDRESS"],kn=["SLACK","TEAMS","SHAREPOINT","GOOGLE_DRIVE"];function _s(s){let t=s.split(",").map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new Error("--events must list at least one event");let e=t.filter(n=>!Pn.includes(n));if(e.length>0)throw new Error(`Unknown event(s): ${e.join(", ")}. Valid: ${Pn.join(", ")}`);return t}function Is(s){let t=s.destinationFile?xs.readFileSync(Ss.resolve(s.destinationFile),"utf-8"):s.destinationJson;if(!t)throw new Error("Provide --destination-json or --destination-file");let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("destination must be a JSON object");return e}function wa(s){let t=s.command("notifications").description("Project notification channels (Slack / Teams / email event routes)");t.command("integrations <projectId>").description("List connected integrations for the project").option("--provider <provider>",`Filter by provider (${kn.join(", ")})`).action(async(e,n)=>{if(n.provider&&!kn.includes(n.provider))throw new Error(`Unknown provider. Valid: ${kn.join(", ")}`);let r=await new h(f()).projects.listNotificationIntegrations(e,n.provider);d()?m(r):O(r,["id","provider","tenantName","tenantId"])}),t.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(e,n)=>{let i=new h(f());if(n.teamId){let a=await i.projects.listNotificationTeamsChannels(e,n.connectionId,n.teamId);d()?m(a):O(a,["id","displayName","membershipType"]);return}let r=await i.projects.listNotificationSlackChannels(e,n.connectionId).catch(()=>null);if(r){d()?m(r):O(r,["id","name","isPrivate"]);return}let o=await i.projects.listNotificationTeamsTeams(e,n.connectionId);d()?m(o):O(o,["id","displayName"])}),t.command("list <projectId>").description("List notification routes for the project").action(async e=>{let i=await new h(f()).projects.listNotificationRoutes(e);d()?m(i):O(i,["id","channelType","destinationLabel","subscribedEvents","deploymentId","agentId","enabled"])}),t.command("create <projectId>").description("Create a notification route").requiredOption("--channel-type <type>",$n.join(" | ")).requiredOption("--events <events>",`Comma-separated events (${Pn.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(e,n)=>{if(!$n.includes(n.channelType))throw new Error(`Unknown channel type. Valid: ${$n.join(", ")}`);let i={channelType:n.channelType,subscribedEvents:_s(n.events),destination:Is(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 h(f()).projects.createNotificationRoute(e,i);d()?m(o):(b("Notification route created."),w(o))}),t.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(e,n,i)=>{let r={...i.events!==void 0&&{subscribedEvents:_s(i.events)},...i.connectionId!==void 0&&{connectionId:i.connectionId===""?null:i.connectionId},...(i.destinationJson!==void 0||i.destinationFile!==void 0)&&{destination:Is(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 h(f()).projects.updateNotificationRoute(e,n,r);d()?m(a):(b("Notification route updated."),w(a))}),t.command("delete <projectId> <routeId>").description("Delete a notification route").action(async(e,n)=>{await new h(f()).projects.deleteNotificationRoute(e,n),d()?m({success:!0}):b("Notification route deleted.")})}function Ts(s){let t=s.command("projects").description("Project management");t.command("list").description("List projects").action(async()=>{let n=await new h(f()).projects.list();d()?m(n):O(n,["id","name","icon","createdAt"])}),t.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 e=>{let i=await new h(f()).projects.create({name:e.name,teamId:e.teamId,icon:e.icon});d()?m(i):(b("Project created."),w(i))}),t.command("schema <projectId>").description("Get the extraction schema for a project").action(async e=>{let i=await new h(f()).projects.getSchema(e);d()?m(i):w(i)}),wa(t)}var jn=A(require("fs"));function vs(s){let t=s.command("deployments").description("Deployment management");t.command("list <projectId>").description("List deployments for a project").option("--status <status>","Filter by status").option("--type <type>","Filter by type").action(async(e,n)=>{let r=await new h(f()).deployments.list(e,n);d()?m(r):O(r,["id","name","type","status","createdAt"])}),t.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(e,n)=>{let i=new h(f()),r;if(n.tablesFile){let a=jn.readFileSync(n.tablesFile,"utf-8");r=JSON.parse(a)}let o=await i.deployments.create(e,{name:n.name,type:n.type,tables:r});d()?m(o):(b("Deployment created."),w(o))}),t.command("config <deploymentId>").description("Get deployment configuration").action(async e=>{let i=await new h(f()).deployments.getConfig(e);d()?m(i):w(i)}),t.command("update <deploymentId>").description("Update deployment configuration").requiredOption("--body <file>","JSON file with configuration updates").action(async(e,n)=>{let i=new h(f()),r=jn.readFileSync(n.body,"utf-8"),o=JSON.parse(r);await i.deployments.updateConfig(e,o),d()?m({success:!0}):b("Deployment configuration updated.")}),t.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(e,n)=>{let r=await new h(f()).deployments.listDocuments(e,{limit:parseInt(n.limit),offset:parseInt(n.offset),status:n.status});d()?m(r):O(r.data,["id","name","status","createdAt"])})}var Ue=A(require("fs")),qe=A(require("path"));var Qt=A(require("process"),1);var Os=(s=0)=>t=>`\x1B[${t+s}m`,Bs=(s=0)=>t=>`\x1B[${38+s};5;${t}m`,Rs=(s=0)=>(t,e,n)=>`\x1B[${38+s};2;${t};${e};${n}m`,N={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]}},Mc=Object.keys(N.modifier),Aa=Object.keys(N.color),_a=Object.keys(N.bgColor),Uc=[...Aa,..._a];function Ia(){let s=new Map;for(let[t,e]of Object.entries(N)){for(let[n,i]of Object.entries(e))N[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},e[n]=N[n],s.set(i[0],i[1]);Object.defineProperty(N,t,{value:e,enumerable:!1})}return Object.defineProperty(N,"codes",{value:s,enumerable:!1}),N.color.close="\x1B[39m",N.bgColor.close="\x1B[49m",N.color.ansi=Os(),N.color.ansi256=Bs(),N.color.ansi16m=Rs(),N.bgColor.ansi=Os(10),N.bgColor.ansi256=Bs(10),N.bgColor.ansi16m=Rs(10),Object.defineProperties(N,{rgbToAnsi256:{value(t,e,n){return t===e&&e===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(e/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let e=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!e)return[0,0,0];let[n]=e;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:t=>N.rgbToAnsi256(...N.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let e,n,i;if(t>=232)e=((t-232)*10+8)/255,n=e,i=e;else{t-=16;let a=t%36;e=Math.floor(t/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let r=Math.max(e,n,i)*2;if(r===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(e));return r===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(t,e,n)=>N.ansi256ToAnsi(N.rgbToAnsi256(t,e,n)),enumerable:!1},hexToAnsi:{value:t=>N.ansi256ToAnsi(N.hexToAnsi256(t)),enumerable:!1}}),N}var xa=Ia(),et=xa;var Oe=A(require("process"),1),ks=A(require("os"),1),Nn=A(require("tty"),1);function Z(s,t=globalThis.Deno?globalThis.Deno.args:Oe.default.argv){let e=s.startsWith("-")?"":s.length===1?"-":"--",n=t.indexOf(e+s),i=t.indexOf("--");return n!==-1&&(i===-1||n<i)}var{env:L}=Oe.default,ve;Z("no-color")||Z("no-colors")||Z("color=false")||Z("color=never")?ve=0:(Z("color")||Z("colors")||Z("color=true")||Z("color=always"))&&(ve=1);function Sa(){if("FORCE_COLOR"in L)return L.FORCE_COLOR==="true"?1:L.FORCE_COLOR==="false"?0:L.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(L.FORCE_COLOR,10),3)}function Ta(s){return s===0?!1:{level:s,hasBasic:!0,has256:s>=2,has16m:s>=3}}function va(s,{streamIsTTY:t,sniffFlags:e=!0}={}){let n=Sa();n!==void 0&&(ve=n);let i=e?ve:n;if(i===0)return 0;if(e){if(Z("color=16m")||Z("color=full")||Z("color=truecolor"))return 3;if(Z("color=256"))return 2}if("TF_BUILD"in L&&"AGENT_NAME"in L)return 1;if(s&&!t&&i===void 0)return 0;let r=i||0;if(L.TERM==="dumb")return r;if(Oe.default.platform==="win32"){let o=ks.default.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in L)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(o=>o in L)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(o=>o in L)||L.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in L)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(L.TEAMCITY_VERSION)?1:0;if(L.COLORTERM==="truecolor"||L.TERM==="xterm-kitty"||L.TERM==="xterm-ghostty"||L.TERM==="wezterm")return 3;if("TERM_PROGRAM"in L){let o=Number.parseInt((L.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(L.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(L.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(L.TERM)||"COLORTERM"in L?1:r}function $s(s,t={}){let e=va(s,{streamIsTTY:s&&s.isTTY,...t});return Ta(e)}var Oa={stdout:$s({isTTY:Nn.default.isatty(1)}),stderr:$s({isTTY:Nn.default.isatty(2)})},Ps=Oa;function js(s,t,e){let n=s.indexOf(t);if(n===-1)return s;let i=t.length,r=0,o="";do o+=s.slice(r,n)+t+e,r=n+i,n=s.indexOf(t,r);while(n!==-1);return o+=s.slice(r),o}function Ns(s,t,e,n){let i=0,r="";do{let o=s[n-1]==="\r";r+=s.slice(i,o?n-1:n)+t+(o?`\r
41
+ [2] Log in with a browser on another device
42
+ [3] Paste a token manually
43
+ Choice: `);if(a==="2"){await e(o);return}if(a==="3"){await n(o);return}P("Opening browser for authentication...");try{let{token:u}=await xs(o);ft({apiUrl:o,token:u}),b("Authenticated successfully. Credentials saved to ~/.limai/config.json")}catch(u){x({code:"AUTH",message:u instanceof Error?u.message:"Browser login failed"}),P("If this terminal has no browser, run `limai auth login` again and choose option 2."),process.exit(1)}}else await n(o)});async function e(i){P("Open this URL in a browser on any device:"),P(` ${i}/cli-auth?mode=remote`),P("After authorizing, a code will be shown.");let r=await vs("Paste the code here: ");r||(x({code:"VALIDATION",message:"No code entered."}),process.exit(1));let o=new h({apiUrl:i,token:r});try{await o.http.get("/health")}catch{x({code:"AUTH",message:"The code could not be verified. Make sure you copied it completely and try again."}),process.exit(1)}ft({apiUrl:i,token:r}),b("Authenticated successfully. Credentials saved to ~/.limai/config.json")}async function n(i){let r=await vs("API Token: ");r||(x({code:"VALIDATION",message:"API token is required."}),process.exit(1)),ft({apiUrl:i,token:r}),b("Credentials saved to ~/.limai/config.json")}t.command("logout").description("Clear stored credentials").action(()=>{ft({apiUrl:"",token:""}),b("Credentials cleared.")}),t.command("status").description("Verify authentication").action(async()=>{let i=xt();i||(x({code:"AUTH",message:"Not authenticated. Run `limai auth login` first."}),process.exit(1));let r=new h(i);try{await r.http.get("/health"),d()?p({status:"ok",apiUrl:i.apiUrl}):w({status:"Authenticated",apiUrl:i.apiUrl})}catch(o){x({code:"AUTH",message:o instanceof Error?o.message:"Authentication failed"}),process.exit(2)}})}var Rs=A(require("fs")),$s=A(require("path"));var Ln=["EXTRACTION_COMPLETED","DOCUMENT_REVIEWED","CONTEXT_DOCUMENT_NEEDS_REVIEW","INTEGRATION_FILE_UPLOADED","AGENT_RUN_WAITING_HUMAN","AGENT_RUN_COMPLETED"],jn=["SLACK","TEAMS_CHANNEL","TEAMS_CHAT","EMAIL_ADDRESS"],Nn=["SLACK","TEAMS","SHAREPOINT","GOOGLE_DRIVE"];function Os(s){let t=s.split(",").map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new Error("--events must list at least one event");let e=t.filter(n=>!Ln.includes(n));if(e.length>0)throw new Error(`Unknown event(s): ${e.join(", ")}. Valid: ${Ln.join(", ")}`);return t}function Bs(s){let t=s.destinationFile?Rs.readFileSync($s.resolve(s.destinationFile),"utf-8"):s.destinationJson;if(!t)throw new Error("Provide --destination-json or --destination-file");let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("destination must be a JSON object");return e}function ka(s){let t=s.command("notifications").description("Project notification channels (Slack / Teams / email event routes)");t.command("integrations <projectId>").description("List connected integrations for the project").option("--provider <provider>",`Filter by provider (${Nn.join(", ")})`).action(async(e,n)=>{if(n.provider&&!Nn.includes(n.provider))throw new Error(`Unknown provider. Valid: ${Nn.join(", ")}`);let r=await new h(f()).projects.listNotificationIntegrations(e,n.provider);d()?p(r):O(r,["id","provider","tenantName","tenantId"])}),t.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(e,n)=>{let i=new h(f());if(n.teamId){let a=await i.projects.listNotificationTeamsChannels(e,n.connectionId,n.teamId);d()?p(a):O(a,["id","displayName","membershipType"]);return}let r=await i.projects.listNotificationSlackChannels(e,n.connectionId).catch(()=>null);if(r){d()?p(r):O(r,["id","name","isPrivate"]);return}let o=await i.projects.listNotificationTeamsTeams(e,n.connectionId);d()?p(o):O(o,["id","displayName"])}),t.command("list <projectId>").description("List notification routes for the project").action(async e=>{let i=await new h(f()).projects.listNotificationRoutes(e);d()?p(i):O(i,["id","channelType","destinationLabel","subscribedEvents","deploymentId","agentId","enabled"])}),t.command("create <projectId>").description("Create a notification route").requiredOption("--channel-type <type>",jn.join(" | ")).requiredOption("--events <events>",`Comma-separated events (${Ln.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(e,n)=>{if(!jn.includes(n.channelType))throw new Error(`Unknown channel type. Valid: ${jn.join(", ")}`);let i={channelType:n.channelType,subscribedEvents:Os(n.events),destination:Bs(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 h(f()).projects.createNotificationRoute(e,i);d()?p(o):(b("Notification route created."),w(o))}),t.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(e,n,i)=>{let r={...i.events!==void 0&&{subscribedEvents:Os(i.events)},...i.connectionId!==void 0&&{connectionId:i.connectionId===""?null:i.connectionId},...(i.destinationJson!==void 0||i.destinationFile!==void 0)&&{destination:Bs(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 h(f()).projects.updateNotificationRoute(e,n,r);d()?p(a):(b("Notification route updated."),w(a))}),t.command("delete <projectId> <routeId>").description("Delete a notification route").action(async(e,n)=>{await new h(f()).projects.deleteNotificationRoute(e,n),d()?p({success:!0}):b("Notification route deleted.")})}function ks(s){let t=s.command("projects").description("Project management");t.command("list").description("List projects").action(async()=>{let n=await new h(f()).projects.list();d()?p(n):O(n,["id","name","icon","createdAt"])}),t.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 e=>{let i=await new h(f()).projects.create({name:e.name,teamId:e.teamId,icon:e.icon});d()?p(i):(b("Project created."),w(i))}),t.command("schema <projectId>").description("Get the extraction schema for a project").action(async e=>{let i=await new h(f()).projects.getSchema(e);d()?p(i):w(i)}),ka(t)}var Mn=A(require("fs"));function Ps(s){let t=s.command("deployments").description("Deployment management");t.command("list <projectId>").description("List deployments for a project").option("--status <status>","Filter by status").option("--type <type>","Filter by type").action(async(e,n)=>{let r=await new h(f()).deployments.list(e,n);d()?p(r):O(r,["id","name","type","status","createdAt"])}),t.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(e,n)=>{let i=new h(f()),r;if(n.tablesFile){let a=Mn.readFileSync(n.tablesFile,"utf-8");r=JSON.parse(a)}let o=await i.deployments.create(e,{name:n.name,type:n.type,tables:r});d()?p(o):(b("Deployment created."),w(o))}),t.command("config <deploymentId>").description("Get deployment configuration").action(async e=>{let i=await new h(f()).deployments.getConfig(e);d()?p(i):w(i)}),t.command("update <deploymentId>").description("Update deployment configuration").requiredOption("--body <file>","JSON file with configuration updates").action(async(e,n)=>{let i=new h(f()),r=Mn.readFileSync(n.body,"utf-8"),o=JSON.parse(r);await i.deployments.updateConfig(e,o),d()?p({success:!0}):b("Deployment configuration updated.")}),t.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(e,n)=>{let r=await new h(f()).deployments.listDocuments(e,{limit:parseInt(n.limit),offset:parseInt(n.offset),status:n.status});d()?p(r):O(r.data,["id","name","status","createdAt"])})}var Je=A(require("fs")),Ve=A(require("path"));var Qt=A(require("process"),1);var js=(s=0)=>t=>`\x1B[${t+s}m`,Ns=(s=0)=>t=>`\x1B[${38+s};5;${t}m`,Ls=(s=0)=>(t,e,n)=>`\x1B[${38+s};2;${t};${e};${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]}},iD=Object.keys(L.modifier),Pa=Object.keys(L.color),ja=Object.keys(L.bgColor),sD=[...Pa,...ja];function Na(){let s=new Map;for(let[t,e]of Object.entries(L)){for(let[n,i]of Object.entries(e))L[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},e[n]=L[n],s.set(i[0],i[1]);Object.defineProperty(L,t,{value:e,enumerable:!1})}return Object.defineProperty(L,"codes",{value:s,enumerable:!1}),L.color.close="\x1B[39m",L.bgColor.close="\x1B[49m",L.color.ansi=js(),L.color.ansi256=Ns(),L.color.ansi16m=Ls(),L.bgColor.ansi=js(10),L.bgColor.ansi256=Ns(10),L.bgColor.ansi16m=Ls(10),Object.defineProperties(L,{rgbToAnsi256:{value(t,e,n){return t===e&&e===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(e/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let e=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!e)return[0,0,0];let[n]=e;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:t=>L.rgbToAnsi256(...L.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let e,n,i;if(t>=232)e=((t-232)*10+8)/255,n=e,i=e;else{t-=16;let a=t%36;e=Math.floor(t/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let r=Math.max(e,n,i)*2;if(r===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(e));return r===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(t,e,n)=>L.ansi256ToAnsi(L.rgbToAnsi256(t,e,n)),enumerable:!1},hexToAnsi:{value:t=>L.ansi256ToAnsi(L.hexToAnsi256(t)),enumerable:!1}}),L}var La=Na(),et=La;var Re=A(require("process"),1),Us=A(require("os"),1),Un=A(require("tty"),1);function Z(s,t=globalThis.Deno?globalThis.Deno.args:Re.default.argv){let e=s.startsWith("-")?"":s.length===1?"-":"--",n=t.indexOf(e+s),i=t.indexOf("--");return n!==-1&&(i===-1||n<i)}var{env:M}=Re.default,Be;Z("no-color")||Z("no-colors")||Z("color=false")||Z("color=never")?Be=0:(Z("color")||Z("colors")||Z("color=true")||Z("color=always"))&&(Be=1);function Ma(){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 Ua(s){return s===0?!1:{level:s,hasBasic:!0,has256:s>=2,has16m:s>=3}}function qa(s,{streamIsTTY:t,sniffFlags:e=!0}={}){let n=Ma();n!==void 0&&(Be=n);let i=e?Be:n;if(i===0)return 0;if(e){if(Z("color=16m")||Z("color=full")||Z("color=truecolor"))return 3;if(Z("color=256"))return 2}if("TF_BUILD"in M&&"AGENT_NAME"in M)return 1;if(s&&!t&&i===void 0)return 0;let r=i||0;if(M.TERM==="dumb")return r;if(Re.default.platform==="win32"){let o=Us.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 Ms(s,t={}){let e=qa(s,{streamIsTTY:s&&s.isTTY,...t});return Ua(e)}var Ja={stdout:Ms({isTTY:Un.default.isatty(1)}),stderr:Ms({isTTY:Un.default.isatty(2)})},qs=Ja;function Js(s,t,e){let n=s.indexOf(t);if(n===-1)return s;let i=t.length,r=0,o="";do o+=s.slice(r,n)+t+e,r=n+i,n=s.indexOf(t,r);while(n!==-1);return o+=s.slice(r),o}function Vs(s,t,e,n){let i=0,r="";do{let o=s[n-1]==="\r";r+=s.slice(i,o?n-1:n)+t+(o?`\r
44
44
  `:`
45
45
  `)+e,i=n+1,n=s.indexOf(`
46
- `,i)}while(n!==-1);return r+=s.slice(i),r}var{stdout:Ls,stderr:Ms}=Ps,Ln=Symbol("GENERATOR"),Bt=Symbol("STYLER"),Gt=Symbol("IS_EMPTY"),Us=["ansi","ansi","ansi256","ansi16m"],Rt=Object.create(null),Ba=(s,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let e=Ls?Ls.level:0;s.level=t.level===void 0?e:t.level};var Ra=s=>{let t=(...e)=>e.join(" ");return Ba(t,s),Object.setPrototypeOf(t,Yt.prototype),t};function Yt(s){return Ra(s)}Object.setPrototypeOf(Yt.prototype,Function.prototype);for(let[s,t]of Object.entries(et))Rt[s]={get(){let e=Be(this,Un(t.open,t.close,this[Bt]),this[Gt]);return Object.defineProperty(this,s,{value:e}),e}};Rt.visible={get(){let s=Be(this,this[Bt],!0);return Object.defineProperty(this,"visible",{value:s}),s}};var Mn=(s,t,e,...n)=>s==="rgb"?t==="ansi16m"?et[e].ansi16m(...n):t==="ansi256"?et[e].ansi256(et.rgbToAnsi256(...n)):et[e].ansi(et.rgbToAnsi(...n)):s==="hex"?Mn("rgb",t,e,...et.hexToRgb(...n)):et[e][s](...n),$a=["rgb","hex","ansi256"];for(let s of $a){Rt[s]={get(){let{level:e}=this;return function(...n){let i=Un(Mn(s,Us[e],"color",...n),et.color.close,this[Bt]);return Be(this,i,this[Gt])}}};let t="bg"+s[0].toUpperCase()+s.slice(1);Rt[t]={get(){let{level:e}=this;return function(...n){let i=Un(Mn(s,Us[e],"bgColor",...n),et.bgColor.close,this[Bt]);return Be(this,i,this[Gt])}}}}var ka=Object.defineProperties(()=>{},{...Rt,level:{enumerable:!0,get(){return this[Ln].level},set(s){this[Ln].level=s}}}),Un=(s,t,e)=>{let n,i;return e===void 0?(n=s,i=t):(n=e.openAll+s,i=t+e.closeAll),{open:s,close:t,openAll:n,closeAll:i,parent:e}},Be=(s,t,e)=>{let n=(...i)=>Pa(n,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(n,ka),n[Ln]=s,n[Bt]=t,n[Gt]=e,n},Pa=(s,t)=>{if(s.level<=0||!t)return s[Gt]?"":t;let e=s[Bt];if(e===void 0)return t;let{openAll:n,closeAll:i}=e;if(t.includes("\x1B"))for(;e!==void 0;)t=js(t,e.close,e.open),e=e.parent;let r=t.indexOf(`
47
- `);return r!==-1&&(t=Ns(t,i,n,r)),n+t+i};Object.defineProperties(Yt.prototype,Rt);var ja=Yt(),Yc=Yt({level:Ms?Ms.level:0});var nt=ja;var Kn=A(require("process"),1);var Kt=A(require("process"),1);var Na=(s,t,e,n)=>{if(e==="length"||e==="prototype"||e==="arguments"||e==="caller")return;let i=Object.getOwnPropertyDescriptor(s,e),r=Object.getOwnPropertyDescriptor(t,e);!La(i,r)&&n||Object.defineProperty(s,e,r)},La=function(s,t){return s===void 0||s.configurable||s.writable===t.writable&&s.enumerable===t.enumerable&&s.configurable===t.configurable&&(s.writable||s.value===t.value)},Ma=(s,t)=>{let e=Object.getPrototypeOf(t);e!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,e)},Ua=(s,t)=>`/* Wrapped ${s}*/
48
- ${t}`,qa=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Ja=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Va=(s,t,e)=>{let n=e===""?"":`with ${e.trim()}() `,i=Ua.bind(null,n,t.toString());Object.defineProperty(i,"name",Ja);let{writable:r,enumerable:o,configurable:a}=qa;Object.defineProperty(s,"toString",{value:i,writable:r,enumerable:o,configurable:a})};function qn(s,t,{ignoreNonConfigurable:e=!1}={}){let{name:n}=s;for(let i of Reflect.ownKeys(t))Na(s,t,i,e);return Ma(s,t),Va(s,t,n),s}var Re=new WeakMap,qs=(s,t={})=>{if(typeof s!="function")throw new TypeError("Expected a function");let e,n=0,i=s.displayName||s.name||"<anonymous>",r=function(...o){if(Re.set(r,++n),n===1)e=s.apply(this,o),s=void 0;else if(t.throw===!0)throw new Error(`Function \`${i}\` can only be called once`);return e};return qn(r,s),Re.set(r,n),r};qs.callCount=s=>{if(!Re.has(s))throw new Error(`The given function \`${s.name}\` is not wrapped by the \`onetime\` package`);return Re.get(s)};var Js=qs;var ft=[];ft.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&ft.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ft.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var $e=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",Jn=Symbol.for("signal-exit emitter"),Vn=globalThis,Ha=Object.defineProperty.bind(Object),Hn=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Vn[Jn])return Vn[Jn];Ha(Vn,Jn,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,e){this.listeners[t].push(e)}removeListener(t,e){let n=this.listeners[t],i=n.indexOf(e);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(t,e,n){if(this.emitted[t])return!1;this.emitted[t]=!0;let i=!1;for(let r of this.listeners[t])i=r(e,n)===!0||i;return t==="exit"&&(i=this.emit("afterExit",e,n)||i),i}},ke=class{},Wa=s=>({onExit(t,e){return s.onExit(t,e)},load(){return s.load()},unload(){return s.unload()}}),Wn=class extends ke{onExit(){return()=>{}}load(){}unload(){}},Gn=class extends ke{#o=Yn.platform==="win32"?"SIGINT":"SIGHUP";#n=new Hn;#t;#s;#d;#e={};#r=!1;constructor(t){super(),this.#t=t,this.#e={};for(let e of ft)this.#e[e]=()=>{let n=this.#t.listeners(e),{count:i}=this.#n,r=t;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,e),a=e==="SIGHUP"?this.#o:e;o||t.kill(t.pid,a)}};this.#d=t.reallyExit,this.#s=t.emit}onExit(t,e){if(!$e(this.#t))return()=>{};this.#r===!1&&this.load();let n=e?.alwaysLast?"afterExit":"exit";return this.#n.on(n,t),()=>{this.#n.removeListener(n,t),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 t of ft)try{let e=this.#e[t];e&&this.#t.on(t,e)}catch{}this.#t.emit=(t,...e)=>this.#p(t,...e),this.#t.reallyExit=t=>this.#i(t)}}unload(){this.#r&&(this.#r=!1,ft.forEach(t=>{let e=this.#e[t];if(!e)throw new Error("Listener not defined for signal: "+t);try{this.#t.removeListener(t,e)}catch{}}),this.#t.emit=this.#s,this.#t.reallyExit=this.#d,this.#n.count-=1)}#i(t){return $e(this.#t)?(this.#t.exitCode=t||0,this.#n.emit("exit",this.#t.exitCode,null),this.#d.call(this.#t,this.#t.exitCode)):0}#p(t,...e){let n=this.#s;if(t==="exit"&&$e(this.#t)){typeof e[0]=="number"&&(this.#t.exitCode=e[0]);let i=n.call(this.#t,t,...e);return this.#n.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,t,...e)}},Yn=globalThis.process,{onExit:Vs,load:eD,unload:nD}=Wa($e(Yn)?new Gn(Yn):new Wn);var Hs=Kt.default.stderr.isTTY?Kt.default.stderr:Kt.default.stdout.isTTY?Kt.default.stdout:void 0,Ga=Hs?Js(()=>{Vs(()=>{Hs.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Ws=Ga;var Pe=!1,$t={};$t.show=(s=Kn.default.stderr)=>{s.isTTY&&(Pe=!1,s.write("\x1B[?25h"))};$t.hide=(s=Kn.default.stderr)=>{s.isTTY&&(Ws(),Pe=!0,s.write("\x1B[?25l"))};$t.toggle=(s,t)=>{s!==void 0&&(Pe=s),Pe?$t.show(t):$t.hide(t)};var zn=$t;var te=A(Xn(),1);var Q=A(require("process"),1);function Zn(){return Q.default.platform!=="win32"?Q.default.env.TERM!=="linux":!!Q.default.env.CI||!!Q.default.env.WT_SESSION||!!Q.default.env.TERMINUS_SUBLIME||Q.default.env.ConEmuTask==="{cmd::Cmder}"||Q.default.env.TERM_PROGRAM==="Terminus-Sublime"||Q.default.env.TERM_PROGRAM==="vscode"||Q.default.env.TERM==="xterm-256color"||Q.default.env.TERM==="alacritty"||Q.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Ka={info:nt.blue("\u2139"),success:nt.green("\u2714"),warning:nt.yellow("\u26A0"),error:nt.red("\u2716")},za={info:nt.blue("i"),success:nt.green("\u221A"),warning:nt.yellow("\u203C"),error:nt.red("\xD7")},Xa=Zn()?Ka:za,zt=Xa;function Qn({onlyFirst:s=!1}={}){let i="(?:\\u001B\\][\\s\\S]*?(?:\\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 Za=Qn();function Xt(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return!s.includes("\x1B")&&!s.includes("\x9B")?s:s.replace(Za,"")}var Ne=[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],Le=[12288,12288,65281,65376,65504,65510],ti=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],ei=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Zt=[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 Me=(s,t)=>{let e=0,n=Math.floor(s.length/2)-1;for(;e<=n;){let i=Math.floor((e+n)/2),r=i*2;if(t<s[r])n=i-1;else if(t>s[r+1])e=i+1;else return!0}return!1};var Qa=Ne[0],tu=Ne.at(-1),eu=Le[0],nu=Le.at(-1),bD=ti[0],wD=ti.at(-1),AD=ei[0],_D=ei.at(-1),iu=Zt[0],su=Zt.at(-1),zs=19968,[ru,ou]=au(Zt);function au(s){let t=s[0],e=s[1];for(let n=0;n<s.length;n+=2){let i=s[n],r=s[n+1];if(zs>=i&&zs<=r)return[i,r];r-i>e-t&&(t=i,e=r)}return[t,e]}var Xs=s=>s<Qa||s>tu?!1:Me(Ne,s),Zs=s=>s<eu||s>nu?!1:Me(Le,s);var Qs=s=>s>=ru&&s<=ou?!0:s<iu||s>su?!1:Me(Zt,s);function uu(s){if(!Number.isSafeInteger(s))throw new TypeError(`Expected a code point, got \`${typeof s}\`.`)}function tr(s,{ambiguousAsWide:t=!1}={}){return uu(s),Zs(s)||Qs(s)||t&&Xs(s)?2:1}var er=()=>/[#*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 lu=new Intl.Segmenter,cu=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function ni(s,t={}){if(typeof s!="string"||s.length===0)return 0;let{ambiguousIsNarrow:e=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(s=Xt(s)),s.length===0)return 0;let i=0,r={ambiguousAsWide:!e};for(let{segment:o}of lu.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)&&!cu.test(o)){if(er().test(o)){i+=2;continue}i+=tr(a,r)}}return i}function ii({stream:s=process.stdout}={}){return!!(s&&s.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var si=A(require("process"),1);function ri(){let{env:s}=si.default,{TERM:t,TERM_PROGRAM:e}=s;return si.default.platform!=="win32"?t!=="linux":!!s.WT_SESSION||!!s.TERMINUS_SUBLIME||s.ConEmuTask==="{cmd::Cmder}"||e==="Terminus-Sublime"||e==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||s.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var it=A(require("process"),1),Du=3,oi=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.#t()}#n(){it.default.platform==="win32"||!it.default.stdin.isTTY||(it.default.stdin.setRawMode(!0),it.default.stdin.on("data",this.#s),it.default.stdin.resume())}#t(){it.default.stdin.isTTY&&(it.default.stdin.off("data",this.#s),it.default.stdin.pause(),it.default.stdin.setRawMode(!1))}#s(t){t[0]===Du&&it.default.emit("SIGINT")}},du=new oi,ai=du;var pu=A(Xn(),1),ui=class{#o=0;#n=!1;#t=0;#s=-1;#d=0;#e;#r;#i;#p;#f;#l;#c;#D;#h;#a;#u;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#e={color:"cyan",stream:Qt.default.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#e.color,this.spinner=this.#e.spinner,this.#f=this.#e.interval,this.#i=this.#e.stream,this.#l=typeof this.#e.isEnabled=="boolean"?this.#e.isEnabled:ii({stream:this.#i}),this.#c=typeof this.#e.isSilent=="boolean"?this.#e.isSilent:!1,this.text=this.#e.text,this.prefixText=this.#e.prefixText,this.suffixText=this.#e.suffixText,this.indent=this.#e.indent,Qt.default.env.NODE_ENV==="test"&&(this._stream=this.#i,this._isEnabled=this.#l,Object.defineProperty(this,"_linesToClear",{get(){return this.#o},set(e){this.#o=e}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#s}}),Object.defineProperty(this,"_lineCount",{get(){return this.#t}}))}get indent(){return this.#D}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#D=t,this.#m()}get interval(){return this.#f??this.#r.interval??100}get spinner(){return this.#r}set spinner(t){if(this.#s=-1,this.#f=void 0,typeof t=="object"){if(t.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#r=t}else if(!ri())this.#r=te.default.line;else if(t===void 0)this.#r=te.default.dots;else if(t!=="default"&&te.default[t])this.#r=te.default[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#h}set text(t=""){this.#h=t,this.#m()}get prefixText(){return this.#a}set prefixText(t=""){this.#a=t,this.#m()}get suffixText(){return this.#u}set suffixText(t=""){this.#u=t,this.#m()}get isSpinning(){return this.#p!==void 0}#g(t=this.#a,e=" "){return typeof t=="string"&&t!==""?t+e:typeof t=="function"?t()+e:""}#F(t=this.#u,e=" "){return typeof t=="string"&&t!==""?e+t:typeof t=="function"?e+t():""}#m(){let t=this.#i.columns??80,e=this.#g(this.#a,"-"),n=this.#F(this.#u,"-"),i=" ".repeat(this.#D)+e+"--"+this.#h+"--"+n;this.#t=0;for(let r of Xt(i).split(`
49
- `))this.#t+=Math.max(1,Math.ceil(ni(r,{countAnsiEscapeCodes:!0})/t))}get isEnabled(){return this.#l&&!this.#c}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#l=t}get isSilent(){return this.#c}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#c=t}frame(){let t=Date.now();(this.#s===-1||t-this.#d>=this.interval)&&(this.#s=++this.#s%this.#r.frames.length,this.#d=t);let{frames:e}=this.#r,n=e[this.#s];this.color&&(n=nt[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 t=0;t<this.#o;t++)t>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.#t,this)}start(t){return t&&(this.text=t),this.#c?this:this.#l?this.isSpinning?this:(this.#e.hideCursor&&zn.hide(this.#i),this.#e.discardStdin&&Qt.default.stdin.isTTY&&(this.#n=!0,ai.start()),this.render(),this.#p=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#i.write(`- ${this.text}
50
- `),this)}stop(){return this.#l?(clearInterval(this.#p),this.#p=void 0,this.#s=0,this.clear(),this.#e.hideCursor&&zn.show(this.#i),this.#e.discardStdin&&Qt.default.stdin.isTTY&&this.#n&&(ai.stop(),this.#n=!1),this):this}succeed(t){return this.stopAndPersist({symbol:zt.success,text:t})}fail(t){return this.stopAndPersist({symbol:zt.error,text:t})}warn(t){return this.stopAndPersist({symbol:zt.warning,text:t})}info(t){return this.stopAndPersist({symbol:zt.info,text:t})}stopAndPersist(t={}){if(this.#c)return this;let e=t.prefixText??this.#a,n=this.#g(e," "),i=t.symbol??" ",r=t.text??this.text,a=typeof r=="string"?(i?" ":"")+r:"",u=t.suffixText??this.#u,l=this.#F(u," "),c=n+i+a+l+`
51
- `;return this.stop(),this.#i.write(c),this}};function li(s){return new ui(s)}var ht={start(){return ht},stop(){return ht},succeed(){return ht},fail(){return ht},warn(){return ht},info(){return ht},text:"",isSpinning:!1};function y(s){return d()?ht:li({text:s,color:"cyan"})}function nr(s){let t=s.command("documents").description("Document upload and processing");t.command("upload <extractionSchemaId> <file>").description("Upload a document for extraction").action(async(e,n)=>{let i=new h(f()),r=qe.resolve(n);Ue.existsSync(r)||(console.error(`File not found: ${r}`),process.exit(1));let o=y(`Uploading ${qe.basename(r)}...`);o.start();let a=await i.uploadFile(e,r);a.isDuplicate?o.warn("File already exists (duplicate)."):o.succeed("File uploaded."),d()?m(a):w(a)}),t.command("process <extractionSchemaId> <fileId>").description("Process a document for extraction").option("--async","Process asynchronously").option("--wait","Wait for completion (implies --async)").action(async(e,n,i)=>{let r=new h(f());if(i.async||i.wait){let a=await r.documents.processAsync(e,n);if(i.wait){let u=y(`Waiting for extraction (job ${a.jobId})...`);u.start();let c=await new X(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,e);d()?m(D):w({fileId:n,status:"COMPLETED",tables:Object.keys(D.data?.tables??{}).length})}else u.fail(`Extraction ${c.status}`),process.exit(1)}else d()?m(a):(b("Processing job queued."),w(a))}else{let a=y("Processing file...");a.start();let u=await r.documents.processSync(e,n);a.succeed("Processing complete."),d()?m(u):w(u)}}),t.command("get <fileId>").description("Get extracted file data").option("--extraction-schema-id <id>","Extraction schema ID").action(async(e,n)=>{let r=await new h(f()).documents.getFileData(e,n.extractionSchemaId);d()?m(r):w(r)}),t.command("correct <extractionSchemaId> <fileId>").description("Submit corrections for extracted data").requiredOption("--corrections <file>","JSON file with corrections").action(async(e,n,i)=>{let r=new h(f()),o=Ue.readFileSync(i.corrections,"utf-8"),a=JSON.parse(o);await r.documents.submitCorrections(e,n,a),d()?m({success:!0}):b("Corrections submitted.")})}var ir=A(require("fs"));function sr(s){let t=s.command("tables").description("Table management");t.command("create <deploymentId>").description("Create a table in a deployment").requiredOption("--body <file>","JSON file with table definition").action(async(e,n)=>{let i=new h(f()),r=ir.readFileSync(n.body,"utf-8"),o=JSON.parse(r),a=await i.tables.createTable(e,o);d()?m(a):(b("Table created."),w(a))}),t.command("get <tableId>").description("Get table details").action(async e=>{let i=await new h(f()).tables.get(e);d()?m(i):w(i)}),t.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(e,n)=>{let i=new h(f());if(n.all){let r=await Fe(us(async(o,a)=>i.tables.listRows(e,{limit:o,offset:a}),{pageSize:500}));d()?m(r):O(r)}else{let r=await i.tables.listRows(e,{limit:parseInt(n.limit),offset:parseInt(n.offset)});d()?m(r):O(r.data)}}),t.command("columns <tableId>").description("List columns in a table").action(async e=>{let i=await new h(f()).tables.listColumns(e);d()?m(i):O(i,["id","name","type"])})}function rr(s){s.command("columns").description("Column management").command("get <columnId>").description("Get column details").action(async e=>{let i=await new h(f()).http.get(`/columns/${e}`);d()?m(i):w(i)})}function or(s){let t=s.command("schema").description("Extraction schema management");t.command("get <extractionSchemaId>").description("Get extraction schema details").action(async e=>{let i=await new h(f()).schema.get(e);d()?m(i):w(i)}),t.command("data <extractionSchemaId>").description("Get all data for an extraction schema").action(async e=>{let i=await new h(f()).schema.getAllData(e);d()?m(i):w(i)})}var ar=A(require("fs"));function ur(s){let t=s.command("benchmarks").description("Benchmark management");t.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(e,n)=>{let i=new h(f()),r={name:n.name};if(n.description&&(r.description=n.description),n.fileIds&&(r.fileIds=n.fileIds.split(",")),n.configFile){let a=ar.readFileSync(n.configFile,"utf-8"),u=JSON.parse(a);r={...r,...u}}let o=await i.http.post(`/benchmark/${e}/run-benchmark`,r);d()?m(o):(b("Benchmark started."),w(o))}),t.command("files <extractionSchemaId>").description("List files available for benchmarking").action(async e=>{let i=await new h(f()).http.get(`/benchmark/${e}/list-files`),r=Array.isArray(i)?i:i.data||i;d()?m(i):O(r)}),t.command("results <extractionSchemaId>").description("Get benchmark results").requiredOption("--execution-id <id>","Execution ID").action(async(e,n)=>{let r=await new h(f()).http.get(`/benchmark/${e}/get-results`,{executionId:n.executionId});d()?m(r):w(r)}),t.command("status <executionId>").description("Get benchmark execution status").action(async e=>{let i=await new h(f()).http.get(`/benchmarks/${e}`);d()?m(i):w(i)}),t.command("metrics <executionId>").description("Get benchmark execution metrics").action(async e=>{let i=await new h(f()).http.get(`/benchmarks/${e}/metrics`);d()?m(i):w(i)})}var lt=A(require("fs")),ne=A(require("path")),Ve=require("stream"),dr=require("stream/promises");var Je=A(require("fs")),ee=A(require("path"));var mu=["JOB_CONTEXT.json",ee.join(process.env.HOME||"/home/daytona","JOB_CONTEXT.json")];function lr(s){let t=s?[ee.resolve(s)]:mu.map(e=>ee.resolve(e));for(let e of t)if(Je.existsSync(e)){let n=Je.readFileSync(e,"utf-8"),i;try{i=JSON.parse(n)}catch{throw new U(`Invalid JSON in ${e}`)}return fu(i,e),i}throw new j("JOB_CONTEXT.json not found. Searched: "+t.join(", "),{code:"JOB_CONTEXT_NOT_FOUND",exitCode:1})}function fu(s,t){let e=[];if(s.jobId||e.push("jobId"),s.fileId||e.push("fileId"),s.fileName||e.push("fileName"),s.sourceFileUrl||e.push("sourceFileUrl"),s.deploymentId||e.push("deploymentId"),s.extractionSchemaId||e.push("extractionSchemaId"),e.length>0)throw new U(`JOB_CONTEXT.json (${t}) missing required fields: ${e.join(", ")}`);if(!s.schema||!Array.isArray(s.schema.tables)||s.schema.tables.length===0)throw new U(`JOB_CONTEXT.json (${t}) must have schema.tables with at least one table`);for(let n of s.schema.tables){if(!n.id||!n.name)throw new U("JOB_CONTEXT.json: table missing id or name");if(!Array.isArray(n.columns)||n.columns.length===0)throw new U(`JOB_CONTEXT.json: table "${n.name}" has no columns`)}}function cr(s,t){let e=[],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 t.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){e.push(`Table "${u}" not found in schema. Available tables: ${[...o.keys()].join(", ")}`);continue}let c=s.tables[u];if(!Array.isArray(c)){e.push(`Table "${u}": rows must be an array`);continue}let D=!l.isPrimary,p=new Set(l.columns.map(g=>g.name)),F=new Map(l.columns.map(g=>[g.name,g]));for(let g=0;g<c.length;g++){let v=c[g];hu(v,g,u,D,p,F,e,n)}i.push({name:u,rowCount:c.length,isChild:D}),r+=c.length}for(let u of t.schema.tables)a.includes(u.name)||n.push(`Schema table "${u.name}" has no data in submission`);return{valid:e.length===0,errors:e,warnings:n,summary:{tablesFound:a.length,totalRows:r,tableDetails:i}}}function hu(s,t,e,n,i,r,o,a){let u=`Table "${e}" row ${t}`;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 p=r.get(D);p&&gu(s.cells[D],D,p.type,p.isList,u,a)}c===0&&o.push(`${u}: no cell keys match any schema column`)}function gu(s,t,e,n,i,r){if(s!=null){if(n&&!Array.isArray(s)){r.push(`${i}: column "${t}" is a LIST but value is not an array`);return}switch(e){case"NUMBER":typeof s!="number"&&typeof s!="string"&&r.push(`${i}: column "${t}" (NUMBER) has unexpected type ${typeof s}`);break;case"BOOLEAN":typeof s!="boolean"&&r.push(`${i}: column "${t}" (BOOLEAN) has unexpected type ${typeof s}`);break;case"DATE":typeof s!="string"&&r.push(`${i}: column "${t}" (DATE) should be an ISO date string`);break;case"LIST":Array.isArray(s)||r.push(`${i}: column "${t}" (LIST) should be an array`);break}}}var Dr=200;function pr(s){let t=s.command("jobs").description("Job queue management");t.command("status <jobId>").description("Get job status").option("--wait","Poll until job completes").option("--timeout <seconds>","Timeout in seconds","300").action(async(e,n)=>{let i=new h(f());if(n.wait){let r=new X(i.queue),o=y(`Waiting for job ${e}...`);o.start();let a;for await(let u of r.poll(e,{timeoutMs:parseInt(n.timeout)*1e3}))o.text=`Job ${e}: ${u.status} (extraction: ${u.extractionStageStatus})`,a=u;a?.status==="COMPLETED"?o.succeed(`Job ${e} completed.`):o.fail(`Job ${e}: ${a?.status}`),d()?m(a):w(a)}else{let r=await i.queue.getStatus(e);d()?m(r):w(r)}}),t.command("wait <jobId>").description("Wait for a job to complete").option("--timeout <seconds>","Timeout in seconds","300").action(async(e,n)=>{let i=new h(f()),r=new X(i.queue),o=y(`Waiting for job ${e}...`);o.start();let a=await r.waitForCompletion(e,{timeoutMs:parseInt(n.timeout)*1e3,onStatus:u=>{o.text=`Job ${e}: ${u.status}`}});a.status==="COMPLETED"?o.succeed(`Job ${e} completed.`):o.fail(`Job ${e}: ${a.status}`),d()?m(a):w(a)}),t.command("cancel <jobId>").description("Cancel a queued job").action(async e=>{await new h(f()).queue.cancel(e),d()?m({success:!0,jobId:e}):b(`Job ${e} cancelled.`)}),t.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(e,n)=>{let i=n.status.toUpperCase();if(!["PROCESSING","COMPLETED","FAILED"].includes(i))throw new U("Status must be PROCESSING, COMPLETED, or FAILED");if(i==="FAILED"&&!n.errorMessage)throw new U("--error-message is required when status is FAILED");let o=await new h(f()).queue.updateStatus(e,{status:i,errorMessage:n.errorMessage,pages:n.pages?parseInt(n.pages):void 0,rows:n.rows?parseInt(n.rows):void 0});d()?m(o):b(`Job ${e} status updated to ${i}`)}),t.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(e,n)=>{let i=new h(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(e);if(!a.ok)throw new j(`Failed to download: HTTP ${a.status}`,{code:"DOWNLOAD_ERROR",exitCode:1});let u=ne.resolve(n.output),l=ne.dirname(u);if(lt.existsSync(l)||lt.mkdirSync(l,{recursive:!0}),!a.body)throw new j("Download failed: response body is empty",{code:"DOWNLOAD_ERROR",exitCode:1});let c=0,D=new Ve.Transform({transform(F,g,v){c+=F.byteLength,v(null,F)}});await(0,dr.pipeline)(Ve.Readable.fromWeb(a.body),D,lt.createWriteStream(u)),o.succeed(`Downloaded (${bu(c)})`);let p={file:u,bytes:c};r&&(p.jobId=r,p.status="PROCESSING"),d()&&m(p)}catch(a){throw o.fail("Download failed"),r&&await yu(i,r,a),a}}),t.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(Dr)).option("--dry-run","Validate and show plan without submitting").action(async(e,n)=>{let i=lr(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 h(f()),l=parseInt(n.batchSize)||Dr,c=y("Loading and validating submission...");c.start();try{let D=Eu(e),p=cr(D,i);if(!p.valid){c.fail("Validation failed");for(let _ of p.errors)console.error(`\x1B[31m ${_}\x1B[0m`);d()&&m({error:{code:"VALIDATION_ERROR",errors:p.errors}}),process.exit(1)}if(p.warnings.length>0&&!d())for(let _ of p.warnings)ot(` ${_}`);let F=new Map,g=[],v=[];for(let _ of i.schema.tables)F.set(_.name,_.id),_.isPrimary?g.push(_.name):v.push(_.name);if(n.dryRun){c.succeed("Validation passed (dry run)");let _={dryRun:!0,validation:p.summary,deleteOrder:[...v,...g].filter(x=>D.tables[x]).map(x=>({table:x,tableId:F.get(x)})),createOrder:[...g,...v].filter(x=>D.tables[x]).map(x=>({table:x,tableId:F.get(x),rows:D.tables[x].length,batches:Math.ceil(D.tables[x].length/l)}))};if(d())m(_);else{V("Delete order:");for(let x of _.deleteOrder)V(` ${x.table} (${x.tableId})`);V("Create order:");for(let x of _.createOrder)V(` ${x.table}: ${x.rows} rows in ${x.batches} batch(es)`)}return}let B=Object.keys(D.tables),E=[...v,...g].filter(_=>B.includes(_));for(let _ of E){let x=F.get(_);c.text=`Deleting existing rows from "${_}"...`,await u.tables.deleteRows(x,{fileId:o,deploymentId:a})}let C=0,I=new Map;for(let _ of g){let x=D.tables[_];if(!x||x.length===0)continue;let qt=F.get(_),mt=new Map;I.set(_,mt);let Dt=await Fu(u,qt,o,a,x,l,c,_);for(let G=0;G<x.length;G++)Dt[G]&&mt.set(x[G].index,Dt[G]);C+=Dt.length}for(let _ of v){let x=D.tables[_];if(!x||x.length===0)continue;let qt=F.get(_),mt=Cu(_,i),Dt=mt?I.get(mt):void 0,G=x.map(wt=>{let rn;if(wt.parentIndex!==void 0&&Dt&&(rn=Dt.get(wt.parentIndex),!rn))throw new U(`Table "${_}" row ${wt.index}: parentIndex ${wt.parentIndex} does not match any parent row`);return{cells:wt.cells,index:wt.index,parentRowId:rn}}),ue=await mr(u,qt,o,a,G,l,c,_);C+=ue.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 ${p.summary.tablesFound} table(s). Job COMPLETED.`);let q={status:"COMPLETED",jobId:r,tablesProcessed:p.summary.tablesFound,totalRowsCreated:C,tables:p.summary.tableDetails};d()&&m(q)}catch(D){c.fail("Submission failed");let p=D instanceof Error?D.message:String(D),F=D instanceof U?"VALIDATION_ERROR":"SUBMISSION_ERROR";d()?m({error:{code:F,message:p}}):console.error(`\x1B[31m ${p}\x1B[0m`),process.exit(1)}})}async function Fu(s,t,e,n,i,r,o,a){let u=i.map(l=>({cells:l.cells,index:l.index}));return mr(s,t,e,n,u,r,o,a)}async function mr(s,t,e,n,i,r,o,a){let u=Array.from({length:i.length}),l=Math.ceil(i.length/r),c=3,D=0,p=[];for(let F=0;F<i.length;F+=r)p.push({start:F,batchRows:i.slice(F,F+r)});for(let F=0;F<p.length;F+=c){let g=p.slice(F,F+c),v=await Promise.all(g.map(({batchRows:B})=>s.tables.createRows(t,{fileId:e,deploymentId:n,rows:B})));for(let B=0;B<g.length;B++){let{start:E}=g[B];v[B].rowIds.forEach((C,I)=>{u[E+I]=C})}D+=g.length,o.text=`"${a}" batch ${D}/${l} (${Math.min(D*r,i.length)}/${i.length} rows)...`}return u.filter(Boolean)}function Cu(s,t){let e=t.schema.tables.find(i=>i.name===s);return!e||e.isPrimary?void 0:t.schema.tables.find(i=>i.isPrimary)?.name}function Eu(s){let t=ne.resolve(s);if(!lt.existsSync(t))throw new U(`File not found: ${t}`);let e=lt.readFileSync(t,"utf-8");try{return JSON.parse(e)}catch{throw new U(`Invalid JSON in ${t}`)}}async function yu(s,t,e){try{let n=e instanceof Error?e.message:String(e);await s.queue.updateStatus(t,{status:"FAILED",errorMessage:n.slice(0,500)})}catch{}}function bu(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}var Ft=A(require("fs")),We=A(require("path"));var Ei=A(Xr());var Xu={update(){},increment(){},stop(){}};function Zr(s){if(d())return Xu;let t=s.format??" {bar} {percentage}% | {value}/{total} | {filename}",e=new Ei.default.SingleBar({format:t,barCompleteChar:"\u2588",barIncompleteChar:"\u2591",hideCursor:!0,clearOnComplete:!1,stopOnComplete:!0},Ei.default.Presets.shades_classic);return e.start(s.total,0),{update(n,i){e.update(n,i)},increment(n=1,i){e.increment(n,i)},stop(){e.stop()}}}function Qr(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(t,e,n)=>{let i=f(),r=new h(i),o=We.resolve(e),a=n.process||n.wait;Ft.existsSync(o)||(console.error(`Path not found: ${o}`),process.exit(1));let u=Ft.statSync(o);if(u.isFile()){let l=y(`Uploading ${We.basename(o)}...`);l.start();let c=await r.uploadFile(t,o);if(c.isDuplicate?l.warn(`File already exists (duplicate). File ID: ${c.fileId}`):l.succeed(`Uploaded ${c.filename} (${Zu(c.bytesUploaded)})`),a){let D=y("Queuing for extraction...");D.start();let p=await r.documents.processAsync(t,c.fileId);if(D.succeed(`Queued. Job ID: ${p.jobId}`),n.wait){let F=new X(r.queue),g=y("Waiting for extraction...");g.start();let v=await F.waitForCompletion(p.jobId,{onStatus:B=>{g.text=`Extraction: ${B.status} (${B.extractionStageStatus})`}});if(v.status==="COMPLETED"){g.succeed("Extraction completed.");let B=await r.documents.getFileData(c.fileId,t);n.output?(Ft.writeFileSync(n.output,JSON.stringify(B,null,2)),b(`Results written to ${n.output}`)):d()?m(B):w({fileId:c.fileId,status:"COMPLETED",tables:Object.keys(B.data?.tables??{}).length})}else g.fail(`Extraction ${v.status}`),process.exit(1)}else d()&&m({fileId:c.fileId,fileName:c.filename,jobId:p.jobId})}else d()&&m(c)}else if(u.isDirectory()){V(`Scanning ${o} for files...`);let l=await r.uploadFolder(t,o,{concurrency:parseInt(n.concurrency),process:a,globPattern:n.glob});if(l.total===0){ot("No supported files found in directory.");return}if(b(`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)ot(` Failed: ${D.filename} - ${D.error}`)}if(n.wait&&l.queued>0){let c=l.files.filter(F=>F.status==="queued"&&F.jobId);V(`Waiting for ${c.length} extractions to complete...`);let D=Zr({total:c.length,format:" Extracting {bar} {percentage}% | {value}/{total} files"}),p=0;await Promise.all(c.map(async F=>{await new X(r.queue).waitForCompletion(F.jobId),p++,D.update(p)})),D.stop(),b("All extractions completed.")}n.output?(Ft.writeFileSync(n.output,JSON.stringify(l,null,2)),b(`Results written to ${n.output}`)):d()&&m(l)}})}function Zu(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var to=A(require("fs"));function eo(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(t,e)=>{let n=new h(f()),i=y("Fetching extraction data...");i.start();let r=e.limit?parseInt(e.limit):e.all?void 0:100;if(e.output){let o=to.createWriteStream(e.output),a=0,u=0;for await(let l of n.downloadAll(t,{pageSize:parseInt(e.pageSize),maxItems:r,order:e.order,status:e.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.`),b(`Data written to ${e.output} (NDJSON format)`)}else{let o=[],a=0;for await(let u of n.downloadAll(t,{pageSize:parseInt(e.pageSize),maxItems:r,order:e.order,status:e.status}))o.push(...u),a++,i.text=`Fetched ${o.length} rows (${a} pages)...`;i.succeed(`Downloaded ${o.length} rows.`),m(o)}})}var Ge=class extends Error{constructor(t,e){super(t),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}},no=10,Qu=13,Ct=32;function yi(s){}function ro(s){if(typeof s=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=yi,onError:e=yi,onRetry:n=yi,onComment:i}=s,r=[],o=!0,a,u="",l=0,c;function D(E){if(o&&(o=!1,E.charCodeAt(0)===239&&E.charCodeAt(1)===187&&E.charCodeAt(2)===191&&(E=E.slice(3))),r.length===0){let q=p(E);q!==""&&r.push(q);return}if(E.indexOf(`
53
- `)===-1&&E.indexOf("\r")===-1){r.push(E);return}r.push(E);let C=r.join("");r.length=0;let I=p(C);I!==""&&r.push(I)}function p(E){let C=0;if(E.indexOf("\r")===-1){let I=E.indexOf(`
46
+ `,i)}while(n!==-1);return r+=s.slice(i),r}var{stdout:Hs,stderr:Ws}=qs,qn=Symbol("GENERATOR"),Bt=Symbol("STYLER"),Gt=Symbol("IS_EMPTY"),Gs=["ansi","ansi","ansi256","ansi16m"],Rt=Object.create(null),Va=(s,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let e=Hs?Hs.level:0;s.level=t.level===void 0?e:t.level};var Ha=s=>{let t=(...e)=>e.join(" ");return Va(t,s),Object.setPrototypeOf(t,Yt.prototype),t};function Yt(s){return Ha(s)}Object.setPrototypeOf(Yt.prototype,Function.prototype);for(let[s,t]of Object.entries(et))Rt[s]={get(){let e=$e(this,Vn(t.open,t.close,this[Bt]),this[Gt]);return Object.defineProperty(this,s,{value:e}),e}};Rt.visible={get(){let s=$e(this,this[Bt],!0);return Object.defineProperty(this,"visible",{value:s}),s}};var Jn=(s,t,e,...n)=>s==="rgb"?t==="ansi16m"?et[e].ansi16m(...n):t==="ansi256"?et[e].ansi256(et.rgbToAnsi256(...n)):et[e].ansi(et.rgbToAnsi(...n)):s==="hex"?Jn("rgb",t,e,...et.hexToRgb(...n)):et[e][s](...n),Wa=["rgb","hex","ansi256"];for(let s of Wa){Rt[s]={get(){let{level:e}=this;return function(...n){let i=Vn(Jn(s,Gs[e],"color",...n),et.color.close,this[Bt]);return $e(this,i,this[Gt])}}};let t="bg"+s[0].toUpperCase()+s.slice(1);Rt[t]={get(){let{level:e}=this;return function(...n){let i=Vn(Jn(s,Gs[e],"bgColor",...n),et.bgColor.close,this[Bt]);return $e(this,i,this[Gt])}}}}var Ga=Object.defineProperties(()=>{},{...Rt,level:{enumerable:!0,get(){return this[qn].level},set(s){this[qn].level=s}}}),Vn=(s,t,e)=>{let n,i;return e===void 0?(n=s,i=t):(n=e.openAll+s,i=t+e.closeAll),{open:s,close:t,openAll:n,closeAll:i,parent:e}},$e=(s,t,e)=>{let n=(...i)=>Ya(n,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(n,Ga),n[qn]=s,n[Bt]=t,n[Gt]=e,n},Ya=(s,t)=>{if(s.level<=0||!t)return s[Gt]?"":t;let e=s[Bt];if(e===void 0)return t;let{openAll:n,closeAll:i}=e;if(t.includes("\x1B"))for(;e!==void 0;)t=Js(t,e.close,e.open),e=e.parent;let r=t.indexOf(`
47
+ `);return r!==-1&&(t=Vs(t,i,n,r)),n+t+i};Object.defineProperties(Yt.prototype,Rt);var Ka=Yt(),DD=Yt({level:Ws?Ws.level:0});var nt=Ka;var Zn=A(require("process"),1);var Kt=A(require("process"),1);var za=(s,t,e,n)=>{if(e==="length"||e==="prototype"||e==="arguments"||e==="caller")return;let i=Object.getOwnPropertyDescriptor(s,e),r=Object.getOwnPropertyDescriptor(t,e);!Xa(i,r)&&n||Object.defineProperty(s,e,r)},Xa=function(s,t){return s===void 0||s.configurable||s.writable===t.writable&&s.enumerable===t.enumerable&&s.configurable===t.configurable&&(s.writable||s.value===t.value)},Za=(s,t)=>{let e=Object.getPrototypeOf(t);e!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,e)},Qa=(s,t)=>`/* Wrapped ${s}*/
48
+ ${t}`,tu=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),eu=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),nu=(s,t,e)=>{let n=e===""?"":`with ${e.trim()}() `,i=Qa.bind(null,n,t.toString());Object.defineProperty(i,"name",eu);let{writable:r,enumerable:o,configurable:a}=tu;Object.defineProperty(s,"toString",{value:i,writable:r,enumerable:o,configurable:a})};function Hn(s,t,{ignoreNonConfigurable:e=!1}={}){let{name:n}=s;for(let i of Reflect.ownKeys(t))za(s,t,i,e);return Za(s,t),nu(s,t,n),s}var ke=new WeakMap,Ys=(s,t={})=>{if(typeof s!="function")throw new TypeError("Expected a function");let e,n=0,i=s.displayName||s.name||"<anonymous>",r=function(...o){if(ke.set(r,++n),n===1)e=s.apply(this,o),s=void 0;else if(t.throw===!0)throw new Error(`Function \`${i}\` can only be called once`);return e};return Hn(r,s),ke.set(r,n),r};Ys.callCount=s=>{if(!ke.has(s))throw new Error(`The given function \`${s.name}\` is not wrapped by the \`onetime\` package`);return ke.get(s)};var Ks=Ys;var ht=[];ht.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&ht.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ht.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Pe=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",Wn=Symbol.for("signal-exit emitter"),Gn=globalThis,iu=Object.defineProperty.bind(Object),Yn=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Gn[Wn])return Gn[Wn];iu(Gn,Wn,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,e){this.listeners[t].push(e)}removeListener(t,e){let n=this.listeners[t],i=n.indexOf(e);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(t,e,n){if(this.emitted[t])return!1;this.emitted[t]=!0;let i=!1;for(let r of this.listeners[t])i=r(e,n)===!0||i;return t==="exit"&&(i=this.emit("afterExit",e,n)||i),i}},je=class{},su=s=>({onExit(t,e){return s.onExit(t,e)},load(){return s.load()},unload(){return s.unload()}}),Kn=class extends je{onExit(){return()=>{}}load(){}unload(){}},zn=class extends je{#o=Xn.platform==="win32"?"SIGINT":"SIGHUP";#n=new Yn;#t;#s;#d;#e={};#r=!1;constructor(t){super(),this.#t=t,this.#e={};for(let e of ht)this.#e[e]=()=>{let n=this.#t.listeners(e),{count:i}=this.#n,r=t;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,e),a=e==="SIGHUP"?this.#o:e;o||t.kill(t.pid,a)}};this.#d=t.reallyExit,this.#s=t.emit}onExit(t,e){if(!Pe(this.#t))return()=>{};this.#r===!1&&this.load();let n=e?.alwaysLast?"afterExit":"exit";return this.#n.on(n,t),()=>{this.#n.removeListener(n,t),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 t of ht)try{let e=this.#e[t];e&&this.#t.on(t,e)}catch{}this.#t.emit=(t,...e)=>this.#p(t,...e),this.#t.reallyExit=t=>this.#i(t)}}unload(){this.#r&&(this.#r=!1,ht.forEach(t=>{let e=this.#e[t];if(!e)throw new Error("Listener not defined for signal: "+t);try{this.#t.removeListener(t,e)}catch{}}),this.#t.emit=this.#s,this.#t.reallyExit=this.#d,this.#n.count-=1)}#i(t){return Pe(this.#t)?(this.#t.exitCode=t||0,this.#n.emit("exit",this.#t.exitCode,null),this.#d.call(this.#t,this.#t.exitCode)):0}#p(t,...e){let n=this.#s;if(t==="exit"&&Pe(this.#t)){typeof e[0]=="number"&&(this.#t.exitCode=e[0]);let i=n.call(this.#t,t,...e);return this.#n.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,t,...e)}},Xn=globalThis.process,{onExit:zs,load:FD,unload:CD}=su(Pe(Xn)?new zn(Xn):new Kn);var Xs=Kt.default.stderr.isTTY?Kt.default.stderr:Kt.default.stdout.isTTY?Kt.default.stdout:void 0,ru=Xs?Ks(()=>{zs(()=>{Xs.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Zs=ru;var Ne=!1,$t={};$t.show=(s=Zn.default.stderr)=>{s.isTTY&&(Ne=!1,s.write("\x1B[?25h"))};$t.hide=(s=Zn.default.stderr)=>{s.isTTY&&(Zs(),Ne=!0,s.write("\x1B[?25l"))};$t.toggle=(s,t)=>{s!==void 0&&(Ne=s),Ne?$t.show(t):$t.hide(t)};var Qn=$t;var te=A(ti(),1);var Q=A(require("process"),1);function ei(){return Q.default.platform!=="win32"?Q.default.env.TERM!=="linux":!!Q.default.env.CI||!!Q.default.env.WT_SESSION||!!Q.default.env.TERMINUS_SUBLIME||Q.default.env.ConEmuTask==="{cmd::Cmder}"||Q.default.env.TERM_PROGRAM==="Terminus-Sublime"||Q.default.env.TERM_PROGRAM==="vscode"||Q.default.env.TERM==="xterm-256color"||Q.default.env.TERM==="alacritty"||Q.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var au={info:nt.blue("\u2139"),success:nt.green("\u2714"),warning:nt.yellow("\u26A0"),error:nt.red("\u2716")},uu={info:nt.blue("i"),success:nt.green("\u221A"),warning:nt.yellow("\u203C"),error:nt.red("\xD7")},lu=ei()?au:uu,zt=lu;function ni({onlyFirst:s=!1}={}){let i="(?:\\u001B\\][\\s\\S]*?(?:\\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 cu=ni();function Xt(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return!s.includes("\x1B")&&!s.includes("\x9B")?s:s.replace(cu,"")}var Me=[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],Ue=[12288,12288,65281,65376,65504,65510],ii=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],si=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Zt=[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 qe=(s,t)=>{let e=0,n=Math.floor(s.length/2)-1;for(;e<=n;){let i=Math.floor((e+n)/2),r=i*2;if(t<s[r])n=i-1;else if(t>s[r+1])e=i+1;else return!0}return!1};var Du=Me[0],du=Me.at(-1),pu=Ue[0],mu=Ue.at(-1),LD=ii[0],MD=ii.at(-1),UD=si[0],qD=si.at(-1),fu=Zt[0],hu=Zt.at(-1),nr=19968,[gu,Fu]=Cu(Zt);function Cu(s){let t=s[0],e=s[1];for(let n=0;n<s.length;n+=2){let i=s[n],r=s[n+1];if(nr>=i&&nr<=r)return[i,r];r-i>e-t&&(t=i,e=r)}return[t,e]}var ir=s=>s<Du||s>du?!1:qe(Me,s),sr=s=>s<pu||s>mu?!1:qe(Ue,s);var rr=s=>s>=gu&&s<=Fu?!0:s<fu||s>hu?!1:qe(Zt,s);function Eu(s){if(!Number.isSafeInteger(s))throw new TypeError(`Expected a code point, got \`${typeof s}\`.`)}function or(s,{ambiguousAsWide:t=!1}={}){return Eu(s),sr(s)||rr(s)||t&&ir(s)?2:1}var ar=()=>/[#*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 yu=new Intl.Segmenter,bu=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function ri(s,t={}){if(typeof s!="string"||s.length===0)return 0;let{ambiguousIsNarrow:e=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(s=Xt(s)),s.length===0)return 0;let i=0,r={ambiguousAsWide:!e};for(let{segment:o}of yu.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)&&!bu.test(o)){if(ar().test(o)){i+=2;continue}i+=or(a,r)}}return i}function oi({stream:s=process.stdout}={}){return!!(s&&s.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var ai=A(require("process"),1);function ui(){let{env:s}=ai.default,{TERM:t,TERM_PROGRAM:e}=s;return ai.default.platform!=="win32"?t!=="linux":!!s.WT_SESSION||!!s.TERMINUS_SUBLIME||s.ConEmuTask==="{cmd::Cmder}"||e==="Terminus-Sublime"||e==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||s.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var it=A(require("process"),1),wu=3,li=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.#t()}#n(){it.default.platform==="win32"||!it.default.stdin.isTTY||(it.default.stdin.setRawMode(!0),it.default.stdin.on("data",this.#s),it.default.stdin.resume())}#t(){it.default.stdin.isTTY&&(it.default.stdin.off("data",this.#s),it.default.stdin.pause(),it.default.stdin.setRawMode(!1))}#s(t){t[0]===wu&&it.default.emit("SIGINT")}},Au=new li,ci=Au;var _u=A(ti(),1),Di=class{#o=0;#n=!1;#t=0;#s=-1;#d=0;#e;#r;#i;#p;#f;#l;#c;#D;#h;#a;#u;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#e={color:"cyan",stream:Qt.default.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#e.color,this.spinner=this.#e.spinner,this.#f=this.#e.interval,this.#i=this.#e.stream,this.#l=typeof this.#e.isEnabled=="boolean"?this.#e.isEnabled:oi({stream:this.#i}),this.#c=typeof this.#e.isSilent=="boolean"?this.#e.isSilent:!1,this.text=this.#e.text,this.prefixText=this.#e.prefixText,this.suffixText=this.#e.suffixText,this.indent=this.#e.indent,Qt.default.env.NODE_ENV==="test"&&(this._stream=this.#i,this._isEnabled=this.#l,Object.defineProperty(this,"_linesToClear",{get(){return this.#o},set(e){this.#o=e}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#s}}),Object.defineProperty(this,"_lineCount",{get(){return this.#t}}))}get indent(){return this.#D}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#D=t,this.#m()}get interval(){return this.#f??this.#r.interval??100}get spinner(){return this.#r}set spinner(t){if(this.#s=-1,this.#f=void 0,typeof t=="object"){if(t.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#r=t}else if(!ui())this.#r=te.default.line;else if(t===void 0)this.#r=te.default.dots;else if(t!=="default"&&te.default[t])this.#r=te.default[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#h}set text(t=""){this.#h=t,this.#m()}get prefixText(){return this.#a}set prefixText(t=""){this.#a=t,this.#m()}get suffixText(){return this.#u}set suffixText(t=""){this.#u=t,this.#m()}get isSpinning(){return this.#p!==void 0}#g(t=this.#a,e=" "){return typeof t=="string"&&t!==""?t+e:typeof t=="function"?t()+e:""}#F(t=this.#u,e=" "){return typeof t=="string"&&t!==""?e+t:typeof t=="function"?e+t():""}#m(){let t=this.#i.columns??80,e=this.#g(this.#a,"-"),n=this.#F(this.#u,"-"),i=" ".repeat(this.#D)+e+"--"+this.#h+"--"+n;this.#t=0;for(let r of Xt(i).split(`
49
+ `))this.#t+=Math.max(1,Math.ceil(ri(r,{countAnsiEscapeCodes:!0})/t))}get isEnabled(){return this.#l&&!this.#c}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#l=t}get isSilent(){return this.#c}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#c=t}frame(){let t=Date.now();(this.#s===-1||t-this.#d>=this.interval)&&(this.#s=++this.#s%this.#r.frames.length,this.#d=t);let{frames:e}=this.#r,n=e[this.#s];this.color&&(n=nt[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 t=0;t<this.#o;t++)t>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.#t,this)}start(t){return t&&(this.text=t),this.#c?this:this.#l?this.isSpinning?this:(this.#e.hideCursor&&Qn.hide(this.#i),this.#e.discardStdin&&Qt.default.stdin.isTTY&&(this.#n=!0,ci.start()),this.render(),this.#p=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#i.write(`- ${this.text}
50
+ `),this)}stop(){return this.#l?(clearInterval(this.#p),this.#p=void 0,this.#s=0,this.clear(),this.#e.hideCursor&&Qn.show(this.#i),this.#e.discardStdin&&Qt.default.stdin.isTTY&&this.#n&&(ci.stop(),this.#n=!1),this):this}succeed(t){return this.stopAndPersist({symbol:zt.success,text:t})}fail(t){return this.stopAndPersist({symbol:zt.error,text:t})}warn(t){return this.stopAndPersist({symbol:zt.warning,text:t})}info(t){return this.stopAndPersist({symbol:zt.info,text:t})}stopAndPersist(t={}){if(this.#c)return this;let e=t.prefixText??this.#a,n=this.#g(e," "),i=t.symbol??" ",r=t.text??this.text,a=typeof r=="string"?(i?" ":"")+r:"",u=t.suffixText??this.#u,l=this.#F(u," "),c=n+i+a+l+`
51
+ `;return this.stop(),this.#i.write(c),this}};function di(s){return new Di(s)}var gt={start(){return gt},stop(){return gt},succeed(){return gt},fail(){return gt},warn(){return gt},info(){return gt},text:"",isSpinning:!1};function y(s){return d()?gt:di({text:s,color:"cyan"})}function ur(s){let t=s.command("documents").description("Document upload and processing");t.command("upload <extractionSchemaId> <file>").description("Upload a document for extraction").action(async(e,n)=>{let i=new h(f()),r=Ve.resolve(n);Je.existsSync(r)||(console.error(`File not found: ${r}`),process.exit(1));let o=y(`Uploading ${Ve.basename(r)}...`);o.start();let a=await i.uploadFile(e,r);a.isDuplicate?o.warn("File already exists (duplicate)."):o.succeed("File uploaded."),d()?p(a):w(a)}),t.command("process <extractionSchemaId> <fileId>").description("Process a document for extraction").option("--async","Process asynchronously").option("--wait","Wait for completion (implies --async)").action(async(e,n,i)=>{let r=new h(f());if(i.async||i.wait){let a=await r.documents.processAsync(e,n);if(i.wait){let u=y(`Waiting for extraction (job ${a.jobId})...`);u.start();let c=await new X(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,e);d()?p(D):w({fileId:n,status:"COMPLETED",tables:Object.keys(D.data?.tables??{}).length})}else u.fail(`Extraction ${c.status}`),process.exit(1)}else d()?p(a):(b("Processing job queued."),w(a))}else{let a=y("Processing file...");a.start();let u=await r.documents.processSync(e,n);a.succeed("Processing complete."),d()?p(u):w(u)}}),t.command("get <fileId>").description("Get extracted file data").option("--extraction-schema-id <id>","Extraction schema ID").action(async(e,n)=>{let r=await new h(f()).documents.getFileData(e,n.extractionSchemaId);d()?p(r):w(r)}),t.command("correct <extractionSchemaId> <fileId>").description("Submit corrections for extracted data").requiredOption("--corrections <file>","JSON file with corrections").action(async(e,n,i)=>{let r=new h(f()),o=Je.readFileSync(i.corrections,"utf-8"),a=JSON.parse(o);await r.documents.submitCorrections(e,n,a),d()?p({success:!0}):b("Corrections submitted.")})}var pi=A(require("fs"));function lr(s){let t=s.command("tables").description("Table management");t.command("create <deploymentId>").description("Create a table in a deployment").requiredOption("--body <file>","JSON file with table definition").action(async(e,n)=>{let i=new h(f()),r=pi.readFileSync(n.body,"utf-8"),o=JSON.parse(r),a=await i.tables.createTable(e,o);d()?p(a):(b("Table created."),w(a))}),t.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(e,n)=>{let i=new h(f()),r={};if(n.instructionsFile?r.instructions=pi.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(e,r);d()?p(o):(b("Table updated."),w(o))}),t.command("get <tableId>").description("Get table details").action(async e=>{let i=await new h(f()).tables.get(e);d()?p(i):w(i)}),t.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(e,n)=>{let i=new h(f());if(n.all){let r=await Ce(ds(async(o,a)=>i.tables.listRows(e,{limit:o,offset:a}),{pageSize:500}));d()?p(r):O(r)}else{let r=await i.tables.listRows(e,{limit:parseInt(n.limit),offset:parseInt(n.offset)});d()?p(r):O(r.data)}}),t.command("columns <tableId>").description("List columns in a table").action(async e=>{let i=await new h(f()).tables.listColumns(e);d()?p(i):O(i,["id","name","type"])})}function cr(s){s.command("columns").description("Column management").command("get <columnId>").description("Get column details").action(async e=>{let i=await new h(f()).http.get(`/columns/${e}`);d()?p(i):w(i)})}function Dr(s){let t=s.command("schema").description("Extraction schema management");t.command("get <extractionSchemaId>").description("Get extraction schema details").action(async e=>{let i=await new h(f()).schema.get(e);d()?p(i):w(i)}),t.command("data <extractionSchemaId>").description("Get all data for an extraction schema").action(async e=>{let i=await new h(f()).schema.getAllData(e);d()?p(i):w(i)})}var dr=A(require("fs"));function pr(s){let t=s.command("benchmarks").description("Benchmark management");t.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(e,n)=>{let i=new h(f()),r={name:n.name};if(n.description&&(r.description=n.description),n.fileIds&&(r.fileIds=n.fileIds.split(",")),n.configFile){let a=dr.readFileSync(n.configFile,"utf-8"),u=JSON.parse(a);r={...r,...u}}let o=await i.http.post(`/benchmark/${e}/run-benchmark`,r);d()?p(o):(b("Benchmark started."),w(o))}),t.command("files <extractionSchemaId>").description("List files available for benchmarking").action(async e=>{let i=await new h(f()).http.get(`/benchmark/${e}/list-files`),r=Array.isArray(i)?i:i.data||i;d()?p(i):O(r)}),t.command("results <extractionSchemaId>").description("Get benchmark results").requiredOption("--execution-id <id>","Execution ID").action(async(e,n)=>{let r=await new h(f()).http.get(`/benchmark/${e}/get-results`,{executionId:n.executionId});d()?p(r):w(r)}),t.command("status <executionId>").description("Get benchmark execution status").action(async e=>{let i=await new h(f()).http.get(`/benchmarks/${e}`);d()?p(i):w(i)}),t.command("metrics <executionId>").description("Get benchmark execution metrics").action(async e=>{let i=await new h(f()).http.get(`/benchmarks/${e}/metrics`);d()?p(i):w(i)})}var lt=A(require("fs")),ne=A(require("path")),We=require("stream"),gr=require("stream/promises");var He=A(require("fs")),ee=A(require("path"));var Iu=["JOB_CONTEXT.json",ee.join(process.env.HOME||"/home/daytona","JOB_CONTEXT.json")];function mr(s){let t=s?[ee.resolve(s)]:Iu.map(e=>ee.resolve(e));for(let e of t)if(He.existsSync(e)){let n=He.readFileSync(e,"utf-8"),i;try{i=JSON.parse(n)}catch{throw new q(`Invalid JSON in ${e}`)}return xu(i,e),i}throw new N("JOB_CONTEXT.json not found. Searched: "+t.join(", "),{code:"JOB_CONTEXT_NOT_FOUND",exitCode:1})}function xu(s,t){let e=[];if(s.jobId||e.push("jobId"),s.fileId||e.push("fileId"),s.fileName||e.push("fileName"),s.sourceFileUrl||e.push("sourceFileUrl"),s.deploymentId||e.push("deploymentId"),s.extractionSchemaId||e.push("extractionSchemaId"),e.length>0)throw new q(`JOB_CONTEXT.json (${t}) missing required fields: ${e.join(", ")}`);if(!s.schema||!Array.isArray(s.schema.tables)||s.schema.tables.length===0)throw new q(`JOB_CONTEXT.json (${t}) must have schema.tables with at least one table`);for(let n of s.schema.tables){if(!n.id||!n.name)throw new q("JOB_CONTEXT.json: table missing id or name");if(!Array.isArray(n.columns)||n.columns.length===0)throw new q(`JOB_CONTEXT.json: table "${n.name}" has no columns`)}}function fr(s,t){let e=[],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 t.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){e.push(`Table "${u}" not found in schema. Available tables: ${[...o.keys()].join(", ")}`);continue}let c=s.tables[u];if(!Array.isArray(c)){e.push(`Table "${u}": rows must be an array`);continue}let D=!l.isPrimary,m=new Set(l.columns.map(g=>g.name)),F=new Map(l.columns.map(g=>[g.name,g]));for(let g=0;g<c.length;g++){let T=c[g];Su(T,g,u,D,m,F,e,n)}i.push({name:u,rowCount:c.length,isChild:D}),r+=c.length}for(let u of t.schema.tables)a.includes(u.name)||n.push(`Schema table "${u.name}" has no data in submission`);return{valid:e.length===0,errors:e,warnings:n,summary:{tablesFound:a.length,totalRows:r,tableDetails:i}}}function Su(s,t,e,n,i,r,o,a){let u=`Table "${e}" row ${t}`;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&&vu(s.cells[D],D,m.type,m.isList,u,a)}c===0&&o.push(`${u}: no cell keys match any schema column`)}function vu(s,t,e,n,i,r){if(s!=null){if(n&&!Array.isArray(s)){r.push(`${i}: column "${t}" is a LIST but value is not an array`);return}switch(e){case"NUMBER":typeof s!="number"&&typeof s!="string"&&r.push(`${i}: column "${t}" (NUMBER) has unexpected type ${typeof s}`);break;case"BOOLEAN":typeof s!="boolean"&&r.push(`${i}: column "${t}" (BOOLEAN) has unexpected type ${typeof s}`);break;case"DATE":typeof s!="string"&&r.push(`${i}: column "${t}" (DATE) should be an ISO date string`);break;case"LIST":Array.isArray(s)||r.push(`${i}: column "${t}" (LIST) should be an array`);break}}}var hr=200;function Fr(s){let t=s.command("jobs").description("Job queue management");t.command("status <jobId>").description("Get job status").option("--wait","Poll until job completes").option("--timeout <seconds>","Timeout in seconds","300").action(async(e,n)=>{let i=new h(f());if(n.wait){let r=new X(i.queue),o=y(`Waiting for job ${e}...`);o.start();let a;for await(let u of r.poll(e,{timeoutMs:parseInt(n.timeout)*1e3}))o.text=`Job ${e}: ${u.status} (extraction: ${u.extractionStageStatus})`,a=u;a?.status==="COMPLETED"?o.succeed(`Job ${e} completed.`):o.fail(`Job ${e}: ${a?.status}`),d()?p(a):w(a)}else{let r=await i.queue.getStatus(e);d()?p(r):w(r)}}),t.command("wait <jobId>").description("Wait for a job to complete").option("--timeout <seconds>","Timeout in seconds","300").action(async(e,n)=>{let i=new h(f()),r=new X(i.queue),o=y(`Waiting for job ${e}...`);o.start();let a=await r.waitForCompletion(e,{timeoutMs:parseInt(n.timeout)*1e3,onStatus:u=>{o.text=`Job ${e}: ${u.status}`}});a.status==="COMPLETED"?o.succeed(`Job ${e} completed.`):o.fail(`Job ${e}: ${a.status}`),d()?p(a):w(a)}),t.command("cancel <jobId>").description("Cancel a queued job").action(async e=>{await new h(f()).queue.cancel(e),d()?p({success:!0,jobId:e}):b(`Job ${e} cancelled.`)}),t.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(e,n)=>{let i=n.status.toUpperCase();if(!["PROCESSING","COMPLETED","FAILED"].includes(i))throw new q("Status must be PROCESSING, COMPLETED, or FAILED");if(i==="FAILED"&&!n.errorMessage)throw new q("--error-message is required when status is FAILED");let o=await new h(f()).queue.updateStatus(e,{status:i,errorMessage:n.errorMessage,pages:n.pages?parseInt(n.pages):void 0,rows:n.rows?parseInt(n.rows):void 0});d()?p(o):b(`Job ${e} status updated to ${i}`)}),t.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(e,n)=>{let i=new h(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(e);if(!a.ok)throw new N(`Failed to download: HTTP ${a.status}`,{code:"DOWNLOAD_ERROR",exitCode:1});let u=ne.resolve(n.output),l=ne.dirname(u);if(lt.existsSync(l)||lt.mkdirSync(l,{recursive:!0}),!a.body)throw new N("Download failed: response body is empty",{code:"DOWNLOAD_ERROR",exitCode:1});let c=0,D=new We.Transform({transform(F,g,T){c+=F.byteLength,T(null,F)}});await(0,gr.pipeline)(We.Readable.fromWeb(a.body),D,lt.createWriteStream(u)),o.succeed(`Downloaded (${$u(c)})`);let m={file:u,bytes:c};r&&(m.jobId=r,m.status="PROCESSING"),d()&&p(m)}catch(a){throw o.fail("Download failed"),r&&await Ru(i,r,a),a}}),t.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(hr)).option("--dry-run","Validate and show plan without submitting").action(async(e,n)=>{let i=mr(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 h(f()),l=parseInt(n.batchSize)||hr,c=y("Loading and validating submission...");c.start();try{let D=Bu(e),m=fr(D,i);if(!m.valid){c.fail("Validation failed");for(let _ of m.errors)console.error(`\x1B[31m ${_}\x1B[0m`);d()&&p({error:{code:"VALIDATION_ERROR",errors:m.errors}}),process.exit(1)}if(m.warnings.length>0&&!d())for(let _ of m.warnings)ot(` ${_}`);let F=new Map,g=[],T=[];for(let _ of i.schema.tables)F.set(_.name,_.id),_.isPrimary?g.push(_.name):T.push(_.name);if(n.dryRun){c.succeed("Validation passed (dry run)");let _={dryRun:!0,validation:m.summary,deleteOrder:[...T,...g].filter(S=>D.tables[S]).map(S=>({table:S,tableId:F.get(S)})),createOrder:[...g,...T].filter(S=>D.tables[S]).map(S=>({table:S,tableId:F.get(S),rows:D.tables[S].length,batches:Math.ceil(D.tables[S].length/l)}))};if(d())p(_);else{P("Delete order:");for(let S of _.deleteOrder)P(` ${S.table} (${S.tableId})`);P("Create order:");for(let S of _.createOrder)P(` ${S.table}: ${S.rows} rows in ${S.batches} batch(es)`)}return}let B=Object.keys(D.tables),E=[...T,...g].filter(_=>B.includes(_));for(let _ of E){let S=F.get(_);c.text=`Deleting existing rows from "${_}"...`,await u.tables.deleteRows(S,{fileId:o,deploymentId:a})}let C=0,I=new Map;for(let _ of g){let S=D.tables[_];if(!S||S.length===0)continue;let qt=F.get(_),mt=new Map;I.set(_,mt);let Dt=await Tu(u,qt,o,a,S,l,c,_);for(let G=0;G<S.length;G++)Dt[G]&&mt.set(S[G].index,Dt[G]);C+=Dt.length}for(let _ of T){let S=D.tables[_];if(!S||S.length===0)continue;let qt=F.get(_),mt=Ou(_,i),Dt=mt?I.get(mt):void 0,G=S.map(At=>{let ln;if(At.parentIndex!==void 0&&Dt&&(ln=Dt.get(At.parentIndex),!ln))throw new q(`Table "${_}" row ${At.index}: parentIndex ${At.parentIndex} does not match any parent row`);return{cells:At.cells,index:At.index,parentRowId:ln}}),le=await Cr(u,qt,o,a,G,l,c,_);C+=le.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 J={status:"COMPLETED",jobId:r,tablesProcessed:m.summary.tablesFound,totalRowsCreated:C,tables:m.summary.tableDetails};d()&&p(J)}catch(D){c.fail("Submission failed");let m=D instanceof Error?D.message:String(D),F=D instanceof q?"VALIDATION_ERROR":"SUBMISSION_ERROR";d()?p({error:{code:F,message:m}}):console.error(`\x1B[31m ${m}\x1B[0m`),process.exit(1)}})}async function Tu(s,t,e,n,i,r,o,a){let u=i.map(l=>({cells:l.cells,index:l.index}));return Cr(s,t,e,n,u,r,o,a)}async function Cr(s,t,e,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 F=0;F<i.length;F+=r)m.push({start:F,batchRows:i.slice(F,F+r)});for(let F=0;F<m.length;F+=c){let g=m.slice(F,F+c),T=await Promise.all(g.map(({batchRows:B})=>s.tables.createRows(t,{fileId:e,deploymentId:n,rows:B})));for(let B=0;B<g.length;B++){let{start:E}=g[B];T[B].rowIds.forEach((C,I)=>{u[E+I]=C})}D+=g.length,o.text=`"${a}" batch ${D}/${l} (${Math.min(D*r,i.length)}/${i.length} rows)...`}return u.filter(Boolean)}function Ou(s,t){let e=t.schema.tables.find(i=>i.name===s);return!e||e.isPrimary?void 0:t.schema.tables.find(i=>i.isPrimary)?.name}function Bu(s){let t=ne.resolve(s);if(!lt.existsSync(t))throw new q(`File not found: ${t}`);let e=lt.readFileSync(t,"utf-8");try{return JSON.parse(e)}catch{throw new q(`Invalid JSON in ${t}`)}}async function Ru(s,t,e){try{let n=e instanceof Error?e.message:String(e);await s.queue.updateStatus(t,{status:"FAILED",errorMessage:n.slice(0,500)})}catch{}}function $u(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}var Ct=A(require("fs")),Ye=A(require("path"));var Ai=A(no());var ll={update(){},increment(){},stop(){}};function io(s){if(d())return ll;let t=s.format??" {bar} {percentage}% | {value}/{total} | {filename}",e=new Ai.default.SingleBar({format:t,barCompleteChar:"\u2588",barIncompleteChar:"\u2591",hideCursor:!0,clearOnComplete:!1,stopOnComplete:!0},Ai.default.Presets.shades_classic);return e.start(s.total,0),{update(n,i){e.update(n,i)},increment(n=1,i){e.increment(n,i)},stop(){e.stop()}}}function so(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(t,e,n)=>{let i=f(),r=new h(i),o=Ye.resolve(e),a=n.process||n.wait;Ct.existsSync(o)||(console.error(`Path not found: ${o}`),process.exit(1));let u=Ct.statSync(o);if(u.isFile()){let l=y(`Uploading ${Ye.basename(o)}...`);l.start();let c=await r.uploadFile(t,o);if(c.isDuplicate?l.warn(`File already exists (duplicate). File ID: ${c.fileId}`):l.succeed(`Uploaded ${c.filename} (${cl(c.bytesUploaded)})`),a){let D=y("Queuing for extraction...");D.start();let m=await r.documents.processAsync(t,c.fileId);if(D.succeed(`Queued. Job ID: ${m.jobId}`),n.wait){let F=new X(r.queue),g=y("Waiting for extraction...");g.start();let T=await F.waitForCompletion(m.jobId,{onStatus:B=>{g.text=`Extraction: ${B.status} (${B.extractionStageStatus})`}});if(T.status==="COMPLETED"){g.succeed("Extraction completed.");let B=await r.documents.getFileData(c.fileId,t);n.output?(Ct.writeFileSync(n.output,JSON.stringify(B,null,2)),b(`Results written to ${n.output}`)):d()?p(B):w({fileId:c.fileId,status:"COMPLETED",tables:Object.keys(B.data?.tables??{}).length})}else g.fail(`Extraction ${T.status}`),process.exit(1)}else d()&&p({fileId:c.fileId,fileName:c.filename,jobId:m.jobId})}else d()&&p(c)}else if(u.isDirectory()){P(`Scanning ${o} for files...`);let l=await r.uploadFolder(t,o,{concurrency:parseInt(n.concurrency),process:a,globPattern:n.glob});if(l.total===0){ot("No supported files found in directory.");return}if(b(`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)ot(` Failed: ${D.filename} - ${D.error}`)}if(n.wait&&l.queued>0){let c=l.files.filter(F=>F.status==="queued"&&F.jobId);P(`Waiting for ${c.length} extractions to complete...`);let D=io({total:c.length,format:" Extracting {bar} {percentage}% | {value}/{total} files"}),m=0;await Promise.all(c.map(async F=>{await new X(r.queue).waitForCompletion(F.jobId),m++,D.update(m)})),D.stop(),b("All extractions completed.")}n.output?(Ct.writeFileSync(n.output,JSON.stringify(l,null,2)),b(`Results written to ${n.output}`)):d()&&p(l)}})}function cl(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var ro=A(require("fs"));function oo(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(t,e)=>{let n=new h(f()),i=y("Fetching extraction data...");i.start();let r=e.limit?parseInt(e.limit):e.all?void 0:100;if(e.output){let o=ro.createWriteStream(e.output),a=0,u=0;for await(let l of n.downloadAll(t,{pageSize:parseInt(e.pageSize),maxItems:r,order:e.order,status:e.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.`),b(`Data written to ${e.output} (NDJSON format)`)}else{let o=[],a=0;for await(let u of n.downloadAll(t,{pageSize:parseInt(e.pageSize),maxItems:r,order:e.order,status:e.status}))o.push(...u),a++,i.text=`Fetched ${o.length} rows (${a} pages)...`;i.succeed(`Downloaded ${o.length} rows.`),p(o)}})}var Ke=class extends Error{constructor(t,e){super(t),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}},ao=10,Dl=13,Et=32;function _i(s){}function co(s){if(typeof s=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=_i,onError:e=_i,onRetry:n=_i,onComment:i}=s,r=[],o=!0,a,u="",l=0,c;function D(E){if(o&&(o=!1,E.charCodeAt(0)===239&&E.charCodeAt(1)===187&&E.charCodeAt(2)===191&&(E=E.slice(3))),r.length===0){let J=m(E);J!==""&&r.push(J);return}if(E.indexOf(`
53
+ `)===-1&&E.indexOf("\r")===-1){r.push(E);return}r.push(E);let C=r.join("");r.length=0;let I=m(C);I!==""&&r.push(I)}function m(E){let C=0;if(E.indexOf("\r")===-1){let I=E.indexOf(`
54
54
  `,C);for(;I!==-1;){if(C===I){l>0&&t({id:a,event:c,data:u}),a=void 0,u="",l=0,c=void 0,C=I+1,I=E.indexOf(`
55
- `,C);continue}let q=E.charCodeAt(C);if(io(E,C,q)){let _=E.charCodeAt(C+5)===Ct?C+6:C+5,x=E.slice(_,I);if(l===0&&E.charCodeAt(I+1)===no){t({id:a,event:c,data:x}),a=void 0,u="",c=void 0,C=I+2,I=E.indexOf(`
56
- `,C);continue}u=l===0?x:`${u}
57
- ${x}`,l++}else so(E,C,q)?c=E.slice(E.charCodeAt(C+6)===Ct?C+7:C+6,I)||void 0:F(E,C,I);C=I+1,I=E.indexOf(`
58
- `,C)}return E.slice(C)}for(;C<E.length;){let I=E.indexOf("\r",C),q=E.indexOf(`
59
- `,C),_=-1;if(I!==-1&&q!==-1?_=I<q?I:q:I!==-1?I===E.length-1?_=-1:_=I:q!==-1&&(_=q),_===-1)break;F(E,C,_),C=_+1,E.charCodeAt(C-1)===Qu&&E.charCodeAt(C)===no&&C++}return E.slice(C)}function F(E,C,I){if(C===I){v();return}let q=E.charCodeAt(C);if(io(E,C,q)){let G=E.charCodeAt(C+5)===Ct?C+6:C+5,ue=E.slice(G,I);u=l===0?ue:`${u}
60
- ${ue}`,l++;return}if(so(E,C,q)){c=E.slice(E.charCodeAt(C+6)===Ct?C+7:C+6,I)||void 0;return}if(q===105&&E.charCodeAt(C+1)===100&&E.charCodeAt(C+2)===58){let G=E.slice(E.charCodeAt(C+3)===Ct?C+4:C+3,I);a=G.includes("\0")?void 0:G;return}if(q===58){if(i){let G=E.slice(C,I);i(G.slice(E.charCodeAt(C+1)===Ct?2:1))}return}let _=E.slice(C,I),x=_.indexOf(":");if(x===-1){g(_,"",_);return}let qt=_.slice(0,x),mt=_.charCodeAt(x+1)===Ct?2:1,Dt=_.slice(x+mt);g(qt,Dt,_)}function g(E,C,I){switch(E){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)):e(new Ge(`Invalid \`retry\` value: "${C}"`,{type:"invalid-retry",value:C,line:I}));break;default:e(new Ge(`Unknown field "${E.length>20?`${E.slice(0,20)}\u2026`:E}"`,{type:"unknown-field",field:E,value:C,line:I}));break}}function v(){l>0&&t({id:a,event:c,data:u}),a=void 0,u="",l=0,c=void 0}function B(E={}){if(E.consume&&r.length>0){let C=r.join("");F(C,0,C.length)}o=!0,a=void 0,u="",l=0,c=void 0,r.length=0}return{feed:D,reset:B}}function io(s,t,e){return e===100&&s.charCodeAt(t+1)===97&&s.charCodeAt(t+2)===116&&s.charCodeAt(t+3)===97&&s.charCodeAt(t+4)===58}function so(s,t,e){return e===101&&s.charCodeAt(t+1)===118&&s.charCodeAt(t+2)===101&&s.charCodeAt(t+3)===110&&s.charCodeAt(t+4)===116&&s.charCodeAt(t+5)===58}var Ke=class extends Event{constructor(t,e){var n,i;super(t),this.code=(n=e?.code)!=null?n:void 0,this.message=(i=e?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,e,n){return n(oo(this),e)}[Symbol.for("Deno.customInspect")](t,e){return t(oo(this),e)}};function tl(s){let t=globalThis.DOMException;return typeof t=="function"?new t(s,"SyntaxError"):new SyntaxError(s)}function bi(s){return s instanceof Error?"errors"in s&&Array.isArray(s.errors)?s.errors.map(bi).join(", "):"cause"in s&&s.cause instanceof Error?`${s}: ${bi(s.cause)}`:s.message:`${s}`}function oo(s){return{type:s.type,message:s.message,code:s.code,defaultPrevented:s.defaultPrevented,cancelable:s.cancelable,timeStamp:s.timeStamp}}var uo=s=>{throw TypeError(s)},vi=(s,t,e)=>t.has(s)||uo("Cannot "+e),T=(s,t,e)=>(vi(s,t,"read from private field"),e?e.call(s):t.get(s)),J=(s,t,e)=>t.has(s)?uo("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),M=(s,t,e,n)=>(vi(s,t,"write to private field"),t.set(s,e),e),ct=(s,t,e)=>(vi(s,t,"access private method"),e),K,Et,kt,Ye,ze,re,Nt,oe,pt,Pt,Lt,jt,ie,st,wi,Ai,_i,ao,Ii,xi,se,Si,Ti,yt=class extends EventTarget{constructor(t,e){var n,i;super(),J(this,st),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,J(this,K),J(this,Et),J(this,kt),J(this,Ye),J(this,ze),J(this,re),J(this,Nt),J(this,oe,null),J(this,pt),J(this,Pt),J(this,Lt,null),J(this,jt,null),J(this,ie,null),J(this,Ai,async r=>{var o;T(this,Pt).reset();let{body:a,redirected:u,status:l,headers:c}=r;if(l===204){ct(this,st,se).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?M(this,kt,new URL(r.url)):M(this,kt,void 0),l!==200){ct(this,st,se).call(this,`Non-200 status code (${l})`,l);return}if(!(c.get("content-type")||"").startsWith("text/event-stream")){ct(this,st,se).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(T(this,K)===this.CLOSED)return;M(this,K,this.OPEN);let D=new Event("open");if((o=T(this,ie))==null||o.call(this,D),this.dispatchEvent(D),typeof a!="object"||!a||!("getReader"in a)){ct(this,st,se).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}let p=new TextDecoder,F=a.getReader(),g=!0;do{let{done:v,value:B}=await F.read();B&&T(this,Pt).feed(p.decode(B,{stream:!v})),v&&(g=!1,T(this,Pt).reset(),ct(this,st,Si).call(this))}while(g)}),J(this,_i,r=>{M(this,pt,void 0),!(r.name==="AbortError"||r.type==="aborted")&&ct(this,st,Si).call(this,bi(r))}),J(this,Ii,r=>{typeof r.id=="string"&&M(this,oe,r.id);let o=new MessageEvent(r.event||"message",{data:r.data,origin:T(this,kt)?T(this,kt).origin:T(this,Et).origin,lastEventId:r.id||""});T(this,jt)&&(!r.event||r.event==="message")&&T(this,jt).call(this,o),this.dispatchEvent(o)}),J(this,xi,r=>{M(this,re,r)}),J(this,Ti,()=>{M(this,Nt,void 0),T(this,K)===this.CONNECTING&&ct(this,st,wi).call(this)});try{if(t instanceof URL)M(this,Et,t);else if(typeof t=="string")M(this,Et,new URL(t,el()));else throw new Error("Invalid URL")}catch{throw tl("An invalid or illegal string was specified")}M(this,Pt,ro({onEvent:T(this,Ii),onRetry:T(this,xi)})),M(this,K,this.CONNECTING),M(this,re,3e3),M(this,ze,(n=e?.fetch)!=null?n:globalThis.fetch),M(this,Ye,(i=e?.withCredentials)!=null?i:!1),ct(this,st,wi).call(this)}get readyState(){return T(this,K)}get url(){return T(this,Et).href}get withCredentials(){return T(this,Ye)}get onerror(){return T(this,Lt)}set onerror(t){M(this,Lt,t)}get onmessage(){return T(this,jt)}set onmessage(t){M(this,jt,t)}get onopen(){return T(this,ie)}set onopen(t){M(this,ie,t)}addEventListener(t,e,n){let i=e;super.addEventListener(t,i,n)}removeEventListener(t,e,n){let i=e;super.removeEventListener(t,i,n)}close(){T(this,Nt)&&clearTimeout(T(this,Nt)),T(this,K)!==this.CLOSED&&(T(this,pt)&&T(this,pt).abort(),M(this,K,this.CLOSED),M(this,pt,void 0))}};K=new WeakMap,Et=new WeakMap,kt=new WeakMap,Ye=new WeakMap,ze=new WeakMap,re=new WeakMap,Nt=new WeakMap,oe=new WeakMap,pt=new WeakMap,Pt=new WeakMap,Lt=new WeakMap,jt=new WeakMap,ie=new WeakMap,st=new WeakSet,wi=function(){M(this,K,this.CONNECTING),M(this,pt,new AbortController),T(this,ze)(T(this,Et),ct(this,st,ao).call(this)).then(T(this,Ai)).catch(T(this,_i))},Ai=new WeakMap,_i=new WeakMap,ao=function(){var s;let t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...T(this,oe)?{"Last-Event-ID":T(this,oe)}:void 0},cache:"no-store",signal:(s=T(this,pt))==null?void 0:s.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},Ii=new WeakMap,xi=new WeakMap,se=function(s,t){var e;T(this,K)!==this.CLOSED&&M(this,K,this.CLOSED);let n=new Ke("error",{code:t,message:s});(e=T(this,Lt))==null||e.call(this,n),this.dispatchEvent(n)},Si=function(s,t){var e;if(T(this,K)===this.CLOSED)return;M(this,K,this.CONNECTING);let n=new Ke("error",{code:t,message:s});(e=T(this,Lt))==null||e.call(this,n),this.dispatchEvent(n),M(this,Nt,setTimeout(T(this,Ti),T(this,re)))},Ti=new WeakMap,yt.CONNECTING=0,yt.OPEN=1,yt.CLOSED=2;function el(){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 Xe=class{eventSource=null;handlers=new Map;config;reconnectAttempts=0;maxReconnectAttempts=10;baseReconnectDelay=1e3;connected=!1;constructor(t){this.config={...t,sessionId:t.sessionId??crypto.randomUUID()}}async connect(){return new Promise((t,e)=>{let n=new URL("/events",this.config.sseUrl);n.searchParams.set("sessionId",this.config.sessionId),this.eventSource=new yt(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,t()},this.eventSource.onerror=()=>{if(!this.connected){e(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(t){if(!this.connected)throw new Error("Not connected to SSE server");let e=new URL("/subscribe",this.config.sseUrl),n=await fetch(e.toString(),{method:"POST",headers:{Authorization:`Bearer ${this.config.token}`,"Content-Type":"application/json"},body:JSON.stringify({projectId:t})});if(!n.ok)throw new Error(`Failed to subscribe to project ${t}: ${n.status}`)}async unsubscribe(t){if(!this.connected)return;let e=new URL("/unsubscribe",this.config.sseUrl);await fetch(e.toString(),{method:"POST",headers:{Authorization:`Bearer ${this.config.token}`,"Content-Type":"application/json"},body:JSON.stringify({projectId:t})})}on(t,e){let n=t;return this.handlers.has(n)||this.handlers.set(n,new Set),this.handlers.get(n).add(e),()=>{this.handlers.get(n)?.delete(e)}}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.connected=!1,this.handlers.clear()}get isConnected(){return this.connected}dispatchEvent(t){let e={type:t.type,data:t.data??t,timestamp:t.timestamp??new Date().toISOString(),sequenceNumber:t.sequenceNumber},n=this.handlers.get(e.type);if(n)for(let r of n)r(e);let i=this.handlers.get("*");if(i)for(let r of i)r(e)}handleReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts){this.disconnect();return}this.eventSource&&(this.eventSource.close(),this.eventSource=null);let t=this.baseReconnectDelay*Math.pow(2,this.reconnectAttempts);this.reconnectAttempts++,setTimeout(()=>{this.connect().catch(()=>{this.handleReconnect()})},t)}};function lo(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(t,e)=>{let n=f();n.sseUrl||(ot("SSE URL not configured. Set LIMAI_SSE_URL or run `limai config set sseUrl <url>`"),process.exit(1));let i=e.events?.split(",").map(o=>o.trim().toUpperCase())??null;V(`Connecting to event stream for project ${t}...`);let r=new Xe({sseUrl:n.sseUrl,token:n.token});try{if(await r.connect(),await r.subscribe(t),V("Connected. Watching for events... (Ctrl+C to stop)"),r.on("*",o=>{if(!(i&&!i.includes(o.type)))if(d())m(o);else{let a=new Date(o.timestamp).toLocaleTimeString();console.log(`[${a}] ${o.type}`),o.data&&console.log(` ${JSON.stringify(o.data)}`)}}),e.timeout){let o=parseInt(e.timeout)*1e3;setTimeout(()=>{V("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 co=A(require("fs")),bt=A(require("path"));function Do(s){let t=s.command("classify").description("Document classification");t.command("list").description("List classifiers in a project").requiredOption("--project-id <id>","Project ID").action(async e=>{let i=await new h(f()).classify.list(e.projectId);if(d())m(i);else{let r=Array.isArray(i)?i:[];O(r)}}),t.command("file <classifierId> <file>").description("Upload and classify a file").option("--async","Use async classification").option("--wait","Wait for async result").action(async(e,n,i)=>{let r=f(),o=new h(r),a=bt.resolve(n);co.existsSync(a)||(S({code:"NOT_FOUND",message:`File not found: ${a}`}),process.exit(1));let u=y(`Uploading ${bt.basename(a)}...`);u.start();let l=await o.classify.getUploadUrl(e,bt.basename(a)),c=bt.extname(a).toLowerCase(),p={".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg"}[c]||"application/octet-stream";if(await o.http.putFile(l.url,a,p),u.succeed("File uploaded."),i.async){let F=y("Classifying (async)...");F.start();let g=await o.classify.classifyAsync(e,l.fileId);g.fileId?F.succeed(`Classified -> ${g.deploymentName}`):F.warn("File could not be classified (UNCLASSIFIED)"),d()?m(g):w(g)}else{let F=y("Classifying...");F.start();let g=await o.classify.classify(e,l.fileId);g.fileId?F.succeed(`Classified -> ${g.deploymentName}`):F.warn("File could not be classified (UNCLASSIFIED)"),d()?m(g):w(g)}}),t.command("create").description("Create a new classifier").requiredOption("--name <name>","Classifier name").requiredOption("--project-id <id>","Project ID").action(async e=>{let i=await new h(f()).classify.createClassifier({name:e.name,projectId:e.projectId});d()?m(i):(b("Classifier created."),w(i))}),t.command("add-route <classifierId>").description("Add a deployment route to a classifier").requiredOption("--deployment-id <id>","Deployment ID").requiredOption("--name <name>","Route name").requiredOption("--description <desc>","Route description").action(async(e,n)=>{let r=await new h(f()).classify.createRoute(e,{deploymentId:n.deploymentId,name:n.name,description:n.description});d()?m(r):(b("Route added."),w(r))}),t.command("status <classifierId>").description("Check classification status").requiredOption("--classification-id <id>","Classification ID").action(async(e,n)=>{let r=await new h(f()).classify.getStatus(e,n.classificationId);d()?m(r):w(r)})}var po=A(require("fs")),ae=A(require("path"));function mo(s){let t=s.command("split").description("Document splitting");t.command("list-project").description("List splitters in a project").requiredOption("--project-id <id>","Project ID").action(async e=>{let i=await new h(f()).split.list(e.projectId);if(d())m(i);else{let r=Array.isArray(i)?i:[];O(r)}}),t.command("file <splitterId> <file>").description("Upload and split a document").option("--async","Use async splitting").option("--wait","Wait for async result").action(async(e,n,i)=>{let r=f(),o=new h(r),a=ae.resolve(n);po.existsSync(a)||(S({code:"NOT_FOUND",message:`File not found: ${a}`}),process.exit(1));let u=y(`Uploading ${ae.basename(a)}...`);u.start();let l=await o.split.getUploadUrl(e,ae.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(e,l.fileId);if(c.succeed(`Split queued. ID: ${D.splitId}`),i.wait){let p=y("Waiting for split...");p.start();let F=await o.split.getStatus(e,D.splitId);for(;F.status==="PENDING"||F.status==="PROCESSING";)await new Promise(g=>setTimeout(g,2e3)),F=await o.split.getStatus(e,D.splitId),p.text=`Split: ${F.status}`;F.status==="COMPLETED"?p.succeed(`Split completed. ${F.result?.segmentCount??0} segments.`):p.fail(`Split ${F.status}`),d()?m(F):w(F)}else d()&&m(D)}else{let c=y("Splitting document...");c.start();let D=await o.split.split(e,l.fileId);D.status==="COMPLETED"?c.succeed(`Split into ${D.segmentCount} segments.`):c.fail(`Split ${D.status}`),d()?m(D):w(D)}}),t.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 e=>{let i=await new h(f()).split.createSplitter({name:e.name,prompt:e.prompt,outputType:e.outputType,deploymentId:e.deploymentId,classifierId:e.classifierId,projectId:e.projectId,mergeSegments:e.mergeSegments});d()?m(i):(b("Splitter created."),w(i))}),t.command("status <splitterId>").description("Check split status").requiredOption("--split-id <id>","Split ID").action(async(e,n)=>{let r=await new h(f()).split.getStatus(e,n.splitId);d()?m(r):w(r)}),t.command("list <splitterId>").description("List splits").action(async e=>{let i=await new h(f()).split.listSplits(e);if(d())m(i);else{let r=Array.isArray(i)?i:[];O(r)}})}var fo=["apiUrl","token","sseUrl","defaultProjectId","defaultDeploymentId"];function ho(s){let t=s.command("config").description("CLI configuration");t.command("list").description("Show all config values").action(()=>{let e=It();if(!e){console.log("No configuration found.");return}let n={...e,token:e.token?`${e.token.slice(0,12)}...`:"(not set)"};d()?m(n):w(n)}),t.command("get <key>").description("Get a config value").action(e=>{let n=It();n||(S({code:"NOT_FOUND",message:"No configuration found."}),process.exit(1));let i=n[e];i===void 0&&(S({code:"VALIDATION",message:`Unknown key: ${e}`}),process.exit(1));let r=e==="token"&&typeof i=="string"&&i.length>12?`${i.slice(0,12)}...`:i;d()?m({[e]:r}):console.log(String(r))}),t.command("set <key> <value>").description("Set a config value").action((e,n)=>{fo.includes(e)||(S({code:"VALIDATION",message:`Unknown key: ${e}. Allowed: ${fo.join(", ")}`}),process.exit(1)),xt({[e]:n}),d()?m({[e]:n}):b(`Set ${e} = ${e==="token"?"***":n}`)})}var Ze=A(require("fs")),Fo=A(require("path"));var go=50;function Co(s){let t=s.command("rows").description("Row operations on tables");t.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(go)).action(async(e,n)=>{let i=new h(f()),r=parseInt(n.batchSize)||go,o=Fo.resolve(n.data);if(!Ze.existsSync(o))throw new U(`File not found: ${o}`);let a=Ze.readFileSync(o,"utf-8"),u;try{u=JSON.parse(a)}catch{throw new U(`Invalid JSON in ${o}`)}if(!Array.isArray(u))throw new U("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 F=0;F<u.length;F+=r){let g=u.slice(F,F+r),v=Math.floor(F/r)+1;l.text=`Creating rows batch ${v}/${D} (${c.length+g.length}/${u.length})...`;let B=await i.tables.createRows(e,{fileId:n.fileId,deploymentId:n.deploymentId,rows:g});c.push(...B.rowIds)}l.succeed(`Created ${c.length} rows.`);let p={rowsCreated:c.length,rowIds:c};d()?m(p):b(`${c.length} rows created in table ${e}`)}),t.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(e,n)=>{let i=new h(f()),r=y("Deleting rows...");r.start();let o=await i.tables.deleteRows(e,{fileId:n.fileId,deploymentId:n.deploymentId});r.succeed(`Deleted ${o.rowsDeleted} rows.`),d()?m(o):b(`${o.rowsDeleted} rows deleted from table ${e}`)})}var rt=A(require("fs")),tt=A(require("path"));function yo(s){let t=s.command("buckets").description("Bucket management");t.command("list <projectId>").description("List buckets in a project").action(async e=>{let i=await new h(f()).buckets.list(e);d()?m(i):O(i.map(r=>({id:r.id,name:r.name,files:r.fileCount,created:r.createdAt})))}),t.command("create <projectId>").description("Create a new bucket").requiredOption("--name <name>","Bucket name").option("--description <description>","Bucket description").action(async(e,n)=>{let r=await new h(f()).buckets.create(e,n.name,n.description);d()?m(r):(b(`Bucket created: ${r.id}`),w({id:r.id,name:r.name,description:r.description??""}))}),t.command("delete <bucketId>").description("Delete a bucket").action(async e=>{await new h(f()).buckets.delete(e),d()?m({success:!0}):b(`Bucket ${e} deleted.`)}),t.command("upload <bucketId> <path>").description("Upload file(s) to a bucket").action(async(e,n)=>{let i=f(),r=new h(i),o=tt.resolve(n);rt.existsSync(o)||(S({code:"NOT_FOUND",message:`Path not found: ${o}`}),process.exit(1));let a=rt.statSync(o);if(a.isFile())await Eo(r,e,o);else if(a.isDirectory()){let l=rt.readdirSync(o).map(p=>tt.join(o,p)).filter(p=>rt.statSync(p).isFile());if(l.length===0){ot("No files found in directory.");return}V(`Found ${l.length} file(s) to upload.`);let c=0,D=0;for(let p of l)try{await Eo(r,e,p),c++}catch(F){D++,ot(`Failed: ${tt.basename(p)} - ${F instanceof Error?F.message:"Unknown error"}`)}b(`Upload complete: ${c} uploaded, ${D} failed (${l.length} total)`)}}),t.command("files <bucketId>").description("List files in a bucket").option("--label <labels...>","Filter by labels").action(async(e,n)=>{let r=await new h(f()).buckets.listFiles(e,n.label);d()?m(r):O(r.map(o=>({id:o.id,name:o.name,labels:o.labels.join(", "),size:o.sizeBytes?Oi(o.sizeBytes):"-",status:o.status,created:o.createdAt})))}),t.command("download <bucketId> <fileId>").description("Download a file from a bucket").option("--output <path>","Output file path").action(async(e,n,i)=>{let r=new h(f()),o=y("Getting download URL...");o.start();let{url:a,fileName:u}=await r.buckets.getDownloadUrl(e,n),l=tt.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?tt.resolve(i.output):tt.resolve(l);rt.mkdirSync(tt.dirname(D),{recursive:!0}),o.text=`Downloading ${l}...`;let p=await fetch(a);p.ok||(o.fail(`Download failed: HTTP ${p.status}`),process.exit(1));let F=Buffer.from(await p.arrayBuffer());rt.writeFileSync(D,F);let g=F.length;o.succeed(`Downloaded ${l} (${Oi(g)}) to ${D}`),d()&&m({fileId:n,fileName:u,outputPath:D,bytes:g})}),t.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(e,n,i)=>{!i.add&&!i.remove&&(S({code:"VALIDATION",message:"Provide --add or --remove with label values."}),process.exit(1));let r=new h(f()),a=(await r.buckets.listFiles(e)).find(c=>c.id===n);a||(S({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(e,n,u);d()?m(l):b(`Labels updated: [${u.join(", ")}]`)}),t.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(e,n,i)=>{[i.deployment,i.classifier,i.splitter].filter(Boolean).length!==1&&(S({code:"VALIDATION",message:"Provide exactly one target: --deployment, --classifier, or --splitter."}),process.exit(1));let o=new h(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(e,n,a,u);l.succeed(`File sent to ${a.toLowerCase()}.`),d()&&m(c)})}async function Eo(s,t,e){let n=tt.basename(e),i=y(`Uploading ${n}...`);i.start();let{url:r,fileId:o}=await s.buckets.getUploadUrl(t,n),a=await s.http.putFile(r,e,"application/octet-stream");await s.buckets.confirmUpload(t,o,a),i.succeed(`Uploaded ${n} (${Oi(a)}) - File ID: ${o}`),d()&&m({fileId:o,filename:n,bytes:a})}function Oi(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var W=A(require("fs")),H=A(require("path"));var bo=A(require("path")),nl={".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 Qe(s){let t=bo.extname(s).toLowerCase();return nl[t]??"application/octet-stream"}function Ao(s){let t=s.command("agents").description("Agent management");t.command("list <projectId>").description("List agents in a project").option("--status <status>","Filter by status (ACTIVE, PAUSED, DISABLED)").action(async(i,r)=>{let a=await new h(f()).agents.list(i,r);d()?m(a):O(a.map(u=>({id:u.id,name:u.name,status:u.status,triggers:u.triggerTypes.join(", "),deployments:u.deploymentRoutes.map(l=>l.deploymentName).join(", "),runs:u.runCount,created:u.createdAt})))}),t.command("get <projectId> <agentId>").description("Show agent details").action(async(i,r)=>{let a=await new h(f()).agents.get(i,r);d()?m(a):w({id:a.id,name:a.name,status:a.status,triggers:a.triggerTypes.join(", "),"process content":Mt(a.processContent,120),deployments:a.deploymentRoutes.map(u=>`${u.deploymentName} (${u.deploymentId})`).join(", "),"email address":a.ingestEmailAddress??"",connection:a.connection?`${a.connection.provider} (${a.connection.status})`:"",files:a.files.map(u=>u.fileName).join(", "),skills:a.skills.map(u=>u.name).join(", "),runs:a.runCount,created:a.createdAt,updated:a.updatedAt})}),t.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("--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.",sl,[]).action(async(i,r)=>{let o=new h(f()),a="";if(r.processFile){let g=H.resolve(r.processFile);a=W.readFileSync(g,"utf-8")}let u=r.triggers.split(",").map(g=>g.trim()),l=r.deployments?r.deployments.split(",").map(g=>g.trim()):void 0,c=r.integrationConfigFile?JSON.parse(W.readFileSync(H.resolve(r.integrationConfigFile),"utf-8")):void 0,D=y("Creating agent...");D.start();let p=await o.agents.create(i,{name:r.name,processContent:a,triggerTypes:u,deploymentIds:l,connectionId:r.connectionId,integrationConfigs:c,emailLocalPart:r.emailLocalPart});D.succeed(`Agent created: ${p.id}`);let F=[];for(let g of r.file){let v=await wo(o,i,p.id,g);F.push(v)}d()?m({...p,uploadedFiles:F}):w({id:p.id,name:p.name,status:p.status,triggers:p.triggerTypes.join(", "),...F.length>0&&{files:F.map(g=>`${g.filename} (${g.fileId})`).join(", ")}})}),t.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("--email-local-part <value>","Custom email local part (before @domain). Optional.").action(async(i,r,o)=>{let a=new h(f()),u={};o.name&&(u.name=o.name),o.status&&(u.status=o.status),o.tier&&(u.tier=o.tier),o.connectionId&&(u.connectionId=o.connectionId),o.emailLocalPart&&(u.emailLocalPart=o.emailLocalPart),o.integrationConfigFile&&(u.integrationConfigs=JSON.parse(W.readFileSync(H.resolve(o.integrationConfigFile),"utf-8"))),o.processFile&&(u.processContent=W.readFileSync(H.resolve(o.processFile),"utf-8")),o.triggers&&(u.triggerTypes=o.triggers.split(",").map(c=>c.trim())),o.deployments&&(u.deploymentIds=o.deployments.split(",").map(c=>c.trim()));let l=y("Updating agent...");l.start(),await a.agents.update(i,r,u),l.succeed("Agent updated."),d()&&m({success:!0})}),t.command("delete <projectId> <agentId>").description("Delete an agent").action(async(i,r)=>{await new h(f()).agents.delete(i,r),d()?m({success:!0}):b(`Agent ${r} deleted.`)}),t.command("upload-file <projectId> <agentId> <filePath>").description("Upload a template file to an agent").action(async(i,r,o)=>{let a=new h(f()),u=await wo(a,i,r,o);d()&&m(u)}),t.command("delete-file <projectId> <agentId> <fileId>").description("Delete a template file from an agent").action(async(i,r,o)=>{await new h(f()).agents.deleteFile(i,r,o),d()?m({success:!0}):b(`File ${o} deleted.`)}),t.command("download-file <projectId> <agentId> <fileId>").description("Download a template file from an agent").option("--output <path>","Output file path").action(async(i,r,o,a)=>{let u=new h(f()),l=y("Getting download URL...");l.start();let{url:c,fileName:D}=await u.agents.getFileDownloadUrl(i,r,o),p=H.basename(D).replace(/[/\\:*?"<>|]/g,"_");!(p===D&&!D.startsWith(".")&&D.length>0)&&!a.output&&(l.fail(`Server returned an unsafe filename "${D}". Use --output to specify an explicit path.`),process.exit(1));let g=a.output?H.resolve(a.output):H.resolve(p);W.mkdirSync(H.dirname(g),{recursive:!0}),l.text=`Downloading ${D}...`;let v=await fetch(c);v.ok||(l.fail(`Download failed: HTTP ${v.status}`),process.exit(1));let B=Buffer.from(await v.arrayBuffer());W.writeFileSync(g,B);let E=B.length;l.succeed(`Downloaded ${D} (${Bi(E)}) to ${g}`),d()&&m({fileId:o,fileName:D,outputPath:g,bytes:E})});let e=t.command("skills").description("Agent skill management");e.command("list <projectId> <agentId>").description("List skills for an agent").action(async(i,r)=>{let a=await new h(f()).agents.listSkills(i,r);d()?m(a):O(a.map(u=>({id:u.id,name:u.name,content:Mt(u.content,80),created:u.createdAt})))}),e.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(i,r,o)=>{let a=new h(f()),u=W.readFileSync(H.resolve(o.contentFile),"utf-8"),l=y("Creating skill...");l.start();let c=await a.agents.createSkill(i,r,{name:o.name,content:u});l.succeed(`Skill created: ${c.id}`),d()?m(c):w({id:c.id,name:c.name})}),e.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(i,r,o,a)=>{let u=new h(f()),l={};a.name&&(l.name=a.name),a.contentFile&&(l.content=W.readFileSync(H.resolve(a.contentFile),"utf-8"));let c=y("Updating skill...");c.start(),await u.agents.updateSkill(i,r,o,l),c.succeed("Skill updated."),d()&&m({success:!0})}),e.command("delete <projectId> <agentId> <skillId>").description("Delete a skill").action(async(i,r,o)=>{await new h(f()).agents.deleteSkill(i,r,o),d()?m({success:!0}):b(`Skill ${o} deleted.`)}),e.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(i,r,o,a)=>{let l=await new h(f()).agents.linkFileToSkill(i,r,o,a);d()?m(l):b(`Linked ${l.file.fileName} to skill ${o}.`)}),e.command("unlink-file <projectId> <agentId> <skillId> <fileId>").description("Unlink a file from a skill").action(async(i,r,o,a)=>{await new h(f()).agents.unlinkFileFromSkill(i,r,o,a),d()?m({success:!0}):b(`Unlinked file ${a} from skill ${o}.`)});let n=t.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(i,r,o)=>{let u=await new h(f()).agents.listRuns(i,r,{limit:o.limit?parseInt(o.limit,10):void 0,status:o.status});d()?m(u):O(u.map(l=>({id:l.id,status:l.status,triggerType:l.triggerType,title:Mt(l.title,40),steps:l.stepsCount,duration:l.executionDurationMs?`${(l.executionDurationMs/1e3).toFixed(1)}s`:"-",created:l.createdAt})))}),n.command("get <projectId> <agentId> <runId>").description("Show run details").action(async(i,r,o)=>{let u=await new h(f()).agents.getRun(i,r,o);d()?m(u):(w({id:u.id,status:u.status,triggerType:u.triggerType,triggerEventId:u.triggerEventId,title:u.title,sandboxId:u.sandboxId??"-",errorMessage:u.errorMessage??"",duration:u.executionDurationMs?`${(u.executionDurationMs/1e3).toFixed(1)}s`:"-",startedAt:u.startedAt??"-",completedAt:u.completedAt??"-",created:u.createdAt}),u.steps.length>0&&(console.log(`
55
+ `,C);continue}let J=E.charCodeAt(C);if(uo(E,C,J)){let _=E.charCodeAt(C+5)===Et?C+6:C+5,S=E.slice(_,I);if(l===0&&E.charCodeAt(I+1)===ao){t({id:a,event:c,data:S}),a=void 0,u="",c=void 0,C=I+2,I=E.indexOf(`
56
+ `,C);continue}u=l===0?S:`${u}
57
+ ${S}`,l++}else lo(E,C,J)?c=E.slice(E.charCodeAt(C+6)===Et?C+7:C+6,I)||void 0:F(E,C,I);C=I+1,I=E.indexOf(`
58
+ `,C)}return E.slice(C)}for(;C<E.length;){let I=E.indexOf("\r",C),J=E.indexOf(`
59
+ `,C),_=-1;if(I!==-1&&J!==-1?_=I<J?I:J:I!==-1?I===E.length-1?_=-1:_=I:J!==-1&&(_=J),_===-1)break;F(E,C,_),C=_+1,E.charCodeAt(C-1)===Dl&&E.charCodeAt(C)===ao&&C++}return E.slice(C)}function F(E,C,I){if(C===I){T();return}let J=E.charCodeAt(C);if(uo(E,C,J)){let G=E.charCodeAt(C+5)===Et?C+6:C+5,le=E.slice(G,I);u=l===0?le:`${u}
60
+ ${le}`,l++;return}if(lo(E,C,J)){c=E.slice(E.charCodeAt(C+6)===Et?C+7:C+6,I)||void 0;return}if(J===105&&E.charCodeAt(C+1)===100&&E.charCodeAt(C+2)===58){let G=E.slice(E.charCodeAt(C+3)===Et?C+4:C+3,I);a=G.includes("\0")?void 0:G;return}if(J===58){if(i){let G=E.slice(C,I);i(G.slice(E.charCodeAt(C+1)===Et?2:1))}return}let _=E.slice(C,I),S=_.indexOf(":");if(S===-1){g(_,"",_);return}let qt=_.slice(0,S),mt=_.charCodeAt(S+1)===Et?2:1,Dt=_.slice(S+mt);g(qt,Dt,_)}function g(E,C,I){switch(E){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)):e(new Ke(`Invalid \`retry\` value: "${C}"`,{type:"invalid-retry",value:C,line:I}));break;default:e(new Ke(`Unknown field "${E.length>20?`${E.slice(0,20)}\u2026`:E}"`,{type:"unknown-field",field:E,value:C,line:I}));break}}function T(){l>0&&t({id:a,event:c,data:u}),a=void 0,u="",l=0,c=void 0}function B(E={}){if(E.consume&&r.length>0){let C=r.join("");F(C,0,C.length)}o=!0,a=void 0,u="",l=0,c=void 0,r.length=0}return{feed:D,reset:B}}function uo(s,t,e){return e===100&&s.charCodeAt(t+1)===97&&s.charCodeAt(t+2)===116&&s.charCodeAt(t+3)===97&&s.charCodeAt(t+4)===58}function lo(s,t,e){return e===101&&s.charCodeAt(t+1)===118&&s.charCodeAt(t+2)===101&&s.charCodeAt(t+3)===110&&s.charCodeAt(t+4)===116&&s.charCodeAt(t+5)===58}var Xe=class extends Event{constructor(t,e){var n,i;super(t),this.code=(n=e?.code)!=null?n:void 0,this.message=(i=e?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,e,n){return n(Do(this),e)}[Symbol.for("Deno.customInspect")](t,e){return t(Do(this),e)}};function dl(s){let t=globalThis.DOMException;return typeof t=="function"?new t(s,"SyntaxError"):new SyntaxError(s)}function Ii(s){return s instanceof Error?"errors"in s&&Array.isArray(s.errors)?s.errors.map(Ii).join(", "):"cause"in s&&s.cause instanceof Error?`${s}: ${Ii(s.cause)}`:s.message:`${s}`}function Do(s){return{type:s.type,message:s.message,code:s.code,defaultPrevented:s.defaultPrevented,cancelable:s.cancelable,timeStamp:s.timeStamp}}var mo=s=>{throw TypeError(s)},$i=(s,t,e)=>t.has(s)||mo("Cannot "+e),v=(s,t,e)=>($i(s,t,"read from private field"),e?e.call(s):t.get(s)),V=(s,t,e)=>t.has(s)?mo("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),U=(s,t,e,n)=>($i(s,t,"write to private field"),t.set(s,e),e),ct=(s,t,e)=>($i(s,t,"access private method"),e),K,yt,kt,ze,Ze,re,Nt,oe,pt,Pt,Lt,jt,ie,st,xi,Si,vi,po,Ti,Oi,se,Bi,Ri,bt=class extends EventTarget{constructor(t,e){var n,i;super(),V(this,st),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,V(this,K),V(this,yt),V(this,kt),V(this,ze),V(this,Ze),V(this,re),V(this,Nt),V(this,oe,null),V(this,pt),V(this,Pt),V(this,Lt,null),V(this,jt,null),V(this,ie,null),V(this,Si,async r=>{var o;v(this,Pt).reset();let{body:a,redirected:u,status:l,headers:c}=r;if(l===204){ct(this,st,se).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?U(this,kt,new URL(r.url)):U(this,kt,void 0),l!==200){ct(this,st,se).call(this,`Non-200 status code (${l})`,l);return}if(!(c.get("content-type")||"").startsWith("text/event-stream")){ct(this,st,se).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(v(this,K)===this.CLOSED)return;U(this,K,this.OPEN);let D=new Event("open");if((o=v(this,ie))==null||o.call(this,D),this.dispatchEvent(D),typeof a!="object"||!a||!("getReader"in a)){ct(this,st,se).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}let m=new TextDecoder,F=a.getReader(),g=!0;do{let{done:T,value:B}=await F.read();B&&v(this,Pt).feed(m.decode(B,{stream:!T})),T&&(g=!1,v(this,Pt).reset(),ct(this,st,Bi).call(this))}while(g)}),V(this,vi,r=>{U(this,pt,void 0),!(r.name==="AbortError"||r.type==="aborted")&&ct(this,st,Bi).call(this,Ii(r))}),V(this,Ti,r=>{typeof r.id=="string"&&U(this,oe,r.id);let o=new MessageEvent(r.event||"message",{data:r.data,origin:v(this,kt)?v(this,kt).origin:v(this,yt).origin,lastEventId:r.id||""});v(this,jt)&&(!r.event||r.event==="message")&&v(this,jt).call(this,o),this.dispatchEvent(o)}),V(this,Oi,r=>{U(this,re,r)}),V(this,Ri,()=>{U(this,Nt,void 0),v(this,K)===this.CONNECTING&&ct(this,st,xi).call(this)});try{if(t instanceof URL)U(this,yt,t);else if(typeof t=="string")U(this,yt,new URL(t,pl()));else throw new Error("Invalid URL")}catch{throw dl("An invalid or illegal string was specified")}U(this,Pt,co({onEvent:v(this,Ti),onRetry:v(this,Oi)})),U(this,K,this.CONNECTING),U(this,re,3e3),U(this,Ze,(n=e?.fetch)!=null?n:globalThis.fetch),U(this,ze,(i=e?.withCredentials)!=null?i:!1),ct(this,st,xi).call(this)}get readyState(){return v(this,K)}get url(){return v(this,yt).href}get withCredentials(){return v(this,ze)}get onerror(){return v(this,Lt)}set onerror(t){U(this,Lt,t)}get onmessage(){return v(this,jt)}set onmessage(t){U(this,jt,t)}get onopen(){return v(this,ie)}set onopen(t){U(this,ie,t)}addEventListener(t,e,n){let i=e;super.addEventListener(t,i,n)}removeEventListener(t,e,n){let i=e;super.removeEventListener(t,i,n)}close(){v(this,Nt)&&clearTimeout(v(this,Nt)),v(this,K)!==this.CLOSED&&(v(this,pt)&&v(this,pt).abort(),U(this,K,this.CLOSED),U(this,pt,void 0))}};K=new WeakMap,yt=new WeakMap,kt=new WeakMap,ze=new WeakMap,Ze=new WeakMap,re=new WeakMap,Nt=new WeakMap,oe=new WeakMap,pt=new WeakMap,Pt=new WeakMap,Lt=new WeakMap,jt=new WeakMap,ie=new WeakMap,st=new WeakSet,xi=function(){U(this,K,this.CONNECTING),U(this,pt,new AbortController),v(this,Ze)(v(this,yt),ct(this,st,po).call(this)).then(v(this,Si)).catch(v(this,vi))},Si=new WeakMap,vi=new WeakMap,po=function(){var s;let t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...v(this,oe)?{"Last-Event-ID":v(this,oe)}:void 0},cache:"no-store",signal:(s=v(this,pt))==null?void 0:s.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},Ti=new WeakMap,Oi=new WeakMap,se=function(s,t){var e;v(this,K)!==this.CLOSED&&U(this,K,this.CLOSED);let n=new Xe("error",{code:t,message:s});(e=v(this,Lt))==null||e.call(this,n),this.dispatchEvent(n)},Bi=function(s,t){var e;if(v(this,K)===this.CLOSED)return;U(this,K,this.CONNECTING);let n=new Xe("error",{code:t,message:s});(e=v(this,Lt))==null||e.call(this,n),this.dispatchEvent(n),U(this,Nt,setTimeout(v(this,Ri),v(this,re)))},Ri=new WeakMap,bt.CONNECTING=0,bt.OPEN=1,bt.CLOSED=2;function pl(){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 Qe=class{eventSource=null;handlers=new Map;config;reconnectAttempts=0;maxReconnectAttempts=10;baseReconnectDelay=1e3;connected=!1;constructor(t){this.config={...t,sessionId:t.sessionId??crypto.randomUUID()}}async connect(){return new Promise((t,e)=>{let n=new URL("/events",this.config.sseUrl);n.searchParams.set("sessionId",this.config.sessionId),this.eventSource=new bt(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,t()},this.eventSource.onerror=()=>{if(!this.connected){e(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(t){if(!this.connected)throw new Error("Not connected to SSE server");let e=new URL("/subscribe",this.config.sseUrl),n=await fetch(e.toString(),{method:"POST",headers:{Authorization:`Bearer ${this.config.token}`,"Content-Type":"application/json"},body:JSON.stringify({projectId:t})});if(!n.ok)throw new Error(`Failed to subscribe to project ${t}: ${n.status}`)}async unsubscribe(t){if(!this.connected)return;let e=new URL("/unsubscribe",this.config.sseUrl);await fetch(e.toString(),{method:"POST",headers:{Authorization:`Bearer ${this.config.token}`,"Content-Type":"application/json"},body:JSON.stringify({projectId:t})})}on(t,e){let n=t;return this.handlers.has(n)||this.handlers.set(n,new Set),this.handlers.get(n).add(e),()=>{this.handlers.get(n)?.delete(e)}}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this.connected=!1,this.handlers.clear()}get isConnected(){return this.connected}dispatchEvent(t){let e={type:t.type,data:t.data??t,timestamp:t.timestamp??new Date().toISOString(),sequenceNumber:t.sequenceNumber},n=this.handlers.get(e.type);if(n)for(let r of n)r(e);let i=this.handlers.get("*");if(i)for(let r of i)r(e)}handleReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts){this.disconnect();return}this.eventSource&&(this.eventSource.close(),this.eventSource=null);let t=this.baseReconnectDelay*Math.pow(2,this.reconnectAttempts);this.reconnectAttempts++,setTimeout(()=>{this.connect().catch(()=>{this.handleReconnect()})},t)}};function fo(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(t,e)=>{let n=f();n.sseUrl||(ot("SSE URL not configured. Set LIMAI_SSE_URL or run `limai config set sseUrl <url>`"),process.exit(1));let i=e.events?.split(",").map(o=>o.trim().toUpperCase())??null;P(`Connecting to event stream for project ${t}...`);let r=new Qe({sseUrl:n.sseUrl,token:n.token});try{if(await r.connect(),await r.subscribe(t),P("Connected. Watching for events... (Ctrl+C to stop)"),r.on("*",o=>{if(!(i&&!i.includes(o.type)))if(d())p(o);else{let a=new Date(o.timestamp).toLocaleTimeString();console.log(`[${a}] ${o.type}`),o.data&&console.log(` ${JSON.stringify(o.data)}`)}}),e.timeout){let o=parseInt(e.timeout)*1e3;setTimeout(()=>{P("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 ho=A(require("fs")),wt=A(require("path"));function go(s){let t=s.command("classify").description("Document classification");t.command("list").description("List classifiers in a project").requiredOption("--project-id <id>","Project ID").action(async e=>{let i=await new h(f()).classify.list(e.projectId);if(d())p(i);else{let r=Array.isArray(i)?i:[];O(r)}}),t.command("file <classifierId> <file>").description("Upload and classify a file").option("--async","Use async classification").option("--wait","Wait for async result").action(async(e,n,i)=>{let r=f(),o=new h(r),a=wt.resolve(n);ho.existsSync(a)||(x({code:"NOT_FOUND",message:`File not found: ${a}`}),process.exit(1));let u=y(`Uploading ${wt.basename(a)}...`);u.start();let l=await o.classify.getUploadUrl(e,wt.basename(a)),c=wt.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 F=y("Classifying (async)...");F.start();let g=await o.classify.classifyAsync(e,l.fileId);g.fileId?F.succeed(`Classified -> ${g.deploymentName}`):F.warn("File could not be classified (UNCLASSIFIED)"),d()?p(g):w(g)}else{let F=y("Classifying...");F.start();let g=await o.classify.classify(e,l.fileId);g.fileId?F.succeed(`Classified -> ${g.deploymentName}`):F.warn("File could not be classified (UNCLASSIFIED)"),d()?p(g):w(g)}}),t.command("create").description("Create a new classifier").requiredOption("--name <name>","Classifier name").requiredOption("--project-id <id>","Project ID").action(async e=>{let i=await new h(f()).classify.createClassifier({name:e.name,projectId:e.projectId});d()?p(i):(b("Classifier created."),w(i))}),t.command("add-route <classifierId>").description("Add a deployment route to a classifier").requiredOption("--deployment-id <id>","Deployment ID").requiredOption("--name <name>","Route name").requiredOption("--description <desc>","Route description").action(async(e,n)=>{let r=await new h(f()).classify.createRoute(e,{deploymentId:n.deploymentId,name:n.name,description:n.description});d()?p(r):(b("Route added."),w(r))}),t.command("status <classifierId>").description("Check classification status").requiredOption("--classification-id <id>","Classification ID").action(async(e,n)=>{let r=await new h(f()).classify.getStatus(e,n.classificationId);d()?p(r):w(r)})}var Fo=A(require("fs")),ae=A(require("path"));function Co(s){let t=s.command("split").description("Document splitting");t.command("list-project").description("List splitters in a project").requiredOption("--project-id <id>","Project ID").action(async e=>{let i=await new h(f()).split.list(e.projectId);if(d())p(i);else{let r=Array.isArray(i)?i:[];O(r)}}),t.command("file <splitterId> <file>").description("Upload and split a document").option("--async","Use async splitting").option("--wait","Wait for async result").action(async(e,n,i)=>{let r=f(),o=new h(r),a=ae.resolve(n);Fo.existsSync(a)||(x({code:"NOT_FOUND",message:`File not found: ${a}`}),process.exit(1));let u=y(`Uploading ${ae.basename(a)}...`);u.start();let l=await o.split.getUploadUrl(e,ae.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(e,l.fileId);if(c.succeed(`Split queued. ID: ${D.splitId}`),i.wait){let m=y("Waiting for split...");m.start();let F=await o.split.getStatus(e,D.splitId);for(;F.status==="PENDING"||F.status==="PROCESSING";)await new Promise(g=>setTimeout(g,2e3)),F=await o.split.getStatus(e,D.splitId),m.text=`Split: ${F.status}`;F.status==="COMPLETED"?m.succeed(`Split completed. ${F.result?.segmentCount??0} segments.`):m.fail(`Split ${F.status}`),d()?p(F):w(F)}else d()&&p(D)}else{let c=y("Splitting document...");c.start();let D=await o.split.split(e,l.fileId);D.status==="COMPLETED"?c.succeed(`Split into ${D.segmentCount} segments.`):c.fail(`Split ${D.status}`),d()?p(D):w(D)}}),t.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 e=>{let i=await new h(f()).split.createSplitter({name:e.name,prompt:e.prompt,outputType:e.outputType,deploymentId:e.deploymentId,classifierId:e.classifierId,projectId:e.projectId,mergeSegments:e.mergeSegments});d()?p(i):(b("Splitter created."),w(i))}),t.command("status <splitterId>").description("Check split status").requiredOption("--split-id <id>","Split ID").action(async(e,n)=>{let r=await new h(f()).split.getStatus(e,n.splitId);d()?p(r):w(r)}),t.command("list <splitterId>").description("List splits").action(async e=>{let i=await new h(f()).split.listSplits(e);if(d())p(i);else{let r=Array.isArray(i)?i:[];O(r)}})}var Eo=["apiUrl","token","sseUrl","defaultProjectId","defaultDeploymentId"];function yo(s){let t=s.command("config").description("CLI configuration");t.command("list").description("Show all config values").action(()=>{let e=xt();if(!e){console.log("No configuration found.");return}let n={...e,token:e.token?`${e.token.slice(0,12)}...`:"(not set)"};d()?p(n):w(n)}),t.command("get <key>").description("Get a config value").action(e=>{let n=xt();n||(x({code:"NOT_FOUND",message:"No configuration found."}),process.exit(1));let i=n[e];i===void 0&&(x({code:"VALIDATION",message:`Unknown key: ${e}`}),process.exit(1));let r=e==="token"&&typeof i=="string"&&i.length>12?`${i.slice(0,12)}...`:i;d()?p({[e]:r}):console.log(String(r))}),t.command("set <key> <value>").description("Set a config value").action((e,n)=>{Eo.includes(e)||(x({code:"VALIDATION",message:`Unknown key: ${e}. Allowed: ${Eo.join(", ")}`}),process.exit(1)),ft({[e]:n}),d()?p({[e]:n}):b(`Set ${e} = ${e==="token"?"***":n}`)})}var tn=A(require("fs")),wo=A(require("path"));var bo=50;function Ao(s){let t=s.command("rows").description("Row operations on tables");t.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(bo)).action(async(e,n)=>{let i=new h(f()),r=parseInt(n.batchSize)||bo,o=wo.resolve(n.data);if(!tn.existsSync(o))throw new q(`File not found: ${o}`);let a=tn.readFileSync(o,"utf-8"),u;try{u=JSON.parse(a)}catch{throw new q(`Invalid JSON in ${o}`)}if(!Array.isArray(u))throw new q("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 F=0;F<u.length;F+=r){let g=u.slice(F,F+r),T=Math.floor(F/r)+1;l.text=`Creating rows batch ${T}/${D} (${c.length+g.length}/${u.length})...`;let B=await i.tables.createRows(e,{fileId:n.fileId,deploymentId:n.deploymentId,rows:g});c.push(...B.rowIds)}l.succeed(`Created ${c.length} rows.`);let m={rowsCreated:c.length,rowIds:c};d()?p(m):b(`${c.length} rows created in table ${e}`)}),t.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(e,n)=>{let i=new h(f()),r=y("Deleting rows...");r.start();let o=await i.tables.deleteRows(e,{fileId:n.fileId,deploymentId:n.deploymentId});r.succeed(`Deleted ${o.rowsDeleted} rows.`),d()?p(o):b(`${o.rowsDeleted} rows deleted from table ${e}`)})}var rt=A(require("fs")),tt=A(require("path"));function Io(s){let t=s.command("buckets").description("Bucket management");t.command("list <projectId>").description("List buckets in a project").action(async e=>{let i=await new h(f()).buckets.list(e);d()?p(i):O(i.map(r=>({id:r.id,name:r.name,files:r.fileCount,created:r.createdAt})))}),t.command("create <projectId>").description("Create a new bucket").requiredOption("--name <name>","Bucket name").option("--description <description>","Bucket description").action(async(e,n)=>{let r=await new h(f()).buckets.create(e,n.name,n.description);d()?p(r):(b(`Bucket created: ${r.id}`),w({id:r.id,name:r.name,description:r.description??""}))}),t.command("delete <bucketId>").description("Delete a bucket").action(async e=>{await new h(f()).buckets.delete(e),d()?p({success:!0}):b(`Bucket ${e} deleted.`)}),t.command("upload <bucketId> <path>").description("Upload file(s) to a bucket").action(async(e,n)=>{let i=f(),r=new h(i),o=tt.resolve(n);rt.existsSync(o)||(x({code:"NOT_FOUND",message:`Path not found: ${o}`}),process.exit(1));let a=rt.statSync(o);if(a.isFile())await _o(r,e,o);else if(a.isDirectory()){let l=rt.readdirSync(o).map(m=>tt.join(o,m)).filter(m=>rt.statSync(m).isFile());if(l.length===0){ot("No files found in directory.");return}P(`Found ${l.length} file(s) to upload.`);let c=0,D=0;for(let m of l)try{await _o(r,e,m),c++}catch(F){D++,ot(`Failed: ${tt.basename(m)} - ${F instanceof Error?F.message:"Unknown error"}`)}b(`Upload complete: ${c} uploaded, ${D} failed (${l.length} total)`)}}),t.command("files <bucketId>").description("List files in a bucket").option("--label <labels...>","Filter by labels").action(async(e,n)=>{let r=await new h(f()).buckets.listFiles(e,n.label);d()?p(r):O(r.map(o=>({id:o.id,name:o.name,labels:o.labels.join(", "),size:o.sizeBytes?ki(o.sizeBytes):"-",status:o.status,created:o.createdAt})))}),t.command("download <bucketId> <fileId>").description("Download a file from a bucket").option("--output <path>","Output file path").action(async(e,n,i)=>{let r=new h(f()),o=y("Getting download URL...");o.start();let{url:a,fileName:u}=await r.buckets.getDownloadUrl(e,n),l=tt.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?tt.resolve(i.output):tt.resolve(l);rt.mkdirSync(tt.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 F=Buffer.from(await m.arrayBuffer());rt.writeFileSync(D,F);let g=F.length;o.succeed(`Downloaded ${l} (${ki(g)}) to ${D}`),d()&&p({fileId:n,fileName:u,outputPath:D,bytes:g})}),t.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(e,n,i)=>{!i.add&&!i.remove&&(x({code:"VALIDATION",message:"Provide --add or --remove with label values."}),process.exit(1));let r=new h(f()),a=(await r.buckets.listFiles(e)).find(c=>c.id===n);a||(x({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(e,n,u);d()?p(l):b(`Labels updated: [${u.join(", ")}]`)}),t.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(e,n,i)=>{[i.deployment,i.classifier,i.splitter].filter(Boolean).length!==1&&(x({code:"VALIDATION",message:"Provide exactly one target: --deployment, --classifier, or --splitter."}),process.exit(1));let o=new h(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(e,n,a,u);l.succeed(`File sent to ${a.toLowerCase()}.`),d()&&p(c)})}async function _o(s,t,e){let n=tt.basename(e),i=y(`Uploading ${n}...`);i.start();let{url:r,fileId:o}=await s.buckets.getUploadUrl(t,n),a=await s.http.putFile(r,e,"application/octet-stream");await s.buckets.confirmUpload(t,o,a),i.succeed(`Uploaded ${n} (${ki(a)}) - File ID: ${o}`),d()&&p({fileId:o,filename:n,bytes:a})}function ki(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var W=A(require("fs")),H=A(require("path"));var xo=A(require("path")),ml={".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 en(s){let t=xo.extname(s).toLowerCase();return ml[t]??"application/octet-stream"}function vo(s){let t=s.command("agents").description("Agent management");t.command("list <projectId>").description("List agents in a project").option("--status <status>","Filter by status (ACTIVE, PAUSED, DISABLED)").action(async(i,r)=>{let a=await new h(f()).agents.list(i,r);d()?p(a):O(a.map(u=>({id:u.id,name:u.name,status:u.status,triggers:u.triggerTypes.join(", "),deployments:u.deploymentRoutes.map(l=>l.deploymentName).join(", "),runs:u.runCount,created:u.createdAt})))}),t.command("get <projectId> <agentId>").description("Show agent details").action(async(i,r)=>{let a=await new h(f()).agents.get(i,r);d()?p(a):w({id:a.id,name:a.name,status:a.status,triggers:a.triggerTypes.join(", "),"process content":Mt(a.processContent,120),deployments:a.deploymentRoutes.map(u=>`${u.deploymentName} (${u.deploymentId})`).join(", "),"email address":a.ingestEmailAddress??"",connection:a.connection?`${a.connection.provider} (${a.connection.status})`:"",files:a.files.map(u=>u.fileName).join(", "),skills:a.skills.map(u=>u.name).join(", "),runs:a.runCount,created:a.createdAt,updated:a.updatedAt})}),t.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("--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.",hl,[]).action(async(i,r)=>{let o=new h(f()),a="";if(r.processFile){let g=H.resolve(r.processFile);a=W.readFileSync(g,"utf-8")}let u=r.triggers.split(",").map(g=>g.trim()),l=r.deployments?r.deployments.split(",").map(g=>g.trim()):void 0,c=r.integrationConfigFile?JSON.parse(W.readFileSync(H.resolve(r.integrationConfigFile),"utf-8")):void 0,D=y("Creating agent...");D.start();let m=await o.agents.create(i,{name:r.name,processContent:a,triggerTypes:u,deploymentIds:l,connectionId:r.connectionId,integrationConfigs:c,emailLocalPart:r.emailLocalPart});D.succeed(`Agent created: ${m.id}`);let F=[];for(let g of r.file){let T=await So(o,i,m.id,g);F.push(T)}d()?p({...m,uploadedFiles:F}):w({id:m.id,name:m.name,status:m.status,triggers:m.triggerTypes.join(", "),...F.length>0&&{files:F.map(g=>`${g.filename} (${g.fileId})`).join(", ")}})}),t.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("--email-local-part <value>","Custom email local part (before @domain). Optional.").action(async(i,r,o)=>{let a=new h(f()),u={};o.name&&(u.name=o.name),o.status&&(u.status=o.status),o.tier&&(u.tier=o.tier),o.connectionId&&(u.connectionId=o.connectionId),o.emailLocalPart&&(u.emailLocalPart=o.emailLocalPart),o.integrationConfigFile&&(u.integrationConfigs=JSON.parse(W.readFileSync(H.resolve(o.integrationConfigFile),"utf-8"))),o.processFile&&(u.processContent=W.readFileSync(H.resolve(o.processFile),"utf-8")),o.triggers&&(u.triggerTypes=o.triggers.split(",").map(c=>c.trim())),o.deployments&&(u.deploymentIds=o.deployments.split(",").map(c=>c.trim()));let l=y("Updating agent...");l.start(),await a.agents.update(i,r,u),l.succeed("Agent updated."),d()&&p({success:!0})}),t.command("delete <projectId> <agentId>").description("Delete an agent").action(async(i,r)=>{await new h(f()).agents.delete(i,r),d()?p({success:!0}):b(`Agent ${r} deleted.`)}),t.command("upload-file <projectId> <agentId> <filePath>").description("Upload a template file to an agent").action(async(i,r,o)=>{let a=new h(f()),u=await So(a,i,r,o);d()&&p(u)}),t.command("delete-file <projectId> <agentId> <fileId>").description("Delete a template file from an agent").action(async(i,r,o)=>{await new h(f()).agents.deleteFile(i,r,o),d()?p({success:!0}):b(`File ${o} deleted.`)}),t.command("download-file <projectId> <agentId> <fileId>").description("Download a template file from an agent").option("--output <path>","Output file path").action(async(i,r,o,a)=>{let u=new h(f()),l=y("Getting download URL...");l.start();let{url:c,fileName:D}=await u.agents.getFileDownloadUrl(i,r,o),m=H.basename(D).replace(/[/\\:*?"<>|]/g,"_");!(m===D&&!D.startsWith(".")&&D.length>0)&&!a.output&&(l.fail(`Server returned an unsafe filename "${D}". Use --output to specify an explicit path.`),process.exit(1));let g=a.output?H.resolve(a.output):H.resolve(m);W.mkdirSync(H.dirname(g),{recursive:!0}),l.text=`Downloading ${D}...`;let T=await fetch(c);T.ok||(l.fail(`Download failed: HTTP ${T.status}`),process.exit(1));let B=Buffer.from(await T.arrayBuffer());W.writeFileSync(g,B);let E=B.length;l.succeed(`Downloaded ${D} (${Pi(E)}) to ${g}`),d()&&p({fileId:o,fileName:D,outputPath:g,bytes:E})});let e=t.command("skills").description("Agent skill management");e.command("list <projectId> <agentId>").description("List skills for an agent").action(async(i,r)=>{let a=await new h(f()).agents.listSkills(i,r);d()?p(a):O(a.map(u=>({id:u.id,name:u.name,content:Mt(u.content,80),created:u.createdAt})))}),e.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(i,r,o)=>{let a=new h(f()),u=W.readFileSync(H.resolve(o.contentFile),"utf-8"),l=y("Creating skill...");l.start();let c=await a.agents.createSkill(i,r,{name:o.name,content:u});l.succeed(`Skill created: ${c.id}`),d()?p(c):w({id:c.id,name:c.name})}),e.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(i,r,o,a)=>{let u=new h(f()),l={};a.name&&(l.name=a.name),a.contentFile&&(l.content=W.readFileSync(H.resolve(a.contentFile),"utf-8"));let c=y("Updating skill...");c.start(),await u.agents.updateSkill(i,r,o,l),c.succeed("Skill updated."),d()&&p({success:!0})}),e.command("delete <projectId> <agentId> <skillId>").description("Delete a skill").action(async(i,r,o)=>{await new h(f()).agents.deleteSkill(i,r,o),d()?p({success:!0}):b(`Skill ${o} deleted.`)}),e.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(i,r,o,a)=>{let l=await new h(f()).agents.linkFileToSkill(i,r,o,a);d()?p(l):b(`Linked ${l.file.fileName} to skill ${o}.`)}),e.command("unlink-file <projectId> <agentId> <skillId> <fileId>").description("Unlink a file from a skill").action(async(i,r,o,a)=>{await new h(f()).agents.unlinkFileFromSkill(i,r,o,a),d()?p({success:!0}):b(`Unlinked file ${a} from skill ${o}.`)});let n=t.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(i,r,o)=>{let u=await new h(f()).agents.listRuns(i,r,{limit:o.limit?parseInt(o.limit,10):void 0,status:o.status});d()?p(u):O(u.map(l=>({id:l.id,status:l.status,triggerType:l.triggerType,title:Mt(l.title,40),steps:l.stepsCount,duration:l.executionDurationMs?`${(l.executionDurationMs/1e3).toFixed(1)}s`:"-",created:l.createdAt})))}),n.command("get <projectId> <agentId> <runId>").description("Show run details").action(async(i,r,o)=>{let u=await new h(f()).agents.getRun(i,r,o);d()?p(u):(w({id:u.id,status:u.status,triggerType:u.triggerType,triggerEventId:u.triggerEventId,title:u.title,sandboxId:u.sandboxId??"-",errorMessage:u.errorMessage??"",duration:u.executionDurationMs?`${(u.executionDurationMs/1e3).toFixed(1)}s`:"-",startedAt:u.startedAt??"-",completedAt:u.completedAt??"-",created:u.createdAt}),u.steps.length>0&&(console.log(`
62
62
  Steps:`),O(u.steps.map(l=>({id:l.id,type:l.type,title:Mt(l.title,40),status:l.status,order:l.order})))),u.emailDrafts.length>0&&(console.log(`
63
- Email Drafts:`),O(u.emailDrafts.map(l=>({id:l.id,to:l.toAddress,subject:Mt(l.subject,40),status:l.status,created:l.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(i,r,o,a)=>{let l=await new h(f()).agents.getRunConversation(i,r,o,{stepId:a.stepId});if(d()){m(l);return}if(l.unavailable){S({code:"CONVERSATION_UNAVAILABLE",message:"Conversation unavailable."});return}for(let c of l.messages){let D=c,p=D.info?.role??"unknown",F=D.info?.finish?` (${D.info.finish})`:"";console.log(`
64
- [${p}${F}]`);for(let g of D.parts??[])if(g.type==="text"&&g.text)console.log(g.text);else if(g.type==="tool"){let v=g.state?.status??"unknown",B=g.state?.input?` ${JSON.stringify(g.state.input)}`:"";console.log(`- tool: ${g.tool??"unknown"} [${v}]${B}`),g.state?.output&&console.log(` output: ${Mt(g.state.output,240)}`)}}}),t.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(i,r,o)=>{let a=new h(f()),u=y("Creating run...");u.start();let l=o.metadata?JSON.parse(o.metadata):void 0,c=await a.agents.createRun(i,r,{triggerEventId:o.triggerEventId,triggerType:o.triggerType,title:o.title,metadata:l});u.succeed(`Run created: ${c.id}`),d()?m(c):w({id:c.id,status:c.status,title:c.title})}),t.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(i,r,o,a)=>{let u=new h(f()),l=y("Creating step...");l.start();let c;if(a.conditions){let p=JSON.parse(a.conditions);Array.isArray(p)||(l.fail("--conditions must be a JSON array"),process.exit(1)),c=p}let D=await u.agents.createStep(i,r,o,{type:a.type,title:a.title,order:parseInt(a.order,10),description:a.description,postReviewAction:a.postReviewAction,data:a.data?JSON.parse(a.data):void 0,conditions:c});l.succeed(`Step created: ${D.id}`),d()?m(D):(w({id:D.id,type:D.type,title:D.title,status:D.status}),D.conditions&&D.conditions.length>0&&(console.log(`
65
- Conditions:`),O(D.conditions.map(p=>({id:p.id,type:p.type,entityId:p.entityId,label:p.label??"",met:p.met?"yes":"no"})))))}),t.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(i,r,o,a)=>{let u=new h(f()),l=y("Updating run...");l.start();let c={};a.status&&(c.status=a.status),a.errorMessage&&(c.errorMessage=a.errorMessage),a.metadata&&(c.metadata=JSON.parse(a.metadata));let D=await u.agents.updateRun(i,r,o,c);l.succeed(`Run updated: ${D.status}`),d()&&m(D)}),t.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(i,r,o,a,u)=>{let l=new h(f()),c=y("Updating step...");c.start();let D=await l.agents.updateStep(i,r,o,a,{status:u.status,data:u.data?JSON.parse(u.data):void 0});c.succeed(`Step updated: ${D.status}`),d()&&m(D)}),t.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(i,r,o,a,u)=>{let l=new h(f()),c=y("Updating step conditions...");c.start();let D=JSON.parse(u.conditions),p=await l.agents.updateStepConditions(i,r,o,a,D);c.succeed(`Step conditions replaced (${D.length})`),d()&&m(p)}),t.command("pause-run <projectId> <agentId> <runId>").description("Pause a running agent run").action(async(i,r,o)=>{let a=new h(f()),u=y("Pausing run...");u.start();let l=await a.agents.pauseRun(i,r,o);u.succeed(`Run paused: ${l.runId}`),d()&&m(l)}),es()&&il(t)}function il(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(t,e,n)=>{!n.body&&!n.bodyFile&&(console.error("Either --body or --body-file is required"),process.exit(1));let i=new h(f()),r=n.body??"";if(n.bodyFile){let u=H.resolve(n.bodyFile);r=W.readFileSync(u,"utf-8")}let o=y("Sending email...");o.start();let a=await i.agents.sendEmail(t,e,{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}`),d()&&m(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(t,e,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 h(f()),a=y(`Completing execution (${r.toLowerCase()})...`);a.start();let u=await o.agents.completeExecution(t,e,{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":""}`),d()&&m(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(t,e,n)=>{S({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(t,e,n,i)=>{let r=new h(f()),{filename:o,buffer:a}=_o(i),u=y(`Uploading ${o}...`);u.start();let{uploadUrl:l,s3Key:c}=await r.agents.getArtifactUploadUrl(t,e,{executionId:n,fileName:o});await r.http.putRaw(l,a,"application/octet-stream"),u.succeed(`Uploaded ${o} (${Bi(a.length)})`),d()&&m({success:!0,s3Key:c,fileName:o})})}function _o(s){let t=H.resolve(s);return W.existsSync(t)||(console.error(`File not found: ${t}`),process.exit(1)),{filename:H.basename(t),buffer:W.readFileSync(t)}}async function wo(s,t,e,n){let{filename:i,buffer:r}=_o(n),o=Qe(i),a=y(`Uploading ${i}...`);a.start();let{url:u,fileId:l}=await s.agents.getFileUploadUrl(t,e,i);return await s.http.putRaw(u,r,o),await s.agents.updateFileMetadata(t,e,l,{sizeBytes:r.length,mimeType:o}),a.succeed(`Uploaded ${i} (${Bi(r.length)}) - File ID: ${l}`),{fileId:l,filename:i,bytes:r.length}}function sl(s,t){return[...t,s]}function Mt(s,t){return s.length<=t?s:s.slice(0,t-3)+"..."}function Bi(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var Ut=A(require("fs")),Ri=A(require("path"));function rl(s,t){return[...t,s]}function Io(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",rl,[]).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").action(async e=>{let n=e.project??process.env.LIMAI_PROJECT_ID;n||(S({code:"VALIDATION",message:"Missing project ID. Pass --project <id> or set LIMAI_PROJECT_ID."}),process.exit(1)),e.files.length===0&&(S({code:"VALIDATION",message:"Pass at least one --files <path>."}),process.exit(1));let i=e.files.map(l=>{let c=Ri.resolve(l);return Ut.existsSync(c)||(S({code:"NOT_FOUND",message:`File not found: ${c}`}),process.exit(1)),{data:Ut.readFileSync(c).toString("base64"),mimeType:Qe(c)}}),r;if(e.schemaFile){let l=Ri.resolve(e.schemaFile);Ut.existsSync(l)||(S({code:"NOT_FOUND",message:`Schema file not found: ${l}`}),process.exit(1));try{let c=JSON.parse(Ut.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){S({code:"VALIDATION",message:`Invalid schema file: ${c instanceof Error?c.message:c}`}),process.exit(1)}}let o=new h(f()),a=y(`Asking Gemini about ${i.length} file(s)...`);a.start();let u=await o.vision.ask(n,{prompt:e.prompt,files:i,...r&&{schema:r}});a.succeed("Vision response received"),d()?m(u):"text"in u?console.log(u.text):console.log(JSON.stringify(u.data,null,2))})}var nn=A(require("fs")),xo=A(require("path"));function at(s){let t=s.commands.find(e=>e.name()==="integrations");return t||s.command("integrations").description("Agent-facing integration tools")}function tn(){let s=process.env.LIMAI_API_BASE_URL||process.env.LIMAI_API_URL,t=process.env.LIMAI_API_SECRET;return s||(console.error("LIMAI_API_BASE_URL (or LIMAI_API_URL) environment variable is required."),process.exit(1)),t||(console.error("LIMAI_API_SECRET environment variable is required."),process.exit(1)),{apiBaseUrl:s,apiSecret:t}}function en(s,t){let e=process.env.LIMAI_API_SECRET;if(e){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":e}}}(!t.agent||!t.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/${t.project}/agents/${t.agent}/runs/${t.executionId}/integrations/${s}/upload`,headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.token}`}}}function So(s){at(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}=tn(),o;if(n.blocks){let c=xo.resolve(n.blocks);nn.existsSync(c)||(console.error(`Blocks file not found: ${c}`),process.exit(1));let D=nn.readFileSync(c,"utf-8");try{let p=JSON.parse(D);Array.isArray(p)||(console.error("Blocks file must contain a JSON array"),process.exit(1)),o=p}catch(p){console.error(`Failed to parse blocks JSON: ${p instanceof Error?p.message:String(p)}`),process.exit(1)}}let a=d()?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}`),S({code:"SLACK_SEND_FAILED",message:D}),process.exit(1)}let l=await u.json();a?.succeed(`Message sent to ${l.channel}`),d()?m(l):console.log(JSON.stringify(l,null,2))})}var sn=A(require("fs")),To=A(require("path"));function vo(s){at(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").option("--mime <mimeType>","MIME type (defaults to S3 ContentType or application/octet-stream)").action(async n=>{let i=n.file,r=To.resolve(n.file);sn.existsSync(r)&&sn.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=d()?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,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}`),S({code:"GDRIVE_UPLOAD_FAILED",message:D}),process.exit(1)}let l=await u.json();o?.succeed(`Uploaded to Google Drive: ${l.fileId}`),d()?m(l):console.log(JSON.stringify(l,null,2))})}function Oo(s){at(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").option("--folder <folderId>","Destination SharePoint folder ID").option("--mime <mimeType>","MIME type (defaults to S3 ContentType or application/octet-stream)").action(async n=>{let i=d()?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,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}`),S({code:"SHAREPOINT_UPLOAD_FAILED",message:l}),process.exit(1)}let a=await o.json();i?.succeed(`Uploaded to SharePoint: ${a.itemId}`),d()?m(a):console.log(JSON.stringify(a,null,2))})}function ol(){let s=process.env.LIMAI_API_BASE_URL||process.env.LIMAI_API_URL;return s||f().apiUrl}function Bo(s){at(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 U("Provide either --team and --channel, or --chat (but not both)");let o=ol(),a=process.env.LIMAI_API_SECRET;if(!a)throw new j("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 F=await D.json().catch(()=>({})),g=typeof F?.error=="string"?F.error:`HTTP ${D.status}`;throw new j(g,{code:"TEAMS_SEND_FAILED",exitCode:1})}let p=await D.json();c.succeed("Message sent"),d()?m(p):(b(`Message ID: ${p.messageId}`),p.webUrl&&b(`URL: ${p.webUrl}`))})}function Ro(s){at(s).command("status").description("List integration connection status for a project").requiredOption("--project <projectId>","Project ID").action(async e=>{let{apiBaseUrl:n,apiSecret:i}=tn(),r=d()?null:y("Loading integration status...");r?.start();let o=await fetch(`${n.replace(/\/$/,"")}/api/internal/integrations/status?projectId=${encodeURIComponent(e.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}`),S({code:"INTEGRATIONS_STATUS_FAILED",message:l}),process.exit(1)}let a=await o.json();r?.succeed("Integration status loaded"),d()?m(a):console.log(JSON.stringify(a,null,2))})}function $o(s){let t=s.command("labels").description("Manage key:value labels on files and emails");t.command("list <projectId>").description("List all distinct labels in a project").option("--entity-type <type>","Filter by entity type (file|email)").action(async(e,n)=>{let i=new h(f()),r=y("Fetching labels..."),o=await i.labels.list(e,n);r.stop(),d()?m(o):o.labels.length===0?b("No labels found"):O(o.labels.map(a=>{let u=a.split(":");return{label:a,key:u[0],value:u.length>1?u.slice(1).join(":"):""}}))}),t.command("get <projectId> <entityType> <entityId>").description("Get labels on a specific entity").action(async(e,n,i)=>{let r=new h(f()),o=y("Fetching labels..."),a=await r.labels.addRemove(e,n,i);o.stop(),d()?m(a):a.labels.length===0?b("No labels on this entity"):w(Object.fromEntries(a.labels.map((u,l)=>[`label ${l+1}`,u])))}),t.command("add <projectId> <entityType> <entityId> <labels...>").description("Add labels to an entity").action(async(e,n,i,r)=>{let o=new h(f()),a=y("Adding labels..."),u=await o.labels.addRemove(e,n,i,r);a.stop(),d()?m(u):b(`Added ${r.length} label(s). Current labels: ${u.labels.join(", ")}`)}),t.command("remove <projectId> <entityType> <entityId> <labels...>").description("Remove labels from an entity").action(async(e,n,i,r)=>{let o=new h(f()),a=y("Removing labels..."),u=await o.labels.addRemove(e,n,i,void 0,r);a.stop(),d()?m(u):b(`Removed ${r.length} label(s). Current labels: ${u.labels.join(", ")||"(none)"}`)}),t.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(e,n)=>{let i=new h(f()),r=y("Searching..."),o=await i.labels.search(e,n);r.stop(),d()?m(o):o.results.length===0?b("No matching entities found"):O(o.results.map(a=>({type:a.entityType,id:a.entityId,name:a.name||a.subject||"",labels:a.labels.join(", "),date:a.createdAt||a.receivedAt||""})))})}var P=new Yi,al="0.1.1";P.name("limai").description("CLI for the LimAI data extraction platform").version(al).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 t=s.optsWithGlobals();t.json&&zi(!0),t.verbose&&Xi(!0),t.token&&(process.env.LIMAI_API_TOKEN=t.token),t.apiUrl&&(process.env.LIMAI_API_URL=t.apiUrl)});As(P);ho(P);Ts(P);vs(P);nr(P);sr(P);rr(P);or(P);ur(P);pr(P);Qr(P);eo(P);lo(P);Do(P);mo(P);Co(P);yo(P);Ao(P);Io(P);So(P);vo(P);Oo(P);Bo(P);Ro(P);$o(P);process.on("unhandledRejection",s=>{Zi(s)});P.parse();
63
+ Email Drafts:`),O(u.emailDrafts.map(l=>({id:l.id,to:l.toAddress,subject:Mt(l.subject,40),status:l.status,created:l.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(i,r,o,a)=>{let l=await new h(f()).agents.getRunConversation(i,r,o,{stepId:a.stepId});if(d()){p(l);return}if(l.unavailable){x({code:"CONVERSATION_UNAVAILABLE",message:"Conversation unavailable."});return}for(let c of l.messages){let D=c,m=D.info?.role??"unknown",F=D.info?.finish?` (${D.info.finish})`:"";console.log(`
64
+ [${m}${F}]`);for(let g of D.parts??[])if(g.type==="text"&&g.text)console.log(g.text);else if(g.type==="tool"){let T=g.state?.status??"unknown",B=g.state?.input?` ${JSON.stringify(g.state.input)}`:"";console.log(`- tool: ${g.tool??"unknown"} [${T}]${B}`),g.state?.output&&console.log(` output: ${Mt(g.state.output,240)}`)}}}),t.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(i,r,o)=>{let a=new h(f()),u=y("Creating run...");u.start();let l=o.metadata?JSON.parse(o.metadata):void 0,c=await a.agents.createRun(i,r,{triggerEventId:o.triggerEventId,triggerType:o.triggerType,title:o.title,metadata:l});u.succeed(`Run created: ${c.id}`),d()?p(c):w({id:c.id,status:c.status,title:c.title})}),t.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(i,r,o,a)=>{let u=new h(f()),l=y("Creating step...");l.start();let c;if(a.conditions){let m=JSON.parse(a.conditions);Array.isArray(m)||(l.fail("--conditions must be a JSON array"),process.exit(1)),c=m}let D=await u.agents.createStep(i,r,o,{type:a.type,title:a.title,order:parseInt(a.order,10),description:a.description,postReviewAction:a.postReviewAction,data:a.data?JSON.parse(a.data):void 0,conditions:c});l.succeed(`Step created: ${D.id}`),d()?p(D):(w({id:D.id,type:D.type,title:D.title,status:D.status}),D.conditions&&D.conditions.length>0&&(console.log(`
65
+ Conditions:`),O(D.conditions.map(m=>({id:m.id,type:m.type,entityId:m.entityId,label:m.label??"",met:m.met?"yes":"no"})))))}),t.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(i,r,o,a)=>{let u=new h(f()),l=y("Updating run...");l.start();let c={};a.status&&(c.status=a.status),a.errorMessage&&(c.errorMessage=a.errorMessage),a.metadata&&(c.metadata=JSON.parse(a.metadata));let D=await u.agents.updateRun(i,r,o,c);l.succeed(`Run updated: ${D.status}`),d()&&p(D)}),t.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(i,r,o,a,u)=>{let l=new h(f()),c=y("Updating step...");c.start();let D=await l.agents.updateStep(i,r,o,a,{status:u.status,data:u.data?JSON.parse(u.data):void 0});c.succeed(`Step updated: ${D.status}`),d()&&p(D)}),t.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(i,r,o,a,u)=>{let l=new h(f()),c=y("Updating step conditions...");c.start();let D=JSON.parse(u.conditions),m=await l.agents.updateStepConditions(i,r,o,a,D);c.succeed(`Step conditions replaced (${D.length})`),d()&&p(m)}),t.command("pause-run <projectId> <agentId> <runId>").description("Pause a running agent run").action(async(i,r,o)=>{let a=new h(f()),u=y("Pausing run...");u.start();let l=await a.agents.pauseRun(i,r,o);u.succeed(`Run paused: ${l.runId}`),d()&&p(l)}),rs()&&fl(t)}function fl(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(t,e,n)=>{!n.body&&!n.bodyFile&&(console.error("Either --body or --body-file is required"),process.exit(1));let i=new h(f()),r=n.body??"";if(n.bodyFile){let u=H.resolve(n.bodyFile);r=W.readFileSync(u,"utf-8")}let o=y("Sending email...");o.start();let a=await i.agents.sendEmail(t,e,{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}`),d()&&p(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(t,e,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 h(f()),a=y(`Completing execution (${r.toLowerCase()})...`);a.start();let u=await o.agents.completeExecution(t,e,{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":""}`),d()&&p(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(t,e,n)=>{x({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(t,e,n,i)=>{let r=new h(f()),{filename:o,buffer:a}=To(i),u=y(`Uploading ${o}...`);u.start();let{uploadUrl:l,s3Key:c}=await r.agents.getArtifactUploadUrl(t,e,{executionId:n,fileName:o});await r.http.putRaw(l,a,"application/octet-stream"),u.succeed(`Uploaded ${o} (${Pi(a.length)})`),d()&&p({success:!0,s3Key:c,fileName:o})})}function To(s){let t=H.resolve(s);return W.existsSync(t)||(console.error(`File not found: ${t}`),process.exit(1)),{filename:H.basename(t),buffer:W.readFileSync(t)}}async function So(s,t,e,n){let{filename:i,buffer:r}=To(n),o=en(i),a=y(`Uploading ${i}...`);a.start();let{url:u,fileId:l}=await s.agents.getFileUploadUrl(t,e,i);return await s.http.putRaw(u,r,o),await s.agents.updateFileMetadata(t,e,l,{sizeBytes:r.length,mimeType:o}),a.succeed(`Uploaded ${i} (${Pi(r.length)}) - File ID: ${l}`),{fileId:l,filename:i,bytes:r.length}}function hl(s,t){return[...t,s]}function Mt(s,t){return s.length<=t?s:s.slice(0,t-3)+"..."}function Pi(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}var Ut=A(require("fs")),ji=A(require("path"));function gl(s,t){return[...t,s]}function Oo(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",gl,[]).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 e=>{let n=e.project??process.env.LIMAI_PROJECT_ID;n||(x({code:"VALIDATION",message:"Missing project ID. Pass --project <id> or set LIMAI_PROJECT_ID."}),process.exit(1)),e.files.length===0&&(x({code:"VALIDATION",message:"Pass at least one --files <path>."}),process.exit(1));let i=e.files.map(l=>{let c=ji.resolve(l);return Ut.existsSync(c)||(x({code:"NOT_FOUND",message:`File not found: ${c}`}),process.exit(1)),{data:Ut.readFileSync(c).toString("base64"),mimeType:en(c)}}),r;if(e.schemaFile){let l=ji.resolve(e.schemaFile);Ut.existsSync(l)||(x({code:"NOT_FOUND",message:`Schema file not found: ${l}`}),process.exit(1));try{let c=JSON.parse(Ut.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){x({code:"VALIDATION",message:`Invalid schema file: ${c instanceof Error?c.message:c}`}),process.exit(1)}}let o=new h(f()),a=y(`Asking Gemini${e.fast?" Flash Lite":""} about ${i.length} file(s)...`);a.start();let u=await o.vision.ask(n,{prompt:e.prompt,files:i,...r&&{schema:r},...e.fast&&{fast:!0}});a.succeed("Vision response received"),d()?p(u):"text"in u?console.log(u.text):console.log(JSON.stringify(u.data,null,2))})}var Bo=A(require("fs")),Ro=A(require("path"));function nn(s){return JSON.parse(Bo.readFileSync(Ro.resolve(s),"utf-8"))}function $o(s){s.command("validations").description("Validation result submission").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").action(async(e,n,i)=>{let r=new h(f()),o={findings:nn(i.findingsFile)};i.changesFile&&(o.cellChanges=nn(i.changesFile)),i.breakdownFile&&(o.breakdown=nn(i.breakdownFile)),i.newRowsFile&&(o.newRows=nn(i.newRowsFile));let a=y("Submitting validation...");a.start();let u=await r.validations.submit(e,n,o);a.succeed("Validation submitted."),d()?p(u):w(u)})}var on=A(require("fs")),ko=A(require("path"));function at(s){let t=s.commands.find(e=>e.name()==="integrations");return t||s.command("integrations").description("Agent-facing integration tools")}function sn(){let s=process.env.LIMAI_API_BASE_URL||process.env.LIMAI_API_URL,t=process.env.LIMAI_API_SECRET;return s||(console.error("LIMAI_API_BASE_URL (or LIMAI_API_URL) environment variable is required."),process.exit(1)),t||(console.error("LIMAI_API_SECRET environment variable is required."),process.exit(1)),{apiBaseUrl:s,apiSecret:t}}function rn(s,t){let e=process.env.LIMAI_API_SECRET;if(e){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":e}}}(!t.agent||!t.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/${t.project}/agents/${t.agent}/runs/${t.executionId}/integrations/${s}/upload`,headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.token}`}}}function Po(s){at(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}=sn(),o;if(n.blocks){let c=ko.resolve(n.blocks);on.existsSync(c)||(console.error(`Blocks file not found: ${c}`),process.exit(1));let D=on.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=d()?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}`),x({code:"SLACK_SEND_FAILED",message:D}),process.exit(1)}let l=await u.json();a?.succeed(`Message sent to ${l.channel}`),d()?p(l):console.log(JSON.stringify(l,null,2))})}var an=A(require("fs")),jo=A(require("path"));function No(s){at(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").option("--mime <mimeType>","MIME type (defaults to S3 ContentType or application/octet-stream)").action(async n=>{let i=n.file,r=jo.resolve(n.file);an.existsSync(r)&&an.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=d()?null:y(`Uploading ${n.name} to Google Drive...`);o?.start();let a=rn("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,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}`),x({code:"GDRIVE_UPLOAD_FAILED",message:D}),process.exit(1)}let l=await u.json();o?.succeed(`Uploaded to Google Drive: ${l.fileId}`),d()?p(l):console.log(JSON.stringify(l,null,2))})}function Lo(s){at(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").option("--folder <folderId>","Destination SharePoint folder ID").option("--mime <mimeType>","MIME type (defaults to S3 ContentType or application/octet-stream)").action(async n=>{let i=d()?null:y(`Uploading ${n.name} to SharePoint...`);i?.start();let r=rn("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,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}`),x({code:"SHAREPOINT_UPLOAD_FAILED",message:l}),process.exit(1)}let a=await o.json();i?.succeed(`Uploaded to SharePoint: ${a.itemId}`),d()?p(a):console.log(JSON.stringify(a,null,2))})}function Fl(){let s=process.env.LIMAI_API_BASE_URL||process.env.LIMAI_API_URL;return s||f().apiUrl}function Mo(s){at(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 q("Provide either --team and --channel, or --chat (but not both)");let o=Fl(),a=process.env.LIMAI_API_SECRET;if(!a)throw new N("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 F=await D.json().catch(()=>({})),g=typeof F?.error=="string"?F.error:`HTTP ${D.status}`;throw new N(g,{code:"TEAMS_SEND_FAILED",exitCode:1})}let m=await D.json();c.succeed("Message sent"),d()?p(m):(b(`Message ID: ${m.messageId}`),m.webUrl&&b(`URL: ${m.webUrl}`))})}function Uo(s){at(s).command("status").description("List integration connection status for a project").requiredOption("--project <projectId>","Project ID").action(async e=>{let{apiBaseUrl:n,apiSecret:i}=sn(),r=d()?null:y("Loading integration status...");r?.start();let o=await fetch(`${n.replace(/\/$/,"")}/api/internal/integrations/status?projectId=${encodeURIComponent(e.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}`),x({code:"INTEGRATIONS_STATUS_FAILED",message:l}),process.exit(1)}let a=await o.json();r?.succeed("Integration status loaded"),d()?p(a):console.log(JSON.stringify(a,null,2))})}function qo(s){let t=s.command("labels").description("Manage key:value labels on files and emails");t.command("list <projectId>").description("List all distinct labels in a project").option("--entity-type <type>","Filter by entity type (file|email)").action(async(e,n)=>{let i=new h(f()),r=y("Fetching labels..."),o=await i.labels.list(e,n);r.stop(),d()?p(o):o.labels.length===0?b("No labels found"):O(o.labels.map(a=>{let u=a.split(":");return{label:a,key:u[0],value:u.length>1?u.slice(1).join(":"):""}}))}),t.command("get <projectId> <entityType> <entityId>").description("Get labels on a specific entity").action(async(e,n,i)=>{let r=new h(f()),o=y("Fetching labels..."),a=await r.labels.addRemove(e,n,i);o.stop(),d()?p(a):a.labels.length===0?b("No labels on this entity"):w(Object.fromEntries(a.labels.map((u,l)=>[`label ${l+1}`,u])))}),t.command("add <projectId> <entityType> <entityId> <labels...>").description("Add labels to an entity").action(async(e,n,i,r)=>{let o=new h(f()),a=y("Adding labels..."),u=await o.labels.addRemove(e,n,i,r);a.stop(),d()?p(u):b(`Added ${r.length} label(s). Current labels: ${u.labels.join(", ")}`)}),t.command("remove <projectId> <entityType> <entityId> <labels...>").description("Remove labels from an entity").action(async(e,n,i,r)=>{let o=new h(f()),a=y("Removing labels..."),u=await o.labels.addRemove(e,n,i,void 0,r);a.stop(),d()?p(u):b(`Removed ${r.length} label(s). Current labels: ${u.labels.join(", ")||"(none)"}`)}),t.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(e,n)=>{let i=new h(f()),r=y("Searching..."),o=await i.labels.search(e,n);r.stop(),d()?p(o):o.results.length===0?b("No matching entities found"):O(o.results.map(a=>({type:a.entityType,id:a.entityId,name:a.name||a.subject||"",labels:a.labels.join(", "),date:a.createdAt||a.receivedAt||""})))})}var Jo=require("child_process"),Vo=A(require("os")),Ho=A(require("path"));var ue="@limai.io/cli",Cl=`https://registry.npmjs.org/${ue.replace("/","%2f")}/latest`,un="0.3.1";function El(){let s=Ho.join(Vo.homedir(),".limai","bin");return process.execPath.startsWith(s)}async function yl(){let s=await fetch(Cl);if(!s.ok)throw new Error(`npm registry responded with ${s.status}`);let t=await s.json();if(!t.version)throw new Error("npm registry response did not include a version");return t.version}function Wo(s){s.command("update").description("Update the LimAI CLI to the latest version").action(async()=>{if(El()&&(x({code:"UPDATE",message:"This copy of the CLI is the discontinued standalone binary and can no longer be updated."}),P("Remove it and reinstall with npm:"),P(" rm -rf ~/.limai/bin"),P(` npm install -g ${ue}`),process.exit(1)),un.endsWith("-dev")){P("Running from source \u2014 update with `git pull` in the monorepo instead.");return}let t;try{t=await yl()}catch(n){x({code:"UPDATE",message:n instanceof Error?`Could not check for updates: ${n.message}`:"Could not check for updates"}),process.exit(1)}if(t===un){b(`Already up to date (v${un}).`);return}P(`Updating ${ue} v${un} \u2192 v${t}...`);let e=(0,Jo.spawnSync)("npm",["install","-g",`${ue}@latest`],{stdio:"inherit",shell:process.platform==="win32"});(e.error||e.status!==0)&&(x({code:"UPDATE",message:e.error instanceof Error?e.error.message:`npm install exited with status ${e.status}`}),P(`Run it manually: npm install -g ${ue}@latest`),process.exit(1)),b(`Updated to v${t}.`)})}var k=new Zi,bl="0.3.1";k.name("limai").description("CLI for the LimAI data extraction platform").version(bl).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 t=s.optsWithGlobals();t.json&&ts(!0),t.verbose&&es(!0),t.token&&(process.env.LIMAI_API_TOKEN=t.token),t.apiUrl&&(process.env.LIMAI_API_URL=t.apiUrl)});Ts(k);yo(k);ks(k);Ps(k);ur(k);lr(k);cr(k);Dr(k);pr(k);Fr(k);so(k);oo(k);fo(k);go(k);Co(k);Ao(k);Io(k);vo(k);Oo(k);$o(k);Po(k);No(k);Lo(k);Mo(k);Uo(k);qo(k);Wo(k);process.on("unhandledRejection",s=>{ns(s)});k.parse();