@mlightcad/libredwg-converter 3.14.14 → 3.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +59 -59
- package/dist/libredwg-parser-worker.js +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 mlightcad
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mlightcad
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
# @mlightcad/libredwg-converter
|
|
2
|
-
|
|
3
|
-
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
4
|
-
[](https://www.npmjs.com/package/@mlightcad/libredwg-converter)
|
|
5
|
-
|
|
6
|
-
The `libredwg-converter` package provides a DWG file converter for the RealDWG-Web ecosystem, enabling reading and conversion of DWG files into the AutoCAD-like drawing database structure. It is based on the [LibreDWG](https://www.gnu.org/software/libredwg/) library compiled to WebAssembly.
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
This package implements a DWG file converter compatible with the RealDWG-Web data model. It allows you to register DWG file support in your application and convert DWG files into the in-memory drawing database.
|
|
11
|
-
|
|
12
|
-
DWG parsing is provided through a dedicated Web Worker bundle (`libredwg-parser-worker.js`). **This converter is intended for Web Worker use only.** That restriction is not because parsing cannot run on the main thread in principle; it is a deliberate licensing choice. LibreDWG and its WebAssembly wrapper are copyleft (GPL), and loading them in a separate worker bundle helps keep that parser code apart from the main MIT-licensed application so license obligations are easier to manage.
|
|
13
|
-
|
|
14
|
-
## Key Features
|
|
15
|
-
|
|
16
|
-
- **DWG File Support**: Read and convert DWG files to the drawing database
|
|
17
|
-
- **Integration**: Designed to work with the RealDWG-Web data model and converter manager
|
|
18
|
-
- **WebAssembly Powered**: Uses LibreDWG compiled to WASM, loaded in a Web Worker for license isolation
|
|
19
|
-
|
|
20
|
-
## Installation
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install @mlightcad/libredwg-converter
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
> **Peer dependencies:**
|
|
27
|
-
> - `@mlightcad/data-model`
|
|
28
|
-
|
|
29
|
-
## Usage Example
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
import { AcDbDatabaseConverterManager, AcDbFileType } from '@mlightcad/data-model';
|
|
33
|
-
import { AcDbLibreDwgConverter } from '@mlightcad/libredwg-converter';
|
|
34
|
-
|
|
35
|
-
const dwgConverter = new AcDbLibreDwgConverter({
|
|
36
|
-
useWorker: true,
|
|
37
|
-
parserWorkerUrl: './assets/libredwg-parser-worker.js'
|
|
38
|
-
});
|
|
39
|
-
AcDbDatabaseConverterManager.instance.register(AcDbFileType.DWG, dwgConverter);
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Deploy both `libredwg-parser-worker.js` and its sibling `libredwg-web.wasm` from this package's `dist/` folder to the same public directory. The worker loads the wasm from next to itself at runtime.
|
|
43
|
-
|
|
44
|
-
## API
|
|
45
|
-
|
|
46
|
-
- **AcDbLibreDwgConverter**: Main converter class for DWG files (extends `AcDbDatabaseConverter`)
|
|
47
|
-
|
|
48
|
-
## Dependencies
|
|
49
|
-
|
|
50
|
-
- **@mlightcad/data-model**: Drawing database and entity definitions
|
|
51
|
-
- **@mlightcad/libredwg-web**: WASM wrapper for LibreDWG, loaded in the worker bundle by design for license isolation
|
|
52
|
-
|
|
53
|
-
## API Documentation
|
|
54
|
-
|
|
55
|
-
For detailed API documentation, visit the [RealDWG-Web documentation](https://mlight-lee.github.io/realdwg-web/).
|
|
56
|
-
|
|
57
|
-
## Contributing
|
|
58
|
-
|
|
59
|
-
This package is part of the RealDWG-Web monorepo. Please refer to the main project README for contribution guidelines.
|
|
1
|
+
# @mlightcad/libredwg-converter
|
|
2
|
+
|
|
3
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
4
|
+
[](https://www.npmjs.com/package/@mlightcad/libredwg-converter)
|
|
5
|
+
|
|
6
|
+
The `libredwg-converter` package provides a DWG file converter for the RealDWG-Web ecosystem, enabling reading and conversion of DWG files into the AutoCAD-like drawing database structure. It is based on the [LibreDWG](https://www.gnu.org/software/libredwg/) library compiled to WebAssembly.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This package implements a DWG file converter compatible with the RealDWG-Web data model. It allows you to register DWG file support in your application and convert DWG files into the in-memory drawing database.
|
|
11
|
+
|
|
12
|
+
DWG parsing is provided through a dedicated Web Worker bundle (`libredwg-parser-worker.js`). **This converter is intended for Web Worker use only.** That restriction is not because parsing cannot run on the main thread in principle; it is a deliberate licensing choice. LibreDWG and its WebAssembly wrapper are copyleft (GPL), and loading them in a separate worker bundle helps keep that parser code apart from the main MIT-licensed application so license obligations are easier to manage.
|
|
13
|
+
|
|
14
|
+
## Key Features
|
|
15
|
+
|
|
16
|
+
- **DWG File Support**: Read and convert DWG files to the drawing database
|
|
17
|
+
- **Integration**: Designed to work with the RealDWG-Web data model and converter manager
|
|
18
|
+
- **WebAssembly Powered**: Uses LibreDWG compiled to WASM, loaded in a Web Worker for license isolation
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @mlightcad/libredwg-converter
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
> **Peer dependencies:**
|
|
27
|
+
> - `@mlightcad/data-model`
|
|
28
|
+
|
|
29
|
+
## Usage Example
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { AcDbDatabaseConverterManager, AcDbFileType } from '@mlightcad/data-model';
|
|
33
|
+
import { AcDbLibreDwgConverter } from '@mlightcad/libredwg-converter';
|
|
34
|
+
|
|
35
|
+
const dwgConverter = new AcDbLibreDwgConverter({
|
|
36
|
+
useWorker: true,
|
|
37
|
+
parserWorkerUrl: './assets/libredwg-parser-worker.js'
|
|
38
|
+
});
|
|
39
|
+
AcDbDatabaseConverterManager.instance.register(AcDbFileType.DWG, dwgConverter);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Deploy both `libredwg-parser-worker.js` and its sibling `libredwg-web.wasm` from this package's `dist/` folder to the same public directory. The worker loads the wasm from next to itself at runtime.
|
|
43
|
+
|
|
44
|
+
## API
|
|
45
|
+
|
|
46
|
+
- **AcDbLibreDwgConverter**: Main converter class for DWG files (extends `AcDbDatabaseConverter`)
|
|
47
|
+
|
|
48
|
+
## Dependencies
|
|
49
|
+
|
|
50
|
+
- **@mlightcad/data-model**: Drawing database and entity definitions
|
|
51
|
+
- **@mlightcad/libredwg-web**: WASM wrapper for LibreDWG, loaded in the worker bundle by design for license isolation
|
|
52
|
+
|
|
53
|
+
## API Documentation
|
|
54
|
+
|
|
55
|
+
For detailed API documentation, visit the [RealDWG-Web documentation](https://mlight-lee.github.io/realdwg-web/).
|
|
56
|
+
|
|
57
|
+
## Contributing
|
|
58
|
+
|
|
59
|
+
This package is part of the RealDWG-Web monorepo. Please refer to the main project README for contribution guidelines.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ro=Object.defineProperty;var ao=(a,t,i)=>t in a?ro(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i;var Yt=(a,t,i)=>ao(a,typeof t!="symbol"?t+"":t,i);var oo="DwgConverterLicenseError",io=["evaluation of @mlight-cad/dwg-converter has expired"],so=["invalid @mlight-cad/dwg-converter license key"];function _o(a){return a==="license_expired"||a==="license_invalid"}function _r(a){var t=a.toLowerCase();if(io.some(function(i){return t.includes(i)}))return"license_expired";if(so.some(function(i){return t.includes(i)}))return"license_invalid"}function lo(a){var t;return(t=_r(a))!==null&&t!==void 0?t:"license_invalid"}var co=function(a,t,i,n){function d(_){return _ instanceof i?_:new i(function(E){E(_)})}return new(i||(i=Promise))(function(_,E){function h(P){try{A(n.next(P))}catch(v){E(v)}}function g(P){try{A(n.throw(P))}catch(v){E(v)}}function A(P){P.done?_(P.value):d(P.value).then(h,g)}A((n=n.apply(a,t||[])).next())})},Eo=function(a,t){var i={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},n,d,_,E;return E={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(E[Symbol.iterator]=function(){return this}),E;function h(A){return function(P){return g([A,P])}}function g(A){if(n)throw new TypeError("Generator is already executing.");for(;E&&(E=0,A[0]&&(i=0)),i;)try{if(n=1,d&&(_=A[0]&2?d.return:A[0]?d.throw||((_=d.return)&&_.call(d),0):d.next)&&!(_=_.call(d,A[1])).done)return _;switch(d=0,_&&(A=[A[0]&2,_.value]),A[0]){case 0:case 1:_=A;break;case 4:return i.label++,{value:A[1],done:!1};case 5:i.label++,d=A[1],A=[0];continue;case 7:A=i.ops.pop(),i.trys.pop();continue;default:if(_=i.trys,!(_=_.length>0&&_[_.length-1])&&(A[0]===6||A[0]===2)){i=0;continue}if(A[0]===3&&(!_||A[1]>_[0]&&A[1]<_[3])){i.label=A[1];break}if(A[0]===6&&i.label<_[1]){i.label=_[1],_=A;break}if(_&&i.label<_[2]){i.label=_[2],i.ops.push(A);break}_[2]&&i.ops.pop(),i.trys.pop();continue}A=t.call(a,i)}catch(P){A=[6,P],d=0}finally{n=_=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},uo=["out of memory","data cannot be cloned","allocation failed","memory access out of bounds"];function fo(a){var t=a.toLowerCase();return uo.some(function(i){return t.includes(i)})}var ho=(function(){function a(){this.setupMessageHandler()}return a.prototype.setupMessageHandler=function(){var t=this;self.onmessage=function(i){return co(t,void 0,void 0,function(){var n,d,_,E,h,g;return Eo(this,function(A){switch(A.label){case 0:n=i.data,d=n.id,_=n.input,A.label=1;case 1:return A.trys.push([1,3,,4]),[4,this.executeTask(_)];case 2:return E=A.sent(),this.sendResponse(d,!0,E),[3,4];case 3:return h=A.sent(),g=h instanceof Error?h.message:String(h),this.sendResponse(d,!1,void 0,g,this.classifyTaskError(h,g)),[3,4];case 4:return[2]}})})}},a.prototype.sendResponse=function(t,i,n,d,_){var E={id:t,success:i,data:n,error:d,errorCode:_};try{self.postMessage(E)}catch(g){var h=g instanceof Error?g.message:String(g);self.postMessage({id:t,success:!1,error:h,errorCode:this.classifyPostMessageError(h)})}},a.prototype.classifyTaskError=function(t,i){if(t instanceof Error){var n=t.code;if(_o(n))return n;if(t.name===oo)return lo(i)}var d=_r(i);return d||this.classifyPostMessageError(i)},a.prototype.classifyPostMessageError=function(t){return fo(t)?"worker_oom":t.toLowerCase().includes("timed out")?"worker_timeout":"worker_error"},a})();const go="modulepreload",Ao=function(a,t){return new URL(a,t).href},tr={},To=function(t,i,n){let d=Promise.resolve();if(i&&i.length>0){let E=function(P){return Promise.all(P.map(v=>Promise.resolve(v).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const h=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),A=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));d=E(i.map(P=>{if(P=Ao(P,n),P in tr)return;tr[P]=!0;const v=P.endsWith(".css"),p=v?'[rel="stylesheet"]':"";if(!!n)for(let w=h.length-1;w>=0;w--){const m=h[w];if(m.href===P&&(!v||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${P}"]${p}`))return;const R=document.createElement("link");if(R.rel=v?"stylesheet":go,v||(R.as="script"),R.crossOrigin="",R.href=P,A&&R.setAttribute("nonce",A),document.head.appendChild(R),v)return new Promise((w,m)=>{R.addEventListener("load",w),R.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${P}`)))})}))}function _(E){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=E,window.dispatchEvent(h),!h.defaultPrevented)throw E}return d.then(E=>{for(const h of E||[])h.status==="rejected"&&_(h.reason);return t().catch(_)})};var er=(()=>{var a=import.meta.url;return(async function(t={}){var i,n=t,d,_,E=new Promise((e,r)=>{d=e,_=r}),h=typeof window=="object",g=typeof WorkerGlobalScope<"u",A=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(A){const{createRequire:e}=await To(()=>Promise.resolve().then(()=>Fo),void 0,import.meta.url);var P=e(import.meta.url)}var v=Object.assign({},n),p="./this.program",I="";function R(e){return n.locateFile?n.locateFile(e,I):I+e}var w,m;if(A){var S=P("fs"),W=P("path");import.meta.url.startsWith("data:")||(I=W.dirname(P("url").fileURLToPath(import.meta.url))+"/"),m=e=>{e=ft(e)?new URL(e):e;var r=S.readFileSync(e);return r},w=async(e,r=!0)=>{e=ft(e)?new URL(e):e;var o=S.readFileSync(e,r?void 0:"utf8");return o},!n.thisProgram&&process.argv.length>1&&(p=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2)}else(h||g)&&(g?I=self.location.href:typeof document<"u"&&document.currentScript&&(I=document.currentScript.src),a&&(I=a),I.startsWith("blob:")?I="":I=I.slice(0,I.replace(/[?#].*/,"").lastIndexOf("/")+1),g&&(m=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),w=async e=>{if(ft(e))return new Promise((o,s)=>{var c=new XMLHttpRequest;c.open("GET",e,!0),c.responseType="arraybuffer",c.onload=()=>{if(c.status==200||c.status==0&&c.response){o(c.response);return}s(c.status)},c.onerror=s,c.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var M=n.print||(()=>{}).bind(console),x=n.printErr||(()=>{}).bind(console);Object.assign(n,v),v=null,n.arguments&&n.arguments,n.thisProgram&&(p=n.thisProgram);var k=n.wasmBinary,V,q=!1,$,Z,nt,it,Y,U,lt,st,Dt,yt,Nt="data:application/octet-stream;base64,",pt=e=>e.startsWith(Nt),ft=e=>e.startsWith("file://");function ht(){var e=V.buffer;n.HEAP8=$=new Int8Array(e),n.HEAP16=nt=new Int16Array(e),n.HEAPU8=Z=new Uint8Array(e),n.HEAPU16=it=new Uint16Array(e),n.HEAP32=Y=new Int32Array(e),n.HEAPU32=U=new Uint32Array(e),n.HEAPF32=lt=new Float32Array(e),n.HEAPF64=yt=new Float64Array(e),n.HEAP64=st=new BigInt64Array(e),n.HEAPU64=Dt=new BigUint64Array(e)}var Rt=[],Ft=[],Ut=[];function Zt(){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)jt(n.preRun.shift());ne(Rt)}function qt(){!n.noFSInit&&!l.initialized&&l.init(),l.ignorePermissions=!1,ne(Ft)}function Qt(){if(n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;)te(n.postRun.shift());ne(Ut)}function jt(e){Rt.unshift(e)}function Gt(e){Ft.unshift(e)}function te(e){Ut.unshift(e)}var ct=0,Wt=null;function $t(e){var r;ct++,(r=n.monitorRunDependencies)==null||r.call(n,ct)}function Q(e){var o;if(ct--,(o=n.monitorRunDependencies)==null||o.call(n,ct),ct==0&&Wt){var r=Wt;Wt=null,r()}}function X(e){var o;(o=n.onAbort)==null||o.call(n,e),e="Aborted("+e+")",x(e),q=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw _(r),r}var ee;function we(){if(n.locateFile){var e="libredwg-web.wasm";return pt(e)?e:R(e)}return new URL(""+new URL("libredwg-web.wasm",import.meta.url).href,import.meta.url).href}function Ce(e){if(e==ee&&k)return new Uint8Array(k);if(m)return m(e);throw"both async and sync fetching of the wasm failed"}async function De(e){if(!k)try{var r=await w(e);return new Uint8Array(r)}catch{}return Ce(e)}async function Re(e,r){try{var o=await De(e),s=await WebAssembly.instantiate(o,r);return s}catch(c){x(`failed to asynchronously prepare wasm: ${c}`),X(c)}}async function Se(e,r,o){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!pt(r)&&!ft(r)&&!A)try{var s=fetch(r,{credentials:"same-origin"}),c=await WebAssembly.instantiateStreaming(s,o);return c}catch(u){x(`wasm streaming compile failed: ${u}`),x("falling back to ArrayBuffer instantiation")}return Re(r,o)}function Le(){return{env:Qn,wasi_snapshot_preview1:Qn}}async function Ye(){function e(u,f){return K=u.exports,K=no(K),V=K.memory,ht(),kn=K.__indirect_function_table,Gt(K.__wasm_call_ctors),Q(),K}$t();function r(u){return e(u.instance)}var o=Le();if(n.instantiateWasm)try{return n.instantiateWasm(o,e)}catch(u){x(`Module.instantiateWasm callback failed with error: ${u}`),_(u)}ee??(ee=we());try{var s=await Se(k,ee,o),c=r(s);return c}catch(u){return _(u),Promise.reject(u)}}var ne=e=>{for(;e.length>0;)e.shift()(n)};n.noExitRuntime;function Ne(e,r,o="i8"){switch(o.endsWith("*")&&(o="*"),o){case"i1":$[e>>>0]=r;break;case"i8":$[e>>>0]=r;break;case"i16":nt[e>>>1>>>0]=r;break;case"i32":Y[e>>>2>>>0]=r;break;case"i64":st[e>>>3]=BigInt(r);break;case"float":lt[e>>>2>>>0]=r;break;case"double":yt[e>>>3>>>0]=r;break;case"*":U[e>>>2>>>0]=r;break;default:X(`invalid type for setValue: ${o}`)}}var he=e=>ja(e),ge=()=>eo();class Ge{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){U[this.ptr+4>>>2>>>0]=r}get_type(){return U[this.ptr+4>>>2>>>0]}set_destructor(r){U[this.ptr+8>>>2>>>0]=r}get_destructor(){return U[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,$[this.ptr+12>>>0]=r}get_caught(){return $[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,$[this.ptr+13>>>0]=r}get_rethrown(){return $[this.ptr+13>>>0]!=0}init(r,o){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(o)}set_adjusted_ptr(r){U[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return U[this.ptr+16>>>2>>>0]}}var Ae=0,We=9007199254740992,Me=-9007199254740992,re=e=>e<Me||e>We?NaN:Number(e);function Te(e,r,o){e>>>=0,r>>>=0,o>>>=0;var s=new Ge(e);throw s.init(r,o),Ae=e,Ae}var Mt=()=>{var e=Y[+F.varargs>>>2>>>0];return F.varargs+=4,e},vt=Mt,J={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var o=0,s=e.length-1;s>=0;s--){var c=e[s];c==="."?e.splice(s,1):c===".."?(e.splice(s,1),o++):o&&(e.splice(s,1),o--)}if(r)for(;o;o--)e.unshift("..");return e},normalize:e=>{var r=J.isAbs(e),o=e.slice(-1)==="/";return e=J.normalizeArray(e.split("/").filter(s=>!!s),!r).join("/"),!e&&!r&&(e="."),e&&o&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=J.splitPath(e),o=r[0],s=r[1];return!o&&!s?".":(s&&(s=s.slice(0,-1)),o+s)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>J.normalize(e.join("/")),join2:(e,r)=>J.normalize(e+"/"+r)},Pe=()=>{if(A){var e=P("crypto");return r=>e.randomFillSync(r)}return r=>crypto.getRandomValues(r)},Ht=e=>{(Ht=Pe())(e)},It={resolve:(...e)=>{for(var r="",o=!1,s=e.length-1;s>=-1&&!o;s--){var c=s>=0?e[s]:l.cwd();if(typeof c!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";r=c+"/"+r,o=J.isAbs(c)}return r=J.normalizeArray(r.split("/").filter(u=>!!u),!o).join("/"),(o?"/":"")+r||"."},relative:(e,r)=>{e=It.resolve(e).slice(1),r=It.resolve(r).slice(1);function o(C){for(var D=0;D<C.length&&C[D]==="";D++);for(var N=C.length-1;N>=0&&C[N]==="";N--);return D>N?[]:C.slice(D,N-D+1)}for(var s=o(e.split("/")),c=o(r.split("/")),u=Math.min(s.length,c.length),f=u,T=0;T<u;T++)if(s[T]!==c[T]){f=T;break}for(var y=[],T=f;T<s.length;T++)y.push("..");return y=y.concat(c.slice(f)),y.join("/")}},ae=typeof TextDecoder<"u"?new TextDecoder:void 0,mt=(e,r=0,o=NaN)=>{r>>>=0;for(var s=r+o,c=r;e[c]&&!(c>=s);)++c;if(c-r>16&&e.buffer&&ae)return ae.decode(e.subarray(r,c));for(var u="";r<c;){var f=e[r++];if(!(f&128)){u+=String.fromCharCode(f);continue}var T=e[r++]&63;if((f&224)==192){u+=String.fromCharCode((f&31)<<6|T);continue}var y=e[r++]&63;if((f&240)==224?f=(f&15)<<12|T<<6|y:f=(f&7)<<18|T<<12|y<<6|e[r++]&63,f<65536)u+=String.fromCharCode(f);else{var C=f-65536;u+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return u},Vt=[],St=e=>{for(var r=0,o=0;o<e.length;++o){var s=e.charCodeAt(o);s<=127?r++:s<=2047?r+=2:s>=55296&&s<=57343?(r+=4,++o):r+=3}return r},Xt=(e,r,o,s)=>{if(o>>>=0,!(s>0))return 0;for(var c=o,u=o+s-1,f=0;f<e.length;++f){var T=e.charCodeAt(f);if(T>=55296&&T<=57343){var y=e.charCodeAt(++f);T=65536+((T&1023)<<10)|y&1023}if(T<=127){if(o>=u)break;r[o++>>>0]=T}else if(T<=2047){if(o+1>=u)break;r[o++>>>0]=192|T>>6,r[o++>>>0]=128|T&63}else if(T<=65535){if(o+2>=u)break;r[o++>>>0]=224|T>>12,r[o++>>>0]=128|T>>6&63,r[o++>>>0]=128|T&63}else{if(o+3>=u)break;r[o++>>>0]=240|T>>18,r[o++>>>0]=128|T>>12&63,r[o++>>>0]=128|T>>6&63,r[o++>>>0]=128|T&63}}return r[o>>>0]=0,o-c},oe=(e,r,o)=>{var s=St(e)+1,c=new Array(s),u=Xt(e,c,0,c.length);return c.length=u,c},ye=()=>{if(!Vt.length){var e=null;if(A){var r=256,o=Buffer.alloc(r),s=0,c=process.stdin.fd;try{s=S.readSync(c,o,0,r)}catch(u){if(u.toString().includes("EOF"))s=0;else throw u}s>0&&(e=o.slice(0,s).toString("utf-8"))}else typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
1
|
+
var ro=Object.defineProperty;var ao=(a,t,i)=>t in a?ro(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i;var Yt=(a,t,i)=>ao(a,typeof t!="symbol"?t+"":t,i);var oo="DwgConverterLicenseError",io=["evaluation of @mlightcad/dwg-converter has expired"],so=["invalid @mlightcad/dwg-converter license key"];function _o(a){return a==="license_expired"||a==="license_invalid"}function _r(a){var t=a.toLowerCase();if(io.some(function(i){return t.includes(i)}))return"license_expired";if(so.some(function(i){return t.includes(i)}))return"license_invalid"}function lo(a){var t;return(t=_r(a))!==null&&t!==void 0?t:"license_invalid"}var co=function(a,t,i,n){function d(_){return _ instanceof i?_:new i(function(E){E(_)})}return new(i||(i=Promise))(function(_,E){function h(P){try{A(n.next(P))}catch(v){E(v)}}function g(P){try{A(n.throw(P))}catch(v){E(v)}}function A(P){P.done?_(P.value):d(P.value).then(h,g)}A((n=n.apply(a,t||[])).next())})},Eo=function(a,t){var i={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},n,d,_,E;return E={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(E[Symbol.iterator]=function(){return this}),E;function h(A){return function(P){return g([A,P])}}function g(A){if(n)throw new TypeError("Generator is already executing.");for(;E&&(E=0,A[0]&&(i=0)),i;)try{if(n=1,d&&(_=A[0]&2?d.return:A[0]?d.throw||((_=d.return)&&_.call(d),0):d.next)&&!(_=_.call(d,A[1])).done)return _;switch(d=0,_&&(A=[A[0]&2,_.value]),A[0]){case 0:case 1:_=A;break;case 4:return i.label++,{value:A[1],done:!1};case 5:i.label++,d=A[1],A=[0];continue;case 7:A=i.ops.pop(),i.trys.pop();continue;default:if(_=i.trys,!(_=_.length>0&&_[_.length-1])&&(A[0]===6||A[0]===2)){i=0;continue}if(A[0]===3&&(!_||A[1]>_[0]&&A[1]<_[3])){i.label=A[1];break}if(A[0]===6&&i.label<_[1]){i.label=_[1],_=A;break}if(_&&i.label<_[2]){i.label=_[2],i.ops.push(A);break}_[2]&&i.ops.pop(),i.trys.pop();continue}A=t.call(a,i)}catch(P){A=[6,P],d=0}finally{n=_=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},uo=["out of memory","data cannot be cloned","allocation failed","memory access out of bounds"];function fo(a){var t=a.toLowerCase();return uo.some(function(i){return t.includes(i)})}var ho=(function(){function a(){this.setupMessageHandler()}return a.prototype.setupMessageHandler=function(){var t=this;self.onmessage=function(i){return co(t,void 0,void 0,function(){var n,d,_,E,h,g;return Eo(this,function(A){switch(A.label){case 0:n=i.data,d=n.id,_=n.input,A.label=1;case 1:return A.trys.push([1,3,,4]),[4,this.executeTask(_)];case 2:return E=A.sent(),this.sendResponse(d,!0,E),[3,4];case 3:return h=A.sent(),g=h instanceof Error?h.message:String(h),this.sendResponse(d,!1,void 0,g,this.classifyTaskError(h,g)),[3,4];case 4:return[2]}})})}},a.prototype.sendResponse=function(t,i,n,d,_){var E={id:t,success:i,data:n,error:d,errorCode:_};try{self.postMessage(E)}catch(g){var h=g instanceof Error?g.message:String(g);self.postMessage({id:t,success:!1,error:h,errorCode:this.classifyPostMessageError(h)})}},a.prototype.classifyTaskError=function(t,i){if(t instanceof Error){var n=t.code;if(_o(n))return n;if(t.name===oo)return lo(i)}var d=_r(i);return d||this.classifyPostMessageError(i)},a.prototype.classifyPostMessageError=function(t){return fo(t)?"worker_oom":t.toLowerCase().includes("timed out")?"worker_timeout":"worker_error"},a})();const go="modulepreload",Ao=function(a,t){return new URL(a,t).href},tr={},To=function(t,i,n){let d=Promise.resolve();if(i&&i.length>0){let E=function(P){return Promise.all(P.map(v=>Promise.resolve(v).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const h=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),A=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));d=E(i.map(P=>{if(P=Ao(P,n),P in tr)return;tr[P]=!0;const v=P.endsWith(".css"),p=v?'[rel="stylesheet"]':"";if(!!n)for(let w=h.length-1;w>=0;w--){const m=h[w];if(m.href===P&&(!v||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${P}"]${p}`))return;const R=document.createElement("link");if(R.rel=v?"stylesheet":go,v||(R.as="script"),R.crossOrigin="",R.href=P,A&&R.setAttribute("nonce",A),document.head.appendChild(R),v)return new Promise((w,m)=>{R.addEventListener("load",w),R.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${P}`)))})}))}function _(E){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=E,window.dispatchEvent(h),!h.defaultPrevented)throw E}return d.then(E=>{for(const h of E||[])h.status==="rejected"&&_(h.reason);return t().catch(_)})};var er=(()=>{var a=import.meta.url;return(async function(t={}){var i,n=t,d,_,E=new Promise((e,r)=>{d=e,_=r}),h=typeof window=="object",g=typeof WorkerGlobalScope<"u",A=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(A){const{createRequire:e}=await To(()=>Promise.resolve().then(()=>Fo),void 0,import.meta.url);var P=e(import.meta.url)}var v=Object.assign({},n),p="./this.program",I="";function R(e){return n.locateFile?n.locateFile(e,I):I+e}var w,m;if(A){var S=P("fs"),W=P("path");import.meta.url.startsWith("data:")||(I=W.dirname(P("url").fileURLToPath(import.meta.url))+"/"),m=e=>{e=ft(e)?new URL(e):e;var r=S.readFileSync(e);return r},w=async(e,r=!0)=>{e=ft(e)?new URL(e):e;var o=S.readFileSync(e,r?void 0:"utf8");return o},!n.thisProgram&&process.argv.length>1&&(p=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2)}else(h||g)&&(g?I=self.location.href:typeof document<"u"&&document.currentScript&&(I=document.currentScript.src),a&&(I=a),I.startsWith("blob:")?I="":I=I.slice(0,I.replace(/[?#].*/,"").lastIndexOf("/")+1),g&&(m=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),w=async e=>{if(ft(e))return new Promise((o,s)=>{var c=new XMLHttpRequest;c.open("GET",e,!0),c.responseType="arraybuffer",c.onload=()=>{if(c.status==200||c.status==0&&c.response){o(c.response);return}s(c.status)},c.onerror=s,c.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var M=n.print||(()=>{}).bind(console),x=n.printErr||(()=>{}).bind(console);Object.assign(n,v),v=null,n.arguments&&n.arguments,n.thisProgram&&(p=n.thisProgram);var k=n.wasmBinary,V,q=!1,$,Z,nt,it,Y,U,lt,st,Dt,yt,Nt="data:application/octet-stream;base64,",pt=e=>e.startsWith(Nt),ft=e=>e.startsWith("file://");function ht(){var e=V.buffer;n.HEAP8=$=new Int8Array(e),n.HEAP16=nt=new Int16Array(e),n.HEAPU8=Z=new Uint8Array(e),n.HEAPU16=it=new Uint16Array(e),n.HEAP32=Y=new Int32Array(e),n.HEAPU32=U=new Uint32Array(e),n.HEAPF32=lt=new Float32Array(e),n.HEAPF64=yt=new Float64Array(e),n.HEAP64=st=new BigInt64Array(e),n.HEAPU64=Dt=new BigUint64Array(e)}var Rt=[],Ft=[],Ut=[];function Zt(){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)jt(n.preRun.shift());ne(Rt)}function qt(){!n.noFSInit&&!l.initialized&&l.init(),l.ignorePermissions=!1,ne(Ft)}function Qt(){if(n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;)te(n.postRun.shift());ne(Ut)}function jt(e){Rt.unshift(e)}function Gt(e){Ft.unshift(e)}function te(e){Ut.unshift(e)}var ct=0,Wt=null;function $t(e){var r;ct++,(r=n.monitorRunDependencies)==null||r.call(n,ct)}function Q(e){var o;if(ct--,(o=n.monitorRunDependencies)==null||o.call(n,ct),ct==0&&Wt){var r=Wt;Wt=null,r()}}function X(e){var o;(o=n.onAbort)==null||o.call(n,e),e="Aborted("+e+")",x(e),q=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw _(r),r}var ee;function we(){if(n.locateFile){var e="libredwg-web.wasm";return pt(e)?e:R(e)}return new URL(""+new URL("libredwg-web.wasm",import.meta.url).href,import.meta.url).href}function Ce(e){if(e==ee&&k)return new Uint8Array(k);if(m)return m(e);throw"both async and sync fetching of the wasm failed"}async function De(e){if(!k)try{var r=await w(e);return new Uint8Array(r)}catch{}return Ce(e)}async function Re(e,r){try{var o=await De(e),s=await WebAssembly.instantiate(o,r);return s}catch(c){x(`failed to asynchronously prepare wasm: ${c}`),X(c)}}async function Se(e,r,o){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!pt(r)&&!ft(r)&&!A)try{var s=fetch(r,{credentials:"same-origin"}),c=await WebAssembly.instantiateStreaming(s,o);return c}catch(u){x(`wasm streaming compile failed: ${u}`),x("falling back to ArrayBuffer instantiation")}return Re(r,o)}function Le(){return{env:Qn,wasi_snapshot_preview1:Qn}}async function Ye(){function e(u,f){return K=u.exports,K=no(K),V=K.memory,ht(),kn=K.__indirect_function_table,Gt(K.__wasm_call_ctors),Q(),K}$t();function r(u){return e(u.instance)}var o=Le();if(n.instantiateWasm)try{return n.instantiateWasm(o,e)}catch(u){x(`Module.instantiateWasm callback failed with error: ${u}`),_(u)}ee??(ee=we());try{var s=await Se(k,ee,o),c=r(s);return c}catch(u){return _(u),Promise.reject(u)}}var ne=e=>{for(;e.length>0;)e.shift()(n)};n.noExitRuntime;function Ne(e,r,o="i8"){switch(o.endsWith("*")&&(o="*"),o){case"i1":$[e>>>0]=r;break;case"i8":$[e>>>0]=r;break;case"i16":nt[e>>>1>>>0]=r;break;case"i32":Y[e>>>2>>>0]=r;break;case"i64":st[e>>>3]=BigInt(r);break;case"float":lt[e>>>2>>>0]=r;break;case"double":yt[e>>>3>>>0]=r;break;case"*":U[e>>>2>>>0]=r;break;default:X(`invalid type for setValue: ${o}`)}}var he=e=>ja(e),ge=()=>eo();class Ge{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){U[this.ptr+4>>>2>>>0]=r}get_type(){return U[this.ptr+4>>>2>>>0]}set_destructor(r){U[this.ptr+8>>>2>>>0]=r}get_destructor(){return U[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,$[this.ptr+12>>>0]=r}get_caught(){return $[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,$[this.ptr+13>>>0]=r}get_rethrown(){return $[this.ptr+13>>>0]!=0}init(r,o){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(o)}set_adjusted_ptr(r){U[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return U[this.ptr+16>>>2>>>0]}}var Ae=0,We=9007199254740992,Me=-9007199254740992,re=e=>e<Me||e>We?NaN:Number(e);function Te(e,r,o){e>>>=0,r>>>=0,o>>>=0;var s=new Ge(e);throw s.init(r,o),Ae=e,Ae}var Mt=()=>{var e=Y[+F.varargs>>>2>>>0];return F.varargs+=4,e},vt=Mt,J={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var o=0,s=e.length-1;s>=0;s--){var c=e[s];c==="."?e.splice(s,1):c===".."?(e.splice(s,1),o++):o&&(e.splice(s,1),o--)}if(r)for(;o;o--)e.unshift("..");return e},normalize:e=>{var r=J.isAbs(e),o=e.slice(-1)==="/";return e=J.normalizeArray(e.split("/").filter(s=>!!s),!r).join("/"),!e&&!r&&(e="."),e&&o&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=J.splitPath(e),o=r[0],s=r[1];return!o&&!s?".":(s&&(s=s.slice(0,-1)),o+s)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>J.normalize(e.join("/")),join2:(e,r)=>J.normalize(e+"/"+r)},Pe=()=>{if(A){var e=P("crypto");return r=>e.randomFillSync(r)}return r=>crypto.getRandomValues(r)},Ht=e=>{(Ht=Pe())(e)},It={resolve:(...e)=>{for(var r="",o=!1,s=e.length-1;s>=-1&&!o;s--){var c=s>=0?e[s]:l.cwd();if(typeof c!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";r=c+"/"+r,o=J.isAbs(c)}return r=J.normalizeArray(r.split("/").filter(u=>!!u),!o).join("/"),(o?"/":"")+r||"."},relative:(e,r)=>{e=It.resolve(e).slice(1),r=It.resolve(r).slice(1);function o(C){for(var D=0;D<C.length&&C[D]==="";D++);for(var N=C.length-1;N>=0&&C[N]==="";N--);return D>N?[]:C.slice(D,N-D+1)}for(var s=o(e.split("/")),c=o(r.split("/")),u=Math.min(s.length,c.length),f=u,T=0;T<u;T++)if(s[T]!==c[T]){f=T;break}for(var y=[],T=f;T<s.length;T++)y.push("..");return y=y.concat(c.slice(f)),y.join("/")}},ae=typeof TextDecoder<"u"?new TextDecoder:void 0,mt=(e,r=0,o=NaN)=>{r>>>=0;for(var s=r+o,c=r;e[c]&&!(c>=s);)++c;if(c-r>16&&e.buffer&&ae)return ae.decode(e.subarray(r,c));for(var u="";r<c;){var f=e[r++];if(!(f&128)){u+=String.fromCharCode(f);continue}var T=e[r++]&63;if((f&224)==192){u+=String.fromCharCode((f&31)<<6|T);continue}var y=e[r++]&63;if((f&240)==224?f=(f&15)<<12|T<<6|y:f=(f&7)<<18|T<<12|y<<6|e[r++]&63,f<65536)u+=String.fromCharCode(f);else{var C=f-65536;u+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return u},Vt=[],St=e=>{for(var r=0,o=0;o<e.length;++o){var s=e.charCodeAt(o);s<=127?r++:s<=2047?r+=2:s>=55296&&s<=57343?(r+=4,++o):r+=3}return r},Xt=(e,r,o,s)=>{if(o>>>=0,!(s>0))return 0;for(var c=o,u=o+s-1,f=0;f<e.length;++f){var T=e.charCodeAt(f);if(T>=55296&&T<=57343){var y=e.charCodeAt(++f);T=65536+((T&1023)<<10)|y&1023}if(T<=127){if(o>=u)break;r[o++>>>0]=T}else if(T<=2047){if(o+1>=u)break;r[o++>>>0]=192|T>>6,r[o++>>>0]=128|T&63}else if(T<=65535){if(o+2>=u)break;r[o++>>>0]=224|T>>12,r[o++>>>0]=128|T>>6&63,r[o++>>>0]=128|T&63}else{if(o+3>=u)break;r[o++>>>0]=240|T>>18,r[o++>>>0]=128|T>>12&63,r[o++>>>0]=128|T>>6&63,r[o++>>>0]=128|T&63}}return r[o>>>0]=0,o-c},oe=(e,r,o)=>{var s=St(e)+1,c=new Array(s),u=Xt(e,c,0,c.length);return c.length=u,c},ye=()=>{if(!Vt.length){var e=null;if(A){var r=256,o=Buffer.alloc(r),s=0,c=process.stdin.fd;try{s=S.readSync(c,o,0,r)}catch(u){if(u.toString().includes("EOF"))s=0;else throw u}s>0&&(e=o.slice(0,s).toString("utf-8"))}else typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
2
2
|
`));if(!e)return null;Vt=oe(e)}return Vt.shift()},gt={ttys:[],init(){},shutdown(){},register(e,r){gt.ttys[e]={input:[],output:[],ops:r},l.registerDevice(e,gt.stream_ops)},stream_ops:{open(e){var r=gt.ttys[e.node.rdev];if(!r)throw new l.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,o,s,c){if(!e.tty||!e.tty.ops.get_char)throw new l.ErrnoError(60);for(var u=0,f=0;f<s;f++){var T;try{T=e.tty.ops.get_char(e.tty)}catch{throw new l.ErrnoError(29)}if(T===void 0&&u===0)throw new l.ErrnoError(6);if(T==null)break;u++,r[o+f]=T}return u&&(e.node.atime=Date.now()),u},write(e,r,o,s,c){if(!e.tty||!e.tty.ops.put_char)throw new l.ErrnoError(60);try{for(var u=0;u<s;u++)e.tty.ops.put_char(e.tty,r[o+u])}catch{throw new l.ErrnoError(29)}return s&&(e.node.mtime=e.node.ctime=Date.now()),u}},default_tty_ops:{get_char(e){return ye()},put_char(e,r){r===null||r===10?(M(mt(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){var r;((r=e.output)==null?void 0:r.length)>0&&(M(mt(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,o){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(x(mt(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){var r;((r=e.output)==null?void 0:r.length)>0&&(x(mt(e.output)),e.output=[])}}},pe=(e,r)=>Math.ceil(e/r)*r,ie=e=>{X()},B={ops_table:null,mount(e){return B.createNode(null,"/",16895,0)},createNode(e,r,o,s){if(l.isBlkdev(o)||l.isFIFO(o))throw new l.ErrnoError(63);B.ops_table||(B.ops_table={dir:{node:{getattr:B.node_ops.getattr,setattr:B.node_ops.setattr,lookup:B.node_ops.lookup,mknod:B.node_ops.mknod,rename:B.node_ops.rename,unlink:B.node_ops.unlink,rmdir:B.node_ops.rmdir,readdir:B.node_ops.readdir,symlink:B.node_ops.symlink},stream:{llseek:B.stream_ops.llseek}},file:{node:{getattr:B.node_ops.getattr,setattr:B.node_ops.setattr},stream:{llseek:B.stream_ops.llseek,read:B.stream_ops.read,write:B.stream_ops.write,allocate:B.stream_ops.allocate,mmap:B.stream_ops.mmap,msync:B.stream_ops.msync}},link:{node:{getattr:B.node_ops.getattr,setattr:B.node_ops.setattr,readlink:B.node_ops.readlink},stream:{}},chrdev:{node:{getattr:B.node_ops.getattr,setattr:B.node_ops.setattr},stream:l.chrdev_stream_ops}});var c=l.createNode(e,r,o,s);return l.isDir(c.mode)?(c.node_ops=B.ops_table.dir.node,c.stream_ops=B.ops_table.dir.stream,c.contents={}):l.isFile(c.mode)?(c.node_ops=B.ops_table.file.node,c.stream_ops=B.ops_table.file.stream,c.usedBytes=0,c.contents=null):l.isLink(c.mode)?(c.node_ops=B.ops_table.link.node,c.stream_ops=B.ops_table.link.stream):l.isChrdev(c.mode)&&(c.node_ops=B.ops_table.chrdev.node,c.stream_ops=B.ops_table.chrdev.stream),c.atime=c.mtime=c.ctime=Date.now(),e&&(e.contents[r]=c,e.atime=e.mtime=e.ctime=c.atime),c},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 o=e.contents?e.contents.length:0;if(!(o>=r)){var s=1024*1024;r=Math.max(r,o*(o<s?2:1.125)>>>0),o!=0&&(r=Math.max(r,256));var c=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(c.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var o=e.contents;e.contents=new Uint8Array(r),o&&e.contents.set(o.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=l.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,l.isDir(e.mode)?r.size=4096:l.isFile(e.mode)?r.size=e.usedBytes:l.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(const o of["mode","atime","mtime","ctime"])r[o]!=null&&(e[o]=r[o]);r.size!==void 0&&B.resizeFileStorage(e,r.size)},lookup(e,r){throw B.doesNotExistError},mknod(e,r,o,s){return B.createNode(e,r,o,s)},rename(e,r,o){var s;try{s=l.lookupNode(r,o)}catch{}if(s){if(l.isDir(e.mode))for(var c in s.contents)throw new l.ErrnoError(55);l.hashRemoveNode(s)}delete e.parent.contents[e.name],r.contents[o]=e,e.name=o,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 o=l.lookupNode(e,r);for(var s in o.contents)throw new l.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,r,o){var s=B.createNode(e,r,41471,0);return s.link=o,s},readlink(e){if(!l.isLink(e.mode))throw new l.ErrnoError(28);return e.link}},stream_ops:{read(e,r,o,s,c){var u=e.node.contents;if(c>=e.node.usedBytes)return 0;var f=Math.min(e.node.usedBytes-c,s);if(f>8&&u.subarray)r.set(u.subarray(c,c+f),o);else for(var T=0;T<f;T++)r[o+T]=u[c+T];return f},write(e,r,o,s,c,u){if(r.buffer===$.buffer&&(u=!1),!s)return 0;var f=e.node;if(f.mtime=f.ctime=Date.now(),r.subarray&&(!f.contents||f.contents.subarray)){if(u)return f.contents=r.subarray(o,o+s),f.usedBytes=s,s;if(f.usedBytes===0&&c===0)return f.contents=r.slice(o,o+s),f.usedBytes=s,s;if(c+s<=f.usedBytes)return f.contents.set(r.subarray(o,o+s),c),s}if(B.expandFileStorage(f,c+s),f.contents.subarray&&r.subarray)f.contents.set(r.subarray(o,o+s),c);else for(var T=0;T<s;T++)f.contents[c+T]=r[o+T];return f.usedBytes=Math.max(f.usedBytes,c+s),s},llseek(e,r,o){var s=r;if(o===1?s+=e.position:o===2&&l.isFile(e.node.mode)&&(s+=e.node.usedBytes),s<0)throw new l.ErrnoError(28);return s},allocate(e,r,o){B.expandFileStorage(e.node,r+o),e.node.usedBytes=Math.max(e.node.usedBytes,r+o)},mmap(e,r,o,s,c){if(!l.isFile(e.node.mode))throw new l.ErrnoError(43);var u,f,T=e.node.contents;if(!(c&2)&&T&&T.buffer===$.buffer)f=!1,u=T.byteOffset;else{if(f=!0,u=ie(),!u)throw new l.ErrnoError(48);T&&((o>0||o+r<T.length)&&(T.subarray?T=T.subarray(o,o+r):T=Array.prototype.slice.call(T,o,o+r)),$.set(T,u>>>0))}return{ptr:u,allocated:f}},msync(e,r,o,s,c){return B.stream_ops.write(e,r,0,s,o,!1),0}}},He=async e=>{var r=await w(e);return new Uint8Array(r)},Ve=(e,r,o,s,c,u)=>{l.createDataFile(e,r,o,s,c,u)},Xe=n.preloadPlugins||[],an=(e,r,o,s)=>{typeof Browser<"u"&&Browser.init();var c=!1;return Xe.forEach(u=>{c||u.canHandle(r)&&(u.handle(e,r,o,s),c=!0)}),c},on=(e,r,o,s,c,u,f,T,y,C)=>{var D=r?It.resolve(J.join2(e,r)):e;function N(O){function G(b){C==null||C(),T||Ve(e,r,b,s,c,y),u==null||u(),Q()}an(O,D,G,()=>{f==null||f(),Q()})||G(O)}$t(),typeof o=="string"?He(o).then(N,f):N(o)},sn=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},o=r[e];if(typeof o>"u")throw new Error(`Unknown file open mode: ${e}`);return o},xe=(e,r)=>{var o=0;return e&&(o|=365),r&&(o|=146),o},l={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(e){Yt(this,"name","ErrnoError");this.errno=e}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){Yt(this,"shared",{})}get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,r,o,s){Yt(this,"node_ops",{});Yt(this,"stream_ops",{});Yt(this,"readMode",365);Yt(this,"writeMode",146);Yt(this,"mounted",null);e||(e=this),this.parent=e,this.mount=e.mount,this.id=l.nextInode++,this.name=r,this.mode=o,this.rdev=s,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 l.isDir(this.mode)}get isDevice(){return l.isChrdev(this.mode)}},lookupPath(e,r={}){if(!e)throw new l.ErrnoError(44);r.follow_mount??(r.follow_mount=!0),J.isAbs(e)||(e=l.cwd()+"/"+e);t:for(var o=0;o<40;o++){for(var s=e.split("/").filter(C=>!!C),c=l.root,u="/",f=0;f<s.length;f++){var T=f===s.length-1;if(T&&r.parent)break;if(s[f]!=="."){if(s[f]===".."){u=J.dirname(u),c=c.parent;continue}u=J.join2(u,s[f]);try{c=l.lookupNode(c,s[f])}catch(C){if((C==null?void 0:C.errno)===44&&T&&r.noent_okay)return{path:u};throw C}if(l.isMountpoint(c)&&(!T||r.follow_mount)&&(c=c.mounted.root),l.isLink(c.mode)&&(!T||r.follow)){if(!c.node_ops.readlink)throw new l.ErrnoError(52);var y=c.node_ops.readlink(c);J.isAbs(y)||(y=J.dirname(u)+"/"+y),e=y+"/"+s.slice(f+1).join("/");continue t}}}return{path:u,node:c}}throw new l.ErrnoError(32)},getPath(e){for(var r;;){if(l.isRoot(e)){var o=e.mount.mountpoint;return r?o[o.length-1]!=="/"?`${o}/${r}`:o+r:o}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var o=0,s=0;s<r.length;s++)o=(o<<5)-o+r.charCodeAt(s)|0;return(e+o>>>0)%l.nameTable.length},hashAddNode(e){var r=l.hashName(e.parent.id,e.name);e.name_next=l.nameTable[r],l.nameTable[r]=e},hashRemoveNode(e){var r=l.hashName(e.parent.id,e.name);if(l.nameTable[r]===e)l.nameTable[r]=e.name_next;else for(var o=l.nameTable[r];o;){if(o.name_next===e){o.name_next=e.name_next;break}o=o.name_next}},lookupNode(e,r){var o=l.mayLookup(e);if(o)throw new l.ErrnoError(o);for(var s=l.hashName(e.id,r),c=l.nameTable[s];c;c=c.name_next){var u=c.name;if(c.parent.id===e.id&&u===r)return c}return l.lookup(e,r)},createNode(e,r,o,s){var c=new l.FSNode(e,r,o,s);return l.hashAddNode(c),c},destroyNode(e){l.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 l.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(!l.isDir(e.mode))return 54;var r=l.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!l.isDir(e.mode))return 54;try{var o=l.lookupNode(e,r);return 20}catch{}return l.nodePermissions(e,"wx")},mayDelete(e,r,o){var s;try{s=l.lookupNode(e,r)}catch(u){return u.errno}var c=l.nodePermissions(e,"wx");if(c)return c;if(o){if(!l.isDir(s.mode))return 54;if(l.isRoot(s)||l.getPath(s)===l.cwd())return 10}else if(l.isDir(s.mode))return 31;return 0},mayOpen(e,r){return e?l.isLink(e.mode)?32:l.isDir(e.mode)&&(l.flagsToPermissionString(r)!=="r"||r&576)?31:l.nodePermissions(e,l.flagsToPermissionString(r)):44},checkOpExists(e,r){if(!e)throw new l.ErrnoError(r);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=l.MAX_OPEN_FDS;e++)if(!l.streams[e])return e;throw new l.ErrnoError(33)},getStreamChecked(e){var r=l.getStream(e);if(!r)throw new l.ErrnoError(8);return r},getStream:e=>l.streams[e],createStream(e,r=-1){return e=Object.assign(new l.FSStream,e),r==-1&&(r=l.nextfd()),e.fd=r,l.streams[r]=e,e},closeStream(e){l.streams[e]=null},dupStream(e,r=-1){var s,c;var o=l.createStream(e,r);return(c=(s=o.stream_ops)==null?void 0:s.dup)==null||c.call(s,o),o},doSetAttr(e,r,o){var s=e==null?void 0:e.stream_ops.setattr,c=s?e:r;s??(s=r.node_ops.setattr),l.checkOpExists(s,63),s(c,o)},chrdev_stream_ops:{open(e){var o,s;var r=l.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,(s=(o=e.stream_ops).open)==null||s.call(o,e)},llseek(){throw new l.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){l.devices[e]={stream_ops:r}},getDevice:e=>l.devices[e],getMounts(e){for(var r=[],o=[e];o.length;){var s=o.pop();r.push(s),o.push(...s.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),l.syncFSRequests++,l.syncFSRequests>1&&x(`warning: ${l.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var o=l.getMounts(l.root.mount),s=0;function c(f){return l.syncFSRequests--,r(f)}function u(f){if(f)return u.errored?void 0:(u.errored=!0,c(f));++s>=o.length&&c(null)}o.forEach(f=>{if(!f.type.syncfs)return u(null);f.type.syncfs(f,e,u)})},mount(e,r,o){var s=o==="/",c=!o,u;if(s&&l.root)throw new l.ErrnoError(10);if(!s&&!c){var f=l.lookupPath(o,{follow_mount:!1});if(o=f.path,u=f.node,l.isMountpoint(u))throw new l.ErrnoError(10);if(!l.isDir(u.mode))throw new l.ErrnoError(54)}var T={type:e,opts:r,mountpoint:o,mounts:[]},y=e.mount(T);return y.mount=T,T.root=y,s?l.root=y:u&&(u.mounted=T,u.mount&&u.mount.mounts.push(T)),y},unmount(e){var r=l.lookupPath(e,{follow_mount:!1});if(!l.isMountpoint(r.node))throw new l.ErrnoError(28);var o=r.node,s=o.mounted,c=l.getMounts(s);Object.keys(l.nameTable).forEach(f=>{for(var T=l.nameTable[f];T;){var y=T.name_next;c.includes(T.mount)&&l.destroyNode(T),T=y}}),o.mounted=null;var u=o.mount.mounts.indexOf(s);o.mount.mounts.splice(u,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,o){var s=l.lookupPath(e,{parent:!0}),c=s.node,u=J.basename(e);if(!u)throw new l.ErrnoError(28);if(u==="."||u==="..")throw new l.ErrnoError(20);var f=l.mayCreate(c,u);if(f)throw new l.ErrnoError(f);if(!c.node_ops.mknod)throw new l.ErrnoError(63);return c.node_ops.mknod(c,u,r,o)},statfs(e){return l.statfsNode(l.lookupPath(e,{follow:!0}).node)},statfsStream(e){return l.statfsNode(e.node)},statfsNode(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:l.nextInode,ffree:l.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(r,e.node_ops.statfs(e.mount.opts.root)),r},create(e,r=438){return r&=4095,r|=32768,l.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,l.mknod(e,r,0)},mkdirTree(e,r){for(var o=e.split("/"),s="",c=0;c<o.length;++c)if(o[c]){s+="/"+o[c];try{l.mkdir(s,r)}catch(u){if(u.errno!=20)throw u}}},mkdev(e,r,o){return typeof o>"u"&&(o=r,r=438),r|=8192,l.mknod(e,r,o)},symlink(e,r){if(!It.resolve(e))throw new l.ErrnoError(44);var o=l.lookupPath(r,{parent:!0}),s=o.node;if(!s)throw new l.ErrnoError(44);var c=J.basename(r),u=l.mayCreate(s,c);if(u)throw new l.ErrnoError(u);if(!s.node_ops.symlink)throw new l.ErrnoError(63);return s.node_ops.symlink(s,c,e)},rename(e,r){var o=J.dirname(e),s=J.dirname(r),c=J.basename(e),u=J.basename(r),f,T,y;if(f=l.lookupPath(e,{parent:!0}),T=f.node,f=l.lookupPath(r,{parent:!0}),y=f.node,!T||!y)throw new l.ErrnoError(44);if(T.mount!==y.mount)throw new l.ErrnoError(75);var C=l.lookupNode(T,c),D=It.relative(e,s);if(D.charAt(0)!==".")throw new l.ErrnoError(28);if(D=It.relative(r,o),D.charAt(0)!==".")throw new l.ErrnoError(55);var N;try{N=l.lookupNode(y,u)}catch{}if(C!==N){var O=l.isDir(C.mode),G=l.mayDelete(T,c,O);if(G)throw new l.ErrnoError(G);if(G=N?l.mayDelete(y,u,O):l.mayCreate(y,u),G)throw new l.ErrnoError(G);if(!T.node_ops.rename)throw new l.ErrnoError(63);if(l.isMountpoint(C)||N&&l.isMountpoint(N))throw new l.ErrnoError(10);if(y!==T&&(G=l.nodePermissions(T,"w"),G))throw new l.ErrnoError(G);l.hashRemoveNode(C);try{T.node_ops.rename(C,y,u),C.parent=y}catch(b){throw b}finally{l.hashAddNode(C)}}},rmdir(e){var r=l.lookupPath(e,{parent:!0}),o=r.node,s=J.basename(e),c=l.lookupNode(o,s),u=l.mayDelete(o,s,!0);if(u)throw new l.ErrnoError(u);if(!o.node_ops.rmdir)throw new l.ErrnoError(63);if(l.isMountpoint(c))throw new l.ErrnoError(10);o.node_ops.rmdir(o,s),l.destroyNode(c)},readdir(e){var r=l.lookupPath(e,{follow:!0}),o=r.node,s=l.checkOpExists(o.node_ops.readdir,54);return s(o)},unlink(e){var r=l.lookupPath(e,{parent:!0}),o=r.node;if(!o)throw new l.ErrnoError(44);var s=J.basename(e),c=l.lookupNode(o,s),u=l.mayDelete(o,s,!1);if(u)throw new l.ErrnoError(u);if(!o.node_ops.unlink)throw new l.ErrnoError(63);if(l.isMountpoint(c))throw new l.ErrnoError(10);o.node_ops.unlink(o,s),l.destroyNode(c)},readlink(e){var r=l.lookupPath(e),o=r.node;if(!o)throw new l.ErrnoError(44);if(!o.node_ops.readlink)throw new l.ErrnoError(28);return o.node_ops.readlink(o)},stat(e,r){var o=l.lookupPath(e,{follow:!r}),s=o.node,c=l.checkOpExists(s.node_ops.getattr,63);return c(s)},fstat(e){var r=l.getStreamChecked(e),o=r.node,s=r.stream_ops.getattr,c=s?r:o;return s??(s=o.node_ops.getattr),l.checkOpExists(s,63),s(c)},lstat(e){return l.stat(e,!0)},doChmod(e,r,o,s){l.doSetAttr(e,r,{mode:o&4095|r.mode&-4096,ctime:Date.now(),dontFollow:s})},chmod(e,r,o){var s;if(typeof e=="string"){var c=l.lookupPath(e,{follow:!o});s=c.node}else s=e;l.doChmod(null,s,r,o)},lchmod(e,r){l.chmod(e,r,!0)},fchmod(e,r){var o=l.getStreamChecked(e);l.doChmod(o,o.node,r,!1)},doChown(e,r,o){l.doSetAttr(e,r,{timestamp:Date.now(),dontFollow:o})},chown(e,r,o,s){var c;if(typeof e=="string"){var u=l.lookupPath(e,{follow:!s});c=u.node}else c=e;l.doChown(null,c,s)},lchown(e,r,o){l.chown(e,r,o,!0)},fchown(e,r,o){var s=l.getStreamChecked(e);l.doChown(s,s.node,!1)},doTruncate(e,r,o){if(l.isDir(r.mode))throw new l.ErrnoError(31);if(!l.isFile(r.mode))throw new l.ErrnoError(28);var s=l.nodePermissions(r,"w");if(s)throw new l.ErrnoError(s);l.doSetAttr(e,r,{size:o,timestamp:Date.now()})},truncate(e,r){if(r<0)throw new l.ErrnoError(28);var o;if(typeof e=="string"){var s=l.lookupPath(e,{follow:!0});o=s.node}else o=e;l.doTruncate(null,o,r)},ftruncate(e,r){var o=l.getStreamChecked(e);if(r<0||(o.flags&2097155)===0)throw new l.ErrnoError(28);l.doTruncate(o,o.node,r)},utime(e,r,o){var s=l.lookupPath(e,{follow:!0}),c=s.node,u=l.checkOpExists(c.node_ops.setattr,63);u(c,{atime:r,mtime:o})},open(e,r,o=438){if(e==="")throw new l.ErrnoError(44);r=typeof r=="string"?sn(r):r,r&64?o=o&4095|32768:o=0;var s,c;if(typeof e=="object")s=e;else{c=e.endsWith("/");var u=l.lookupPath(e,{follow:!(r&131072),noent_okay:!0});s=u.node,e=u.path}var f=!1;if(r&64)if(s){if(r&128)throw new l.ErrnoError(20)}else{if(c)throw new l.ErrnoError(31);s=l.mknod(e,o|511,0),f=!0}if(!s)throw new l.ErrnoError(44);if(l.isChrdev(s.mode)&&(r&=-513),r&65536&&!l.isDir(s.mode))throw new l.ErrnoError(54);if(!f){var T=l.mayOpen(s,r);if(T)throw new l.ErrnoError(T)}r&512&&!f&&l.truncate(s,0),r&=-131713;var y=l.createStream({node:s,path:l.getPath(s),flags:r,seekable:!0,position:0,stream_ops:s.stream_ops,ungotten:[],error:!1});return y.stream_ops.open&&y.stream_ops.open(y),f&&l.chmod(s,o&511),n.logReadFiles&&!(r&1)&&(e in l.readFiles||(l.readFiles[e]=1)),y},close(e){if(l.isClosed(e))throw new l.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{l.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,o){if(l.isClosed(e))throw new l.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new l.ErrnoError(70);if(o!=0&&o!=1&&o!=2)throw new l.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,o),e.ungotten=[],e.position},read(e,r,o,s,c){if(s<0||c<0)throw new l.ErrnoError(28);if(l.isClosed(e))throw new l.ErrnoError(8);if((e.flags&2097155)===1)throw new l.ErrnoError(8);if(l.isDir(e.node.mode))throw new l.ErrnoError(31);if(!e.stream_ops.read)throw new l.ErrnoError(28);var u=typeof c<"u";if(!u)c=e.position;else if(!e.seekable)throw new l.ErrnoError(70);var f=e.stream_ops.read(e,r,o,s,c);return u||(e.position+=f),f},write(e,r,o,s,c,u){if(s<0||c<0)throw new l.ErrnoError(28);if(l.isClosed(e))throw new l.ErrnoError(8);if((e.flags&2097155)===0)throw new l.ErrnoError(8);if(l.isDir(e.node.mode))throw new l.ErrnoError(31);if(!e.stream_ops.write)throw new l.ErrnoError(28);e.seekable&&e.flags&1024&&l.llseek(e,0,2);var f=typeof c<"u";if(!f)c=e.position;else if(!e.seekable)throw new l.ErrnoError(70);var T=e.stream_ops.write(e,r,o,s,c,u);return f||(e.position+=T),T},allocate(e,r,o){if(l.isClosed(e))throw new l.ErrnoError(8);if(r<0||o<=0)throw new l.ErrnoError(28);if((e.flags&2097155)===0)throw new l.ErrnoError(8);if(!l.isFile(e.node.mode)&&!l.isDir(e.node.mode))throw new l.ErrnoError(43);if(!e.stream_ops.allocate)throw new l.ErrnoError(138);e.stream_ops.allocate(e,r,o)},mmap(e,r,o,s,c){if((s&2)!==0&&(c&2)===0&&(e.flags&2097155)!==2)throw new l.ErrnoError(2);if((e.flags&2097155)===1)throw new l.ErrnoError(2);if(!e.stream_ops.mmap)throw new l.ErrnoError(43);if(!r)throw new l.ErrnoError(28);return e.stream_ops.mmap(e,r,o,s,c)},msync(e,r,o,s,c){return e.stream_ops.msync?e.stream_ops.msync(e,r,o,s,c):0},ioctl(e,r,o){if(!e.stream_ops.ioctl)throw new l.ErrnoError(59);return e.stream_ops.ioctl(e,r,o)},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 o,s=l.open(e,r.flags),c=l.stat(e),u=c.size,f=new Uint8Array(u);return l.read(s,f,0,u,0),r.encoding==="utf8"?o=mt(f):r.encoding==="binary"&&(o=f),l.close(s),o},writeFile(e,r,o={}){o.flags=o.flags||577;var s=l.open(e,o.flags,o.mode);if(typeof r=="string"){var c=new Uint8Array(St(r)+1),u=Xt(r,c,0,c.length);l.write(s,c,0,u,void 0,o.canOwn)}else if(ArrayBuffer.isView(r))l.write(s,r,0,r.byteLength,void 0,o.canOwn);else throw new Error("Unsupported data type");l.close(s)},cwd:()=>l.currentPath,chdir(e){var r=l.lookupPath(e,{follow:!0});if(r.node===null)throw new l.ErrnoError(44);if(!l.isDir(r.node.mode))throw new l.ErrnoError(54);var o=l.nodePermissions(r.node,"x");if(o)throw new l.ErrnoError(o);l.currentPath=r.path},createDefaultDirectories(){l.mkdir("/tmp"),l.mkdir("/home"),l.mkdir("/home/web_user")},createDefaultDevices(){l.mkdir("/dev"),l.registerDevice(l.makedev(1,3),{read:()=>0,write:(s,c,u,f,T)=>f,llseek:()=>0}),l.mkdev("/dev/null",l.makedev(1,3)),gt.register(l.makedev(5,0),gt.default_tty_ops),gt.register(l.makedev(6,0),gt.default_tty1_ops),l.mkdev("/dev/tty",l.makedev(5,0)),l.mkdev("/dev/tty1",l.makedev(6,0));var e=new Uint8Array(1024),r=0,o=()=>(r===0&&(Ht(e),r=e.byteLength),e[--r]);l.createDevice("/dev","random",o),l.createDevice("/dev","urandom",o),l.mkdir("/dev/shm"),l.mkdir("/dev/shm/tmp")},createSpecialDirectories(){l.mkdir("/proc");var e=l.mkdir("/proc/self");l.mkdir("/proc/self/fd"),l.mount({mount(){var r=l.createNode(e,"fd",16895,73);return r.stream_ops={llseek:B.stream_ops.llseek},r.node_ops={lookup(o,s){var c=+s,u=l.getStreamChecked(c),f={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>u.path},id:c+1};return f.parent=f,f},readdir(){return Array.from(l.streams.entries()).filter(([o,s])=>s).map(([o,s])=>o.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,o){e?l.createDevice("/dev","stdin",e):l.symlink("/dev/tty","/dev/stdin"),r?l.createDevice("/dev","stdout",null,r):l.symlink("/dev/tty","/dev/stdout"),o?l.createDevice("/dev","stderr",null,o):l.symlink("/dev/tty1","/dev/stderr"),l.open("/dev/stdin",0),l.open("/dev/stdout",1),l.open("/dev/stderr",1)},staticInit(){l.nameTable=new Array(4096),l.mount(B,{},"/"),l.createDefaultDirectories(),l.createDefaultDevices(),l.createSpecialDirectories(),l.filesystems={MEMFS:B}},init(e,r,o){l.initialized=!0,e??(e=n.stdin),r??(r=n.stdout),o??(o=n.stderr),l.createStandardStreams(e,r,o)},quit(){l.initialized=!1;for(var e=0;e<l.streams.length;e++){var r=l.streams[e];r&&l.close(r)}},findObject(e,r){var o=l.analyzePath(e,r);return o.exists?o.object:null},analyzePath(e,r){try{var o=l.lookupPath(e,{follow:!r});e=o.path}catch{}var s={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var o=l.lookupPath(e,{parent:!0});s.parentExists=!0,s.parentPath=o.path,s.parentObject=o.node,s.name=J.basename(e),o=l.lookupPath(e,{follow:!r}),s.exists=!0,s.path=o.path,s.object=o.node,s.name=o.node.name,s.isRoot=o.path==="/"}catch(c){s.error=c.errno}return s},createPath(e,r,o,s){e=typeof e=="string"?e:l.getPath(e);for(var c=r.split("/").reverse();c.length;){var u=c.pop();if(u){var f=J.join2(e,u);try{l.mkdir(f)}catch{}e=f}}return f},createFile(e,r,o,s,c){var u=J.join2(typeof e=="string"?e:l.getPath(e),r),f=xe(s,c);return l.create(u,f)},createDataFile(e,r,o,s,c,u){var f=r;e&&(e=typeof e=="string"?e:l.getPath(e),f=r?J.join2(e,r):e);var T=xe(s,c),y=l.create(f,T);if(o){if(typeof o=="string"){for(var C=new Array(o.length),D=0,N=o.length;D<N;++D)C[D]=o.charCodeAt(D);o=C}l.chmod(y,T|146);var O=l.open(y,577);l.write(O,o,0,o.length,0,u),l.close(O),l.chmod(y,T)}},createDevice(e,r,o,s){var T;var c=J.join2(typeof e=="string"?e:l.getPath(e),r),u=xe(!!o,!!s);(T=l.createDevice).major??(T.major=64);var f=l.makedev(l.createDevice.major++,0);return l.registerDevice(f,{open(y){y.seekable=!1},close(y){var C;(C=s==null?void 0:s.buffer)!=null&&C.length&&s(10)},read(y,C,D,N,O){for(var G=0,b=0;b<N;b++){var z;try{z=o()}catch{throw new l.ErrnoError(29)}if(z===void 0&&G===0)throw new l.ErrnoError(6);if(z==null)break;G++,C[D+b]=z}return G&&(y.node.atime=Date.now()),G},write(y,C,D,N,O){for(var G=0;G<N;G++)try{s(C[D+G])}catch{throw new l.ErrnoError(29)}return N&&(y.node.mtime=y.node.ctime=Date.now()),G}}),l.mkdev(c,u,f)},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=m(e.url),e.usedBytes=e.contents.length}catch{throw new l.ErrnoError(29)}},createLazyFile(e,r,o,s,c){class u{constructor(){Yt(this,"lengthKnown",!1);Yt(this,"chunks",[])}get(G){if(!(G>this.length-1||G<0)){var b=G%this.chunkSize,z=G/this.chunkSize|0;return this.getter(z)[b]}}setDataGetter(G){this.getter=G}cacheLength(){var G=new XMLHttpRequest;if(G.open("HEAD",o,!1),G.send(null),!(G.status>=200&&G.status<300||G.status===304))throw new Error("Couldn't load "+o+". Status: "+G.status);var b=Number(G.getResponseHeader("Content-length")),z,_t=(z=G.getResponseHeader("Accept-Ranges"))&&z==="bytes",rt=(z=G.getResponseHeader("Content-Encoding"))&&z==="gzip",dt=1024*1024;_t||(dt=b);var tt=(ut,Bt)=>{if(ut>Bt)throw new Error("invalid range ("+ut+", "+Bt+") or no bytes requested!");if(Bt>b-1)throw new Error("only "+b+" bytes available! programmer error!");var at=new XMLHttpRequest;if(at.open("GET",o,!1),b!==dt&&at.setRequestHeader("Range","bytes="+ut+"-"+Bt),at.responseType="arraybuffer",at.overrideMimeType&&at.overrideMimeType("text/plain; charset=x-user-defined"),at.send(null),!(at.status>=200&&at.status<300||at.status===304))throw new Error("Couldn't load "+o+". Status: "+at.status);return at.response!==void 0?new Uint8Array(at.response||[]):oe(at.responseText||"")},Ee=this;Ee.setDataGetter(ut=>{var Bt=ut*dt,at=(ut+1)*dt-1;if(at=Math.min(at,b-1),typeof Ee.chunks[ut]>"u"&&(Ee.chunks[ut]=tt(Bt,at)),typeof Ee.chunks[ut]>"u")throw new Error("doXHR failed!");return Ee.chunks[ut]}),(rt||!b)&&(dt=b=1,b=this.getter(0).length,dt=b,M("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=b,this._chunkSize=dt,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(!g)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var f=new u,T={isDevice:!1,contents:f}}else var T={isDevice:!1,url:o};var y=l.createFile(e,r,T,s,c);T.contents?y.contents=T.contents:T.url&&(y.contents=null,y.url=T.url),Object.defineProperties(y,{usedBytes:{get:function(){return this.contents.length}}});var C={},D=Object.keys(y.stream_ops);D.forEach(O=>{var G=y.stream_ops[O];C[O]=(...b)=>(l.forceLoadFile(y),G(...b))});function N(O,G,b,z,_t){var rt=O.node.contents;if(_t>=rt.length)return 0;var dt=Math.min(rt.length-_t,z);if(rt.slice)for(var tt=0;tt<dt;tt++)G[b+tt]=rt[_t+tt];else for(var tt=0;tt<dt;tt++)G[b+tt]=rt.get(_t+tt);return dt}return C.read=(O,G,b,z,_t)=>(l.forceLoadFile(y),N(O,G,b,z,_t)),C.mmap=(O,G,b,z,_t)=>{l.forceLoadFile(y);var rt=ie();if(!rt)throw new l.ErrnoError(48);return N(O,$,rt,G,b),{ptr:rt,allocated:!0}},y.stream_ops=C,y}},xt=(e,r)=>(e>>>=0,e?mt(Z,e,r):""),F={DEFAULT_POLLMASK:5,calculateAt(e,r,o){if(J.isAbs(r))return r;var s;if(e===-100)s=l.cwd();else{var c=F.getStreamFromFD(e);s=c.path}if(r.length==0){if(!o)throw new l.ErrnoError(44);return s}return s+"/"+r},writeStat(e,r){Y[e>>>2>>>0]=r.dev,Y[e+4>>>2>>>0]=r.mode,U[e+8>>>2>>>0]=r.nlink,Y[e+12>>>2>>>0]=r.uid,Y[e+16>>>2>>>0]=r.gid,Y[e+20>>>2>>>0]=r.rdev,st[e+24>>>3]=BigInt(r.size),Y[e+32>>>2>>>0]=4096,Y[e+36>>>2>>>0]=r.blocks;var o=r.atime.getTime(),s=r.mtime.getTime(),c=r.ctime.getTime();return st[e+40>>>3]=BigInt(Math.floor(o/1e3)),U[e+48>>>2>>>0]=o%1e3*1e3*1e3,st[e+56>>>3]=BigInt(Math.floor(s/1e3)),U[e+64>>>2>>>0]=s%1e3*1e3*1e3,st[e+72>>>3]=BigInt(Math.floor(c/1e3)),U[e+80>>>2>>>0]=c%1e3*1e3*1e3,st[e+88>>>3]=BigInt(r.ino),0},writeStatFs(e,r){Y[e+4>>>2>>>0]=r.bsize,Y[e+40>>>2>>>0]=r.bsize,Y[e+8>>>2>>>0]=r.blocks,Y[e+12>>>2>>>0]=r.bfree,Y[e+16>>>2>>>0]=r.bavail,Y[e+20>>>2>>>0]=r.files,Y[e+24>>>2>>>0]=r.ffree,Y[e+28>>>2>>>0]=r.fsid,Y[e+44>>>2>>>0]=r.flags,Y[e+36>>>2>>>0]=r.namelen},doMsync(e,r,o,s,c){if(!l.isFile(r.node.mode))throw new l.ErrnoError(43);if(s&2)return 0;var u=Z.slice(e,e+o);l.msync(r,u,c,o,s)},getStreamFromFD(e){var r=l.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=xt(e);return r}};function j(e,r,o){o>>>=0,F.varargs=o;try{var s=F.getStreamFromFD(e);switch(r){case 0:{var c=Mt();if(c<0)return-28;for(;l.streams[c];)c++;var u;return u=l.dupStream(s,c),u.fd}case 1:case 2:return 0;case 3:return s.flags;case 4:{var c=Mt();return s.flags|=c,0}case 12:{var c=vt(),f=0;return nt[c+f>>>1>>>0]=2,0}case 13:case 14:return 0}return-28}catch(T){if(typeof l>"u"||T.name!=="ErrnoError")throw T;return-T.errno}}function Kt(e,r){r>>>=0;try{return F.writeStat(r,l.fstat(e))}catch(o){if(typeof l>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Ke(e,r,o){o>>>=0,F.varargs=o;try{var s=F.getStreamFromFD(e);switch(r){case 21509:return s.tty?0:-59;case 21505:{if(!s.tty)return-59;if(s.tty.ops.ioctl_tcgets){var c=s.tty.ops.ioctl_tcgets(s),u=vt();Y[u>>>2>>>0]=c.c_iflag||0,Y[u+4>>>2>>>0]=c.c_oflag||0,Y[u+8>>>2>>>0]=c.c_cflag||0,Y[u+12>>>2>>>0]=c.c_lflag||0;for(var f=0;f<32;f++)$[u+f+17>>>0]=c.c_cc[f]||0;return 0}return 0}case 21510:case 21511:case 21512:return s.tty?0:-59;case 21506:case 21507:case 21508:{if(!s.tty)return-59;if(s.tty.ops.ioctl_tcsets){for(var u=vt(),T=Y[u>>>2>>>0],y=Y[u+4>>>2>>>0],C=Y[u+8>>>2>>>0],D=Y[u+12>>>2>>>0],N=[],f=0;f<32;f++)N.push($[u+f+17>>>0]);return s.tty.ops.ioctl_tcsets(s.tty,r,{c_iflag:T,c_oflag:y,c_cflag:C,c_lflag:D,c_cc:N})}return 0}case 21519:{if(!s.tty)return-59;var u=vt();return Y[u>>>2>>>0]=0,0}case 21520:return s.tty?-28:-59;case 21531:{var u=vt();return l.ioctl(s,r,u)}case 21523:{if(!s.tty)return-59;if(s.tty.ops.ioctl_tiocgwinsz){var O=s.tty.ops.ioctl_tiocgwinsz(s.tty),u=vt();nt[u>>>1>>>0]=O[0],nt[u+2>>>1>>>0]=O[1]}return 0}case 21524:return s.tty?0:-59;case 21515:return s.tty?0:-59;default:return-28}}catch(G){if(typeof l>"u"||G.name!=="ErrnoError")throw G;return-G.errno}}function _n(e,r){e>>>=0,r>>>=0;try{return e=F.getStr(e),F.writeStat(r,l.lstat(e))}catch(o){if(typeof l>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function dn(e,r,o,s){r>>>=0,o>>>=0;try{r=F.getStr(r);var c=s&256,u=s&4096;return s=s&-6401,r=F.calculateAt(e,r,u),F.writeStat(o,c?l.lstat(r):l.stat(r))}catch(f){if(typeof l>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function be(e,r,o,s){r>>>=0,s>>>=0,F.varargs=s;try{r=F.getStr(r),r=F.calculateAt(e,r);var c=s?Mt():0;return l.open(r,o,c).fd}catch(u){if(typeof l>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function ln(e,r){e>>>=0,r>>>=0;try{return e=F.getStr(e),F.writeStat(r,l.stat(e))}catch(o){if(typeof l>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var cn=()=>X(""),se=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},bt=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);wt=e},wt,ot=e=>{for(var r="",o=e;Z[o>>>0];)r+=wt[Z[o++>>>0]];return r},zt={},kt={},ve={},_e,H=e=>{throw new _e(e)},Ie,de=e=>{throw new Ie(e)},ze=(e,r,o)=>{e.forEach(T=>ve[T]=r);function s(T){var y=o(T);y.length!==e.length&&de("Mismatched type converter count");for(var C=0;C<e.length;++C)Ct(e[C],y[C])}var c=new Array(r.length),u=[],f=0;r.forEach((T,y)=>{kt.hasOwnProperty(T)?c[y]=kt[T]:(u.push(T),zt.hasOwnProperty(T)||(zt[T]=[]),zt[T].push(()=>{c[y]=kt[T],++f,f===u.length&&s(c)}))}),u.length===0&&s(c)};function gr(e,r,o={}){var s=r.name;if(e||H(`type "${s}" must have a positive integer typeid pointer`),kt.hasOwnProperty(e)){if(o.ignoreDuplicateRegistrations)return;H(`Cannot register type '${s}' twice`)}if(kt[e]=r,delete ve[e],zt.hasOwnProperty(e)){var c=zt[e];delete zt[e],c.forEach(u=>u())}}function Ct(e,r,o={}){return gr(e,r,o)}var Nn=(e,r,o)=>{switch(r){case 1:return o?s=>$[s>>>0]:s=>Z[s>>>0];case 2:return o?s=>nt[s>>>1>>>0]:s=>it[s>>>1>>>0];case 4:return o?s=>Y[s>>>2>>>0]:s=>U[s>>>2>>>0];case 8:return o?s=>st[s>>>3]:s=>Dt[s>>>3];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function Ar(e,r,o,s,c){e>>>=0,r>>>=0,o>>>=0,r=ot(r);var u=r.indexOf("u")!=-1;Ct(e,{name:r,fromWireType:f=>f,toWireType:function(f,T){if(typeof T!="bigint"&&typeof T!="number")throw new TypeError(`Cannot convert "${se(T)}" to ${this.name}`);return typeof T=="number"&&(T=BigInt(T)),T},argPackAdvance:Lt,readValueFromPointer:Nn(r,o,!u),destructorFunction:null})}var Lt=8;function Tr(e,r,o,s){e>>>=0,r>>>=0,r=ot(r),Ct(e,{name:r,fromWireType:function(c){return!!c},toWireType:function(c,u){return u?o:s},argPackAdvance:Lt,readValueFromPointer:function(c){return this.fromWireType(Z[c>>>0])},destructorFunction:null})}var Pr=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),En=e=>{function r(o){return o.$$.ptrType.registeredClass.name}H(r(e)+" instance already deleted")},un=!1,Gn=e=>{},yr=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},Wn=e=>{e.count.value-=1;var r=e.count.value===0;r&&yr(e)},Mn=(e,r,o)=>{if(r===o)return e;if(o.baseClass===void 0)return null;var s=Mn(e,r,o.baseClass);return s===null?null:o.downcast(s)},xn={},pr={},vr=(e,r)=>{for(r===void 0&&H("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},Ir=(e,r)=>(r=vr(e,r),pr[r]),Je=(e,r)=>{(!r.ptrType||!r.ptr)&&de("makeClassHandle requires ptr and ptrType");var o=!!r.smartPtrType,s=!!r.smartPtr;return o!==s&&de("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ke(Object.create(e,{$$:{value:r,writable:!0}}))};function mr(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var o=Ir(this.registeredClass,r);if(o!==void 0){if(o.$$.count.value===0)return o.$$.ptr=r,o.$$.smartPtr=e,o.clone();var s=o.clone();return this.destructor(e),s}function c(){return this.isSmartPointer?Je(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):Je(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),f=xn[u];if(!f)return c.call(this);var T;this.isConst?T=f.constPointerType:T=f.pointerType;var y=Mn(r,this.registeredClass,T.registeredClass);return y===null?c.call(this):this.isSmartPointer?Je(T.registeredClass.instancePrototype,{ptrType:T,ptr:y,smartPtrType:this,smartPtr:e}):Je(T.registeredClass.instancePrototype,{ptrType:T,ptr:y})}var ke=e=>typeof FinalizationRegistry>"u"?(ke=r=>r,e):(un=new FinalizationRegistry(r=>{Wn(r.$$)}),ke=r=>{var o=r.$$,s=!!o.smartPtr;if(s){var c={$$:o};un.register(r,c,r)}return r},Gn=r=>un.unregister(r),ke(e)),wr=()=>{Object.assign(Ze.prototype,{isAliasOf(e){if(!(this instanceof Ze)||!(e instanceof Ze))return!1;var r=this.$$.ptrType.registeredClass,o=this.$$.ptr;e.$$=e.$$;for(var s=e.$$.ptrType.registeredClass,c=e.$$.ptr;r.baseClass;)o=r.upcast(o),r=r.baseClass;for(;s.baseClass;)c=s.upcast(c),s=s.baseClass;return r===s&&o===c},clone(){if(this.$$.ptr||En(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=ke(Object.create(Object.getPrototypeOf(this),{$$:{value:Pr(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||En(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&H("Object already scheduled for deletion"),Gn(this),Wn(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||En(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&H("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}})};function Ze(){}var me=(e,r)=>Object.defineProperty(r,"name",{value:e}),Cr=(e,r,o)=>{if(e[r].overloadTable===void 0){var s=e[r];e[r]=function(...c){return e[r].overloadTable.hasOwnProperty(c.length)||H(`Function '${o}' called with an invalid number of arguments (${c.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[c.length].apply(this,c)},e[r].overloadTable=[],e[r].overloadTable[s.argCount]=s}},fn=(e,r,o)=>{n.hasOwnProperty(e)?((o===void 0||n[e].overloadTable!==void 0&&n[e].overloadTable[o]!==void 0)&&H(`Cannot register public name '${e}' twice`),Cr(n,e,e),n[e].overloadTable.hasOwnProperty(o)&&H(`Cannot register multiple overloads of a function with the same number of arguments (${o})!`),n[e].overloadTable[o]=r):(n[e]=r,n[e].argCount=o)},Dr=48,Rr=57,Sr=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Dr&&r<=Rr?`_${e}`:e};function Lr(e,r,o,s,c,u,f,T){this.name=e,this.constructor=r,this.instancePrototype=o,this.rawDestructor=s,this.baseClass=c,this.getActualType=u,this.upcast=f,this.downcast=T,this.pureVirtualFunctions=[]}var qe=(e,r,o)=>{for(;r!==o;)r.upcast||H(`Expected null or instance of ${o.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function Yr(e,r){if(r===null)return this.isReference&&H(`null is not a valid ${this.name}`),0;r.$$||H(`Cannot pass "${se(r)}" as a ${this.name}`),r.$$.ptr||H(`Cannot pass deleted object as a pointer of type ${this.name}`);var o=r.$$.ptrType.registeredClass,s=qe(r.$$.ptr,o,this.registeredClass);return s}function Nr(e,r){var o;if(r===null)return this.isReference&&H(`null is not a valid ${this.name}`),this.isSmartPointer?(o=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,o),o):0;(!r||!r.$$)&&H(`Cannot pass "${se(r)}" as a ${this.name}`),r.$$.ptr||H(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&H(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var s=r.$$.ptrType.registeredClass;if(o=qe(r.$$.ptr,s,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&H("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?o=r.$$.smartPtr:H(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:o=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)o=r.$$.smartPtr;else{var c=r.clone();o=this.rawShare(o,Et.toHandle(()=>c.delete())),e!==null&&e.push(this.rawDestructor,o)}break;default:H("Unsupporting sharing policy")}return o}function Gr(e,r){if(r===null)return this.isReference&&H(`null is not a valid ${this.name}`),0;r.$$||H(`Cannot pass "${se(r)}" as a ${this.name}`),r.$$.ptr||H(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&H(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var o=r.$$.ptrType.registeredClass,s=qe(r.$$.ptr,o,this.registeredClass);return s}function Qe(e){return this.fromWireType(U[e>>>2>>>0])}var Wr=()=>{Object.assign(je.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},argPackAdvance:Lt,readValueFromPointer:Qe,fromWireType:mr})};function je(e,r,o,s,c,u,f,T,y,C,D){this.name=e,this.registeredClass=r,this.isReference=o,this.isConst=s,this.isSmartPointer=c,this.pointeeType=u,this.sharingPolicy=f,this.rawGetPointee=T,this.rawConstructor=y,this.rawShare=C,this.rawDestructor=D,!c&&r.baseClass===void 0?s?(this.toWireType=Yr,this.destructorFunction=null):(this.toWireType=Gr,this.destructorFunction=null):this.toWireType=Nr}var bn=(e,r,o)=>{n.hasOwnProperty(e)||de("Replacing nonexistent public symbol"),n[e].overloadTable!==void 0&&o!==void 0?n[e].overloadTable[o]=r:(n[e]=r,n[e].argCount=o)},tn=[],kn,On=e=>{var r=tn[e];return r||(e>=tn.length&&(tn.length=e+1),tn[e]=r=kn.get(e)),r},Mr=(e,r,o=[])=>{var s=On(r)(...o);return e[0]=="p"?s>>>0:s},xr=(e,r)=>(...o)=>Mr(e,r,o),le=(e,r)=>{e=ot(e);function o(){return e.includes("p")?xr(e,r):On(r)}var s=o();return typeof s!="function"&&H(`unknown function pointer with signature ${e}: ${r}`),s},br=(e,r)=>{var o=me(r,function(s){this.name=r,this.message=s;var c=new Error(s).stack;c!==void 0&&(this.stack=this.toString()+`
|
|
3
3
|
`+c.replace(/^Error(:[^\n]*)?\n/,""))});return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,o.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},o},Bn,Fn=e=>{var r=Qa(e),o=ot(r);return Jt(r),o},en=(e,r)=>{var o=[],s={};function c(u){if(!s[u]&&!kt[u]){if(ve[u]){ve[u].forEach(c);return}o.push(u),s[u]=!0}}throw r.forEach(c),new Bn(`${e}: `+o.map(Fn).join([", "]))};function kr(e,r,o,s,c,u,f,T,y,C,D,N,O){e>>>=0,r>>>=0,o>>>=0,s>>>=0,c>>>=0,u>>>=0,f>>>=0,T>>>=0,y>>>=0,C>>>=0,D>>>=0,N>>>=0,O>>>=0,D=ot(D),u=le(c,u),T&&(T=le(f,T)),C&&(C=le(y,C)),O=le(N,O);var G=Sr(D);fn(G,function(){en(`Cannot construct ${D} due to unbound types`,[s])}),ze([e,r,o],s?[s]:[],b=>{var at;b=b[0];var z,_t;s?(z=b.registeredClass,_t=z.instancePrototype):_t=Ze.prototype;var rt=me(D,function(...vn){if(Object.getPrototypeOf(this)!==dt)throw new _e("Use 'new' to construct "+D);if(tt.constructor_body===void 0)throw new _e(D+" has no accessible constructor");var jn=tt.constructor_body[vn.length];if(jn===void 0)throw new _e(`Tried to invoke ctor of ${D} with invalid number of parameters (${vn.length}) - expected (${Object.keys(tt.constructor_body).toString()}) parameters instead!`);return jn.apply(this,vn)}),dt=Object.create(_t,{constructor:{value:rt}});rt.prototype=dt;var tt=new Lr(D,rt,dt,O,z,u,T,C);tt.baseClass&&((at=tt.baseClass).__derivedClasses??(at.__derivedClasses=[]),tt.baseClass.__derivedClasses.push(tt));var Ee=new je(D,tt,!0,!1,!1),ut=new je(D+"*",tt,!1,!1,!1),Bt=new je(D+" const*",tt,!1,!0,!1);return xn[e]={pointerType:ut,constPointerType:Bt},bn(G,rt),[Ee,ut,Bt]})}var hn=e=>{for(;e.length;){var r=e.pop(),o=e.pop();o(r)}},Un=(e,r,o)=>(e instanceof Object||H(`${o} with invalid "this": ${e}`),e instanceof r.registeredClass.constructor||H(`${o} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||H(`cannot call emscripten binding method ${o} on deleted object`),qe(e.$$.ptr,e.$$.ptrType.registeredClass,r.registeredClass)),Or=function(e,r,o,s,c,u,f,T,y,C){e>>>=0,r>>>=0,o>>>=0,s>>>=0,c>>>=0,u>>>=0,f>>>=0,T>>>=0,y>>>=0,C>>>=0,r=ot(r),c=le(s,c),ze([],[e],D=>{D=D[0];var N=`${D.name}.${r}`,O={get(){en(`Cannot access ${N} due to unbound types`,[o,f])},enumerable:!0,configurable:!0};return y?O.set=()=>en(`Cannot access ${N} due to unbound types`,[o,f]):O.set=G=>H(N+" is a read-only property"),Object.defineProperty(D.registeredClass.instancePrototype,r,O),ze([],y?[o,f]:[o],G=>{var b=G[0],z={get(){var rt=Un(this,D,N+" getter");return b.fromWireType(c(u,rt))},enumerable:!0};if(y){y=le(T,y);var _t=G[1];z.set=function(rt){var dt=Un(this,D,N+" setter"),tt=[];y(C,dt,_t.toWireType(tt,rt)),hn(tt)}}return Object.defineProperty(D.registeredClass.instancePrototype,r,z),[]}),[]})},gn=[],Ot=[];function An(e){e>>>=0,e>9&&--Ot[e+1]===0&&(Ot[e]=void 0,gn.push(e))}var Br=()=>Ot.length/2-5-gn.length,Fr=()=>{Ot.push(0,1,void 0,1,null,1,!0,1,!1,1),n.count_emval_handles=Br},Et={toValue:e=>(e||H("Cannot use deleted val. handle = "+e),Ot[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const r=gn.pop()||Ot.length;return Ot[r]=e,Ot[r+1]=1,r}}}},Ur={name:"emscripten::val",fromWireType:e=>{var r=Et.toValue(e);return An(e),r},toWireType:(e,r)=>Et.toHandle(r),argPackAdvance:Lt,readValueFromPointer:Qe,destructorFunction:null};function $r(e){return e>>>=0,Ct(e,Ur)}var Hr=(e,r,o)=>{switch(r){case 1:return o?function(s){return this.fromWireType($[s>>>0])}:function(s){return this.fromWireType(Z[s>>>0])};case 2:return o?function(s){return this.fromWireType(nt[s>>>1>>>0])}:function(s){return this.fromWireType(it[s>>>1>>>0])};case 4:return o?function(s){return this.fromWireType(Y[s>>>2>>>0])}:function(s){return this.fromWireType(U[s>>>2>>>0])};default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function Vr(e,r,o,s){e>>>=0,r>>>=0,o>>>=0,r=ot(r);function c(){}c.values={},Ct(e,{name:r,constructor:c,fromWireType:function(u){return this.constructor.values[u]},toWireType:(u,f)=>f.value,argPackAdvance:Lt,readValueFromPointer:Hr(r,o,s),destructorFunction:null}),fn(r,c)}var Tn=(e,r)=>{var o=kt[e];return o===void 0&&H(`${r} has unknown type ${Fn(e)}`),o};function Xr(e,r,o){e>>>=0,r>>>=0;var s=Tn(e,"enum");r=ot(r);var c=s.constructor,u=Object.create(s.constructor.prototype,{value:{value:o},constructor:{value:me(`${s.name}_${r}`,function(){})}});c.values[o]=u,c[r]=u}var Kr=(e,r)=>{switch(r){case 4:return function(o){return this.fromWireType(lt[o>>>2>>>0])};case 8:return function(o){return this.fromWireType(yt[o>>>3>>>0])};default:throw new TypeError(`invalid float width (${r}): ${e}`)}},zr=function(e,r,o){e>>>=0,r>>>=0,o>>>=0,r=ot(r),Ct(e,{name:r,fromWireType:s=>s,toWireType:(s,c)=>c,argPackAdvance:Lt,readValueFromPointer:Kr(r,o),destructorFunction:null})};function $n(e){for(var r=1;r<e.length;++r)if(e[r]!==null&&e[r].destructorFunction===void 0)return!0;return!1}function Hn(e,r){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var o=me(e.name||"unknownFunctionName",function(){});o.prototype=e.prototype;var s=new o,c=e.apply(s,r);return c instanceof Object?c:s}function Jr(e,r,o,s){for(var c=$n(e),u=e.length-2,f=[],T=["fn"],y=0;y<u;++y)f.push(`arg${y}`),T.push(`arg${y}Wired`);f=f.join(","),T=T.join(",");var C=`return function (${f}) {
|
|
4
4
|
`;c&&(C+=`var destructors = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mlightcad/libredwg-converter",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"vite": "^6.4.3",
|
|
42
|
-
"@mlightcad/data-model": "1.
|
|
42
|
+
"@mlightcad/data-model": "1.15.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@mlightcad/data-model": "1.
|
|
45
|
+
"@mlightcad/data-model": "1.15.0"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"analyze": "pnpm run analyze:lib && pnpm run analyze:worker",
|