@nutrient-sdk/document-authoring 1.9.0-preview.202510211023.54d6a1d11073665fbb4a45f0174b615cd2c4e04f → 1.9.0-preview.202510311503.64e75f5284d684d4302f1db62d945f9ed3681223
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/cli.js +1 -1
- package/lib/docauth.mjs +18 -2
- package/lib/docauth.umd.js +18 -2
- package/lib/docauth.wasm +0 -0
- package/lib/index.d.cts +276 -1
- package/lib/index.d.mts +276 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ the SDK via `npm`).
|
|
|
78
78
|
|
|
79
79
|
### Example
|
|
80
80
|
|
|
81
|
-
You can download an example project demoing both TypeScript and JavaScript integration from [here](https://document-authoring.cdn.staging.nutrient.io/releases/document-authoring-1.9.0-preview.
|
|
81
|
+
You can download an example project demoing both TypeScript and JavaScript integration from [here](https://document-authoring.cdn.staging.nutrient.io/releases/document-authoring-1.9.0-preview.202510311503.64e75f5284d684d4302f1db62d945f9ed3681223-example.zip), unzip it and run:
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
84
|
npm install
|
|
@@ -92,7 +92,7 @@ By default, the Document Authoring SDK will fetch the required files (fonts, emo
|
|
|
92
92
|
|
|
93
93
|
### Self-hosting the assets
|
|
94
94
|
|
|
95
|
-
To host the assets on your own infrastructure you can download them from [here](https://document-authoring.cdn.staging.nutrient.io/releases/document-authoring-1.9.0-preview.
|
|
95
|
+
To host the assets on your own infrastructure you can download them from [here](https://document-authoring.cdn.staging.nutrient.io/releases/document-authoring-1.9.0-preview.202510311503.64e75f5284d684d4302f1db62d945f9ed3681223-assets.zip) and deploy them to a suitable location.
|
|
96
96
|
Provide an appropriate base path when initializing the Document Authoring SDK.
|
|
97
97
|
|
|
98
98
|
#### Example:
|
package/lib/cli.js
CHANGED
|
@@ -20,7 +20,7 @@ Expecting one of '${l.join("', '")}'`);return this._lifeCycleHooks[i]?this._life
|
|
|
20
20
|
`),this.outputHelp({error:!0}));let l=a||{},d=l.exitCode||1,h=l.code||"commander.error";this._exit(d,h,i)}_parseOptionsEnv(){this.options.forEach(i=>{if(i.envVar&&i.envVar in L.env){let a=i.attributeName();(this.getOptionValue(a)===void 0||["default","config","env"].includes(this.getOptionValueSource(a)))&&(i.required||i.optional?this.emit(`optionEnv:${i.name()}`,L.env[i.envVar]):this.emit(`optionEnv:${i.name()}`))}})}_parseOptionsImplied(){let i=new js(this.options),a=l=>this.getOptionValue(l)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(l));this.options.filter(l=>l.implied!==void 0&&a(l.attributeName())&&i.valueFromOption(this.getOptionValue(l.attributeName()),l)).forEach(l=>{Object.keys(l.implied).filter(d=>!a(d)).forEach(d=>{this.setOptionValueWithSource(d,l.implied[d],"implied")})})}missingArgument(i){let a=`error: missing required argument '${i}'`;this.error(a,{code:"commander.missingArgument"})}optionMissingArgument(i){let a=`error: option '${i.flags}' argument missing`;this.error(a,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(i){let a=`error: required option '${i.flags}' not specified`;this.error(a,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(i,a){let l=y=>{let k=y.attributeName(),b=this.getOptionValue(k),$=this.options.find(T=>T.negate&&k===T.attributeName()),S=this.options.find(T=>!T.negate&&k===T.attributeName());return $&&($.presetArg===void 0&&b===!1||$.presetArg!==void 0&&b===$.presetArg)?$:S||y},d=y=>{let k=l(y),b=k.attributeName();return this.getOptionValueSource(b)==="env"?`environment variable '${k.envVar}'`:`option '${k.flags}'`},h=`error: ${d(i)} cannot be used with ${d(a)}`;this.error(h,{code:"commander.conflictingOption"})}unknownOption(i){if(this._allowUnknownOption)return;let a="";if(i.startsWith("--")&&this._showSuggestionAfterError){let d=[],h=this;do{let y=h.createHelp().visibleOptions(h).filter(k=>k.long).map(k=>k.long);d=d.concat(y),h=h.parent}while(h&&!h._enablePositionalOptions);a=nn(i,d)}let l=`error: unknown option '${i}'${a}`;this.error(l,{code:"commander.unknownOption"})}_excessArguments(i){if(this._allowExcessArguments)return;let a=this.registeredArguments.length,l=a===1?"":"s",h=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${a} argument${l} but got ${i.length}.`;this.error(h,{code:"commander.excessArguments"})}unknownCommand(){let i=this.args[0],a="";if(this._showSuggestionAfterError){let d=[];this.createHelp().visibleCommands(this).forEach(h=>{d.push(h.name()),h.alias()&&d.push(h.alias())}),a=nn(i,d)}let l=`error: unknown command '${i}'${a}`;this.error(l,{code:"commander.unknownCommand"})}version(i,a,l){if(i===void 0)return this._version;this._version=i,a=a||"-V, --version",l=l||"output the version number";let d=this.createOption(a,l);return this._versionOptionName=d.attributeName(),this._registerOption(d),this.on("option:"+d.name(),()=>{this._outputConfiguration.writeOut(`${i}
|
|
21
21
|
`),this._exit(0,"commander.version",i)}),this}description(i,a){return i===void 0&&a===void 0?this._description:(this._description=i,a&&(this._argsDescription=a),this)}summary(i){return i===void 0?this._summary:(this._summary=i,this)}alias(i){if(i===void 0)return this._aliases[0];let a=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(a=this.commands[this.commands.length-1]),i===a._name)throw new Error("Command alias can't be the same as its name");let l=this.parent?._findCommand(i);if(l){let d=[l.name()].concat(l.aliases()).join("|");throw new Error(`cannot add alias '${i}' to command '${this.name()}' as already have command '${d}'`)}return a._aliases.push(i),this}aliases(i){return i===void 0?this._aliases:(i.forEach(a=>this.alias(a)),this)}usage(i){if(i===void 0){if(this._usage)return this._usage;let a=this.registeredArguments.map(l=>Ds(l));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?a:[]).join(" ")}return this._usage=i,this}name(i){return i===void 0?this._name:(this._name=i,this)}nameFromFilename(i){return this._name=le.basename(i,le.extname(i)),this}executableDir(i){return i===void 0?this._executableDir:(this._executableDir=i,this)}helpInformation(i){let a=this.createHelp();return a.helpWidth===void 0&&(a.helpWidth=i&&i.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),a.formatHelp(this,a)}_getHelpContext(i){i=i||{};let a={error:!!i.error},l;return a.error?l=d=>this._outputConfiguration.writeErr(d):l=d=>this._outputConfiguration.writeOut(d),a.write=i.write||l,a.command=this,a}outputHelp(i){let a;typeof i=="function"&&(a=i,i=void 0);let l=this._getHelpContext(i);this._getCommandAndAncestors().reverse().forEach(h=>h.emit("beforeAllHelp",l)),this.emit("beforeHelp",l);let d=this.helpInformation(l);if(a&&(d=a(d),typeof d!="string"&&!Buffer.isBuffer(d)))throw new Error("outputHelp callback must return a string or a Buffer");l.write(d),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",l),this._getCommandAndAncestors().forEach(h=>h.emit("afterAllHelp",l))}helpOption(i,a){return typeof i=="boolean"?(i?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(i=i??"-h, --help",a=a??"display help for command",this._helpOption=this.createOption(i,a),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(i){return this._helpOption=i,this}help(i){this.outputHelp(i);let a=L.exitCode||0;a===0&&i&&typeof i!="function"&&i.error&&(a=1),this._exit(a,"commander.help","(outputHelp)")}addHelpText(i,a){let l=["beforeAll","before","after","afterAll"];if(!l.includes(i))throw new Error(`Unexpected value for position to addHelpText.
|
|
22
22
|
Expecting one of '${l.join("', '")}'`);let d=`${i}Help`;return this.on(d,h=>{let y;typeof a=="function"?y=a({error:h.error,command:h.command}):y=a,y&&h.write(`${y}
|
|
23
|
-
`)}),this}_outputHelpIfRequested(i){let a=this._getHelpOption();a&&i.find(d=>a.is(d))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function on(g){return g.map(i=>{if(!i.startsWith("--inspect"))return i;let a,l="127.0.0.1",d="9229",h;return(h=i.match(/^(--inspect(-brk)?)$/))!==null?a=h[1]:(h=i.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(a=h[1],/^\d+$/.test(h[3])?d=h[3]:l=h[3]):(h=i.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(a=h[1],l=h[3],d=h[4]),a&&d!=="0"?`${a}=${l}:${parseInt(d)+1}`:i})}sn.Command=Wr});var fn=ge(re=>{var{Argument:ln}=rr(),{Command:Ur}=an(),{CommanderError:Hs,InvalidArgumentError:un}=Te(),{Help:Rs}=Tr(),{Option:cn}=jr();re.program=new Ur;re.createCommand=g=>new Ur(g);re.createOption=(g,i)=>new cn(g,i);re.createArgument=(g,i)=>new ln(g,i);re.Command=Ur;re.Option=cn;re.Argument=ln;re.Help=Rs;re.CommanderError=Hs;re.InvalidArgumentError=un;re.InvalidOptionArgumentError=un});var Ir=Cr(require("fs")),mn=require("path");function Ar(g,i){if(!g)throw new Error(i);return g}function Nt(g){return Ar(g),g}function Bt(g){throw new Error("Should not be reachable")}var Lt=async(g,i)=>{let a={instantiateWasm:async(l,d)=>{switch(g.type){case"response":{let h=await WebAssembly.instantiateStreaming(g.response,l);d(h.instance,h.module)}break;case"buffer":{let h=await WebAssembly.instantiate(await g.buffer,l);d(h.instance,h.module)}break;default:Bt(g)}}};return Nt(await(await i)(a))};var gs=new TextEncoder,kr=g=>gs.encode(g),_s=new TextDecoder,qt=g=>_s.decode(g);var ys=!1,ws=g=>{if(typeof g=="string")return kr(g);if(g instanceof Uint8Array)return g;if(g instanceof Object)return kr(JSON.stringify(g));throw new Error("unsupported type")},zt=g=>{let i=new g.DocumentEngine.create;return{exec:(h,...y)=>(()=>{let{error:b,values:$}=(()=>{let T=new g.MemoryHandleVector;try{for(let I of y){let B=ws(I),W=g.allocateMemory(B.byteLength);try{Ar(W.size===B.byteLength),W.view.set(B),T.push_back(W)}finally{W.delete()}}try{return i.exec(h,T)}catch(I){throw console.error("exception while calling exec",h,I),I}}finally{T.delete()}})();if(b)throw $.delete(),ys&&console.error("WASM request",h,y,"yielded error",b),b;let S=[];for(let T=0;T<$.size();++T){let I=$.get(T);S.push(I.view.slice()),I.delete()}return $.delete(),S})(),destroy:()=>{i.delete()}}};var Ce=Cr(require("fs")),Kt=require("path");var Gt=g=>JSON.parse(qt(g));var Jt=(g,i,a)=>{let{wasmExecutor:l}=g;return Gt(l.exec("fonts/index",{id:a},i)[0])},Yt=g=>({v:1,availableFonts:g});var Es=[".ttf",".otf",".ttc",".otc"],Xt=(g,i)=>{let a=[];return Ce.readdirSync(i).forEach(l=>{let d=(0,Kt.resolve)(i,l);if(!Ce.statSync(d).isFile()||Es.every(k=>!l.toLowerCase().endsWith(k)))return;let h=(()=>{try{return new Uint8Array(Ce.readFileSync(d))}catch{throw new Error(`Error processing file '${l}'.`)}})(),y=Jt(g,h,l);a=a.concat(y)}),a};var bs=(()=>{var g=typeof document<"u"?document.currentScript?.src:void 0;return function(i={}){var a,l=i,d,h,y=new Promise((e,r)=>{d=e,h=r}),k=!0,b=!1,$=Object.assign({},l),S=[],T="./this.program",I=(e,r)=>{throw r},B="";function W(e){return l.locateFile?l.locateFile(e,B):B+e}var Q,fe;(k||b)&&(b?B=self.location.href:typeof document<"u"&&document.currentScript&&(B=document.currentScript.src),g&&(B=g),B.startsWith("blob:")?B="":B=B.substr(0,B.replace(/[?#].*/,"").lastIndexOf("/")+1),Q=async e=>{var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var tr=l.print||console.log.bind(console),ue=l.printErr||console.error.bind(console);Object.assign(l,$),$=null,l.arguments&&(S=l.arguments),l.thisProgram&&(T=l.thisProgram);var xe=l.wasmBinary,De,Me=!1,je,K,Y,ne,He,A,j,Br,nr;function Lr(){var e=De.buffer;l.HEAP8=K=new Int8Array(e),l.HEAP16=ne=new Int16Array(e),l.HEAPU8=Y=new Uint8Array(e),l.HEAPU16=He=new Uint16Array(e),l.HEAP32=A=new Int32Array(e),l.HEAPU32=j=new Uint32Array(e),l.HEAPF32=Br=new Float32Array(e),l.HEAPF64=nr=new Float64Array(e)}var qr=[],zr=[],pn=[],Gr=[],Jr=!1;function vn(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)wn(l.preRun.shift());Ve(qr)}function gn(){Jr=!0,!l.noFSInit&&!s.initialized&&s.init(),s.ignorePermissions=!1,ce.init(),Ve(zr)}function _n(){Ve(pn)}function yn(){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)bn(l.postRun.shift());Ve(Gr)}function wn(e){qr.unshift(e)}function En(e){zr.unshift(e)}function bn(e){Gr.unshift(e)}var de=0,Ae=null;function Is(e){return e}function Yr(e){de++,l.monitorRunDependencies?.(de)}function ir(e){if(de--,l.monitorRunDependencies?.(de),de==0&&Ae){var r=Ae;Ae=null,r()}}function Re(e){l.onAbort?.(e),e="Aborted("+e+")",ue(e),Me=!0,e+=". Build with -sASSERTIONS for more info.",Jr&&Ht();var r=new WebAssembly.RuntimeError(e);throw h(r),r}var Cn="data:application/octet-stream;base64,",Kr=e=>e.startsWith(Cn);function An(){var e="docauth.wasm";return Kr(e)?e:W(e)}var or;function kn(e){if(e==or&&xe)return new Uint8Array(xe);if(fe)return fe(e);throw"both async and sync fetching of the wasm failed"}async function $n(e){if(!xe)try{var r=await Q(e);return new Uint8Array(r)}catch{}return kn(e)}async function On(e,r){try{var t=await $n(e),n=await WebAssembly.instantiate(t,r);return n}catch(o){ue(`failed to asynchronously prepare wasm: ${o}`),Re(o)}}async function Sn(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Kr(r)&&typeof fetch=="function")try{var n=fetch(r,{credentials:"same-origin"}),o=await WebAssembly.instantiateStreaming(n,t);return o}catch(u){ue(`wasm streaming compile failed: ${u}`),ue("falling back to ArrayBuffer instantiation")}return On(r,t)}function Pn(){return{a:Jo}}async function Fn(){function e(o,u){return R=o.exports,De=R.ia,Lr(),mt=R.oa,En(R.ja),ir("wasm-instantiate"),R}Yr("wasm-instantiate");function r(o){e(o.instance)}var t=Pn();if(l.instantiateWasm)try{return l.instantiateWasm(t,e)}catch(o){ue(`Module.instantiateWasm callback failed with error: ${o}`),h(o)}or??=An();try{var n=await Sn(xe,or,t);return r(n),n}catch(o){h(o);return}}var O,U,Tn={
|
|
23
|
+
`)}),this}_outputHelpIfRequested(i){let a=this._getHelpOption();a&&i.find(d=>a.is(d))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function on(g){return g.map(i=>{if(!i.startsWith("--inspect"))return i;let a,l="127.0.0.1",d="9229",h;return(h=i.match(/^(--inspect(-brk)?)$/))!==null?a=h[1]:(h=i.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(a=h[1],/^\d+$/.test(h[3])?d=h[3]:l=h[3]):(h=i.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(a=h[1],l=h[3],d=h[4]),a&&d!=="0"?`${a}=${l}:${parseInt(d)+1}`:i})}sn.Command=Wr});var fn=ge(re=>{var{Argument:ln}=rr(),{Command:Ur}=an(),{CommanderError:Hs,InvalidArgumentError:un}=Te(),{Help:Rs}=Tr(),{Option:cn}=jr();re.program=new Ur;re.createCommand=g=>new Ur(g);re.createOption=(g,i)=>new cn(g,i);re.createArgument=(g,i)=>new ln(g,i);re.Command=Ur;re.Option=cn;re.Argument=ln;re.Help=Rs;re.CommanderError=Hs;re.InvalidArgumentError=un;re.InvalidOptionArgumentError=un});var Ir=Cr(require("fs")),mn=require("path");function Ar(g,i){if(!g)throw new Error(i);return g}function Nt(g){return Ar(g),g}function Bt(g){throw new Error("Should not be reachable")}var Lt=async(g,i)=>{let a={instantiateWasm:async(l,d)=>{switch(g.type){case"response":{let h=await WebAssembly.instantiateStreaming(g.response,l);d(h.instance,h.module)}break;case"buffer":{let h=await WebAssembly.instantiate(await g.buffer,l);d(h.instance,h.module)}break;default:Bt(g)}}};return Nt(await(await i)(a))};var gs=new TextEncoder,kr=g=>gs.encode(g),_s=new TextDecoder,qt=g=>_s.decode(g);var ys=!1,ws=g=>{if(typeof g=="string")return kr(g);if(g instanceof Uint8Array)return g;if(g instanceof Object)return kr(JSON.stringify(g));throw new Error("unsupported type")},zt=g=>{let i=new g.DocumentEngine.create;return{exec:(h,...y)=>(()=>{let{error:b,values:$}=(()=>{let T=new g.MemoryHandleVector;try{for(let I of y){let B=ws(I),W=g.allocateMemory(B.byteLength);try{Ar(W.size===B.byteLength),W.view.set(B),T.push_back(W)}finally{W.delete()}}try{return i.exec(h,T)}catch(I){throw console.error("exception while calling exec",h,I),I}}finally{T.delete()}})();if(b)throw $.delete(),ys&&console.error("WASM request",h,y,"yielded error",b),b;let S=[];for(let T=0;T<$.size();++T){let I=$.get(T);S.push(I.view.slice()),I.delete()}return $.delete(),S})(),destroy:()=>{i.delete()}}};var Ce=Cr(require("fs")),Kt=require("path");var Gt=g=>JSON.parse(qt(g));var Jt=(g,i,a)=>{let{wasmExecutor:l}=g;return Gt(l.exec("fonts/index",{id:a},i)[0])},Yt=g=>({v:1,availableFonts:g});var Es=[".ttf",".otf",".ttc",".otc"],Xt=(g,i)=>{let a=[];return Ce.readdirSync(i).forEach(l=>{let d=(0,Kt.resolve)(i,l);if(!Ce.statSync(d).isFile()||Es.every(k=>!l.toLowerCase().endsWith(k)))return;let h=(()=>{try{return new Uint8Array(Ce.readFileSync(d))}catch{throw new Error(`Error processing file '${l}'.`)}})(),y=Jt(g,h,l);a=a.concat(y)}),a};var bs=(()=>{var g=typeof document<"u"?document.currentScript?.src:void 0;return function(i={}){var a,l=i,d,h,y=new Promise((e,r)=>{d=e,h=r}),k=!0,b=!1,$=Object.assign({},l),S=[],T="./this.program",I=(e,r)=>{throw r},B="";function W(e){return l.locateFile?l.locateFile(e,B):B+e}var Q,fe;(k||b)&&(b?B=self.location.href:typeof document<"u"&&document.currentScript&&(B=document.currentScript.src),g&&(B=g),B.startsWith("blob:")?B="":B=B.substr(0,B.replace(/[?#].*/,"").lastIndexOf("/")+1),Q=async e=>{var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var tr=l.print||console.log.bind(console),ue=l.printErr||console.error.bind(console);Object.assign(l,$),$=null,l.arguments&&(S=l.arguments),l.thisProgram&&(T=l.thisProgram);var xe=l.wasmBinary,De,Me=!1,je,K,Y,ne,He,A,j,Br,nr;function Lr(){var e=De.buffer;l.HEAP8=K=new Int8Array(e),l.HEAP16=ne=new Int16Array(e),l.HEAPU8=Y=new Uint8Array(e),l.HEAPU16=He=new Uint16Array(e),l.HEAP32=A=new Int32Array(e),l.HEAPU32=j=new Uint32Array(e),l.HEAPF32=Br=new Float32Array(e),l.HEAPF64=nr=new Float64Array(e)}var qr=[],zr=[],pn=[],Gr=[],Jr=!1;function vn(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)wn(l.preRun.shift());Ve(qr)}function gn(){Jr=!0,!l.noFSInit&&!s.initialized&&s.init(),s.ignorePermissions=!1,ce.init(),Ve(zr)}function _n(){Ve(pn)}function yn(){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)bn(l.postRun.shift());Ve(Gr)}function wn(e){qr.unshift(e)}function En(e){zr.unshift(e)}function bn(e){Gr.unshift(e)}var de=0,Ae=null;function Is(e){return e}function Yr(e){de++,l.monitorRunDependencies?.(de)}function ir(e){if(de--,l.monitorRunDependencies?.(de),de==0&&Ae){var r=Ae;Ae=null,r()}}function Re(e){l.onAbort?.(e),e="Aborted("+e+")",ue(e),Me=!0,e+=". Build with -sASSERTIONS for more info.",Jr&&Ht();var r=new WebAssembly.RuntimeError(e);throw h(r),r}var Cn="data:application/octet-stream;base64,",Kr=e=>e.startsWith(Cn);function An(){var e="docauth.wasm";return Kr(e)?e:W(e)}var or;function kn(e){if(e==or&&xe)return new Uint8Array(xe);if(fe)return fe(e);throw"both async and sync fetching of the wasm failed"}async function $n(e){if(!xe)try{var r=await Q(e);return new Uint8Array(r)}catch{}return kn(e)}async function On(e,r){try{var t=await $n(e),n=await WebAssembly.instantiate(t,r);return n}catch(o){ue(`failed to asynchronously prepare wasm: ${o}`),Re(o)}}async function Sn(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Kr(r)&&typeof fetch=="function")try{var n=fetch(r,{credentials:"same-origin"}),o=await WebAssembly.instantiateStreaming(n,t);return o}catch(u){ue(`wasm streaming compile failed: ${u}`),ue("falling back to ArrayBuffer instantiation")}return On(r,t)}function Pn(){return{a:Jo}}async function Fn(){function e(o,u){return R=o.exports,De=R.ia,Lr(),mt=R.oa,En(R.ja),ir("wasm-instantiate"),R}Yr("wasm-instantiate");function r(o){e(o.instance)}var t=Pn();if(l.instantiateWasm)try{return l.instantiateWasm(t,e)}catch(o){ue(`Module.instantiateWasm callback failed with error: ${o}`),h(o)}or??=An();try{var n=await Sn(xe,or,t);return r(n),n}catch(o){h(o);return}}var O,U,Tn={1978480:()=>typeof wasmOffsetConverter<"u"};class Xr{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var Ve=e=>{for(;e.length>0;)e.shift()(l)},Qr=l.noExitRuntime||!0,H={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];o==="."?e.splice(n,1):o===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=H.isAbs(e),t=e.substr(-1)==="/";return e=H.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=H.splitPath(e),t=r[0],n=r[1];return!t&&!n?".":(n&&(n=n.substr(0,n.length-1)),t+n)},basename:e=>{if(e==="/")return"/";e=H.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:(...e)=>H.normalize(e.join("/")),join2:(e,r)=>H.normalize(e+"/"+r)},xn=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);Re("initRandomDevice")},Zr=e=>(Zr=xn())(e),_e={resolve:(...e)=>{for(var r="",t=!1,n=e.length-1;n>=-1&&!t;n--){var o=n>=0?e[n]:s.cwd();if(typeof o!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";r=o+"/"+r,t=H.isAbs(o)}return r=H.normalizeArray(r.split("/").filter(u=>!!u),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=_e.resolve(e).substr(1),r=_e.resolve(r).substr(1);function t(p){for(var v=0;v<p.length&&p[v]==="";v++);for(var _=p.length-1;_>=0&&p[_]==="";_--);return v>_?[]:p.slice(v,_-v+1)}for(var n=t(e.split("/")),o=t(r.split("/")),u=Math.min(n.length,o.length),c=u,f=0;f<u;f++)if(n[f]!==o[f]){c=f;break}for(var m=[],f=c;f<n.length;f++)m.push("..");return m=m.concat(o.slice(c)),m.join("/")}},et=typeof TextDecoder<"u"?new TextDecoder:void 0,ye=(e,r=0,t=NaN)=>{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&et)return et.decode(e.subarray(r,o));for(var u="";r<o;){var c=e[r++];if(!(c&128)){u+=String.fromCharCode(c);continue}var f=e[r++]&63;if((c&224)==192){u+=String.fromCharCode((c&31)<<6|f);continue}var m=e[r++]&63;if((c&240)==224?c=(c&15)<<12|f<<6|m:c=(c&7)<<18|f<<12|m<<6|e[r++]&63,c<65536)u+=String.fromCharCode(c);else{var p=c-65536;u+=String.fromCharCode(55296|p>>10,56320|p&1023)}}return u},sr=[],We=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},ar=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,u=t+n-1,c=0;c<e.length;++c){var f=e.charCodeAt(c);if(f>=55296&&f<=57343){var m=e.charCodeAt(++c);f=65536+((f&1023)<<10)|m&1023}if(f<=127){if(t>=u)break;r[t++]=f}else if(f<=2047){if(t+1>=u)break;r[t++]=192|f>>6,r[t++]=128|f&63}else if(f<=65535){if(t+2>=u)break;r[t++]=224|f>>12,r[t++]=128|f>>6&63,r[t++]=128|f&63}else{if(t+3>=u)break;r[t++]=240|f>>18,r[t++]=128|f>>12&63,r[t++]=128|f>>6&63,r[t++]=128|f&63}}return r[t]=0,t-o};function rt(e,r,t){var n=t>0?t:We(e)+1,o=new Array(n),u=ar(e,o,0,o.length);return r&&(o.length=u),o}var Dn=()=>{if(!sr.length){var e=null;if(typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
24
24
|
`)),!e)return null;sr=rt(e,!0)}return sr.shift()},ce={ttys:[],init(){},shutdown(){},register(e,r){ce.ttys[e]={input:[],output:[],ops:r},s.registerDevice(e,ce.stream_ops)},stream_ops:{open(e){var r=ce.ttys[e.node.rdev];if(!r)throw new s.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new s.ErrnoError(60);for(var u=0,c=0;c<n;c++){var f;try{f=e.tty.ops.get_char(e.tty)}catch{throw new s.ErrnoError(29)}if(f===void 0&&u===0)throw new s.ErrnoError(6);if(f==null)break;u++,r[t+c]=f}return u&&(e.node.atime=Date.now()),u},write(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new s.ErrnoError(60);try{for(var u=0;u<n;u++)e.tty.ops.put_char(e.tty,r[t+u])}catch{throw new s.ErrnoError(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),u}},default_tty_ops:{get_char(e){return Dn()},put_char(e,r){r===null||r===10?(tr(ye(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(tr(ye(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,r,t){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(ue(ye(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(ue(ye(e.output)),e.output=[])}}},Mn=(e,r)=>{Y.fill(0,e,e+r)},tt=(e,r)=>Math.ceil(e/r)*r,nt=e=>{e=tt(e,65536);var r=Mt(65536,e);return r&&Mn(r,e),r},P={ops_table:null,mount(e){return P.createNode(null,"/",16895,0)},createNode(e,r,t,n){if(s.isBlkdev(t)||s.isFIFO(t))throw new s.ErrnoError(63);P.ops_table||={dir:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr,lookup:P.node_ops.lookup,mknod:P.node_ops.mknod,rename:P.node_ops.rename,unlink:P.node_ops.unlink,rmdir:P.node_ops.rmdir,readdir:P.node_ops.readdir,symlink:P.node_ops.symlink},stream:{llseek:P.stream_ops.llseek}},file:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr},stream:{llseek:P.stream_ops.llseek,read:P.stream_ops.read,write:P.stream_ops.write,allocate:P.stream_ops.allocate,mmap:P.stream_ops.mmap,msync:P.stream_ops.msync}},link:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr,readlink:P.node_ops.readlink},stream:{}},chrdev:{node:{getattr:P.node_ops.getattr,setattr:P.node_ops.setattr},stream:s.chrdev_stream_ops}};var o=s.createNode(e,r,t,n);return s.isDir(o.mode)?(o.node_ops=P.ops_table.dir.node,o.stream_ops=P.ops_table.dir.stream,o.contents={}):s.isFile(o.mode)?(o.node_ops=P.ops_table.file.node,o.stream_ops=P.ops_table.file.stream,o.usedBytes=0,o.contents=null):s.isLink(o.mode)?(o.node_ops=P.ops_table.link.node,o.stream_ops=P.ops_table.link.stream):s.isChrdev(o.mode)&&(o.node_ops=P.ops_table.chrdev.node,o.stream_ops=P.ops_table.chrdev.stream),o.atime=o.mtime=o.ctime=Date.now(),e&&(e.contents[r]=o,e.atime=e.mtime=e.ctime=o.atime),o},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var o=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(o.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=s.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,s.isDir(e.mode)?r.size=4096:s.isFile(e.mode)?r.size=e.usedBytes:s.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){for(let t of["mode","atime","mtime","ctime"])r[t]&&(e[t]=r[t]);r.size!==void 0&&P.resizeFileStorage(e,r.size)},lookup(e,r){throw P.doesNotExistError},mknod(e,r,t,n){return P.createNode(e,r,t,n)},rename(e,r,t){var n;try{n=s.lookupNode(r,t)}catch{}if(n){if(s.isDir(e.mode))for(var o in n.contents)throw new s.ErrnoError(55);s.hashRemoveNode(n)}delete e.parent.contents[e.name],r.contents[t]=e,e.name=t,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.contents[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var t=s.lookupNode(e,r);for(var n in t.contents)throw new s.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,r,t){var n=P.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!s.isLink(e.mode))throw new s.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var u=e.node.contents;if(o>=e.node.usedBytes)return 0;var c=Math.min(e.node.usedBytes-o,n);if(c>8&&u.subarray)r.set(u.subarray(o,o+c),t);else for(var f=0;f<c;f++)r[t+f]=u[o+f];return c},write(e,r,t,n,o,u){if(r.buffer===K.buffer&&(u=!1),!n)return 0;var c=e.node;if(c.mtime=c.ctime=Date.now(),r.subarray&&(!c.contents||c.contents.subarray)){if(u)return c.contents=r.subarray(t,t+n),c.usedBytes=n,n;if(c.usedBytes===0&&o===0)return c.contents=r.slice(t,t+n),c.usedBytes=n,n;if(o+n<=c.usedBytes)return c.contents.set(r.subarray(t,t+n),o),n}if(P.expandFileStorage(c,o+n),c.contents.subarray&&r.subarray)c.contents.set(r.subarray(t,t+n),o);else for(var f=0;f<n;f++)c.contents[o+f]=r[t+f];return c.usedBytes=Math.max(c.usedBytes,o+n),n},llseek(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&s.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new s.ErrnoError(28);return n},allocate(e,r,t){P.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap(e,r,t,n,o){if(!s.isFile(e.node.mode))throw new s.ErrnoError(43);var u,c,f=e.node.contents;if(!(o&2)&&f&&f.buffer===K.buffer)c=!1,u=f.byteOffset;else{if(c=!0,u=nt(r),!u)throw new s.ErrnoError(48);f&&((t>0||t+r<f.length)&&(f.subarray?f=f.subarray(t,t+r):f=Array.prototype.slice.call(f,t,t+r)),K.set(f,u))}return{ptr:u,allocated:c}},msync(e,r,t,n,o){return P.stream_ops.write(e,r,0,n,t,!1),0}}},jn=async e=>{var r=await Q(e);return new Uint8Array(r)},Hn=(e,r,t,n,o,u)=>{s.createDataFile(e,r,t,n,o,u)},Rn=l.preloadPlugins||[],Vn=(e,r,t,n)=>{typeof Browser<"u"&&Browser.init();var o=!1;return Rn.forEach(u=>{o||u.canHandle(r)&&(u.handle(e,r,t,n),o=!0)}),o},Wn=(e,r,t,n,o,u,c,f,m,p)=>{var v=r?_e.resolve(H.join2(e,r)):e,_=`cp ${v}`;function w(E){function C(F){p?.(),f||Hn(e,r,F,n,o,m),u?.(),ir(_)}Vn(E,v,C,()=>{c?.(),ir(_)})||C(E)}Yr(_),typeof t=="string"?jn(t).then(w,c):w(t)},Un=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);return t},lr=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},s={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{name="ErrnoError";constructor(e){this.errno=e}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.id=s.nextInode++,this.name=r,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return s.isDir(this.mode)}get isDevice(){return s.isChrdev(this.mode)}},lookupPath(e,r={}){if(!e)return{path:"",node:null};r.follow_mount??=!0,H.isAbs(e)||(e=s.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var n=e.split("/").filter(p=>!!p&&p!=="."),o=s.root,u="/",c=0;c<n.length;c++){var f=c===n.length-1;if(f&&r.parent)break;if(n[c]===".."){u=H.dirname(u),o=o.parent;continue}u=H.join2(u,n[c]);try{o=s.lookupNode(o,n[c])}catch(p){if(p?.errno===44&&f&&r.noent_okay)return{path:u};throw p}if(s.isMountpoint(o)&&(!f||r.follow_mount)&&(o=o.mounted.root),s.isLink(o.mode)&&(!f||r.follow)){if(!o.node_ops.readlink)throw new s.ErrnoError(52);var m=o.node_ops.readlink(o);H.isAbs(m)||(m=H.dirname(u)+"/"+m),e=m+"/"+n.slice(c+1).join("/");continue e}}return{path:u,node:o}}throw new s.ErrnoError(32)},getPath(e){for(var r;;){if(s.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?`${t}/${r}`:t+r:t}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%s.nameTable.length},hashAddNode(e){var r=s.hashName(e.parent.id,e.name);e.name_next=s.nameTable[r],s.nameTable[r]=e},hashRemoveNode(e){var r=s.hashName(e.parent.id,e.name);if(s.nameTable[r]===e)s.nameTable[r]=e.name_next;else for(var t=s.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=s.mayLookup(e);if(t)throw new s.ErrnoError(t);for(var n=s.hashName(e.id,r),o=s.nameTable[n];o;o=o.name_next){var u=o.name;if(o.parent.id===e.id&&u===r)return o}return s.lookup(e,r)},createNode(e,r,t,n){var o=new s.FSNode(e,r,t,n);return s.hashAddNode(o),o},destroyNode(e){s.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return s.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!s.isDir(e.mode))return 54;var r=s.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!s.isDir(e.mode))return 54;try{var t=s.lookupNode(e,r);return 20}catch{}return s.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=s.lookupNode(e,r)}catch(u){return u.errno}var o=s.nodePermissions(e,"wx");if(o)return o;if(t){if(!s.isDir(n.mode))return 54;if(s.isRoot(n)||s.getPath(n)===s.cwd())return 10}else if(s.isDir(n.mode))return 31;return 0},mayOpen(e,r){return e?s.isLink(e.mode)?32:s.isDir(e.mode)&&(s.flagsToPermissionString(r)!=="r"||r&512)?31:s.nodePermissions(e,s.flagsToPermissionString(r)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=s.MAX_OPEN_FDS;e++)if(!s.streams[e])return e;throw new s.ErrnoError(33)},getStreamChecked(e){var r=s.getStream(e);if(!r)throw new s.ErrnoError(8);return r},getStream:e=>s.streams[e],createStream(e,r=-1){return e=Object.assign(new s.FSStream,e),r==-1&&(r=s.nextfd()),e.fd=r,s.streams[r]=e,e},closeStream(e){s.streams[e]=null},dupStream(e,r=-1){var t=s.createStream(e,r);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(e){var r=s.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new s.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){s.devices[e]={stream_ops:r}},getDevice:e=>s.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),s.syncFSRequests++,s.syncFSRequests>1&&ue(`warning: ${s.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=s.getMounts(s.root.mount),n=0;function o(c){return s.syncFSRequests--,r(c)}function u(c){if(c)return u.errored?void 0:(u.errored=!0,o(c));++n>=t.length&&o(null)}t.forEach(c=>{if(!c.type.syncfs)return u(null);c.type.syncfs(c,e,u)})},mount(e,r,t){var n=t==="/",o=!t,u;if(n&&s.root)throw new s.ErrnoError(10);if(!n&&!o){var c=s.lookupPath(t,{follow_mount:!1});if(t=c.path,u=c.node,s.isMountpoint(u))throw new s.ErrnoError(10);if(!s.isDir(u.mode))throw new s.ErrnoError(54)}var f={type:e,opts:r,mountpoint:t,mounts:[]},m=e.mount(f);return m.mount=f,f.root=m,n?s.root=m:u&&(u.mounted=f,u.mount&&u.mount.mounts.push(f)),m},unmount(e){var r=s.lookupPath(e,{follow_mount:!1});if(!s.isMountpoint(r.node))throw new s.ErrnoError(28);var t=r.node,n=t.mounted,o=s.getMounts(n);Object.keys(s.nameTable).forEach(c=>{for(var f=s.nameTable[c];f;){var m=f.name_next;o.includes(f.mount)&&s.destroyNode(f),f=m}}),t.mounted=null;var u=t.mount.mounts.indexOf(n);t.mount.mounts.splice(u,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var n=s.lookupPath(e,{parent:!0}),o=n.node,u=H.basename(e);if(!u||u==="."||u==="..")throw new s.ErrnoError(28);var c=s.mayCreate(o,u);if(c)throw new s.ErrnoError(c);if(!o.node_ops.mknod)throw new s.ErrnoError(63);return o.node_ops.mknod(o,u,r,t)},statfs(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:s.nextInode,ffree:s.nextInode-1,fsid:42,flags:2,namelen:255},t=s.lookupPath(e,{follow:!0}).node;return t?.node_ops.statfs&&Object.assign(r,t.node_ops.statfs(t.mount.opts.root)),r},create(e,r=438){return r&=4095,r|=32768,s.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,s.mknod(e,r,0)},mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{s.mkdir(n,r)}catch(u){if(u.errno!=20)throw u}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,s.mknod(e,r,t)},symlink(e,r){if(!_e.resolve(e))throw new s.ErrnoError(44);var t=s.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new s.ErrnoError(44);var o=H.basename(r),u=s.mayCreate(n,o);if(u)throw new s.ErrnoError(u);if(!n.node_ops.symlink)throw new s.ErrnoError(63);return n.node_ops.symlink(n,o,e)},rename(e,r){var t=H.dirname(e),n=H.dirname(r),o=H.basename(e),u=H.basename(r),c,f,m;if(c=s.lookupPath(e,{parent:!0}),f=c.node,c=s.lookupPath(r,{parent:!0}),m=c.node,!f||!m)throw new s.ErrnoError(44);if(f.mount!==m.mount)throw new s.ErrnoError(75);var p=s.lookupNode(f,o),v=_e.relative(e,n);if(v.charAt(0)!==".")throw new s.ErrnoError(28);if(v=_e.relative(r,t),v.charAt(0)!==".")throw new s.ErrnoError(55);var _;try{_=s.lookupNode(m,u)}catch{}if(p!==_){var w=s.isDir(p.mode),E=s.mayDelete(f,o,w);if(E)throw new s.ErrnoError(E);if(E=_?s.mayDelete(m,u,w):s.mayCreate(m,u),E)throw new s.ErrnoError(E);if(!f.node_ops.rename)throw new s.ErrnoError(63);if(s.isMountpoint(p)||_&&s.isMountpoint(_))throw new s.ErrnoError(10);if(m!==f&&(E=s.nodePermissions(f,"w"),E))throw new s.ErrnoError(E);s.hashRemoveNode(p);try{f.node_ops.rename(p,m,u),p.parent=m}catch(C){throw C}finally{s.hashAddNode(p)}}},rmdir(e){var r=s.lookupPath(e,{parent:!0}),t=r.node,n=H.basename(e),o=s.lookupNode(t,n),u=s.mayDelete(t,n,!0);if(u)throw new s.ErrnoError(u);if(!t.node_ops.rmdir)throw new s.ErrnoError(63);if(s.isMountpoint(o))throw new s.ErrnoError(10);t.node_ops.rmdir(t,n),s.destroyNode(o)},readdir(e){var r=s.lookupPath(e,{follow:!0}),t=r.node;if(!t.node_ops.readdir)throw new s.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var r=s.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new s.ErrnoError(44);var n=H.basename(e),o=s.lookupNode(t,n),u=s.mayDelete(t,n,!1);if(u)throw new s.ErrnoError(u);if(!t.node_ops.unlink)throw new s.ErrnoError(63);if(s.isMountpoint(o))throw new s.ErrnoError(10);t.node_ops.unlink(t,n),s.destroyNode(o)},readlink(e){var r=s.lookupPath(e),t=r.node;if(!t)throw new s.ErrnoError(44);if(!t.node_ops.readlink)throw new s.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,r){var t=s.lookupPath(e,{follow:!r}),n=t.node;if(!n)throw new s.ErrnoError(44);if(!n.node_ops.getattr)throw new s.ErrnoError(63);return n.node_ops.getattr(n)},lstat(e){return s.stat(e,!0)},chmod(e,r,t){var n;if(typeof e=="string"){var o=s.lookupPath(e,{follow:!t});n=o.node}else n=e;if(!n.node_ops.setattr)throw new s.ErrnoError(63);n.node_ops.setattr(n,{mode:r&4095|n.mode&-4096,ctime:Date.now()})},lchmod(e,r){s.chmod(e,r,!0)},fchmod(e,r){var t=s.getStreamChecked(e);s.chmod(t.node,r)},chown(e,r,t,n){var o;if(typeof e=="string"){var u=s.lookupPath(e,{follow:!n});o=u.node}else o=e;if(!o.node_ops.setattr)throw new s.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){s.chown(e,r,t,!0)},fchown(e,r,t){var n=s.getStreamChecked(e);s.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new s.ErrnoError(28);var t;if(typeof e=="string"){var n=s.lookupPath(e,{follow:!0});t=n.node}else t=e;if(!t.node_ops.setattr)throw new s.ErrnoError(63);if(s.isDir(t.mode))throw new s.ErrnoError(31);if(!s.isFile(t.mode))throw new s.ErrnoError(28);var o=s.nodePermissions(t,"w");if(o)throw new s.ErrnoError(o);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=s.getStreamChecked(e);if(!(t.flags&2097155))throw new s.ErrnoError(28);s.truncate(t.node,r)},utime(e,r,t){var n=s.lookupPath(e,{follow:!0}),o=n.node;o.node_ops.setattr(o,{atime:r,mtime:t})},open(e,r,t=438){if(e==="")throw new s.ErrnoError(44);r=typeof r=="string"?Un(r):r,r&64?t=t&4095|32768:t=0;var n;if(typeof e=="object")n=e;else{var o=s.lookupPath(e,{follow:!(r&131072),noent_okay:!0});n=o.node,e=o.path}var u=!1;if(r&64)if(n){if(r&128)throw new s.ErrnoError(20)}else n=s.mknod(e,t,0),u=!0;if(!n)throw new s.ErrnoError(44);if(s.isChrdev(n.mode)&&(r&=-513),r&65536&&!s.isDir(n.mode))throw new s.ErrnoError(54);if(!u){var c=s.mayOpen(n,r);if(c)throw new s.ErrnoError(c)}r&512&&!u&&s.truncate(n,0),r&=-131713;var f=s.createStream({node:n,path:s.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return f.stream_ops.open&&f.stream_ops.open(f),l.logReadFiles&&!(r&1)&&(e in s.readFiles||(s.readFiles[e]=1)),f},close(e){if(s.isClosed(e))throw new s.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{s.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(s.isClosed(e))throw new s.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new s.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new s.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new s.ErrnoError(28);if(s.isClosed(e))throw new s.ErrnoError(8);if((e.flags&2097155)===1)throw new s.ErrnoError(8);if(s.isDir(e.node.mode))throw new s.ErrnoError(31);if(!e.stream_ops.read)throw new s.ErrnoError(28);var u=typeof o<"u";if(!u)o=e.position;else if(!e.seekable)throw new s.ErrnoError(70);var c=e.stream_ops.read(e,r,t,n,o);return u||(e.position+=c),c},write(e,r,t,n,o,u){if(n<0||o<0)throw new s.ErrnoError(28);if(s.isClosed(e))throw new s.ErrnoError(8);if(!(e.flags&2097155))throw new s.ErrnoError(8);if(s.isDir(e.node.mode))throw new s.ErrnoError(31);if(!e.stream_ops.write)throw new s.ErrnoError(28);e.seekable&&e.flags&1024&&s.llseek(e,0,2);var c=typeof o<"u";if(!c)o=e.position;else if(!e.seekable)throw new s.ErrnoError(70);var f=e.stream_ops.write(e,r,t,n,o,u);return c||(e.position+=f),f},allocate(e,r,t){if(s.isClosed(e))throw new s.ErrnoError(8);if(r<0||t<=0)throw new s.ErrnoError(28);if(!(e.flags&2097155))throw new s.ErrnoError(8);if(!s.isFile(e.node.mode)&&!s.isDir(e.node.mode))throw new s.ErrnoError(43);if(!e.stream_ops.allocate)throw new s.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap(e,r,t,n,o){if(n&2&&!(o&2)&&(e.flags&2097155)!==2)throw new s.ErrnoError(2);if((e.flags&2097155)===1)throw new s.ErrnoError(2);if(!e.stream_ops.mmap)throw new s.ErrnoError(43);if(!r)throw new s.ErrnoError(28);return e.stream_ops.mmap(e,r,t,n,o)},msync(e,r,t,n,o){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new s.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=s.open(e,r.flags),o=s.stat(e),u=o.size,c=new Uint8Array(u);return s.read(n,c,0,u,0),r.encoding==="utf8"?t=ye(c):r.encoding==="binary"&&(t=c),s.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=s.open(e,t.flags,t.mode);if(typeof r=="string"){var o=new Uint8Array(We(r)+1),u=ar(r,o,0,o.length);s.write(n,o,0,u,void 0,t.canOwn)}else if(ArrayBuffer.isView(r))s.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");s.close(n)},cwd:()=>s.currentPath,chdir(e){var r=s.lookupPath(e,{follow:!0});if(r.node===null)throw new s.ErrnoError(44);if(!s.isDir(r.node.mode))throw new s.ErrnoError(54);var t=s.nodePermissions(r.node,"x");if(t)throw new s.ErrnoError(t);s.currentPath=r.path},createDefaultDirectories(){s.mkdir("/tmp"),s.mkdir("/home"),s.mkdir("/home/web_user")},createDefaultDevices(){s.mkdir("/dev"),s.registerDevice(s.makedev(1,3),{read:()=>0,write:(n,o,u,c,f)=>c,llseek:()=>0}),s.mkdev("/dev/null",s.makedev(1,3)),ce.register(s.makedev(5,0),ce.default_tty_ops),ce.register(s.makedev(6,0),ce.default_tty1_ops),s.mkdev("/dev/tty",s.makedev(5,0)),s.mkdev("/dev/tty1",s.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(r=Zr(e).byteLength),e[--r]);s.createDevice("/dev","random",t),s.createDevice("/dev","urandom",t),s.mkdir("/dev/shm"),s.mkdir("/dev/shm/tmp")},createSpecialDirectories(){s.mkdir("/proc");var e=s.mkdir("/proc/self");s.mkdir("/proc/self/fd"),s.mount({mount(){var r=s.createNode(e,"fd",16895,73);return r.stream_ops={llseek:P.stream_ops.llseek},r.node_ops={lookup(t,n){var o=+n,u=s.getStreamChecked(o),c={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>u.path},id:o+1};return c.parent=c,c},readdir(){return Array.from(s.streams.entries()).filter(([t,n])=>n).map(([t,n])=>t.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?s.createDevice("/dev","stdin",e):s.symlink("/dev/tty","/dev/stdin"),r?s.createDevice("/dev","stdout",null,r):s.symlink("/dev/tty","/dev/stdout"),t?s.createDevice("/dev","stderr",null,t):s.symlink("/dev/tty1","/dev/stderr");var n=s.open("/dev/stdin",0),o=s.open("/dev/stdout",1),u=s.open("/dev/stderr",1)},staticInit(){s.nameTable=new Array(4096),s.mount(P,{},"/"),s.createDefaultDirectories(),s.createDefaultDevices(),s.createSpecialDirectories(),s.filesystems={MEMFS:P}},init(e,r,t){s.initialized=!0,e??=l.stdin,r??=l.stdout,t??=l.stderr,s.createStandardStreams(e,r,t)},quit(){s.initialized=!1;for(var e=0;e<s.streams.length;e++){var r=s.streams[e];r&&s.close(r)}},findObject(e,r){var t=s.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=s.lookupPath(e,{follow:!r});e=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=s.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=H.basename(e),t=s.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(o){n.error=o.errno}return n},createPath(e,r,t,n){e=typeof e=="string"?e:s.getPath(e);for(var o=r.split("/").reverse();o.length;){var u=o.pop();if(u){var c=H.join2(e,u);try{s.mkdir(c)}catch{}e=c}}return c},createFile(e,r,t,n,o){var u=H.join2(typeof e=="string"?e:s.getPath(e),r),c=lr(n,o);return s.create(u,c)},createDataFile(e,r,t,n,o,u){var c=r;e&&(e=typeof e=="string"?e:s.getPath(e),c=r?H.join2(e,r):e);var f=lr(n,o),m=s.create(c,f);if(t){if(typeof t=="string"){for(var p=new Array(t.length),v=0,_=t.length;v<_;++v)p[v]=t.charCodeAt(v);t=p}s.chmod(m,f|146);var w=s.open(m,577);s.write(w,t,0,t.length,0,u),s.close(w),s.chmod(m,f)}},createDevice(e,r,t,n){var o=H.join2(typeof e=="string"?e:s.getPath(e),r),u=lr(!!t,!!n);s.createDevice.major??=64;var c=s.makedev(s.createDevice.major++,0);return s.registerDevice(c,{open(f){f.seekable=!1},close(f){n?.buffer?.length&&n(10)},read(f,m,p,v,_){for(var w=0,E=0;E<v;E++){var C;try{C=t()}catch{throw new s.ErrnoError(29)}if(C===void 0&&w===0)throw new s.ErrnoError(6);if(C==null)break;w++,m[p+E]=C}return w&&(f.node.atime=Date.now()),w},write(f,m,p,v,_){for(var w=0;w<v;w++)try{n(m[p+w])}catch{throw new s.ErrnoError(29)}return v&&(f.node.mtime=f.node.ctime=Date.now()),w}}),s.mkdev(o,u,c)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=fe(e.url),e.usedBytes=e.contents.length}catch{throw new s.ErrnoError(29)}},createLazyFile(e,r,t,n,o){class u{lengthKnown=!1;chunks=[];get(E){if(!(E>this.length-1||E<0)){var C=E%this.chunkSize,F=E/this.chunkSize|0;return this.getter(F)[C]}}setDataGetter(E){this.getter=E}cacheLength(){var E=new XMLHttpRequest;if(E.open("HEAD",t,!1),E.send(null),!(E.status>=200&&E.status<300||E.status===304))throw new Error("Couldn't load "+t+". Status: "+E.status);var C=Number(E.getResponseHeader("Content-length")),F,N=(F=E.getResponseHeader("Accept-Ranges"))&&F==="bytes",M=(F=E.getResponseHeader("Content-Encoding"))&&F==="gzip",z=1024*1024;N||(z=C);var V=(X,ae)=>{if(X>ae)throw new Error("invalid range ("+X+", "+ae+") or no bytes requested!");if(ae>C-1)throw new Error("only "+C+" bytes available! programmer error!");var q=new XMLHttpRequest;if(q.open("GET",t,!1),C!==z&&q.setRequestHeader("Range","bytes="+X+"-"+ae),q.responseType="arraybuffer",q.overrideMimeType&&q.overrideMimeType("text/plain; charset=x-user-defined"),q.send(null),!(q.status>=200&&q.status<300||q.status===304))throw new Error("Couldn't load "+t+". Status: "+q.status);return q.response!==void 0?new Uint8Array(q.response||[]):rt(q.responseText||"",!0)},ve=this;ve.setDataGetter(X=>{var ae=X*z,q=(X+1)*z-1;if(q=Math.min(q,C-1),typeof ve.chunks[X]>"u"&&(ve.chunks[X]=V(ae,q)),typeof ve.chunks[X]>"u")throw new Error("doXHR failed!");return ve.chunks[X]}),(M||!C)&&(z=C=1,C=this.getter(0).length,z=C,tr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=C,this._chunkSize=z,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!b)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var c=new u,f={isDevice:!1,contents:c}}else var f={isDevice:!1,url:t};var m=s.createFile(e,r,f,n,o);f.contents?m.contents=f.contents:f.url&&(m.contents=null,m.url=f.url),Object.defineProperties(m,{usedBytes:{get:function(){return this.contents.length}}});var p={},v=Object.keys(m.stream_ops);v.forEach(w=>{var E=m.stream_ops[w];p[w]=(...C)=>(s.forceLoadFile(m),E(...C))});function _(w,E,C,F,N){var M=w.node.contents;if(N>=M.length)return 0;var z=Math.min(M.length-N,F);if(M.slice)for(var V=0;V<z;V++)E[C+V]=M[N+V];else for(var V=0;V<z;V++)E[C+V]=M.get(N+V);return z}return p.read=(w,E,C,F,N)=>(s.forceLoadFile(m),_(w,E,C,F,N)),p.mmap=(w,E,C,F,N)=>{s.forceLoadFile(m);var M=nt(E);if(!M)throw new s.ErrnoError(48);return _(w,K,M,E,C),{ptr:M,allocated:!0}},m.stream_ops=p,m}},it=(e,r)=>e?ye(Y,e,r):"",x={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(H.isAbs(r))return r;var n;if(e===-100)n=s.cwd();else{var o=x.getStreamFromFD(e);n=o.path}if(r.length==0){if(!t)throw new s.ErrnoError(44);return n}return n+"/"+r},doStat(e,r,t){var n=e(r);A[t>>2]=n.dev,A[t+4>>2]=n.mode,j[t+8>>2]=n.nlink,A[t+12>>2]=n.uid,A[t+16>>2]=n.gid,A[t+20>>2]=n.rdev,U=[n.size>>>0,(O=n.size,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+24>>2]=U[0],A[t+28>>2]=U[1],A[t+32>>2]=4096,A[t+36>>2]=n.blocks;var o=n.atime.getTime(),u=n.mtime.getTime(),c=n.ctime.getTime();return U=[Math.floor(o/1e3)>>>0,(O=Math.floor(o/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+40>>2]=U[0],A[t+44>>2]=U[1],j[t+48>>2]=o%1e3*1e3*1e3,U=[Math.floor(u/1e3)>>>0,(O=Math.floor(u/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+56>>2]=U[0],A[t+60>>2]=U[1],j[t+64>>2]=u%1e3*1e3*1e3,U=[Math.floor(c/1e3)>>>0,(O=Math.floor(c/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+72>>2]=U[0],A[t+76>>2]=U[1],j[t+80>>2]=c%1e3*1e3*1e3,U=[n.ino>>>0,(O=n.ino,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[t+88>>2]=U[0],A[t+92>>2]=U[1],0},doMsync(e,r,t,n,o){if(!s.isFile(r.node.mode))throw new s.ErrnoError(43);if(n&2)return 0;var u=Y.slice(e,e+t);s.msync(r,u,o,t,n)},getStreamFromFD(e){var r=s.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=it(e);return r}};function In(e,r,t,n){try{if(r=x.getStr(r),r=x.calculateAt(e,r),t&-8)return-28;var o=s.lookupPath(r,{follow:!0}),u=o.node;if(!u)return-44;var c="";return t&4&&(c+="r"),t&2&&(c+="w"),t&1&&(c+="x"),c&&s.nodePermissions(u,c)?-2:0}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}var Ue=()=>{var e=A[+x.varargs>>2];return x.varargs+=4,e},we=Ue;function Nn(e,r,t){x.varargs=t;try{var n=x.getStreamFromFD(e);switch(r){case 0:{var o=Ue();if(o<0)return-28;for(;s.streams[o];)o++;var u;return u=s.dupStream(n,o),u.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var o=Ue();return n.flags|=o,0}case 12:{var o=we(),c=0;return ne[o+c>>1]=2,0}case 13:case 14:return 0}return-28}catch(f){if(typeof s>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function Bn(e,r){try{var t=x.getStreamFromFD(e);return x.doStat(s.stat,t.path,r)}catch(n){if(typeof s>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var he=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN;function Ln(e,r,t){var n=he(r,t);try{return isNaN(n)?61:(s.ftruncate(e,n),0)}catch(o){if(typeof s>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var ur=(e,r,t)=>ar(e,Y,r,t);function qn(e,r,t){try{var n=x.getStreamFromFD(e);n.getdents||=s.readdir(n.path);for(var o=280,u=0,c=s.llseek(n,0,1),f=Math.floor(c/o),m=Math.min(n.getdents.length,f+Math.floor(t/o)),p=f;p<m;p++){var v,_,w=n.getdents[p];if(w===".")v=n.node.id,_=4;else if(w===".."){var E=s.lookupPath(n.path,{parent:!0});v=E.node.id,_=4}else{var C;try{C=s.lookupNode(n.node,w)}catch(F){if(F?.errno===28)continue;throw F}v=C.id,_=s.isChrdev(C.mode)?2:s.isDir(C.mode)?4:s.isLink(C.mode)?10:8}U=[v>>>0,(O=v,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[r+u>>2]=U[0],A[r+u+4>>2]=U[1],U=[(p+1)*o>>>0,(O=(p+1)*o,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],A[r+u+8>>2]=U[0],A[r+u+12>>2]=U[1],ne[r+u+16>>1]=280,K[r+u+18]=_,ur(w,r+u+19,256),u+=o}return s.llseek(n,p*o,0),u}catch(F){if(typeof s>"u"||F.name!=="ErrnoError")throw F;return-F.errno}}function zn(e,r,t){x.varargs=t;try{var n=x.getStreamFromFD(e);switch(r){case 21509:return n.tty?0:-59;case 21505:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),u=we();A[u>>2]=o.c_iflag||0,A[u+4>>2]=o.c_oflag||0,A[u+8>>2]=o.c_cflag||0,A[u+12>>2]=o.c_lflag||0;for(var c=0;c<32;c++)K[u+c+17]=o.c_cc[c]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var u=we(),f=A[u>>2],m=A[u+4>>2],p=A[u+8>>2],v=A[u+12>>2],_=[],c=0;c<32;c++)_.push(K[u+c+17]);return n.tty.ops.ioctl_tcsets(n.tty,r,{c_iflag:f,c_oflag:m,c_cflag:p,c_lflag:v,c_cc:_})}return 0}case 21519:{if(!n.tty)return-59;var u=we();return A[u>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var u=we();return s.ioctl(n,r,u)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var w=n.tty.ops.ioctl_tiocgwinsz(n.tty),u=we();ne[u>>1]=w[0],ne[u+2>>1]=w[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(E){if(typeof s>"u"||E.name!=="ErrnoError")throw E;return-E.errno}}function Gn(e,r){try{return e=x.getStr(e),x.doStat(s.lstat,e,r)}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function Jn(e,r,t,n){try{r=x.getStr(r);var o=n&256,u=n&4096;return n=n&-6401,r=x.calculateAt(e,r,u),x.doStat(o?s.lstat:s.stat,r,t)}catch(c){if(typeof s>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}function Yn(e,r,t,n){x.varargs=n;try{r=x.getStr(r),r=x.calculateAt(e,r);var o=n?Ue():0;return s.open(r,t,o).fd}catch(u){if(typeof s>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Kn(e,r,t,n){try{return r=x.getStr(r),n=x.getStr(n),r=x.calculateAt(e,r),n=x.calculateAt(t,n),s.rename(r,n),0}catch(o){if(typeof s>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Xn(e){try{return e=x.getStr(e),s.rmdir(e),0}catch(r){if(typeof s>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function Qn(e,r){try{return e=x.getStr(e),x.doStat(s.stat,e,r)}catch(t){if(typeof s>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function Zn(e,r,t){try{return r=x.getStr(r),r=x.calculateAt(e,r),t===0?s.unlink(r):t===512?s.rmdir(r):Re("Invalid flags passed to unlinkat"),0}catch(n){if(typeof s>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var ei=()=>Re(""),Ie={},Ne=e=>{for(;e.length;){var r=e.pop(),t=e.pop();t(r)}};function ke(e){return this.fromWireType(j[e>>2])}var Ee={},me={},Be={},ot,Le=e=>{throw new ot(e)},Z=(e,r,t)=>{e.forEach(f=>Be[f]=r);function n(f){var m=t(f);m.length!==e.length&&Le("Mismatched type converter count");for(var p=0;p<e.length;++p)te(e[p],m[p])}var o=new Array(r.length),u=[],c=0;r.forEach((f,m)=>{me.hasOwnProperty(f)?o[m]=me[f]:(u.push(f),Ee.hasOwnProperty(f)||(Ee[f]=[]),Ee[f].push(()=>{o[m]=me[f],++c,c===u.length&&n(o)}))}),u.length===0&&n(o)},ri=e=>{var r=Ie[e];delete Ie[e];var t=r.rawConstructor,n=r.rawDestructor,o=r.fields,u=o.map(c=>c.getterReturnType).concat(o.map(c=>c.setterArgumentType));Z([e],u,c=>{var f={};return o.forEach((m,p)=>{var v=m.fieldName,_=c[p],w=m.getter,E=m.getterContext,C=c[p+o.length],F=m.setter,N=m.setterContext;f[v]={read:M=>_.fromWireType(w(E,M)),write:(M,z)=>{var V=[];F(N,M,C.toWireType(V,z)),Ne(V)}}}),[{name:r.name,fromWireType:m=>{var p={};for(var v in f)p[v]=f[v].read(m);return n(m),p},toWireType:(m,p)=>{for(var v in f)if(!(v in p))throw new TypeError(`Missing field: "${v}"`);var _=t();for(v in f)f[v].write(_,p[v]);return m!==null&&m.push(n,_),_},argPackAdvance:ie,readValueFromPointer:ke,destructorFunction:n}]})},ti=(e,r,t,n,o)=>{},ni=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);st=e},st,G=e=>{for(var r="",t=e;Y[t];)r+=st[Y[t++]];return r},be,D=e=>{throw new be(e)};function ii(e,r,t={}){var n=r.name;if(e||D(`type "${n}" must have a positive integer typeid pointer`),me.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;D(`Cannot register type '${n}' twice`)}if(me[e]=r,delete Be[e],Ee.hasOwnProperty(e)){var o=Ee[e];delete Ee[e],o.forEach(u=>u())}}function te(e,r,t={}){return ii(e,r,t)}var ie=8,oi=(e,r,t,n)=>{r=G(r),te(e,{name:r,fromWireType:function(o){return!!o},toWireType:function(o,u){return u?t:n},argPackAdvance:ie,readValueFromPointer:function(o){return this.fromWireType(Y[o])},destructorFunction:null})},si=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),cr=e=>{function r(t){return t.$$.ptrType.registeredClass.name}D(r(e)+" instance already deleted")},fr=!1,at=e=>{},ai=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},lt=e=>{e.count.value-=1;var r=e.count.value===0;r&&ai(e)},ut=(e,r,t)=>{if(r===t)return e;if(t.baseClass===void 0)return null;var n=ut(e,r,t.baseClass);return n===null?null:t.downcast(n)},ct={},li={},ui=(e,r)=>{for(r===void 0&&D("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},ci=(e,r)=>(r=ui(e,r),li[r]),qe=(e,r)=>{(!r.ptrType||!r.ptr)&&Le("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Le("Both smartPtrType and smartPtr must be specified"),r.count={value:1},$e(Object.create(e,{$$:{value:r,writable:!0}}))};function fi(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=ci(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?qe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):qe(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),c=ct[u];if(!c)return o.call(this);var f;this.isConst?f=c.constPointerType:f=c.pointerType;var m=ut(r,this.registeredClass,f.registeredClass);return m===null?o.call(this):this.isSmartPointer?qe(f.registeredClass.instancePrototype,{ptrType:f,ptr:m,smartPtrType:this,smartPtr:e}):qe(f.registeredClass.instancePrototype,{ptrType:f,ptr:m})}var $e=e=>typeof FinalizationRegistry>"u"?($e=r=>r,e):(fr=new FinalizationRegistry(r=>{lt(r.$$)}),$e=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var o={$$:t};fr.register(r,o,r)}return r},at=r=>fr.unregister(r),$e(e)),ze=[],di=()=>{for(;ze.length;){var e=ze.pop();e.$$.deleteScheduled=!1,e.delete()}},ft,hi=()=>{Object.assign(Ge.prototype,{isAliasOf(e){if(!(this instanceof Ge)||!(e instanceof Ge))return!1;var r=this.$$.ptrType.registeredClass,t=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,o=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return r===n&&t===o},clone(){if(this.$$.ptr||cr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=$e(Object.create(Object.getPrototypeOf(this),{$$:{value:si(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||cr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&D("Object already scheduled for deletion"),at(this),lt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||cr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&D("Object already scheduled for deletion"),ze.push(this),ze.length===1&&ft&&ft(di),this.$$.deleteScheduled=!0,this}})};function Ge(){}var Oe=(e,r)=>Object.defineProperty(r,"name",{value:e}),dr=(e,r,t)=>{if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(...o){return e[r].overloadTable.hasOwnProperty(o.length)||D(`Function '${t}' called with an invalid number of arguments (${o.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[o.length].apply(this,o)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},dt=(e,r,t)=>{l.hasOwnProperty(e)?((t===void 0||l[e].overloadTable!==void 0&&l[e].overloadTable[t]!==void 0)&&D(`Cannot register public name '${e}' twice`),dr(l,e,e),l[e].overloadTable.hasOwnProperty(t)&&D(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),l[e].overloadTable[t]=r):(l[e]=r,l[e].argCount=t)},mi=48,pi=57,vi=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=mi&&r<=pi?`_${e}`:e};function gi(e,r,t,n,o,u,c,f){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=o,this.getActualType=u,this.upcast=c,this.downcast=f,this.pureVirtualFunctions=[]}var Je=(e,r,t)=>{for(;r!==t;)r.upcast||D(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function _i(e,r){if(r===null)return this.isReference&&D(`null is not a valid ${this.name}`),0;r.$$||D(`Cannot pass "${vr(r)}" as a ${this.name}`),r.$$.ptr||D(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Je(r.$$.ptr,t,this.registeredClass);return n}function yi(e,r){var t;if(r===null)return this.isReference&&D(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;(!r||!r.$$)&&D(`Cannot pass "${vr(r)}" as a ${this.name}`),r.$$.ptr||D(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&D(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(t=Je(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&D("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:D(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var o=r.clone();t=this.rawShare(t,ee.toHandle(()=>o.delete())),e!==null&&e.push(this.rawDestructor,t)}break;default:D("Unsupporting sharing policy")}return t}function wi(e,r){if(r===null)return this.isReference&&D(`null is not a valid ${this.name}`),0;r.$$||D(`Cannot pass "${vr(r)}" as a ${this.name}`),r.$$.ptr||D(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&D(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass,n=Je(r.$$.ptr,t,this.registeredClass);return n}var Ei=()=>{Object.assign(Se.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:ie,readValueFromPointer:ke,fromWireType:fi})};function Se(e,r,t,n,o,u,c,f,m,p,v){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=o,this.pointeeType=u,this.sharingPolicy=c,this.rawGetPointee=f,this.rawConstructor=m,this.rawShare=p,this.rawDestructor=v,!o&&r.baseClass===void 0?n?(this.toWireType=_i,this.destructorFunction=null):(this.toWireType=wi,this.destructorFunction=null):this.toWireType=yi}var ht=(e,r,t)=>{l.hasOwnProperty(e)||Le("Replacing nonexistent public symbol"),l[e].overloadTable!==void 0&&t!==void 0?l[e].overloadTable[t]=r:(l[e]=r,l[e].argCount=t)},bi=(e,r,t)=>{e=e.replace(/p/g,"i");var n=l["dynCall_"+e];return n(r,...t)},Ye=[],mt,pt=e=>{var r=Ye[e];return r||(e>=Ye.length&&(Ye.length=e+1),Ye[e]=r=mt.get(e)),r},Ci=(e,r,t=[])=>{if(e.includes("j"))return bi(e,r,t);var n=pt(r)(...t);return n},Ai=(e,r)=>(...t)=>Ci(e,r,t),J=(e,r)=>{e=G(e);function t(){return e.includes("j")?Ai(e,r):pt(r)}var n=t();return typeof n!="function"&&D(`unknown function pointer with signature ${e}: ${r}`),n},ki=(e,r)=>{var t=Oe(r,function(n){this.name=r,this.message=n;var o=new Error(n).stack;o!==void 0&&(this.stack=this.toString()+`
|
|
25
25
|
`+o.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},t},vt,gt=e=>{var r=xt(e),t=G(r);return se(r),t},pe=(e,r)=>{var t=[],n={};function o(u){if(!n[u]&&!me[u]){if(Be[u]){Be[u].forEach(o);return}t.push(u),n[u]=!0}}throw r.forEach(o),new vt(`${e}: `+t.map(gt).join([", "]))},$i=(e,r,t,n,o,u,c,f,m,p,v,_,w)=>{v=G(v),u=J(o,u),f&&=J(c,f),p&&=J(m,p),w=J(_,w);var E=vi(v);dt(E,function(){pe(`Cannot construct ${v} due to unbound types`,[n])}),Z([e,r,t],n?[n]:[],C=>{C=C[0];var F,N;n?(F=C.registeredClass,N=F.instancePrototype):N=Ge.prototype;var M=Oe(v,function(...q){if(Object.getPrototypeOf(this)!==z)throw new be("Use 'new' to construct "+v);if(V.constructor_body===void 0)throw new be(v+" has no accessible constructor");var Ut=V.constructor_body[q.length];if(Ut===void 0)throw new be(`Tried to invoke ctor of ${v} with invalid number of parameters (${q.length}) - expected (${Object.keys(V.constructor_body).toString()}) parameters instead!`);return Ut.apply(this,q)}),z=Object.create(N,{constructor:{value:M}});M.prototype=z;var V=new gi(v,M,z,w,F,u,f,p);V.baseClass&&(V.baseClass.__derivedClasses??=[],V.baseClass.__derivedClasses.push(V));var ve=new Se(v,V,!0,!1,!1),X=new Se(v+"*",V,!1,!1,!1),ae=new Se(v+" const*",V,!1,!0,!1);return ct[e]={pointerType:X,constPointerType:ae},ht(E,M),[ve,X,ae]})};function _t(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function yt(e,r){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var t=Oe(e.name||"unknownFunctionName",function(){});t.prototype=e.prototype;var n=new t,o=e.apply(n,r);return o instanceof Object?o:n}function Oi(e,r,t,n){var o=_t(e),u=e.length-2,c=[],f=["fn"];r&&f.push("thisWired");for(var m=0;m<u;++m)c.push(`arg${m}`),f.push(`arg${m}Wired`);c=c.join(","),f=f.join(",");var p=`return function (${c}) {
|
|
26
26
|
`;o&&(p+=`var destructors = [];
|
package/lib/docauth.mjs
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
var e=[
|
|
2
|
+
// Document actions
|
|
3
|
+
{id:"document.undo",label:"Undo",description:"Undo the last action",shortcuts:["Cmd+Z"]},{id:"document.redo",label:"Redo",description:"Redo the last undone action",shortcuts:["Cmd+Y","Cmd+Shift+Z"]},{id:"document.export-pdf",label:"Download PDF",description:"Export document as PDF"},{id:"document.export-docx",label:"Download DOCX",description:"Export document as DOCX"},
|
|
4
|
+
// Formatting actions
|
|
5
|
+
{id:"formatting.bold",label:"Bold",description:"Apply bold formatting",shortcuts:["Cmd+B"]},{id:"formatting.italic",label:"Italic",description:"Apply italic formatting",shortcuts:["Cmd+I"]},{id:"formatting.underline",label:"Underline",description:"Apply underline formatting",shortcuts:["Cmd+U"]},{id:"formatting.strikethrough",label:"Strikethrough",description:"Apply strikethrough formatting"},{id:"formatting.subscript",label:"Subscript",description:"Apply subscript formatting"},{id:"formatting.superscript",label:"Superscript",description:"Apply superscript formatting"},{id:"formatting.clear",label:"Clear Formatting",description:"Remove all formatting"},
|
|
6
|
+
// Insert actions
|
|
7
|
+
{id:"insert.page-break",label:"Page Break",description:"Insert a page break"},{id:"insert.section-break-next-page",label:"Section Break (Next Page)",description:"Insert a section break on next page"},{id:"insert.section-break-continuous",label:"Section Break (Continuous)",description:"Insert a continuous section break"},{id:"insert.column-break",label:"Column Break",description:"Insert a column break"},{id:"insert.image",label:"Image",description:"Insert an image"},{id:"insert.link",label:"Link",description:"Insert a hyperlink",shortcuts:["Cmd+K"]},
|
|
8
|
+
// Table actions
|
|
9
|
+
{id:"table.insert",label:"Insert Table",description:"Insert a new table"},{id:"table.delete",label:"Delete Table",description:"Delete the current table"},{id:"table.insert-row-above",label:"Insert Row Above",description:"Insert a row above current row"},{id:"table.insert-row-below",label:"Insert Row Below",description:"Insert a row below current row"},{id:"table.insert-column-left",label:"Insert Column Left",description:"Insert a column to the left"},{id:"table.insert-column-right",label:"Insert Column Right",description:"Insert a column to the right"},{id:"table.delete-row",label:"Delete Row",description:"Delete the current row"},{id:"table.delete-column",label:"Delete Column",description:"Delete the current column"},{id:"table.merge-cells",label:"Merge Cells",description:"Merge selected cells"},{id:"table.split-cells",label:"Split Cells",description:"Split merged cells"},
|
|
10
|
+
// View actions
|
|
11
|
+
{id:"view.zoom-in",label:"Zoom In",description:"Increase zoom level",shortcuts:["Cmd+="]},{id:"view.zoom-out",label:"Zoom Out",description:"Decrease zoom level",shortcuts:["Cmd+-"]},{id:"view.zoom-reset",label:"Reset Zoom",description:"Reset zoom to 100%",shortcuts:["Cmd+0"]},{id:"view.toggle-ruler",label:"Toggle Ruler",description:"Show or hide the ruler"},{id:"view.toggle-formatting-marks",label:"Toggle Formatting Marks",description:"Show or hide formatting marks"},
|
|
12
|
+
// Layout actions
|
|
13
|
+
{id:"layout.align-left",label:"Align Left",description:"Align text to the left",shortcuts:["Cmd+Shift+L"]},{id:"layout.align-center",label:"Align Center",description:"Center align text",shortcuts:["Cmd+Shift+E"]},{id:"layout.align-right",label:"Align Right",description:"Align text to the right",shortcuts:["Cmd+Shift+R"]},{id:"layout.align-justify",label:"Justify",description:"Justify text",shortcuts:["Cmd+Shift+J"]},{id:"layout.increase-indent",label:"Increase Indent",description:"Increase paragraph indent",shortcuts:["Cmd+]"]},{id:"layout.decrease-indent",label:"Decrease Indent",description:"Decrease paragraph indent",shortcuts:["Cmd+["]},{id:"layout.bulleted-list",label:"Bulleted List",description:"Create a bulleted list"},{id:"layout.numbered-list",label:"Numbered List",description:"Create a numbered list"},
|
|
14
|
+
// Style actions
|
|
15
|
+
{id:"style.apply",label:"Apply Style",description:"Apply a style to the selection"}],t={items:[{type:"built-in",id:"zoom-select",builtInType:"zoom"},{type:"separator",id:"sep-after-zoom"},{type:"built-in",id:"mobile-lock",builtInType:"mobile-lock"},{type:"built-in",id:"undo-btn",builtInType:"undo"},{type:"built-in",id:"redo-btn",builtInType:"redo"},{type:"separator",id:"sep-after-undo-redo"},{type:"built-in",id:"style-menu",builtInType:"style-menu"},{type:"separator",id:"sep-after-style"},{type:"built-in",id:"font-family-select",builtInType:"font-family"},{type:"built-in",id:"font-size-input",builtInType:"font-size"},{type:"separator",id:"sep-after-font"},{type:"built-in",id:"bold-btn",builtInType:"bold"},{type:"built-in",id:"italic-btn",builtInType:"italic"},{type:"built-in",id:"underline-btn",builtInType:"underline"},{type:"built-in",id:"strikethrough-btn",builtInType:"strikethrough"},{type:"built-in",id:"subscript-btn",builtInType:"subscript"},{type:"built-in",id:"superscript-btn",builtInType:"superscript"},{type:"separator",id:"sep-after-character-formatting"},{type:"built-in",id:"text-color-picker",builtInType:"text-color"},{type:"built-in",id:"highlight-color-picker",builtInType:"highlight-color"},{type:"separator",id:"sep-after-colors"},{type:"built-in",id:"align-left-btn",builtInType:"align-left"},{type:"built-in",id:"align-center-btn",builtInType:"align-center"},{type:"built-in",id:"align-right-btn",builtInType:"align-right"},{type:"built-in",id:"align-justify-btn",builtInType:"align-justify"},{type:"separator",id:"sep-after-alignment"},{type:"built-in",id:"line-spacing-menu",builtInType:"line-spacing-menu"},{type:"separator",id:"sep-after-line-spacing"},{type:"built-in",id:"bulleted-list",builtInType:"bulleted-list"},{type:"built-in",id:"numbered-list",builtInType:"numbered-list"},{type:"separator",id:"sep-after-lists"},{type:"built-in",id:"decrease-indent-btn",builtInType:"decrease-indent"},{type:"built-in",id:"increase-indent-btn",builtInType:"increase-indent"},{type:"separator",id:"sep-after-indentation"},{type:"built-in",id:"clear-formatting-btn",builtInType:"clear-formatting"},{type:"built-in",id:"formatting-marks-btn",builtInType:"formatting-marks"},{type:"separator",id:"sep-after-formatting-marks"},{type:"built-in",id:"page-setup-menu",builtInType:"page-setup-menu"},{type:"separator",id:"sep-after-page-setup"},{type:"built-in",id:"insert-menu",builtInType:"insert-menu"},{type:"separator",id:"sep-after-insert"},{type:"built-in",id:"table-menu",builtInType:"table-menu"},{type:"separator",id:"sep-after-table"},{type:"built-in",id:"download-menu",builtInType:"download-menu"},{type:"separator",id:"sep-before-ui-settings"},{type:"built-in",id:"ui-settings-menu",builtInType:"ui-settings-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-ui-settings"}]};
|
|
16
|
+
// ../packages/ui/src/actions/default-actions-standalone.ts
|
|
17
|
+
const i={type:"default-index"},n=async e=>(await(async e=>{const t=new URL(e??"https://document-authoring.cdn.staging.nutrient.io/2025/1/",window.location.href).href,i=new URL("docauth-impl-c578b095dd9e8978.js",t).href;return import(
|
|
2
18
|
/*webpackIgnore: true*/
|
|
3
19
|
/* @vite-ignore */
|
|
4
|
-
|
|
20
|
+
i)})(e?.assets?.base)).createDocAuthSystem(e);var l={createDocAuthSystem:n,defaultFontIndex:i,defaultActions:e,defaultToolbarConfig:t};export{n as createDocAuthSystem,l as default,e as defaultActions,i as defaultFontIndex,t as defaultToolbarConfig};
|
package/lib/docauth.umd.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
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";
|
|
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";var t=[
|
|
2
|
+
// Document actions
|
|
3
|
+
{id:"document.undo",label:"Undo",description:"Undo the last action",shortcuts:["Cmd+Z"]},{id:"document.redo",label:"Redo",description:"Redo the last undone action",shortcuts:["Cmd+Y","Cmd+Shift+Z"]},{id:"document.export-pdf",label:"Download PDF",description:"Export document as PDF"},{id:"document.export-docx",label:"Download DOCX",description:"Export document as DOCX"},
|
|
4
|
+
// Formatting actions
|
|
5
|
+
{id:"formatting.bold",label:"Bold",description:"Apply bold formatting",shortcuts:["Cmd+B"]},{id:"formatting.italic",label:"Italic",description:"Apply italic formatting",shortcuts:["Cmd+I"]},{id:"formatting.underline",label:"Underline",description:"Apply underline formatting",shortcuts:["Cmd+U"]},{id:"formatting.strikethrough",label:"Strikethrough",description:"Apply strikethrough formatting"},{id:"formatting.subscript",label:"Subscript",description:"Apply subscript formatting"},{id:"formatting.superscript",label:"Superscript",description:"Apply superscript formatting"},{id:"formatting.clear",label:"Clear Formatting",description:"Remove all formatting"},
|
|
6
|
+
// Insert actions
|
|
7
|
+
{id:"insert.page-break",label:"Page Break",description:"Insert a page break"},{id:"insert.section-break-next-page",label:"Section Break (Next Page)",description:"Insert a section break on next page"},{id:"insert.section-break-continuous",label:"Section Break (Continuous)",description:"Insert a continuous section break"},{id:"insert.column-break",label:"Column Break",description:"Insert a column break"},{id:"insert.image",label:"Image",description:"Insert an image"},{id:"insert.link",label:"Link",description:"Insert a hyperlink",shortcuts:["Cmd+K"]},
|
|
8
|
+
// Table actions
|
|
9
|
+
{id:"table.insert",label:"Insert Table",description:"Insert a new table"},{id:"table.delete",label:"Delete Table",description:"Delete the current table"},{id:"table.insert-row-above",label:"Insert Row Above",description:"Insert a row above current row"},{id:"table.insert-row-below",label:"Insert Row Below",description:"Insert a row below current row"},{id:"table.insert-column-left",label:"Insert Column Left",description:"Insert a column to the left"},{id:"table.insert-column-right",label:"Insert Column Right",description:"Insert a column to the right"},{id:"table.delete-row",label:"Delete Row",description:"Delete the current row"},{id:"table.delete-column",label:"Delete Column",description:"Delete the current column"},{id:"table.merge-cells",label:"Merge Cells",description:"Merge selected cells"},{id:"table.split-cells",label:"Split Cells",description:"Split merged cells"},
|
|
10
|
+
// View actions
|
|
11
|
+
{id:"view.zoom-in",label:"Zoom In",description:"Increase zoom level",shortcuts:["Cmd+="]},{id:"view.zoom-out",label:"Zoom Out",description:"Decrease zoom level",shortcuts:["Cmd+-"]},{id:"view.zoom-reset",label:"Reset Zoom",description:"Reset zoom to 100%",shortcuts:["Cmd+0"]},{id:"view.toggle-ruler",label:"Toggle Ruler",description:"Show or hide the ruler"},{id:"view.toggle-formatting-marks",label:"Toggle Formatting Marks",description:"Show or hide formatting marks"},
|
|
12
|
+
// Layout actions
|
|
13
|
+
{id:"layout.align-left",label:"Align Left",description:"Align text to the left",shortcuts:["Cmd+Shift+L"]},{id:"layout.align-center",label:"Align Center",description:"Center align text",shortcuts:["Cmd+Shift+E"]},{id:"layout.align-right",label:"Align Right",description:"Align text to the right",shortcuts:["Cmd+Shift+R"]},{id:"layout.align-justify",label:"Justify",description:"Justify text",shortcuts:["Cmd+Shift+J"]},{id:"layout.increase-indent",label:"Increase Indent",description:"Increase paragraph indent",shortcuts:["Cmd+]"]},{id:"layout.decrease-indent",label:"Decrease Indent",description:"Decrease paragraph indent",shortcuts:["Cmd+["]},{id:"layout.bulleted-list",label:"Bulleted List",description:"Create a bulleted list"},{id:"layout.numbered-list",label:"Numbered List",description:"Create a numbered list"},
|
|
14
|
+
// Style actions
|
|
15
|
+
{id:"style.apply",label:"Apply Style",description:"Apply a style to the selection"}],i={items:[{type:"built-in",id:"zoom-select",builtInType:"zoom"},{type:"separator",id:"sep-after-zoom"},{type:"built-in",id:"mobile-lock",builtInType:"mobile-lock"},{type:"built-in",id:"undo-btn",builtInType:"undo"},{type:"built-in",id:"redo-btn",builtInType:"redo"},{type:"separator",id:"sep-after-undo-redo"},{type:"built-in",id:"style-menu",builtInType:"style-menu"},{type:"separator",id:"sep-after-style"},{type:"built-in",id:"font-family-select",builtInType:"font-family"},{type:"built-in",id:"font-size-input",builtInType:"font-size"},{type:"separator",id:"sep-after-font"},{type:"built-in",id:"bold-btn",builtInType:"bold"},{type:"built-in",id:"italic-btn",builtInType:"italic"},{type:"built-in",id:"underline-btn",builtInType:"underline"},{type:"built-in",id:"strikethrough-btn",builtInType:"strikethrough"},{type:"built-in",id:"subscript-btn",builtInType:"subscript"},{type:"built-in",id:"superscript-btn",builtInType:"superscript"},{type:"separator",id:"sep-after-character-formatting"},{type:"built-in",id:"text-color-picker",builtInType:"text-color"},{type:"built-in",id:"highlight-color-picker",builtInType:"highlight-color"},{type:"separator",id:"sep-after-colors"},{type:"built-in",id:"align-left-btn",builtInType:"align-left"},{type:"built-in",id:"align-center-btn",builtInType:"align-center"},{type:"built-in",id:"align-right-btn",builtInType:"align-right"},{type:"built-in",id:"align-justify-btn",builtInType:"align-justify"},{type:"separator",id:"sep-after-alignment"},{type:"built-in",id:"line-spacing-menu",builtInType:"line-spacing-menu"},{type:"separator",id:"sep-after-line-spacing"},{type:"built-in",id:"bulleted-list",builtInType:"bulleted-list"},{type:"built-in",id:"numbered-list",builtInType:"numbered-list"},{type:"separator",id:"sep-after-lists"},{type:"built-in",id:"decrease-indent-btn",builtInType:"decrease-indent"},{type:"built-in",id:"increase-indent-btn",builtInType:"increase-indent"},{type:"separator",id:"sep-after-indentation"},{type:"built-in",id:"clear-formatting-btn",builtInType:"clear-formatting"},{type:"built-in",id:"formatting-marks-btn",builtInType:"formatting-marks"},{type:"separator",id:"sep-after-formatting-marks"},{type:"built-in",id:"page-setup-menu",builtInType:"page-setup-menu"},{type:"separator",id:"sep-after-page-setup"},{type:"built-in",id:"insert-menu",builtInType:"insert-menu"},{type:"separator",id:"sep-after-insert"},{type:"built-in",id:"table-menu",builtInType:"table-menu"},{type:"separator",id:"sep-after-table"},{type:"built-in",id:"download-menu",builtInType:"download-menu"},{type:"separator",id:"sep-before-ui-settings"},{type:"built-in",id:"ui-settings-menu",builtInType:"ui-settings-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-ui-settings"}]};
|
|
16
|
+
// ../packages/ui/src/actions/default-actions-standalone.ts
|
|
17
|
+
const n={type:"default-index"},l=async e=>(await(async e=>{const t=new URL(e??"https://document-authoring.cdn.staging.nutrient.io/2025/1/",window.location.href).href,i=new URL("docauth-impl-c578b095dd9e8978.js",t).href;return import(
|
|
2
18
|
/*webpackIgnore: true*/
|
|
3
19
|
/* @vite-ignore */
|
|
4
|
-
|
|
20
|
+
i)})(e?.assets?.base)).createDocAuthSystem(e);var r={createDocAuthSystem:l,defaultFontIndex:n,defaultActions:t,defaultToolbarConfig:i};e.createDocAuthSystem=l,e.default=r,e.defaultActions=t,e.defaultFontIndex=n,e.defaultToolbarConfig=i,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/lib/docauth.wasm
CHANGED
|
Binary file
|
package/lib/index.d.cts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action definition that users can register
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export declare type Action = BuiltInAction | CustomAction;
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
8
|
* @public
|
|
3
9
|
*/
|
|
@@ -15,6 +21,42 @@ export declare type Assets = {
|
|
|
15
21
|
*/
|
|
16
22
|
export declare type BlobInput = Promise<Response | Blob | ArrayBuffer> | Response | Blob | ArrayBuffer;
|
|
17
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Built-in action - can omit handler, will use default implementation
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export declare type BuiltInAction = {
|
|
29
|
+
readonly id: BuiltInActionId;
|
|
30
|
+
readonly label: string;
|
|
31
|
+
readonly description?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Keyboard shortcuts for the action.
|
|
34
|
+
* Use "Mod" as the primary modifier key - it will be automatically resolved to:
|
|
35
|
+
* - "Ctrl" on Windows/Linux
|
|
36
|
+
* - "⌘" (Command) on Mac
|
|
37
|
+
*
|
|
38
|
+
* Examples:
|
|
39
|
+
* - "Mod+B" becomes "Ctrl+B" on Windows, "⌘B" on Mac
|
|
40
|
+
* - "Mod+Shift+P" becomes "Ctrl+Shift+P" on Windows, "⌘⇧P" on Mac
|
|
41
|
+
*/
|
|
42
|
+
readonly shortcuts?: string[];
|
|
43
|
+
/** Icon as data URI (e.g., data:image/svg+xml;base64,... or data:image/png;base64,...). Only data:image/ URIs are allowed for security. */
|
|
44
|
+
readonly icon?: string;
|
|
45
|
+
readonly isEnabled?: () => boolean;
|
|
46
|
+
readonly order?: number;
|
|
47
|
+
readonly handler?: (...args: unknown[]) => void | Promise<void>;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Actions API - Type definitions for registering and executing editor actions
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* Built-in action IDs that have default implementations
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export declare type BuiltInActionId = 'document.undo' | 'document.redo' | 'document.export-pdf' | 'document.export-docx' | 'formatting.bold' | 'formatting.italic' | 'formatting.underline' | 'formatting.strikethrough' | 'formatting.subscript' | 'formatting.superscript' | 'formatting.clear' | 'insert.page-break' | 'insert.section-break-next-page' | 'insert.section-break-continuous' | 'insert.column-break' | 'insert.image' | 'insert.link' | 'table.insert' | 'table.delete' | 'table.insert-row-above' | 'table.insert-row-below' | 'table.insert-column-left' | 'table.insert-column-right' | 'table.delete-row' | 'table.delete-column' | 'table.merge-cells' | 'table.split-cells' | 'view.zoom-in' | 'view.zoom-out' | 'view.zoom-reset' | 'view.toggle-ruler' | 'view.toggle-formatting-marks' | 'layout.align-left' | 'layout.align-center' | 'layout.align-right' | 'layout.align-justify' | 'layout.increase-indent' | 'layout.decrease-indent' | 'layout.bulleted-list' | 'layout.numbered-list' | 'style.apply';
|
|
59
|
+
|
|
18
60
|
/**
|
|
19
61
|
* Creates an instance of the Document Authoring system which can be shared between different tasks
|
|
20
62
|
* like creating editors, importing Word documents or creating PDFs.
|
|
@@ -90,15 +132,83 @@ export declare type CreateEditorOptions = {
|
|
|
90
132
|
__hidePDFDownload?: boolean;
|
|
91
133
|
};
|
|
92
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Custom action - must provide handler
|
|
137
|
+
* @public
|
|
138
|
+
*/
|
|
139
|
+
export declare type CustomAction = {
|
|
140
|
+
readonly id: string;
|
|
141
|
+
readonly label: string;
|
|
142
|
+
readonly description?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Keyboard shortcuts for the action.
|
|
145
|
+
* Use "Cmd" as the modifier key - it will be resolved to:
|
|
146
|
+
* - "Ctrl" on Windows/Linux (for keyboard handling)
|
|
147
|
+
* - "⌘" on Mac (for keyboard handling)
|
|
148
|
+
* - "Ctrl" or "⌘" for display based on platform
|
|
149
|
+
*
|
|
150
|
+
* Examples:
|
|
151
|
+
* - "Cmd+B" becomes "Ctrl+B" on Windows, "⌘B" on Mac
|
|
152
|
+
* - "Cmd+Shift+P" becomes "Ctrl+Shift+P" on Windows, "⌘⇧P" on Mac
|
|
153
|
+
*/
|
|
154
|
+
readonly shortcuts?: string[];
|
|
155
|
+
/** Icon as data URI (e.g., data:image/svg+xml;base64,... or data:image/png;base64,...). Only data:image/ URIs are allowed for security. */
|
|
156
|
+
readonly icon?: string;
|
|
157
|
+
readonly isEnabled?: () => boolean;
|
|
158
|
+
readonly order?: number;
|
|
159
|
+
readonly handler: (...args: unknown[]) => void | Promise<void>;
|
|
160
|
+
};
|
|
161
|
+
|
|
93
162
|
/**
|
|
94
163
|
* @hidden
|
|
95
164
|
*/
|
|
96
165
|
declare const _default: {
|
|
97
166
|
createDocAuthSystem: (options?: CreateDocAuthSystemOptions) => Promise<DocAuthSystem>;
|
|
98
167
|
defaultFontIndex: DefaultFontIndex;
|
|
168
|
+
defaultActions: BuiltInAction[];
|
|
169
|
+
defaultToolbarConfig: ToolbarConfig;
|
|
99
170
|
};
|
|
100
171
|
export default _default;
|
|
101
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Get the default set of actions available in the editor.
|
|
175
|
+
* Can be combined with custom actions using spread operator.
|
|
176
|
+
*
|
|
177
|
+
* Note: Built-in actions (those with IDs from {@link BuiltInActionId}) can omit handlers -
|
|
178
|
+
* they will be automatically populated with default implementations when passed to
|
|
179
|
+
* `editor.setActions()`. This allows you to customize labels, shortcuts, and order
|
|
180
|
+
* without needing to implement the behavior yourself. Built-in handlers can also be
|
|
181
|
+
* overridden by providing your own handler function.
|
|
182
|
+
*
|
|
183
|
+
* Custom actions (those with any other string ID) must provide a handler function.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* import { defaultActions } from '@nutrient-sdk/document-authoring';
|
|
188
|
+
*
|
|
189
|
+
* // Customize a built-in action's metadata (handlers auto-populate for built-in actions)
|
|
190
|
+
* editor.setActions([
|
|
191
|
+
* ...defaultActions,
|
|
192
|
+
* { id: 'formatting.bold', label: 'Make Bold', shortcuts: ['Ctrl+B'] }
|
|
193
|
+
* ]);
|
|
194
|
+
*
|
|
195
|
+
* // Override a built-in action's behavior
|
|
196
|
+
* editor.setActions([
|
|
197
|
+
* ...defaultActions,
|
|
198
|
+
* { id: 'formatting.bold', label: 'Bold', handler: () => console.log('custom bold!') }
|
|
199
|
+
* ]);
|
|
200
|
+
*
|
|
201
|
+
* // Add custom actions (must provide handler)
|
|
202
|
+
* editor.setActions([
|
|
203
|
+
* ...defaultActions.filter(a => a.id !== 'document.export-pdf'),
|
|
204
|
+
* { id: 'custom.my-action', label: 'My Action', handler: () => console.log('clicked') }
|
|
205
|
+
* ]);
|
|
206
|
+
* ```
|
|
207
|
+
*
|
|
208
|
+
* @public
|
|
209
|
+
*/
|
|
210
|
+
export declare const defaultActions: BuiltInAction[];
|
|
211
|
+
|
|
102
212
|
/**
|
|
103
213
|
* The default font index that is part of the Document Authoring SDK bundle.
|
|
104
214
|
*
|
|
@@ -119,6 +229,25 @@ export declare type DefaultFontIndex = {
|
|
|
119
229
|
*/
|
|
120
230
|
export declare const defaultFontIndex: DefaultFontIndex;
|
|
121
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Get the default toolbar configuration.
|
|
234
|
+
* Can be used as-is or customized.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* import { defaultToolbarConfig } from '@nutrient-sdk/document-authoring';
|
|
239
|
+
*
|
|
240
|
+
* editor.setToolbarConfig(defaultToolbarConfig);
|
|
241
|
+
* // or customize:
|
|
242
|
+
* editor.setToolbarConfig({
|
|
243
|
+
* items: [...defaultToolbarConfig.items, myCustomItem]
|
|
244
|
+
* });
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
247
|
+
* @public
|
|
248
|
+
*/
|
|
249
|
+
export declare const defaultToolbarConfig: ToolbarConfig;
|
|
250
|
+
|
|
122
251
|
/**
|
|
123
252
|
* @public
|
|
124
253
|
*/
|
|
@@ -189,6 +318,15 @@ export declare type DocAuthEditor = {
|
|
|
189
318
|
* @param text - The text to insert at the cursor position
|
|
190
319
|
*/
|
|
191
320
|
insertTextAtCursor(text: string): void;
|
|
321
|
+
/**
|
|
322
|
+
* Checks if the editor has an active cursor/insertion point.
|
|
323
|
+
* This is useful for custom actions to determine if they should be enabled.
|
|
324
|
+
*
|
|
325
|
+
* @returns true if cursor is active and insertion is possible, false otherwise
|
|
326
|
+
*
|
|
327
|
+
* @internal
|
|
328
|
+
*/
|
|
329
|
+
hasActiveCursor(): boolean;
|
|
192
330
|
/**
|
|
193
331
|
* Adds an event listener that will be called every time the specified event is emitted.
|
|
194
332
|
*
|
|
@@ -242,6 +380,62 @@ export declare type DocAuthEditor = {
|
|
|
242
380
|
* @eventMap DocAuthEditorEvents
|
|
243
381
|
*/
|
|
244
382
|
once: <EventName extends keyof DocAuthEditorEvents>(event: EventName, handler: DocAuthEditorEventHandler<EventName>) => DocAuthEditor;
|
|
383
|
+
/**
|
|
384
|
+
* Set all actions (replaces any existing actions).
|
|
385
|
+
* Allows setting and executing editor actions programmatically.
|
|
386
|
+
*
|
|
387
|
+
* @param actions - Array of actions to register
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```typescript
|
|
391
|
+
* import { defaultActions } from '@nutrient-sdk/document-authoring';
|
|
392
|
+
*
|
|
393
|
+
* // Register custom actions alongside default actions
|
|
394
|
+
* editor.setActions([
|
|
395
|
+
* ...defaultActions, // Keep default actions
|
|
396
|
+
* {
|
|
397
|
+
* id: 'custom.insert-signature',
|
|
398
|
+
* label: 'Insert Signature',
|
|
399
|
+
* handler: () => {
|
|
400
|
+
* editor.insertTextAtCursor('\n\nBest regards,\nJohn Doe');
|
|
401
|
+
* },
|
|
402
|
+
* shortcuts: [{ mac: '⌘⇧S', windows: 'Ctrl+Shift+S' }]
|
|
403
|
+
* }
|
|
404
|
+
* ]);
|
|
405
|
+
* ```
|
|
406
|
+
*
|
|
407
|
+
* @public
|
|
408
|
+
*/
|
|
409
|
+
setActions(actions: Action[]): void;
|
|
410
|
+
/**
|
|
411
|
+
* Set the toolbar configuration.
|
|
412
|
+
* Use this to customize the editor's toolbar.
|
|
413
|
+
*
|
|
414
|
+
* @param config - Toolbar configuration object
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```typescript
|
|
418
|
+
* import { defaultToolbarConfig } from '@nutrient-sdk/document-authoring';
|
|
419
|
+
*
|
|
420
|
+
* // Use default toolbar
|
|
421
|
+
* editor.setToolbarConfig(defaultToolbarConfig);
|
|
422
|
+
*
|
|
423
|
+
* // Or create a minimal toolbar
|
|
424
|
+
* editor.setToolbarConfig({
|
|
425
|
+
* items: [
|
|
426
|
+
* { type: 'built-in', id: 'undo', builtInType: 'undo' },
|
|
427
|
+
* { type: 'built-in', id: 'redo', builtInType: 'redo' },
|
|
428
|
+
* { type: 'separator', id: 'sep-1' },
|
|
429
|
+
* { type: 'built-in', id: 'bold', builtInType: 'bold' },
|
|
430
|
+
* { type: 'built-in', id: 'italic', builtInType: 'italic' },
|
|
431
|
+
* { type: 'action', id: 'custom', actionId: 'custom.insert-signature' }
|
|
432
|
+
* ]
|
|
433
|
+
* });
|
|
434
|
+
* ```
|
|
435
|
+
*
|
|
436
|
+
* @public
|
|
437
|
+
*/
|
|
438
|
+
setToolbarConfig(config: ToolbarConfig): void;
|
|
245
439
|
};
|
|
246
440
|
|
|
247
441
|
/**
|
|
@@ -601,6 +795,57 @@ export declare namespace Programmatic {
|
|
|
601
795
|
{};
|
|
602
796
|
}
|
|
603
797
|
|
|
798
|
+
/**
|
|
799
|
+
* Toolbar API - Type definitions for customizing the editor toolbar
|
|
800
|
+
* @public
|
|
801
|
+
*/
|
|
802
|
+
/**
|
|
803
|
+
* Action toolbar item - references an action by ID
|
|
804
|
+
* @public
|
|
805
|
+
*/
|
|
806
|
+
export declare type ToolbarActionItem = {
|
|
807
|
+
type: 'action';
|
|
808
|
+
id: string;
|
|
809
|
+
actionId: string;
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Built-in toolbar item - uses original toolbar components directly
|
|
814
|
+
* Self-contained with no external configuration properties
|
|
815
|
+
* @public
|
|
816
|
+
*/
|
|
817
|
+
export declare type ToolbarBuiltInItem = {
|
|
818
|
+
type: 'built-in';
|
|
819
|
+
id: string;
|
|
820
|
+
builtInType: 'undo' | 'redo' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'subscript' | 'superscript' | 'text-color' | 'highlight-color' | 'align-left' | 'align-center' | 'align-right' | 'align-justify' | 'bulleted-list' | 'numbered-list' | 'decrease-indent' | 'increase-indent' | 'clear-formatting' | 'formatting-marks' | 'zoom' | 'mobile-lock' | 'font-family' | 'font-size' | 'style-menu' | 'line-spacing-menu' | 'page-setup-menu' | 'insert-menu' | 'table-menu' | 'download-menu' | 'ui-settings-menu';
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Toolbar configuration
|
|
825
|
+
* @public
|
|
826
|
+
*/
|
|
827
|
+
export declare type ToolbarConfig = {
|
|
828
|
+
/**
|
|
829
|
+
* Array of toolbar items to display
|
|
830
|
+
*/
|
|
831
|
+
items?: ToolbarItem[];
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Union type for all toolbar items
|
|
836
|
+
* @public
|
|
837
|
+
*/
|
|
838
|
+
export declare type ToolbarItem = ToolbarActionItem | ToolbarBuiltInItem | ToolbarSeparatorItem;
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Visual separator
|
|
842
|
+
* @public
|
|
843
|
+
*/
|
|
844
|
+
export declare type ToolbarSeparatorItem = {
|
|
845
|
+
type: 'separator';
|
|
846
|
+
id: string;
|
|
847
|
+
};
|
|
848
|
+
|
|
604
849
|
/**
|
|
605
850
|
* @alpha
|
|
606
851
|
*/
|
|
@@ -655,11 +900,41 @@ export declare type UIOptions = {
|
|
|
655
900
|
*
|
|
656
901
|
* Initial zoom level for the editor.
|
|
657
902
|
*
|
|
658
|
-
* Valid range is 0.5 to 4.0.
|
|
903
|
+
* Valid range is 0.5 to 4.0, which any values provided will be clamped to.
|
|
659
904
|
*
|
|
660
905
|
* @defaultValue `1`
|
|
661
906
|
*/
|
|
662
907
|
initialZoom?: number;
|
|
908
|
+
/**
|
|
909
|
+
* Initial toolbar configuration.
|
|
910
|
+
*
|
|
911
|
+
* The toolbar can also be customized at runtime using `editor.setToolbarConfig()`.
|
|
912
|
+
*/
|
|
913
|
+
toolbar?: ToolbarConfig;
|
|
914
|
+
/**
|
|
915
|
+
* Initial actions configuration.
|
|
916
|
+
*
|
|
917
|
+
* Actions can also be customized at runtime using `editor.setActions()`.
|
|
918
|
+
*
|
|
919
|
+
* @example
|
|
920
|
+
* ```typescript
|
|
921
|
+
* import { defaultActions } from '@nutrient-sdk/document-authoring';
|
|
922
|
+
*
|
|
923
|
+
* const editor = await system.createEditor(target, {
|
|
924
|
+
* ui: {
|
|
925
|
+
* actions: [
|
|
926
|
+
* ...defaultActions,
|
|
927
|
+
* {
|
|
928
|
+
* id: 'custom.hello',
|
|
929
|
+
* label: 'Say Hello',
|
|
930
|
+
* handler: () => alert('Hello!'),
|
|
931
|
+
* }
|
|
932
|
+
* ]
|
|
933
|
+
* }
|
|
934
|
+
* });
|
|
935
|
+
* ```
|
|
936
|
+
*/
|
|
937
|
+
actions?: Action[];
|
|
663
938
|
};
|
|
664
939
|
|
|
665
940
|
/**
|
package/lib/index.d.mts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action definition that users can register
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export declare type Action = BuiltInAction | CustomAction;
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
8
|
* @public
|
|
3
9
|
*/
|
|
@@ -15,6 +21,42 @@ export declare type Assets = {
|
|
|
15
21
|
*/
|
|
16
22
|
export declare type BlobInput = Promise<Response | Blob | ArrayBuffer> | Response | Blob | ArrayBuffer;
|
|
17
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Built-in action - can omit handler, will use default implementation
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export declare type BuiltInAction = {
|
|
29
|
+
readonly id: BuiltInActionId;
|
|
30
|
+
readonly label: string;
|
|
31
|
+
readonly description?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Keyboard shortcuts for the action.
|
|
34
|
+
* Use "Mod" as the primary modifier key - it will be automatically resolved to:
|
|
35
|
+
* - "Ctrl" on Windows/Linux
|
|
36
|
+
* - "⌘" (Command) on Mac
|
|
37
|
+
*
|
|
38
|
+
* Examples:
|
|
39
|
+
* - "Mod+B" becomes "Ctrl+B" on Windows, "⌘B" on Mac
|
|
40
|
+
* - "Mod+Shift+P" becomes "Ctrl+Shift+P" on Windows, "⌘⇧P" on Mac
|
|
41
|
+
*/
|
|
42
|
+
readonly shortcuts?: string[];
|
|
43
|
+
/** Icon as data URI (e.g., data:image/svg+xml;base64,... or data:image/png;base64,...). Only data:image/ URIs are allowed for security. */
|
|
44
|
+
readonly icon?: string;
|
|
45
|
+
readonly isEnabled?: () => boolean;
|
|
46
|
+
readonly order?: number;
|
|
47
|
+
readonly handler?: (...args: unknown[]) => void | Promise<void>;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Actions API - Type definitions for registering and executing editor actions
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* Built-in action IDs that have default implementations
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export declare type BuiltInActionId = 'document.undo' | 'document.redo' | 'document.export-pdf' | 'document.export-docx' | 'formatting.bold' | 'formatting.italic' | 'formatting.underline' | 'formatting.strikethrough' | 'formatting.subscript' | 'formatting.superscript' | 'formatting.clear' | 'insert.page-break' | 'insert.section-break-next-page' | 'insert.section-break-continuous' | 'insert.column-break' | 'insert.image' | 'insert.link' | 'table.insert' | 'table.delete' | 'table.insert-row-above' | 'table.insert-row-below' | 'table.insert-column-left' | 'table.insert-column-right' | 'table.delete-row' | 'table.delete-column' | 'table.merge-cells' | 'table.split-cells' | 'view.zoom-in' | 'view.zoom-out' | 'view.zoom-reset' | 'view.toggle-ruler' | 'view.toggle-formatting-marks' | 'layout.align-left' | 'layout.align-center' | 'layout.align-right' | 'layout.align-justify' | 'layout.increase-indent' | 'layout.decrease-indent' | 'layout.bulleted-list' | 'layout.numbered-list' | 'style.apply';
|
|
59
|
+
|
|
18
60
|
/**
|
|
19
61
|
* Creates an instance of the Document Authoring system which can be shared between different tasks
|
|
20
62
|
* like creating editors, importing Word documents or creating PDFs.
|
|
@@ -90,15 +132,83 @@ export declare type CreateEditorOptions = {
|
|
|
90
132
|
__hidePDFDownload?: boolean;
|
|
91
133
|
};
|
|
92
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Custom action - must provide handler
|
|
137
|
+
* @public
|
|
138
|
+
*/
|
|
139
|
+
export declare type CustomAction = {
|
|
140
|
+
readonly id: string;
|
|
141
|
+
readonly label: string;
|
|
142
|
+
readonly description?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Keyboard shortcuts for the action.
|
|
145
|
+
* Use "Cmd" as the modifier key - it will be resolved to:
|
|
146
|
+
* - "Ctrl" on Windows/Linux (for keyboard handling)
|
|
147
|
+
* - "⌘" on Mac (for keyboard handling)
|
|
148
|
+
* - "Ctrl" or "⌘" for display based on platform
|
|
149
|
+
*
|
|
150
|
+
* Examples:
|
|
151
|
+
* - "Cmd+B" becomes "Ctrl+B" on Windows, "⌘B" on Mac
|
|
152
|
+
* - "Cmd+Shift+P" becomes "Ctrl+Shift+P" on Windows, "⌘⇧P" on Mac
|
|
153
|
+
*/
|
|
154
|
+
readonly shortcuts?: string[];
|
|
155
|
+
/** Icon as data URI (e.g., data:image/svg+xml;base64,... or data:image/png;base64,...). Only data:image/ URIs are allowed for security. */
|
|
156
|
+
readonly icon?: string;
|
|
157
|
+
readonly isEnabled?: () => boolean;
|
|
158
|
+
readonly order?: number;
|
|
159
|
+
readonly handler: (...args: unknown[]) => void | Promise<void>;
|
|
160
|
+
};
|
|
161
|
+
|
|
93
162
|
/**
|
|
94
163
|
* @hidden
|
|
95
164
|
*/
|
|
96
165
|
declare const _default: {
|
|
97
166
|
createDocAuthSystem: (options?: CreateDocAuthSystemOptions) => Promise<DocAuthSystem>;
|
|
98
167
|
defaultFontIndex: DefaultFontIndex;
|
|
168
|
+
defaultActions: BuiltInAction[];
|
|
169
|
+
defaultToolbarConfig: ToolbarConfig;
|
|
99
170
|
};
|
|
100
171
|
export default _default;
|
|
101
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Get the default set of actions available in the editor.
|
|
175
|
+
* Can be combined with custom actions using spread operator.
|
|
176
|
+
*
|
|
177
|
+
* Note: Built-in actions (those with IDs from {@link BuiltInActionId}) can omit handlers -
|
|
178
|
+
* they will be automatically populated with default implementations when passed to
|
|
179
|
+
* `editor.setActions()`. This allows you to customize labels, shortcuts, and order
|
|
180
|
+
* without needing to implement the behavior yourself. Built-in handlers can also be
|
|
181
|
+
* overridden by providing your own handler function.
|
|
182
|
+
*
|
|
183
|
+
* Custom actions (those with any other string ID) must provide a handler function.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* import { defaultActions } from '@nutrient-sdk/document-authoring';
|
|
188
|
+
*
|
|
189
|
+
* // Customize a built-in action's metadata (handlers auto-populate for built-in actions)
|
|
190
|
+
* editor.setActions([
|
|
191
|
+
* ...defaultActions,
|
|
192
|
+
* { id: 'formatting.bold', label: 'Make Bold', shortcuts: ['Ctrl+B'] }
|
|
193
|
+
* ]);
|
|
194
|
+
*
|
|
195
|
+
* // Override a built-in action's behavior
|
|
196
|
+
* editor.setActions([
|
|
197
|
+
* ...defaultActions,
|
|
198
|
+
* { id: 'formatting.bold', label: 'Bold', handler: () => console.log('custom bold!') }
|
|
199
|
+
* ]);
|
|
200
|
+
*
|
|
201
|
+
* // Add custom actions (must provide handler)
|
|
202
|
+
* editor.setActions([
|
|
203
|
+
* ...defaultActions.filter(a => a.id !== 'document.export-pdf'),
|
|
204
|
+
* { id: 'custom.my-action', label: 'My Action', handler: () => console.log('clicked') }
|
|
205
|
+
* ]);
|
|
206
|
+
* ```
|
|
207
|
+
*
|
|
208
|
+
* @public
|
|
209
|
+
*/
|
|
210
|
+
export declare const defaultActions: BuiltInAction[];
|
|
211
|
+
|
|
102
212
|
/**
|
|
103
213
|
* The default font index that is part of the Document Authoring SDK bundle.
|
|
104
214
|
*
|
|
@@ -119,6 +229,25 @@ export declare type DefaultFontIndex = {
|
|
|
119
229
|
*/
|
|
120
230
|
export declare const defaultFontIndex: DefaultFontIndex;
|
|
121
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Get the default toolbar configuration.
|
|
234
|
+
* Can be used as-is or customized.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* import { defaultToolbarConfig } from '@nutrient-sdk/document-authoring';
|
|
239
|
+
*
|
|
240
|
+
* editor.setToolbarConfig(defaultToolbarConfig);
|
|
241
|
+
* // or customize:
|
|
242
|
+
* editor.setToolbarConfig({
|
|
243
|
+
* items: [...defaultToolbarConfig.items, myCustomItem]
|
|
244
|
+
* });
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
247
|
+
* @public
|
|
248
|
+
*/
|
|
249
|
+
export declare const defaultToolbarConfig: ToolbarConfig;
|
|
250
|
+
|
|
122
251
|
/**
|
|
123
252
|
* @public
|
|
124
253
|
*/
|
|
@@ -189,6 +318,15 @@ export declare type DocAuthEditor = {
|
|
|
189
318
|
* @param text - The text to insert at the cursor position
|
|
190
319
|
*/
|
|
191
320
|
insertTextAtCursor(text: string): void;
|
|
321
|
+
/**
|
|
322
|
+
* Checks if the editor has an active cursor/insertion point.
|
|
323
|
+
* This is useful for custom actions to determine if they should be enabled.
|
|
324
|
+
*
|
|
325
|
+
* @returns true if cursor is active and insertion is possible, false otherwise
|
|
326
|
+
*
|
|
327
|
+
* @internal
|
|
328
|
+
*/
|
|
329
|
+
hasActiveCursor(): boolean;
|
|
192
330
|
/**
|
|
193
331
|
* Adds an event listener that will be called every time the specified event is emitted.
|
|
194
332
|
*
|
|
@@ -242,6 +380,62 @@ export declare type DocAuthEditor = {
|
|
|
242
380
|
* @eventMap DocAuthEditorEvents
|
|
243
381
|
*/
|
|
244
382
|
once: <EventName extends keyof DocAuthEditorEvents>(event: EventName, handler: DocAuthEditorEventHandler<EventName>) => DocAuthEditor;
|
|
383
|
+
/**
|
|
384
|
+
* Set all actions (replaces any existing actions).
|
|
385
|
+
* Allows setting and executing editor actions programmatically.
|
|
386
|
+
*
|
|
387
|
+
* @param actions - Array of actions to register
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```typescript
|
|
391
|
+
* import { defaultActions } from '@nutrient-sdk/document-authoring';
|
|
392
|
+
*
|
|
393
|
+
* // Register custom actions alongside default actions
|
|
394
|
+
* editor.setActions([
|
|
395
|
+
* ...defaultActions, // Keep default actions
|
|
396
|
+
* {
|
|
397
|
+
* id: 'custom.insert-signature',
|
|
398
|
+
* label: 'Insert Signature',
|
|
399
|
+
* handler: () => {
|
|
400
|
+
* editor.insertTextAtCursor('\n\nBest regards,\nJohn Doe');
|
|
401
|
+
* },
|
|
402
|
+
* shortcuts: [{ mac: '⌘⇧S', windows: 'Ctrl+Shift+S' }]
|
|
403
|
+
* }
|
|
404
|
+
* ]);
|
|
405
|
+
* ```
|
|
406
|
+
*
|
|
407
|
+
* @public
|
|
408
|
+
*/
|
|
409
|
+
setActions(actions: Action[]): void;
|
|
410
|
+
/**
|
|
411
|
+
* Set the toolbar configuration.
|
|
412
|
+
* Use this to customize the editor's toolbar.
|
|
413
|
+
*
|
|
414
|
+
* @param config - Toolbar configuration object
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```typescript
|
|
418
|
+
* import { defaultToolbarConfig } from '@nutrient-sdk/document-authoring';
|
|
419
|
+
*
|
|
420
|
+
* // Use default toolbar
|
|
421
|
+
* editor.setToolbarConfig(defaultToolbarConfig);
|
|
422
|
+
*
|
|
423
|
+
* // Or create a minimal toolbar
|
|
424
|
+
* editor.setToolbarConfig({
|
|
425
|
+
* items: [
|
|
426
|
+
* { type: 'built-in', id: 'undo', builtInType: 'undo' },
|
|
427
|
+
* { type: 'built-in', id: 'redo', builtInType: 'redo' },
|
|
428
|
+
* { type: 'separator', id: 'sep-1' },
|
|
429
|
+
* { type: 'built-in', id: 'bold', builtInType: 'bold' },
|
|
430
|
+
* { type: 'built-in', id: 'italic', builtInType: 'italic' },
|
|
431
|
+
* { type: 'action', id: 'custom', actionId: 'custom.insert-signature' }
|
|
432
|
+
* ]
|
|
433
|
+
* });
|
|
434
|
+
* ```
|
|
435
|
+
*
|
|
436
|
+
* @public
|
|
437
|
+
*/
|
|
438
|
+
setToolbarConfig(config: ToolbarConfig): void;
|
|
245
439
|
};
|
|
246
440
|
|
|
247
441
|
/**
|
|
@@ -601,6 +795,57 @@ export declare namespace Programmatic {
|
|
|
601
795
|
{};
|
|
602
796
|
}
|
|
603
797
|
|
|
798
|
+
/**
|
|
799
|
+
* Toolbar API - Type definitions for customizing the editor toolbar
|
|
800
|
+
* @public
|
|
801
|
+
*/
|
|
802
|
+
/**
|
|
803
|
+
* Action toolbar item - references an action by ID
|
|
804
|
+
* @public
|
|
805
|
+
*/
|
|
806
|
+
export declare type ToolbarActionItem = {
|
|
807
|
+
type: 'action';
|
|
808
|
+
id: string;
|
|
809
|
+
actionId: string;
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Built-in toolbar item - uses original toolbar components directly
|
|
814
|
+
* Self-contained with no external configuration properties
|
|
815
|
+
* @public
|
|
816
|
+
*/
|
|
817
|
+
export declare type ToolbarBuiltInItem = {
|
|
818
|
+
type: 'built-in';
|
|
819
|
+
id: string;
|
|
820
|
+
builtInType: 'undo' | 'redo' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'subscript' | 'superscript' | 'text-color' | 'highlight-color' | 'align-left' | 'align-center' | 'align-right' | 'align-justify' | 'bulleted-list' | 'numbered-list' | 'decrease-indent' | 'increase-indent' | 'clear-formatting' | 'formatting-marks' | 'zoom' | 'mobile-lock' | 'font-family' | 'font-size' | 'style-menu' | 'line-spacing-menu' | 'page-setup-menu' | 'insert-menu' | 'table-menu' | 'download-menu' | 'ui-settings-menu';
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Toolbar configuration
|
|
825
|
+
* @public
|
|
826
|
+
*/
|
|
827
|
+
export declare type ToolbarConfig = {
|
|
828
|
+
/**
|
|
829
|
+
* Array of toolbar items to display
|
|
830
|
+
*/
|
|
831
|
+
items?: ToolbarItem[];
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Union type for all toolbar items
|
|
836
|
+
* @public
|
|
837
|
+
*/
|
|
838
|
+
export declare type ToolbarItem = ToolbarActionItem | ToolbarBuiltInItem | ToolbarSeparatorItem;
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Visual separator
|
|
842
|
+
* @public
|
|
843
|
+
*/
|
|
844
|
+
export declare type ToolbarSeparatorItem = {
|
|
845
|
+
type: 'separator';
|
|
846
|
+
id: string;
|
|
847
|
+
};
|
|
848
|
+
|
|
604
849
|
/**
|
|
605
850
|
* @alpha
|
|
606
851
|
*/
|
|
@@ -655,11 +900,41 @@ export declare type UIOptions = {
|
|
|
655
900
|
*
|
|
656
901
|
* Initial zoom level for the editor.
|
|
657
902
|
*
|
|
658
|
-
* Valid range is 0.5 to 4.0.
|
|
903
|
+
* Valid range is 0.5 to 4.0, which any values provided will be clamped to.
|
|
659
904
|
*
|
|
660
905
|
* @defaultValue `1`
|
|
661
906
|
*/
|
|
662
907
|
initialZoom?: number;
|
|
908
|
+
/**
|
|
909
|
+
* Initial toolbar configuration.
|
|
910
|
+
*
|
|
911
|
+
* The toolbar can also be customized at runtime using `editor.setToolbarConfig()`.
|
|
912
|
+
*/
|
|
913
|
+
toolbar?: ToolbarConfig;
|
|
914
|
+
/**
|
|
915
|
+
* Initial actions configuration.
|
|
916
|
+
*
|
|
917
|
+
* Actions can also be customized at runtime using `editor.setActions()`.
|
|
918
|
+
*
|
|
919
|
+
* @example
|
|
920
|
+
* ```typescript
|
|
921
|
+
* import { defaultActions } from '@nutrient-sdk/document-authoring';
|
|
922
|
+
*
|
|
923
|
+
* const editor = await system.createEditor(target, {
|
|
924
|
+
* ui: {
|
|
925
|
+
* actions: [
|
|
926
|
+
* ...defaultActions,
|
|
927
|
+
* {
|
|
928
|
+
* id: 'custom.hello',
|
|
929
|
+
* label: 'Say Hello',
|
|
930
|
+
* handler: () => alert('Hello!'),
|
|
931
|
+
* }
|
|
932
|
+
* ]
|
|
933
|
+
* }
|
|
934
|
+
* });
|
|
935
|
+
* ```
|
|
936
|
+
*/
|
|
937
|
+
actions?: Action[];
|
|
663
938
|
};
|
|
664
939
|
|
|
665
940
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nutrient-sdk/document-authoring",
|
|
3
|
-
"version": "1.9.0-preview.
|
|
3
|
+
"version": "1.9.0-preview.202510311503.64e75f5284d684d4302f1db62d945f9ed3681223",
|
|
4
4
|
"description": "A web SDK for word processing and rich text capabilities.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "lib/docauth.umd.js",
|