@nutrient-sdk/document-authoring 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/cli.js +15 -15
- package/lib/docauth.mjs +1 -1
- package/lib/docauth.umd.js +1 -1
- package/lib/docauth.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ the SDK via `npm`).
|
|
|
78
78
|
|
|
79
79
|
### Example
|
|
80
80
|
|
|
81
|
-
You can download an example project demoing both TypeScript and JavaScript integration from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.8.
|
|
81
|
+
You can download an example project demoing both TypeScript and JavaScript integration from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.8.2-example.zip), unzip it and run:
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
84
|
npm install
|
|
@@ -92,7 +92,7 @@ By default, the Document Authoring SDK will fetch the required files (fonts, emo
|
|
|
92
92
|
|
|
93
93
|
### Self-hosting the assets
|
|
94
94
|
|
|
95
|
-
To host the assets on your own infrastructure you can download them from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.8.
|
|
95
|
+
To host the assets on your own infrastructure you can download them from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.8.2-assets.zip) and deploy them to a suitable location.
|
|
96
96
|
Provide an appropriate base path when initializing the Document Authoring SDK.
|
|
97
97
|
|
|
98
98
|
#### Example:
|
package/lib/cli.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
2
|
+
"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(`
|
|
3
3
|
`).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(`
|
|
4
4
|
`)}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
|
|
5
5
|
`,`
|
|
6
6
|
`),S=" ".repeat(l),I="\\s\u200B",B=new RegExp(`
|
|
7
7
|
|.{1,${k-1}}([${I}]|$)|[^${I}]+?([${I}]|$)`,"g"),W=$.match(B)||[];return b+W.map((Q,fe)=>Q===`
|
|
8
8
|
`?"":(fe>0?S:"")+Q.trimEnd()).join(`
|
|
9
|
-
`)}};
|
|
9
|
+
`)}};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?`
|
|
10
10
|
(Did you mean one of ${l.join(", ")}?)`:l.length===1?`
|
|
11
|
-
(Did you mean ${l[0]}?)`:""}
|
|
12
|
-
- 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
|
|
13
|
-
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
|
|
14
|
-
- 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
|
|
11
|
+
(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
|
|
12
|
+
- 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}'.
|
|
13
|
+
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}'
|
|
14
|
+
- 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
|
|
15
15
|
- if '${i._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
16
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
-
- ${T}`;throw new Error(I)}else if(S.code==="EACCES")throw new Error(`'${y}' not executable`);if(!$)L.exit(1);else{let T=new
|
|
17
|
+
- ${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}
|
|
18
18
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
19
19
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
20
|
-
`),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
|
|
21
|
-
`),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=>
|
|
20
|
+
`),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}
|
|
21
|
+
`),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.
|
|
22
22
|
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}
|
|
23
|
-
`)}),this}_outputHelpIfRequested(i){let a=this._getHelpOption();a&&i.find(d=>a.is(d))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function
|
|
24
|
-
`)),!e)return null;or=et(e,!0)}return or.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 Tn()},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=[])}}},xn=(e,r)=>{Y.fill(0,e,e+r)},rt=(e,r)=>Math.ceil(e/r)*r,tt=e=>{e=rt(e,65536);var r=Dt(65536,e);return r&&xn(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=tt(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}}},Dn=async e=>{var r=await Q(e);return new Uint8Array(r)},Mn=(e,r,t,n,o,u)=>{s.createDataFile(e,r,t,n,o,u)},jn=l.preloadPlugins||[],Hn=(e,r,t,n)=>{typeof Browser<"u"&&Browser.init();var o=!1;return jn.forEach(u=>{o||u.canHandle(r)&&(u.handle(e,r,t,n),o=!0)}),o},Rn=(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||Mn(e,r,F,n,o,m),u?.(),nr(_)}Hn(E,v,C,()=>{c?.(),nr(_)})||C(E)}Jr(_),typeof t=="string"?Dn(t).then(w,c):w(t)},Vn=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}`);return t},ar=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},s={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{name="ErrnoError";constructor(e){this.errno=e}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.id=s.nextInode++,this.name=r,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return s.isDir(this.mode)}get isDevice(){return s.isChrdev(this.mode)}},lookupPath(e,r={}){if(!e)return{path:"",node:null};r.follow_mount??=!0,H.isAbs(e)||(e=s.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var n=e.split("/").filter(p=>!!p&&p!=="."),o=s.root,u="/",c=0;c<n.length;c++){var f=c===n.length-1;if(f&&r.parent)break;if(n[c]===".."){u=H.dirname(u),o=o.parent;continue}u=H.join2(u,n[c]);try{o=s.lookupNode(o,n[c])}catch(p){if(p?.errno===44&&f&&r.noent_okay)return{path:u};throw p}if(s.isMountpoint(o)&&(!f||r.follow_mount)&&(o=o.mounted.root),s.isLink(o.mode)&&(!f||r.follow)){if(!o.node_ops.readlink)throw new s.ErrnoError(52);var m=o.node_ops.readlink(o);H.isAbs(m)||(m=H.dirname(u)+"/"+m),e=m+"/"+n.slice(c+1).join("/");continue e}}return{path:u,node:o}}throw new s.ErrnoError(32)},getPath(e){for(var r;;){if(s.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%s.nameTable.length},hashAddNode(e){var r=s.hashName(e.parent.id,e.name);e.name_next=s.nameTable[r],s.nameTable[r]=e},hashRemoveNode(e){var r=s.hashName(e.parent.id,e.name);if(s.nameTable[r]===e)s.nameTable[r]=e.name_next;else for(var t=s.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=s.mayLookup(e);if(t)throw new s.ErrnoError(t);for(var n=s.hashName(e.id,r),o=s.nameTable[n];o;o=o.name_next){var u=o.name;if(o.parent.id===e.id&&u===r)return o}return s.lookup(e,r)},createNode(e,r,t,n){var o=new s.FSNode(e,r,t,n);return s.hashAddNode(o),o},destroyNode(e){s.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return s.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!s.isDir(e.mode))return 54;var r=s.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!s.isDir(e.mode))return 54;try{var t=s.lookupNode(e,r);return 20}catch{}return s.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=s.lookupNode(e,r)}catch(u){return u.errno}var o=s.nodePermissions(e,"wx");if(o)return o;if(t){if(!s.isDir(n.mode))return 54;if(s.isRoot(n)||s.getPath(n)===s.cwd())return 10}else if(s.isDir(n.mode))return 31;return 0},mayOpen(e,r){return e?s.isLink(e.mode)?32:s.isDir(e.mode)&&(s.flagsToPermissionString(r)!=="r"||r&512)?31:s.nodePermissions(e,s.flagsToPermissionString(r)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=s.MAX_OPEN_FDS;e++)if(!s.streams[e])return e;throw new s.ErrnoError(33)},getStreamChecked(e){var r=s.getStream(e);if(!r)throw new s.ErrnoError(8);return r},getStream:e=>s.streams[e],createStream(e,r=-1){return e=Object.assign(new s.FSStream,e),r==-1&&(r=s.nextfd()),e.fd=r,s.streams[r]=e,e},closeStream(e){s.streams[e]=null},dupStream(e,r=-1){var t=s.createStream(e,r);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(e){var r=s.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new s.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){s.devices[e]={stream_ops:r}},getDevice:e=>s.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),s.syncFSRequests++,s.syncFSRequests>1&&ue(`warning: ${s.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=s.getMounts(s.root.mount),n=0;function o(c){return s.syncFSRequests--,r(c)}function u(c){if(c)return u.errored?void 0:(u.errored=!0,o(c));++n>=t.length&&o(null)}t.forEach(c=>{if(!c.type.syncfs)return u(null);c.type.syncfs(c,e,u)})},mount(e,r,t){var n=t==="/",o=!t,u;if(n&&s.root)throw new s.ErrnoError(10);if(!n&&!o){var c=s.lookupPath(t,{follow_mount:!1});if(t=c.path,u=c.node,s.isMountpoint(u))throw new s.ErrnoError(10);if(!s.isDir(u.mode))throw new s.ErrnoError(54)}var f={type:e,opts:r,mountpoint:t,mounts:[]},m=e.mount(f);return m.mount=f,f.root=m,n?s.root=m:u&&(u.mounted=f,u.mount&&u.mount.mounts.push(f)),m},unmount(e){var r=s.lookupPath(e,{follow_mount:!1});if(!s.isMountpoint(r.node))throw new s.ErrnoError(28);var t=r.node,n=t.mounted,o=s.getMounts(n);Object.keys(s.nameTable).forEach(c=>{for(var f=s.nameTable[c];f;){var m=f.name_next;o.includes(f.mount)&&s.destroyNode(f),f=m}}),t.mounted=null;var u=t.mount.mounts.indexOf(n);t.mount.mounts.splice(u,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var n=s.lookupPath(e,{parent:!0}),o=n.node,u=H.basename(e);if(!u||u==="."||u==="..")throw new s.ErrnoError(28);var c=s.mayCreate(o,u);if(c)throw new s.ErrnoError(c);if(!o.node_ops.mknod)throw new s.ErrnoError(63);return o.node_ops.mknod(o,u,r,t)},statfs(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:s.nextInode,ffree:s.nextInode-1,fsid:42,flags:2,namelen:255},t=s.lookupPath(e,{follow:!0}).node;return t?.node_ops.statfs&&Object.assign(r,t.node_ops.statfs(t.mount.opts.root)),r},create(e,r=438){return r&=4095,r|=32768,s.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,s.mknod(e,r,0)},mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{s.mkdir(n,r)}catch(u){if(u.errno!=20)throw u}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,s.mknod(e,r,t)},symlink(e,r){if(!_e.resolve(e))throw new s.ErrnoError(44);var t=s.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new s.ErrnoError(44);var o=H.basename(r),u=s.mayCreate(n,o);if(u)throw new s.ErrnoError(u);if(!n.node_ops.symlink)throw new s.ErrnoError(63);return n.node_ops.symlink(n,o,e)},rename(e,r){var t=H.dirname(e),n=H.dirname(r),o=H.basename(e),u=H.basename(r),c,f,m;if(c=s.lookupPath(e,{parent:!0}),f=c.node,c=s.lookupPath(r,{parent:!0}),m=c.node,!f||!m)throw new s.ErrnoError(44);if(f.mount!==m.mount)throw new s.ErrnoError(75);var p=s.lookupNode(f,o),v=_e.relative(e,n);if(v.charAt(0)!==".")throw new s.ErrnoError(28);if(v=_e.relative(r,t),v.charAt(0)!==".")throw new s.ErrnoError(55);var _;try{_=s.lookupNode(m,u)}catch{}if(p!==_){var w=s.isDir(p.mode),E=s.mayDelete(f,o,w);if(E)throw new s.ErrnoError(E);if(E=_?s.mayDelete(m,u,w):s.mayCreate(m,u),E)throw new s.ErrnoError(E);if(!f.node_ops.rename)throw new s.ErrnoError(63);if(s.isMountpoint(p)||_&&s.isMountpoint(_))throw new s.ErrnoError(10);if(m!==f&&(E=s.nodePermissions(f,"w"),E))throw new s.ErrnoError(E);s.hashRemoveNode(p);try{f.node_ops.rename(p,m,u),p.parent=m}catch(C){throw C}finally{s.hashAddNode(p)}}},rmdir(e){var r=s.lookupPath(e,{parent:!0}),t=r.node,n=H.basename(e),o=s.lookupNode(t,n),u=s.mayDelete(t,n,!0);if(u)throw new s.ErrnoError(u);if(!t.node_ops.rmdir)throw new s.ErrnoError(63);if(s.isMountpoint(o))throw new s.ErrnoError(10);t.node_ops.rmdir(t,n),s.destroyNode(o)},readdir(e){var r=s.lookupPath(e,{follow:!0}),t=r.node;if(!t.node_ops.readdir)throw new s.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var r=s.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new s.ErrnoError(44);var n=H.basename(e),o=s.lookupNode(t,n),u=s.mayDelete(t,n,!1);if(u)throw new s.ErrnoError(u);if(!t.node_ops.unlink)throw new s.ErrnoError(63);if(s.isMountpoint(o))throw new s.ErrnoError(10);t.node_ops.unlink(t,n),s.destroyNode(o)},readlink(e){var r=s.lookupPath(e),t=r.node;if(!t)throw new s.ErrnoError(44);if(!t.node_ops.readlink)throw new s.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,r){var t=s.lookupPath(e,{follow:!r}),n=t.node;if(!n)throw new s.ErrnoError(44);if(!n.node_ops.getattr)throw new s.ErrnoError(63);return n.node_ops.getattr(n)},lstat(e){return s.stat(e,!0)},chmod(e,r,t){var n;if(typeof e=="string"){var o=s.lookupPath(e,{follow:!t});n=o.node}else n=e;if(!n.node_ops.setattr)throw new s.ErrnoError(63);n.node_ops.setattr(n,{mode:r&4095|n.mode&-4096,ctime:Date.now()})},lchmod(e,r){s.chmod(e,r,!0)},fchmod(e,r){var t=s.getStreamChecked(e);s.chmod(t.node,r)},chown(e,r,t,n){var o;if(typeof e=="string"){var u=s.lookupPath(e,{follow:!n});o=u.node}else o=e;if(!o.node_ops.setattr)throw new s.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){s.chown(e,r,t,!0)},fchown(e,r,t){var n=s.getStreamChecked(e);s.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new s.ErrnoError(28);var t;if(typeof e=="string"){var n=s.lookupPath(e,{follow:!0});t=n.node}else t=e;if(!t.node_ops.setattr)throw new s.ErrnoError(63);if(s.isDir(t.mode))throw new s.ErrnoError(31);if(!s.isFile(t.mode))throw new s.ErrnoError(28);var o=s.nodePermissions(t,"w");if(o)throw new s.ErrnoError(o);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=s.getStreamChecked(e);if(!(t.flags&2097155))throw new s.ErrnoError(28);s.truncate(t.node,r)},utime(e,r,t){var n=s.lookupPath(e,{follow:!0}),o=n.node;o.node_ops.setattr(o,{atime:r,mtime:t})},open(e,r,t=438){if(e==="")throw new s.ErrnoError(44);r=typeof r=="string"?Vn(r):r,r&64?t=t&4095|32768:t=0;var n;if(typeof e=="object")n=e;else{var o=s.lookupPath(e,{follow:!(r&131072),noent_okay:!0});n=o.node,e=o.path}var u=!1;if(r&64)if(n){if(r&128)throw new s.ErrnoError(20)}else n=s.mknod(e,t,0),u=!0;if(!n)throw new s.ErrnoError(44);if(s.isChrdev(n.mode)&&(r&=-513),r&65536&&!s.isDir(n.mode))throw new s.ErrnoError(54);if(!u){var c=s.mayOpen(n,r);if(c)throw new s.ErrnoError(c)}r&512&&!u&&s.truncate(n,0),r&=-131713;var f=s.createStream({node:n,path:s.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return f.stream_ops.open&&f.stream_ops.open(f),l.logReadFiles&&!(r&1)&&(e in s.readFiles||(s.readFiles[e]=1)),f},close(e){if(s.isClosed(e))throw new s.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{s.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(s.isClosed(e))throw new s.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new s.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new s.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new s.ErrnoError(28);if(s.isClosed(e))throw new s.ErrnoError(8);if((e.flags&2097155)===1)throw new s.ErrnoError(8);if(s.isDir(e.node.mode))throw new s.ErrnoError(31);if(!e.stream_ops.read)throw new s.ErrnoError(28);var u=typeof o<"u";if(!u)o=e.position;else if(!e.seekable)throw new s.ErrnoError(70);var c=e.stream_ops.read(e,r,t,n,o);return u||(e.position+=c),c},write(e,r,t,n,o,u){if(n<0||o<0)throw new s.ErrnoError(28);if(s.isClosed(e))throw new s.ErrnoError(8);if(!(e.flags&2097155))throw new s.ErrnoError(8);if(s.isDir(e.node.mode))throw new s.ErrnoError(31);if(!e.stream_ops.write)throw new s.ErrnoError(28);e.seekable&&e.flags&1024&&s.llseek(e,0,2);var c=typeof o<"u";if(!c)o=e.position;else if(!e.seekable)throw new s.ErrnoError(70);var f=e.stream_ops.write(e,r,t,n,o,u);return c||(e.position+=f),f},allocate(e,r,t){if(s.isClosed(e))throw new s.ErrnoError(8);if(r<0||t<=0)throw new s.ErrnoError(28);if(!(e.flags&2097155))throw new s.ErrnoError(8);if(!s.isFile(e.node.mode)&&!s.isDir(e.node.mode))throw new s.ErrnoError(43);if(!e.stream_ops.allocate)throw new s.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap(e,r,t,n,o){if(n&2&&!(o&2)&&(e.flags&2097155)!==2)throw new s.ErrnoError(2);if((e.flags&2097155)===1)throw new s.ErrnoError(2);if(!e.stream_ops.mmap)throw new s.ErrnoError(43);if(!r)throw new s.ErrnoError(28);return e.stream_ops.mmap(e,r,t,n,o)},msync(e,r,t,n,o){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new s.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=s.open(e,r.flags),o=s.stat(e),u=o.size,c=new Uint8Array(u);return s.read(n,c,0,u,0),r.encoding==="utf8"?t=ye(c):r.encoding==="binary"&&(t=c),s.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=s.open(e,t.flags,t.mode);if(typeof r=="string"){var o=new Uint8Array(We(r)+1),u=sr(r,o,0,o.length);s.write(n,o,0,u,void 0,t.canOwn)}else if(ArrayBuffer.isView(r))s.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");s.close(n)},cwd:()=>s.currentPath,chdir(e){var r=s.lookupPath(e,{follow:!0});if(r.node===null)throw new s.ErrnoError(44);if(!s.isDir(r.node.mode))throw new s.ErrnoError(54);var t=s.nodePermissions(r.node,"x");if(t)throw new s.ErrnoError(t);s.currentPath=r.path},createDefaultDirectories(){s.mkdir("/tmp"),s.mkdir("/home"),s.mkdir("/home/web_user")},createDefaultDevices(){s.mkdir("/dev"),s.registerDevice(s.makedev(1,3),{read:()=>0,write:(n,o,u,c,f)=>c,llseek:()=>0}),s.mkdev("/dev/null",s.makedev(1,3)),ce.register(s.makedev(5,0),ce.default_tty_ops),ce.register(s.makedev(6,0),ce.default_tty1_ops),s.mkdev("/dev/tty",s.makedev(5,0)),s.mkdev("/dev/tty1",s.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(r=Qr(e).byteLength),e[--r]);s.createDevice("/dev","random",t),s.createDevice("/dev","urandom",t),s.mkdir("/dev/shm"),s.mkdir("/dev/shm/tmp")},createSpecialDirectories(){s.mkdir("/proc");var e=s.mkdir("/proc/self");s.mkdir("/proc/self/fd"),s.mount({mount(){var r=s.createNode(e,"fd",16895,73);return r.stream_ops={llseek:P.stream_ops.llseek},r.node_ops={lookup(t,n){var o=+n,u=s.getStreamChecked(o),c={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>u.path},id:o+1};return c.parent=c,c},readdir(){return Array.from(s.streams.entries()).filter(([t,n])=>n).map(([t,n])=>t.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?s.createDevice("/dev","stdin",e):s.symlink("/dev/tty","/dev/stdin"),r?s.createDevice("/dev","stdout",null,r):s.symlink("/dev/tty","/dev/stdout"),t?s.createDevice("/dev","stderr",null,t):s.symlink("/dev/tty1","/dev/stderr");var n=s.open("/dev/stdin",0),o=s.open("/dev/stdout",1),u=s.open("/dev/stderr",1)},staticInit(){s.nameTable=new Array(4096),s.mount(P,{},"/"),s.createDefaultDirectories(),s.createDefaultDevices(),s.createSpecialDirectories(),s.filesystems={MEMFS:P}},init(e,r,t){s.initialized=!0,e??=l.stdin,r??=l.stdout,t??=l.stderr,s.createStandardStreams(e,r,t)},quit(){s.initialized=!1;for(var e=0;e<s.streams.length;e++){var r=s.streams[e];r&&s.close(r)}},findObject(e,r){var t=s.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=s.lookupPath(e,{follow:!r});e=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=s.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=H.basename(e),t=s.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(o){n.error=o.errno}return n},createPath(e,r,t,n){e=typeof e=="string"?e:s.getPath(e);for(var o=r.split("/").reverse();o.length;){var u=o.pop();if(u){var c=H.join2(e,u);try{s.mkdir(c)}catch{}e=c}}return c},createFile(e,r,t,n,o){var u=H.join2(typeof e=="string"?e:s.getPath(e),r),c=ar(n,o);return s.create(u,c)},createDataFile(e,r,t,n,o,u){var c=r;e&&(e=typeof e=="string"?e:s.getPath(e),c=r?H.join2(e,r):e);var f=ar(n,o),m=s.create(c,f);if(t){if(typeof t=="string"){for(var p=new Array(t.length),v=0,_=t.length;v<_;++v)p[v]=t.charCodeAt(v);t=p}s.chmod(m,f|146);var w=s.open(m,577);s.write(w,t,0,t.length,0,u),s.close(w),s.chmod(m,f)}},createDevice(e,r,t,n){var o=H.join2(typeof e=="string"?e:s.getPath(e),r),u=ar(!!t,!!n);s.createDevice.major??=64;var c=s.makedev(s.createDevice.major++,0);return s.registerDevice(c,{open(f){f.seekable=!1},close(f){n?.buffer?.length&&n(10)},read(f,m,p,v,_){for(var w=0,E=0;E<v;E++){var C;try{C=t()}catch{throw new s.ErrnoError(29)}if(C===void 0&&w===0)throw new s.ErrnoError(6);if(C==null)break;w++,m[p+E]=C}return w&&(f.node.atime=Date.now()),w},write(f,m,p,v,_){for(var w=0;w<v;w++)try{n(m[p+w])}catch{throw new s.ErrnoError(29)}return v&&(f.node.mtime=f.node.ctime=Date.now()),w}}),s.mkdev(o,u,c)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=fe(e.url),e.usedBytes=e.contents.length}catch{throw new s.ErrnoError(29)}},createLazyFile(e,r,t,n,o){class u{lengthKnown=!1;chunks=[];get(E){if(!(E>this.length-1||E<0)){var C=E%this.chunkSize,F=E/this.chunkSize|0;return this.getter(F)[C]}}setDataGetter(E){this.getter=E}cacheLength(){var E=new XMLHttpRequest;if(E.open("HEAD",t,!1),E.send(null),!(E.status>=200&&E.status<300||E.status===304))throw new Error("Couldn't load "+t+". Status: "+E.status);var C=Number(E.getResponseHeader("Content-length")),F,N=(F=E.getResponseHeader("Accept-Ranges"))&&F==="bytes",M=(F=E.getResponseHeader("Content-Encoding"))&&F==="gzip",z=1024*1024;N||(z=C);var V=(X,ae)=>{if(X>ae)throw new Error("invalid range ("+X+", "+ae+") or no bytes requested!");if(ae>C-1)throw new Error("only "+C+" bytes available! programmer error!");var q=new XMLHttpRequest;if(q.open("GET",t,!1),C!==z&&q.setRequestHeader("Range","bytes="+X+"-"+ae),q.responseType="arraybuffer",q.overrideMimeType&&q.overrideMimeType("text/plain; charset=x-user-defined"),q.send(null),!(q.status>=200&&q.status<300||q.status===304))throw new Error("Couldn't load "+t+". Status: "+q.status);return q.response!==void 0?new Uint8Array(q.response||[]):et(q.responseText||"",!0)},ve=this;ve.setDataGetter(X=>{var ae=X*z,q=(X+1)*z-1;if(q=Math.min(q,C-1),typeof ve.chunks[X]>"u"&&(ve.chunks[X]=V(ae,q)),typeof ve.chunks[X]>"u")throw new Error("doXHR failed!");return ve.chunks[X]}),(M||!C)&&(z=C=1,C=this.getter(0).length,z=C,tr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=C,this._chunkSize=z,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!b)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var c=new u,f={isDevice:!1,contents:c}}else var f={isDevice:!1,url:t};var m=s.createFile(e,r,f,n,o);f.contents?m.contents=f.contents:f.url&&(m.contents=null,m.url=f.url),Object.defineProperties(m,{usedBytes:{get:function(){return this.contents.length}}});var p={},v=Object.keys(m.stream_ops);v.forEach(w=>{var E=m.stream_ops[w];p[w]=(...C)=>(s.forceLoadFile(m),E(...C))});function _(w,E,C,F,N){var M=w.node.contents;if(N>=M.length)return 0;var z=Math.min(M.length-N,F);if(M.slice)for(var V=0;V<z;V++)E[C+V]=M[N+V];else for(var V=0;V<z;V++)E[C+V]=M.get(N+V);return z}return p.read=(w,E,C,F,N)=>(s.forceLoadFile(m),_(w,E,C,F,N)),p.mmap=(w,E,C,F,N)=>{s.forceLoadFile(m);var M=tt(E);if(!M)throw new s.ErrnoError(48);return _(w,K,M,E,C),{ptr:M,allocated:!0}},m.stream_ops=p,m}},nt=(e,r)=>e?ye(Y,e,r):"",x={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(H.isAbs(r))return r;var n;if(e===-100)n=s.cwd();else{var o=x.getStreamFromFD(e);n=o.path}if(r.length==0){if(!t)throw new s.ErrnoError(44);return n}return n+"/"+r},doStat(e,r,t){var n=e(r);A[t>>2]=n.dev,A[t+4>>2]=n.mode,j[t+8>>2]=n.nlink,A[t+12>>2]=n.uid,A[t+16>>2]=n.gid,A[t+20>>2]=n.rdev,U=[n.size>>>0,(O=n.size,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+24>>2]=U[0],A[t+28>>2]=U[1],A[t+32>>2]=4096,A[t+36>>2]=n.blocks;var o=n.atime.getTime(),u=n.mtime.getTime(),c=n.ctime.getTime();return U=[Math.floor(o/1e3)>>>0,(O=Math.floor(o/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+40>>2]=U[0],A[t+44>>2]=U[1],j[t+48>>2]=o%1e3*1e3*1e3,U=[Math.floor(u/1e3)>>>0,(O=Math.floor(u/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+56>>2]=U[0],A[t+60>>2]=U[1],j[t+64>>2]=u%1e3*1e3*1e3,U=[Math.floor(c/1e3)>>>0,(O=Math.floor(c/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+72>>2]=U[0],A[t+76>>2]=U[1],j[t+80>>2]=c%1e3*1e3*1e3,U=[n.ino>>>0,(O=n.ino,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+88>>2]=U[0],A[t+92>>2]=U[1],0},doMsync(e,r,t,n,o){if(!s.isFile(r.node.mode))throw new s.ErrnoError(43);if(n&2)return 0;var u=Y.slice(e,e+t);s.msync(r,u,o,t,n)},getStreamFromFD(e){var r=s.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=nt(e);return r}};function Wn(e,r,t,n){try{if(r=x.getStr(r),r=x.calculateAt(e,r),t&-8)return-28;var o=s.lookupPath(r,{follow:!0}),u=o.node;if(!u)return-44;var c="";return t&4&&(c+="r"),t&2&&(c+="w"),t&1&&(c+="x"),c&&s.nodePermissions(u,c)?-2:0}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}var Ue=()=>{var e=A[+x.varargs>>2];return x.varargs+=4,e},we=Ue;function Un(e,r,t){x.varargs=t;try{var n=x.getStreamFromFD(e);switch(r){case 0:{var o=Ue();if(o<0)return-28;for(;s.streams[o];)o++;var u;return u=s.dupStream(n,o),u.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var o=Ue();return n.flags|=o,0}case 12:{var o=we(),c=0;return ne[o+c>>1]=2,0}case 13:case 14:return 0}return-28}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function In(e,r){try{var t=x.getStreamFromFD(e);return x.doStat(s.stat,t.path,r)}catch(n){if(typeof s>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var he=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN;function Nn(e,r,t){var n=he(r,t);try{return isNaN(n)?61:(s.ftruncate(e,n),0)}catch(o){if(typeof s>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var lr=(e,r,t)=>sr(e,Y,r,t);function Bn(e,r,t){try{var n=x.getStreamFromFD(e);n.getdents||=s.readdir(n.path);for(var o=280,u=0,c=s.llseek(n,0,1),f=Math.floor(c/o),m=Math.min(n.getdents.length,f+Math.floor(t/o)),p=f;p<m;p++){var v,_,w=n.getdents[p];if(w===".")v=n.node.id,_=4;else if(w===".."){var E=s.lookupPath(n.path,{parent:!0});v=E.node.id,_=4}else{var C;try{C=s.lookupNode(n.node,w)}catch(F){if(F?.errno===28)continue;throw F}v=C.id,_=s.isChrdev(C.mode)?2:s.isDir(C.mode)?4:s.isLink(C.mode)?10:8}U=[v>>>0,(O=v,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[r+u>>2]=U[0],A[r+u+4>>2]=U[1],U=[(p+1)*o>>>0,(O=(p+1)*o,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[r+u+8>>2]=U[0],A[r+u+12>>2]=U[1],ne[r+u+16>>1]=280,K[r+u+18]=_,lr(w,r+u+19,256),u+=o}return s.llseek(n,p*o,0),u}catch(F){if(typeof s>"u"||F.name!=="ErrnoError")throw F;return-F.errno}}function Ln(e,r,t){x.varargs=t;try{var n=x.getStreamFromFD(e);switch(r){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),u=we();A[u>>2]=o.c_iflag||0,A[u+4>>2]=o.c_oflag||0,A[u+8>>2]=o.c_cflag||0,A[u+12>>2]=o.c_lflag||0;for(var c=0;c<32;c++)K[u+c+17]=o.c_cc[c]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var u=we(),f=A[u>>2],m=A[u+4>>2],p=A[u+8>>2],v=A[u+12>>2],_=[],c=0;c<32;c++)_.push(K[u+c+17]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:f,c_oflag:m,c_cflag:p,c_lflag:v,c_cc:_})}return 0}case 21519:{if(!n.tty)return-59;var u=we();return A[u>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var u=we();return s.ioctl(n,r,u)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var w=n.tty.ops.ioctl_tiocgwinsz(n.tty),u=we();ne[u>>1]=w[0],ne[u+2>>1]=w[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(E){if(typeof s>"u"||E.name!=="ErrnoError")throw E;return-E.errno}}function qn(e,r){try{return e=x.getStr(e),x.doStat(s.lstat,e,r)}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function zn(e,r,t,n){try{r=x.getStr(r);var o=n&256,u=n&4096;return n=n&-6401,r=x.calculateAt(e,r,u),x.doStat(o?s.lstat:s.stat,r,t)}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function Gn(e,r,t,n){x.varargs=n;try{r=x.getStr(r),r=x.calculateAt(e,r);var o=n?Ue():0;return s.open(r,t,o).fd}catch(u){if(typeof s>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Jn(e,r,t,n){try{return r=x.getStr(r),n=x.getStr(n),r=x.calculateAt(e,r),n=x.calculateAt(t,n),s.rename(r,n),0}catch(o){if(typeof s>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Yn(e){try{return e=x.getStr(e),s.rmdir(e),0}catch(r){if(typeof s>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function Kn(e,r){try{return e=x.getStr(e),x.doStat(s.stat,e,r)}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function Xn(e,r,t){try{return r=x.getStr(r),r=x.calculateAt(e,r),t===0?s.unlink(r):t===512?s.rmdir(r):Re("Invalid flags passed to unlinkat"),0}catch(n){if(typeof s>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var Qn=()=>Re(""),Ie={},Ne=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function ke(e){return this.fromWireType(j[e>>2])}var Ee={},me={},Be={},it,Le=e=>{throw new it(e)},Z=(e,r,t)=>{e.forEach(f=>Be[f]=r);function n(f){var m=t(f);m.length!==e.length&&Le("Mismatched type converter count");for(var p=0;p<e.length;++p)te(e[p],m[p])}var o=new Array(r.length),u=[],c=0;r.forEach((f,m)=>{me.hasOwnProperty(f)?o[m]=me[f]:(u.push(f),Ee.hasOwnProperty(f)||(Ee[f]=[]),Ee[f].push(()=>{o[m]=me[f],++c,c===u.length&&n(o)}))}),u.length===0&&n(o)},Zn=e=>{var r=Ie[e];delete Ie[e];var t=r.rawConstructor,n=r.rawDestructor,o=r.fields,u=o.map(c=>c.getterReturnType).concat(o.map(c=>c.setterArgumentType));Z([e],u,c=>{var f={};return o.forEach((m,p)=>{var v=m.fieldName,_=c[p],w=m.getter,E=m.getterContext,C=c[p+o.length],F=m.setter,N=m.setterContext;f[v]={read:M=>_.fromWireType(w(E,M)),write:(M,z)=>{var V=[];F(N,M,C.toWireType(V,z)),Ne(V)}}}),[{name:r.name,fromWireType:m=>{var p={};for(var v in f)p[v]=f[v].read(m);return n(m),p},toWireType:(m,p)=>{for(var v in f)if(!(v in p))throw new TypeError(`Missing field: "${v}"`);var _=t();for(v in f)f[v].write(_,p[v]);return m!==null&&m.push(n,_),_},argPackAdvance:ie,readValueFromPointer:ke,destructorFunction:n}]})},ei=(e,r,t,n,o)=>{},ri=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);ot=e},ot,G=e=>{for(var r="",t=e;Y[t];)r+=ot[Y[t++]];return r},be,D=e=>{throw new be(e)};function ti(e,r,t={}){var n=r.name;if(e||D(`type "${n}" must have a positive integer typeid pointer`),me.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;D(`Cannot register type '${n}' twice`)}if(me[e]=r,delete Be[e],Ee.hasOwnProperty(e)){var o=Ee[e];delete Ee[e],o.forEach(u=>u())}}function te(e,r,t={}){return ti(e,r,t)}var ie=8,ni=(e,r,t,n)=>{r=G(r),te(e,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,u){return u?t:n},argPackAdvance:ie,readValueFromPointer:function(o){return this.fromWireType(Y[o])},destructorFunction:null})},ii=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),ur=e=>{function r(t){return t.$$.ptrType.registeredClass.name}D(r(e)+" instance already deleted")},cr=!1,st=e=>{},oi=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},at=e=>{e.count.value-=1;var r=e.count.value===0;r&&oi(e)},lt=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=lt(e,r,t.baseClass);return n===null?null:t.downcast(n)},ut={},si={},ai=(e,r)=>{for(r===void 0&&D("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},li=(e,r)=>(r=ai(e,r),si[r]),qe=(e,r)=>{(!r.ptrType||!r.ptr)&&Le("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Le("Both smartPtrType and smartPtr must be specified"),r.count={value:1},$e(Object.create(e,{$$:{value:r,writable:!0}}))};function ui(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=li(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?qe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):qe(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),c=ut[u];if(!c)return o.call(this);var f;this.isConst?f=c.constPointerType:f=c.pointerType;var m=lt(r,this.registeredClass,f.registeredClass);return m===null?o.call(this):this.isSmartPointer?qe(f.registeredClass.instancePrototype,{ptrType:f,ptr:m,smartPtrType:this,smartPtr:e}):qe(f.registeredClass.instancePrototype,{ptrType:f,ptr:m})}var $e=e=>typeof FinalizationRegistry>"u"?($e=r=>r,e):(cr=new FinalizationRegistry(r=>{at(r.$$)}),$e=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var o={$$:t};cr.register(r,o,r)}return r},st=r=>cr.unregister(r),$e(e)),ze=[],ci=()=>{for(;ze.length;){var e=ze.pop();e.$$.deleteScheduled=!1,e.delete()}},ct,fi=()=>{Object.assign(Ge.prototype,{isAliasOf(e){if(!(this instanceof Ge)||!(e instanceof Ge))return!1;var r=this.$$.ptrType.registeredClass,t=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,o=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return r===n&&t===o},clone(){if(this.$$.ptr||ur(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=$e(Object.create(Object.getPrototypeOf(this),{$$:{value:ii(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||ur(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&D("Object already scheduled for deletion"),st(this),at(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ur(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&D("Object already scheduled for deletion"),ze.push(this),ze.length===1&&ct&&ct(ci),this.$$.deleteScheduled=!0,this}})};function Ge(){}var Oe=(e,r)=>Object.defineProperty(r,"name",{value:e}),fr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...o){return e[r].overloadTable.hasOwnProperty(o.length)||D(`Function '${t}' called with an invalid number of arguments (${o.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[o.length].apply(this,o)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},ft=(e,r,t)=>{l.hasOwnProperty(e)?((t===void 0||l[e].overloadTable!==void 0&&l[e].overloadTable[t]!==void 0)&&D(`Cannot register public name '${e}' twice`),fr(l,e,e),l[e].overloadTable.hasOwnProperty(t)&&D(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),l[e].overloadTable[t]=r):(l[e]=r,l[e].argCount=t)},di=48,hi=57,mi=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=di&&r<=hi?`_${e}`:e};function pi(e,r,t,n,o,u,c,f){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=o,this.getActualType=u,this.upcast=c,this.downcast=f,this.pureVirtualFunctions=[]}var Je=(e,r,t)=>{for(;r!==t;)r.upcast||D(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function vi(e,r){if(r===null)return this.isReference&&D(`null is not a valid ${this.name}`),0;r.$$||D(`Cannot pass "${pr(r)}" as a ${this.name}`),r.$$.ptr||D(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Je(r.$$.ptr,t,this.registeredClass);return n}function gi(e,r){var t;if(r===null)return this.isReference&&D(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&D(`Cannot pass "${pr(r)}" as a ${this.name}`),r.$$.ptr||D(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&D(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=Je(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&D("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:D(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var o=r.clone();t=this.rawShare(t,ee.toHandle(()=>o.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:D("Unsupporting sharing policy")}return t}function _i(e,r){if(r===null)return this.isReference&&D(`null is not a valid ${this.name}`),0;r.$$||D(`Cannot pass "${pr(r)}" as a ${this.name}`),r.$$.ptr||D(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&D(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Je(r.$$.ptr,t,this.registeredClass);return n}var yi=()=>{Object.assign(Se.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:ie,readValueFromPointer:ke,fromWireType:ui})};function Se(e,r,t,n,o,u,c,f,m,p,v){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=o,this.pointeeType=u,this.sharingPolicy=c,this.rawGetPointee=f,this.rawConstructor=m,this.rawShare=p,this.rawDestructor=v,!o&&r.baseClass===void 0?n?(this.toWireType=vi,this.destructorFunction=null):(this.toWireType=_i,this.destructorFunction=null):this.toWireType=gi}var dt=(e,r,t)=>{l.hasOwnProperty(e)||Le("Replacing nonexistent public symbol"),l[e].overloadTable!==void 0&&t!==void 0?l[e].overloadTable[t]=r:(l[e]=r,l[e].argCount=t)},wi=(e,r,t)=>{e=e.replace(/p/g,"i");var n=l["dynCall_"+e];return n(r,...t)},Ye=[],ht,mt=e=>{var r=Ye[e];return r||(e>=Ye.length&&(Ye.length=e+1),Ye[e]=r=ht.get(e)),r},Ei=(e,r,t=[])=>{if(e.includes("j"))return wi(e,r,t);var n=mt(r)(...t);return n},bi=(e,r)=>(...t)=>Ei(e,r,t),J=(e,r)=>{e=G(e);function t(){return e.includes("j")?bi(e,r):mt(r)}var n=t();return typeof n!="function"&&D(`unknown function pointer with signature ${e}: ${r}`),n},Ci=(e,r)=>{var t=Oe(r,function(n){this.name=r,this.message=n;var o=new Error(n).stack;o!==void 0&&(this.stack=this.toString()+`
|
|
25
|
-
`+o.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t},
|
|
23
|
+
`)}),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+=`
|
|
24
|
+
`)),!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}`);return t},lr=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},s={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{name="ErrnoError";constructor(e){this.errno=e}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.id=s.nextInode++,this.name=r,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return s.isDir(this.mode)}get isDevice(){return s.isChrdev(this.mode)}},lookupPath(e,r={}){if(!e)return{path:"",node:null};r.follow_mount??=!0,H.isAbs(e)||(e=s.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var n=e.split("/").filter(p=>!!p&&p!=="."),o=s.root,u="/",c=0;c<n.length;c++){var f=c===n.length-1;if(f&&r.parent)break;if(n[c]===".."){u=H.dirname(u),o=o.parent;continue}u=H.join2(u,n[c]);try{o=s.lookupNode(o,n[c])}catch(p){if(p?.errno===44&&f&&r.noent_okay)return{path:u};throw p}if(s.isMountpoint(o)&&(!f||r.follow_mount)&&(o=o.mounted.root),s.isLink(o.mode)&&(!f||r.follow)){if(!o.node_ops.readlink)throw new s.ErrnoError(52);var m=o.node_ops.readlink(o);H.isAbs(m)||(m=H.dirname(u)+"/"+m),e=m+"/"+n.slice(c+1).join("/");continue e}}return{path:u,node:o}}throw new s.ErrnoError(32)},getPath(e){for(var r;;){if(s.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%s.nameTable.length},hashAddNode(e){var r=s.hashName(e.parent.id,e.name);e.name_next=s.nameTable[r],s.nameTable[r]=e},hashRemoveNode(e){var r=s.hashName(e.parent.id,e.name);if(s.nameTable[r]===e)s.nameTable[r]=e.name_next;else for(var t=s.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=s.mayLookup(e);if(t)throw new s.ErrnoError(t);for(var n=s.hashName(e.id,r),o=s.nameTable[n];o;o=o.name_next){var u=o.name;if(o.parent.id===e.id&&u===r)return o}return s.lookup(e,r)},createNode(e,r,t,n){var o=new s.FSNode(e,r,t,n);return s.hashAddNode(o),o},destroyNode(e){s.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return s.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!s.isDir(e.mode))return 54;var r=s.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!s.isDir(e.mode))return 54;try{var t=s.lookupNode(e,r);return 20}catch{}return s.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=s.lookupNode(e,r)}catch(u){return u.errno}var o=s.nodePermissions(e,"wx");if(o)return o;if(t){if(!s.isDir(n.mode))return 54;if(s.isRoot(n)||s.getPath(n)===s.cwd())return 10}else if(s.isDir(n.mode))return 31;return 0},mayOpen(e,r){return e?s.isLink(e.mode)?32:s.isDir(e.mode)&&(s.flagsToPermissionString(r)!=="r"||r&512)?31:s.nodePermissions(e,s.flagsToPermissionString(r)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=s.MAX_OPEN_FDS;e++)if(!s.streams[e])return e;throw new s.ErrnoError(33)},getStreamChecked(e){var r=s.getStream(e);if(!r)throw new s.ErrnoError(8);return r},getStream:e=>s.streams[e],createStream(e,r=-1){return e=Object.assign(new s.FSStream,e),r==-1&&(r=s.nextfd()),e.fd=r,s.streams[r]=e,e},closeStream(e){s.streams[e]=null},dupStream(e,r=-1){var t=s.createStream(e,r);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(e){var r=s.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new s.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){s.devices[e]={stream_ops:r}},getDevice:e=>s.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),s.syncFSRequests++,s.syncFSRequests>1&&ue(`warning: ${s.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=s.getMounts(s.root.mount),n=0;function o(c){return s.syncFSRequests--,r(c)}function u(c){if(c)return u.errored?void 0:(u.errored=!0,o(c));++n>=t.length&&o(null)}t.forEach(c=>{if(!c.type.syncfs)return u(null);c.type.syncfs(c,e,u)})},mount(e,r,t){var n=t==="/",o=!t,u;if(n&&s.root)throw new s.ErrnoError(10);if(!n&&!o){var c=s.lookupPath(t,{follow_mount:!1});if(t=c.path,u=c.node,s.isMountpoint(u))throw new s.ErrnoError(10);if(!s.isDir(u.mode))throw new s.ErrnoError(54)}var f={type:e,opts:r,mountpoint:t,mounts:[]},m=e.mount(f);return m.mount=f,f.root=m,n?s.root=m:u&&(u.mounted=f,u.mount&&u.mount.mounts.push(f)),m},unmount(e){var r=s.lookupPath(e,{follow_mount:!1});if(!s.isMountpoint(r.node))throw new s.ErrnoError(28);var t=r.node,n=t.mounted,o=s.getMounts(n);Object.keys(s.nameTable).forEach(c=>{for(var f=s.nameTable[c];f;){var m=f.name_next;o.includes(f.mount)&&s.destroyNode(f),f=m}}),t.mounted=null;var u=t.mount.mounts.indexOf(n);t.mount.mounts.splice(u,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var n=s.lookupPath(e,{parent:!0}),o=n.node,u=H.basename(e);if(!u||u==="."||u==="..")throw new s.ErrnoError(28);var c=s.mayCreate(o,u);if(c)throw new s.ErrnoError(c);if(!o.node_ops.mknod)throw new s.ErrnoError(63);return o.node_ops.mknod(o,u,r,t)},statfs(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:s.nextInode,ffree:s.nextInode-1,fsid:42,flags:2,namelen:255},t=s.lookupPath(e,{follow:!0}).node;return t?.node_ops.statfs&&Object.assign(r,t.node_ops.statfs(t.mount.opts.root)),r},create(e,r=438){return r&=4095,r|=32768,s.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,s.mknod(e,r,0)},mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{s.mkdir(n,r)}catch(u){if(u.errno!=20)throw u}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,s.mknod(e,r,t)},symlink(e,r){if(!_e.resolve(e))throw new s.ErrnoError(44);var t=s.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new s.ErrnoError(44);var o=H.basename(r),u=s.mayCreate(n,o);if(u)throw new s.ErrnoError(u);if(!n.node_ops.symlink)throw new s.ErrnoError(63);return n.node_ops.symlink(n,o,e)},rename(e,r){var t=H.dirname(e),n=H.dirname(r),o=H.basename(e),u=H.basename(r),c,f,m;if(c=s.lookupPath(e,{parent:!0}),f=c.node,c=s.lookupPath(r,{parent:!0}),m=c.node,!f||!m)throw new s.ErrnoError(44);if(f.mount!==m.mount)throw new s.ErrnoError(75);var p=s.lookupNode(f,o),v=_e.relative(e,n);if(v.charAt(0)!==".")throw new s.ErrnoError(28);if(v=_e.relative(r,t),v.charAt(0)!==".")throw new s.ErrnoError(55);var _;try{_=s.lookupNode(m,u)}catch{}if(p!==_){var w=s.isDir(p.mode),E=s.mayDelete(f,o,w);if(E)throw new s.ErrnoError(E);if(E=_?s.mayDelete(m,u,w):s.mayCreate(m,u),E)throw new s.ErrnoError(E);if(!f.node_ops.rename)throw new s.ErrnoError(63);if(s.isMountpoint(p)||_&&s.isMountpoint(_))throw new s.ErrnoError(10);if(m!==f&&(E=s.nodePermissions(f,"w"),E))throw new s.ErrnoError(E);s.hashRemoveNode(p);try{f.node_ops.rename(p,m,u),p.parent=m}catch(C){throw C}finally{s.hashAddNode(p)}}},rmdir(e){var r=s.lookupPath(e,{parent:!0}),t=r.node,n=H.basename(e),o=s.lookupNode(t,n),u=s.mayDelete(t,n,!0);if(u)throw new s.ErrnoError(u);if(!t.node_ops.rmdir)throw new s.ErrnoError(63);if(s.isMountpoint(o))throw new s.ErrnoError(10);t.node_ops.rmdir(t,n),s.destroyNode(o)},readdir(e){var r=s.lookupPath(e,{follow:!0}),t=r.node;if(!t.node_ops.readdir)throw new s.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var r=s.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new s.ErrnoError(44);var n=H.basename(e),o=s.lookupNode(t,n),u=s.mayDelete(t,n,!1);if(u)throw new s.ErrnoError(u);if(!t.node_ops.unlink)throw new s.ErrnoError(63);if(s.isMountpoint(o))throw new s.ErrnoError(10);t.node_ops.unlink(t,n),s.destroyNode(o)},readlink(e){var r=s.lookupPath(e),t=r.node;if(!t)throw new s.ErrnoError(44);if(!t.node_ops.readlink)throw new s.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,r){var t=s.lookupPath(e,{follow:!r}),n=t.node;if(!n)throw new s.ErrnoError(44);if(!n.node_ops.getattr)throw new s.ErrnoError(63);return n.node_ops.getattr(n)},lstat(e){return s.stat(e,!0)},chmod(e,r,t){var n;if(typeof e=="string"){var o=s.lookupPath(e,{follow:!t});n=o.node}else n=e;if(!n.node_ops.setattr)throw new s.ErrnoError(63);n.node_ops.setattr(n,{mode:r&4095|n.mode&-4096,ctime:Date.now()})},lchmod(e,r){s.chmod(e,r,!0)},fchmod(e,r){var t=s.getStreamChecked(e);s.chmod(t.node,r)},chown(e,r,t,n){var o;if(typeof e=="string"){var u=s.lookupPath(e,{follow:!n});o=u.node}else o=e;if(!o.node_ops.setattr)throw new s.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){s.chown(e,r,t,!0)},fchown(e,r,t){var n=s.getStreamChecked(e);s.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new s.ErrnoError(28);var t;if(typeof e=="string"){var n=s.lookupPath(e,{follow:!0});t=n.node}else t=e;if(!t.node_ops.setattr)throw new s.ErrnoError(63);if(s.isDir(t.mode))throw new s.ErrnoError(31);if(!s.isFile(t.mode))throw new s.ErrnoError(28);var o=s.nodePermissions(t,"w");if(o)throw new s.ErrnoError(o);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=s.getStreamChecked(e);if(!(t.flags&2097155))throw new s.ErrnoError(28);s.truncate(t.node,r)},utime(e,r,t){var n=s.lookupPath(e,{follow:!0}),o=n.node;o.node_ops.setattr(o,{atime:r,mtime:t})},open(e,r,t=438){if(e==="")throw new s.ErrnoError(44);r=typeof r=="string"?Un(r):r,r&64?t=t&4095|32768:t=0;var n;if(typeof e=="object")n=e;else{var o=s.lookupPath(e,{follow:!(r&131072),noent_okay:!0});n=o.node,e=o.path}var u=!1;if(r&64)if(n){if(r&128)throw new s.ErrnoError(20)}else n=s.mknod(e,t,0),u=!0;if(!n)throw new s.ErrnoError(44);if(s.isChrdev(n.mode)&&(r&=-513),r&65536&&!s.isDir(n.mode))throw new s.ErrnoError(54);if(!u){var c=s.mayOpen(n,r);if(c)throw new s.ErrnoError(c)}r&512&&!u&&s.truncate(n,0),r&=-131713;var f=s.createStream({node:n,path:s.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return f.stream_ops.open&&f.stream_ops.open(f),l.logReadFiles&&!(r&1)&&(e in s.readFiles||(s.readFiles[e]=1)),f},close(e){if(s.isClosed(e))throw new s.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{s.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(s.isClosed(e))throw new s.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new s.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new s.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new s.ErrnoError(28);if(s.isClosed(e))throw new s.ErrnoError(8);if((e.flags&2097155)===1)throw new s.ErrnoError(8);if(s.isDir(e.node.mode))throw new s.ErrnoError(31);if(!e.stream_ops.read)throw new s.ErrnoError(28);var u=typeof o<"u";if(!u)o=e.position;else if(!e.seekable)throw new s.ErrnoError(70);var c=e.stream_ops.read(e,r,t,n,o);return u||(e.position+=c),c},write(e,r,t,n,o,u){if(n<0||o<0)throw new s.ErrnoError(28);if(s.isClosed(e))throw new s.ErrnoError(8);if(!(e.flags&2097155))throw new s.ErrnoError(8);if(s.isDir(e.node.mode))throw new s.ErrnoError(31);if(!e.stream_ops.write)throw new s.ErrnoError(28);e.seekable&&e.flags&1024&&s.llseek(e,0,2);var c=typeof o<"u";if(!c)o=e.position;else if(!e.seekable)throw new s.ErrnoError(70);var f=e.stream_ops.write(e,r,t,n,o,u);return c||(e.position+=f),f},allocate(e,r,t){if(s.isClosed(e))throw new s.ErrnoError(8);if(r<0||t<=0)throw new s.ErrnoError(28);if(!(e.flags&2097155))throw new s.ErrnoError(8);if(!s.isFile(e.node.mode)&&!s.isDir(e.node.mode))throw new s.ErrnoError(43);if(!e.stream_ops.allocate)throw new s.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap(e,r,t,n,o){if(n&2&&!(o&2)&&(e.flags&2097155)!==2)throw new s.ErrnoError(2);if((e.flags&2097155)===1)throw new s.ErrnoError(2);if(!e.stream_ops.mmap)throw new s.ErrnoError(43);if(!r)throw new s.ErrnoError(28);return e.stream_ops.mmap(e,r,t,n,o)},msync(e,r,t,n,o){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new s.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=s.open(e,r.flags),o=s.stat(e),u=o.size,c=new Uint8Array(u);return s.read(n,c,0,u,0),r.encoding==="utf8"?t=ye(c):r.encoding==="binary"&&(t=c),s.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=s.open(e,t.flags,t.mode);if(typeof r=="string"){var o=new Uint8Array(We(r)+1),u=ar(r,o,0,o.length);s.write(n,o,0,u,void 0,t.canOwn)}else if(ArrayBuffer.isView(r))s.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");s.close(n)},cwd:()=>s.currentPath,chdir(e){var r=s.lookupPath(e,{follow:!0});if(r.node===null)throw new s.ErrnoError(44);if(!s.isDir(r.node.mode))throw new s.ErrnoError(54);var t=s.nodePermissions(r.node,"x");if(t)throw new s.ErrnoError(t);s.currentPath=r.path},createDefaultDirectories(){s.mkdir("/tmp"),s.mkdir("/home"),s.mkdir("/home/web_user")},createDefaultDevices(){s.mkdir("/dev"),s.registerDevice(s.makedev(1,3),{read:()=>0,write:(n,o,u,c,f)=>c,llseek:()=>0}),s.mkdev("/dev/null",s.makedev(1,3)),ce.register(s.makedev(5,0),ce.default_tty_ops),ce.register(s.makedev(6,0),ce.default_tty1_ops),s.mkdev("/dev/tty",s.makedev(5,0)),s.mkdev("/dev/tty1",s.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(r=Zr(e).byteLength),e[--r]);s.createDevice("/dev","random",t),s.createDevice("/dev","urandom",t),s.mkdir("/dev/shm"),s.mkdir("/dev/shm/tmp")},createSpecialDirectories(){s.mkdir("/proc");var e=s.mkdir("/proc/self");s.mkdir("/proc/self/fd"),s.mount({mount(){var r=s.createNode(e,"fd",16895,73);return r.stream_ops={llseek:P.stream_ops.llseek},r.node_ops={lookup(t,n){var o=+n,u=s.getStreamChecked(o),c={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>u.path},id:o+1};return c.parent=c,c},readdir(){return Array.from(s.streams.entries()).filter(([t,n])=>n).map(([t,n])=>t.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?s.createDevice("/dev","stdin",e):s.symlink("/dev/tty","/dev/stdin"),r?s.createDevice("/dev","stdout",null,r):s.symlink("/dev/tty","/dev/stdout"),t?s.createDevice("/dev","stderr",null,t):s.symlink("/dev/tty1","/dev/stderr");var n=s.open("/dev/stdin",0),o=s.open("/dev/stdout",1),u=s.open("/dev/stderr",1)},staticInit(){s.nameTable=new Array(4096),s.mount(P,{},"/"),s.createDefaultDirectories(),s.createDefaultDevices(),s.createSpecialDirectories(),s.filesystems={MEMFS:P}},init(e,r,t){s.initialized=!0,e??=l.stdin,r??=l.stdout,t??=l.stderr,s.createStandardStreams(e,r,t)},quit(){s.initialized=!1;for(var e=0;e<s.streams.length;e++){var r=s.streams[e];r&&s.close(r)}},findObject(e,r){var t=s.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=s.lookupPath(e,{follow:!r});e=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=s.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=H.basename(e),t=s.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(o){n.error=o.errno}return n},createPath(e,r,t,n){e=typeof e=="string"?e:s.getPath(e);for(var o=r.split("/").reverse();o.length;){var u=o.pop();if(u){var c=H.join2(e,u);try{s.mkdir(c)}catch{}e=c}}return c},createFile(e,r,t,n,o){var u=H.join2(typeof e=="string"?e:s.getPath(e),r),c=lr(n,o);return s.create(u,c)},createDataFile(e,r,t,n,o,u){var c=r;e&&(e=typeof e=="string"?e:s.getPath(e),c=r?H.join2(e,r):e);var f=lr(n,o),m=s.create(c,f);if(t){if(typeof t=="string"){for(var p=new Array(t.length),v=0,_=t.length;v<_;++v)p[v]=t.charCodeAt(v);t=p}s.chmod(m,f|146);var w=s.open(m,577);s.write(w,t,0,t.length,0,u),s.close(w),s.chmod(m,f)}},createDevice(e,r,t,n){var o=H.join2(typeof e=="string"?e:s.getPath(e),r),u=lr(!!t,!!n);s.createDevice.major??=64;var c=s.makedev(s.createDevice.major++,0);return s.registerDevice(c,{open(f){f.seekable=!1},close(f){n?.buffer?.length&&n(10)},read(f,m,p,v,_){for(var w=0,E=0;E<v;E++){var C;try{C=t()}catch{throw new s.ErrnoError(29)}if(C===void 0&&w===0)throw new s.ErrnoError(6);if(C==null)break;w++,m[p+E]=C}return w&&(f.node.atime=Date.now()),w},write(f,m,p,v,_){for(var w=0;w<v;w++)try{n(m[p+w])}catch{throw new s.ErrnoError(29)}return v&&(f.node.mtime=f.node.ctime=Date.now()),w}}),s.mkdev(o,u,c)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=fe(e.url),e.usedBytes=e.contents.length}catch{throw new s.ErrnoError(29)}},createLazyFile(e,r,t,n,o){class u{lengthKnown=!1;chunks=[];get(E){if(!(E>this.length-1||E<0)){var C=E%this.chunkSize,F=E/this.chunkSize|0;return this.getter(F)[C]}}setDataGetter(E){this.getter=E}cacheLength(){var E=new XMLHttpRequest;if(E.open("HEAD",t,!1),E.send(null),!(E.status>=200&&E.status<300||E.status===304))throw new Error("Couldn't load "+t+". Status: "+E.status);var C=Number(E.getResponseHeader("Content-length")),F,N=(F=E.getResponseHeader("Accept-Ranges"))&&F==="bytes",M=(F=E.getResponseHeader("Content-Encoding"))&&F==="gzip",z=1024*1024;N||(z=C);var V=(X,ae)=>{if(X>ae)throw new Error("invalid range ("+X+", "+ae+") or no bytes requested!");if(ae>C-1)throw new Error("only "+C+" bytes available! programmer error!");var q=new XMLHttpRequest;if(q.open("GET",t,!1),C!==z&&q.setRequestHeader("Range","bytes="+X+"-"+ae),q.responseType="arraybuffer",q.overrideMimeType&&q.overrideMimeType("text/plain; charset=x-user-defined"),q.send(null),!(q.status>=200&&q.status<300||q.status===304))throw new Error("Couldn't load "+t+". Status: "+q.status);return q.response!==void 0?new Uint8Array(q.response||[]):rt(q.responseText||"",!0)},ve=this;ve.setDataGetter(X=>{var ae=X*z,q=(X+1)*z-1;if(q=Math.min(q,C-1),typeof ve.chunks[X]>"u"&&(ve.chunks[X]=V(ae,q)),typeof ve.chunks[X]>"u")throw new Error("doXHR failed!");return ve.chunks[X]}),(M||!C)&&(z=C=1,C=this.getter(0).length,z=C,tr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=C,this._chunkSize=z,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!b)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var c=new u,f={isDevice:!1,contents:c}}else var f={isDevice:!1,url:t};var m=s.createFile(e,r,f,n,o);f.contents?m.contents=f.contents:f.url&&(m.contents=null,m.url=f.url),Object.defineProperties(m,{usedBytes:{get:function(){return this.contents.length}}});var p={},v=Object.keys(m.stream_ops);v.forEach(w=>{var E=m.stream_ops[w];p[w]=(...C)=>(s.forceLoadFile(m),E(...C))});function _(w,E,C,F,N){var M=w.node.contents;if(N>=M.length)return 0;var z=Math.min(M.length-N,F);if(M.slice)for(var V=0;V<z;V++)E[C+V]=M[N+V];else for(var V=0;V<z;V++)E[C+V]=M.get(N+V);return z}return p.read=(w,E,C,F,N)=>(s.forceLoadFile(m),_(w,E,C,F,N)),p.mmap=(w,E,C,F,N)=>{s.forceLoadFile(m);var M=nt(E);if(!M)throw new s.ErrnoError(48);return _(w,K,M,E,C),{ptr:M,allocated:!0}},m.stream_ops=p,m}},it=(e,r)=>e?ye(Y,e,r):"",x={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(H.isAbs(r))return r;var n;if(e===-100)n=s.cwd();else{var o=x.getStreamFromFD(e);n=o.path}if(r.length==0){if(!t)throw new s.ErrnoError(44);return n}return n+"/"+r},doStat(e,r,t){var n=e(r);A[t>>2]=n.dev,A[t+4>>2]=n.mode,j[t+8>>2]=n.nlink,A[t+12>>2]=n.uid,A[t+16>>2]=n.gid,A[t+20>>2]=n.rdev,U=[n.size>>>0,(O=n.size,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+24>>2]=U[0],A[t+28>>2]=U[1],A[t+32>>2]=4096,A[t+36>>2]=n.blocks;var o=n.atime.getTime(),u=n.mtime.getTime(),c=n.ctime.getTime();return U=[Math.floor(o/1e3)>>>0,(O=Math.floor(o/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+40>>2]=U[0],A[t+44>>2]=U[1],j[t+48>>2]=o%1e3*1e3*1e3,U=[Math.floor(u/1e3)>>>0,(O=Math.floor(u/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+56>>2]=U[0],A[t+60>>2]=U[1],j[t+64>>2]=u%1e3*1e3*1e3,U=[Math.floor(c/1e3)>>>0,(O=Math.floor(c/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+72>>2]=U[0],A[t+76>>2]=U[1],j[t+80>>2]=c%1e3*1e3*1e3,U=[n.ino>>>0,(O=n.ino,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+88>>2]=U[0],A[t+92>>2]=U[1],0},doMsync(e,r,t,n,o){if(!s.isFile(r.node.mode))throw new s.ErrnoError(43);if(n&2)return 0;var u=Y.slice(e,e+t);s.msync(r,u,o,t,n)},getStreamFromFD(e){var r=s.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=it(e);return r}};function In(e,r,t,n){try{if(r=x.getStr(r),r=x.calculateAt(e,r),t&-8)return-28;var o=s.lookupPath(r,{follow:!0}),u=o.node;if(!u)return-44;var c="";return t&4&&(c+="r"),t&2&&(c+="w"),t&1&&(c+="x"),c&&s.nodePermissions(u,c)?-2:0}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}var Ue=()=>{var e=A[+x.varargs>>2];return x.varargs+=4,e},we=Ue;function Nn(e,r,t){x.varargs=t;try{var n=x.getStreamFromFD(e);switch(r){case 0:{var o=Ue();if(o<0)return-28;for(;s.streams[o];)o++;var u;return u=s.dupStream(n,o),u.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var o=Ue();return n.flags|=o,0}case 12:{var o=we(),c=0;return ne[o+c>>1]=2,0}case 13:case 14:return 0}return-28}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function Bn(e,r){try{var t=x.getStreamFromFD(e);return x.doStat(s.stat,t.path,r)}catch(n){if(typeof s>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var he=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN;function Ln(e,r,t){var n=he(r,t);try{return isNaN(n)?61:(s.ftruncate(e,n),0)}catch(o){if(typeof s>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var ur=(e,r,t)=>ar(e,Y,r,t);function qn(e,r,t){try{var n=x.getStreamFromFD(e);n.getdents||=s.readdir(n.path);for(var o=280,u=0,c=s.llseek(n,0,1),f=Math.floor(c/o),m=Math.min(n.getdents.length,f+Math.floor(t/o)),p=f;p<m;p++){var v,_,w=n.getdents[p];if(w===".")v=n.node.id,_=4;else if(w===".."){var E=s.lookupPath(n.path,{parent:!0});v=E.node.id,_=4}else{var C;try{C=s.lookupNode(n.node,w)}catch(F){if(F?.errno===28)continue;throw F}v=C.id,_=s.isChrdev(C.mode)?2:s.isDir(C.mode)?4:s.isLink(C.mode)?10:8}U=[v>>>0,(O=v,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[r+u>>2]=U[0],A[r+u+4>>2]=U[1],U=[(p+1)*o>>>0,(O=(p+1)*o,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[r+u+8>>2]=U[0],A[r+u+12>>2]=U[1],ne[r+u+16>>1]=280,K[r+u+18]=_,ur(w,r+u+19,256),u+=o}return s.llseek(n,p*o,0),u}catch(F){if(typeof s>"u"||F.name!=="ErrnoError")throw F;return-F.errno}}function zn(e,r,t){x.varargs=t;try{var n=x.getStreamFromFD(e);switch(r){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),u=we();A[u>>2]=o.c_iflag||0,A[u+4>>2]=o.c_oflag||0,A[u+8>>2]=o.c_cflag||0,A[u+12>>2]=o.c_lflag||0;for(var c=0;c<32;c++)K[u+c+17]=o.c_cc[c]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var u=we(),f=A[u>>2],m=A[u+4>>2],p=A[u+8>>2],v=A[u+12>>2],_=[],c=0;c<32;c++)_.push(K[u+c+17]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:f,c_oflag:m,c_cflag:p,c_lflag:v,c_cc:_})}return 0}case 21519:{if(!n.tty)return-59;var u=we();return A[u>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var u=we();return s.ioctl(n,r,u)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var w=n.tty.ops.ioctl_tiocgwinsz(n.tty),u=we();ne[u>>1]=w[0],ne[u+2>>1]=w[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(E){if(typeof s>"u"||E.name!=="ErrnoError")throw E;return-E.errno}}function Gn(e,r){try{return e=x.getStr(e),x.doStat(s.lstat,e,r)}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function Jn(e,r,t,n){try{r=x.getStr(r);var o=n&256,u=n&4096;return n=n&-6401,r=x.calculateAt(e,r,u),x.doStat(o?s.lstat:s.stat,r,t)}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function Yn(e,r,t,n){x.varargs=n;try{r=x.getStr(r),r=x.calculateAt(e,r);var o=n?Ue():0;return s.open(r,t,o).fd}catch(u){if(typeof s>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Kn(e,r,t,n){try{return r=x.getStr(r),n=x.getStr(n),r=x.calculateAt(e,r),n=x.calculateAt(t,n),s.rename(r,n),0}catch(o){if(typeof s>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Xn(e){try{return e=x.getStr(e),s.rmdir(e),0}catch(r){if(typeof s>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function Qn(e,r){try{return e=x.getStr(e),x.doStat(s.stat,e,r)}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function Zn(e,r,t){try{return r=x.getStr(r),r=x.calculateAt(e,r),t===0?s.unlink(r):t===512?s.rmdir(r):Re("Invalid flags passed to unlinkat"),0}catch(n){if(typeof s>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var ei=()=>Re(""),Ie={},Ne=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function ke(e){return this.fromWireType(j[e>>2])}var Ee={},me={},Be={},ot,Le=e=>{throw new ot(e)},Z=(e,r,t)=>{e.forEach(f=>Be[f]=r);function n(f){var m=t(f);m.length!==e.length&&Le("Mismatched type converter count");for(var p=0;p<e.length;++p)te(e[p],m[p])}var o=new Array(r.length),u=[],c=0;r.forEach((f,m)=>{me.hasOwnProperty(f)?o[m]=me[f]:(u.push(f),Ee.hasOwnProperty(f)||(Ee[f]=[]),Ee[f].push(()=>{o[m]=me[f],++c,c===u.length&&n(o)}))}),u.length===0&&n(o)},ri=e=>{var r=Ie[e];delete Ie[e];var t=r.rawConstructor,n=r.rawDestructor,o=r.fields,u=o.map(c=>c.getterReturnType).concat(o.map(c=>c.setterArgumentType));Z([e],u,c=>{var f={};return o.forEach((m,p)=>{var v=m.fieldName,_=c[p],w=m.getter,E=m.getterContext,C=c[p+o.length],F=m.setter,N=m.setterContext;f[v]={read:M=>_.fromWireType(w(E,M)),write:(M,z)=>{var V=[];F(N,M,C.toWireType(V,z)),Ne(V)}}}),[{name:r.name,fromWireType:m=>{var p={};for(var v in f)p[v]=f[v].read(m);return n(m),p},toWireType:(m,p)=>{for(var v in f)if(!(v in p))throw new TypeError(`Missing field: "${v}"`);var _=t();for(v in f)f[v].write(_,p[v]);return m!==null&&m.push(n,_),_},argPackAdvance:ie,readValueFromPointer:ke,destructorFunction:n}]})},ti=(e,r,t,n,o)=>{},ni=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);st=e},st,G=e=>{for(var r="",t=e;Y[t];)r+=st[Y[t++]];return r},be,D=e=>{throw new be(e)};function ii(e,r,t={}){var n=r.name;if(e||D(`type "${n}" must have a positive integer typeid pointer`),me.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;D(`Cannot register type '${n}' twice`)}if(me[e]=r,delete Be[e],Ee.hasOwnProperty(e)){var o=Ee[e];delete Ee[e],o.forEach(u=>u())}}function te(e,r,t={}){return ii(e,r,t)}var ie=8,oi=(e,r,t,n)=>{r=G(r),te(e,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,u){return u?t:n},argPackAdvance:ie,readValueFromPointer:function(o){return this.fromWireType(Y[o])},destructorFunction:null})},si=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),cr=e=>{function r(t){return t.$$.ptrType.registeredClass.name}D(r(e)+" instance already deleted")},fr=!1,at=e=>{},ai=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},lt=e=>{e.count.value-=1;var r=e.count.value===0;r&&ai(e)},ut=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=ut(e,r,t.baseClass);return n===null?null:t.downcast(n)},ct={},li={},ui=(e,r)=>{for(r===void 0&&D("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},ci=(e,r)=>(r=ui(e,r),li[r]),qe=(e,r)=>{(!r.ptrType||!r.ptr)&&Le("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Le("Both smartPtrType and smartPtr must be specified"),r.count={value:1},$e(Object.create(e,{$$:{value:r,writable:!0}}))};function fi(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=ci(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?qe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):qe(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),c=ct[u];if(!c)return o.call(this);var f;this.isConst?f=c.constPointerType:f=c.pointerType;var m=ut(r,this.registeredClass,f.registeredClass);return m===null?o.call(this):this.isSmartPointer?qe(f.registeredClass.instancePrototype,{ptrType:f,ptr:m,smartPtrType:this,smartPtr:e}):qe(f.registeredClass.instancePrototype,{ptrType:f,ptr:m})}var $e=e=>typeof FinalizationRegistry>"u"?($e=r=>r,e):(fr=new FinalizationRegistry(r=>{lt(r.$$)}),$e=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var o={$$:t};fr.register(r,o,r)}return r},at=r=>fr.unregister(r),$e(e)),ze=[],di=()=>{for(;ze.length;){var e=ze.pop();e.$$.deleteScheduled=!1,e.delete()}},ft,hi=()=>{Object.assign(Ge.prototype,{isAliasOf(e){if(!(this instanceof Ge)||!(e instanceof Ge))return!1;var r=this.$$.ptrType.registeredClass,t=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,o=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return r===n&&t===o},clone(){if(this.$$.ptr||cr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=$e(Object.create(Object.getPrototypeOf(this),{$$:{value:si(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||cr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&D("Object already scheduled for deletion"),at(this),lt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||cr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&D("Object already scheduled for deletion"),ze.push(this),ze.length===1&&ft&&ft(di),this.$$.deleteScheduled=!0,this}})};function Ge(){}var Oe=(e,r)=>Object.defineProperty(r,"name",{value:e}),dr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...o){return e[r].overloadTable.hasOwnProperty(o.length)||D(`Function '${t}' called with an invalid number of arguments (${o.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[o.length].apply(this,o)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},dt=(e,r,t)=>{l.hasOwnProperty(e)?((t===void 0||l[e].overloadTable!==void 0&&l[e].overloadTable[t]!==void 0)&&D(`Cannot register public name '${e}' twice`),dr(l,e,e),l[e].overloadTable.hasOwnProperty(t)&&D(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),l[e].overloadTable[t]=r):(l[e]=r,l[e].argCount=t)},mi=48,pi=57,vi=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=mi&&r<=pi?`_${e}`:e};function gi(e,r,t,n,o,u,c,f){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=o,this.getActualType=u,this.upcast=c,this.downcast=f,this.pureVirtualFunctions=[]}var Je=(e,r,t)=>{for(;r!==t;)r.upcast||D(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function _i(e,r){if(r===null)return this.isReference&&D(`null is not a valid ${this.name}`),0;r.$$||D(`Cannot pass "${vr(r)}" as a ${this.name}`),r.$$.ptr||D(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Je(r.$$.ptr,t,this.registeredClass);return n}function yi(e,r){var t;if(r===null)return this.isReference&&D(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&D(`Cannot pass "${vr(r)}" as a ${this.name}`),r.$$.ptr||D(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&D(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=Je(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&D("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:D(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var o=r.clone();t=this.rawShare(t,ee.toHandle(()=>o.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:D("Unsupporting sharing policy")}return t}function wi(e,r){if(r===null)return this.isReference&&D(`null is not a valid ${this.name}`),0;r.$$||D(`Cannot pass "${vr(r)}" as a ${this.name}`),r.$$.ptr||D(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&D(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Je(r.$$.ptr,t,this.registeredClass);return n}var Ei=()=>{Object.assign(Se.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:ie,readValueFromPointer:ke,fromWireType:fi})};function Se(e,r,t,n,o,u,c,f,m,p,v){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=o,this.pointeeType=u,this.sharingPolicy=c,this.rawGetPointee=f,this.rawConstructor=m,this.rawShare=p,this.rawDestructor=v,!o&&r.baseClass===void 0?n?(this.toWireType=_i,this.destructorFunction=null):(this.toWireType=wi,this.destructorFunction=null):this.toWireType=yi}var ht=(e,r,t)=>{l.hasOwnProperty(e)||Le("Replacing nonexistent public symbol"),l[e].overloadTable!==void 0&&t!==void 0?l[e].overloadTable[t]=r:(l[e]=r,l[e].argCount=t)},bi=(e,r,t)=>{e=e.replace(/p/g,"i");var n=l["dynCall_"+e];return n(r,...t)},Ye=[],mt,pt=e=>{var r=Ye[e];return r||(e>=Ye.length&&(Ye.length=e+1),Ye[e]=r=mt.get(e)),r},Ci=(e,r,t=[])=>{if(e.includes("j"))return bi(e,r,t);var n=pt(r)(...t);return n},Ai=(e,r)=>(...t)=>Ci(e,r,t),J=(e,r)=>{e=G(e);function t(){return e.includes("j")?Ai(e,r):pt(r)}var n=t();return typeof n!="function"&&D(`unknown function pointer with signature ${e}: ${r}`),n},ki=(e,r)=>{var t=Oe(r,function(n){this.name=r,this.message=n;var o=new Error(n).stack;o!==void 0&&(this.stack=this.toString()+`
|
|
25
|
+
`+o.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t},vt,gt=e=>{var r=xt(e),t=G(r);return se(r),t},pe=(e,r)=>{var t=[],n={};function o(u){if(!n[u]&&!me[u]){if(Be[u]){Be[u].forEach(o);return}t.push(u),n[u]=!0}}throw r.forEach(o),new vt(`${e}: `+t.map(gt).join([", "]))},$i=(e,r,t,n,o,u,c,f,m,p,v,_,w)=>{v=G(v),u=J(o,u),f&&=J(c,f),p&&=J(m,p),w=J(_,w);var E=vi(v);dt(E,function(){pe(`Cannot construct ${v} due to unbound types`,[n])}),Z([e,r,t],n?[n]:[],C=>{C=C[0];var F,N;n?(F=C.registeredClass,N=F.instancePrototype):N=Ge.prototype;var M=Oe(v,function(...q){if(Object.getPrototypeOf(this)!==z)throw new be("Use 'new' to construct "+v);if(V.constructor_body===void 0)throw new be(v+" has no accessible constructor");var Ut=V.constructor_body[q.length];if(Ut===void 0)throw new be(`Tried to invoke ctor of ${v} with invalid number of parameters (${q.length}) - expected (${Object.keys(V.constructor_body).toString()}) parameters instead!`);return Ut.apply(this,q)}),z=Object.create(N,{constructor:{value:M}});M.prototype=z;var V=new gi(v,M,z,w,F,u,f,p);V.baseClass&&(V.baseClass.__derivedClasses??=[],V.baseClass.__derivedClasses.push(V));var ve=new Se(v,V,!0,!1,!1),X=new Se(v+"*",V,!1,!1,!1),ae=new Se(v+" const*",V,!1,!0,!1);return ct[e]={pointerType:X,constPointerType:ae},ht(E,M),[ve,X,ae]})};function _t(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function yt(e,r){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var t=Oe(e.name||"unknownFunctionName",function(){});t.prototype=e.prototype;var n=new t,o=e.apply(n,r);return o instanceof Object?o:n}function Oi(e,r,t,n){var o=_t(e),u=e.length-2,c=[],f=["fn"];r&&f.push("thisWired");for(var m=0;m<u;++m)c.push(`arg${m}`),f.push(`arg${m}Wired`);c=c.join(","),f=f.join(",");var p=`return function (${c}) {
|
|
26
26
|
`;o&&(p+=`var destructors = [];
|
|
27
27
|
`);var v=o?"destructors":"null",_=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];r&&(p+=`var thisWired = classParam['toWireType'](${v}, this);
|
|
28
28
|
`);for(var m=0;m<u;++m)p+=`var arg${m}Wired = argType${m}['toWireType'](${v}, arg${m});
|
|
@@ -32,9 +32,9 @@ Expecting one of '${l.join("', '")}'`);let d=`${i}Help`;return this.on(d,h=>{let
|
|
|
32
32
|
`,_.push(`${w}_dtor`))}return t&&(p+=`var ret = retType['fromWireType'](rv);
|
|
33
33
|
return ret;
|
|
34
34
|
`),p+=`}
|
|
35
|
-
`,[_,p]}function Ke(e,r,t,n,o,u){var c=r.length;c<2&&D("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var f=r[1]!==null&&t!==null,m=
|
|
35
|
+
`,[_,p]}function Ke(e,r,t,n,o,u){var c=r.length;c<2&&D("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var f=r[1]!==null&&t!==null,m=_t(r),p=r[0].name!=="void",v=[e,D,n,o,Ne,r[0],r[1]],_=0;_<c-2;++_)v.push(r[_+2]);if(!m)for(var _=f?1:2;_<r.length;++_)r[_].destructorFunction!==null&&v.push(r[_].destructorFunction);let[w,E]=Oi(r,f,p,u);w.push(E);var C=yt(Function,w)(...v);return Oe(e,C)}var Xe=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(j[r+n*4>>2]);return t},hr=e=>{e=e.trim();let r=e.indexOf("(");return r!==-1?e.substr(0,r):e},Si=(e,r,t,n,o,u,c,f,m)=>{var p=Xe(t,n);r=G(r),r=hr(r),u=J(o,u),Z([],[e],v=>{v=v[0];var _=`${v.name}.${r}`;function w(){pe(`Cannot call ${_} due to unbound types`,p)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]);var E=v.registeredClass.constructor;return E[r]===void 0?(w.argCount=t-1,E[r]=w):(dr(E,r,_),E[r].overloadTable[t-1]=w),Z([],p,C=>{var F=[C[0],null].concat(C.slice(1)),N=Ke(_,F,null,u,c,f);if(E[r].overloadTable===void 0?(N.argCount=t-1,E[r]=N):E[r].overloadTable[t-1]=N,v.registeredClass.__derivedClasses)for(let M of v.registeredClass.__derivedClasses)M.constructor.hasOwnProperty(r)||(M.constructor[r]=N);return[]}),[]})},Pi=(e,r,t,n,o,u)=>{var c=Xe(r,t);o=J(n,o),Z([],[e],f=>{f=f[0];var m=`constructor ${f.name}`;if(f.registeredClass.constructor_body===void 0&&(f.registeredClass.constructor_body=[]),f.registeredClass.constructor_body[r-1]!==void 0)throw new be(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return f.registeredClass.constructor_body[r-1]=()=>{pe(`Cannot construct ${f.name} due to unbound types`,c)},Z([],c,p=>(p.splice(1,0,null),f.registeredClass.constructor_body[r-1]=Ke(m,p,null,o,u),[])),[]})},Fi=(e,r,t,n,o,u,c,f,m,p)=>{var v=Xe(t,n);r=G(r),r=hr(r),u=J(o,u),Z([],[e],_=>{_=_[0];var w=`${_.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),f&&_.registeredClass.pureVirtualFunctions.push(r);function E(){pe(`Cannot call ${w} due to unbound types`,v)}var C=_.registeredClass.instancePrototype,F=C[r];return F===void 0||F.overloadTable===void 0&&F.className!==_.name&&F.argCount===t-2?(E.argCount=t-2,E.className=_.name,C[r]=E):(dr(C,r,w),C[r].overloadTable[t-2]=E),Z([],v,N=>{var M=Ke(w,N,_,u,c,m);return C[r].overloadTable===void 0?(M.argCount=t-2,C[r]=M):C[r].overloadTable[t-2]=M,[]}),[]})},wt=(e,r,t)=>(e instanceof Object||D(`${t} with invalid "this": ${e}`),e instanceof r.registeredClass.constructor||D(`${t} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||D(`cannot call emscripten binding method ${t} on deleted object`),Je(e.$$.ptr,e.$$.ptrType.registeredClass,r.registeredClass)),Ti=(e,r,t,n,o,u,c,f,m,p)=>{r=G(r),o=J(n,o),Z([],[e],v=>{v=v[0];var _=`${v.name}.${r}`,w={get(){pe(`Cannot access ${_} due to unbound types`,[t,c])},enumerable:!0,configurable:!0};return m?w.set=()=>pe(`Cannot access ${_} due to unbound types`,[t,c]):w.set=E=>D(_+" is a read-only property"),Object.defineProperty(v.registeredClass.instancePrototype,r,w),Z([],m?[t,c]:[t],E=>{var C=E[0],F={get(){var M=wt(this,v,_+" getter");return C.fromWireType(o(u,M))},enumerable:!0};if(m){m=J(f,m);var N=E[1];F.set=function(M){var z=wt(this,v,_+" setter"),V=[];m(p,z,N.toWireType(V,M)),Ne(V)}}return Object.defineProperty(v.registeredClass.instancePrototype,r,F),[]}),[]})},mr=[],oe=[],pr=e=>{e>9&&--oe[e+1]===0&&(oe[e]=void 0,mr.push(e))},xi=()=>oe.length/2-5-mr.length,Di=()=>{oe.push(0,1,void 0,1,null,1,!0,1,!1,1),l.count_emval_handles=xi},ee={toValue:e=>(e||D("Cannot use deleted val. handle = "+e),oe[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=mr.pop()||oe.length;return oe[r]=e,oe[r+1]=1,r}}}},Et={name:"emscripten::val",fromWireType:e=>{var r=ee.toValue(e);return pr(e),r},toWireType:(e,r)=>ee.toHandle(r),argPackAdvance:ie,readValueFromPointer:ke,destructorFunction:null},Mi=e=>te(e,Et),vr=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},ji=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(Br[t>>2])};case 8:return function(t){return this.fromWireType(nr[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},Hi=(e,r,t)=>{r=G(r),te(e,{name:r,fromWireType:n=>n,toWireType:(n,o)=>o,argPackAdvance:ie,readValueFromPointer:ji(r,t),destructorFunction:null})},Ri=(e,r,t,n,o,u,c,f)=>{var m=Xe(r,t);e=G(e),e=hr(e),o=J(n,o),dt(e,function(){pe(`Cannot call ${e} due to unbound types`,m)},r-1),Z([],m,p=>{var v=[p[0],null].concat(p.slice(1));return ht(e,Ke(e,v,null,o,u,c),r-1),[]})},Vi=(e,r,t)=>{switch(r){case 1:return t?n=>K[n]:n=>Y[n];case 2:return t?n=>ne[n>>1]:n=>He[n>>1];case 4:return t?n=>A[n>>2]:n=>j[n>>2];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},Wi=(e,r,t,n,o)=>{r=G(r),o===-1&&(o=4294967295);var u=v=>v;if(n===0){var c=32-8*t;u=v=>v<<c>>>c}var f=r.includes("unsigned"),m=(v,_)=>{},p;f?p=function(v,_){return m(_,this.name),_>>>0}:p=function(v,_){return m(_,this.name),_},te(e,{name:r,fromWireType:u,toWireType:p,argPackAdvance:ie,readValueFromPointer:Vi(r,t,n!==0),destructorFunction:null})},Ui=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],o=n[r];function u(c){var f=j[c>>2],m=j[c+4>>2];return new o(K.buffer,m,f)}t=G(t),te(e,{name:t,fromWireType:u,argPackAdvance:ie,readValueFromPointer:u},{ignoreDuplicateRegistrations:!0})},Ii=Object.assign({optional:!0},Et),Ni=(e,r)=>{te(e,Ii)},Bi=(e,r,t,n,o,u,c,f,m,p,v,_)=>{t=G(t),u=J(o,u),f=J(c,f),p=J(m,p),_=J(v,_),Z([e],[r],w=>{w=w[0];var E=new Se(t,w.registeredClass,!1,!1,!0,w,n,u,f,p,_);return[E]})},Li=(e,r)=>{r=G(r);var t=!0;te(e,{name:r,fromWireType(n){var o=j[n>>2],u=n+4,c;if(t)for(var f=u,m=0;m<=o;++m){var p=u+m;if(m==o||Y[p]==0){var v=p-f,_=it(f,v);c===void 0?c=_:(c+="\0",c+=_),f=p+1}}else{for(var w=new Array(o),m=0;m<o;++m)w[m]=String.fromCharCode(Y[u+m]);c=w.join("")}return se(n),c},toWireType(n,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var u,c=typeof o=="string";c||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Int8Array||D("Cannot pass non-string to std::string"),t&&c?u=We(o):u=o.length;var f=br(4+u+1),m=f+4;if(j[f>>2]=u,t&&c)ur(o,m,u+1);else if(c)for(var p=0;p<u;++p){var v=o.charCodeAt(p);v>255&&(se(m),D("String has UTF-16 code units that do not fit in 8 bits")),Y[m+p]=v}else for(var p=0;p<u;++p)Y[m+p]=o[p];return n!==null&&n.push(se,f),f},argPackAdvance:ie,readValueFromPointer:ke,destructorFunction(n){se(n)}})},bt=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,qi=(e,r)=>{for(var t=e,n=t>>1,o=n+r/2;!(n>=o)&&He[n];)++n;if(t=n<<1,t-e>32&&bt)return bt.decode(Y.subarray(e,t));for(var u="",c=0;!(c>=r/2);++c){var f=ne[e+c*2>>1];if(f==0)break;u+=String.fromCharCode(f)}return u},zi=(e,r,t)=>{if(t??=2147483647,t<2)return 0;t-=2;for(var n=r,o=t<e.length*2?t/2:e.length,u=0;u<o;++u){var c=e.charCodeAt(u);ne[r>>1]=c,r+=2}return ne[r>>1]=0,r-n},Gi=e=>e.length*2,Ji=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var o=A[e+t*4>>2];if(o==0)break;if(++t,o>=65536){var u=o-65536;n+=String.fromCharCode(55296|u>>10,56320|u&1023)}else n+=String.fromCharCode(o)}return n},Yi=(e,r,t)=>{if(t??=2147483647,t<4)return 0;for(var n=r,o=n+t-4,u=0;u<e.length;++u){var c=e.charCodeAt(u);if(c>=55296&&c<=57343){var f=e.charCodeAt(++u);c=65536+((c&1023)<<10)|f&1023}if(A[r>>2]=c,r+=4,r+4>o)break}return A[r>>2]=0,r-n},Ki=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&++t,r+=4}return r},Xi=(e,r,t)=>{t=G(t);var n,o,u,c;r===2?(n=qi,o=zi,c=Gi,u=f=>He[f>>1]):r===4&&(n=Ji,o=Yi,c=Ki,u=f=>j[f>>2]),te(e,{name:t,fromWireType:f=>{for(var m=j[f>>2],p,v=f+4,_=0;_<=m;++_){var w=f+4+_*r;if(_==m||u(w)==0){var E=w-v,C=n(v,E);p===void 0?p=C:(p+="\0",p+=C),v=w+r}}return se(f),p},toWireType:(f,m)=>{typeof m!="string"&&D(`Cannot pass non-string to C++ string type ${t}`);var p=c(m),v=br(4+p+r);return j[v>>2]=p/r,o(m,v+4,p+r),f!==null&&f.push(se,v),v},argPackAdvance:ie,readValueFromPointer:ke,destructorFunction(f){se(f)}})},Qi=(e,r,t,n,o,u)=>{Ie[e]={name:G(r),rawConstructor:J(t,n),rawDestructor:J(o,u),fields:[]}},Zi=(e,r,t,n,o,u,c,f,m,p)=>{Ie[e].fields.push({fieldName:G(r),getterReturnType:t,getter:J(n,o),getterContext:u,setterArgumentType:c,setter:J(f,m),setterContext:p})},eo=(e,r)=>{r=G(r),te(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}})},ro=(e,r,t)=>Y.copyWithin(e,r,r+t),Ct=0,to=()=>{Qr=!1,Ct=0},gr=(e,r)=>{var t=me[e];return t===void 0&&D(`${r} has unknown type ${gt(e)}`),t},At=(e,r,t)=>{var n=[],o=e.toWireType(n,t);return n.length&&(j[r>>2]=ee.toHandle(n)),o},no=(e,r,t)=>(e=ee.toValue(e),r=gr(r,"emval::as"),At(r,t,e)),Qe=[],io=(e,r,t,n)=>(e=Qe[e],r=ee.toValue(r),e(null,r,t,n)),oo={},_r=e=>{var r=oo[e];return r===void 0?G(e):r},so=(e,r,t,n,o)=>(e=Qe[e],r=ee.toValue(r),t=_r(t),e(r,r[t],n,o)),kt=()=>typeof globalThis=="object"?globalThis:function(){return Function}()("return this")(),ao=e=>e===0?ee.toHandle(kt()):(e=_r(e),ee.toHandle(kt()[e])),lo=e=>{var r=Qe.length;return Qe.push(e),r},uo=(e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=gr(j[r+n*4>>2],"parameter "+n);return t},Ns=Reflect.construct,co=(e,r,t)=>{var n=uo(e,r),o=n.shift();e--;var u=`return function (obj, func, destructorsRef, args) {
|
|
36
36
|
`,c=0,f=[];t===0&&f.push("obj");for(var m=["retType"],p=[o],v=0;v<e;++v)f.push("arg"+v),m.push("argType"+v),p.push(n[v]),u+=` var arg${v} = argType${v}.readValueFromPointer(args${c?"+"+c:""});
|
|
37
37
|
`,c+=n[v].argPackAdvance;var _=t===1?"new func":"func.call";u+=` var rv = ${_}(${f.join(", ")});
|
|
38
|
-
`,o.isVoid||(m.push("emval_returnValue"),p.push(
|
|
38
|
+
`,o.isVoid||(m.push("emval_returnValue"),p.push(At),u+=` return emval_returnValue(retType, destructorsRef, rv);
|
|
39
39
|
`),u+=`};
|
|
40
|
-
`,m.push(u);var w=
|
|
40
|
+
`,m.push(u);var w=yt(Function,m)(...p),E=`methodCaller<(${n.map(C=>C.name).join(", ")}) => ${o.name}>`;return lo(Oe(E,w))},fo=e=>(e=_r(e),ee.toHandle(l[e])),ho=e=>{e>9&&(oe[e+1]+=1)},mo=e=>{var r=ee.toValue(e);Ne(r),pr(e)},po=(e,r)=>{e=gr(e,"_emval_take_value");var t=e.readValueFromPointer(r);return ee.toHandle(t)};function vo(e,r,t){var n=he(e,r),o=new Date(n*1e3);A[t>>2]=o.getUTCSeconds(),A[t+4>>2]=o.getUTCMinutes(),A[t+8>>2]=o.getUTCHours(),A[t+12>>2]=o.getUTCDate(),A[t+16>>2]=o.getUTCMonth(),A[t+20>>2]=o.getUTCFullYear()-1900,A[t+24>>2]=o.getUTCDay();var u=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),c=(o.getTime()-u)/(1e3*60*60*24)|0;A[t+28>>2]=c}var go=e=>e%4===0&&(e%100!==0||e%400===0),_o=[0,31,60,91,121,152,182,213,244,274,305,335],yo=[0,31,59,90,120,151,181,212,243,273,304,334],wo=e=>{var r=go(e.getFullYear()),t=r?_o:yo,n=t[e.getMonth()]+e.getDate()-1;return n};function Eo(e,r,t){var n=he(e,r),o=new Date(n*1e3);A[t>>2]=o.getSeconds(),A[t+4>>2]=o.getMinutes(),A[t+8>>2]=o.getHours(),A[t+12>>2]=o.getDate(),A[t+16>>2]=o.getMonth(),A[t+20>>2]=o.getFullYear()-1900,A[t+24>>2]=o.getDay();var u=wo(o)|0;A[t+28>>2]=u,A[t+36>>2]=-(o.getTimezoneOffset()*60);var c=new Date(o.getFullYear(),0,1),f=new Date(o.getFullYear(),6,1).getTimezoneOffset(),m=c.getTimezoneOffset(),p=(f!=m&&o.getTimezoneOffset()==Math.min(m,f))|0;A[t+32>>2]=p}function bo(e,r,t,n,o,u,c,f){var m=he(o,u);try{if(isNaN(m))return 61;var p=x.getStreamFromFD(n),v=s.mmap(p,e,m,r,t),_=v.ptr;return A[c>>2]=v.allocated,j[f>>2]=_,0}catch(w){if(typeof s>"u"||w.name!=="ErrnoError")throw w;return-w.errno}}function Co(e,r,t,n,o,u,c){var f=he(u,c);try{var m=x.getStreamFromFD(o);t&2&&x.doMsync(e,m,r,n,f)}catch(p){if(typeof s>"u"||p.name!=="ErrnoError")throw p;return-p.errno}}var Pe={},yr=e=>{if(e instanceof Xr||e=="unwind")return je;I(1,e)},$t=()=>Qr||Ct>0,Ot=e=>{je=e,$t()||(l.onExit?.(e),Me=!0),I(e,new Xr(e))},St=(e,r)=>{je=e,Ot(e)},Ao=St,ko=()=>{if(!$t())try{Ao(je)}catch(e){yr(e)}},$o=e=>{if(!Me)try{e(),ko()}catch(r){yr(r)}},Pt=()=>performance.now(),Oo=(e,r)=>{if(Pe[e]&&(clearTimeout(Pe[e].id),delete Pe[e]),!r)return 0;var t=setTimeout(()=>{delete Pe[e],$o(()=>jt(e,Pt()))},r);return Pe[e]={id:t,timeout_ms:r},0},Ft=()=>Date.now(),So=1,Po=e=>e>=0&&e<=3;function Fo(e,r,t,n){var o=he(r,t);if(!Po(e))return 28;var u;if(e===0)u=Ft();else if(So)u=Pt();else return 52;var c=Math.round(u*1e3*1e3);return U=[c>>>0,(O=c,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[n>>2]=U[0],A[n+4>>2]=U[1],0}var wr=[],To=(e,r)=>{wr.length=0;for(var t;t=Y[e++];){var n=t!=105;n&=t!=112,r+=n&&r%8?4:0,wr.push(t==112?j[r>>2]:t==105?A[r>>2]:nr[r>>3]),r+=n?8:4}return wr},xo=(e,r,t)=>{var n=To(r,t);return Tn[e](...n)},Do=(e,r,t)=>xo(e,r,t),Mo=()=>2147483648,jo=e=>{var r=De.buffer,t=(e-r.byteLength+65535)/65536|0;try{return De.grow(t),Lr(),1}catch{}},Ho=e=>{var r=Y.length;e>>>=0;var t=Mo();if(e>t)return!1;for(var n=1;n<=4;n*=2){var o=r*(1+.2/n);o=Math.min(o,e+100663296);var u=Math.min(t,tt(Math.max(e,o),65536)),c=jo(u);if(c)return!0}return!1},Er={},Ro=()=>T||"./this.program",Fe=()=>{if(!Fe.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Ro()};for(var t in Er)Er[t]===void 0?delete r[t]:r[t]=Er[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);Fe.strings=n}return Fe.strings},Vo=(e,r)=>{for(var t=0;t<e.length;++t)K[r++]=e.charCodeAt(t);K[r]=0},Wo=(e,r)=>{var t=0;return Fe().forEach((n,o)=>{var u=r+t;j[e+o*4>>2]=u,Vo(n,u),t+=n.length+1}),0},Uo=(e,r)=>{var t=Fe();j[e>>2]=t.length;var n=0;return t.forEach(o=>n+=o.length+1),j[r>>2]=n,0};function Io(e){try{var r=x.getStreamFromFD(e);return s.close(r),0}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var No=(e,r,t,n)=>{for(var o=0,u=0;u<t;u++){var c=j[r>>2],f=j[r+4>>2];r+=8;var m=s.read(e,K,c,f,n);if(m<0)return-1;if(o+=m,m<f)break;typeof n<"u"&&(n+=m)}return o};function Bo(e,r,t,n){try{var o=x.getStreamFromFD(e),u=No(o,r,t);return j[n>>2]=u,0}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return c.errno}}function Lo(e,r,t,n,o){var u=he(r,t);try{if(isNaN(u))return 61;var c=x.getStreamFromFD(e);return s.llseek(c,u,n),U=[c.position>>>0,(O=c.position,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[o>>2]=U[0],A[o+4>>2]=U[1],c.getdents&&u===0&&n===0&&(c.getdents=null),0}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return f.errno}}var qo=(e,r,t,n)=>{for(var o=0,u=0;u<t;u++){var c=j[r>>2],f=j[r+4>>2];r+=8;var m=s.write(e,K,c,f,n);if(m<0)return-1;if(o+=m,m<f)break;typeof n<"u"&&(n+=m)}return o};function zo(e,r,t,n){try{var o=x.getStreamFromFD(e),u=qo(o,r,t);return j[n>>2]=u,0}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return c.errno}}var Tt=e=>Rt(e),Go=e=>{var r=We(e)+1,t=Tt(r);return ur(e,t,r),t};s.createPreloadedFile=Wn,s.staticInit(),P.doesNotExistError=new s.ErrnoError(44),P.doesNotExistError.stack="<generic error, no stack>",ot=l.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},ni(),be=l.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},hi(),Ei(),vt=l.UnboundTypeError=ki(Error,"UnboundTypeError"),Di();var Jo={V:In,r:Nn,S:Bn,E:Ln,M:qn,U:zn,Q:Gn,P:Jn,h:Yn,L:Kn,n:Xn,R:Qn,o:Zn,W:ei,u:ri,G:ti,ea:oi,j:$i,aa:Si,ba:Pi,d:Fi,x:Ti,ca:Mi,w:Hi,ga:Ri,c:Wi,a:Ui,ha:Ni,m:Bi,da:Li,i:Xi,$:Qi,v:Zi,fa:eo,T:ro,I:to,t:no,y:io,Z:so,b:pr,_:ao,k:co,X:fo,l:ho,g:mo,f:po,B:vo,C:Eo,z:bo,A:Co,J:Oo,F:Fo,Y:Do,s:Ft,K:Ho,N:Wo,O:Uo,e:Io,q:Bo,D:Lo,p:zo,H:Ot},R;Fn();var Yo=()=>(Yo=R.ja)(),xt=e=>(xt=R.ka)(e),br=e=>(br=R.la)(e),se=e=>(se=R.ma)(e),Dt=l._main=(e,r)=>(Dt=l._main=R.na)(e,r),Mt=(e,r)=>(Mt=R.pa)(e,r),jt=(e,r)=>(jt=R.qa)(e,r),Ht=()=>(Ht=R.ra)(),Rt=e=>(Rt=R.sa)(e),Ko=l.dynCall_ji=(e,r)=>(Ko=l.dynCall_ji=R.ta)(e,r),Xo=l.dynCall_jiji=(e,r,t,n,o)=>(Xo=l.dynCall_jiji=R.ua)(e,r,t,n,o),Qo=l.dynCall_viij=(e,r,t,n,o)=>(Qo=l.dynCall_viij=R.va)(e,r,t,n,o),Zo=l.dynCall_iij=(e,r,t,n)=>(Zo=l.dynCall_iij=R.wa)(e,r,t,n),es=l.dynCall_iiji=(e,r,t,n,o)=>(es=l.dynCall_iiji=R.xa)(e,r,t,n,o),rs=l.dynCall_jji=(e,r,t,n)=>(rs=l.dynCall_jji=R.ya)(e,r,t,n),ts=l.dynCall_iji=(e,r,t,n)=>(ts=l.dynCall_iji=R.za)(e,r,t,n),ns=l.dynCall_iiij=(e,r,t,n,o)=>(ns=l.dynCall_iiij=R.Aa)(e,r,t,n,o),is=l.dynCall_viijj=(e,r,t,n,o,u,c)=>(is=l.dynCall_viijj=R.Ba)(e,r,t,n,o,u,c),os=l.dynCall_vij=(e,r,t,n)=>(os=l.dynCall_vij=R.Ca)(e,r,t,n),ss=l.dynCall_viijii=(e,r,t,n,o,u,c)=>(ss=l.dynCall_viijii=R.Da)(e,r,t,n,o,u,c),as=l.dynCall_iiiiij=(e,r,t,n,o,u,c)=>(as=l.dynCall_iiiiij=R.Ea)(e,r,t,n,o,u,c),ls=l.dynCall_iiiiijj=(e,r,t,n,o,u,c,f,m)=>(ls=l.dynCall_iiiiijj=R.Fa)(e,r,t,n,o,u,c,f,m),us=l.dynCall_iiiiiijj=(e,r,t,n,o,u,c,f,m,p)=>(us=l.dynCall_iiiiiijj=R.Ga)(e,r,t,n,o,u,c,f,m,p),Ze;Ae=function e(){Ze||Vt(),Ze||(Ae=e)};function cs(e=[]){var r=Dt;e.unshift(T);var t=e.length,n=Tt((t+1)*4),o=n;e.forEach(c=>{j[o>>2]=Go(c),o+=4}),j[o>>2]=0;try{var u=r(t,n);return St(u,!0),u}catch(c){return yr(c)}}function Vt(e=S){if(de>0||(vn(),de>0))return;function r(){Ze||(Ze=!0,l.calledRun=!0,!Me&&(gn(),_n(),d(l),l.onRuntimeInitialized?.(),Wt&&cs(e),yn()))}l.setStatus?(l.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>l.setStatus(""),1),r()},1)):r()}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();var Wt=!0;return l.noInitialRun&&(Wt=!1),Vt(),a=y,a}})(),Qt=bs;var dn=Cr(fn(),1),{program:ga,createCommand:_a,createArgument:ya,createOption:wa,CommanderError:Ea,InvalidArgumentError:ba,InvalidOptionArgumentError:Ca,Command:hn,Argument:Aa,Option:ka,Help:$a}=dn.default;var Vs=()=>Ir.default.openAsBlob((0,mn.resolve)(__dirname,"docauth.wasm")),Ws=async()=>{let g=await Lt({type:"buffer",buffer:(await Vs()).arrayBuffer()},Promise.resolve(Qt));return zt(g)},Nr=new hn,Us=async g=>{let i=await Ws(),a=Xt({wasmExecutor:i},g.scanDirectory);Ir.default.writeFileSync(g.writeTo,JSON.stringify(Yt(a)),"utf-8")};Nr.name("document-authoring");Nr.command("create-font-index").description("Create a dynamic font index").requiredOption("-d, --scan-directory <string>","The directory to scan for fonts").requiredOption("-w, --write-to <string>","The font index JSON file to create").action(Us);Nr.parse();
|
package/lib/docauth.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const t={type:"default-index"},e=async t=>(await(async t=>{const e=new URL(t??"https://document-authoring.cdn.nutrient.io/2025/1/",window.location.href).href,a=new URL("docauth-impl-
|
|
1
|
+
const t={type:"default-index"},e=async t=>(await(async t=>{const e=new URL(t??"https://document-authoring.cdn.nutrient.io/2025/1/",window.location.href).href,a=new URL("docauth-impl-33ba2e554b2dbacd.js",e).href;return import(
|
|
2
2
|
/*webpackIgnore: true*/
|
|
3
3
|
/* @vite-ignore */
|
|
4
4
|
a)})(t?.assets?.base)).createDocAuthSystem(t);var a={createDocAuthSystem:e,defaultFontIndex:t};export{e as createDocAuthSystem,a as default,t as defaultFontIndex};
|
package/lib/docauth.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).DocAuth={})}(this,(function(e){"use strict";const t={type:"default-index"},n=async e=>(await(async e=>{const t=new URL(e??"https://document-authoring.cdn.nutrient.io/2025/1/",window.location.href).href,n=new URL("docauth-impl-
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).DocAuth={})}(this,(function(e){"use strict";const t={type:"default-index"},n=async e=>(await(async e=>{const t=new URL(e??"https://document-authoring.cdn.nutrient.io/2025/1/",window.location.href).href,n=new URL("docauth-impl-33ba2e554b2dbacd.js",t).href;return import(
|
|
2
2
|
/*webpackIgnore: true*/
|
|
3
3
|
/* @vite-ignore */
|
|
4
4
|
n)})(e?.assets?.base)).createDocAuthSystem(e);var o={createDocAuthSystem:n,defaultFontIndex:t};e.createDocAuthSystem=n,e.default=o,e.defaultFontIndex=t,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/lib/docauth.wasm
CHANGED
|
Binary file
|