UNPKG

@nutrient-sdk/document-authoring

Version:

A web SDK for word processing and rich text capabilities.

24 lines 107 kB
#!/usr/bin/env node "use strict";var fs=Object.create;var It=Object.defineProperty;var ds=Object.getOwnPropertyDescriptor;var hs=Object.getOwnPropertyNames;var ms=Object.getPrototypeOf,ps=Object.prototype.hasOwnProperty;var ge=(g,i)=>()=>(i||g((i={exports:{}}).exports,i),i.exports);var vs=(g,i,a,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let d of hs(i))!ps.call(g,d)&&d!==a&&It(g,d,{get:()=>i[d],enumerable:!(l=ds(i,d))||l.enumerable});return g};var Cr=(g,i,a)=>(a=g!=null?fs(ms(g)):{},vs(i||!g||!g.__esModule?It(a,"default",{value:g,enumerable:!0}):a,g));var Te=ge(Or=>{var er=class extends Error{constructor(i,a,l){super(l),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=a,this.exitCode=i,this.nestedError=void 0}},$r=class extends er{constructor(i){super(1,"commander.invalidArgument",i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Or.CommanderError=er;Or.InvalidArgumentError=$r});var rr=ge(Pr=>{var{InvalidArgumentError:Cs}=Te(),Sr=class{constructor(i,a){switch(this.description=a||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,i[0]){case"<":this.required=!0,this._name=i.slice(1,-1);break;case"[":this.required=!1,this._name=i.slice(1,-1);break;default:this.required=!0,this._name=i;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(i,a){return a===this.defaultValue||!Array.isArray(a)?[i]:a.concat(i)}default(i,a){return this.defaultValue=i,this.defaultValueDescription=a,this}argParser(i){return this.parseArg=i,this}choices(i){return this.argChoices=i.slice(),this.parseArg=(a,l)=>{if(!this.argChoices.includes(a))throw new Cs(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(a,l):a},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function As(g){let i=g.name()+(g.variadic===!0?"...":"");return g.required?"<"+i+">":"["+i+"]"}Pr.Argument=Sr;Pr.humanReadableArgName=As});var Tr=ge(Zt=>{var{humanReadableArgName:ks}=rr(),Fr=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(i){let a=i.commands.filter(d=>!d._hidden),l=i._getHelpCommand();return l&&!l._hidden&&a.push(l),this.sortSubcommands&&a.sort((d,h)=>d.name().localeCompare(h.name())),a}compareOptions(i,a){let l=d=>d.short?d.short.replace(/^-/,""):d.long.replace(/^--/,"");return l(i).localeCompare(l(a))}visibleOptions(i){let a=i.options.filter(d=>!d.hidden),l=i._getHelpOption();if(l&&!l.hidden){let d=l.short&&i._findOption(l.short),h=l.long&&i._findOption(l.long);!d&&!h?a.push(l):l.long&&!h?a.push(i.createOption(l.long,l.description)):l.short&&!d&&a.push(i.createOption(l.short,l.description))}return this.sortOptions&&a.sort(this.compareOptions),a}visibleGlobalOptions(i){if(!this.showGlobalOptions)return[];let a=[];for(let l=i.parent;l;l=l.parent){let d=l.options.filter(h=>!h.hidden);a.push(...d)}return this.sortOptions&&a.sort(this.compareOptions),a}visibleArguments(i){return i._argsDescription&&i.registeredArguments.forEach(a=>{a.description=a.description||i._argsDescription[a.name()]||""}),i.registeredArguments.find(a=>a.description)?i.registeredArguments:[]}subcommandTerm(i){let a=i.registeredArguments.map(l=>ks(l)).join(" ");return i._name+(i._aliases[0]?"|"+i._aliases[0]:"")+(i.options.length?" [options]":"")+(a?" "+a:"")}optionTerm(i){return i.flags}argumentTerm(i){return i.name()}longestSubcommandTermLength(i,a){return a.visibleCommands(i).reduce((l,d)=>Math.max(l,a.subcommandTerm(d).length),0)}longestOptionTermLength(i,a){return a.visibleOptions(i).reduce((l,d)=>Math.max(l,a.optionTerm(d).length),0)}longestGlobalOptionTermLength(i,a){return a.visibleGlobalOptions(i).reduce((l,d)=>Math.max(l,a.optionTerm(d).length),0)}longestArgumentTermLength(i,a){return a.visibleArguments(i).reduce((l,d)=>Math.max(l,a.argumentTerm(d).length),0)}commandUsage(i){let a=i._name;i._aliases[0]&&(a=a+"|"+i._aliases[0]);let l="";for(let d=i.parent;d;d=d.parent)l=d.name()+" "+l;return l+a+" "+i.usage()}commandDescription(i){return i.description()}subcommandDescription(i){return i.summary()||i.description()}optionDescription(i){let a=[];return i.argChoices&&a.push(`choices: ${i.argChoices.map(l=>JSON.stringify(l)).join(", ")}`),i.defaultValue!==void 0&&(i.required||i.optional||i.isBoolean()&&typeof i.defaultValue=="boolean")&&a.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),i.presetArg!==void 0&&i.optional&&a.push(`preset: ${JSON.stringify(i.presetArg)}`),i.envVar!==void 0&&a.push(`env: ${i.envVar}`),a.length>0?`${i.description} (${a.join(", ")})`:i.description}argumentDescription(i){let a=[];if(i.argChoices&&a.push(`choices: ${i.argChoices.map(l=>JSON.stringify(l)).join(", ")}`),i.defaultValue!==void 0&&a.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),a.length>0){let l=`(${a.join(", ")})`;return i.description?`${i.description} ${l}`:l}return i.description}formatHelp(i,a){let l=a.padWidth(i,a),d=a.helpWidth||80,h=2,y=2;function k(W,Q){if(Q){let fe=`${W.padEnd(l+y)}${Q}`;return a.wrap(fe,d-h,l+y)}return W}function b(W){return W.join(` `).replace(/^/gm," ".repeat(h))}let $=[`Usage: ${a.commandUsage(i)}`,""],S=a.commandDescription(i);S.length>0&&($=$.concat([a.wrap(S,d,0),""]));let T=a.visibleArguments(i).map(W=>k(a.argumentTerm(W),a.argumentDescription(W)));T.length>0&&($=$.concat(["Arguments:",b(T),""]));let I=a.visibleOptions(i).map(W=>k(a.optionTerm(W),a.optionDescription(W)));if(I.length>0&&($=$.concat(["Options:",b(I),""])),this.showGlobalOptions){let W=a.visibleGlobalOptions(i).map(Q=>k(a.optionTerm(Q),a.optionDescription(Q)));W.length>0&&($=$.concat(["Global Options:",b(W),""]))}let B=a.visibleCommands(i).map(W=>k(a.subcommandTerm(W),a.subcommandDescription(W)));return B.length>0&&($=$.concat(["Commands:",b(B),""])),$.join(` `)}padWidth(i,a){return Math.max(a.longestOptionTermLength(i,a),a.longestGlobalOptionTermLength(i,a),a.longestSubcommandTermLength(i,a),a.longestArgumentTermLength(i,a))}wrap(i,a,l,d=40){let h=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",y=new RegExp(`[\\n][${h}]+`);if(i.match(y))return i;let k=a-l;if(k<d)return i;let b=i.slice(0,l),$=i.slice(l).replace(`\r `,` `),S=" ".repeat(l),I="\\s\u200B",B=new RegExp(` |.{1,${k-1}}([${I}]|$)|[^${I}]+?([${I}]|$)`,"g"),W=$.match(B)||[];return b+W.map((Q,fe)=>Q===` `?"":(fe>0?S:"")+Q.trimEnd()).join(` `)}};Zt.Help=Fr});var jr=ge(Mr=>{var{InvalidArgumentError:$s}=Te(),xr=class{constructor(i,a){this.flags=i,this.description=a||"",this.required=i.includes("<"),this.optional=i.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(i),this.mandatory=!1;let l=Ss(i);this.short=l.shortFlag,this.long=l.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(i,a){return this.defaultValue=i,this.defaultValueDescription=a,this}preset(i){return this.presetArg=i,this}conflicts(i){return this.conflictsWith=this.conflictsWith.concat(i),this}implies(i){let a=i;return typeof i=="string"&&(a={[i]:!0}),this.implied=Object.assign(this.implied||{},a),this}env(i){return this.envVar=i,this}argParser(i){return this.parseArg=i,this}makeOptionMandatory(i=!0){return this.mandatory=!!i,this}hideHelp(i=!0){return this.hidden=!!i,this}_concatValue(i,a){return a===this.defaultValue||!Array.isArray(a)?[i]:a.concat(i)}choices(i){return this.argChoices=i.slice(),this.parseArg=(a,l)=>{if(!this.argChoices.includes(a))throw new $s(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(a,l):a},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Os(this.name().replace(/^no-/,""))}is(i){return this.short===i||this.long===i}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Dr=class{constructor(i){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,i.forEach(a=>{a.negate?this.negativeOptions.set(a.attributeName(),a):this.positiveOptions.set(a.attributeName(),a)}),this.negativeOptions.forEach((a,l)=>{this.positiveOptions.has(l)&&this.dualOptions.add(l)})}valueFromOption(i,a){let l=a.attributeName();if(!this.dualOptions.has(l))return!0;let d=this.negativeOptions.get(l).presetArg,h=d!==void 0?d:!1;return a.negate===(h===i)}};function Os(g){return g.split("-").reduce((i,a)=>i+a[0].toUpperCase()+a.slice(1))}function Ss(g){let i,a,l=g.split(/[ |,]+/);return l.length>1&&!/^[[<]/.test(l[1])&&(i=l.shift()),a=l.shift(),!i&&/^-[^-]$/.test(a)&&(i=a,a=void 0),{shortFlag:i,longFlag:a}}Mr.Option=xr;Mr.DualOptions=Dr});var rn=ge(en=>{function Ps(g,i){if(Math.abs(g.length-i.length)>3)return Math.max(g.length,i.length);let a=[];for(let l=0;l<=g.length;l++)a[l]=[l];for(let l=0;l<=i.length;l++)a[0][l]=l;for(let l=1;l<=i.length;l++)for(let d=1;d<=g.length;d++){let h=1;g[d-1]===i[l-1]?h=0:h=1,a[d][l]=Math.min(a[d-1][l]+1,a[d][l-1]+1,a[d-1][l-1]+h),d>1&&l>1&&g[d-1]===i[l-2]&&g[d-2]===i[l-1]&&(a[d][l]=Math.min(a[d][l],a[d-2][l-2]+1))}return a[g.length][i.length]}function Fs(g,i){if(!i||i.length===0)return"";i=Array.from(new Set(i));let a=g.startsWith("--");a&&(g=g.slice(2),i=i.map(y=>y.slice(2)));let l=[],d=3,h=.4;return i.forEach(y=>{if(y.length<=1)return;let k=Ps(g,y),b=Math.max(g.length,y.length);(b-k)/b>h&&(k<d?(d=k,l=[y]):k===d&&l.push(y))}),l.sort((y,k)=>y.localeCompare(k)),a&&(l=l.map(y=>`--${y}`)),l.length>1?` (Did you mean one of ${l.join(", ")}?)`:l.length===1?` (Did you mean ${l[0]}?)`:""}en.suggestSimilar=Fs});var an=ge(sn=>{var Ts=require("node:events").EventEmitter,Hr=require("node:child_process"),le=require("node:path"),Rr=require("node:fs"),L=require("node:process"),{Argument:xs,humanReadableArgName:Ds}=rr(),{CommanderError:Vr}=Te(),{Help:Ms}=Tr(),{Option:tn,DualOptions:js}=jr(),{suggestSimilar:nn}=rn(),Wr=class g extends Ts{constructor(i){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=i||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:a=>L.stdout.write(a),writeErr:a=>L.stderr.write(a),getOutHelpWidth:()=>L.stdout.isTTY?L.stdout.columns:void 0,getErrHelpWidth:()=>L.stderr.isTTY?L.stderr.columns:void 0,outputError:(a,l)=>l(a)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(i){return this._outputConfiguration=i._outputConfiguration,this._helpOption=i._helpOption,this._helpCommand=i._helpCommand,this._helpConfiguration=i._helpConfiguration,this._exitCallback=i._exitCallback,this._storeOptionsAsProperties=i._storeOptionsAsProperties,this._combineFlagAndOptionalValue=i._combineFlagAndOptionalValue,this._allowExcessArguments=i._allowExcessArguments,this._enablePositionalOptions=i._enablePositionalOptions,this._showHelpAfterError=i._showHelpAfterError,this._showSuggestionAfterError=i._showSuggestionAfterError,this}_getCommandAndAncestors(){let i=[];for(let a=this;a;a=a.parent)i.push(a);return i}command(i,a,l){let d=a,h=l;typeof d=="object"&&d!==null&&(h=d,d=null),h=h||{};let[,y,k]=i.match(/([^ ]+) *(.*)/),b=this.createCommand(y);return d&&(b.description(d),b._executableHandler=!0),h.isDefault&&(this._defaultCommandName=b._name),b._hidden=!!(h.noHelp||h.hidden),b._executableFile=h.executableFile||null,k&&b.arguments(k),this._registerCommand(b),b.parent=this,b.copyInheritedSettings(this),d?this:b}createCommand(i){return new g(i)}createHelp(){return Object.assign(new Ms,this.configureHelp())}configureHelp(i){return i===void 0?this._helpConfiguration:(this._helpConfiguration=i,this)}configureOutput(i){return i===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,i),this)}showHelpAfterError(i=!0){return typeof i!="string"&&(i=!!i),this._showHelpAfterError=i,this}showSuggestionAfterError(i=!0){return this._showSuggestionAfterError=!!i,this}addCommand(i,a){if(!i._name)throw new Error(`Command passed to .addCommand() must have a name - specify the name in Command constructor or using .name()`);return a=a||{},a.isDefault&&(this._defaultCommandName=i._name),(a.noHelp||a.hidden)&&(i._hidden=!0),this._registerCommand(i),i.parent=this,i._checkForBrokenPassThrough(),this}createArgument(i,a){return new xs(i,a)}argument(i,a,l,d){let h=this.createArgument(i,a);return typeof l=="function"?h.default(d).argParser(l):h.default(l),this.addArgument(h),this}arguments(i){return i.trim().split(/ +/).forEach(a=>{this.argument(a)}),this}addArgument(i){let a=this.registeredArguments.slice(-1)[0];if(a&&a.variadic)throw new Error(`only the last argument can be variadic '${a.name()}'`);if(i.required&&i.defaultValue!==void 0&&i.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${i.name()}'`);return this.registeredArguments.push(i),this}helpCommand(i,a){if(typeof i=="boolean")return this._addImplicitHelpCommand=i,this;i=i??"help [command]";let[,l,d]=i.match(/([^ ]+) *(.*)/),h=a??"display help for command",y=this.createCommand(l);return y.helpOption(!1),d&&y.arguments(d),h&&y.description(h),this._addImplicitHelpCommand=!0,this._helpCommand=y,this}addHelpCommand(i,a){return typeof i!="object"?(this.helpCommand(i,a),this):(this._addImplicitHelpCommand=!0,this._helpCommand=i,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(i,a){let l=["preSubcommand","preAction","postAction"];if(!l.includes(i))throw new Error(`Unexpected value for event passed to hook : '${i}'. Expecting one of '${l.join("', '")}'`);return this._lifeCycleHooks[i]?this._lifeCycleHooks[i].push(a):this._lifeCycleHooks[i]=[a],this}exitOverride(i){return i?this._exitCallback=i:this._exitCallback=a=>{if(a.code!=="commander.executeSubCommandAsync")throw a},this}_exit(i,a,l){this._exitCallback&&this._exitCallback(new Vr(i,a,l)),L.exit(i)}action(i){let a=l=>{let d=this.registeredArguments.length,h=l.slice(0,d);return this._storeOptionsAsProperties?h[d]=this:h[d]=this.opts(),h.push(this),i.apply(this,h)};return this._actionHandler=a,this}createOption(i,a){return new tn(i,a)}_callParseArg(i,a,l,d){try{return i.parseArg(a,l)}catch(h){if(h.code==="commander.invalidArgument"){let y=`${d} ${h.message}`;this.error(y,{exitCode:h.exitCode,code:h.code})}throw h}}_registerOption(i){let a=i.short&&this._findOption(i.short)||i.long&&this._findOption(i.long);if(a){let l=i.long&&this._findOption(i.long)?i.long:i.short;throw new Error(`Cannot add option '${i.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${l}' - already used by option '${a.flags}'`)}this.options.push(i)}_registerCommand(i){let a=d=>[d.name()].concat(d.aliases()),l=a(i).find(d=>this._findCommand(d));if(l){let d=a(this._findCommand(l)).join("|"),h=a(i).join("|");throw new Error(`cannot add command '${h}' as already have command '${d}'`)}this.commands.push(i)}addOption(i){this._registerOption(i);let a=i.name(),l=i.attributeName();if(i.negate){let h=i.long.replace(/^--no-/,"--");this._findOption(h)||this.setOptionValueWithSource(l,i.defaultValue===void 0?!0:i.defaultValue,"default")}else i.defaultValue!==void 0&&this.setOptionValueWithSource(l,i.defaultValue,"default");let d=(h,y,k)=>{h==null&&i.presetArg!==void 0&&(h=i.presetArg);let b=this.getOptionValue(l);h!==null&&i.parseArg?h=this._callParseArg(i,h,b,y):h!==null&&i.variadic&&(h=i._concatValue(h,b)),h==null&&(i.negate?h=!1:i.isBoolean()||i.optional?h=!0:h=""),this.setOptionValueWithSource(l,h,k)};return this.on("option:"+a,h=>{let y=`error: option '${i.flags}' argument '${h}' is invalid.`;d(h,y,"cli")}),i.envVar&&this.on("optionEnv:"+a,h=>{let y=`error: option '${i.flags}' value '${h}' from env '${i.envVar}' is invalid.`;d(h,y,"env")}),this}_optionEx(i,a,l,d,h){if(typeof a=="object"&&a instanceof tn)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let y=this.createOption(a,l);if(y.makeOptionMandatory(!!i.mandatory),typeof d=="function")y.default(h).argParser(d);else if(d instanceof RegExp){let k=d;d=(b,$)=>{let S=k.exec(b);return S?S[0]:$},y.default(h).argParser(d)}else y.default(d);return this.addOption(y)}option(i,a,l,d){return this._optionEx({},i,a,l,d)}requiredOption(i,a,l,d){return this._optionEx({mandatory:!0},i,a,l,d)}combineFlagAndOptionalValue(i=!0){return this._combineFlagAndOptionalValue=!!i,this}allowUnknownOption(i=!0){return this._allowUnknownOption=!!i,this}allowExcessArguments(i=!0){return this._allowExcessArguments=!!i,this}enablePositionalOptions(i=!0){return this._enablePositionalOptions=!!i,this}passThroughOptions(i=!0){return this._passThroughOptions=!!i,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(i=!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=!!i,this}getOptionValue(i){return this._storeOptionsAsProperties?this[i]:this._optionValues[i]}setOptionValue(i,a){return this.setOptionValueWithSource(i,a,void 0)}setOptionValueWithSource(i,a,l){return this._storeOptionsAsProperties?this[i]=a:this._optionValues[i]=a,this._optionValueSources[i]=l,this}getOptionValueSource(i){return this._optionValueSources[i]}getOptionValueSourceWithGlobals(i){let a;return this._getCommandAndAncestors().forEach(l=>{l.getOptionValueSource(i)!==void 0&&(a=l.getOptionValueSource(i))}),a}_prepareUserArgs(i,a){if(i!==void 0&&!Array.isArray(i))throw new Error("first parameter to parse must be array or undefined");if(a=a||{},i===void 0&&a.from===void 0){L.versions?.electron&&(a.from="electron");let d=L.execArgv??[];(d.includes("-e")||d.includes("--eval")||d.includes("-p")||d.includes("--print"))&&(a.from="eval")}i===void 0&&(i=L.argv),this.rawArgs=i.slice();let l;switch(a.from){case void 0:case"node":this._scriptPath=i[1],l=i.slice(2);break;case"electron":L.defaultApp?(this._scriptPath=i[1],l=i.slice(2)):l=i.slice(1);break;case"user":l=i.slice(0);break;case"eval":l=i.slice(1);break;default:throw new Error(`unexpected parse option { from: '${a.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",l}parse(i,a){let l=this._prepareUserArgs(i,a);return this._parseCommand([],l),this}async parseAsync(i,a){let l=this._prepareUserArgs(i,a);return await this._parseCommand([],l),this}_executeSubCommand(i,a){a=a.slice();let l=!1,d=[".js",".ts",".tsx",".mjs",".cjs"];function h(S,T){let I=le.resolve(S,T);if(Rr.existsSync(I))return I;if(d.includes(le.extname(T)))return;let B=d.find(W=>Rr.existsSync(`${I}${W}`));if(B)return`${I}${B}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let y=i._executableFile||`${this._name}-${i._name}`,k=this._executableDir||"";if(this._scriptPath){let S;try{S=Rr.realpathSync(this._scriptPath)}catch{S=this._scriptPath}k=le.resolve(le.dirname(S),k)}if(k){let S=h(k,y);if(!S&&!i._executableFile&&this._scriptPath){let T=le.basename(this._scriptPath,le.extname(this._scriptPath));T!==this._name&&(S=h(k,`${T}-${i._name}`))}y=S||y}l=d.includes(le.extname(y));let b;L.platform!=="win32"?l?(a.unshift(y),a=on(L.execArgv).concat(a),b=Hr.spawn(L.argv[0],a,{stdio:"inherit"})):b=Hr.spawn(y,a,{stdio:"inherit"}):(a.unshift(y),a=on(L.execArgv).concat(a),b=Hr.spawn(L.execPath,a,{stdio:"inherit"})),b.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(T=>{L.on(T,()=>{b.killed===!1&&b.exitCode===null&&b.kill(T)})});let $=this._exitCallback;b.on("close",S=>{S=S??1,$?$(new Vr(S,"commander.executeSubCommandAsync","(close)")):L.exit(S)}),b.on("error",S=>{if(S.code==="ENOENT"){let T=k?`searched for local subcommand relative to directory '${k}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",I=`'${y}' does not exist - if '${i._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - ${T}`;throw new Error(I)}else if(S.code==="EACCES")throw new Error(`'${y}' not executable`);if(!$)L.exit(1);else{let T=new Vr(1,"commander.executeSubCommandAsync","(error)");T.nestedError=S,$(T)}}),this.runningCommand=b}_dispatchSubcommand(i,a,l){let d=this._findCommand(i);d||this.help({error:!0});let h;return h=this._chainOrCallSubCommandHook(h,d,"preSubcommand"),h=this._chainOrCall(h,()=>{if(d._executableHandler)this._executeSubCommand(d,a.concat(l));else return d._parseCommand(a,l)}),h}_dispatchHelpCommand(i){i||this.help();let a=this._findCommand(i);return a&&!a._executableHandler&&a.help(),this._dispatchSubcommand(i,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((i,a)=>{i.required&&this.args[a]==null&&this.missingArgument(i.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let i=(l,d,h)=>{let y=d;if(d!==null&&l.parseArg){let k=`error: command-argument value '${d}' is invalid for argument '${l.name()}'.`;y=this._callParseArg(l,d,h,k)}return y};this._checkNumberOfArguments();let a=[];this.registeredArguments.forEach((l,d)=>{let h=l.defaultValue;l.variadic?d<this.args.length?(h=this.args.slice(d),l.parseArg&&(h=h.reduce((y,k)=>i(l,k,y),l.defaultValue))):h===void 0&&(h=[]):d<this.args.length&&(h=this.args[d],l.parseArg&&(h=i(l,h,l.defaultValue))),a[d]=h}),this.processedArgs=a}_chainOrCall(i,a){return i&&i.then&&typeof i.then=="function"?i.then(()=>a()):a()}_chainOrCallHooks(i,a){let l=i,d=[];return this._getCommandAndAncestors().reverse().filter(h=>h._lifeCycleHooks[a]!==void 0).forEach(h=>{h._lifeCycleHooks[a].forEach(y=>{d.push({hookedCommand:h,callback:y})})}),a==="postAction"&&d.reverse(),d.forEach(h=>{l=this._chainOrCall(l,()=>h.callback(h.hookedCommand,this))}),l}_chainOrCallSubCommandHook(i,a,l){let d=i;return this._lifeCycleHooks[l]!==void 0&&this._lifeCycleHooks[l].forEach(h=>{d=this._chainOrCall(d,()=>h(this,a))}),d}_parseCommand(i,a){let l=this.parseOptions(a);if(this._parseOptionsEnv(),this._parseOptionsImplied(),i=i.concat(l.operands),a=l.unknown,this.args=i.concat(a),i&&this._findCommand(i[0]))return this._dispatchSubcommand(i[0],i.slice(1),a);if(this._getHelpCommand()&&i[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(i[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(a),this._dispatchSubcommand(this._defaultCommandName,i,a);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(l.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let d=()=>{l.unknown.length>0&&this.unknownOption(l.unknown[0])},h=`command:${this.name()}`;if(this._actionHandler){d(),this._processArguments();let y;return y=this._chainOrCallHooks(y,"preAction"),y=this._chainOrCall(y,()=>this._actionHandler(this.processedArgs)),this.parent&&(y=this._chainOrCall(y,()=>{this.parent.emit(h,i,a)})),y=this._chainOrCallHooks(y,"postAction"),y}if(this.parent&&this.parent.listenerCount(h))d(),this._processArguments(),this.parent.emit(h,i,a);else if(i.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",i,a);this.listenerCount("command:*")?this.emit("command:*",i,a):this.commands.length?this.unknownCommand():(d(),this._processArguments())}else this.commands.length?(d(),this.help({error:!0})):(d(),this._processArguments())}_findCommand(i){if(i)return this.commands.find(a=>a._name===i||a._aliases.includes(i))}_findOption(i){return this.options.find(a=>a.is(i))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(i=>{i.options.forEach(a=>{a.mandatory&&i.getOptionValue(a.attributeName())===void 0&&i.missingMandatoryOptionValue(a)})})}_checkForConflictingLocalOptions(){let i=this.options.filter(l=>{let d=l.attributeName();return this.getOptionValue(d)===void 0?!1:this.getOptionValueSource(d)!=="default"});i.filter(l=>l.conflictsWith.length>0).forEach(l=>{let d=i.find(h=>l.conflictsWith.includes(h.attributeName()));d&&this._conflictingOption(l,d)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(i=>{i._checkForConflictingLocalOptions()})}parseOptions(i){let a=[],l=[],d=a,h=i.slice();function y(b){return b.length>1&&b[0]==="-"}let k=null;for(;h.length;){let b=h.shift();if(b==="--"){d===l&&d.push(b),d.push(...h);break}if(k&&!y(b)){this.emit(`option:${k.name()}`,b);continue}if(k=null,y(b)){let $=this._findOption(b);if($){if($.required){let S=h.shift();S===void 0&&this.optionMissingArgument($),this.emit(`option:${$.name()}`,S)}else if($.optional){let S=null;h.length>0&&!y(h[0])&&(S=h.shift()),this.emit(`option:${$.name()}`,S)}else this.emit(`option:${$.name()}`);k=$.variadic?$:null;continue}}if(b.length>2&&b[0]==="-"&&b[1]!=="-"){let $=this._findOption(`-${b[1]}`);if($){$.required||$.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${$.name()}`,b.slice(2)):(this.emit(`option:${$.name()}`),h.unshift(`-${b.slice(2)}`));continue}}if(/^--[^=]+=/.test(b)){let $=b.indexOf("="),S=this._findOption(b.slice(0,$));if(S&&(S.required||S.optional)){this.emit(`option:${S.name()}`,b.slice($+1));continue}}if(y(b)&&(d=l),(this._enablePositionalOptions||this._passThroughOptions)&&a.length===0&&l.length===0){if(this._findCommand(b)){a.push(b),h.length>0&&l.push(...h);break}else if(this._getHelpCommand()&&b===this._getHelpCommand().name()){a.push(b),h.length>0&&a.push(...h);break}else if(this._defaultCommandName){l.push(b),h.length>0&&l.push(...h);break}}if(this._passThroughOptions){d.push(b),h.length>0&&d.push(...h);break}d.push(b)}return{operands:a,unknown:l}}opts(){if(this._storeOptionsAsProperties){let i={},a=this.options.length;for(let l=0;l<a;l++){let d=this.options[l].attributeName();i[d]=d===this._versionOptionName?this._version:this[d]}return i}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((i,a)=>Object.assign(i,a.opts()),{})}error(i,a){this._outputConfiguration.outputError(`${i} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` `),this.outputHelp({error:!0}));let l=a||{},d=l.exitCode||1,h=l.code||"commander.error";this._exit(d,h,i)}_parseOptionsEnv(){this.options.forEach(i=>{if(i.envVar&&i.envVar in L.env){let a=i.attributeName();(this.getOptionValue(a)===void 0||["default","config","env"].includes(this.getOptionValueSource(a)))&&(i.required||i.optional?this.emit(`optionEnv:${i.name()}`,L.env[i.envVar]):this.emit(`optionEnv:${i.name()}`))}})}_parseOptionsImplied(){let i=new js(this.options),a=l=>this.getOptionValue(l)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(l));this.options.filter(l=>l.implied!==void 0&&a(l.attributeName())&&i.valueFromOption(this.getOptionValue(l.attributeName()),l)).forEach(l=>{Object.keys(l.implied).filter(d=>!a(d)).forEach(d=>{this.setOptionValueWithSource(d,l.implied[d],"implied")})})}missingArgument(i){let a=`error: missing required argument '${i}'`;this.error(a,{code:"commander.missingArgument"})}optionMissingArgument(i){let a=`error: option '${i.flags}' argument missing`;this.error(a,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(i){let a=`error: required option '${i.flags}' not specified`;this.error(a,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(i,a){let l=y=>{let k=y.attributeName(),b=this.getOptionValue(k),$=this.options.find(T=>T.negate&&k===T.attributeName()),S=this.options.find(T=>!T.negate&&k===T.attributeName());return $&&($.presetArg===void 0&&b===!1||$.presetArg!==void 0&&b===$.presetArg)?$:S||y},d=y=>{let k=l(y),b=k.attributeName();return this.getOptionValueSource(b)==="env"?`environment variable '${k.envVar}'`:`option '${k.flags}'`},h=`error: ${d(i)} cannot be used with ${d(a)}`;this.error(h,{code:"commander.conflictingOption"})}unknownOption(i){if(this._allowUnknownOption)return;let a="";if(i.startsWith("--")&&this._showSuggestionAfterError){let d=[],h=this;do{let y=h.createHelp().visibleOptions(h).filter(k=>k.long).map(k=>k.long);d=d.concat(y),h=h.parent}while(h&&!h._enablePositionalOptions);a=nn(i,d)}let l=`error: unknown option '${i}'${a}`;this.error(l,{code:"commander.unknownOption"})}_excessArguments(i){if(this._allowExcessArguments)return;let a=this.registeredArguments.length,l=a===1?"":"s",h=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${a} argument${l} but got ${i.length}.`;this.error(h,{code:"commander.excessArguments"})}unknownCommand(){let i=this.args[0],a="";if(this._showSuggestionAfterError){let d=[];this.createHelp().visibleCommands(this).forEach(h=>{d.push(h.name()),h.alias()&&d.push(h.alias())}),a=nn(i,d)}let l=`error: unknown command '${i}'${a}`;this.error(l,{code:"commander.unknownCommand"})}version(i,a,l){if(i===void 0)return this._version;this._version=i,a=a||"-V, --version",l=l||"output the version number";let d=this.createOption(a,l);return this._versionOptionName=d.attributeName(),this._registerOption(d),this.on("option:"+d.name(),()=>{this._outputConfiguration.writeOut(`${i} `),this._exit(0,"commander.version",i)}),this}description(i,a){return i===void 0&&a===void 0?this._description:(this._description=i,a&&(this._argsDescription=a),this)}summary(i){return i===void 0?this._summary:(this._summary=i,this)}alias(i){if(i===void 0)return this._aliases[0];let a=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(a=this.commands[this.commands.length-1]),i===a._name)throw new Error("Command alias can't be the same as its name");let l=this.parent?._findCommand(i);if(l){let d=[l.name()].concat(l.aliases()).join("|");throw new Error(`cannot add alias '${i}' to command '${this.name()}' as already have command '${d}'`)}return a._aliases.push(i),this}aliases(i){return i===void 0?this._aliases:(i.forEach(a=>this.alias(a)),this)}usage(i){if(i===void 0){if(this._usage)return this._usage;let a=this.registeredArguments.map(l=>Ds(l));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?a:[]).join(" ")}return this._usage=i,this}name(i){return i===void 0?this._name:(this._name=i,this)}nameFromFilename(i){return this._name=le.basename(i,le.extname(i)),this}executableDir(i){return i===void 0?this._executableDir:(this._executableDir=i,this)}helpInformation(i){let a=this.createHelp();return a.helpWidth===void 0&&(a.helpWidth=i&&i.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),a.formatHelp(this,a)}_getHelpContext(i){i=i||{};let a={error:!!i.error},l;return a.error?l=d=>this._outputConfiguration.writeErr(d):l=d=>this._outputConfiguration.writeOut(d),a.write=i.write||l,a.command=this,a}outputHelp(i){let a;typeof i=="function"&&(a=i,i=void 0);let l=this._getHelpContext(i);this._getCommandAndAncestors().reverse().forEach(h=>h.emit("beforeAllHelp",l)),this.emit("beforeHelp",l);let d=this.helpInformation(l);if(a&&(d=a(d),typeof d!="string"&&!Buffer.isBuffer(d)))throw new Error("outputHelp callback must return a string or a Buffer");l.write(d),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",l),this._getCommandAndAncestors().forEach(h=>h.emit("afterAllHelp",l))}helpOption(i,a){return typeof i=="boolean"?(i?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(i=i??"-h, --help",a=a??"display help for command",this._helpOption=this.createOption(i,a),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(i){return this._helpOption=i,this}help(i){this.outputHelp(i);let a=L.exitCode||0;a===0&&i&&typeof i!="function"&&i.error&&(a=1),this._exit(a,"commander.help","(outputHelp)")}addHelpText(i,a){let l=["beforeAll","before","after","afterAll"];if(!l.includes(i))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${l.join("', '")}'`);let d=`${i}Help`;return this.on(d,h=>{let y;typeof a=="function"?y=a({error:h.error,command:h.command}):y=a,y&&h.write(`${y} `)}),this}_outputHelpIfRequested(i){let a=this._getHelpOption();a&&i.find(d=>a.is(d))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function on(g){return g.map(i=>{if(!i.startsWith("--inspect"))return i;let a,l="127.0.0.1",d="9229",h;return(h=i.match(/^(--inspect(-brk)?)$/))!==null?a=h[1]:(h=i.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(a=h[1],/^\d+$/.test(h[3])?d=h[3]:l=h[3]):(h=i.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(a=h[1],l=h[3],d=h[4]),a&&d!=="0"?`${a}=${l}:${parseInt(d)+1}`:i})}sn.Command=Wr});var fn=ge(re=>{var{Argument:ln}=rr(),{Command:Ur}=an(),{CommanderError:Hs,InvalidArgumentError:un}=Te(),{Help:Rs}=Tr(),{Option:cn}=jr();re.program=new Ur;re.createCommand=g=>new Ur(g);re.createOption=(g,i)=>new cn(g,i);re.createArgument=(g,i)=>new ln(g,i);re.Command=Ur;re.Option=cn;re.Argument=ln;re.Help=Rs;re.CommanderError=Hs;re.InvalidArgumentError=un;re.InvalidOptionArgumentError=un});var Ir=Cr(require("fs")),mn=require("path");function Ar(g,i){if(!g)throw new Error(i);return g}function Nt(g){return Ar(g),g}function Bt(g){throw new Error("Should not be reachable")}var Lt=async(g,i)=>{let a={instantiateWasm:async(l,d)=>{switch(g.type){case"response":{let h=await WebAssembly.instantiateStreaming(g.response,l);d(h.instance,h.module)}break;case"buffer":{let h=await WebAssembly.instantiate(await g.buffer,l);d(h.instance,h.module)}break;default:Bt(g)}}};return Nt(await(await i)(a))};var gs=new TextEncoder,kr=g=>gs.encode(g),_s=new TextDecoder,qt=g=>_s.decode(g);var ys=!1,ws=g=>{if(typeof g=="string")return kr(g);if(g instanceof Uint8Array)return g;if(g instanceof Object)return kr(JSON.stringify(g));throw new Error("unsupported type")},zt=g=>{let i=new g.DocumentEngine.create;return{exec:(h,...y)=>(()=>{let{error:b,values:$}=(()=>{let T=new g.MemoryHandleVector;try{for(let I of y){let B=ws(I),W=g.allocateMemory(B.byteLength);try{Ar(W.size===B.byteLength),W.view.set(B),T.push_back(W)}finally{W.delete()}}try{return i.exec(h,T)}catch(I){throw console.error("exception while calling exec",h,I),I}}finally{T.delete()}})();if(b)throw $.delete(),ys&&console.error("WASM request",h,y,"yielded error",b),b;let S=[];for(let T=0;T<$.size();++T){let I=$.get(T);S.push(I.view.slice()),I.delete()}return $.delete(),S})(),destroy:()=>{i.delete()}}};var Ce=Cr(require("fs")),Kt=require("path");var Gt=g=>JSON.parse(qt(g));var Jt=(g,i,a)=>{let{wasmExecutor:l}=g;return Gt(l.exec("fonts/index",{id:a},i)[0])},Yt=g=>({v:1,availableFonts:g});var Es=[".ttf",".otf",".ttc",".otc"],Xt=(g,i)=>{let a=[];return Ce.readdirSync(i).forEach(l=>{let d=(0,Kt.resolve)(i,l);if(!Ce.statSync(d).isFile()||Es.every(k=>!l.toLowerCase().endsWith(k)))return;let h=(()=>{try{return new Uint8Array(Ce.readFileSync(d))}catch{throw new Error(`Error processing file '${l}'.`)}})(),y=Jt(g,h,l);a=a.concat(y)}),a};var bs=(()=>{var g=typeof document<"u"?document.currentScript?.src:void 0;return function(i={}){var a,l=i,d,h,y=new Promise((e,r)=>{d=e,h=r}),k=!0,b=!1,$=Object.assign({},l),S=[],T="./this.program",I=(e,r)=>{throw r},B="";function W(e){return l.locateFile?l.locateFile(e,B):B+e}var Q,fe;(k||b)&&(b?B=self.location.href:typeof document<"u"&&document.currentScript&&(B=document.currentScript.src),g&&(B=g),B.startsWith("blob:")?B="":B=B.substr(0,B.replace(/[?#].*/,"").lastIndexOf("/")+1),Q=async e=>{var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var tr=l.print||console.log.bind(console),ue=l.printErr||console.error.bind(console);Object.assign(l,$),$=null,l.arguments&&(S=l.arguments),l.thisProgram&&(T=l.thisProgram);var xe=l.wasmBinary,De,Me=!1,je,K,Y,ne,He,A,j,Br,nr;function Lr(){var e=De.buffer;l.HEAP8=K=new Int8Array(e),l.HEAP16=ne=new Int16Array(e),l.HEAPU8=Y=new Uint8Array(e),l.HEAPU16=He=new Uint16Array(e),l.HEAP32=A=new Int32Array(e),l.HEAPU32=j=new Uint32Array(e),l.HEAPF32=Br=new Float32Array(e),l.HEAPF64=nr=new Float64Array(e)}var qr=[],zr=[],pn=[],Gr=[],Jr=!1;function vn(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)wn(l.preRun.shift());Ve(qr)}function gn(){Jr=!0,!l.noFSInit&&!s.initialized&&s.init(),s.ignorePermissions=!1,ce.init(),Ve(zr)}function _n(){Ve(pn)}function yn(){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)bn(l.postRun.shift());Ve(Gr)}function wn(e){qr.unshift(e)}function En(e){zr.unshift(e)}function bn(e){Gr.unshift(e)}var de=0,Ae=null;function Is(e){return e}function Yr(e){de++,l.monitorRunDependencies?.(de)}function ir(e){if(de--,l.monitorRunDependencies?.(de),de==0&&Ae){var r=Ae;Ae=null,r()}}function Re(e){l.onAbort?.(e),e="Aborted("+e+")",ue(e),Me=!0,e+=". Build with -sASSERTIONS for more info.",Jr&&Ht();var r=new WebAssembly.RuntimeError(e);throw h(r),r}var Cn="data:application/octet-stream;base64,",Kr=e=>e.startsWith(Cn);function An(){var e="docauth.wasm";return Kr(e)?e:W(e)}var or;function kn(e){if(e==or&&xe)return new Uint8Array(xe);if(fe)return fe(e);throw"both async and sync fetching of the wasm failed"}async function $n(e){if(!xe)try{var r=await Q(e);return new Uint8Array(r)}catch{}return kn(e)}async function On(e,r){try{var t=await $n(e),n=await WebAssembly.instantiate(t,r);return n}catch(o){ue(`failed to asynchronously prepare wasm: ${o}`),Re(o)}}async function Sn(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Kr(r)&&typeof fetch=="function")try{var n=fetch(r,{credentials:"same-origin"}),o=await WebAssembly.instantiateStreaming(n,t);return o}catch(u){ue(`wasm streaming compile failed: ${u}`),ue("falling back to ArrayBuffer instantiation")}return On(r,t)}function Pn(){return{a:Jo}}async function Fn(){function e(o,u){return R=o.exports,De=R.ia,Lr(),mt=R.oa,En(R.ja),ir("wasm-instantiate"),R}Yr("wasm-instantiate");function r(o){e(o.instance)}var t=Pn();if(l.instantiateWasm)try{return l.instantiateWasm(t,e)}catch(o){ue(`Module.instantiateWasm callback failed with error: ${o}`),h(o)}or??=An();try{var n=await Sn(xe,or,t);return r(n),n}catch(o){h(o);return}}var O,U,Tn={1978352:()=>typeof wasmOffsetConverter<"u"};class Xr{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var Ve=e=>{for(;e.length>0;)e.shift()(l)},Qr=l.noExitRuntime||!0,H={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];o==="."?e.splice(n,1):o===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=H.isAbs(e),t=e.substr(-1)==="/";return e=H.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=H.splitPath(e),t=r[0],n=r[1];return!t&&!n?".":(n&&(n=n.substr(0,n.length-1)),t+n)},basename:e=>{if(e==="/")return"/";e=H.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:(...e)=>H.normalize(e.join("/")),join2:(e,r)=>H.normalize(e+"/"+r)},xn=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);Re("initRandomDevice")},Zr=e=>(Zr=xn())(e),_e={resolve:(...e)=>{for(var r="",t=!1,n=e.length-1;n>=-1&&!t;n--){var o=n>=0?e[n]:s.cwd();if(typeof o!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";r=o+"/"+r,t=H.isAbs(o)}return r=H.normalizeArray(r.split("/").filter(u=>!!u),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=_e.resolve(e).substr(1),r=_e.resolve(r).substr(1);function t(p){for(var v=0;v<p.length&&p[v]==="";v++);for(var _=p.length-1;_>=0&&p[_]==="";_--);return v>_?[]:p.slice(v,_-v+1)}for(var n=t(e.split("/")),o=t(r.split("/")),u=Math.min(n.length,o.length),c=u,f=0;f<u;f++)if(n[f]!==o[f]){c=f;break}for(var m=[],f=c;f<n.length;f++)m.push("..");return m=m.concat(o.slice(c)),m.join("/")}},et=typeof TextDecoder<"u"?new TextDecoder:void 0,ye=(e,r=0,t=NaN)=>{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&et)return et.decode(e.subarray(r,o));for(var u="";r<o;){var c=e[r++];if(!(c&128)){u+=String.fromCharCode(c);continue}var f=e[r++]&63;if((c&224)==192){u+=String.fromCharCode((c&31)<<6|f);continue}var m=e[r++]&63;if((c&240)==224?c=(c&15)<<12|f<<6|m:c=(c&7)<<18|f<<12|m<<6|e[r++]&63,c<65536)u+=String.fromCharCode(c);else{var p=c-65536;u+=String.fromCharCode(55296|p>>10,56320|p&1023)}}return u},sr=[],We=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},ar=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,u=t+n-1,c=0;c<e.length;++c){var f=e.charCodeAt(c);if(f>=55296&&f<=57343){var m=e.charCodeAt(++c);f=65536+((f&1023)<<10)|m&1023}if(f<=127){if(t>=u)break;r[t++]=f}else if(f<=2047){if(t+1>=u)break;r[t++]=192|f>>6,r[t++]=128|f&63}else if(f<=65535){if(t+2>=u)break;r[t++]=224|f>>12,r[t++]=128|f>>6&63,r[t++]=128|f&63}else{if(t+3>=u)break;r[t++]=240|f>>18,r[t++]=128|f>>12&63,r[t++]=128|f>>6&63,r[t++]=128|f&63}}return r[t]=0,t-o};function rt(e,r,t){var n=t>0?t:We(e)+1,o=new Array(n),u=ar(e,o,0,o.length);return r&&(o.length=u),o}var Dn=()=>{if(!sr.length){var e=null;if(typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=` `)),!e)return null;sr=rt(e,!0)}return sr.shift()},ce={ttys:[],init(){},shutdown(){},register(e,r){ce.ttys[e]={input:[],output:[],ops:r},s.registerDevice(e,ce.stream_ops)},stream_ops:{open(e){var r=ce.ttys[e.node.rdev];if(!r)throw new s.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new s.ErrnoError(60);for(var u=0,c=0;c<n;c++){var f;try{f=e.tty.ops.get_char(e.tty)}catch{throw new s.ErrnoError(29)}if(f===void 0&&u===0)throw new s.ErrnoError(6);if(f==null)break;u++,r[t+c]=f}return u&&(e.node.atime=Date.now()),u},write(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new s.ErrnoError(60);try{for(var u=0;u<n;u++)e.tty.ops.put_char(e.tty,r[t+u])}catch{throw new s.ErrnoError(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),u}},default_tty_ops:{get_char(e){return Dn()},put_char(e,r){r===null||r===10?(tr(ye(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(tr(ye(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,r,t){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(ue(ye(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(ue(ye(e.output)),e.output=[])}}},Mn=(e,r)=>{Y.fill(0,e,e+r)},tt=(e,r)=>Math.ceil(e/r)*r,nt=e=>{e=tt(e,65536);var r=Mt(65536,e);return r&&Mn(r,e),r},P={ops_table:null,mount(e){return P.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(s.isBlkdev(t)||s.isFIFO(t))throw new s.ErrnoError(63);P.ops_table||={dir:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr,lookup:P.node_ops.lookup,mknod:P.node_ops.mknod,rename:P.node_ops.rename,unlink:P.node_ops.unlink,rmdir:P.node_ops.rmdir,readdir:P.node_ops.readdir,symlink:P.node_ops.symlink},stream:{llseek:P.stream_ops.llseek}},file:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr},stream:{llseek:P.stream_ops.llseek,read:P.stream_ops.read,write:P.stream_ops.write,allocate:P.stream_ops.allocate,mmap:P.stream_ops.mmap,msync:P.stream_ops.msync}},link:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr,readlink:P.node_ops.readlink},stream:{}},chrdev:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr},stream:s.chrdev_stream_ops}};var o=s.createNode(e,r,t,n);return s.isDir(o.mode)?(o.node_ops=P.ops_table.dir.node,o.stream_ops=P.ops_table.dir.stream,o.contents={}):s.isFile(o.mode)?(o.node_ops=P.ops_table.file.node,o.stream_ops=P.ops_table.file.stream,o.usedBytes=0,o.contents=null):s.isLink(o.mode)?(o.node_ops=P.ops_table.link.node,o.stream_ops=P.ops_table.link.stream):s.isChrdev(o.mode)&&(o.node_ops=P.ops_table.chrdev.node,o.stream_ops=P.ops_table.chrdev.stream),o.atime=o.mtime=o.ctime=Date.now(),e&&(e.contents[r]=o,e.atime=e.mtime=e.ctime=o.atime),o},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var o=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(o.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=s.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,s.isDir(e.mode)?r.size=4096:s.isFile(e.mode)?r.size=e.usedBytes:s.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){for(let t of["mode","atime","mtime","ctime"])r[t]&&(e[t]=r[t]);r.size!==void 0&&P.resizeFileStorage(e,r.size)},lookup(e,r){throw P.doesNotExistError},mknod(e,r,t,n){return P.createNode(e,r,t,n)},rename(e,r,t){var n;try{n=s.lookupNode(r,t)}catch{}if(n){if(s.isDir(e.mode))for(var o in n.contents)throw new s.ErrnoError(55);s.hashRemoveNode(n)}delete e.parent.contents[e.name],r.contents[t]=e,e.name=t,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.contents[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var t=s.lookupNode(e,r);for(var n in t.contents)throw new s.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,r,t){var n=P.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!s.isLink(e.mode))throw new s.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var u=e.node.contents;if(o>=e.node.usedBytes)return 0;var c=Math.min(e.node.usedBytes-o,n);if(c>8&&u.subarray)r.set(u.subarray(o,o+c),t);else for(var f=0;f<c;f++)r[t+f]=u[o+f];return c},write(e,r,t,n,o,u){if(r.buffer===K.buffer&&(u=!1),!n)return 0;var c=e.node;if(c.mtime=c.ctime=Date.now(),r.subarray&&(!c.contents||c.contents.subarray)){if(u)return c.contents=r.subarray(t,t+n),c.usedBytes=n,n;if(c.usedBytes===0&&o===0)return c.contents=r.slice(t,t+n),c.usedBytes=n,n;if(o+n<=c.usedBytes)return c.contents.set(r.subarray(t,t+n),o),n}if(P.expandFileStorage(c,o+n),c.contents.subarray&&r.subarray)c.contents.set(r.subarray(t,t+n),o);else for(var f=0;f<n;f++)c.contents[o+f]=r[t+f];return c.usedBytes=Math.max(c.usedBytes,o+n),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&s.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new s.ErrnoError(28);return n},allocate(e,r,t){P.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap(e,r,t,n,o){if(!s.isFile(e.node.mode))throw new s.ErrnoError(43);var u,c,f=e.node.contents;if(!(o&2)&&f&&f.buffer===K.buffer)c=!1,u=f.byteOffset;else{if(c=!0,u=nt(r),!u)throw new s.ErrnoError(48);f&&((t>0||t+r<f.length)&&(f.subarray?f=f.subarray(t,t+r):f=Array.prototype.slice.call(f,t,t+r)),K.set(f,u))}return{ptr:u,allocated:c}},msync(e,r,t,n,o){return P.stream_ops.write(e,r,0,n,t,!1),0}}},jn=async e=>{var r=await Q(e);return new Uint8Array(r)},Hn=(e,r,t,n,o,u)=>{s.createDataFile(e,r,t,n,o,u)},Rn=l.preloadPlugins||[],Vn=(e,r,t,n)=>{typeof Browser<"u"&&Browser.init();var o=!1;return Rn.forEach(u=>{o||u.canHandle(r)&&(u.handle(e,r,t,n),o=!0)}),o},Wn=(e,r,t,n,o,u,c,f,m,p)=>{var v=r?_e.resolve(H.join2(e,r)):e,_=`cp ${v}`;function w(E){function C(F){p?.(),f||Hn(e,r,F,n,o,m),u?.(),ir(_)}Vn(E,v,C,()=>{c?.(),ir(_)})||C(E)}Yr(_),typeof t=="string"?jn(t).then(w,c):w(t)},Un=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);ret