@nutrient-sdk/document-authoring 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ACKNOWLEDGEMENTS +11702 -0
- package/LICENSE.md +5 -0
- package/README.md +124 -0
- package/lib/cli.js +43 -0
- package/lib/docauth.mjs +4 -0
- package/lib/docauth.umd.js +4 -0
- package/lib/docauth.wasm +0 -0
- package/lib/index.d.cts +331 -0
- package/lib/index.d.mts +331 -0
- package/package.json +50 -0
package/LICENSE.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Document Authoring SDK
|
|
2
|
+
|
|
3
|
+
> ### The `@pspdfkit/document-authoring` package has been renamed to `@nutrient-sdk/document-authoring`.
|
|
4
|
+
> Please use the [`@nutrient-sdk/document-authoring`][] package going forward.
|
|
5
|
+
|
|
6
|
+
The Document Authoring SDK provides a way to seamlessly embed document authoring capabilities into your web app. It's a WYSIWYG editor that provides features traditionally found only in desktop word processors. You can read more and try a demo on our [dedicated product page](https://www.nutrient.io/sdk/document-authoring).
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## ✨ Feature Requests & Feedback
|
|
10
|
+
|
|
11
|
+
To help us shape this new authoring experience, we highly value your feedback! Please submit any feature requests or bug reports to [support@nutrient.io](mailto:support@nutrient.io) with the subject line "Document Authoring: Feature Request/Bug Report". We appreciate your contributions and are excited to hear your thoughts!
|
|
12
|
+
|
|
13
|
+
## 💻 Installation
|
|
14
|
+
|
|
15
|
+
The package is available on [npm](https://www.npmjs.com/), and can be installed with your package manager of choice. The package name is `@nutrient-sdk/document-authoring`.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @nutrient-sdk/document-authoring
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## ⚡️ Quickstart
|
|
22
|
+
|
|
23
|
+
The visual editor needs a suitable target DOM element:
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<!--
|
|
27
|
+
IMPORTANT: An editor target element needs to have its `position` set to a value other than the default or `static`!
|
|
28
|
+
If unsure use `relative`.
|
|
29
|
+
-->
|
|
30
|
+
<div id="editor" style="position: relative; border: 1px solid black; width: 1024px; height: 600px;"></div>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The npm package can then be imported and the target set to the element:
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
import DocAuth from '@nutrient-sdk/document-authoring';
|
|
37
|
+
|
|
38
|
+
const docAuthSystem = await DocAuth.createDocAuthSystem()
|
|
39
|
+
|
|
40
|
+
const editor = await docAuthSystem.createEditor(document.getElementById('editor'),{
|
|
41
|
+
document: await docAuthSystem.createDocumentFromPlaintext('Hi there!'),
|
|
42
|
+
})
|
|
43
|
+
```
|
|
44
|
+
For a typical setup, this is all that's needed.
|
|
45
|
+
|
|
46
|
+
### Other methods
|
|
47
|
+
|
|
48
|
+
In a static context (with no bundler) you can use the file found at `lib/docauth.es.js` in the package (located in
|
|
49
|
+
`node_modules/@nutrient-sdk/document-authoring/lib/docauth.es.js` if you installed
|
|
50
|
+
the SDK via `npm`).
|
|
51
|
+
|
|
52
|
+
With the default configuration (CDN assets) this is the only file you need at runtime.
|
|
53
|
+
If you use this file in your application you will need to use a dynamic import:
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
// Replace `/lib/docauth.es.js` with the path where the file is available in your setup.
|
|
57
|
+
const DocAuth = await import('/lib/docauth.es.js');
|
|
58
|
+
|
|
59
|
+
const docAuthSystem = await DocAuth.createDocAuthSystem()
|
|
60
|
+
|
|
61
|
+
const editor = await docAuthSystem.createEditor(document.getElementById('editor'),{
|
|
62
|
+
document: await docAuthSystem.createDocumentFromPlaintext('Hi there!'),
|
|
63
|
+
})
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Alternatively a version that can be included via a script tag is available at `lib/docauth.umd.js` in the package (located in
|
|
67
|
+
`node_modules/@nutrient-sdk/document-authoring/lib/docauth.umd.js` if you installed
|
|
68
|
+
the SDK via `npm`).
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<script src="lib/docauth.umd.js"></script>
|
|
72
|
+
<script>
|
|
73
|
+
(async()=>{
|
|
74
|
+
const docAuthSystem = await DocAuth.createDocAuthSystem()
|
|
75
|
+
const editor = await docAuthSystem.createEditor(document.getElementById('editor'),{
|
|
76
|
+
document: await docAuthSystem.createDocumentFromPlaintext('Hi there!'),
|
|
77
|
+
})
|
|
78
|
+
})()
|
|
79
|
+
</script>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Example
|
|
83
|
+
|
|
84
|
+
You can download an example project demoing both TypeScript and JavaScript integration from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.3.0-example.zip), unzip it and run:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm install
|
|
88
|
+
npx vite serve
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Fetching assets
|
|
92
|
+
|
|
93
|
+
By default, the Document Authoring SDK will fetch the required files (fonts, emoji data, etc.) from a public CDN, and no further configuration is needed. See below for instructions on how to self-host assets.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Self-hosting the assets
|
|
97
|
+
|
|
98
|
+
To host the assets on your own infrastructure you can download them from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.3.0-assets.zip) and deploy them to a suitable location.
|
|
99
|
+
Provide an appropriate base path when initializing the Document Authoring SDK.
|
|
100
|
+
|
|
101
|
+
#### Example:
|
|
102
|
+
|
|
103
|
+
```JavaScript
|
|
104
|
+
// Alternatively you can use `import DocAuth from '@nutrient-sdk/document-authoring'` if you have a bundler set up.
|
|
105
|
+
// Replace `/lib/docauth.es.js` with the path where the file is available in your setup.
|
|
106
|
+
const DocAuth = await import('/lib/docauth.es.js');
|
|
107
|
+
|
|
108
|
+
const docAuthSystem = await DocAuth.createDocAuthSystem({
|
|
109
|
+
assets: {
|
|
110
|
+
// Replace '/document-authoring-assets/' with the path where the assets are available.
|
|
111
|
+
base: '/document-authoring-assets/',
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Entry points and TypeScript declarations
|
|
117
|
+
|
|
118
|
+
Typescript type declarations are provided (`lib/docauth.d.ts`).
|
|
119
|
+
|
|
120
|
+
The `DocAuth.createDocAuthSystem` method and the `DocAuthSystem` type are the main entry points when using this library.
|
|
121
|
+
|
|
122
|
+
## 🧾 License
|
|
123
|
+
|
|
124
|
+
Copyright (c) 2024-present [PSPDFKit GmbH](https://www.nutrient.io). See the [evaluation license](./LICENSE.md) for more information.
|
package/lib/cli.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";var ns=Object.create;var jt=Object.defineProperty;var is=Object.getOwnPropertyDescriptor;var os=Object.getOwnPropertyNames;var ss=Object.getPrototypeOf,as=Object.prototype.hasOwnProperty;var ge=(g,i)=>()=>(i||g((i={exports:{}}).exports,i),i.exports);var ls=(g,i,l,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let d of os(i))!as.call(g,d)&&d!==l&&jt(g,d,{get:()=>i[d],enumerable:!(a=is(i,d))||a.enumerable});return g};var Ar=(g,i,l)=>(l=g!=null?ns(ss(g)):{},ls(i||!g||!g.__esModule?jt(l,"default",{value:g,enumerable:!0}):l,g));var Me=ge(Sr=>{var tr=class extends Error{constructor(i,l,a){super(a),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=l,this.exitCode=i,this.nestedError=void 0}},Or=class extends tr{constructor(i){super(1,"commander.invalidArgument",i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Sr.CommanderError=tr;Sr.InvalidArgumentError=Or});var nr=ge(Fr=>{var{InvalidArgumentError:ms}=Me(),Pr=class{constructor(i,l){switch(this.description=l||"",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,l){return l===this.defaultValue||!Array.isArray(l)?[i]:l.concat(i)}default(i,l){return this.defaultValue=i,this.defaultValueDescription=l,this}argParser(i){return this.parseArg=i,this}choices(i){return this.argChoices=i.slice(),this.parseArg=(l,a)=>{if(!this.argChoices.includes(l))throw new ms(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(l,a):l},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function vs(g){let i=g.name()+(g.variadic===!0?"...":"");return g.required?"<"+i+">":"["+i+"]"}Fr.Argument=Pr;Fr.humanReadableArgName=vs});var xr=ge(Gt=>{var{humanReadableArgName:gs}=nr(),Tr=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(i){let l=i.commands.filter(d=>!d._hidden),a=i._getHelpCommand();return a&&!a._hidden&&l.push(a),this.sortSubcommands&&l.sort((d,p)=>d.name().localeCompare(p.name())),l}compareOptions(i,l){let a=d=>d.short?d.short.replace(/^-/,""):d.long.replace(/^--/,"");return a(i).localeCompare(a(l))}visibleOptions(i){let l=i.options.filter(d=>!d.hidden),a=i._getHelpOption();if(a&&!a.hidden){let d=a.short&&i._findOption(a.short),p=a.long&&i._findOption(a.long);!d&&!p?l.push(a):a.long&&!p?l.push(i.createOption(a.long,a.description)):a.short&&!d&&l.push(i.createOption(a.short,a.description))}return this.sortOptions&&l.sort(this.compareOptions),l}visibleGlobalOptions(i){if(!this.showGlobalOptions)return[];let l=[];for(let a=i.parent;a;a=a.parent){let d=a.options.filter(p=>!p.hidden);l.push(...d)}return this.sortOptions&&l.sort(this.compareOptions),l}visibleArguments(i){return i._argsDescription&&i.registeredArguments.forEach(l=>{l.description=l.description||i._argsDescription[l.name()]||""}),i.registeredArguments.find(l=>l.description)?i.registeredArguments:[]}subcommandTerm(i){let l=i.registeredArguments.map(a=>gs(a)).join(" ");return i._name+(i._aliases[0]?"|"+i._aliases[0]:"")+(i.options.length?" [options]":"")+(l?" "+l:"")}optionTerm(i){return i.flags}argumentTerm(i){return i.name()}longestSubcommandTermLength(i,l){return l.visibleCommands(i).reduce((a,d)=>Math.max(a,l.subcommandTerm(d).length),0)}longestOptionTermLength(i,l){return l.visibleOptions(i).reduce((a,d)=>Math.max(a,l.optionTerm(d).length),0)}longestGlobalOptionTermLength(i,l){return l.visibleGlobalOptions(i).reduce((a,d)=>Math.max(a,l.optionTerm(d).length),0)}longestArgumentTermLength(i,l){return l.visibleArguments(i).reduce((a,d)=>Math.max(a,l.argumentTerm(d).length),0)}commandUsage(i){let l=i._name;i._aliases[0]&&(l=l+"|"+i._aliases[0]);let a="";for(let d=i.parent;d;d=d.parent)a=d.name()+" "+a;return a+l+" "+i.usage()}commandDescription(i){return i.description()}subcommandDescription(i){return i.summary()||i.description()}optionDescription(i){let l=[];return i.argChoices&&l.push(`choices: ${i.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),i.defaultValue!==void 0&&(i.required||i.optional||i.isBoolean()&&typeof i.defaultValue=="boolean")&&l.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),i.presetArg!==void 0&&i.optional&&l.push(`preset: ${JSON.stringify(i.presetArg)}`),i.envVar!==void 0&&l.push(`env: ${i.envVar}`),l.length>0?`${i.description} (${l.join(", ")})`:i.description}argumentDescription(i){let l=[];if(i.argChoices&&l.push(`choices: ${i.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),i.defaultValue!==void 0&&l.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),l.length>0){let a=`(${l.join(", ")})`;return i.description?`${i.description} ${a}`:a}return i.description}formatHelp(i,l){let a=l.padWidth(i,l),d=l.helpWidth||80,p=2,_=2;function A(R,Q){if(Q){let de=`${R.padEnd(a+_)}${Q}`;return l.wrap(de,d-p,a+_)}return R}function b(R){return R.join(`
|
|
3
|
+
`).replace(/^/gm," ".repeat(p))}let k=[`Usage: ${l.commandUsage(i)}`,""],S=l.commandDescription(i);S.length>0&&(k=k.concat([l.wrap(S,d,0),""]));let F=l.visibleArguments(i).map(R=>A(l.argumentTerm(R),l.argumentDescription(R)));F.length>0&&(k=k.concat(["Arguments:",b(F),""]));let W=l.visibleOptions(i).map(R=>A(l.optionTerm(R),l.optionDescription(R)));if(W.length>0&&(k=k.concat(["Options:",b(W),""])),this.showGlobalOptions){let R=l.visibleGlobalOptions(i).map(Q=>A(l.optionTerm(Q),l.optionDescription(Q)));R.length>0&&(k=k.concat(["Global Options:",b(R),""]))}let B=l.visibleCommands(i).map(R=>A(l.subcommandTerm(R),l.subcommandDescription(R)));return B.length>0&&(k=k.concat(["Commands:",b(B),""])),k.join(`
|
|
4
|
+
`)}padWidth(i,l){return Math.max(l.longestOptionTermLength(i,l),l.longestGlobalOptionTermLength(i,l),l.longestSubcommandTermLength(i,l),l.longestArgumentTermLength(i,l))}wrap(i,l,a,d=40){let p=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",_=new RegExp(`[\\n][${p}]+`);if(i.match(_))return i;let A=l-a;if(A<d)return i;let b=i.slice(0,a),k=i.slice(a).replace(`\r
|
|
5
|
+
`,`
|
|
6
|
+
`),S=" ".repeat(a),W="\\s\u200B",B=new RegExp(`
|
|
7
|
+
|.{1,${A-1}}([${W}]|$)|[^${W}]+?([${W}]|$)`,"g"),R=k.match(B)||[];return b+R.map((Q,de)=>Q===`
|
|
8
|
+
`?"":(de>0?S:"")+Q.trimEnd()).join(`
|
|
9
|
+
`)}};Gt.Help=Tr});var Hr=ge(jr=>{var{InvalidArgumentError:_s}=Me(),Dr=class{constructor(i,l){this.flags=i,this.description=l||"",this.required=i.includes("<"),this.optional=i.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(i),this.mandatory=!1;let a=ws(i);this.short=a.shortFlag,this.long=a.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,l){return this.defaultValue=i,this.defaultValueDescription=l,this}preset(i){return this.presetArg=i,this}conflicts(i){return this.conflictsWith=this.conflictsWith.concat(i),this}implies(i){let l=i;return typeof i=="string"&&(l={[i]:!0}),this.implied=Object.assign(this.implied||{},l),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,l){return l===this.defaultValue||!Array.isArray(l)?[i]:l.concat(i)}choices(i){return this.argChoices=i.slice(),this.parseArg=(l,a)=>{if(!this.argChoices.includes(l))throw new _s(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(l,a):l},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return ys(this.name().replace(/^no-/,""))}is(i){return this.short===i||this.long===i}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Mr=class{constructor(i){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,i.forEach(l=>{l.negate?this.negativeOptions.set(l.attributeName(),l):this.positiveOptions.set(l.attributeName(),l)}),this.negativeOptions.forEach((l,a)=>{this.positiveOptions.has(a)&&this.dualOptions.add(a)})}valueFromOption(i,l){let a=l.attributeName();if(!this.dualOptions.has(a))return!0;let d=this.negativeOptions.get(a).presetArg,p=d!==void 0?d:!1;return l.negate===(p===i)}};function ys(g){return g.split("-").reduce((i,l)=>i+l[0].toUpperCase()+l.slice(1))}function ws(g){let i,l,a=g.split(/[ |,]+/);return a.length>1&&!/^[[<]/.test(a[1])&&(i=a.shift()),l=a.shift(),!i&&/^-[^-]$/.test(l)&&(i=l,l=void 0),{shortFlag:i,longFlag:l}}jr.Option=Dr;jr.DualOptions=Mr});var Yt=ge(Jt=>{function Es(g,i){if(Math.abs(g.length-i.length)>3)return Math.max(g.length,i.length);let l=[];for(let a=0;a<=g.length;a++)l[a]=[a];for(let a=0;a<=i.length;a++)l[0][a]=a;for(let a=1;a<=i.length;a++)for(let d=1;d<=g.length;d++){let p=1;g[d-1]===i[a-1]?p=0:p=1,l[d][a]=Math.min(l[d-1][a]+1,l[d][a-1]+1,l[d-1][a-1]+p),d>1&&a>1&&g[d-1]===i[a-2]&&g[d-2]===i[a-1]&&(l[d][a]=Math.min(l[d][a],l[d-2][a-2]+1))}return l[g.length][i.length]}function bs(g,i){if(!i||i.length===0)return"";i=Array.from(new Set(i));let l=g.startsWith("--");l&&(g=g.slice(2),i=i.map(_=>_.slice(2)));let a=[],d=3,p=.4;return i.forEach(_=>{if(_.length<=1)return;let A=Es(g,_),b=Math.max(g.length,_.length);(b-A)/b>p&&(A<d?(d=A,a=[_]):A===d&&a.push(_))}),a.sort((_,A)=>_.localeCompare(A)),l&&(a=a.map(_=>`--${_}`)),a.length>1?`
|
|
10
|
+
(Did you mean one of ${a.join(", ")}?)`:a.length===1?`
|
|
11
|
+
(Did you mean ${a[0]}?)`:""}Jt.suggestSimilar=bs});var en=ge(Zt=>{var Cs=require("node:events").EventEmitter,Rr=require("node:child_process"),ue=require("node:path"),Vr=require("node:fs"),L=require("node:process"),{Argument:As,humanReadableArgName:ks}=nr(),{CommanderError:Wr}=Me(),{Help:$s}=xr(),{Option:Kt,DualOptions:Os}=Hr(),{suggestSimilar:Xt}=Yt(),Ur=class g extends Cs{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:l=>L.stdout.write(l),writeErr:l=>L.stderr.write(l),getOutHelpWidth:()=>L.stdout.isTTY?L.stdout.columns:void 0,getErrHelpWidth:()=>L.stderr.isTTY?L.stderr.columns:void 0,outputError:(l,a)=>a(l)},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 l=this;l;l=l.parent)i.push(l);return i}command(i,l,a){let d=l,p=a;typeof d=="object"&&d!==null&&(p=d,d=null),p=p||{};let[,_,A]=i.match(/([^ ]+) *(.*)/),b=this.createCommand(_);return d&&(b.description(d),b._executableHandler=!0),p.isDefault&&(this._defaultCommandName=b._name),b._hidden=!!(p.noHelp||p.hidden),b._executableFile=p.executableFile||null,A&&b.arguments(A),this._registerCommand(b),b.parent=this,b.copyInheritedSettings(this),d?this:b}createCommand(i){return new g(i)}createHelp(){return Object.assign(new $s,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,l){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 l=l||{},l.isDefault&&(this._defaultCommandName=i._name),(l.noHelp||l.hidden)&&(i._hidden=!0),this._registerCommand(i),i.parent=this,i._checkForBrokenPassThrough(),this}createArgument(i,l){return new As(i,l)}argument(i,l,a,d){let p=this.createArgument(i,l);return typeof a=="function"?p.default(d).argParser(a):p.default(a),this.addArgument(p),this}arguments(i){return i.trim().split(/ +/).forEach(l=>{this.argument(l)}),this}addArgument(i){let l=this.registeredArguments.slice(-1)[0];if(l&&l.variadic)throw new Error(`only the last argument can be variadic '${l.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,l){if(typeof i=="boolean")return this._addImplicitHelpCommand=i,this;i=i??"help [command]";let[,a,d]=i.match(/([^ ]+) *(.*)/),p=l??"display help for command",_=this.createCommand(a);return _.helpOption(!1),d&&_.arguments(d),p&&_.description(p),this._addImplicitHelpCommand=!0,this._helpCommand=_,this}addHelpCommand(i,l){return typeof i!="object"?(this.helpCommand(i,l),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,l){let a=["preSubcommand","preAction","postAction"];if(!a.includes(i))throw new Error(`Unexpected value for event passed to hook : '${i}'.
|
|
13
|
+
Expecting one of '${a.join("', '")}'`);return this._lifeCycleHooks[i]?this._lifeCycleHooks[i].push(l):this._lifeCycleHooks[i]=[l],this}exitOverride(i){return i?this._exitCallback=i:this._exitCallback=l=>{if(l.code!=="commander.executeSubCommandAsync")throw l},this}_exit(i,l,a){this._exitCallback&&this._exitCallback(new Wr(i,l,a)),L.exit(i)}action(i){let l=a=>{let d=this.registeredArguments.length,p=a.slice(0,d);return this._storeOptionsAsProperties?p[d]=this:p[d]=this.opts(),p.push(this),i.apply(this,p)};return this._actionHandler=l,this}createOption(i,l){return new Kt(i,l)}_callParseArg(i,l,a,d){try{return i.parseArg(l,a)}catch(p){if(p.code==="commander.invalidArgument"){let _=`${d} ${p.message}`;this.error(_,{exitCode:p.exitCode,code:p.code})}throw p}}_registerOption(i){let l=i.short&&this._findOption(i.short)||i.long&&this._findOption(i.long);if(l){let a=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 '${a}'
|
|
14
|
+
- already used by option '${l.flags}'`)}this.options.push(i)}_registerCommand(i){let l=d=>[d.name()].concat(d.aliases()),a=l(i).find(d=>this._findCommand(d));if(a){let d=l(this._findCommand(a)).join("|"),p=l(i).join("|");throw new Error(`cannot add command '${p}' as already have command '${d}'`)}this.commands.push(i)}addOption(i){this._registerOption(i);let l=i.name(),a=i.attributeName();if(i.negate){let p=i.long.replace(/^--no-/,"--");this._findOption(p)||this.setOptionValueWithSource(a,i.defaultValue===void 0?!0:i.defaultValue,"default")}else i.defaultValue!==void 0&&this.setOptionValueWithSource(a,i.defaultValue,"default");let d=(p,_,A)=>{p==null&&i.presetArg!==void 0&&(p=i.presetArg);let b=this.getOptionValue(a);p!==null&&i.parseArg?p=this._callParseArg(i,p,b,_):p!==null&&i.variadic&&(p=i._concatValue(p,b)),p==null&&(i.negate?p=!1:i.isBoolean()||i.optional?p=!0:p=""),this.setOptionValueWithSource(a,p,A)};return this.on("option:"+l,p=>{let _=`error: option '${i.flags}' argument '${p}' is invalid.`;d(p,_,"cli")}),i.envVar&&this.on("optionEnv:"+l,p=>{let _=`error: option '${i.flags}' value '${p}' from env '${i.envVar}' is invalid.`;d(p,_,"env")}),this}_optionEx(i,l,a,d,p){if(typeof l=="object"&&l instanceof Kt)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let _=this.createOption(l,a);if(_.makeOptionMandatory(!!i.mandatory),typeof d=="function")_.default(p).argParser(d);else if(d instanceof RegExp){let A=d;d=(b,k)=>{let S=A.exec(b);return S?S[0]:k},_.default(p).argParser(d)}else _.default(d);return this.addOption(_)}option(i,l,a,d){return this._optionEx({},i,l,a,d)}requiredOption(i,l,a,d){return this._optionEx({mandatory:!0},i,l,a,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,l){return this.setOptionValueWithSource(i,l,void 0)}setOptionValueWithSource(i,l,a){return this._storeOptionsAsProperties?this[i]=l:this._optionValues[i]=l,this._optionValueSources[i]=a,this}getOptionValueSource(i){return this._optionValueSources[i]}getOptionValueSourceWithGlobals(i){let l;return this._getCommandAndAncestors().forEach(a=>{a.getOptionValueSource(i)!==void 0&&(l=a.getOptionValueSource(i))}),l}_prepareUserArgs(i,l){if(i!==void 0&&!Array.isArray(i))throw new Error("first parameter to parse must be array or undefined");if(l=l||{},i===void 0&&l.from===void 0){L.versions?.electron&&(l.from="electron");let d=L.execArgv??[];(d.includes("-e")||d.includes("--eval")||d.includes("-p")||d.includes("--print"))&&(l.from="eval")}i===void 0&&(i=L.argv),this.rawArgs=i.slice();let a;switch(l.from){case void 0:case"node":this._scriptPath=i[1],a=i.slice(2);break;case"electron":L.defaultApp?(this._scriptPath=i[1],a=i.slice(2)):a=i.slice(1);break;case"user":a=i.slice(0);break;case"eval":a=i.slice(1);break;default:throw new Error(`unexpected parse option { from: '${l.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",a}parse(i,l){let a=this._prepareUserArgs(i,l);return this._parseCommand([],a),this}async parseAsync(i,l){let a=this._prepareUserArgs(i,l);return await this._parseCommand([],a),this}_executeSubCommand(i,l){l=l.slice();let a=!1,d=[".js",".ts",".tsx",".mjs",".cjs"];function p(S,F){let W=ue.resolve(S,F);if(Vr.existsSync(W))return W;if(d.includes(ue.extname(F)))return;let B=d.find(R=>Vr.existsSync(`${W}${R}`));if(B)return`${W}${B}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let _=i._executableFile||`${this._name}-${i._name}`,A=this._executableDir||"";if(this._scriptPath){let S;try{S=Vr.realpathSync(this._scriptPath)}catch{S=this._scriptPath}A=ue.resolve(ue.dirname(S),A)}if(A){let S=p(A,_);if(!S&&!i._executableFile&&this._scriptPath){let F=ue.basename(this._scriptPath,ue.extname(this._scriptPath));F!==this._name&&(S=p(A,`${F}-${i._name}`))}_=S||_}a=d.includes(ue.extname(_));let b;L.platform!=="win32"?a?(l.unshift(_),l=Qt(L.execArgv).concat(l),b=Rr.spawn(L.argv[0],l,{stdio:"inherit"})):b=Rr.spawn(_,l,{stdio:"inherit"}):(l.unshift(_),l=Qt(L.execArgv).concat(l),b=Rr.spawn(L.execPath,l,{stdio:"inherit"})),b.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(F=>{L.on(F,()=>{b.killed===!1&&b.exitCode===null&&b.kill(F)})});let k=this._exitCallback;b.on("close",S=>{S=S??1,k?k(new Wr(S,"commander.executeSubCommandAsync","(close)")):L.exit(S)}),b.on("error",S=>{if(S.code==="ENOENT"){let F=A?`searched for local subcommand relative to directory '${A}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",W=`'${_}' does not exist
|
|
15
|
+
- if '${i._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
+
- ${F}`;throw new Error(W)}else if(S.code==="EACCES")throw new Error(`'${_}' not executable`);if(!k)L.exit(1);else{let F=new Wr(1,"commander.executeSubCommandAsync","(error)");F.nestedError=S,k(F)}}),this.runningCommand=b}_dispatchSubcommand(i,l,a){let d=this._findCommand(i);d||this.help({error:!0});let p;return p=this._chainOrCallSubCommandHook(p,d,"preSubcommand"),p=this._chainOrCall(p,()=>{if(d._executableHandler)this._executeSubCommand(d,l.concat(a));else return d._parseCommand(l,a)}),p}_dispatchHelpCommand(i){i||this.help();let l=this._findCommand(i);return l&&!l._executableHandler&&l.help(),this._dispatchSubcommand(i,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((i,l)=>{i.required&&this.args[l]==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=(a,d,p)=>{let _=d;if(d!==null&&a.parseArg){let A=`error: command-argument value '${d}' is invalid for argument '${a.name()}'.`;_=this._callParseArg(a,d,p,A)}return _};this._checkNumberOfArguments();let l=[];this.registeredArguments.forEach((a,d)=>{let p=a.defaultValue;a.variadic?d<this.args.length?(p=this.args.slice(d),a.parseArg&&(p=p.reduce((_,A)=>i(a,A,_),a.defaultValue))):p===void 0&&(p=[]):d<this.args.length&&(p=this.args[d],a.parseArg&&(p=i(a,p,a.defaultValue))),l[d]=p}),this.processedArgs=l}_chainOrCall(i,l){return i&&i.then&&typeof i.then=="function"?i.then(()=>l()):l()}_chainOrCallHooks(i,l){let a=i,d=[];return this._getCommandAndAncestors().reverse().filter(p=>p._lifeCycleHooks[l]!==void 0).forEach(p=>{p._lifeCycleHooks[l].forEach(_=>{d.push({hookedCommand:p,callback:_})})}),l==="postAction"&&d.reverse(),d.forEach(p=>{a=this._chainOrCall(a,()=>p.callback(p.hookedCommand,this))}),a}_chainOrCallSubCommandHook(i,l,a){let d=i;return this._lifeCycleHooks[a]!==void 0&&this._lifeCycleHooks[a].forEach(p=>{d=this._chainOrCall(d,()=>p(this,l))}),d}_parseCommand(i,l){let a=this.parseOptions(l);if(this._parseOptionsEnv(),this._parseOptionsImplied(),i=i.concat(a.operands),l=a.unknown,this.args=i.concat(l),i&&this._findCommand(i[0]))return this._dispatchSubcommand(i[0],i.slice(1),l);if(this._getHelpCommand()&&i[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(i[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(l),this._dispatchSubcommand(this._defaultCommandName,i,l);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(a.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let d=()=>{a.unknown.length>0&&this.unknownOption(a.unknown[0])},p=`command:${this.name()}`;if(this._actionHandler){d(),this._processArguments();let _;return _=this._chainOrCallHooks(_,"preAction"),_=this._chainOrCall(_,()=>this._actionHandler(this.processedArgs)),this.parent&&(_=this._chainOrCall(_,()=>{this.parent.emit(p,i,l)})),_=this._chainOrCallHooks(_,"postAction"),_}if(this.parent&&this.parent.listenerCount(p))d(),this._processArguments(),this.parent.emit(p,i,l);else if(i.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",i,l);this.listenerCount("command:*")?this.emit("command:*",i,l):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(l=>l._name===i||l._aliases.includes(i))}_findOption(i){return this.options.find(l=>l.is(i))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(i=>{i.options.forEach(l=>{l.mandatory&&i.getOptionValue(l.attributeName())===void 0&&i.missingMandatoryOptionValue(l)})})}_checkForConflictingLocalOptions(){let i=this.options.filter(a=>{let d=a.attributeName();return this.getOptionValue(d)===void 0?!1:this.getOptionValueSource(d)!=="default"});i.filter(a=>a.conflictsWith.length>0).forEach(a=>{let d=i.find(p=>a.conflictsWith.includes(p.attributeName()));d&&this._conflictingOption(a,d)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(i=>{i._checkForConflictingLocalOptions()})}parseOptions(i){let l=[],a=[],d=l,p=i.slice();function _(b){return b.length>1&&b[0]==="-"}let A=null;for(;p.length;){let b=p.shift();if(b==="--"){d===a&&d.push(b),d.push(...p);break}if(A&&!_(b)){this.emit(`option:${A.name()}`,b);continue}if(A=null,_(b)){let k=this._findOption(b);if(k){if(k.required){let S=p.shift();S===void 0&&this.optionMissingArgument(k),this.emit(`option:${k.name()}`,S)}else if(k.optional){let S=null;p.length>0&&!_(p[0])&&(S=p.shift()),this.emit(`option:${k.name()}`,S)}else this.emit(`option:${k.name()}`);A=k.variadic?k:null;continue}}if(b.length>2&&b[0]==="-"&&b[1]!=="-"){let k=this._findOption(`-${b[1]}`);if(k){k.required||k.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${k.name()}`,b.slice(2)):(this.emit(`option:${k.name()}`),p.unshift(`-${b.slice(2)}`));continue}}if(/^--[^=]+=/.test(b)){let k=b.indexOf("="),S=this._findOption(b.slice(0,k));if(S&&(S.required||S.optional)){this.emit(`option:${S.name()}`,b.slice(k+1));continue}}if(_(b)&&(d=a),(this._enablePositionalOptions||this._passThroughOptions)&&l.length===0&&a.length===0){if(this._findCommand(b)){l.push(b),p.length>0&&a.push(...p);break}else if(this._getHelpCommand()&&b===this._getHelpCommand().name()){l.push(b),p.length>0&&l.push(...p);break}else if(this._defaultCommandName){a.push(b),p.length>0&&a.push(...p);break}}if(this._passThroughOptions){d.push(b),p.length>0&&d.push(...p);break}d.push(b)}return{operands:l,unknown:a}}opts(){if(this._storeOptionsAsProperties){let i={},l=this.options.length;for(let a=0;a<l;a++){let d=this.options[a].attributeName();i[d]=d===this._versionOptionName?this._version:this[d]}return i}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((i,l)=>Object.assign(i,l.opts()),{})}error(i,l){this._outputConfiguration.outputError(`${i}
|
|
18
|
+
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
19
|
+
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
20
|
+
`),this.outputHelp({error:!0}));let a=l||{},d=a.exitCode||1,p=a.code||"commander.error";this._exit(d,p,i)}_parseOptionsEnv(){this.options.forEach(i=>{if(i.envVar&&i.envVar in L.env){let l=i.attributeName();(this.getOptionValue(l)===void 0||["default","config","env"].includes(this.getOptionValueSource(l)))&&(i.required||i.optional?this.emit(`optionEnv:${i.name()}`,L.env[i.envVar]):this.emit(`optionEnv:${i.name()}`))}})}_parseOptionsImplied(){let i=new Os(this.options),l=a=>this.getOptionValue(a)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(a));this.options.filter(a=>a.implied!==void 0&&l(a.attributeName())&&i.valueFromOption(this.getOptionValue(a.attributeName()),a)).forEach(a=>{Object.keys(a.implied).filter(d=>!l(d)).forEach(d=>{this.setOptionValueWithSource(d,a.implied[d],"implied")})})}missingArgument(i){let l=`error: missing required argument '${i}'`;this.error(l,{code:"commander.missingArgument"})}optionMissingArgument(i){let l=`error: option '${i.flags}' argument missing`;this.error(l,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(i){let l=`error: required option '${i.flags}' not specified`;this.error(l,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(i,l){let a=_=>{let A=_.attributeName(),b=this.getOptionValue(A),k=this.options.find(F=>F.negate&&A===F.attributeName()),S=this.options.find(F=>!F.negate&&A===F.attributeName());return k&&(k.presetArg===void 0&&b===!1||k.presetArg!==void 0&&b===k.presetArg)?k:S||_},d=_=>{let A=a(_),b=A.attributeName();return this.getOptionValueSource(b)==="env"?`environment variable '${A.envVar}'`:`option '${A.flags}'`},p=`error: ${d(i)} cannot be used with ${d(l)}`;this.error(p,{code:"commander.conflictingOption"})}unknownOption(i){if(this._allowUnknownOption)return;let l="";if(i.startsWith("--")&&this._showSuggestionAfterError){let d=[],p=this;do{let _=p.createHelp().visibleOptions(p).filter(A=>A.long).map(A=>A.long);d=d.concat(_),p=p.parent}while(p&&!p._enablePositionalOptions);l=Xt(i,d)}let a=`error: unknown option '${i}'${l}`;this.error(a,{code:"commander.unknownOption"})}_excessArguments(i){if(this._allowExcessArguments)return;let l=this.registeredArguments.length,a=l===1?"":"s",p=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${l} argument${a} but got ${i.length}.`;this.error(p,{code:"commander.excessArguments"})}unknownCommand(){let i=this.args[0],l="";if(this._showSuggestionAfterError){let d=[];this.createHelp().visibleCommands(this).forEach(p=>{d.push(p.name()),p.alias()&&d.push(p.alias())}),l=Xt(i,d)}let a=`error: unknown command '${i}'${l}`;this.error(a,{code:"commander.unknownCommand"})}version(i,l,a){if(i===void 0)return this._version;this._version=i,l=l||"-V, --version",a=a||"output the version number";let d=this.createOption(l,a);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,l){return i===void 0&&l===void 0?this._description:(this._description=i,l&&(this._argsDescription=l),this)}summary(i){return i===void 0?this._summary:(this._summary=i,this)}alias(i){if(i===void 0)return this._aliases[0];let l=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(l=this.commands[this.commands.length-1]),i===l._name)throw new Error("Command alias can't be the same as its name");let a=this.parent?._findCommand(i);if(a){let d=[a.name()].concat(a.aliases()).join("|");throw new Error(`cannot add alias '${i}' to command '${this.name()}' as already have command '${d}'`)}return l._aliases.push(i),this}aliases(i){return i===void 0?this._aliases:(i.forEach(l=>this.alias(l)),this)}usage(i){if(i===void 0){if(this._usage)return this._usage;let l=this.registeredArguments.map(a=>ks(a));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?l:[]).join(" ")}return this._usage=i,this}name(i){return i===void 0?this._name:(this._name=i,this)}nameFromFilename(i){return this._name=ue.basename(i,ue.extname(i)),this}executableDir(i){return i===void 0?this._executableDir:(this._executableDir=i,this)}helpInformation(i){let l=this.createHelp();return l.helpWidth===void 0&&(l.helpWidth=i&&i.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),l.formatHelp(this,l)}_getHelpContext(i){i=i||{};let l={error:!!i.error},a;return l.error?a=d=>this._outputConfiguration.writeErr(d):a=d=>this._outputConfiguration.writeOut(d),l.write=i.write||a,l.command=this,l}outputHelp(i){let l;typeof i=="function"&&(l=i,i=void 0);let a=this._getHelpContext(i);this._getCommandAndAncestors().reverse().forEach(p=>p.emit("beforeAllHelp",a)),this.emit("beforeHelp",a);let d=this.helpInformation(a);if(l&&(d=l(d),typeof d!="string"&&!Buffer.isBuffer(d)))throw new Error("outputHelp callback must return a string or a Buffer");a.write(d),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",a),this._getCommandAndAncestors().forEach(p=>p.emit("afterAllHelp",a))}helpOption(i,l){return typeof i=="boolean"?(i?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(i=i??"-h, --help",l=l??"display help for command",this._helpOption=this.createOption(i,l),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 l=L.exitCode||0;l===0&&i&&typeof i!="function"&&i.error&&(l=1),this._exit(l,"commander.help","(outputHelp)")}addHelpText(i,l){let a=["beforeAll","before","after","afterAll"];if(!a.includes(i))throw new Error(`Unexpected value for position to addHelpText.
|
|
22
|
+
Expecting one of '${a.join("', '")}'`);let d=`${i}Help`;return this.on(d,p=>{let _;typeof l=="function"?_=l({error:p.error,command:p.command}):_=l,_&&p.write(`${_}
|
|
23
|
+
`)}),this}_outputHelpIfRequested(i){let l=this._getHelpOption();l&&i.find(d=>l.is(d))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Qt(g){return g.map(i=>{if(!i.startsWith("--inspect"))return i;let l,a="127.0.0.1",d="9229",p;return(p=i.match(/^(--inspect(-brk)?)$/))!==null?l=p[1]:(p=i.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(l=p[1],/^\d+$/.test(p[3])?d=p[3]:a=p[3]):(p=i.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(l=p[1],a=p[3],d=p[4]),l&&d!=="0"?`${l}=${a}:${parseInt(d)+1}`:i})}Zt.Command=Ur});var on=ge(re=>{var{Argument:rn}=nr(),{Command:Ir}=en(),{CommanderError:Ss,InvalidArgumentError:tn}=Me(),{Help:Ps}=xr(),{Option:nn}=Hr();re.program=new Ir;re.createCommand=g=>new Ir(g);re.createOption=(g,i)=>new nn(g,i);re.createArgument=(g,i)=>new rn(g,i);re.Command=Ir;re.Option=nn;re.Argument=rn;re.Help=Ps;re.CommanderError=Ss;re.InvalidArgumentError=tn;re.InvalidOptionArgumentError=tn});var Nr=Ar(require("fs")),ln=require("path");function kr(g,i){if(!g)throw new Error(i);return g}function Ht(g){return kr(g),g}function Rt(g){throw new Error("Should not be reachable")}var Vt=async(g,i)=>{let l={instantiateWasm:async(a,d)=>{switch(g.type){case"response":{let p=await WebAssembly.instantiateStreaming(g.response,a);d(p.instance,p.module)}break;case"buffer":{let p=await WebAssembly.instantiate(await g.buffer,a);d(p.instance,p.module)}break;default:Rt(g)}}};return Ht(await(await i)(l))};var us=new TextEncoder,$r=g=>us.encode(g),cs=new TextDecoder,Wt=g=>cs.decode(g);var fs=!1,ds=g=>{if(typeof g=="string")return $r(g);if(g instanceof Uint8Array)return g;if(g instanceof Object)return $r(JSON.stringify(g));throw new Error("unsupported type")},Ut=g=>{let i=new g.DocumentEngine.create;return{exec:(p,..._)=>(()=>{let{error:b,values:k}=(()=>{let F=new g.MemoryHandleVector;try{for(let W of _){let B=ds(W),R=g.allocateMemory(B.byteLength);try{kr(R.size===B.byteLength),R.view.set(B),F.push_back(R)}finally{R.delete()}}try{return i.exec(p,F)}catch(W){throw console.error("exception while calling exec",p,W),W}}finally{F.delete()}})();if(b)throw k.delete(),fs&&console.error("WASM request",p,_,"yielded error",b),b;let S=[];for(let F=0;F<k.size();++F){let W=k.get(F);S.push(W.view.slice()),W.delete()}return k.delete(),S})(),destroy:()=>{i.delete()}}};var Ce=Ar(require("fs")),Lt=require("path");var It=g=>JSON.parse(Wt(g));var Nt=(g,i,l)=>{let{wasmExecutor:a}=g;return It(a.exec("fonts/index",{id:l},i)[0])},Bt=g=>({v:1,availableFonts:g});var hs=[".ttf",".otf",".ttc",".otc"],qt=(g,i)=>{let l=[];return Ce.readdirSync(i).forEach(a=>{let d=(0,Lt.resolve)(i,a);if(!Ce.statSync(d).isFile()||hs.every(A=>!a.toLowerCase().endsWith(A)))return;let p=(()=>{try{return new Uint8Array(Ce.readFileSync(d))}catch{throw new Error(`Error processing file '${a}'.`)}})(),_=Nt(g,p,a);l=l.concat(_)}),l};var ps=(()=>{var g=typeof document<"u"?document.currentScript?.src:void 0;return function(i={}){var l,a=i,d,p,_=new Promise((e,r)=>{d=e,p=r}),A=!0,b=!1,k=Object.assign({},a),S=[],F="./this.program",W=(e,r)=>{throw r},B="";function R(e){return a.locateFile?a.locateFile(e,B):B+e}var Q,de;(A||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=e=>fetch(e,{credentials:"same-origin"}).then(r=>r.ok?r.arrayBuffer():Promise.reject(new Error(r.status+" : "+r.url))));var ir=a.print||console.log.bind(console),ce=a.printErr||console.error.bind(console);Object.assign(a,k),k=null,a.arguments&&(S=a.arguments),a.thisProgram&&(F=a.thisProgram),a.quit&&(W=a.quit);var Ae;a.wasmBinary&&(Ae=a.wasmBinary);var je,or=!1,He,K,Y,te,Re,C,M,Lr,qr;function zr(){var e=je.buffer;a.HEAP8=K=new Int8Array(e),a.HEAP16=te=new Int16Array(e),a.HEAPU8=Y=new Uint8Array(e),a.HEAPU16=Re=new Uint16Array(e),a.HEAP32=C=new Int32Array(e),a.HEAPU32=M=new Uint32Array(e),a.HEAPF32=Lr=new Float32Array(e),a.HEAPF64=qr=new Float64Array(e)}var Gr=[],Jr=[],un=[],Yr=[],Kr=!1;function cn(){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;)pn(a.preRun.shift());Ie(Gr)}function fn(){Kr=!0,!a.noFSInit&&!s.init.initialized&&s.init(),s.ignorePermissions=!1,fe.init(),Ie(Jr)}function dn(){Ie(un)}function hn(){if(a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;)vn(a.postRun.shift());Ie(Yr)}function pn(e){Gr.unshift(e)}function mn(e){Jr.unshift(e)}function vn(e){Yr.unshift(e)}var he=0,sr=null,ke=null;function Ds(e){return e}function ar(e){he++,a.monitorRunDependencies?.(he)}function Ve(e){if(he--,a.monitorRunDependencies?.(he),he==0&&(sr!==null&&(clearInterval(sr),sr=null),ke)){var r=ke;ke=null,r()}}function We(e){a.onAbort?.(e),e="Aborted("+e+")",ce(e),or=!0,He=1,e+=". Build with -sASSERTIONS for more info.",Kr&&Ft();var r=new WebAssembly.RuntimeError(e);throw p(r),r}var gn="data:application/octet-stream;base64,",Xr=e=>e.startsWith(gn);function _n(){var e="docauth.wasm";return Xr(e)?e:R(e)}var Ue;function Qr(e){if(e==Ue&&Ae)return new Uint8Array(Ae);if(de)return de(e);throw"both async and sync fetching of the wasm failed"}function yn(e){return Ae?Promise.resolve().then(()=>Qr(e)):Q(e).then(r=>new Uint8Array(r),()=>Qr(e))}function Zr(e,r,t){return yn(e).then(n=>WebAssembly.instantiate(n,r)).then(t,n=>{ce(`failed to asynchronously prepare wasm: ${n}`),We(n)})}function wn(e,r,t,n){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Xr(r)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(o=>{var u=WebAssembly.instantiateStreaming(o,t);return u.then(n,function(c){return ce(`wasm streaming compile failed: ${c}`),ce("falling back to ArrayBuffer instantiation"),Zr(r,t,n)})}):Zr(r,t,n)}function En(){return{a:Wo}}function bn(){var e=En();function r(n,o){return j=n.exports,je=j.fa,zr(),pt=j.la,mn(j.ga),Ve("wasm-instantiate"),j}ar("wasm-instantiate");function t(n){r(n.instance)}if(a.instantiateWasm)try{return a.instantiateWasm(e,r)}catch(n){ce(`Module.instantiateWasm callback failed with error: ${n}`),p(n)}return Ue||(Ue=_n()),wn(Ae,Ue,e,t).catch(p),{}}var O,U;function et(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var Ie=e=>{for(;e.length>0;)e.shift()(a)},Cn=a.noExitRuntime||!0,V={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=V.isAbs(e),t=e.substr(-1)==="/";return e=V.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=V.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=V.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:(...e)=>V.normalize(e.join("/")),join2:(e,r)=>V.normalize(e+"/"+r)},An=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);We("initRandomDevice")},rt=e=>(rt=An())(e),ne={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=V.isAbs(o)}return r=V.normalizeArray(r.split("/").filter(u=>!!u),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=ne.resolve(e).substr(1),r=ne.resolve(r).substr(1);function t(m){for(var v=0;v<m.length&&m[v]==="";v++);for(var y=m.length-1;y>=0&&m[y]==="";y--);return v>y?[]:m.slice(v,y-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 h=[],f=c;f<n.length;f++)h.push("..");return h=h.concat(o.slice(c)),h.join("/")}},tt=typeof TextDecoder<"u"?new TextDecoder:void 0,_e=(e,r,t)=>{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&tt)return tt.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 h=e[r++]&63;if((c&240)==224?c=(c&15)<<12|f<<6|h:c=(c&7)<<18|f<<12|h<<6|e[r++]&63,c<65536)u+=String.fromCharCode(c);else{var m=c-65536;u+=String.fromCharCode(55296|m>>10,56320|m&1023)}}return u},lr=[],Ne=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},ur=(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 h=e.charCodeAt(++c);f=65536+((f&1023)<<10)|h&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 nt(e,r,t){var n=t>0?t:Ne(e)+1,o=new Array(n),u=ur(e,o,0,o.length);return r&&(o.length=u),o}var kn=()=>{if(!lr.length){var e=null;if(typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
24
|
+
`)),!e)return null;lr=nt(e,!0)}return lr.shift()},fe={ttys:[],init(){},shutdown(){},register(e,r){fe.ttys[e]={input:[],output:[],ops:r},s.registerDevice(e,fe.stream_ops)},stream_ops:{open(e){var r=fe.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.timestamp=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.timestamp=Date.now()),u}},default_tty_ops:{get_char(e){return kn()},put_char(e,r){r===null||r===10?(ir(_e(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(ir(_e(e.output,0)),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?(ce(_e(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(ce(_e(e.output,0)),e.output=[])}}},$n=(e,r)=>(Y.fill(0,e,e+r),e),On=(e,r)=>Math.ceil(e/r)*r,it=e=>{e=On(e,65536);var r=Pt(65536,e);return r?$n(r,e):0},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.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),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.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){r.mode!==void 0&&(e.mode=r.mode),r.timestamp!==void 0&&(e.timestamp=r.timestamp),r.size!==void 0&&P.resizeFileStorage(e,r.size)},lookup(e,r){throw s.genericErrors[44]},mknod(e,r,t,n){return P.createNode(e,r,t,n)},rename(e,r,t){if(s.isDir(e.mode)){var n;try{n=s.lookupNode(r,t)}catch{}if(n)for(var o in n.contents)throw new s.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp},unlink(e,r){delete e.contents[r],e.timestamp=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.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},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.timestamp=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.buffer===K.buffer)c=!1,u=f.byteOffset;else{if((t>0||t+r<f.length)&&(f.subarray?f=f.subarray(t,t+r):f=Array.prototype.slice.call(f,t,t+r)),c=!0,u=it(r),!u)throw new s.ErrnoError(48);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}}},Sn=(e,r,t,n)=>{var o=n?"":`al ${e}`;Q(e).then(u=>{r(new Uint8Array(u)),o&&Ve(o)},u=>{if(t)t();else throw`Loading data file "${e}" failed.`}),o&&ar(o)},Pn=(e,r,t,n,o,u)=>{s.createDataFile(e,r,t,n,o,u)},Fn=a.preloadPlugins||[],Tn=(e,r,t,n)=>{typeof Browser<"u"&&Browser.init();var o=!1;return Fn.forEach(u=>{o||u.canHandle(r)&&(u.handle(e,r,t,n),o=!0)}),o},xn=(e,r,t,n,o,u,c,f,h,m)=>{var v=r?ne.resolve(V.join2(e,r)):e,y=`cp ${v}`;function w(E){function $(D){m?.(),f||Pn(e,r,D,n,o,h),u?.(),Ve(y)}Tn(E,v,$,()=>{c?.(),Ve(y)})||$(E)}ar(y),typeof t=="string"?Sn(t,w,c):w(t)},Dn=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},cr=(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{constructor(e){this.name="ErrnoError",this.errno=e}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.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{constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=s.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n,this.readMode=365,this.writeMode=146}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=ne.resolve(e),!e)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(r=Object.assign(t,r),r.recurse_count>8)throw new s.ErrnoError(32);for(var n=e.split("/").filter(y=>!!y),o=s.root,u="/",c=0;c<n.length;c++){var f=c===n.length-1;if(f&&r.parent)break;if(o=s.lookupNode(o,n[c]),u=V.join2(u,n[c]),s.isMountpoint(o)&&(!f||f&&r.follow_mount)&&(o=o.mounted.root),!f||r.follow)for(var h=0;s.isLink(o.mode);){var m=s.readlink(u);u=ne.resolve(V.dirname(u),m);var v=s.lookupPath(u,{recurse_count:r.recurse_count+1});if(o=v.node,h++>40)throw new s.ErrnoError(32)}}return{path:u,node:o}},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){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&&ce(`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:[]},h=e.mount(f);return h.mount=f,f.root=h,n?s.root=h:u&&(u.mounted=f,u.mount&&u.mount.mounts.push(f)),h},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 h=f.name_next;o.includes(f.mount)&&s.destroyNode(f),f=h}}),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=V.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)},create(e,r){return r=r!==void 0?r:438,r&=4095,r|=32768,s.mknod(e,r,0)},mkdir(e,r){return r=r!==void 0?r:511,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(!ne.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=V.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=V.dirname(e),n=V.dirname(r),o=V.basename(e),u=V.basename(r),c,f,h;if(c=s.lookupPath(e,{parent:!0}),f=c.node,c=s.lookupPath(r,{parent:!0}),h=c.node,!f||!h)throw new s.ErrnoError(44);if(f.mount!==h.mount)throw new s.ErrnoError(75);var m=s.lookupNode(f,o),v=ne.relative(e,n);if(v.charAt(0)!==".")throw new s.ErrnoError(28);if(v=ne.relative(r,t),v.charAt(0)!==".")throw new s.ErrnoError(55);var y;try{y=s.lookupNode(h,u)}catch{}if(m!==y){var w=s.isDir(m.mode),E=s.mayDelete(f,o,w);if(E)throw new s.ErrnoError(E);if(E=y?s.mayDelete(h,u,w):s.mayCreate(h,u),E)throw new s.ErrnoError(E);if(!f.node_ops.rename)throw new s.ErrnoError(63);if(s.isMountpoint(m)||y&&s.isMountpoint(y))throw new s.ErrnoError(10);if(h!==f&&(E=s.nodePermissions(f,"w"),E))throw new s.ErrnoError(E);s.hashRemoveNode(m);try{f.node_ops.rename(m,h,u),m.parent=h}catch($){throw $}finally{s.hashAddNode(m)}}},rmdir(e){var r=s.lookupPath(e,{parent:!0}),t=r.node,n=V.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=V.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 ne.resolve(s.getPath(t.parent),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,timestamp: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,{timestamp:Math.max(r,t)})},open(e,r,t){if(e==="")throw new s.ErrnoError(44);r=typeof r=="string"?Dn(r):r,r&64?(t=typeof t>"u"?438:t,t=t&4095|32768):t=0;var n;if(typeof e=="object")n=e;else{e=V.normalize(e);try{var o=s.lookupPath(e,{follow:!(r&131072)});n=o.node}catch{}}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),a.logReadFiles&&!(r&1)&&(s.readFiles||(s.readFiles={}),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);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=_e(c,0):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(Ne(r)+1),u=ur(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}),s.mkdev("/dev/null",s.makedev(1,3)),fe.register(s.makedev(5,0),fe.default_tty_ops),fe.register(s.makedev(6,0),fe.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=rt(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.node_ops={lookup(t,n){var o=+n,u=s.getStreamChecked(o),c={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>u.path}};return c.parent=c,c}},r}},{},"/proc/self/fd")},createStandardStreams(){a.stdin?s.createDevice("/dev","stdin",a.stdin):s.symlink("/dev/tty","/dev/stdin"),a.stdout?s.createDevice("/dev","stdout",null,a.stdout):s.symlink("/dev/tty","/dev/stdout"),a.stderr?s.createDevice("/dev","stderr",null,a.stderr):s.symlink("/dev/tty1","/dev/stderr");var e=s.open("/dev/stdin",0),r=s.open("/dev/stdout",1),t=s.open("/dev/stderr",1)},staticInit(){[44].forEach(e=>{s.genericErrors[e]=new s.ErrnoError(e),s.genericErrors[e].stack="<generic error, no stack>"}),s.nameTable=new Array(4096),s.mount(P,{},"/"),s.createDefaultDirectories(),s.createDefaultDevices(),s.createSpecialDirectories(),s.filesystems={MEMFS:P}},init(e,r,t){s.init.initialized=!0,a.stdin=e||a.stdin,a.stdout=r||a.stdout,a.stderr=t||a.stderr,s.createStandardStreams()},quit(){s.init.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=V.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=V.join2(e,u);try{s.mkdir(c)}catch{}e=c}}return c},createFile(e,r,t,n,o){var u=V.join2(typeof e=="string"?e:s.getPath(e),r),c=cr(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?V.join2(e,r):e);var f=cr(n,o),h=s.create(c,f);if(t){if(typeof t=="string"){for(var m=new Array(t.length),v=0,y=t.length;v<y;++v)m[v]=t.charCodeAt(v);t=m}s.chmod(h,f|146);var w=s.open(h,577);s.write(w,t,0,t.length,0,u),s.close(w),s.chmod(h,f)}},createDevice(e,r,t,n){var o=V.join2(typeof e=="string"?e:s.getPath(e),r),u=cr(!!t,!!n);s.createDevice.major||(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,h,m,v,y){for(var w=0,E=0;E<v;E++){var $;try{$=t()}catch{throw new s.ErrnoError(29)}if($===void 0&&w===0)throw new s.ErrnoError(6);if($==null)break;w++,h[m+E]=$}return w&&(f.node.timestamp=Date.now()),w},write(f,h,m,v,y){for(var w=0;w<v;w++)try{n(h[m+w])}catch{throw new s.ErrnoError(29)}return v&&(f.node.timestamp=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=de(e.url),e.usedBytes=e.contents.length}catch{throw new s.ErrnoError(29)}},createLazyFile(e,r,t,n,o){class u{constructor(){this.lengthKnown=!1,this.chunks=[]}get(E){if(!(E>this.length-1||E<0)){var $=E%this.chunkSize,D=E/this.chunkSize|0;return this.getter(D)[$]}}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 $=Number(E.getResponseHeader("Content-length")),D,I=(D=E.getResponseHeader("Accept-Ranges"))&&D==="bytes",N=(D=E.getResponseHeader("Content-Encoding"))&&D==="gzip",z=1024*1024;I||(z=$);var H=(X,le)=>{if(X>le)throw new Error("invalid range ("+X+", "+le+") or no bytes requested!");if(le>$-1)throw new Error("only "+$+" bytes available! programmer error!");var q=new XMLHttpRequest;if(q.open("GET",t,!1),$!==z&&q.setRequestHeader("Range","bytes="+X+"-"+le),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||[]):nt(q.responseText||"",!0)},ve=this;ve.setDataGetter(X=>{var le=X*z,q=(X+1)*z-1;if(q=Math.min(q,$-1),typeof ve.chunks[X]>"u"&&(ve.chunks[X]=H(le,q)),typeof ve.chunks[X]>"u")throw new Error("doXHR failed!");return ve.chunks[X]}),(N||!$)&&(z=$=1,$=this.getter(0).length,z=$,ir("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=$,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 h=s.createFile(e,r,f,n,o);f.contents?h.contents=f.contents:f.url&&(h.contents=null,h.url=f.url),Object.defineProperties(h,{usedBytes:{get:function(){return this.contents.length}}});var m={},v=Object.keys(h.stream_ops);v.forEach(w=>{var E=h.stream_ops[w];m[w]=(...$)=>(s.forceLoadFile(h),E(...$))});function y(w,E,$,D,I){var N=w.node.contents;if(I>=N.length)return 0;var z=Math.min(N.length-I,D);if(N.slice)for(var H=0;H<z;H++)E[$+H]=N[I+H];else for(var H=0;H<z;H++)E[$+H]=N.get(I+H);return z}return m.read=(w,E,$,D,I)=>(s.forceLoadFile(h),y(w,E,$,D,I)),m.mmap=(w,E,$,D,I)=>{s.forceLoadFile(h);var N=it(E);if(!N)throw new s.ErrnoError(48);return y(w,K,N,E,$),{ptr:N,allocated:!0}},h.stream_ops=m,h}},ot=(e,r)=>e?_e(Y,e,r):"",T={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(V.isAbs(r))return r;var n;if(e===-100)n=s.cwd();else{var o=T.getStreamFromFD(e);n=o.path}if(r.length==0){if(!t)throw new s.ErrnoError(44);return n}return V.join2(n,r)},doStat(e,r,t){var n=e(r);C[t>>2]=n.dev,C[t+4>>2]=n.mode,M[t+8>>2]=n.nlink,C[t+12>>2]=n.uid,C[t+16>>2]=n.gid,C[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)],C[t+24>>2]=U[0],C[t+28>>2]=U[1],C[t+32>>2]=4096,C[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)],C[t+40>>2]=U[0],C[t+44>>2]=U[1],M[t+48>>2]=o%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)],C[t+56>>2]=U[0],C[t+60>>2]=U[1],M[t+64>>2]=u%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)],C[t+72>>2]=U[0],C[t+76>>2]=U[1],M[t+80>>2]=c%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)],C[t+88>>2]=U[0],C[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=ot(e);return r}};function Mn(e,r,t,n){try{if(r=T.getStr(r),r=T.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}}function Be(){var e=C[+T.varargs>>2];return T.varargs+=4,e}var ye=Be;function jn(e,r,t){T.varargs=t;try{var n=T.getStreamFromFD(e);switch(r){case 0:{var o=Be();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=Be();return n.flags|=o,0}case 12:{var o=ye(),c=0;return te[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 Hn(e,r){try{var t=T.getStreamFromFD(e);return T.doStat(s.stat,t.path,r)}catch(n){if(typeof s>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var we=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN;function Rn(e,r,t){var n=we(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 fr=(e,r,t)=>ur(e,Y,r,t);function Vn(e,r,t){try{var n=T.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);f<n.getdents.length&&u+o<=t;){var h,m,v=n.getdents[f];if(v===".")h=n.node.id,m=4;else if(v===".."){var y=s.lookupPath(n.path,{parent:!0});h=y.node.id,m=4}else{var w=s.lookupNode(n.node,v);h=w.id,m=s.isChrdev(w.mode)?2:s.isDir(w.mode)?4:s.isLink(w.mode)?10:8}U=[h>>>0,(O=h,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],C[r+u>>2]=U[0],C[r+u+4>>2]=U[1],U=[(f+1)*o>>>0,(O=(f+1)*o,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],C[r+u+8>>2]=U[0],C[r+u+12>>2]=U[1],te[r+u+16>>1]=280,K[r+u+18]=m,fr(v,r+u+19,256),u+=o,f+=1}return s.llseek(n,f*o,0),u}catch(E){if(typeof s>"u"||E.name!=="ErrnoError")throw E;return-E.errno}}function Wn(e,r,t){T.varargs=t;try{var n=T.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=ye();C[u>>2]=o.c_iflag||0,C[u+4>>2]=o.c_oflag||0,C[u+8>>2]=o.c_cflag||0,C[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=ye(),f=C[u>>2],h=C[u+4>>2],m=C[u+8>>2],v=C[u+12>>2],y=[],c=0;c<32;c++)y.push(K[u+c+17]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:f,c_oflag:h,c_cflag:m,c_lflag:v,c_cc:y})}return 0}case 21519:{if(!n.tty)return-59;var u=ye();return C[u>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var u=ye();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=ye();te[u>>1]=w[0],te[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 Un(e,r){try{return e=T.getStr(e),T.doStat(s.lstat,e,r)}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function In(e,r,t,n){try{r=T.getStr(r);var o=n&256,u=n&4096;return n=n&-6401,r=T.calculateAt(e,r,u),T.doStat(o?s.lstat:s.stat,r,t)}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function Nn(e,r,t,n){T.varargs=n;try{r=T.getStr(r),r=T.calculateAt(e,r);var o=n?Be():0;return s.open(r,t,o).fd}catch(u){if(typeof s>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Bn(e,r,t,n){try{return r=T.getStr(r),n=T.getStr(n),r=T.calculateAt(e,r),n=T.calculateAt(t,n),s.rename(r,n),0}catch(o){if(typeof s>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Ln(e){try{return e=T.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=T.getStr(e),T.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=T.getStr(r),r=T.calculateAt(e,r),t===0?s.unlink(r):t===512?s.rmdir(r):We("Invalid flags passed to unlinkat"),0}catch(n){if(typeof s>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var Gn=()=>{We("")},Le={},qe=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function $e(e){return this.fromWireType(M[e>>2])}var Ee={},pe={},ze={},st,Ge=e=>{throw new st(e)},Z=(e,r,t)=>{e.forEach(function(f){ze[f]=r});function n(f){var h=t(f);h.length!==e.length&&Ge("Mismatched type converter count");for(var m=0;m<e.length;++m)ie(e[m],h[m])}var o=new Array(r.length),u=[],c=0;r.forEach((f,h)=>{pe.hasOwnProperty(f)?o[h]=pe[f]:(u.push(f),Ee.hasOwnProperty(f)||(Ee[f]=[]),Ee[f].push(()=>{o[h]=pe[f],++c,c===u.length&&n(o)}))}),u.length===0&&n(o)},Jn=e=>{var r=Le[e];delete Le[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((h,m)=>{var v=h.fieldName,y=c[m],w=h.getter,E=h.getterContext,$=c[m+o.length],D=h.setter,I=h.setterContext;f[v]={read:N=>y.fromWireType(w(E,N)),write:(N,z)=>{var H=[];D(I,N,$.toWireType(H,z)),qe(H)}}}),[{name:r.name,fromWireType:h=>{var m={};for(var v in f)m[v]=f[v].read(h);return n(h),m},toWireType:(h,m)=>{for(var v in f)if(!(v in m))throw new TypeError(`Missing field: "${v}"`);var y=t();for(v in f)f[v].write(y,m[v]);return h!==null&&h.push(n,y),y},argPackAdvance:oe,readValueFromPointer:$e,destructorFunction:n}]})},Yn=(e,r,t,n,o)=>{},Kn=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);at=e},at,G=e=>{for(var r="",t=e;Y[t];)r+=at[Y[t++]];return r},be,x=e=>{throw new be(e)};function Xn(e,r,t={}){var n=r.name;if(e||x(`type "${n}" must have a positive integer typeid pointer`),pe.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;x(`Cannot register type '${n}' twice`)}if(pe[e]=r,delete ze[e],Ee.hasOwnProperty(e)){var o=Ee[e];delete Ee[e],o.forEach(u=>u())}}function ie(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");return Xn(e,r,t)}var oe=8,Qn=(e,r,t,n)=>{r=G(r),ie(e,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,u){return u?t:n},argPackAdvance:oe,readValueFromPointer:function(o){return this.fromWireType(Y[o])},destructorFunction:null})},Zn=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),dr=e=>{function r(t){return t.$$.ptrType.registeredClass.name}x(r(e)+" instance already deleted")},hr=!1,lt=e=>{},ei=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},ut=e=>{e.count.value-=1;var r=e.count.value===0;r&&ei(e)},ct=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=ct(e,r,t.baseClass);return n===null?null:t.downcast(n)},ft={},ri=()=>Object.keys(Pe).length,ti=()=>{var e=[];for(var r in Pe)Pe.hasOwnProperty(r)&&e.push(Pe[r]);return e},Oe=[],pr=()=>{for(;Oe.length;){var e=Oe.pop();e.$$.deleteScheduled=!1,e.delete()}},Se,ni=e=>{Se=e,Oe.length&&Se&&Se(pr)},ii=()=>{a.getInheritedInstanceCount=ri,a.getLiveInheritedInstances=ti,a.flushPendingDeletes=pr,a.setDelayFunction=ni},Pe={},oi=(e,r)=>{for(r===void 0&&x("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},si=(e,r)=>(r=oi(e,r),Pe[r]),Je=(e,r)=>{(!r.ptrType||!r.ptr)&&Ge("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Ge("Both smartPtrType and smartPtr must be specified"),r.count={value:1},Fe(Object.create(e,{$$:{value:r,writable:!0}}))};function ai(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=si(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?Je(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):Je(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),c=ft[u];if(!c)return o.call(this);var f;this.isConst?f=c.constPointerType:f=c.pointerType;var h=ct(r,this.registeredClass,f.registeredClass);return h===null?o.call(this):this.isSmartPointer?Je(f.registeredClass.instancePrototype,{ptrType:f,ptr:h,smartPtrType:this,smartPtr:e}):Je(f.registeredClass.instancePrototype,{ptrType:f,ptr:h})}var Fe=e=>typeof FinalizationRegistry>"u"?(Fe=r=>r,e):(hr=new FinalizationRegistry(r=>{ut(r.$$)}),Fe=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var o={$$:t};hr.register(r,o,r)}return r},lt=r=>hr.unregister(r),Fe(e)),li=()=>{Object.assign(Ye.prototype,{isAliasOf(e){if(!(this instanceof Ye)||!(e instanceof Ye))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||dr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Fe(Object.create(Object.getPrototypeOf(this),{$$:{value:Zn(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||dr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&x("Object already scheduled for deletion"),lt(this),ut(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||dr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&x("Object already scheduled for deletion"),Oe.push(this),Oe.length===1&&Se&&Se(pr),this.$$.deleteScheduled=!0,this}})};function Ye(){}var Te=(e,r)=>Object.defineProperty(r,"name",{value:e}),mr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...o){return e[r].overloadTable.hasOwnProperty(o.length)||x(`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)=>{a.hasOwnProperty(e)?((t===void 0||a[e].overloadTable!==void 0&&a[e].overloadTable[t]!==void 0)&&x(`Cannot register public name '${e}' twice`),mr(a,e,e),a.hasOwnProperty(t)&&x(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),a[e].overloadTable[t]=r):(a[e]=r,t!==void 0&&(a[e].numArguments=t))},ui=48,ci=57,fi=e=>{if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=ui&&r<=ci?`_${e}`:e};function di(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 Ke=(e,r,t)=>{for(;r!==t;)r.upcast||x(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function hi(e,r){if(r===null)return this.isReference&&x(`null is not a valid ${this.name}`),0;r.$$||x(`Cannot pass "${yr(r)}" as a ${this.name}`),r.$$.ptr||x(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Ke(r.$$.ptr,t,this.registeredClass);return n}function pi(e,r){var t;if(r===null)return this.isReference&&x(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&x(`Cannot pass "${yr(r)}" as a ${this.name}`),r.$$.ptr||x(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&x(`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=Ke(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&x("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:x(`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:x("Unsupporting sharing policy")}return t}function mi(e,r){if(r===null)return this.isReference&&x(`null is not a valid ${this.name}`),0;r.$$||x(`Cannot pass "${yr(r)}" as a ${this.name}`),r.$$.ptr||x(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&x(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Ke(r.$$.ptr,t,this.registeredClass);return n}var vi=()=>{Object.assign(xe.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:oe,readValueFromPointer:$e,fromWireType:ai})};function xe(e,r,t,n,o,u,c,f,h,m,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=h,this.rawShare=m,this.rawDestructor=v,!o&&r.baseClass===void 0?n?(this.toWireType=hi,this.destructorFunction=null):(this.toWireType=mi,this.destructorFunction=null):this.toWireType=pi}var ht=(e,r,t)=>{a.hasOwnProperty(e)||Ge("Replacing nonexistent public symbol"),a[e].overloadTable!==void 0&&t!==void 0?a[e].overloadTable[t]=r:(a[e]=r,a[e].argCount=t)},gi=(e,r,t)=>{e=e.replace(/p/g,"i");var n=a["dynCall_"+e];return n(r,...t)},Xe=[],pt,mt=e=>{var r=Xe[e];return r||(e>=Xe.length&&(Xe.length=e+1),Xe[e]=r=pt.get(e)),r},_i=(e,r,t=[])=>{if(e.includes("j"))return gi(e,r,t);var n=mt(r)(...t);return n},yi=(e,r)=>(...t)=>_i(e,r,t),J=(e,r)=>{e=G(e);function t(){return e.includes("j")?yi(e,r):mt(r)}var n=t();return typeof n!="function"&&x(`unknown function pointer with signature ${e}: ${r}`),n},wi=(e,r)=>{var t=Te(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=Ot(e),t=G(r);return ae(r),t},me=(e,r)=>{var t=[],n={};function o(u){if(!n[u]&&!pe[u]){if(ze[u]){ze[u].forEach(o);return}t.push(u),n[u]=!0}}throw r.forEach(o),new vt(`${e}: `+t.map(gt).join([", "]))},Ei=(e,r,t,n,o,u,c,f,h,m,v,y,w)=>{v=G(v),u=J(o,u),f&&=J(c,f),m&&=J(h,m),w=J(y,w);var E=fi(v);dt(E,function(){me(`Cannot construct ${v} due to unbound types`,[n])}),Z([e,r,t],n?[n]:[],$=>{$=$[0];var D,I;n?(D=$.registeredClass,I=D.instancePrototype):I=Ye.prototype;var N=Te(v,function(...q){if(Object.getPrototypeOf(this)!==z)throw new be("Use 'new' to construct "+v);if(H.constructor_body===void 0)throw new be(v+" has no accessible constructor");var Mt=H.constructor_body[q.length];if(Mt===void 0)throw new be(`Tried to invoke ctor of ${v} with invalid number of parameters (${q.length}) - expected (${Object.keys(H.constructor_body).toString()}) parameters instead!`);return Mt.apply(this,q)}),z=Object.create(I,{constructor:{value:N}});N.prototype=z;var H=new di(v,N,z,w,D,u,f,m);H.baseClass&&(H.baseClass.__derivedClasses??=[],H.baseClass.__derivedClasses.push(H));var ve=new xe(v,H,!0,!1,!1),X=new xe(v+"*",H,!1,!1,!1),le=new xe(v+" const*",H,!1,!0,!1);return ft[e]={pointerType:X,constPointerType:le},ht(E,N),[ve,X,le]})};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=Te(e.name||"unknownFunctionName",function(){});t.prototype=e.prototype;var n=new t,o=e.apply(n,r);return o instanceof Object?o:n}function bi(e,r,t,n){for(var o=_t(e),u=e.length,c="",f="",h=0;h<u-2;++h)c+=(h!==0?", ":"")+"arg"+h,f+=(h!==0?", ":"")+"arg"+h+"Wired";var m=`
|
|
26
|
+
return function (${c}) {
|
|
27
|
+
if (arguments.length !== ${u-2}) {
|
|
28
|
+
throwBindingError('function ' + humanName + ' called with ' + arguments.length + ' arguments, expected ${u-2}');
|
|
29
|
+
}`;o&&(m+=`var destructors = [];
|
|
30
|
+
`);var v=o?"destructors":"null",y=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];r&&(m+="var thisWired = classParam['toWireType']("+v+`, this);
|
|
31
|
+
`);for(var h=0;h<u-2;++h)m+="var arg"+h+"Wired = argType"+h+"['toWireType']("+v+", arg"+h+`);
|
|
32
|
+
`,y.push("argType"+h);if(r&&(f="thisWired"+(f.length>0?", ":"")+f),m+=(t||n?"var rv = ":"")+"invoker(fn"+(f.length>0?", ":"")+f+`);
|
|
33
|
+
`,o)m+=`runDestructors(destructors);
|
|
34
|
+
`;else for(var h=r?1:2;h<e.length;++h){var w=h===1?"thisWired":"arg"+(h-2)+"Wired";e[h].destructorFunction!==null&&(m+=`${w}_dtor(${w});
|
|
35
|
+
`,y.push(`${w}_dtor`))}return t&&(m+=`var ret = retType['fromWireType'](rv);
|
|
36
|
+
return ret;
|
|
37
|
+
`),m+=`}
|
|
38
|
+
`,[y,m]}function Qe(e,r,t,n,o,u){var c=r.length;c<2&&x("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var f=r[1]!==null&&t!==null,h=_t(r),m=r[0].name!=="void",v=[e,x,n,o,qe,r[0],r[1]],y=0;y<c-2;++y)v.push(r[y+2]);if(!h)for(var y=f?1:2;y<r.length;++y)r[y].destructorFunction!==null&&v.push(r[y].destructorFunction);let[w,E]=bi(r,f,m,u);w.push(E);var $=yt(Function,w)(...v);return Te(e,$)}var Ze=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(M[r+n*4>>2]);return t},vr=e=>{e=e.trim();let r=e.indexOf("(");return r!==-1?e.substr(0,r):e},Ci=(e,r,t,n,o,u,c,f)=>{var h=Ze(t,n);r=G(r),r=vr(r),u=J(o,u),Z([],[e],m=>{m=m[0];var v=`${m.name}.${r}`;function y(){me(`Cannot call ${v} due to unbound types`,h)}r.startsWith("@@")&&(r=Symbol[r.substring(2)]);var w=m.registeredClass.constructor;return w[r]===void 0?(y.argCount=t-1,w[r]=y):(mr(w,r,v),w[r].overloadTable[t-1]=y),Z([],h,E=>{var $=[E[0],null].concat(E.slice(1)),D=Qe(v,$,null,u,c,f);if(w[r].overloadTable===void 0?(D.argCount=t-1,w[r]=D):w[r].overloadTable[t-1]=D,m.registeredClass.__derivedClasses)for(let I of m.registeredClass.__derivedClasses)I.constructor.hasOwnProperty(r)||(I.constructor[r]=D);return[]}),[]})},Ai=(e,r,t,n,o,u)=>{var c=Ze(r,t);o=J(n,o),Z([],[e],f=>{f=f[0];var h=`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]=()=>{me(`Cannot construct ${f.name} due to unbound types`,c)},Z([],c,m=>(m.splice(1,0,null),f.registeredClass.constructor_body[r-1]=Qe(h,m,null,o,u),[])),[]})},ki=(e,r,t,n,o,u,c,f,h)=>{var m=Ze(t,n);r=G(r),r=vr(r),u=J(o,u),Z([],[e],v=>{v=v[0];var y=`${v.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),f&&v.registeredClass.pureVirtualFunctions.push(r);function w(){me(`Cannot call ${y} due to unbound types`,m)}var E=v.registeredClass.instancePrototype,$=E[r];return $===void 0||$.overloadTable===void 0&&$.className!==v.name&&$.argCount===t-2?(w.argCount=t-2,w.className=v.name,E[r]=w):(mr(E,r,y),E[r].overloadTable[t-2]=w),Z([],m,D=>{var I=Qe(y,D,v,u,c,h);return E[r].overloadTable===void 0?(I.argCount=t-2,E[r]=I):E[r].overloadTable[t-2]=I,[]}),[]})},wt=(e,r,t)=>(e instanceof Object||x(`${t} with invalid "this": ${e}`),e instanceof r.registeredClass.constructor||x(`${t} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||x(`cannot call emscripten binding method ${t} on deleted object`),Ke(e.$$.ptr,e.$$.ptrType.registeredClass,r.registeredClass)),$i=(e,r,t,n,o,u,c,f,h,m)=>{r=G(r),o=J(n,o),Z([],[e],v=>{v=v[0];var y=`${v.name}.${r}`,w={get(){me(`Cannot access ${y} due to unbound types`,[t,c])},enumerable:!0,configurable:!0};return h?w.set=()=>me(`Cannot access ${y} due to unbound types`,[t,c]):w.set=E=>x(y+" is a read-only property"),Object.defineProperty(v.registeredClass.instancePrototype,r,w),Z([],h?[t,c]:[t],E=>{var $=E[0],D={get(){var N=wt(this,v,y+" getter");return $.fromWireType(o(u,N))},enumerable:!0};if(h){h=J(f,h);var I=E[1];D.set=function(N){var z=wt(this,v,y+" setter"),H=[];h(m,z,I.toWireType(H,N)),qe(H)}}return Object.defineProperty(v.registeredClass.instancePrototype,r,D),[]}),[]})},gr=[],se=[],_r=e=>{e>9&&--se[e+1]===0&&(se[e]=void 0,gr.push(e))},Oi=()=>se.length/2-5-gr.length,Si=()=>{se.push(0,1,void 0,1,null,1,!0,1,!1,1),a.count_emval_handles=Oi},ee={toValue:e=>(e||x("Cannot use deleted val. handle = "+e),se[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=gr.pop()||se.length;return se[r]=e,se[r+1]=1,r}}}},Pi={name:"emscripten::val",fromWireType:e=>{var r=ee.toValue(e);return _r(e),r},toWireType:(e,r)=>ee.toHandle(r),argPackAdvance:oe,readValueFromPointer:$e,destructorFunction:null},Et=e=>ie(e,Pi),yr=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Fi=(e,r)=>{switch(r){case 4:return function(t){return this.fromWireType(Lr[t>>2])};case 8:return function(t){return this.fromWireType(qr[t>>3])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},Ti=(e,r,t)=>{r=G(r),ie(e,{name:r,fromWireType:n=>n,toWireType:(n,o)=>o,argPackAdvance:oe,readValueFromPointer:Fi(r,t),destructorFunction:null})},xi=(e,r,t,n,o,u,c)=>{var f=Ze(r,t);e=G(e),e=vr(e),o=J(n,o),dt(e,function(){me(`Cannot call ${e} due to unbound types`,f)},r-1),Z([],f,h=>{var m=[h[0],null].concat(h.slice(1));return ht(e,Qe(e,m,null,o,u,c),r-1),[]})},Di=(e,r,t)=>{switch(r){case 1:return t?n=>K[n]:n=>Y[n];case 2:return t?n=>te[n>>1]:n=>Re[n>>1];case 4:return t?n=>C[n>>2]:n=>M[n>>2];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}},Mi=(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"),h=(v,y)=>{},m;f?m=function(v,y){return h(y,this.name),y>>>0}:m=function(v,y){return h(y,this.name),y},ie(e,{name:r,fromWireType:u,toWireType:m,argPackAdvance:oe,readValueFromPointer:Di(r,t,n!==0),destructorFunction:null})},ji=(e,r,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],o=n[r];function u(c){var f=M[c>>2],h=M[c+4>>2];return new o(K.buffer,h,f)}t=G(t),ie(e,{name:t,fromWireType:u,argPackAdvance:oe,readValueFromPointer:u},{ignoreDuplicateRegistrations:!0})},Hi=(e,r)=>{Et(e)},Ri=(e,r,t,n,o,u,c,f,h,m,v,y)=>{t=G(t),u=J(o,u),f=J(c,f),m=J(h,m),y=J(v,y),Z([e],[r],w=>{w=w[0];var E=new xe(t,w.registeredClass,!1,!1,!0,w,n,u,f,m,y);return[E]})},Vi=(e,r)=>{r=G(r);var t=r==="std::string";ie(e,{name:r,fromWireType(n){var o=M[n>>2],u=n+4,c;if(t)for(var f=u,h=0;h<=o;++h){var m=u+h;if(h==o||Y[m]==0){var v=m-f,y=ot(f,v);c===void 0?c=y:(c+="\0",c+=y),f=m+1}}else{for(var w=new Array(o),h=0;h<o;++h)w[h]=String.fromCharCode(Y[u+h]);c=w.join("")}return ae(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||x("Cannot pass non-string to std::string"),t&&c?u=Ne(o):u=o.length;var f=Cr(4+u+1),h=f+4;if(M[f>>2]=u,t&&c)fr(o,h,u+1);else if(c)for(var m=0;m<u;++m){var v=o.charCodeAt(m);v>255&&(ae(h),x("String has UTF-16 code units that do not fit in 8 bits")),Y[h+m]=v}else for(var m=0;m<u;++m)Y[h+m]=o[m];return n!==null&&n.push(ae,f),f},argPackAdvance:oe,readValueFromPointer:$e,destructorFunction(n){ae(n)}})},bt=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,Wi=(e,r)=>{for(var t=e,n=t>>1,o=n+r/2;!(n>=o)&&Re[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=te[e+c*2>>1];if(f==0)break;u+=String.fromCharCode(f)}return u},Ui=(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);te[r>>1]=c,r+=2}return te[r>>1]=0,r-n},Ii=e=>e.length*2,Ni=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var o=C[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},Bi=(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(C[r>>2]=c,r+=4,r+4>o)break}return C[r>>2]=0,r-n},Li=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},qi=(e,r,t)=>{t=G(t);var n,o,u,c;r===2?(n=Wi,o=Ui,c=Ii,u=f=>Re[f>>1]):r===4&&(n=Ni,o=Bi,c=Li,u=f=>M[f>>2]),ie(e,{name:t,fromWireType:f=>{for(var h=M[f>>2],m,v=f+4,y=0;y<=h;++y){var w=f+4+y*r;if(y==h||u(w)==0){var E=w-v,$=n(v,E);m===void 0?m=$:(m+="\0",m+=$),v=w+r}}return ae(f),m},toWireType:(f,h)=>{typeof h!="string"&&x(`Cannot pass non-string to C++ string type ${t}`);var m=c(h),v=Cr(4+m+r);return M[v>>2]=m/r,o(h,v+4,m+r),f!==null&&f.push(ae,v),v},argPackAdvance:oe,readValueFromPointer:$e,destructorFunction(f){ae(f)}})},zi=(e,r,t,n,o,u)=>{Le[e]={name:G(r),rawConstructor:J(t,n),rawDestructor:J(o,u),fields:[]}},Gi=(e,r,t,n,o,u,c,f,h,m)=>{Le[e].fields.push({fieldName:G(r),getterReturnType:t,getter:J(n,o),getterContext:u,setterArgumentType:c,setter:J(f,h),setterContext:m})},Ji=(e,r)=>{r=G(r),ie(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(t,n)=>{}})},Yi=1,Ki=()=>Yi,Xi=(e,r,t)=>Y.copyWithin(e,r,r+t),wr=(e,r)=>{var t=pe[e];return t===void 0&&x(`${r} has unknown type ${gt(e)}`),t},Ct=(e,r,t)=>{var n=[],o=e.toWireType(n,t);return n.length&&(M[r>>2]=ee.toHandle(n)),o},Qi=(e,r,t)=>(e=ee.toValue(e),r=wr(r,"emval::as"),Ct(r,t,e)),er=[],Zi=(e,r,t,n)=>(e=er[e],r=ee.toValue(r),e(null,r,t,n)),eo={},Er=e=>{var r=eo[e];return r===void 0?G(e):r},ro=(e,r,t,n,o)=>(e=er[e],r=ee.toValue(r),t=Er(t),e(r,r[t],n,o)),At=()=>typeof globalThis=="object"?globalThis:function(){return Function}()("return this")(),to=e=>e===0?ee.toHandle(At()):(e=Er(e),ee.toHandle(At()[e])),no=e=>{var r=er.length;return er.push(e),r},io=(e,r)=>{for(var t=new Array(e),n=0;n<e;++n)t[n]=wr(M[r+n*4>>2],"parameter "+n);return t},Ms=Reflect.construct,oo=(e,r,t)=>{var n=io(e,r),o=n.shift();e--;var u=`return function (obj, func, destructorsRef, args) {
|
|
39
|
+
`,c=0,f=[];t===0&&f.push("obj");for(var h=["retType"],m=[o],v=0;v<e;++v)f.push("arg"+v),h.push("argType"+v),m.push(n[v]),u+=` var arg${v} = argType${v}.readValueFromPointer(args${c?"+"+c:""});
|
|
40
|
+
`,c+=n[v].argPackAdvance;var y=t===1?"new func":"func.call";u+=` var rv = ${y}(${f.join(", ")});
|
|
41
|
+
`,o.isVoid||(h.push("emval_returnValue"),m.push(Ct),u+=` return emval_returnValue(retType, destructorsRef, rv);
|
|
42
|
+
`),u+=`};
|
|
43
|
+
`,h.push(u);var w=yt(Function,h)(...m),E=`methodCaller<(${n.map($=>$.name).join(", ")}) => ${o.name}>`;return no(Te(E,w))},so=e=>(e=Er(e),ee.toHandle(a[e])),ao=e=>{e>9&&(se[e+1]+=1)},lo=e=>{var r=ee.toValue(e);qe(r),_r(e)},uo=(e,r)=>{e=wr(e,"_emval_take_value");var t=e.readValueFromPointer(r);return ee.toHandle(t)};function co(e,r,t){var n=we(e,r),o=new Date(n*1e3);C[t>>2]=o.getUTCSeconds(),C[t+4>>2]=o.getUTCMinutes(),C[t+8>>2]=o.getUTCHours(),C[t+12>>2]=o.getUTCDate(),C[t+16>>2]=o.getUTCMonth(),C[t+20>>2]=o.getUTCFullYear()-1900,C[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;C[t+28>>2]=c}var fo=e=>e%4===0&&(e%100!==0||e%400===0),ho=[0,31,60,91,121,152,182,213,244,274,305,335],po=[0,31,59,90,120,151,181,212,243,273,304,334],mo=e=>{var r=fo(e.getFullYear()),t=r?ho:po,n=t[e.getMonth()]+e.getDate()-1;return n};function vo(e,r,t){var n=we(e,r),o=new Date(n*1e3);C[t>>2]=o.getSeconds(),C[t+4>>2]=o.getMinutes(),C[t+8>>2]=o.getHours(),C[t+12>>2]=o.getDate(),C[t+16>>2]=o.getMonth(),C[t+20>>2]=o.getFullYear()-1900,C[t+24>>2]=o.getDay();var u=mo(o)|0;C[t+28>>2]=u,C[t+36>>2]=-(o.getTimezoneOffset()*60);var c=new Date(o.getFullYear(),0,1),f=new Date(o.getFullYear(),6,1).getTimezoneOffset(),h=c.getTimezoneOffset(),m=(f!=h&&o.getTimezoneOffset()==Math.min(h,f))|0;C[t+32>>2]=m}function go(e,r,t,n,o,u,c,f){var h=we(o,u);try{if(isNaN(h))return 61;var m=T.getStreamFromFD(n),v=s.mmap(m,e,h,r,t),y=v.ptr;return C[c>>2]=v.allocated,M[f>>2]=y,0}catch(w){if(typeof s>"u"||w.name!=="ErrnoError")throw w;return-w.errno}}function _o(e,r,t,n,o,u,c){var f=we(u,c);try{var h=T.getStreamFromFD(o);t&2&&T.doMsync(e,h,r,n,f)}catch(m){if(typeof s>"u"||m.name!=="ErrnoError")throw m;return-m.errno}}var yo=()=>Date.now(),kt;kt=()=>performance.now();var wo=()=>2147483648,Eo=e=>{var r=je.buffer,t=(e-r.byteLength+65535)/65536;try{return je.grow(t),zr(),1}catch{}},bo=e=>{var r=Y.length;e>>>=0;var t=wo();if(e>t)return!1;for(var n=(h,m)=>h+(m-h%m)%m,o=1;o<=4;o*=2){var u=r*(1+.2/o);u=Math.min(u,e+100663296);var c=Math.min(t,n(Math.max(e,u),65536)),f=Eo(c);if(f)return!0}return!1},br={},Co=()=>F||"./this.program",De=()=>{if(!De.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,_:Co()};for(var t in br)br[t]===void 0?delete r[t]:r[t]=br[t];var n=[];for(var t in r)n.push(`${t}=${r[t]}`);De.strings=n}return De.strings},Ao=(e,r)=>{for(var t=0;t<e.length;++t)K[r++]=e.charCodeAt(t);K[r]=0},ko=(e,r)=>{var t=0;return De().forEach((n,o)=>{var u=r+t;M[e+o*4>>2]=u,Ao(n,u),t+=n.length+1}),0},$o=(e,r)=>{var t=De();M[e>>2]=t.length;var n=0;return t.forEach(o=>n+=o.length+1),M[r>>2]=n,0};function Oo(e){try{var r=T.getStreamFromFD(e);return s.close(r),0}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var So=(e,r,t,n)=>{for(var o=0,u=0;u<t;u++){var c=M[r>>2],f=M[r+4>>2];r+=8;var h=s.read(e,K,c,f,n);if(h<0)return-1;if(o+=h,h<f)break;typeof n<"u"&&(n+=h)}return o};function Po(e,r,t,n){try{var o=T.getStreamFromFD(e),u=So(o,r,t);return M[n>>2]=u,0}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return c.errno}}function Fo(e,r,t,n,o){var u=we(r,t);try{if(isNaN(u))return 61;var c=T.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)],C[o>>2]=U[0],C[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 To=(e,r,t,n)=>{for(var o=0,u=0;u<t;u++){var c=M[r>>2],f=M[r+4>>2];r+=8;var h=s.write(e,K,c,f,n);if(h<0)return-1;o+=h,typeof n<"u"&&(n+=h)}return o};function xo(e,r,t,n){try{var o=T.getStreamFromFD(e),u=To(o,r,t);return M[n>>2]=u,0}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return c.errno}}var Do=0,Mo=()=>Cn||Do>0,jo=e=>{He=e,Mo()||(a.onExit?.(e),or=!0),W(e,new et(e))},Ho=(e,r)=>{He=e,jo(e)},Ro=e=>{if(e instanceof et||e=="unwind")return He;W(1,e)},$t=e=>Tt(e),Vo=e=>{var r=Ne(e)+1,t=$t(r);return fr(e,t,r),t};s.createPreloadedFile=xn,s.staticInit(),st=a.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},Kn(),be=a.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},li(),ii(),vi(),vt=a.UnboundTypeError=wi(Error,"UnboundTypeError"),Si();var Wo={U:Mn,s:jn,P:Hn,F:Rn,J:Vn,R:Wn,N:Un,M:In,h:Nn,I:Bn,o:Ln,O:qn,p:zn,V:Gn,u:Jn,G:Yn,ba:Qn,k:Ei,_:Ci,$:Ai,d:ki,y:$i,aa:Et,w:Ti,da:xi,c:Mi,a:ji,ea:Hi,n:Ri,x:Vi,j:qi,Z:zi,v:Gi,ca:Ji,T:Ki,Q:Xi,t:Qi,z:Zi,X:ro,b:_r,Y:to,l:oo,W:so,m:ao,g:lo,f:uo,C:co,D:vo,A:go,B:_o,i:yo,S:kt,H:bo,K:ko,L:$o,e:Oo,r:Po,E:Fo,q:xo},j=bn(),Uo=()=>(Uo=j.ga)(),Ot=e=>(Ot=j.ha)(e),Cr=e=>(Cr=j.ia)(e),ae=e=>(ae=j.ja)(e),St=a._main=(e,r)=>(St=a._main=j.ka)(e,r),Pt=(e,r)=>(Pt=j.ma)(e,r),Ft=()=>(Ft=j.na)(),Tt=e=>(Tt=j.oa)(e),Io=a.dynCall_ji=(e,r)=>(Io=a.dynCall_ji=j.pa)(e,r),No=a.dynCall_jiji=(e,r,t,n,o)=>(No=a.dynCall_jiji=j.qa)(e,r,t,n,o),Bo=a.dynCall_viij=(e,r,t,n,o)=>(Bo=a.dynCall_viij=j.ra)(e,r,t,n,o),Lo=a.dynCall_iij=(e,r,t,n)=>(Lo=a.dynCall_iij=j.sa)(e,r,t,n),qo=a.dynCall_iiji=(e,r,t,n,o)=>(qo=a.dynCall_iiji=j.ta)(e,r,t,n,o),zo=a.dynCall_jji=(e,r,t,n)=>(zo=a.dynCall_jji=j.ua)(e,r,t,n),Go=a.dynCall_iji=(e,r,t,n)=>(Go=a.dynCall_iji=j.va)(e,r,t,n),Jo=a.dynCall_iiij=(e,r,t,n,o)=>(Jo=a.dynCall_iiij=j.wa)(e,r,t,n,o),Yo=a.dynCall_viijj=(e,r,t,n,o,u,c)=>(Yo=a.dynCall_viijj=j.xa)(e,r,t,n,o,u,c),Ko=a.dynCall_vij=(e,r,t,n)=>(Ko=a.dynCall_vij=j.ya)(e,r,t,n),Xo=a.dynCall_viijii=(e,r,t,n,o,u,c)=>(Xo=a.dynCall_viijii=j.za)(e,r,t,n,o,u,c),Qo=a.dynCall_iiiij=(e,r,t,n,o,u)=>(Qo=a.dynCall_iiiij=j.Aa)(e,r,t,n,o,u),Zo=a.dynCall_iiiiij=(e,r,t,n,o,u,c)=>(Zo=a.dynCall_iiiiij=j.Ba)(e,r,t,n,o,u,c),es=a.dynCall_iiiiijj=(e,r,t,n,o,u,c,f,h)=>(es=a.dynCall_iiiiijj=j.Ca)(e,r,t,n,o,u,c,f,h),rs=a.dynCall_iiiiiijj=(e,r,t,n,o,u,c,f,h,m)=>(rs=a.dynCall_iiiiiijj=j.Da)(e,r,t,n,o,u,c,f,h,m),rr;ke=function e(){rr||xt(),rr||(ke=e)};function ts(e=[]){var r=St;e.unshift(F);var t=e.length,n=$t((t+1)*4),o=n;e.forEach(c=>{M[o>>2]=Vo(c),o+=4}),M[o>>2]=0;try{var u=r(t,n);return Ho(u,!0),u}catch(c){return Ro(c)}}function xt(e=S){if(he>0||(cn(),he>0))return;function r(){rr||(rr=!0,a.calledRun=!0,!or&&(fn(),dn(),d(a),a.onRuntimeInitialized?.(),Dt&&ts(e),hn()))}a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),r()},1)):r()}if(a.preInit)for(typeof a.preInit=="function"&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();var Dt=!0;return a.noInitialRun&&(Dt=!1),xt(),l=_,l}})(),zt=ps;var sn=Ar(on(),1),{program:ua,createCommand:ca,createArgument:fa,createOption:da,CommanderError:ha,InvalidArgumentError:pa,InvalidOptionArgumentError:ma,Command:an,Argument:va,Option:ga,Help:_a}=sn.default;var Fs=()=>Nr.default.openAsBlob((0,ln.resolve)(__dirname,"docauth.wasm")),Ts=async()=>{let g=await Vt({type:"buffer",buffer:(await Fs()).arrayBuffer()},Promise.resolve(zt));return Ut(g)},Br=new an,xs=async g=>{let i=await Ts(),l=qt({wasmExecutor:i},g.scanDirectory);Nr.default.writeFileSync(g.writeTo,JSON.stringify(Bt(l)),"utf-8")};Br.name("document-authoring");Br.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(xs);Br.parse();
|
package/lib/docauth.mjs
ADDED
|
@@ -0,0 +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,n=new URL("docauth-impl-0bb648cb47fd5605.js",e).href;return import(
|
|
2
|
+
/*webpackIgnore: true*/
|
|
3
|
+
/* @vite-ignore */
|
|
4
|
+
n)})(t?.assets?.base)).createDocAuthSystem(t);var n={createDocAuthSystem:e,defaultFontIndex:t};export{e as createDocAuthSystem,n as default,t as defaultFontIndex};
|
|
@@ -0,0 +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-0bb648cb47fd5605.js",t).href;return import(
|
|
2
|
+
/*webpackIgnore: true*/
|
|
3
|
+
/* @vite-ignore */
|
|
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
ADDED
|
Binary file
|